mirror of
https://github.com/candle-usb/candleLight_fw.git
synced 2025-01-14 05:42:53 +08:00
CMake: clean up -mcpu=XYZ compile flags
also remove duplicate link options for F072 targets
This commit is contained in:
parent
2c4d046df5
commit
6b451da2f0
@ -17,6 +17,10 @@ add_compile_options(
|
||||
--specs=nosys.specs
|
||||
)
|
||||
|
||||
#need these later, per-platform
|
||||
set(CPUFLAGS_F0 -mcpu=cortex-m0)
|
||||
set(CPUFLAGS_F4 -mcpu=cortex-m4)
|
||||
|
||||
add_link_options(
|
||||
-mthumb -Wall -Wextra -g3
|
||||
-Xlinker --gc-sections
|
||||
@ -118,9 +122,9 @@ function(add_f042_target TGTNAME)
|
||||
add_executable(${TGTNAME}_fw ${SOURCE_FILES})
|
||||
add_dependencies(${TGTNAME}_fw version_h)
|
||||
target_include_directories(${TGTNAME}_fw PRIVATE include/ ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_compile_options(${TGTNAME}_fw BEFORE PRIVATE -mcpu=cortex-m0)
|
||||
target_compile_options(${TGTNAME}_fw BEFORE PRIVATE ${CPUFLAGS_F0})
|
||||
target_compile_definitions(${TGTNAME}_fw PRIVATE BOARD=BOARD_${TGTNAME} STM32F0)
|
||||
target_link_options(${TGTNAME}_fw BEFORE PRIVATE -mcpu=cortex-m0)
|
||||
target_link_options(${TGTNAME}_fw BEFORE PRIVATE ${CPUFLAGS_F0})
|
||||
target_link_options(${TGTNAME}_fw PRIVATE -T ${CMAKE_SOURCE_DIR}/ldscripts/STM32F042X6.ld)
|
||||
target_link_libraries(${TGTNAME}_fw PRIVATE STM32_HAL_STM32F042x6 STM32_USB_Device_Library_STM32F042x6)
|
||||
make_bin_file(${TGTNAME}_fw)
|
||||
@ -132,12 +136,10 @@ function(add_f072_target TGTNAME)
|
||||
add_executable(${TGTNAME}_fw ${SOURCE_FILES})
|
||||
add_dependencies(${TGTNAME}_fw version_h)
|
||||
target_include_directories(${TGTNAME}_fw PRIVATE include/ ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_compile_options(${TGTNAME}_fw BEFORE PRIVATE -mcpu=cortex-m0)
|
||||
target_compile_options(${TGTNAME}_fw BEFORE PRIVATE ${CPUFLAGS_F0})
|
||||
target_compile_definitions(${TGTNAME}_fw PRIVATE BOARD=BOARD_${TGTNAME} STM32F0)
|
||||
target_link_options(${TGTNAME}_fw BEFORE PRIVATE -mcpu=cortex-m0)
|
||||
target_link_options(${TGTNAME}_fw BEFORE PRIVATE ${CPUFLAGS_F0})
|
||||
target_link_options(${TGTNAME}_fw PRIVATE -T ${CMAKE_SOURCE_DIR}/ldscripts/STM32F072XB.ld)
|
||||
target_link_options(STM32_HAL_STM32F072xB BEFORE PRIVATE -mcpu=cortex-m0)
|
||||
target_link_options(STM32_USB_Device_Library_STM32F072xB BEFORE PRIVATE -mcpu=cortex-m0)
|
||||
target_link_libraries(${TGTNAME}_fw PRIVATE STM32_HAL_STM32F072xB STM32_USB_Device_Library_STM32F072xB)
|
||||
make_bin_file(${TGTNAME}_fw)
|
||||
dfu_flash(${TGTNAME}_fw)
|
||||
@ -149,8 +151,8 @@ function(add_f407_target TGTNAME)
|
||||
add_dependencies(${TGTNAME}_fw version_h)
|
||||
target_include_directories(${TGTNAME}_fw PRIVATE include/ ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_compile_definitions(${TGTNAME}_fw PRIVATE BOARD=BOARD_${TGTNAME} STM32F4)
|
||||
target_compile_options(${TGTNAME}_fw BEFORE PRIVATE -mcpu=cortex-m4)
|
||||
target_link_options(${TGTNAME}_fw BEFORE PRIVATE -mcpu=cortex-m4)
|
||||
target_compile_options(${TGTNAME}_fw BEFORE PRIVATE ${CPUFLAGS_F4})
|
||||
target_link_options(${TGTNAME}_fw BEFORE PRIVATE ${CPUFLAGS_F4})
|
||||
target_link_options(${TGTNAME}_fw PRIVATE -T ${CMAKE_SOURCE_DIR}/ldscripts/STM32F407XE.ld)
|
||||
target_link_libraries(${TGTNAME}_fw PRIVATE STM32_HAL_STM32F407xE STM32_USB_Device_Library_STM32F407xE)
|
||||
make_bin_file(${TGTNAME}_fw)
|
||||
|
@ -124,15 +124,15 @@ set(INCLUDE_DIRS
|
||||
|
||||
add_library(STM32_HAL_STM32F042x6 STATIC ${STM32F0_SOURCES})
|
||||
target_include_directories(STM32_HAL_STM32F042x6 PUBLIC ${INCLUDE_DIRS} include/stm32f0xx)
|
||||
target_compile_options(STM32_HAL_STM32F042x6 PRIVATE -mcpu=cortex-m0 -Wno-unused-parameter)
|
||||
target_compile_options(STM32_HAL_STM32F042x6 PRIVATE ${CPUFLAGS_F0} -Wno-unused-parameter)
|
||||
target_compile_definitions(STM32_HAL_STM32F042x6 PUBLIC STM32F042x6 HAL_TARGET_PREFIX=stm32f0xx)
|
||||
|
||||
add_library(STM32_HAL_STM32F072xB STATIC ${STM32F0_SOURCES})
|
||||
target_include_directories(STM32_HAL_STM32F072xB PUBLIC ${INCLUDE_DIRS} include/stm32f0xx)
|
||||
target_compile_options(STM32_HAL_STM32F072xB PRIVATE -mcpu=cortex-m0 -Wno-unused-parameter)
|
||||
target_compile_options(STM32_HAL_STM32F072xB PRIVATE ${CPUFLAGS_F0} -Wno-unused-parameter)
|
||||
target_compile_definitions(STM32_HAL_STM32F072xB PUBLIC STM32F072xB HAL_TARGET_PREFIX=stm32f0xx)
|
||||
|
||||
add_library(STM32_HAL_STM32F407xE STATIC ${STM32F4_SOURCES})
|
||||
target_include_directories(STM32_HAL_STM32F407xE PUBLIC ${INCLUDE_DIRS} include/stm32f4xx)
|
||||
target_compile_options(STM32_HAL_STM32F407xE PRIVATE -mcpu=cortex-m4 -Wno-unused-parameter)
|
||||
target_compile_options(STM32_HAL_STM32F407xE PRIVATE ${CPUFLAGS_F4} -Wno-unused-parameter)
|
||||
target_compile_definitions(STM32_HAL_STM32F407xE PUBLIC STM32F407xx HAL_TARGET_PREFIX=stm32f4xx)
|
||||
|
@ -17,15 +17,15 @@ set(INCLUDE_DIRS
|
||||
|
||||
add_library(STM32_USB_Device_Library_STM32F042x6 STATIC ${SOURCES})
|
||||
target_include_directories(STM32_USB_Device_Library_STM32F042x6 PUBLIC ${INCLUDE_DIRS})
|
||||
target_compile_options(STM32_USB_Device_Library_STM32F042x6 PRIVATE -mcpu=cortex-m0 -Wno-unused-parameter -DSTM32F0)
|
||||
target_compile_options(STM32_USB_Device_Library_STM32F042x6 PRIVATE ${CPUFLAGS_F0} -Wno-unused-parameter -DSTM32F0)
|
||||
target_link_libraries(STM32_USB_Device_Library_STM32F042x6 PRIVATE STM32_HAL_STM32F042x6)
|
||||
|
||||
add_library(STM32_USB_Device_Library_STM32F072xB STATIC ${SOURCES})
|
||||
target_include_directories(STM32_USB_Device_Library_STM32F072xB PUBLIC ${INCLUDE_DIRS})
|
||||
target_compile_options(STM32_USB_Device_Library_STM32F072xB PRIVATE -mcpu=cortex-m0 -Wno-unused-parameter -DSTM32F0)
|
||||
target_compile_options(STM32_USB_Device_Library_STM32F072xB PRIVATE ${CPUFLAGS_F0} -Wno-unused-parameter -DSTM32F0)
|
||||
target_link_libraries(STM32_USB_Device_Library_STM32F072xB PRIVATE STM32_HAL_STM32F072xB)
|
||||
|
||||
add_library(STM32_USB_Device_Library_STM32F407xE STATIC ${SOURCES})
|
||||
target_include_directories(STM32_USB_Device_Library_STM32F407xE PUBLIC ${INCLUDE_DIRS})
|
||||
target_compile_options(STM32_USB_Device_Library_STM32F407xE PRIVATE -mcpu=cortex-m4 -Wno-unused-parameter -DSTM32F4)
|
||||
target_compile_options(STM32_USB_Device_Library_STM32F407xE PRIVATE ${CPUFLAGS_F4} -Wno-unused-parameter -DSTM32F4)
|
||||
target_link_libraries(STM32_USB_Device_Library_STM32F407xE PRIVATE STM32_HAL_STM32F407xE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user