mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
cmake determine relative path for firmware linking
This commit is contained in:
@@ -35,15 +35,19 @@ if (NOT LD_SCRIPT)
|
|||||||
set(LD_SCRIPT ld.script)
|
set(LD_SCRIPT ld.script)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
file(RELATIVE_PATH PX4_BINARY_DIR_REL ${CMAKE_CURRENT_BINARY_DIR} ${PX4_BINARY_DIR})
|
||||||
|
|
||||||
target_link_libraries(${FW_NAME}
|
target_link_libraries(${FW_NAME}
|
||||||
-TNuttX/nuttx/configs/${BOARD}/scripts/${LD_SCRIPT}
|
|
||||||
|
-Wl,--script=${PX4_BINARY_DIR_REL}/NuttX/nuttx/configs/${BOARD}/scripts/${LD_SCRIPT}
|
||||||
-Wl,-Map=${CONFIG}.map
|
-Wl,-Map=${CONFIG}.map
|
||||||
-Wl,--warn-common
|
-Wl,--warn-common,--gc-sections
|
||||||
-Wl,--gc-sections
|
|
||||||
-Wl,--start-group
|
-Wl,--start-group
|
||||||
${module_libraries}
|
${module_libraries}
|
||||||
${nuttx_libs}
|
${nuttx_libs}
|
||||||
-Wl,--end-group
|
-Wl,--end-group
|
||||||
|
|
||||||
m
|
m
|
||||||
gcc
|
gcc
|
||||||
)
|
)
|
||||||
@@ -61,8 +65,6 @@ set(fw_file ${PX4_BINARY_DIR}/${FW_NAME})
|
|||||||
string(REPLACE ".elf" ".px4" fw_file ${fw_file})
|
string(REPLACE ".elf" ".px4" fw_file ${fw_file})
|
||||||
string(REPLACE "nuttx_" "" fw_file ${fw_file})
|
string(REPLACE "nuttx_" "" fw_file ${fw_file})
|
||||||
|
|
||||||
file(RELATIVE_PATH PX4_BINARY_DIR_REL ${CMAKE_CURRENT_BINARY_DIR} ${PX4_BINARY_DIR})
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${BOARD}.bin
|
add_custom_command(OUTPUT ${BOARD}.bin
|
||||||
COMMAND ${OBJCOPY} -O binary ${PX4_BINARY_DIR_REL}/${FW_NAME} ${BOARD}.bin
|
COMMAND ${OBJCOPY} -O binary ${PX4_BINARY_DIR_REL}/${FW_NAME} ${BOARD}.bin
|
||||||
DEPENDS ${FW_NAME}
|
DEPENDS ${FW_NAME}
|
||||||
|
|||||||
Reference in New Issue
Block a user