Skip to content
This repository was archived by the owner on Dec 6, 2018. It is now read-only.

[WIP] Kinetis KE02 platform support #377

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fb77916
Skeleton for KE02 platform and NVIC IRQ names support
forGGe Feb 21, 2017
ecc2a56
KE02 platform files and architecture changes
forGGe Feb 21, 2017
304c985
ke02: stubs provided and application is built
forGGe Feb 22, 2017
b39645e
Fix bug with incorrect align of data section
forGGe Feb 26, 2017
754b31b
Add optional flag to disable newlib stubs from theCore
forGGe Feb 26, 2017
54ff307
Correct flags for M0+ architecture and update KE02 memory map
forGGe Feb 26, 2017
c884da0
Kinetis platform console and flash protect support
forGGe Mar 5, 2017
e68704f
Provide correct definitions for dynamic memory allocators
forGGe Mar 5, 2017
af587f8
Use libnano as std lib for M0+ MCU
forGGe Mar 6, 2017
349863a
Add watchdog preparation steps
forGGe Mar 24, 2017
def32ae
Merge remote-tracking branch 'origin/develop' into g230_kinetis_ke02_…
forGGe Apr 7, 2018
5ccd25a
ke02: move IRQ include file to standart place
forGGe Apr 7, 2018
e43a0e9
build_api: print more useful information for thirdparties
forGGe Apr 7, 2018
198ba29
ke02: freshen platform and related files
forGGe Apr 7, 2018
34e459a
various: clarify module dependencies
forGGe Apr 7, 2018
1e2c1ba
tm4c: include guard for irq.S
forGGe Apr 7, 2018
f627f2b
ke02: add stub example to perform kind-of-a-testing
forGGe Apr 7, 2018
15dbadc
ke02: gdbinit script for JLink
forGGe Apr 9, 2018
228f7fe
newlib: improve stubs to work with heap and bypass console
forGGe Apr 9, 2018
8647763
ke02: correct initialization and dependencies
forGGe Apr 9, 2018
186e9e9
ke02: update kexx_drv reference to include new fix
forGGe Apr 9, 2018
bbeef77
[wip - kinetis ke02 support]: Initial support for the platform:
iia Apr 29, 2018
97d1107
[wip - kinetis ke02 support]: Fix SystemCoreClock
iia Apr 30, 2018
42ab0bd
Merge branch 'develop' into g230_kinetis_ke02_exp_support
iia May 10, 2018
ea95e2d
ke02: Fix issues from initial review
iia May 10, 2018
43cef80
ke02: Fix UART config code generation issue. See, https://github.com/…
iia May 10, 2018
506295b
Fix system clock configuration trim and some cleanup
iia May 10, 2018
38e4b5d
common: fix dependency for console header
forGGe May 12, 2018
74e425e
Merge pull request #1 from forGGe/g230_build_fixes_for_377_pr
iia May 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# ASM is crucial
enable_language(ASM-ATT)
# Subproject may use tests
enable_testing()

# Obvious requirement
cmake_minimum_required(VERSION 3.4)
Expand Down Expand Up @@ -138,4 +136,4 @@ add_subdirectory(lib)
add_subdirectory(dev)
add_subdirectory(kernel)
add_dependencies(all_cppcheck ${PROJECT_NAME})
add_dependencies(${PROJECT_NAME} thecore_validate)
add_dependencies(${PROJECT_NAME} thecore_validate)
23 changes: 22 additions & 1 deletion arch/arm_cm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# ARM Cortex-M architecture
add_library(arch STATIC startup_arm_cm.S arch.cpp)
if(TARGET_MCU_ARCH MATCHES "^arm_cm0")
# Slightely different architecture used there
add_library(arch STATIC startup_arm_cm0.S arch.cpp)
else()
add_library(arch STATIC startup_arm_cm.S arch.cpp)
endif()

# By default CMake do not pass compile definitions to ASM files.
# Probably due to the fact that it depends on assembler used and some of the
# assemblers may not support preprocessing.
# This command forces use of gcc instead of as. It allows to pass compile definitions
set_source_files_properties(startup_arm_cm.S PROPERTIES LANGUAGE C)
set_source_files_properties(startup_arm_cm0.S PROPERTIES LANGUAGE C)

# ASM code requires some symbols present in outer libraries
target_link_libraries(arch PRIVATE sys)
Expand Down Expand Up @@ -54,6 +60,21 @@ if(NOT TARGET_PLATFORM_IS_NOT_CMSIS_COMPLIANT)
target_sources(arch PUBLIC ${CMAKE_CURRENT_LIST_DIR}/execution.cpp)
endif()

# Custom stack size
if(TARGET_STACK_SIZE)
target_compile_definitions(arch PRIVATE -D__STACK_SIZE=${TARGET_STACK_SIZE})
endif()

# Custom heap size
if(TARGET_HEAP_SIZE)
target_compile_definitions(arch PRIVATE -D__HEAP_SIZE=${TARGET_HEAP_SIZE})
endif()

# Kinetis-specific definitions
if(TARGET_KINETIS_FLASH_PROTECT_SECTION)
target_compile_definitions(arch PRIVATE -DTARGET_KINETIS_FLASH_PROTECT_SECTION=1)
endif()

# Apply memory layout
configure_file(gcc_arm_cm.ld ${CMAKE_CURRENT_BINARY_DIR}/gcc_arm_cm.ld)

Expand Down
8 changes: 5 additions & 3 deletions arch/arm_cm/arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ extern "C" void __attribute__((naked)) arch_delay(uint32_t loop_count)
{
(void)loop_count;
#if defined ( __GNUC__ )
__asm(" subs r0, #1\n"
" bne arch_delay\n"
" bx lr");
__asm(" .syntax unified\n"
" subs r0, #1\n"
" bne arch_delay\n"
" bx lr\n"
" .syntax divided\n");
#else
#error Not yet implemented for your compiler
#endif
Expand Down
12 changes: 12 additions & 0 deletions arch/arm_cm/export/arch/defs.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef ARCH_ASM_DEFS_H_
#define ARCH_ASM_DEFS_H_

/* Macro to define default handlers. Default handler
* will be weak symbol and just dead loops. They can be
* overwritten by other handlers */
.macro def_irq_handler handler_name
.weak \handler_name
.set \handler_name, Default_Handler
.endm

#endif /* ARCH_ASM_DEFS_H_ */
2 changes: 2 additions & 0 deletions arch/arm_cm/export/arch/execution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <core_cm4.h>
#elif defined arm_cm3
#include <core_cm3.h>
#elif defined arm_cm0plus
#include <core_cm0plus.h>
#endif

#include <limits.h>
Expand Down
3 changes: 2 additions & 1 deletion arch/arm_cm/gcc_arm_cm.ld
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ SECTIONS
} > FLASH
*/

. = ALIGN(4);

__etext = .;

.data : AT (__etext)
Expand All @@ -129,7 +131,6 @@ SECTIONS
*(vtable)
*(.data*)

. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(.preinit_array))
Expand Down
10 changes: 2 additions & 8 deletions arch/arm_cm/startup_arm_cm.S
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ __StackLimit:
__StackTop:
.size __StackTop, . - __StackTop

.include "arch/defs.S"

.section .heap
.align 3
#ifdef __HEAP_SIZE
Expand Down Expand Up @@ -238,14 +240,6 @@ Default_Handler:
b .
.size Default_Handler, . - Default_Handler

/* Macro to define default handlers. Default handler
* will be weak symbol and just dead loops. They can be
* overwritten by other handlers */
.macro def_irq_handler handler_name
.weak \handler_name
.set \handler_name, Default_Handler
.endm

def_irq_handler NMI_Handler
def_irq_handler HardFault_Handler
def_irq_handler MemManage_Handler
Expand Down
Loading