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