cmake: add serial param & ROMFS generation to the build system

- only a few configs done yet
This commit is contained in:
Beat Küng 2018-06-07 14:02:47 +02:00
parent 5bb75a7ff8
commit c237221a81
16 changed files with 101 additions and 3 deletions

View File

@ -475,6 +475,7 @@ add_custom_target(metadata_airframes
add_custom_target(metadata_parameters
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/docs
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/serial/generate_config.py --all-ports --params-file ${PX4_SOURCE_DIR}/src/generated_serial_params.c
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/parameters/px_process_params.py
--src-path `find ${PX4_SOURCE_DIR}/src -maxdepth 4 -type d`
--inject-xml ${PX4_SOURCE_DIR}/src/lib/parameters/parameters_injected.xml
@ -530,4 +531,4 @@ else()
set(CPACK_GENERATOR "ZIP")
endif()
include(CPack)
include(CPack)

View File

@ -73,7 +73,7 @@ add_subdirectory(${romfs_src_dir})
# copy all romfs files, process airframes, prune comments
get_property(romfs_cmake_files GLOBAL PROPERTY PX4_ROMFS_CMAKE_FILES)
get_property(romfs_copy_files GLOBAL PROPERTY PX4_ROMFS_FILES)
add_custom_command(OUTPUT ${romfs_gen_root_dir}/init.d/rcS ${romfs_gen_root_dir}/init.d/rc.autostart
add_custom_command(OUTPUT ${romfs_gen_root_dir}/init.d/rcS ${romfs_gen_root_dir}/init.d/rc.serial ${romfs_gen_root_dir}/init.d/rc.autostart
COMMAND ${CMAKE_COMMAND} -E remove_directory ${romfs_gen_root_dir}
# TODO: we should only copy the files in ${romfs_copy_files}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${romfs_src_dir} ${romfs_gen_root_dir}
@ -83,6 +83,9 @@ add_custom_command(OUTPUT ${romfs_gen_root_dir}/init.d/rcS ${romfs_gen_root_dir}
--airframes-path ${romfs_gen_root_dir}/init.d
--start-script ${romfs_gen_root_dir}/init.d/rc.autostart
--board ${BOARD}
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/serial/generate_config.py
--rc-file ${romfs_temp_dir}/init.d/rc.serial
--serial-ports ${board_serial_ports} #--verbose
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_romfs_pruner.py
--folder ${romfs_gen_root_dir} --board ${BOARD}
DEPENDS
@ -90,6 +93,7 @@ add_custom_command(OUTPUT ${romfs_gen_root_dir}/init.d/rcS ${romfs_gen_root_dir}
${romfs_copy_files}
${PX4_SOURCE_DIR}/Tools/px_process_airframes.py
${PX4_SOURCE_DIR}/Tools/px_romfs_pruner.py
${PX4_SOURCE_DIR}/Tools/serial/generate_config.py
COMMENT "ROMFS: copying, generating airframes, pruning"
)

View File

@ -3,6 +3,12 @@ px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common)
set(config_uavcan_num_ifaces 1)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS0
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2)
set(config_module_list
#
# Board support modules

View File

@ -1,6 +1,12 @@
px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS5
TEL1:/dev/ttyS3
TEL2:/dev/ttyS1)
set(config_module_list
#
# Board support modules

View File

@ -1,6 +1,12 @@
px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common IO px4io-v2)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS3
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2)
set(config_uavcan_num_ifaces 1)
set(config_module_list

View File

@ -1,6 +1,13 @@
px4_nuttx_configure(HWCLASS m7 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS6
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2
TEL4:/dev/ttyS3)
set(config_uavcan_num_ifaces 1)
set(config_module_list

View File

@ -1,6 +1,12 @@
px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS3
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2)
set(config_uavcan_num_ifaces 1)
set(config_module_list

View File

@ -5,6 +5,11 @@ set(UAVCAN_PLATFORM kinetis CACHE STRING "uavcan platform")
set(UAVCAN_TIMER 1)
set(config_uavcan_num_ifaces 2)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS3
TEL1:/dev/ttyS4)
set(config_module_list
#
# Board support modules

View File

@ -1,6 +1,11 @@
px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common)
# user-configurable UART ports
set(board_serial_ports
TEL2:/dev/ttyS1
URT6:/dev/ttyS2)
set(config_module_list
#
# Board support modules

View File

@ -1,5 +1,12 @@
px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common IO px4io-v2)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS3
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2
TEL4:/dev/ttyS6)
#set(config_uavcan_num_ifaces 2)
set(config_bl_file ${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/extras/px4fmuv3_bl.bin)

View File

@ -7,6 +7,13 @@ set(LD_SCRIPT ld_full.script CACHE string "" FORCE)
px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common IO px4io-v2)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS3
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2
TEL4:/dev/ttyS6)
set(config_uavcan_num_ifaces 2)
set(config_module_list

View File

@ -1,6 +1,12 @@
px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS3
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2)
set(config_uavcan_num_ifaces 1)
set(config_module_list

View File

@ -1,6 +1,14 @@
px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common IO px4io-v2)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS3
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2
TEL3:/dev/ttyS0
TEL4:/dev/ttyS6)
set(config_uavcan_num_ifaces 2)
set(config_module_list

View File

@ -1,6 +1,13 @@
px4_nuttx_configure(HWCLASS m7 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common IO px4io-v2)
# user-configurable UART ports
set(board_serial_ports
GPS1:/dev/ttyS0
TEL1:/dev/ttyS1
TEL2:/dev/ttyS2
TEL4:/dev/ttyS3)
set(config_uavcan_num_ifaces 2)
set(config_module_list

3
src/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/generated_serial_params.c

View File

@ -68,11 +68,24 @@ endif()
list(REMOVE_DUPLICATES module_list)
get_property(module_config_files GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)
set(generated_params_dir ${PX4_BINARY_DIR}/generated_params)
set(generated_serial_params_file ${generated_params_dir}/serial_params.c)
add_custom_command(OUTPUT ${generated_serial_params_file}
COMMAND ${CMAKE_COMMAND} -E make_directory ${generated_params_dir}
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/serial/generate_config.py
--params-file ${generated_serial_params_file}
--serial-ports ${board_serial_ports} #--verbose
DEPENDS
${PX4_SOURCE_DIR}/Tools/serial/generate_config.py
COMMENT "Generating serial_params.c"
)
set(parameters_xml ${PX4_BINARY_DIR}/parameters.xml)
file(GLOB_RECURSE param_src_files ${PX4_SOURCE_DIR}/src/*params.c)
add_custom_command(OUTPUT ${parameters_xml}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/px_process_params.py
--src-path ${module_list}
--src-path ${module_list} ${generated_params_dir}
--xml ${parameters_xml}
--inject-xml ${CMAKE_CURRENT_SOURCE_DIR}/parameters_injected.xml
--overrides ${PARAM_DEFAULT_OVERRIDES}
@ -80,6 +93,7 @@ add_custom_command(OUTPUT ${parameters_xml}
#--verbose
DEPENDS
${param_src_files}
${generated_serial_params_file}
parameters_injected.xml
px4params/srcparser.py
px4params/srcscanner.py