clang work with f0

This commit is contained in:
hathach 2024-04-23 11:35:42 +07:00
parent a410eb345c
commit f76d38c924
No known key found for this signature in database
GPG Key ID: 26FAB84F615C3C52
2 changed files with 12 additions and 15 deletions

View File

@ -1,9 +1,5 @@
include_guard()
if (NOT BOARD)
message(FATAL_ERROR "BOARD not specified")
endif ()
set(ST_FAMILY f0)
set(ST_PREFIX stm32${ST_FAMILY}xx)
@ -29,7 +25,10 @@ function(add_board_target BOARD_TARGET)
if (NOT TARGET ${BOARD_TARGET})
# Startup & Linker script
set(STARTUP_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/startup_${MCU_VARIANT}.s)
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
set(STARTUP_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/startup_${MCU_VARIANT}.s)
set(LD_FILE_Clang ${LD_FILE_GNU})
set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf)
add_library(${BOARD_TARGET} STATIC
@ -49,8 +48,7 @@ function(add_board_target BOARD_TARGET)
${ST_CMSIS}/Include
${ST_HAL_DRIVER}/Inc
)
target_compile_options(${BOARD_TARGET} PUBLIC
)
#target_compile_options(${BOARD_TARGET} PUBLIC)
target_compile_definitions(${BOARD_TARGET} PUBLIC
CFG_EXAMPLE_MSC_READONLY
)
@ -61,9 +59,11 @@ function(add_board_target BOARD_TARGET)
target_link_options(${BOARD_TARGET} PUBLIC
"LINKER:--script=${LD_FILE_GNU}"
-nostartfiles
# 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_Clang}"
)
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
target_link_options(${BOARD_TARGET} PUBLIC
@ -109,5 +109,5 @@ function(family_configure_example TARGET RTOS)
# Flashing
family_flash_stlink(${TARGET})
#family_flash_jlink(${TARGET})
family_flash_jlink(${TARGET})
endfunction()

View File

@ -1,9 +1,5 @@
include_guard()
if (NOT BOARD)
message(FATAL_ERROR "BOARD not specified")
endif ()
set(ST_FAMILY h7)
set(ST_PREFIX stm32${ST_FAMILY}xx)
@ -32,6 +28,7 @@ function(add_board_target BOARD_TARGET)
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
set(STARTUP_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/startup_${MCU_VARIANT}.s)
set(LD_FILE_Clang ${LD_FILE_GNU})
if(NOT DEFINED LD_FILE_IAR)
set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf)
endif()
@ -69,7 +66,7 @@ function(add_board_target BOARD_TARGET)
)
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_link_options(${BOARD_TARGET} PUBLIC
"LINKER:--script=${LD_FILE_GNU}"
"LINKER:--script=${LD_FILE_Clang}"
)
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
target_link_options(${BOARD_TARGET} PUBLIC