mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00: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)
|
||||
endif()
|
||||
|
||||
file(RELATIVE_PATH PX4_BINARY_DIR_REL ${CMAKE_CURRENT_BINARY_DIR} ${PX4_BINARY_DIR})
|
||||
|
||||
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,--warn-common
|
||||
-Wl,--gc-sections
|
||||
-Wl,--warn-common,--gc-sections
|
||||
|
||||
-Wl,--start-group
|
||||
${module_libraries}
|
||||
${nuttx_libs}
|
||||
${module_libraries}
|
||||
${nuttx_libs}
|
||||
-Wl,--end-group
|
||||
|
||||
m
|
||||
gcc
|
||||
)
|
||||
@@ -61,8 +65,6 @@ set(fw_file ${PX4_BINARY_DIR}/${FW_NAME})
|
||||
string(REPLACE ".elf" ".px4" 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
|
||||
COMMAND ${OBJCOPY} -O binary ${PX4_BINARY_DIR_REL}/${FW_NAME} ${BOARD}.bin
|
||||
DEPENDS ${FW_NAME}
|
||||
|
||||
Reference in New Issue
Block a user