Skip to content

Commit

Permalink
cmake: add serial param & ROMFS generation to the build system
Browse files Browse the repository at this point in the history
- only a few configs done yet
  • Loading branch information
bkueng committed Sep 25, 2018
1 parent 5bb75a7 commit c237221
Show file tree
Hide file tree
Showing 16 changed files with 101 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -530,4 +531,4 @@ else()
set(CPACK_GENERATOR "ZIP")
endif()

include(CPack)
include(CPack)
6 changes: 5 additions & 1 deletion ROMFS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -83,13 +83,17 @@ 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
${romfs_cmake_files}
${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"
)

Expand Down
6 changes: 6 additions & 0 deletions cmake/configs/nuttx_aerocore2_default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions cmake/configs/nuttx_aerofc-v1_default.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions cmake/configs/nuttx_auav-x21_default.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions cmake/configs/nuttx_av-x-v1_default.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions cmake/configs/nuttx_mindpx-v2_default.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions cmake/configs/nuttx_nxphlite-v3_default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions cmake/configs/nuttx_omnibus-f4sd_default.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions cmake/configs/nuttx_px4fmu-v2_default.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
7 changes: 7 additions & 0 deletions cmake/configs/nuttx_px4fmu-v3_default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions cmake/configs/nuttx_px4fmu-v4_default.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 8 additions & 0 deletions cmake/configs/nuttx_px4fmu-v4pro_default.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions cmake/configs/nuttx_px4fmu-v5_default.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/generated_serial_params.c

16 changes: 15 additions & 1 deletion src/lib/parameters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,32 @@ 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}
--board ${BOARD}
#--verbose
DEPENDS
${param_src_files}
${generated_serial_params_file}
parameters_injected.xml
px4params/srcparser.py
px4params/srcscanner.py
Expand Down

0 comments on commit c237221

Please sign in to comment.