diff --git a/.ci/Jenkinsfile-SITL_tests b/.ci/Jenkinsfile-SITL_tests index ab96c2706c8f..5170ad937891 100644 --- a/.ci/Jenkinsfile-SITL_tests +++ b/.ci/Jenkinsfile-SITL_tests @@ -3,80 +3,32 @@ pipeline { agent none - parameters { - choice( - name: 'PX4_CMAKE_BUILD_TYPE', - choices: ['RelWithDebInfo', 'Coverage', 'AddressSanitizer', 'UndefinedBehaviorSanitizer'], - description: "CMake build type" - ) - } - stages { stage('Build') { - agent { docker { - image 'px4io/px4-dev-ros-kinetic:2018-09-11' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE --cap-add SYS_PTRACE' + image 'px4io/px4-dev-ros-kinetic:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE' } } - - stages { - - stage('build px4') { - steps { - sh('export') - sh('make distclean') - sh "ccache -z" - sh "git fetch --tags" - sh('make posix_sitl_default') - sh "ccache -s" - } - } - - stage('stash build for coverage') { - steps { - stash includes: 'build/**/*', name: 'build_sitl_coverage', useDefaultExcludes: false - } - when { - environment name: 'PX4_CMAKE_BUILD_TYPE', value: 'Coverage' - } - } - - stage('unit tests') { - steps { - sh 'export' - sh 'make posix_sitl_default test_results_junit' - junit 'build/posix_sitl_default/JUnitTestResults.xml' - } - } - - stage('build sitl_gazebo') { - steps { - sh 'export' - sh "ccache -z" - sh('make posix_sitl_default sitl_gazebo') - sh "ccache -s" - } - } - - stage('package') { - steps { - sh 'export' - sh('make posix_sitl_default package') - stash(name: "px4_sitl_package", includes: "build/posix_sitl_default/*.bz2") - } - } - + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'git fetch --tags' + sh 'make px4_sitl_default' + sh 'make px4_sitl_default sitl_gazebo' + sh 'make px4_sitl_default package' + sh 'ccache -s' + stash(name: "px4_sitl_package", includes: "build/px4_sitl_default/*.bz2") + archiveArtifacts(artifacts: "build/px4_sitl_default/*.bz2", fingerprint: true, onlyIfSuccessful: true) } - post { always { sh 'make distclean' } } - } // stage Build stage('ROS Tests') { @@ -127,6 +79,13 @@ pipeline { mission: "VTOL_mission_1", vehicle: "tiltrotor" ], + [ + name: "MC_avoidance", + test: "mavros_posix_test_avoidance.test", + mission: "avoidance", + vehicle: "iris_obs_avoid", + run_script: "rostest_avoidance_run.sh" + ], ] @@ -140,64 +99,11 @@ pipeline { } // steps } // stage ROS Tests - stage('Coverage') { - parallel { - - stage('code coverage (python)') { - agent { - docker { - image 'px4io/px4-dev-base:2018-09-11' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw --cap-add SYS_PTRACE' - } - } - steps { - sh 'export' - sh 'make distclean' - sh 'make python_coverage' - withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) { - sh 'curl -s https://codecov.io/bash | bash -s - -F python' - } - - sh 'make distclean' - } - - when { - environment name: 'PX4_CMAKE_BUILD_TYPE', value: 'Coverage' - } - } - - stage('unit tests') { - agent { - docker { - image 'px4io/px4-dev-base:2018-09-11' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw --cap-add SYS_PTRACE' - } - } - steps { - sh 'export' - sh 'make distclean' - sh 'make posix_sitl_default test_results_junit' - withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) { - sh 'curl -s https://codecov.io/bash | bash -s - -F unittest' - } - sh 'make distclean' - } - when { - environment name: 'PX4_CMAKE_BUILD_TYPE', value: 'Coverage' - } - } - - } // parallel - } // stage Coverage - } //stages environment { - ASAN_OPTIONS = 'detect_stack_use_after_return=1:check_initialization_order=1' - UBSAN_OPTIONS = 'print_stacktrace=1' CCACHE_DIR = '/tmp/ccache' CI = true - CTEST_OUTPUT_ON_FAILURE = 1 } options { @@ -210,22 +116,18 @@ def createTestNode(Map test_def) { return { node { cleanWs() - docker.image("px4io/px4-dev-ros-kinetic:2018-09-11").inside('-e HOME=${WORKSPACE} --cap-add SYS_PTRACE') { + docker.image("px4io/px4-dev-ros-kinetic:2019-03-08").inside('-e HOME=${WORKSPACE}') { stage(test_def.name) { + def run_script = test_def.get('run_script', 'rostest_px4_run.sh') def test_ok = true sh('export') - if (env.PX4_CMAKE_BUILD_TYPE == 'Coverage') { - checkout(scm) - unstash 'build_sitl_coverage' - } - unstash('px4_sitl_package') - sh('tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2') + sh('tar -xjpvf build/px4_sitl_default/px4-px4_sitl_default*.bz2') // run test try { - sh('px4-posix_sitl_default*/px4/test/rostest_px4_run.sh ' + test_def.test + ' mission:=' + test_def.mission + ' vehicle:=' + test_def.vehicle) + sh('px4-px4_sitl_default*/px4/test/' + run_script + ' ' + test_def.test + ' mission:=' + test_def.mission + ' vehicle:=' + test_def.vehicle) } catch (exc) { // save all test artifacts for debugging @@ -234,41 +136,19 @@ def createTestNode(Map test_def) { } // log analysis - if (env.PX4_CMAKE_BUILD_TYPE == 'Coverage') { - withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) { - sh 'curl -s https://codecov.io/bash | bash -s - -F sitl_mission_${STAGE_NAME}' - - // process log data (with python code coverage) - try { - sh('coverage run -p px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg') - } catch (exc) { - // save log analysis artifacts for debugging - archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv') - // FIXME: don't let the script to fail the build - // test_ok = false - } - - // upload log to flight review (https://logs.px4.io/) with python code coverage - sh('coverage run -p px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg') - - // upload python code coverage to codecov.io - sh 'curl -s https://codecov.io/bash | bash -s - -X gcov -F sitl_python_${STAGE_NAME}' - } - } else { // non code coverage - // process ekf log data - try { - sh('px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg') - } catch (exc) { - // save log analysis artifacts for debugging - archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv') - // FIXME: don't let the script to fail the build - // test_ok = false - } - - // upload log to flight review (https://logs.px4.io/) - sh('px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg') + // process ekf log data + try { + sh('px4-px4_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg') + } catch (exc) { + // save log analysis artifacts for debugging + archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv') + // FIXME: don't let the script to fail the build + // test_ok = false } + // upload log to flight review (https://logs.px4.io/) + sh('px4-px4_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg') + if (!test_ok) { error('ROS Test failed') } diff --git a/.ci/Jenkinsfile-SITL_tests_ASan b/.ci/Jenkinsfile-SITL_tests_ASan new file mode 100644 index 000000000000..c4c6718b49b0 --- /dev/null +++ b/.ci/Jenkinsfile-SITL_tests_ASan @@ -0,0 +1,153 @@ +#!/usr/bin/env groovy + +pipeline { + agent none + + stages { + + stage('Build') { + agent { + docker { + image 'px4io/px4-dev-ros-kinetic:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'git fetch --tags' + sh 'make px4_sitl_default' + sh 'make px4_sitl_default sitl_gazebo' + sh 'make px4_sitl_default package' + sh 'ccache -s' + stash(name: "px4_sitl_package", includes: "build/px4_sitl_default/*.bz2") + //archiveArtifacts(artifacts: "build/px4_sitl_default/*.bz2", fingerprint: true, onlyIfSuccessful: true) + } + post { + always { + sh 'make distclean' + } + } + } // stage Build + + stage('ROS Tests') { + steps { + script { + def missions = [ + [ + name: "FW", + test: "mavros_posix_test_mission.test", + mission: "FW_mission_1", + vehicle: "plane" + ], + + [ + name: "MC_box", + test: "mavros_posix_test_mission.test", + mission: "MC_mission_box", + vehicle: "iris" + ], + [ + name: "MC_offboard_att", + test: "mavros_posix_tests_offboard_attctl.test", + mission: "", + vehicle: "iris" + ], + [ + name: "MC_offboard_pos", + test: "mavros_posix_tests_offboard_posctl.test", + mission: "", + vehicle: "iris" + ], + + [ + name: "VTOL_standard", + test: "mavros_posix_test_mission.test", + mission: "VTOL_mission_1", + vehicle: "standard_vtol" + ], + [ + name: "VTOL_tailsitter", + test: "mavros_posix_test_mission.test", + mission: "VTOL_mission_1", + vehicle: "tailsitter" + ], + [ + name: "VTOL_tiltrotor", + test: "mavros_posix_test_mission.test", + mission: "VTOL_mission_1", + vehicle: "tiltrotor" + ], + + ] + + def test_nodes = [:] + for (def i = 0; i < missions.size(); i++) { + test_nodes.put(missions[i].name, createTestNode(missions[i])) + } + + parallel test_nodes + } // script + } // steps + } // stage ROS Tests + + } //stages + + environment { + CCACHE_DIR = '/tmp/ccache' + CI = true + PX4_CMAKE_BUILD_TYPE = 'AddressSanitizer' + } + + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30')) + timeout(time: 60, unit: 'MINUTES') + } +} // pipeline + +def createTestNode(Map test_def) { + return { + node { + cleanWs() + docker.image("px4io/px4-dev-ros-kinetic:2019-03-08").inside('-e HOME=${WORKSPACE}') { + stage(test_def.name) { + def test_ok = true + sh('export') + + unstash('px4_sitl_package') + sh('tar -xjpvf build/px4_sitl_default/px4-px4_sitl_default*.bz2') + + // run test + try { + sh('px4-px4_sitl_default*/px4/test/rostest_px4_run.sh ' + test_def.test + ' mission:=' + test_def.mission + ' vehicle:=' + test_def.vehicle) + + } catch (exc) { + // save all test artifacts for debugging + archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.ulg, .ros/**/rosunit-*.xml, .ros/**/rostest-*.log') + test_ok = false + } + + // log analysis + // process ekf log data + try { + sh('px4-px4_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg') + } catch (exc) { + // save log analysis artifacts for debugging + archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv') + // FIXME: don't let the script to fail the build + // test_ok = false + } + + // upload log to flight review (https://logs.px4.io/) + sh('px4-px4_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg') + + if (!test_ok) { + error('ROS Test failed') + } + } // stage + cleanWs() + } // docker.image + } // node + } // return +} // createTestNode diff --git a/.ci/Jenkinsfile-SITL_tests_coverage b/.ci/Jenkinsfile-SITL_tests_coverage new file mode 100644 index 000000000000..7862d2268313 --- /dev/null +++ b/.ci/Jenkinsfile-SITL_tests_coverage @@ -0,0 +1,182 @@ +#!/usr/bin/env groovy + +pipeline { + agent none + + stages { + + stage('ROS Tests') { + steps { + script { + def missions = [ + [ + name: "FW", + test: "mavros_posix_test_mission.test", + mission: "FW_mission_1", + vehicle: "plane" + ], + + [ + name: "MC_box", + test: "mavros_posix_test_mission.test", + mission: "MC_mission_box", + vehicle: "iris" + ], + [ + name: "MC_offboard_att", + test: "mavros_posix_tests_offboard_attctl.test", + mission: "", + vehicle: "iris" + ], + [ + name: "MC_offboard_pos", + test: "mavros_posix_tests_offboard_posctl.test", + mission: "", + vehicle: "iris" + ], + + [ + name: "VTOL_standard", + test: "mavros_posix_test_mission.test", + mission: "VTOL_mission_1", + vehicle: "standard_vtol" + ], + [ + name: "VTOL_tailsitter", + test: "mavros_posix_test_mission.test", + mission: "VTOL_mission_1", + vehicle: "tailsitter" + ], + [ + name: "VTOL_tiltrotor", + test: "mavros_posix_test_mission.test", + mission: "VTOL_mission_1", + vehicle: "tiltrotor" + ], + + ] + + def test_nodes = [:] + for (def i = 0; i < missions.size(); i++) { + test_nodes.put(missions[i].name, createTestNode(missions[i])) + } + + parallel test_nodes + } // script + } // steps + } // stage ROS Tests + + stage('Coverage') { + parallel { + + stage('code coverage (python)') { + agent { + docker { + image 'px4io/px4-dev-base-bionic:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'make python_coverage' + withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) { + sh 'curl -s https://codecov.io/bash | bash -s - -F python' + } + + sh 'make distclean' + } + } + + stage('unit tests') { + agent { + docker { + image 'px4io/px4-dev-base-bionic:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'make px4_sitl_test test_results_junit' + withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) { + sh 'curl -s https://codecov.io/bash | bash -s - -F unittest' + } + sh 'make distclean' + } + } + + } // parallel + } // stage Coverage + + } //stages + + environment { + CCACHE_DIR = '/tmp/ccache' + CI = true + CTEST_OUTPUT_ON_FAILURE = 1 + PX4_CMAKE_BUILD_TYPE = 'Coverage' + } + + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30')) + timeout(time: 60, unit: 'MINUTES') + } +} // pipeline + +def createTestNode(Map test_def) { + return { + node { + cleanWs() + docker.image("px4io/px4-dev-ros-kinetic:2019-03-08").inside('-e HOME=${WORKSPACE}') { + stage(test_def.name) { + def test_ok = true + sh('export') + + checkout(scm) + + // run test + try { + sh('make distclean') + sh('ccache -z') + sh('make px4_sitl_default') + sh('make px4_sitl_default sitl_gazebo') + sh('ccache -s') + sh('make rostest_run TEST_FILE=' + test_def.test + ' TEST_MISSION=' + test_def.mission + ' TEST_VEHICLE=' + test_def.vehicle) + } catch (exc) { + // save all test artifacts for debugging + archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.ulg, .ros/**/rosunit-*.xml, .ros/**/rostest-*.log') + test_ok = false + } + + // log analysis + withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) { + sh 'curl -s https://codecov.io/bash | bash -s - -F sitl_mission_${STAGE_NAME}' + + // process log data (with python code coverage) + try { + //sh('coverage run -p Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg') + sh('Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg') + } catch (exc) { + // save log analysis artifacts for debugging + archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv') + // FIXME: don't let the script to fail the build + // test_ok = false + } + + // upload log to flight review (https://logs.px4.io/) with python code coverage + sh('coverage run -p Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg') + + // upload python code coverage to codecov.io + sh 'curl -s https://codecov.io/bash | bash -s - -X gcov -F sitl_python_${STAGE_NAME}' + } + + if (!test_ok) { + error('ROS Test failed') + } + } // stage + cleanWs() + } // docker.image + } // node + } // return +} // createTestNode diff --git a/.ci/Jenkinsfile-compile b/.ci/Jenkinsfile-compile index f6dc68e41811..27370b47dc47 100644 --- a/.ci/Jenkinsfile-compile +++ b/.ci/Jenkinsfile-compile @@ -9,112 +9,59 @@ pipeline { script { def build_nodes = [:] def docker_images = [ - arch: "px4io/px4-dev-base-archlinux:2018-09-11", - armhf: "px4io/px4-dev-armhf:2018-09-11", - base: "px4io/px4-dev-base:2018-09-11", - clang: "px4io/px4-dev-clang:2018-09-11", - nuttx: "px4io/px4-dev-nuttx:2018-09-11", - ros: "px4io/px4-dev-ros:2018-09-11", - rpi: "px4io/px4-dev-raspi:2018-09-11", + armhf: "px4io/px4-dev-armhf:2019-03-08", + base: "px4io/px4-dev-base-bionic:2019-03-08", + nuttx: "px4io/px4-dev-nuttx:2019-03-08", + ros: "px4io/px4-dev-ros-kinetic:2019-03-08", + rpi: "px4io/px4-dev-raspi:2019-03-08", snapdragon: "lorenzmeier/px4-dev-snapdragon:2018-09-12" ] - // MAC OSX posix_sitl_default - build_nodes["posix_sitl_default (OSX)"] = { - node("mac") { - withEnv(["CCACHE_BASEDIR=${pwd()}"]) { - stage("sitl (OSX)") { - try { - checkout(scm) - sh('export') - sh('make distclean') - sh('ccache -z') - sh('make posix_sitl_default') - sh('ccache -s') - } - catch (exc) { - throw (exc) - } - finally { - sh('make distclean') - } - } - } - } - } - - // MAC OSX nuttx_px4fmu-v4pro_default - build_nodes["px4fmu-v4pro_default (OSX)"] = { - node("mac") { - withEnv(["CCACHE_BASEDIR=${pwd()}"]) { - stage("px4fmu-v4pro (OSX)") { - try { - checkout(scm) - sh('export') - sh('make distclean') - sh('ccache -z') - sh('make nuttx_px4fmu-v4pro_default') - sh('ccache -s') - } - catch (exc) { - throw (exc) - } - finally { - sh('make distclean') - } - } - } - } - } - - // docker builds: - def arch_builds = [ - target: ["posix_sitl_default"], - image: docker_images.arch, - archive: false - ] - def armhf_builds = [ - target: ["posix_ocpoc_ubuntu"], + target: ["aerotenna_ocpoc_ubuntu"], image: docker_images.armhf, archive: false ] def base_builds = [ - target: ["posix_sitl_rtps"], + target: ["px4_sitl_rtps"], image: docker_images.base, archive: false ] def nuttx_builds_archive = [ - target: ["px4fmu-v2_default", "px4fmu-v3_default", "px4fmu-v4_default", "px4fmu-v4pro_default", "px4fmu-v5_default", "px4fmu-v5_rtps", "px4fmu-v5_stackcheck", - "aerofc-v1_default", "aerocore2_default", "auav-x21_default", "av-x-v1_default", "crazyflie_default", "mindpx-v2_default", - "nxphlite-v3_default", "omnibus-f4sd_default"], + target: [ + "px4_fmu-v2_default", "px4_fmu-v2_fixedwing", "px4_fmu-v2_lpe", "px4_fmu-v2_multicopter", "px4_fmu-v2_rover", "px4_fmu-v2_test", + "px4_fmu-v3_default", + "px4_fmu-v4_default", + "px4_fmu-v4pro_default", + "px4_fmu-v5_default", "px4_fmu-v5_fixedwing", "px4_fmu-v5_multicopter", "px4_fmu-v5_rover", "px4_fmu-v5_rtps", "px4_fmu-v5_stackcheck", + "intel_aerofc-v1_default", "auav_x21_default", "av_x-v1_default", "bitcraze_crazyflie_default", "airmind_mindpx-v2_default", + "nxp_fmuk66-v3_default", "omnibus_f4sd_default"], image: docker_images.nuttx, archive: true ] def nuttx_builds_other = [ - target: ["px4-same70xplained-v1_default", "px4-stm32f4discovery_default", "px4cannode-v1_default", - "px4esc-v1_default", "px4nucleoF767ZI-v1_default", "s2740vc-v1_default"], + target: ["px4_cannode-v1_default", "px4_esc-v1_default", "thiemar_s2740vc-v1_default"], image: docker_images.nuttx, archive: false ] def rpi_builds = [ - target: ["posix_rpi_cross", "posix_bebop_default"], + target: ["emlid_navio2_cross", "parrot_bebop_default"], image: docker_images.rpi, archive: false ] def snapdragon_builds = [ - target: ["qurt_eagle_default", "posix_eagle_default"], + target: ["atlflight_eagle_qurt-default", "atlflight_eagle_default"], image: docker_images.snapdragon, archive: false ] def docker_builds = [ - arch_builds, armhf_builds, base_builds, nuttx_builds_archive, nuttx_builds_other, rpi_builds, snapdragon_builds + armhf_builds, base_builds, nuttx_builds_archive, nuttx_builds_other, rpi_builds, snapdragon_builds ] for (def build_type = 0; build_type < docker_builds.size(); build_type++) { @@ -132,25 +79,25 @@ pipeline { } // stage Build // TODO: actually upload artifacts to S3 - stage('S3 Upload') { - agent { - docker { image 'px4io/px4-dev-base:2018-09-11' } - } - options { - skipDefaultCheckout() - } - when { - anyOf { - branch 'master' - branch 'beta' - branch 'stable' - branch 'pr-jenkins' // for testing - } - } - steps { - sh 'echo "uploading to S3"' - } - } + // stage('S3 Upload') { + // agent { + // docker { image 'px4io/px4-dev-base-bionic:2019-03-08' } + // } + // options { + // skipDefaultCheckout() + // } + // when { + // anyOf { + // branch 'master' + // branch 'beta' + // branch 'stable' + // branch 'pr-jenkins' // for testing + // } + // } + // steps { + // sh 'echo "uploading to S3"' + // } + // } } // stages environment { @@ -158,16 +105,23 @@ pipeline { CI = true } options { - buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30')) + buildDiscarder(logRotator(numToKeepStr: '2', artifactDaysToKeepStr: '14')) timeout(time: 60, unit: 'MINUTES') } } def createBuildNode(Boolean archive, String docker_image, String target) { return { + + // TODO: fix the snapdragon image + bypass_entrypoint = '' + if (docker_image == 'lorenzmeier/px4-dev-snapdragon:2018-09-12') { + bypass_entrypoint = ' --entrypoint=""' + } + node { docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_dagar') { - docker.image(docker_image).inside('-e CCACHE_BASEDIR=${WORKSPACE} -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') { + docker.image(docker_image).inside('-e CCACHE_BASEDIR=${WORKSPACE} -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + bypass_entrypoint) { stage(target) { try { sh('export') @@ -179,7 +133,7 @@ def createBuildNode(Boolean archive, String docker_image, String target) { sh('ccache -s') sh('make sizes') if (archive) { - archiveArtifacts(allowEmptyArchive: false, artifacts: 'build/**/*.px4, build/**/*.elf, build/**/*.bin', fingerprint: true, onlyIfSuccessful: true) + archiveArtifacts(allowEmptyArchive: false, artifacts: 'build/*/*.px4, build/*/*.elf, build/*/*.bin', fingerprint: true, onlyIfSuccessful: true) } sh('make ' + target + ' package') archiveArtifacts(allowEmptyArchive: true, artifacts: 'build/*/*.tar.bz2', fingerprint: true, onlyIfSuccessful: true) diff --git a/.ci/Jenkinsfile-compile_mac b/.ci/Jenkinsfile-compile_mac new file mode 100644 index 000000000000..7f7837f789c9 --- /dev/null +++ b/.ci/Jenkinsfile-compile_mac @@ -0,0 +1,87 @@ +#!/usr/bin/env groovy + +pipeline { + agent none + stages { + + stage('Build') { + + parallel { + + stage('px4_sitl_default (OSX)') { + agent { + label 'mac' + } + environment { + CCACHE_BASEDIR = "${env.WORKSPACE}" + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'make px4_sitl_default' + sh 'ccache -s' + } + post { + always { + sh 'make distclean' + } + } + } // stage px4_sitl_default + + stage('px4_fmu-v5_default (OSX)') { + agent { + label 'mac' + } + environment { + CCACHE_BASEDIR = "${env.WORKSPACE}" + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'make px4_fmu-v5_default' + sh 'ccache -s' + } + post { + always { + sh 'make distclean' + } + } + } // stage px4_fmu-v5_default + + stage('sitl tests (OSX)') { + agent { + label 'mac' + } + environment { + CCACHE_BASEDIR = "${env.WORKSPACE}" + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'make tests' + sh 'ccache -s' + } + post { + always { + sh 'make distclean' + } + } + } // stage sitl tests + + } // parallel + } // stage Build + + } // stages + environment { + CCACHE_CPP2 = '1' + CCACHE_DIR = '/tmp/ccache' + CI = true + } + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30')) + timeout(time: 120, unit: 'MINUTES') + } +} diff --git a/.ci/Jenkinsfile-hardware b/.ci/Jenkinsfile-hardware index ff94a7b4e3f3..59c67f1008c8 100644 --- a/.ci/Jenkinsfile-hardware +++ b/.ci/Jenkinsfile-hardware @@ -1,3 +1,5 @@ +#!/usr/bin/env groovy + pipeline { agent none stages { @@ -6,10 +8,130 @@ pipeline { parallel { - stage('px4fmu-v2') { + stage('px4_fmu-v2_test') { + agent { + docker { + image 'px4io/px4-dev-nuttx:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'git fetch --tags' + sh 'make px4_fmu-v2_default' + sh 'make sizes' + sh 'ccache -s' + stash includes: 'build/px4_fmu-v2_default/px4_fmu-v2_default.elf', name: 'px4_fmu-v2_test' + } + post { + always { + sh 'make distclean' + } + } + } + + stage('px4_fmu-v3_default') { + agent { + docker { + image 'px4io/px4-dev-nuttx:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'git fetch --tags' + sh 'make px4_fmu-v3_default' + sh 'make sizes' + sh 'ccache -s' + stash includes: 'build/px4_fmu-v3_default/px4_fmu-v3_default.elf', name: 'px4_fmu-v3_default' + } + post { + always { + sh 'make distclean' + } + } + } + + stage('px4_fmu-v4_default') { + agent { + docker { + image 'px4io/px4-dev-nuttx:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'git fetch --tags' + sh 'make px4_fmu-v4_default' + sh 'make sizes' + sh 'ccache -s' + stash includes: 'build/px4_fmu-v4_default/px4_fmu-v4_default.elf', name: 'px4_fmu-v4_default' + } + post { + always { + sh 'make distclean' + } + } + } + + stage('px4_fmu-v4pro_default') { + agent { + docker { + image 'px4io/px4-dev-nuttx:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'git fetch --tags' + sh 'make px4_fmu-v4pro_default' + sh 'make sizes' + sh 'ccache -s' + stash includes: 'build/px4_fmu-v4pro_default/px4_fmu-v4pro_default.elf', name: 'px4_fmu-v4pro_default' + } + post { + always { + sh 'make distclean' + } + } + } + + stage('px4_fmu-v5_default') { + agent { + docker { + image 'px4io/px4-dev-nuttx:2019-03-08' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + } + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'git fetch --tags' + sh 'make px4_fmu-v5_default' + sh 'make sizes' + sh 'ccache -s' + stash includes: 'build/px4_fmu-v5_default/px4_fmu-v5_default.elf', name: 'px4_fmu-v5_default' + } + post { + always { + sh 'make distclean' + } + } + } + + stage('px4_fmu-v5_stackcheck') { agent { docker { - image 'px4io/px4-dev-nuttx:2018-09-11' + image 'px4io/px4-dev-nuttx:2019-03-08' args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' } } @@ -18,11 +140,10 @@ pipeline { sh 'make distclean' sh 'ccache -z' sh 'git fetch --tags' - sh 'make nuttx_px4fmu-v2_test' + sh 'make px4_fmu-v5_stackcheck' sh 'make sizes' sh 'ccache -s' - stash includes: 'build/nuttx_px4fmu-v2_test/nuttx_px4fmu-v2_test.elf', name: 'px4fmu-v2_test' - stash includes: 'Tools/HIL/monitor_firmware_upload.py, Tools/HIL/run_tests.py', name: 'scripts-px4fmu-v2' + stash includes: 'build/px4_fmu-v5_stackcheck/px4_fmu-v5_stackcheck.elf', name: 'px4_fmu-v5_stackcheck' } post { always { @@ -31,10 +152,10 @@ pipeline { } } - stage('px4fmu-v4 (stackcheck)') { + stage('nxp_fmuk66-v3_default') { agent { docker { - image 'px4io/px4-dev-nuttx:2018-09-11' + image 'px4io/px4-dev-nuttx:2019-03-08' args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' } } @@ -43,11 +164,10 @@ pipeline { sh 'make distclean' sh 'ccache -z' sh 'git fetch --tags' - sh 'make nuttx_px4fmu-v4_stackcheck' + sh 'make nxp_fmuk66-v3_default' sh 'make sizes' sh 'ccache -s' - stash includes: 'build/nuttx_px4fmu-v4_stackcheck/nuttx_px4fmu-v4_stackcheck.elf', name: 'px4fmu-v4_stackcheck' - stash includes: 'Tools/HIL/monitor_firmware_upload.py, Tools/HIL/run_tests.py', name: 'scripts-px4fmu-v4' + stash includes: 'build/nxp_fmuk66-v3_default/nxp_fmuk66-v3_default.elf', name: 'nxp_fmuk66-v3_default' } post { always { @@ -63,29 +183,139 @@ pipeline { parallel { - stage('px4fmu-v2') { + stage('px4_fmu-v2_test') { + agent { + label 'px4_fmu-v2' + } + steps { + script { + try { + sh 'export' + sh 'find /dev/serial' + unstash 'px4_fmu-v2_test' + sh 'platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v2_test/px4_fmu-v2_test.elf' + sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_*` --baudrate 57600' + //sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' + } catch (Exception err) { + // always report passed for now + currentBuild.result = 'SUCCESS' + } + } // script + } + options { + timeout(time: 600, unit: 'SECONDS') + } + } + + stage('px4_fmu-v3_default') { + agent { + label 'px4_fmu-v3' + } + steps { + script { + try { + sh 'export' + sh 'find /dev/serial' + unstash 'px4_fmu-v3_default' + sh 'platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v3_default/px4_fmu-v3_default.elf' + sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_*` --baudrate 57600' + sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' + } catch (Exception err) { + // always report passed for now + currentBuild.result = 'SUCCESS' + } + } // script + } + options { + timeout(time: 600, unit: 'SECONDS') + } + } + + stage('px4_fmu-v4_default') { + agent { + label 'px4_fmu-v4' + } + steps { + script { + try { + sh 'export' + sh 'find /dev/serial' + unstash 'px4_fmu-v4_default' + sh 'platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v4_default/px4_fmu-v4_default.elf' + sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_*` --baudrate 57600' + sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' + } catch (Exception err) { + // always report passed for now + currentBuild.result = 'SUCCESS' + } + } // script + } + options { + timeout(time: 600, unit: 'SECONDS') + } + } + + stage('px4_fmu-v4pro_default') { + agent { + label 'px4_fmu-v4pro' + } + steps { + script { + try { + sh 'export' + sh 'find /dev/serial' + unstash 'px4_fmu-v4pro_default' + sh 'platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v4pro_default/px4_fmu-v4pro_default.elf' + sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_*` --baudrate 57600' + sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' + } catch (Exception err) { + // always report passed for now + currentBuild.result = 'SUCCESS' + } + } // script + } + options { + timeout(time: 600, unit: 'SECONDS') + } + } + + stage('px4_fmu-v5_default') { + agent { + label 'px4_fmu-v5' + } + steps { + script { + try { + sh 'export' + sh 'find /dev/serial' + unstash 'px4_fmu-v5_default' + sh './platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v5_default/px4_fmu-v5_default.elf' + sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_*` --baudrate 57600' + sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' + } catch (Exception err) { + // always report passed for now + currentBuild.result = 'SUCCESS' + } + } // script + } + options { + timeout(time: 600, unit: 'SECONDS') + } + } + + stage('px4_fmu-v5_stackcheck') { agent { - label 'px4fmu-v2' + label 'px4_fmu-v5' } steps { script { try { sh 'export' sh 'find /dev/serial' - unstash 'scripts-px4fmu-v2' - unstash 'px4fmu-v2_test' - sh ''' gdb -nx --batch \ - -ex "target extended-remote `find /dev/serial -name *Black_Magic_Probe_*-if00`" \ - -ex "monitor version" \ - -ex "monitor connect_srst enable" \ - -ex "monitor swdp_scan" \ - -ex "attach 1" \ - -ex "load" \ - -ex "kill" \ - build/nuttx_px4fmu-v2_test/nuttx_px4fmu-v2_test.elf - ''' - sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *Black_Magic_Probe_*-if02` --baudrate 57600' - sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *Black_Magic_Probe_*-if02`' + unstash 'px4_fmu-v5_stackcheck' + sh './platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v5_stackcheck/px4_fmu-v5_stackcheck.elf' + sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_*` --baudrate 57600' + sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' } catch (Exception err) { // always report passed for now currentBuild.result = 'SUCCESS' @@ -93,33 +323,23 @@ pipeline { } // script } options { - timeout(time: 300, unit: 'SECONDS') + timeout(time: 600, unit: 'SECONDS') } } - stage('px4fmu-v4') { + stage('nxp_fmuk66-v3_default') { agent { - label 'px4fmu-v4' + label 'nxp_fmuk66-v3' } steps { script { try { sh 'export' sh 'find /dev/serial' - unstash 'scripts-px4fmu-v4' - unstash 'px4fmu-v4_stackcheck' - sh ''' gdb -nx --batch \ - -ex "target extended-remote `find /dev/serial -name *Black_Magic_Probe_*-if00`" \ - -ex "monitor version" \ - -ex "monitor connect_srst enable" \ - -ex "monitor swdp_scan" \ - -ex "attach 1" \ - -ex "load" \ - -ex "kill" \ - build/nuttx_px4fmu-v4_stackcheck/nuttx_px4fmu-v4_stackcheck.elf - ''' - sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *Black_Magic_Probe_*-if02` --baudrate 57600' - sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *Black_Magic_Probe_*-if02`' + unstash 'nxp_fmuk66-v3_default' + sh './platforms/nuttx/Debug/jlink_gdb_upload.sh build/nxp_fmuk66-v3_default/nxp_fmuk66-v3_default.elf' + sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI*` --baudrate 57600' + sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' } catch (Exception err) { // always report passed for now currentBuild.result = 'SUCCESS' @@ -127,7 +347,7 @@ pipeline { } // script } options { - timeout(time: 300, unit: 'SECONDS') + timeout(time: 600, unit: 'SECONDS') } } @@ -140,7 +360,7 @@ pipeline { CI = true } options { - buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30')) + buildDiscarder(logRotator(numToKeepStr: '20', artifactDaysToKeepStr: '30')) timeout(time: 60, unit: 'MINUTES') } } diff --git a/.github/stale.yml b/.github/stale.yml index 12927b5f6f6d..16d66077c317 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,55 +1,18 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Number of days of inactivity before an Issue or Pull Request becomes stale -daysUntilStale: 60 - -# Number of days of inactivity before a stale Issue or Pull Request is closed. -# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 90 +# Number of days of inactivity before a stale issue is closed daysUntilClose: 14 - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +# Issues with these labels will never be considered stale exemptLabels: - - priority-crtical + - pinned - security - - "[Status] Maybe Later" - -# Set to true to ignore issues in a project (defaults to false) -exemptProjects: true - -# Set to true to ignore issues in a milestone (defaults to false) -exemptMilestones: true - -# Label to use when marking as stale -staleLabel: status/STALE - -# Comment to post when marking as stale. Set to `false` to disable +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had - recent activity. It will be closed in 2 weeks if no further activity occurs. Thank you + recent activity. It will be closed if no further activity occurs. Thank you for your contributions. - -# Comment to post when removing the stale label. -# unmarkComment: > -# Your comment here. - -# Comment to post when closing a stale Issue or Pull Request. - closeComment: > - Closing as stale. - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 10 - -# Limit to only `issues` or `pulls` -# only: issues - -# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': -# pulls: -# daysUntilStale: 30 -# markComment: > -# This pull request has been automatically marked as stale because it has not had -# recent activity. It will be closed if no further activity occurs. Thank you -# for your contributions. - -# issues: -# exemptLabels: -# - confirmed +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: > + Closing as stale. diff --git a/.gitignore b/.gitignore index de25e81e7673..543eccd8b806 100644 --- a/.gitignore +++ b/.gitignore @@ -52,8 +52,6 @@ GTAGS .idea cmake-build-*/ -.vscode - posix-configs/SITL/init/test/*_generated /airframes.md @@ -61,7 +59,14 @@ posix-configs/SITL/init/test/*_generated /parameters.md /parameters.xml /modules +/msg/ros/*.msg *.gcov .coverage .coverage.* + +.vscode/.cortex-debug.peripherals.state.json +.vscode/.cortex-debug.registers.state.json +.vscode/compile_commands.json +.vscode/ipch/ + diff --git a/.gitmodules b/.gitmodules index 20028c815573..fa1ddcbee20d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,18 +2,18 @@ path = mavlink/include/mavlink/v2.0 url = https://github.com/mavlink/c_library_v2.git branch = master -[submodule "src/modules/uavcan/libuavcan"] - path = src/modules/uavcan/libuavcan - url = https://github.com/UAVCAN/libuavcan.git - branch = master +[submodule "src/drivers/uavcan/libuavcan"] + path = src/drivers/uavcan/libuavcan + url = https://github.com/PX4/uavcan.git + branch = px4 [submodule "msg/tools/genmsg"] path = msg/tools/genmsg - url = https://github.com/ros/genmsg.git - branch = indigo-devel + url = https://github.com/PX4/genmsg.git + branch = px4 [submodule "msg/tools/gencpp"] path = msg/tools/gencpp - url = https://github.com/ros/gencpp.git - branch = indigo-devel + url = https://github.com/PX4/gencpp.git + branch = px4 [submodule "Tools/jMAVSim"] path = Tools/jMAVSim url = https://github.com/PX4/jMAVSim.git @@ -34,26 +34,26 @@ path = src/lib/ecl url = https://github.com/PX4/ecl.git branch = master -[submodule "cmake/cmake_hexagon"] - path = cmake/cmake_hexagon - url = https://github.com/ATLFlight/cmake_hexagon.git - branch = master +[submodule "boards/atlflight/cmake_hexagon"] + path = boards/atlflight/cmake_hexagon + url = https://github.com/PX4/cmake_hexagon.git + branch = px4 [submodule "src/drivers/gps/devices"] path = src/drivers/gps/devices url = https://github.com/PX4/GpsDrivers.git branch = master [submodule "src/modules/micrortps_bridge/micro-CDR"] path = src/modules/micrortps_bridge/micro-CDR - url = https://github.com/eProsima/micro-CDR.git - branch = master + url = https://github.com/PX4/micro-CDR.git + branch = px4 [submodule "platforms/nuttx/NuttX/nuttx"] path = platforms/nuttx/NuttX/nuttx url = https://github.com/PX4/NuttX.git - branch = px4_firmware_nuttx-7.22+ + branch = px4_firmware_nuttx-7.28+ [submodule "platforms/nuttx/NuttX/apps"] path = platforms/nuttx/NuttX/apps url = https://github.com/PX4/NuttX-apps.git - branch = px4_firmware_nuttx-7.22+ + branch = px4_firmware_nuttx-7.28+ [submodule "cmake/configs/uavcan_board_ident"] path = cmake/configs/uavcan_board_ident url = https://github.com/PX4/uavcan_board_ident.git diff --git a/.travis.yml b/.travis.yml index fcc1e11f63e6..1c1c71086b20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ matrix: fast_finish: true include: - os: linux + dist: xenial if: branch = coverity_scan before_install: @@ -28,5 +29,5 @@ addons: description: "Build submitted via Travis CI" notification_email: ci@px4.io build_command_prepend: "make distclean" - build_command: "make posix_sitl_default" + build_command: "make px4_sitl_default" branch_pattern: coverity_scan diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 000000000000..2e4bfd61df85 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,26 @@ +{ + "configurations": [ + { + "name": "Linux", + "intelliSenseMode": "gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "browse": { + "path": [ + "${workspaceFolder}/src/", + "${workspaceFolder}/src/lib/", + "${workspaceFolder}/src/lib/matrix", + "${workspaceFolder}/src/platforms", + "${workspaceFolder}/platforms/", + "." + ], + "limitSymbolsToIncludedHeaders": true + }, + "compileCommands": "${workspaceFolder}/.vscode/compile_commands.json", + "configurationProvider": "vector-of-bool.cmake-tools" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/cmake-variants.yaml b/.vscode/cmake-variants.yaml new file mode 100644 index 000000000000..6d53cbd4835c --- /dev/null +++ b/.vscode/cmake-variants.yaml @@ -0,0 +1,63 @@ +CONFIG: + default: px4_sitl_default + choices: + px4_sitl_default: + short: px4_sitl + buildType: RelWithDebInfo + settings: + CONFIG: px4_sitl_default + px4_sitl_default_Debug: + short: px4_sitl (Debug) + buildType: Debug + settings: + CONFIG: px4_sitl_default + px4_sitl_default_ASan: + short: px4_sitl (Address Sanitizer) + buildType: AddressSanitizer + settings: + CONFIG: px4_sitl_default + px4_fmu-v2_default: + short: px4_fmu-v2 + buildType: MinSizeRel + settings: + CONFIG: px4_fmu-v2_default + px4_fmu-v3_default: + short: px4_fmu-v3 + buildType: MinSizeRel + settings: + CONFIG: px4_fmu-v3_default + px4_fmu-v4_default: + short: px4_fmu-v4 + buildType: MinSizeRel + settings: + CONFIG: px4_fmu-v4_default + px4_fmu-v4pro_default: + short: px4_fmu-v4pro + buildType: MinSizeRel + settings: + CONFIG: px4_fmu-v4pro_default + px4_fmu-v5_default: + short: px4_fmu-v5 + buildType: MinSizeRel + settings: + CONFIG: px4_fmu-v5_default + airmind_mindpx-v2_default: + short: airmind_mindpx-v2 + buildType: MinSizeRel + settings: + CONFIG: airmind_mindpx-v2_default + av_x-v1_default: + short: av-x + buildType: MinSizeRel + settings: + CONFIG: av_x-v1_default + intel_aerofc-v1_default: + short: intel_aerofc-v1 + buildType: MinSizeRel + settings: + CONFIG: intel_aerofc-v1_default + nxp_fmuk66-v3_default: + short: nxp_fmuk66-v3 + buildType: MinSizeRel + settings: + CONFIG: nxp_fmuk66-v3_default diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000000..1121504aef59 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,17 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "ajshort.ros", + "chiehyu.vscode-astyle", + "dan-c-underwood.arm", + "github.vscode-pull-request-github", + "marus25.cortex-debug", + "ms-python.python", + "ms-vscode.cpptools", + "peterjausovec.vscode-docker", + "twxs.cmake", + "vector-of-bool.cmake-tools", + "wholroyd.jinja" + ] +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000000..ad11897832ff --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,194 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "SITL shell", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.launchTargetPath}", + "args": [ + "${workspaceFolder}/ROMFS/px4fmu_common", + "-s", + "etc/init.d-posix/rcS", + "-t", + "${workspaceFolder}/test_data" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "environment": [ + { + "name": "PX4_SIM_MODEL", + "value": "shell" + } + ], + "externalConsole": false, + "linux": { + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + { + "name": "SITL jmavsim iris", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.launchTargetPath}", + "args": [ + "${workspaceFolder}/ROMFS/px4fmu_common", + "-s", + "etc/init.d-posix/rcS", + "-t", + "${workspaceFolder}/test_data" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "environment": [ + { + "name": "PX4_SIM_MODEL", + "value": "iris" + } + ], + "externalConsole": false, + "preLaunchTask": "jmavsim", + "postDebugTask": "jmavsim kill", + "linux": { + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + { + "name": "SITL gazebo iris", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.launchTargetPath}", + "args": [ + "${workspaceFolder}/ROMFS/px4fmu_common", + "-s", + "etc/init.d-posix/rcS", + "-t", + "${workspaceFolder}/test_data" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "environment": [ + { + "name": "PX4_SIM_MODEL", + "value": "iris" + } + ], + "externalConsole": false, + "preLaunchTask": "gazebo iris", + "postDebugTask": "gazebo kill", + "linux": { + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + { + "name": "px4_fmu-v2 (jlink) ", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "jlink", + "device": "STM32F427VI", + "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F427.svd", + "interface": "swd" + }, + { + "name": "px4_fmu-v3 (jlink)", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "jlink", + "device": "STM32F427VI", + "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F427.svd", + "interface": "swd" + }, + { + "name": "px4_fmu-v4 (jlink)", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "jlink", + "device": "STM32F427VI", + "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F427.svd", + "interface": "swd" + }, + { + "name": "px4_fmu-v4pro (jlink)", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "jlink", + "device": "STM32F469VI", + "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F469.svd", + "interface": "swd" + }, + { + "name": "px4_fmu-v5 (jlink)", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "jlink", + "device": "STM32F765VI", + "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F7x5.svd", + "interface": "swd" + }, + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000000..94e40fa6539e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,82 @@ +{ + "editor.insertSpaces": false, + "editor.tabSize": 8, + "editor.wordWrapColumn": 120, + "editor.suggest.localityBonus": true, + "astyle.astylerc": "${workspaceFolder}/Tools/astyle/astylerc", + "astyle.c.enable": true, + "astyle.cpp.enable": true, + "breadcrumbs.enabled": true, + "cmake.autoRestartBuild": true, + "cmake.buildDirectory": "${workspaceFolder}/build/${variant:CONFIG}", + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.copyCompileCommands": "${workspaceFolder}/.vscode/compile_commands.json", + "cmake.debugConfig": { + "name": "SITL shell (gdb)", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.launchTargetPath}", + "args": [ + "${workspaceFolder}/ROMFS/px4fmu_common", + "-s", + "etc/init.d-posix/rcS", + "-t", + "${workspaceFolder}/test_data" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "environment": [ + { + "name": "PX4_SIM_MODEL", + "value": "shell" + } + ], + "externalConsole": false, + "linux": { + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + "C_Cpp.clang_format_fallbackStyle": "none", + "C_Cpp.configurationWarnings": "Disabled", + "C_Cpp.default.cppStandard": "c++11", + "C_Cpp.default.cStandard": "c99", + "C_Cpp.default.intelliSenseMode": "gcc-x64", + "C_Cpp.errorSquiggles": "Disabled", + "C_Cpp.formatting": "Disabled", + "C_Cpp.intelliSenseEngine": "Default", + "C_Cpp.intelliSenseEngineFallback": "Disabled", + "debug.toolBarLocation": "docked", + "git.detectSubmodulesLimit": 20, + "files.associations": { + "*.jinja": "jinja" + }, + "search.exclude": { + "build/**": true + }, + "search.showLineNumbers": true, + "workbench.statusBar.feedback.visible": false, + "workbench.editor.enablePreview": false, + "workbench.editor.enablePreviewFromQuickOpen": false, + "workbench.editor.highlightModifiedTabs": true +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000000..19adf8163f1a --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,97 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "jmavsim", + "type": "shell", + "command": "Tools/jmavsim_run.sh", + "isBackground": true, + "args": [ + "-r", + "500" + ], + "options": { + "cwd": "${workspaceRoot}" + }, + "presentation": { + "reveal": "always", + "panel": "dedicated" + }, + "problemMatcher": [ + { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": ".", + } + } + ] + }, + { + "label": "jmavsim kill", + "type": "shell", + "command": "kill $(ps aux | grep jmavsim | grep -v 'grep' | awk '{print $2}')", + "problemMatcher": [] + }, + { + "label": "gazebo build", + "type": "shell", + "command": "make px4_sitl_default sitl_gazebo", + "options": { + "cwd": "${workspaceRoot}" + }, + "problemMatcher": [] + }, + { + "label": "gazebo iris", + "type": "shell", + "dependsOn": "gazebo build", + "options": { + "cwd": "${workspaceRoot}", + "env": { + "GAZEBO_PLUGIN_PATH": "${workspaceRoot}/build/px4_sitl_default/build_gazebo", + "GAZEBO_MODEL_PATH": "${workspaceRoot}/Tools/sitl_gazebo/models" + } + }, + "command": "gzserver --verbose ${workspaceRoot}/Tools/sitl_gazebo/worlds/iris.world", + "isBackground": true, + "presentation": { + "reveal": "always", + "panel": "dedicated" + }, + "problemMatcher": [ + { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": ".", + } + } + ] + }, + { + "label": "gazebo kill", + "type": "shell", + "command": "killall gzserver", + "problemMatcher": [] + }, + ] +} \ No newline at end of file diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index ce7bd3b756aa..83086da9e44b 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -61,7 +61,7 @@ 'c++', '-undef', # get rid of standard definitions to allow us to include arm math header '-I', os.path.join(os.path.expanduser("~"),'gcc-arm-none-eabi-4_7-2013q3/arm-none-eabi/include'), -'-I', 'Build/px4io-v2_default.build/nuttx-export/include/', +'-I', 'Build/px4_io-v2_default.build/nuttx-export/include/', '-I', './NuttX/nuttx/arch/arm/include', '-include', './src/include/visibility.h', '-I', './src', diff --git a/CMakeLists.txt b/CMakeLists.txt index fbe5a4cb64a2..0bfcee70d8ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ # * Common functions should be included in px_base.cmake. # # * OS/ board specific fucntions should be include in -# px_impl_${OS}.cmake or px4_impl_${OS}_${BOARD}.cmake. +# px_impl_${PX4_PLATFORM}.cmake or px4_impl_${PX4_PLATFORM}_${PX4_BOARD}.cmake. # # Formatting # --------------------------------------------------------------------------- @@ -92,9 +92,9 @@ # --------------------------------------------------------------------------- # # * If referencing a string variable, don't put it in quotes. -# Don't do "${OS}" STREQUAL "posix", -# instead type ${OS} STREQUAL "posix". This will throw an -# error when ${OS} is not defined instead of silently +# Don't do "${PX4_PLATFORM}" STREQUAL "posix", +# instead type ${PX4_PLATFORM} STREQUAL "posix". This will throw an +# error when ${PX4_PLATFORM} is not defined instead of silently # evaluating to false. # #============================================================================= @@ -104,12 +104,12 @@ cmake_minimum_required(VERSION 3.2 FATAL_ERROR) set(PX4_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(PX4_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") -list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/cmake") +list(APPEND CMAKE_MODULE_PATH ${PX4_SOURCE_DIR}/cmake) #============================================================================= # git # -include(common/px4_git) +include(px4_git) execute_process( COMMAND git describe --always --tags @@ -132,13 +132,98 @@ define_property(GLOBAL PROPERTY PX4_MODULE_PATHS # configuration # -set(CONFIG "posix_sitl_default" CACHE STRING "desired configuration") +set(CONFIG "px4_sitl_default" CACHE STRING "desired configuration") -string(REPLACE "_" ";" config_args ${CONFIG}) -list(GET config_args 0 OS) -list(GET config_args 1 BOARD) -list(GET config_args 2 LABEL) +include(px4_add_module) +set(config_module_list) +set(config_df_driver_list) +# find PX4 config +# look for in tree board config that matches CONFIG input +if(NOT PX4_CONFIG_FILE) + + file(GLOB_RECURSE board_configs + RELATIVE "${PX4_SOURCE_DIR}/boards" + "boards/*.cmake" + ) + + set(PX4_CONFIGS ${board_configs} CACHE STRINGS "PX4 board configs" FORCE) + + foreach(filename ${board_configs}) + # parse input CONFIG into components to match with existing in tree configs + # the platform prefix (eg nuttx_) is historical, and removed if present + string(REPLACE ".cmake" "" filename_stripped ${filename}) + string(REPLACE "/" ";" config ${filename_stripped}) + list(LENGTH config config_len) + + if(${config_len} EQUAL 3) + + + list(GET config 0 vendor) + list(GET config 1 model) + list(GET config 2 label) + + set(board "${vendor}${model}") + + # __