Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable serial ports v2 #10337

Merged
merged 25 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9a3d4ca
cmake configs: minor cleanup for hott telemetry
bkueng Jun 7, 2018
33baa49
sf0x: add -d param to pass the serial port
bkueng Jun 7, 2018
1305d30
param: add 'param touch <param_name>' command
bkueng Jun 7, 2018
9cb4ef7
Tools/serial: add script to generate ROMFS serial startup logic & ser…
bkueng Jun 7, 2018
b9fb5f2
cmake: add serial param & ROMFS generation to the build system
bkueng Jun 7, 2018
36c4cda
px4_cli: add px4_get_parameter_value CLI helper method
bkueng Jun 7, 2018
88c616b
pwm.cpp: use px4_get_parameter_value
bkueng Jun 7, 2018
3729e4d
micrortps_client: use px4_get_parameter_value for baudrate
bkueng Jun 7, 2018
c1a6584
mavlink_main: use px4_get_parameter_value for baudrate, datarate and …
bkueng Jun 7, 2018
98b4776
gpssim: remove unused uart_path
bkueng Jun 7, 2018
4c2b849
boards: remove GPS_DEFAULT_UART_PORT
bkueng Jun 7, 2018
63090e3
px_process_params.py: fix default argument for --inject-xml
bkueng Aug 27, 2018
54602e8
Tools/validate_yaml: add schema validation for module yaml config files
bkueng Aug 27, 2018
6552a12
sf0x: avoid reopening the UART on startup
bkueng Sep 4, 2018
19cba1b
module_schema.yaml: add parameter definitions
bkueng Sep 4, 2018
883749a
module_schema.yaml: move from test/ to validation/
bkueng Sep 4, 2018
6c2032d
px4_module.h: remove unnecessary ;
bkueng Sep 5, 2018
15d993a
params: remove unused SENS_EN_* params
bkueng Sep 5, 2018
aadd938
Tools/serial: use per-module serial port config params, instead of pe…
bkueng Aug 27, 2018
8be6a4c
serial drivers/modules: add yaml config files
bkueng Aug 27, 2018
b0c0285
SYS_COMPANION: deprecate this param
bkueng Sep 5, 2018
4657334
rc.serial.jinja: remove 'param touch' for baudrates
bkueng Sep 5, 2018
b3d1af9
shellcheck: ignore SC2154 on NuttX
bkueng Sep 5, 2018
3bb734e
serial generate config add 10 generic serial ports
dagar Sep 16, 2018
69b098b
Jenkins: add module config validation to CI
bkueng Sep 22, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ if (NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
get_filename_component(EXTERNAL_MODULES_LOCATION "${EXTERNAL_MODULES_LOCATION}" ABSOLUTE)
endif()

set_property(GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)

include(platforms/${OS}/cmake/px4_impl_os.cmake)
include(configs/${CONFIG})
list(APPEND CMAKE_MODULE_PATH ${PX4_SOURCE_DIR}/platforms/${OS}/cmake)
Expand Down Expand Up @@ -473,8 +475,12 @@ add_custom_target(metadata_airframes
USES_TERMINAL
)

file(GLOB_RECURSE yaml_config_files ${PX4_SOURCE_DIR}/src/modules/*.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth getting rid of all cmake globbing to avoid possible surprises with incremental builds.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. This was just the quickest way to achieve it. Essentially I want to tell cmake 'give me all module configs for all possible modules'. And adding a new config with all modules does not seem right for that.

${PX4_SOURCE_DIR}/src/drivers/*.yaml ${PX4_SOURCE_DIR}/src/lib/*.yaml)
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 --config-files ${yaml_config_files}
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 +536,4 @@ else()
set(CPACK_GENERATOR "ZIP")
endif()

include(CPack)
include(CPack)
13 changes: 13 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,19 @@ pipeline {
}
}

stage('Module Config Validation') {
agent {
docker {
image 'px4io/px4-dev-base:2018-09-11'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
steps {
sh 'export'
sh 'make validate_module_configs'
}
}

} // parallel
} // stage Analysis

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ python_coverage:

# static analyzers (scan-build, clang-tidy, cppcheck)
# --------------------------------------------------------------------
.PHONY: scan-build posix_sitl_default-clang clang-tidy clang-tidy-fix clang-tidy-quiet cppcheck shellcheck_all
.PHONY: scan-build posix_sitl_default-clang clang-tidy clang-tidy-fix clang-tidy-quiet
.PHONY: cppcheck shellcheck_all validate_module_configs

scan-build:
@export CCC_CC=clang
Expand Down Expand Up @@ -364,6 +365,9 @@ shellcheck_all:
@$(SRC_DIR)/Tools/run-shellcheck.sh $(SRC_DIR)/ROMFS/px4fmu_common/
@make px4fmu-v2_default shellcheck

validate_module_configs:
@find $(SRC_DIR)/src/modules $(SRC_DIR)/src/drivers $(SRC_DIR)/src/lib -name *.yaml -type f -print0 | xargs -0 $(SRC_DIR)/Tools/validate_yaml.py --schema-file $(SRC_DIR)/validation/module_schema.yaml

# Cleanup
# --------------------------------------------------------------------
.PHONY: clean submodulesclean submodulesupdate gazeboclean distclean
Expand Down
15 changes: 14 additions & 1 deletion ROMFS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ 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
get_property(module_config_files GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)
file(GLOB jinja_templates ${PX4_SOURCE_DIR}/Tools/serial/*.jinja)
if (px4_constrained_flash_build)
set(added_arguments --constrained-flash)
endif()
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 +88,20 @@ 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-dir ${romfs_gen_root_dir}/init.d
--serial-ports ${board_serial_ports} ${added_arguments}
--config-files ${module_config_files} #--verbose
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_romfs_pruner.py
--folder ${romfs_gen_root_dir} --board ${BOARD}
DEPENDS
${jinja_templates}
${module_config_files}
${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 Expand Up @@ -167,6 +179,7 @@ if(SHELLCHECK_PATH)
--exclude=SC2086 # SC2086: Double quote to prevent globbing and word splitting.
--exclude=SC2039 # SC2039: In POSIX sh, == in place of = is undefined.
--exclude=SC2166 # SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
--exclude=SC2154 # SC2154: <var> is referenced but not assigned (NuttX uses different asssignment)
init.d/*
DEPENDS ${romfs_gen_root_dir}/init.d/rc.autostart
WORKING_DIRECTORY ${romfs_gen_root_dir}
Expand Down
7 changes: 6 additions & 1 deletion ROMFS/px4fmu_common/init.d/13013_deltaquad
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ then
param set PWM_RATE 400

param set SENS_BOARD_ROT 18
param set SYS_COMPANION 57600

# TELEM2 config
param set MAV_1_CONFIG 102
param set MAV_1_RATE 5000
param set MAV_1_FORWARD 1
param set SER_TEL2_BAUD 57600

param set VT_TYPE 2
param set VT_MOT_COUNT 4
Expand Down
2 changes: 0 additions & 2 deletions ROMFS/px4fmu_common/init.d/3100_tbs_caipirinha
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ then
param set PWM_DISARMED 0
param set PWM_MIN 900
param set PWM_MAX 2100

param set SYS_COMPANION 157600
fi

set MIXER caipi
Expand Down
7 changes: 5 additions & 2 deletions ROMFS/px4fmu_common/init.d/4030_3dr_solo
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,15 @@ then
param set RC5_MIN 1000
param set RC5_REV 1
param set RC5_TRIM 1500

# enable high-speed link on telem 1
param set MAV_0_RATE 80000
param set MAV_0_MODE 2
param set SER_TEL1_BAUD 921600
fi

set MIXER quad_x

set PWM_OUT 1234
set MIXER_AUX none

# enable high-speed link on telem 1
set MAVLINK_F "-d /dev/ttyS1 -b 921600 -r 80000 -m onboard -x"
7 changes: 5 additions & 2 deletions ROMFS/px4fmu_common/init.d/4070_aerofc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ then
param set MPC_Z_VEL_MAX_UP 5.0000
param set MPC_Z_VEL_P 0.8000

param set SYS_COMPANION 921600
# TELEM2 config
param set MAV_1_CONFIG 102
param set MAV_1_RATE 80000
param set MAV_1_FORWARD 1
param set SER_TEL2_BAUD 921600
fi

if param compare SYS_HITL 0
Expand All @@ -78,4 +82,3 @@ fi
set MIXER quad_x
set USE_IO no

set MAVLINK_COMPANION_DEVICE /dev/ttyS1
7 changes: 6 additions & 1 deletion ROMFS/px4fmu_common/init.d/4900_crazyflie
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,17 @@ then
param set PWM_RATE 3921

param set SDLOG_PROFILE 1

param set SENS_FLOW_MINRNG 0.05
param set SYS_COMPANION 20

param set SYS_FMU_TASK 1

fi

set PWM_DISARMED none
set PWM_MAX none
set PWM_MIN none

syslink start
mavlink start -d /dev/bridge0 -b 57600 -m osd -r 40000

Loading