clang work with lpc43
This commit is contained in:
@@ -256,7 +256,7 @@ SECTIONS
|
||||
*(COMMON)
|
||||
. = ALIGN(4) ;
|
||||
_ebss = .;
|
||||
PROVIDE(end = .);
|
||||
/* PROVIDE(end = .); */
|
||||
} > RamLoc40 /* RamLoc32 */
|
||||
|
||||
/* NOINIT section for RamLoc40 */
|
||||
@@ -267,6 +267,21 @@ SECTIONS
|
||||
. = ALIGN(4) ;
|
||||
} > RamLoc40
|
||||
|
||||
/* hathach add heap section for clang */
|
||||
.heap (NOLOAD): {
|
||||
__heap_start = .;
|
||||
__HeapBase = .;
|
||||
__heap_base = .;
|
||||
__end = .;
|
||||
PROVIDE(end = .);
|
||||
PROVIDE(_end = .);
|
||||
PROVIDE(__end__ = .);
|
||||
KEEP(*(.heap*))
|
||||
__HeapLimit = .;
|
||||
__heap_limit = .;
|
||||
__heap_end = .;
|
||||
} > RamLoc40
|
||||
|
||||
/* NOINIT section for RamAHB32 */
|
||||
.noinit_RAM3 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
@@ -299,19 +314,21 @@ SECTIONS
|
||||
. = ALIGN(4) ;
|
||||
_end_noinit = .;
|
||||
} > RamLoc32
|
||||
PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
|
||||
/* PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);*/
|
||||
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
||||
|
||||
/* ## Create checksum value (used in startup) ## */
|
||||
PROVIDE(__valid_user_code_checksum = 0 -
|
||||
(_vStackTop
|
||||
+ (ResetISR + 1)
|
||||
+ (NMI_Handler + 1)
|
||||
+ (HardFault_Handler + 1)
|
||||
+ (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
|
||||
+ (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
|
||||
+ (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
|
||||
) );
|
||||
/* This cause issue with clang linker, so it is disabled */
|
||||
/* MemManage_Handler, BusFault_Handler, UsageFault_Hander may not be defined */
|
||||
/* PROVIDE(__valid_user_code_checksum = 0 -*/
|
||||
/* (_vStackTop*/
|
||||
/* + (ResetISR + 1)*/
|
||||
/* + (NMI_Handler + 1)*/
|
||||
/* + (HardFault_Handler + 1)*/
|
||||
/* + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1)*/
|
||||
/* + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1)*/
|
||||
/* + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1)*/
|
||||
/* ) );*/
|
||||
|
||||
/* Provide basic symbols giving location and size of main text
|
||||
* block, including initial values of RW data sections. Note that
|
||||
|
@@ -304,9 +304,24 @@ SECTIONS
|
||||
_ebss = .;
|
||||
PROVIDE(__end_bss_RAM = .) ;
|
||||
PROVIDE(__end_bss_RamLoc32 = .) ;
|
||||
PROVIDE(end = .);
|
||||
/* PROVIDE(end = .);*/
|
||||
} > RamLoc40 AT> RamLoc40 /* > RamLoc32 AT> RamLoc32 */
|
||||
|
||||
/* hathach add heap section for clang */
|
||||
.heap (NOLOAD): {
|
||||
__heap_start = .;
|
||||
__HeapBase = .;
|
||||
__heap_base = .;
|
||||
__end = .;
|
||||
PROVIDE(end = .);
|
||||
PROVIDE(_end = .);
|
||||
PROVIDE(__end__ = .);
|
||||
KEEP(*(.heap*))
|
||||
__HeapLimit = .;
|
||||
__heap_limit = .;
|
||||
__heap_end = .;
|
||||
} > RamLoc40
|
||||
|
||||
/* NOINIT section for RamLoc40 */
|
||||
.noinit_RAM2 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
@@ -376,20 +391,22 @@ SECTIONS
|
||||
PROVIDE(__end_noinit_RamLoc32 = .) ;
|
||||
} > RamLoc32 AT> RamLoc32
|
||||
|
||||
PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
|
||||
/* PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);*/
|
||||
|
||||
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
||||
|
||||
/* ## Create checksum value (used in startup) ## */
|
||||
PROVIDE(__valid_user_code_checksum = 0 -
|
||||
(_vStackTop
|
||||
+ (ResetISR + 1)
|
||||
+ (NMI_Handler + 1)
|
||||
+ (HardFault_Handler + 1)
|
||||
+ (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
|
||||
+ (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
|
||||
+ (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
|
||||
) );
|
||||
/* This cause issue with clang linker, so it is disabled */
|
||||
/* MemManage_Handler, BusFault_Handler, UsageFault_Hander may not be defined */
|
||||
/* PROVIDE(__valid_user_code_checksum = 0 -*/
|
||||
/* (_vStackTop*/
|
||||
/* + (ResetISR + 1)*/
|
||||
/* + (NMI_Handler + 1)*/
|
||||
/* + (HardFault_Handler + 1)*/
|
||||
/* + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1)*/
|
||||
/* + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1)*/
|
||||
/* + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1)*/
|
||||
/* ) );*/
|
||||
|
||||
/* Provide basic symbols giving location and size of main text
|
||||
* block, including initial values of RW data sections. Note that
|
||||
|
@@ -1,6 +1,7 @@
|
||||
include_guard()
|
||||
|
||||
set(SDK_DIR ${TOP}/hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx)
|
||||
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
||||
|
||||
# include board specific
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
@@ -23,6 +24,7 @@ function(add_board_target BOARD_TARGET)
|
||||
|
||||
# Startup & Linker script
|
||||
set(STARTUP_FILE_GNU ${SDK_DIR}/../gcc/cr_startup_lpc43xx.c)
|
||||
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
|
||||
set(STARTUP_FILE_IAR ${SDK_DIR}/../iar/iar_startup_lpc18xx43xx.s)
|
||||
set(LD_FILE_IAR ${SDK_DIR}/../iar/linker/lpc18xx_43xx_ldscript_iflash.icf)
|
||||
|
||||
@@ -43,6 +45,7 @@ function(add_board_target BOARD_TARGET)
|
||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||
${SDK_DIR}/inc
|
||||
${SDK_DIR}/inc/config_43xx
|
||||
${CMSIS_5}/CMSIS/Core/Include
|
||||
)
|
||||
|
||||
update_board(${BOARD_TARGET})
|
||||
@@ -51,9 +54,11 @@ function(add_board_target BOARD_TARGET)
|
||||
target_compile_options(${BOARD_TARGET} PUBLIC -nostdlib)
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
# nanolib
|
||||
--specs=nosys.specs
|
||||
--specs=nano.specs
|
||||
--specs=nosys.specs --specs=nano.specs
|
||||
)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
|
Reference in New Issue
Block a user