px4-firmware/src/firmware/nuttx/CMakeLists.txt

58 lines
1.4 KiB
CMake
Raw Normal View History

2015-09-08 16:18:59 -03:00
px4_nuttx_generate_builtin_commands(
OUT builtin_commands.c
MODULE_LIST
${module_libraries}
2015-09-12 02:53:01 -03:00
${config_extra_builtin_cmds}
)
2015-09-08 16:18:59 -03:00
px4_nuttx_generate_romfs(OUT romfs.o
ROOT ROMFS/px4fmu_common)
px4_generate_parameters()
2015-09-08 16:18:59 -03:00
# add executable
add_executable(firmware_nuttx builtin_commands.c ${CMAKE_BINARY_DIR}/px4_parameters.c romfs.o)
2015-09-08 16:18:59 -03:00
set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export)
set(main_link_flags
"-T${nuttx_export_dir}/build/ld.script"
"-Wl,-Map=${CMAKE_BINARY_DIR}/main.map"
)
px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ")
set_target_properties(firmware_nuttx PROPERTIES LINK_FLAGS ${main_link_flags})
set(cmsis_lib ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a)
2015-09-08 16:18:59 -03:00
target_link_libraries(firmware_nuttx
-Wl,--start-group
${module_libraries}
${cmsis_lib}
2015-09-08 16:18:59 -03:00
apps nuttx nosys m gcc
-Wl,--end-group)
2015-09-11 07:38:39 -03:00
set(fw_file ${CMAKE_CURRENT_BINARY_DIR}/${OS}-${BOARD}-${LABEL}.px4)
add_custom_target(check_weak
COMMAND ${NM} firmware_nuttx | grep " w "
DEPENDS firmware_nuttx
)
2015-09-11 07:38:39 -03:00
px4_nuttx_add_firmware(OUT ${fw_file}
EXE firmware_nuttx
${config_firmware_options}
)
2015-09-08 16:18:59 -03:00
configure_file(gdbinit.in .gdbinit)
add_custom_target(debug
COMMAND ${GDB} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx
DEPENDS firmware_nuttx
${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
)
2015-09-08 16:18:59 -03:00
px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD}
2015-09-11 07:38:39 -03:00
BUNDLE ${fw_file})
install(FILES ${fw_file} DESTINATION .)
2015-09-08 16:18:59 -03:00
# vim: set noet ft=cmake fenc=utf-8 ff=unix :