clang work with lpc43
This commit is contained in:
@@ -308,9 +308,10 @@ SECTIONS
|
|||||||
_ebss = .;
|
_ebss = .;
|
||||||
PROVIDE(__end_bss_RAM = .) ;
|
PROVIDE(__end_bss_RAM = .) ;
|
||||||
PROVIDE(__end_bss_RamLoc32 = .) ;
|
PROVIDE(__end_bss_RamLoc32 = .) ;
|
||||||
PROVIDE(end = .);
|
/* PROVIDE(end = .);*/
|
||||||
} > RamLoc40 AT> RamLoc40 /* > RamLoc32 AT> RamLoc32 */
|
} > RamLoc40 AT> RamLoc40 /* > RamLoc32 AT> RamLoc32 */
|
||||||
|
|
||||||
|
/* hathach add heap section for clang */
|
||||||
.heap (NOLOAD): {
|
.heap (NOLOAD): {
|
||||||
__heap_start = .;
|
__heap_start = .;
|
||||||
__HeapBase = .;
|
__HeapBase = .;
|
||||||
@@ -393,7 +394,7 @@ SECTIONS
|
|||||||
PROVIDE(__end_noinit_RAM = .) ;
|
PROVIDE(__end_noinit_RAM = .) ;
|
||||||
PROVIDE(__end_noinit_RamLoc32 = .) ;
|
PROVIDE(__end_noinit_RamLoc32 = .) ;
|
||||||
} > RamLoc32 AT> 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);
|
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
||||||
|
|
||||||
/* ## Create checksum value (used in startup) ## */
|
/* ## Create checksum value (used in startup) ## */
|
||||||
|
@@ -255,6 +255,7 @@ SECTIONS
|
|||||||
*(COMMON)
|
*(COMMON)
|
||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
|
/* PROVIDE(end = .); */
|
||||||
} > RamLoc40 /* RamLoc32 */
|
} > RamLoc40 /* RamLoc32 */
|
||||||
|
|
||||||
/* NOINIT section for RamLoc40 */
|
/* NOINIT section for RamLoc40 */
|
||||||
@@ -265,6 +266,7 @@ SECTIONS
|
|||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
} > RamLoc40
|
} > RamLoc40
|
||||||
|
|
||||||
|
/* hathach add heap section for clang */
|
||||||
.heap (NOLOAD): {
|
.heap (NOLOAD): {
|
||||||
__heap_start = .;
|
__heap_start = .;
|
||||||
__HeapBase = .;
|
__HeapBase = .;
|
||||||
@@ -311,7 +313,7 @@ SECTIONS
|
|||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
_end_noinit = .;
|
_end_noinit = .;
|
||||||
} > RamLoc32
|
} > RamLoc32
|
||||||
|
/* PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);*/
|
||||||
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
||||||
|
|
||||||
/* ## Create checksum value (used in startup) ## */
|
/* ## Create checksum value (used in startup) ## */
|
||||||
|
@@ -1,10 +1,7 @@
|
|||||||
include_guard()
|
include_guard()
|
||||||
|
|
||||||
if (NOT BOARD)
|
|
||||||
message(FATAL_ERROR "BOARD not specified")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(SDK_DIR ${TOP}/hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx)
|
set(SDK_DIR ${TOP}/hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx)
|
||||||
|
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
||||||
|
|
||||||
# include board specific
|
# include board specific
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||||
@@ -21,7 +18,10 @@ set(FAMILY_MCUS LPC18XX CACHE INTERNAL "")
|
|||||||
#------------------------------------
|
#------------------------------------
|
||||||
# only need to be built ONCE for all examples
|
# only need to be built ONCE for all examples
|
||||||
function(add_board_target BOARD_TARGET)
|
function(add_board_target BOARD_TARGET)
|
||||||
if (NOT TARGET ${BOARD_TARGET})
|
if (TARGET ${BOARD_TARGET})
|
||||||
|
return()
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_library(${BOARD_TARGET} STATIC
|
add_library(${BOARD_TARGET} STATIC
|
||||||
${SDK_DIR}/../gcc/cr_startup_lpc18xx.c
|
${SDK_DIR}/../gcc/cr_startup_lpc18xx.c
|
||||||
${SDK_DIR}/src/chip_18xx_43xx.c
|
${SDK_DIR}/src/chip_18xx_43xx.c
|
||||||
@@ -30,9 +30,6 @@ function(add_board_target BOARD_TARGET)
|
|||||||
${SDK_DIR}/src/sysinit_18xx_43xx.c
|
${SDK_DIR}/src/sysinit_18xx_43xx.c
|
||||||
${SDK_DIR}/src/uart_18xx_43xx.c
|
${SDK_DIR}/src/uart_18xx_43xx.c
|
||||||
)
|
)
|
||||||
target_compile_options(${BOARD_TARGET} PUBLIC
|
|
||||||
-nostdlib
|
|
||||||
)
|
|
||||||
target_compile_definitions(${BOARD_TARGET} PUBLIC
|
target_compile_definitions(${BOARD_TARGET} PUBLIC
|
||||||
__USE_LPCOPEN
|
__USE_LPCOPEN
|
||||||
CORE_M3
|
CORE_M3
|
||||||
@@ -40,11 +37,13 @@ function(add_board_target BOARD_TARGET)
|
|||||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||||
${SDK_DIR}/inc
|
${SDK_DIR}/inc
|
||||||
${SDK_DIR}/inc/config_18xx
|
${SDK_DIR}/inc/config_18xx
|
||||||
|
${CMSIS_5}/CMSIS/Core/Include
|
||||||
)
|
)
|
||||||
|
|
||||||
update_board(${BOARD_TARGET})
|
update_board(${BOARD_TARGET})
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(${BOARD_TARGET} PUBLIC -nostdlib)
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
target_link_options(${BOARD_TARGET} PUBLIC
|
||||||
"LINKER:--script=${LD_FILE_GNU}"
|
"LINKER:--script=${LD_FILE_GNU}"
|
||||||
--specs=nosys.specs --specs=nano.specs
|
--specs=nosys.specs --specs=nano.specs
|
||||||
@@ -58,7 +57,6 @@ function(add_board_target BOARD_TARGET)
|
|||||||
"LINKER:--config=${LD_FILE_IAR}"
|
"LINKER:--config=${LD_FILE_IAR}"
|
||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
@@ -99,5 +97,4 @@ function(family_configure_example TARGET RTOS)
|
|||||||
|
|
||||||
# Flashing
|
# Flashing
|
||||||
family_flash_jlink(${TARGET})
|
family_flash_jlink(${TARGET})
|
||||||
#family_flash_nxplink(${TARGET})
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -256,7 +256,7 @@ SECTIONS
|
|||||||
*(COMMON)
|
*(COMMON)
|
||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
PROVIDE(end = .);
|
/* PROVIDE(end = .); */
|
||||||
} > RamLoc40 /* RamLoc32 */
|
} > RamLoc40 /* RamLoc32 */
|
||||||
|
|
||||||
/* NOINIT section for RamLoc40 */
|
/* NOINIT section for RamLoc40 */
|
||||||
@@ -267,6 +267,21 @@ SECTIONS
|
|||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
} > RamLoc40
|
} > 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 section for RamAHB32 */
|
||||||
.noinit_RAM3 (NOLOAD) : ALIGN(4)
|
.noinit_RAM3 (NOLOAD) : ALIGN(4)
|
||||||
{
|
{
|
||||||
@@ -299,19 +314,21 @@ SECTIONS
|
|||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
_end_noinit = .;
|
_end_noinit = .;
|
||||||
} > RamLoc32
|
} > 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);
|
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
||||||
|
|
||||||
/* ## Create checksum value (used in startup) ## */
|
/* ## Create checksum value (used in startup) ## */
|
||||||
PROVIDE(__valid_user_code_checksum = 0 -
|
/* This cause issue with clang linker, so it is disabled */
|
||||||
(_vStackTop
|
/* MemManage_Handler, BusFault_Handler, UsageFault_Hander may not be defined */
|
||||||
+ (ResetISR + 1)
|
/* PROVIDE(__valid_user_code_checksum = 0 -*/
|
||||||
+ (NMI_Handler + 1)
|
/* (_vStackTop*/
|
||||||
+ (HardFault_Handler + 1)
|
/* + (ResetISR + 1)*/
|
||||||
+ (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
|
/* + (NMI_Handler + 1)*/
|
||||||
+ (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
|
/* + (HardFault_Handler + 1)*/
|
||||||
+ (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
|
/* + (( 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
|
/* Provide basic symbols giving location and size of main text
|
||||||
* block, including initial values of RW data sections. Note that
|
* block, including initial values of RW data sections. Note that
|
||||||
|
@@ -304,9 +304,24 @@ SECTIONS
|
|||||||
_ebss = .;
|
_ebss = .;
|
||||||
PROVIDE(__end_bss_RAM = .) ;
|
PROVIDE(__end_bss_RAM = .) ;
|
||||||
PROVIDE(__end_bss_RamLoc32 = .) ;
|
PROVIDE(__end_bss_RamLoc32 = .) ;
|
||||||
PROVIDE(end = .);
|
/* PROVIDE(end = .);*/
|
||||||
} > RamLoc40 AT> RamLoc40 /* > RamLoc32 AT> RamLoc32 */
|
} > 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 section for RamLoc40 */
|
||||||
.noinit_RAM2 (NOLOAD) : ALIGN(4)
|
.noinit_RAM2 (NOLOAD) : ALIGN(4)
|
||||||
{
|
{
|
||||||
@@ -376,20 +391,22 @@ SECTIONS
|
|||||||
PROVIDE(__end_noinit_RamLoc32 = .) ;
|
PROVIDE(__end_noinit_RamLoc32 = .) ;
|
||||||
} > RamLoc32 AT> 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);
|
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
||||||
|
|
||||||
/* ## Create checksum value (used in startup) ## */
|
/* ## Create checksum value (used in startup) ## */
|
||||||
PROVIDE(__valid_user_code_checksum = 0 -
|
/* This cause issue with clang linker, so it is disabled */
|
||||||
(_vStackTop
|
/* MemManage_Handler, BusFault_Handler, UsageFault_Hander may not be defined */
|
||||||
+ (ResetISR + 1)
|
/* PROVIDE(__valid_user_code_checksum = 0 -*/
|
||||||
+ (NMI_Handler + 1)
|
/* (_vStackTop*/
|
||||||
+ (HardFault_Handler + 1)
|
/* + (ResetISR + 1)*/
|
||||||
+ (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
|
/* + (NMI_Handler + 1)*/
|
||||||
+ (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
|
/* + (HardFault_Handler + 1)*/
|
||||||
+ (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
|
/* + (( 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
|
/* Provide basic symbols giving location and size of main text
|
||||||
* block, including initial values of RW data sections. Note that
|
* block, including initial values of RW data sections. Note that
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
include_guard()
|
include_guard()
|
||||||
|
|
||||||
set(SDK_DIR ${TOP}/hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx)
|
set(SDK_DIR ${TOP}/hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx)
|
||||||
|
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
||||||
|
|
||||||
# include board specific
|
# include board specific
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||||
@@ -23,6 +24,7 @@ function(add_board_target BOARD_TARGET)
|
|||||||
|
|
||||||
# Startup & Linker script
|
# Startup & Linker script
|
||||||
set(STARTUP_FILE_GNU ${SDK_DIR}/../gcc/cr_startup_lpc43xx.c)
|
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(STARTUP_FILE_IAR ${SDK_DIR}/../iar/iar_startup_lpc18xx43xx.s)
|
||||||
set(LD_FILE_IAR ${SDK_DIR}/../iar/linker/lpc18xx_43xx_ldscript_iflash.icf)
|
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
|
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||||
${SDK_DIR}/inc
|
${SDK_DIR}/inc
|
||||||
${SDK_DIR}/inc/config_43xx
|
${SDK_DIR}/inc/config_43xx
|
||||||
|
${CMSIS_5}/CMSIS/Core/Include
|
||||||
)
|
)
|
||||||
|
|
||||||
update_board(${BOARD_TARGET})
|
update_board(${BOARD_TARGET})
|
||||||
@@ -51,9 +54,11 @@ function(add_board_target BOARD_TARGET)
|
|||||||
target_compile_options(${BOARD_TARGET} PUBLIC -nostdlib)
|
target_compile_options(${BOARD_TARGET} PUBLIC -nostdlib)
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
target_link_options(${BOARD_TARGET} PUBLIC
|
||||||
"LINKER:--script=${LD_FILE_GNU}"
|
"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")
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
target_link_options(${BOARD_TARGET} PUBLIC
|
||||||
|
@@ -29,7 +29,10 @@ set(FAMILY_MCUS NRF5X CACHE INTERNAL "")
|
|||||||
#------------------------------------
|
#------------------------------------
|
||||||
# only need to be built ONCE for all examples
|
# only need to be built ONCE for all examples
|
||||||
function(add_board_target BOARD_TARGET)
|
function(add_board_target BOARD_TARGET)
|
||||||
if (NOT TARGET ${BOARD_TARGET})
|
if (TARGET ${BOARD_TARGET})
|
||||||
|
return()
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (MCU_VARIANT STREQUAL "nrf5340_application")
|
if (MCU_VARIANT STREQUAL "nrf5340_application")
|
||||||
set(MCU_VARIANT_XXAA "nrf5340_xxaa_application")
|
set(MCU_VARIANT_XXAA "nrf5340_xxaa_application")
|
||||||
else ()
|
else ()
|
||||||
@@ -96,7 +99,6 @@ function(add_board_target BOARD_TARGET)
|
|||||||
"LINKER:--config=${LD_FILE_IAR}"
|
"LINKER:--config=${LD_FILE_IAR}"
|
||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -176,6 +176,7 @@ deps_optional = {
|
|||||||
'lib/CMSIS_5': ['https://github.com/ARM-software/CMSIS_5.git',
|
'lib/CMSIS_5': ['https://github.com/ARM-software/CMSIS_5.git',
|
||||||
'20285262657d1b482d132d20d755c8c330d55c1f',
|
'20285262657d1b482d132d20d755c8c330d55c1f',
|
||||||
'imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf ra saml2x'
|
'imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf ra saml2x'
|
||||||
|
'lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43'
|
||||||
'stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5'
|
'stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5'
|
||||||
'stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb'
|
'stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb'
|
||||||
'sam3x samd11 samd21 samd51 same5x same7x saml2x samg'],
|
'sam3x samd11 samd21 samd51 same5x same7x saml2x samg'],
|
||||||
|
Reference in New Issue
Block a user