Move linker script configuration inside into a single spot
Use a block comment to avoid cmake-format messing up the relevant newlinespull/143/head
parent
21390cefe1
commit
b3c53b8a85
|
|
@ -120,10 +120,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_compile_definitions(_DEBUG)
|
add_compile_definitions(_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# if(CMAKE_CROSSCOMPILING) # configure linker script set(LINKER_SCRIPT
|
|
||||||
# "${CMAKE_CURRENT_SOURCE_DIR}/src/STM32F407VG_FLASH.ld")
|
|
||||||
# add_link_options("-Wl,-T,${LINKER_SCRIPT}") endif()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Import definitions of all libraries
|
# Import definitions of all libraries
|
||||||
#
|
#
|
||||||
|
|
@ -139,6 +135,13 @@ add_executable(firmware)
|
||||||
set_target_properties(firmware PROPERTIES CXX_STANDARD 14)
|
set_target_properties(firmware PROPERTIES CXX_STANDARD 14)
|
||||||
|
|
||||||
if(CMAKE_CROSSCOMPILING)
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
#[[
|
||||||
|
# configure linker script
|
||||||
|
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/src/avr5.xn)
|
||||||
|
target_link_options(firmware PUBLIC -Wl,-T,${LINKER_SCRIPT})
|
||||||
|
add_link_dependency(firmware ${LINKER_SCRIPT})
|
||||||
|
#]]
|
||||||
|
|
||||||
# generate firmware.bin file
|
# generate firmware.bin file
|
||||||
objcopy(firmware "ihex" ".hex")
|
objcopy(firmware "ihex" ".hex")
|
||||||
|
|
||||||
|
|
@ -157,8 +160,6 @@ if(CMAKE_CROSSCOMPILING)
|
||||||
target_link_options(firmware PUBLIC -Wl,-Map=firmware.map)
|
target_link_options(firmware PUBLIC -Wl,-Map=firmware.map)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# add_link_dependency(firmware "${LINKER_SCRIPT}")
|
|
||||||
|
|
||||||
target_include_directories(firmware PRIVATE src lib)
|
target_include_directories(firmware PRIVATE src lib)
|
||||||
|
|
||||||
target_compile_options(firmware PRIVATE -Wdouble-promotion)
|
target_compile_options(firmware PRIVATE -Wdouble-promotion)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue