2015-09-08 16:18:59 -03:00
|
|
|
px4_nuttx_generate_builtin_commands(
|
|
|
|
OUT builtin_commands.c
|
2015-09-11 00:43:59 -03:00
|
|
|
MODULE_LIST
|
|
|
|
${module_libraries}
|
2015-09-12 02:53:01 -03:00
|
|
|
${config_extra_builtin_cmds}
|
2015-09-10 18:44:27 -03:00
|
|
|
)
|
2015-09-08 16:18:59 -03:00
|
|
|
|
|
|
|
# add executable
|
2015-09-13 19:30:32 -03:00
|
|
|
add_executable(firmware_nuttx
|
2015-09-19 18:57:54 -03:00
|
|
|
builtin_commands.c)
|
|
|
|
|
|
|
|
|
2016-08-18 16:37:23 -03:00
|
|
|
set(nuttx_export_dir ${PX4_BINARY_DIR}/${BOARD}/NuttX/nuttx-export)
|
2015-09-12 06:26:31 -03:00
|
|
|
|
|
|
|
set(link_libs
|
2016-05-03 05:03:28 -03:00
|
|
|
romfs apps nuttx m gcc
|
2015-09-08 16:18:59 -03:00
|
|
|
)
|
|
|
|
|
2015-09-12 06:26:31 -03:00
|
|
|
if(NOT ${BOARD} STREQUAL "sim")
|
|
|
|
list(APPEND link_libs nosys)
|
|
|
|
set(main_link_flags
|
|
|
|
"-T${nuttx_export_dir}/build/ld.script"
|
2016-08-18 16:37:23 -03:00
|
|
|
"-Wl,-Map=${PX4_BINARY_DIR}/${BOARD}/main.map"
|
2015-09-12 06:26:31 -03:00
|
|
|
)
|
|
|
|
px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ")
|
|
|
|
set_target_properties(firmware_nuttx PROPERTIES LINK_FLAGS ${main_link_flags})
|
|
|
|
endif()
|
|
|
|
|
2015-09-08 16:18:59 -03:00
|
|
|
target_link_libraries(firmware_nuttx
|
|
|
|
-Wl,--start-group
|
2015-09-10 13:40:34 -03:00
|
|
|
${module_libraries}
|
2016-05-03 05:03:28 -03:00
|
|
|
${df_driver_libs}
|
2015-09-12 06:26:31 -03:00
|
|
|
${config_extra_libs}
|
|
|
|
${link_libs}
|
2015-09-08 16:18:59 -03:00
|
|
|
-Wl,--end-group)
|
|
|
|
|
2015-09-13 15:31:58 -03:00
|
|
|
add_custom_target(check_weak
|
2015-09-12 06:26:31 -03:00
|
|
|
COMMAND ${NM} firmware_nuttx | ${GREP} " w " | cat
|
2015-09-13 15:31:58 -03:00
|
|
|
DEPENDS firmware_nuttx
|
2015-09-12 06:26:31 -03:00
|
|
|
VERBATIM
|
2015-09-13 15:31:58 -03:00
|
|
|
)
|
|
|
|
|
2015-09-12 06:26:31 -03:00
|
|
|
if(NOT ${BOARD} STREQUAL "sim")
|
2015-10-24 11:57:46 -03:00
|
|
|
|
2015-11-13 18:45:07 -04:00
|
|
|
if (config_io_board)
|
2016-08-18 16:37:23 -03:00
|
|
|
set(extras "${PX4_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}.bin")
|
2015-11-13 18:45:07 -04:00
|
|
|
endif()
|
2015-11-22 19:43:56 -04:00
|
|
|
|
2016-04-22 16:15:37 -03:00
|
|
|
set(romfs_dir "ROMFS/px4fmu_common")
|
2016-07-12 21:47:55 -03:00
|
|
|
if (${BOARD} STREQUAL "tap-v1")
|
2016-08-18 16:37:23 -03:00
|
|
|
set(romfs_dir "ROMFS/tap_common")
|
2016-07-12 21:47:55 -03:00
|
|
|
endif()
|
2016-04-22 16:15:37 -03:00
|
|
|
if (${BOARD} STREQUAL "px4fmu-v2" AND ${LABEL} STREQUAL "test")
|
|
|
|
set(romfs_dir "ROMFS/px4fmu_test")
|
|
|
|
endif()
|
2015-10-24 11:57:46 -03:00
|
|
|
|
2016-07-12 21:47:55 -03:00
|
|
|
|
2015-10-24 11:57:46 -03:00
|
|
|
px4_nuttx_add_romfs(OUT romfs
|
2016-04-22 16:15:37 -03:00
|
|
|
ROOT ${romfs_dir}
|
2015-11-13 18:45:07 -04:00
|
|
|
EXTRAS ${extras}
|
2015-10-24 11:57:46 -03:00
|
|
|
)
|
2015-11-13 18:45:07 -04:00
|
|
|
if (config_io_board)
|
|
|
|
add_dependencies(romfs fw_io)
|
2015-10-21 17:22:55 -03:00
|
|
|
endif()
|
2016-04-22 16:15:37 -03:00
|
|
|
|
|
|
|
set(fw_file ${CMAKE_CURRENT_BINARY_DIR}/${OS}-${BOARD}-${LABEL}.px4)
|
2015-09-08 16:18:59 -03:00
|
|
|
|
2015-09-12 06:26:31 -03:00
|
|
|
px4_nuttx_add_firmware(OUT ${fw_file}
|
|
|
|
BOARD ${BOARD}
|
|
|
|
EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx
|
2016-08-18 16:37:23 -03:00
|
|
|
PARAM_XML ${PX4_BINARY_DIR}/parameters.xml
|
|
|
|
AIRFRAMES_XML ${PX4_BINARY_DIR}/airframes.xml
|
2015-09-12 06:26:31 -03:00
|
|
|
)
|
2015-09-13 15:31:58 -03:00
|
|
|
|
2015-09-12 06:26:31 -03:00
|
|
|
configure_file(gdbinit.in .gdbinit)
|
|
|
|
|
|
|
|
add_custom_target(debug
|
2015-10-06 13:10:23 -03:00
|
|
|
COMMAND ${GDB} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx
|
|
|
|
DEPENDS firmware_nuttx
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(debug_tui
|
2015-09-19 11:39:54 -03:00
|
|
|
COMMAND ${GDBTUI} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx
|
|
|
|
DEPENDS firmware_nuttx
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
|
|
|
)
|
|
|
|
|
2015-10-06 13:10:23 -03:00
|
|
|
add_custom_target(debug_ddd
|
|
|
|
COMMAND ${DDD} --debugger ${GDB} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx
|
|
|
|
DEPENDS firmware_nuttx
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
|
|
|
)
|
|
|
|
|
2015-09-19 11:39:54 -03:00
|
|
|
add_custom_target(debug_io
|
2015-10-06 13:10:23 -03:00
|
|
|
COMMAND ${GDB}
|
2016-08-18 16:37:23 -03:00
|
|
|
${PX4_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}
|
2015-10-06 13:10:23 -03:00
|
|
|
DEPENDS firmware_nuttx
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(debug_io_tui
|
2015-09-19 11:39:54 -03:00
|
|
|
COMMAND ${GDBTUI}
|
2016-08-18 16:37:23 -03:00
|
|
|
${PX4_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}
|
2015-09-12 06:26:31 -03:00
|
|
|
DEPENDS firmware_nuttx
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
|
|
|
)
|
2015-09-13 15:31:58 -03:00
|
|
|
|
2015-10-06 13:10:23 -03:00
|
|
|
add_custom_target(debug_io_ddd
|
|
|
|
COMMAND ${DDD} --debugger ${GDB}
|
2016-08-18 16:37:23 -03:00
|
|
|
${PX4_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}
|
2015-10-06 13:10:23 -03:00
|
|
|
DEPENDS firmware_nuttx
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
|
|
|
)
|
|
|
|
|
2015-09-12 06:26:31 -03:00
|
|
|
px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD}
|
|
|
|
BUNDLE ${fw_file})
|
|
|
|
endif()
|
2015-09-11 07:38:39 -03:00
|
|
|
|
|
|
|
install(FILES ${fw_file} DESTINATION .)
|
2015-09-08 16:18:59 -03:00
|
|
|
|
|
|
|
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|