clang compile with lpc17
This commit is contained in:
@@ -140,7 +140,7 @@ SECTIONS
|
|||||||
*(COMMON)
|
*(COMMON)
|
||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
PROVIDE(end = .);
|
/* PROVIDE(end = .);*/
|
||||||
} > RamLoc32
|
} > RamLoc32
|
||||||
|
|
||||||
/* NOINIT section for RamAHB32 */
|
/* NOINIT section for RamAHB32 */
|
||||||
@@ -159,19 +159,37 @@ SECTIONS
|
|||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
_end_noinit = .;
|
_end_noinit = .;
|
||||||
} > RamLoc32
|
} > RamLoc32
|
||||||
PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
|
|
||||||
|
/* 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 = .;
|
||||||
|
} > 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) ## */
|
||||||
PROVIDE(__valid_user_code_checksum = 0 -
|
/* This cause issue with clang linker, so it is disabled */
|
||||||
(_vStackTop
|
/* MemManage_Handler, BusFault_Handler, UsageFault_Handler 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
|
||||||
|
@@ -140,7 +140,7 @@ SECTIONS
|
|||||||
*(COMMON)
|
*(COMMON)
|
||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
PROVIDE(end = .);
|
/* PROVIDE(end = .);*/
|
||||||
} > RamLoc32
|
} > RamLoc32
|
||||||
|
|
||||||
/* NOINIT section for RamAHB32 */
|
/* NOINIT section for RamAHB32 */
|
||||||
@@ -159,19 +159,37 @@ SECTIONS
|
|||||||
. = ALIGN(4) ;
|
. = ALIGN(4) ;
|
||||||
_end_noinit = .;
|
_end_noinit = .;
|
||||||
} > RamLoc32
|
} > RamLoc32
|
||||||
PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
|
|
||||||
|
/* 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 = .;
|
||||||
|
} > 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) ## */
|
||||||
PROVIDE(__valid_user_code_checksum = 0 -
|
/* This cause issue with clang linker, so it is disabled */
|
||||||
(_vStackTop
|
/* MemManage_Handler, BusFault_Handler, UsageFault_Handler 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,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/lpc175x_6x/lpc_chip_175x_6x)
|
set(SDK_DIR ${TOP}/hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x)
|
||||||
|
set(CMSIS_DIR ${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,42 +18,46 @@ set(FAMILY_MCUS LPC175X_6X 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})
|
||||||
add_library(${BOARD_TARGET} STATIC
|
return()
|
||||||
${SDK_DIR}/../gcc/cr_startup_lpc175x_6x.c
|
endif ()
|
||||||
${SDK_DIR}/src/chip_17xx_40xx.c
|
|
||||||
${SDK_DIR}/src/clock_17xx_40xx.c
|
|
||||||
${SDK_DIR}/src/gpio_17xx_40xx.c
|
|
||||||
${SDK_DIR}/src/iocon_17xx_40xx.c
|
|
||||||
${SDK_DIR}/src/sysctl_17xx_40xx.c
|
|
||||||
${SDK_DIR}/src/sysinit_17xx_40xx.c
|
|
||||||
${SDK_DIR}/src/uart_17xx_40xx.c
|
|
||||||
)
|
|
||||||
target_compile_options(${BOARD_TARGET} PUBLIC
|
|
||||||
-nostdlib
|
|
||||||
)
|
|
||||||
target_compile_definitions(${BOARD_TARGET} PUBLIC
|
|
||||||
__USE_LPCOPEN
|
|
||||||
CORE_M3
|
|
||||||
RTC_EV_SUPPORT=0
|
|
||||||
)
|
|
||||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
|
||||||
${SDK_DIR}/inc
|
|
||||||
)
|
|
||||||
|
|
||||||
update_board(${BOARD_TARGET})
|
add_library(${BOARD_TARGET} STATIC
|
||||||
|
${SDK_DIR}/../gcc/cr_startup_lpc175x_6x.c
|
||||||
|
${SDK_DIR}/src/chip_17xx_40xx.c
|
||||||
|
${SDK_DIR}/src/clock_17xx_40xx.c
|
||||||
|
${SDK_DIR}/src/gpio_17xx_40xx.c
|
||||||
|
${SDK_DIR}/src/iocon_17xx_40xx.c
|
||||||
|
${SDK_DIR}/src/sysctl_17xx_40xx.c
|
||||||
|
${SDK_DIR}/src/sysinit_17xx_40xx.c
|
||||||
|
${SDK_DIR}/src/uart_17xx_40xx.c
|
||||||
|
)
|
||||||
|
target_compile_definitions(${BOARD_TARGET} PUBLIC
|
||||||
|
__USE_LPCOPEN
|
||||||
|
CORE_M3
|
||||||
|
RTC_EV_SUPPORT=0
|
||||||
|
)
|
||||||
|
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||||
|
${SDK_DIR}/inc
|
||||||
|
${CMSIS_DIR}/CMSIS/Core/Include
|
||||||
|
)
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
update_board(${BOARD_TARGET})
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
|
||||||
"LINKER:--script=${LD_FILE_GNU}"
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
# nanolib
|
target_compile_options(${BOARD_TARGET} PUBLIC -nostdlib)
|
||||||
--specs=nosys.specs --specs=nano.specs
|
target_link_options(${BOARD_TARGET} PUBLIC
|
||||||
)
|
"LINKER:--script=${LD_FILE_GNU}"
|
||||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
--specs=nosys.specs --specs=nano.specs
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
)
|
||||||
"LINKER:--config=${LD_FILE_IAR}"
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
)
|
target_link_options(${BOARD_TARGET} PUBLIC
|
||||||
endif ()
|
"LINKER:--script=${LD_FILE_GNU}"
|
||||||
|
)
|
||||||
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||||
|
target_link_options(${BOARD_TARGET} PUBLIC
|
||||||
|
"LINKER:--config=${LD_FILE_IAR}"
|
||||||
|
)
|
||||||
endif ()
|
endif ()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@@ -1,9 +1,5 @@
|
|||||||
include_guard()
|
include_guard()
|
||||||
|
|
||||||
if (NOT BOARD)
|
|
||||||
message(FATAL_ERROR "BOARD not specified")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(NRFX_DIR ${TOP}/hw/mcu/nordic/nrfx)
|
set(NRFX_DIR ${TOP}/hw/mcu/nordic/nrfx)
|
||||||
set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user