From 1d6b31d1962ec90a7f671df7b61f8693729a4482 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Mon, 7 Sep 2015 20:37:45 -0400 Subject: [PATCH 001/389] Switch to cmake build system. --- .gitignore | 2 + CMakeLists.txt | 544 +++++++--------- Makefile | 320 +--------- Tools/px_generate_uorb_topic_headers.py | 23 +- cmake/Toolchain-arm-none-eabi.cmake | 67 ++ cmake/Toolchain-hexagon.cmake | 249 ++++++++ cmake/Toolchain-posix-clang-native.cmake | 83 +++ cmake/builtin_commands.c.cmake | 12 + cmake/cmake_lists.jinja | 73 +++ cmake/convert_modules_to_cmake.py | 91 +++ cmake/posix/posix-sitl-simple.cmake | 43 ++ cmake/posix/px4_target_impl.cmake | 111 ++++ cmake/px4_nuttx_utils.cmake | 348 ++++++++++ cmake/px4_utils.cmake | 594 ++++++++++++++++++ cmake/qurt/px4_target_impl.cmake | 124 ++++ cmake/test/px4_simple_app_correct.txt | 27 + cmake/test/px4_simple_app_input.txt | 4 + cmake/test_compare.py | 50 ++ makefiles/CMakeLists.txt | 38 ++ src/CMakeLists.txt | 71 +++ src/drivers/CMakeLists.txt | 54 ++ src/drivers/airspeed/CMakeLists.txt | 42 ++ src/drivers/ardrone_interface/CMakeLists.txt | 45 ++ src/drivers/batt_smbus/CMakeLists.txt | 43 ++ src/drivers/blinkm/CMakeLists.txt | 43 ++ src/drivers/bma180/CMakeLists.txt | 43 ++ src/drivers/boards/aerocore/CMakeLists.txt | 45 ++ .../px4-stm32f4discovery/CMakeLists.txt | 42 ++ src/drivers/boards/px4fmu-v1/CMakeLists.txt | 47 ++ src/drivers/boards/px4fmu-v2/CMakeLists.txt | 47 ++ src/drivers/boards/px4io-v1/CMakeLists.txt | 43 ++ src/drivers/boards/px4io-v2/CMakeLists.txt | 43 ++ src/drivers/boards/sitl/CMakeLists.txt | 42 ++ src/drivers/camera_trigger/CMakeLists.txt | 44 ++ src/drivers/device/CMakeLists.txt | 63 ++ src/drivers/ets_airspeed/CMakeLists.txt | 44 ++ src/drivers/frsky_telemetry/CMakeLists.txt | 45 ++ src/drivers/gimbal/CMakeLists.txt | 43 ++ src/drivers/gps/CMakeLists.txt | 48 ++ src/drivers/hmc5883/CMakeLists.txt | 47 ++ src/drivers/hott/CMakeLists.txt | 43 ++ src/drivers/hott/hott_sensors/CMakeLists.txt | 43 ++ .../hott/hott_telemetry/CMakeLists.txt | 43 ++ src/drivers/irlock/CMakeLists.txt | 43 ++ src/drivers/l3gd20/CMakeLists.txt | 45 ++ src/drivers/led/CMakeLists.txt | 42 ++ src/drivers/ll40ls/CMakeLists.txt | 46 ++ src/drivers/lsm303d/CMakeLists.txt | 45 ++ src/drivers/mb12xx/CMakeLists.txt | 43 ++ src/drivers/md25/CMakeLists.txt | 44 ++ src/drivers/meas_airspeed/CMakeLists.txt | 45 ++ src/drivers/mkblctrl/CMakeLists.txt | 44 ++ src/drivers/mpu6000/CMakeLists.txt | 45 ++ src/drivers/mpu9250/CMakeLists.txt | 45 ++ src/drivers/ms5611/CMakeLists.txt | 45 ++ src/drivers/oreoled/CMakeLists.txt | 43 ++ src/drivers/pca8574/CMakeLists.txt | 43 ++ src/drivers/pca9685/CMakeLists.txt | 41 ++ src/drivers/pwm_input/CMakeLists.txt | 44 ++ src/drivers/pwm_out_sim/CMakeLists.txt | 44 ++ src/drivers/px4flow/CMakeLists.txt | 45 ++ src/drivers/px4fmu/CMakeLists.txt | 46 ++ src/drivers/px4io/CMakeLists.txt | 49 ++ src/drivers/rgbled/CMakeLists.txt | 43 ++ src/drivers/roboclaw/CMakeLists.txt | 44 ++ src/drivers/sf0x/CMakeLists.txt | 44 ++ src/drivers/stm32/CMakeLists.txt | 43 ++ src/drivers/stm32/adc/CMakeLists.txt | 43 ++ src/drivers/stm32/tone_alarm/CMakeLists.txt | 43 ++ src/drivers/trone/CMakeLists.txt | 44 ++ src/examples/CMakeLists.txt | 16 + src/examples/fixedwing_control/CMakeLists.txt | 46 ++ .../flow_position_estimator/CMakeLists.txt | 45 ++ src/examples/hwtest/CMakeLists.txt | 41 ++ src/examples/matlab_csv_serial/CMakeLists.txt | 41 ++ src/examples/publisher/CMakeLists.txt | 44 ++ src/examples/px4_daemon_app/CMakeLists.txt | 42 ++ src/examples/px4_mavlink_debug/CMakeLists.txt | 42 ++ src/examples/px4_simple_app/CMakeLists.txt | 41 ++ .../rover_steering_control/CMakeLists.txt | 46 ++ src/examples/subscriber/CMakeLists.txt | 45 ++ src/lib/CMakeLists.txt | 15 + src/lib/conversion/CMakeLists.txt | 42 ++ src/lib/ecl/CMakeLists.txt | 46 ++ src/lib/external_lgpl/CMakeLists.txt | 42 ++ src/lib/geo/CMakeLists.txt | 40 ++ src/lib/geo_lookup/CMakeLists.txt | 42 ++ src/lib/launchdetection/CMakeLists.txt | 44 ++ src/lib/mathlib/CMakeLists.txt | 41 ++ src/lib/mathlib/math/filter/CMakeLists.txt | 40 ++ src/lib/rc/CMakeLists.txt | 43 ++ src/modules/CMakeLists.txt | 40 ++ .../attitude_estimator_ekf/CMakeLists.txt | 48 ++ .../attitude_estimator_q/CMakeLists.txt | 43 ++ src/modules/bottle_drop/CMakeLists.txt | 45 ++ src/modules/commander/CMakeLists.txt | 57 ++ .../commander/commander_tests/CMakeLists.txt | 44 ++ src/modules/controllib/CMakeLists.txt | 46 ++ src/modules/dataman/CMakeLists.txt | 44 ++ .../ekf_att_pos_estimator/CMakeLists.txt | 48 ++ src/modules/fixedwing_backside/CMakeLists.txt | 43 ++ src/modules/fw_att_control/CMakeLists.txt | 45 ++ src/modules/fw_pos_control_l1/CMakeLists.txt | 50 ++ src/modules/gpio_led/CMakeLists.txt | 43 ++ src/modules/land_detector/CMakeLists.txt | 50 ++ src/modules/mavlink/CMakeLists.txt | 58 ++ .../mavlink/mavlink_tests/CMakeLists.txt | 53 ++ src/modules/mc_att_control/CMakeLists.txt | 43 ++ .../CMakeLists.txt | 45 ++ src/modules/mc_pos_control/CMakeLists.txt | 43 ++ .../CMakeLists.txt | 47 ++ src/modules/muorb/adsp/CMakeLists.txt | 43 ++ src/modules/muorb/krait/CMakeLists.txt | 42 ++ src/modules/navigator/CMakeLists.txt | 63 ++ .../position_estimator_inav/CMakeLists.txt | 47 ++ src/modules/px4iofirmware/CMakeLists.txt | 56 ++ src/modules/sdlog2/CMakeLists.txt | 47 ++ src/modules/segway/CMakeLists.txt | 43 ++ src/modules/sensors/CMakeLists.txt | 47 ++ src/modules/simulator/CMakeLists.txt | 47 ++ src/modules/systemlib/CMakeLists.txt | 80 +++ src/modules/systemlib/mixer/CMakeLists.txt | 44 ++ src/modules/uORB/CMakeLists.txt | 78 +++ src/modules/uavcan/CMakeLists.txt | 47 ++ src/modules/unit_test/CMakeLists.txt | 42 ++ src/modules/vtol_att_control/CMakeLists.txt | 51 ++ src/platforms/CMakeLists.txt | 26 + src/platforms/common/CMakeLists.txt | 49 ++ src/platforms/nuttx/CMakeLists.txt | 42 ++ src/platforms/nuttx/px4_layer/CMakeLists.txt | 43 ++ .../posix/drivers/accelsim/CMakeLists.txt | 41 ++ .../posix/drivers/adcsim/CMakeLists.txt | 43 ++ .../posix/drivers/airspeedsim/CMakeLists.txt | 44 ++ .../posix/drivers/barosim/CMakeLists.txt | 44 ++ .../posix/drivers/gpssim/CMakeLists.txt | 43 ++ .../posix/drivers/gyrosim/CMakeLists.txt | 45 ++ .../posix/drivers/tonealrmsim/CMakeLists.txt | 43 ++ src/platforms/posix/px4_layer/CMakeLists.txt | 46 ++ .../posix/tests/hello/CMakeLists.txt | 43 ++ .../posix/tests/hrt_test/CMakeLists.txt | 43 ++ .../posix/tests/muorb/CMakeLists.txt | 43 ++ .../posix/tests/vcdev_test/CMakeLists.txt | 43 ++ .../posix/tests/wqueue/CMakeLists.txt | 43 ++ src/platforms/posix/work_queue/CMakeLists.txt | 55 ++ src/platforms/qurt/px4_layer/CMakeLists.txt | 47 ++ src/platforms/qurt/tests/hello/CMakeLists.txt | 43 ++ src/platforms/qurt/tests/muorb/CMakeLists.txt | 42 ++ src/systemcmds/CMakeLists.txt | 26 + src/systemcmds/bl_update/CMakeLists.txt | 44 ++ src/systemcmds/config/CMakeLists.txt | 44 ++ src/systemcmds/dumpfile/CMakeLists.txt | 43 ++ src/systemcmds/esc_calib/CMakeLists.txt | 44 ++ src/systemcmds/i2c/CMakeLists.txt | 43 ++ src/systemcmds/mixer/CMakeLists.txt | 45 ++ src/systemcmds/motor_test/CMakeLists.txt | 44 ++ src/systemcmds/mtd/CMakeLists.txt | 45 ++ src/systemcmds/nshterm/CMakeLists.txt | 45 ++ src/systemcmds/param/CMakeLists.txt | 44 ++ src/systemcmds/perf/CMakeLists.txt | 44 ++ src/systemcmds/pwm/CMakeLists.txt | 44 ++ src/systemcmds/reboot/CMakeLists.txt | 44 ++ src/systemcmds/reflect/CMakeLists.txt | 43 ++ src/systemcmds/tests/CMakeLists.txt | 71 +++ src/systemcmds/top/CMakeLists.txt | 44 ++ src/systemcmds/topic_listener/CMakeLists.txt | 44 ++ src/systemcmds/usb_connected/CMakeLists.txt | 43 ++ src/systemcmds/ver/CMakeLists.txt | 44 ++ 167 files changed, 8828 insertions(+), 634 deletions(-) create mode 100644 cmake/Toolchain-arm-none-eabi.cmake create mode 100644 cmake/Toolchain-hexagon.cmake create mode 100644 cmake/Toolchain-posix-clang-native.cmake create mode 100644 cmake/builtin_commands.c.cmake create mode 100644 cmake/cmake_lists.jinja create mode 100755 cmake/convert_modules_to_cmake.py create mode 100644 cmake/posix/posix-sitl-simple.cmake create mode 100644 cmake/posix/px4_target_impl.cmake create mode 100644 cmake/px4_nuttx_utils.cmake create mode 100644 cmake/px4_utils.cmake create mode 100644 cmake/qurt/px4_target_impl.cmake create mode 100644 cmake/test/px4_simple_app_correct.txt create mode 100644 cmake/test/px4_simple_app_input.txt create mode 100755 cmake/test_compare.py create mode 100644 makefiles/CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/drivers/CMakeLists.txt create mode 100644 src/drivers/airspeed/CMakeLists.txt create mode 100644 src/drivers/ardrone_interface/CMakeLists.txt create mode 100644 src/drivers/batt_smbus/CMakeLists.txt create mode 100644 src/drivers/blinkm/CMakeLists.txt create mode 100644 src/drivers/bma180/CMakeLists.txt create mode 100644 src/drivers/boards/aerocore/CMakeLists.txt create mode 100644 src/drivers/boards/px4-stm32f4discovery/CMakeLists.txt create mode 100644 src/drivers/boards/px4fmu-v1/CMakeLists.txt create mode 100644 src/drivers/boards/px4fmu-v2/CMakeLists.txt create mode 100644 src/drivers/boards/px4io-v1/CMakeLists.txt create mode 100644 src/drivers/boards/px4io-v2/CMakeLists.txt create mode 100644 src/drivers/boards/sitl/CMakeLists.txt create mode 100644 src/drivers/camera_trigger/CMakeLists.txt create mode 100644 src/drivers/device/CMakeLists.txt create mode 100644 src/drivers/ets_airspeed/CMakeLists.txt create mode 100644 src/drivers/frsky_telemetry/CMakeLists.txt create mode 100644 src/drivers/gimbal/CMakeLists.txt create mode 100644 src/drivers/gps/CMakeLists.txt create mode 100644 src/drivers/hmc5883/CMakeLists.txt create mode 100644 src/drivers/hott/CMakeLists.txt create mode 100644 src/drivers/hott/hott_sensors/CMakeLists.txt create mode 100644 src/drivers/hott/hott_telemetry/CMakeLists.txt create mode 100644 src/drivers/irlock/CMakeLists.txt create mode 100644 src/drivers/l3gd20/CMakeLists.txt create mode 100644 src/drivers/led/CMakeLists.txt create mode 100644 src/drivers/ll40ls/CMakeLists.txt create mode 100644 src/drivers/lsm303d/CMakeLists.txt create mode 100644 src/drivers/mb12xx/CMakeLists.txt create mode 100644 src/drivers/md25/CMakeLists.txt create mode 100644 src/drivers/meas_airspeed/CMakeLists.txt create mode 100644 src/drivers/mkblctrl/CMakeLists.txt create mode 100644 src/drivers/mpu6000/CMakeLists.txt create mode 100644 src/drivers/mpu9250/CMakeLists.txt create mode 100644 src/drivers/ms5611/CMakeLists.txt create mode 100644 src/drivers/oreoled/CMakeLists.txt create mode 100644 src/drivers/pca8574/CMakeLists.txt create mode 100644 src/drivers/pca9685/CMakeLists.txt create mode 100644 src/drivers/pwm_input/CMakeLists.txt create mode 100644 src/drivers/pwm_out_sim/CMakeLists.txt create mode 100644 src/drivers/px4flow/CMakeLists.txt create mode 100644 src/drivers/px4fmu/CMakeLists.txt create mode 100644 src/drivers/px4io/CMakeLists.txt create mode 100644 src/drivers/rgbled/CMakeLists.txt create mode 100644 src/drivers/roboclaw/CMakeLists.txt create mode 100644 src/drivers/sf0x/CMakeLists.txt create mode 100644 src/drivers/stm32/CMakeLists.txt create mode 100644 src/drivers/stm32/adc/CMakeLists.txt create mode 100644 src/drivers/stm32/tone_alarm/CMakeLists.txt create mode 100644 src/drivers/trone/CMakeLists.txt create mode 100644 src/examples/CMakeLists.txt create mode 100644 src/examples/fixedwing_control/CMakeLists.txt create mode 100644 src/examples/flow_position_estimator/CMakeLists.txt create mode 100644 src/examples/hwtest/CMakeLists.txt create mode 100644 src/examples/matlab_csv_serial/CMakeLists.txt create mode 100644 src/examples/publisher/CMakeLists.txt create mode 100644 src/examples/px4_daemon_app/CMakeLists.txt create mode 100644 src/examples/px4_mavlink_debug/CMakeLists.txt create mode 100644 src/examples/px4_simple_app/CMakeLists.txt create mode 100644 src/examples/rover_steering_control/CMakeLists.txt create mode 100644 src/examples/subscriber/CMakeLists.txt create mode 100644 src/lib/CMakeLists.txt create mode 100644 src/lib/conversion/CMakeLists.txt create mode 100644 src/lib/ecl/CMakeLists.txt create mode 100644 src/lib/external_lgpl/CMakeLists.txt create mode 100644 src/lib/geo/CMakeLists.txt create mode 100644 src/lib/geo_lookup/CMakeLists.txt create mode 100644 src/lib/launchdetection/CMakeLists.txt create mode 100644 src/lib/mathlib/CMakeLists.txt create mode 100644 src/lib/mathlib/math/filter/CMakeLists.txt create mode 100644 src/lib/rc/CMakeLists.txt create mode 100644 src/modules/CMakeLists.txt create mode 100644 src/modules/attitude_estimator_ekf/CMakeLists.txt create mode 100644 src/modules/attitude_estimator_q/CMakeLists.txt create mode 100644 src/modules/bottle_drop/CMakeLists.txt create mode 100644 src/modules/commander/CMakeLists.txt create mode 100644 src/modules/commander/commander_tests/CMakeLists.txt create mode 100644 src/modules/controllib/CMakeLists.txt create mode 100644 src/modules/dataman/CMakeLists.txt create mode 100644 src/modules/ekf_att_pos_estimator/CMakeLists.txt create mode 100644 src/modules/fixedwing_backside/CMakeLists.txt create mode 100644 src/modules/fw_att_control/CMakeLists.txt create mode 100644 src/modules/fw_pos_control_l1/CMakeLists.txt create mode 100644 src/modules/gpio_led/CMakeLists.txt create mode 100644 src/modules/land_detector/CMakeLists.txt create mode 100644 src/modules/mavlink/CMakeLists.txt create mode 100644 src/modules/mavlink/mavlink_tests/CMakeLists.txt create mode 100644 src/modules/mc_att_control/CMakeLists.txt create mode 100644 src/modules/mc_att_control_multiplatform/CMakeLists.txt create mode 100644 src/modules/mc_pos_control/CMakeLists.txt create mode 100644 src/modules/mc_pos_control_multiplatform/CMakeLists.txt create mode 100644 src/modules/muorb/adsp/CMakeLists.txt create mode 100644 src/modules/muorb/krait/CMakeLists.txt create mode 100644 src/modules/navigator/CMakeLists.txt create mode 100644 src/modules/position_estimator_inav/CMakeLists.txt create mode 100644 src/modules/px4iofirmware/CMakeLists.txt create mode 100644 src/modules/sdlog2/CMakeLists.txt create mode 100644 src/modules/segway/CMakeLists.txt create mode 100644 src/modules/sensors/CMakeLists.txt create mode 100644 src/modules/simulator/CMakeLists.txt create mode 100644 src/modules/systemlib/CMakeLists.txt create mode 100644 src/modules/systemlib/mixer/CMakeLists.txt create mode 100644 src/modules/uORB/CMakeLists.txt create mode 100644 src/modules/uavcan/CMakeLists.txt create mode 100644 src/modules/unit_test/CMakeLists.txt create mode 100644 src/modules/vtol_att_control/CMakeLists.txt create mode 100644 src/platforms/CMakeLists.txt create mode 100644 src/platforms/common/CMakeLists.txt create mode 100644 src/platforms/nuttx/CMakeLists.txt create mode 100644 src/platforms/nuttx/px4_layer/CMakeLists.txt create mode 100644 src/platforms/posix/drivers/accelsim/CMakeLists.txt create mode 100644 src/platforms/posix/drivers/adcsim/CMakeLists.txt create mode 100644 src/platforms/posix/drivers/airspeedsim/CMakeLists.txt create mode 100644 src/platforms/posix/drivers/barosim/CMakeLists.txt create mode 100644 src/platforms/posix/drivers/gpssim/CMakeLists.txt create mode 100644 src/platforms/posix/drivers/gyrosim/CMakeLists.txt create mode 100644 src/platforms/posix/drivers/tonealrmsim/CMakeLists.txt create mode 100644 src/platforms/posix/px4_layer/CMakeLists.txt create mode 100644 src/platforms/posix/tests/hello/CMakeLists.txt create mode 100644 src/platforms/posix/tests/hrt_test/CMakeLists.txt create mode 100644 src/platforms/posix/tests/muorb/CMakeLists.txt create mode 100644 src/platforms/posix/tests/vcdev_test/CMakeLists.txt create mode 100644 src/platforms/posix/tests/wqueue/CMakeLists.txt create mode 100644 src/platforms/posix/work_queue/CMakeLists.txt create mode 100644 src/platforms/qurt/px4_layer/CMakeLists.txt create mode 100644 src/platforms/qurt/tests/hello/CMakeLists.txt create mode 100644 src/platforms/qurt/tests/muorb/CMakeLists.txt create mode 100644 src/systemcmds/CMakeLists.txt create mode 100644 src/systemcmds/bl_update/CMakeLists.txt create mode 100644 src/systemcmds/config/CMakeLists.txt create mode 100644 src/systemcmds/dumpfile/CMakeLists.txt create mode 100644 src/systemcmds/esc_calib/CMakeLists.txt create mode 100644 src/systemcmds/i2c/CMakeLists.txt create mode 100644 src/systemcmds/mixer/CMakeLists.txt create mode 100644 src/systemcmds/motor_test/CMakeLists.txt create mode 100644 src/systemcmds/mtd/CMakeLists.txt create mode 100644 src/systemcmds/nshterm/CMakeLists.txt create mode 100644 src/systemcmds/param/CMakeLists.txt create mode 100644 src/systemcmds/perf/CMakeLists.txt create mode 100644 src/systemcmds/pwm/CMakeLists.txt create mode 100644 src/systemcmds/reboot/CMakeLists.txt create mode 100644 src/systemcmds/reflect/CMakeLists.txt create mode 100644 src/systemcmds/tests/CMakeLists.txt create mode 100644 src/systemcmds/top/CMakeLists.txt create mode 100644 src/systemcmds/topic_listener/CMakeLists.txt create mode 100644 src/systemcmds/usb_connected/CMakeLists.txt create mode 100644 src/systemcmds/ver/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 4aa1d72166..9d415d1839 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,9 @@ .~lock.* Archives/* Build/* +Testing/ build/* +build_*/ core cscope.out Firmware.sublime-workspace diff --git a/CMakeLists.txt b/CMakeLists.txt index bfd7b662b1..aace54bd66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,332 +1,224 @@ -cmake_minimum_required(VERSION 2.8.3) -project(px4) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -add_definitions(-D__PX4_ROS) -add_definitions(-D__EXPORT=) -add_definitions(-DMAVLINK_DIALECT=common) +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ -## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages -find_package(catkin REQUIRED COMPONENTS - roscpp - rospy - std_msgs - geometry_msgs - message_generation - cmake_modules - gazebo_msgs - sensor_msgs - mav_msgs - libmavconn - tf -) -find_package(Eigen REQUIRED) - -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) +#============================================================================= +# CMAKE CODING STANDARD FOR PX4 +# +# Structure +# --------------------------------------------------------------------------- +# +# * Common functions should be included in px_utils.cmake. +# +# * OS/ board specific fucntions should be include in +# px_${OS}_utils.cmake or px4_${OS}_${BOARD}_utils.cmake. +# +# Formatting +# --------------------------------------------------------------------------- +# +# * Use hard indents to match the px4 source code. +# +# * All function and script arguments are upper case. +# +# * All local variables are lower case. +# +# * All cmake functions are lowercase. +# +# Functions/Macros +# --------------------------------------------------------------------------- +# +# * Never use macros. They allow overwriting global variables and this +# makes variable declarations hard to locate. +# +# * If a target from add_custom_* is set in a function, explicitly pass it +# as an output argument so that the target name is clear to the user. +# +# * Avoid use of global variables in functions. Functions in a nested +# scope may use global variables, but this makes it difficult to +# resuse functions. +# +# Included CMake Files +# --------------------------------------------------------------------------- +# +# * Never set global variables in an included cmake file, +# you may only define functions. This excludes Toolchain files. This +# makes it clear to the user when variables are being set or targets +# are being created. +# +# * All toolchain files should be included in the cmake +# directory and named Toolchain-"name".cmake. +# +# Misc +# --------------------------------------------------------------------------- +# +# * 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 +# evaluating to false. +# +#============================================================================= -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -add_message_files( - FILES - rc_channels.msg - vehicle_attitude.msg - vehicle_attitude_setpoint.msg - manual_control_setpoint.msg - actuator_controls.msg - actuator_controls_0.msg - actuator_controls_virtual_mc.msg - vehicle_rates_setpoint.msg - mc_virtual_rates_setpoint.msg - vehicle_attitude.msg - vehicle_control_mode.msg - actuator_armed.msg - parameter_update.msg - vehicle_status.msg - vehicle_local_position.msg - position_setpoint.msg - position_setpoint_triplet.msg - vehicle_local_position_setpoint.msg - vehicle_global_velocity_setpoint.msg - offboard_control_mode.msg - vehicle_force_setpoint.msg - distance_sensor.msg -) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -generate_messages( - DEPENDENCIES - std_msgs - gazebo_msgs -) - -################################### -## catkin specific configuration ## -################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need -catkin_package( - INCLUDE_DIRS src/include - LIBRARIES px4 - CATKIN_DEPENDS message_runtime roscpp rospy std_msgs libmavconn - DEPENDS system_lib -) - -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -include_directories( - ${catkin_INCLUDE_DIRS} - src/platforms - src/platforms/ros/px4_messages - src/include - src/modules - src/ - src/lib - ${EIGEN_INCLUDE_DIRS} - integrationtests -) - -## generate multiplatform wrapper headers -## note that the message header files are generated as in any ROS project with generate_messages() -set(MULTIPLATFORM_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/platforms/ros/px4_messages) -set(MULTIPLATFORM_TEMPLATE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/msg/templates/px4/ros) -set(TOPICHEADER_TEMP_DIR ${CMAKE_BINARY_DIR}/topics_temporary) -set(MULTIPLATFORM_PREFIX px4_) -add_custom_target(multiplatform_message_headers ALL ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Tools/px_generate_uorb_topic_headers.py - -d ${CMAKE_CURRENT_SOURCE_DIR}/msg -o ${MULTIPLATFORM_HEADER_DIR} -e ${MULTIPLATFORM_TEMPLATE_DIR} - -t ${TOPICHEADER_TEMP_DIR} -p ${MULTIPLATFORM_PREFIX}) - -## Declare a cpp library -add_library(px4 - src/platforms/ros/px4_ros_impl.cpp - src/platforms/ros/perf_counter.cpp - src/platforms/ros/geo.cpp - src/lib/mathlib/math/Limits.cpp - src/modules/systemlib/circuit_breaker.cpp -) -add_dependencies(px4 ${PROJECT_NAME}_generate_messages_cpp multiplatform_message_headers) - -target_link_libraries(px4 - ${catkin_LIBRARIES} -) - -## Declare a test publisher -add_executable(publisher - src/examples/publisher/publisher_main.cpp - src/examples/publisher/publisher_example.cpp) -add_dependencies(publisher ${PROJECT_NAME}_generate_messages_cpp multiplatform_message_headers) -target_link_libraries(publisher - ${catkin_LIBRARIES} - px4 -) - -## Declare a test subscriber -add_executable(subscriber - src/examples/subscriber/subscriber_main.cpp - src/examples/subscriber/subscriber_example.cpp) -add_dependencies(subscriber ${PROJECT_NAME}_generate_messages_cpp multiplatform_message_headers) -target_link_libraries(subscriber - ${catkin_LIBRARIES} - px4 -) - -## MC Attitude Control -add_executable(mc_att_control - src/modules/mc_att_control_multiplatform/mc_att_control_main.cpp - src/modules/mc_att_control_multiplatform/mc_att_control.cpp - src/modules/mc_att_control_multiplatform/mc_att_control_base.cpp) -add_dependencies(mc_att_control ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(mc_att_control - ${catkin_LIBRARIES} - px4 -) - -## MC Position Control -add_executable(mc_pos_control - src/modules/mc_pos_control_multiplatform/mc_pos_control_main.cpp - src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp) -add_dependencies(mc_pos_control ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(mc_pos_control - ${catkin_LIBRARIES} - px4 -) - -## Attitude Estimator dummy -add_executable(attitude_estimator - src/platforms/ros/nodes/attitude_estimator/attitude_estimator.cpp) -add_dependencies(attitude_estimator ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(attitude_estimator - ${catkin_LIBRARIES} - px4 -) - -## Position Estimator dummy -add_executable(position_estimator - src/platforms/ros/nodes/position_estimator/position_estimator.cpp) -add_dependencies(position_estimator ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(position_estimator - ${catkin_LIBRARIES} - px4 -) - -## Manual input -add_executable(manual_input - src/platforms/ros/nodes/manual_input/manual_input.cpp) -add_dependencies(manual_input ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(manual_input - ${catkin_LIBRARIES} - px4 -) - -## Multicopter Mixer dummy -add_executable(mc_mixer - src/platforms/ros/nodes/mc_mixer/mc_mixer.cpp) -add_dependencies(mc_mixer ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(mc_mixer - ${catkin_LIBRARIES} - px4 -) - -## Commander dummy -add_executable(commander - src/platforms/ros/nodes/commander/commander.cpp) -add_dependencies(commander ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(commander - ${catkin_LIBRARIES} - px4 -) - -## Mavlink dummy -add_executable(mavlink - src/platforms/ros/nodes/mavlink/mavlink.cpp) -add_dependencies(mavlink ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(mavlink - ${catkin_LIBRARIES} - px4 -) - -## Offboard Position Setpoint Demo -add_executable(demo_offboard_position_setpoints - src/platforms/ros/nodes/demo_offboard_position_setpoints/demo_offboard_position_setpoints.cpp) -add_dependencies(demo_offboard_position_setpoints ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(demo_offboard_position_setpoints - ${catkin_LIBRARIES} - px4 -) - -## Offboard Attitude Setpoint Demo -add_executable(demo_offboard_attitude_setpoints - src/platforms/ros/nodes/demo_offboard_attitude_setpoints/demo_offboard_attitude_setpoints.cpp) -add_dependencies(demo_offboard_attitude_setpoints ${PROJECT_NAME}_generate_messages_cpp_cpp) -target_link_libraries(demo_offboard_attitude_setpoints - ${catkin_LIBRARIES} - px4 -) - -############# -## Install ## -############# - -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html - -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark executables and/or libraries for installation -install(TARGETS ${PROJECT_NAME} - ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -) - -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_px4test.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) - -if(CATKIN_ENABLE_TESTING) - find_package(rostest REQUIRED) - add_rostest(integrationtests/demo_tests/direct_tests.launch) - add_rostest(integrationtests/demo_tests/mavros_tests.launch) +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +project(px4 CXX C ASM) +if (NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) + cmake_policy(SET CMP0045 NEW) # error on non-existent target in get prop + cmake_policy(SET CMP0046 NEW) # no non-existent targets as dependencies endif() +set(version_major 0) +set(version_minor 1) +set(verion_patch 2) +set(version "${version_major}.${version_minor}.${version_patch}") +set(package-contact "px4users@googlegroups.com") +#============================================================================= +# cmake modules +# + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + +include(px4_utils) +include(px4_nuttx_utils) + +#============================================================================= +# parameters +# + +set(OS "posix" CACHE STRING "desired operating system") +set_property(CACHE OS PROPERTY STRINGS nuttx posix qurt) + +set(BOARD "sitl" CACHE STRING "target board") +set_property(CACHE BOARD PROPERTY STRINGS px4fmu-v2 sitl) + +set(LABEL "simple" CACHE STRING "module set label") +set_property(CACHE LABEL PROPERTY STRINGS simple default) + +set(NUTTX_BUILD_THREADS "4" CACHE STRING + "number of threads to use when building NuttX") + +set(required_toolchain_variables + CMAKE_C_COMPILER_ID + ) + +#============================================================================= +# check required toolchain variables +# +foreach(var ${required_toolchain_variables}) + if (NOT ${var}) + message(FATAL_ERROR "Toolchain must define ${var}") + endif() +endforeach() + +#============================================================================= +# git +# +px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") +px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") +px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") +px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") +px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") + +add_custom_target(submodule_clean + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND git submodule deinit -f . + COMMAND rm -rf .git/modules/* + ) + +#============================================================================= +# external libraries +# +if(${OS} STREQUAL "nuttx") + px4_nuttx_add_export(OUT nuttx_export + CONFIG ${BOARD} + THREADS ${NUTTX_BUILD_THREADS} + DEPENDS git_nuttx) +endif() + +#============================================================================= +# build flags +# + +px4_add_common_flags( + C_FLAGS c_flags + CXX_FLAGS cxx_flags + EXE_LINKER_FLAGS exe_linker_flags + INCLUDE_DIRS include_dirs + LINK_DIRS link_dirs + DEFINITIONS definitions) + +if(${OS} STREQUAL "nuttx") + px4_add_nuttx_flags( + BOARD ${BOARD} + C_FLAGS c_flags + CXX_FLAGS cxx_flags + EXE_LINKER_FLAGS exe_linker_flags + INCLUDE_DIRS include_dirs + LINK_DIRS link_dirs + DEFINITIONS definitions) + +endif() + +px4_join(OUT CMAKE_EXE_LINKER_FLAGS LIST "${exe_linker_flags}" GLUE " ") +px4_join(OUT CMAKE_C_FLAGS LIST "${c_flags}" GLUE " ") +px4_join(OUT CMAKE_CXX_FLAGS LIST "${cxx_flags}" GLUE " ") +include_directories(${include_dirs}) +link_directories(${link_dirs}) +add_definitions(${definitions}) + +#============================================================================= +# source code generation +# +file(GLOB_RECURSE msg_files msg/*.msg) +px4_generate_messages(TARGET msg_gen + MSG_FILES ${msg_files} + OS ${OS} + DEPENDS git_genmsg git_gencpp + ) + +#============================================================================= +# subdirectories +# +add_subdirectory(src) + +#============================================================================= +# packaging +# +# Important to having packaging at end of cmake file. +# +set(CPACK_PACKAGE_VERSION ${version}) +set(CPACK_PACKAGE_CONTACT ${package_contact}) +include(CPack) + +# vim: set noet fenc=utf-8 ff=unix ft=cmake : diff --git a/Makefile b/Makefile index 3c47aad3e0..cc8a625478 100644 --- a/Makefile +++ b/Makefile @@ -1,307 +1,27 @@ -# -# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# +d=$(PWD) -# -# Top-level Makefile for building PX4 firmware images. -# +px4fmu-v2_simple: + mkdir -p $d/build_$@ && cd $d/build_$@ && \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-arm-none-eabi.cmake \ + -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=simple && \ + make -s && ctest -V && cpack -G ZIP -TARGETS := nuttx posix posix-arm qurt -EXPLICIT_TARGET := $(filter $(TARGETS),$(MAKECMDGOALS)) -ifneq ($(EXPLICIT_TARGET),) - export PX4_TARGET_OS=$(EXPLICIT_TARGET) - export GOALS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) -endif +px4fmu-v2_simple-upload: px4fmu-v2_simple + cd $d/build_$< && make upload -# -# Get path and tool configuration -# -export PX4_BASE := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))/ -include $(PX4_BASE)makefiles/setup.mk +posix-sitl_simple: + mkdir -p $d/build_$@ && cd $d/build_$@ && \ + cmake .. \ + -DOS=posix -DBOARD=sitl -DLABEL=simple && \ + make -s && ctest -V && cpack -G ZIP -# -# Get a version string provided by git -# This assumes that git command is available and that -# the directory holding this file also contains .git directory -# -GIT_DESC := $(shell git log -1 --pretty=format:%H) -ifneq ($(words $(GIT_DESC)),1) - GIT_DESC := "unknown_git_version" -endif +qurt-hil_simple: + mkdir -p $d/build_$@ && cd $d/build_$@ && \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-hexagon.cmake \ + -DOS=qurt -DBOARD=hil -DLABEL=simple && \ + make -s && ctest -V && cpack -G ZIP -GIT_DESC_SHORT := $(shell echo $(GIT_DESC) | cut -c1-16) - -# -# Canned firmware configurations that we (know how to) build. -# -KNOWN_CONFIGS := $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/config_*.mk)))) -CONFIGS ?= $(KNOWN_CONFIGS) - -# -# Boards that we (know how to) build NuttX export kits for. -# -KNOWN_BOARDS := $(subst board_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/board_*.mk)))) -BOARDS ?= $(KNOWN_BOARDS) - -# -# Debugging -# -MQUIET = --no-print-directory -#MQUIET = --print-directory - -################################################################################ -# No user-serviceable parts below -################################################################################ - -# -# If the user has listed a config as a target, strip it out and override CONFIGS. -# -FIRMWARE_GOAL = firmware -EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS)) -ifneq ($(EXPLICIT_CONFIGS),) -CONFIGS := $(EXPLICIT_CONFIGS) -.PHONY: $(EXPLICIT_CONFIGS) -$(EXPLICIT_CONFIGS): all - -# -# If the user has asked to upload, they must have also specified exactly one -# config. -# -ifneq ($(filter upload,$(MAKECMDGOALS)),) -ifneq ($(words $(EXPLICIT_CONFIGS)),1) -$(error In order to upload, exactly one board config must be specified) -endif -FIRMWARE_GOAL = upload -.PHONY: upload -upload: - @: -endif -endif - -ifeq ($(PX4_TARGET_OS),nuttx) -include $(PX4_BASE)makefiles/nuttx/firmware_nuttx.mk -endif -ifeq ($(PX4_TARGET_OS),posix) -include $(PX4_BASE)makefiles/posix/firmware_posix.mk -endif -ifeq ($(PX4_TARGET_OS),posix-arm) -include $(PX4_BASE)makefiles/posix/firmware_posix.mk -endif -ifeq ($(PX4_TARGET_OS),qurt) -include $(PX4_BASE)makefiles/qurt/firmware_qurt.mk -endif - -qurt_fixup: - makefiles/qurt/setup.sh $(PX4_BASE) - -restore: - cd src/lib/eigen && git checkout . - git submodule update - -# -# Versioning -# - -GIT_VER_FILE = $(PX4_VERSIONING_DIR).build_git_ver -GIT_HEADER_FILE = $(PX4_VERSIONING_DIR)build_git_version.h - -$(GIT_VER_FILE) : - $(Q) if [ ! -f $(GIT_VER_FILE) ]; then \ - $(MKDIR) -p $(PX4_VERSIONING_DIR); \ - $(ECHO) "" > $(GIT_VER_FILE); \ - fi - -.PHONY: checkgitversion -checkgitversion: $(GIT_VER_FILE) - $(Q) if [ "$(GIT_DESC)" != "$(shell cat $(GIT_VER_FILE))" ]; then \ - $(ECHO) "/* Auto Magically Generated file */" > $(GIT_HEADER_FILE); \ - $(ECHO) "/* Do not edit! */" >> $(GIT_HEADER_FILE); \ - $(ECHO) "#define PX4_GIT_VERSION_STR \"$(GIT_DESC)\"" >> $(GIT_HEADER_FILE); \ - $(ECHO) "#define PX4_GIT_VERSION_BINARY 0x$(GIT_DESC_SHORT)" >> $(GIT_HEADER_FILE); \ - $(ECHO) $(GIT_DESC) > $(GIT_VER_FILE); \ - fi -# -# Sizes -# - -.PHONY: size -size: - $(Q) for elfs in Build/*; do if [ -f $$elfs/firmware.elf ]; then $(SIZE) $$elfs/firmware.elf; fi done - - -# -# Submodule Checks -# - -.PHONY: checksubmodules -checksubmodules: - $(Q) ($(PX4_BASE)/Tools/check_submodules.sh $(PX4_TARGET_OS)) - -.PHONY: updatesubmodules -updatesubmodules: - $(Q) (git submodule init) - $(Q) (git submodule update) - -MSG_DIR = $(PX4_BASE)msg -UORB_TEMPLATE_DIR = $(PX4_BASE)msg/templates/uorb -MULTIPLATFORM_TEMPLATE_DIR = $(PX4_BASE)msg/templates/px4/uorb -TOPICS_DIR = $(PX4_BASE)src/modules/uORB/topics -MULTIPLATFORM_HEADER_DIR = $(PX4_BASE)src/platforms/$(PX4_TARGET_OS)/px4_messages -MULTIPLATFORM_PREFIX = px4_ -TOPICHEADER_TEMP_DIR = $(BUILD_DIR)topics_temporary -MULTI_TOPICHEADER_TEMP_DIR = $(BUILD_DIR)multi_topics_temporary -GENMSG_PYTHONPATH = $(PX4_BASE)Tools/genmsg/src -GENCPP_PYTHONPATH = $(PX4_BASE)Tools/gencpp/src - -.PHONY: generateuorbtopicheaders -generateuorbtopicheaders: checksubmodules - @$(ECHO) "Generating uORB topic headers" - $(Q) (PYTHONPATH=$(GENMSG_PYTHONPATH):$(GENCPP_PYTHONPATH):$(PYTHONPATH) $(PYTHON) \ - $(PX4_BASE)Tools/px_generate_uorb_topic_headers.py \ - -d $(MSG_DIR) -o $(TOPICS_DIR) -e $(UORB_TEMPLATE_DIR) -t $(TOPICHEADER_TEMP_DIR)) - @$(ECHO) "Generating multiplatform uORB topic wrapper headers" - $(Q) (PYTHONPATH=$(GENMSG_PYTHONPATH):$(GENCPP_PYTHONPATH):$(PYTHONPATH) $(PYTHON) \ - $(PX4_BASE)Tools/px_generate_uorb_topic_headers.py \ - -d $(MSG_DIR) -o $(MULTIPLATFORM_HEADER_DIR) -e $(MULTIPLATFORM_TEMPLATE_DIR) -t $(MULTI_TOPICHEADER_TEMP_DIR) -p $(MULTIPLATFORM_PREFIX)) - -# -# Testing targets -# -testbuild: - $(Q) (cd $(PX4_BASE) && $(MAKE) distclean && $(MAKE) archives && $(MAKE) -j8) - $(Q) (zip -r Firmware.zip $(PX4_BASE)/Images) - -nuttx posix posix-arm qurt: -ifeq ($(GOALS),) - $(MAKE) PX4_TARGET_OS=$@ $(GOALS) -else - export PX4_TARGET_OS=$@ -endif - -sitl_quad: - $(Q) Tools/sitl_run.sh posix-configs/SITL/init/rcS -sitl_quad_gazebo: - $(Q) Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros -sitl_plane: - $(Q) Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing - -qurtrun: - $(MAKE) PX4_TARGET_OS=qurt sim - -# -# Unittest targets. Builds and runs the host-level -# unit tests. -.PHONY: tests -tests: generateuorbtopicheaders - $(Q) (mkdir -p $(PX4_BASE)/unittests/build && cd $(PX4_BASE)/unittests/build && cmake .. && $(MAKE) --no-print-directory unittests) - -.PHONY: check_format -check_format: - $(Q) (./Tools/check_code_style.sh) - -# -# Cleanup targets. 'clean' should remove all built products and force -# a complete re-compilation, 'distclean' should remove everything -# that's generated leaving only files that are in source control. -# -.PHONY: clean clean: - @echo > /dev/null - $(Q) $(RMDIR) $(BUILD_DIR)*.build - $(Q) $(RMDIR) $(PX4_VERSIONING_DIR) - $(Q) $(REMOVE) $(IMAGE_DIR)*.px4 - $(Q) $(RMDIR) $(TOPICHEADER_TEMP_DIR) - $(Q) $(RMDIR) $(MULTI_TOPICHEADER_TEMP_DIR) - -.PHONY: distclean -distclean: clean - @echo > /dev/null - $(Q) $(REMOVE) $(ARCHIVE_DIR)*.export - $(Q) $(MAKE) -C $(NUTTX_SRC) -r $(MQUIET) distclean - $(Q) (cd $(NUTTX_SRC)/configs && $(FIND) . -maxdepth 1 -type l -delete) - -# -# Print some help text -# -.PHONY: help -help: - @$(ECHO) "" - @$(ECHO) " PX4 firmware builder" - @$(ECHO) " ====================" - @$(ECHO) "" - @$(ECHO) " Available targets:" - @$(ECHO) " ------------------" - @$(ECHO) "" -ifeq ($(PX4_TARGET_OS),nuttx) - @$(ECHO) " archives" - @$(ECHO) " Build the NuttX RTOS archives that are used by the firmware build." - @$(ECHO) "" -endif - @$(ECHO) " all" - @$(ECHO) " Build all firmware configs: $(CONFIGS)" - @$(ECHO) " A limited set of configs can be built with CONFIGS=" - @$(ECHO) "" - @for config in $(CONFIGS); do \ - $(ECHO) " $$config"; \ - $(ECHO) " Build just the $$config firmware configuration."; \ - $(ECHO) ""; \ - done - @$(ECHO) " clean" - @$(ECHO) " Remove all firmware build pieces." - @$(ECHO) "" -ifeq ($(PX4_TARGET_OS),nuttx) - @$(ECHO) " distclean" - @$(ECHO) " Remove all compilation products, including NuttX RTOS archives." - @$(ECHO) "" - @$(ECHO) " upload" - @$(ECHO) " When exactly one config is being built, add this target to upload the" - @$(ECHO) " firmware to the board when the build is complete. Not supported for" - @$(ECHO) " all configurations." - @$(ECHO) "" -endif - @$(ECHO) " testbuild" - @$(ECHO) " Perform a complete clean build of the entire tree." - @$(ECHO) "" - @$(ECHO) " Common options:" - @$(ECHO) " ---------------" - @$(ECHO) "" - @$(ECHO) " V=1" - @$(ECHO) " If V is set, more verbose output is printed during the build. This can" - @$(ECHO) " help when diagnosing issues with the build or toolchain." - @$(ECHO) "" -ifeq ($(PX4_TARGET_OS),nuttx) - @$(ECHO) " To see help for a specifix target use 'make help' where target is" - @$(ECHO) " one of: " - @$(ECHO) " nuttx" - @$(ECHO) " posix" - @$(ECHO) " qurt" - @$(ECHO) "" -endif + rm -rf build_*/ +.PHONY: clean diff --git a/Tools/px_generate_uorb_topic_headers.py b/Tools/px_generate_uorb_topic_headers.py index 449f208c25..3c9f5379c6 100755 --- a/Tools/px_generate_uorb_topic_headers.py +++ b/Tools/px_generate_uorb_topic_headers.py @@ -79,7 +79,7 @@ def convert_file(filename, outputdir, templatedir, includepath): """ Converts a single .msg file to a uorb header """ - print("Generating headers from {0}".format(filename)) + #print("Generating headers from {0}".format(filename)) genmsg.template_tools.generate_from_file(filename, package, outputdir, @@ -136,7 +136,7 @@ def convert_dir(inputdir, outputdir, templatedir): return True -def copy_changed(inputdir, outputdir, prefix=''): +def copy_changed(inputdir, outputdir, prefix='', quiet=False): """ Copies files from inputdir to outputdir if they don't exist in ouputdir or if their content changed @@ -153,7 +153,8 @@ def copy_changed(inputdir, outputdir, prefix=''): fno = os.path.join(outputdir, prefix + f) if not os.path.isfile(fno): shutil.copy(fni, fno) - print("{0}: new header file".format(f)) + if not quiet: + print("{0}: new header file".format(f)) continue if os.path.getmtime(fni) > os.path.getmtime(fno): @@ -161,13 +162,15 @@ def copy_changed(inputdir, outputdir, prefix=''): # only copy if contents do not match if not filecmp.cmp(fni, fno): shutil.copy(fni, fno) - print("{0}: updated".format(f)) + if not quiet: + print("{0}: updated".format(f)) continue - #print("{0}: unchanged".format(f)) + if not quiet: + print("{0}: unchanged".format(f)) -def convert_dir_save(inputdir, outputdir, templatedir, temporarydir, prefix): +def convert_dir_save(inputdir, outputdir, templatedir, temporarydir, prefix, quiet=False): """ Converts all .msg files in inputdir to uORB header files Unchanged existing files are not overwritten. @@ -175,7 +178,7 @@ def convert_dir_save(inputdir, outputdir, templatedir, temporarydir, prefix): # Create new headers in temporary output directory convert_dir(inputdir, temporarydir, templatedir) # Copy changed headers from temporary dir to output dir - copy_changed(temporarydir, outputdir, prefix) + copy_changed(temporarydir, outputdir, prefix, quiet) if __name__ == "__main__": parser = argparse.ArgumentParser( @@ -193,6 +196,9 @@ if __name__ == "__main__": parser.add_argument('-p', dest='prefix', default='', help='string added as prefix to the output file ' ' name when converting directories') + parser.add_argument('-q', dest='quiet', default=False, action='store_true', + help='string added as prefix to the output file ' + ' name when converting directories') args = parser.parse_args() if args.file is not None: @@ -208,4 +214,5 @@ if __name__ == "__main__": args.outputdir, args.templatedir, args.temporarydir, - args.prefix) + args.prefix, + args.quiet) diff --git a/cmake/Toolchain-arm-none-eabi.cmake b/cmake/Toolchain-arm-none-eabi.cmake new file mode 100644 index 0000000000..9587705b32 --- /dev/null +++ b/cmake/Toolchain-arm-none-eabi.cmake @@ -0,0 +1,67 @@ +# defines: +# +# NM +# OBJCOPY +# LD +# CXX_COMPILER +# C_COMPILER +# CMAKE_SYSTEM_NAME +# CMAKE_SYSTEM_VERSION +# GENROMFS +# LINKER_FLAGS +# CMAKE_EXE_LINKER_FLAGS +# CMAKE_FIND_ROOT_PATH +# CMAKE_FIND_ROOT_PATH_MODE_PROGRAM +# CMAKE_FIND_ROOT_PATH_MODE_LIBRARY +# CMAKE_FIND_ROOT_PATH_MODE_INCLUDE + +include(CMakeForceCompiler) + +# this one is important +set(CMAKE_SYSTEM_NAME Generic) + +#this one not so much +set(CMAKE_SYSTEM_VERSION 1) + +# specify the cross compiler +find_program(C_COMPILER arm-none-eabi-gcc) +if(NOT C_COMPILER) + message(FATAL_ERROR "could not find arm-none-eabi-gcc compiler") +endif() +cmake_force_c_compiler(${C_COMPILER} GNU) + +find_program(CXX_COMPILER arm-none-eabi-g++) +if(NOT CXX_COMPILER) + message(FATAL_ERROR "could not find arm-none-eabi-g++ compiler") +endif() +cmake_force_cxx_compiler(${CXX_COMPILER} GNU) + +# compiler tools +foreach(tool objcopy nm ld) + string(TOUPPER ${tool} TOOL) + find_program(${TOOL} arm-none-eabi-${tool}) + if(NOT ${TOOL}) + message(FATAL_ERROR "could not find ${TOOL}") + endif() +endforeach() + +# os tools +foreach(tool grep rm nm genromfs) + string(TOUPPER ${tool} TOOL) + find_program(${TOOL} ${tool}) + if(NOT ${TOOL}) + message(FATAL_ERROR "could not find ${TOOL}") + endif() +endforeach() + +set(LINKER_FLAGS "-Wl,-gc-sections") +set(CMAKE_EXE_LINKER_FLAGS ${LINKER_FLAGS}) + +# where is the target environment +set(CMAKE_FIND_ROOT_PATH get_file_component(${C_COMPILER} PATH)) + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/cmake/Toolchain-hexagon.cmake b/cmake/Toolchain-hexagon.cmake new file mode 100644 index 0000000000..82f6f19ab1 --- /dev/null +++ b/cmake/Toolchain-hexagon.cmake @@ -0,0 +1,249 @@ +# +# Copyright (C) 2015 Mark Charlebois. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +include(CMakeForceCompiler) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +include(px4_utils) + +if(NOT HEXAGON_TOOLS_ROOT) + set(HEXAGON_TOOLS_ROOT /opt/6.4.05) +endif() + +if(NOT HEXAGON_SDK_ROOT) + set(HEXAGON_SDK_ROOT /opt/Hexagon_SDK) +endif() + +macro (list2string out in) + set(list ${ARGV}) + list(REMOVE_ITEM list ${out}) + foreach(item ${list}) + set(${out} "${${out}} ${item}") + endforeach() +endmacro(list2string) + +set(V_ARCH "v5") +set(CROSSDEV "hexagon-") +set(HEXAGON_BIN ${HEXAGON_TOOLS_ROOT}/gnu/bin) +set(HEXAGON_CLANG_BIN ${HEXAGON_TOOLS_ROOT}/qc/bin) +set(HEXAGON_LIB_DIR ${HEXAGON_TOOLS_ROOT}/gnu/hexagon/lib) +set(HEXAGON_ISS_DIR ${HEXAGON_TOOLS_ROOT}/qc/lib/iss) +set(TOOLSLIB ${HEXAGON_TOOLS_ROOT}/dinkumware/lib/$(V_ARCH)/G0) +set(QCTOOLSLIB ${HEXAGON_TOOLS_ROOT}/qc/lib/$(V_ARCH)/G0) + +# Use the HexagonTools compiler (6.4.05) +set(CMAKE_C_COMPILER ${HEXAGON_CLANG_BIN}/${CROSSDEV}clang) +set(CMAKE_CXX_COMPILER ${HEXAGON_CLANG_BIN}/${CROSSDEV}clang++) + +set(CMAKE_AR ${HEXAGON_BIN}/${CROSSDEV}ar CACHE FILEPATH "Archiver") +set(CMAKE_RANLIB ${HEXAGON_BIN}/${CROSSDEV}ranlib) +set(CMAKE_LINKER ${HEXAGON_BIN}/${CROSSDEV}ld) +set(CMAKE_NM ${HEXAGON_BIN}/${CROSSDEV}nm) +set(CMAKE_OBJDUMP ${HEXAGON_BIN}/${CROSSDEV}objdump) +set(CMAKE_OBJCOPY ${HEXAGON_BIN}/${CROSSDEV}objcopy) + +list2string(HEXAGON_INCLUDE_DIRS + -I${HEXAGON_TOOLS_ROOT}/gnu/hexagon/include + -I${HEXAGON_SDK_ROOT}/inc + -I${HEXAGON_SDK_ROOT}/inc/stddef + ) + +#set(DYNAMIC_LIBS -Wl,${TOOLSLIB}/pic/libstdc++.a) + +#set(MAXOPTIMIZATION -O0) + +# Base CPU flags for each of the supported architectures. +# +set(ARCHCPUFLAGS + -m${V_ARCH} + -G0 + ) + +add_definitions( + -D_PID_T -D_UID_T -D_TIMER_T + -Dnoreturn_function= + -D__EXPORT= + -Drestrict= + -D_DEBUG + -Wno-error=shadow + ) + +# optimisation flags +# +set(ARCHOPTIMIZATION + -O0 + -g + -fno-strict-aliasing + -fdata-sections + -fpic + -fno-zero-initialized-in-bss + ) + +# Language-specific flags +# +set(ARCHCFLAGS + -std=gnu99 + -D__CUSTOM_FILE_IO__ + ) +set(ARCHCXXFLAGS + -fno-exceptions + -fno-rtti + -std=c++11 + -fno-threadsafe-statics + -DCONFIG_WCHAR_BUILTIN + -D__CUSTOM_FILE_IO__ + ) + +set(ARCHWARNINGS + -Wall + -Wextra + -Werror + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-gnu-array-member-paren-init + -Wno-cast-align + -Wno-missing-braces + -Wno-strict-aliasing +# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+ +# -Wcast-qual - generates spurious noreturn attribute warnings, try again later +# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code +# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives + ) + +# C-specific warnings +# +set(ARCHCWARNINGS + ${ARCHWARNINGS} + -Wstrict-prototypes + -Wnested-externs + ) + +# C++-specific warnings +# +set(ARCHWARNINGSXX + ${ARCHWARNINGS} + -Wno-missing-field-initializers + ) +exec_program(${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ARGS -print-libgcc-file-name OUTPUT_VARIABLE LIBGCC) +exec_program(${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ARGS -print-file-name=libm.a OUTPUT_VARIABLE LIBM) +set(EXTRA_LIBS ${EXTRA_LIBS} ${LIBM}) + +# Flags we pass to the C compiler +# +list2string(CFLAGS + ${ARCHCFLAGS} + ${ARCHCWARNINGS} + ${ARCHOPTIMIZATION} + ${ARCHCPUFLAGS} + ${ARCHINCLUDES} + ${INSTRUMENTATIONDEFINES} + ${ARCHDEFINES} + ${EXTRADEFINES} + ${EXTRACFLAGS} + ${HEXAGON_INCLUDE_DIRS} + ) + +# Flags we pass to the C++ compiler +# +list2string(CXXFLAGS + ${ARCHCXXFLAGS} + ${ARCHWARNINGSXX} + ${ARCHOPTIMIZATION} + ${ARCHCPUFLAGS} + ${ARCHXXINCLUDES} + ${INSTRUMENTATIONDEFINES} + ${ARCHDEFINES} + ${EXTRADEFINES} + ${EXTRACXXFLAGS} + ${HEXAGON_INCLUDE_DIRS} + ) + +# Flags we pass to the assembler +# +list2string(AFLAGS + ${CFLAGS} + -D__ASSEMBLY__ + ${EXTRADEFINES} + ${EXTRAAFLAGS} + ) + +# Set cmake flags +# +list2string(CMAKE_C_FLAGS + ${CMAKE_C_FLAGS} + ${CFLAGS} + ) + +set(QURT_CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "cflags") + +message(STATUS "CMAKE_C_FLAGS: -${CMAKE_C_FLAGS}-") + +list2string(CMAKE_CXX_FLAGS + ${CMAKE_CXX_FLAGS} + ${CXXFLAGS} + ) + +set(QURT_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "cxxflags") + +message(STATUS "CMAKE_CXX_FLAGS: -${CMAKE_CXX_FLAGS}-") + +# Flags we pass to the linker +# +list2string(CMAKE_EXE_LINKER_FLAGS + -g + -mv5 + -mG0lib + -G0 + -fpic + -shared + -Wl,-Bsymbolic + -Wl,--wrap=malloc + -Wl,--wrap=calloc + -Wl,--wrap=free + -Wl,--wrap=realloc + -Wl,--wrap=memalign + -Wl,--wrap=__stack_chk_fail + -lc + ${EXTRALDFLAGS} + ) + +# where is the target environment +set(CMAKE_FIND_ROOT_PATH get_file_component(${C_COMPILER} PATH)) + +set(CMAKE_C_COMPILER_ID, "Clang") +set(CMAKE_CXX_COMPILER_ID, "Clang") + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/cmake/Toolchain-posix-clang-native.cmake b/cmake/Toolchain-posix-clang-native.cmake new file mode 100644 index 0000000000..88492dc960 --- /dev/null +++ b/cmake/Toolchain-posix-clang-native.cmake @@ -0,0 +1,83 @@ + +set(WARNINGS + -Wall + -Wextra + -Wdouble-promotion + -Wshadow + -Wfloat-equal + -Wframe-larger-than=1024 + -Wpointer-arith + -Wlogical-op + -Wmissing-declarations + -Wpacked + -Wno-unused-parameter + -Werror=format-security + -Werror=array-bounds + -Wfatal-errors + -Wformat=1 + -Werror=unused-but-set-variable + -Werror=unused-variable + -Werror=double-promotion + -Werror=reorder + -Werror=uninitialized + -Werror=init-self + #-Wcast-qual - generates spurious noreturn attribute warnings, + # try again later + #-Wconversion - would be nice, but too many "risky-but-safe" + # conversions in the code + #-Wcast-align - would help catch bad casts in some cases, + # but generates too many false positives + ) + +set(OPT_FLAGS + -Os -g3 + ) + +#============================================================================= +# c flags +# +set(C_WARNINGS + -Wbad-function-cast + -Wstrict-prototypes + -Wold-style-declaration + -Wmissing-parameter-type + -Wmissing-prototypes + -Wnested-externs + ) +set(C_FLAGS + -std=gnu99 + -fno-common + ) + +#============================================================================= +# cxx flags +# +set(CXX_WARNINGS + -Wno-missing-field-initializers + ) +set(CXX_FLAGS + -fno-exceptions + -fno-rtti + -std=gnu++0x + -fno-threadsafe-statics + -DCONFIG_WCHAR_BUILTIN + -D__CUSTOM_FILE_IO__ + ) + +#============================================================================= +# ld flags +# +set(LD_FLAGS + -Wl,--warn-common + -Wl,--gc-sections + ) + +#============================================================================= +# misc flags +# +set(VISIBILITY_FLAGS + -fvisibility=hidden + "-include ${CMAKE_SOURCE_DIR}/src/include/visibility.h" + ) +set(EXE_LINK_FLAGS) + diff --git a/cmake/builtin_commands.c.cmake b/cmake/builtin_commands.c.cmake new file mode 100644 index 0000000000..09c611d0dd --- /dev/null +++ b/cmake/builtin_commands.c.cmake @@ -0,0 +1,12 @@ +/* builtin command list - automatically generated, do not edit */ +#include +#include +#include +uint8_t romfs_img_len = 0; +uint8_t romfs_img[] = {}; +${builtin_apps_decl_string} +const struct builtin_s g_builtins[] = { +${builtin_apps_string} + {NULL, 0, 0, NULL} +}; +const int g_builtin_count = ${command_count}; diff --git a/cmake/cmake_lists.jinja b/cmake/cmake_lists.jinja new file mode 100644 index 0000000000..f24bc0bcbd --- /dev/null +++ b/cmake/cmake_lists.jinja @@ -0,0 +1,73 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE {{data.module}} +{%- if data.command != '' %} + MAIN {{data.command}} +{%- endif %} +{%- if data.priority != '' %} + PRIORITY {{data.priority}} +{%- endif %} +{%- if data.stacksize != '' %} + STACK {{data.stacksize}} +{%- endif %} +{%- if (data.extracxxflags|length > 0) or (data.extracflags|length > 0) or (data.maxoptimization != '') %} + COMPILE_FLAGS +{%- for flag in data.extracxxflags %} + {{flag}} +{%- endfor %} +{%- for flag in data.extracflags %} + {{flag}} +{%- endfor %} + {{data.maxoptimization}} +{%- endif %} +{%- if data.srcs|length > 0 %} + SRCS +{%- for src in data.srcs %} + {{src}} +{%- endfor %} +{%- endif %} + DEPENDS +{%- if data.module != 'platforms__common' %} + platforms__common +{%- else %} + msg_gen +{%- endif %} +{%- if data.includes|length > 0 %} + INCLUDES {%- for include in data.includes %} + {{include}} +{%- endfor %} +{%- endif %} + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : +{# vim: set noet list ft=jinja fenc=utf-8 ff=unix : #} diff --git a/cmake/convert_modules_to_cmake.py b/cmake/convert_modules_to_cmake.py new file mode 100755 index 0000000000..ead6a9672b --- /dev/null +++ b/cmake/convert_modules_to_cmake.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import argparse +import os +import sys +import fnmatch +import re +import shutil +import jinja2 + +src_path = os.path.join(os.path.curdir, 'src') + +parser = argparse.ArgumentParser('converts module.mk to CMakeList.txt, run in root of repo') +parser.add_argument('path', help='directory of modules to convert') +parser.add_argument('--overwrite', help='overwrite existing files', dest='overwrite', action='store_true') +parser.add_argument('--backup', help='create backup of existing files if overwriting', dest='backup', action='store_true') +parser.set_defaults(overwrite=False, backup=False) +args = parser.parse_args() + +cmake_template = jinja2.Template(open('cmake/cmake_lists.jinja', 'r').read()) + +module_files = [] +for root, dirnames, filenames in os.walk(args.path): + for filename in fnmatch.filter(filenames, 'module.mk'): + module_files.append(os.path.join(root, filename)) + + +search_data = [ + # name # re string + ('command', r'.*MODULE_COMMAND\s*[\+]?=\s*([^\n]+)'), + ('stacksize', r'.*MODULE_STACKSIZE\s*[\+]?=([^\n]+)'), + ('extracxxflags', r'.*EXTRACXXFLAGS\s*[\+]?=([^\n]+)'), + ('extracflags', r'.*EXTRACFLAGS\s*[\+]?=\s*([^\s]+)\s*'), + ('priority', r'.*MODULE_PRIORITY\s*[\+]?=\s*([^\s]+)\s*'), + ('maxoptimization', r'.*MAXOPTIMIZATION\s*[\+]?=\s*([^\s]+)\s*'), + ('srcs', '.*SRCS\s*[\+]?=([^\n\\\]*([\\\]\s*\n[^\n\\\]*)*)'), + ('include_dirs', '.*INCLUDE_DIRS\s*[\+]?=([^\n\\\]*([\\\]\s*\n[^\n\\\]*)*)'), + ] + +progs = {} +for name, re_str in search_data: + progs[name] = re.compile(re_str) + +for module_file in module_files: + + data = {} + with open(module_file, 'r') as f: + module_text = f.read() + data['text'] = module_text + module_dir = os.path.dirname(module_file) + data['module'] = os.path.relpath(module_dir, src_path).replace( + os.sep, '__').split('.')[0] + #print(module_text) + for name, re_str in search_data: + result = progs[name].search(module_text) + if result is not None: + d = result.group(1).strip() + if name in ['srcs', 'extracxxflags', 'extracflags']: + d_store = d.replace('\\', '').split() + elif name == 'include_dirs': + d_store = d.replace('(', '{').replace(')', '}').split() + else: + d_store = d + data[name] = d_store + else: + data[name] = '' + + cmake_file = os.path.join(os.path.dirname(module_file), 'CMakeLists.txt') + cmake_file_backup = cmake_file + '.backup' + + if os.path.exists(cmake_file): + if args.backup: + if os.path.exists(cmake_file_backup): + print('error: file already exists:', cmake_file_backup) + continue + else: + shutil.copyfile(cmake_file, cmake_file_backup) + if args.overwrite: + print('overwriting', cmake_file) + else: + print('error: file already exists:', cmake_file) + continue + + with open(cmake_file, 'w') as f: + data_rendered = cmake_template.render(data=data) + f.write(data_rendered) + + +# vim: set et fenc= ff=unix sts=4 sw=4 ts=4 : diff --git a/cmake/posix/posix-sitl-simple.cmake b/cmake/posix/posix-sitl-simple.cmake new file mode 100644 index 0000000000..a5e0ce8a08 --- /dev/null +++ b/cmake/posix/posix-sitl-simple.cmake @@ -0,0 +1,43 @@ +list(APPEND module_directories + ./src/platforms/posix/px4_layer + ./src/platforms/posix/work_queue + ./src/platforms/posix/drivers/adcsim + ./src/platforms/posix/drivers/gpssim + ./src/platforms/posix/drivers/tonealrmsim + ./src/platforms/posix/drivers/accelsim + ./src/platforms/posix/drivers/airspeedsim + ./src/platforms/posix/drivers/barosim + ./src/platforms/posix/drivers/gyrosim + ./src/systemcmds/param + ./src/systemcmds/mixer + ./src/systemcmds/topic_listener + ./src/systemcmds/ver + ./src/systemcmds/esc_calib + ./src/systemcmds/reboot + ./src/modules/sensors + ./src/modules/mavlink + ./src/modules/attitude_estimator_ekf + ./src/modules/attitude_estimator_q + ./src/modules/ekf_att_pos_estimator + ./src/modules/position_estimator_inav + ./src/modules/navigator + ./src/modules/mc_pos_control + ./src/modules/mc_att_control + ./src/modules/mc_pos_control_multiplatform + ./src/modules/mc_att_control_multiplatform + ./src/modules/land_detector + ./src/modules/fw_att_control + ./src/modules/fw_pos_control_l1 + ./src/modules/dataman + ./src/modules/sdlog2 + ./src/modules/simulator + ./src/modules/commander + ./src/modules/controllib + ./src/lib/mathlib + ./src/lib/ecl + ./src/lib/external_lgpl + ./src/lib/geo + ./src/lib/geo_lookup + ./src/lib/launchdetection + ) + diff --git a/cmake/posix/px4_target_impl.cmake b/cmake/posix/px4_target_impl.cmake new file mode 100644 index 0000000000..6e0af6ba18 --- /dev/null +++ b/cmake/posix/px4_target_impl.cmake @@ -0,0 +1,111 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +#============================================================================= +# FILE: posix/px4_target_impl.cmake +# +# Each PX4 target OS must implement the cmake/${OS}/px4_target_impl.cmake +# rules for their target that implement the following macros: +# +# px4_target_set_flags +# px4_target_validate_config +# px4_target_firmware +# px4_target_rules +# px4_target_testing +# +# The macros are called from the top level CMakeLists.txt +# +set(POSIX_APPS_HEADER ${CMAKE_BINARY_DIR}/apps.h) + +add_git_submodule(eigen src/lib/eigen) + +macro(px4_target_set_flags) + include_directories( + src/platforms/posix/include + ) + add_definitions( + -D__PX4_POSIX + -D__PX4_LINUX + "-Dnoreturn_function=__attribute__\(\(noreturn\)\)" + -DCLOCK_MONOTONIC=1 + ) + list(APPEND EXE_LINK_LIBS + pthread + ) +endmacro() + +macro(px4_target_validate_config) + if(NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/${OS}/${TARGET_NAME}.cmake) + message(FATAL_ERROR "not implemented yet: ${TARGET_NAME}") + endif() +endmacro() + +macro(px4_target_set_modules) + # Include the target config file + include(${TARGET_NAME}) +endmacro() + +macro(px4_target_firmware) + set(installed_targets) + add_executable(main ./src/platforms/posix/main.cpp) + target_link_libraries(main ${module_list} ${EXE_LINK_LIBS} ${module_list} ${EXE_LINK_LIBS}) + list(APPEND installed_targets main) +endmacro() + +macro(px4_target_rules) + #============================================================================= + # apps + # + add_custom_command(OUTPUT ${POSIX_APPS_HEADER} + COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/Tools/posix_apps.py > ${POSIX_APPS_HEADER} + COMMENT "Generating posix apps" + VERBATIM + ) + + add_custom_target(posix_apps ALL DEPENDS ${POSIX_APPS_HEADER}) +endmacro() + +macro(px4_target_testing) + if (${BOARD} STREQUAL "sitl") + + add_test(test_px4_simple_app ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/test_compare.py + --command ${CMAKE_BINARY_DIR}/main + --stdout ${CMAKE_BINARY_DIR}/test/px4_simple_app_output.txt + --stdin ${CMAKE_SOURCE_DIR}/cmake/test/px4_simple_app_input.txt + --check ${CMAKE_SOURCE_DIR}/cmake/test/px4_simple_app_correct.txt + --start 4 --stop -1 + ) + + endif() +endmacro() diff --git a/cmake/px4_nuttx_utils.cmake b/cmake/px4_nuttx_utils.cmake new file mode 100644 index 0000000000..25f3cf0692 --- /dev/null +++ b/cmake/px4_nuttx_utils.cmake @@ -0,0 +1,348 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include(px4_utils) + +#---------------------------------------------------------------------------- +# px4_nuttx_add_firmware +# +# This function adds a nuttx firmware target. +# +# Usage: +# px4_nuttx_add_firmware(OUT EXE ) +# +# Input: +# EXE : the executable to generate the firmware from +# +# Options: +# PARAM_XML : toggles generation of param_xml +# +# Output: +# OUT : the generated firmware target +# +# Example: +# px4_nuttx_add_firmware(TARGET fw_test EXE test) +# +#---------------------------------------------------------------------------- +function(px4_nuttx_add_firmware) + px4_parse_function_args( + NAME px4_nuttx_add_firmware + ONE_VALUE OUT EXE + OPTIONS PARAM_XML + REQUIRED EXE + ARGN ${ARGN}) + + #TODO handle param_xml + add_custom_command(OUTPUT ${OUT} + COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py + --prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype + --git_identity ${CMAKE_SOURCE_DIR} + --image ${EXE}.bin > ${OUT} + DEPENDS ${EXE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) +endfunction() + +#---------------------------------------------------------------------------- +# px4_nuttx_generate_builtin_commands +# +# This function generates the builtin_commands.c src for nuttx + +# Usage: +# px4_nuttx_generate_builtin_commands( +# MODULE_LIST +# OUT ) +# +# Input: +# MODULE_LIST : list of modules +# +# Output: +# OUT : generated builtin_commands.c src +# +# Example: +# px4_nuttx_generate_builtin_commands(OUT MODULE_LIST px4_simple_app) +# +#---------------------------------------------------------------------------- +function(px4_nuttx_generate_builtin_commands) + px4_parse_function_args( + NAME px4_nuttx_generate_builtin_commands + ONE_VALUE OUT + MULTI_VALUE MODULE_LIST + REQUIRED MODULE_LIST OUT + ARGN ${ARGN}) + set(builtin_apps_string) + set(builtin_apps_decl_string) + set(command_count 0) + foreach(module ${MODULE_LIST}) + # default + set(MAIN_DEFAULT MAIN-NOTFOUND) + set(STACK_DEFAULT 1024) + set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT) + foreach(property MAIN STACK PRIORITY) + get_target_property(${property} ${module} ${property}) + if(NOT ${property}) + set(${property} ${${property}_DEFAULT}) + endif() + endforeach() + if (MAIN) + set(builtin_apps_string + "${builtin_apps_string}\t{\"${MAIN}\", ${PRIORITY}, ${STACK}, ${MAIN}_main},\n") + set(builtin_apps_decl_string + "${builtin_apps_decl_string}extern int ${MAIN}_main(int argc, char *argv[]);\n") + math(EXPR command_count "${command_count}+1") + endif() + endforeach() + configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.cmake + ${OUT}) +endfunction() + +#---------------------------------------------------------------------------- +# px4_nuttx_add_export +# +# This function generates a nuttx export. + +# Usage: +# px4_nuttx_add_export( +# OUT +# CONFIG +# DEPENDS ) +# +# Input: +# CONFIG : the board to generate the export for +# DEPENDS : dependencies +# +# Output: +# OUT : the export target +# +# Example: +# px4_nuttx_add_export(OUT nuttx_export CONFIG px4fmu-v2) +# +#---------------------------------------------------------------------------- +function(px4_nuttx_add_export) + + px4_parse_function_args( + NAME px4_nuttx_add_export + ONE_VALUE OUT CONFIG THREADS + MULTI_VALUE DEPENDS + REQUIRED OUT CONFIG THREADS + ARGN ${ARGN}) + + set(nuttx_src ${CMAKE_BINARY_DIR}/${CONFIG}/NuttX) + + # patch + add_custom_target(__nuttx_patch_${CONFIG}) + file(GLOB nuttx_patches RELATIVE ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/nuttx-patches/*.patch) + foreach(patch ${nuttx_patches}) + string(REPLACE "/" "_" patch_name "${patch}-${CONFIG}") + message(STATUS "nuttx-patch: ${patch}") + add_custom_command(OUTPUT nuttx_patch_${patch_name}.stamp + COMMAND patch -p0 -N < ${CMAKE_SOURCE_DIR}/${patch} + COMMAND touch nuttx_patch_${patch_name}.stamp + DEPENDS ${DEPENDS} + ) + add_custom_target(nuttx_patch_${patch_name} + DEPENDS nuttx_patch_${patch_name}.stamp) + add_dependencies(nuttx_patch nuttx_patch_${patch_name}) + endforeach() + + # copy + add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp + COMMAND mkdir -p ${CMAKE_BINARY_DIR}/${CONFIG} + COMMAND cp -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src} + COMMAND rm -rf ${nuttx_src}/.git + COMMAND touch nuttx_copy_${CONFIG}.stamp + DEPENDS ${DEPENDS}) + add_custom_target(__nuttx_copy_${CONFIG} + DEPENDS nuttx_copy_${CONFIG}.stamp __nuttx_patch_${CONFIG}) + + # export + add_custom_command(OUTPUT ${CONFIG}.export + COMMAND echo Configuring NuttX for ${CONFIG} + COMMAND make -C${nuttx_src}/nuttx -j${THREADS} + -r --quiet distclean + COMMAND cp -r ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG} + ${nuttx_src}/nuttx/configs + COMMAND cd ${nuttx_src}/nuttx/tools && + ./configure.sh ${CONFIG}/nsh + COMMAND echo Exporting NuttX for ${CONFIG} + COMMAND make -C ${nuttx_src}/nuttx -j${THREADS} + -r CONFIG_ARCH_BOARD=${CONFIG} export + COMMAND cp -r ${nuttx_src}/nuttx/nuttx-export.zip + ${CONFIG}.export + DEPENDS ${DEPENDS} __nuttx_copy_${CONFIG}) + + # extract + add_custom_command(OUTPUT nuttx_export_${BOARD}.stamp + COMMAND rm -rf ${nuttx_src}/nuttx-export + COMMAND unzip ${BOARD}.export -d ${nuttx_src} + COMMAND touch nuttx_export_${BOARD}.stamp + DEPENDS ${DEPENDS} ${BOARD}.export) + + add_custom_target(${OUT} + DEPENDS nuttx_export_${BOARD}.stamp) + +endfunction() + +#---------------------------------------------------------------------------- +# px4_nuttx_generate_romfs +# +# The functions generates the ROMFS filesystem for nuttx. +# +# Usage: +# px4_nuttx_generate_romfs(OUT ROOT ) +# +# Input: +# ROOT : the root of the ROMFS +# +# Output: +# OUT : the generated ROMFS +# +# Example: +# px4_nuttx_generate_romfs(OUT my_romfs ROOT "ROMFS/my_board") +# +#---------------------------------------------------------------------------- +function(px4_nuttx_generate_romfs) + + px4_parse_function_args( + NAME px4_nuttx_generate_romfs + ONE_VALUE OUT ROOT + REQUIRED OUT ROOT + ARGN ${ARGN}) + + file(GLOB_RECURSE romfs_files ${ROOT}/*) + set(romfs_temp_dir ${CMAKE_BINARY_DIR}/${ROOT}) + set(romfs_src_dir ${CMAKE_SOURCE_DIR}/${ROOT}) + + add_custom_command(OUTPUT ${OUT} + COMMAND cmake -E remove_directory ${romfs_temp_dir} + COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} + #TODO add romfs cleanup and pruning + COMMAND ${GENROMFS} -f ${OUT} -d ${romfs_temp_dir} -V "NSHInitVol" + DEPENDS ${romfs_files} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + add_custom_target(gen_romfs DEPENDS ${OUT}) + +endfunction() + +#---------------------------------------------------------------------------- +# px4_add_nuttx_flags +# +# Set ths nuttx build flags. +# +# Usage: +# px4_add_nuttx_flags( +# C_FLAGS +# CXX_FLAGS +# EXE_LINKER_FLAGS +# INCLUDE_DIRS +# LINK_DIRS +# DEFINITIONS ) +# +# Input: +# BOARD : flags depend on board/nuttx config + +# Input/Output: (appends to existing variable) +# C_FLAGS : c compile flags variable +# CXX_FLAGS : c++ compile flags variable +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories +# LINK_DIRS : link directories +# DEFINITIONS : definitions +# +# Example: +# px4_add_nuttx_flags( +# C_FLAGS CMAKE_C_FLAGS +# CXX_FLAGS CMAKE_CXX_FLAGS +# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS +# INCLUDES ) +# +#---------------------------------------------------------------------------- +function(px4_add_nuttx_flags) + + set(inout_vars + C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) + + px4_parse_function_args( + NAME px4_add_nuttx_flags + ONE_VALUE ${inout_vars} BOARD + REQUIRED ${inout_vars} BOARD + ARGN ${ARGN}) + + set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) + set(added_include_dirs + ${nuttx_export_dir}/include + ${nuttx_export_dir}/include/cxx + ${nuttx_export_dir}/arch/chip + ${nuttx_export_dir}/arch/common + ) + set(added_link_dirs + ${nuttx_export_dir}/libs + ) + set(added_definitions + -D__PX4_NUTTX + ) + set(added_c_flags + -nodefaultlibs + -nostdlib + ) + set(added_cxx_flags + -nodefaultlibs + -nostdlib + ) + + set(added_exe_linker_flags) # none currently + + if ("${BOARD}" STREQUAL "px4fmu-v2") + set(arm_build_flags + -mcpu=cortex-m4 + -mthumb + -march=armv7e-m + -mfpu=fpv4-sp-d16 + -mfloat-abi=hard + ) + list(APPEND c_flags ${arm_build_flags}) + list(APPEND cxx_flags ${arm_build_flags}) + endif() + + # output + foreach(var ${inout_vars}) + string(TOLOWER ${var} lower_var) + set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) + endforeach() + +endfunction() + +# vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/px4_utils.cmake b/cmake/px4_utils.cmake new file mode 100644 index 0000000000..3d3b5563e8 --- /dev/null +++ b/cmake/px4_utils.cmake @@ -0,0 +1,594 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include(CMakeParseArguments) + +#---------------------------------------------------------------------------- +# px4_parse_function_args +# +# This function simpliies usage of the cmake_parse_arguments module. +# It is inteded to be called by other functions. +# +# Usage: +# px4_parse_function_args( +# NAME +# [ OPTIONS ] +# [ ONE_VALUE ] +# [ MULTI_VALUE ] +# REQUIRED +# ARGN ) +# +# Input: +# NAME : the name of the calling function +# OPTIONS : boolean flags +# ONE_VALUE : single value variables +# MULTI_VALUE : multi value variables +# REQUIRED : required arguments +# ARGN : the function input arguments, typically ${ARGN} +# +# Output: +# The function arguments corresponding to the following are set: +# ${OPTIONS}, ${ONE_VALUE}, ${MULTI_VALUE} +# +# Example: +# function test() +# px4_parse_function_args( +# NAME TEST +# ONE_VALUE NAME +# MULTI_VALUE LIST +# REQUIRED NAME LIST +# ARGN ${ARGN}) +# message(STATUS "name: ${NAME}") +# message(STATUS "list: ${LIST}") +# endfunction() +# +# test(NAME "hello" LIST a b c) +# +# OUTPUT: +# name: hello +# list: a b c +# +#---------------------------------------------------------------------------- +function(px4_parse_function_args) + cmake_parse_arguments(IN "" "NAME" "OPTIONS;ONE_VALUE;MULTI_VALUE;REQUIRED;ARGN" "${ARGN}") + cmake_parse_arguments(OUT "${IN_OPTIONS}" "${IN_ONE_VALUE}" "${IN_MULTI_VALUE}" "${IN_ARGN}") + if (OUT_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "${IN_NAME}: unparsed ${OUT_UNPARSED_ARGUMENTS}") + endif() + foreach(arg ${IN_REQUIRED}) + if (NOT OUT_${arg}) + message(FATAL_ERROR "${IN_NAME} requires argument ${arg}, ARGN: ${IN_ARGN}") + endif() + endforeach() + foreach(arg ${IN_OPTIONS} ${IN_ONE_VALUE} ${IN_MULTI_VALUE}) + set(${arg} ${OUT_${arg}} PARENT_SCOPE) + endforeach() +endfunction() + +#---------------------------------------------------------------------------- +# add_git_submodule +# +# This function add a git submodule target. +# +# Usage: +# add_git_submodule(TARGET PATH ) +# +# Input: +# PATH : git submodule path +# +# Output: +# TARGET : git target +# +# Example: +# add_git_submodule(TARGET git_nuttx PATH "NuttX") +# +#---------------------------------------------------------------------------- +function(px4_add_git_submodule) + px4_parse_function_args( + NAME px4_add_git_submodule + ONE_VALUE TARGET PATH + REQUIRED TARGET PATH + ARGN ${ARGN}) + string(REPLACE "/" "_" NAME ${PATH}) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git_${NAME}.stamp + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND git submodule init ${PATH} + COMMAND git submodule update ${PATH} + COMMAND touch ${CMAKE_BINARY_DIR}/git_${NAME}.stamp + ) + add_custom_target(${TARGET} + DEPENDS git_${NAME}.stamp + ) +endfunction() + +#---------------------------------------------------------------------------- +# px4_prepend_string +# +# This function prepends a string to a list +# +# Usage: +# px4_prepend_string(OUT STR LIST ) +# +# Input: +# STR : string to prepend +# LIST : list to prepend to +# +# Output: +# ${OUT} : prepended list +# +# Example: +# px4_prepend_string(OUT test_str STR "path/to/" LIST src/file1.cpp src/file2.cpp) +# test_str would then be: +# path/to/src/file1.cpp +# path/to/src/file2.cpp +# +#---------------------------------------------------------------------------- +function(px4_prepend_string) + px4_parse_function_args( + NAME px4_prepend_string + ONE_VALUE OUT STR + MULTI_VALUE LIST + REQUIRED OUT STR LIST + ARGN ${ARGN}) + set(${OUT}) + foreach(file ${LIST}) + list(APPEND ${OUT} ${STR}${file}) + endforeach() + set(${OUT} ${${OUT}} PARENT_SCOPE) +endfunction() + +#---------------------------------------------------------------------------- +# px4_join +# +# This function joins a list with a given separator. If list is not +# passed, or is sent "", this will return the empty string. +# +# Usage: +# px4_join(OUT ${OUT} [ LIST ${LIST} ] GLUE ${GLUE}) +# +# Input: +# LIST : list to join +# GLUE : separator to use +# +# Output: +# OUT : joined list +# +# Example: +# px4_join(OUT test_join LIST a b c GLUE ";") +# test_join would then be: +# "a;b;c" +# +#---------------------------------------------------------------------------- +function(px4_join) + px4_parse_function_args( + NAME px4_join + ONE_VALUE OUT GLUE + MULTI_VALUE LIST + REQUIRED GLUE OUT + ARGN ${ARGN}) + string (REPLACE ";" "${GLUE}" _TMP_STR "${LIST}") + set(${OUT} ${_TMP_STR} PARENT_SCOPE) +endfunction() + +#---------------------------------------------------------------------------- +# px4_add_module +# +# This function builds a static library from a module description. +# +# Usage: +# px4_add_module(MODULE +# [ MAIN ] +# [ STACK ] +# [ COMPILE_FLAGS ] +# [ INCLUDES ] +# [ DEPENDS ] +# ) +# +# Input: +# MODULE : unique name of module +# MAIN : entry point, if not given, assumed to be library +# STACK : size of stack +# COMPILE_FLAGS : compile flags +# LINK_FLAGS : link flags +# SRCS : source files +# INCLUDES : include directories +# DEPENDS : targets which this module depends on +# +# Output: +# Static library with name matching MODULE. +# +# Example: +# px4_add_module(MODULE test +# SRCS +# file.cpp +# STACK 1024 +# DEPENDS +# git_nuttx +# ) +# +#---------------------------------------------------------------------------- +function(px4_add_module) + px4_parse_function_args( + NAME px4_add_module + ONE_VALUE MODULE MAIN STACK PRIORITY + MULTI_VALUE COMPILE_FLAGS LINK_FLAGS SRCS INCLUDES DEPENDS + REQUIRED MODULE + ARGN ${ARGN}) + add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${SRCS}) + if(INCLUDES) + target_include_directories(${MODULE} ${INCLUDES}) + endif() + if(DEPENDS) + add_dependencies(${MODULE} ${DEPENDS}) + endif() + foreach(prop LINK_FLAGS COMPILE_FLAGS) + if(${prop}) + px4_join(OUT ${prop} LIST ${${prop}} GLUE " ") + endif() + endforeach() + foreach (prop STACK MAIN COMPILE_FLAGS LINK_FLAGS PRIORITY) + if (${prop}) + set_target_properties(${MODULE} PROPERTIES "${prop}" "${${prop}}") + endif() + endforeach() + set_target_properties(${MODULE} PROPERTIES LINK_INTERFACE_MULTIPLICITY 4) +endfunction() + +#---------------------------------------------------------------------------- +# px4_generate_messages +# +# This function generates source code from ROS msg definitions. + +# Usage: +# px4_generate_messages(TARGET MSGS ) +# +# Input: +# MSG_FILES : the ROS msgs to generate files from +# OS : the operating system selected +# DEPENDS : dependencies +# +# Output: +# TARGET : the message generation target +# +# Example: +# px4_generate_messages(TARGET +# MSG_FILES OS +# [ DEPENDS ] +# ) +# +#---------------------------------------------------------------------------- +function(px4_generate_messages) + px4_parse_function_args( + NAME px4_generate_messages + OPTIONS VERBOSE + ONE_VALUE OS TARGET + MULTI_VALUE MSG_FILES DEPENDS + REQUIRED MSG_FILES OS TARGET + ARGN ${ARGN}) + set(QUIET) + if(NOT VERBOSE) + set(QUIET "-q") + endif() + set(PYTHONPATH "${CMAKE_SOURCE_DIR}/Tools/genmsg/src:${CMAKE_SOURCE_DIR}/Tools/gencpp/src:$ENV{PYTHONPATH}") + set(msg_out_path ${CMAKE_BINARY_DIR}/src/modules/uORB/topics) + set(msg_list) + foreach(msg_file ${MSG_FILES}) + get_filename_component(msg ${msg_file} NAME_WE) + list(APPEND msg_list ${msg}) + endforeach() + set(msg_files_out) + foreach(msg ${msg_list}) + list(APPEND msg_files_out ${msg_out_path}/${msg}.h) + endforeach() + add_custom_command(OUTPUT ${msg_files_out} + COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + Tools/px_generate_uorb_topic_headers.py + ${QUIET} + -d msg + -o ${msg_out_path} + -e msg/templates/uorb + -t ${CMAKE_BINARY_DIR}/topics_temporary + DEPENDS ${DEPENDS} ${MSG_FILES} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Generating uORB topic headers" + VERBATIM + ) + + # multi messages for target OS + set(msg_multi_out_path + ${CMAKE_BINARY_DIR}/src/platforms/${OS}/px4_messages) + set(msg_multi_files_out) + foreach(msg ${msg_list}) + list(APPEND msg_multi_files_out ${msg_multi_out_path}/px4_${msg}.h) + endforeach() + add_custom_command(OUTPUT ${msg_multi_files_out} + COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + Tools/px_generate_uorb_topic_headers.py + ${QUIET} + -d msg + -o ${msg_multi_out_path} + -e msg/templates/px4/uorb + -t ${CMAKE_BINARY_DIR}/multi_topics_temporary/${OS} + -p "px4_" + DEPENDS ${DEPENDS} ${MSG_FILES} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Generating uORB topic multi headers for ${OS}" + VERBATIM + ) + add_custom_target(${TARGET} + DEPENDS ${msg_multi_files_out} ${msg_files_out}) +endfunction() + +#---------------------------------------------------------------------------- +# px4_add_upload +# +# This function generates source code from ROS msg definitions. + +# Usage: +# px4_add_upload(OUT BUNDLE ) +# +# Input: +# BUNDLE : the firmware.px4 file +# OS : the operating system +# BOARD : the board +# +# Output: +# OUT : the firmware target +# +# Example: +# px4_add_upload(OUT upload +# BUNDLE main.px4 +# ) +# +#---------------------------------------------------------------------------- +function(px4_add_upload) + px4_parse_function_args( + NAME px4_generate_messages + ONE_VALUE OS BOARD OUT BUNDLE + REQUIRED OS BOARD OUT BUNDLE + ARGN ${ARGN}) + set(serial_ports) + if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") + list(APPEND serial_ports + /dev/serial/by-id/usb-3D_Robotics* + /dev/serial/by-id/pci-3D_Robotics* + ) + elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") + list(APPEND serial_ports + /dev/tty.usbmodemPX*,/dev/tty.usbmodem* + ) + elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") + foreach(port RANGE 32 0) + list(APPEND "COM${port}") + endforeach() + endif() + px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",") + add_custom_target(${OUT} + COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${BUNDLE} + DEPENDS ${BUNDLE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "uploading ${BUNDLE}" + VERBATIM + ) +endfunction() + +#---------------------------------------------------------------------------- +# px4_add_common_flags +# +# Set ths default build flags. +# +# Usage: +# px4_add_common_flags( +# C_FLAGS +# CXX_FLAGS +# EXE_LINKER_FLAGS +# INCLUDE_DIRS +# LINK_DIRS +# DEFINITIONS ) +# +# Input/Output: (appends to existing variable) +# C_FLAGS : c compile flags variable +# CXX_FLAGS : c++ compile flags variable +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories +# LINK_DIRS : link directories +# DEFINITIONS : definitions +# +# Example: +# px4_add_common_flags( +# C_FLAGS CMAKE_C_FLAGS +# CXX_FLAGS CMAKE_CXX_FLAGS +# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS +# INCLUDES ) +# +#---------------------------------------------------------------------------- +function(px4_add_common_flags) + + set(inout_vars + C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) + + px4_parse_function_args( + NAME px4_add_common_flags + ONE_VALUE ${inout_vars} + REQUIRED ${inout_vars} + ARGN ${ARGN}) + + set(warnings + -Wall + -Wno-sign-compare + -Wextra + #-Wshadow # very verbose due to eigen + -Wfloat-equal + -Wframe-larger-than=1024 + -Wpointer-arith + -Wmissing-declarations + -Wpacked + -Wno-unused-parameter + -Werror=format-security + -Werror=array-bounds + -Wfatal-errors + -Werror=unused-variable + -Werror=reorder + -Werror=uninitialized + -Werror=init-self + #-Wcast-qual - generates spurious noreturn attribute warnings, + # try again later + #-Wconversion - would be nice, but too many "risky-but-safe" + # conversions in the code + #-Wcast-align - would help catch bad casts in some cases, + # but generates too many false positives + ) + + if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + list(APPEND warnings + -Werror=unused-but-set-variable + -Wformat=1 + #-Wlogical-op # very verbose due to eigen + -Wdouble-promotion + -Werror=double-promotion + ) + endif() + + set(max_optimization -Os) + + set(optimization_flags + -fno-strict-aliasing + -fomit-frame-pointer + -funsafe-math-optimizations + -ffunction-sections + -fdata-sections + ) + if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + list(APPEND optimization_flags + -fno-strength-reduce + -fno-builtin-printf + ) + endif() + + set(c_warnings + -Wbad-function-cast + -Wstrict-prototypes + -Wmissing-prototypes + -Wnested-externs + ) + + if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + list(APPEND c_warnings + -Wold-style-declaration + -Wmissing-parameter-type + ) + endif() + + set(c_compile_flags + -std=gnu99 + -fno-common + ) + + set(cxx_warnings + -Wno-missing-field-initializers + ) + set(cxx_compile_flags + -fno-exceptions + -fno-rtti + -std=gnu++0x + -fno-threadsafe-statics + -DCONFIG_WCHAR_BUILTIN + -D__CUSTOM_FILE_IO__ + ) + + set(visibility_flags + -fvisibility=hidden + "-include ${CMAKE_SOURCE_DIR}/src/include/visibility.h" + ) + + set(added_c_flags + ${c_compile_flags} + ${warnings} + ${c_warnings} + ${max_optimization} + ${optimization_flags} + ${visibility_flags} + ) + + set(added_cxx_flags + ${cxx_compile_flags} + ${warnings} + ${cxx_warnings} + ${max_optimization} + ${optimization_flags} + ${visibility_flags} + ) + + set(added_include_dirs + src + ${CMAKE_BINARY_DIR}/src + src/modules + src/include + src/lib + src/platforms + # TODO Build/versioning was in Makefile, + # do we need this, how does it work with cmake + src/drivers/boards/${BOARD} + src/lib/eigen + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/src/modules/px4_messages + ${CMAKE_BINARY_DIR}/src/modules + mavlink/include/mavlink + ) + + set(added_link_dirs) # none used currently + + set(added_definitions + -DCONFIG_ARCH_BOARD_${BOARD_CONFIG} + ) + + set(added_exe_link_flags + -Wl,--warn-common + -Wl,--gc-sections + ) + + # output + foreach(var ${inout_vars}) + string(TOLOWER ${var} lower_var) + set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) + endforeach() + +endfunction() + + + + + + +# vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/qurt/px4_target_impl.cmake b/cmake/qurt/px4_target_impl.cmake new file mode 100644 index 0000000000..d9d5a65728 --- /dev/null +++ b/cmake/qurt/px4_target_impl.cmake @@ -0,0 +1,124 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +#============================================================================= +# FILE: posix/px4_target_impl.cmake +# +# Each PX4 target OS must implement the cmake/${OS}/px4_target_impl.cmake +# rules for their target that implement the following macros: +# +# px4_target_set_flags +# px4_target_validate_config +# px4_target_firmware +# px4_target_rules +# px4_target_testing +# +# The macros are called from the top level CMakeLists.txt +# +set(QURT_APPS_HEADER ${CMAKE_BINARY_DIR}/apps.h) + +add_git_submodule(dspal src/lib/dspal) +add_git_submodule(eigen src/lib/eigen-3.2) + +macro(px4_target_set_flags) + list(APPEND EXE_LINK_LIBS + pthread + ) + set(DSPAL_ROOT src/lib/dspal) + include_directories( + ${DSPAL_ROOT}/include + ${DSPAL_ROOT}/sys + ${DSPAL_ROOT}/sys/sys + ${DSPAL_ROOT}/mpu_spi/inc + ${DSPAL_ROOT}/uart_esc/inc + src/platforms/qurt/include + src/platforms/posix/include + src/lib/eigen-3.2 + ) + add_definitions( + -D__PX4_QURT + -D__PX4_POSIX + -include ${PX4_INCLUDE_DIR}visibility.h + ) + + # Add the toolchain specific flags + set(CMAKE_C_FLAGS ${QURT_CMAKE_C_FLAGS}) + set(CMAKE_CXX_FLAGS ${QURT_CMAKE_CXX_FLAGS}) + set(CMAKE_SHARED_LINKER_FLAGS "") + + message(STATUS "CMAKE_C_FLAGS: -${CMAKE_C_FLAGS}-") + message(STATUS "CMAKE_CXX_FLAGS: -${CMAKE_CXX_FLAGS}-") + + # Clear -rdynamic flag which fails for hexagon + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") + set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") + +endmacro() + +macro(px4_target_set_modules) + list(APPEND module_directories + ./src/platforms/qurt/px4_layer + ./src/platforms/posix/work_queue + ) +endmacro() + +macro(px4_target_validate_config) + if (${TARGET_NAME} STREQUAL "qurt-hil-simple") + else() + message(FATAL_ERROR "not implemented yet: ${TARGET_NAME}") + endif() +endmacro() + +macro(px4_target_firmware) + set(installed_targets) + add_library(dspal_main SHARED ./src/platforms/qurt/px4_layer/main.cpp) + target_link_libraries(dspal_main ${module_list}) + list(APPEND installed_targets dspal_main) +endmacro() + +macro(px4_target_rules) + #============================================================================= + # apps + # + add_custom_command(OUTPUT ${QURT_APPS_HEADER} + COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/Tools/qurt_apps.py > ${QURT_APPS_HEADER} + COMMENT "Generating qurt apps" + VERBATIM + ) + + add_custom_target(qurt_apps DEPENDS ${QURT_APPS_HEADER}) +endmacro() + +macro(px4_target_testing) +endmacro() diff --git a/cmake/test/px4_simple_app_correct.txt b/cmake/test/px4_simple_app_correct.txt new file mode 100644 index 0000000000..317d4f5982 --- /dev/null +++ b/cmake/test/px4_simple_app_correct.txt @@ -0,0 +1,27 @@ +INFO Shell id is 47996278451456 +WARN 1 starting task wkr_high (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146) +WARN 54 starting task wkr_low (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146) +WARN 100 starting task wkr_hrt (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146) +App name: mainapp +Enter a command and its args: +---------------------------------- +Running: uorb +Returning: uorb +Enter a command and its args: +---------------------------------- +Running: accelsim +Returning: accelsim +Enter a command and its args: +---------------------------------- +Running: px4_simple_app +Hello Sky! +[px4_simple_app] Got no data within a second +[px4_simple_app] Got no data within a second +[px4_simple_app] Got no data within a second +[px4_simple_app] Got no data within a second +[px4_simple_app] Got no data within a second +Returning: px4_simple_app +Enter a command and its args: +---------------------------------- +Running: shutdown +Shutting down diff --git a/cmake/test/px4_simple_app_input.txt b/cmake/test/px4_simple_app_input.txt new file mode 100644 index 0000000000..29360b9624 --- /dev/null +++ b/cmake/test/px4_simple_app_input.txt @@ -0,0 +1,4 @@ +uorb start +accelsim start +px4_simple_app +shutdown diff --git a/cmake/test_compare.py b/cmake/test_compare.py new file mode 100755 index 0000000000..fb2b4745a4 --- /dev/null +++ b/cmake/test_compare.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +""" +This runs a command and compares output to a known file over +a given line range. +""" +from __future__ import print_function +import subprocess +import argparse +import os + + +#pylint: disable=invalid-name +parser = argparse.ArgumentParser(description='Process some integers.') +parser.add_argument('--command', required=True) +parser.add_argument('--stdin', required=True) +parser.add_argument('--stdout', required=True) +parser.add_argument('--check', required=True) +parser.add_argument('--start', default=0) +parser.add_argument('--stop', default=-1) +args = parser.parse_args() + +d = os.path.dirname(args.stdout) +if not os.path.exists(d): + os.makedirs(d) + +with open(args.stdout, 'w') as outfile: + with open(args.stdin, 'r') as infile: + proc = subprocess.Popen( + args.command, stdout=outfile, stdin=infile) +proc.communicate() + +i_start = int(args.start) +i_stop = int(args.stop) + +with open(args.stdout, 'r') as outfile: + out_contents = file.readlines(outfile) +out_contents = "".join(out_contents[i_start:i_stop]) + +with open(args.check, 'r') as checkfile: + check_contents = file.readlines(checkfile) +check_contents = "".join(check_contents[i_start:i_stop]) + +if (out_contents != check_contents): + print("output:\n", out_contents) + print("check:\n", check_contents) + exit(1) + +exit(0) + +# vim: set et ft=python fenc= ff=unix sts=4 sw=4 ts=4 : diff --git a/makefiles/CMakeLists.txt b/makefiles/CMakeLists.txt new file mode 100644 index 0000000000..db2304917e --- /dev/null +++ b/makefiles/CMakeLists.txt @@ -0,0 +1,38 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000000..d2a80d939f --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,71 @@ +#============================================================================= +# module subdirectories, need to include first +# +add_subdirectory(./lib) +add_subdirectory(./drivers) +add_subdirectory(./platforms) +add_subdirectory(./systemcmds) +add_subdirectory(./examples) +add_subdirectory(./modules) + +#============================================================================= +# executable +# + +# a list of modules that will be linked to main +set(module_list) + +if (${LABEL} STREQUAL "simple") + list(APPEND module_list + drivers__led + drivers__device + platforms__common + modules__systemlib + modules__uORB + examples__px4_simple_app + lib__mathlib__math__filter + lib__conversion + ) +endif() + +if (${OS} STREQUAL "nuttx") + + if (${LABEL} STREQUAL "simple") + list(APPEND module_list ${module_list_simple}) + endif() + + list(APPEND module_list + platforms__nuttx + platforms__nuttx__px4_layer + drivers__boards__px4fmu-v2 + drivers__stm32 + ) + + px4_nuttx_generate_builtin_commands( + OUT builtin_commands.c + MODULE_LIST ${module_list}) + + # add executable + add_executable(main builtin_commands.c) + 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(main PROPERTIES LINK_FLAGS ${main_link_flags}) + + target_link_libraries(main + -Wl,--start-group + ${module_list} + apps nuttx nosys m gcc + -Wl,--end-group) + + px4_nuttx_add_firmware(OUT fw_main.px4 EXE main) + px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE fw_main.px4) + + px4_nuttx_generate_romfs(OUT romfs.img ROOT ROMFS/px4fmu_common) + +endif() + +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/CMakeLists.txt b/src/drivers/CMakeLists.txt new file mode 100644 index 0000000000..7a504e9326 --- /dev/null +++ b/src/drivers/CMakeLists.txt @@ -0,0 +1,54 @@ +set(directories + ./roboclaw + ./device + ./px4io + ./boards/px4fmu-v2 + ./boards/px4-stm32f4discovery + ./boards/px4io-v2 + ./boards/px4io-v1 + ./boards/px4fmu-v1 + ./boards/aerocore + ./mpu6000 + ./gimbal + ./camera_trigger + ./pwm_input + ./pwm_out_sim + ./pca9685 + ./mkblctrl + ./sf0x + ./hott/hott_telemetry + ./hott/hott_sensors + ./hott + ./ms5611 + ./led + ./irlock + ./bma180 + ./l3gd20 + ./blinkm + ./md25 + ./lsm303d + ./pca8574 + ./mb12xx + ./trone + ./airspeed + ./rgbled + ./frsky_telemetry + ./meas_airspeed + ./px4flow + ./mpu9250 + ./gps + ./ets_airspeed + ./ll40ls + ./ardrone_interface + ./hmc5883 + ./px4fmu + ./stm32/tone_alarm + ./stm32/adc + ./stm32 + ./oreoled + ./batt_smbus + ) + +foreach(directory ${directories}) + add_subdirectory(${directory} EXCLUDE_FROM_ALL) +endforeach() diff --git a/src/drivers/airspeed/CMakeLists.txt b/src/drivers/airspeed/CMakeLists.txt new file mode 100644 index 0000000000..81a8f61113 --- /dev/null +++ b/src/drivers/airspeed/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__airspeed + COMPILE_FLAGS + -Os + SRCS + airspeed.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/ardrone_interface/CMakeLists.txt b/src/drivers/ardrone_interface/CMakeLists.txt new file mode 100644 index 0000000000..70f50865ae --- /dev/null +++ b/src/drivers/ardrone_interface/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__ardrone_interface + MAIN ardrone_interface + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + ardrone_interface.c + ardrone_motor_control.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/batt_smbus/CMakeLists.txt b/src/drivers/batt_smbus/CMakeLists.txt new file mode 100644 index 0000000000..d1ee69d45d --- /dev/null +++ b/src/drivers/batt_smbus/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__batt_smbus + MAIN batt_smbus + COMPILE_FLAGS + -Os + SRCS + batt_smbus.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/blinkm/CMakeLists.txt b/src/drivers/blinkm/CMakeLists.txt new file mode 100644 index 0000000000..599913acaf --- /dev/null +++ b/src/drivers/blinkm/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__blinkm + MAIN blinkm + COMPILE_FLAGS + -Os + SRCS + blinkm.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/bma180/CMakeLists.txt b/src/drivers/bma180/CMakeLists.txt new file mode 100644 index 0000000000..7df83173fd --- /dev/null +++ b/src/drivers/bma180/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__bma180 + MAIN bma180 + COMPILE_FLAGS + -Os + SRCS + bma180.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/boards/aerocore/CMakeLists.txt b/src/drivers/boards/aerocore/CMakeLists.txt new file mode 100644 index 0000000000..f1fb63a255 --- /dev/null +++ b/src/drivers/boards/aerocore/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__boards__aerocore + COMPILE_FLAGS + -Os + SRCS + aerocore_init.c + aerocore_pwm_servo.c + aerocore_spi.c + aerocore_led.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/boards/px4-stm32f4discovery/CMakeLists.txt b/src/drivers/boards/px4-stm32f4discovery/CMakeLists.txt new file mode 100644 index 0000000000..e4af694e5d --- /dev/null +++ b/src/drivers/boards/px4-stm32f4discovery/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__boards__px4-stm32f4discovery + SRCS + px4discovery_init.c + px4discovery_usb.c + px4discovery_led.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/boards/px4fmu-v1/CMakeLists.txt b/src/drivers/boards/px4fmu-v1/CMakeLists.txt new file mode 100644 index 0000000000..8807ed6730 --- /dev/null +++ b/src/drivers/boards/px4fmu-v1/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__boards__px4fmu-v1 + COMPILE_FLAGS + -Os + SRCS + px4fmu_can.c + px4fmu_init.c + px4fmu_pwm_servo.c + px4fmu_spi.c + px4fmu_usb.c + px4fmu_led.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/boards/px4fmu-v2/CMakeLists.txt b/src/drivers/boards/px4fmu-v2/CMakeLists.txt new file mode 100644 index 0000000000..27cb595c34 --- /dev/null +++ b/src/drivers/boards/px4fmu-v2/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__boards__px4fmu-v2 + COMPILE_FLAGS + -Os + SRCS + px4fmu_can.c + px4fmu2_init.c + px4fmu_pwm_servo.c + px4fmu_spi.c + px4fmu_usb.c + px4fmu2_led.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/boards/px4io-v1/CMakeLists.txt b/src/drivers/boards/px4io-v1/CMakeLists.txt new file mode 100644 index 0000000000..0806a1e049 --- /dev/null +++ b/src/drivers/boards/px4io-v1/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__boards__px4io-v1 + COMPILE_FLAGS + -Os + SRCS + px4io_init.c + px4io_pwm_servo.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/boards/px4io-v2/CMakeLists.txt b/src/drivers/boards/px4io-v2/CMakeLists.txt new file mode 100644 index 0000000000..8969b90a29 --- /dev/null +++ b/src/drivers/boards/px4io-v2/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__boards__px4io-v2 + COMPILE_FLAGS + -Os + SRCS + px4iov2_init.c + px4iov2_pwm_servo.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/boards/sitl/CMakeLists.txt b/src/drivers/boards/sitl/CMakeLists.txt new file mode 100644 index 0000000000..8d7d7bee34 --- /dev/null +++ b/src/drivers/boards/sitl/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__boards__sitl + COMPILE_FLAGS + -Os + SRCS + sitl_led.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/camera_trigger/CMakeLists.txt b/src/drivers/camera_trigger/CMakeLists.txt new file mode 100644 index 0000000000..4f3669876e --- /dev/null +++ b/src/drivers/camera_trigger/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__camera_trigger + MAIN camera_trigger + COMPILE_FLAGS + -Os + SRCS + camera_trigger.cpp + camera_trigger_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/device/CMakeLists.txt b/src/drivers/device/CMakeLists.txt new file mode 100644 index 0000000000..7a68999949 --- /dev/null +++ b/src/drivers/device/CMakeLists.txt @@ -0,0 +1,63 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +set(SRCS) + +if(${OS} STREQUAL "nuttx") + list(APPEND SRCS + device_nuttx.cpp + cdev.cpp + i2c_nuttx.cpp + pio.cpp + spi.cpp + ringbuffer.cpp + ) +else() + list(APPEND SRCS + device_posix.cpp + vdev.cpp + vfile.cpp + vdev_posix.cpp + i2c_posix.cpp + sim.cpp + ringbuffer.cpp + ) +endif() + +px4_add_module( + MODULE drivers__device + SRCS ${SRCS} + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/ets_airspeed/CMakeLists.txt b/src/drivers/ets_airspeed/CMakeLists.txt new file mode 100644 index 0000000000..f989419311 --- /dev/null +++ b/src/drivers/ets_airspeed/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__ets_airspeed + MAIN ets_airspeed + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + ets_airspeed.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/frsky_telemetry/CMakeLists.txt b/src/drivers/frsky_telemetry/CMakeLists.txt new file mode 100644 index 0000000000..7d6c17f463 --- /dev/null +++ b/src/drivers/frsky_telemetry/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__frsky_telemetry + MAIN frsky_telemetry + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + frsky_data.c + frsky_telemetry.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/gimbal/CMakeLists.txt b/src/drivers/gimbal/CMakeLists.txt new file mode 100644 index 0000000000..ac26a1876e --- /dev/null +++ b/src/drivers/gimbal/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__gimbal + MAIN gimbal + COMPILE_FLAGS + -Os + SRCS + gimbal.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/gps/CMakeLists.txt b/src/drivers/gps/CMakeLists.txt new file mode 100644 index 0000000000..2441ba9ff7 --- /dev/null +++ b/src/drivers/gps/CMakeLists.txt @@ -0,0 +1,48 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__gps + MAIN gps + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + gps.cpp + gps_helper.cpp + mtk.cpp + ashtech.cpp + ubx.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/hmc5883/CMakeLists.txt b/src/drivers/hmc5883/CMakeLists.txt new file mode 100644 index 0000000000..6f2f98a822 --- /dev/null +++ b/src/drivers/hmc5883/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__hmc5883 + MAIN hmc5883 + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + hmc5883_i2c.cpp + hmc5883_spi.cpp + hmc5883.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/hott/CMakeLists.txt b/src/drivers/hott/CMakeLists.txt new file mode 100644 index 0000000000..827c720317 --- /dev/null +++ b/src/drivers/hott/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__hott + COMPILE_FLAGS + -Os + SRCS + messages.cpp + comms.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/hott/hott_sensors/CMakeLists.txt b/src/drivers/hott/hott_sensors/CMakeLists.txt new file mode 100644 index 0000000000..6d9b9b6c47 --- /dev/null +++ b/src/drivers/hott/hott_sensors/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__hott__hott_sensors + MAIN hott_sensors + COMPILE_FLAGS + -Os + SRCS + hott_sensors.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/hott/hott_telemetry/CMakeLists.txt b/src/drivers/hott/hott_telemetry/CMakeLists.txt new file mode 100644 index 0000000000..b86ef91cb3 --- /dev/null +++ b/src/drivers/hott/hott_telemetry/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__hott__hott_telemetry + MAIN hott_telemetry + COMPILE_FLAGS + -Os + SRCS + hott_telemetry.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/irlock/CMakeLists.txt b/src/drivers/irlock/CMakeLists.txt new file mode 100644 index 0000000000..d821afb3b6 --- /dev/null +++ b/src/drivers/irlock/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__irlock + MAIN irlock + COMPILE_FLAGS + -Os + SRCS + irlock.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/l3gd20/CMakeLists.txt b/src/drivers/l3gd20/CMakeLists.txt new file mode 100644 index 0000000000..4534295694 --- /dev/null +++ b/src/drivers/l3gd20/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__l3gd20 + MAIN l3gd20 + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + l3gd20.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/led/CMakeLists.txt b/src/drivers/led/CMakeLists.txt new file mode 100644 index 0000000000..2279751d8c --- /dev/null +++ b/src/drivers/led/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__led + COMPILE_FLAGS + -Os + SRCS + led.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/ll40ls/CMakeLists.txt b/src/drivers/ll40ls/CMakeLists.txt new file mode 100644 index 0000000000..e8f6a9af96 --- /dev/null +++ b/src/drivers/ll40ls/CMakeLists.txt @@ -0,0 +1,46 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__ll40ls + MAIN ll40ls + COMPILE_FLAGS + -Os + SRCS + ll40ls.cpp + LidarLite.cpp + LidarLiteI2C.cpp + LidarLitePWM.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/lsm303d/CMakeLists.txt b/src/drivers/lsm303d/CMakeLists.txt new file mode 100644 index 0000000000..c781592137 --- /dev/null +++ b/src/drivers/lsm303d/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__lsm303d + MAIN lsm303d + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + lsm303d.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/mb12xx/CMakeLists.txt b/src/drivers/mb12xx/CMakeLists.txt new file mode 100644 index 0000000000..3517cf4eb0 --- /dev/null +++ b/src/drivers/mb12xx/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__mb12xx + MAIN mb12xx + COMPILE_FLAGS + -Os + SRCS + mb12xx.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/md25/CMakeLists.txt b/src/drivers/md25/CMakeLists.txt new file mode 100644 index 0000000000..d57ff5b4f5 --- /dev/null +++ b/src/drivers/md25/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__md25 + MAIN md25 + COMPILE_FLAGS + -Os + SRCS + md25.cpp + md25_main.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/meas_airspeed/CMakeLists.txt b/src/drivers/meas_airspeed/CMakeLists.txt new file mode 100644 index 0000000000..16e0f97b59 --- /dev/null +++ b/src/drivers/meas_airspeed/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__meas_airspeed + MAIN meas_airspeed + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + meas_airspeed.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/mkblctrl/CMakeLists.txt b/src/drivers/mkblctrl/CMakeLists.txt new file mode 100644 index 0000000000..1a711bdfa0 --- /dev/null +++ b/src/drivers/mkblctrl/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__mkblctrl + MAIN mkblctrl + COMPILE_FLAGS + -Os + SRCS + mkblctrl.cpp + mkblctrl_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/mpu6000/CMakeLists.txt b/src/drivers/mpu6000/CMakeLists.txt new file mode 100644 index 0000000000..1a1e7a639e --- /dev/null +++ b/src/drivers/mpu6000/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__mpu6000 + MAIN mpu6000 + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + mpu6000.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/mpu9250/CMakeLists.txt b/src/drivers/mpu9250/CMakeLists.txt new file mode 100644 index 0000000000..0c1b6e6fb8 --- /dev/null +++ b/src/drivers/mpu9250/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__mpu9250 + MAIN mpu9250 + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + mpu9250.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/ms5611/CMakeLists.txt b/src/drivers/ms5611/CMakeLists.txt new file mode 100644 index 0000000000..8afca6ade0 --- /dev/null +++ b/src/drivers/ms5611/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__ms5611 + MAIN ms5611 + COMPILE_FLAGS + -Os + SRCS + ms5611_nuttx.cpp + ms5611_spi.cpp + ms5611_i2c.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/oreoled/CMakeLists.txt b/src/drivers/oreoled/CMakeLists.txt new file mode 100644 index 0000000000..f0407c71f6 --- /dev/null +++ b/src/drivers/oreoled/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__oreoled + MAIN oreoled + COMPILE_FLAGS + -Os + SRCS + oreoled.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/pca8574/CMakeLists.txt b/src/drivers/pca8574/CMakeLists.txt new file mode 100644 index 0000000000..4b00076be4 --- /dev/null +++ b/src/drivers/pca8574/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__pca8574 + MAIN pca8574 + COMPILE_FLAGS + -Os + SRCS + pca8574.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/pca9685/CMakeLists.txt b/src/drivers/pca9685/CMakeLists.txt new file mode 100644 index 0000000000..e5053ab8f6 --- /dev/null +++ b/src/drivers/pca9685/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__pca9685 + MAIN pca9685 + SRCS + pca9685.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/pwm_input/CMakeLists.txt b/src/drivers/pwm_input/CMakeLists.txt new file mode 100644 index 0000000000..81c79fd842 --- /dev/null +++ b/src/drivers/pwm_input/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__pwm_input + MAIN pwm_input + COMPILE_FLAGS + -Wno-pmf-conversions + + SRCS + pwm_input.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/pwm_out_sim/CMakeLists.txt b/src/drivers/pwm_out_sim/CMakeLists.txt new file mode 100644 index 0000000000..0febaa0bea --- /dev/null +++ b/src/drivers/pwm_out_sim/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__pwm_out_sim + MAIN pwm_out_sim + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + pwm_out_sim.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/px4flow/CMakeLists.txt b/src/drivers/px4flow/CMakeLists.txt new file mode 100644 index 0000000000..21bfa4526e --- /dev/null +++ b/src/drivers/px4flow/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__px4flow + MAIN px4flow + STACK 1200 + COMPILE_FLAGS + -Wno-attributes + -Os + SRCS + px4flow.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/px4fmu/CMakeLists.txt b/src/drivers/px4fmu/CMakeLists.txt new file mode 100644 index 0000000000..335da06c1e --- /dev/null +++ b/src/drivers/px4fmu/CMakeLists.txt @@ -0,0 +1,46 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__px4fmu + MAIN fmu + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + fmu.cpp + px4fmu_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/px4io/CMakeLists.txt b/src/drivers/px4io/CMakeLists.txt new file mode 100644 index 0000000000..818d2c33d6 --- /dev/null +++ b/src/drivers/px4io/CMakeLists.txt @@ -0,0 +1,49 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__px4io + MAIN px4io + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + px4io.cpp + px4io_uploader.cpp + px4io_serial.cpp + px4io_i2c.cpp + px4io_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/rgbled/CMakeLists.txt b/src/drivers/rgbled/CMakeLists.txt new file mode 100644 index 0000000000..d833567467 --- /dev/null +++ b/src/drivers/rgbled/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__rgbled + MAIN rgbled + COMPILE_FLAGS + -Os + SRCS + rgbled.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/roboclaw/CMakeLists.txt b/src/drivers/roboclaw/CMakeLists.txt new file mode 100644 index 0000000000..c2eac724e6 --- /dev/null +++ b/src/drivers/roboclaw/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__roboclaw + MAIN roboclaw + COMPILE_FLAGS + -Os + SRCS + roboclaw_main.cpp + RoboClaw.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/sf0x/CMakeLists.txt b/src/drivers/sf0x/CMakeLists.txt new file mode 100644 index 0000000000..a90d1da824 --- /dev/null +++ b/src/drivers/sf0x/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__sf0x + MAIN sf0x + COMPILE_FLAGS + -Os + SRCS + sf0x.cpp + sf0x_parser.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/stm32/CMakeLists.txt b/src/drivers/stm32/CMakeLists.txt new file mode 100644 index 0000000000..e81bf50277 --- /dev/null +++ b/src/drivers/stm32/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__stm32 + COMPILE_FLAGS + -Os + SRCS + drv_hrt.c + drv_pwm_servo.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/stm32/adc/CMakeLists.txt b/src/drivers/stm32/adc/CMakeLists.txt new file mode 100644 index 0000000000..72205cdac7 --- /dev/null +++ b/src/drivers/stm32/adc/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__stm32__adc + MAIN adc + COMPILE_FLAGS + -Os + SRCS + adc.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/stm32/tone_alarm/CMakeLists.txt b/src/drivers/stm32/tone_alarm/CMakeLists.txt new file mode 100644 index 0000000000..d01a1ff59b --- /dev/null +++ b/src/drivers/stm32/tone_alarm/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__stm32__tone_alarm + MAIN tone_alarm + COMPILE_FLAGS + -Os + SRCS + tone_alarm.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/trone/CMakeLists.txt b/src/drivers/trone/CMakeLists.txt new file mode 100644 index 0000000000..e0166dd333 --- /dev/null +++ b/src/drivers/trone/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE drivers__trone + MAIN trone + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + trone.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt new file mode 100644 index 0000000000..e16d5e0179 --- /dev/null +++ b/src/examples/CMakeLists.txt @@ -0,0 +1,16 @@ +set(directories + ./px4_simple_app + ./fixedwing_control + ./rover_steering_control + ./px4_mavlink_debug + ./px4_daemon_app + ./flow_position_estimator + ./matlab_csv_serial + ./subscriber + ./hwtest + ./publisher + ) + +foreach(directory ${directories}) + add_subdirectory(${directory} EXCLUDE_FROM_ALL) +endforeach() diff --git a/src/examples/fixedwing_control/CMakeLists.txt b/src/examples/fixedwing_control/CMakeLists.txt new file mode 100644 index 0000000000..e1032db305 --- /dev/null +++ b/src/examples/fixedwing_control/CMakeLists.txt @@ -0,0 +1,46 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__fixedwing_control + MAIN ex_fixedwing_control + STACK 1200 + COMPILE_FLAGS + -Wframe-larger-than=1300 + + SRCS + main.c + params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/flow_position_estimator/CMakeLists.txt b/src/examples/flow_position_estimator/CMakeLists.txt new file mode 100644 index 0000000000..432aed1df9 --- /dev/null +++ b/src/examples/flow_position_estimator/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__flow_position_estimator + MAIN flow_position_estimator + COMPILE_FLAGS + -Wno-float-equal + + SRCS + flow_position_estimator_main.c + flow_position_estimator_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/hwtest/CMakeLists.txt b/src/examples/hwtest/CMakeLists.txt new file mode 100644 index 0000000000..31548df813 --- /dev/null +++ b/src/examples/hwtest/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__hwtest + MAIN ex_hwtest + SRCS + hwtest.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/matlab_csv_serial/CMakeLists.txt b/src/examples/matlab_csv_serial/CMakeLists.txt new file mode 100644 index 0000000000..516acda092 --- /dev/null +++ b/src/examples/matlab_csv_serial/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__matlab_csv_serial + MAIN matlab_csv_serial + SRCS + matlab_csv_serial.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/publisher/CMakeLists.txt b/src/examples/publisher/CMakeLists.txt new file mode 100644 index 0000000000..d48aebf6c1 --- /dev/null +++ b/src/examples/publisher/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__publisher + MAIN publisher + STACK 1200 + SRCS + publisher_main.cpp + publisher_start_nuttx.cpp + publisher_example.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/px4_daemon_app/CMakeLists.txt b/src/examples/px4_daemon_app/CMakeLists.txt new file mode 100644 index 0000000000..2d455353d9 --- /dev/null +++ b/src/examples/px4_daemon_app/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__px4_daemon_app + MAIN px4_daemon_app + STACK 1200 + SRCS + px4_daemon_app.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/px4_mavlink_debug/CMakeLists.txt b/src/examples/px4_mavlink_debug/CMakeLists.txt new file mode 100644 index 0000000000..2f1b5a6a2f --- /dev/null +++ b/src/examples/px4_mavlink_debug/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__px4_mavlink_debug + MAIN px4_mavlink_debug + STACK 2000 + SRCS + px4_mavlink_debug.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/px4_simple_app/CMakeLists.txt b/src/examples/px4_simple_app/CMakeLists.txt new file mode 100644 index 0000000000..5ba6781c60 --- /dev/null +++ b/src/examples/px4_simple_app/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__px4_simple_app + MAIN px4_simple_app + SRCS + px4_simple_app.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/rover_steering_control/CMakeLists.txt b/src/examples/rover_steering_control/CMakeLists.txt new file mode 100644 index 0000000000..0ba4b03f52 --- /dev/null +++ b/src/examples/rover_steering_control/CMakeLists.txt @@ -0,0 +1,46 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__rover_steering_control + MAIN rover_steering_control + STACK 1200 + COMPILE_FLAGS + -Wframe-larger-than=1300 + + SRCS + main.cpp + params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/subscriber/CMakeLists.txt b/src/examples/subscriber/CMakeLists.txt new file mode 100644 index 0000000000..817d309d20 --- /dev/null +++ b/src/examples/subscriber/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE examples__subscriber + MAIN subscriber + STACK 2400 + SRCS + subscriber_main.cpp + subscriber_start_nuttx.cpp + subscriber_example.cpp + subscriber_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt new file mode 100644 index 0000000000..eaf068d917 --- /dev/null +++ b/src/lib/CMakeLists.txt @@ -0,0 +1,15 @@ +set(directories + ./external_lgpl + ./geo + ./launchdetection + ./mathlib/math/filter + ./mathlib + ./rc + ./geo_lookup + ./ecl + ./conversion + ) + +foreach(directory ${directories}) + add_subdirectory(${directory} EXCLUDE_FROM_ALL) +endforeach() diff --git a/src/lib/conversion/CMakeLists.txt b/src/lib/conversion/CMakeLists.txt new file mode 100644 index 0000000000..78f39e99aa --- /dev/null +++ b/src/lib/conversion/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__conversion + COMPILE_FLAGS + -Os + SRCS + rotation.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/ecl/CMakeLists.txt b/src/lib/ecl/CMakeLists.txt new file mode 100644 index 0000000000..0830521ec0 --- /dev/null +++ b/src/lib/ecl/CMakeLists.txt @@ -0,0 +1,46 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__ecl + COMPILE_FLAGS + -Os + SRCS + attitude_fw/ecl_controller.cpp + attitude_fw/ecl_pitch_controller.cpp + attitude_fw/ecl_roll_controller.cpp + attitude_fw/ecl_yaw_controller.cpp + l1/ecl_l1_pos_controller.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/external_lgpl/CMakeLists.txt b/src/lib/external_lgpl/CMakeLists.txt new file mode 100644 index 0000000000..b46af5006d --- /dev/null +++ b/src/lib/external_lgpl/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__external_lgpl + COMPILE_FLAGS + -Os + SRCS + tecs/tecs.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/geo/CMakeLists.txt b/src/lib/geo/CMakeLists.txt new file mode 100644 index 0000000000..14b80ef2a5 --- /dev/null +++ b/src/lib/geo/CMakeLists.txt @@ -0,0 +1,40 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__geo + SRCS + geo.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/geo_lookup/CMakeLists.txt b/src/lib/geo_lookup/CMakeLists.txt new file mode 100644 index 0000000000..ea13af025d --- /dev/null +++ b/src/lib/geo_lookup/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__geo_lookup + COMPILE_FLAGS + -Os + SRCS + geo_mag_declination.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/launchdetection/CMakeLists.txt b/src/lib/launchdetection/CMakeLists.txt new file mode 100644 index 0000000000..7ea0c18788 --- /dev/null +++ b/src/lib/launchdetection/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__launchdetection + COMPILE_FLAGS + -Os + SRCS + LaunchDetector.cpp + CatapultLaunchMethod.cpp + launchdetection_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/mathlib/CMakeLists.txt b/src/lib/mathlib/CMakeLists.txt new file mode 100644 index 0000000000..6bfe964d79 --- /dev/null +++ b/src/lib/mathlib/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__mathlib + SRCS + math/test/test.cpp + math/Limits.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/mathlib/math/filter/CMakeLists.txt b/src/lib/mathlib/math/filter/CMakeLists.txt new file mode 100644 index 0000000000..785b2f2c6c --- /dev/null +++ b/src/lib/mathlib/math/filter/CMakeLists.txt @@ -0,0 +1,40 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__mathlib__math__filter + SRCS + LowPassFilter2p.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/rc/CMakeLists.txt b/src/lib/rc/CMakeLists.txt new file mode 100644 index 0000000000..686f398e27 --- /dev/null +++ b/src/lib/rc/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE lib__rc + COMPILE_FLAGS + -Os + SRCS + st24.c + sumd.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt new file mode 100644 index 0000000000..3f68d4a05d --- /dev/null +++ b/src/modules/CMakeLists.txt @@ -0,0 +1,40 @@ +set(directories + ./navigator + ./segway + ./fw_pos_control_l1 + ./uavcan + ./position_estimator_inav + ./px4iofirmware + ./gpio_led + ./dataman + ./fixedwing_backside + ./uORB + ./land_detector + ./muorb/krait + ./muorb/adsp + ./simulator + ./ekf_att_pos_estimator + ./mc_pos_control + ./attitude_estimator_ekf + ./sensors + ./vtol_att_control + ./fw_att_control + ./unit_test + ./mc_att_control_multiplatform + ./commander/commander_tests + ./commander + ./mavlink/mavlink_tests + ./mavlink + ./mc_att_control + ./bottle_drop + ./systemlib/mixer + ./systemlib + ./mc_pos_control_multiplatform + ./sdlog2 + ./controllib + ./attitude_estimator_q + ) + +foreach(directory ${directories}) + add_subdirectory(${directory} EXCLUDE_FROM_ALL) +endforeach() diff --git a/src/modules/attitude_estimator_ekf/CMakeLists.txt b/src/modules/attitude_estimator_ekf/CMakeLists.txt new file mode 100644 index 0000000000..9a6ef24a4b --- /dev/null +++ b/src/modules/attitude_estimator_ekf/CMakeLists.txt @@ -0,0 +1,48 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__attitude_estimator_ekf + MAIN attitude_estimator_ekf + STACK 1200 + COMPILE_FLAGS + -Wframe-larger-than=2400 + -Wno-float-equal + + SRCS + attitude_estimator_ekf_main.cpp + attitude_estimator_ekf_params.c + codegen/AttitudeEKF.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/attitude_estimator_q/CMakeLists.txt b/src/modules/attitude_estimator_q/CMakeLists.txt new file mode 100644 index 0000000000..fd47087728 --- /dev/null +++ b/src/modules/attitude_estimator_q/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__attitude_estimator_q + MAIN attitude_estimator_q + STACK 1200 + SRCS + attitude_estimator_q_main.cpp + attitude_estimator_q_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/bottle_drop/CMakeLists.txt b/src/modules/bottle_drop/CMakeLists.txt new file mode 100644 index 0000000000..0b03efe6e4 --- /dev/null +++ b/src/modules/bottle_drop/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__bottle_drop + MAIN bottle_drop + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + bottle_drop.cpp + bottle_drop_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/commander/CMakeLists.txt b/src/modules/commander/CMakeLists.txt new file mode 100644 index 0000000000..a831aa9bce --- /dev/null +++ b/src/modules/commander/CMakeLists.txt @@ -0,0 +1,57 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__commander + MAIN commander + STACK 5000 + COMPILE_FLAGS + -Wframe-larger-than=2200 + -Os + SRCS + commander.cpp + commander_params.c + state_machine_helper.cpp + commander_helper.cpp + calibration_routines.cpp + accelerometer_calibration.cpp + gyro_calibration.cpp + mag_calibration.cpp + baro_calibration.cpp + rc_calibration.cpp + airspeed_calibration.cpp + esc_calibration.cpp + PreflightCheck.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/commander/commander_tests/CMakeLists.txt b/src/modules/commander/commander_tests/CMakeLists.txt new file mode 100644 index 0000000000..1a604136ad --- /dev/null +++ b/src/modules/commander/commander_tests/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__commander__commander_tests + MAIN commander_tests + SRCS + commander_tests.cpp + state_machine_helper_test.cpp + ../state_machine_helper.cpp + ../PreflightCheck.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/controllib/CMakeLists.txt b/src/modules/controllib/CMakeLists.txt new file mode 100644 index 0000000000..1cfb2402ec --- /dev/null +++ b/src/modules/controllib/CMakeLists.txt @@ -0,0 +1,46 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__controllib + COMPILE_FLAGS + -Os + SRCS + test_params.c + block/Block.cpp + block/BlockParam.cpp + uorb/blocks.cpp + blocks.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/dataman/CMakeLists.txt b/src/modules/dataman/CMakeLists.txt new file mode 100644 index 0000000000..b480f3695b --- /dev/null +++ b/src/modules/dataman/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__dataman + MAIN dataman + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + dataman.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/ekf_att_pos_estimator/CMakeLists.txt b/src/modules/ekf_att_pos_estimator/CMakeLists.txt new file mode 100644 index 0000000000..9d4ae2de6f --- /dev/null +++ b/src/modules/ekf_att_pos_estimator/CMakeLists.txt @@ -0,0 +1,48 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__ekf_att_pos_estimator + MAIN ekf_att_pos_estimator + COMPILE_FLAGS + -Weffc++ + -Wframe-larger-than=3400 + + SRCS + ekf_att_pos_estimator_main.cpp + ekf_att_pos_estimator_params.c + estimator_22states.cpp + estimator_utilities.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/fixedwing_backside/CMakeLists.txt b/src/modules/fixedwing_backside/CMakeLists.txt new file mode 100644 index 0000000000..c2c8ec649f --- /dev/null +++ b/src/modules/fixedwing_backside/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__fixedwing_backside + MAIN fixedwing_backside + SRCS + fixedwing_backside_main.cpp + fixedwing.cpp + params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/fw_att_control/CMakeLists.txt b/src/modules/fw_att_control/CMakeLists.txt new file mode 100644 index 0000000000..b434a36a86 --- /dev/null +++ b/src/modules/fw_att_control/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__fw_att_control + MAIN fw_att_control + STACK 1200 + COMPILE_FLAGS + -Os + SRCS + fw_att_control_main.cpp + fw_att_control_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/fw_pos_control_l1/CMakeLists.txt b/src/modules/fw_pos_control_l1/CMakeLists.txt new file mode 100644 index 0000000000..530dd51b1e --- /dev/null +++ b/src/modules/fw_pos_control_l1/CMakeLists.txt @@ -0,0 +1,50 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__fw_pos_control_l1 + MAIN fw_pos_control_l1 + STACK 1200 + COMPILE_FLAGS + -Wno-float-equal + -Os + SRCS + fw_pos_control_l1_main.cpp + fw_pos_control_l1_params.c + landingslope.cpp + mtecs/mTecs.cpp + mtecs/limitoverride.cpp + mtecs/mTecs_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/gpio_led/CMakeLists.txt b/src/modules/gpio_led/CMakeLists.txt new file mode 100644 index 0000000000..435d8e986a --- /dev/null +++ b/src/modules/gpio_led/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__gpio_led + MAIN gpio_led + COMPILE_FLAGS + -Os + SRCS + gpio_led.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/land_detector/CMakeLists.txt b/src/modules/land_detector/CMakeLists.txt new file mode 100644 index 0000000000..37030f1795 --- /dev/null +++ b/src/modules/land_detector/CMakeLists.txt @@ -0,0 +1,50 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__land_detector + MAIN land_detector + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + + SRCS + land_detector_main.cpp + land_detector_params.c + LandDetector.cpp + MulticopterLandDetector.cpp + FixedwingLandDetector.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/mavlink/CMakeLists.txt b/src/modules/mavlink/CMakeLists.txt new file mode 100644 index 0000000000..f9897dd194 --- /dev/null +++ b/src/modules/mavlink/CMakeLists.txt @@ -0,0 +1,58 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__mavlink + MAIN mavlink + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Wno-attributes + -Wno-packed + -DMAVLINK_COMM_NUM_BUFFERS=3 + -Wno-packed + -Os + SRCS + mavlink.c + mavlink_main.cpp + mavlink_mission.cpp + mavlink_parameters.cpp + mavlink_orb_subscription.cpp + mavlink_messages.cpp + mavlink_stream.cpp + mavlink_rate_limiter.cpp + mavlink_receiver.cpp + mavlink_ftp.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/mavlink/mavlink_tests/CMakeLists.txt b/src/modules/mavlink/mavlink_tests/CMakeLists.txt new file mode 100644 index 0000000000..fe902974ee --- /dev/null +++ b/src/modules/mavlink/mavlink_tests/CMakeLists.txt @@ -0,0 +1,53 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__mavlink__mavlink_tests + MAIN mavlink_tests + STACK 5000 + COMPILE_FLAGS + -Weffc++ + -DMAVLINK_FTP_UNIT_TEST + -Wno-attributes + -Wno-packed + -Wno-packed + -Os + SRCS + mavlink_tests.cpp + mavlink_ftp_test.cpp + ../mavlink_stream.cpp + ../mavlink_ftp.cpp + ../mavlink.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/mc_att_control/CMakeLists.txt b/src/modules/mc_att_control/CMakeLists.txt new file mode 100644 index 0000000000..3f4aeed93f --- /dev/null +++ b/src/modules/mc_att_control/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__mc_att_control + MAIN mc_att_control + STACK 1200 + SRCS + mc_att_control_main.cpp + mc_att_control_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/mc_att_control_multiplatform/CMakeLists.txt b/src/modules/mc_att_control_multiplatform/CMakeLists.txt new file mode 100644 index 0000000000..22f9d16ee8 --- /dev/null +++ b/src/modules/mc_att_control_multiplatform/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__mc_att_control_multiplatform + MAIN mc_att_control_m + SRCS + mc_att_control_main.cpp + mc_att_control_start_nuttx.cpp + mc_att_control.cpp + mc_att_control_base.cpp + mc_att_control_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/mc_pos_control/CMakeLists.txt b/src/modules/mc_pos_control/CMakeLists.txt new file mode 100644 index 0000000000..3790bfd614 --- /dev/null +++ b/src/modules/mc_pos_control/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__mc_pos_control + MAIN mc_pos_control + STACK 1200 + SRCS + mc_pos_control_main.cpp + mc_pos_control_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/mc_pos_control_multiplatform/CMakeLists.txt b/src/modules/mc_pos_control_multiplatform/CMakeLists.txt new file mode 100644 index 0000000000..28c2d0948a --- /dev/null +++ b/src/modules/mc_pos_control_multiplatform/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__mc_pos_control_multiplatform + MAIN mc_pos_control_m + COMPILE_FLAGS + -Wframe-larger-than=1200 + + SRCS + mc_pos_control_main.cpp + mc_pos_control_start_nuttx.cpp + mc_pos_control.cpp + mc_pos_control_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/muorb/adsp/CMakeLists.txt b/src/modules/muorb/adsp/CMakeLists.txt new file mode 100644 index 0000000000..ade682dbfd --- /dev/null +++ b/src/modules/muorb/adsp/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__muorb__adsp + COMPILE_FLAGS + -Os + SRCS + px4muorb.cpp + uORBFastRpcChannel.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/muorb/krait/CMakeLists.txt b/src/modules/muorb/krait/CMakeLists.txt new file mode 100644 index 0000000000..5bb0dd4f7d --- /dev/null +++ b/src/modules/muorb/krait/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__muorb__krait + MAIN muorb + SRCS + uORBKraitFastRpcChannel.cpp + muorb_main.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/navigator/CMakeLists.txt b/src/modules/navigator/CMakeLists.txt new file mode 100644 index 0000000000..177f172755 --- /dev/null +++ b/src/modules/navigator/CMakeLists.txt @@ -0,0 +1,63 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__navigator + MAIN navigator + STACK 1200 + COMPILE_FLAGS + -Wno-sign-compare + -Os + SRCS + navigator_main.cpp + navigator_params.c + navigator_mode.cpp + mission_block.cpp + mission.cpp + mission_params.c + loiter.cpp + rtl.cpp + rtl_params.c + mission_feasibility_checker.cpp + geofence.cpp + geofence_params.c + datalinkloss.cpp + datalinkloss_params.c + rcloss.cpp + rcloss_params.c + enginefailure.cpp + gpsfailure.cpp + gpsfailure_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/position_estimator_inav/CMakeLists.txt b/src/modules/position_estimator_inav/CMakeLists.txt new file mode 100644 index 0000000000..5ba3d7b64d --- /dev/null +++ b/src/modules/position_estimator_inav/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__position_estimator_inav + MAIN position_estimator_inav + STACK 1200 + COMPILE_FLAGS + -Wframe-larger-than=3800 + + SRCS + position_estimator_inav_main.c + position_estimator_inav_params.c + inertial_filter.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/px4iofirmware/CMakeLists.txt b/src/modules/px4iofirmware/CMakeLists.txt new file mode 100644 index 0000000000..0680fde22c --- /dev/null +++ b/src/modules/px4iofirmware/CMakeLists.txt @@ -0,0 +1,56 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__px4iofirmware + SRCS + adc.c + controls.c + dsm.c + px4io.c + registers.c + safety.c + sbus.c + ../systemlib/up_cxxinitialize.c + ../systemlib/perf_counter.c + mixer.cpp + ../systemlib/mixer/mixer.cpp + ../systemlib/mixer/mixer_group.cpp + ../systemlib/mixer/mixer_multirotor.cpp + ../systemlib/mixer/mixer_simple.cpp + ../systemlib/pwm_limit/pwm_limit.c + ../../lib/rc/st24.c + ../../lib/rc/sumd.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/sdlog2/CMakeLists.txt b/src/modules/sdlog2/CMakeLists.txt new file mode 100644 index 0000000000..319e614d34 --- /dev/null +++ b/src/modules/sdlog2/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__sdlog2 + MAIN sdlog2 + PRIORITY "SCHED_PRIORITY_MAX-30" + STACK 1200 + COMPILE_FLAGS + -Wframe-larger-than=1400 + -Os + SRCS + sdlog2.c + logbuffer.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/segway/CMakeLists.txt b/src/modules/segway/CMakeLists.txt new file mode 100644 index 0000000000..6e9dd93bb2 --- /dev/null +++ b/src/modules/segway/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__segway + MAIN segway + SRCS + segway_main.cpp + BlockSegwayController.cpp + params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/sensors/CMakeLists.txt b/src/modules/sensors/CMakeLists.txt new file mode 100644 index 0000000000..0d498032dd --- /dev/null +++ b/src/modules/sensors/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__sensors + MAIN sensors + PRIORITY "SCHED_PRIORITY_MAX-5" + STACK 1200 + COMPILE_FLAGS + -Wno-type-limits + -Os + SRCS + sensors.cpp + sensor_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/simulator/CMakeLists.txt b/src/modules/simulator/CMakeLists.txt new file mode 100644 index 0000000000..13025e5eab --- /dev/null +++ b/src/modules/simulator/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__simulator + MAIN simulator + COMPILE_FLAGS + -Weffc++ + -Wno-attributes + -Wno-packed + -Wno-packed + + SRCS + simulator.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/systemlib/CMakeLists.txt b/src/modules/systemlib/CMakeLists.txt new file mode 100644 index 0000000000..e69055c4a2 --- /dev/null +++ b/src/modules/systemlib/CMakeLists.txt @@ -0,0 +1,80 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +set(SRCS + perf_counter.c + param/param.c + conversions.c + cpuload.c + pid/pid.c + airspeed.c + system_params.c + mavlink_log.c + rc_check.c + otp.c + board_serial.c + pwm_limit/pwm_limit.c + mcu_version.c + bson/tinybson.c + circuit_breaker.cpp + circuit_breaker_params.c + ) + +if(${OS} STREQUAL "nuttx") + list(APPEND SRCS + err.c + printload.c + up_cxxinitialize.c + ) +else() + list(APPEND SRCS + print_load_posix.c + ) +endif() + +if(NOT ${OS} STREQUAL "qurt") + list(APPEND SRCS + hx_stream.c + ) +endif() + +px4_add_module( + MODULE modules__systemlib + COMPILE_FLAGS + -Wno-sign-compare + -Os + SRCS ${SRCS} + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/systemlib/mixer/CMakeLists.txt b/src/modules/systemlib/mixer/CMakeLists.txt new file mode 100644 index 0000000000..429615d14b --- /dev/null +++ b/src/modules/systemlib/mixer/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__systemlib__mixer + SRCS + mixer.cpp + mixer_group.cpp + mixer_multirotor.cpp + mixer_simple.cpp + mixer_load.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/uORB/CMakeLists.txt b/src/modules/uORB/CMakeLists.txt new file mode 100644 index 0000000000..ceaa4ea00a --- /dev/null +++ b/src/modules/uORB/CMakeLists.txt @@ -0,0 +1,78 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# this includes the generated topics directory +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ) + +set(SRCS + objects_common.cpp + uORBUtils.cpp + uORB.cpp + uORBMain.cpp + Publication.cpp + Subscription.cpp + ) + +if(${OS} STREQUAL "nuttx") + list(APPEND SRCS + uORBDevices_nuttx.cpp + uORBTest_UnitTest.cpp + uORBManager_nuttx.cpp + ) +elseif(${OS} STREQUAL "posix") + list(APPEND SRCS + uORBDevices_posix.cpp + uORBManager_posix.cpp + uORBTest_UnitTest.cpp + ) +elseif(${OS} STREQUAL "posix-arm") + list(APPEND SRCS + uORBDevices_posix.cpp + uORBManager_posix.cpp + uORBTest_UnitTest.cpp + ) +endif() + +px4_add_module( + MODULE modules__uORB + MAIN uorb + STACK 2048 + COMPILE_FLAGS + -Os + SRCS ${SRCS} + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/uavcan/CMakeLists.txt b/src/modules/uavcan/CMakeLists.txt new file mode 100644 index 0000000000..86a02dd359 --- /dev/null +++ b/src/modules/uavcan/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__uavcan + MAIN uavcan + STACK 3200 + COMPILE_FLAGS + -O3 + SRCS + uavcan_main.cpp + uavcan_servers.cpp + uavcan_clock.cpp + uavcan_params.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/unit_test/CMakeLists.txt b/src/modules/unit_test/CMakeLists.txt new file mode 100644 index 0000000000..6fd63d931d --- /dev/null +++ b/src/modules/unit_test/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__unit_test + COMPILE_FLAGS + -Os + SRCS + unit_test.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/vtol_att_control/CMakeLists.txt b/src/modules/vtol_att_control/CMakeLists.txt new file mode 100644 index 0000000000..6af889f52a --- /dev/null +++ b/src/modules/vtol_att_control/CMakeLists.txt @@ -0,0 +1,51 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE modules__vtol_att_control + MAIN vtol_att_control + COMPILE_FLAGS + -Wno-write-strings + + SRCS + vtol_att_control_main.cpp + vtol_att_control_params.c + tiltrotor_params.c + tiltrotor.cpp + vtol_type.cpp + tailsitter.cpp + standard_params.c + standard.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/CMakeLists.txt b/src/platforms/CMakeLists.txt new file mode 100644 index 0000000000..eaea200452 --- /dev/null +++ b/src/platforms/CMakeLists.txt @@ -0,0 +1,26 @@ +set(directories + ./posix/tests/hrt_test + ./posix/tests/wqueue + ./posix/tests/hello + ./posix/tests/muorb + ./posix/tests/vcdev_test + ./posix/work_queue + ./posix/px4_layer + ./posix/drivers/adcsim + ./posix/drivers/gpssim + ./posix/drivers/tonealrmsim + ./posix/drivers/accelsim + ./posix/drivers/airspeedsim + ./posix/drivers/barosim + ./posix/drivers/gyrosim + ./qurt/tests/hello + ./qurt/tests/muorb + ./qurt/px4_layer + ./common + ./nuttx/px4_layer + ./nuttx + ) + +foreach(directory ${directories}) + add_subdirectory(${directory} EXCLUDE_FROM_ALL) +endforeach() diff --git a/src/platforms/common/CMakeLists.txt b/src/platforms/common/CMakeLists.txt new file mode 100644 index 0000000000..0bc74e228a --- /dev/null +++ b/src/platforms/common/CMakeLists.txt @@ -0,0 +1,49 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +set(depends + msg_gen + ) +if(${OS} STREQUAL "nuttx") + list(APPEND depends + nuttx_export + ) +endif() + +px4_add_module( + MODULE platforms__common + SRCS + px4_getopt.c + DEPENDS + ${depends} + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/nuttx/CMakeLists.txt b/src/platforms/nuttx/CMakeLists.txt new file mode 100644 index 0000000000..37c2ac4879 --- /dev/null +++ b/src/platforms/nuttx/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__nuttx + COMPILE_FLAGS + -Os + SRCS + px4_nuttx_impl.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/nuttx/px4_layer/CMakeLists.txt b/src/platforms/nuttx/px4_layer/CMakeLists.txt new file mode 100644 index 0000000000..86dc1ebb48 --- /dev/null +++ b/src/platforms/nuttx/px4_layer/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__nuttx__px4_layer + COMPILE_FLAGS + -Os + SRCS + px4_nuttx_tasks.c + ../../posix/px4_layer/px4_log.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/drivers/accelsim/CMakeLists.txt b/src/platforms/posix/drivers/accelsim/CMakeLists.txt new file mode 100644 index 0000000000..e5b1a92147 --- /dev/null +++ b/src/platforms/posix/drivers/accelsim/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__drivers__accelsim + MAIN accelsim + SRCS + accelsim.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/drivers/adcsim/CMakeLists.txt b/src/platforms/posix/drivers/adcsim/CMakeLists.txt new file mode 100644 index 0000000000..93cdd95a0f --- /dev/null +++ b/src/platforms/posix/drivers/adcsim/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__drivers__adcsim + MAIN adcsim + COMPILE_FLAGS + -Os + SRCS + adcsim.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/drivers/airspeedsim/CMakeLists.txt b/src/platforms/posix/drivers/airspeedsim/CMakeLists.txt new file mode 100644 index 0000000000..8c2a410862 --- /dev/null +++ b/src/platforms/posix/drivers/airspeedsim/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__drivers__airspeedsim + MAIN measairspeedsim + COMPILE_FLAGS + -Os + SRCS + airspeedsim.cpp + meas_airspeed_sim.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/drivers/barosim/CMakeLists.txt b/src/platforms/posix/drivers/barosim/CMakeLists.txt new file mode 100644 index 0000000000..15963f87eb --- /dev/null +++ b/src/platforms/posix/drivers/barosim/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__drivers__barosim + MAIN barosim + COMPILE_FLAGS + -Os + SRCS + baro.cpp + baro_sim.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/drivers/gpssim/CMakeLists.txt b/src/platforms/posix/drivers/gpssim/CMakeLists.txt new file mode 100644 index 0000000000..2c580d7757 --- /dev/null +++ b/src/platforms/posix/drivers/gpssim/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__drivers__gpssim + MAIN gpssim + COMPILE_FLAGS + -Os + SRCS + gpssim.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/drivers/gyrosim/CMakeLists.txt b/src/platforms/posix/drivers/gyrosim/CMakeLists.txt new file mode 100644 index 0000000000..184df706d3 --- /dev/null +++ b/src/platforms/posix/drivers/gyrosim/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__drivers__gyrosim + MAIN gyrosim + STACK 1200 + COMPILE_FLAGS + -Weffc++ + -Os + SRCS + gyrosim.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/drivers/tonealrmsim/CMakeLists.txt b/src/platforms/posix/drivers/tonealrmsim/CMakeLists.txt new file mode 100644 index 0000000000..0ac134ea9c --- /dev/null +++ b/src/platforms/posix/drivers/tonealrmsim/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__drivers__tonealrmsim + MAIN tone_alarm + COMPILE_FLAGS + -Os + SRCS + tone_alarm.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/px4_layer/CMakeLists.txt b/src/platforms/posix/px4_layer/CMakeLists.txt new file mode 100644 index 0000000000..295e882532 --- /dev/null +++ b/src/platforms/posix/px4_layer/CMakeLists.txt @@ -0,0 +1,46 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__px4_layer + COMPILE_FLAGS + -Os + SRCS + px4_posix_impl.cpp + px4_posix_tasks.cpp + lib_crc32.c + drv_hrt.c + px4_log.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/tests/hello/CMakeLists.txt b/src/platforms/posix/tests/hello/CMakeLists.txt new file mode 100644 index 0000000000..f19e4eb872 --- /dev/null +++ b/src/platforms/posix/tests/hello/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__tests__hello + MAIN hello + SRCS + hello_main.cpp + hello_start_posix.cpp + hello_example.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/tests/hrt_test/CMakeLists.txt b/src/platforms/posix/tests/hrt_test/CMakeLists.txt new file mode 100644 index 0000000000..3a67f630ea --- /dev/null +++ b/src/platforms/posix/tests/hrt_test/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__tests__hrt_test + MAIN hrttest + SRCS + hrt_test_main.cpp + hrt_test_start_posix.cpp + hrt_test.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/tests/muorb/CMakeLists.txt b/src/platforms/posix/tests/muorb/CMakeLists.txt new file mode 100644 index 0000000000..967a598cb4 --- /dev/null +++ b/src/platforms/posix/tests/muorb/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__tests__muorb + MAIN muorb_test + SRCS + muorb_test_main.cpp + muorb_test_start_posix.cpp + muorb_test_example.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/tests/vcdev_test/CMakeLists.txt b/src/platforms/posix/tests/vcdev_test/CMakeLists.txt new file mode 100644 index 0000000000..b7ff2cc9e2 --- /dev/null +++ b/src/platforms/posix/tests/vcdev_test/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__tests__vcdev_test + MAIN vcdevtest + SRCS + vcdevtest_main.cpp + vcdevtest_start_posix.cpp + vcdevtest_example.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/tests/wqueue/CMakeLists.txt b/src/platforms/posix/tests/wqueue/CMakeLists.txt new file mode 100644 index 0000000000..6efd698949 --- /dev/null +++ b/src/platforms/posix/tests/wqueue/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__tests__wqueue + MAIN wqueue_test + SRCS + wqueue_main.cpp + wqueue_start_posix.cpp + wqueue_test.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/posix/work_queue/CMakeLists.txt b/src/platforms/posix/work_queue/CMakeLists.txt new file mode 100644 index 0000000000..1ee2dec52d --- /dev/null +++ b/src/platforms/posix/work_queue/CMakeLists.txt @@ -0,0 +1,55 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__posix__work_queue + COMPILE_FLAGS + -Os + SRCS + hrt_thread.c + hrt_queue.c + hrt_work_cancel.c + work_thread.c + work_lock.c + work_queue.c + work_cancel.c + queue.c + dq_addlast.c + dq_remfirst.c + sq_addlast.c + sq_remfirst.c + sq_addafter.c + dq_rem.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/qurt/px4_layer/CMakeLists.txt b/src/platforms/qurt/px4_layer/CMakeLists.txt new file mode 100644 index 0000000000..f7a6d657a7 --- /dev/null +++ b/src/platforms/qurt/px4_layer/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__qurt__px4_layer + COMPILE_FLAGS + -Os + SRCS + px4_qurt_impl.cpp + px4_qurt_tasks.cpp + lib_crc32.c + drv_hrt.c + qurt_stubs.c + main.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/qurt/tests/hello/CMakeLists.txt b/src/platforms/qurt/tests/hello/CMakeLists.txt new file mode 100644 index 0000000000..4664b35f89 --- /dev/null +++ b/src/platforms/qurt/tests/hello/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__qurt__tests__hello + MAIN hello + SRCS + hello_main.cpp + hello_start_qurt.cpp + hello_example.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/qurt/tests/muorb/CMakeLists.txt b/src/platforms/qurt/tests/muorb/CMakeLists.txt new file mode 100644 index 0000000000..ac233a1202 --- /dev/null +++ b/src/platforms/qurt/tests/muorb/CMakeLists.txt @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE platforms__qurt__tests__muorb + MAIN muorb_test + SRCS + muorb_test_start_qurt.cpp + muorb_test_example.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/CMakeLists.txt b/src/systemcmds/CMakeLists.txt new file mode 100644 index 0000000000..6ee6b33a1f --- /dev/null +++ b/src/systemcmds/CMakeLists.txt @@ -0,0 +1,26 @@ + +set(directories + ./mtd + ./ver + ./mixer + ./tests + ./nshterm + ./config + ./top + ./bl_update + ./reboot + ./i2c + ./param + ./reflect + ./usb_connected + ./motor_test + ./esc_calib + ./perf + ./topic_listener + ./dumpfile + ./pwm + ) + +foreach(directory ${directories}) + add_subdirectory(${directory} EXCLUDE_FROM_ALL) +endforeach() diff --git a/src/systemcmds/bl_update/CMakeLists.txt b/src/systemcmds/bl_update/CMakeLists.txt new file mode 100644 index 0000000000..5b9d7953e5 --- /dev/null +++ b/src/systemcmds/bl_update/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__bl_update + MAIN bl_update + STACK 4096 + COMPILE_FLAGS + -Os + SRCS + bl_update.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/config/CMakeLists.txt b/src/systemcmds/config/CMakeLists.txt new file mode 100644 index 0000000000..c2e876ff28 --- /dev/null +++ b/src/systemcmds/config/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__config + MAIN config + STACK 4096 + COMPILE_FLAGS + -Os + SRCS + config.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/dumpfile/CMakeLists.txt b/src/systemcmds/dumpfile/CMakeLists.txt new file mode 100644 index 0000000000..5935d7ec06 --- /dev/null +++ b/src/systemcmds/dumpfile/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__dumpfile + MAIN dumpfile + COMPILE_FLAGS + -Os + SRCS + dumpfile.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/esc_calib/CMakeLists.txt b/src/systemcmds/esc_calib/CMakeLists.txt new file mode 100644 index 0000000000..229271b1d8 --- /dev/null +++ b/src/systemcmds/esc_calib/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__esc_calib + MAIN esc_calib + STACK 4096 + COMPILE_FLAGS + -Os + SRCS + esc_calib.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/i2c/CMakeLists.txt b/src/systemcmds/i2c/CMakeLists.txt new file mode 100644 index 0000000000..04a2b00884 --- /dev/null +++ b/src/systemcmds/i2c/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__i2c + MAIN i2c + COMPILE_FLAGS + -Os + SRCS + i2c.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/mixer/CMakeLists.txt b/src/systemcmds/mixer/CMakeLists.txt new file mode 100644 index 0000000000..c49433c864 --- /dev/null +++ b/src/systemcmds/mixer/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__mixer + MAIN mixer + STACK 4096 + COMPILE_FLAGS + -Wframe-larger-than=2048 + -Os + SRCS + mixer.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/motor_test/CMakeLists.txt b/src/systemcmds/motor_test/CMakeLists.txt new file mode 100644 index 0000000000..77e9905178 --- /dev/null +++ b/src/systemcmds/motor_test/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__motor_test + MAIN motor_test + STACK 4096 + COMPILE_FLAGS + -Os + SRCS + motor_test.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/mtd/CMakeLists.txt b/src/systemcmds/mtd/CMakeLists.txt new file mode 100644 index 0000000000..7c67196736 --- /dev/null +++ b/src/systemcmds/mtd/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__mtd + MAIN mtd + COMPILE_FLAGS + -Wno-error + -Os + SRCS + mtd.c + 24xxxx_mtd.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/nshterm/CMakeLists.txt b/src/systemcmds/nshterm/CMakeLists.txt new file mode 100644 index 0000000000..30c2e58a51 --- /dev/null +++ b/src/systemcmds/nshterm/CMakeLists.txt @@ -0,0 +1,45 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__nshterm + MAIN nshterm + PRIORITY "SCHED_PRIORITY_DEFAULT-30" + STACK 1500 + COMPILE_FLAGS + -Os + SRCS + nshterm.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/param/CMakeLists.txt b/src/systemcmds/param/CMakeLists.txt new file mode 100644 index 0000000000..cd35b0da04 --- /dev/null +++ b/src/systemcmds/param/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__param + MAIN param + STACK 1800 + COMPILE_FLAGS + -Os + SRCS + param.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/perf/CMakeLists.txt b/src/systemcmds/perf/CMakeLists.txt new file mode 100644 index 0000000000..8a0a3a815c --- /dev/null +++ b/src/systemcmds/perf/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__perf + MAIN perf + STACK 1800 + COMPILE_FLAGS + -Os + SRCS + perf.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/pwm/CMakeLists.txt b/src/systemcmds/pwm/CMakeLists.txt new file mode 100644 index 0000000000..df1c6088c9 --- /dev/null +++ b/src/systemcmds/pwm/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__pwm + MAIN pwm + STACK 1800 + COMPILE_FLAGS + -Os + SRCS + pwm.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/reboot/CMakeLists.txt b/src/systemcmds/reboot/CMakeLists.txt new file mode 100644 index 0000000000..635b88b95d --- /dev/null +++ b/src/systemcmds/reboot/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__reboot + MAIN reboot + STACK 800 + COMPILE_FLAGS + -Os + SRCS + reboot.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/reflect/CMakeLists.txt b/src/systemcmds/reflect/CMakeLists.txt new file mode 100644 index 0000000000..f7fcda35cd --- /dev/null +++ b/src/systemcmds/reflect/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__reflect + MAIN reflect + COMPILE_FLAGS + -Os + SRCS + reflect.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/tests/CMakeLists.txt b/src/systemcmds/tests/CMakeLists.txt new file mode 100644 index 0000000000..c58048433d --- /dev/null +++ b/src/systemcmds/tests/CMakeLists.txt @@ -0,0 +1,71 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__tests + MAIN tests + STACK 60000 + COMPILE_FLAGS + -Wframe-larger-than=6000 + -O0 + SRCS + test_adc.c + test_bson.c + test_float.c + test_gpio.c + test_hott_telemetry.c + test_hrt.c + test_int.c + test_jig_voltages.c + test_led.c + test_sensors.c + test_servo.c + test_sleep.c + test_uart_baudchange.c + test_uart_console.c + test_uart_loopback.c + test_uart_send.c + test_mixer.cpp + test_mathlib.cpp + test_file.c + test_file2.c + tests_main.c + test_param.c + test_ppm_loopback.c + test_rc.c + test_conv.cpp + test_mount.c + test_eigen.cpp + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/top/CMakeLists.txt b/src/systemcmds/top/CMakeLists.txt new file mode 100644 index 0000000000..0bf73a923c --- /dev/null +++ b/src/systemcmds/top/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__top + MAIN top + STACK 1700 + COMPILE_FLAGS + -Os + SRCS + top.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/topic_listener/CMakeLists.txt b/src/systemcmds/topic_listener/CMakeLists.txt new file mode 100644 index 0000000000..2739b178ee --- /dev/null +++ b/src/systemcmds/topic_listener/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +#px4_add_module( + #MODULE systemcmds__topic_listener + #MAIN listener + #STACK 1800 + #COMPILE_FLAGS + #-Os + #SRCS + #topic_listener.cpp + #DEPENDS + #platforms__common + #) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/usb_connected/CMakeLists.txt b/src/systemcmds/usb_connected/CMakeLists.txt new file mode 100644 index 0000000000..7d9966229e --- /dev/null +++ b/src/systemcmds/usb_connected/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__usb_connected + MAIN usb_connected + COMPILE_FLAGS + -Os + SRCS + usb_connected.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/ver/CMakeLists.txt b/src/systemcmds/ver/CMakeLists.txt new file mode 100644 index 0000000000..f6676b1883 --- /dev/null +++ b/src/systemcmds/ver/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +px4_add_module( + MODULE systemcmds__ver + MAIN ver + STACK 1024 + COMPILE_FLAGS + -Os + SRCS + ver.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : From 29520c08348bcdd8aa9d275bb62c59ff729f92e8 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Mon, 7 Sep 2015 23:58:31 -0400 Subject: [PATCH 002/389] Support for os abstraction. --- CMakeLists.txt | 48 ++++++------- cmake/px4_nuttx_utils.cmake | 100 +++++++++++++++++++++++----- cmake/px4_utils.cmake | 77 +++++++++++++-------- src/CMakeLists.txt | 2 +- src/platforms/common/CMakeLists.txt | 7 +- 5 files changed, 156 insertions(+), 78 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aace54bd66..fcfb877d0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,9 @@ # Functions/Macros # --------------------------------------------------------------------------- # +# * Use px4_parse_function_args to parse functions and check for required +# arguments. +# # * Never use macros. They allow overwriting global variables and this # makes variable declarations hard to locate. # @@ -107,9 +110,17 @@ set(package-contact "px4users@googlegroups.com") # list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) - -include(px4_utils) -include(px4_nuttx_utils) +include(px4_${OS}_utils) +set(px4_required_functions + px4_os_add_firmware + px4_os_prebuild_targets + px4_os_add_flags + ) +foreach(cmd ${px4_required_functions}) + if(NOT COMMAND ${cmd}) + message(FATAL_ERROR "cmake/px4_${OS}_utils.cmake must implement ${cmd}") + endif() +endforeach() #============================================================================= # parameters @@ -124,8 +135,8 @@ set_property(CACHE BOARD PROPERTY STRINGS px4fmu-v2 sitl) set(LABEL "simple" CACHE STRING "module set label") set_property(CACHE LABEL PROPERTY STRINGS simple default) -set(NUTTX_BUILD_THREADS "4" CACHE STRING - "number of threads to use when building NuttX") +set(THREADS "4" CACHE STRING + "number of threads to use for external build processes") set(required_toolchain_variables CMAKE_C_COMPILER_ID @@ -159,40 +170,25 @@ add_custom_target(submodule_clean #============================================================================= # external libraries # -if(${OS} STREQUAL "nuttx") - px4_nuttx_add_export(OUT nuttx_export - CONFIG ${BOARD} - THREADS ${NUTTX_BUILD_THREADS} - DEPENDS git_nuttx) -endif() +px4_os_prebuild_targets(OUT prebuild_targets + BOARD ${BOARD} + THREADS ${THREADS}) #============================================================================= # build flags # - -px4_add_common_flags( +px4_os_add_flags( + BOARD ${BOARD} C_FLAGS c_flags CXX_FLAGS cxx_flags EXE_LINKER_FLAGS exe_linker_flags INCLUDE_DIRS include_dirs LINK_DIRS link_dirs DEFINITIONS definitions) - -if(${OS} STREQUAL "nuttx") - px4_add_nuttx_flags( - BOARD ${BOARD} - C_FLAGS c_flags - CXX_FLAGS cxx_flags - EXE_LINKER_FLAGS exe_linker_flags - INCLUDE_DIRS include_dirs - LINK_DIRS link_dirs - DEFINITIONS definitions) - -endif() - px4_join(OUT CMAKE_EXE_LINKER_FLAGS LIST "${exe_linker_flags}" GLUE " ") px4_join(OUT CMAKE_C_FLAGS LIST "${c_flags}" GLUE " ") px4_join(OUT CMAKE_CXX_FLAGS LIST "${cxx_flags}" GLUE " ") + include_directories(${include_dirs}) link_directories(${link_dirs}) add_definitions(${definitions}) diff --git a/cmake/px4_nuttx_utils.cmake b/cmake/px4_nuttx_utils.cmake index 25f3cf0692..df10da85df 100644 --- a/cmake/px4_nuttx_utils.cmake +++ b/cmake/px4_nuttx_utils.cmake @@ -31,9 +31,28 @@ # ############################################################################ + +#============================================================================= +# +# Defined functions in this file +# +# OS Specific Functions +# +# * px4_nuttx_add_firmware +# * px4_nuttx_generate_builtin_commands +# * px4_nuttx_add_export +# * px4_nuttx_generate_romfs +# +# Required OS Inteface Functions +# +# * px4_os_add_flags +# * px4_os_prebuild_targets +# + include(px4_utils) -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_nuttx_add_firmware # # This function adds a nuttx firmware target. @@ -53,7 +72,6 @@ include(px4_utils) # Example: # px4_nuttx_add_firmware(TARGET fw_test EXE test) # -#---------------------------------------------------------------------------- function(px4_nuttx_add_firmware) px4_parse_function_args( NAME px4_nuttx_add_firmware @@ -74,7 +92,8 @@ function(px4_nuttx_add_firmware) ) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_nuttx_generate_builtin_commands # # This function generates the builtin_commands.c src for nuttx @@ -91,9 +110,9 @@ endfunction() # OUT : generated builtin_commands.c src # # Example: -# px4_nuttx_generate_builtin_commands(OUT MODULE_LIST px4_simple_app) +# px4_nuttx_generate_builtin_commands( +# OUT MODULE_LIST px4_simple_app) # -#---------------------------------------------------------------------------- function(px4_nuttx_generate_builtin_commands) px4_parse_function_args( NAME px4_nuttx_generate_builtin_commands @@ -127,11 +146,12 @@ function(px4_nuttx_generate_builtin_commands) ${OUT}) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_nuttx_add_export # # This function generates a nuttx export. - +# # Usage: # px4_nuttx_add_export( # OUT @@ -148,7 +168,6 @@ endfunction() # Example: # px4_nuttx_add_export(OUT nuttx_export CONFIG px4fmu-v2) # -#---------------------------------------------------------------------------- function(px4_nuttx_add_export) px4_parse_function_args( @@ -215,7 +234,8 @@ function(px4_nuttx_add_export) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_nuttx_generate_romfs # # The functions generates the ROMFS filesystem for nuttx. @@ -232,7 +252,6 @@ endfunction() # Example: # px4_nuttx_generate_romfs(OUT my_romfs ROOT "ROMFS/my_board") # -#---------------------------------------------------------------------------- function(px4_nuttx_generate_romfs) px4_parse_function_args( @@ -257,13 +276,14 @@ function(px4_nuttx_generate_romfs) endfunction() -#---------------------------------------------------------------------------- -# px4_add_nuttx_flags +#============================================================================= +# +# px4_add_flags # # Set ths nuttx build flags. # # Usage: -# px4_add_nuttx_flags( +# px4_add_flags( # C_FLAGS # CXX_FLAGS # EXE_LINKER_FLAGS @@ -273,7 +293,7 @@ endfunction() # # Input: # BOARD : flags depend on board/nuttx config - +# # Input/Output: (appends to existing variable) # C_FLAGS : c compile flags variable # CXX_FLAGS : c++ compile flags variable @@ -283,24 +303,32 @@ endfunction() # DEFINITIONS : definitions # # Example: -# px4_add_nuttx_flags( +# px4_add_flags( # C_FLAGS CMAKE_C_FLAGS # CXX_FLAGS CMAKE_CXX_FLAGS # EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS # INCLUDES ) # -#---------------------------------------------------------------------------- -function(px4_add_nuttx_flags) +function(px4_add_flags) set(inout_vars C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) px4_parse_function_args( - NAME px4_add_nuttx_flags + NAME px4_add_flags ONE_VALUE ${inout_vars} BOARD REQUIRED ${inout_vars} BOARD ARGN ${ARGN}) + px4_add_common_flags( + BOARD ${BOARD} + C_FLAGS ${C_FLAGS} + CXX_FLAGS ${CXX_FLAGS} + EXE_LINKER_FLAGS ${EXE_LINKER_FLAGS} + INCLUDE_DIRS ${INCLUDE_DIRS} + LINK_DIRS ${LINK_DIRS} + DEFINITIONS ${DEFINITIONS}) + set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) set(added_include_dirs ${nuttx_export_dir}/include @@ -341,8 +369,44 @@ function(px4_add_nuttx_flags) foreach(var ${inout_vars}) string(TOLOWER ${var} lower_var) set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) + message(STATUS "nuttx: set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") endforeach() endfunction() +#============================================================================= +# +# px4_prebuild_targets +# +# This function generates os dependent targets + +# Usage: +# px4_os_prebuild_targets( +# OUT +# BOARD +# ) +# +# Input: +# BOARD : board +# THREADS : number of threads for building +# +# Output: +# OUT : the target list +# +# Example: +# px4_os_prebuild_targets(OUT target_list BOARD px4fmu-v2) +# +function(px4_prebuild_targets) + px4_parse_function_args( + NAME px4_add_os_libraries + ONE_VALUE OUT BOARD THREADS + REQUIRED OUT BOARD + ARGN ${ARGN}) + px4_nuttx_add_export(OUT nuttx_export + CONFIG ${BOARD} + THREADS ${THREADS} + DEPENDS git_nuttx) + add_custom_target(${OUT} DEPENDS nuttx_export) +endfunction() + # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/px4_utils.cmake b/cmake/px4_utils.cmake index 3d3b5563e8..5333c454a8 100644 --- a/cmake/px4_utils.cmake +++ b/cmake/px4_utils.cmake @@ -31,9 +31,26 @@ # ############################################################################ +#============================================================================= +# +# Defined functions in this file +# +# utility functions +# +# * px4_parse_function_args +# * px4_add_git_submodule +# * px4_prepend_string +# * px4_join +# * px4_add_module +# * px4_generate_messages +# * px4_add_upload +# * px4_add_common_flags +# + include(CMakeParseArguments) -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_parse_function_args # # This function simpliies usage of the cmake_parse_arguments module. @@ -78,7 +95,6 @@ include(CMakeParseArguments) # name: hello # list: a b c # -#---------------------------------------------------------------------------- function(px4_parse_function_args) cmake_parse_arguments(IN "" "NAME" "OPTIONS;ONE_VALUE;MULTI_VALUE;REQUIRED;ARGN" "${ARGN}") cmake_parse_arguments(OUT "${IN_OPTIONS}" "${IN_ONE_VALUE}" "${IN_MULTI_VALUE}" "${IN_ARGN}") @@ -95,13 +111,14 @@ function(px4_parse_function_args) endforeach() endfunction() -#---------------------------------------------------------------------------- -# add_git_submodule +#============================================================================= +# +# px4_add_git_submodule # # This function add a git submodule target. # # Usage: -# add_git_submodule(TARGET PATH ) +# px4_add_git_submodule(TARGET PATH ) # # Input: # PATH : git submodule path @@ -110,9 +127,8 @@ endfunction() # TARGET : git target # # Example: -# add_git_submodule(TARGET git_nuttx PATH "NuttX") +# px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") # -#---------------------------------------------------------------------------- function(px4_add_git_submodule) px4_parse_function_args( NAME px4_add_git_submodule @@ -131,7 +147,8 @@ function(px4_add_git_submodule) ) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_prepend_string # # This function prepends a string to a list @@ -152,7 +169,6 @@ endfunction() # path/to/src/file1.cpp # path/to/src/file2.cpp # -#---------------------------------------------------------------------------- function(px4_prepend_string) px4_parse_function_args( NAME px4_prepend_string @@ -167,7 +183,8 @@ function(px4_prepend_string) set(${OUT} ${${OUT}} PARENT_SCOPE) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_join # # This function joins a list with a given separator. If list is not @@ -188,7 +205,6 @@ endfunction() # test_join would then be: # "a;b;c" # -#---------------------------------------------------------------------------- function(px4_join) px4_parse_function_args( NAME px4_join @@ -200,7 +216,8 @@ function(px4_join) set(${OUT} ${_TMP_STR} PARENT_SCOPE) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_add_module # # This function builds a static library from a module description. @@ -236,7 +253,6 @@ endfunction() # git_nuttx # ) # -#---------------------------------------------------------------------------- function(px4_add_module) px4_parse_function_args( NAME px4_add_module @@ -264,11 +280,12 @@ function(px4_add_module) set_target_properties(${MODULE} PROPERTIES LINK_INTERFACE_MULTIPLICITY 4) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_generate_messages # # This function generates source code from ROS msg definitions. - +# # Usage: # px4_generate_messages(TARGET MSGS ) # @@ -286,7 +303,6 @@ endfunction() # [ DEPENDS ] # ) # -#---------------------------------------------------------------------------- function(px4_generate_messages) px4_parse_function_args( NAME px4_generate_messages @@ -349,11 +365,12 @@ function(px4_generate_messages) DEPENDS ${msg_multi_files_out} ${msg_files_out}) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_add_upload # # This function generates source code from ROS msg definitions. - +# # Usage: # px4_add_upload(OUT BUNDLE ) # @@ -370,7 +387,6 @@ endfunction() # BUNDLE main.px4 # ) # -#---------------------------------------------------------------------------- function(px4_add_upload) px4_parse_function_args( NAME px4_generate_messages @@ -403,13 +419,15 @@ function(px4_add_upload) ) endfunction() -#---------------------------------------------------------------------------- +#============================================================================= +# # px4_add_common_flags # # Set ths default build flags. # # Usage: # px4_add_common_flags( +# BOARD # C_FLAGS # CXX_FLAGS # EXE_LINKER_FLAGS @@ -417,6 +435,9 @@ endfunction() # LINK_DIRS # DEFINITIONS ) # +# Input: +# BOARD : board +# # Input/Output: (appends to existing variable) # C_FLAGS : c compile flags variable # CXX_FLAGS : c++ compile flags variable @@ -427,12 +448,12 @@ endfunction() # # Example: # px4_add_common_flags( +# BOARD px4fmu-v2 # C_FLAGS CMAKE_C_FLAGS # CXX_FLAGS CMAKE_CXX_FLAGS # EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS # INCLUDES ) # -#---------------------------------------------------------------------------- function(px4_add_common_flags) set(inout_vars @@ -440,8 +461,8 @@ function(px4_add_common_flags) px4_parse_function_args( NAME px4_add_common_flags - ONE_VALUE ${inout_vars} - REQUIRED ${inout_vars} + ONE_VALUE ${inout_vars} BOARD + REQUIRED ${inout_vars} BOARD ARGN ${ARGN}) set(warnings @@ -569,8 +590,10 @@ function(px4_add_common_flags) set(added_link_dirs) # none used currently + string(TOUPPER ${BOARD} board_upper) + string(REPLACE "-" "_" board_config ${board_upper}) set(added_definitions - -DCONFIG_ARCH_BOARD_${BOARD_CONFIG} + -DCONFIG_ARCH_BOARD_${board_config} ) set(added_exe_link_flags @@ -582,13 +605,9 @@ function(px4_add_common_flags) foreach(var ${inout_vars}) string(TOLOWER ${var} lower_var) set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) + message(STATUS "set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") endforeach() endfunction() - - - - - # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2a80d939f..6584e136cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,7 +64,7 @@ if (${OS} STREQUAL "nuttx") px4_nuttx_add_firmware(OUT fw_main.px4 EXE main) px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE fw_main.px4) - px4_nuttx_generate_romfs(OUT romfs.img ROOT ROMFS/px4fmu_common) + px4_generate_romfs(OUT romfs.img ROOT ROMFS/px4fmu_common) endif() diff --git a/src/platforms/common/CMakeLists.txt b/src/platforms/common/CMakeLists.txt index 0bc74e228a..7d486c9709 100644 --- a/src/platforms/common/CMakeLists.txt +++ b/src/platforms/common/CMakeLists.txt @@ -33,10 +33,9 @@ set(depends msg_gen ) -if(${OS} STREQUAL "nuttx") - list(APPEND depends - nuttx_export - ) + +if (prebuild_targets) + list(APPEND depends prebuild_targets) endif() px4_add_module( From 852c72fdc72909f0fe5cdde6a5e7e3cbd02f00b6 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 00:07:41 -0400 Subject: [PATCH 003/389] Naming fix. --- CMakeLists.txt | 1 - cmake/px4_nuttx_utils.cmake | 16 ++++++++-------- cmake/px4_utils.cmake | 2 +- src/CMakeLists.txt | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcfb877d0a..84274c09ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,6 @@ set(package-contact "px4users@googlegroups.com") list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) include(px4_${OS}_utils) set(px4_required_functions - px4_os_add_firmware px4_os_prebuild_targets px4_os_add_flags ) diff --git a/cmake/px4_nuttx_utils.cmake b/cmake/px4_nuttx_utils.cmake index df10da85df..7e5240179c 100644 --- a/cmake/px4_nuttx_utils.cmake +++ b/cmake/px4_nuttx_utils.cmake @@ -278,12 +278,12 @@ endfunction() #============================================================================= # -# px4_add_flags +# px4_os_add_flags # # Set ths nuttx build flags. # # Usage: -# px4_add_flags( +# px4_os_add_flags( # C_FLAGS # CXX_FLAGS # EXE_LINKER_FLAGS @@ -303,13 +303,13 @@ endfunction() # DEFINITIONS : definitions # # Example: -# px4_add_flags( +# px4_os_add_flags( # C_FLAGS CMAKE_C_FLAGS # CXX_FLAGS CMAKE_CXX_FLAGS # EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS # INCLUDES ) # -function(px4_add_flags) +function(px4_os_add_flags) set(inout_vars C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) @@ -369,14 +369,14 @@ function(px4_add_flags) foreach(var ${inout_vars}) string(TOLOWER ${var} lower_var) set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) - message(STATUS "nuttx: set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") + #message(STATUS "nuttx: set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") endforeach() endfunction() #============================================================================= # -# px4_prebuild_targets +# px4_os_prebuild_targets # # This function generates os dependent targets @@ -396,9 +396,9 @@ endfunction() # Example: # px4_os_prebuild_targets(OUT target_list BOARD px4fmu-v2) # -function(px4_prebuild_targets) +function(px4_os_prebuild_targets) px4_parse_function_args( - NAME px4_add_os_libraries + NAME px4_os_prebuild_targets ONE_VALUE OUT BOARD THREADS REQUIRED OUT BOARD ARGN ${ARGN}) diff --git a/cmake/px4_utils.cmake b/cmake/px4_utils.cmake index 5333c454a8..edc910b4cb 100644 --- a/cmake/px4_utils.cmake +++ b/cmake/px4_utils.cmake @@ -605,7 +605,7 @@ function(px4_add_common_flags) foreach(var ${inout_vars}) string(TOLOWER ${var} lower_var) set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) - message(STATUS "set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") + #message(STATUS "set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") endforeach() endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6584e136cb..d2a80d939f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,7 +64,7 @@ if (${OS} STREQUAL "nuttx") px4_nuttx_add_firmware(OUT fw_main.px4 EXE main) px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE fw_main.px4) - px4_generate_romfs(OUT romfs.img ROOT ROMFS/px4fmu_common) + px4_nuttx_generate_romfs(OUT romfs.img ROOT ROMFS/px4fmu_common) endif() From 4764a6244043b81bb1999fd6762f8380121dd144 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Mon, 7 Sep 2015 21:10:43 -0700 Subject: [PATCH 004/389] Merge of latest changes Signed-off-by: Mark Charlebois --- CMakeLists.txt | 12 +++++- cmake/qurt/px4_target_impl.cmake | 69 +++++++++++++++++++------------- 2 files changed, 52 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcfb877d0a..8d1885cf73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,12 +154,16 @@ endforeach() #============================================================================= # git # +if(${OS} STREQUAL "nuttx") px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +endif() px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") +if(NOT ${OS} STREQUAL "nuttx") px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") +endif() add_custom_target(submodule_clean WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} @@ -185,6 +189,7 @@ px4_os_add_flags( INCLUDE_DIRS include_dirs LINK_DIRS link_dirs DEFINITIONS definitions) + px4_join(OUT CMAKE_EXE_LINKER_FLAGS LIST "${exe_linker_flags}" GLUE " ") px4_join(OUT CMAKE_C_FLAGS LIST "${c_flags}" GLUE " ") px4_join(OUT CMAKE_CXX_FLAGS LIST "${cxx_flags}" GLUE " ") @@ -206,7 +211,12 @@ px4_generate_messages(TARGET msg_gen #============================================================================= # subdirectories # -add_subdirectory(src) +if(${OS} STREQUAL "nuttx") + add_subdirectory(src) +else(${OS} STREQUAL "nuttx") + set(module_list) + px4_target_add_modules(module_list) +endif() #============================================================================= # packaging diff --git a/cmake/qurt/px4_target_impl.cmake b/cmake/qurt/px4_target_impl.cmake index d9d5a65728..1dad68331d 100644 --- a/cmake/qurt/px4_target_impl.cmake +++ b/cmake/qurt/px4_target_impl.cmake @@ -47,15 +47,21 @@ # set(QURT_APPS_HEADER ${CMAKE_BINARY_DIR}/apps.h) -add_git_submodule(dspal src/lib/dspal) -add_git_submodule(eigen src/lib/eigen-3.2) +px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") +px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") + +function(px4_target_set_flags) + set(inout_vars + C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) + + px4_parse_function_args( + NAME px4_target_set_flags + ONE_VALUE ${inout_vars} BOARD + REQUIRED ${inout_vars} BOARD + ARGN ${ARGN}) -macro(px4_target_set_flags) - list(APPEND EXE_LINK_LIBS - pthread - ) set(DSPAL_ROOT src/lib/dspal) - include_directories( + set(added_include_dirs ${DSPAL_ROOT}/include ${DSPAL_ROOT}/sys ${DSPAL_ROOT}/sys/sys @@ -65,48 +71,55 @@ macro(px4_target_set_flags) src/platforms/posix/include src/lib/eigen-3.2 ) - add_definitions( + + set(added_definitions -D__PX4_QURT -D__PX4_POSIX -include ${PX4_INCLUDE_DIR}visibility.h ) # Add the toolchain specific flags - set(CMAKE_C_FLAGS ${QURT_CMAKE_C_FLAGS}) - set(CMAKE_CXX_FLAGS ${QURT_CMAKE_CXX_FLAGS}) - set(CMAKE_SHARED_LINKER_FLAGS "") - - message(STATUS "CMAKE_C_FLAGS: -${CMAKE_C_FLAGS}-") - message(STATUS "CMAKE_CXX_FLAGS: -${CMAKE_CXX_FLAGS}-") + set(added_cflags ${QURT_CMAKE_C_FLAGS}) + set(added_cxx_flags ${QURT_CMAKE_CXX_FLAGS}) + # FIXME @jgoppert - how to work around issues like this? + # Without changing global variables? # Clear -rdynamic flag which fails for hexagon set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -endmacro() + # output + foreach(var ${inout_vars}) + string(TOLOWER ${var} lower_var) + set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) + endforeach() +endfunction() -macro(px4_target_set_modules) - list(APPEND module_directories +function(px4_target_add_modules out_module_directories) + list(APPEND ${out_module_directories} ./src/platforms/qurt/px4_layer ./src/platforms/posix/work_queue + PARENT_SCOPE ) -endmacro() +endfunction() -macro(px4_target_validate_config) - if (${TARGET_NAME} STREQUAL "qurt-hil-simple") - else() +function(px4_target_validate_config) + # FIXME - this can be done in Firmware/CMakeLists.txt + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) + + if (NOT EXISTS("${CMAKE_SOURCE_DIR}/cmake/qurt/${TARGET_NAME}.cmake") message(FATAL_ERROR "not implemented yet: ${TARGET_NAME}") endif() -endmacro() +endfunction() -macro(px4_target_firmware) +function(px4_target_firmware) set(installed_targets) add_library(dspal_main SHARED ./src/platforms/qurt/px4_layer/main.cpp) target_link_libraries(dspal_main ${module_list}) list(APPEND installed_targets dspal_main) -endmacro() +endfunction() -macro(px4_target_rules) +function(px4_target_rules) #============================================================================= # apps # @@ -118,7 +131,7 @@ macro(px4_target_rules) ) add_custom_target(qurt_apps DEPENDS ${QURT_APPS_HEADER}) -endmacro() +endfunction() -macro(px4_target_testing) -endmacro() +function(px4_target_testing) +endfunction() From cb9649bfd511b538b16895ad6767fd036fdb7f76 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 00:12:49 -0400 Subject: [PATCH 005/389] Depdendency fix for prebuild_targets. --- src/platforms/common/CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/platforms/common/CMakeLists.txt b/src/platforms/common/CMakeLists.txt index 7d486c9709..c60f47764e 100644 --- a/src/platforms/common/CMakeLists.txt +++ b/src/platforms/common/CMakeLists.txt @@ -32,12 +32,9 @@ ############################################################################ set(depends msg_gen + prebuild_targets ) -if (prebuild_targets) - list(APPEND depends prebuild_targets) -endif() - px4_add_module( MODULE platforms__common SRCS From 4d02b7474804015a31c57e40ceacdef28fa4ca5e Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 00:30:35 -0400 Subject: [PATCH 006/389] Rename of modules. --- CMakeLists.txt | 10 +++++++--- cmake/{px4_utils.cmake => px4_base.cmake} | 0 cmake/{px4_nuttx_utils.cmake => px4_impl_nuttx.cmake} | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) rename cmake/{px4_utils.cmake => px4_base.cmake} (100%) rename cmake/{px4_nuttx_utils.cmake => px4_impl_nuttx.cmake} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84274c09ee..0ec01199f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,10 +37,10 @@ # Structure # --------------------------------------------------------------------------- # -# * Common functions should be included in px_utils.cmake. +# * Common functions should be included in px_base.cmake. # # * OS/ board specific fucntions should be include in -# px_${OS}_utils.cmake or px4_${OS}_${BOARD}_utils.cmake. +# px_impl_${OS}.cmake or px4_impl_${OS}_${BOARD}.cmake. # # Formatting # --------------------------------------------------------------------------- @@ -110,7 +110,11 @@ set(package-contact "px4users@googlegroups.com") # list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -include(px4_${OS}_utils) +if (EXISTS px4_imple_${OS}_${BOARD}) + include(px4_impl_${OS}_${BOARD}) +else() + include(px4_impl_${OS}) +endif() set(px4_required_functions px4_os_prebuild_targets px4_os_add_flags diff --git a/cmake/px4_utils.cmake b/cmake/px4_base.cmake similarity index 100% rename from cmake/px4_utils.cmake rename to cmake/px4_base.cmake diff --git a/cmake/px4_nuttx_utils.cmake b/cmake/px4_impl_nuttx.cmake similarity index 99% rename from cmake/px4_nuttx_utils.cmake rename to cmake/px4_impl_nuttx.cmake index 7e5240179c..ef704f1ec2 100644 --- a/cmake/px4_nuttx_utils.cmake +++ b/cmake/px4_impl_nuttx.cmake @@ -49,7 +49,7 @@ # * px4_os_prebuild_targets # -include(px4_utils) +include(px4_base) #============================================================================= # From 0dab16123efb56eaad43aacdc0134a6e1ad6eaca Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 00:30:35 -0400 Subject: [PATCH 007/389] Rename of modules. --- CMakeLists.txt | 10 +++++++--- cmake/{px4_utils.cmake => px4_base.cmake} | 0 cmake/{px4_nuttx_utils.cmake => px4_impl_nuttx.cmake} | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) rename cmake/{px4_utils.cmake => px4_base.cmake} (100%) rename cmake/{px4_nuttx_utils.cmake => px4_impl_nuttx.cmake} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84274c09ee..fe287e7761 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,10 +37,10 @@ # Structure # --------------------------------------------------------------------------- # -# * Common functions should be included in px_utils.cmake. +# * Common functions should be included in px_base.cmake. # # * OS/ board specific fucntions should be include in -# px_${OS}_utils.cmake or px4_${OS}_${BOARD}_utils.cmake. +# px_impl_${OS}.cmake or px4_impl_${OS}_${BOARD}.cmake. # # Formatting # --------------------------------------------------------------------------- @@ -110,7 +110,11 @@ set(package-contact "px4users@googlegroups.com") # list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -include(px4_${OS}_utils) +if (EXISTS px4_impl_${OS}_${BOARD}) + include(px4_impl_${OS}_${BOARD}) +else() + include(px4_impl_${OS}) +endif() set(px4_required_functions px4_os_prebuild_targets px4_os_add_flags diff --git a/cmake/px4_utils.cmake b/cmake/px4_base.cmake similarity index 100% rename from cmake/px4_utils.cmake rename to cmake/px4_base.cmake diff --git a/cmake/px4_nuttx_utils.cmake b/cmake/px4_impl_nuttx.cmake similarity index 99% rename from cmake/px4_nuttx_utils.cmake rename to cmake/px4_impl_nuttx.cmake index 7e5240179c..ef704f1ec2 100644 --- a/cmake/px4_nuttx_utils.cmake +++ b/cmake/px4_impl_nuttx.cmake @@ -49,7 +49,7 @@ # * px4_os_prebuild_targets # -include(px4_utils) +include(px4_base) #============================================================================= # From 815387492c4d4ba767309c3cd5eff3b747b267ac Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 00:47:18 -0400 Subject: [PATCH 008/389] Fixed upload target for nuttx. --- src/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2a80d939f..9371c39084 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,10 +61,14 @@ if (${OS} STREQUAL "nuttx") apps nuttx nosys m gcc -Wl,--end-group) - px4_nuttx_add_firmware(OUT fw_main.px4 EXE main) - px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE fw_main.px4) + px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 + EXE ${CMAKE_CURRENT_BINARY_DIR}/main) - px4_nuttx_generate_romfs(OUT romfs.img ROOT ROMFS/px4fmu_common) + px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} + BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) + + px4_nuttx_generate_romfs(OUT ${CMAKE_CURRENT_BINARY_DIR}/romfs.img + ROOT ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common) endif() From 44dd4160a2e89e96614067d51378522ca87a86f5 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Mon, 7 Sep 2015 23:35:40 -0700 Subject: [PATCH 009/389] cmake: Adding qurt build support Signed-off-by: Mark Charlebois --- CMakeLists.txt | 7 +- cmake/Toolchain-hexagon.cmake | 2 +- cmake/px4_impl_qurt.cmake | 259 ++++++++++++++++++ cmake/qurt/configs/config-qurt-hil.cmake | 85 ++++++ ...px4_target_impl.cmake => qurt_funcs.cmake} | 47 +--- src/CMakeLists.txt | 62 +++-- 6 files changed, 383 insertions(+), 79 deletions(-) create mode 100644 cmake/px4_impl_qurt.cmake create mode 100644 cmake/qurt/configs/config-qurt-hil.cmake rename cmake/qurt/{px4_target_impl.cmake => qurt_funcs.cmake} (72%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5c6a32102..e655d57765 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,12 +214,7 @@ px4_generate_messages(TARGET msg_gen #============================================================================= # subdirectories # -if(${OS} STREQUAL "nuttx") - add_subdirectory(src) -else(${OS} STREQUAL "nuttx") - set(module_list) - px4_target_add_modules(module_list) -endif() +add_subdirectory(src) #============================================================================= # packaging diff --git a/cmake/Toolchain-hexagon.cmake b/cmake/Toolchain-hexagon.cmake index 82f6f19ab1..5e5805ba46 100644 --- a/cmake/Toolchain-hexagon.cmake +++ b/cmake/Toolchain-hexagon.cmake @@ -32,7 +32,7 @@ include(CMakeForceCompiler) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -include(px4_utils) +include(px4_base) if(NOT HEXAGON_TOOLS_ROOT) set(HEXAGON_TOOLS_ROOT /opt/6.4.05) diff --git a/cmake/px4_impl_qurt.cmake b/cmake/px4_impl_qurt.cmake new file mode 100644 index 0000000000..7748ff2ecf --- /dev/null +++ b/cmake/px4_impl_qurt.cmake @@ -0,0 +1,259 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + + +#============================================================================= +# +# Defined functions in this file +# +# OS Specific Functions +# +# * px4_qurt_add_firmware +# * px4_qurt_generate_builtin_commands +# * px4_qurt_add_export +# * px4_qurt_generate_romfs +# +# Required OS Inteface Functions +# +# * px4_os_add_flags +# * px4_os_prebuild_targets +# + +include(px4_base) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt/configs) +include(qurt_funcs) + +#============================================================================= +# +# px4_qurt_generate_builtin_commands +# +# This function generates the builtin_commands.c src for qurt +# +# Usage: +# px4_qurt_generate_builtin_commands( +# MODULE_LIST +# OUT ) +# +# Input: +# MODULE_LIST : list of modules +# +# Output: +# OUT : generated builtin_commands.c src +# +# Example: +# px4_qurt_generate_builtin_commands( +# OUT MODULE_LIST px4_simple_app) +# +function(px4_qurt_generate_builtin_commands) + px4_parse_function_args( + NAME px4_qurt_generate_builtin_commands + ONE_VALUE OUT + MULTI_VALUE MODULE_LIST + REQUIRED MODULE_LIST OUT + ARGN ${ARGN}) + set(builtin_apps_string) + set(builtin_apps_decl_string) + set(command_count 0) + foreach(module ${MODULE_LIST}) + # default + set(MAIN_DEFAULT MAIN-NOTFOUND) + set(STACK_DEFAULT 1024) + set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT) + foreach(property MAIN STACK PRIORITY) + get_target_property(${property} ${module} ${property}) + if(NOT ${property}) + set(${property} ${${property}_DEFAULT}) + endif() + endforeach() + if (MAIN) + set(builtin_apps_string + "${builtin_apps_string}\t{\"${MAIN}\", ${PRIORITY}, ${STACK}, ${MAIN}_main},\n") + set(builtin_apps_decl_string + "${builtin_apps_decl_string}extern int ${MAIN}_main(int argc, char *argv[]);\n") + math(EXPR command_count "${command_count}+1") + endif() + endforeach() + configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.cmake + ${OUT}) +endfunction() + +#============================================================================= +# +# px4_os_add_flags +# +# Set ths qurt build flags. +# +# Usage: +# px4_os_add_flags( +# C_FLAGS +# CXX_FLAGS +# EXE_LINKER_FLAGS +# INCLUDE_DIRS +# LINK_DIRS +# DEFINITIONS ) +# +# Input: +# BOARD : flags depend on board/qurt config +# +# Input/Output: (appends to existing variable) +# C_FLAGS : c compile flags variable +# CXX_FLAGS : c++ compile flags variable +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories +# LINK_DIRS : link directories +# DEFINITIONS : definitions +# +# Example: +# px4_os_add_flags( +# C_FLAGS CMAKE_C_FLAGS +# CXX_FLAGS CMAKE_CXX_FLAGS +# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS +# INCLUDES ) +# +function(px4_os_add_flags) + + set(inout_vars + C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) + + px4_parse_function_args( + NAME px4_add_flags + ONE_VALUE ${inout_vars} BOARD + REQUIRED ${inout_vars} BOARD + ARGN ${ARGN}) + + px4_add_common_flags( + BOARD ${BOARD} + C_FLAGS ${C_FLAGS} + CXX_FLAGS ${CXX_FLAGS} + EXE_LINKER_FLAGS ${EXE_LINKER_FLAGS} + INCLUDE_DIRS ${INCLUDE_DIRS} + LINK_DIRS ${LINK_DIRS} + DEFINITIONS ${DEFINITIONS}) + + set(DSPAL_ROOT src/lib/dspal) + set(added_include_dirs + ${DSPAL_ROOT}/include + ${DSPAL_ROOT}/sys + ${DSPAL_ROOT}/sys/sys + ${DSPAL_ROOT}/mpu_spi/inc + ${DSPAL_ROOT}/uart_esc/inc + src/platforms/qurt/include + src/platforms/posix/include + src/lib/eigen-3.2 + ) + + set(added_definitions + -D__PX4_QURT + -D__PX4_POSIX + -include ${PX4_INCLUDE_DIR}visibility.h + ) + + # Add the toolchain specific flags + set(added_cflags ${QURT_CMAKE_C_FLAGS}) + set(added_cxx_flags ${QURT_CMAKE_CXX_FLAGS}) + + # FIXME @jgoppert - how to work around issues like this? + # Without changing global variables? + # Clear -rdynamic flag which fails for hexagon + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") + set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") + + # output + foreach(var ${inout_vars}) + string(TOLOWER ${var} lower_var) + set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) + #message(STATUS "qurt: set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") + endforeach() + +endfunction() + +#============================================================================= +# +# px4_os_prebuild_targets +# +# This function generates os dependent targets +# +# Usage: +# px4_os_prebuild_targets( +# OUT +# BOARD +# ) +# +# Input: +# BOARD : board +# THREADS : number of threads for building +# +# Output: +# OUT : the target list +# +# Example: +# px4_os_prebuild_targets(OUT target_list BOARD px4fmu-v2) +# +function(px4_os_prebuild_targets) + px4_parse_function_args( + NAME px4_os_prebuild_targets + ONE_VALUE OUT BOARD THREADS + REQUIRED OUT BOARD + ARGN ${ARGN}) +endfunction() + +#============================================================================= +# +# px4_qurt_add_modules +# +# This function adds target modules +# +# Usage: +# px4_os_prebuild_targets( +# OUT +# BOARD +# ) +# +# Input: +# BOARD : board +# +# Output: +# MODULE_LIST : the updated module list +# +# Example: +# px4_qurt_add_modules(MODULE_LIST module_list BOARD hil) +# +function(px4_qurt_add_modules out_modules BOARD) + include(config-qurt-${BOARD}) + set(config_modules) + px4_set_config_modules(config_modules) + set(${out_modules} ${out_modules} ${config_modules} PARENT_SCOPE) +endfunction() + +# vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/qurt/configs/config-qurt-hil.cmake b/cmake/qurt/configs/config-qurt-hil.cmake new file mode 100644 index 0000000000..6c68043868 --- /dev/null +++ b/cmake/qurt/configs/config-qurt-hil.cmake @@ -0,0 +1,85 @@ +function(px4_set_config_modules out_module_list) + set(config_module_list + drivers/device + drivers/boards/sitl + drivers/pwm_out_sim + drivers/led + drivers/rgbled + modules/sensors + + # drivers/blinkm + # drivers/ms5611 + + # + # System commands + # + systemcmds/param + systemcmds/mixer + + # + # General system control + # + # modules/mavlink + + # + # Estimation modules (EKF/ SO3 / other filters) + # + # modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator + modules/attitude_estimator_q + modules/position_estimator_inav + + # + # Vehicle Control + # + modules/mc_att_control + modules/mc_pos_control + + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/uORB + #MODULES += modules/dataman + #MODULES += modules/sdlog2 + #MODULES += modules/simulator + modules/commander + + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + modules/controllib + + # + # QuRT port + # + platforms/qurt/px4_layer + platforms/posix/work_queue + # platforms/posix/drivers/accelsim + # platforms/posix/drivers/gyrosim + # platforms/posix/drivers/adcsim + # platforms/posix/drivers/barosim + + # + # Unit tests + # + # platforms/qurt/tests/muorb + # platforms/posix/tests/vcdev_test + # platforms/posix/tests/hrt_test + # platforms/posix/tests/wqueue + + # + # sources for muorb over fastrpc + # + modules/muorb/adsp/ + ) + message(STATUS "modules: ${config_module_list}") + set(${out_module_list} ${config_module_list} PARENT_SCOPE) +endfunction() + diff --git a/cmake/qurt/px4_target_impl.cmake b/cmake/qurt/qurt_funcs.cmake similarity index 72% rename from cmake/qurt/px4_target_impl.cmake rename to cmake/qurt/qurt_funcs.cmake index 1dad68331d..c8a2f46a9f 100644 --- a/cmake/qurt/px4_target_impl.cmake +++ b/cmake/qurt/qurt_funcs.cmake @@ -50,51 +50,6 @@ set(QURT_APPS_HEADER ${CMAKE_BINARY_DIR}/apps.h) px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") -function(px4_target_set_flags) - set(inout_vars - C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) - - px4_parse_function_args( - NAME px4_target_set_flags - ONE_VALUE ${inout_vars} BOARD - REQUIRED ${inout_vars} BOARD - ARGN ${ARGN}) - - set(DSPAL_ROOT src/lib/dspal) - set(added_include_dirs - ${DSPAL_ROOT}/include - ${DSPAL_ROOT}/sys - ${DSPAL_ROOT}/sys/sys - ${DSPAL_ROOT}/mpu_spi/inc - ${DSPAL_ROOT}/uart_esc/inc - src/platforms/qurt/include - src/platforms/posix/include - src/lib/eigen-3.2 - ) - - set(added_definitions - -D__PX4_QURT - -D__PX4_POSIX - -include ${PX4_INCLUDE_DIR}visibility.h - ) - - # Add the toolchain specific flags - set(added_cflags ${QURT_CMAKE_C_FLAGS}) - set(added_cxx_flags ${QURT_CMAKE_CXX_FLAGS}) - - # FIXME @jgoppert - how to work around issues like this? - # Without changing global variables? - # Clear -rdynamic flag which fails for hexagon - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") - set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - - # output - foreach(var ${inout_vars}) - string(TOLOWER ${var} lower_var) - set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) - endforeach() -endfunction() - function(px4_target_add_modules out_module_directories) list(APPEND ${out_module_directories} ./src/platforms/qurt/px4_layer @@ -107,7 +62,7 @@ function(px4_target_validate_config) # FIXME - this can be done in Firmware/CMakeLists.txt list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) - if (NOT EXISTS("${CMAKE_SOURCE_DIR}/cmake/qurt/${TARGET_NAME}.cmake") + if (NOT EXISTS("${CMAKE_SOURCE_DIR}/cmake/qurt/${TARGET_NAME}.cmake")) message(FATAL_ERROR "not implemented yet: ${TARGET_NAME}") endif() endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9371c39084..a019156921 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,35 +1,35 @@ -#============================================================================= -# module subdirectories, need to include first -# -add_subdirectory(./lib) -add_subdirectory(./drivers) -add_subdirectory(./platforms) -add_subdirectory(./systemcmds) -add_subdirectory(./examples) -add_subdirectory(./modules) - #============================================================================= # executable # -# a list of modules that will be linked to main -set(module_list) - -if (${LABEL} STREQUAL "simple") - list(APPEND module_list - drivers__led - drivers__device - platforms__common - modules__systemlib - modules__uORB - examples__px4_simple_app - lib__mathlib__math__filter - lib__conversion - ) -endif() - if (${OS} STREQUAL "nuttx") + #============================================================================= + # module subdirectories, need to include first + # + add_subdirectory(./lib) + add_subdirectory(./drivers) + add_subdirectory(./platforms) + add_subdirectory(./systemcmds) + add_subdirectory(./examples) + add_subdirectory(./modules) + + # a list of modules that will be linked to main + set(module_list) + + if (${LABEL} STREQUAL "simple") + list(APPEND module_list + drivers__led + drivers__device + platforms__common + modules__systemlib + modules__uORB + examples__px4_simple_app + lib__mathlib__math__filter + lib__conversion + ) + endif() + if (${LABEL} STREQUAL "simple") list(APPEND module_list ${module_list_simple}) endif() @@ -70,6 +70,16 @@ if (${OS} STREQUAL "nuttx") px4_nuttx_generate_romfs(OUT ${CMAKE_CURRENT_BINARY_DIR}/romfs.img ROOT ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common) +elseif(${OS} STREQUAL "qurt") + set(module_list) + px4_qurt_add_modules(module_list ${BOARD}) + message(STATUS "module list: ${module_list}") + + px4_qurt_generate_builtin_commands( + OUT builtin_commands.c + MODULE_LIST ${module_list}) + + add_executable(mainapp builtin_commands.c) endif() # vim: set noet ft=cmake fenc=utf-8 ff=unix : From bf9e541d19b7864c149773fad984cb72740bced1 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 04:17:54 -0400 Subject: [PATCH 010/389] Got romfs generation working. --- CMakeLists.txt | 17 ++++- cmake/Toolchain-arm-none-eabi.cmake | 4 +- cmake/px4_impl_nuttx.cmake | 98 +++++++++++++++++++++++------ src/CMakeLists.txt | 8 +-- 4 files changed, 100 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe287e7761..c445b7788f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,12 +109,20 @@ set(package-contact "px4users@googlegroups.com") # cmake modules # +# set module path list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -if (EXISTS px4_impl_${OS}_${BOARD}) - include(px4_impl_${OS}_${BOARD}) + +# prefer board implementation module over os implmementation module +set(board_impl_module px4_impl_${OS}_${BOARD}) +set(os_impl_module px4_impl_${OS}) +if (EXISTS ${board_impl_module}) + set(impl_module ${board_impl_module}) else() - include(px4_impl_${OS}) + set(impl_module ${os_impl_module}) endif() +include(${impl_module}) + +# require px4 module interface set(px4_required_functions px4_os_prebuild_targets px4_os_add_flags @@ -125,6 +133,9 @@ foreach(cmd ${px4_required_functions}) endif() endforeach() +# other modules +enable_testing() + #============================================================================= # parameters # diff --git a/cmake/Toolchain-arm-none-eabi.cmake b/cmake/Toolchain-arm-none-eabi.cmake index 9587705b32..13514080ad 100644 --- a/cmake/Toolchain-arm-none-eabi.cmake +++ b/cmake/Toolchain-arm-none-eabi.cmake @@ -41,12 +41,12 @@ foreach(tool objcopy nm ld) string(TOUPPER ${tool} TOOL) find_program(${TOOL} arm-none-eabi-${tool}) if(NOT ${TOOL}) - message(FATAL_ERROR "could not find ${TOOL}") + message(FATAL_ERROR "could not find ${tool}") endif() endforeach() # os tools -foreach(tool grep rm nm genromfs) +foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip) string(TOUPPER ${tool} TOOL) find_program(${TOOL} ${tool}) if(NOT ${TOOL}) diff --git a/cmake/px4_impl_nuttx.cmake b/cmake/px4_impl_nuttx.cmake index ef704f1ec2..6d44c16b9b 100644 --- a/cmake/px4_impl_nuttx.cmake +++ b/cmake/px4_impl_nuttx.cmake @@ -42,6 +42,7 @@ # * px4_nuttx_generate_builtin_commands # * px4_nuttx_add_export # * px4_nuttx_generate_romfs +# * px4_bin_to_obj # # Required OS Inteface Functions # @@ -187,8 +188,8 @@ function(px4_nuttx_add_export) string(REPLACE "/" "_" patch_name "${patch}-${CONFIG}") message(STATUS "nuttx-patch: ${patch}") add_custom_command(OUTPUT nuttx_patch_${patch_name}.stamp - COMMAND patch -p0 -N < ${CMAKE_SOURCE_DIR}/${patch} - COMMAND touch nuttx_patch_${patch_name}.stamp + COMMAND ${PATCH} -p0 -N < ${CMAKE_SOURCE_DIR}/${patch} + COMMAND ${TOUCH} nuttx_patch_${patch_name}.stamp DEPENDS ${DEPENDS} ) add_custom_target(nuttx_patch_${patch_name} @@ -198,35 +199,35 @@ function(px4_nuttx_add_export) # copy add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp - COMMAND mkdir -p ${CMAKE_BINARY_DIR}/${CONFIG} - COMMAND cp -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src} - COMMAND rm -rf ${nuttx_src}/.git - COMMAND touch nuttx_copy_${CONFIG}.stamp + COMMAND ${MKDIR} -p ${CMAKE_BINARY_DIR}/${CONFIG} + COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src} + COMMAND ${RM} -rf ${nuttx_src}/.git + COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp DEPENDS ${DEPENDS}) add_custom_target(__nuttx_copy_${CONFIG} DEPENDS nuttx_copy_${CONFIG}.stamp __nuttx_patch_${CONFIG}) # export add_custom_command(OUTPUT ${CONFIG}.export - COMMAND echo Configuring NuttX for ${CONFIG} - COMMAND make -C${nuttx_src}/nuttx -j${THREADS} + COMMAND ${ECHO} Configuring NuttX for ${CONFIG} + COMMAND ${MAKE} -C${nuttx_src}/nuttx -j${THREADS} -r --quiet distclean - COMMAND cp -r ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG} + COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG} ${nuttx_src}/nuttx/configs COMMAND cd ${nuttx_src}/nuttx/tools && ./configure.sh ${CONFIG}/nsh - COMMAND echo Exporting NuttX for ${CONFIG} - COMMAND make -C ${nuttx_src}/nuttx -j${THREADS} + COMMAND ${ECHO} Exporting NuttX for ${CONFIG} + COMMAND ${MAKE} -C ${nuttx_src}/nuttx -j${THREADS} -r CONFIG_ARCH_BOARD=${CONFIG} export - COMMAND cp -r ${nuttx_src}/nuttx/nuttx-export.zip + COMMAND ${CP} -r ${nuttx_src}/nuttx/nuttx-export.zip ${CONFIG}.export DEPENDS ${DEPENDS} __nuttx_copy_${CONFIG}) # extract add_custom_command(OUTPUT nuttx_export_${BOARD}.stamp - COMMAND rm -rf ${nuttx_src}/nuttx-export - COMMAND unzip ${BOARD}.export -d ${nuttx_src} - COMMAND touch nuttx_export_${BOARD}.stamp + COMMAND ${RM} -rf ${nuttx_src}/nuttx-export + COMMAND ${UNZIP} ${BOARD}.export -d ${nuttx_src} + COMMAND ${TOUCH} nuttx_export_${BOARD}.stamp DEPENDS ${DEPENDS} ${BOARD}.export) add_custom_target(${OUT} @@ -234,6 +235,63 @@ function(px4_nuttx_add_export) endfunction() +#============================================================================= +# +# px4_bin_to_obj +# +# The functions create an object file from a binary image. +# +# Usage: +# px4_bin_to_boj(OBJ VAR BIN ) +# +# Input: +# BIN : the bin file +# VAR : the variable name +# +# Output: +# OBJ : the object file +# +# Example: +# px4_bin_to_obj(OBJ my_obj VAR romfs BIN my_bin) +# +function(px4_bin_to_obj) + + px4_parse_function_args( + NAME px4_bin_to_obj + ONE_VALUE BIN OBJ VAR + REQUIRED BIN OBJ VAR + ARGN ${ARGN}) + + string(REPLACE "/" " " _tmp ${BIN}) + string(REPLACE "/" " " sym ${_tmp}) + message(STATUS "sym: ${sym}") + + separate_arguments(CMAKE_C_FLAGS) + + add_custom_command(OUTPUT ${OBJ} + COMMAND ${TOUCH} ${OBJ}.c + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c ${OBJ}.c -o ${OBJ}.c.o + COMMAND ${LD} -r -o ${OBJ}.bin.o ${OBJ}.c.o -b binary ${BIN} + COMMAND ${NM} -p --radix=x ${OBJ}.bin.o + | ${GREP} ${sym}_size + | ${GREP} -o ^[0-9a-fA-F]* + | ${AWK} "{print \"const unsigned int ${VAR}_len = 0x\"$1\";\"}" > ${OBJ}.c + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c ${OBJ}.c -o ${OBJ}.c.o + COMMAND ${LD} -r -o ${OBJ} ${OBJ}.c.o ${OBJ}.bin.o + COMMAND ${OBJCOPY} ${OBJ} + --redefine-sym ${sym}_start=${VAR} + --strip-symbol ${sym}_size + --strip-symbol ${sym}_end + --rename-section .data=.rodata + COMMAND ${RM} ${OBJ}.c ${OBJ}.c.o ${OBJ}.bin.o + DEPENDS ${BIN} + VERBATIM + ) + + set(${OBJ} ${OBJ} PARENT_SCOPE) + +endfunction() + #============================================================================= # # px4_nuttx_generate_romfs @@ -264,15 +322,19 @@ function(px4_nuttx_generate_romfs) set(romfs_temp_dir ${CMAKE_BINARY_DIR}/${ROOT}) set(romfs_src_dir ${CMAKE_SOURCE_DIR}/${ROOT}) - add_custom_command(OUTPUT ${OUT} + add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} #TODO add romfs cleanup and pruning - COMMAND ${GENROMFS} -f ${OUT} -d ${romfs_temp_dir} -V "NSHInitVol" + COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin + -d ${romfs_temp_dir} -V "NSHInitVol" DEPENDS ${romfs_files} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) - add_custom_target(gen_romfs DEPENDS ${OUT}) + + px4_bin_to_obj(OBJ ${OUT} + BIN ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin + VAR romfs) endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9371c39084..6bf6b25bf7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,8 +45,11 @@ if (${OS} STREQUAL "nuttx") OUT builtin_commands.c MODULE_LIST ${module_list}) + px4_nuttx_generate_romfs(OUT romfs.o + ROOT ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common) + # add executable - add_executable(main builtin_commands.c) + add_executable(main builtin_commands.c romfs.o) set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) set(main_link_flags "-T${nuttx_export_dir}/build/ld.script" @@ -67,9 +70,6 @@ if (${OS} STREQUAL "nuttx") px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) - px4_nuttx_generate_romfs(OUT ${CMAKE_CURRENT_BINARY_DIR}/romfs.img - ROOT ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common) - endif() # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 34f00ede4dc380a29989c3ac7a66a6e9cbdf1bcf Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 04:20:48 -0400 Subject: [PATCH 011/389] Merge. --- CMakeLists.txt | 5 + cmake/Toolchain-hexagon.cmake | 2 +- cmake/px4_impl_qurt.cmake | 259 ++++++++++++++++++ cmake/qurt/configs/config-qurt-hil.cmake | 85 ++++++ ...px4_target_impl.cmake => qurt_funcs.cmake} | 68 ++--- src/CMakeLists.txt | 65 +++-- 6 files changed, 407 insertions(+), 77 deletions(-) create mode 100644 cmake/px4_impl_qurt.cmake create mode 100644 cmake/qurt/configs/config-qurt-hil.cmake rename cmake/qurt/{px4_target_impl.cmake => qurt_funcs.cmake} (67%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c445b7788f..806809ce11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,12 +168,16 @@ endforeach() #============================================================================= # git # +if(${OS} STREQUAL "nuttx") px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +endif() px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") +if(NOT ${OS} STREQUAL "nuttx") px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") +endif() add_custom_target(submodule_clean WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} @@ -199,6 +203,7 @@ px4_os_add_flags( INCLUDE_DIRS include_dirs LINK_DIRS link_dirs DEFINITIONS definitions) + px4_join(OUT CMAKE_EXE_LINKER_FLAGS LIST "${exe_linker_flags}" GLUE " ") px4_join(OUT CMAKE_C_FLAGS LIST "${c_flags}" GLUE " ") px4_join(OUT CMAKE_CXX_FLAGS LIST "${cxx_flags}" GLUE " ") diff --git a/cmake/Toolchain-hexagon.cmake b/cmake/Toolchain-hexagon.cmake index 82f6f19ab1..5e5805ba46 100644 --- a/cmake/Toolchain-hexagon.cmake +++ b/cmake/Toolchain-hexagon.cmake @@ -32,7 +32,7 @@ include(CMakeForceCompiler) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -include(px4_utils) +include(px4_base) if(NOT HEXAGON_TOOLS_ROOT) set(HEXAGON_TOOLS_ROOT /opt/6.4.05) diff --git a/cmake/px4_impl_qurt.cmake b/cmake/px4_impl_qurt.cmake new file mode 100644 index 0000000000..7748ff2ecf --- /dev/null +++ b/cmake/px4_impl_qurt.cmake @@ -0,0 +1,259 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + + +#============================================================================= +# +# Defined functions in this file +# +# OS Specific Functions +# +# * px4_qurt_add_firmware +# * px4_qurt_generate_builtin_commands +# * px4_qurt_add_export +# * px4_qurt_generate_romfs +# +# Required OS Inteface Functions +# +# * px4_os_add_flags +# * px4_os_prebuild_targets +# + +include(px4_base) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt/configs) +include(qurt_funcs) + +#============================================================================= +# +# px4_qurt_generate_builtin_commands +# +# This function generates the builtin_commands.c src for qurt +# +# Usage: +# px4_qurt_generate_builtin_commands( +# MODULE_LIST +# OUT ) +# +# Input: +# MODULE_LIST : list of modules +# +# Output: +# OUT : generated builtin_commands.c src +# +# Example: +# px4_qurt_generate_builtin_commands( +# OUT MODULE_LIST px4_simple_app) +# +function(px4_qurt_generate_builtin_commands) + px4_parse_function_args( + NAME px4_qurt_generate_builtin_commands + ONE_VALUE OUT + MULTI_VALUE MODULE_LIST + REQUIRED MODULE_LIST OUT + ARGN ${ARGN}) + set(builtin_apps_string) + set(builtin_apps_decl_string) + set(command_count 0) + foreach(module ${MODULE_LIST}) + # default + set(MAIN_DEFAULT MAIN-NOTFOUND) + set(STACK_DEFAULT 1024) + set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT) + foreach(property MAIN STACK PRIORITY) + get_target_property(${property} ${module} ${property}) + if(NOT ${property}) + set(${property} ${${property}_DEFAULT}) + endif() + endforeach() + if (MAIN) + set(builtin_apps_string + "${builtin_apps_string}\t{\"${MAIN}\", ${PRIORITY}, ${STACK}, ${MAIN}_main},\n") + set(builtin_apps_decl_string + "${builtin_apps_decl_string}extern int ${MAIN}_main(int argc, char *argv[]);\n") + math(EXPR command_count "${command_count}+1") + endif() + endforeach() + configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.cmake + ${OUT}) +endfunction() + +#============================================================================= +# +# px4_os_add_flags +# +# Set ths qurt build flags. +# +# Usage: +# px4_os_add_flags( +# C_FLAGS +# CXX_FLAGS +# EXE_LINKER_FLAGS +# INCLUDE_DIRS +# LINK_DIRS +# DEFINITIONS ) +# +# Input: +# BOARD : flags depend on board/qurt config +# +# Input/Output: (appends to existing variable) +# C_FLAGS : c compile flags variable +# CXX_FLAGS : c++ compile flags variable +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories +# LINK_DIRS : link directories +# DEFINITIONS : definitions +# +# Example: +# px4_os_add_flags( +# C_FLAGS CMAKE_C_FLAGS +# CXX_FLAGS CMAKE_CXX_FLAGS +# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS +# INCLUDES ) +# +function(px4_os_add_flags) + + set(inout_vars + C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) + + px4_parse_function_args( + NAME px4_add_flags + ONE_VALUE ${inout_vars} BOARD + REQUIRED ${inout_vars} BOARD + ARGN ${ARGN}) + + px4_add_common_flags( + BOARD ${BOARD} + C_FLAGS ${C_FLAGS} + CXX_FLAGS ${CXX_FLAGS} + EXE_LINKER_FLAGS ${EXE_LINKER_FLAGS} + INCLUDE_DIRS ${INCLUDE_DIRS} + LINK_DIRS ${LINK_DIRS} + DEFINITIONS ${DEFINITIONS}) + + set(DSPAL_ROOT src/lib/dspal) + set(added_include_dirs + ${DSPAL_ROOT}/include + ${DSPAL_ROOT}/sys + ${DSPAL_ROOT}/sys/sys + ${DSPAL_ROOT}/mpu_spi/inc + ${DSPAL_ROOT}/uart_esc/inc + src/platforms/qurt/include + src/platforms/posix/include + src/lib/eigen-3.2 + ) + + set(added_definitions + -D__PX4_QURT + -D__PX4_POSIX + -include ${PX4_INCLUDE_DIR}visibility.h + ) + + # Add the toolchain specific flags + set(added_cflags ${QURT_CMAKE_C_FLAGS}) + set(added_cxx_flags ${QURT_CMAKE_CXX_FLAGS}) + + # FIXME @jgoppert - how to work around issues like this? + # Without changing global variables? + # Clear -rdynamic flag which fails for hexagon + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") + set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") + + # output + foreach(var ${inout_vars}) + string(TOLOWER ${var} lower_var) + set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) + #message(STATUS "qurt: set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") + endforeach() + +endfunction() + +#============================================================================= +# +# px4_os_prebuild_targets +# +# This function generates os dependent targets +# +# Usage: +# px4_os_prebuild_targets( +# OUT +# BOARD +# ) +# +# Input: +# BOARD : board +# THREADS : number of threads for building +# +# Output: +# OUT : the target list +# +# Example: +# px4_os_prebuild_targets(OUT target_list BOARD px4fmu-v2) +# +function(px4_os_prebuild_targets) + px4_parse_function_args( + NAME px4_os_prebuild_targets + ONE_VALUE OUT BOARD THREADS + REQUIRED OUT BOARD + ARGN ${ARGN}) +endfunction() + +#============================================================================= +# +# px4_qurt_add_modules +# +# This function adds target modules +# +# Usage: +# px4_os_prebuild_targets( +# OUT +# BOARD +# ) +# +# Input: +# BOARD : board +# +# Output: +# MODULE_LIST : the updated module list +# +# Example: +# px4_qurt_add_modules(MODULE_LIST module_list BOARD hil) +# +function(px4_qurt_add_modules out_modules BOARD) + include(config-qurt-${BOARD}) + set(config_modules) + px4_set_config_modules(config_modules) + set(${out_modules} ${out_modules} ${config_modules} PARENT_SCOPE) +endfunction() + +# vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/qurt/configs/config-qurt-hil.cmake b/cmake/qurt/configs/config-qurt-hil.cmake new file mode 100644 index 0000000000..6c68043868 --- /dev/null +++ b/cmake/qurt/configs/config-qurt-hil.cmake @@ -0,0 +1,85 @@ +function(px4_set_config_modules out_module_list) + set(config_module_list + drivers/device + drivers/boards/sitl + drivers/pwm_out_sim + drivers/led + drivers/rgbled + modules/sensors + + # drivers/blinkm + # drivers/ms5611 + + # + # System commands + # + systemcmds/param + systemcmds/mixer + + # + # General system control + # + # modules/mavlink + + # + # Estimation modules (EKF/ SO3 / other filters) + # + # modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator + modules/attitude_estimator_q + modules/position_estimator_inav + + # + # Vehicle Control + # + modules/mc_att_control + modules/mc_pos_control + + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/uORB + #MODULES += modules/dataman + #MODULES += modules/sdlog2 + #MODULES += modules/simulator + modules/commander + + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + modules/controllib + + # + # QuRT port + # + platforms/qurt/px4_layer + platforms/posix/work_queue + # platforms/posix/drivers/accelsim + # platforms/posix/drivers/gyrosim + # platforms/posix/drivers/adcsim + # platforms/posix/drivers/barosim + + # + # Unit tests + # + # platforms/qurt/tests/muorb + # platforms/posix/tests/vcdev_test + # platforms/posix/tests/hrt_test + # platforms/posix/tests/wqueue + + # + # sources for muorb over fastrpc + # + modules/muorb/adsp/ + ) + message(STATUS "modules: ${config_module_list}") + set(${out_module_list} ${config_module_list} PARENT_SCOPE) +endfunction() + diff --git a/cmake/qurt/px4_target_impl.cmake b/cmake/qurt/qurt_funcs.cmake similarity index 67% rename from cmake/qurt/px4_target_impl.cmake rename to cmake/qurt/qurt_funcs.cmake index d9d5a65728..c8a2f46a9f 100644 --- a/cmake/qurt/px4_target_impl.cmake +++ b/cmake/qurt/qurt_funcs.cmake @@ -47,66 +47,34 @@ # set(QURT_APPS_HEADER ${CMAKE_BINARY_DIR}/apps.h) -add_git_submodule(dspal src/lib/dspal) -add_git_submodule(eigen src/lib/eigen-3.2) +px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") +px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") -macro(px4_target_set_flags) - list(APPEND EXE_LINK_LIBS - pthread - ) - set(DSPAL_ROOT src/lib/dspal) - include_directories( - ${DSPAL_ROOT}/include - ${DSPAL_ROOT}/sys - ${DSPAL_ROOT}/sys/sys - ${DSPAL_ROOT}/mpu_spi/inc - ${DSPAL_ROOT}/uart_esc/inc - src/platforms/qurt/include - src/platforms/posix/include - src/lib/eigen-3.2 - ) - add_definitions( - -D__PX4_QURT - -D__PX4_POSIX - -include ${PX4_INCLUDE_DIR}visibility.h - ) - - # Add the toolchain specific flags - set(CMAKE_C_FLAGS ${QURT_CMAKE_C_FLAGS}) - set(CMAKE_CXX_FLAGS ${QURT_CMAKE_CXX_FLAGS}) - set(CMAKE_SHARED_LINKER_FLAGS "") - - message(STATUS "CMAKE_C_FLAGS: -${CMAKE_C_FLAGS}-") - message(STATUS "CMAKE_CXX_FLAGS: -${CMAKE_CXX_FLAGS}-") - - # Clear -rdynamic flag which fails for hexagon - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") - set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -endmacro() - -macro(px4_target_set_modules) - list(APPEND module_directories +function(px4_target_add_modules out_module_directories) + list(APPEND ${out_module_directories} ./src/platforms/qurt/px4_layer ./src/platforms/posix/work_queue + PARENT_SCOPE ) -endmacro() +endfunction() -macro(px4_target_validate_config) - if (${TARGET_NAME} STREQUAL "qurt-hil-simple") - else() +function(px4_target_validate_config) + # FIXME - this can be done in Firmware/CMakeLists.txt + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) + + if (NOT EXISTS("${CMAKE_SOURCE_DIR}/cmake/qurt/${TARGET_NAME}.cmake")) message(FATAL_ERROR "not implemented yet: ${TARGET_NAME}") endif() -endmacro() +endfunction() -macro(px4_target_firmware) +function(px4_target_firmware) set(installed_targets) add_library(dspal_main SHARED ./src/platforms/qurt/px4_layer/main.cpp) target_link_libraries(dspal_main ${module_list}) list(APPEND installed_targets dspal_main) -endmacro() +endfunction() -macro(px4_target_rules) +function(px4_target_rules) #============================================================================= # apps # @@ -118,7 +86,7 @@ macro(px4_target_rules) ) add_custom_target(qurt_apps DEPENDS ${QURT_APPS_HEADER}) -endmacro() +endfunction() -macro(px4_target_testing) -endmacro() +function(px4_target_testing) +endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6bf6b25bf7..647797b304 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,35 +1,35 @@ -#============================================================================= -# module subdirectories, need to include first -# -add_subdirectory(./lib) -add_subdirectory(./drivers) -add_subdirectory(./platforms) -add_subdirectory(./systemcmds) -add_subdirectory(./examples) -add_subdirectory(./modules) - #============================================================================= # executable # -# a list of modules that will be linked to main -set(module_list) - -if (${LABEL} STREQUAL "simple") - list(APPEND module_list - drivers__led - drivers__device - platforms__common - modules__systemlib - modules__uORB - examples__px4_simple_app - lib__mathlib__math__filter - lib__conversion - ) -endif() - if (${OS} STREQUAL "nuttx") + #============================================================================= + # module subdirectories, need to include first + # + add_subdirectory(./lib) + add_subdirectory(./drivers) + add_subdirectory(./platforms) + add_subdirectory(./systemcmds) + add_subdirectory(./examples) + add_subdirectory(./modules) + + # a list of modules that will be linked to main + set(module_list) + + if (${LABEL} STREQUAL "simple") + list(APPEND module_list + drivers__led + drivers__device + platforms__common + modules__systemlib + modules__uORB + examples__px4_simple_app + lib__mathlib__math__filter + lib__conversion + ) + endif() + if (${LABEL} STREQUAL "simple") list(APPEND module_list ${module_list_simple}) endif() @@ -70,6 +70,19 @@ if (${OS} STREQUAL "nuttx") px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) + px4_nuttx_generate_romfs(OUT ${CMAKE_CURRENT_BINARY_DIR}/romfs.img + ROOT ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common) + +elseif(${OS} STREQUAL "qurt") + set(module_list) + px4_qurt_add_modules(module_list ${BOARD}) + message(STATUS "module list: ${module_list}") + + px4_qurt_generate_builtin_commands( + OUT builtin_commands.c + MODULE_LIST ${module_list}) + + add_executable(mainapp builtin_commands.c) endif() # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 387e504ea27c06a363e41c580849ddfd833c4c19 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 04:22:38 -0400 Subject: [PATCH 012/389] Removed git if blocks, modules don't clone unless dep. added. --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 806809ce11..e8c5610066 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,7 @@ set(px4_required_functions ) foreach(cmd ${px4_required_functions}) if(NOT COMMAND ${cmd}) - message(FATAL_ERROR "cmake/px4_${OS}_utils.cmake must implement ${cmd}") + message(FATAL_ERROR "cmake/${impl_module} must implement ${cmd}") endif() endforeach() @@ -168,16 +168,12 @@ endforeach() #============================================================================= # git # -if(${OS} STREQUAL "nuttx") px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") -endif() px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") -if(NOT ${OS} STREQUAL "nuttx") px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") -endif() add_custom_target(submodule_clean WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} From b7850fc319d88021c68d37fd57b8b4b852078fa5 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 04:57:45 -0400 Subject: [PATCH 013/389] Fixed romfs building. --- cmake/builtin_commands.c.cmake | 2 -- cmake/px4_impl_nuttx.cmake | 12 +++++++----- src/CMakeLists.txt | 3 --- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cmake/builtin_commands.c.cmake b/cmake/builtin_commands.c.cmake index 09c611d0dd..53c69b98ef 100644 --- a/cmake/builtin_commands.c.cmake +++ b/cmake/builtin_commands.c.cmake @@ -2,8 +2,6 @@ #include #include #include -uint8_t romfs_img_len = 0; -uint8_t romfs_img[] = {}; ${builtin_apps_decl_string} const struct builtin_s g_builtins[] = { ${builtin_apps_string} diff --git a/cmake/px4_impl_nuttx.cmake b/cmake/px4_impl_nuttx.cmake index 6d44c16b9b..ec7019a231 100644 --- a/cmake/px4_impl_nuttx.cmake +++ b/cmake/px4_impl_nuttx.cmake @@ -262,14 +262,15 @@ function(px4_bin_to_obj) REQUIRED BIN OBJ VAR ARGN ${ARGN}) - string(REPLACE "/" " " _tmp ${BIN}) - string(REPLACE "/" " " sym ${_tmp}) - message(STATUS "sym: ${sym}") + string(REPLACE "/" "_" _tmp ${BIN}) + string(REPLACE "." "_" _tmp ${_tmp}) + string(REPLACE "-" "_" sym "_binary_${_tmp}") + #message(STATUS "sym: ${sym}") separate_arguments(CMAKE_C_FLAGS) add_custom_command(OUTPUT ${OBJ} - COMMAND ${TOUCH} ${OBJ}.c + COMMAND ${ECHO} > ${OBJ}.c COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c ${OBJ}.c -o ${OBJ}.c.o COMMAND ${LD} -r -o ${OBJ}.bin.o ${OBJ}.c.o -b binary ${BIN} COMMAND ${NM} -p --radix=x ${OBJ}.bin.o @@ -283,6 +284,7 @@ function(px4_bin_to_obj) --strip-symbol ${sym}_size --strip-symbol ${sym}_end --rename-section .data=.rodata + # useful to comment remove statement when debugging COMMAND ${RM} ${OBJ}.c ${OBJ}.c.o ${OBJ}.bin.o DEPENDS ${BIN} VERBATIM @@ -334,7 +336,7 @@ function(px4_nuttx_generate_romfs) px4_bin_to_obj(OBJ ${OUT} BIN ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin - VAR romfs) + VAR romfs_img) endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 647797b304..55be37483d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,9 +70,6 @@ if (${OS} STREQUAL "nuttx") px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) - px4_nuttx_generate_romfs(OUT ${CMAKE_CURRENT_BINARY_DIR}/romfs.img - ROOT ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common) - elseif(${OS} STREQUAL "qurt") set(module_list) px4_qurt_add_modules(module_list ${BOARD}) From bbf043e32734e921c9dbf319759939b6ce25aa54 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 05:32:55 -0400 Subject: [PATCH 014/389] More work on romfs. --- CMakeLists.txt | 5 +++++ cmake/px4_impl_nuttx.cmake | 20 ++++++++++++++++++-- src/CMakeLists.txt | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8c5610066..e9fbddef56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,11 @@ endforeach() # other modules enable_testing() +#============================================================================= +# programs +# +find_package(PythonInterp REQUIRED) + #============================================================================= # parameters # diff --git a/cmake/px4_impl_nuttx.cmake b/cmake/px4_impl_nuttx.cmake index ec7019a231..d9a450b15f 100644 --- a/cmake/px4_impl_nuttx.cmake +++ b/cmake/px4_impl_nuttx.cmake @@ -324,14 +324,30 @@ function(px4_nuttx_generate_romfs) set(romfs_temp_dir ${CMAKE_BINARY_DIR}/${ROOT}) set(romfs_src_dir ${CMAKE_SOURCE_DIR}/${ROOT}) + set(romfs_autostart ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py) + set(romfs_pruner ${CMAKE_SOURCE_DIR}/Tools/px_romfs_pruner.py) + + + #message(STATUS "temp_dir: ${romfs_temp_dir}") + #message(STATUS "src_dir: ${romfs_src_dir}") + + add_custom_command(OUTPUT rc.autostart + COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} + -a ${ROMFS_ROOT}/init.d + -s rc.autostart + ) + add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} + COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d #TODO add romfs cleanup and pruning + COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} + --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin -d ${romfs_temp_dir} -V "NSHInitVol" - DEPENDS ${romfs_files} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ${romfs_files} rc.autostart + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) px4_bin_to_obj(OBJ ${OUT} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 55be37483d..25af787ed2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,7 +46,7 @@ if (${OS} STREQUAL "nuttx") MODULE_LIST ${module_list}) px4_nuttx_generate_romfs(OUT romfs.o - ROOT ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common) + ROOT ROMFS/px4fmu_common) # add executable add_executable(main builtin_commands.c romfs.o) From 9d183376479c9324ca0d6a88cf3e835fe6f8dd2e Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 10:15:22 -0400 Subject: [PATCH 015/389] Fixed issues noted by voon, start of python script for bin to obj. --- cmake/bin_to_object.py | 21 +++++++++++++++++++ ...commands.c.cmake => builtin_commands.c.in} | 0 cmake/px4_base.cmake | 2 +- cmake/px4_impl_nuttx.cmake | 2 +- cmake/px4_impl_qurt.cmake | 2 +- 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100755 cmake/bin_to_object.py rename cmake/{builtin_commands.c.cmake => builtin_commands.c.in} (100%) diff --git a/cmake/bin_to_object.py b/cmake/bin_to_object.py new file mode 100755 index 0000000000..053580d969 --- /dev/null +++ b/cmake/bin_to_object.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +""" +This converts a binary imagge to an object file +""" +from __future__ import print_function +import subprocess +import argparse +import os + +#pylint: disable=invalid-name +parser = argparse.ArgumentParser(description='Convert bin to obj.') +parser.add_argument('--c-flags', required=True) +parser.add_argument('--c-compiler', required=True) +parser.add_argument('--nm', required=True) +args = parser.parse_args() + +#TODO write function + +exit(0) + +# vim: set et ft=python fenc= ff=unix sts=4 sw=4 ts=4 : diff --git a/cmake/builtin_commands.c.cmake b/cmake/builtin_commands.c.in similarity index 100% rename from cmake/builtin_commands.c.cmake rename to cmake/builtin_commands.c.in diff --git a/cmake/px4_base.cmake b/cmake/px4_base.cmake index edc910b4cb..cf808a8152 100644 --- a/cmake/px4_base.cmake +++ b/cmake/px4_base.cmake @@ -389,7 +389,7 @@ endfunction() # function(px4_add_upload) px4_parse_function_args( - NAME px4_generate_messages + NAME px4_add_upload ONE_VALUE OS BOARD OUT BUNDLE REQUIRED OS BOARD OUT BUNDLE ARGN ${ARGN}) diff --git a/cmake/px4_impl_nuttx.cmake b/cmake/px4_impl_nuttx.cmake index d9a450b15f..8f36855bd9 100644 --- a/cmake/px4_impl_nuttx.cmake +++ b/cmake/px4_impl_nuttx.cmake @@ -143,7 +143,7 @@ function(px4_nuttx_generate_builtin_commands) math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.cmake + configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.in ${OUT}) endfunction() diff --git a/cmake/px4_impl_qurt.cmake b/cmake/px4_impl_qurt.cmake index 7748ff2ecf..5337840727 100644 --- a/cmake/px4_impl_qurt.cmake +++ b/cmake/px4_impl_qurt.cmake @@ -104,7 +104,7 @@ function(px4_qurt_generate_builtin_commands) math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.cmake + configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.in ${OUT}) endfunction() From d9a2553d34e990e8bb091ab4aad6eafa6a219b9a Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 15:18:59 -0400 Subject: [PATCH 016/389] Added firmware directories. --- CMakeLists.txt | 5 +- src/CMakeLists.txt | 90 +++---------------------------- src/firmware/CMakeLists.txt | 3 ++ src/firmware/nuttx/CMakeLists.txt | 57 ++++++++++++++++++++ src/firmware/posix/CMakeLists.txt | 3 ++ src/firmware/qurt/CMakeLists.txt | 11 ++++ 6 files changed, 85 insertions(+), 84 deletions(-) create mode 100644 src/firmware/CMakeLists.txt create mode 100644 src/firmware/nuttx/CMakeLists.txt create mode 100644 src/firmware/posix/CMakeLists.txt create mode 100644 src/firmware/qurt/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index e9fbddef56..3ca1287d16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,7 @@ link_directories(${link_dirs}) add_definitions(${definitions}) #============================================================================= -# source code generation +# source code generation} # file(GLOB_RECURSE msg_files msg/*.msg) px4_generate_messages(TARGET msg_gen @@ -228,6 +228,9 @@ px4_generate_messages(TARGET msg_gen # add_subdirectory(src) +# set the overall objective of the build +add_custom_target(ALL firmware_${OS}) + #============================================================================= # packaging # diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 25af787ed2..e69837558c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,85 +1,9 @@ -#============================================================================= -# executable -# - -if (${OS} STREQUAL "nuttx") - - #============================================================================= - # module subdirectories, need to include first - # - add_subdirectory(./lib) - add_subdirectory(./drivers) - add_subdirectory(./platforms) - add_subdirectory(./systemcmds) - add_subdirectory(./examples) - add_subdirectory(./modules) - - # a list of modules that will be linked to main - set(module_list) - - if (${LABEL} STREQUAL "simple") - list(APPEND module_list - drivers__led - drivers__device - platforms__common - modules__systemlib - modules__uORB - examples__px4_simple_app - lib__mathlib__math__filter - lib__conversion - ) - endif() - - if (${LABEL} STREQUAL "simple") - list(APPEND module_list ${module_list_simple}) - endif() - - list(APPEND module_list - platforms__nuttx - platforms__nuttx__px4_layer - drivers__boards__px4fmu-v2 - drivers__stm32 - ) - - px4_nuttx_generate_builtin_commands( - OUT builtin_commands.c - MODULE_LIST ${module_list}) - - px4_nuttx_generate_romfs(OUT romfs.o - ROOT ROMFS/px4fmu_common) - - # add executable - add_executable(main builtin_commands.c romfs.o) - 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(main PROPERTIES LINK_FLAGS ${main_link_flags}) - - target_link_libraries(main - -Wl,--start-group - ${module_list} - apps nuttx nosys m gcc - -Wl,--end-group) - - px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 - EXE ${CMAKE_CURRENT_BINARY_DIR}/main) - - px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} - BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) - -elseif(${OS} STREQUAL "qurt") - set(module_list) - px4_qurt_add_modules(module_list ${BOARD}) - message(STATUS "module list: ${module_list}") - - px4_qurt_generate_builtin_commands( - OUT builtin_commands.c - MODULE_LIST ${module_list}) - - add_executable(mainapp builtin_commands.c) -endif() +add_subdirectory(./lib) +add_subdirectory(./drivers) +add_subdirectory(./platforms) +add_subdirectory(./systemcmds) +add_subdirectory(./examples) +add_subdirectory(./modules) +add_subdirectory(./firmware) # vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/firmware/CMakeLists.txt b/src/firmware/CMakeLists.txt new file mode 100644 index 0000000000..ebf2b30bd6 --- /dev/null +++ b/src/firmware/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(./nuttx) + +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt new file mode 100644 index 0000000000..d8fab25364 --- /dev/null +++ b/src/firmware/nuttx/CMakeLists.txt @@ -0,0 +1,57 @@ +# a list of modules that will be linked to main +set(module_list) + +if (${LABEL} STREQUAL "simple") + list(APPEND module_list + drivers__led + drivers__device + platforms__common + modules__systemlib + modules__uORB + examples__px4_simple_app + lib__mathlib__math__filter + lib__conversion + ) +endif() + +if (${LABEL} STREQUAL "simple") + list(APPEND module_list ${module_list_simple}) +endif() + +list(APPEND module_list + platforms__nuttx + platforms__nuttx__px4_layer + drivers__boards__px4fmu-v2 + drivers__stm32 +) + +px4_nuttx_generate_builtin_commands( + OUT builtin_commands.c + MODULE_LIST ${module_list}) + +px4_nuttx_generate_romfs(OUT romfs.o + ROOT ROMFS/px4fmu_common) + +# add executable +add_executable(firmware_nuttx builtin_commands.c romfs.o) +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}) + +target_link_libraries(firmware_nuttx + -Wl,--start-group + ${module_list} + apps nuttx nosys m gcc + -Wl,--end-group) + +px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 + EXE ${CMAKE_CURRENT_BINARY_DIR}/main) + +px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} + BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) + +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt new file mode 100644 index 0000000000..fed65f90df --- /dev/null +++ b/src/firmware/posix/CMakeLists.txt @@ -0,0 +1,3 @@ +#TODO + +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt new file mode 100644 index 0000000000..8473f3098b --- /dev/null +++ b/src/firmware/qurt/CMakeLists.txt @@ -0,0 +1,11 @@ +set(module_list) +px4_qurt_add_modules(module_list ${BOARD}) +message(STATUS "module list: ${module_list}") + +px4_qurt_generate_builtin_commands( + OUT builtin_commands.c + MODULE_LIST ${module_list}) + +add_executable(mainapp builtin_commands.c) + +# vim: set noet ft=cmake fenc=utf-8 ff=unix : From ecf99650c8798fea89aac5375836547603f66ece Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 15:20:43 -0400 Subject: [PATCH 017/389] Fixed upload for nuttx. --- src/firmware/nuttx/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index d8fab25364..970dcd5fce 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -49,7 +49,7 @@ target_link_libraries(firmware_nuttx -Wl,--end-group) px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 - EXE ${CMAKE_CURRENT_BINARY_DIR}/main) + EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx) px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) From 14cafa014318c6069ad3e20059ef5feb80ff73bd Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 15:21:55 -0400 Subject: [PATCH 018/389] Fixed qurt firmware target name. --- src/firmware/qurt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index 8473f3098b..b9b3f37101 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -6,6 +6,6 @@ px4_qurt_generate_builtin_commands( OUT builtin_commands.c MODULE_LIST ${module_list}) -add_executable(mainapp builtin_commands.c) +add_executable(firmware_qurt builtin_commands.c) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 0de5868ee248af17d9ebb6a714c9632a93c9c647 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 07:47:09 -0700 Subject: [PATCH 019/389] More qurt support The current approach of distributing submodule inclusion logic makes evert parent dir need to know about all build targets. This approach goes back to the previous way of centralizing the build dirs in a single file. Signed-off-by: Mark Charlebois --- cmake/px4_impl_qurt.cmake | 10 ++-- cmake/qurt/configs/config-qurt-hil.cmake | 2 +- src/CMakeLists.txt | 75 ++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 6 deletions(-) diff --git a/cmake/px4_impl_qurt.cmake b/cmake/px4_impl_qurt.cmake index 5337840727..ebfdc9f45b 100644 --- a/cmake/px4_impl_qurt.cmake +++ b/cmake/px4_impl_qurt.cmake @@ -236,7 +236,7 @@ endfunction() # # Usage: # px4_os_prebuild_targets( -# OUT +# OUT_MODULES # BOARD # ) # @@ -244,16 +244,16 @@ endfunction() # BOARD : board # # Output: -# MODULE_LIST : the updated module list +# OUT_MODULES : the updated module list # # Example: -# px4_qurt_add_modules(MODULE_LIST module_list BOARD hil) +# px4_qurt_add_modules(module_list "hil") # -function(px4_qurt_add_modules out_modules BOARD) +function(px4_qurt_add_modules OUT_MODULES BOARD) include(config-qurt-${BOARD}) set(config_modules) px4_set_config_modules(config_modules) - set(${out_modules} ${out_modules} ${config_modules} PARENT_SCOPE) + set(${OUT_MODULES} ${${OUT_MODULES}} ${config_modules} PARENT_SCOPE) endfunction() # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/qurt/configs/config-qurt-hil.cmake b/cmake/qurt/configs/config-qurt-hil.cmake index 6c68043868..694aa8d0ea 100644 --- a/cmake/qurt/configs/config-qurt-hil.cmake +++ b/cmake/qurt/configs/config-qurt-hil.cmake @@ -77,7 +77,7 @@ function(px4_set_config_modules out_module_list) # # sources for muorb over fastrpc # - modules/muorb/adsp/ + modules/muorb/adsp ) message(STATUS "modules: ${config_module_list}") set(${out_module_list} ${config_module_list} PARENT_SCOPE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e69837558c..1bc4e961fb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,6 @@ +#============================================================================= +# module subdirectories, need to include first +# add_subdirectory(./lib) add_subdirectory(./drivers) add_subdirectory(./platforms) @@ -5,5 +8,77 @@ add_subdirectory(./systemcmds) add_subdirectory(./examples) add_subdirectory(./modules) add_subdirectory(./firmware) +#============================================================================= +# executable +# + +if (${OS} STREQUAL "nuttx") + + # a list of modules that will be linked to main + set(module_list) + + if (${LABEL} STREQUAL "simple") + list(APPEND module_list + drivers__led + drivers__device + platforms__common + modules__systemlib + modules__uORB + examples__px4_simple_app + lib__mathlib__math__filter + lib__conversion + ) + endif() + + if (${LABEL} STREQUAL "simple") + list(APPEND module_list ${module_list_simple}) + endif() + + list(APPEND module_list + platforms__nuttx + platforms__nuttx__px4_layer + drivers__boards__px4fmu-v2 + drivers__stm32 + ) + + px4_nuttx_generate_builtin_commands( + OUT builtin_commands.c + MODULE_LIST ${module_list}) + + px4_nuttx_generate_romfs(OUT romfs.o + ROOT ROMFS/px4fmu_common) + + # add executable + add_executable(main builtin_commands.c romfs.o) + 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(main PROPERTIES LINK_FLAGS ${main_link_flags}) + + target_link_libraries(main + -Wl,--start-group + ${module_list} + apps nuttx nosys m gcc + -Wl,--end-group) + + px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 + EXE ${CMAKE_CURRENT_BINARY_DIR}/main) + + px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} + BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) + +elseif(${OS} STREQUAL "qurt") + set(module_list) + px4_qurt_add_modules(module_list ${BOARD}) + message(STATUS "module list: ${module_list}") + + foreach(directory ${module_list}) + message(STATUS "directory: ${directory}") + add_subdirectory(${directory} EXCLUDE_FROM_ALL) + endforeach() +endif() # vim: set noet ft=cmake fenc=utf-8 ff=unix : From eb40a6de77a68e749dcb639df7236ef880ecb896 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 13:16:12 -0700 Subject: [PATCH 020/389] cmake: qurt modules now build but do not link Managed to get the deps set up to build the qurt modules using a config file for the list of modules. NuttX link options are being set somewhere that break the qurt build Signed-off-by: Mark Charlebois --- cmake/px4_impl_qurt.cmake | 5 +- cmake/qurt/builtin_commands.cpp_stub | 84 +++++++++++++++++++++++++++ src/CMakeLists.txt | 33 +++++++++-- src/drivers/CMakeLists.txt | 1 + src/modules/muorb/adsp/CMakeLists.txt | 2 + src/modules/muorb/adsp/px4muorb.cpp | 5 +- src/modules/systemlib/perf_counter.c | 11 ++-- src/platforms/px4_log.h | 34 +++++------ 8 files changed, 145 insertions(+), 30 deletions(-) create mode 100644 cmake/qurt/builtin_commands.cpp_stub diff --git a/cmake/px4_impl_qurt.cmake b/cmake/px4_impl_qurt.cmake index ebfdc9f45b..e6df99cd27 100644 --- a/cmake/px4_impl_qurt.cmake +++ b/cmake/px4_impl_qurt.cmake @@ -98,13 +98,13 @@ function(px4_qurt_generate_builtin_commands) endforeach() if (MAIN) set(builtin_apps_string - "${builtin_apps_string}\t{\"${MAIN}\", ${PRIORITY}, ${STACK}, ${MAIN}_main},\n") + "${builtin_apps_string}\tapps[\"${MAIN}\"] = ${MAIN}_main;\n") set(builtin_apps_decl_string "${builtin_apps_decl_string}extern int ${MAIN}_main(int argc, char *argv[]);\n") math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.in + configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/builtin_commands.cpp_stub ${OUT}) endfunction() @@ -226,6 +226,7 @@ function(px4_os_prebuild_targets) ONE_VALUE OUT BOARD THREADS REQUIRED OUT BOARD ARGN ${ARGN}) + add_custom_target(${OUT}) endfunction() #============================================================================= diff --git a/cmake/qurt/builtin_commands.cpp_stub b/cmake/qurt/builtin_commands.cpp_stub new file mode 100644 index 0000000000..f4d240d529 --- /dev/null +++ b/cmake/qurt/builtin_commands.cpp_stub @@ -0,0 +1,84 @@ +/* builtin command list - automatically generated, do not edit */ +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +extern void px4_show_devices(void); + +extern "C" { +${builtin_apps_decl_string} +static int shutdown_main(int argc, char *argv[]); +static int list_tasks_main(int argc, char *argv[]); +static int list_files_main(int argc, char *argv[]); +static int list_devices_main(int argc, char *argv[]); +static int list_topics_main(int argc, char *argv[]); +static int sleep_main(int argc, char *argv[]); +} + + +void init_app_map(map &apps) +{ +${builtin_apps_string} + apps["shutdown"] = shutdown_main; + apps["list_tasks"] = list_tasks_main; + apps["list_files"] = list_files_main; + apps["list_devices"] = list_devices_main; + apps["list_topics"] = list_topics_main; + apps["sleep"] = sleep_main; +} + +void list_builtins(map &apps) +{ + printf("Builtin Commands:\\n"); + for (map::iterator it=apps.begin(); it!=apps.end(); ++it) + printf("\\t%s\\n", (it->first).c_str()); +} + +static int shutdown_main(int argc, char *argv[]) +{ + printf("Shutting down\\n"); + exit(0); +} + +static int list_tasks_main(int argc, char *argv[]) +{ + px4_show_tasks(); + return 0; +} + +static int list_devices_main(int argc, char *argv[]) +{ + px4_show_devices(); + return 0; +} + +static int list_topics_main(int argc, char *argv[]) +{ + px4_show_topics(); + return 0; +} +static int list_files_main(int argc, char *argv[]) +{ + px4_show_files(); + return 0; +} +static int sleep_main(int argc, char *argv[]) +{ + if (argc != 2) { + PX4_WARN( "Usage: sleep " ); + return 1; + } + + unsigned long usecs = ( (unsigned long) atol( argv[1] ) ) * 1000 * 1000; + PX4_WARN("Sleeping for %s, %ld",argv[1],usecs); + usleep( usecs ); + return 0; +} + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1bc4e961fb..c76007edd0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,12 @@ add_subdirectory(./firmware) # executable # +function(px4_mangle_name dirname newname) + set(tmp) + string(REPLACE "/" "__" tmp ${dirname}) + set(${newname} ${tmp} PARENT_SCOPE) +endfunction() + if (${OS} STREQUAL "nuttx") # a list of modules that will be linked to main @@ -71,14 +77,33 @@ if (${OS} STREQUAL "nuttx") BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) elseif(${OS} STREQUAL "qurt") + set(module_dir_list) set(module_list) - px4_qurt_add_modules(module_list ${BOARD}) - message(STATUS "module list: ${module_list}") + px4_qurt_add_modules(module_dir_list ${BOARD}) + message(STATUS "module list: ${module_dir_list}") - foreach(directory ${module_list}) + foreach(directory ${module_dir_list}) message(STATUS "directory: ${directory}") - add_subdirectory(${directory} EXCLUDE_FROM_ALL) + px4_mangle_name(${directory} mangled_name) + list(APPEND module_list + ${mangled_name}) endforeach() + px4_qurt_generate_builtin_commands( + OUT builtin_commands.cpp + MODULE_LIST ${module_list}) + + # FIXME @jgoppert - how to work around issues like this? + # Without changing global variables? + # Clear -rdynamic flag which fails for hexagon + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") + set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") + + add_executable(main builtin_commands.cpp) + target_link_libraries(main + -Wl,--start-group + ${module_list} + apps nuttx nosys m gcc + -Wl,--end-group) endif() # vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/CMakeLists.txt b/src/drivers/CMakeLists.txt index 7a504e9326..a435bdc94d 100644 --- a/src/drivers/CMakeLists.txt +++ b/src/drivers/CMakeLists.txt @@ -8,6 +8,7 @@ set(directories ./boards/px4io-v1 ./boards/px4fmu-v1 ./boards/aerocore + ./boards/sitl ./mpu6000 ./gimbal ./camera_trigger diff --git a/src/modules/muorb/adsp/CMakeLists.txt b/src/modules/muorb/adsp/CMakeLists.txt index ade682dbfd..185264a85f 100644 --- a/src/modules/muorb/adsp/CMakeLists.txt +++ b/src/modules/muorb/adsp/CMakeLists.txt @@ -30,6 +30,8 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +include_directories("../../uORB") + px4_add_module( MODULE modules__muorb__adsp COMPILE_FLAGS diff --git a/src/modules/muorb/adsp/px4muorb.cpp b/src/modules/muorb/adsp/px4muorb.cpp index e6cad0aba3..53318f8e49 100644 --- a/src/modules/muorb/adsp/px4muorb.cpp +++ b/src/modules/muorb/adsp/px4muorb.cpp @@ -31,7 +31,7 @@ * ****************************************************************************/ #include "px4muorb.hpp" -#include "qurt.h" +//#include "qurt.h" #include "uORBFastRpcChannel.hpp" #include "uORBManager.hpp" @@ -44,12 +44,11 @@ #include "uORB/topics/sensor_combined.h" #include "uORB.h" -#include "HAP_power.h" - #define _ENABLE_MUORB 1 extern "C" { int dspal_main(int argc, const char *argv[]); +void HAP_power_request(int a, int b, int c); }; diff --git a/src/modules/systemlib/perf_counter.c b/src/modules/systemlib/perf_counter.c index 8ec9b1a444..105b958898 100644 --- a/src/modules/systemlib/perf_counter.c +++ b/src/modules/systemlib/perf_counter.c @@ -47,6 +47,9 @@ #ifdef __PX4_QURT #define dprintf(...) +#define ddeclare(...) +#else +#define ddeclare(...) __VA_ARGS_ #endif /** @@ -417,8 +420,8 @@ perf_print_counter_fd(int fd, perf_counter_t handle) break; case PC_ELAPSED: { - struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle; - float rms = sqrtf(pce->M2 / (pce->event_count - 1)); + ddeclare(struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle;) + ddeclare(float rms = sqrtf(pce->M2 / (pce->event_count - 1));) dprintf(fd, "%s: %llu events, %llu overruns, %lluus elapsed, %lluus avg, min %lluus max %lluus %5.3fus rms\n", handle->name, (unsigned long long)pce->event_count, @@ -432,8 +435,8 @@ perf_print_counter_fd(int fd, perf_counter_t handle) } case PC_INTERVAL: { - struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle; - float rms = sqrtf(pci->M2 / (pci->event_count - 1)); + ddeclare(struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle;) + ddeclare(float rms = sqrtf(pci->M2 / (pci->event_count - 1));) dprintf(fd, "%s: %llu events, %lluus avg, min %lluus max %lluus %5.3fus rms\n", handle->name, diff --git a/src/platforms/px4_log.h b/src/platforms/px4_log.h index a8208313e6..e6540c20d2 100644 --- a/src/platforms/px4_log.h +++ b/src/platforms/px4_log.h @@ -70,33 +70,33 @@ static inline void do_nothing(int level, ...) /**************************************************************************** * Messages that should never be filtered or compiled out ****************************************************************************/ -#define PX4_LOG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_INFO(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_LOG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_INFO(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILE__, __LINE__, FMT, ##__VA_ARGS__) #if defined(TRACE_BUILD) /**************************************************************************** * Extremely Verbose settings for a Trace build ****************************************************************************/ -#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILE__, __LINE__, FMT, ##__VA_ARGS__) #elif defined(DEBUG_BUILD) /**************************************************************************** * Verbose settings for a Debug build ****************************************************************************/ -#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILE__, __LINE__, FMT, ##__VA_ARGS__) #elif defined(RELEASE_BUILD) /**************************************************************************** * Non-verbose settings for a Release build to minimize strings in build ****************************************************************************/ -#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__) #define PX4_WARN(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_WARN, FMT, ##__VA_ARGS__) #define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__) @@ -104,14 +104,14 @@ static inline void do_nothing(int level, ...) /**************************************************************************** * Medium verbose settings for a default build ****************************************************************************/ -#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) -#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__) +#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__) #define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__) #endif -#define PX4_LOG_NAMED(name, FMT, ...) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, "%s " FMT, name, ##__VA_ARGS__) -#define PX4_LOG_NAMED_COND(name, cond, FMT, ...) if( cond ) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, "%s " FMT, name, ##__VA_ARGS__) +#define PX4_LOG_NAMED(name, FMT, ...) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILE__, __LINE__, "%s " FMT, name, ##__VA_ARGS__) +#define PX4_LOG_NAMED_COND(name, cond, FMT, ...) if( cond ) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILE__, __LINE__, "%s " FMT, name, ##__VA_ARGS__) #else From 29520dc5b14ef50c44ee77bb7c81be464bb9c315 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 13:42:41 -0700 Subject: [PATCH 021/389] Fixed nuttx libs in qurt build Signed-off-by: Mark Charlebois --- src/CMakeLists.txt | 16 +++++++++++----- src/platforms/qurt/px4_layer/qurt_stubs.c | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c76007edd0..470e99aa30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -77,6 +77,11 @@ if (${OS} STREQUAL "nuttx") BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) elseif(${OS} STREQUAL "qurt") + + set(V_ARCH v5) + set(HEXAGON_TOOLS_ROOT /opt/6.4.03) + set(TOOLSLIB + ${HEXAGON_TOOLS_ROOT}/dinkumware/lib/${V_ARCH}/G0) set(module_dir_list) set(module_list) px4_qurt_add_modules(module_dir_list ${BOARD}) @@ -98,12 +103,13 @@ elseif(${OS} STREQUAL "qurt") set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - add_executable(main builtin_commands.cpp) - target_link_libraries(main - -Wl,--start-group + add_executable(mainapp builtin_commands.cpp) + target_link_libraries(mainapp + -Wl,--whole-archive ${module_list} - apps nuttx nosys m gcc - -Wl,--end-group) + m + -Wl,--no-whole-archive + -Wl,${TOOLSLIB}/pic/libstdc++.a) endif() # vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/qurt/px4_layer/qurt_stubs.c b/src/platforms/qurt/px4_layer/qurt_stubs.c index 937393bc65..e8c08f2d14 100644 --- a/src/platforms/qurt/px4_layer/qurt_stubs.c +++ b/src/platforms/qurt/px4_layer/qurt_stubs.c @@ -60,6 +60,7 @@ void _Parse_csd( void ) block_indefinite(); } +#if 0 void _Locksyslock( int x ) { PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); @@ -70,7 +71,7 @@ void _Unlocksyslock( int x ) { PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); block_indefinite(); -} +#endif} void _Valbytes( void ) { From c16c6a00e35cb5278dc89fc6e79d4fc3e72ed8ec Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 13:54:43 -0700 Subject: [PATCH 022/389] Clean up location of nuttx specific template Signed-off-by: Mark Charlebois --- CMakeLists.txt | 1 + cmake/{ => nuttx}/builtin_commands.c.in | 0 cmake/{ => nuttx}/px4_impl_nuttx.cmake | 2 +- cmake/{ => qurt}/px4_impl_qurt.cmake | 0 src/modules/systemlib/perf_counter.c | 2 +- 5 files changed, 3 insertions(+), 2 deletions(-) rename cmake/{ => nuttx}/builtin_commands.c.in (100%) rename cmake/{ => nuttx}/px4_impl_nuttx.cmake (99%) rename cmake/{ => qurt}/px4_impl_qurt.cmake (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ca1287d16..cbec24e59f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,7 @@ set(package-contact "px4users@googlegroups.com") # set module path list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/${OS}) # prefer board implementation module over os implmementation module set(board_impl_module px4_impl_${OS}_${BOARD}) diff --git a/cmake/builtin_commands.c.in b/cmake/nuttx/builtin_commands.c.in similarity index 100% rename from cmake/builtin_commands.c.in rename to cmake/nuttx/builtin_commands.c.in diff --git a/cmake/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake similarity index 99% rename from cmake/px4_impl_nuttx.cmake rename to cmake/nuttx/px4_impl_nuttx.cmake index 8f36855bd9..4e4724b184 100644 --- a/cmake/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -143,7 +143,7 @@ function(px4_nuttx_generate_builtin_commands) math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${CMAKE_SOURCE_DIR}/cmake/builtin_commands.c.in + configure_file(${CMAKE_SOURCE_DIR}/cmake/nuttx/builtin_commands.c.in ${OUT}) endfunction() diff --git a/cmake/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake similarity index 100% rename from cmake/px4_impl_qurt.cmake rename to cmake/qurt/px4_impl_qurt.cmake diff --git a/src/modules/systemlib/perf_counter.c b/src/modules/systemlib/perf_counter.c index 105b958898..a9d9db9748 100644 --- a/src/modules/systemlib/perf_counter.c +++ b/src/modules/systemlib/perf_counter.c @@ -49,7 +49,7 @@ #define dprintf(...) #define ddeclare(...) #else -#define ddeclare(...) __VA_ARGS_ +#define ddeclare(...) __VA_ARGS__ #endif /** From d343edaa66881f51c712bfc8aed62adbc1a3c228 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 14:13:54 -0700 Subject: [PATCH 023/389] Moved qurt changes to src/firmware/qurt/CMakeLists.txt The src/CMakeLists.txt are now in src/firmware/${OS}/CMakeLists.txt Signed-off-by: Mark Charlebois --- src/firmware/qurt/CMakeLists.txt | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index b9b3f37101..9a49794627 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -1,11 +1,34 @@ +set(V_ARCH v5) +set(HEXAGON_TOOLS_ROOT /opt/6.4.03) +set(TOOLSLIB + ${HEXAGON_TOOLS_ROOT}/dinkumware/lib/${V_ARCH}/G0) +set(module_dir_list) set(module_list) -px4_qurt_add_modules(module_list ${BOARD}) -message(STATUS "module list: ${module_list}") +px4_qurt_add_modules(module_dir_list ${BOARD}) +message(STATUS "module list: ${module_dir_list}") +foreach(directory ${module_dir_list}) + message(STATUS "directory: ${directory}") + px4_mangle_name(${directory} mangled_name) + list(APPEND module_list + ${mangled_name}) +endforeach() px4_qurt_generate_builtin_commands( - OUT builtin_commands.c + OUT builtin_commands.cpp MODULE_LIST ${module_list}) -add_executable(firmware_qurt builtin_commands.c) +# FIXME @jgoppert - how to work around issues like this? +# Without changing global variables? +# Clear -rdynamic flag which fails for hexagon +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") + +add_executable(mainapp builtin_commands.cpp) +target_link_libraries(mainapp + -Wl,--whole-archive + ${module_list} + m + -Wl,--no-whole-archive + -Wl,${TOOLSLIB}/pic/libstdc++.a) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From e82ea34e51c973ef2b1c8b1e0bd9631019b68c80 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 14:19:29 -0700 Subject: [PATCH 024/389] Changed builtin_commands.cpp_stub to builtin_commands.cpp_in Signed-off-by: Mark Charlebois --- .../qurt/{builtin_commands.cpp_stub => builtin_commands.cpp_in} | 0 cmake/qurt/px4_impl_qurt.cmake | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename cmake/qurt/{builtin_commands.cpp_stub => builtin_commands.cpp_in} (100%) diff --git a/cmake/qurt/builtin_commands.cpp_stub b/cmake/qurt/builtin_commands.cpp_in similarity index 100% rename from cmake/qurt/builtin_commands.cpp_stub rename to cmake/qurt/builtin_commands.cpp_in diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index e6df99cd27..1874787f57 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -104,7 +104,7 @@ function(px4_qurt_generate_builtin_commands) math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/builtin_commands.cpp_stub + configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/builtin_commands.cpp_in ${OUT}) endfunction() From 4885bbbdd18ec13dadb919e9dc15ccdeb28d134e Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 14:36:09 -0700 Subject: [PATCH 025/389] Added px4_mangle_name function to px4_base.cmake Signed-off-by: Mark Charlebois --- cmake/px4_base.cmake | 25 ++++++++ src/CMakeLists.txt | 106 ------------------------------- src/firmware/qurt/CMakeLists.txt | 2 + 3 files changed, 27 insertions(+), 106 deletions(-) diff --git a/cmake/px4_base.cmake b/cmake/px4_base.cmake index cf808a8152..888011fe76 100644 --- a/cmake/px4_base.cmake +++ b/cmake/px4_base.cmake @@ -610,4 +610,29 @@ function(px4_add_common_flags) endfunction() +#============================================================================= +# +# px4_mangle_name +# +# Convert a path name to a module name +# +# Usage: +# px4_mangle_name(dirname newname) +# +# Input: +# dirname : path to module dir +# +# Output: +# newname : module name +# +# Example: +# px4_mangle_name(${dirpath} mangled_name) +# message(STATUS "module name is ${mangled_name}") +# +function(px4_mangle_name dirname newname) + set(tmp) + string(REPLACE "/" "__" tmp ${dirname}) + set(${newname} ${tmp} PARENT_SCOPE) +endfunction() + # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 470e99aa30..e69837558c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,3 @@ -#============================================================================= -# module subdirectories, need to include first -# add_subdirectory(./lib) add_subdirectory(./drivers) add_subdirectory(./platforms) @@ -8,108 +5,5 @@ add_subdirectory(./systemcmds) add_subdirectory(./examples) add_subdirectory(./modules) add_subdirectory(./firmware) -#============================================================================= -# executable -# - -function(px4_mangle_name dirname newname) - set(tmp) - string(REPLACE "/" "__" tmp ${dirname}) - set(${newname} ${tmp} PARENT_SCOPE) -endfunction() - -if (${OS} STREQUAL "nuttx") - - # a list of modules that will be linked to main - set(module_list) - - if (${LABEL} STREQUAL "simple") - list(APPEND module_list - drivers__led - drivers__device - platforms__common - modules__systemlib - modules__uORB - examples__px4_simple_app - lib__mathlib__math__filter - lib__conversion - ) - endif() - - if (${LABEL} STREQUAL "simple") - list(APPEND module_list ${module_list_simple}) - endif() - - list(APPEND module_list - platforms__nuttx - platforms__nuttx__px4_layer - drivers__boards__px4fmu-v2 - drivers__stm32 - ) - - px4_nuttx_generate_builtin_commands( - OUT builtin_commands.c - MODULE_LIST ${module_list}) - - px4_nuttx_generate_romfs(OUT romfs.o - ROOT ROMFS/px4fmu_common) - - # add executable - add_executable(main builtin_commands.c romfs.o) - 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(main PROPERTIES LINK_FLAGS ${main_link_flags}) - - target_link_libraries(main - -Wl,--start-group - ${module_list} - apps nuttx nosys m gcc - -Wl,--end-group) - - px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 - EXE ${CMAKE_CURRENT_BINARY_DIR}/main) - - px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} - BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) - -elseif(${OS} STREQUAL "qurt") - - set(V_ARCH v5) - set(HEXAGON_TOOLS_ROOT /opt/6.4.03) - set(TOOLSLIB - ${HEXAGON_TOOLS_ROOT}/dinkumware/lib/${V_ARCH}/G0) - set(module_dir_list) - set(module_list) - px4_qurt_add_modules(module_dir_list ${BOARD}) - message(STATUS "module list: ${module_dir_list}") - - foreach(directory ${module_dir_list}) - message(STATUS "directory: ${directory}") - px4_mangle_name(${directory} mangled_name) - list(APPEND module_list - ${mangled_name}) - endforeach() - px4_qurt_generate_builtin_commands( - OUT builtin_commands.cpp - MODULE_LIST ${module_list}) - - # FIXME @jgoppert - how to work around issues like this? - # Without changing global variables? - # Clear -rdynamic flag which fails for hexagon - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") - set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - - add_executable(mainapp builtin_commands.cpp) - target_link_libraries(mainapp - -Wl,--whole-archive - ${module_list} - m - -Wl,--no-whole-archive - -Wl,${TOOLSLIB}/pic/libstdc++.a) -endif() # vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index 9a49794627..fa0720c743 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -1,3 +1,5 @@ +include(px4_base) + set(V_ARCH v5) set(HEXAGON_TOOLS_ROOT /opt/6.4.03) set(TOOLSLIB From 7e1c984234d725d1f0b828e56c4d8c5430636180 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 15:39:13 -0700 Subject: [PATCH 026/389] Hack to get posix build partially working Created a dummy build_git_version.h so I did not have to figure out how to generate it. Commented out topic_listener.cpp from src/systemcmds/CMakeLists.txt because it depends on a generated cpp file. Link doesn't work mut many modules build Signed-off-by: Mark Charlebois --- CMakeLists.txt | 1 + Makefile | 2 +- cmake/nuttx/px4_impl_nuttx.cmake | 1 + cmake/posix/builtin_commands.cpp_in | 84 ++++++ cmake/posix/configs/config-posix-sitl.cmake | 46 +++ cmake/posix/posix-sitl-simple.cmake | 43 --- cmake/posix/px4_impl_posix.cmake | 263 ++++++++++++++++++ cmake/posix/px4_target_impl.cmake | 111 -------- src/CMakeLists.txt | 2 +- src/firmware/posix/CMakeLists.txt | 23 +- src/include/build_git_version.h | 2 + .../drivers/airspeedsim/meas_airspeed_sim.cpp | 2 +- src/systemcmds/CMakeLists.txt | 2 +- src/systemcmds/topic_listener/CMakeLists.txt | 22 +- 14 files changed, 434 insertions(+), 170 deletions(-) create mode 100644 cmake/posix/builtin_commands.cpp_in create mode 100644 cmake/posix/configs/config-posix-sitl.cmake delete mode 100644 cmake/posix/posix-sitl-simple.cmake create mode 100644 cmake/posix/px4_impl_posix.cmake delete mode 100644 cmake/posix/px4_target_impl.cmake create mode 100644 src/include/build_git_version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index cbec24e59f..58731547b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,7 @@ set(package-contact "px4users@googlegroups.com") # # set module path +message("OS = ${OS}") list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/${OS}) diff --git a/Makefile b/Makefile index cc8a625478..686fd85378 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ px4fmu-v2_simple-upload: px4fmu-v2_simple posix-sitl_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-posix-clang-native.cmake \ -DOS=posix -DBOARD=sitl -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 4e4724b184..dad2709aaf 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -31,6 +31,7 @@ # ############################################################################ +message(STATUS "included nuttx file") #============================================================================= # diff --git a/cmake/posix/builtin_commands.cpp_in b/cmake/posix/builtin_commands.cpp_in new file mode 100644 index 0000000000..f4d240d529 --- /dev/null +++ b/cmake/posix/builtin_commands.cpp_in @@ -0,0 +1,84 @@ +/* builtin command list - automatically generated, do not edit */ +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +extern void px4_show_devices(void); + +extern "C" { +${builtin_apps_decl_string} +static int shutdown_main(int argc, char *argv[]); +static int list_tasks_main(int argc, char *argv[]); +static int list_files_main(int argc, char *argv[]); +static int list_devices_main(int argc, char *argv[]); +static int list_topics_main(int argc, char *argv[]); +static int sleep_main(int argc, char *argv[]); +} + + +void init_app_map(map &apps) +{ +${builtin_apps_string} + apps["shutdown"] = shutdown_main; + apps["list_tasks"] = list_tasks_main; + apps["list_files"] = list_files_main; + apps["list_devices"] = list_devices_main; + apps["list_topics"] = list_topics_main; + apps["sleep"] = sleep_main; +} + +void list_builtins(map &apps) +{ + printf("Builtin Commands:\\n"); + for (map::iterator it=apps.begin(); it!=apps.end(); ++it) + printf("\\t%s\\n", (it->first).c_str()); +} + +static int shutdown_main(int argc, char *argv[]) +{ + printf("Shutting down\\n"); + exit(0); +} + +static int list_tasks_main(int argc, char *argv[]) +{ + px4_show_tasks(); + return 0; +} + +static int list_devices_main(int argc, char *argv[]) +{ + px4_show_devices(); + return 0; +} + +static int list_topics_main(int argc, char *argv[]) +{ + px4_show_topics(); + return 0; +} +static int list_files_main(int argc, char *argv[]) +{ + px4_show_files(); + return 0; +} +static int sleep_main(int argc, char *argv[]) +{ + if (argc != 2) { + PX4_WARN( "Usage: sleep " ); + return 1; + } + + unsigned long usecs = ( (unsigned long) atol( argv[1] ) ) * 1000 * 1000; + PX4_WARN("Sleeping for %s, %ld",argv[1],usecs); + usleep( usecs ); + return 0; +} + diff --git a/cmake/posix/configs/config-posix-sitl.cmake b/cmake/posix/configs/config-posix-sitl.cmake new file mode 100644 index 0000000000..647a30b87a --- /dev/null +++ b/cmake/posix/configs/config-posix-sitl.cmake @@ -0,0 +1,46 @@ +function(px4_set_config_modules out_module_list) + set(config_module_list + platforms/posix/px4_layer + platforms/posix/work_queue + platforms/posix/drivers/adcsim + platforms/posix/drivers/gpssim + platforms/posix/drivers/tonealrmsim + platforms/posix/drivers/accelsim + platforms/posix/drivers/airspeedsim + platforms/posix/drivers/barosim + platforms/posix/drivers/gyrosim + systemcmds/param + systemcmds/mixer + systemcmds/ver + systemcmds/esc_calib + systemcmds/reboot + modules/sensors + modules/mavlink + modules/attitude_estimator_ekf + modules/attitude_estimator_q + modules/ekf_att_pos_estimator + modules/position_estimator_inav + modules/navigator + modules/mc_pos_control + modules/mc_att_control + modules/mc_pos_control_multiplatform + modules/mc_att_control_multiplatform + modules/land_detector + modules/fw_att_control + modules/fw_pos_control_l1 + modules/dataman + modules/sdlog2 + modules/simulator + modules/commander + modules/controllib + lib/mathlib + lib/ecl + lib/external_lgpl + lib/geo + lib/geo_lookup + lib/launchdetection + ) + message(STATUS "modules: ${config_module_list}") + set(${out_module_list} ${config_module_list} PARENT_SCOPE) +endfunction() + diff --git a/cmake/posix/posix-sitl-simple.cmake b/cmake/posix/posix-sitl-simple.cmake deleted file mode 100644 index a5e0ce8a08..0000000000 --- a/cmake/posix/posix-sitl-simple.cmake +++ /dev/null @@ -1,43 +0,0 @@ -list(APPEND module_directories - ./src/platforms/posix/px4_layer - ./src/platforms/posix/work_queue - ./src/platforms/posix/drivers/adcsim - ./src/platforms/posix/drivers/gpssim - ./src/platforms/posix/drivers/tonealrmsim - ./src/platforms/posix/drivers/accelsim - ./src/platforms/posix/drivers/airspeedsim - ./src/platforms/posix/drivers/barosim - ./src/platforms/posix/drivers/gyrosim - ./src/systemcmds/param - ./src/systemcmds/mixer - ./src/systemcmds/topic_listener - ./src/systemcmds/ver - ./src/systemcmds/esc_calib - ./src/systemcmds/reboot - ./src/modules/sensors - ./src/modules/mavlink - ./src/modules/attitude_estimator_ekf - ./src/modules/attitude_estimator_q - ./src/modules/ekf_att_pos_estimator - ./src/modules/position_estimator_inav - ./src/modules/navigator - ./src/modules/mc_pos_control - ./src/modules/mc_att_control - ./src/modules/mc_pos_control_multiplatform - ./src/modules/mc_att_control_multiplatform - ./src/modules/land_detector - ./src/modules/fw_att_control - ./src/modules/fw_pos_control_l1 - ./src/modules/dataman - ./src/modules/sdlog2 - ./src/modules/simulator - ./src/modules/commander - ./src/modules/controllib - ./src/lib/mathlib - ./src/lib/ecl - ./src/lib/external_lgpl - ./src/lib/geo - ./src/lib/geo_lookup - ./src/lib/launchdetection - ) - diff --git a/cmake/posix/px4_impl_posix.cmake b/cmake/posix/px4_impl_posix.cmake new file mode 100644 index 0000000000..cc77c08d44 --- /dev/null +++ b/cmake/posix/px4_impl_posix.cmake @@ -0,0 +1,263 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +message(STATUS "include posix file") +#============================================================================= +# +# Defined functions in this file +# +# OS Specific Functions +# +# * px4_posix_add_firmware +# * px4_posix_generate_builtin_commands +# * px4_posix_add_export +# * px4_posix_generate_romfs +# +# Required OS Inteface Functions +# +# * px4_os_add_flags +# * px4_os_prebuild_targets +# + +include(px4_base) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/posix) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/posix/configs) + +#============================================================================= +# +# px4_posix_generate_builtin_commands +# +# This function generates the builtin_commands.c src for posix +# +# Usage: +# px4_posix_generate_builtin_commands( +# MODULE_LIST +# OUT ) +# +# Input: +# MODULE_LIST : list of modules +# +# Output: +# OUT : generated builtin_commands.c src +# +# Example: +# px4_posix_generate_builtin_commands( +# OUT MODULE_LIST px4_simple_app) +# +function(px4_posix_generate_builtin_commands) + px4_parse_function_args( + NAME px4_posix_generate_builtin_commands + ONE_VALUE OUT + MULTI_VALUE MODULE_LIST + REQUIRED MODULE_LIST OUT + ARGN ${ARGN}) + set(builtin_apps_string) + set(builtin_apps_decl_string) + set(command_count 0) + foreach(module ${MODULE_LIST}) + # default + set(MAIN_DEFAULT MAIN-NOTFOUND) + set(STACK_DEFAULT 1024) + set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT) + foreach(property MAIN STACK PRIORITY) + get_target_property(${property} ${module} ${property}) + if(NOT ${property}) + set(${property} ${${property}_DEFAULT}) + endif() + endforeach() + if (MAIN) + set(builtin_apps_string + "${builtin_apps_string}\tapps[\"${MAIN}\"] = ${MAIN}_main;\n") + set(builtin_apps_decl_string + "${builtin_apps_decl_string}extern int ${MAIN}_main(int argc, char *argv[]);\n") + math(EXPR command_count "${command_count}+1") + endif() + endforeach() + configure_file(${CMAKE_SOURCE_DIR}/cmake/posix/builtin_commands.cpp_in + ${OUT}) +endfunction() + +#============================================================================= +# +# px4_os_add_flags +# +# Set ths posix build flags. +# +# Usage: +# px4_os_add_flags( +# C_FLAGS +# CXX_FLAGS +# EXE_LINKER_FLAGS +# INCLUDE_DIRS +# LINK_DIRS +# DEFINITIONS ) +# +# Input: +# BOARD : flags depend on board/posix config +# +# Input/Output: (appends to existing variable) +# C_FLAGS : c compile flags variable +# CXX_FLAGS : c++ compile flags variable +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories +# LINK_DIRS : link directories +# DEFINITIONS : definitions +# +# Example: +# px4_os_add_flags( +# C_FLAGS CMAKE_C_FLAGS +# CXX_FLAGS CMAKE_CXX_FLAGS +# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS +# INCLUDES ) +# +function(px4_os_add_flags) + + set(inout_vars + C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) + + px4_parse_function_args( + NAME px4_add_flags + ONE_VALUE ${inout_vars} BOARD + REQUIRED ${inout_vars} BOARD + ARGN ${ARGN}) + + px4_add_common_flags( + BOARD ${BOARD} + C_FLAGS ${C_FLAGS} + CXX_FLAGS ${CXX_FLAGS} + EXE_LINKER_FLAGS ${EXE_LINKER_FLAGS} + INCLUDE_DIRS ${INCLUDE_DIRS} + LINK_DIRS ${LINK_DIRS} + DEFINITIONS ${DEFINITIONS}) + + set(PX4_BASE ) + set(added_include_dirs + src/modules/systemlib + src/lib/eigen + src/platforms/posix/include + mavlink/include/mavlink + ) + + set(added_definitions + -D__PX4_POSIX + -D__PX4_LINUX + -DCLOCK_MONOTONIC=1 + -Dnoreturn_function=__attribute__\(\(noreturn\)\) + -include ${PX4_INCLUDE_DIR}visibility.h + ) + + set(added_exe_linker_flags + -lpthread + ) + + + # Add the toolchain specific flags + set(added_cflags ${POSIX_CMAKE_C_FLAGS}) + set(added_cxx_flags ${POSIX_CMAKE_CXX_FLAGS}) + + # output + foreach(var ${inout_vars}) + string(TOLOWER ${var} lower_var) + set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE) + #message(STATUS "posix: set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)") + endforeach() + +endfunction() + +#============================================================================= +# +# px4_os_prebuild_targets +# +# This function generates os dependent targets +# +# Usage: +# px4_os_prebuild_targets( +# OUT +# BOARD +# ) +# +# Input: +# BOARD : board +# THREADS : number of threads for building +# +# Output: +# OUT : the target list +# +# Example: +# px4_os_prebuild_targets(OUT target_list BOARD px4fmu-v2) +# +function(px4_os_prebuild_targets) + px4_parse_function_args( + NAME px4_os_prebuild_targets + ONE_VALUE OUT BOARD THREADS + REQUIRED OUT BOARD + ARGN ${ARGN}) + add_custom_target(${OUT}) +endfunction() + +#============================================================================= +# +# px4_posix_add_modules +# +# This function adds target modules +# +# Usage: +# px4_os_prebuild_targets( +# OUT_MODULES +# BOARD +# ) +# +# Input: +# BOARD : board +# +# Output: +# OUT_MODULES : the updated module list +# +# Example: +# px4_posix_add_modules(module_list "hil") +# +function(px4_posix_add_modules OUT_MODULES BOARD) + include(config-posix-${BOARD}) + set(config_modules) + px4_set_config_modules(config_modules) + set(${OUT_MODULES} ${${OUT_MODULES}} ${config_modules} PARENT_SCOPE) +endfunction() + + +macro(px4_target_firmware) + set(installed_targets) + add_executable(main ./src/platforms/posix/main.cpp) + target_link_libraries(main ${module_list} ${EXE_LINK_LIBS} ${module_list} ${EXE_LINK_LIBS}) + list(APPEND installed_targets main) +endmacro() + diff --git a/cmake/posix/px4_target_impl.cmake b/cmake/posix/px4_target_impl.cmake deleted file mode 100644 index 6e0af6ba18..0000000000 --- a/cmake/posix/px4_target_impl.cmake +++ /dev/null @@ -1,111 +0,0 @@ -############################################################################ -# -# Copyright (c) 2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -#============================================================================= -# FILE: posix/px4_target_impl.cmake -# -# Each PX4 target OS must implement the cmake/${OS}/px4_target_impl.cmake -# rules for their target that implement the following macros: -# -# px4_target_set_flags -# px4_target_validate_config -# px4_target_firmware -# px4_target_rules -# px4_target_testing -# -# The macros are called from the top level CMakeLists.txt -# -set(POSIX_APPS_HEADER ${CMAKE_BINARY_DIR}/apps.h) - -add_git_submodule(eigen src/lib/eigen) - -macro(px4_target_set_flags) - include_directories( - src/platforms/posix/include - ) - add_definitions( - -D__PX4_POSIX - -D__PX4_LINUX - "-Dnoreturn_function=__attribute__\(\(noreturn\)\)" - -DCLOCK_MONOTONIC=1 - ) - list(APPEND EXE_LINK_LIBS - pthread - ) -endmacro() - -macro(px4_target_validate_config) - if(NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/${OS}/${TARGET_NAME}.cmake) - message(FATAL_ERROR "not implemented yet: ${TARGET_NAME}") - endif() -endmacro() - -macro(px4_target_set_modules) - # Include the target config file - include(${TARGET_NAME}) -endmacro() - -macro(px4_target_firmware) - set(installed_targets) - add_executable(main ./src/platforms/posix/main.cpp) - target_link_libraries(main ${module_list} ${EXE_LINK_LIBS} ${module_list} ${EXE_LINK_LIBS}) - list(APPEND installed_targets main) -endmacro() - -macro(px4_target_rules) - #============================================================================= - # apps - # - add_custom_command(OUTPUT ${POSIX_APPS_HEADER} - COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} - ${CMAKE_SOURCE_DIR}/Tools/posix_apps.py > ${POSIX_APPS_HEADER} - COMMENT "Generating posix apps" - VERBATIM - ) - - add_custom_target(posix_apps ALL DEPENDS ${POSIX_APPS_HEADER}) -endmacro() - -macro(px4_target_testing) - if (${BOARD} STREQUAL "sitl") - - add_test(test_px4_simple_app ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/test_compare.py - --command ${CMAKE_BINARY_DIR}/main - --stdout ${CMAKE_BINARY_DIR}/test/px4_simple_app_output.txt - --stdin ${CMAKE_SOURCE_DIR}/cmake/test/px4_simple_app_input.txt - --check ${CMAKE_SOURCE_DIR}/cmake/test/px4_simple_app_correct.txt - --start 4 --stop -1 - ) - - endif() -endmacro() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e69837558c..6f61960bcb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,6 +4,6 @@ add_subdirectory(./platforms) add_subdirectory(./systemcmds) add_subdirectory(./examples) add_subdirectory(./modules) -add_subdirectory(./firmware) +add_subdirectory(./firmware/${OS}) # vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index fed65f90df..df3c99ab59 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -1,3 +1,24 @@ -#TODO +include(px4_base) + +set(module_dir_list) +set(module_list) +px4_posix_add_modules(module_dir_list ${BOARD}) +message(STATUS "module list: ${module_dir_list}") + +foreach(directory ${module_dir_list}) + message(STATUS "directory: ${directory}") + px4_mangle_name(${directory} mangled_name) + list(APPEND module_list + ${mangled_name}) +endforeach() +px4_posix_generate_builtin_commands( + OUT builtin_commands.cpp + MODULE_LIST ${module_list}) + +add_executable(mainapp builtin_commands.cpp) +target_link_libraries(mainapp + ${module_list} + pthread m + ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/include/build_git_version.h b/src/include/build_git_version.h new file mode 100644 index 0000000000..35f139b386 --- /dev/null +++ b/src/include/build_git_version.h @@ -0,0 +1,2 @@ +#define PX4_GIT_VERSION_STR "1234567890123456789012345678901234567890" +#define PX4_GIT_VERSION_BINARY 0x1234567890123456 diff --git a/src/platforms/posix/drivers/airspeedsim/meas_airspeed_sim.cpp b/src/platforms/posix/drivers/airspeedsim/meas_airspeed_sim.cpp index 5aca386acb..ec07a0ea89 100644 --- a/src/platforms/posix/drivers/airspeedsim/meas_airspeed_sim.cpp +++ b/src/platforms/posix/drivers/airspeedsim/meas_airspeed_sim.cpp @@ -589,7 +589,7 @@ measairspeedsim_main(int argc, char *argv[]) } } - int ret; + int ret = 0; /* * Start/load the driver. diff --git a/src/systemcmds/CMakeLists.txt b/src/systemcmds/CMakeLists.txt index 6ee6b33a1f..52cabc06c5 100644 --- a/src/systemcmds/CMakeLists.txt +++ b/src/systemcmds/CMakeLists.txt @@ -16,7 +16,7 @@ set(directories ./motor_test ./esc_calib ./perf - ./topic_listener +# ./topic_listener ./dumpfile ./pwm ) diff --git a/src/systemcmds/topic_listener/CMakeLists.txt b/src/systemcmds/topic_listener/CMakeLists.txt index 2739b178ee..1503bac8b1 100644 --- a/src/systemcmds/topic_listener/CMakeLists.txt +++ b/src/systemcmds/topic_listener/CMakeLists.txt @@ -30,15 +30,15 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ -#px4_add_module( - #MODULE systemcmds__topic_listener - #MAIN listener - #STACK 1800 - #COMPILE_FLAGS - #-Os - #SRCS - #topic_listener.cpp - #DEPENDS - #platforms__common - #) +px4_add_module( + MODULE systemcmds__topic_listener + MAIN listener + STACK 1800 + COMPILE_FLAGS + -Os + SRCS + topic_listener.cpp + DEPENDS + platforms__common + ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 3d42a24398334b870e08f302a725025ecb3235a0 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 16:02:07 -0700 Subject: [PATCH 027/389] Added missing modules for posix MOst of the link errors are resolved. Param is still an issue. Signed-off-by: Mark Charlebois --- cmake/posix/configs/config-posix-sitl.cmake | 9 +++++++++ src/firmware/posix/CMakeLists.txt | 2 ++ 2 files changed, 11 insertions(+) diff --git a/cmake/posix/configs/config-posix-sitl.cmake b/cmake/posix/configs/config-posix-sitl.cmake index 647a30b87a..ece121908c 100644 --- a/cmake/posix/configs/config-posix-sitl.cmake +++ b/cmake/posix/configs/config-posix-sitl.cmake @@ -1,5 +1,9 @@ function(px4_set_config_modules out_module_list) set(config_module_list + drivers/led + drivers/device + drivers/boards/sitl + platforms/common platforms/posix/px4_layer platforms/posix/work_queue platforms/posix/drivers/adcsim @@ -14,7 +18,10 @@ function(px4_set_config_modules out_module_list) systemcmds/ver systemcmds/esc_calib systemcmds/reboot + modules/uORB + modules/systemlib modules/sensors + modules/simulator modules/mavlink modules/attitude_estimator_ekf modules/attitude_estimator_q @@ -34,6 +41,8 @@ function(px4_set_config_modules out_module_list) modules/commander modules/controllib lib/mathlib + lib/mathlib/math/filter + lib/conversion lib/ecl lib/external_lgpl lib/geo diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index df3c99ab59..58f6024b54 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -17,8 +17,10 @@ px4_posix_generate_builtin_commands( add_executable(mainapp builtin_commands.cpp) target_link_libraries(mainapp + -Wl,--start-group ${module_list} pthread m + -Wl,--end-group ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 91cf77c68b82f628f1ae9c6f95cecae177d46fa8 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 16:12:45 -0700 Subject: [PATCH 028/389] Added more missing modules for posix Signed-off-by: Mark Charlebois --- cmake/posix/configs/config-posix-sitl.cmake | 1 + src/modules/simulator/CMakeLists.txt | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/posix/configs/config-posix-sitl.cmake b/cmake/posix/configs/config-posix-sitl.cmake index ece121908c..1b5672aef1 100644 --- a/cmake/posix/configs/config-posix-sitl.cmake +++ b/cmake/posix/configs/config-posix-sitl.cmake @@ -20,6 +20,7 @@ function(px4_set_config_modules out_module_list) systemcmds/reboot modules/uORB modules/systemlib + modules/systemlib/mixer modules/sensors modules/simulator modules/mavlink diff --git a/src/modules/simulator/CMakeLists.txt b/src/modules/simulator/CMakeLists.txt index 13025e5eab..1e81695b97 100644 --- a/src/modules/simulator/CMakeLists.txt +++ b/src/modules/simulator/CMakeLists.txt @@ -30,6 +30,12 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +set(SIMULATOR_SRCS simulator.cpp) +if (NOT ${OS} STREQUAL "qurt") + list(APPEND SIMULATOR_SRCS + simulator_mavlink.cpp) +endif() + px4_add_module( MODULE modules__simulator MAIN simulator @@ -40,8 +46,9 @@ px4_add_module( -Wno-packed SRCS - simulator.cpp + ${SIMULATOR_SRCS} DEPENDS platforms__common ) + # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 9c8dd69f2964af5a31667889c428f498ab561096 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 16:14:11 -0700 Subject: [PATCH 029/389] Removed debug Signed-off-by: Mark Charlebois --- cmake/nuttx/px4_impl_nuttx.cmake | 2 -- cmake/posix/px4_impl_posix.cmake | 1 - 2 files changed, 3 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index dad2709aaf..b511c43968 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -31,8 +31,6 @@ # ############################################################################ -message(STATUS "included nuttx file") - #============================================================================= # # Defined functions in this file diff --git a/cmake/posix/px4_impl_posix.cmake b/cmake/posix/px4_impl_posix.cmake index cc77c08d44..46c21e29f9 100644 --- a/cmake/posix/px4_impl_posix.cmake +++ b/cmake/posix/px4_impl_posix.cmake @@ -31,7 +31,6 @@ # ############################################################################ -message(STATUS "include posix file") #============================================================================= # # Defined functions in this file From fbebeab1b42bb61866a4411ee574cc97c07a6338 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 19:27:38 -0400 Subject: [PATCH 030/389] Added mixer generation. --- src/modules/systemlib/mixer/CMakeLists.txt | 8 ++++++++ src/platforms/common/CMakeLists.txt | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/modules/systemlib/mixer/CMakeLists.txt b/src/modules/systemlib/mixer/CMakeLists.txt index 429615d14b..bb2b4422a5 100644 --- a/src/modules/systemlib/mixer/CMakeLists.txt +++ b/src/modules/systemlib/mixer/CMakeLists.txt @@ -30,6 +30,13 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_custom_command(OUTPUT mixer_multirotor.generated.h + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/multi_tables.py + > mixer_multirotor.generated.h) + px4_add_module( MODULE modules__systemlib__mixer SRCS @@ -38,6 +45,7 @@ px4_add_module( mixer_multirotor.cpp mixer_simple.cpp mixer_load.c + mixer_multirotor.generated.h DEPENDS platforms__common ) diff --git a/src/platforms/common/CMakeLists.txt b/src/platforms/common/CMakeLists.txt index c60f47764e..b7a003b506 100644 --- a/src/platforms/common/CMakeLists.txt +++ b/src/platforms/common/CMakeLists.txt @@ -35,6 +35,10 @@ set(depends prebuild_targets ) +if(${OS} STREQUAL "posix") + list(APPEND depends git_eigen git_mavlink) +endif() + px4_add_module( MODULE platforms__common SRCS From 126325bace9a70f5d51280a01c2cc284412b4e09 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 20:50:18 -0400 Subject: [PATCH 031/389] Work on posix. --- cmake/posix/ld.script | 46 +++++++++++++++++++++++++++++++ src/firmware/posix/CMakeLists.txt | 17 +++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 cmake/posix/ld.script diff --git a/cmake/posix/ld.script b/cmake/posix/ld.script new file mode 100644 index 0000000000..32478e1e14 --- /dev/null +++ b/cmake/posix/ld.script @@ -0,0 +1,46 @@ +/**************************************************************************** + * ld.script + * + * Copyright (C) 2015 Mark Charlebois. All rights reserved. + * Author: Mark Charlebois + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +SECTIONS +{ + /* + * Construction data for parameters. + */ + __param : ALIGN(8) { + __param_start = .; + KEEP(*(__param*)) + __param_end = .; + } +} diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index 58f6024b54..6dfda2bea7 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -5,6 +5,11 @@ set(module_list) px4_posix_add_modules(module_dir_list ${BOARD}) message(STATUS "module list: ${module_dir_list}") +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_custom_command(OUTPUT apps.h + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/posix_apps.py > apps.h) + foreach(directory ${module_dir_list}) message(STATUS "directory: ${directory}") px4_mangle_name(${directory} mangled_name) @@ -15,7 +20,17 @@ px4_posix_generate_builtin_commands( OUT builtin_commands.cpp MODULE_LIST ${module_list}) -add_executable(mainapp builtin_commands.cpp) +add_executable(mainapp + ${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp + apps.h + builtin_commands.cpp) + +set(main_link_flags + "-T${CMAKE_SOURCE_DIR}/cmake/posix/ld.script" + ) +px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") +set_target_properties(mainapp PROPERTIES LINK_FLAGS ${main_link_flags}) + target_link_libraries(mainapp -Wl,--start-group ${module_list} From 73a328473e92eec0c347452db05c6a13bce0620a Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 21:22:05 -0400 Subject: [PATCH 032/389] Fix for posix linker script. --- cmake/posix/ld.script | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/posix/ld.script b/cmake/posix/ld.script index 32478e1e14..7069271193 100644 --- a/cmake/posix/ld.script +++ b/cmake/posix/ld.script @@ -44,3 +44,4 @@ SECTIONS __param_end = .; } } +INSERT AFTER .rodata; From 75f1f9178425841321b203c89710537833368d8c Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 18:39:51 -0700 Subject: [PATCH 033/389] cmake qurt and posix fixes for cmake Added generation of build_git_version.h Added separate src/lib/eigen-3.2 dir for qurt (new submodule) Added patching of eigen-3.2 for qurt (compiler has issue with Complex) Signed-off-by: Mark Charlebois --- .gitmodules | 3 +++ CMakeLists.txt | 14 ++++++++++++-- cmake/build_git_version.h.in | 4 ++++ cmake/px4_base.cmake | 7 ++++++- cmake/px4_git_hash.cmake | 31 +++++++++++++++++++++++++++++++ cmake/qurt/px4_impl_qurt.cmake | 3 +++ cmake/qurt/qurt_eigen.patch | 17 +++++++++++++++++ src/include/build_git_version.h | 2 -- src/lib/eigen-3.2 | 1 + 9 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 cmake/build_git_version.h.in create mode 100644 cmake/px4_git_hash.cmake create mode 100644 cmake/qurt/qurt_eigen.patch delete mode 100644 src/include/build_git_version.h create mode 160000 src/lib/eigen-3.2 diff --git a/.gitmodules b/.gitmodules index cb9a6ccf05..9db1631350 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ [submodule "src/lib/dspal"] path = src/lib/dspal url = https://github.com/mcharleb/dspal.git +[submodule "src/lib/eigen-3.2"] + path = src/lib/eigen-3.2 + url = https://github.com/PX4/eigen.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 58731547b9..11b0e4fde5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,12 +175,16 @@ endforeach() #============================================================================= # git # -px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +if (${OS} STREQUAL "nuttx") + px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +endif() px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") -px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") +if (NOT ${OS} STREQUAL "qurt") + px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") +endif() add_custom_target(submodule_clean WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} @@ -233,6 +237,12 @@ add_subdirectory(src) # set the overall objective of the build add_custom_target(ALL firmware_${OS}) +#============================================================================= +# generate git version +# +include(px4_git_hash) +px4_create_git_hash_header(HEADER ${CMAKE_BINARY_DIR}/build_git_version.h) + #============================================================================= # packaging # diff --git a/cmake/build_git_version.h.in b/cmake/build_git_version.h.in new file mode 100644 index 0000000000..1d1adb9ba3 --- /dev/null +++ b/cmake/build_git_version.h.in @@ -0,0 +1,4 @@ +/* Auto Magically Generated file */ +/* Do not edit! */ +#define PX4_GIT_VERSION_STR @git_desc@ +#define PX4_GIT_VERSION_BINARY 0x@git_desc_short@ diff --git a/cmake/px4_base.cmake b/cmake/px4_base.cmake index 888011fe76..42d75c5b4b 100644 --- a/cmake/px4_base.cmake +++ b/cmake/px4_base.cmake @@ -581,13 +581,18 @@ function(px4_add_common_flags) # TODO Build/versioning was in Makefile, # do we need this, how does it work with cmake src/drivers/boards/${BOARD} - src/lib/eigen ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/src/modules/px4_messages ${CMAKE_BINARY_DIR}/src/modules mavlink/include/mavlink ) + if (NOT ${OS} STREQUAL "qurt") + list(APPEND added_include_dirs + src/lib/eigen + ) + endif() + set(added_link_dirs) # none used currently string(TOUPPER ${BOARD} board_upper) diff --git a/cmake/px4_git_hash.cmake b/cmake/px4_git_hash.cmake new file mode 100644 index 0000000000..a3a29b2d14 --- /dev/null +++ b/cmake/px4_git_hash.cmake @@ -0,0 +1,31 @@ +#============================================================================= +# +# px4_create_git_hash_header +# +# Create a header file containing the git hash of the current tree +# +# Usage: +# px4_create_git_hash_header(HEADER ${CMAKE_BUILD_DIR}/git_hash.h) +# +# Input: +# HEADER : path of the header file to generate +# +# Example: +# px4_create_git_hash_header(HEADER ${CMAKE_BUILD_DIR}/git_hash.h) +# +function(px4_create_git_hash_header) + px4_parse_function_args( + NAME px4_create_git_hash_header + ONE_VALUE HEADER + REQUIRED HEADER + ARGN ${ARGN}) + execute_process( + COMMAND git log -n 1 --pretty=format:"%H" + OUTPUT_VARIABLE git_desc + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + message(STATUS "GIT_DESC = ${git_desc}") + set(git_desc_short) + string(SUBSTRING ${git_desc} 1 16 git_desc_short) + configure_file(${CMAKE_SOURCE_DIR}/cmake/build_git_version.h.in ${HEADER} @ONLY) +endfunction() diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index 1874787f57..44cce7599d 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -227,6 +227,9 @@ function(px4_os_prebuild_targets) REQUIRED OUT BOARD ARGN ${ARGN}) add_custom_target(${OUT}) + execute_process( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/eigen-3.2 + COMMAND patch -p1 -i ../../../cmake/qurt/qurt_eigen.patch) endfunction() #============================================================================= diff --git a/cmake/qurt/qurt_eigen.patch b/cmake/qurt/qurt_eigen.patch new file mode 100644 index 0000000000..9ea57403ba --- /dev/null +++ b/cmake/qurt/qurt_eigen.patch @@ -0,0 +1,17 @@ +This patch is required for QuRT. complex.h defines "I" and it replaces "I" in the +enum definition without this patch creating an error. + +diff --git a/Eigen/src/Core/SolveTriangular.h b/Eigen/src/Core/SolveTriangular.h +index ef17f28..1116270 100644 +--- a/Eigen/src/Core/SolveTriangular.h ++++ b/Eigen/src/Core/SolveTriangular.h +@@ -112,6 +112,9 @@ template + struct triangular_solver_unroller; + ++#ifdef __PX4_QURT ++#undef I ++#endif + template + struct triangular_solver_unroller { + enum { diff --git a/src/include/build_git_version.h b/src/include/build_git_version.h deleted file mode 100644 index 35f139b386..0000000000 --- a/src/include/build_git_version.h +++ /dev/null @@ -1,2 +0,0 @@ -#define PX4_GIT_VERSION_STR "1234567890123456789012345678901234567890" -#define PX4_GIT_VERSION_BINARY 0x1234567890123456 diff --git a/src/lib/eigen-3.2 b/src/lib/eigen-3.2 new file mode 160000 index 0000000000..e7850ed81f --- /dev/null +++ b/src/lib/eigen-3.2 @@ -0,0 +1 @@ +Subproject commit e7850ed81f9c469e02df496ef09ae32ec0379b71 From dbc60d99c5be6e8d59f46a164e9b3a3482f2e9c2 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 18:50:11 -0700 Subject: [PATCH 034/389] cmake: qurt fix to build shared lib, not executable Signed-off-by: Mark Charlebois --- cmake/qurt/configs/config-qurt-hil.cmake | 1 + src/firmware/qurt/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/qurt/configs/config-qurt-hil.cmake b/cmake/qurt/configs/config-qurt-hil.cmake index 694aa8d0ea..d9d3e2ee13 100644 --- a/cmake/qurt/configs/config-qurt-hil.cmake +++ b/cmake/qurt/configs/config-qurt-hil.cmake @@ -6,6 +6,7 @@ function(px4_set_config_modules out_module_list) drivers/led drivers/rgbled modules/sensors + modules/uORB # drivers/blinkm # drivers/ms5611 diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index fa0720c743..b5babecf11 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -25,7 +25,7 @@ px4_qurt_generate_builtin_commands( set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -add_executable(mainapp builtin_commands.cpp) +add_library(mainapp builtin_commands.cpp) target_link_libraries(mainapp -Wl,--whole-archive ${module_list} From b561215017bc787d04a16823019b8c51999754d8 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 19:17:53 -0700 Subject: [PATCH 035/389] cmake: fixes for apps.h generation for posix and qurt Signed-off-by: Mark Charlebois --- .../apps.h_in} | 32 +++++++++++-------- cmake/posix/px4_impl_posix.cmake | 2 +- .../apps.h_in} | 0 cmake/qurt/px4_impl_qurt.cmake | 2 +- src/firmware/posix/CMakeLists.txt | 8 ++--- src/firmware/qurt/CMakeLists.txt | 7 ++-- 6 files changed, 29 insertions(+), 22 deletions(-) rename cmake/{qurt/builtin_commands.cpp_in => posix/apps.h_in} (75%) rename cmake/{posix/builtin_commands.cpp_in => qurt/apps.h_in} (100%) diff --git a/cmake/qurt/builtin_commands.cpp_in b/cmake/posix/apps.h_in similarity index 75% rename from cmake/qurt/builtin_commands.cpp_in rename to cmake/posix/apps.h_in index f4d240d529..7b29304b3f 100644 --- a/cmake/qurt/builtin_commands.cpp_in +++ b/cmake/posix/apps.h_in @@ -22,9 +22,10 @@ static int list_topics_main(int argc, char *argv[]); static int sleep_main(int argc, char *argv[]); } - -void init_app_map(map &apps) +static map app_map(void) { + static map apps; + ${builtin_apps_string} apps["shutdown"] = shutdown_main; apps["list_tasks"] = list_tasks_main; @@ -32,13 +33,17 @@ ${builtin_apps_string} apps["list_devices"] = list_devices_main; apps["list_topics"] = list_topics_main; apps["sleep"] = sleep_main; + + return apps; } -void list_builtins(map &apps) +map apps = app_map(); + +static void list_builtins(void) { - printf("Builtin Commands:\\n"); + cout << "Builtin Commands:" << endl; for (map::iterator it=apps.begin(); it!=apps.end(); ++it) - printf("\\t%s\\n", (it->first).c_str()); + cout << '\t' << it->first << endl; } static int shutdown_main(int argc, char *argv[]) @@ -64,21 +69,20 @@ static int list_topics_main(int argc, char *argv[]) px4_show_topics(); return 0; } + static int list_files_main(int argc, char *argv[]) { px4_show_files(); return 0; } + static int sleep_main(int argc, char *argv[]) { - if (argc != 2) { - PX4_WARN( "Usage: sleep " ); - return 1; - } - - unsigned long usecs = ( (unsigned long) atol( argv[1] ) ) * 1000 * 1000; - PX4_WARN("Sleeping for %s, %ld",argv[1],usecs); - usleep( usecs ); - return 0; + if (argc != 2) { + cout << "Usage: sleep " << endl; + return 1; + } + sleep(atoi(argv[1])); + return 0; } diff --git a/cmake/posix/px4_impl_posix.cmake b/cmake/posix/px4_impl_posix.cmake index 46c21e29f9..6108b9c94f 100644 --- a/cmake/posix/px4_impl_posix.cmake +++ b/cmake/posix/px4_impl_posix.cmake @@ -102,7 +102,7 @@ function(px4_posix_generate_builtin_commands) math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${CMAKE_SOURCE_DIR}/cmake/posix/builtin_commands.cpp_in + configure_file(${CMAKE_SOURCE_DIR}/cmake/posix/apps.h_in ${OUT}) endfunction() diff --git a/cmake/posix/builtin_commands.cpp_in b/cmake/qurt/apps.h_in similarity index 100% rename from cmake/posix/builtin_commands.cpp_in rename to cmake/qurt/apps.h_in diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index 44cce7599d..cdd42a37fa 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -104,7 +104,7 @@ function(px4_qurt_generate_builtin_commands) math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/builtin_commands.cpp_in + configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/apps.h_in ${OUT}) endfunction() diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index 6dfda2bea7..de02be35c4 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -7,8 +7,8 @@ message(STATUS "module list: ${module_dir_list}") include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_custom_command(OUTPUT apps.h - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/posix_apps.py > apps.h) +#add_custom_command(OUTPUT apps.h +# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/posix_apps.py > apps.h) foreach(directory ${module_dir_list}) message(STATUS "directory: ${directory}") @@ -17,13 +17,13 @@ foreach(directory ${module_dir_list}) ${mangled_name}) endforeach() px4_posix_generate_builtin_commands( - OUT builtin_commands.cpp + OUT apps.h MODULE_LIST ${module_list}) add_executable(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp apps.h - builtin_commands.cpp) + ) set(main_link_flags "-T${CMAKE_SOURCE_DIR}/cmake/posix/ld.script" diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index b5babecf11..5087639174 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -16,7 +16,7 @@ foreach(directory ${module_dir_list}) ${mangled_name}) endforeach() px4_qurt_generate_builtin_commands( - OUT builtin_commands.cpp + OUT apps.h MODULE_LIST ${module_list}) # FIXME @jgoppert - how to work around issues like this? @@ -25,7 +25,10 @@ px4_qurt_generate_builtin_commands( set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -add_library(mainapp builtin_commands.cpp) +add_library(mainapp + ${CMAKE_SOURCE_DIR}/src/platforms/qurt/px4_layer/main.cpp + apps.h) + target_link_libraries(mainapp -Wl,--whole-archive ${module_list} From b781093c19cdb2866893de35ccf50634f51438f3 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 8 Sep 2015 22:32:58 -0400 Subject: [PATCH 036/389] Deleted extra cmake file. --- src/firmware/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/firmware/CMakeLists.txt diff --git a/src/firmware/CMakeLists.txt b/src/firmware/CMakeLists.txt deleted file mode 100644 index ebf2b30bd6..0000000000 --- a/src/firmware/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(./nuttx) - -# vim: set noet ft=cmake fenc=utf-8 ff=unix : From d5d758bdc6f48adc82fd252bb35238ac8600be10 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 8 Sep 2015 19:34:59 -0700 Subject: [PATCH 037/389] qurt: Updated the version of dspal headers Signed-off-by: Mark Charlebois --- src/lib/dspal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dspal b/src/lib/dspal index 1741154446..e691659c00 160000 --- a/src/lib/dspal +++ b/src/lib/dspal @@ -1 +1 @@ -Subproject commit 1741154446c7c92c6e632d7ee1619c6d4174bf2d +Subproject commit e691659c000a63be6f6db0d9a367ed5a705fbdee From b6b25f2ad157e24d06d90f522cc3e55d899d66d6 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Wed, 9 Sep 2015 08:18:41 -0400 Subject: [PATCH 038/389] Nuttx sim support. --- Makefile | 7 + cmake/Toolchain-native.cmake | 17 + nuttx-configs/sim/include/README.txt | 1 + nuttx-configs/sim/include/board.h | 0 nuttx-configs/sim/nsh/Make.defs | 111 ++++++ nuttx-configs/sim/nsh/defconfig | 531 ++++++++++++++++++++++++++ nuttx-configs/sim/nsh/setenv.sh | 45 +++ src/drivers/boards/sim/board_config.h | 0 8 files changed, 712 insertions(+) create mode 100644 cmake/Toolchain-native.cmake create mode 100644 nuttx-configs/sim/include/README.txt create mode 100644 nuttx-configs/sim/include/board.h create mode 100644 nuttx-configs/sim/nsh/Make.defs create mode 100644 nuttx-configs/sim/nsh/defconfig create mode 100755 nuttx-configs/sim/nsh/setenv.sh create mode 100644 src/drivers/boards/sim/board_config.h diff --git a/Makefile b/Makefile index 686fd85378..34f417a992 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,13 @@ px4fmu-v2_simple: -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP +nuttx-sim-simple: + echo "nuttx-sim-simple is a work in progress" + mkdir -p $d/build_$@ && cd $d/build_$@ && \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-native.cmake \ + -DOS=nuttx -DBOARD=sim -DLABEL=simple && \ + make -s && ctest -V && cpack -G ZIP + px4fmu-v2_simple-upload: px4fmu-v2_simple cd $d/build_$< && make upload diff --git a/cmake/Toolchain-native.cmake b/cmake/Toolchain-native.cmake new file mode 100644 index 0000000000..e7792a5f87 --- /dev/null +++ b/cmake/Toolchain-native.cmake @@ -0,0 +1,17 @@ +# compiler tools +foreach(tool objcopy nm ld) + string(TOUPPER ${tool} TOOL) + find_program(${TOOL} ${tool}) + if(NOT ${TOOL}) + message(FATAL_ERROR "could not find ${tool}") + endif() +endforeach() + +# os tools +foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip) + string(TOUPPER ${tool} TOOL) + find_program(${TOOL} ${tool}) + if(NOT ${TOOL}) + message(FATAL_ERROR "could not find ${TOOL}") + endif() +endforeach() diff --git a/nuttx-configs/sim/include/README.txt b/nuttx-configs/sim/include/README.txt new file mode 100644 index 0000000000..f807449043 --- /dev/null +++ b/nuttx-configs/sim/include/README.txt @@ -0,0 +1 @@ +This directory contains header files unique to the Linux user-mode platform. diff --git a/nuttx-configs/sim/include/board.h b/nuttx-configs/sim/include/board.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/nuttx-configs/sim/nsh/Make.defs b/nuttx-configs/sim/nsh/Make.defs new file mode 100644 index 0000000000..83402a2397 --- /dev/null +++ b/nuttx-configs/sim/nsh/Make.defs @@ -0,0 +1,111 @@ +############################################################################ +# configs/sim/nsh/Make.defs +# +# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include ${TOPDIR}/.config +include ${TOPDIR}/tools/Config.mk + +HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = -O2 +endif + +ARCHCPUFLAGS = -std=gnu99 -fno-builtin +ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti +ARCHPICFLAGS = -fpic +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = +ARCHINCLUDES = -I. -isystem $(TOPDIR)/include +ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx +ARCHSCRIPT = + +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + +CROSSDEV = +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +OBJEXT = .o +LIBEXT = .a + +ifeq ($(HOSTOS),Cygwin) + EXEEXT = .exe +else + EXEEXT = +endif + +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 +endif + + +MKDEP = $(TOPDIR)/tools/mkdeps.sh + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +HOSTLDFLAGS = diff --git a/nuttx-configs/sim/nsh/defconfig b/nuttx-configs/sim/nsh/defconfig new file mode 100644 index 0000000000..c3088107d9 --- /dev/null +++ b/nuttx-configs/sim/nsh/defconfig @@ -0,0 +1,531 @@ +# +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# +CONFIG_NUTTX_NEWCONFIG=y + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +CONFIG_DEBUG_SYMBOLS=y + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +# CONFIG_ARCH_ARM is not set +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +CONFIG_ARCH_SIM=y +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="sim" +CONFIG_BOARD_LOOPSPERMSEC=0 + +# +# Simulation Configuration Options +# +# CONFIG_SIM_M32 is not set +# CONFIG_SIM_WALLTIME is not set + +# +# External Memory Configuration +# + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_VECNOTIRQ is not set +# CONFIG_ARCH_DMA is not set +# CONFIG_ARCH_IRQPRIO is not set +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +# CONFIG_ARCH_HAVE_VFORK is not set +# CONFIG_ARCH_STACKDUMP is not set +# CONFIG_ENDIAN_BIG is not set +# CONFIG_ARCH_HAVE_RAMFUNCS is not set + +# +# Board Settings +# +CONFIG_DRAM_START=0x0 +CONFIG_DRAM_SIZE=0 + +# +# Boot options +# +CONFIG_BOOT_RUNFROMEXTSRAM=y +# CONFIG_BOOT_RUNFROMFLASH is not set +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_SIM=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="sim" + +# +# Common Board Options +# +CONFIG_NSH_MMCSDMINOR=0 + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 +CONFIG_RR_INTERVAL=0 +# CONFIG_SCHED_INSTRUMENTATION is not set +CONFIG_TASK_NAME_SIZE=32 +CONFIG_SCHED_HAVE_PARENT=y +# CONFIG_SCHED_CHILD_STATUS is not set +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2008 +CONFIG_START_MONTH=6 +CONFIG_START_DAY=1 +CONFIG_DEV_CONSOLE=y +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +# CONFIG_SCHED_WORKQUEUE is not set +CONFIG_SCHED_WAITPID=y +# CONFIG_SCHED_STARTHOOK is not set +# CONFIG_SCHED_ATEXIT is not set +CONFIG_SCHED_ONEXIT=y +CONFIG_SCHED_ONEXIT_MAX=1 +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_ENVIRON is not set + +# +# Signal Numbers +# +CONFIG_SIG_SIGUSR1=1 +CONFIG_SIG_SIGUSR2=2 +CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCHLD=4 +CONFIG_SIG_SIGCONDTIMEDOUT=16 + +# +# Sizes of configurable things (0 disables) +# +CONFIG_MAX_TASKS=64 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=32 +CONFIG_NFILE_STREAMS=16 +CONFIG_NAME_MAX=32 +CONFIG_PREALLOC_MQ_MSGS=32 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=4 +CONFIG_PREALLOC_WDOGS=32 +CONFIG_PREALLOC_TIMERS=8 + +# +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_USERMAIN_STACKSIZE=4096 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=8192 + +# +# Device Drivers +# +CONFIG_DISABLE_POLL=y +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +# CONFIG_STANDARD_SERIAL is not set +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_FS_RAMMAP is not set +CONFIG_FS_FAT=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FAT_MAXFNAME=32 +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_FS_NXFFS is not set +CONFIG_FS_ROMFS=y +CONFIG_FS_BINFS=y + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +CONFIG_BINFMT_EXEPATH=y +CONFIG_PATH_INITIAL="/bin" +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +CONFIG_BUILTIN=y +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=64 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +CONFIG_LIBC_EXECFUNCS=y +CONFIG_EXECFUNCS_SYMTAB="g_symtab" +CONFIG_EXECFUNCS_NSYMBOLS=0 +CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024 +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +# CONFIG_LIB_KBDCODEC is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +CONFIG_BUILTIN_PROXY_STACKSIZE=1024 + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +CONFIG_EXAMPLES_HELLO=y +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +CONFIG_EXAMPLES_NSH=y +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POSIXSPAWN is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILE_APPS=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 +CONFIG_NSH_FILEIOSIZE=1024 +CONFIG_NSH_LINELEN=80 +CONFIG_NSH_NESTDEPTH=3 +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set +CONFIG_NSH_ROMFSETC=y +CONFIG_NSH_ROMFSMOUNTPT="/etc" +CONFIG_NSH_INITSCRIPT="init.d/rcS" +CONFIG_NSH_ROMFSDEVNO=1 +CONFIG_NSH_ROMFSSECTSIZE=64 +CONFIG_NSH_FATDEVNO=2 +CONFIG_NSH_FATSECTSIZE=512 +CONFIG_NSH_FATNSECTORS=1024 +CONFIG_NSH_FATMOUNTPT="/tmp" +CONFIG_NSH_CONSOLE=y +# CONFIG_NSH_CONDEV is not set +# CONFIG_NSH_ARCHINIT is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx-configs/sim/nsh/setenv.sh b/nuttx-configs/sim/nsh/setenv.sh new file mode 100755 index 0000000000..c629c5a1ec --- /dev/null +++ b/nuttx-configs/sim/nsh/setenv.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# sim/nsh/setenv.sh +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ "$(basename $0)" = "setenv.sh" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi + +#export NUTTX_BIN= +#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG} + +echo "PATH : ${PATH}" diff --git a/src/drivers/boards/sim/board_config.h b/src/drivers/boards/sim/board_config.h new file mode 100644 index 0000000000..e69de29bb2 From cf3739448418719c5d902f11914dae312efa3e76 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Wed, 9 Sep 2015 08:28:54 -0400 Subject: [PATCH 039/389] Added board config for nuttx sim. --- src/drivers/boards/sim/board_config.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/drivers/boards/sim/board_config.h b/src/drivers/boards/sim/board_config.h index e69de29bb2..6413bb780b 100644 --- a/src/drivers/boards/sim/board_config.h +++ b/src/drivers/boards/sim/board_config.h @@ -0,0 +1,13 @@ +#define UDID_START 0x1FFF7A10 + +/* + * I2C busses + */ +#define PX4_I2C_BUS_ESC 1 +#define PX4_SIM_BUS_TEST 2 +#define PX4_I2C_BUS_EXPANSION 3 +#define PX4_I2C_BUS_LED 3 + +#define PX4_I2C_OBDEV_LED 0x55 + +#define STM32_SYSMEM_UID "SIMULATIONID" From 5a59d7d74f10bd85a33367b7424845b4db6096dd Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Wed, 9 Sep 2015 10:15:37 -0700 Subject: [PATCH 040/389] cmake: added support for topic_listener.cpp Signed-off-by: Mark Charlebois --- cmake/posix/configs/config-posix-sitl.cmake | 1 + src/systemcmds/CMakeLists.txt | 2 +- src/systemcmds/topic_listener/CMakeLists.txt | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmake/posix/configs/config-posix-sitl.cmake b/cmake/posix/configs/config-posix-sitl.cmake index 1b5672aef1..99895b2ad4 100644 --- a/cmake/posix/configs/config-posix-sitl.cmake +++ b/cmake/posix/configs/config-posix-sitl.cmake @@ -18,6 +18,7 @@ function(px4_set_config_modules out_module_list) systemcmds/ver systemcmds/esc_calib systemcmds/reboot + systemcmds/topic_listener modules/uORB modules/systemlib modules/systemlib/mixer diff --git a/src/systemcmds/CMakeLists.txt b/src/systemcmds/CMakeLists.txt index 52cabc06c5..6ee6b33a1f 100644 --- a/src/systemcmds/CMakeLists.txt +++ b/src/systemcmds/CMakeLists.txt @@ -16,7 +16,7 @@ set(directories ./motor_test ./esc_calib ./perf -# ./topic_listener + ./topic_listener ./dumpfile ./pwm ) diff --git a/src/systemcmds/topic_listener/CMakeLists.txt b/src/systemcmds/topic_listener/CMakeLists.txt index 1503bac8b1..2f720757ac 100644 --- a/src/systemcmds/topic_listener/CMakeLists.txt +++ b/src/systemcmds/topic_listener/CMakeLists.txt @@ -30,6 +30,14 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ + +add_custom_command(OUTPUT topic_listener.cpp + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/generate_listener.py ${CMAKE_SOURCE_DIR} > topic_listener.cpp + ) + +add_custom_target(generate_topic_listener + DEPENDS topic_listener.cpp) + px4_add_module( MODULE systemcmds__topic_listener MAIN listener @@ -40,5 +48,6 @@ px4_add_module( topic_listener.cpp DEPENDS platforms__common + generate_topic_listener ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 9c376119d06a96461299c45837dcddb2fbc0bae1 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Wed, 9 Sep 2015 13:24:29 -0700 Subject: [PATCH 041/389] cmake: changes required for qurt build Fixed CMakeLists.txt to be consistent with module.mk Converted PX4_TICKS_PER_SEC to define for QURT to get around relocation error Added stubs for QURT so building a full executable can be tested. This will enable CI testing without the full Hexagon SDK. Signed-off-by: Mark Charlebois --- Makefile | 2 +- cmake/qurt/configs/config-qurt-hil.cmake | 2 +- cmake/qurt/px4_impl_qurt.cmake | 3 +- src/firmware/posix/CMakeLists.txt | 3 - src/firmware/qurt/CMakeLists.txt | 22 ++++- src/modules/uORB/CMakeLists.txt | 5 + src/platforms/px4_defines.h | 4 + src/platforms/qurt/dspal/dspal_stub.c | 24 +++-- src/platforms/qurt/px4_layer/CMakeLists.txt | 26 +++-- src/platforms/qurt/px4_layer/commands_hil.c | 1 + src/platforms/qurt/px4_layer/main.cpp | 12 +-- .../qurt/px4_layer/px4_qurt_impl.cpp | 2 +- src/platforms/qurt/px4_layer/qurt_stubs.c | 15 ++- src/platforms/qurt/stubs/stubs_posix.c | 99 +++++++++++++++++++ src/platforms/qurt/stubs/stubs_qurt.c | 14 +++ 15 files changed, 201 insertions(+), 33 deletions(-) create mode 100644 src/platforms/qurt/stubs/stubs_posix.c create mode 100644 src/platforms/qurt/stubs/stubs_qurt.c diff --git a/Makefile b/Makefile index 34f417a992..5b9146fce5 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ posix-sitl_simple: qurt-hil_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-hexagon.cmake \ + cmake .. -DQURT_ENABLE_STUBS=1 -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-hexagon.cmake \ -DOS=qurt -DBOARD=hil -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP diff --git a/cmake/qurt/configs/config-qurt-hil.cmake b/cmake/qurt/configs/config-qurt-hil.cmake index d9d3e2ee13..6d7cbae5e4 100644 --- a/cmake/qurt/configs/config-qurt-hil.cmake +++ b/cmake/qurt/configs/config-qurt-hil.cmake @@ -6,7 +6,6 @@ function(px4_set_config_modules out_module_list) drivers/led drivers/rgbled modules/sensors - modules/uORB # drivers/blinkm # drivers/ms5611 @@ -60,6 +59,7 @@ function(px4_set_config_modules out_module_list) # # QuRT port # + platforms/common platforms/qurt/px4_layer platforms/posix/work_queue # platforms/posix/drivers/accelsim diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index cdd42a37fa..f643068c7d 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -104,8 +104,7 @@ function(px4_qurt_generate_builtin_commands) math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/apps.h_in - ${OUT}) + configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/apps.h_in ${OUT}) endfunction() #============================================================================= diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index de02be35c4..e8c037ba9b 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -7,9 +7,6 @@ message(STATUS "module list: ${module_dir_list}") include_directories(${CMAKE_CURRENT_BINARY_DIR}) -#add_custom_command(OUTPUT apps.h -# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/posix_apps.py > apps.h) - foreach(directory ${module_dir_list}) message(STATUS "directory: ${directory}") px4_mangle_name(${directory} mangled_name) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index 5087639174..ac8de03c92 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -15,8 +15,9 @@ foreach(directory ${module_dir_list}) list(APPEND module_list ${mangled_name}) endforeach() + px4_qurt_generate_builtin_commands( - OUT apps.h + OUT ${CMAKE_BINARY_DIR}/apps.h MODULE_LIST ${module_list}) # FIXME @jgoppert - how to work around issues like this? @@ -25,9 +26,22 @@ px4_qurt_generate_builtin_commands( set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -add_library(mainapp - ${CMAKE_SOURCE_DIR}/src/platforms/qurt/px4_layer/main.cpp - apps.h) +# Enable build without HexagonSDK to check link dependencies +if ("${QURT_ENABLE_STUBS}" STREQUAL "1") + add_executable(mainapp + ${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c + ${CMAKE_BINARY_DIR}/apps.h) +else("${QURT_ENABLE_STUBS}" STREQUAL "1") + add_library(mainapp + ${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c + ${CMAKE_BINARY_DIR}/apps.h) +endif() + +set(main_link_flags + "-T${CMAKE_SOURCE_DIR}/cmake/posix/ld.script" + ) +px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") +set_target_properties(mainapp PROPERTIES LINK_FLAGS ${main_link_flags}) target_link_libraries(mainapp -Wl,--whole-archive diff --git a/src/modules/uORB/CMakeLists.txt b/src/modules/uORB/CMakeLists.txt index ceaa4ea00a..840b1307ae 100644 --- a/src/modules/uORB/CMakeLists.txt +++ b/src/modules/uORB/CMakeLists.txt @@ -63,6 +63,11 @@ elseif(${OS} STREQUAL "posix-arm") uORBManager_posix.cpp uORBTest_UnitTest.cpp ) +elseif(${OS} STREQUAL "qurt") + list(APPEND SRCS + uORBDevices_posix.cpp + uORBManager_posix.cpp + ) endif() px4_add_module( diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h index 8660276405..69dc2d64eb 100644 --- a/src/platforms/px4_defines.h +++ b/src/platforms/px4_defines.h @@ -144,9 +144,13 @@ typedef param_t px4_param_t; /* FIXME - Used to satisfy build */ #define getreg32(a) (*(volatile uint32_t *)(a)) +#ifdef __PX4_QURT +#define PX4_TICKS_PER_SEC 1000L +#else __BEGIN_DECLS extern long PX4_TICKS_PER_SEC; __END_DECLS +#endif #define USEC_PER_TICK (1000000UL/PX4_TICKS_PER_SEC) #define USEC2TICK(x) (((x)+(USEC_PER_TICK/2))/USEC_PER_TICK) diff --git a/src/platforms/qurt/dspal/dspal_stub.c b/src/platforms/qurt/dspal/dspal_stub.c index 996a279d87..fc736a169c 100644 --- a/src/platforms/qurt/dspal/dspal_stub.c +++ b/src/platforms/qurt/dspal/dspal_stub.c @@ -33,20 +33,16 @@ #include #include -#define STACK_SIZE 0x8000 -static char __attribute__ ((aligned (16))) stack1[STACK_SIZE]; +//#define STACK_SIZE 0x8000 +//static char __attribute__ ((aligned (16))) stack1[STACK_SIZE]; -int main(int argc, char* argv[]) +static void do_dlopen() { - int ret = 0; - char *builtin[]={"libgcc.so", "libc.so", "libstdc++.so"}; +#if 0 void *handle; char *error; void (*entry_function)() = NULL; - printf("In DSPAL main\n"); - dlinit(3, builtin); -#if 0 handle = dlopen ("libdspal_client.so", RTLD_LAZY); if (!handle) { printf("Error opening libdspal_client.so\n"); @@ -59,6 +55,18 @@ int main(int argc, char* argv[]) } dlclose(handle); #endif +} + + +int main(int argc, char* argv[]) +{ + int ret = 0; + char *builtin[]={"libgcc.so", "libc.so", "libstdc++.so"}; + + printf("In DSPAL main\n"); + dlinit(3, builtin); + + do_dlopen(); return ret; } diff --git a/src/platforms/qurt/px4_layer/CMakeLists.txt b/src/platforms/qurt/px4_layer/CMakeLists.txt index f7a6d657a7..7385fa5b0f 100644 --- a/src/platforms/qurt/px4_layer/CMakeLists.txt +++ b/src/platforms/qurt/px4_layer/CMakeLists.txt @@ -30,17 +30,31 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ + +set(QURT_LAYER_SRCS + px4_qurt_impl.cpp + px4_qurt_tasks.cpp + lib_crc32.c + drv_hrt.c + qurt_stubs.c + main.cpp + ) +if ("${QURT_ENABLE_STUBS}" STREQUAL "1") + list(APPEND QURT_LAYER_SRCS + ../stubs/stubs_posix.c + ../stubs/stubs_qurt.c + ) +endif() + +set(CONFIG_SRC commands_${BOARD}.c) + px4_add_module( MODULE platforms__qurt__px4_layer COMPILE_FLAGS -Os SRCS - px4_qurt_impl.cpp - px4_qurt_tasks.cpp - lib_crc32.c - drv_hrt.c - qurt_stubs.c - main.cpp + ${QURT_LAYER_SRCS} + ${CONFIG_SRC} DEPENDS platforms__common ) diff --git a/src/platforms/qurt/px4_layer/commands_hil.c b/src/platforms/qurt/px4_layer/commands_hil.c index b338aeb7ed..3ff299b89d 100644 --- a/src/platforms/qurt/px4_layer/commands_hil.c +++ b/src/platforms/qurt/px4_layer/commands_hil.c @@ -37,6 +37,7 @@ * @author Mark Charlebois */ +const char *get_commands(void); const char *get_commands() { diff --git a/src/platforms/qurt/px4_layer/main.cpp b/src/platforms/qurt/px4_layer/main.cpp index 45a6e4cec8..ba2374dcfd 100644 --- a/src/platforms/qurt/px4_layer/main.cpp +++ b/src/platforms/qurt/px4_layer/main.cpp @@ -46,6 +46,7 @@ #include #include #include +#include using namespace std; @@ -100,18 +101,17 @@ static void process_commands(map &apps, const char *cmds) char arg[256]; // This is added because it is a parameter used by commander, yet created by mavlink. Since mavlink is not - // running on QURT, we need to manually define it so it is available to commander. "2" is for quadrotor. + // running on QURT, we need to manually define it so it is available to commander. "2" is for quadrotor. - // Following is hack to prevent duplicate parameter definition error in param parser - /** - * @board QuRT_App - */ + // Following is hack to prevent duplicate parameter definition error in param parser + /** + * @board QuRT_App + */ PARAM_DEFINE_INT32(MAV_TYPE,2); // Eat leading whitespace eat_whitespace(b, i); - for(;;) { // End of command line if (b[i] == '\n' || b[i] == '\0') { diff --git a/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp b/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp index 9925e05dfa..14ef3304bc 100644 --- a/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp +++ b/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp @@ -59,7 +59,7 @@ __BEGIN_DECLS extern uint64_t get_ticks_per_us(); -long PX4_TICKS_PER_SEC = 1000; +//long PX4_TICKS_PER_SEC = 1000L; unsigned int sleep(unsigned int sec) { diff --git a/src/platforms/qurt/px4_layer/qurt_stubs.c b/src/platforms/qurt/px4_layer/qurt_stubs.c index e8c08f2d14..9764710fa0 100644 --- a/src/platforms/qurt/px4_layer/qurt_stubs.c +++ b/src/platforms/qurt/px4_layer/qurt_stubs.c @@ -32,6 +32,18 @@ ****************************************************************************/ #include "px4_log.h" //extern "C" { +void block_indefinite( void ); +void _Read_uleb( void ); +void _Parse_fde_instr( void ); +void _Parse_csd( void ); +void _Valbytes( void ); +void _Get_eh_data( void ); +void _Parse_lsda( void ); +void __cxa_guard_release( void ); +void _Read_enc_ptr( void ); +void _Read_sleb( void ); +void __cxa_guard_acquire( void ); +void __cxa_pure_virtual( void ); void block_indefinite( void ) { @@ -71,7 +83,8 @@ void _Unlocksyslock( int x ) { PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); block_indefinite(); -#endif} +} +#endif void _Valbytes( void ) { diff --git a/src/platforms/qurt/stubs/stubs_posix.c b/src/platforms/qurt/stubs/stubs_posix.c new file mode 100644 index 0000000000..991a0b4a85 --- /dev/null +++ b/src/platforms/qurt/stubs/stubs_posix.c @@ -0,0 +1,99 @@ +#include +#include +#include +#include +#include + +int sem_init(sem_t *sem, int pshared, unsigned int value) +{ + return 1; +} + +int sem_wait(sem_t *sem) +{ + return 1; +} + +int sem_destroy(sem_t *sem) +{ + return 1; +} + +int sem_post(sem_t *sem) +{ + return 1; +} + +int sem_getvalue(sem_t *sem, int *sval) +{ + return 1; +} + +int usleep(useconds_t usec) +{ + return 0; +} + +pthread_t pthread_self(void) +{ + pthread_t x = 0; + return x; +} + + +int pthread_kill(pthread_t thread, int sig) +{ + return 1; +} + +void pthread_exit(void *retval) +{ +} + +int pthread_join(pthread_t thread, void **retval) +{ + return 1; +} + +int pthread_cancel(pthread_t thread) +{ + return 1; +} +int pthread_attr_init(pthread_attr_t *attr) +{ + return 1; +} + +int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) +{ + return 1; +} + +int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize) +{ + return 1; +} + +int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param) +{ + return 1; +} + +int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg) +{ + return 1; +} +int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param) +{ + return 1; +} + +int pthread_attr_destroy(pthread_attr_t *attr) +{ + return 1; +} + +int clock_gettime(clockid_t clk_id, struct timespec *tp) +{ + return 1; +} diff --git a/src/platforms/qurt/stubs/stubs_qurt.c b/src/platforms/qurt/stubs/stubs_qurt.c new file mode 100644 index 0000000000..0fb8ac71bf --- /dev/null +++ b/src/platforms/qurt/stubs/stubs_qurt.c @@ -0,0 +1,14 @@ +#include + +void HAP_debug(const char *msg, int level, const char *filename, int line) +{ +} + +void HAP_power_request(int a, int b, int c) +{ +} + +int dlinit(int a, char **b) +{ + return 1; +} From bf18c846523d232b5483ba0a0a6c7d7068e8e419 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Wed, 9 Sep 2015 23:00:58 -0400 Subject: [PATCH 042/389] Cleanup of module building. --- CMakeLists.txt | 28 ++++++---- Makefile | 21 ++++--- cmake/{ => common}/px4_base.cmake | 32 +++++++++++ .../config_nuttx_px4fmu-v2_simple.cmake | 23 ++++++++ .../config_posix_sitl_simple.cmake} | 7 ++- .../config_qurt_hil_simple.cmake} | 1 - cmake/nuttx/px4_impl_nuttx.cmake | 2 +- cmake/posix/px4_impl_posix.cmake | 2 +- cmake/px4_git_hash.cmake | 31 ----------- cmake/qurt/px4_impl_qurt.cmake | 2 +- cmake/{ => scripts}/bin_to_object.py | 0 .../{ => scripts}/convert_modules_to_cmake.py | 2 +- cmake/{ => scripts}/test_compare.py | 0 cmake/{ => templates}/build_git_version.h.in | 0 cmake/{ => templates}/cmake_lists.jinja | 0 .../Toolchain-arm-none-eabi.cmake | 0 .../{ => toolchains}/Toolchain-hexagon.cmake | 2 +- cmake/{ => toolchains}/Toolchain-native.cmake | 0 .../Toolchain-posix-clang-native.cmake | 0 nuttx-configs/sim/nsh/defconfig | 4 +- src/CMakeLists.txt | 9 --- src/drivers/CMakeLists.txt | 55 ------------------- src/drivers/device/CMakeLists.txt | 14 +++-- src/examples/CMakeLists.txt | 16 ------ src/firmware/nuttx/CMakeLists.txt | 33 ++++++----- src/firmware/posix/CMakeLists.txt | 17 +----- src/lib/CMakeLists.txt | 15 ----- .../mathlib/math/filter/LowPassFilter2p.cpp | 4 ++ src/modules/CMakeLists.txt | 40 -------------- src/modules/systemlib/mcu_version.c | 2 +- src/modules/systemlib/printload.c | 4 ++ src/platforms/CMakeLists.txt | 26 --------- src/platforms/common/CMakeLists.txt | 5 +- .../nuttx/px4_layer/px4_nuttx_tasks.c | 4 ++ src/platforms/px4_subscriber.h | 15 ++++- src/systemcmds/CMakeLists.txt | 26 --------- 36 files changed, 151 insertions(+), 291 deletions(-) rename cmake/{ => common}/px4_base.cmake (94%) create mode 100644 cmake/configs/config_nuttx_px4fmu-v2_simple.cmake rename cmake/{posix/configs/config-posix-sitl.cmake => configs/config_posix_sitl_simple.cmake} (95%) rename cmake/{qurt/configs/config-qurt-hil.cmake => configs/config_qurt_hil_simple.cmake} (96%) delete mode 100644 cmake/px4_git_hash.cmake rename cmake/{ => scripts}/bin_to_object.py (100%) rename cmake/{ => scripts}/convert_modules_to_cmake.py (97%) rename cmake/{ => scripts}/test_compare.py (100%) rename cmake/{ => templates}/build_git_version.h.in (100%) rename cmake/{ => templates}/cmake_lists.jinja (100%) rename cmake/{ => toolchains}/Toolchain-arm-none-eabi.cmake (100%) rename cmake/{ => toolchains}/Toolchain-hexagon.cmake (99%) rename cmake/{ => toolchains}/Toolchain-native.cmake (100%) rename cmake/{ => toolchains}/Toolchain-posix-clang-native.cmake (100%) delete mode 100644 src/CMakeLists.txt delete mode 100644 src/drivers/CMakeLists.txt delete mode 100644 src/examples/CMakeLists.txt delete mode 100644 src/lib/CMakeLists.txt delete mode 100644 src/modules/CMakeLists.txt delete mode 100644 src/platforms/CMakeLists.txt delete mode 100644 src/systemcmds/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 11b0e4fde5..83cd243145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ # --------------------------------------------------------------------------- # # * Use px4_parse_function_args to parse functions and check for required -# arguments. +# arguments. Unless there is only one argument in the function and it is clear. # # * Never use macros. They allow overwriting global variables and this # makes variable declarations hard to locate. @@ -112,22 +112,21 @@ set(package-contact "px4users@googlegroups.com") # set module path message("OS = ${OS}") list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/${OS}) # prefer board implementation module over os implmementation module -set(board_impl_module px4_impl_${OS}_${BOARD}) -set(os_impl_module px4_impl_${OS}) -if (EXISTS ${board_impl_module}) - set(impl_module ${board_impl_module}) +set(config_module "configs/config_${OS}_${BOARD}_${LABEL}") +set(config_path "${CMAKE_SOURCE_DIR}/cmake/${config_module}.cmake") +if (EXISTS ${config_path}) + include(${config_module}) else() - set(impl_module ${os_impl_module}) + message(FATAL_ERROR "build config not found: ${config_path}") endif() -include(${impl_module}) # require px4 module interface set(px4_required_functions px4_os_prebuild_targets px4_os_add_flags + px4_set_config_modules ) foreach(cmd ${px4_required_functions}) if(NOT COMMAND ${cmd}) @@ -232,15 +231,20 @@ px4_generate_messages(TARGET msg_gen #============================================================================= # subdirectories # -add_subdirectory(src) +px4_set_config_modules(config_modules) +set(module_libraries) +foreach(module ${config_modules}) + add_subdirectory(src/${module}) + px4_mangle_name(${module} mangled_name) + list(APPEND module_libraries ${mangled_name}) + message(STATUS "adding module: ${module}") +endforeach() -# set the overall objective of the build -add_custom_target(ALL firmware_${OS}) +add_subdirectory(src/firmware/${OS}) #============================================================================= # generate git version # -include(px4_git_hash) px4_create_git_hash_header(HEADER ${CMAKE_BINARY_DIR}/build_git_version.h) #============================================================================= diff --git a/Makefile b/Makefile index 5b9146fce5..d3d7aa23d1 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,33 @@ d=$(PWD) -px4fmu-v2_simple: + +nuttx_px4fmu-v2_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-arm-none-eabi.cmake \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP +px4fmu-v2_simple: nuttx_px4fmu-v2_simple -nuttx-sim-simple: +nuttx_sim_simple: echo "nuttx-sim-simple is a work in progress" mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-native.cmake \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-native.cmake \ -DOS=nuttx -DBOARD=sim -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP -px4fmu-v2_simple-upload: px4fmu-v2_simple +nuttx_px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple cd $d/build_$< && make upload +px4fmu-v2_simple_upload: px4fmu-v2_simple_upload -posix-sitl_simple: +posix_sitl_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-posix-clang-native.cmake \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-posix-clang-native.cmake \ -DOS=posix -DBOARD=sitl -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP -qurt-hil_simple: +qurt_hil_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DQURT_ENABLE_STUBS=1 -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-hexagon.cmake \ + cmake .. -DQURT_ENABLE_STUBS=1 -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-hexagon.cmake \ -DOS=qurt -DBOARD=hil -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP diff --git a/cmake/px4_base.cmake b/cmake/common/px4_base.cmake similarity index 94% rename from cmake/px4_base.cmake rename to cmake/common/px4_base.cmake index 42d75c5b4b..9238bd05ad 100644 --- a/cmake/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -640,4 +640,36 @@ function(px4_mangle_name dirname newname) set(${newname} ${tmp} PARENT_SCOPE) endfunction() +#============================================================================= +# +# px4_create_git_hash_header +# +# Create a header file containing the git hash of the current tree +# +# Usage: +# px4_create_git_hash_header(HEADER ${CMAKE_BUILD_DIR}/git_hash.h) +# +# Input: +# HEADER : path of the header file to generate +# +# Example: +# px4_create_git_hash_header(HEADER ${CMAKE_BUILD_DIR}/git_hash.h) +# +function(px4_create_git_hash_header) + px4_parse_function_args( + NAME px4_create_git_hash_header + ONE_VALUE HEADER + REQUIRED HEADER + ARGN ${ARGN}) + execute_process( + COMMAND git log -n 1 --pretty=format:"%H" + OUTPUT_VARIABLE git_desc + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + message(STATUS "GIT_DESC = ${git_desc}") + set(git_desc_short) + string(SUBSTRING ${git_desc} 1 16 git_desc_short) + configure_file(${CMAKE_SOURCE_DIR}/cmake/templates/build_git_version.h.in ${HEADER} @ONLY) +endfunction() + # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake b/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake new file mode 100644 index 0000000000..148baf63eb --- /dev/null +++ b/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake @@ -0,0 +1,23 @@ +include(nuttx/px4_impl_nuttx) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + platforms/nuttx + platforms/nuttx/px4_layer + platforms/common + drivers/led + drivers/device + modules/systemlib + modules/uORB + examples/px4_simple_app + drivers/boards/px4fmu-v2 + drivers/stm32 + lib/mathlib/math/filter + lib/conversion + ) + + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/posix/configs/config-posix-sitl.cmake b/cmake/configs/config_posix_sitl_simple.cmake similarity index 95% rename from cmake/posix/configs/config-posix-sitl.cmake rename to cmake/configs/config_posix_sitl_simple.cmake index 99895b2ad4..aedb00f75c 100644 --- a/cmake/posix/configs/config-posix-sitl.cmake +++ b/cmake/configs/config_posix_sitl_simple.cmake @@ -1,4 +1,7 @@ +include(posix/px4_impl_posix) + function(px4_set_config_modules out_module_list) + set(config_module_list drivers/led drivers/device @@ -39,7 +42,6 @@ function(px4_set_config_modules out_module_list) modules/fw_pos_control_l1 modules/dataman modules/sdlog2 - modules/simulator modules/commander modules/controllib lib/mathlib @@ -51,7 +53,8 @@ function(px4_set_config_modules out_module_list) lib/geo_lookup lib/launchdetection ) - message(STATUS "modules: ${config_module_list}") + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + endfunction() diff --git a/cmake/qurt/configs/config-qurt-hil.cmake b/cmake/configs/config_qurt_hil_simple.cmake similarity index 96% rename from cmake/qurt/configs/config-qurt-hil.cmake rename to cmake/configs/config_qurt_hil_simple.cmake index 6d7cbae5e4..ea1c8cc5a5 100644 --- a/cmake/qurt/configs/config-qurt-hil.cmake +++ b/cmake/configs/config_qurt_hil_simple.cmake @@ -80,7 +80,6 @@ function(px4_set_config_modules out_module_list) # modules/muorb/adsp ) - message(STATUS "modules: ${config_module_list}") set(${out_module_list} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index b511c43968..ebd60febc0 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -49,7 +49,7 @@ # * px4_os_prebuild_targets # -include(px4_base) +include(common/px4_base) #============================================================================= # diff --git a/cmake/posix/px4_impl_posix.cmake b/cmake/posix/px4_impl_posix.cmake index 6108b9c94f..335652aa5b 100644 --- a/cmake/posix/px4_impl_posix.cmake +++ b/cmake/posix/px4_impl_posix.cmake @@ -48,7 +48,7 @@ # * px4_os_prebuild_targets # -include(px4_base) +include(common/px4_base) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/posix) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/posix/configs) diff --git a/cmake/px4_git_hash.cmake b/cmake/px4_git_hash.cmake deleted file mode 100644 index a3a29b2d14..0000000000 --- a/cmake/px4_git_hash.cmake +++ /dev/null @@ -1,31 +0,0 @@ -#============================================================================= -# -# px4_create_git_hash_header -# -# Create a header file containing the git hash of the current tree -# -# Usage: -# px4_create_git_hash_header(HEADER ${CMAKE_BUILD_DIR}/git_hash.h) -# -# Input: -# HEADER : path of the header file to generate -# -# Example: -# px4_create_git_hash_header(HEADER ${CMAKE_BUILD_DIR}/git_hash.h) -# -function(px4_create_git_hash_header) - px4_parse_function_args( - NAME px4_create_git_hash_header - ONE_VALUE HEADER - REQUIRED HEADER - ARGN ${ARGN}) - execute_process( - COMMAND git log -n 1 --pretty=format:"%H" - OUTPUT_VARIABLE git_desc - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - message(STATUS "GIT_DESC = ${git_desc}") - set(git_desc_short) - string(SUBSTRING ${git_desc} 1 16 git_desc_short) - configure_file(${CMAKE_SOURCE_DIR}/cmake/build_git_version.h.in ${HEADER} @ONLY) -endfunction() diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index f643068c7d..407dc6414d 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -49,7 +49,7 @@ # * px4_os_prebuild_targets # -include(px4_base) +include(common/px4_base) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt/configs) include(qurt_funcs) diff --git a/cmake/bin_to_object.py b/cmake/scripts/bin_to_object.py similarity index 100% rename from cmake/bin_to_object.py rename to cmake/scripts/bin_to_object.py diff --git a/cmake/convert_modules_to_cmake.py b/cmake/scripts/convert_modules_to_cmake.py similarity index 97% rename from cmake/convert_modules_to_cmake.py rename to cmake/scripts/convert_modules_to_cmake.py index ead6a9672b..7cd8768c65 100755 --- a/cmake/convert_modules_to_cmake.py +++ b/cmake/scripts/convert_modules_to_cmake.py @@ -19,7 +19,7 @@ parser.add_argument('--backup', help='create backup of existing files if overwri parser.set_defaults(overwrite=False, backup=False) args = parser.parse_args() -cmake_template = jinja2.Template(open('cmake/cmake_lists.jinja', 'r').read()) +cmake_template = jinja2.Template(open('cmake/scripts/cmake_lists.jinja', 'r').read()) module_files = [] for root, dirnames, filenames in os.walk(args.path): diff --git a/cmake/test_compare.py b/cmake/scripts/test_compare.py similarity index 100% rename from cmake/test_compare.py rename to cmake/scripts/test_compare.py diff --git a/cmake/build_git_version.h.in b/cmake/templates/build_git_version.h.in similarity index 100% rename from cmake/build_git_version.h.in rename to cmake/templates/build_git_version.h.in diff --git a/cmake/cmake_lists.jinja b/cmake/templates/cmake_lists.jinja similarity index 100% rename from cmake/cmake_lists.jinja rename to cmake/templates/cmake_lists.jinja diff --git a/cmake/Toolchain-arm-none-eabi.cmake b/cmake/toolchains/Toolchain-arm-none-eabi.cmake similarity index 100% rename from cmake/Toolchain-arm-none-eabi.cmake rename to cmake/toolchains/Toolchain-arm-none-eabi.cmake diff --git a/cmake/Toolchain-hexagon.cmake b/cmake/toolchains/Toolchain-hexagon.cmake similarity index 99% rename from cmake/Toolchain-hexagon.cmake rename to cmake/toolchains/Toolchain-hexagon.cmake index 5e5805ba46..4de37f553c 100644 --- a/cmake/Toolchain-hexagon.cmake +++ b/cmake/toolchains/Toolchain-hexagon.cmake @@ -32,7 +32,7 @@ include(CMakeForceCompiler) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -include(px4_base) +include(common/px4_base) if(NOT HEXAGON_TOOLS_ROOT) set(HEXAGON_TOOLS_ROOT /opt/6.4.05) diff --git a/cmake/Toolchain-native.cmake b/cmake/toolchains/Toolchain-native.cmake similarity index 100% rename from cmake/Toolchain-native.cmake rename to cmake/toolchains/Toolchain-native.cmake diff --git a/cmake/Toolchain-posix-clang-native.cmake b/cmake/toolchains/Toolchain-posix-clang-native.cmake similarity index 100% rename from cmake/Toolchain-posix-clang-native.cmake rename to cmake/toolchains/Toolchain-posix-clang-native.cmake diff --git a/nuttx-configs/sim/nsh/defconfig b/nuttx-configs/sim/nsh/defconfig index c3088107d9..391b3f03a6 100644 --- a/nuttx-configs/sim/nsh/defconfig +++ b/nuttx-configs/sim/nsh/defconfig @@ -118,7 +118,7 @@ CONFIG_NSH_MMCSDMINOR=0 # CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=0 -# CONFIG_SCHED_INSTRUMENTATION is not set +CONFIG_SCHED_INSTRUMENTATION=y CONFIG_TASK_NAME_SIZE=32 CONFIG_SCHED_HAVE_PARENT=y # CONFIG_SCHED_CHILD_STATUS is not set @@ -182,7 +182,7 @@ CONFIG_PTHREAD_STACK_DEFAULT=8192 # # Device Drivers # -CONFIG_DISABLE_POLL=y +#CONFIG_DISABLE_POLL is not set CONFIG_DEV_NULL=y # CONFIG_DEV_ZERO is not set # CONFIG_LOOP is not set diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 6f61960bcb..0000000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -add_subdirectory(./lib) -add_subdirectory(./drivers) -add_subdirectory(./platforms) -add_subdirectory(./systemcmds) -add_subdirectory(./examples) -add_subdirectory(./modules) -add_subdirectory(./firmware/${OS}) - -# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/drivers/CMakeLists.txt b/src/drivers/CMakeLists.txt deleted file mode 100644 index a435bdc94d..0000000000 --- a/src/drivers/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -set(directories - ./roboclaw - ./device - ./px4io - ./boards/px4fmu-v2 - ./boards/px4-stm32f4discovery - ./boards/px4io-v2 - ./boards/px4io-v1 - ./boards/px4fmu-v1 - ./boards/aerocore - ./boards/sitl - ./mpu6000 - ./gimbal - ./camera_trigger - ./pwm_input - ./pwm_out_sim - ./pca9685 - ./mkblctrl - ./sf0x - ./hott/hott_telemetry - ./hott/hott_sensors - ./hott - ./ms5611 - ./led - ./irlock - ./bma180 - ./l3gd20 - ./blinkm - ./md25 - ./lsm303d - ./pca8574 - ./mb12xx - ./trone - ./airspeed - ./rgbled - ./frsky_telemetry - ./meas_airspeed - ./px4flow - ./mpu9250 - ./gps - ./ets_airspeed - ./ll40ls - ./ardrone_interface - ./hmc5883 - ./px4fmu - ./stm32/tone_alarm - ./stm32/adc - ./stm32 - ./oreoled - ./batt_smbus - ) - -foreach(directory ${directories}) - add_subdirectory(${directory} EXCLUDE_FROM_ALL) -endforeach() diff --git a/src/drivers/device/CMakeLists.txt b/src/drivers/device/CMakeLists.txt index 7a68999949..b97339b892 100644 --- a/src/drivers/device/CMakeLists.txt +++ b/src/drivers/device/CMakeLists.txt @@ -35,13 +35,17 @@ set(SRCS) if(${OS} STREQUAL "nuttx") list(APPEND SRCS - device_nuttx.cpp - cdev.cpp - i2c_nuttx.cpp - pio.cpp - spi.cpp ringbuffer.cpp ) + if (NOT ${BOARD} STREQUAL "sim") + list(APPEND SRCS + device_nuttx.cpp + cdev.cpp + i2c_nuttx.cpp + pio.cpp + spi.cpp + ) + endif() else() list(APPEND SRCS device_posix.cpp diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt deleted file mode 100644 index e16d5e0179..0000000000 --- a/src/examples/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -set(directories - ./px4_simple_app - ./fixedwing_control - ./rover_steering_control - ./px4_mavlink_debug - ./px4_daemon_app - ./flow_position_estimator - ./matlab_csv_serial - ./subscriber - ./hwtest - ./publisher - ) - -foreach(directory ${directories}) - add_subdirectory(${directory} EXCLUDE_FROM_ALL) -endforeach() diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 970dcd5fce..1f61d0e073 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -1,30 +1,29 @@ # a list of modules that will be linked to main -set(module_list) +set(module_list + platforms__nuttx + platforms__nuttx__px4_layer + platforms__common + drivers__led + drivers__device + modules__systemlib + modules__uORB + ) if (${LABEL} STREQUAL "simple") list(APPEND module_list - drivers__led - drivers__device - platforms__common - modules__systemlib - modules__uORB examples__px4_simple_app - lib__mathlib__math__filter - lib__conversion ) endif() -if (${LABEL} STREQUAL "simple") - list(APPEND module_list ${module_list_simple}) +if(${BOARD} STREQUAL "px4fmu-v2") + list(APPEND module_list + drivers__boards__px4fmu-v2 + drivers__stm32 + lib__mathlib__math__filter + lib__conversion + ) endif() -list(APPEND module_list - platforms__nuttx - platforms__nuttx__px4_layer - drivers__boards__px4fmu-v2 - drivers__stm32 -) - px4_nuttx_generate_builtin_commands( OUT builtin_commands.c MODULE_LIST ${module_list}) diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index e8c037ba9b..2f8d8c95c3 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -1,21 +1,8 @@ -include(px4_base) - -set(module_dir_list) -set(module_list) -px4_posix_add_modules(module_dir_list ${BOARD}) -message(STATUS "module list: ${module_dir_list}") - include_directories(${CMAKE_CURRENT_BINARY_DIR}) -foreach(directory ${module_dir_list}) - message(STATUS "directory: ${directory}") - px4_mangle_name(${directory} mangled_name) - list(APPEND module_list - ${mangled_name}) -endforeach() px4_posix_generate_builtin_commands( OUT apps.h - MODULE_LIST ${module_list}) + MODULE_LIST ${module_libraries}) add_executable(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp @@ -30,7 +17,7 @@ set_target_properties(mainapp PROPERTIES LINK_FLAGS ${main_link_flags}) target_link_libraries(mainapp -Wl,--start-group - ${module_list} + ${module_libraries} pthread m -Wl,--end-group ) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt deleted file mode 100644 index eaf068d917..0000000000 --- a/src/lib/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -set(directories - ./external_lgpl - ./geo - ./launchdetection - ./mathlib/math/filter - ./mathlib - ./rc - ./geo_lookup - ./ecl - ./conversion - ) - -foreach(directory ${directories}) - add_subdirectory(${directory} EXCLUDE_FROM_ALL) -endforeach() diff --git a/src/lib/mathlib/math/filter/LowPassFilter2p.cpp b/src/lib/mathlib/math/filter/LowPassFilter2p.cpp index 7e2778e445..c3d44588fd 100644 --- a/src/lib/mathlib/math/filter/LowPassFilter2p.cpp +++ b/src/lib/mathlib/math/filter/LowPassFilter2p.cpp @@ -41,6 +41,10 @@ #include "LowPassFilter2p.hpp" #include "math.h" +#ifndef M_PI_F +#define M_PI_F 3.14159f +#endif + namespace math { diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt deleted file mode 100644 index 3f68d4a05d..0000000000 --- a/src/modules/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -set(directories - ./navigator - ./segway - ./fw_pos_control_l1 - ./uavcan - ./position_estimator_inav - ./px4iofirmware - ./gpio_led - ./dataman - ./fixedwing_backside - ./uORB - ./land_detector - ./muorb/krait - ./muorb/adsp - ./simulator - ./ekf_att_pos_estimator - ./mc_pos_control - ./attitude_estimator_ekf - ./sensors - ./vtol_att_control - ./fw_att_control - ./unit_test - ./mc_att_control_multiplatform - ./commander/commander_tests - ./commander - ./mavlink/mavlink_tests - ./mavlink - ./mc_att_control - ./bottle_drop - ./systemlib/mixer - ./systemlib - ./mc_pos_control_multiplatform - ./sdlog2 - ./controllib - ./attitude_estimator_q - ) - -foreach(directory ${directories}) - add_subdirectory(${directory} EXCLUDE_FROM_ALL) -endforeach() diff --git a/src/modules/systemlib/mcu_version.c b/src/modules/systemlib/mcu_version.c index e4623c2ce0..be614f7d7a 100644 --- a/src/modules/systemlib/mcu_version.c +++ b/src/modules/systemlib/mcu_version.c @@ -62,7 +62,7 @@ /** Copy the 96bit MCU Unique ID into the provided pointer */ void mcu_unique_id(uint32_t *uid_96_bit) { -#ifdef __PX4_NUTTX +#ifdef CONFIG_ARCH_CHIP_STM32 uid_96_bit[0] = getreg32(UNIQUE_ID); uid_96_bit[1] = getreg32(UNIQUE_ID + 4); uid_96_bit[2] = getreg32(UNIQUE_ID + 8); diff --git a/src/modules/systemlib/printload.c b/src/modules/systemlib/printload.c index 23dde1ce44..a179ddc51b 100644 --- a/src/modules/systemlib/printload.c +++ b/src/modules/systemlib/printload.c @@ -261,7 +261,11 @@ void print_load(uint64_t t, int fd, struct print_load_s *print_state) stack_size - stack_free, stack_size, system_load.tasks[i].tcb->sched_priority, +#if CONFIG_ARCH_BOARD_SIM + 0); +#else system_load.tasks[i].tcb->base_priority); +#endif #if CONFIG_RR_INTERVAL > 0 /* print scheduling info with RR time slice */ diff --git a/src/platforms/CMakeLists.txt b/src/platforms/CMakeLists.txt deleted file mode 100644 index eaea200452..0000000000 --- a/src/platforms/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -set(directories - ./posix/tests/hrt_test - ./posix/tests/wqueue - ./posix/tests/hello - ./posix/tests/muorb - ./posix/tests/vcdev_test - ./posix/work_queue - ./posix/px4_layer - ./posix/drivers/adcsim - ./posix/drivers/gpssim - ./posix/drivers/tonealrmsim - ./posix/drivers/accelsim - ./posix/drivers/airspeedsim - ./posix/drivers/barosim - ./posix/drivers/gyrosim - ./qurt/tests/hello - ./qurt/tests/muorb - ./qurt/px4_layer - ./common - ./nuttx/px4_layer - ./nuttx - ) - -foreach(directory ${directories}) - add_subdirectory(${directory} EXCLUDE_FROM_ALL) -endforeach() diff --git a/src/platforms/common/CMakeLists.txt b/src/platforms/common/CMakeLists.txt index b7a003b506..5cb59b418b 100644 --- a/src/platforms/common/CMakeLists.txt +++ b/src/platforms/common/CMakeLists.txt @@ -33,10 +33,11 @@ set(depends msg_gen prebuild_targets + git_mavlink ) -if(${OS} STREQUAL "posix") - list(APPEND depends git_eigen git_mavlink) +if(${OS} STREQUAL "posix" OR ${BOARD} STREQUAL "sim") + list(APPEND depends git_eigen) endif() px4_add_module( diff --git a/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c b/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c index e9b722de4c..1849374fb2 100644 --- a/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c +++ b/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c @@ -50,7 +50,9 @@ #include #include +#ifndef CONFIG_ARCH_BOARD_SIM #include +#endif #include @@ -61,7 +63,9 @@ void px4_systemreset(bool to_bootloader) { if (to_bootloader) { +#ifndef CONFIG_ARCH_BOARD_SIM stm32_pwr_enablebkp(); +#endif /* XXX wow, this is evil - write a magic number into backup register zero */ *(uint32_t *)0x40002850 = 0xb007b007; diff --git a/src/platforms/px4_subscriber.h b/src/platforms/px4_subscriber.h index 9b0ca1319a..e92c82fc66 100644 --- a/src/platforms/px4_subscriber.h +++ b/src/platforms/px4_subscriber.h @@ -38,8 +38,10 @@ */ #pragma once +#ifndef CONFIG_ARCH_BOARD_SIM #include #include +#endif #if defined(__PX4_ROS) /* includes when building for ros */ @@ -219,10 +221,12 @@ public: protected: uORB::SubscriptionBase * _uorb_sub; /**< Handle to the subscription */ +#ifndef CONFIG_ARCH_BOARD_SIM typename std::remove_referencedata())>::type getUORBData() { return (typename std::remove_referencedata())>::type)*_uorb_sub; } +#endif /** * Get void pointer to last message value @@ -242,8 +246,13 @@ public: * @param cbf Callback, executed on receiving a new message * @param interval Minimal interval between calls to callback */ - SubscriberUORBCallback(unsigned interval, - std::function cbf) : + SubscriberUORBCallback(unsigned interval +#ifndef CONFIG_ARCH_BOARD_SIM + ,std::function cbf) +#else + ) +#endif + : SubscriberUORB(interval), _cbf(cbf) {} @@ -277,7 +286,9 @@ public: }; protected: +#ifndef CONFIG_ARCH_BOARD_SIM std::function _cbf; /**< Callback that the user provided on the subscription */ +#endif }; #endif diff --git a/src/systemcmds/CMakeLists.txt b/src/systemcmds/CMakeLists.txt deleted file mode 100644 index 6ee6b33a1f..0000000000 --- a/src/systemcmds/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ - -set(directories - ./mtd - ./ver - ./mixer - ./tests - ./nshterm - ./config - ./top - ./bl_update - ./reboot - ./i2c - ./param - ./reflect - ./usb_connected - ./motor_test - ./esc_calib - ./perf - ./topic_listener - ./dumpfile - ./pwm - ) - -foreach(directory ${directories}) - add_subdirectory(${directory} EXCLUDE_FROM_ALL) -endforeach() From 323ae36d9f00a6f20e8a43117182aa23cd66bb37 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Wed, 9 Sep 2015 23:07:30 -0400 Subject: [PATCH 043/389] Added nuttx sim config. --- Makefile | 1 - cmake/configs/config_nuttx_sim_simple.cmake | 23 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 cmake/configs/config_nuttx_sim_simple.cmake diff --git a/Makefile b/Makefile index d3d7aa23d1..e52f05e501 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ nuttx_px4fmu-v2_simple: px4fmu-v2_simple: nuttx_px4fmu-v2_simple nuttx_sim_simple: - echo "nuttx-sim-simple is a work in progress" mkdir -p $d/build_$@ && cd $d/build_$@ && \ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-native.cmake \ -DOS=nuttx -DBOARD=sim -DLABEL=simple && \ diff --git a/cmake/configs/config_nuttx_sim_simple.cmake b/cmake/configs/config_nuttx_sim_simple.cmake new file mode 100644 index 0000000000..0440bfed14 --- /dev/null +++ b/cmake/configs/config_nuttx_sim_simple.cmake @@ -0,0 +1,23 @@ +include(nuttx/px4_impl_nuttx) + +message(WARNING "this is a work in progress and doesn't build yet") + +function(px4_set_config_modules out_module_list) + + set(config_module_list + platforms/nuttx + platforms/nuttx/px4_layer + platforms/common + drivers/led + drivers/device + modules/systemlib + modules/uORB + examples/px4_simple_app + lib/mathlib/math/filter + lib/conversion + ) + + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + From d0c89b8396e407d63964b410b44119aec3ae8b9b Mon Sep 17 00:00:00 2001 From: James Goppert Date: Wed, 9 Sep 2015 23:11:25 -0400 Subject: [PATCH 044/389] Attempted to fix qurt build, some cleanup of old module funcs. --- cmake/posix/px4_impl_posix.cmake | 37 -------------------------------- cmake/qurt/px4_impl_qurt.cmake | 28 ------------------------ src/firmware/qurt/CMakeLists.txt | 13 +---------- 3 files changed, 1 insertion(+), 77 deletions(-) diff --git a/cmake/posix/px4_impl_posix.cmake b/cmake/posix/px4_impl_posix.cmake index 335652aa5b..ed97ab9cb7 100644 --- a/cmake/posix/px4_impl_posix.cmake +++ b/cmake/posix/px4_impl_posix.cmake @@ -223,40 +223,3 @@ function(px4_os_prebuild_targets) ARGN ${ARGN}) add_custom_target(${OUT}) endfunction() - -#============================================================================= -# -# px4_posix_add_modules -# -# This function adds target modules -# -# Usage: -# px4_os_prebuild_targets( -# OUT_MODULES -# BOARD -# ) -# -# Input: -# BOARD : board -# -# Output: -# OUT_MODULES : the updated module list -# -# Example: -# px4_posix_add_modules(module_list "hil") -# -function(px4_posix_add_modules OUT_MODULES BOARD) - include(config-posix-${BOARD}) - set(config_modules) - px4_set_config_modules(config_modules) - set(${OUT_MODULES} ${${OUT_MODULES}} ${config_modules} PARENT_SCOPE) -endfunction() - - -macro(px4_target_firmware) - set(installed_targets) - add_executable(main ./src/platforms/posix/main.cpp) - target_link_libraries(main ${module_list} ${EXE_LINK_LIBS} ${module_list} ${EXE_LINK_LIBS}) - list(APPEND installed_targets main) -endmacro() - diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index 407dc6414d..8fdc3324f5 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -231,32 +231,4 @@ function(px4_os_prebuild_targets) COMMAND patch -p1 -i ../../../cmake/qurt/qurt_eigen.patch) endfunction() -#============================================================================= -# -# px4_qurt_add_modules -# -# This function adds target modules -# -# Usage: -# px4_os_prebuild_targets( -# OUT_MODULES -# BOARD -# ) -# -# Input: -# BOARD : board -# -# Output: -# OUT_MODULES : the updated module list -# -# Example: -# px4_qurt_add_modules(module_list "hil") -# -function(px4_qurt_add_modules OUT_MODULES BOARD) - include(config-qurt-${BOARD}) - set(config_modules) - px4_set_config_modules(config_modules) - set(${OUT_MODULES} ${${OUT_MODULES}} ${config_modules} PARENT_SCOPE) -endfunction() - # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index ac8de03c92..dd5b09a39b 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -4,21 +4,10 @@ set(V_ARCH v5) set(HEXAGON_TOOLS_ROOT /opt/6.4.03) set(TOOLSLIB ${HEXAGON_TOOLS_ROOT}/dinkumware/lib/${V_ARCH}/G0) -set(module_dir_list) -set(module_list) -px4_qurt_add_modules(module_dir_list ${BOARD}) -message(STATUS "module list: ${module_dir_list}") - -foreach(directory ${module_dir_list}) - message(STATUS "directory: ${directory}") - px4_mangle_name(${directory} mangled_name) - list(APPEND module_list - ${mangled_name}) -endforeach() px4_qurt_generate_builtin_commands( OUT ${CMAKE_BINARY_DIR}/apps.h - MODULE_LIST ${module_list}) + MODULE_LIST ${module_libraries}) # FIXME @jgoppert - how to work around issues like this? # Without changing global variables? From 0286136c6842334c8ceecb081463d6caeb066c9d Mon Sep 17 00:00:00 2001 From: James Goppert Date: Wed, 9 Sep 2015 23:18:53 -0400 Subject: [PATCH 045/389] Addressed scope question. --- CMakeLists.txt | 4 ++++ src/firmware/qurt/CMakeLists.txt | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83cd243145..e3515ca8bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,10 @@ # makes it clear to the user when variables are being set or targets # are being created. # +# * Setting a global variable in a CMakeLists.txt file is ok, because +# each CMakeLists.txt file has scope in the current directory and all +# subdirecties, so it is not truly global. +# # * All toolchain files should be included in the cmake # directory and named Toolchain-"name".cmake. # diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index dd5b09a39b..fb97327691 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -9,9 +9,8 @@ px4_qurt_generate_builtin_commands( OUT ${CMAKE_BINARY_DIR}/apps.h MODULE_LIST ${module_libraries}) -# FIXME @jgoppert - how to work around issues like this? -# Without changing global variables? # Clear -rdynamic flag which fails for hexagon +# this change is scoped in this directory and below set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") From 1eddfde4395e98980d811c1236d8d1b036e0edb5 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 01:59:01 -0400 Subject: [PATCH 046/389] Replaced awk with python script for bin_to_obj. --- cmake/nuttx/bin_to_obj.py | 86 ++++++++++++++++++++++++++++++++ cmake/nuttx/px4_impl_nuttx.cmake | 77 ++++++---------------------- cmake/scripts/bin_to_object.py | 21 -------- 3 files changed, 100 insertions(+), 84 deletions(-) create mode 100755 cmake/nuttx/bin_to_obj.py delete mode 100755 cmake/scripts/bin_to_object.py diff --git a/cmake/nuttx/bin_to_obj.py b/cmake/nuttx/bin_to_obj.py new file mode 100755 index 0000000000..07c81edcde --- /dev/null +++ b/cmake/nuttx/bin_to_obj.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +""" +This converts a binary imagge to an object file +""" +from __future__ import print_function +import subprocess +import argparse +import re +from subprocess import PIPE + +#pylint: disable=invalid-name +parser = argparse.ArgumentParser(description='Convert bin to obj.') +parser.add_argument('--c_flags', required=True) +parser.add_argument('--c_compiler', required=True) +parser.add_argument('--nm', required=True) +parser.add_argument('--ld', required=True) +parser.add_argument('--objcopy', required=True) +parser.add_argument('--bin', required=True) +parser.add_argument('--obj', required=True) +parser.add_argument('--var', required=True) +args = parser.parse_args() + +in_bin = args.bin +c_flags = args.c_flags +c_compiler = args.c_compiler +nm = args.nm +ld = args.ld +obj = args.obj +var = args.var +objcopy = args.objcopy + +sym = "_binary_" + in_bin.replace('/', '_').replace('.', '_').replace('-', '_') +#print("sym: ", sym) + +# write empty file +with open('{obj:s}.c'.format(**locals()), 'w') as f: + f.write("") + +def run_cmd(cmd, d): + cmd = cmd.format(**d) + #print(cmd) + proc = subprocess.Popen(cmd.split(), stdout=PIPE, stderr=PIPE) + stdout, stderr = proc.communicate() + if stderr != "": + raise RuntimeError(stderr) + return stdout + +# do compile +run_cmd("{c_compiler:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o", + locals()) + +# link +run_cmd("{ld:s} -r -o {obj:s}.bin.o {obj:s}.c.o -b binary {in_bin:s}", + locals()) + +# get size of image +stdout = run_cmd("{nm:s} -p --radix=x {obj:s}.bin.o", locals()) +re_size = re.compile("(^[0-9A-Fa-f]*) .*{sym:s}_size".format( + **locals())) +size_match = re.match(re_size, stdout) +size = size_match.group(1) +#print("romfs size: ", size) + +# write size to file +with open('{obj:s}.c'.format(**locals()), 'w') as f: + f.write("const unsigned int {var:s}_len = 0x{size:s};".format( + **locals())) + +# do compile +run_cmd("{c_compiler:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o", + locals()) + +# link +run_cmd("{ld:s} -r -o {obj:s} {obj:s}.c.o {obj:s}.bin.o", + locals()) + +# obj copy +run_cmd(""" +{objcopy:s} {obj:s} + --redefine-sym {sym:s}_start={var:s} + --strip-symbol {sym:s}_size + --strip-symbol {sym:s}_end + --rename-section .data=.rodata +""", locals()) + +# vim: set et ft=python fenc= ff=unix sts=4 sw=4 ts=4 : diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index ebd60febc0..54a46199fe 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -41,7 +41,6 @@ # * px4_nuttx_generate_builtin_commands # * px4_nuttx_add_export # * px4_nuttx_generate_romfs -# * px4_bin_to_obj # # Required OS Inteface Functions # @@ -234,65 +233,6 @@ function(px4_nuttx_add_export) endfunction() -#============================================================================= -# -# px4_bin_to_obj -# -# The functions create an object file from a binary image. -# -# Usage: -# px4_bin_to_boj(OBJ VAR BIN ) -# -# Input: -# BIN : the bin file -# VAR : the variable name -# -# Output: -# OBJ : the object file -# -# Example: -# px4_bin_to_obj(OBJ my_obj VAR romfs BIN my_bin) -# -function(px4_bin_to_obj) - - px4_parse_function_args( - NAME px4_bin_to_obj - ONE_VALUE BIN OBJ VAR - REQUIRED BIN OBJ VAR - ARGN ${ARGN}) - - string(REPLACE "/" "_" _tmp ${BIN}) - string(REPLACE "." "_" _tmp ${_tmp}) - string(REPLACE "-" "_" sym "_binary_${_tmp}") - #message(STATUS "sym: ${sym}") - - separate_arguments(CMAKE_C_FLAGS) - - add_custom_command(OUTPUT ${OBJ} - COMMAND ${ECHO} > ${OBJ}.c - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c ${OBJ}.c -o ${OBJ}.c.o - COMMAND ${LD} -r -o ${OBJ}.bin.o ${OBJ}.c.o -b binary ${BIN} - COMMAND ${NM} -p --radix=x ${OBJ}.bin.o - | ${GREP} ${sym}_size - | ${GREP} -o ^[0-9a-fA-F]* - | ${AWK} "{print \"const unsigned int ${VAR}_len = 0x\"$1\";\"}" > ${OBJ}.c - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c ${OBJ}.c -o ${OBJ}.c.o - COMMAND ${LD} -r -o ${OBJ} ${OBJ}.c.o ${OBJ}.bin.o - COMMAND ${OBJCOPY} ${OBJ} - --redefine-sym ${sym}_start=${VAR} - --strip-symbol ${sym}_size - --strip-symbol ${sym}_end - --rename-section .data=.rodata - # useful to comment remove statement when debugging - COMMAND ${RM} ${OBJ}.c ${OBJ}.c.o ${OBJ}.bin.o - DEPENDS ${BIN} - VERBATIM - ) - - set(${OBJ} ${OBJ} PARENT_SCOPE) - -endfunction() - #============================================================================= # # px4_nuttx_generate_romfs @@ -325,6 +265,7 @@ function(px4_nuttx_generate_romfs) set(romfs_autostart ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py) set(romfs_pruner ${CMAKE_SOURCE_DIR}/Tools/px_romfs_pruner.py) + set(bin_to_obj ${CMAKE_SOURCE_DIR}/cmake/nuttx/bin_to_obj.py) #message(STATUS "temp_dir: ${romfs_temp_dir}") @@ -349,9 +290,19 @@ function(px4_nuttx_generate_romfs) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - px4_bin_to_obj(OBJ ${OUT} - BIN ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin - VAR romfs_img) + add_custom_command(OUTPUT romfs.o + COMMAND ${PYTHON_EXECUTABLE} ${bin_to_obj} + --ld ${LD} --c_flags ${CMAKE_C_FLAGS} + --c_compiler ${CMAKE_C_COMPILER} + --nm ${NM} --objcopy ${OBJCOPY} + --obj romfs.o + --var romfs_img + --bin romfs.bin + DEPENDS romfs.bin + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + set(${OUT} romfs.o PARENT_SCOPE) endfunction() diff --git a/cmake/scripts/bin_to_object.py b/cmake/scripts/bin_to_object.py deleted file mode 100755 index 053580d969..0000000000 --- a/cmake/scripts/bin_to_object.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -""" -This converts a binary imagge to an object file -""" -from __future__ import print_function -import subprocess -import argparse -import os - -#pylint: disable=invalid-name -parser = argparse.ArgumentParser(description='Convert bin to obj.') -parser.add_argument('--c-flags', required=True) -parser.add_argument('--c-compiler', required=True) -parser.add_argument('--nm', required=True) -args = parser.parse_args() - -#TODO write function - -exit(0) - -# vim: set et ft=python fenc= ff=unix sts=4 sw=4 ts=4 : From b7699bff5ae10367ac42d233b9d5c7fc551d0ed1 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 02:21:40 -0400 Subject: [PATCH 047/389] Changes to travis for cmake build. --- .travis.yml | 68 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index 20b15d323d..260cb83580 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,38 +73,46 @@ script: - ccache -z - arm-none-eabi-gcc --version - echo 'Building POSIX Firmware..' && echo -en 'travis_fold:start:script.1\\r' - - make posix -j4 - - ccache -s - - echo -en 'travis_fold:end:script.1\\r' + - make posix_sitl_simple - echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r' - - make tests - - cat src/modules/systemlib/mixer/mixer_multirotor.generated.h - - echo -en 'travis_fold:end:script.2\\r' - - echo 'Building NuttX..' && echo -en 'travis_fold:start:script.3\\r' - - make archives - - ccache -s - - echo -en 'travis_fold:end:script.3\\r' - - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.4\\r' - - make -j4 - - make size - - ccache -s - - echo -en 'travis_fold:end:script.4\\r' - - zip Firmware.zip Images/*.px4 + - cd build_posix_sitl_simple && ctest + - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r' + - make nuttx_px4fmu-v2_simple + - echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r' + - cd nuttx_px4fmu-v2_simple && ctest -after_script: - - git clone git://github.com/PX4/CI-Tools.git - - ./CI-Tools/s3cmd-configure -# upload newest build for this branch with s3 index - - ./CI-Tools/s3cmd-put Images/px4*.px4 CI-Tools/directory/index.html Firmware/$TRAVIS_BRANCH/ -# archive newest build by date with s3 index - - ./CI-Tools/s3cmd-put Firmware.zip archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/ - - ./CI-Tools/s3cmd-put CI-Tools/directory/index.html archives/Firmware/$TRAVIS_BRANCH/ -# upload top level index.html and timestamp.html - - ./CI-Tools/s3cmd-put CI-Tools/index.html index.html - - ./CI-Tools/s3cmd-put CI-Tools/timestamp.html timestamp.html - - echo "" - - echo "Binaries have been posted to:" - - echo https://px4-travis.s3.amazonaws.com/archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/Firmware.zip + #- make posix -j4 + #- ccache -s + #- echo -en 'travis_fold:end:script.1\\r' + #- echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r' + #- make tests + #- cat src/modules/systemlib/mixer/mixer_multirotor.generated.h + #- echo -en 'travis_fold:end:script.2\\r' + #- echo 'Building NuttX..' && echo -en 'travis_fold:start:script.3\\r' + #- make archives + #- ccache -s + #- echo -en 'travis_fold:end:script.3\\r' + #- echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.4\\r' + #- make -j4 + #- make size + #- ccache -s + #- echo -en 'travis_fold:end:script.4\\r' + #- zip Firmware.zip Images/*.px4 + +#after_script: + #- git clone git://github.com/PX4/CI-Tools.git + #- ./CI-Tools/s3cmd-configure +## upload newest build for this branch with s3 index + #- ./CI-Tools/s3cmd-put Images/px4*.px4 CI-Tools/directory/index.html Firmware/$TRAVIS_BRANCH/ +## archive newest build by date with s3 index + #- ./CI-Tools/s3cmd-put Firmware.zip archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/ + #- ./CI-Tools/s3cmd-put CI-Tools/directory/index.html archives/Firmware/$TRAVIS_BRANCH/ +## upload top level index.html and timestamp.html + #- ./CI-Tools/s3cmd-put CI-Tools/index.html index.html + #- ./CI-Tools/s3cmd-put CI-Tools/timestamp.html timestamp.html + #- echo "" + #- echo "Binaries have been posted to:" + #- echo https://px4-travis.s3.amazonaws.com/archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/Firmware.zip deploy: provider: releases From 3b231ec0a7a24f277b0d5f5d40a4260df00bfbab Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 02:29:26 -0400 Subject: [PATCH 048/389] Travis fix for cmake. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 260cb83580..b5bb9296b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ script: - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r' - make nuttx_px4fmu-v2_simple - echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r' - - cd nuttx_px4fmu-v2_simple && ctest + - cd build_nuttx_px4fmu-v2_simple && ctest #- make posix -j4 #- ccache -s From c66581d2ced33d9f22b70e12780709bd0da970fa Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 02:42:41 -0400 Subject: [PATCH 049/389] Travis fixes. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b5bb9296b2..9807da6499 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,17 +69,17 @@ env: - PX4_AWS_BUCKET=px4-travis script: - - make check_format + #- make check_format - ccache -z - arm-none-eabi-gcc --version - echo 'Building POSIX Firmware..' && echo -en 'travis_fold:start:script.1\\r' - make posix_sitl_simple - echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r' - - cd build_posix_sitl_simple && ctest + - make -C build_posix_sitl_simple test - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r' - make nuttx_px4fmu-v2_simple - echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r' - - cd build_nuttx_px4fmu-v2_simple && ctest + - make -C build_nuttx_px4fmu-v2_simple test #- make posix -j4 #- ccache -s From cadc7280b731da478f4d715c81a6cd4aa09554e6 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 03:05:17 -0400 Subject: [PATCH 050/389] Fixed makefile upload link. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e52f05e501..29c3b7fff7 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ nuttx_sim_simple: nuttx_px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple cd $d/build_$< && make upload -px4fmu-v2_simple_upload: px4fmu-v2_simple_upload +px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple_upload posix_sitl_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ From 08dc74afac85a774973b12d813c70e8729657063 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 09:29:21 -0700 Subject: [PATCH 051/389] cmake: fixes for qurt build after refactoring Signed-off-by: Mark Charlebois --- cmake/configs/config_qurt_hil_simple.cmake | 4 +++ cmake/posix/px4_impl_posix.cmake | 1 - cmake/qurt/px4_impl_qurt.cmake | 8 +++-- cmake/qurt/qurt_funcs.cmake | 42 ---------------------- src/firmware/qurt/CMakeLists.txt | 4 +-- 5 files changed, 11 insertions(+), 48 deletions(-) diff --git a/cmake/configs/config_qurt_hil_simple.cmake b/cmake/configs/config_qurt_hil_simple.cmake index ea1c8cc5a5..6068991428 100644 --- a/cmake/configs/config_qurt_hil_simple.cmake +++ b/cmake/configs/config_qurt_hil_simple.cmake @@ -1,4 +1,7 @@ +include(qurt/px4_impl_qurt) + function(px4_set_config_modules out_module_list) + set(config_module_list drivers/device drivers/boards/sitl @@ -81,5 +84,6 @@ function(px4_set_config_modules out_module_list) modules/muorb/adsp ) set(${out_module_list} ${config_module_list} PARENT_SCOPE) + endfunction() diff --git a/cmake/posix/px4_impl_posix.cmake b/cmake/posix/px4_impl_posix.cmake index ed97ab9cb7..1e08a43975 100644 --- a/cmake/posix/px4_impl_posix.cmake +++ b/cmake/posix/px4_impl_posix.cmake @@ -50,7 +50,6 @@ include(common/px4_base) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/posix) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/posix/configs) #============================================================================= # diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index 8fdc3324f5..9857502925 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -51,8 +51,9 @@ include(common/px4_base) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt/configs) -include(qurt_funcs) + +px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") +px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") #============================================================================= # @@ -225,7 +226,8 @@ function(px4_os_prebuild_targets) ONE_VALUE OUT BOARD THREADS REQUIRED OUT BOARD ARGN ${ARGN}) - add_custom_target(${OUT}) + add_custom_target(${OUT} DEPENDS git_dspal git_eigen32) + add_custom_target(ALL DEPENDS git_eigen32) execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/eigen-3.2 COMMAND patch -p1 -i ../../../cmake/qurt/qurt_eigen.patch) diff --git a/cmake/qurt/qurt_funcs.cmake b/cmake/qurt/qurt_funcs.cmake index c8a2f46a9f..7ecd0cc818 100644 --- a/cmake/qurt/qurt_funcs.cmake +++ b/cmake/qurt/qurt_funcs.cmake @@ -45,48 +45,6 @@ # # The macros are called from the top level CMakeLists.txt # -set(QURT_APPS_HEADER ${CMAKE_BINARY_DIR}/apps.h) - px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") -function(px4_target_add_modules out_module_directories) - list(APPEND ${out_module_directories} - ./src/platforms/qurt/px4_layer - ./src/platforms/posix/work_queue - PARENT_SCOPE - ) -endfunction() - -function(px4_target_validate_config) - # FIXME - this can be done in Firmware/CMakeLists.txt - list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) - - if (NOT EXISTS("${CMAKE_SOURCE_DIR}/cmake/qurt/${TARGET_NAME}.cmake")) - message(FATAL_ERROR "not implemented yet: ${TARGET_NAME}") - endif() -endfunction() - -function(px4_target_firmware) - set(installed_targets) - add_library(dspal_main SHARED ./src/platforms/qurt/px4_layer/main.cpp) - target_link_libraries(dspal_main ${module_list}) - list(APPEND installed_targets dspal_main) -endfunction() - -function(px4_target_rules) - #============================================================================= - # apps - # - add_custom_command(OUTPUT ${QURT_APPS_HEADER} - COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} - ${CMAKE_SOURCE_DIR}/Tools/qurt_apps.py > ${QURT_APPS_HEADER} - COMMENT "Generating qurt apps" - VERBATIM - ) - - add_custom_target(qurt_apps DEPENDS ${QURT_APPS_HEADER}) -endfunction() - -function(px4_target_testing) -endfunction() diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index fb97327691..f9c53c5853 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -1,4 +1,4 @@ -include(px4_base) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) set(V_ARCH v5) set(HEXAGON_TOOLS_ROOT /opt/6.4.03) @@ -33,7 +33,7 @@ set_target_properties(mainapp PROPERTIES LINK_FLAGS ${main_link_flags}) target_link_libraries(mainapp -Wl,--whole-archive - ${module_list} + ${module_libraries} m -Wl,--no-whole-archive -Wl,${TOOLSLIB}/pic/libstdc++.a) From f7fe33e6a46d9bbf1df16d8fb15ef174e6a6f401 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 12:40:34 -0400 Subject: [PATCH 052/389] Removed old module list from nuttx firmware. --- src/firmware/nuttx/CMakeLists.txt | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 1f61d0e073..17d86245ba 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -1,32 +1,6 @@ -# a list of modules that will be linked to main -set(module_list - platforms__nuttx - platforms__nuttx__px4_layer - platforms__common - drivers__led - drivers__device - modules__systemlib - modules__uORB - ) - -if (${LABEL} STREQUAL "simple") - list(APPEND module_list - examples__px4_simple_app - ) -endif() - -if(${BOARD} STREQUAL "px4fmu-v2") - list(APPEND module_list - drivers__boards__px4fmu-v2 - drivers__stm32 - lib__mathlib__math__filter - lib__conversion - ) -endif() - px4_nuttx_generate_builtin_commands( OUT builtin_commands.c - MODULE_LIST ${module_list}) + MODULE_LIST ${module_libraries}) px4_nuttx_generate_romfs(OUT romfs.o ROOT ROMFS/px4fmu_common) @@ -43,7 +17,7 @@ set_target_properties(firmware_nuttx PROPERTIES LINK_FLAGS ${main_link_flags}) target_link_libraries(firmware_nuttx -Wl,--start-group - ${module_list} + ${module_libraries} apps nuttx nosys m gcc -Wl,--end-group) From 34eeee9fa9e10908c5d4e84004e31189bb17e1bf Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 13:57:54 -0400 Subject: [PATCH 053/389] Added defautl config for nuttx, nuttx now works over usb. --- CMakeLists.txt | 8 +- Makefile | 39 +++- .../config_nuttx_px4fmu-v2_default.cmake | 185 ++++++++++++++++++ .../config_nuttx_px4fmu-v2_simple.cmake | 136 ++++++++++++- cmake/nuttx/px4_impl_nuttx.cmake | 4 +- src/drivers/boards/px4fmu-v2/px4fmu2_init.c | 23 +-- src/firmware/nuttx/CMakeLists.txt | 8 +- src/modules/uavcan/CMakeLists.txt | 52 ++++- src/platforms/common/CMakeLists.txt | 1 + 9 files changed, 423 insertions(+), 33 deletions(-) create mode 100644 cmake/configs/config_nuttx_px4fmu-v2_default.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e3515ca8bd..747ddf606f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,17 +178,17 @@ endforeach() #============================================================================= # git # -if (${OS} STREQUAL "nuttx") - px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") -endif() px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") +px4_add_git_submodule(TARGET git_uavcan PATH "src/lib/uavcan") if (NOT ${OS} STREQUAL "qurt") px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") endif() - +if(${OS} STREQUAL "nuttx") + px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +endif() add_custom_target(submodule_clean WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND git submodule deinit -f . diff --git a/Makefile b/Makefile index 29c3b7fff7..62b8b4bc95 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,62 @@ d=$(PWD) - +#---------------------------------------------------------------------------- +# OS: nuttx BOARD: px4fmu-v2 LABEL: simple +# nuttx_px4fmu-v2_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP -px4fmu-v2_simple: nuttx_px4fmu-v2_simple +nuttx_px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple + make -C build_$< upload +nuttx_px4fmu-v2_simple_test: nuttx_px4fmu-v2_simple + make -C build_$< test + +#---------------------------------------------------------------------------- +# OS: nuttx BOARD: px4fmu-v2 LABEL: default +# +nuttx_px4fmu-v2_default: + mkdir -p $d/build_$@ && cd $d/build_$@ && \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ + -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=default && \ + make -s && ctest -V && cpack -G ZIP +nuttx_px4fmu-v2_default_upload: nuttx_px4fmu-v2_default + make -C build_$< upload +nuttx_px4fmu-v2_default_test: nuttx_px4fmu-v2_default + make -C build_$< test + +#---------------------------------------------------------------------------- +# OS: nuttx BOARD: sim LABEL: simple +# nuttx_sim_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-native.cmake \ -DOS=nuttx -DBOARD=sim -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP -nuttx_px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple - cd $d/build_$< && make upload -px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple_upload - +#---------------------------------------------------------------------------- +# OS: posix BOARD: sitl LABEL: simple +# posix_sitl_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-posix-clang-native.cmake \ -DOS=posix -DBOARD=sitl -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP +#---------------------------------------------------------------------------- +# OS: qurt BOARD: hil LABEL: simple +# qurt_hil_simple: mkdir -p $d/build_$@ && cd $d/build_$@ && \ cmake .. -DQURT_ENABLE_STUBS=1 -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-hexagon.cmake \ -DOS=qurt -DBOARD=hil -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP +#---------------------------------------------------------------------------- +# misc targets +# clean: rm -rf build_*/ diff --git a/cmake/configs/config_nuttx_px4fmu-v2_default.cmake b/cmake/configs/config_nuttx_px4fmu-v2_default.cmake new file mode 100644 index 0000000000..53cfcca646 --- /dev/null +++ b/cmake/configs/config_nuttx_px4fmu-v2_default.cmake @@ -0,0 +1,185 @@ +include(nuttx/px4_impl_nuttx) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + + # + # Board support modules + # + drivers/device + drivers/stm32 + drivers/stm32/adc + drivers/stm32/tone_alarm + drivers/led + drivers/px4fmu + drivers/px4io + drivers/boards/px4fmu-v2 + drivers/rgbled + drivers/mpu6000 + drivers/mpu9250 + drivers/lsm303d + drivers/l3gd20 + drivers/hmc5883 + drivers/ms5611 + drivers/mb12xx + drivers/sf0x + drivers/ll40ls + drivers/trone + drivers/gps + drivers/pwm_out_sim + drivers/hott + drivers/hott/hott_telemetry + drivers/hott/hott_sensors + drivers/blinkm + drivers/airspeed + drivers/ets_airspeed + drivers/meas_airspeed + drivers/frsky_telemetry + modules/sensors + drivers/mkblctrl + drivers/px4flow + drivers/oreoled + drivers/gimbal + drivers/pwm_input + drivers/camera_trigger + + # + # System commands + # + systemcmds/bl_update + systemcmds/mixer + systemcmds/param + systemcmds/perf + systemcmds/pwm + systemcmds/esc_calib + systemcmds/reboot + systemcmds/top + systemcmds/config + systemcmds/nshterm + systemcmds/mtd + systemcmds/dumpfile + systemcmds/ver + + # + # General system control + # + modules/commander + modules/navigator + modules/mavlink + modules/gpio_led + #modules/uavcan # have to fix CMakeLists.txt + modules/land_detector + + # + # Estimation modules (EKF/ SO3 / other filters) + # + # Too high RAM usage due to static allocations + # modules/attitude_estimator_ekf + modules/attitude_estimator_q + modules/ekf_att_pos_estimator + modules/position_estimator_inav + + # + # Vehicle Control + # + # modules/segway # XXX Needs GCC 4.7 fix + modules/fw_pos_control_l1 + modules/fw_att_control + modules/mc_att_control + modules/mc_pos_control + modules/vtol_att_control + + # + # Logging + # + modules/sdlog2 + + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/controllib + modules/uORB + modules/dataman + + # + # Libraries + # + #lib/mathlib/CMSIS + lib/mathlib + lib/mathlib/math/filter + lib/ecl + lib/external_lgpl + lib/geo + lib/geo_lookup + lib/conversion + lib/launchdetection + platforms/nuttx + + # had to add for cmake, not sure why wasn't in original config + platforms/common + platforms/nuttx/px4_layer + + # + # OBC challenge + # + modules/bottle_drop + + # + # PX4 flow estimator, good for indoors + # + examples/flow_position_estimator + + # + # Rover apps + # + examples/rover_steering_control + + # + # Demo apps + # + #examples/math_demo + # Tutorial code from + # https://px4.io/dev/px4_simple_app + #examples/px4_simple_app + + # Tutorial code from + # https://px4.io/dev/daemon + #examples/px4_daemon_app + + # Tutorial code from + # https://px4.io/dev/debug_values + #examples/px4_mavlink_debug + + # Tutorial code from + # https://px4.io/dev/example_fixedwing_control + #examples/fixedwing_control + + # Hardware test + #examples/hwtest + ) + + # TODO convert rest of makefile config below + + # Generate parameter XML file + #GEN_PARAM_XML = 1 + + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + +function(px4_nuttx_builtin_extra_commands out) + + add_custom_target(sercon_main) + set_target_properties(sercon_main PROPERTIES + MAIN "sercon" STACK "2048") + + add_custom_target(serdis_main) + set_target_properties(serdis_main PROPERTIES + MAIN "serdis" STACK "2048") + + set(${out} sercon_main serdis_main PARENT_SCOPE) + +endfunction() diff --git a/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake b/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake index 148baf63eb..5159f82e04 100644 --- a/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake +++ b/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake @@ -3,21 +3,139 @@ include(nuttx/px4_impl_nuttx) function(px4_set_config_modules out_module_list) set(config_module_list - platforms/nuttx - platforms/nuttx/px4_layer - platforms/common - drivers/led + + # + # Board support modules + # drivers/device - modules/systemlib - modules/uORB - examples/px4_simple_app - drivers/boards/px4fmu-v2 drivers/stm32 + drivers/stm32/adc + drivers/stm32/tone_alarm + drivers/led + drivers/px4fmu + drivers/px4io + drivers/boards/px4fmu-v2 + drivers/rgbled + drivers/mpu6000 + drivers/mpu9250 + drivers/lsm303d + drivers/l3gd20 + drivers/hmc5883 + drivers/ms5611 + drivers/mb12xx + drivers/sf0x + drivers/ll40ls + drivers/trone + drivers/gps + drivers/pwm_out_sim + drivers/hott + drivers/hott/hott_telemetry + drivers/hott/hott_sensors + drivers/blinkm + drivers/airspeed + drivers/ets_airspeed + drivers/meas_airspeed + drivers/frsky_telemetry + modules/sensors + drivers/mkblctrl + drivers/px4flow + drivers/oreoled + drivers/gimbal + drivers/pwm_input + drivers/camera_trigger + + # + # System commands + # + systemcmds/bl_update + systemcmds/mixer + systemcmds/param + systemcmds/perf + systemcmds/pwm + systemcmds/esc_calib + systemcmds/reboot + systemcmds/top + systemcmds/config + systemcmds/nshterm + systemcmds/mtd + systemcmds/dumpfile + systemcmds/ver + + # + # Logging + # + modules/sdlog2 + + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/controllib + modules/uORB + modules/dataman + + # + # Libraries + # + #lib/mathlib/CMSIS + lib/mathlib lib/mathlib/math/filter + lib/ecl + lib/external_lgpl + lib/geo + lib/geo_lookup lib/conversion - ) + lib/launchdetection + platforms/nuttx + + # had to add for cmake, not sure why wasn't in original config + platforms/common + platforms/nuttx/px4_layer + + # + # Demo apps + # + #examples/math_demo + # Tutorial code from + # https://px4.io/dev/px4_simple_app + examples/px4_simple_app + + # Tutorial code from + # https://px4.io/dev/daemon + examples/px4_daemon_app + + # Tutorial code from + # https://px4.io/dev/debug_values + examples/px4_mavlink_debug + + # Tutorial code from + # https://px4.io/dev/example_fixedwing_control + examples/fixedwing_control + + # Hardware test + examples/hwtest + ) + + # TODO convert rest of makefile config below + + # Generate parameter XML file + #GEN_PARAM_XML = 1 set(${out_module_list} ${config_module_list} PARENT_SCOPE) endfunction() +function(px4_nuttx_builtin_extra_commands out) + + add_custom_target(sercon_main) + set_target_properties(sercon_main PROPERTIES + MAIN "sercon" STACK "2048") + + add_custom_target(serdis_main) + set_target_properties(serdis_main PROPERTIES + MAIN "serdis" STACK "2048") + + set(${out} sercon_main serdis_main PARENT_SCOPE) + +endfunction() diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 54a46199fe..6bba2158fa 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -96,7 +96,7 @@ endfunction() # px4_nuttx_generate_builtin_commands # # This function generates the builtin_commands.c src for nuttx - +# # Usage: # px4_nuttx_generate_builtin_commands( # MODULE_LIST @@ -119,10 +119,12 @@ function(px4_nuttx_generate_builtin_commands) MULTI_VALUE MODULE_LIST REQUIRED MODULE_LIST OUT ARGN ${ARGN}) + message(STATUS "argn: ${ARGN}") set(builtin_apps_string) set(builtin_apps_decl_string) set(command_count 0) foreach(module ${MODULE_LIST}) + message("generating builtin for: ${module}") # default set(MAIN_DEFAULT MAIN-NOTFOUND) set(STACK_DEFAULT 1024) diff --git a/src/drivers/boards/px4fmu-v2/px4fmu2_init.c b/src/drivers/boards/px4fmu-v2/px4fmu2_init.c index 698258fa45..e4f32b34c6 100644 --- a/src/drivers/boards/px4fmu-v2/px4fmu2_init.c +++ b/src/drivers/boards/px4fmu-v2/px4fmu2_init.c @@ -210,17 +210,18 @@ static struct sdio_dev_s *sdio; #include -#ifdef __cplusplus -__EXPORT int matherr(struct __exception *e) -{ - return 1; -} -#else -__EXPORT int matherr(struct exception *e) -{ - return 1; -} -#endif +/* TODO XXX commented this out to get cmake build working */ +/*#ifdef __cplusplus*/ +/*__EXPORT int matherr(struct __exception *e)*/ +/*{*/ + /*return 1;*/ +/*}*/ +/*#else*/ +/*__EXPORT int matherr(struct exception *e)*/ +/*{*/ + /*return 1;*/ +/*}*/ +/*#endif*/ __EXPORT int nsh_archinitialize(void) { diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 17d86245ba..8d7832ffab 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -1,6 +1,9 @@ +px4_nuttx_builtin_extra_commands(builtin_extra_cmds) +message(STATUS "builtin extra: ${builtin_extra_cmds}") + px4_nuttx_generate_builtin_commands( OUT builtin_commands.c - MODULE_LIST ${module_libraries}) + MODULE_LIST ${module_libraries} ${builtin_extra_cmds}) px4_nuttx_generate_romfs(OUT romfs.o ROOT ROMFS/px4fmu_common) @@ -15,9 +18,12 @@ set(main_link_flags 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) + target_link_libraries(firmware_nuttx -Wl,--start-group ${module_libraries} + ${cmsis_lib} apps nuttx nosys m gcc -Wl,--end-group) diff --git a/src/modules/uavcan/CMakeLists.txt b/src/modules/uavcan/CMakeLists.txt index 86a02dd359..7cd3ddbb01 100644 --- a/src/modules/uavcan/CMakeLists.txt +++ b/src/modules/uavcan/CMakeLists.txt @@ -37,11 +37,61 @@ px4_add_module( COMPILE_FLAGS -O3 SRCS + + # Main uavcan_main.cpp uavcan_servers.cpp uavcan_clock.cpp uavcan_params.c + + # Actuators + actuators/esc.cpp + + # Sensors + sensors/sensor_bridge.cpp + sensors/gnss.cpp + sensors/mag.cpp + sensors/baro.cpp + DEPENDS platforms__common ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : + +# TODO convert rest of module.mk + +## +## libuavcan +## +#include $(PX4_LIB_DIR)uavcan/libuavcan/include.mk +## Use the relitive path to keep the genrated files in the BUILD_DIR +#SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_SRC)) +#INCLUDE_DIRS += $(LIBUAVCAN_INC) +## Since actual compiler mode is C++11, the library will default to UAVCAN_CPP11, but it will fail to compile +## because this platform lacks most of the standard library and STL. Hence we need to force C++03 mode. +#override EXTRADEFINES := $(EXTRADEFINES) \ +#-DUAVCAN_CPP_VERSION=UAVCAN_CPP03 \ +#-DUAVCAN_NO_ASSERTIONS \ +#-DUAVCAN_MEM_POOL_BLOCK_SIZE=48 \ +#-DUAVCAN_MAX_NETWORK_SIZE_HINT=16 + +## +## libuavcan drivers for STM32 +## +#include $(PX4_LIB_DIR)uavcan/libuavcan_drivers/stm32/driver/include.mk +## Use the relitive path to keep the genrated files in the BUILD_DIR +#SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_STM32_SRC)) +#INCLUDE_DIRS += $(LIBUAVCAN_STM32_INC) +#override EXTRADEFINES := $(EXTRADEFINES) -DUAVCAN_STM32_NUTTX -DUAVCAN_STM32_NUM_IFACES=2 + +## +## libuavcan drivers for posix +## +#include $(PX4_LIB_DIR)uavcan/libuavcan_drivers/posix/include.mk +#INCLUDE_DIRS += $(LIBUAVCAN_POSIX_INC) + +## +## Invoke DSDL compiler +## +#$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR))) +#INCLUDE_DIRS += dsdlc_generated +## vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/common/CMakeLists.txt b/src/platforms/common/CMakeLists.txt index 5cb59b418b..7b50768ac1 100644 --- a/src/platforms/common/CMakeLists.txt +++ b/src/platforms/common/CMakeLists.txt @@ -34,6 +34,7 @@ set(depends msg_gen prebuild_targets git_mavlink + git_uavcan ) if(${OS} STREQUAL "posix" OR ${BOARD} STREQUAL "sim") From b073edc684f788a020f129331d1d1614eb8f7661 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 14:08:03 -0400 Subject: [PATCH 054/389] Set makefile default target explicity. --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 62b8b4bc95..ffe7a78d40 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ d=$(PWD) +all: nuttx_px4fmu-v2_default + #---------------------------------------------------------------------------- # OS: nuttx BOARD: px4fmu-v2 LABEL: simple # From b09c8f3c9bf616947ea0bc1efee6fc040128f1d0 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 11:18:30 -0700 Subject: [PATCH 055/389] cmake: Added dspal and eigen32 to top level CMakeLists.txt Relying on inclusion of git_eigen32 and git_dspal targets to trigger the submodule init and update Signed-off-by: Mark Charlebois --- CMakeLists.txt | 11 +++++------ cmake/qurt/px4_impl_qurt.cmake | 3 --- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 747ddf606f..fc28a8bc62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,12 +183,11 @@ px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") px4_add_git_submodule(TARGET git_uavcan PATH "src/lib/uavcan") -if (NOT ${OS} STREQUAL "qurt") - px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") -endif() -if(${OS} STREQUAL "nuttx") - px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") -endif() +px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") +px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") +px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") + add_custom_target(submodule_clean WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND git submodule deinit -f . diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index 9857502925..d565210dfd 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -52,9 +52,6 @@ include(common/px4_base) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt) -px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") -px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") - #============================================================================= # # px4_qurt_generate_builtin_commands From 149deeb11f5c9cd496feb508be806c5fd5c64dd5 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 14:38:09 -0400 Subject: [PATCH 056/389] Fixed autostart. --- cmake/nuttx/px4_impl_nuttx.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 6bba2158fa..a60e0c5133 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -275,7 +275,7 @@ function(px4_nuttx_generate_romfs) add_custom_command(OUTPUT rc.autostart COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} - -a ${ROMFS_ROOT}/init.d + -a ${romfs_src_dir}/init.d/ -s rc.autostart ) From e3e00e92d740d35f903b481903bc75a0feda6a1c Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 12:59:45 -0700 Subject: [PATCH 057/389] Updated to newer version of dspal Signed-off-by: Mark Charlebois --- src/lib/dspal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dspal b/src/lib/dspal index e691659c00..a88d55925c 160000 --- a/src/lib/dspal +++ b/src/lib/dspal @@ -1 +1 @@ -Subproject commit e691659c000a63be6f6db0d9a367ed5a705fbdee +Subproject commit a88d55925cc21d4f9ebc728deab85cbcbb218a52 From a690fd12e0babdd09a3ce784fb88827d94a247bb Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 16:21:52 -0400 Subject: [PATCH 058/389] Removed unneeded dep from makefile. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ffe7a78d40..d78dbd0907 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,9 @@ nuttx_px4fmu-v2_simple: cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP -nuttx_px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple +nuttx_px4fmu-v2_simple_upload: make -C build_$< upload -nuttx_px4fmu-v2_simple_test: nuttx_px4fmu-v2_simple +nuttx_px4fmu-v2_simple_test: make -C build_$< test @@ -24,9 +24,9 @@ nuttx_px4fmu-v2_default: cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=default && \ make -s && ctest -V && cpack -G ZIP -nuttx_px4fmu-v2_default_upload: nuttx_px4fmu-v2_default +nuttx_px4fmu-v2_default_upload: make -C build_$< upload -nuttx_px4fmu-v2_default_test: nuttx_px4fmu-v2_default +nuttx_px4fmu-v2_default_test: make -C build_$< test #---------------------------------------------------------------------------- From 2bd0c2479ef3e43cdb9553f483f4a85a6fda9031 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 16:25:32 -0400 Subject: [PATCH 059/389] Makefile dep fix. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d78dbd0907..ffe7a78d40 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,9 @@ nuttx_px4fmu-v2_simple: cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=simple && \ make -s && ctest -V && cpack -G ZIP -nuttx_px4fmu-v2_simple_upload: +nuttx_px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple make -C build_$< upload -nuttx_px4fmu-v2_simple_test: +nuttx_px4fmu-v2_simple_test: nuttx_px4fmu-v2_simple make -C build_$< test @@ -24,9 +24,9 @@ nuttx_px4fmu-v2_default: cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=default && \ make -s && ctest -V && cpack -G ZIP -nuttx_px4fmu-v2_default_upload: +nuttx_px4fmu-v2_default_upload: nuttx_px4fmu-v2_default make -C build_$< upload -nuttx_px4fmu-v2_default_test: +nuttx_px4fmu-v2_default_test: nuttx_px4fmu-v2_default make -C build_$< test #---------------------------------------------------------------------------- From 6966331a880907d58b2ce35349ef9633c17c58dd Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 17:44:27 -0400 Subject: [PATCH 060/389] Working on param xml gen. Haven't updated qurt config yet. --- CMakeLists.txt | 4 +- .../config_nuttx_px4fmu-v2_default.cmake | 42 +++++++++++++------ .../config_nuttx_px4fmu-v2_simple.cmake | 41 +++++++++++++----- cmake/configs/config_posix_sitl_simple.cmake | 41 +++++++++++++++++- cmake/nuttx/px4_impl_nuttx.cmake | 42 +++++++++++++++---- makefiles/CMakeLists.txt | 38 ----------------- src/firmware/nuttx/CMakeLists.txt | 11 +++-- 7 files changed, 141 insertions(+), 78 deletions(-) delete mode 100644 makefiles/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 747ddf606f..47cfb05cf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,7 @@ endif() set(px4_required_functions px4_os_prebuild_targets px4_os_add_flags - px4_set_config_modules + px4_get_config ) foreach(cmd ${px4_required_functions}) if(NOT COMMAND ${cmd}) @@ -235,7 +235,7 @@ px4_generate_messages(TARGET msg_gen #============================================================================= # subdirectories # -px4_set_config_modules(config_modules) +px4_get_config(OUT_MODULES config_modules) set(module_libraries) foreach(module ${config_modules}) add_subdirectory(src/${module}) diff --git a/cmake/configs/config_nuttx_px4fmu-v2_default.cmake b/cmake/configs/config_nuttx_px4fmu-v2_default.cmake index 53cfcca646..826281cb9d 100644 --- a/cmake/configs/config_nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/config_nuttx_px4fmu-v2_default.cmake @@ -1,9 +1,13 @@ include(nuttx/px4_impl_nuttx) -function(px4_set_config_modules out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ARGN ${ARGN}) set(config_module_list - # # Board support modules # @@ -161,25 +165,39 @@ function(px4_set_config_modules out_module_list) #examples/hwtest ) - # TODO convert rest of makefile config below + set(firmware_options + PARAM_XML # generate param xml + ) - # Generate parameter XML file - #GEN_PARAM_XML = 1 + set(extra_cmds serdis_main sercon_main) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + # output + if(OUT_MODULES) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) + endif() + + if (OUT_FW_OPTS) + set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE) + endif() endfunction() -function(px4_nuttx_builtin_extra_commands out) +function(px4_add_extra_builtin_cmds) - add_custom_target(sercon_main) - set_target_properties(sercon_main PROPERTIES + px4_parse_function_args( + NAME px4_add_extra_builtin_cmds + ONE_VALUE OUT + REQUIRED OUT + ARGN ${ARGN}) + + add_custom_target(sercon) + set_target_properties(sercon PROPERTIES MAIN "sercon" STACK "2048") - add_custom_target(serdis_main) - set_target_properties(serdis_main PROPERTIES + add_custom_target(serdis) + set_target_properties(serdis PROPERTIES MAIN "serdis" STACK "2048") - set(${out} sercon_main serdis_main PARENT_SCOPE) + set(${OUT} sercon serdis PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake b/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake index 5159f82e04..864275ad32 100644 --- a/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake +++ b/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake @@ -1,6 +1,11 @@ include(nuttx/px4_impl_nuttx) -function(px4_set_config_modules out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ARGN ${ARGN}) set(config_module_list @@ -117,25 +122,39 @@ function(px4_set_config_modules out_module_list) examples/hwtest ) - # TODO convert rest of makefile config below + set(firmware_options + PARAM_XML # generate param xml + ) - # Generate parameter XML file - #GEN_PARAM_XML = 1 + set(extra_cmds serdis_main sercon_main) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + # output + if(OUT_MODULES) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) + endif() + + if (OUT_FW_OPTS) + set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE) + endif() endfunction() -function(px4_nuttx_builtin_extra_commands out) +function(px4_add_extra_builtin_cmds) - add_custom_target(sercon_main) - set_target_properties(sercon_main PROPERTIES + px4_parse_function_args( + NAME px4_add_extra_builtin_cmds + ONE_VALUE OUT + REQUIRED OUT + ARGN ${ARGN}) + + add_custom_target(sercon) + set_target_properties(sercon PROPERTIES MAIN "sercon" STACK "2048") - add_custom_target(serdis_main) - set_target_properties(serdis_main PROPERTIES + add_custom_target(serdis) + set_target_properties(serdis PROPERTIES MAIN "serdis" STACK "2048") - set(${out} sercon_main serdis_main PARENT_SCOPE) + set(${OUT} sercon serdis PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_posix_sitl_simple.cmake b/cmake/configs/config_posix_sitl_simple.cmake index aedb00f75c..20481bdb1e 100644 --- a/cmake/configs/config_posix_sitl_simple.cmake +++ b/cmake/configs/config_posix_sitl_simple.cmake @@ -1,6 +1,11 @@ include(posix/px4_impl_posix) -function(px4_set_config_modules out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ARGN ${ARGN}) set(config_module_list drivers/led @@ -54,7 +59,39 @@ function(px4_set_config_modules out_module_list) lib/launchdetection ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(firmware_options + PARAM_XML # generate param xml + ) + + set(extra_cmds serdis_main sercon_main) + + # output + if(OUT_MODULES) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) + endif() + + if (OUT_FW_OPTS) + set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE) + endif() endfunction() +function(px4_add_extra_builtin_cmds) + + px4_parse_function_args( + NAME px4_add_extra_builtin_cmds + ONE_VALUE OUT + REQUIRED OUT + ARGN ${ARGN}) + + add_custom_target(sercon) + set_target_properties(sercon PROPERTIES + MAIN "sercon" STACK "2048") + + add_custom_target(serdis) + set_target_properties(serdis PROPERTIES + MAIN "serdis" STACK "2048") + + set(${OUT} sercon serdis PARENT_SCOPE) + +endfunction() diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index a60e0c5133..c62ce0ecfa 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -79,16 +79,40 @@ function(px4_nuttx_add_firmware) REQUIRED EXE ARGN ${ARGN}) + set(process_params ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py) + set(process_airframes ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py) + + #TODO handle param_xml - add_custom_command(OUTPUT ${OUT} - COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py - --prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype - --git_identity ${CMAKE_SOURCE_DIR} - --image ${EXE}.bin > ${OUT} - DEPENDS ${EXE} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) + if(PARAM_XML) + add_custom_command(OUTPUT ${OUT} + COMMAND ${process_params} + --src-path ${CMAKE_SOURCE_DIR}/src + --board CONFIG_ARCH_BOARD_${BOARD} --xml + COMMAND ${process_airframes} + -a ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common/init.d + --board CONFIG_ARCH_BOARD_${BOARD} --xml + COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py + --prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype + --git_identity ${CMAKE_SOURCE_DIR} + --parameter_xml parameters.xml + --airframe_xml airframe.xml + --image ${EXE}.bin > ${OUT} + DEPENDS ${EXE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + else() + add_custom_command(OUTPUT ${OUT} + COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py + --prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype + --git_identity ${CMAKE_SOURCE_DIR} + --image ${EXE}.bin > ${OUT} + DEPENDS ${EXE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + endif() endfunction() #============================================================================= diff --git a/makefiles/CMakeLists.txt b/makefiles/CMakeLists.txt deleted file mode 100644 index db2304917e..0000000000 --- a/makefiles/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################ -# -# Copyright (c) 2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ -px4_add_module( - MODULE - DEPENDS - platforms__common - ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 8d7832ffab..cc164b8d91 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -1,9 +1,9 @@ -px4_nuttx_builtin_extra_commands(builtin_extra_cmds) -message(STATUS "builtin extra: ${builtin_extra_cmds}") +px4_add_extra_builtin_cmds(OUT extra_builtins) px4_nuttx_generate_builtin_commands( OUT builtin_commands.c - MODULE_LIST ${module_libraries} ${builtin_extra_cmds}) + MODULE_LIST ${module_libraries} ${extra_builtins} + ) px4_nuttx_generate_romfs(OUT romfs.o ROOT ROMFS/px4fmu_common) @@ -27,8 +27,11 @@ target_link_libraries(firmware_nuttx apps nuttx nosys m gcc -Wl,--end-group) +px4_get_config(OUT_FW_OPTS fw_opts) px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 - EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx) + EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx + ${fw_opts} + ) px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) From 8dc5d7532ebeff0c5570ef3c1379d8ec827f19dc Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 15:00:20 -0700 Subject: [PATCH 061/389] Added more eagle build configurations The config_qurt_eagle_travis.cmake target is for CI Signed-off-by: Mark Charlebois --- cmake/configs/config_posix_eagle_default.mk | 48 +++++++++++ cmake/configs/config_posix_eagle_hil.cmake | 37 ++++++++ cmake/configs/config_posix_eagle_muorb.cmake | 19 ++++ .../configs/config_posix_eagle_release.cmake | 32 +++++++ cmake/configs/config_qurt_eagle_hello.cmake | 30 +++++++ cmake/configs/config_qurt_eagle_hil.cmake | 66 ++++++++++++++ cmake/configs/config_qurt_eagle_muorb.cmake | 44 ++++++++++ cmake/configs/config_qurt_eagle_release.cmake | 86 +++++++++++++++++++ cmake/configs/config_qurt_eagle_test.cmake | 41 +++++++++ ...e.cmake => config_qurt_eagle_travis.cmake} | 70 ++++++--------- src/firmware/qurt/CMakeLists.txt | 1 + src/platforms/qurt/px4_layer/CMakeLists.txt | 13 ++- ...commands_muorb_test.c => commands_muorb.c} | 0 .../{commands_adsp.c => commands_release.c} | 0 .../{commands_default.c => commands_test.c} | 0 15 files changed, 441 insertions(+), 46 deletions(-) create mode 100644 cmake/configs/config_posix_eagle_default.mk create mode 100644 cmake/configs/config_posix_eagle_hil.cmake create mode 100644 cmake/configs/config_posix_eagle_muorb.cmake create mode 100644 cmake/configs/config_posix_eagle_release.cmake create mode 100644 cmake/configs/config_qurt_eagle_hello.cmake create mode 100644 cmake/configs/config_qurt_eagle_hil.cmake create mode 100644 cmake/configs/config_qurt_eagle_muorb.cmake create mode 100644 cmake/configs/config_qurt_eagle_release.cmake create mode 100644 cmake/configs/config_qurt_eagle_test.cmake rename cmake/configs/{config_qurt_hil_simple.cmake => config_qurt_eagle_travis.cmake} (51%) rename src/platforms/qurt/px4_layer/{commands_muorb_test.c => commands_muorb.c} (100%) rename src/platforms/qurt/px4_layer/{commands_adsp.c => commands_release.c} (100%) rename src/platforms/qurt/px4_layer/{commands_default.c => commands_test.c} (100%) diff --git a/cmake/configs/config_posix_eagle_default.mk b/cmake/configs/config_posix_eagle_default.mk new file mode 100644 index 0000000000..589c44a05e --- /dev/null +++ b/cmake/configs/config_posix_eagle_default.mk @@ -0,0 +1,48 @@ +include(posix/px4_impl_posix-arm) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + drivers/device + drivers/blinkm + drivers/pwm_out_sim + drivers/rgbled + drivers/led + modules/sensors + + systemcmds/param + systemcmds/mixer + systemcmds/ver + + modules/mavlink + + modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator + + modules/mc_pos_control + modules/mc_att_control + + modules/systemlib + modules/systemlib/mixer + modules/uORB + modules/sensors + modules/dataman + modules/sdlog2 + modules/simulator + modules/commander + modules/controllib + + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + + platforms/posix/px4_layer + platforms/posix/work_queue + ) + + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/configs/config_posix_eagle_hil.cmake b/cmake/configs/config_posix_eagle_hil.cmake new file mode 100644 index 0000000000..ebe148ab37 --- /dev/null +++ b/cmake/configs/config_posix_eagle_hil.cmake @@ -0,0 +1,37 @@ +include(posix/px4_impl_posix-arm) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + drivers/device + drivers/boards/sitl + drivers/led + + systemcmds/param + systemcmds/ver + + modules/mavlink + + modules/systemlib + modules/uORB + modules/sensors + modules/dataman + modules/sdlog2 + modules/simulator + modules/commander + + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + + platforms/posix/px4_layer + platforms/posix/work_queue + modules/muorb/krait + ) + + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/configs/config_posix_eagle_muorb.cmake b/cmake/configs/config_posix_eagle_muorb.cmake new file mode 100644 index 0000000000..70235928ec --- /dev/null +++ b/cmake/configs/config_posix_eagle_muorb.cmake @@ -0,0 +1,19 @@ +include(posix/px4_impl_posix-arm) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + drivers/device + + modules/uORB + + platforms/posix/px4_layer + platforms/posix/work_queue + + modules/muorb/krait + ) + + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/configs/config_posix_eagle_release.cmake b/cmake/configs/config_posix_eagle_release.cmake new file mode 100644 index 0000000000..745fa36826 --- /dev/null +++ b/cmake/configs/config_posix_eagle_release.cmake @@ -0,0 +1,32 @@ +include(posix/px4_impl_posix-arm) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + drivers/device + + systemcmds/param + systemcmds/ver + + modules/mavlink + + modules/systemlib + modules/uORB + modules/dataman + + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + + platforms/posix/px4_layer + platforms/posix/work_queue + + modules/muorb/krait + ) + + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/configs/config_qurt_eagle_hello.cmake b/cmake/configs/config_qurt_eagle_hello.cmake new file mode 100644 index 0000000000..6da3d11574 --- /dev/null +++ b/cmake/configs/config_qurt_eagle_hello.cmake @@ -0,0 +1,30 @@ +include(qurt/px4_impl_qurt) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + drivers/device + + # + # System commands + # + systemcmds/param + + # + # Library modules + # + modules/systemlib + modules/uORB + + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + platforms/qurt/tests/hello + ) + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/configs/config_qurt_eagle_hil.cmake b/cmake/configs/config_qurt_eagle_hil.cmake new file mode 100644 index 0000000000..5e7e7fc16c --- /dev/null +++ b/cmake/configs/config_qurt_eagle_hil.cmake @@ -0,0 +1,66 @@ +include(qurt/px4_impl_qurt) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + drivers/device + drivers/boards/sitl + drivers/pwm_out_sim + drivers/led + drivers/rgbled + modules/sensors + + # + # System commands + # + systemcmds/param + systemcmds/mixer + + # + # Estimation modules (EKF/ SO3 / other filters) + # + #modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator + modules/attitude_estimator_q + modules/position_estimator_inav + + # + # Vehicle Control + # + modules/mc_att_control + modules/mc_pos_control + + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/uORB + modules/commander + + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + modules/controllib + + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + + # + # sources for muorb over fastrpc + # + modules/muorb/adsp + ) + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/configs/config_qurt_eagle_muorb.cmake b/cmake/configs/config_qurt_eagle_muorb.cmake new file mode 100644 index 0000000000..5cf884baf1 --- /dev/null +++ b/cmake/configs/config_qurt_eagle_muorb.cmake @@ -0,0 +1,44 @@ +include(qurt/px4_impl_qurt) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + drivers/device + + # + # System commands + # + systemcmds/param + + # + # Library modules + # + modules/systemlib + modules/uORB + + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + platforms/qurt/tests/muorb + + # + # sources for muorb over fastrpc + # + modules/muorb/adsp + ) + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/configs/config_qurt_eagle_release.cmake b/cmake/configs/config_qurt_eagle_release.cmake new file mode 100644 index 0000000000..3bf19fb16f --- /dev/null +++ b/cmake/configs/config_qurt_eagle_release.cmake @@ -0,0 +1,86 @@ +include(qurt/px4_impl_qurt) + +if ("${HEXAGON_DRIVERS_ROOT}" STREQUAL "") + message(FATAL_ERROR "HEXAGON_DRIVERS_ROOT is not set") +endif() + +if ("${EAGLE_DRIVERS_SRC}" STREQUAL "") + message(FATAL_ERROR "EAGLE_DRIVERS_SRC is not set") +endif() + +include_directories(${HEXAGON_DRIVERS_ROOT}/inc) + +# For Actual flight we need to link against the driver dynamic libraries +set(target_libraries + -L${HEXAGON_DRIVERS_ROOT}/libs + mpu9x50 + uart_esc + csr_gps + rc_receiver + ) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + # + # Board support modules + # + drivers/device + modules/sensors + $(EAGLE_DRIVERS_SRC)/mpu9x50 + $(EAGLE_DRIVERS_SRC)/uart_esc + $(EAGLE_DRIVERS_SRC)/rc_receiver + $(EAGLE_DRIVERS_SRC)/csr_gps + + # + # System commands + # + systemcmds/param + + # + # Estimation modules (EKF/ SO3 / other filters) + # + #modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator + modules/attitude_estimator_q + modules/position_estimator_inav + + # + # Vehicle Control + # + modules/mc_att_control + modules/mc_pos_control + + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/uORB + modules/commander + modules/controllib + + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + + # + # sources for muorb over fastrpc + # + modules/muorb/adsp + ) + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() diff --git a/cmake/configs/config_qurt_eagle_test.cmake b/cmake/configs/config_qurt_eagle_test.cmake new file mode 100644 index 0000000000..bbb837b363 --- /dev/null +++ b/cmake/configs/config_qurt_eagle_test.cmake @@ -0,0 +1,41 @@ +include(qurt/px4_impl_qurt) + +function(px4_set_config_modules out_module_list) + + set(config_module_list + drivers/device + + # + # System commands + # + systemcmds/param + + # + # Library modules + # + modules/systemlib + modules/mixer + modules/uORB + + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/conversion + + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + platforms/qurt/tests/hello + platforms/qurt/tests/vcdev_test + platforms/qurt/tests/hrt_test + platforms/qurt/tests/wqueue + ) + set(${out_module_list} ${config_module_list} PARENT_SCOPE) + +endfunction() + diff --git a/cmake/configs/config_qurt_hil_simple.cmake b/cmake/configs/config_qurt_eagle_travis.cmake similarity index 51% rename from cmake/configs/config_qurt_hil_simple.cmake rename to cmake/configs/config_qurt_eagle_travis.cmake index 6068991428..b8a21017b6 100644 --- a/cmake/configs/config_qurt_hil_simple.cmake +++ b/cmake/configs/config_qurt_eagle_travis.cmake @@ -1,5 +1,8 @@ include(qurt/px4_impl_qurt) +# Run a full link with build stubs to make sure qurt target isn't broken +set(QURT_ENABLE_STUBS 1) + function(px4_set_config_modules out_module_list) set(config_module_list @@ -10,48 +13,37 @@ function(px4_set_config_modules out_module_list) drivers/rgbled modules/sensors - # drivers/blinkm - # drivers/ms5611 - - # - # System commands - # + # + # System commands + # systemcmds/param systemcmds/mixer - # - # General system control - # - # modules/mavlink - - # - # Estimation modules (EKF/ SO3 / other filters) - # - # modules/attitude_estimator_ekf + # + # Estimation modules (EKF/ SO3 / other filters) + # + #modules/attitude_estimator_ekf modules/ekf_att_pos_estimator modules/attitude_estimator_q modules/position_estimator_inav - # - # Vehicle Control - # + # + # Vehicle Control + # modules/mc_att_control modules/mc_pos_control - # - # Library modules - # + # + # Library modules + # modules/systemlib modules/systemlib/mixer modules/uORB - #MODULES += modules/dataman - #MODULES += modules/sdlog2 - #MODULES += modules/simulator modules/commander - # - # Libraries - # + # + # Libraries + # lib/mathlib lib/mathlib/math/filter lib/geo @@ -59,28 +51,16 @@ function(px4_set_config_modules out_module_list) lib/conversion modules/controllib - # - # QuRT port - # + # + # QuRT port + # platforms/common platforms/qurt/px4_layer platforms/posix/work_queue - # platforms/posix/drivers/accelsim - # platforms/posix/drivers/gyrosim - # platforms/posix/drivers/adcsim - # platforms/posix/drivers/barosim - # - # Unit tests - # - # platforms/qurt/tests/muorb - # platforms/posix/tests/vcdev_test - # platforms/posix/tests/hrt_test - # platforms/posix/tests/wqueue - - # - # sources for muorb over fastrpc - # + # + # sources for muorb over fastrpc + # modules/muorb/adsp ) set(${out_module_list} ${config_module_list} PARENT_SCOPE) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index f9c53c5853..e720715ef2 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -34,6 +34,7 @@ set_target_properties(mainapp PROPERTIES LINK_FLAGS ${main_link_flags}) target_link_libraries(mainapp -Wl,--whole-archive ${module_libraries} + ${target_libraries} m -Wl,--no-whole-archive -Wl,${TOOLSLIB}/pic/libstdc++.a) diff --git a/src/platforms/qurt/px4_layer/CMakeLists.txt b/src/platforms/qurt/px4_layer/CMakeLists.txt index 7385fa5b0f..c9720b7e8e 100644 --- a/src/platforms/qurt/px4_layer/CMakeLists.txt +++ b/src/platforms/qurt/px4_layer/CMakeLists.txt @@ -46,7 +46,18 @@ if ("${QURT_ENABLE_STUBS}" STREQUAL "1") ) endif() -set(CONFIG_SRC commands_${BOARD}.c) +# For Eagle, the commands are specific to the build config label +# e.g. config_qurt_eagle_hil uses commands_hil.c +if ("${BOARD}" STREQUAL "eagle") + + # The CI test target can use the hil commands + if ("${LABEL}" STREQUAL "travis") + set(CONFIG_SRC commands_hil.c) + else("${LABEL}" STREQUAL "travis") + set(CONFIG_SRC commands_${LABEL}.c) + endif() + +endif() px4_add_module( MODULE platforms__qurt__px4_layer diff --git a/src/platforms/qurt/px4_layer/commands_muorb_test.c b/src/platforms/qurt/px4_layer/commands_muorb.c similarity index 100% rename from src/platforms/qurt/px4_layer/commands_muorb_test.c rename to src/platforms/qurt/px4_layer/commands_muorb.c diff --git a/src/platforms/qurt/px4_layer/commands_adsp.c b/src/platforms/qurt/px4_layer/commands_release.c similarity index 100% rename from src/platforms/qurt/px4_layer/commands_adsp.c rename to src/platforms/qurt/px4_layer/commands_release.c diff --git a/src/platforms/qurt/px4_layer/commands_default.c b/src/platforms/qurt/px4_layer/commands_test.c similarity index 100% rename from src/platforms/qurt/px4_layer/commands_default.c rename to src/platforms/qurt/px4_layer/commands_test.c From a456b6a1c67d990fd42e95cb42fe930a9a84eeb9 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 16:25:30 -0700 Subject: [PATCH 062/389] Added missing Makefile update Signed-off-by: Mark Charlebois --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ffe7a78d40..38fc7ddd98 100644 --- a/Makefile +++ b/Makefile @@ -50,10 +50,10 @@ posix_sitl_simple: #---------------------------------------------------------------------------- # OS: qurt BOARD: hil LABEL: simple # -qurt_hil_simple: +qurt_eagle_travis: mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DQURT_ENABLE_STUBS=1 -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-hexagon.cmake \ - -DOS=qurt -DBOARD=hil -DLABEL=simple && \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-hexagon.cmake \ + -DOS=qurt -DBOARD=eagle -DLABEL=travis && \ make -s && ctest -V && cpack -G ZIP #---------------------------------------------------------------------------- From 2c33f4921c61c126510b4d58cc52eacab5dc8a07 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 21:15:55 -0400 Subject: [PATCH 063/389] Add makefile magic to simplify maintenance. --- CMakeLists.txt | 2 +- Makefile | 134 +++++++++++++++++++------------ cmake/nuttx/px4_impl_nuttx.cmake | 2 +- 3 files changed, 84 insertions(+), 54 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cd82ee0a4..dbb58a46de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,7 +240,7 @@ foreach(module ${config_modules}) add_subdirectory(src/${module}) px4_mangle_name(${module} mangled_name) list(APPEND module_libraries ${mangled_name}) - message(STATUS "adding module: ${module}") + #message(STATUS "adding module: ${module}") endforeach() add_subdirectory(src/firmware/${OS}) diff --git a/Makefile b/Makefile index 38fc7ddd98..1c036690ea 100644 --- a/Makefile +++ b/Makefile @@ -1,64 +1,94 @@ -d=$(PWD) - -all: nuttx_px4fmu-v2_default - -#---------------------------------------------------------------------------- -# OS: nuttx BOARD: px4fmu-v2 LABEL: simple +############################################################################ # -nuttx_px4fmu-v2_simple: - mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ - -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=simple && \ - make -s && ctest -V && cpack -G ZIP -nuttx_px4fmu-v2_simple_upload: nuttx_px4fmu-v2_simple - make -C build_$< upload -nuttx_px4fmu-v2_simple_test: nuttx_px4fmu-v2_simple - make -C build_$< test - - -#---------------------------------------------------------------------------- -# OS: nuttx BOARD: px4fmu-v2 LABEL: default +# Copyright (c) 2015 PX4 Development Team. All rights reserved. # -nuttx_px4fmu-v2_default: - mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-arm-none-eabi.cmake \ - -DOS=nuttx -DBOARD=px4fmu-v2 -DLABEL=default && \ - make -s && ctest -V && cpack -G ZIP -nuttx_px4fmu-v2_default_upload: nuttx_px4fmu-v2_default - make -C build_$< upload -nuttx_px4fmu-v2_default_test: nuttx_px4fmu-v2_default - make -C build_$< test - -#---------------------------------------------------------------------------- -# OS: nuttx BOARD: sim LABEL: simple +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: # +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# Help +# -------------------------------------------------------------------- +# Don't be afraid of this makefile, it is just passing +# arguments to cmake to allow us to keep the wiki pages etc. +# that describe how to build the px4 firmware +# the same even when using cmake instead of make. +# +# Example usage: +# +# make px4fmu-v2_default (builds) +# make px4fmu-v2_default upload (builds and uploads) +# make px4fmu-v2_default test (builds and tests) +# +# This tells cmake to build the nuttx px4fmu-v2 default config in the +# directory build_nuttx_px4fmu-v2_default and then call make +# in that directory with the target upload. + +# Parsing +# -------------------------------------------------------------------- +# assume 1st argument passed is the main target, the +# rest are arguments to pass to the makefile generated +# by cmake in the subdirectory +ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) + +# Functions +# -------------------------------------------------------------------- +# define a make function to describe how to build a cmake config +define cmake-build +mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && \ + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/$(1).cmake \ + -DOS=$(2) -DBOARD=$(3) -DLABEL=$(4) && \ + make -s $(ARGS) +endef + + +# ADD CONFIGS HERE +# -------------------------------------------------------------------- +px4fmu-v2_default: + $(call cmake-build,Toolchain-arm-none-eabi,nuttx,px4fmu-v2,default) + +px4fmu-v2_simple: + $(call cmake-build,Toolchain-arm-none-eabi,nuttx,px4fmu-v2,default) + nuttx_sim_simple: - mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-native.cmake \ - -DOS=nuttx -DBOARD=sim -DLABEL=simple && \ - make -s && ctest -V && cpack -G ZIP + $(call cmake-build,Toolchain-native,nuttx,sim,default) -#---------------------------------------------------------------------------- -# OS: posix BOARD: sitl LABEL: simple -# posix_sitl_simple: - mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-posix-clang-native.cmake \ - -DOS=posix -DBOARD=sitl -DLABEL=simple && \ - make -s && ctest -V && cpack -G ZIP + $(call cmake-build,Toolchain-posix-clang-native,posix,sitl,simple) -#---------------------------------------------------------------------------- -# OS: qurt BOARD: hil LABEL: simple -# qurt_eagle_travis: - mkdir -p $d/build_$@ && cd $d/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-hexagon.cmake \ - -DOS=qurt -DBOARD=eagle -DLABEL=travis && \ - make -s && ctest -V && cpack -G ZIP + $(call cmake-build,Toolchain-hexagon,qurt,eagle,travis) + + +# Other targets +# -------------------------------------------------------------------- +# explicity set default build target +all: px4fmu-v2_default -#---------------------------------------------------------------------------- -# misc targets -# clean: rm -rf build_*/ diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index c62ce0ecfa..617d158d8b 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -148,7 +148,7 @@ function(px4_nuttx_generate_builtin_commands) set(builtin_apps_decl_string) set(command_count 0) foreach(module ${MODULE_LIST}) - message("generating builtin for: ${module}") + #message("generating builtin for: ${module}") # default set(MAIN_DEFAULT MAIN-NOTFOUND) set(STACK_DEFAULT 1024) From a2615d793ebf999b8be70b2b2e780fb056d54aa8 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 21:20:49 -0400 Subject: [PATCH 064/389] Put warning on spacing in makefile. --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 1c036690ea..d950ecab98 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,8 @@ endef # ADD CONFIGS HERE # -------------------------------------------------------------------- +# Do not put any spaces between function arguments. + px4fmu-v2_default: $(call cmake-build,Toolchain-arm-none-eabi,nuttx,px4fmu-v2,default) From 270bc2ef5d5288831e6726ea825de817bd29dd7e Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 18:37:54 -0700 Subject: [PATCH 065/389] cmake: Fixed configs to use px4_get_config The previous function name was changed to px4_get_config Signed-off-by: Mark Charlebois --- Build/.keep | 0 cmake/configs/config_nuttx_sim_simple.cmake | 2 +- ..._posix_eagle_default.mk => config_posix_eagle_default.cmake} | 2 +- cmake/configs/config_posix_eagle_hil.cmake | 2 +- cmake/configs/config_posix_eagle_muorb.cmake | 2 +- cmake/configs/config_posix_eagle_release.cmake | 2 +- cmake/configs/config_qurt_eagle_hello.cmake | 2 +- cmake/configs/config_qurt_eagle_hil.cmake | 2 +- cmake/configs/config_qurt_eagle_muorb.cmake | 2 +- cmake/configs/config_qurt_eagle_release.cmake | 2 +- cmake/configs/config_qurt_eagle_test.cmake | 2 +- cmake/configs/config_qurt_eagle_travis.cmake | 2 +- 12 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 Build/.keep rename cmake/configs/{config_posix_eagle_default.mk => config_posix_eagle_default.cmake} (93%) diff --git a/Build/.keep b/Build/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cmake/configs/config_nuttx_sim_simple.cmake b/cmake/configs/config_nuttx_sim_simple.cmake index 0440bfed14..a44f8e9597 100644 --- a/cmake/configs/config_nuttx_sim_simple.cmake +++ b/cmake/configs/config_nuttx_sim_simple.cmake @@ -2,7 +2,7 @@ include(nuttx/px4_impl_nuttx) message(WARNING "this is a work in progress and doesn't build yet") -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list platforms/nuttx diff --git a/cmake/configs/config_posix_eagle_default.mk b/cmake/configs/config_posix_eagle_default.cmake similarity index 93% rename from cmake/configs/config_posix_eagle_default.mk rename to cmake/configs/config_posix_eagle_default.cmake index 589c44a05e..77b6716e88 100644 --- a/cmake/configs/config_posix_eagle_default.mk +++ b/cmake/configs/config_posix_eagle_default.cmake @@ -1,6 +1,6 @@ include(posix/px4_impl_posix-arm) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device diff --git a/cmake/configs/config_posix_eagle_hil.cmake b/cmake/configs/config_posix_eagle_hil.cmake index ebe148ab37..fb1c82ddbe 100644 --- a/cmake/configs/config_posix_eagle_hil.cmake +++ b/cmake/configs/config_posix_eagle_hil.cmake @@ -1,6 +1,6 @@ include(posix/px4_impl_posix-arm) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device diff --git a/cmake/configs/config_posix_eagle_muorb.cmake b/cmake/configs/config_posix_eagle_muorb.cmake index 70235928ec..b8e75586be 100644 --- a/cmake/configs/config_posix_eagle_muorb.cmake +++ b/cmake/configs/config_posix_eagle_muorb.cmake @@ -1,6 +1,6 @@ include(posix/px4_impl_posix-arm) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device diff --git a/cmake/configs/config_posix_eagle_release.cmake b/cmake/configs/config_posix_eagle_release.cmake index 745fa36826..9b7b315727 100644 --- a/cmake/configs/config_posix_eagle_release.cmake +++ b/cmake/configs/config_posix_eagle_release.cmake @@ -1,6 +1,6 @@ include(posix/px4_impl_posix-arm) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device diff --git a/cmake/configs/config_qurt_eagle_hello.cmake b/cmake/configs/config_qurt_eagle_hello.cmake index 6da3d11574..38028ff57e 100644 --- a/cmake/configs/config_qurt_eagle_hello.cmake +++ b/cmake/configs/config_qurt_eagle_hello.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device diff --git a/cmake/configs/config_qurt_eagle_hil.cmake b/cmake/configs/config_qurt_eagle_hil.cmake index 5e7e7fc16c..857ad6b570 100644 --- a/cmake/configs/config_qurt_eagle_hil.cmake +++ b/cmake/configs/config_qurt_eagle_hil.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device diff --git a/cmake/configs/config_qurt_eagle_muorb.cmake b/cmake/configs/config_qurt_eagle_muorb.cmake index 5cf884baf1..38618dc2bd 100644 --- a/cmake/configs/config_qurt_eagle_muorb.cmake +++ b/cmake/configs/config_qurt_eagle_muorb.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device diff --git a/cmake/configs/config_qurt_eagle_release.cmake b/cmake/configs/config_qurt_eagle_release.cmake index 3bf19fb16f..5cbd611cdf 100644 --- a/cmake/configs/config_qurt_eagle_release.cmake +++ b/cmake/configs/config_qurt_eagle_release.cmake @@ -19,7 +19,7 @@ set(target_libraries rc_receiver ) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list # diff --git a/cmake/configs/config_qurt_eagle_test.cmake b/cmake/configs/config_qurt_eagle_test.cmake index bbb837b363..1845568e8b 100644 --- a/cmake/configs/config_qurt_eagle_test.cmake +++ b/cmake/configs/config_qurt_eagle_test.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device diff --git a/cmake/configs/config_qurt_eagle_travis.cmake b/cmake/configs/config_qurt_eagle_travis.cmake index b8a21017b6..713c858a44 100644 --- a/cmake/configs/config_qurt_eagle_travis.cmake +++ b/cmake/configs/config_qurt_eagle_travis.cmake @@ -3,7 +3,7 @@ include(qurt/px4_impl_qurt) # Run a full link with build stubs to make sure qurt target isn't broken set(QURT_ENABLE_STUBS 1) -function(px4_set_config_modules out_module_list) +function(px4_get_config out_module_list) set(config_module_list drivers/device From 813a1219a542aaa136929078fd1bcf4e9666eb69 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 21:54:58 -0400 Subject: [PATCH 066/389] Work on travis, set package generators for cpack. --- .travis.yml | 17 ++++++++++++----- CMakeLists.txt | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9807da6499..0f72555415 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,14 +73,21 @@ script: - ccache -z - arm-none-eabi-gcc --version - echo 'Building POSIX Firmware..' && echo -en 'travis_fold:start:script.1\\r' - - make posix_sitl_simple + - make posix_sitl_simple -j4 + - ccache -s + - echo -en 'travis_fold:end:script.1\\r' - echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r' - - make -C build_posix_sitl_simple test + - make posix_sitl_simple test + - cat src/modules/systemlib/mixer/mixer_multirotor.generated.h + - echo -en 'travis_fold:end:script.2\\r' - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r' - - make nuttx_px4fmu-v2_simple + - make px4fmu-v2_default -j4 + - ccache -s + - echo -en 'travis_fold:end:script.3\\r' - echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r' - - make -C build_nuttx_px4fmu-v2_simple test - + - make px4fmu-v2_default test + - echo -en 'travis_fold:end:script.4\\r' + - make px4fmu-v2_default package #- make posix -j4 #- ccache -s #- echo -en 'travis_fold:end:script.1\\r' diff --git a/CMakeLists.txt b/CMakeLists.txt index dbb58a46de..ecd19b7bce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,6 +257,8 @@ px4_create_git_hash_header(HEADER ${CMAKE_BINARY_DIR}/build_git_version.h) # set(CPACK_PACKAGE_VERSION ${version}) set(CPACK_PACKAGE_CONTACT ${package_contact}) +set(CPACK_GENERATOR "ZIP") +set(CPACK_SOURCE_GENERATOR "ZIP") include(CPack) # vim: set noet fenc=utf-8 ff=unix ft=cmake : From 5aa3c45b63f459861ceebefc46e044e87c2a67c0 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 19:01:51 -0700 Subject: [PATCH 067/389] cmake: Unbreak all qurt and posix targets Signed-off-by: Mark Charlebois --- cmake/configs/config_nuttx_sim_simple.cmake | 7 ++++++- cmake/configs/config_posix_eagle_default.cmake | 7 ++++++- cmake/configs/config_posix_eagle_hil.cmake | 7 ++++++- cmake/configs/config_posix_eagle_muorb.cmake | 7 ++++++- cmake/configs/config_posix_eagle_release.cmake | 7 ++++++- cmake/configs/config_qurt_eagle_hello.cmake | 11 ++++++++++- cmake/configs/config_qurt_eagle_hil.cmake | 11 +++++++++-- cmake/configs/config_qurt_eagle_muorb.cmake | 10 ++++++++-- cmake/configs/config_qurt_eagle_release.cmake | 10 ++++++++-- cmake/configs/config_qurt_eagle_test.cmake | 10 ++++++++-- cmake/configs/config_qurt_eagle_travis.cmake | 10 ++++++++-- 11 files changed, 81 insertions(+), 16 deletions(-) diff --git a/cmake/configs/config_nuttx_sim_simple.cmake b/cmake/configs/config_nuttx_sim_simple.cmake index a44f8e9597..79446ae7bc 100644 --- a/cmake/configs/config_nuttx_sim_simple.cmake +++ b/cmake/configs/config_nuttx_sim_simple.cmake @@ -2,7 +2,12 @@ include(nuttx/px4_impl_nuttx) message(WARNING "this is a work in progress and doesn't build yet") -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ARGN ${ARGN}) set(config_module_list platforms/nuttx diff --git a/cmake/configs/config_posix_eagle_default.cmake b/cmake/configs/config_posix_eagle_default.cmake index 77b6716e88..04f80c7523 100644 --- a/cmake/configs/config_posix_eagle_default.cmake +++ b/cmake/configs/config_posix_eagle_default.cmake @@ -1,6 +1,11 @@ include(posix/px4_impl_posix-arm) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ARGN ${ARGN}) set(config_module_list drivers/device diff --git a/cmake/configs/config_posix_eagle_hil.cmake b/cmake/configs/config_posix_eagle_hil.cmake index fb1c82ddbe..115f70d406 100644 --- a/cmake/configs/config_posix_eagle_hil.cmake +++ b/cmake/configs/config_posix_eagle_hil.cmake @@ -1,6 +1,11 @@ include(posix/px4_impl_posix-arm) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ARGN ${ARGN}) set(config_module_list drivers/device diff --git a/cmake/configs/config_posix_eagle_muorb.cmake b/cmake/configs/config_posix_eagle_muorb.cmake index b8e75586be..44fe4cebe0 100644 --- a/cmake/configs/config_posix_eagle_muorb.cmake +++ b/cmake/configs/config_posix_eagle_muorb.cmake @@ -1,6 +1,11 @@ include(posix/px4_impl_posix-arm) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ARGN ${ARGN}) set(config_module_list drivers/device diff --git a/cmake/configs/config_posix_eagle_release.cmake b/cmake/configs/config_posix_eagle_release.cmake index 9b7b315727..90c81fd411 100644 --- a/cmake/configs/config_posix_eagle_release.cmake +++ b/cmake/configs/config_posix_eagle_release.cmake @@ -1,6 +1,11 @@ include(posix/px4_impl_posix-arm) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ARGN ${ARGN}) set(config_module_list drivers/device diff --git a/cmake/configs/config_qurt_eagle_hello.cmake b/cmake/configs/config_qurt_eagle_hello.cmake index 38028ff57e..4969d2af34 100644 --- a/cmake/configs/config_qurt_eagle_hello.cmake +++ b/cmake/configs/config_qurt_eagle_hello.cmake @@ -1,6 +1,12 @@ include(qurt/px4_impl_qurt) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES + REQUIRED OUT_MODULES + ARGN ${ARGN}) set(config_module_list drivers/device @@ -26,5 +32,8 @@ function(px4_get_config out_module_list) ) set(${out_module_list} ${config_module_list} PARENT_SCOPE) + # output + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) + endfunction() diff --git a/cmake/configs/config_qurt_eagle_hil.cmake b/cmake/configs/config_qurt_eagle_hil.cmake index 857ad6b570..f5bc10f324 100644 --- a/cmake/configs/config_qurt_eagle_hil.cmake +++ b/cmake/configs/config_qurt_eagle_hil.cmake @@ -1,6 +1,12 @@ include(qurt/px4_impl_qurt) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES + REQUIRED OUT_MODULES + ARGN ${ARGN}) set(config_module_list drivers/device @@ -60,7 +66,8 @@ function(px4_get_config out_module_list) # modules/muorb/adsp ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_qurt_eagle_muorb.cmake b/cmake/configs/config_qurt_eagle_muorb.cmake index 38618dc2bd..1ef1711c30 100644 --- a/cmake/configs/config_qurt_eagle_muorb.cmake +++ b/cmake/configs/config_qurt_eagle_muorb.cmake @@ -1,6 +1,12 @@ include(qurt/px4_impl_qurt) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES + REQUIRED + ARGN ${ARGN}) set(config_module_list drivers/device @@ -38,7 +44,7 @@ function(px4_get_config out_module_list) # modules/muorb/adsp ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_qurt_eagle_release.cmake b/cmake/configs/config_qurt_eagle_release.cmake index 5cbd611cdf..87b1592757 100644 --- a/cmake/configs/config_qurt_eagle_release.cmake +++ b/cmake/configs/config_qurt_eagle_release.cmake @@ -19,7 +19,13 @@ set(target_libraries rc_receiver ) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES + REQUIRED OUT_MODULES + ARGN ${ARGN}) set(config_module_list # @@ -81,6 +87,6 @@ function(px4_get_config out_module_list) # modules/muorb/adsp ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_qurt_eagle_test.cmake b/cmake/configs/config_qurt_eagle_test.cmake index 1845568e8b..a607a0be2b 100644 --- a/cmake/configs/config_qurt_eagle_test.cmake +++ b/cmake/configs/config_qurt_eagle_test.cmake @@ -1,6 +1,12 @@ include(qurt/px4_impl_qurt) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES + REQUIRED OUT_MODULES + ARGN ${ARGN}) set(config_module_list drivers/device @@ -35,7 +41,7 @@ function(px4_get_config out_module_list) platforms/qurt/tests/hrt_test platforms/qurt/tests/wqueue ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_qurt_eagle_travis.cmake b/cmake/configs/config_qurt_eagle_travis.cmake index 713c858a44..d55c7597e5 100644 --- a/cmake/configs/config_qurt_eagle_travis.cmake +++ b/cmake/configs/config_qurt_eagle_travis.cmake @@ -3,7 +3,13 @@ include(qurt/px4_impl_qurt) # Run a full link with build stubs to make sure qurt target isn't broken set(QURT_ENABLE_STUBS 1) -function(px4_get_config out_module_list) +function(px4_get_config) + + px4_parse_function_args( + NAME px4_set_config_modules + ONE_VALUE OUT_MODULES + REQUIRED OUT_MODULES + ARGN ${ARGN}) set(config_module_list drivers/device @@ -63,7 +69,7 @@ function(px4_get_config out_module_list) # modules/muorb/adsp ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() From cbb8ad19e511e21757c843da5c9c28807ad58837 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 19:15:11 -0700 Subject: [PATCH 068/389] cmake: Proof of concept for build without Makefile Signed-off-by: Mark Charlebois --- CMakeLists.txt | 52 ++++++++++++++++++++++- cmake/configs/config_qurt_eagle_hil.cmake | 2 + 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbb58a46de..fba35c4d7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,13 +109,63 @@ set(verion_patch 2) set(version "${version_major}.${version_minor}.${version_patch}") set(package-contact "px4users@googlegroups.com") +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + +#============================================================================= +# cmake modules +# +if (NOT NESTED_CMAKE_CALL) + message(STATUS "IN TOP") + if (EXISTS ${CMAKE_SOURCE_DIR}/cmake/configs/config_${CONFIG}.cmake) + + # Get the toolchain information + include(configs/config_${CONFIG}) + else() + message(FATAL_ERROR "build config not found: config_${CONFIG}.cmake") + endif() + if (NOT "${USE_TOOLCHAIN}" STREQUAL "") + set(TOOLCHAIN -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchains/${USE_TOOLCHAIN}.cmake) + endif() + string(REPLACE "_" ";" TARGET_PARAMS ${CONFIG}) + list(GET TARGET_PARAMS 0 OS) + list(GET TARGET_PARAMS 1 BOARD) + list(GET TARGET_PARAMS 2 LABEL) + message(STATUS "CONFIG ${OS} ${BOARD} ${LABEL}") + if ("${LABEL}" STREQUAL "upload") + set(LABEL "simple") + set(DOUPLOAD "1") + endif() + if ("${LABEL}" STREQUAL "test") + set(LABEL "simple") + set(DOTEST "1") + endif() + execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${CONFIG} ) + set(NESTED_CMAKE_CALL 1) + message(STATUS "Before") + execute_process(WORKING_DIRECTORY ${CONFIG} + COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -DNESTED_CMAKE_CALL=TRUE ${TOOLCHAIN} -DOS=${OS} -DBOARD=${BOARD} -DLABEL=${LABEL} + ) + execute_process( WORKING_DIRECTORY ${CONFIG} + COMMAND make -s + ) + message(STATUS "${CMAKE_COMMAND} VERBOSE=1 ${CMAKE_SOURCE_DIR} ${TOOLCHAIN} -DOS=${OS} -DBOARD=${BOARD} -DLABEL=${LABEL}") + if ("${DOUPLOAD}" STREQUAL "1") + execute_process( WORKING_DIRECTORY ${CONFIG} + COMMAND make upload) + endif() + if ("${DOTEST}" STREQUAL "1") + execute_process( WORKING_DIRECTORY ${CONFIG} + COMMAND make test) + endif() + return() +endif(NOT NESTED_CMAKE_CALL) + #============================================================================= # cmake modules # # set module path message("OS = ${OS}") -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # prefer board implementation module over os implmementation module set(config_module "configs/config_${OS}_${BOARD}_${LABEL}") diff --git a/cmake/configs/config_qurt_eagle_hil.cmake b/cmake/configs/config_qurt_eagle_hil.cmake index f5bc10f324..378915c373 100644 --- a/cmake/configs/config_qurt_eagle_hil.cmake +++ b/cmake/configs/config_qurt_eagle_hil.cmake @@ -1,5 +1,7 @@ include(qurt/px4_impl_qurt) +set(USE_TOOLCHAIN Toolchain-hexagon) + function(px4_get_config) px4_parse_function_args( From 4beabff26bfbdfe6253cf5ea44fea8788c310cf7 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 19:38:22 -0700 Subject: [PATCH 069/389] cmake: fixed posix configs Signed-off-by: Mark Charlebois --- cmake/configs/config_posix_eagle_default.cmake | 5 +++-- cmake/configs/config_posix_eagle_hil.cmake | 5 +++-- cmake/configs/config_posix_eagle_muorb.cmake | 5 +++-- cmake/configs/config_posix_eagle_release.cmake | 4 ++-- cmake/configs/config_posix_sitl_simple.cmake | 1 + 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmake/configs/config_posix_eagle_default.cmake b/cmake/configs/config_posix_eagle_default.cmake index 04f80c7523..ddbf058bc7 100644 --- a/cmake/configs/config_posix_eagle_default.cmake +++ b/cmake/configs/config_posix_eagle_default.cmake @@ -4,7 +4,8 @@ function(px4_get_config) px4_parse_function_args( NAME px4_set_config_modules - ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ONE_VALUE OUT_MODULES + REQUIRED OUT_MODULES ARGN ${ARGN}) set(config_module_list @@ -47,7 +48,7 @@ function(px4_get_config) platforms/posix/work_queue ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_posix_eagle_hil.cmake b/cmake/configs/config_posix_eagle_hil.cmake index 115f70d406..be779e143f 100644 --- a/cmake/configs/config_posix_eagle_hil.cmake +++ b/cmake/configs/config_posix_eagle_hil.cmake @@ -4,7 +4,8 @@ function(px4_get_config) px4_parse_function_args( NAME px4_set_config_modules - ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ONE_VALUE OUT_MODULES + REQUIRED OUT_MODULES ARGN ${ARGN}) set(config_module_list @@ -36,7 +37,7 @@ function(px4_get_config) modules/muorb/krait ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_posix_eagle_muorb.cmake b/cmake/configs/config_posix_eagle_muorb.cmake index 44fe4cebe0..c08e43861d 100644 --- a/cmake/configs/config_posix_eagle_muorb.cmake +++ b/cmake/configs/config_posix_eagle_muorb.cmake @@ -4,7 +4,8 @@ function(px4_get_config) px4_parse_function_args( NAME px4_set_config_modules - ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ONE_VALUE OUT_MODULES + REQUIRED OUT_MODULES ARGN ${ARGN}) set(config_module_list @@ -18,7 +19,7 @@ function(px4_get_config) modules/muorb/krait ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_posix_eagle_release.cmake b/cmake/configs/config_posix_eagle_release.cmake index 90c81fd411..90d2e40b86 100644 --- a/cmake/configs/config_posix_eagle_release.cmake +++ b/cmake/configs/config_posix_eagle_release.cmake @@ -4,7 +4,7 @@ function(px4_get_config) px4_parse_function_args( NAME px4_set_config_modules - ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS + ONE_VALUE OUT_MODULES ARGN ${ARGN}) set(config_module_list @@ -31,7 +31,7 @@ function(px4_get_config) modules/muorb/krait ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) + set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) endfunction() diff --git a/cmake/configs/config_posix_sitl_simple.cmake b/cmake/configs/config_posix_sitl_simple.cmake index 20481bdb1e..39aed67046 100644 --- a/cmake/configs/config_posix_sitl_simple.cmake +++ b/cmake/configs/config_posix_sitl_simple.cmake @@ -1,4 +1,5 @@ include(posix/px4_impl_posix) +set(USE_TOOLCHAIN Toolchain-native) function(px4_get_config) From 3b118a0ea7f4734ec6fbd9d6550cb0f10c975fa4 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 19:43:54 -0700 Subject: [PATCH 070/389] cmake: Removed obsolete UPLOAD and TEST logic Signed-off-by: Mark Charlebois --- CMakeLists.txt | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fba35c4d7a..93370c61f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,15 +130,6 @@ if (NOT NESTED_CMAKE_CALL) list(GET TARGET_PARAMS 0 OS) list(GET TARGET_PARAMS 1 BOARD) list(GET TARGET_PARAMS 2 LABEL) - message(STATUS "CONFIG ${OS} ${BOARD} ${LABEL}") - if ("${LABEL}" STREQUAL "upload") - set(LABEL "simple") - set(DOUPLOAD "1") - endif() - if ("${LABEL}" STREQUAL "test") - set(LABEL "simple") - set(DOTEST "1") - endif() execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${CONFIG} ) set(NESTED_CMAKE_CALL 1) message(STATUS "Before") @@ -149,14 +140,6 @@ if (NOT NESTED_CMAKE_CALL) COMMAND make -s ) message(STATUS "${CMAKE_COMMAND} VERBOSE=1 ${CMAKE_SOURCE_DIR} ${TOOLCHAIN} -DOS=${OS} -DBOARD=${BOARD} -DLABEL=${LABEL}") - if ("${DOUPLOAD}" STREQUAL "1") - execute_process( WORKING_DIRECTORY ${CONFIG} - COMMAND make upload) - endif() - if ("${DOTEST}" STREQUAL "1") - execute_process( WORKING_DIRECTORY ${CONFIG} - COMMAND make test) - endif() return() endif(NOT NESTED_CMAKE_CALL) From 0047b38c5491dbf4d397b8de9991d322ba3f55ec Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 19:52:23 -0700 Subject: [PATCH 071/389] cmake: added Toolchain-arm-linux-gnueabihf Signed-off-by: Mark Charlebois --- .../configs/config_posix_eagle_default.cmake | 2 + cmake/configs/config_posix_eagle_hil.cmake | 2 + cmake/configs/config_posix_eagle_muorb.cmake | 2 + .../configs/config_posix_eagle_release.cmake | 2 + .../Toolchain-arm-linux-gnueabihf.cmake | 67 +++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake diff --git a/cmake/configs/config_posix_eagle_default.cmake b/cmake/configs/config_posix_eagle_default.cmake index ddbf058bc7..228b4e50ae 100644 --- a/cmake/configs/config_posix_eagle_default.cmake +++ b/cmake/configs/config_posix_eagle_default.cmake @@ -1,5 +1,7 @@ include(posix/px4_impl_posix-arm) +set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) + function(px4_get_config) px4_parse_function_args( diff --git a/cmake/configs/config_posix_eagle_hil.cmake b/cmake/configs/config_posix_eagle_hil.cmake index be779e143f..af3785f5c7 100644 --- a/cmake/configs/config_posix_eagle_hil.cmake +++ b/cmake/configs/config_posix_eagle_hil.cmake @@ -1,5 +1,7 @@ include(posix/px4_impl_posix-arm) +set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) + function(px4_get_config) px4_parse_function_args( diff --git a/cmake/configs/config_posix_eagle_muorb.cmake b/cmake/configs/config_posix_eagle_muorb.cmake index c08e43861d..450d7b1e4e 100644 --- a/cmake/configs/config_posix_eagle_muorb.cmake +++ b/cmake/configs/config_posix_eagle_muorb.cmake @@ -1,5 +1,7 @@ include(posix/px4_impl_posix-arm) +set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) + function(px4_get_config) px4_parse_function_args( diff --git a/cmake/configs/config_posix_eagle_release.cmake b/cmake/configs/config_posix_eagle_release.cmake index 90d2e40b86..cc220cb306 100644 --- a/cmake/configs/config_posix_eagle_release.cmake +++ b/cmake/configs/config_posix_eagle_release.cmake @@ -1,5 +1,7 @@ include(posix/px4_impl_posix-arm) +set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) + function(px4_get_config) px4_parse_function_args( diff --git a/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake b/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake new file mode 100644 index 0000000000..2db5cf82b9 --- /dev/null +++ b/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake @@ -0,0 +1,67 @@ +# defines: +# +# NM +# OBJCOPY +# LD +# CXX_COMPILER +# C_COMPILER +# CMAKE_SYSTEM_NAME +# CMAKE_SYSTEM_VERSION +# GENROMFS +# LINKER_FLAGS +# CMAKE_EXE_LINKER_FLAGS +# CMAKE_FIND_ROOT_PATH +# CMAKE_FIND_ROOT_PATH_MODE_PROGRAM +# CMAKE_FIND_ROOT_PATH_MODE_LIBRARY +# CMAKE_FIND_ROOT_PATH_MODE_INCLUDE + +include(CMakeForceCompiler) + +# this one is important +set(CMAKE_SYSTEM_NAME Generic) + +#this one not so much +set(CMAKE_SYSTEM_VERSION 1) + +# specify the cross compiler +find_program(C_COMPILER arm-linux-gnueabihf-gcc) +if(NOT C_COMPILER) + message(FATAL_ERROR "could not find arm-none-eabi-gcc compiler") +endif() +cmake_force_c_compiler(${C_COMPILER} GNU) + +find_program(CXX_COMPILER arm-linux-gnueabihf-g++) +if(NOT CXX_COMPILER) + message(FATAL_ERROR "could not find arm-none-eabi-g++ compiler") +endif() +cmake_force_cxx_compiler(${CXX_COMPILER} GNU) + +# compiler tools +foreach(tool objcopy nm ld) + string(TOUPPER ${tool} TOOL) + find_program(${TOOL} arm-linux-gnueabihf-${tool}) + if(NOT ${TOOL}) + message(FATAL_ERROR "could not find ${tool}") + endif() +endforeach() + +# os tools +foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip) + string(TOUPPER ${tool} TOOL) + find_program(${TOOL} ${tool}) + if(NOT ${TOOL}) + message(FATAL_ERROR "could not find ${TOOL}") + endif() +endforeach() + +set(LINKER_FLAGS "-Wl,-gc-sections") +set(CMAKE_EXE_LINKER_FLAGS ${LINKER_FLAGS}) + +# where is the target environment +set(CMAKE_FIND_ROOT_PATH get_file_component(${C_COMPILER} PATH)) + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) From 98897960e13a63bad674c36e4247f99aefbf8ffc Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 20:02:31 -0700 Subject: [PATCH 072/389] cmake: removed config_ prefix Signed-off-by: Mark Charlebois --- CMakeLists.txt | 8 ++++---- ...fmu-v2_default.cmake => nuttx_px4fmu-v2_default.cmake} | 0 ...x4fmu-v2_simple.cmake => nuttx_px4fmu-v2_simple.cmake} | 0 ...nfig_nuttx_sim_simple.cmake => nuttx_sim_simple.cmake} | 0 ...osix_eagle_default.cmake => posix_eagle_default.cmake} | 0 ...config_posix_eagle_hil.cmake => posix_eagle_hil.cmake} | 0 ...ig_posix_eagle_muorb.cmake => posix_eagle_muorb.cmake} | 0 ...osix_eagle_release.cmake => posix_eagle_release.cmake} | 0 ...ig_posix_sitl_simple.cmake => posix_sitl_simple.cmake} | 0 ...nfig_qurt_eagle_hello.cmake => qurt_eagle_hello.cmake} | 0 .../{config_qurt_eagle_hil.cmake => qurt_eagle_hil.cmake} | 0 ...nfig_qurt_eagle_muorb.cmake => qurt_eagle_muorb.cmake} | 0 12 files changed, 4 insertions(+), 4 deletions(-) rename cmake/configs/{config_nuttx_px4fmu-v2_default.cmake => nuttx_px4fmu-v2_default.cmake} (100%) rename cmake/configs/{config_nuttx_px4fmu-v2_simple.cmake => nuttx_px4fmu-v2_simple.cmake} (100%) rename cmake/configs/{config_nuttx_sim_simple.cmake => nuttx_sim_simple.cmake} (100%) rename cmake/configs/{config_posix_eagle_default.cmake => posix_eagle_default.cmake} (100%) rename cmake/configs/{config_posix_eagle_hil.cmake => posix_eagle_hil.cmake} (100%) rename cmake/configs/{config_posix_eagle_muorb.cmake => posix_eagle_muorb.cmake} (100%) rename cmake/configs/{config_posix_eagle_release.cmake => posix_eagle_release.cmake} (100%) rename cmake/configs/{config_posix_sitl_simple.cmake => posix_sitl_simple.cmake} (100%) rename cmake/configs/{config_qurt_eagle_hello.cmake => qurt_eagle_hello.cmake} (100%) rename cmake/configs/{config_qurt_eagle_hil.cmake => qurt_eagle_hil.cmake} (100%) rename cmake/configs/{config_qurt_eagle_muorb.cmake => qurt_eagle_muorb.cmake} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 93370c61f6..b80e97b1c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,16 +112,16 @@ set(package-contact "px4users@googlegroups.com") list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) #============================================================================= -# cmake modules +# Validate build configuration and build # if (NOT NESTED_CMAKE_CALL) message(STATUS "IN TOP") - if (EXISTS ${CMAKE_SOURCE_DIR}/cmake/configs/config_${CONFIG}.cmake) + if (EXISTS ${CMAKE_SOURCE_DIR}/cmake/configs/${CONFIG}.cmake) # Get the toolchain information - include(configs/config_${CONFIG}) + include(configs/${CONFIG}) else() - message(FATAL_ERROR "build config not found: config_${CONFIG}.cmake") + message(FATAL_ERROR "build config not found: ${CONFIG}.cmake") endif() if (NOT "${USE_TOOLCHAIN}" STREQUAL "") set(TOOLCHAIN -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchains/${USE_TOOLCHAIN}.cmake) diff --git a/cmake/configs/config_nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake similarity index 100% rename from cmake/configs/config_nuttx_px4fmu-v2_default.cmake rename to cmake/configs/nuttx_px4fmu-v2_default.cmake diff --git a/cmake/configs/config_nuttx_px4fmu-v2_simple.cmake b/cmake/configs/nuttx_px4fmu-v2_simple.cmake similarity index 100% rename from cmake/configs/config_nuttx_px4fmu-v2_simple.cmake rename to cmake/configs/nuttx_px4fmu-v2_simple.cmake diff --git a/cmake/configs/config_nuttx_sim_simple.cmake b/cmake/configs/nuttx_sim_simple.cmake similarity index 100% rename from cmake/configs/config_nuttx_sim_simple.cmake rename to cmake/configs/nuttx_sim_simple.cmake diff --git a/cmake/configs/config_posix_eagle_default.cmake b/cmake/configs/posix_eagle_default.cmake similarity index 100% rename from cmake/configs/config_posix_eagle_default.cmake rename to cmake/configs/posix_eagle_default.cmake diff --git a/cmake/configs/config_posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake similarity index 100% rename from cmake/configs/config_posix_eagle_hil.cmake rename to cmake/configs/posix_eagle_hil.cmake diff --git a/cmake/configs/config_posix_eagle_muorb.cmake b/cmake/configs/posix_eagle_muorb.cmake similarity index 100% rename from cmake/configs/config_posix_eagle_muorb.cmake rename to cmake/configs/posix_eagle_muorb.cmake diff --git a/cmake/configs/config_posix_eagle_release.cmake b/cmake/configs/posix_eagle_release.cmake similarity index 100% rename from cmake/configs/config_posix_eagle_release.cmake rename to cmake/configs/posix_eagle_release.cmake diff --git a/cmake/configs/config_posix_sitl_simple.cmake b/cmake/configs/posix_sitl_simple.cmake similarity index 100% rename from cmake/configs/config_posix_sitl_simple.cmake rename to cmake/configs/posix_sitl_simple.cmake diff --git a/cmake/configs/config_qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake similarity index 100% rename from cmake/configs/config_qurt_eagle_hello.cmake rename to cmake/configs/qurt_eagle_hello.cmake diff --git a/cmake/configs/config_qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake similarity index 100% rename from cmake/configs/config_qurt_eagle_hil.cmake rename to cmake/configs/qurt_eagle_hil.cmake diff --git a/cmake/configs/config_qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake similarity index 100% rename from cmake/configs/config_qurt_eagle_muorb.cmake rename to cmake/configs/qurt_eagle_muorb.cmake From ad4e31c88ac5eb23011afc3d4133e099343f46fe Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 20:07:38 -0700 Subject: [PATCH 073/389] cmake: Missed anm insuance of config_ Signed-off-by: Mark Charlebois --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b80e97b1c5..90fa38b76f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,7 +151,7 @@ endif(NOT NESTED_CMAKE_CALL) message("OS = ${OS}") # prefer board implementation module over os implmementation module -set(config_module "configs/config_${OS}_${BOARD}_${LABEL}") +set(config_module "configs/${OS}_${BOARD}_${LABEL}") set(config_path "${CMAKE_SOURCE_DIR}/cmake/${config_module}.cmake") if (EXISTS ${config_path}) include(${config_module}) From 3de04cf6f414c92a818e7a128f13766bdd17dedb Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 20:17:38 -0700 Subject: [PATCH 074/389] cmake: fixes for posix configs The posix eagle targets were fixed to include the px4_impl_posix.cmake file Signed-off-by: Mark Charlebois --- cmake/configs/posix_eagle_default.cmake | 2 +- cmake/configs/posix_eagle_hil.cmake | 2 +- cmake/configs/posix_eagle_release.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/configs/posix_eagle_default.cmake b/cmake/configs/posix_eagle_default.cmake index 228b4e50ae..17fcc337ff 100644 --- a/cmake/configs/posix_eagle_default.cmake +++ b/cmake/configs/posix_eagle_default.cmake @@ -1,4 +1,4 @@ -include(posix/px4_impl_posix-arm) +include(posix/px4_impl_posix) set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) diff --git a/cmake/configs/posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake index af3785f5c7..aa87bd6bb6 100644 --- a/cmake/configs/posix_eagle_hil.cmake +++ b/cmake/configs/posix_eagle_hil.cmake @@ -1,4 +1,4 @@ -include(posix/px4_impl_posix-arm) +include(posix/px4_impl_posix) set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) diff --git a/cmake/configs/posix_eagle_release.cmake b/cmake/configs/posix_eagle_release.cmake index cc220cb306..fad14f595f 100644 --- a/cmake/configs/posix_eagle_release.cmake +++ b/cmake/configs/posix_eagle_release.cmake @@ -1,4 +1,4 @@ -include(posix/px4_impl_posix-arm) +include(posix/px4_impl_posix) set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) From 07851b79c2045c2d293e5e3a3e5a7d0ef7e1218c Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 23:43:59 -0400 Subject: [PATCH 075/389] Work on config only for cmake arguments. --- CMakeLists.txt | 138 ++++---- Makefile | 17 +- cmake/configs/nuttx_px4fmu-v2_default.cmake | 333 +++++++++----------- cmake/nuttx/px4_impl_nuttx.cmake | 1 - src/firmware/nuttx/CMakeLists.txt | 9 +- 5 files changed, 220 insertions(+), 278 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ebc8c0a2d..b426b2d151 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,8 +95,51 @@ # #============================================================================= - cmake_minimum_required(VERSION 2.8 FATAL_ERROR) + +#============================================================================= +# parameters +# + +set(CONFIG "nuttx_px4fmu-v2_default" CACHE STRING "desired configuration") +file(GLOB_RECURSE configs RELATIVE cmake/configs "cmake/configs/*.cmake") +set_property(CACHE CONFIG PROPERTY STRINGS ${configs}) +set(THREADS "4" CACHE STRING + "number of threads to use for external build processes") + +#============================================================================= +# configuration +# +# must come before project to set toolchain + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +set(config_module "configs/${CONFIG}") +include(${config_module}) + +# require px4 module interface +set(px4_required_interface + px4_os_prebuild_targets + px4_os_add_flags + ) +foreach(cmd ${px4_required_interface}) + if(NOT COMMAND ${cmd}) + message(FATAL_ERROR "${config_module} must implement ${cmd}") + endif() +endforeach() +set(px4_required_config + config_firmware_options + config_extra_builtin_cmds + config_module_list + ) +foreach(conf ${px4_required_config}) + if(NOT DEFINED ${conf}) + message(FATAL_ERROR "${config_module} must define ${conf}") + endif() +endforeach() + +#============================================================================= +# project definition +# project(px4 CXX C ASM) if (NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) cmake_policy(SET CMP0045 NEW) # error on non-existent target in get prop @@ -109,69 +152,16 @@ set(verion_patch 2) set(version "${version_major}.${version_minor}.${version_patch}") set(package-contact "px4users@googlegroups.com") -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +string(REPLACE "_" ";" config_args ${CONFIG}) +list(GET config_args 0 OS) +list(GET config_args 1 BOARD) +list(GET config_args 2 LABEL) -#============================================================================= -# Validate build configuration and build -# -if (NOT NESTED_CMAKE_CALL) - message(STATUS "IN TOP") - if (EXISTS ${CMAKE_SOURCE_DIR}/cmake/configs/${CONFIG}.cmake) - - # Get the toolchain information - include(configs/${CONFIG}) - else() - message(FATAL_ERROR "build config not found: ${CONFIG}.cmake") - endif() - if (NOT "${USE_TOOLCHAIN}" STREQUAL "") - set(TOOLCHAIN -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchains/${USE_TOOLCHAIN}.cmake) - endif() - string(REPLACE "_" ";" TARGET_PARAMS ${CONFIG}) - list(GET TARGET_PARAMS 0 OS) - list(GET TARGET_PARAMS 1 BOARD) - list(GET TARGET_PARAMS 2 LABEL) - execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${CONFIG} ) - set(NESTED_CMAKE_CALL 1) - message(STATUS "Before") - execute_process(WORKING_DIRECTORY ${CONFIG} - COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -DNESTED_CMAKE_CALL=TRUE ${TOOLCHAIN} -DOS=${OS} -DBOARD=${BOARD} -DLABEL=${LABEL} - ) - execute_process( WORKING_DIRECTORY ${CONFIG} - COMMAND make -s - ) - message(STATUS "${CMAKE_COMMAND} VERBOSE=1 ${CMAKE_SOURCE_DIR} ${TOOLCHAIN} -DOS=${OS} -DBOARD=${BOARD} -DLABEL=${LABEL}") - return() -endif(NOT NESTED_CMAKE_CALL) +message(STATUS "TARGET: OS(${OS})-BOARD(${BOARD})-LABEL(${LABEL})") #============================================================================= # cmake modules # - -# set module path -message("OS = ${OS}") - -# prefer board implementation module over os implmementation module -set(config_module "configs/config_${OS}_${BOARD}_${LABEL}") -set(config_path "${CMAKE_SOURCE_DIR}/cmake/${config_module}.cmake") -if (EXISTS ${config_path}) - include(${config_module}) -else() - message(FATAL_ERROR "build config not found: ${config_path}") -endif() - -# require px4 module interface -set(px4_required_functions - px4_os_prebuild_targets - px4_os_add_flags - px4_get_config - ) -foreach(cmd ${px4_required_functions}) - if(NOT COMMAND ${cmd}) - message(FATAL_ERROR "cmake/${impl_module} must implement ${cmd}") - endif() -endforeach() - -# other modules enable_testing() #============================================================================= @@ -179,32 +169,15 @@ enable_testing() # find_package(PythonInterp REQUIRED) -#============================================================================= -# parameters -# - -set(OS "posix" CACHE STRING "desired operating system") -set_property(CACHE OS PROPERTY STRINGS nuttx posix qurt) - -set(BOARD "sitl" CACHE STRING "target board") -set_property(CACHE BOARD PROPERTY STRINGS px4fmu-v2 sitl) - -set(LABEL "simple" CACHE STRING "module set label") -set_property(CACHE LABEL PROPERTY STRINGS simple default) - -set(THREADS "4" CACHE STRING - "number of threads to use for external build processes") - -set(required_toolchain_variables - CMAKE_C_COMPILER_ID - ) - #============================================================================= # check required toolchain variables # -foreach(var ${required_toolchain_variables}) +set(required_variables + CMAKE_C_COMPILER_ID + ) +foreach(var ${required_variables}) if (NOT ${var}) - message(FATAL_ERROR "Toolchain must define ${var}") + message(FATAL_ERROR "Toolchain/config must define ${var}") endif() endforeach() @@ -267,9 +240,8 @@ px4_generate_messages(TARGET msg_gen #============================================================================= # subdirectories # -px4_get_config(OUT_MODULES config_modules) set(module_libraries) -foreach(module ${config_modules}) +foreach(module ${config_module_list}) add_subdirectory(src/${module}) px4_mangle_name(${module} mangled_name) list(APPEND module_libraries ${mangled_name}) diff --git a/Makefile b/Makefile index d950ecab98..99c273f2d6 100644 --- a/Makefile +++ b/Makefile @@ -59,10 +59,8 @@ ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) # -------------------------------------------------------------------- # define a make function to describe how to build a cmake config define cmake-build -mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && \ - cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/$(1).cmake \ - -DOS=$(2) -DBOARD=$(3) -DLABEL=$(4) && \ - make -s $(ARGS) +mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -DCONFIG=$(1) +make -C $(PWD)/build_$@ -s $(ARGS) endef @@ -71,20 +69,19 @@ endef # Do not put any spaces between function arguments. px4fmu-v2_default: - $(call cmake-build,Toolchain-arm-none-eabi,nuttx,px4fmu-v2,default) + $(call cmake-build,nuttx_px4fmu-v2_default) px4fmu-v2_simple: - $(call cmake-build,Toolchain-arm-none-eabi,nuttx,px4fmu-v2,default) + $(call cmake-build,nuttx_px4fmu-v2_simple) nuttx_sim_simple: - $(call cmake-build,Toolchain-native,nuttx,sim,default) + $(call cmake-build,$@) posix_sitl_simple: - $(call cmake-build,Toolchain-posix-clang-native,posix,sitl,simple) + $(call cmake-build,$@) qurt_eagle_travis: - $(call cmake-build,Toolchain-hexagon,qurt,eagle,travis) - + $(call cmake-build,$@) # Other targets # -------------------------------------------------------------------- diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 826281cb9d..4ba1792a41 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -1,203 +1,178 @@ include(nuttx/px4_impl_nuttx) -function(px4_get_config) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS - ARGN ${ARGN}) +set(config_module_list + # + # Board support modules + # + drivers/device + drivers/stm32 + drivers/stm32/adc + drivers/stm32/tone_alarm + drivers/led + drivers/px4fmu + drivers/px4io + drivers/boards/px4fmu-v2 + drivers/rgbled + drivers/mpu6000 + drivers/mpu9250 + drivers/lsm303d + drivers/l3gd20 + drivers/hmc5883 + drivers/ms5611 + drivers/mb12xx + drivers/sf0x + drivers/ll40ls + drivers/trone + drivers/gps + drivers/pwm_out_sim + drivers/hott + drivers/hott/hott_telemetry + drivers/hott/hott_sensors + drivers/blinkm + drivers/airspeed + drivers/ets_airspeed + drivers/meas_airspeed + drivers/frsky_telemetry + modules/sensors + drivers/mkblctrl + drivers/px4flow + drivers/oreoled + drivers/gimbal + drivers/pwm_input + drivers/camera_trigger - set(config_module_list - # - # Board support modules - # - drivers/device - drivers/stm32 - drivers/stm32/adc - drivers/stm32/tone_alarm - drivers/led - drivers/px4fmu - drivers/px4io - drivers/boards/px4fmu-v2 - drivers/rgbled - drivers/mpu6000 - drivers/mpu9250 - drivers/lsm303d - drivers/l3gd20 - drivers/hmc5883 - drivers/ms5611 - drivers/mb12xx - drivers/sf0x - drivers/ll40ls - drivers/trone - drivers/gps - drivers/pwm_out_sim - drivers/hott - drivers/hott/hott_telemetry - drivers/hott/hott_sensors - drivers/blinkm - drivers/airspeed - drivers/ets_airspeed - drivers/meas_airspeed - drivers/frsky_telemetry - modules/sensors - drivers/mkblctrl - drivers/px4flow - drivers/oreoled - drivers/gimbal - drivers/pwm_input - drivers/camera_trigger + # + # System commands + # + systemcmds/bl_update + systemcmds/mixer + systemcmds/param + systemcmds/perf + systemcmds/pwm + systemcmds/esc_calib + systemcmds/reboot + systemcmds/top + systemcmds/config + systemcmds/nshterm + systemcmds/mtd + systemcmds/dumpfile + systemcmds/ver - # - # System commands - # - systemcmds/bl_update - systemcmds/mixer - systemcmds/param - systemcmds/perf - systemcmds/pwm - systemcmds/esc_calib - systemcmds/reboot - systemcmds/top - systemcmds/config - systemcmds/nshterm - systemcmds/mtd - systemcmds/dumpfile - systemcmds/ver + # + # General system control + # + modules/commander + modules/navigator + modules/mavlink + modules/gpio_led + #modules/uavcan # have to fix CMakeLists.txt + modules/land_detector - # - # General system control - # - modules/commander - modules/navigator - modules/mavlink - modules/gpio_led - #modules/uavcan # have to fix CMakeLists.txt - modules/land_detector + # + # Estimation modules (EKF/ SO3 / other filters) + # + # Too high RAM usage due to static allocations + # modules/attitude_estimator_ekf + modules/attitude_estimator_q + modules/ekf_att_pos_estimator + modules/position_estimator_inav - # - # Estimation modules (EKF/ SO3 / other filters) - # - # Too high RAM usage due to static allocations - # modules/attitude_estimator_ekf - modules/attitude_estimator_q - modules/ekf_att_pos_estimator - modules/position_estimator_inav + # + # Vehicle Control + # + # modules/segway # XXX Needs GCC 4.7 fix + modules/fw_pos_control_l1 + modules/fw_att_control + modules/mc_att_control + modules/mc_pos_control + modules/vtol_att_control - # - # Vehicle Control - # - # modules/segway # XXX Needs GCC 4.7 fix - modules/fw_pos_control_l1 - modules/fw_att_control - modules/mc_att_control - modules/mc_pos_control - modules/vtol_att_control + # + # Logging + # + modules/sdlog2 - # - # Logging - # - modules/sdlog2 + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/controllib + modules/uORB + modules/dataman - # - # Library modules - # - modules/systemlib - modules/systemlib/mixer - modules/controllib - modules/uORB - modules/dataman + # + # Libraries + # + #lib/mathlib/CMSIS + lib/mathlib + lib/mathlib/math/filter + lib/ecl + lib/external_lgpl + lib/geo + lib/geo_lookup + lib/conversion + lib/launchdetection + platforms/nuttx - # - # Libraries - # - #lib/mathlib/CMSIS - lib/mathlib - lib/mathlib/math/filter - lib/ecl - lib/external_lgpl - lib/geo - lib/geo_lookup - lib/conversion - lib/launchdetection - platforms/nuttx + # had to add for cmake, not sure why wasn't in original config + platforms/common + platforms/nuttx/px4_layer - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer + # + # OBC challenge + # + modules/bottle_drop - # - # OBC challenge - # - modules/bottle_drop + # + # PX4 flow estimator, good for indoors + # + examples/flow_position_estimator - # - # PX4 flow estimator, good for indoors - # - examples/flow_position_estimator + # + # Rover apps + # + examples/rover_steering_control - # - # Rover apps - # - examples/rover_steering_control + # + # Demo apps + # + #examples/math_demo + # Tutorial code from + # https://px4.io/dev/px4_simple_app + #examples/px4_simple_app - # - # Demo apps - # - #examples/math_demo - # Tutorial code from - # https://px4.io/dev/px4_simple_app - #examples/px4_simple_app + # Tutorial code from + # https://px4.io/dev/daemon + #examples/px4_daemon_app - # Tutorial code from - # https://px4.io/dev/daemon - #examples/px4_daemon_app + # Tutorial code from + # https://px4.io/dev/debug_values + #examples/px4_mavlink_debug - # Tutorial code from - # https://px4.io/dev/debug_values - #examples/px4_mavlink_debug + # Tutorial code from + # https://px4.io/dev/example_fixedwing_control + #examples/fixedwing_control - # Tutorial code from - # https://px4.io/dev/example_fixedwing_control - #examples/fixedwing_control + # Hardware test + #examples/hwtest +) - # Hardware test - #examples/hwtest +set(config_firmware_options + PARAM_XML # generate param xml ) - set(firmware_options - PARAM_XML # generate param xml - ) +set(config_extra_builtin_cmds + serdis_main + sercon_main + ) - set(extra_cmds serdis_main sercon_main) +add_custom_target(sercon) +set_target_properties(sercon PROPERTIES + MAIN "sercon" STACK "2048") - # output - if(OUT_MODULES) - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - endif() - - if (OUT_FW_OPTS) - set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE) - endif() - -endfunction() - -function(px4_add_extra_builtin_cmds) - - px4_parse_function_args( - NAME px4_add_extra_builtin_cmds - ONE_VALUE OUT - REQUIRED OUT - ARGN ${ARGN}) - - add_custom_target(sercon) - set_target_properties(sercon PROPERTIES - MAIN "sercon" STACK "2048") - - add_custom_target(serdis) - set_target_properties(serdis PROPERTIES - MAIN "serdis" STACK "2048") - - set(${OUT} sercon serdis PARENT_SCOPE) - -endfunction() +add_custom_target(serdis) +set_target_properties(serdis PROPERTIES + MAIN "serdis" STACK "2048") diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 617d158d8b..13e05eb7a2 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -143,7 +143,6 @@ function(px4_nuttx_generate_builtin_commands) MULTI_VALUE MODULE_LIST REQUIRED MODULE_LIST OUT ARGN ${ARGN}) - message(STATUS "argn: ${ARGN}") set(builtin_apps_string) set(builtin_apps_decl_string) set(command_count 0) diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index cc164b8d91..006524213f 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -1,8 +1,8 @@ -px4_add_extra_builtin_cmds(OUT extra_builtins) - px4_nuttx_generate_builtin_commands( OUT builtin_commands.c - MODULE_LIST ${module_libraries} ${extra_builtins} + MODULE_LIST + ${module_libraries} + ${config_extra_builtins_cmds} ) px4_nuttx_generate_romfs(OUT romfs.o @@ -27,10 +27,9 @@ target_link_libraries(firmware_nuttx apps nuttx nosys m gcc -Wl,--end-group) -px4_get_config(OUT_FW_OPTS fw_opts) px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx - ${fw_opts} + ${config_firmware_options} ) px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} From ec209f13f03149d16e37ad09c7d574853da1cd02 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 10 Sep 2015 23:53:25 -0400 Subject: [PATCH 076/389] Simplified config handling. --- CMakeLists.txt | 6 +- cmake/configs/nuttx_px4fmu-v2_simple.cmake | 257 ++++++++---------- cmake/configs/nuttx_sim_simple.cmake | 46 ++-- cmake/configs/posix_sitl_simple.cmake | 155 +++++------ ...release.cmake => qurt_eagle_release.cmake} | 0 ...eagle_test.cmake => qurt_eagle_test.cmake} | 0 ...e_travis.cmake => qurt_eagle_travis.cmake} | 0 7 files changed, 211 insertions(+), 253 deletions(-) rename cmake/configs/{config_qurt_eagle_release.cmake => qurt_eagle_release.cmake} (100%) rename cmake/configs/{config_qurt_eagle_test.cmake => qurt_eagle_test.cmake} (100%) rename cmake/configs/{config_qurt_eagle_travis.cmake => qurt_eagle_travis.cmake} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b426b2d151..95259b7de6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,8 +73,8 @@ # --------------------------------------------------------------------------- # # * Never set global variables in an included cmake file, -# you may only define functions. This excludes Toolchain files. This -# makes it clear to the user when variables are being set or targets +# you may only define functions. This excludes config and Toolchain files. +# This makes it clear to the user when variables are being set or targets # are being created. # # * Setting a global variable in a CMakeLists.txt file is ok, because @@ -133,7 +133,7 @@ set(px4_required_config ) foreach(conf ${px4_required_config}) if(NOT DEFINED ${conf}) - message(FATAL_ERROR "${config_module} must define ${conf}") + message(FATAL_ERROR "cmake/${config_module} must define ${conf}") endif() endforeach() diff --git a/cmake/configs/nuttx_px4fmu-v2_simple.cmake b/cmake/configs/nuttx_px4fmu-v2_simple.cmake index 864275ad32..d3ee36d1e0 100644 --- a/cmake/configs/nuttx_px4fmu-v2_simple.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_simple.cmake @@ -1,160 +1,135 @@ include(nuttx/px4_impl_nuttx) -function(px4_get_config) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS - ARGN ${ARGN}) +set(config_module_list - set(config_module_list + # + # Board support modules + # + drivers/device + drivers/stm32 + drivers/stm32/adc + drivers/stm32/tone_alarm + drivers/led + drivers/px4fmu + drivers/px4io + drivers/boards/px4fmu-v2 + drivers/rgbled + drivers/mpu6000 + drivers/mpu9250 + drivers/lsm303d + drivers/l3gd20 + drivers/hmc5883 + drivers/ms5611 + drivers/mb12xx + drivers/sf0x + drivers/ll40ls + drivers/trone + drivers/gps + drivers/pwm_out_sim + drivers/hott + drivers/hott/hott_telemetry + drivers/hott/hott_sensors + drivers/blinkm + drivers/airspeed + drivers/ets_airspeed + drivers/meas_airspeed + drivers/frsky_telemetry + modules/sensors + drivers/mkblctrl + drivers/px4flow + drivers/oreoled + drivers/gimbal + drivers/pwm_input + drivers/camera_trigger - # - # Board support modules - # - drivers/device - drivers/stm32 - drivers/stm32/adc - drivers/stm32/tone_alarm - drivers/led - drivers/px4fmu - drivers/px4io - drivers/boards/px4fmu-v2 - drivers/rgbled - drivers/mpu6000 - drivers/mpu9250 - drivers/lsm303d - drivers/l3gd20 - drivers/hmc5883 - drivers/ms5611 - drivers/mb12xx - drivers/sf0x - drivers/ll40ls - drivers/trone - drivers/gps - drivers/pwm_out_sim - drivers/hott - drivers/hott/hott_telemetry - drivers/hott/hott_sensors - drivers/blinkm - drivers/airspeed - drivers/ets_airspeed - drivers/meas_airspeed - drivers/frsky_telemetry - modules/sensors - drivers/mkblctrl - drivers/px4flow - drivers/oreoled - drivers/gimbal - drivers/pwm_input - drivers/camera_trigger + # + # System commands + # + systemcmds/bl_update + systemcmds/mixer + systemcmds/param + systemcmds/perf + systemcmds/pwm + systemcmds/esc_calib + systemcmds/reboot + systemcmds/top + systemcmds/config + systemcmds/nshterm + systemcmds/mtd + systemcmds/dumpfile + systemcmds/ver - # - # System commands - # - systemcmds/bl_update - systemcmds/mixer - systemcmds/param - systemcmds/perf - systemcmds/pwm - systemcmds/esc_calib - systemcmds/reboot - systemcmds/top - systemcmds/config - systemcmds/nshterm - systemcmds/mtd - systemcmds/dumpfile - systemcmds/ver + # + # Logging + # + modules/sdlog2 - # - # Logging - # - modules/sdlog2 + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/controllib + modules/uORB + modules/dataman - # - # Library modules - # - modules/systemlib - modules/systemlib/mixer - modules/controllib - modules/uORB - modules/dataman + # + # Libraries + # + #lib/mathlib/CMSIS + lib/mathlib + lib/mathlib/math/filter + lib/ecl + lib/external_lgpl + lib/geo + lib/geo_lookup + lib/conversion + lib/launchdetection + platforms/nuttx - # - # Libraries - # - #lib/mathlib/CMSIS - lib/mathlib - lib/mathlib/math/filter - lib/ecl - lib/external_lgpl - lib/geo - lib/geo_lookup - lib/conversion - lib/launchdetection - platforms/nuttx + # had to add for cmake, not sure why wasn't in original config + platforms/common + platforms/nuttx/px4_layer - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer + # + # Demo apps + # + #examples/math_demo + # Tutorial code from + # https://px4.io/dev/px4_simple_app + examples/px4_simple_app - # - # Demo apps - # - #examples/math_demo - # Tutorial code from - # https://px4.io/dev/px4_simple_app - examples/px4_simple_app + # Tutorial code from + # https://px4.io/dev/daemon + examples/px4_daemon_app - # Tutorial code from - # https://px4.io/dev/daemon - examples/px4_daemon_app + # Tutorial code from + # https://px4.io/dev/debug_values + examples/px4_mavlink_debug - # Tutorial code from - # https://px4.io/dev/debug_values - examples/px4_mavlink_debug + # Tutorial code from + # https://px4.io/dev/example_fixedwing_control + examples/fixedwing_control - # Tutorial code from - # https://px4.io/dev/example_fixedwing_control - examples/fixedwing_control + # Hardware test + examples/hwtest +) - # Hardware test - examples/hwtest +set(config_firmware_options + PARAM_XML # generate param xml ) - set(firmware_options - PARAM_XML # generate param xml - ) +set(config_extra_builtin_cmds + serdis_main + sercon_main + ) - set(extra_cmds serdis_main sercon_main) +add_custom_target(sercon) +set_target_properties(sercon PROPERTIES + MAIN "sercon" STACK "2048") - # output - if(OUT_MODULES) - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - endif() - - if (OUT_FW_OPTS) - set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE) - endif() - -endfunction() - -function(px4_add_extra_builtin_cmds) - - px4_parse_function_args( - NAME px4_add_extra_builtin_cmds - ONE_VALUE OUT - REQUIRED OUT - ARGN ${ARGN}) - - add_custom_target(sercon) - set_target_properties(sercon PROPERTIES - MAIN "sercon" STACK "2048") - - add_custom_target(serdis) - set_target_properties(serdis PROPERTIES - MAIN "serdis" STACK "2048") - - set(${OUT} sercon serdis PARENT_SCOPE) - -endfunction() +add_custom_target(serdis) +set_target_properties(serdis PROPERTIES + MAIN "serdis" STACK "2048") diff --git a/cmake/configs/nuttx_sim_simple.cmake b/cmake/configs/nuttx_sim_simple.cmake index 79446ae7bc..0721df5a52 100644 --- a/cmake/configs/nuttx_sim_simple.cmake +++ b/cmake/configs/nuttx_sim_simple.cmake @@ -2,27 +2,35 @@ include(nuttx/px4_impl_nuttx) message(WARNING "this is a work in progress and doesn't build yet") -function(px4_get_config) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS - ARGN ${ARGN}) +set(config_module_list + platforms/nuttx + platforms/nuttx/px4_layer + platforms/common + drivers/led + drivers/device + modules/systemlib + modules/uORB + examples/px4_simple_app + lib/mathlib/math/filter + lib/conversion + ) - set(config_module_list - platforms/nuttx - platforms/nuttx/px4_layer - platforms/common - drivers/led - drivers/device - modules/systemlib - modules/uORB - examples/px4_simple_app - lib/mathlib/math/filter - lib/conversion - ) +set(config_firmware_options + PARAM_XML # generate param xml + ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) +set(config_extra_builtin_cmds + serdis_main + sercon_main + ) -endfunction() +add_custom_target(sercon) +set_target_properties(sercon PROPERTIES + MAIN "sercon" STACK "2048") + +add_custom_target(serdis) +set_target_properties(serdis PROPERTIES + MAIN "serdis" STACK "2048") diff --git a/cmake/configs/posix_sitl_simple.cmake b/cmake/configs/posix_sitl_simple.cmake index 39aed67046..a00e79743e 100644 --- a/cmake/configs/posix_sitl_simple.cmake +++ b/cmake/configs/posix_sitl_simple.cmake @@ -1,98 +1,73 @@ include(posix/px4_impl_posix) -set(USE_TOOLCHAIN Toolchain-native) -function(px4_get_config) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS - ARGN ${ARGN}) +set(config_module_list + drivers/led + drivers/device + drivers/boards/sitl + platforms/common + platforms/posix/px4_layer + platforms/posix/work_queue + platforms/posix/drivers/adcsim + platforms/posix/drivers/gpssim + platforms/posix/drivers/tonealrmsim + platforms/posix/drivers/accelsim + platforms/posix/drivers/airspeedsim + platforms/posix/drivers/barosim + platforms/posix/drivers/gyrosim + systemcmds/param + systemcmds/mixer + systemcmds/ver + systemcmds/esc_calib + systemcmds/reboot + systemcmds/topic_listener + modules/uORB + modules/systemlib + modules/systemlib/mixer + modules/sensors + modules/simulator + modules/mavlink + modules/attitude_estimator_ekf + modules/attitude_estimator_q + modules/ekf_att_pos_estimator + modules/position_estimator_inav + modules/navigator + modules/mc_pos_control + modules/mc_att_control + modules/mc_pos_control_multiplatform + modules/mc_att_control_multiplatform + modules/land_detector + modules/fw_att_control + modules/fw_pos_control_l1 + modules/dataman + modules/sdlog2 + modules/commander + modules/controllib + lib/mathlib + lib/mathlib/math/filter + lib/conversion + lib/ecl + lib/external_lgpl + lib/geo + lib/geo_lookup + lib/launchdetection + ) - set(config_module_list - drivers/led - drivers/device - drivers/boards/sitl - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue - platforms/posix/drivers/adcsim - platforms/posix/drivers/gpssim - platforms/posix/drivers/tonealrmsim - platforms/posix/drivers/accelsim - platforms/posix/drivers/airspeedsim - platforms/posix/drivers/barosim - platforms/posix/drivers/gyrosim - systemcmds/param - systemcmds/mixer - systemcmds/ver - systemcmds/esc_calib - systemcmds/reboot - systemcmds/topic_listener - modules/uORB - modules/systemlib - modules/systemlib/mixer - modules/sensors - modules/simulator - modules/mavlink - modules/attitude_estimator_ekf - modules/attitude_estimator_q - modules/ekf_att_pos_estimator - modules/position_estimator_inav - modules/navigator - modules/mc_pos_control - modules/mc_att_control - modules/mc_pos_control_multiplatform - modules/mc_att_control_multiplatform - modules/land_detector - modules/fw_att_control - modules/fw_pos_control_l1 - modules/dataman - modules/sdlog2 - modules/commander - modules/controllib - lib/mathlib - lib/mathlib/math/filter - lib/conversion - lib/ecl - lib/external_lgpl - lib/geo - lib/geo_lookup - lib/launchdetection - ) - set(firmware_options - PARAM_XML # generate param xml - ) +set(config_firmware_options + PARAM_XML # generate param xml + ) - set(extra_cmds serdis_main sercon_main) +set(config_extra_builtin_cmds + serdis_main + sercon_main + ) - # output - if(OUT_MODULES) - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - endif() +add_custom_target(sercon) +set_target_properties(sercon PROPERTIES + MAIN "sercon" STACK "2048") - if (OUT_FW_OPTS) - set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE) - endif() - -endfunction() - -function(px4_add_extra_builtin_cmds) - - px4_parse_function_args( - NAME px4_add_extra_builtin_cmds - ONE_VALUE OUT - REQUIRED OUT - ARGN ${ARGN}) - - add_custom_target(sercon) - set_target_properties(sercon PROPERTIES - MAIN "sercon" STACK "2048") - - add_custom_target(serdis) - set_target_properties(serdis PROPERTIES - MAIN "serdis" STACK "2048") - - set(${OUT} sercon serdis PARENT_SCOPE) - -endfunction() +add_custom_target(serdis) +set_target_properties(serdis PROPERTIES + MAIN "serdis" STACK "2048") diff --git a/cmake/configs/config_qurt_eagle_release.cmake b/cmake/configs/qurt_eagle_release.cmake similarity index 100% rename from cmake/configs/config_qurt_eagle_release.cmake rename to cmake/configs/qurt_eagle_release.cmake diff --git a/cmake/configs/config_qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake similarity index 100% rename from cmake/configs/config_qurt_eagle_test.cmake rename to cmake/configs/qurt_eagle_test.cmake diff --git a/cmake/configs/config_qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake similarity index 100% rename from cmake/configs/config_qurt_eagle_travis.cmake rename to cmake/configs/qurt_eagle_travis.cmake From 0e8cc821a973edd9ca75894a09c4e791d45ba7a4 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 11 Sep 2015 00:15:33 -0400 Subject: [PATCH 077/389] More config cleanup. --- CMakeLists.txt | 12 ++++++------ Makefile | 6 +++++- cmake/nuttx/px4_impl_nuttx.cmake | 8 +++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95259b7de6..e95dde841b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,7 +132,7 @@ set(px4_required_config config_module_list ) foreach(conf ${px4_required_config}) - if(NOT DEFINED ${conf}) + if(NOT DEFINED conf) message(FATAL_ERROR "cmake/${config_module} must define ${conf}") endif() endforeach() @@ -159,16 +159,16 @@ list(GET config_args 2 LABEL) message(STATUS "TARGET: OS(${OS})-BOARD(${BOARD})-LABEL(${LABEL})") -#============================================================================= -# cmake modules -# -enable_testing() - #============================================================================= # programs # find_package(PythonInterp REQUIRED) +#============================================================================= +# cmake modules +# +enable_testing() + #============================================================================= # check required toolchain variables # diff --git a/Makefile b/Makefile index 99c273f2d6..b2f38a7d47 100644 --- a/Makefile +++ b/Makefile @@ -91,4 +91,8 @@ all: px4fmu-v2_default clean: rm -rf build_*/ -.PHONY: clean +# targets handled by cmake +test: ; +upload: ; + +.PHONY: clean test upload diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 13e05eb7a2..8de25ab868 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -86,10 +86,10 @@ function(px4_nuttx_add_firmware) #TODO handle param_xml if(PARAM_XML) add_custom_command(OUTPUT ${OUT} - COMMAND ${process_params} + COMMAND ${PYTHON_EXECUTABLE} ${process_params} --src-path ${CMAKE_SOURCE_DIR}/src --board CONFIG_ARCH_BOARD_${BOARD} --xml - COMMAND ${process_airframes} + COMMAND ${PYTHON_EXECUTABLE} ${process_airframes} -a ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common/init.d --board CONFIG_ARCH_BOARD_${BOARD} --xml COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin @@ -97,10 +97,9 @@ function(px4_nuttx_add_firmware) --prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype --git_identity ${CMAKE_SOURCE_DIR} --parameter_xml parameters.xml - --airframe_xml airframe.xml + --airframe_xml airframes.xml --image ${EXE}.bin > ${OUT} DEPENDS ${EXE} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) else() add_custom_command(OUTPUT ${OUT} @@ -110,7 +109,6 @@ function(px4_nuttx_add_firmware) --git_identity ${CMAKE_SOURCE_DIR} --image ${EXE}.bin > ${OUT} DEPENDS ${EXE} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) endif() endfunction() From 8bc81d985f21dad33edf647c8706c1a269d2b1b2 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 11 Sep 2015 00:24:30 -0400 Subject: [PATCH 078/389] Fixed typo in version, exposed some more useful cmake targets. --- CMakeLists.txt | 2 +- Makefile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e95dde841b..63b863bd57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,7 +148,7 @@ endif() set(version_major 0) set(version_minor 1) -set(verion_patch 2) +set(version_patch 2) set(version "${version_major}.${version_minor}.${version_patch}") set(package-contact "px4users@googlegroups.com") diff --git a/Makefile b/Makefile index b2f38a7d47..c4d3e06b89 100644 --- a/Makefile +++ b/Makefile @@ -94,5 +94,7 @@ clean: # targets handled by cmake test: ; upload: ; +package: ; +package_source: ; .PHONY: clean test upload From f94e3b3aaafc2bab0def2806ff345ea31872c9cb Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 11 Sep 2015 00:28:13 -0400 Subject: [PATCH 079/389] Fixed config check. --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63b863bd57..eefbe41b16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,12 +127,10 @@ foreach(cmd ${px4_required_interface}) endif() endforeach() set(px4_required_config - config_firmware_options - config_extra_builtin_cmds config_module_list ) foreach(conf ${px4_required_config}) - if(NOT DEFINED conf) + if(NOT DEFINED ${conf}) message(FATAL_ERROR "cmake/${config_module} must define ${conf}") endif() endforeach() From 9ab9e1f142265b41dfb7c4a7506a5c4889571b5a Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 11 Sep 2015 00:31:36 -0400 Subject: [PATCH 080/389] Set version to correct number. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eefbe41b16..a01d50509c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,9 +144,9 @@ if (NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) cmake_policy(SET CMP0046 NEW) # no non-existent targets as dependencies endif() -set(version_major 0) -set(version_minor 1) -set(version_patch 2) +set(version_major 1) +set(version_minor 0) +set(version_patch 1) set(version "${version_major}.${version_minor}.${version_patch}") set(package-contact "px4users@googlegroups.com") From 4bce702ed1b9b03b21b706b782c24fa56d246e49 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 11 Sep 2015 00:45:23 -0400 Subject: [PATCH 081/389] Added rt library to link for posix to fix travis build. --- src/firmware/posix/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index 2f8d8c95c3..4dbd94a3df 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -18,7 +18,7 @@ set_target_properties(mainapp PROPERTIES LINK_FLAGS ${main_link_flags}) target_link_libraries(mainapp -Wl,--start-group ${module_libraries} - pthread m + pthread m rt -Wl,--end-group ) From 31c3f4e40f01e9e7b316beef4f44f0cd9316713b Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 11 Sep 2015 00:49:11 -0400 Subject: [PATCH 082/389] Fix for travis mixer cat. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0f72555415..498dcf28b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,7 +78,7 @@ script: - echo -en 'travis_fold:end:script.1\\r' - echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r' - make posix_sitl_simple test - - cat src/modules/systemlib/mixer/mixer_multirotor.generated.h + - cat build_posix_sitl_simple/src/modules/systemlib/mixer/mixer_multirotor.generated.h - echo -en 'travis_fold:end:script.2\\r' - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r' - make px4fmu-v2_default -j4 From 885dbe045f90cff4dc8d6156fd4e17e47c73df77 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 10 Sep 2015 21:52:55 -0700 Subject: [PATCH 083/389] cmake: converted config files to new style Signed-off-by: Mark Charlebois --- cmake/configs/posix_eagle_default.cmake | 78 +++++++--------- cmake/configs/posix_eagle_hil.cmake | 60 +++++------- cmake/configs/posix_eagle_muorb.cmake | 30 ++---- cmake/configs/posix_eagle_release.cmake | 47 ++++------ cmake/configs/qurt_eagle_hello.cmake | 46 ++++------ cmake/configs/qurt_eagle_hil.cmake | 117 +++++++++++------------- cmake/configs/qurt_eagle_muorb.cmake | 74 +++++++-------- cmake/configs/qurt_eagle_release.cmake | 116 +++++++++++------------ cmake/configs/qurt_eagle_test.cmake | 69 ++++++-------- cmake/configs/qurt_eagle_travis.cmake | 113 +++++++++++------------ 10 files changed, 324 insertions(+), 426 deletions(-) diff --git a/cmake/configs/posix_eagle_default.cmake b/cmake/configs/posix_eagle_default.cmake index 17fcc337ff..8bee815a8b 100644 --- a/cmake/configs/posix_eagle_default.cmake +++ b/cmake/configs/posix_eagle_default.cmake @@ -1,56 +1,44 @@ include(posix/px4_impl_posix) -set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) -function(px4_get_config) +set(config_module_list + drivers/device + drivers/blinkm + drivers/pwm_out_sim + drivers/rgbled + drivers/led + modules/sensors - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED OUT_MODULES - ARGN ${ARGN}) + systemcmds/param + systemcmds/mixer + systemcmds/ver - set(config_module_list - drivers/device - drivers/blinkm - drivers/pwm_out_sim - drivers/rgbled - drivers/led - modules/sensors + modules/mavlink - systemcmds/param - systemcmds/mixer - systemcmds/ver + modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator - modules/mavlink + modules/mc_pos_control + modules/mc_att_control - modules/attitude_estimator_ekf - modules/ekf_att_pos_estimator + modules/systemlib + modules/systemlib/mixer + modules/uORB + modules/sensors + modules/dataman + modules/sdlog2 + modules/simulator + modules/commander + modules/controllib - modules/mc_pos_control - modules/mc_att_control + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion - modules/systemlib - modules/systemlib/mixer - modules/uORB - modules/sensors - modules/dataman - modules/sdlog2 - modules/simulator - modules/commander - modules/controllib - - lib/mathlib - lib/mathlib/math/filter - lib/geo - lib/geo_lookup - lib/conversion - - platforms/posix/px4_layer - platforms/posix/work_queue - ) - - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + platforms/posix/px4_layer + platforms/posix/work_queue + ) diff --git a/cmake/configs/posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake index aa87bd6bb6..fc771f3d89 100644 --- a/cmake/configs/posix_eagle_hil.cmake +++ b/cmake/configs/posix_eagle_hil.cmake @@ -1,45 +1,33 @@ include(posix/px4_impl_posix) -set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) -function(px4_get_config) +set(config_module_list + drivers/device + drivers/boards/sitl + drivers/led - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED OUT_MODULES - ARGN ${ARGN}) + systemcmds/param + systemcmds/ver - set(config_module_list - drivers/device - drivers/boards/sitl - drivers/led + modules/mavlink - systemcmds/param - systemcmds/ver + modules/systemlib + modules/uORB + modules/sensors + modules/dataman + modules/sdlog2 + modules/simulator + modules/commander - modules/mavlink + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion - modules/systemlib - modules/uORB - modules/sensors - modules/dataman - modules/sdlog2 - modules/simulator - modules/commander - - lib/mathlib - lib/mathlib/math/filter - lib/geo - lib/geo_lookup - lib/conversion - - platforms/posix/px4_layer - platforms/posix/work_queue - modules/muorb/krait - ) - - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + platforms/posix/px4_layer + platforms/posix/work_queue + modules/muorb/krait + ) diff --git a/cmake/configs/posix_eagle_muorb.cmake b/cmake/configs/posix_eagle_muorb.cmake index 450d7b1e4e..813fbbfecb 100644 --- a/cmake/configs/posix_eagle_muorb.cmake +++ b/cmake/configs/posix_eagle_muorb.cmake @@ -1,27 +1,15 @@ -include(posix/px4_impl_posix-arm) +include(posix/px4_impl_posix) -set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) -function(px4_get_config) +set(config_module_list + drivers/device - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED OUT_MODULES - ARGN ${ARGN}) + modules/uORB - set(config_module_list - drivers/device + platforms/posix/px4_layer + platforms/posix/work_queue - modules/uORB - - platforms/posix/px4_layer - platforms/posix/work_queue - - modules/muorb/krait - ) - - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + modules/muorb/krait + ) diff --git a/cmake/configs/posix_eagle_release.cmake b/cmake/configs/posix_eagle_release.cmake index fad14f595f..cb3019ae2b 100644 --- a/cmake/configs/posix_eagle_release.cmake +++ b/cmake/configs/posix_eagle_release.cmake @@ -1,39 +1,28 @@ include(posix/px4_impl_posix) -set(USE_TOOLCHAIN Toolchain-arm-linux-gnueabihf) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) -function(px4_get_config) +set(config_module_list + drivers/device - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - ARGN ${ARGN}) + systemcmds/param + systemcmds/ver - set(config_module_list - drivers/device + modules/mavlink - systemcmds/param - systemcmds/ver + modules/systemlib + modules/uORB + modules/dataman - modules/mavlink + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion - modules/systemlib - modules/uORB - modules/dataman + platforms/posix/px4_layer + platforms/posix/work_queue - lib/mathlib - lib/mathlib/math/filter - lib/geo - lib/geo_lookup - lib/conversion - - platforms/posix/px4_layer - platforms/posix/work_queue - - modules/muorb/krait - ) - - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + modules/muorb/krait + ) diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index 4969d2af34..43db471f69 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -1,35 +1,29 @@ include(qurt/px4_impl_qurt) -function(px4_get_config) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED OUT_MODULES - ARGN ${ARGN}) +set(config_module_list + drivers/device - set(config_module_list - drivers/device + # + # System commands + # + systemcmds/param - # - # System commands - # - systemcmds/param + # + # Library modules + # + modules/systemlib + modules/uORB - # - # Library modules - # - modules/systemlib - modules/uORB - - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - platforms/qurt/tests/hello - ) + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + platforms/qurt/tests/hello + ) set(${out_module_list} ${config_module_list} PARENT_SCOPE) # output diff --git a/cmake/configs/qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake index 378915c373..e661ca5b62 100644 --- a/cmake/configs/qurt_eagle_hil.cmake +++ b/cmake/configs/qurt_eagle_hil.cmake @@ -1,75 +1,62 @@ include(qurt/px4_impl_qurt) -set(USE_TOOLCHAIN Toolchain-hexagon) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) -function(px4_get_config) +set(config_module_list + drivers/device + drivers/boards/sitl + drivers/pwm_out_sim + drivers/led + drivers/rgbled + modules/sensors - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED OUT_MODULES - ARGN ${ARGN}) + # + # System commands + # + systemcmds/param + systemcmds/mixer - set(config_module_list - drivers/device - drivers/boards/sitl - drivers/pwm_out_sim - drivers/led - drivers/rgbled - modules/sensors + # + # Estimation modules (EKF/ SO3 / other filters) + # + #modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator + modules/attitude_estimator_q + modules/position_estimator_inav - # - # System commands - # - systemcmds/param - systemcmds/mixer + # + # Vehicle Control + # + modules/mc_att_control + modules/mc_pos_control - # - # Estimation modules (EKF/ SO3 / other filters) - # - #modules/attitude_estimator_ekf - modules/ekf_att_pos_estimator - modules/attitude_estimator_q - modules/position_estimator_inav + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/uORB + modules/commander - # - # Vehicle Control - # - modules/mc_att_control - modules/mc_pos_control + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + modules/controllib - # - # Library modules - # - modules/systemlib - modules/systemlib/mixer - modules/uORB - modules/commander - - # - # Libraries - # - lib/mathlib - lib/mathlib/math/filter - lib/geo - lib/geo_lookup - lib/conversion - modules/controllib - - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - - # - # sources for muorb over fastrpc - # - modules/muorb/adsp - ) - - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + # + # sources for muorb over fastrpc + # + modules/muorb/adsp + ) diff --git a/cmake/configs/qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake index 1ef1711c30..5c83f9e68d 100644 --- a/cmake/configs/qurt_eagle_muorb.cmake +++ b/cmake/configs/qurt_eagle_muorb.cmake @@ -1,50 +1,40 @@ include(qurt/px4_impl_qurt) -function(px4_get_config) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED - ARGN ${ARGN}) +set(config_module_list + drivers/device - set(config_module_list - drivers/device + # + # System commands + # + systemcmds/param - # - # System commands - # - systemcmds/param + # + # Library modules + # + modules/systemlib + modules/uORB - # - # Library modules - # - modules/systemlib - modules/uORB + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion - # - # Libraries - # - lib/mathlib - lib/mathlib/math/filter - lib/geo - lib/geo_lookup - lib/conversion - - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - platforms/qurt/tests/muorb - - # - # sources for muorb over fastrpc - # - modules/muorb/adsp - ) - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + platforms/qurt/tests/muorb + # + # sources for muorb over fastrpc + # + modules/muorb/adsp + ) diff --git a/cmake/configs/qurt_eagle_release.cmake b/cmake/configs/qurt_eagle_release.cmake index 87b1592757..1807e0b56c 100644 --- a/cmake/configs/qurt_eagle_release.cmake +++ b/cmake/configs/qurt_eagle_release.cmake @@ -19,74 +19,66 @@ set(target_libraries rc_receiver ) -function(px4_get_config) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED OUT_MODULES - ARGN ${ARGN}) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) - set(config_module_list - # - # Board support modules - # - drivers/device - modules/sensors - $(EAGLE_DRIVERS_SRC)/mpu9x50 - $(EAGLE_DRIVERS_SRC)/uart_esc - $(EAGLE_DRIVERS_SRC)/rc_receiver - $(EAGLE_DRIVERS_SRC)/csr_gps +set(config_module_list + # + # Board support modules + # + drivers/device + modules/sensors + $(EAGLE_DRIVERS_SRC)/mpu9x50 + $(EAGLE_DRIVERS_SRC)/uart_esc + $(EAGLE_DRIVERS_SRC)/rc_receiver + $(EAGLE_DRIVERS_SRC)/csr_gps - # - # System commands - # - systemcmds/param + # + # System commands + # + systemcmds/param - # - # Estimation modules (EKF/ SO3 / other filters) - # - #modules/attitude_estimator_ekf - modules/ekf_att_pos_estimator - modules/attitude_estimator_q - modules/position_estimator_inav + # + # Estimation modules (EKF/ SO3 / other filters) + # + #modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator + modules/attitude_estimator_q + modules/position_estimator_inav - # - # Vehicle Control - # - modules/mc_att_control - modules/mc_pos_control + # + # Vehicle Control + # + modules/mc_att_control + modules/mc_pos_control - # - # Library modules - # - modules/systemlib - modules/systemlib/mixer - modules/uORB - modules/commander - modules/controllib + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/uORB + modules/commander + modules/controllib - # - # Libraries - # - lib/mathlib - lib/mathlib/math/filter - lib/geo - lib/geo_lookup - lib/conversion + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue - # - # sources for muorb over fastrpc - # - modules/muorb/adsp - ) - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + # + # sources for muorb over fastrpc + # + modules/muorb/adsp + ) diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index a607a0be2b..501c7fbeb8 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -1,47 +1,38 @@ include(qurt/px4_impl_qurt) -function(px4_get_config) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED OUT_MODULES - ARGN ${ARGN}) +set(config_module_list + drivers/device - set(config_module_list - drivers/device + # + # System commands + # + systemcmds/param - # - # System commands - # - systemcmds/param + # + # Library modules + # + modules/systemlib + modules/mixer + modules/uORB - # - # Library modules - # - modules/systemlib - modules/mixer - modules/uORB + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/conversion - # - # Libraries - # - lib/mathlib - lib/mathlib/math/filter - lib/conversion - - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - platforms/qurt/tests/hello - platforms/qurt/tests/vcdev_test - platforms/qurt/tests/hrt_test - platforms/qurt/tests/wqueue - ) - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue + platforms/qurt/tests/hello + platforms/qurt/tests/vcdev_test + platforms/qurt/tests/hrt_test + platforms/qurt/tests/wqueue + ) diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index d55c7597e5..61b171d14d 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -3,73 +3,64 @@ include(qurt/px4_impl_qurt) # Run a full link with build stubs to make sure qurt target isn't broken set(QURT_ENABLE_STUBS 1) -function(px4_get_config) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) - px4_parse_function_args( - NAME px4_set_config_modules - ONE_VALUE OUT_MODULES - REQUIRED OUT_MODULES - ARGN ${ARGN}) +set(config_module_list + drivers/device + drivers/boards/sitl + drivers/pwm_out_sim + drivers/led + drivers/rgbled + modules/sensors - set(config_module_list - drivers/device - drivers/boards/sitl - drivers/pwm_out_sim - drivers/led - drivers/rgbled - modules/sensors + # + # System commands + # + systemcmds/param + systemcmds/mixer - # - # System commands - # - systemcmds/param - systemcmds/mixer + # + # Estimation modules (EKF/ SO3 / other filters) + # + #modules/attitude_estimator_ekf + modules/ekf_att_pos_estimator + modules/attitude_estimator_q + modules/position_estimator_inav - # - # Estimation modules (EKF/ SO3 / other filters) - # - #modules/attitude_estimator_ekf - modules/ekf_att_pos_estimator - modules/attitude_estimator_q - modules/position_estimator_inav + # + # Vehicle Control + # + modules/mc_att_control + modules/mc_pos_control - # - # Vehicle Control - # - modules/mc_att_control - modules/mc_pos_control + # + # Library modules + # + modules/systemlib + modules/systemlib/mixer + modules/uORB + modules/commander - # - # Library modules - # - modules/systemlib - modules/systemlib/mixer - modules/uORB - modules/commander + # + # Libraries + # + lib/mathlib + lib/mathlib/math/filter + lib/geo + lib/geo_lookup + lib/conversion + modules/controllib - # - # Libraries - # - lib/mathlib - lib/mathlib/math/filter - lib/geo - lib/geo_lookup - lib/conversion - modules/controllib + # + # QuRT port + # + platforms/common + platforms/qurt/px4_layer + platforms/posix/work_queue - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - - # - # sources for muorb over fastrpc - # - modules/muorb/adsp - ) - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() + # + # sources for muorb over fastrpc + # + modules/muorb/adsp + ) From b9ef1ee6ed944ec4a06cee3266cedb761f03bcab Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Fri, 11 Sep 2015 02:33:42 -0700 Subject: [PATCH 084/389] param: Build param without linker script Changed to enable the posix_sitl_simple target to build and run param show * without using a linker script Signed-off-by: Mark Charlebois --- CMakeLists.txt | 2 +- Tools/px_generate_params.py | 53 +++++++++++++++++++++++++++++ cmake/common/px4_base.cmake | 14 ++++++++ src/firmware/posix/CMakeLists.txt | 10 +++--- src/modules/systemlib/param/param.c | 8 +++-- src/modules/systemlib/param/param.h | 27 ++------------- 6 files changed, 80 insertions(+), 34 deletions(-) create mode 100755 Tools/px_generate_params.py diff --git a/CMakeLists.txt b/CMakeLists.txt index a01d50509c..04efb3c89c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,7 +226,7 @@ link_directories(${link_dirs}) add_definitions(${definitions}) #============================================================================= -# source code generation} +# source code generation # file(GLOB_RECURSE msg_files msg/*.msg) px4_generate_messages(TARGET msg_gen diff --git a/Tools/px_generate_params.py b/Tools/px_generate_params.py new file mode 100755 index 0000000000..08808bc559 --- /dev/null +++ b/Tools/px_generate_params.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +import xml.etree.ElementTree as ET +import os + +if len(os.sys.argv) != 3: + print "Error in %s" % os.sys.argv[0] + print "Usage: %s " + raise SystemExit + +fp = open(os.sys.argv[2], "w") + +tree = ET.parse(os.sys.argv[1]) +root = tree.getroot() +body = """ +#include +#include + +// DO NOT EDIT +// This file is autogenerated from paramaters.xml + +""" + +start_name = "" +end_name = "" + +for group in root: + if group.tag == "group": + body += "// %s\n" % group.attrib["name"] + for param in group: + if not start_name: + start_name = param.attrib["name"] + end_name = param.attrib["name"] + body += """ +static const +__attribute__((used, section("__param"))) +struct param_info_s __param__%s = { + "%s", + PARAM_TYPE_%s, + .val.f = %s +}; +""" % (param.attrib["name"], param.attrib["name"], param.attrib["type"], param.attrib["default"]) +body += """ +extern const +__attribute__((alias("__param__%s"))) +struct param_info_s __param_start; + +extern const +__attribute__((alias("__param__%s"))) +struct param_info_s __param_end; +""" % (start_name, end_name) + +fp.write(body) + diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 9238bd05ad..c836223258 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -672,4 +672,18 @@ function(px4_create_git_hash_header) configure_file(${CMAKE_SOURCE_DIR}/cmake/templates/build_git_version.h.in ${HEADER} @ONLY) endfunction() +#============================================================================= +# parameter file generation +# +function(px4_generate_parameters) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py -s ${CMAKE_SOURCE_DIR}/src --board ${BOARD} --xml + ) + + execute_process( + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py ${CMAKE_BINARY_DIR}/parameters.xml ${CMAKE_BINARY_DIR}/parameters.c + ) +endfunction() + + # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index 4dbd94a3df..657d8d45ad 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -1,20 +1,18 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) + px4_posix_generate_builtin_commands( OUT apps.h MODULE_LIST ${module_libraries}) +px4_generate_parameters() + add_executable(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp + ${CMAKE_BINARY_DIR}/parameters.c apps.h ) -set(main_link_flags - "-T${CMAKE_SOURCE_DIR}/cmake/posix/ld.script" - ) -px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") -set_target_properties(mainapp PROPERTIES LINK_FLAGS ${main_link_flags}) - target_link_libraries(mainapp -Wl,--start-group ${module_libraries} diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index c85e8dbda8..7af26cd30b 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -86,9 +86,11 @@ extern struct param_info_s param_array[]; extern struct param_info_s *param_info_base; extern struct param_info_s *param_info_limit; #else -extern char __param_start, __param_end; -static const struct param_info_s *param_info_base = (struct param_info_s *) &__param_start; -static const struct param_info_s *param_info_limit = (struct param_info_s *) &__param_end; +extern const struct param_info_s __param_start, __param_end; + +// FIXME - start and end are reversed +static const struct param_info_s *param_info_base = &__param_end; +static const struct param_info_s *param_info_limit = &__param_start; #endif #define param_info_count ((unsigned)(param_info_limit - param_info_base)) diff --git a/src/modules/systemlib/param/param.h b/src/modules/systemlib/param/param.h index caa0635dce..d7cf666a71 100644 --- a/src/modules/systemlib/param/param.h +++ b/src/modules/systemlib/param/param.h @@ -346,34 +346,13 @@ __EXPORT int param_load_default(void); */ /** define an int32 parameter */ -#define PARAM_DEFINE_INT32(_name, _default) \ - static const \ - __attribute__((used, section("__param"))) \ - struct param_info_s __param__##_name = { \ - #_name, \ - PARAM_TYPE_INT32, \ - .val.i = _default \ - } +#define PARAM_DEFINE_INT32(_name, _default) /** define a float parameter */ -#define PARAM_DEFINE_FLOAT(_name, _default) \ - static const \ - __attribute__((used, section("__param"))) \ - struct param_info_s __param__##_name = { \ - #_name, \ - PARAM_TYPE_FLOAT, \ - .val.f = _default \ - } +#define PARAM_DEFINE_FLOAT(_name, _default) /** define a parameter that points to a structure */ -#define PARAM_DEFINE_STRUCT(_name, _default) \ - static const \ - __attribute__((used, section("__param"))) \ - struct param_info_s __param__##_name = { \ - #_name, \ - PARAM_TYPE_STRUCT + sizeof(_default), \ - .val.p = &_default \ - } +#define PARAM_DEFINE_STRUCT(_name, _default) /** * Parameter value union. From e673a25344b1dac7e111aff8d5799ae94ff4b73d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 11:58:04 +0200 Subject: [PATCH 085/389] Fix flags for OS X --- cmake/posix/px4_impl_posix.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmake/posix/px4_impl_posix.cmake b/cmake/posix/px4_impl_posix.cmake index 1e08a43975..d51b5527d5 100644 --- a/cmake/posix/px4_impl_posix.cmake +++ b/cmake/posix/px4_impl_posix.cmake @@ -166,14 +166,26 @@ function(px4_os_add_flags) mavlink/include/mavlink ) +if(UNIX AND APPLE) set(added_definitions -D__PX4_POSIX - -D__PX4_LINUX + -D__PX4_DARWIN -DCLOCK_MONOTONIC=1 -Dnoreturn_function=__attribute__\(\(noreturn\)\) -include ${PX4_INCLUDE_DIR}visibility.h ) +else() + + set(added_definitions + -D__PX4_POSIX + -D__PX4_LINUX + -DCLOCK_MONOTONIC=1 + -Dnoreturn_function=__attribute__\(\(noreturn\)\) + -include ${PX4_INCLUDE_DIR}visibility.h + ) +endif() + set(added_exe_linker_flags -lpthread ) From ad321927e9387f63a20fbaf9379f48b910e6e010 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 11 Sep 2015 06:38:39 -0400 Subject: [PATCH 086/389] Added install target for nuttx. --- cmake/nuttx/px4_impl_nuttx.cmake | 1 + src/firmware/nuttx/CMakeLists.txt | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 8de25ab868..6c2dbaf25a 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -111,6 +111,7 @@ function(px4_nuttx_add_firmware) DEPENDS ${EXE} ) endif() + add_custom_target(build_firmware ALL DEPENDS ${OUT}) endfunction() #============================================================================= diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 006524213f..667bdaa822 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -27,12 +27,16 @@ target_link_libraries(firmware_nuttx apps nuttx nosys m gcc -Wl,--end-group) -px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4 +set(fw_file ${CMAKE_CURRENT_BINARY_DIR}/${OS}-${BOARD}-${LABEL}.px4) + +px4_nuttx_add_firmware(OUT ${fw_file} EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx ${config_firmware_options} ) px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} - BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4) + BUNDLE ${fw_file}) + +install(FILES ${fw_file} DESTINATION .) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 298fbf0080379838a657370af6cacf3a84ae3dba Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 11 Sep 2015 13:52:14 -0400 Subject: [PATCH 087/389] Added more targets to phony. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c4d3e06b89..604147554c 100644 --- a/Makefile +++ b/Makefile @@ -97,4 +97,4 @@ upload: ; package: ; package_source: ; -.PHONY: clean test upload +.PHONY: clean test upload package package_source From fc3acdb2c1b6c656c6a815f04e036b1159a1dfc5 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Fri, 11 Sep 2015 12:41:00 -0700 Subject: [PATCH 088/389] cmake: param refactoring Use a struct to contain all the parameters so the ordering in memory is not machine dependent. Add number of parameters to the param struct. The struct actually allows direct accessing by the member name if desired. Signed-off-by: Mark Charlebois --- Tools/px_generate_params.py | 80 ++++++++++++++++++++--------- cmake/common/px4_base.cmake | 2 +- src/firmware/posix/CMakeLists.txt | 2 +- src/modules/systemlib/param/param.c | 8 ++- 4 files changed, 62 insertions(+), 30 deletions(-) diff --git a/Tools/px_generate_params.py b/Tools/px_generate_params.py index 08808bc559..a12c72f5e0 100755 --- a/Tools/px_generate_params.py +++ b/Tools/px_generate_params.py @@ -2,52 +2,86 @@ import xml.etree.ElementTree as ET import os -if len(os.sys.argv) != 3: +if len(os.sys.argv) != 2: print "Error in %s" % os.sys.argv[0] - print "Usage: %s " + print "Usage: %s " raise SystemExit -fp = open(os.sys.argv[2], "w") +fp_header = open("px4_parameters.h", "w") +fp_src = open("px4_parameters.c", "w") tree = ET.parse(os.sys.argv[1]) root = tree.getroot() -body = """ + +# Generate the header file content +header = """ #include #include // DO NOT EDIT // This file is autogenerated from paramaters.xml +struct px4_parameters_t { """ - start_name = "" end_name = "" for group in root: if group.tag == "group": - body += "// %s\n" % group.attrib["name"] + header += """ + /***************************************************************** + * %s + ****************************************************************/""" % group.attrib["name"] for param in group: if not start_name: start_name = param.attrib["name"] end_name = param.attrib["name"] - body += """ -static const -__attribute__((used, section("__param"))) -struct param_info_s __param__%s = { - "%s", - PARAM_TYPE_%s, - .val.f = %s + header += """ + const struct param_info_s __param__%s;""" % param.attrib["name"] +header += """ + const unsigned int param_count; }; -""" % (param.attrib["name"], param.attrib["name"], param.attrib["type"], param.attrib["default"]) -body += """ -extern const -__attribute__((alias("__param__%s"))) -struct param_info_s __param_start; -extern const -__attribute__((alias("__param__%s"))) -struct param_info_s __param_end; -""" % (start_name, end_name) +extern const struct px4_parameters_t px4_parameters; +""" -fp.write(body) +# Generate the C file content +src = """ +#include + +// DO NOT EDIT +// This file is autogenerated from paramaters.xml + +static const +__attribute__((used, section("__param"))) +struct px4_parameters_t px4_parameters_impl = { +""" +i=0 +for group in root: + if group.tag == "group": + src += """ + /***************************************************************** + * %s + ****************************************************************/""" % group.attrib["name"] + for param in group: + if not start_name: + start_name = param.attrib["name"] + end_name = param.attrib["name"] + i+=1 + src += """ + { + "%s", + PARAM_TYPE_%s, + .val.f = %s + }, +""" % (param.attrib["name"], param.attrib["type"], param.attrib["default"]) +src += """ + %d +}; + +extern const struct px4_parameters_t px4_parameters __attribute__((alias("px4_parameters_impl"))); +""" % i + +fp_header.write(header) +fp_src.write(src) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index c836223258..b1cf5aa33e 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -681,7 +681,7 @@ function(px4_generate_parameters) ) execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py ${CMAKE_BINARY_DIR}/parameters.xml ${CMAKE_BINARY_DIR}/parameters.c + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py ${CMAKE_BINARY_DIR}/parameters.xml ) endfunction() diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index 657d8d45ad..bc557ce6f7 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -9,7 +9,7 @@ px4_generate_parameters() add_executable(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp - ${CMAKE_BINARY_DIR}/parameters.c + ${CMAKE_BINARY_DIR}/px4_parameters.c apps.h ) diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 7af26cd30b..4efe7bea0d 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -63,6 +63,7 @@ #include "uORB/uORB.h" #include "uORB/topics/parameter_update.h" +#include "px4_parameters.h" #if 0 # define debug(fmt, args...) do { warnx(fmt, ##args); } while(0) @@ -86,14 +87,11 @@ extern struct param_info_s param_array[]; extern struct param_info_s *param_info_base; extern struct param_info_s *param_info_limit; #else -extern const struct param_info_s __param_start, __param_end; - // FIXME - start and end are reversed -static const struct param_info_s *param_info_base = &__param_end; -static const struct param_info_s *param_info_limit = &__param_start; +static const struct param_info_s *param_info_base = (const struct param_info_s *)&px4_parameters; #endif -#define param_info_count ((unsigned)(param_info_limit - param_info_base)) +#define param_info_count px4_parameters.param_count /** * Storage for modified parameters. From 1b1adf3835d0a349eb5f06ac934d9b31a71a5005 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 21:47:50 +0200 Subject: [PATCH 089/389] Add required flag for OS X --- cmake/common/px4_base.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index c836223258..a388c7e655 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -482,7 +482,8 @@ function(px4_add_common_flags) -Werror=unused-variable -Werror=reorder -Werror=uninitialized - -Werror=init-self + -Werror=init-self + -Wno-unused-const-variable #-Wcast-qual - generates spurious noreturn attribute warnings, # try again later #-Wconversion - would be nice, but too many "risky-but-safe" From 0f98a7c141c4309c83dd475a213f165ef7a5184e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 21:48:06 +0200 Subject: [PATCH 090/389] OS X: Add missing time calls --- .../posix/px4_layer/px4_posix_impl.cpp | 19 +++++++++++++++++++ src/platforms/px4_tasks.h | 6 ++++++ src/platforms/px4_time.h | 14 ++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/platforms/posix/px4_layer/px4_posix_impl.cpp b/src/platforms/posix/px4_layer/px4_posix_impl.cpp index 94387f648b..37132a0641 100644 --- a/src/platforms/posix/px4_layer/px4_posix_impl.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_impl.cpp @@ -48,6 +48,7 @@ #include "systemlib/param/param.h" #include "hrt_work.h" #include +#include "px4_time.h" extern pthread_t _shell_task_id; @@ -55,8 +56,26 @@ __BEGIN_DECLS long PX4_TICKS_PER_SEC = sysconf(_SC_CLK_TCK); +#ifdef __PX4_DARWIN extern void hrt_init(void); +int px4_clock_gettime(clockid_t clk_id, struct timespec *tp) +{ + uint64_t currtime = hrt_absolute_time(); + + tp->tv_sec = currtime / (1000 * 1000); + tp->tv_nsec = (currtime - (currtime * 1000 * 1000)) * 1000; + + return 0; +} + +int px4_clock_settime(clockid_t clk_id, struct timespec *tp) +{ + /* do nothing right now */ +} + +#endif + __END_DECLS namespace px4 diff --git a/src/platforms/px4_tasks.h b/src/platforms/px4_tasks.h index 3d36a65cfd..9dc237e63b 100644 --- a/src/platforms/px4_tasks.h +++ b/src/platforms/px4_tasks.h @@ -80,6 +80,12 @@ typedef int px4_task_t; #error "No target OS defined" #endif +#if defined (__PX4_LINUX) || defined(__PX4_NUTTX) +#include +#else +#define prctl(_action, _string, _pid) +#endif + typedef int px4_task_t; typedef struct { diff --git a/src/platforms/px4_time.h b/src/platforms/px4_time.h index 5a93dedf40..22751b3a99 100644 --- a/src/platforms/px4_time.h +++ b/src/platforms/px4_time.h @@ -8,6 +8,20 @@ #define px4_clock_gettime clock_gettime #define px4_clock_settime clock_settime +#elif defined(__PX4_DARWIN) + +__BEGIN_DECLS + +#define clockid_t unsigned +#define CLOCK_REALTIME 0 + +int px4_clock_gettime(clockid_t clk_id, struct timespec *tp); +int px4_clock_settime(clockid_t clk_id, struct timespec *tp); + +__EXPORT unsigned int sleep(unsigned int sec); + +__END_DECLS + #elif defined(__PX4_QURT) #include From 12a1ffd27bc484d309cc0d36436cd7fdeef5b9cf Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 21:48:36 +0200 Subject: [PATCH 091/389] Commander: POSIX adjustments --- src/modules/commander/commander.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index f9477d6f7f..f02cb0a809 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -57,9 +58,6 @@ #include #include //#include -#ifndef __PX4_QURT -#include -#endif #include #include #include @@ -2804,7 +2802,7 @@ void answer_command(struct vehicle_command_s &cmd, unsigned result) void *commander_low_prio_loop(void *arg) { -#ifndef __PX4_QURT +#if defined(__PX4_LINUX) || defined(__PX4_NUTTX) /* Set thread name */ prctl(PR_SET_NAME, "commander_low_prio", getpid()); #endif From 60db613a8fb0b471fefdb3abf773e922228cf35f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 21:48:50 +0200 Subject: [PATCH 092/389] EKF: OS X adjustments --- .../ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp index 5f3634d22b..d89eab5299 100644 --- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp +++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp @@ -155,9 +155,9 @@ AttitudePositionEstimatorEKF::AttitudePositionEstimatorEKF() : _landDetector {}, _armed {}, - _gyro_offsets({}), - _accel_offsets({}), - _mag_offsets({}), + _gyro_offsets{}, + _accel_offsets{}, + _mag_offsets{}, _sensor_combined {}, From c29e47b3fc77232fb4463e00d327d5d6e2ddba4d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 21:49:06 +0200 Subject: [PATCH 093/389] MAVLink: POSIX adjustments --- src/modules/mavlink/mavlink_receiver.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 58124f2133..af6de93ab2 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -62,7 +61,6 @@ #include #include #ifndef __PX4_POSIX -#include #include #endif #include From d5f110cc92e694ae360895c9cd2a3d7902d33fca Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 21:49:19 +0200 Subject: [PATCH 094/389] sdlog2: POSIX adjustments --- src/modules/sdlog2/sdlog2.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index a81ab9fdb1..1667ed6ed1 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -45,10 +45,16 @@ #include #include #include +#include +#include #include #include -#include +#ifdef __PX4_DARWIN +#include +#include +#else #include +#endif #include #include #include @@ -410,7 +416,7 @@ int sdlog2_main(int argc, char *argv[]) bool get_log_time_utc_tt(struct tm *tt, bool boot_time) { struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); + px4_clock_gettime(CLOCK_REALTIME, &ts); /* use RTC time for log file naming, e.g. /fs/microsd/2014-01-19/19_37_52.px4log */ time_t utc_time_sec; From 458b72352a66308282b98bfc4ddf31432b6e3df3 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 21:49:29 +0200 Subject: [PATCH 095/389] Simulator: POSIX adjustments --- src/modules/simulator/simulator_mavlink.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index ddbc79db76..e9844ee54a 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -46,6 +46,14 @@ extern "C" __EXPORT hrt_abstime hrt_reset(void); #define UDP_PORT 14560 #define PIXHAWK_DEVICE "/dev/ttyACM0" +#ifndef B460800 +#define B460800 460800 +#endif + +#ifndef B921600 +#define B921600 921600 +#endif + #define PRESS_GROUND 101325.0f #define DENSITY 1.2041f #define GRAVITY 9.81f From 31e5697cea39333edd1e372d3adf2303e4ab1a54 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 11 Sep 2015 21:58:32 +0200 Subject: [PATCH 096/389] OS X: Make param section generation compatible --- Tools/px_generate_params.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tools/px_generate_params.py b/Tools/px_generate_params.py index a12c72f5e0..b468867523 100755 --- a/Tools/px_generate_params.py +++ b/Tools/px_generate_params.py @@ -52,8 +52,10 @@ src = """ // DO NOT EDIT // This file is autogenerated from paramaters.xml -static const +static const +#ifndef __PX4_DARWIN __attribute__((used, section("__param"))) +#endif struct px4_parameters_t px4_parameters_impl = { """ i=0 @@ -79,7 +81,13 @@ src += """ %d }; -extern const struct px4_parameters_t px4_parameters __attribute__((alias("px4_parameters_impl"))); +#ifdef __PX4_DARWIN +#define ___param__attributes ; +#else +#define ___param__attributes __attribute__((alias("px4_parameters_impl"))); +#endif + +extern const struct px4_parameters_t px4_parameters ___param__attributes """ % i fp_header.write(header) From e4b9212e96c2297d2d7aaa1e8ee7050f95f7f922 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Fri, 11 Sep 2015 16:15:48 -0700 Subject: [PATCH 097/389] cmake: Updated makefie to show the available build configs Also fixed param support for nuttx and qurt Signed-off-by: Mark Charlebois --- Makefile | 76 +++++-------------------------- cmake/common/px4_base.cmake | 3 +- src/firmware/nuttx/CMakeLists.txt | 2 + src/firmware/qurt/CMakeLists.txt | 2 + 4 files changed, 18 insertions(+), 65 deletions(-) diff --git a/Makefile b/Makefile index 604147554c..0aadc6d5fc 100644 --- a/Makefile +++ b/Makefile @@ -31,70 +31,18 @@ # ############################################################################ -# Help -# -------------------------------------------------------------------- -# Don't be afraid of this makefile, it is just passing -# arguments to cmake to allow us to keep the wiki pages etc. -# that describe how to build the px4 firmware -# the same even when using cmake instead of make. -# -# Example usage: -# -# make px4fmu-v2_default (builds) -# make px4fmu-v2_default upload (builds and uploads) -# make px4fmu-v2_default test (builds and tests) -# -# This tells cmake to build the nuttx px4fmu-v2 default config in the -# directory build_nuttx_px4fmu-v2_default and then call make -# in that directory with the target upload. +CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~") -# Parsing -# -------------------------------------------------------------------- -# assume 1st argument passed is the main target, the -# rest are arguments to pass to the makefile generated -# by cmake in the subdirectory -ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) +$(CONFIGS): + @mkdir -p Build/$@ + @cd Build/$@ && cmake ../.. -DCONFIG=$@ + @cd Build/$@ && make -# Functions -# -------------------------------------------------------------------- -# define a make function to describe how to build a cmake config -define cmake-build -mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -DCONFIG=$(1) -make -C $(PWD)/build_$@ -s $(ARGS) -endef +clean-all: + @rm -rf Build/* - -# ADD CONFIGS HERE -# -------------------------------------------------------------------- -# Do not put any spaces between function arguments. - -px4fmu-v2_default: - $(call cmake-build,nuttx_px4fmu-v2_default) - -px4fmu-v2_simple: - $(call cmake-build,nuttx_px4fmu-v2_simple) - -nuttx_sim_simple: - $(call cmake-build,$@) - -posix_sitl_simple: - $(call cmake-build,$@) - -qurt_eagle_travis: - $(call cmake-build,$@) - -# Other targets -# -------------------------------------------------------------------- -# explicity set default build target -all: px4fmu-v2_default - -clean: - rm -rf build_*/ - -# targets handled by cmake -test: ; -upload: ; -package: ; -package_source: ; - -.PHONY: clean test upload package package_source +help: + @echo + @echo "Type 'make ' and hit the tab key twice to see a list of the available" + @echo "build configurations." + @echo diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 17f162cb28..4b42f388cf 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -483,7 +483,6 @@ function(px4_add_common_flags) -Werror=reorder -Werror=uninitialized -Werror=init-self - -Wno-unused-const-variable #-Wcast-qual - generates spurious noreturn attribute warnings, # try again later #-Wconversion - would be nice, but too many "risky-but-safe" @@ -494,6 +493,7 @@ function(px4_add_common_flags) if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") list(APPEND warnings + -Wno-unused-const-variable -Werror=unused-but-set-variable -Wformat=1 #-Wlogical-op # very verbose due to eigen @@ -574,6 +574,7 @@ function(px4_add_common_flags) set(added_include_dirs src + ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/src src/modules src/include diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 667bdaa822..13118146f5 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -8,6 +8,8 @@ px4_nuttx_generate_builtin_commands( px4_nuttx_generate_romfs(OUT romfs.o ROOT ROMFS/px4fmu_common) +px4_generate_parameters() + # add executable add_executable(firmware_nuttx builtin_commands.c romfs.o) set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index e720715ef2..8e8b3ea7f5 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -14,6 +14,8 @@ px4_qurt_generate_builtin_commands( set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") +px4_generate_parameters() + # Enable build without HexagonSDK to check link dependencies if ("${QURT_ENABLE_STUBS}" STREQUAL "1") add_executable(mainapp From 6eb4d015fdda9545261e1e7d4a5863cced85bd27 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 01:39:57 +0200 Subject: [PATCH 098/389] Bring back user-friendly Makefile for non-Ubuntu users --- Makefile | 94 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 0aadc6d5fc..97551cb68b 100644 --- a/Makefile +++ b/Makefile @@ -31,18 +31,86 @@ # ############################################################################ +# Help +# -------------------------------------------------------------------- +# Don't be afraid of this makefile, it is just passing +# arguments to cmake to allow us to keep the wiki pages etc. +# that describe how to build the px4 firmware +# the same even when using cmake instead of make. +# +# Example usage: +# +# make px4fmu-v2_default (builds) +# make px4fmu-v2_default upload (builds and uploads) +# make px4fmu-v2_default test (builds and tests) +# +# This tells cmake to build the nuttx px4fmu-v2 default config in the +# directory build_nuttx_px4fmu-v2_default and then call make +# in that directory with the target upload. + +# Parsing +# -------------------------------------------------------------------- +# assume 1st argument passed is the main target, the +# rest are arguments to pass to the makefile generated +# by cmake in the subdirectory +ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) + +# Functions +# -------------------------------------------------------------------- +# define a make function to describe how to build a cmake config +define cmake-build +mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -DCONFIG=$(1) +make -C $(PWD)/build_$@ -s $(ARGS) +endef + + +# ADD CONFIGS HERE +# -------------------------------------------------------------------- +# Do not put any spaces between function arguments. + +px4fmu-v2_default: + $(call cmake-build,nuttx_px4fmu-v2_default) + +px4fmu-v2_simple: + $(call cmake-build,nuttx_px4fmu-v2_simple) + +nuttx_sim_simple: + $(call cmake-build,$@) + +posix_sitl_simple: + $(call cmake-build,$@) + +qurt_eagle_travis: + $(call cmake-build,$@) + +# Other targets +# -------------------------------------------------------------------- +# explicity set default build target +all: px4fmu-v2_default + +clean: + rm -rf build_*/ + +# targets handled by cmake +test: ; +upload: ; +package: ; +package_source: ; + +.PHONY: clean test upload package package_source + CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~") -$(CONFIGS): - @mkdir -p Build/$@ - @cd Build/$@ && cmake ../.. -DCONFIG=$@ - @cd Build/$@ && make - -clean-all: - @rm -rf Build/* - -help: - @echo - @echo "Type 'make ' and hit the tab key twice to see a list of the available" - @echo "build configurations." - @echo +# Future: +#$(CONFIGS): +## @cd Build/$@ && cmake ../.. -DCONFIG=$@ +# @cd Build/$@ && make +# +#clean-all: +# @rm -rf Build/* +# +#help: +# @echo +# @echo "Type 'make ' and hit the tab key twice to see a list of the available" +# @echo "build configurations." +# @echo From 1bba87c2644138ac4fd757ea2de9abb1145e09e5 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Fri, 11 Sep 2015 17:43:25 -0700 Subject: [PATCH 099/389] qurt: Changes for cmake build Added build stubs. Fixed missing module (platforms/common) which was causing missing generated message errors. Signed-off-by: Mark Charlebois --- cmake/configs/posix_eagle_default.cmake | 3 +- cmake/configs/posix_eagle_hil.cmake | 6 ++ cmake/configs/posix_eagle_release.cmake | 6 ++ .../krait-stubs/px4muorb_KraitRpcWrapper.hpp | 76 +++++++++++++++++++ src/modules/muorb/krait/CMakeLists.txt | 4 + src/modules/muorb/krait/muorb_main.cpp | 2 +- .../muorb/krait/uORBKraitFastRpcChannel.hpp | 2 +- 7 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp diff --git a/cmake/configs/posix_eagle_default.cmake b/cmake/configs/posix_eagle_default.cmake index 8bee815a8b..36c787edca 100644 --- a/cmake/configs/posix_eagle_default.cmake +++ b/cmake/configs/posix_eagle_default.cmake @@ -8,7 +8,7 @@ set(config_module_list drivers/pwm_out_sim drivers/rgbled drivers/led - modules/sensors + drivers/boards/sitl systemcmds/param systemcmds/mixer @@ -38,6 +38,7 @@ set(config_module_list lib/geo_lookup lib/conversion + platforms/common platforms/posix/px4_layer platforms/posix/work_queue ) diff --git a/cmake/configs/posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake index fc771f3d89..c4e5375766 100644 --- a/cmake/configs/posix_eagle_hil.cmake +++ b/cmake/configs/posix_eagle_hil.cmake @@ -1,5 +1,10 @@ include(posix/px4_impl_posix) +# Use build stubs unless explicitly set not to +if("${DSPAL_STUBS_ENABLE}" STREQUAL "") + set(DSPAL_STUBS_ENABLE "1") +endif() + set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) set(config_module_list @@ -26,6 +31,7 @@ set(config_module_list lib/geo_lookup lib/conversion + platforms/common platforms/posix/px4_layer platforms/posix/work_queue modules/muorb/krait diff --git a/cmake/configs/posix_eagle_release.cmake b/cmake/configs/posix_eagle_release.cmake index cb3019ae2b..36a9ad1be3 100644 --- a/cmake/configs/posix_eagle_release.cmake +++ b/cmake/configs/posix_eagle_release.cmake @@ -1,5 +1,10 @@ include(posix/px4_impl_posix) +# Use build stubs unless explicitly set not to +if("${DSPAL_STUBS_ENABLE}" STREQUAL "") + set(DSPAL_STUBS_ENABLE "1") +endif() + set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) set(config_module_list @@ -20,6 +25,7 @@ set(config_module_list lib/geo_lookup lib/conversion + platforms/common platforms/posix/px4_layer platforms/posix/work_queue diff --git a/src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp b/src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp new file mode 100644 index 0000000000..d6feab2a47 --- /dev/null +++ b/src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp @@ -0,0 +1,76 @@ +/**************************************************************************** + * + * Copyright (C) 2015 Mark Charlebois. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ +#ifndef _px4muorb_KraitRpcWrapper_hpp_ +#define _px4muorb_KraitRpcWrapper_hpp_ +#include + +namespace px4muorb +{ + class KraitRpcWrapper; +} + +class px4muorb::KraitRpcWrapper +{ +public: + /** + * Constructor + */ + KraitRpcWrapper() {} + + /** + * destructor + */ + ~KraitRpcWrapper() {} + + /** + * Initiatizes the rpc channel px4 muorb + */ + bool Initialize() { return true; } + + /** + * Terminate to clean up the resources. This should be called at program exit + */ + bool Terminate() { return true; } + + /** + * Muorb related functions to pub/sub of orb topic from krait to adsp + */ + int32_t AddSubscriber( const char* topic ) { return 1; } + int32_t RemoveSubscriber( const char* topic ) { return 1; } + int32_t SendData( const char* topic, int32_t length_in_bytes, const uint8_t* data ) { return 1; } + int32_t ReceiveData( int32_t* msg_type, char** topic, int32_t* length_in_bytes, uint8_t** data ) { return 1; } + int32_t IsSubscriberPresent( const char* topic, int32_t* status ) { return 1; } + int32_t ReceiveBulkData( uint8_t** bulk_data, int32_t* length_in_bytes, int32_t* topic_count ) { return 1; } + int32_t UnblockReceiveData() { return 1; } +}; +#endif // _px4muorb_KraitWrapper_hpp_ diff --git a/src/modules/muorb/krait/CMakeLists.txt b/src/modules/muorb/krait/CMakeLists.txt index 5bb0dd4f7d..1c1d6605ac 100644 --- a/src/modules/muorb/krait/CMakeLists.txt +++ b/src/modules/muorb/krait/CMakeLists.txt @@ -30,6 +30,10 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +if("${DSPAL_STUBS_ENABLE}" STREQUAL "1") + include_directories(../krait-stubs) +endif() + px4_add_module( MODULE modules__muorb__krait MAIN muorb diff --git a/src/modules/muorb/krait/muorb_main.cpp b/src/modules/muorb/krait/muorb_main.cpp index 3a320e6134..006870780c 100644 --- a/src/modules/muorb/krait/muorb_main.cpp +++ b/src/modules/muorb/krait/muorb_main.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ #include -#include "uORBManager.hpp" +#include "modules/uORB/uORBManager.hpp" #include "uORBKraitFastRpcChannel.hpp" extern "C" { __EXPORT int muorb_main(int argc, char *argv[]); } diff --git a/src/modules/muorb/krait/uORBKraitFastRpcChannel.hpp b/src/modules/muorb/krait/uORBKraitFastRpcChannel.hpp index a2f6850cbe..0e8d82b44b 100644 --- a/src/modules/muorb/krait/uORBKraitFastRpcChannel.hpp +++ b/src/modules/muorb/krait/uORBKraitFastRpcChannel.hpp @@ -38,7 +38,7 @@ #include #include #include "uORB/uORBCommunicator.hpp" -#include +#include "px4muorb_KraitRpcWrapper.hpp" #include #include "drivers/drv_hrt.h" From 8369e3324552c96a193cb20bc9bd87db7d9f7fff Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Fri, 11 Sep 2015 18:32:44 -0700 Subject: [PATCH 100/389] cmake: Fixes for qurt and nuttx Added px4_parameters.c to nuttx executable src list. Minor syntax fix in Tools/px_generate_params.py for semicolon. Added handling of PX4_MAIN which was not yet supoprted in the cmake build. Fixed include quotes in muorb_test_example.cpp Signed-off-by: Mark Charlebois --- Tools/px_generate_params.py | 6 +++--- cmake/common/px4_base.cmake | 3 +++ cmake/configs/qurt_eagle_hello.cmake | 6 ------ cmake/configs/qurt_eagle_test.cmake | 8 ++++---- cmake/configs/qurt_eagle_travis.cmake | 2 +- src/firmware/nuttx/CMakeLists.txt | 2 +- src/firmware/qurt/CMakeLists.txt | 2 ++ src/platforms/qurt/tests/muorb/muorb_test_example.cpp | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Tools/px_generate_params.py b/Tools/px_generate_params.py index b468867523..c73b842875 100755 --- a/Tools/px_generate_params.py +++ b/Tools/px_generate_params.py @@ -82,12 +82,12 @@ src += """ }; #ifdef __PX4_DARWIN -#define ___param__attributes ; +#define ___param__attributes #else -#define ___param__attributes __attribute__((alias("px4_parameters_impl"))); +#define ___param__attributes __attribute__((alias("px4_parameters_impl"))) #endif -extern const struct px4_parameters_t px4_parameters ___param__attributes +extern const struct px4_parameters_t px4_parameters ___param__attributes; """ % i fp_header.write(header) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 4b42f388cf..0142d21736 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -273,6 +273,9 @@ function(px4_add_module) endif() endforeach() foreach (prop STACK MAIN COMPILE_FLAGS LINK_FLAGS PRIORITY) + if ("${prop}" STREQUAL "MAIN") + add_definitions(-DPX4_MAIN=${${prop}}_app_main) + endif() if (${prop}) set_target_properties(${MODULE} PROPERTIES "${prop}" "${${prop}}") endif() diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index 43db471f69..9076ec7511 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -24,10 +24,4 @@ set(config_module_list platforms/posix/work_queue platforms/qurt/tests/hello ) - set(${out_module_list} ${config_module_list} PARENT_SCOPE) - - # output - set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE) - -endfunction() diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index 501c7fbeb8..c25191f5b9 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -14,7 +14,7 @@ set(config_module_list # Library modules # modules/systemlib - modules/mixer + modules/systemlib/mixer modules/uORB # @@ -31,8 +31,8 @@ set(config_module_list platforms/qurt/px4_layer platforms/posix/work_queue platforms/qurt/tests/hello - platforms/qurt/tests/vcdev_test - platforms/qurt/tests/hrt_test - platforms/qurt/tests/wqueue + platforms/posix/tests/vcdev_test + platforms/posix/tests/hrt_test + platforms/posix/tests/wqueue ) diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index 61b171d14d..ab766f189c 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -1,7 +1,7 @@ include(qurt/px4_impl_qurt) # Run a full link with build stubs to make sure qurt target isn't broken -set(QURT_ENABLE_STUBS 1) +set(QURT_ENABLE_STUBS "1") set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 13118146f5..39abf9161a 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -11,7 +11,7 @@ px4_nuttx_generate_romfs(OUT romfs.o px4_generate_parameters() # add executable -add_executable(firmware_nuttx builtin_commands.c romfs.o) +add_executable(firmware_nuttx builtin_commands.c ${CMAKE_BINARY_DIR}/px4_parameters.c romfs.o) set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) set(main_link_flags "-T${nuttx_export_dir}/build/ld.script" diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index 8e8b3ea7f5..6e6ed042ee 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -20,10 +20,12 @@ px4_generate_parameters() if ("${QURT_ENABLE_STUBS}" STREQUAL "1") add_executable(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c + ${CMAKE_BINARY_DIR}/px4_parameters.c ${CMAKE_BINARY_DIR}/apps.h) else("${QURT_ENABLE_STUBS}" STREQUAL "1") add_library(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c + ${CMAKE_BINARY_DIR}/px4_parameters.c ${CMAKE_BINARY_DIR}/apps.h) endif() diff --git a/src/platforms/qurt/tests/muorb/muorb_test_example.cpp b/src/platforms/qurt/tests/muorb/muorb_test_example.cpp index 2628b56a3b..3b932b5f13 100644 --- a/src/platforms/qurt/tests/muorb/muorb_test_example.cpp +++ b/src/platforms/qurt/tests/muorb/muorb_test_example.cpp @@ -45,7 +45,7 @@ #include #include "uORB/topics/sensor_combined.h" #include "uORB/topics/pwm_input.h" -#include "uORB.h" +#include "modules/uORB/uORB.h" #include "px4_middleware.h" #include "px4_defines.h" #include From ce17984bd5806afe9cec342013b648238cd9f277 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Fri, 11 Sep 2015 18:48:37 -0700 Subject: [PATCH 101/389] qurt: removed linker script Linker script no longer needed for qurt target Signed-off-by: Mark Charlebois --- src/firmware/qurt/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index 6e6ed042ee..b4271ee12e 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -29,12 +29,6 @@ else("${QURT_ENABLE_STUBS}" STREQUAL "1") ${CMAKE_BINARY_DIR}/apps.h) endif() -set(main_link_flags - "-T${CMAKE_SOURCE_DIR}/cmake/posix/ld.script" - ) -px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") -set_target_properties(mainapp PROPERTIES LINK_FLAGS ${main_link_flags}) - target_link_libraries(mainapp -Wl,--whole-archive ${module_libraries} From 0d28cdeb882cf2f7f7699deee4f87479f500b530 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 00:24:16 -0400 Subject: [PATCH 102/389] Fixed extra builtin target name. --- cmake/configs/nuttx_px4fmu-v2_default.cmake | 4 ++-- cmake/configs/nuttx_px4fmu-v2_simple.cmake | 4 ++-- cmake/configs/nuttx_sim_simple.cmake | 4 ++-- cmake/configs/posix_sitl_simple.cmake | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 4ba1792a41..a092466010 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -165,8 +165,8 @@ set(config_firmware_options ) set(config_extra_builtin_cmds - serdis_main - sercon_main + serdis + sercon ) add_custom_target(sercon) diff --git a/cmake/configs/nuttx_px4fmu-v2_simple.cmake b/cmake/configs/nuttx_px4fmu-v2_simple.cmake index d3ee36d1e0..ddd639ac5a 100644 --- a/cmake/configs/nuttx_px4fmu-v2_simple.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_simple.cmake @@ -122,8 +122,8 @@ set(config_firmware_options ) set(config_extra_builtin_cmds - serdis_main - sercon_main + serdis + sercon ) add_custom_target(sercon) diff --git a/cmake/configs/nuttx_sim_simple.cmake b/cmake/configs/nuttx_sim_simple.cmake index 0721df5a52..a777e915f9 100644 --- a/cmake/configs/nuttx_sim_simple.cmake +++ b/cmake/configs/nuttx_sim_simple.cmake @@ -22,8 +22,8 @@ set(config_firmware_options ) set(config_extra_builtin_cmds - serdis_main - sercon_main + serdis + sercon ) add_custom_target(sercon) diff --git a/cmake/configs/posix_sitl_simple.cmake b/cmake/configs/posix_sitl_simple.cmake index a00e79743e..10a02fa89f 100644 --- a/cmake/configs/posix_sitl_simple.cmake +++ b/cmake/configs/posix_sitl_simple.cmake @@ -60,8 +60,8 @@ set(config_firmware_options ) set(config_extra_builtin_cmds - serdis_main - sercon_main + serdis + sercon ) add_custom_target(sercon) From 68a78b0580682af83c7c7f45dfb23d699a333e25 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 00:49:10 -0400 Subject: [PATCH 103/389] Some cleanup of cmake module build. --- CMakeLists.txt | 1 + cmake/common/px4_base.cmake | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04efb3c89c..a3c277559b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,7 @@ project(px4 CXX C ASM) if (NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) cmake_policy(SET CMP0045 NEW) # error on non-existent target in get prop cmake_policy(SET CMP0046 NEW) # no non-existent targets as dependencies + cmake_policy(SET CMP0054 NEW) # don't dereference quoted variables endif() set(version_major 1) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 0142d21736..38ae2f7e2f 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -254,33 +254,44 @@ endfunction() # ) # function(px4_add_module) + px4_parse_function_args( NAME px4_add_module ONE_VALUE MODULE MAIN STACK PRIORITY MULTI_VALUE COMPILE_FLAGS LINK_FLAGS SRCS INCLUDES DEPENDS REQUIRED MODULE ARGN ${ARGN}) + add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${SRCS}) + if(INCLUDES) target_include_directories(${MODULE} ${INCLUDES}) endif() + if(DEPENDS) add_dependencies(${MODULE} ${DEPENDS}) endif() + + if(MAIN) + target_compile_definitions(${MODULE} PUBLIC -DPX4_MAIN=${MAIN}_app_main) + endif() + + # join list variables to get ready to send to compiler foreach(prop LINK_FLAGS COMPILE_FLAGS) if(${prop}) px4_join(OUT ${prop} LIST ${${prop}} GLUE " ") endif() endforeach() - foreach (prop STACK MAIN COMPILE_FLAGS LINK_FLAGS PRIORITY) - if ("${prop}" STREQUAL "MAIN") - add_definitions(-DPX4_MAIN=${${prop}}_app_main) - endif() + + # store module properties in target + # COMPILE_FLAGS and LINK_FLAGS are passed to compiler/linker by cmake + # STACK, MAIN, PRIORITY are PX4 specific + foreach (prop COMPILE_FLAGS LINK_FLAGS STACK MAIN PRIORITY) if (${prop}) - set_target_properties(${MODULE} PROPERTIES "${prop}" "${${prop}}") + set_target_properties(${MODULE} PROPERTIES ${prop} ${${prop}}) endif() endforeach() - set_target_properties(${MODULE} PROPERTIES LINK_INTERFACE_MULTIPLICITY 4) + endfunction() #============================================================================= From 54f8dd2f4d850cf2c81919516c8fcb3c2b5bf1be Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 01:33:36 -0400 Subject: [PATCH 104/389] Support parallel building through -j flag in makefile. --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 97551cb68b..e5d4dc01af 100644 --- a/Makefile +++ b/Makefile @@ -54,13 +54,14 @@ # rest are arguments to pass to the makefile generated # by cmake in the subdirectory ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) +j ?= 1 # Functions # -------------------------------------------------------------------- # define a make function to describe how to build a cmake config define cmake-build -mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -DCONFIG=$(1) -make -C $(PWD)/build_$@ -s $(ARGS) ++mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -DCONFIG=$(1) ++make -C $(PWD)/build_$@ --no-print-directory $(ARGS) endef From 5ee0f18148f98b75584db440e0aefffa00d681b1 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 01:35:09 -0400 Subject: [PATCH 105/389] Improved module definition handling. --- CMakeLists.txt | 2 +- cmake/common/px4_base.cmake | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3c277559b..041966b1d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,7 +156,7 @@ list(GET config_args 0 OS) list(GET config_args 1 BOARD) list(GET config_args 2 LABEL) -message(STATUS "TARGET: OS(${OS})-BOARD(${BOARD})-LABEL(${LABEL})") +message(STATUS "OS=${OS} BOARD=${BOARD} LABEL=${LABEL}") #============================================================================= # programs diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 38ae2f7e2f..66be1acbe5 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -264,6 +264,11 @@ function(px4_add_module) add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${SRCS}) + if(MAIN) + set_target_properties(${MODULE} PROPERTIES + COMPILE_DEFINITIONS PX4_MAIN=${MAIN}_app_main) + endif() + if(INCLUDES) target_include_directories(${MODULE} ${INCLUDES}) endif() @@ -272,10 +277,6 @@ function(px4_add_module) add_dependencies(${MODULE} ${DEPENDS}) endif() - if(MAIN) - target_compile_definitions(${MODULE} PUBLIC -DPX4_MAIN=${MAIN}_app_main) - endif() - # join list variables to get ready to send to compiler foreach(prop LINK_FLAGS COMPILE_FLAGS) if(${prop}) From 4c3f47a003b27adcddfe4dd0323d78f03d090c6c Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 01:53:01 -0400 Subject: [PATCH 106/389] Builtin typo fix. --- src/firmware/nuttx/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 39abf9161a..83d4a8ea14 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -2,7 +2,7 @@ px4_nuttx_generate_builtin_commands( OUT builtin_commands.c MODULE_LIST ${module_libraries} - ${config_extra_builtins_cmds} + ${config_extra_builtin_cmds} ) px4_nuttx_generate_romfs(OUT romfs.o From b2c67a4cf90b2db2ffbb1bb0453623ce12c4d66d Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 02:22:27 -0400 Subject: [PATCH 107/389] Disable autostart for now so usb works. --- cmake/nuttx/px4_impl_nuttx.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 6c2dbaf25a..15a304fdb9 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -291,21 +291,23 @@ function(px4_nuttx_generate_romfs) set(romfs_pruner ${CMAKE_SOURCE_DIR}/Tools/px_romfs_pruner.py) set(bin_to_obj ${CMAKE_SOURCE_DIR}/cmake/nuttx/bin_to_obj.py) - #message(STATUS "temp_dir: ${romfs_temp_dir}") #message(STATUS "src_dir: ${romfs_src_dir}") add_custom_command(OUTPUT rc.autostart COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} - -a ${romfs_src_dir}/init.d/ + -a ${romfs_src_dir}/init.d -s rc.autostart ) add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} - COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d - #TODO add romfs cleanup and pruning + # TODO XXX hack to get nsh to work, copying real + # autostart in currently makes nsh fail over usb + COMMAND cmake -E touch ${romfs_temp_dir}/init.d/rc.autostart + #COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d + #TODO add romfs cleanup of temp file .~, .swp etc COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin From 75dfa5a4202715037e7219b8ba131a63fc670c7e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 09:53:36 +0200 Subject: [PATCH 108/389] Remove outdated flow position estimator --- cmake/configs/nuttx_px4fmu-v2_default.cmake | 5 - .../flow_position_estimator/CMakeLists.txt | 45 -- .../flow_position_estimator_main.c | 465 ------------------ .../flow_position_estimator_params.c | 72 --- .../flow_position_estimator_params.h | 68 --- .../flow_position_estimator/module.mk | 43 -- 6 files changed, 698 deletions(-) delete mode 100644 src/examples/flow_position_estimator/CMakeLists.txt delete mode 100644 src/examples/flow_position_estimator/flow_position_estimator_main.c delete mode 100644 src/examples/flow_position_estimator/flow_position_estimator_params.c delete mode 100644 src/examples/flow_position_estimator/flow_position_estimator_params.h delete mode 100644 src/examples/flow_position_estimator/module.mk diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index a092466010..60cb06a3dc 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -126,11 +126,6 @@ set(config_module_list # modules/bottle_drop - # - # PX4 flow estimator, good for indoors - # - examples/flow_position_estimator - # # Rover apps # diff --git a/src/examples/flow_position_estimator/CMakeLists.txt b/src/examples/flow_position_estimator/CMakeLists.txt deleted file mode 100644 index 432aed1df9..0000000000 --- a/src/examples/flow_position_estimator/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ -px4_add_module( - MODULE examples__flow_position_estimator - MAIN flow_position_estimator - COMPILE_FLAGS - -Wno-float-equal - - SRCS - flow_position_estimator_main.c - flow_position_estimator_params.c - DEPENDS - platforms__common - ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/examples/flow_position_estimator/flow_position_estimator_main.c b/src/examples/flow_position_estimator/flow_position_estimator_main.c deleted file mode 100644 index bcf13c4de5..0000000000 --- a/src/examples/flow_position_estimator/flow_position_estimator_main.c +++ /dev/null @@ -1,465 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2008-2013 PX4 Development Team. All rights reserved. - * Author: Samuel Zihlmann - * Lorenz Meier - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file flow_position_estimator_main.c - * - * Optical flow position estimator - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "flow_position_estimator_params.h" - -__EXPORT int flow_position_estimator_main(int argc, char *argv[]); -static bool thread_should_exit = false; /**< Daemon exit flag */ -static bool thread_running = false; /**< Daemon status flag */ -static int daemon_task; /**< Handle of daemon task / thread */ - -int flow_position_estimator_thread_main(int argc, char *argv[]); -static void usage(const char *reason); - -static void usage(const char *reason) -{ - if (reason) { - fprintf(stderr, "%s\n", reason); - } - - fprintf(stderr, "usage: daemon {start|stop|status} [-p ]\n\n"); - exit(1); -} - -/** - * The daemon app only briefly exists to start - * the background job. The stack size assigned in the - * Makefile does only apply to this management task. - * - * The actual stack size should be set in the call - * to px4_task_spawn_cmd(). - */ -int flow_position_estimator_main(int argc, char *argv[]) -{ - if (argc < 2) { - usage("missing command"); - } - - if (!strcmp(argv[1], "start")) { - if (thread_running) { - printf("flow position estimator already running\n"); - /* this is not an error */ - exit(0); - } - - thread_should_exit = false; - daemon_task = px4_task_spawn_cmd("flow_position_estimator", - SCHED_DEFAULT, - SCHED_PRIORITY_MAX - 5, - 4000, - flow_position_estimator_thread_main, - (argv) ? (char *const *)&argv[2] : (char *const *)NULL); - exit(0); - } - - if (!strcmp(argv[1], "stop")) { - thread_should_exit = true; - exit(0); - } - - if (!strcmp(argv[1], "status")) { - if (thread_running) { - printf("\tflow position estimator is running\n"); - - } else { - printf("\tflow position estimator not started\n"); - } - - exit(0); - } - - usage("unrecognized command"); - exit(1); -} - -int flow_position_estimator_thread_main(int argc, char *argv[]) -{ - /* welcome user */ - thread_running = true; - printf("[flow position estimator] starting\n"); - - /* rotation matrix for transformation of optical flow speed vectors */ - static const int8_t rotM_flow_sensor[3][3] = {{ 0, -1, 0 }, - { 1, 0, 0 }, - { 0, 0, 1 } - }; // 90deg rotated - const float time_scale = powf(10.0f, -6.0f); - static float speed[3] = {0.0f, 0.0f, 0.0f}; - static float flow_speed[3] = {0.0f, 0.0f, 0.0f}; - static float global_speed[3] = {0.0f, 0.0f, 0.0f}; - static uint32_t counter = 0; - static uint64_t time_last_flow = 0; // in ms - static float dt = 0.0f; // seconds - static float sonar_last = 0.0f; - static bool sonar_valid = false; - static float sonar_lp = 0.0f; - - /* subscribe to vehicle status, attitude, sensors and flow*/ - struct actuator_armed_s armed; - memset(&armed, 0, sizeof(armed)); - struct vehicle_control_mode_s control_mode; - memset(&control_mode, 0, sizeof(control_mode)); - struct vehicle_attitude_s att; - memset(&att, 0, sizeof(att)); - struct vehicle_attitude_setpoint_s att_sp; - memset(&att_sp, 0, sizeof(att_sp)); - struct optical_flow_s flow; - memset(&flow, 0, sizeof(flow)); - - /* subscribe to parameter changes */ - int parameter_update_sub = orb_subscribe(ORB_ID(parameter_update)); - - /* subscribe to armed topic */ - int armed_sub = orb_subscribe(ORB_ID(actuator_armed)); - - /* subscribe to safety topic */ - int control_mode_sub = orb_subscribe(ORB_ID(vehicle_control_mode)); - - /* subscribe to attitude */ - int vehicle_attitude_sub = orb_subscribe(ORB_ID(vehicle_attitude)); - - /* subscribe to attitude setpoint */ - int vehicle_attitude_setpoint_sub = orb_subscribe(ORB_ID(vehicle_attitude_setpoint)); - - /* subscribe to optical flow*/ - int optical_flow_sub = orb_subscribe(ORB_ID(optical_flow)); - - /* init local position and filtered flow struct */ - struct vehicle_local_position_s local_pos = { - .x = 0.0f, - .y = 0.0f, - .z = 0.0f, - .vx = 0.0f, - .vy = 0.0f, - .vz = 0.0f - }; - struct filtered_bottom_flow_s filtered_flow = { - .sumx = 0.0f, - .sumy = 0.0f, - .vx = 0.0f, - .vy = 0.0f - }; - - /* advert pub messages */ - orb_advert_t local_pos_pub = orb_advertise(ORB_ID(vehicle_local_position), &local_pos); - orb_advert_t filtered_flow_pub = orb_advertise(ORB_ID(filtered_bottom_flow), &filtered_flow); - - /* vehicle flying status parameters */ - bool vehicle_liftoff = false; - bool sensors_ready = false; - - /* parameters init*/ - struct flow_position_estimator_params params; - struct flow_position_estimator_param_handles param_handles; - parameters_init(¶m_handles); - parameters_update(¶m_handles, ¶ms); - - perf_counter_t mc_loop_perf = perf_alloc(PC_ELAPSED, "flow_position_estimator_runtime"); - perf_counter_t mc_interval_perf = perf_alloc(PC_INTERVAL, "flow_position_estimator_interval"); - perf_counter_t mc_err_perf = perf_alloc(PC_COUNT, "flow_position_estimator_err"); - - while (!thread_should_exit) { - - if (sensors_ready) { - /*This runs at the rate of the sensors */ - struct pollfd fds[2] = { - { .fd = optical_flow_sub, .events = POLLIN }, - { .fd = parameter_update_sub, .events = POLLIN } - }; - - /* wait for a sensor update, check for exit condition every 500 ms */ - int ret = poll(fds, 2, 500); - - if (ret < 0) { - /* poll error, count it in perf */ - perf_count(mc_err_perf); - - } else if (ret == 0) { - /* no return value, ignore */ -// printf("[flow position estimator] no bottom flow.\n"); - } else { - - /* parameter update available? */ - if (fds[1].revents & POLLIN) { - /* read from param to clear updated flag */ - struct parameter_update_s update; - orb_copy(ORB_ID(parameter_update), parameter_update_sub, &update); - - parameters_update(¶m_handles, ¶ms); - printf("[flow position estimator] parameters updated.\n"); - } - - /* only if flow data changed */ - if (fds[0].revents & POLLIN) { - perf_begin(mc_loop_perf); - - orb_copy(ORB_ID(optical_flow), optical_flow_sub, &flow); - /* got flow, updating attitude and status as well */ - orb_copy(ORB_ID(vehicle_attitude), vehicle_attitude_sub, &att); - orb_copy(ORB_ID(vehicle_attitude_setpoint), vehicle_attitude_setpoint_sub, &att_sp); - orb_copy(ORB_ID(actuator_armed), armed_sub, &armed); - orb_copy(ORB_ID(vehicle_control_mode), control_mode_sub, &control_mode); - - /* vehicle state estimation */ - float sonar_new = flow.ground_distance_m; - - /* set liftoff boolean - * -> at bottom sonar sometimes does not work correctly, and has to be calibrated (distance higher than 0.3m) - * -> accept sonar measurements after reaching calibration distance (values between 0.3m and 1.0m for some time) - * -> minimum sonar value 0.3m - */ - - if (!vehicle_liftoff) { - if (armed.armed && att_sp.thrust > params.minimum_liftoff_thrust && sonar_new > 0.3f && sonar_new < 1.0f) { - vehicle_liftoff = true; - } - - } else { - if (!armed.armed || (att_sp.thrust < params.minimum_liftoff_thrust && sonar_new <= 0.3f)) { - vehicle_liftoff = false; - } - } - - /* calc dt between flow timestamps */ - /* ignore first flow msg */ - if (time_last_flow == 0) { - time_last_flow = flow.timestamp; - continue; - } - - dt = (float)(flow.timestamp - time_last_flow) * time_scale ; - time_last_flow = flow.timestamp; - - /* only make position update if vehicle is lift off or DEBUG is activated*/ - if (vehicle_liftoff || params.debug) { - /* copy flow */ - if (flow.integration_timespan > 0) { - flow_speed[0] = flow.pixel_flow_x_integral / (flow.integration_timespan / 1e6f) * flow.ground_distance_m; - flow_speed[1] = flow.pixel_flow_y_integral / (flow.integration_timespan / 1e6f) * flow.ground_distance_m; - - } else { - flow_speed[0] = 0; - flow_speed[1] = 0; - } - - flow_speed[2] = 0.0f; - - /* convert to bodyframe velocity */ - for (uint8_t i = 0; i < 3; i++) { - float sum = 0.0f; - - for (uint8_t j = 0; j < 3; j++) { - sum = sum + flow_speed[j] * rotM_flow_sensor[j][i]; - } - - speed[i] = sum; - } - - /* update filtered flow */ - filtered_flow.sumx = filtered_flow.sumx + speed[0] * dt; - filtered_flow.sumy = filtered_flow.sumy + speed[1] * dt; - filtered_flow.vx = speed[0]; - filtered_flow.vy = speed[1]; - - // TODO add yaw rotation correction (with distance to vehicle zero) - - /* convert to globalframe velocity - * -> local position is currently not used for position control - */ - for (uint8_t i = 0; i < 3; i++) { - float sum = 0.0f; - - for (uint8_t j = 0; j < 3; j++) { - sum = sum + speed[j] * PX4_R(att.R, i, j); - } - - global_speed[i] = sum; - } - - local_pos.x = local_pos.x + global_speed[0] * dt; - local_pos.y = local_pos.y + global_speed[1] * dt; - local_pos.vx = global_speed[0]; - local_pos.vy = global_speed[1]; - local_pos.xy_valid = true; - local_pos.v_xy_valid = true; - - } else { - /* set speed to zero and let position as it is */ - filtered_flow.vx = 0; - filtered_flow.vy = 0; - local_pos.vx = 0; - local_pos.vy = 0; - local_pos.xy_valid = false; - local_pos.v_xy_valid = false; - } - - /* filtering ground distance */ - if (!vehicle_liftoff || !armed.armed) { - /* not possible to fly */ - sonar_valid = false; - local_pos.z = 0.0f; - local_pos.z_valid = false; - - } else { - sonar_valid = true; - } - - if (sonar_valid || params.debug) { - /* simple lowpass sonar filtering */ - /* if new value or with sonar update frequency */ - if (sonar_new != sonar_last || counter % 10 == 0) { - sonar_lp = 0.05f * sonar_new + 0.95f * sonar_lp; - sonar_last = sonar_new; - } - - float height_diff = sonar_new - sonar_lp; - - /* if over 1/2m spike follow lowpass */ - if (height_diff < -params.sonar_lower_lp_threshold || height_diff > params.sonar_upper_lp_threshold) { - local_pos.z = -sonar_lp; - - } else { - local_pos.z = -sonar_new; - } - - local_pos.z_valid = true; - } - - filtered_flow.timestamp = hrt_absolute_time(); - local_pos.timestamp = hrt_absolute_time(); - - /* publish local position */ - if (isfinite(local_pos.x) && isfinite(local_pos.y) && isfinite(local_pos.z) - && isfinite(local_pos.vx) && isfinite(local_pos.vy)) { - orb_publish(ORB_ID(vehicle_local_position), local_pos_pub, &local_pos); - } - - /* publish filtered flow */ - if (isfinite(filtered_flow.sumx) && isfinite(filtered_flow.sumy) && isfinite(filtered_flow.vx) - && isfinite(filtered_flow.vy)) { - orb_publish(ORB_ID(filtered_bottom_flow), filtered_flow_pub, &filtered_flow); - } - - /* measure in what intervals the position estimator runs */ - perf_count(mc_interval_perf); - perf_end(mc_loop_perf); - - } - } - - } else { - /* sensors not ready waiting for first attitude msg */ - - /* polling */ - struct pollfd fds[1] = { - { .fd = vehicle_attitude_sub, .events = POLLIN }, - }; - - /* wait for a attitude message, check for exit condition every 5 s */ - int ret = poll(fds, 1, 5000); - - if (ret < 0) { - /* poll error, count it in perf */ - perf_count(mc_err_perf); - - } else if (ret == 0) { - /* no return value, ignore */ - printf("[flow position estimator] no attitude received.\n"); - - } else { - if (fds[0].revents & POLLIN) { - sensors_ready = true; - printf("[flow position estimator] initialized.\n"); - } - } - } - - counter++; - } - - printf("[flow position estimator] exiting.\n"); - thread_running = false; - - close(vehicle_attitude_setpoint_sub); - close(vehicle_attitude_sub); - close(armed_sub); - close(control_mode_sub); - close(parameter_update_sub); - close(optical_flow_sub); - - perf_print_counter(mc_loop_perf); - perf_free(mc_loop_perf); - - fflush(stdout); - return 0; -} - - diff --git a/src/examples/flow_position_estimator/flow_position_estimator_params.c b/src/examples/flow_position_estimator/flow_position_estimator_params.c deleted file mode 100644 index b565797874..0000000000 --- a/src/examples/flow_position_estimator/flow_position_estimator_params.c +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2008-2013 PX4 Development Team. All rights reserved. - * Author: Samuel Zihlmann - * Lorenz Meier - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/* - * @file flow_position_estimator_params.c - * - * Parameters for position estimator - */ - -#include "flow_position_estimator_params.h" - -/* Extended Kalman Filter covariances */ - -/* controller parameters */ -PARAM_DEFINE_FLOAT(FPE_LO_THRUST, 0.4f); -PARAM_DEFINE_FLOAT(FPE_SONAR_LP_U, 0.5f); -PARAM_DEFINE_FLOAT(FPE_SONAR_LP_L, 0.2f); -PARAM_DEFINE_INT32(FPE_DEBUG, 0); - - -int parameters_init(struct flow_position_estimator_param_handles *h) -{ - /* PID parameters */ - h->minimum_liftoff_thrust = param_find("FPE_LO_THRUST"); - h->sonar_upper_lp_threshold = param_find("FPE_SONAR_LP_U"); - h->sonar_lower_lp_threshold = param_find("FPE_SONAR_LP_L"); - h->debug = param_find("FPE_DEBUG"); - - return OK; -} - -int parameters_update(const struct flow_position_estimator_param_handles *h, struct flow_position_estimator_params *p) -{ - param_get(h->minimum_liftoff_thrust, &(p->minimum_liftoff_thrust)); - param_get(h->sonar_upper_lp_threshold, &(p->sonar_upper_lp_threshold)); - param_get(h->sonar_lower_lp_threshold, &(p->sonar_lower_lp_threshold)); - param_get(h->debug, &(p->debug)); - - return OK; -} diff --git a/src/examples/flow_position_estimator/flow_position_estimator_params.h b/src/examples/flow_position_estimator/flow_position_estimator_params.h deleted file mode 100644 index 3ab4e560fc..0000000000 --- a/src/examples/flow_position_estimator/flow_position_estimator_params.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2008-2013 PX4 Development Team. All rights reserved. - * Author: Samuel Zihlmann - * Lorenz Meier - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/* - * @file flow_position_estimator_params.h - * - * Parameters for position estimator - */ - -#include - -struct flow_position_estimator_params { - float minimum_liftoff_thrust; - float sonar_upper_lp_threshold; - float sonar_lower_lp_threshold; - int debug; -}; - -struct flow_position_estimator_param_handles { - param_t minimum_liftoff_thrust; - param_t sonar_upper_lp_threshold; - param_t sonar_lower_lp_threshold; - param_t debug; -}; - -/** - * Initialize all parameter handles and values - * - */ -int parameters_init(struct flow_position_estimator_param_handles *h); - -/** - * Update all parameters - * - */ -int parameters_update(const struct flow_position_estimator_param_handles *h, struct flow_position_estimator_params *p); diff --git a/src/examples/flow_position_estimator/module.mk b/src/examples/flow_position_estimator/module.mk deleted file mode 100644 index 5c6e29f8f6..0000000000 --- a/src/examples/flow_position_estimator/module.mk +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build position estimator -# - -MODULE_COMMAND = flow_position_estimator - -SRCS = flow_position_estimator_main.c \ - flow_position_estimator_params.c - -EXTRACFLAGS = -Wno-float-equal From 998acf4d0802fe031725ba17d339bab20fcaa677 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 09:53:59 +0200 Subject: [PATCH 109/389] Revert "Disable autostart for now so usb works." This reverts commit b2c67a4cf90b2db2ffbb1bb0453623ce12c4d66d. --- cmake/nuttx/px4_impl_nuttx.cmake | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 15a304fdb9..6c2dbaf25a 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -291,23 +291,21 @@ function(px4_nuttx_generate_romfs) set(romfs_pruner ${CMAKE_SOURCE_DIR}/Tools/px_romfs_pruner.py) set(bin_to_obj ${CMAKE_SOURCE_DIR}/cmake/nuttx/bin_to_obj.py) + #message(STATUS "temp_dir: ${romfs_temp_dir}") #message(STATUS "src_dir: ${romfs_src_dir}") add_custom_command(OUTPUT rc.autostart COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} - -a ${romfs_src_dir}/init.d + -a ${romfs_src_dir}/init.d/ -s rc.autostart ) add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} - # TODO XXX hack to get nsh to work, copying real - # autostart in currently makes nsh fail over usb - COMMAND cmake -E touch ${romfs_temp_dir}/init.d/rc.autostart - #COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d - #TODO add romfs cleanup of temp file .~, .swp etc + COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d + #TODO add romfs cleanup and pruning COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin From 849b61213ccefb84632cf07fc421c518c0167ad4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 10:51:52 +0200 Subject: [PATCH 110/389] commander: Remove unused error variable --- src/modules/commander/state_machine_helper.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index 9227a141de..1fa2e27a89 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -64,12 +64,6 @@ #include "commander_helper.h" #include "PreflightCheck.h" -/* oddly, ERROR is not defined for c++ */ -#ifdef ERROR -# undef ERROR -#endif -static const int ERROR = -1; - // This array defines the arming state transitions. The rows are the new state, and the columns // are the current state. Using new state and current state you can index into the array which // will be true for a valid transition or false for a invalid transition. In some cases even From d222f6e664823090263144daa932e03d9e8e28b1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 10:52:07 +0200 Subject: [PATCH 111/389] EKF: Remove unused error variable --- .../ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp index d89eab5299..17f7264a58 100644 --- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp +++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp @@ -105,12 +105,6 @@ uint64_t getMicros() namespace estimator { -/* oddly, ERROR is not defined for c++ */ -#ifdef ERROR -# undef ERROR -#endif -static const int ERROR = -1; - AttitudePositionEstimatorEKF *g_estimator = nullptr; } From 2be7b82256deaa13f4acf8874b7ff0ad22b058dd Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 10:52:22 +0200 Subject: [PATCH 112/389] Navigator: Remove unused error variable --- src/modules/navigator/mission_feasibility_checker.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/modules/navigator/mission_feasibility_checker.cpp b/src/modules/navigator/mission_feasibility_checker.cpp index a30060b27a..a31aa25805 100644 --- a/src/modules/navigator/mission_feasibility_checker.cpp +++ b/src/modules/navigator/mission_feasibility_checker.cpp @@ -51,12 +51,6 @@ #include #include -/* oddly, ERROR is not defined for c++ */ -#ifdef ERROR -# undef ERROR -#endif -static const int ERROR = -1; - MissionFeasibilityChecker::MissionFeasibilityChecker() : _mavlink_fd(-1), _capabilities_sub(-1), From ceb7204590a174cd437e8dca69f46c5f84f8dc03 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 10:52:44 +0200 Subject: [PATCH 113/389] POSIX sim: Remove unused error variables --- .../posix/drivers/airspeedsim/meas_airspeed_sim.cpp | 6 ------ src/platforms/posix/drivers/barosim/baro.cpp | 6 ------ 2 files changed, 12 deletions(-) diff --git a/src/platforms/posix/drivers/airspeedsim/meas_airspeed_sim.cpp b/src/platforms/posix/drivers/airspeedsim/meas_airspeed_sim.cpp index ec07a0ea89..3474b0bcaa 100644 --- a/src/platforms/posix/drivers/airspeedsim/meas_airspeed_sim.cpp +++ b/src/platforms/posix/drivers/airspeedsim/meas_airspeed_sim.cpp @@ -354,12 +354,6 @@ MEASAirspeedSim::voltage_correction(float &diff_press_pa, float &temperature) namespace meas_airspeed_sim { -/* oddly, ERROR is not defined for c++ */ -#ifdef ERROR -# undef ERROR -#endif -const int ERROR = -1; - MEASAirspeedSim *g_dev = nullptr; int start(int i2c_bus); diff --git a/src/platforms/posix/drivers/barosim/baro.cpp b/src/platforms/posix/drivers/barosim/baro.cpp index 1d4e63f94f..f69363fd40 100644 --- a/src/platforms/posix/drivers/barosim/baro.cpp +++ b/src/platforms/posix/drivers/barosim/baro.cpp @@ -72,12 +72,6 @@ enum BAROSIM_BUS { BAROSIM_BUS_SIM_EXTERNAL }; -/* oddly, ERROR is not defined for c++ */ -#ifdef ERROR -# undef ERROR -#endif -static const int ERROR = -1; - /* helper macro for handling report buffer indices */ #define INCREMENT(_x, _lim) do { __typeof__(_x) _tmp = _x+1; if (_tmp >= _lim) _tmp = 0; _x = _tmp; } while(0) From 4bc44841f6fea727249442aff8eb6f525f1e6aa3 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 11:25:48 +0200 Subject: [PATCH 114/389] CMAKE: Move flags to general location, disable sections for linker on Mac OS --- cmake/common/px4_base.cmake | 16 ++++++++++----- cmake/toolchains/Toolchain-native.cmake | 2 +- src/firmware/posix/CMakeLists.txt | 26 +++++++++++++++++++------ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 66be1acbe5..492e02ae4b 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -498,6 +498,7 @@ function(px4_add_common_flags) -Werror=reorder -Werror=uninitialized -Werror=init-self + -Wno-unused-const-variable #-Wcast-qual - generates spurious noreturn attribute warnings, # try again later #-Wconversion - would be nice, but too many "risky-but-safe" @@ -508,7 +509,6 @@ function(px4_add_common_flags) if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") list(APPEND warnings - -Wno-unused-const-variable -Werror=unused-but-set-variable -Wformat=1 #-Wlogical-op # very verbose due to eigen @@ -618,10 +618,16 @@ function(px4_add_common_flags) -DCONFIG_ARCH_BOARD_${board_config} ) - set(added_exe_link_flags - -Wl,--warn-common - -Wl,--gc-sections - ) + if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + set(added_exe_link_flags + -Wl,--warn-common + -Wl,--gc-sections + ) + else() + set(added_exe_link_flags + -Wl,--warn-common + ) + endif() # output foreach(var ${inout_vars}) diff --git a/cmake/toolchains/Toolchain-native.cmake b/cmake/toolchains/Toolchain-native.cmake index e7792a5f87..0f9ad12f14 100644 --- a/cmake/toolchains/Toolchain-native.cmake +++ b/cmake/toolchains/Toolchain-native.cmake @@ -1,5 +1,5 @@ # compiler tools -foreach(tool objcopy nm ld) +foreach(tool nm ld) string(TOUPPER ${tool} TOOL) find_program(${TOOL} ${tool}) if(NOT ${TOOL}) diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index bc557ce6f7..1ac73ba682 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -13,11 +13,25 @@ add_executable(mainapp apps.h ) -target_link_libraries(mainapp - -Wl,--start-group - ${module_libraries} - pthread m rt - -Wl,--end-group - ) +if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + target_link_libraries(mainapp + -Wl,--start-group + ${module_libraries} + pthread m rt + -Wl,--end-group + ) +else() + if (APPLE) + target_link_libraries(mainapp + ${module_libraries} + pthread m + ) + else() + target_link_libraries(mainapp + ${module_libraries} + pthread m rt + ) + endif() +endif() # vim: set noet ft=cmake fenc=utf-8 ff=unix : From c5d1cb1cbc6dc714d4d151d3601ad2649ca29878 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 11:26:20 +0200 Subject: [PATCH 115/389] Params: Remove linker black magic and turn params into flat global struct --- Tools/px_generate_params.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Tools/px_generate_params.py b/Tools/px_generate_params.py index c73b842875..2642206f3c 100755 --- a/Tools/px_generate_params.py +++ b/Tools/px_generate_params.py @@ -19,7 +19,9 @@ header = """ #include // DO NOT EDIT -// This file is autogenerated from paramaters.xml +// This file is autogenerated from parameters.xml + +__BEGIN_DECLS struct px4_parameters_t { """ @@ -52,11 +54,11 @@ src = """ // DO NOT EDIT // This file is autogenerated from paramaters.xml -static const +const #ifndef __PX4_DARWIN __attribute__((used, section("__param"))) #endif -struct px4_parameters_t px4_parameters_impl = { +struct px4_parameters_t px4_parameters = { """ i=0 for group in root: @@ -81,13 +83,10 @@ src += """ %d }; -#ifdef __PX4_DARWIN -#define ___param__attributes -#else -#define ___param__attributes __attribute__((alias("px4_parameters_impl"))) -#endif +//extern const struct px4_parameters_t px4_parameters; + +__END_DECLS -extern const struct px4_parameters_t px4_parameters ___param__attributes; """ % i fp_header.write(header) From c19fa0c8225b2ca3292938783f9ef05731f978d1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 12:06:45 +0200 Subject: [PATCH 116/389] Revert "Revert "Disable autostart for now so usb works."" This reverts commit 998acf4d0802fe031725ba17d339bab20fcaa677. --- cmake/nuttx/px4_impl_nuttx.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 6c2dbaf25a..15a304fdb9 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -291,21 +291,23 @@ function(px4_nuttx_generate_romfs) set(romfs_pruner ${CMAKE_SOURCE_DIR}/Tools/px_romfs_pruner.py) set(bin_to_obj ${CMAKE_SOURCE_DIR}/cmake/nuttx/bin_to_obj.py) - #message(STATUS "temp_dir: ${romfs_temp_dir}") #message(STATUS "src_dir: ${romfs_src_dir}") add_custom_command(OUTPUT rc.autostart COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} - -a ${romfs_src_dir}/init.d/ + -a ${romfs_src_dir}/init.d -s rc.autostart ) add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} - COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d - #TODO add romfs cleanup and pruning + # TODO XXX hack to get nsh to work, copying real + # autostart in currently makes nsh fail over usb + COMMAND cmake -E touch ${romfs_temp_dir}/init.d/rc.autostart + #COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d + #TODO add romfs cleanup of temp file .~, .swp etc COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin From 779efc1cbc3feb0df01a3901a374b15123afb6e4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 12:11:17 +0200 Subject: [PATCH 117/389] POSIX: Fix shell printing --- src/platforms/posix/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platforms/posix/main.cpp b/src/platforms/posix/main.cpp index be2eae5090..82c6f0cbfa 100644 --- a/src/platforms/posix/main.cpp +++ b/src/platforms/posix/main.cpp @@ -67,7 +67,9 @@ extern "C" { static void print_prompt() { + cout.flush(); cout << "pxh> "; + cout.flush(); } static void run_cmd(const vector &appargs) From 7f41238f706693c423e50b21ed01d5eb7309b9f1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 13:35:48 +0200 Subject: [PATCH 118/389] POSIX: Add usleep shell command, add cout flush to exit command --- Tools/posix_apps.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Tools/posix_apps.py b/Tools/posix_apps.py index b7ddbc210c..c8f2c31de9 100755 --- a/Tools/posix_apps.py +++ b/Tools/posix_apps.py @@ -98,7 +98,9 @@ static void list_builtins(void) static int shutdown_main(int argc, char *argv[]) { - cout << "Shutting down" << endl; + cout.flush(); + cout << endl << "Shutting down" << endl; + cout.flush(); exit(0); } @@ -133,5 +135,14 @@ static int sleep_main(int argc, char *argv[]) sleep(atoi(argv[1])); return 0; } +static int usleep_main(int argc, char *argv[]) +{ + if (argc != 2) { + cout << "Usage: usleep " << endl; + return 1; + } + usleep(atoi(argv[1])); + return 0; +} """) From 05c7a0683dbd600de38942d50ed0f4d14becc2b0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 15:44:05 +0200 Subject: [PATCH 119/389] Re-add missing ease-of-use make targets --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index e5d4dc01af..4f60d249fb 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,17 @@ posix_sitl_simple: qurt_eagle_travis: $(call cmake-build,$@) +posix: posix_sitl_simple + +sitl_quad: + Tools/sitl_run.sh posix-configs/SITL/init/rcS + +sitl_plane: + Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing + +sitl_ros: + Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros + # Other targets # -------------------------------------------------------------------- # explicity set default build target From d2f7f6e7a987e28ee5cf7792b32acc0345e92d91 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 15:44:16 +0200 Subject: [PATCH 120/389] Update SITL run tool --- Tools/sitl_run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 3c65aa4eec..2f105aab99 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -1,5 +1,5 @@ #!/bin/bash -mkdir -p Build/posix_sitl.build/rootfs/fs/microsd -mkdir -p Build/posix_sitl.build/rootfs/eeprom -cd Build/posix_sitl.build && ./mainapp ../../$1 +mkdir -p build_posix_sitl_simple/rootfs/fs/microsd +mkdir -p build_posix_sitl_simple/rootfs/eeprom +cd build_posix_sitl_simple/src/firmware/posix && ./mainapp ../../../../$1 From 0597c57c32990689a03e852965cd216c909680d3 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 15:44:40 +0200 Subject: [PATCH 121/389] Simulator: Provide better and more user-facing feedback --- src/modules/simulator/simulator.cpp | 1 - src/modules/simulator/simulator_mavlink.cpp | 21 +++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/simulator/simulator.cpp b/src/modules/simulator/simulator.cpp index 5d9e29be3a..3ec3b305f8 100644 --- a/src/modules/simulator/simulator.cpp +++ b/src/modules/simulator/simulator.cpp @@ -120,7 +120,6 @@ int Simulator::start(int argc, char *argv[]) int ret = 0; _instance = new Simulator(); if (_instance) { - PX4_INFO("Simulator started"); drv_led_start(); if (argv[2][1] == 's') { _instance->initializeSensorData(); diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index e9844ee54a..81f5bf39eb 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -409,15 +409,16 @@ void Simulator::pollForMAVLinkMessages(bool publish) int serial_fd = openUart(PIXHAWK_DEVICE, 115200); if (serial_fd < 0) { - PX4_WARN("failed to open %s", PIXHAWK_DEVICE); - } + PX4_INFO("Not using %s for radio control input. Assuming joystick input via MAVLink.", PIXHAWK_DEVICE); + } else { - // tell the device to stream some messages - char command[] = "\nsh /etc/init.d/rc.usb\n"; - int w = ::write(serial_fd, command, sizeof(command)); + // tell the device to stream some messages + char command[] = "\nsh /etc/init.d/rc.usb\n"; + int w = ::write(serial_fd, command, sizeof(command)); - if (w <= 0) { - PX4_WARN("failed to send streaming command to %s", PIXHAWK_DEVICE); + if (w <= 0) { + PX4_WARN("failed to send streaming command to %s", PIXHAWK_DEVICE); + } } char serial_buf[1024]; @@ -433,18 +434,18 @@ void Simulator::pollForMAVLinkMessages(bool publish) // wait for first data from simulator and respond with first controls // this is important for the UDP communication to work int pret = -1; - PX4_WARN("Waiting for initial data on UDP.. Please connect the simulator first."); + PX4_INFO("Waiting for initial data on UDP. Please start the flight simulator to proceed.."); while (pret <= 0) { pret = ::poll(&fds[0], (sizeof(fds[0])/sizeof(fds[0])), 100); } - PX4_WARN("Found initial message, pret = %d",pret); + PX4_INFO("Found initial message, pret = %d",pret); _initialized = true; // reset system time (void)hrt_reset(); if (fds[0].revents & POLLIN) { len = recvfrom(_fd, _buf, sizeof(_buf), 0, (struct sockaddr *)&_srcaddr, &_addrlen); - PX4_WARN("Sending initial controls message to jMAVSim."); + PX4_INFO("Sending initial controls message to jMAVSim."); send_controls(); } From 63f9a1e609c8055bbee49c8ee9e207d5ca73c3af Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 15:45:19 +0200 Subject: [PATCH 122/389] POSIX: 1) Really exit on CTRL-C, 2) Clean up boot log, 3) add eye-candy! --- src/platforms/posix/main.cpp | 5 ++++- src/platforms/posix/px4_layer/px4_posix_impl.cpp | 15 +++++++++++++-- src/platforms/posix/px4_layer/px4_posix_tasks.cpp | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/platforms/posix/main.cpp b/src/platforms/posix/main.cpp index 82c6f0cbfa..b0e782d4b0 100644 --- a/src/platforms/posix/main.cpp +++ b/src/platforms/posix/main.cpp @@ -61,7 +61,10 @@ extern "C" { void _SigIntHandler(int sig_num); void _SigIntHandler(int sig_num) { - _ExitFlag = true; + cout.flush(); + cout << endl << "Exiting.." << endl; + cout.flush(); + _exit(0); } } diff --git a/src/platforms/posix/px4_layer/px4_posix_impl.cpp b/src/platforms/posix/px4_layer/px4_posix_impl.cpp index 37132a0641..faf3b81990 100644 --- a/src/platforms/posix/px4_layer/px4_posix_impl.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_impl.cpp @@ -86,7 +86,7 @@ void init_once(void); void init_once(void) { _shell_task_id = pthread_self(); - PX4_INFO("Shell id is %lu", _shell_task_id); + printf("[init] shell id: %lu\n", _shell_task_id); work_queues_init(); hrt_work_queue_init(); hrt_init(); @@ -94,7 +94,18 @@ void init_once(void) void init(int argc, char *argv[], const char *app_name) { - printf("App name: %s\n", app_name); + printf("[init] task name: %s\n", app_name); + printf("\n"); + printf("______ __ __ ___ \n"); + printf("| ___ \\ \\ \\ / / / |\n"); + printf("| |_/ / \\ V / / /| |\n"); + printf("| __/ / \\ / /_| |\n"); + printf("| | / /^\\ \\ \\___ |\n"); + printf("\\_| \\/ \\/ |_/\n"); + printf("\n"); + printf("Ready to fly.\n"); + printf("\n"); + printf("\n"); } uint64_t get_time_micros() diff --git a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp b/src/platforms/posix/px4_layer/px4_posix_tasks.cpp index c8f8d801c5..de929e3a70 100644 --- a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_tasks.cpp @@ -135,7 +135,7 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int taskdata->argc = argc; for (i=0; iargv[i] = (char *)offset; strcpy((char *)offset, argv[i]); offset+=strlen(argv[i])+1; From 4fb6e135d6af0ac74dba692fb54171c400d0d0d6 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 16:57:50 +0200 Subject: [PATCH 123/389] param: report open failure --- src/systemcmds/param/param.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index 69d56dffcd..7c5b4e8cc6 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -244,7 +244,7 @@ do_load(const char *param_file_name) int fd = open(param_file_name, O_RDONLY); if (fd < 0) { - warn("open '%s'", param_file_name); + warn("open failed '%s'", param_file_name); return 1; } From 12372d7de6456d9c72d18bef06632acc47e6ca85 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 16:58:14 +0200 Subject: [PATCH 124/389] POSIX: Abort script on executable failure --- src/platforms/posix/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platforms/posix/main.cpp b/src/platforms/posix/main.cpp index b0e782d4b0..564a89ddb9 100644 --- a/src/platforms/posix/main.cpp +++ b/src/platforms/posix/main.cpp @@ -91,7 +91,11 @@ static void run_cmd(const vector &appargs) } arg[i] = (char *)0; - apps[command](i, (char **)arg); + int retval = apps[command](i, (char **)arg); + + if (retval) { + exit(retval); + } usleep(65000); } else if (command.compare("help") == 0) { From b528ecaa93501ec8b187849e9e5a537dfbb00eee Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 17:02:42 +0200 Subject: [PATCH 125/389] SITL RUN: Fix paths --- Tools/sitl_run.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 2f105aab99..58ed4f6dd5 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -1,5 +1,7 @@ #!/bin/bash -mkdir -p build_posix_sitl_simple/rootfs/fs/microsd -mkdir -p build_posix_sitl_simple/rootfs/eeprom -cd build_posix_sitl_simple/src/firmware/posix && ./mainapp ../../../../$1 +cd build_posix_sitl_simple/src/firmware/posix +mkdir -p rootfs/fs/microsd +mkdir -p rootfs/eeprom +touch rootfs/eeprom/parameters +./mainapp ../../../../$1 From e697cabb6ad3c2ac8704aadf22f132b32a095ae5 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 12 Sep 2015 17:12:16 +0200 Subject: [PATCH 126/389] POSIX: Exit on failure if not running as daemon. This is to ensure errors do not go unnoticed during bench testing --- src/platforms/posix/main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/platforms/posix/main.cpp b/src/platforms/posix/main.cpp index 564a89ddb9..8199c321b5 100644 --- a/src/platforms/posix/main.cpp +++ b/src/platforms/posix/main.cpp @@ -75,7 +75,7 @@ static void print_prompt() cout.flush(); } -static void run_cmd(const vector &appargs) +static void run_cmd(const vector &appargs, bool exit_on_fail) { // command is appargs[0] string command = appargs[0]; @@ -93,7 +93,7 @@ static void run_cmd(const vector &appargs) arg[i] = (char *)0; int retval = apps[command](i, (char **)arg); - if (retval) { + if (exit_on_fail && retval) { exit(retval); } usleep(65000); @@ -122,13 +122,13 @@ static void usage() cout << " -h - help/usage information" << std::endl; } -static void process_line(string &line) +static void process_line(string &line, bool exit_on_fail) { vector appargs(8); stringstream(line) >> appargs[0] >> appargs[1] >> appargs[2] >> appargs[3] >> appargs[4] >> appargs[5] >> appargs[6] >> appargs[7]; - run_cmd(appargs); + run_cmd(appargs, exit_on_fail); } int main(int argc, char **argv) @@ -184,7 +184,7 @@ int main(int argc, char **argv) if (infile.is_open()) { for (string line; getline(infile, line, '\n');) { - process_line(line); + process_line(line, !daemon_mode); } } else { @@ -207,7 +207,7 @@ int main(int argc, char **argv) if (ret > 0) { getline(cin, mystr); - process_line(mystr); + process_line(mystr, !daemon_mode); mystr = ""; } } @@ -221,10 +221,10 @@ int main(int argc, char **argv) if (px4_task_is_running("muorb")) { // sending muorb stop is needed if it is running to exit cleanly vector muorb_stop_cmd = { "muorb", "stop" }; - run_cmd(muorb_stop_cmd); + run_cmd(muorb_stop_cmd, !daemon_mode); } vector shutdown_cmd = { "shutdown" }; - run_cmd(shutdown_cmd); + run_cmd(shutdown_cmd, true); } } From 3da0a2bf4fca5a321431d2daa13564e5d985ee97 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Sat, 12 Sep 2015 11:22:13 -0700 Subject: [PATCH 127/389] Remove policy that broke posix and fix gcc warning A Clang only flag was set for all builds. Signed-off-by: Mark Charlebois --- CMakeLists.txt | 1 - cmake/common/px4_base.cmake | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 041966b1d0..116897c584 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,6 @@ project(px4 CXX C ASM) if (NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) cmake_policy(SET CMP0045 NEW) # error on non-existent target in get prop cmake_policy(SET CMP0046 NEW) # no non-existent targets as dependencies - cmake_policy(SET CMP0054 NEW) # don't dereference quoted variables endif() set(version_major 1) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 492e02ae4b..73a73d21e8 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -498,7 +498,6 @@ function(px4_add_common_flags) -Werror=reorder -Werror=uninitialized -Werror=init-self - -Wno-unused-const-variable #-Wcast-qual - generates spurious noreturn attribute warnings, # try again later #-Wconversion - would be nice, but too many "risky-but-safe" @@ -507,7 +506,11 @@ function(px4_add_common_flags) # but generates too many false positives ) - if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + list(APPEND warnings + -Wno-unused-const-variable + ) + else(${CMAKE_C_COMPILER_ID} STREQUAL "Clang") list(APPEND warnings -Werror=unused-but-set-variable -Wformat=1 From 7e41260135fa38d5f1646aefeff0b158fc5e8f8b Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 14:51:42 -0400 Subject: [PATCH 128/389] Fix policy version number. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 041966b1d0..736dd6f9b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,8 @@ project(px4 CXX C ASM) if (NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) cmake_policy(SET CMP0045 NEW) # error on non-existent target in get prop cmake_policy(SET CMP0046 NEW) # no non-existent targets as dependencies +endif() +if (NOT ${CMAKE_VERSION} VERSION_LESS 3.1.0) cmake_policy(SET CMP0054 NEW) # don't dereference quoted variables endif() From d4a16a68acb757f80431eb679e74da0b8a2418d6 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 15:47:23 -0400 Subject: [PATCH 129/389] Fixed confusing else clause, added to coding standard. --- CMakeLists.txt | 20 ++++++++++++++++++++ cmake/common/px4_base.cmake | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 736dd6f9b7..0708f5cb6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,26 @@ # # * All cmake functions are lowercase. # +# * For else, endif, endfunction, etc, never put the name of the statement +# +# Instead of the very confusing: +# if (${var} STREQUAL "1") <-- condition now becomes if name +# # do somthing +# elseif (${var} STREQUAL "2") <-- another condition +# # do somthing +# else (${var} STREQUAL "1") <-- tags is referring to name of if +# # do somthing +# endif (${var} STREQUAL "1") <-- tag is referring to name of +# +# Do this: +# if (${var} STREQUAL "1") <-- condition now becomes if name +# # do somthing +# elseif (${var} STREQUAL "2") <-- another condition +# # do somthing +# else () <-- leave blank +# # do somthing +# endif () <-- leave blank +# # Functions/Macros # --------------------------------------------------------------------------- # diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 73a73d21e8..be3d449710 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -510,7 +510,7 @@ function(px4_add_common_flags) list(APPEND warnings -Wno-unused-const-variable ) - else(${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + else() list(APPEND warnings -Werror=unused-but-set-variable -Wformat=1 From 3343d96a087fb5243b355d74aec8112cce55d986 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 15:59:33 -0400 Subject: [PATCH 130/389] Fixed readme typo. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0708f5cb6b..e547333c87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,9 +60,9 @@ # # do somthing # elseif (${var} STREQUAL "2") <-- another condition # # do somthing -# else (${var} STREQUAL "1") <-- tags is referring to name of if +# else (${var} STREQUAL "1") <-- tag is referring to name of if # # do somthing -# endif (${var} STREQUAL "1") <-- tag is referring to name of +# endif (${var} STREQUAL "1") <-- tag is referring to name of if # # Do this: # if (${var} STREQUAL "1") <-- condition now becomes if name From 3203f9ac9e730be8afe3036bde4d62dce006ecb6 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 13 Sep 2015 14:31:58 -0400 Subject: [PATCH 131/389] Improvements to make support, added debug target. --- CMakeLists.txt | 1 + Makefile | 20 +++++++++++-------- cmake/common/px4_base.cmake | 2 ++ cmake/nuttx/bin_to_obj.py | 17 ++++++++++++---- .../toolchains/Toolchain-arm-none-eabi.cmake | 2 +- src/firmware/nuttx/CMakeLists.txt | 15 +++++++++++++- src/firmware/nuttx/gdbinit.in | 7 +++++++ 7 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 src/firmware/nuttx/gdbinit.in diff --git a/CMakeLists.txt b/CMakeLists.txt index e547333c87..9f04b1fdd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,6 +126,7 @@ file(GLOB_RECURSE configs RELATIVE cmake/configs "cmake/configs/*.cmake") set_property(CACHE CONFIG PROPERTY STRINGS ${configs}) set(THREADS "4" CACHE STRING "number of threads to use for external build processes") +set(DEBUG_PORT "/dev/ttyACM0" CACHE STRING "debugging port") #============================================================================= # configuration diff --git a/Makefile b/Makefile index 4f60d249fb..9dd4fa24a5 100644 --- a/Makefile +++ b/Makefile @@ -54,16 +54,22 @@ # rest are arguments to pass to the makefile generated # by cmake in the subdirectory ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) -j ?= 1 +j ?= 4 # Functions # -------------------------------------------------------------------- -# define a make function to describe how to build a cmake config +# describe how to build a cmake config define cmake-build +mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -DCONFIG=$(1) -+make -C $(PWD)/build_$@ --no-print-directory $(ARGS) ++make -j$(j) -C $(PWD)/build_$@ --no-print-directory $(ARGS) endef +# create empty targets to avoid msgs for targets passed to cmake +define cmake-targ +$(1): + @# +.PHONY: $(1) +endef # ADD CONFIGS HERE # -------------------------------------------------------------------- @@ -104,12 +110,10 @@ clean: rm -rf build_*/ # targets handled by cmake -test: ; -upload: ; -package: ; -package_source: ; +cmake_targets = test upload packag package_source debug check_weak +$(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ)))) -.PHONY: clean test upload package package_source +.PHONY: clean CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~") diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index be3d449710..7e8ddabee0 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -551,6 +551,7 @@ function(px4_add_common_flags) endif() set(c_compile_flags + -g3 -std=gnu99 -fno-common ) @@ -559,6 +560,7 @@ function(px4_add_common_flags) -Wno-missing-field-initializers ) set(cxx_compile_flags + -g3 -fno-exceptions -fno-rtti -std=gnu++0x diff --git a/cmake/nuttx/bin_to_obj.py b/cmake/nuttx/bin_to_obj.py index 07c81edcde..a4ad3d94df 100755 --- a/cmake/nuttx/bin_to_obj.py +++ b/cmake/nuttx/bin_to_obj.py @@ -55,10 +55,19 @@ run_cmd("{ld:s} -r -o {obj:s}.bin.o {obj:s}.c.o -b binary {in_bin:s}", # get size of image stdout = run_cmd("{nm:s} -p --radix=x {obj:s}.bin.o", locals()) -re_size = re.compile("(^[0-9A-Fa-f]*) .*{sym:s}_size".format( - **locals())) -size_match = re.match(re_size, stdout) -size = size_match.group(1) +re_string = r"^([0-9A-F-a-f]+) .*{sym:s}_size\n".format(**locals()) +re_size = re.compile(re_string, re.MULTILINE) +size_match = re.search(re_size, stdout) +try: + size = size_match.group(1) +except AttributeError as e: + raise RuntimeError("{:s}\nre:{:s}\n{:s}".format( + e, re_string, stdout)) +except IndexError as e: + group0 = size_match.group(0) + raise RuntimeError("{:s}\ngroup 0:{:s}\n{:s}".format( + e, group0, stdout)) + #print("romfs size: ", size) # write size to file diff --git a/cmake/toolchains/Toolchain-arm-none-eabi.cmake b/cmake/toolchains/Toolchain-arm-none-eabi.cmake index 13514080ad..5fab42f3c2 100644 --- a/cmake/toolchains/Toolchain-arm-none-eabi.cmake +++ b/cmake/toolchains/Toolchain-arm-none-eabi.cmake @@ -37,7 +37,7 @@ endif() cmake_force_cxx_compiler(${CXX_COMPILER} GNU) # compiler tools -foreach(tool objcopy nm ld) +foreach(tool objcopy nm ld gdb) string(TOUPPER ${tool} TOOL) find_program(${TOOL} arm-none-eabi-${tool}) if(NOT ${TOOL}) diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 83d4a8ea14..8cf5e64b3b 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -31,11 +31,24 @@ target_link_libraries(firmware_nuttx 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 + ) + px4_nuttx_add_firmware(OUT ${fw_file} - EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx + EXE firmware_nuttx ${config_firmware_options} ) +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 + ) + px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${fw_file}) diff --git a/src/firmware/nuttx/gdbinit.in b/src/firmware/nuttx/gdbinit.in new file mode 100644 index 0000000000..a927caeed0 --- /dev/null +++ b/src/firmware/nuttx/gdbinit.in @@ -0,0 +1,7 @@ +target extended ${DEBUG_PORT} +monitor swdp_scan +attach 1 +monitor vector_catch disable hard +set mem inaccessible-by-default off +set print pretty +source Debug/PX4 From e55af002222e7986e3a2986f9560ee5609004ba4 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 13 Sep 2015 13:58:44 -0400 Subject: [PATCH 132/389] Removed weak attributes. --- src/drivers/boards/aerocore/aerocore_spi.c | 2 +- src/drivers/boards/px4fmu-v1/px4fmu_spi.c | 2 +- src/drivers/boards/px4fmu-v2/px4fmu_spi.c | 2 +- src/drivers/hmc5883/hmc5883.h | 4 ++-- src/drivers/ms5611/ms5611.h | 6 +++--- src/modules/uORB/uORB.h | 10 ++-------- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/drivers/boards/aerocore/aerocore_spi.c b/src/drivers/boards/aerocore/aerocore_spi.c index 5a4dd15b26..1ce3f35f88 100644 --- a/src/drivers/boards/aerocore/aerocore_spi.c +++ b/src/drivers/boards/aerocore/aerocore_spi.c @@ -67,7 +67,7 @@ * ************************************************************************************/ -__EXPORT void weak_function stm32_spiinitialize(void) +__EXPORT void stm32_spiinitialize(void) { #ifdef CONFIG_STM32_SPI1 stm32_configgpio(GPIO_SPI1_NSS); diff --git a/src/drivers/boards/px4fmu-v1/px4fmu_spi.c b/src/drivers/boards/px4fmu-v1/px4fmu_spi.c index 8ef17c36ed..2a444796ff 100644 --- a/src/drivers/boards/px4fmu-v1/px4fmu_spi.c +++ b/src/drivers/boards/px4fmu-v1/px4fmu_spi.c @@ -67,7 +67,7 @@ * ************************************************************************************/ -__EXPORT void weak_function stm32_spiinitialize(void) +__EXPORT void stm32_spiinitialize(void) { stm32_configgpio(GPIO_SPI_CS_GYRO); stm32_configgpio(GPIO_SPI_CS_ACCEL); diff --git a/src/drivers/boards/px4fmu-v2/px4fmu_spi.c b/src/drivers/boards/px4fmu-v2/px4fmu_spi.c index 64b9926b8d..a380e05bd5 100644 --- a/src/drivers/boards/px4fmu-v2/px4fmu_spi.c +++ b/src/drivers/boards/px4fmu-v2/px4fmu_spi.c @@ -67,7 +67,7 @@ * ************************************************************************************/ -__EXPORT void weak_function stm32_spiinitialize(void) +__EXPORT void stm32_spiinitialize(void) { #ifdef CONFIG_STM32_SPI1 stm32_configgpio(GPIO_SPI_CS_GYRO); diff --git a/src/drivers/hmc5883/hmc5883.h b/src/drivers/hmc5883/hmc5883.h index 9607fe6149..4cef0aa8cf 100644 --- a/src/drivers/hmc5883/hmc5883.h +++ b/src/drivers/hmc5883/hmc5883.h @@ -48,6 +48,6 @@ #define ID_C_WHO_AM_I '3' /* interface factories */ -extern device::Device *HMC5883_SPI_interface(int bus) weak_function; -extern device::Device *HMC5883_I2C_interface(int bus) weak_function; +extern device::Device *HMC5883_SPI_interface(int bus); +extern device::Device *HMC5883_I2C_interface(int bus); typedef device::Device *(*HMC5883_constructor)(int); diff --git a/src/drivers/ms5611/ms5611.h b/src/drivers/ms5611/ms5611.h index a7e305b2aa..cc3e4c5920 100644 --- a/src/drivers/ms5611/ms5611.h +++ b/src/drivers/ms5611/ms5611.h @@ -80,7 +80,7 @@ extern bool crc4(uint16_t *n_prom); } /* namespace */ /* interface factories */ -extern device::Device *MS5611_spi_interface(ms5611::prom_u &prom_buf, uint8_t busnum) __attribute__((weak)); -extern device::Device *MS5611_i2c_interface(ms5611::prom_u &prom_buf, uint8_t busnum) __attribute__((weak)); -extern device::Device *MS5611_sim_interface(ms5611::prom_u &prom_buf, uint8_t busnum) __attribute__((weak)); +extern device::Device *MS5611_spi_interface(ms5611::prom_u &prom_buf, uint8_t busnum); +extern device::Device *MS5611_i2c_interface(ms5611::prom_u &prom_buf, uint8_t busnum); +extern device::Device *MS5611_sim_interface(ms5611::prom_u &prom_buf, uint8_t busnum); typedef device::Device *(*MS5611_constructor)(ms5611::prom_u &prom_buf, uint8_t busnum); diff --git a/src/modules/uORB/uORB.h b/src/modules/uORB/uORB.h index c887925fcf..6ead26186b 100644 --- a/src/modules/uORB/uORB.h +++ b/src/modules/uORB/uORB.h @@ -89,20 +89,14 @@ enum ORB_PRIO { /** * Declare (prototype) the uORB metadata for a topic. * - * Note that optional topics are declared weak; this allows a potential - * subscriber to attempt to subscribe to a topic that is not known to the - * system at runtime. The ORB_ID() macro will return NULL/nullptr for - * such a topic, and attempts to advertise or subscribe to it will - * return -1/ENOENT (see below). - * * @param _name The name of the topic. */ #if defined(__cplusplus) # define ORB_DECLARE(_name) extern "C" const struct orb_metadata __orb_##_name __EXPORT -# define ORB_DECLARE_OPTIONAL(_name) extern "C" const struct orb_metadata __orb_##_name __EXPORT __attribute__((weak)) +# define ORB_DECLARE_OPTIONAL(_name) extern "C" const struct orb_metadata __orb_##_name __EXPORT #else # define ORB_DECLARE(_name) extern const struct orb_metadata __orb_##_name __EXPORT -# define ORB_DECLARE_OPTIONAL(_name) extern const struct orb_metadata __orb_##_name __EXPORT __attribute__((weak)) +# define ORB_DECLARE_OPTIONAL(_name) extern const struct orb_metadata __orb_##_name __EXPORT #endif /** From 517e3663d36112e65613a5881b2858d97f87d0b5 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 13 Sep 2015 13:53:47 -0400 Subject: [PATCH 133/389] travis-ci add osx --- .travis.yml | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 498dcf28b3..56f6891cdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,12 @@ language: cpp -# use travis-ci docker based infrastructure -sudo: false +matrix: + include: + - os: linux + sudo: false + - os: osx + osx_image: beta-xcode6.3 cache: directories: @@ -32,17 +36,34 @@ addons: - texinfo - zlib1g-dev +before_install: + - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + pushd . + && cd ~ + && wget https://launchpadlibrarian.net/186124160/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 + && tar -jxf gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 + && exportline="export PATH=$HOME/gcc-arm-none-eabi-4_8-2014q3/bin:\$PATH" + && if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi + && . ~/.profile + && popd + && mkdir -p ~/bin + && wget -O ~/bin/astyle https://github.com/PX4/astyle/releases/download/2.05.1/astyle-linux && chmod +x ~/bin/astyle + && astyle --version + && if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi + ; + elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then + brew tap PX4/homebrew-px4 + && brew update + && brew install genromfs + && brew install kconfig-frontends + && brew install gcc-arm-none-eabi + && brew install astyle + && sudo easy_install pip + && sudo pip install pyserial empy + ; + fi + before_script: - - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi -# General toolchain dependencies - - pushd . - - cd ~ - - wget https://launchpadlibrarian.net/186124160/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 - - tar -jxf gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 - - exportline="export PATH=$HOME/gcc-arm-none-eabi-4_8-2014q3/bin:\$PATH" - - if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi - - . ~/.profile - - popd # setup ccache - mkdir -p ~/bin - ln -s /usr/bin/ccache ~/bin/arm-none-eabi-g++ @@ -56,9 +77,6 @@ before_script: - ln -s /usr/bin/ccache ~/bin/g++-4.8 - ln -s /usr/bin/ccache ~/bin/gcc-4.8 - export PATH=~/bin:$PATH -# grab astyle 2.05.1 - - wget -O ~/bin/astyle https://github.com/PX4/astyle/releases/download/2.05.1/astyle-linux && chmod +x ~/bin/astyle - - astyle --version env: global: @@ -70,11 +88,9 @@ env: script: #- make check_format - - ccache -z - arm-none-eabi-gcc --version - echo 'Building POSIX Firmware..' && echo -en 'travis_fold:start:script.1\\r' - make posix_sitl_simple -j4 - - ccache -s - echo -en 'travis_fold:end:script.1\\r' - echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r' - make posix_sitl_simple test @@ -82,7 +98,6 @@ script: - echo -en 'travis_fold:end:script.2\\r' - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r' - make px4fmu-v2_default -j4 - - ccache -s - echo -en 'travis_fold:end:script.3\\r' - echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r' - make px4fmu-v2_default test From 5b8905a4e0317cb056ecaf8cd8af26c95c781d08 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 13 Sep 2015 15:14:58 -0400 Subject: [PATCH 134/389] Fix for target name. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9dd4fa24a5..b1dd099eb6 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ clean: rm -rf build_*/ # targets handled by cmake -cmake_targets = test upload packag package_source debug check_weak +cmake_targets = test upload package package_source debug check_weak $(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ)))) .PHONY: clean From 334c001cda7db3e6d0580cfa511cde0eed8f6f9c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 13 Sep 2015 23:25:27 +0200 Subject: [PATCH 135/389] IO driver: Add interface header --- src/drivers/px4io/px4io_driver.h | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/drivers/px4io/px4io_driver.h diff --git a/src/drivers/px4io/px4io_driver.h b/src/drivers/px4io/px4io_driver.h new file mode 100644 index 0000000000..0944412fb0 --- /dev/null +++ b/src/drivers/px4io/px4io_driver.h @@ -0,0 +1,48 @@ +/**************************************************************************** + * + * Copyright (c) 2015 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file px4io_driver.h + * + * Interface for PX4IO + */ + +#pragma once + +#ifdef PX4_I2C_OBDEV_PX4IO +device::Device *PX4IO_i2c_interface(); +#endif + +#ifdef PX4IO_SERIAL_BASE +device::Device *PX4IO_serial_interface(); +#endif From bdf5180b18136b0753512ac8241df88a4bccf52d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 13 Sep 2015 23:31:20 +0200 Subject: [PATCH 136/389] PX4IO driver: Get rid of weak function --- src/drivers/px4io/px4io.cpp | 7 +++++-- src/drivers/px4io/px4io_driver.h | 2 ++ src/drivers/px4io/px4io_i2c.cpp | 4 ++-- src/drivers/px4io/px4io_serial.cpp | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 9a91f35a16..7694850181 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -99,8 +99,7 @@ #include "modules/dataman/dataman.h" -extern device::Device *PX4IO_i2c_interface() weak_function; -extern device::Device *PX4IO_serial_interface() weak_function; +#include "px4io_driver.h" #define PX4IO_SET_DEBUG _IOC(0xff00, 0) #define PX4IO_INAIR_RESTART_ENABLE _IOC(0xff00, 1) @@ -2973,10 +2972,12 @@ get_interface() #ifndef CONFIG_ARCH_BOARD_PX4FMU_V1 +#ifdef PX4IO_SERIAL_BASE /* try for a serial interface */ if (PX4IO_serial_interface != nullptr) { interface = PX4IO_serial_interface(); } +#endif if (interface != nullptr) { goto got; @@ -2984,10 +2985,12 @@ get_interface() #endif +#ifdef PX4_I2C_OBDEV_PX4IO /* try for an I2C interface if we haven't got a serial one */ if (PX4IO_i2c_interface != nullptr) { interface = PX4IO_i2c_interface(); } +#endif if (interface != nullptr) { goto got; diff --git a/src/drivers/px4io/px4io_driver.h b/src/drivers/px4io/px4io_driver.h index 0944412fb0..591c3920d2 100644 --- a/src/drivers/px4io/px4io_driver.h +++ b/src/drivers/px4io/px4io_driver.h @@ -39,6 +39,8 @@ #pragma once +#include + #ifdef PX4_I2C_OBDEV_PX4IO device::Device *PX4IO_i2c_interface(); #endif diff --git a/src/drivers/px4io/px4io_i2c.cpp b/src/drivers/px4io/px4io_i2c.cpp index 574a58f52a..4574ec732a 100755 --- a/src/drivers/px4io/px4io_i2c.cpp +++ b/src/drivers/px4io/px4io_i2c.cpp @@ -53,9 +53,9 @@ #include -#ifdef PX4_I2C_OBDEV_PX4IO +#include "px4io_driver.h" -device::Device *PX4IO_i2c_interface(); +#ifdef PX4_I2C_OBDEV_PX4IO class PX4IO_I2C : public device::I2C { diff --git a/src/drivers/px4io/px4io_serial.cpp b/src/drivers/px4io/px4io_serial.cpp index 93f55f9486..c05883aeb8 100644 --- a/src/drivers/px4io/px4io_serial.cpp +++ b/src/drivers/px4io/px4io_serial.cpp @@ -68,9 +68,9 @@ #include -#ifdef PX4IO_SERIAL_BASE +#include "px4io_driver.h" -device::Device *PX4IO_serial_interface(); +#ifdef PX4IO_SERIAL_BASE /* serial register accessors */ #define REG(_x) (*(volatile uint32_t *)(PX4IO_SERIAL_BASE + _x)) From a58416235d24741317f17d30ad925da2864198f6 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 13 Sep 2015 17:35:15 -0400 Subject: [PATCH 137/389] Re-enable autostart. --- cmake/nuttx/px4_impl_nuttx.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 15a304fdb9..0d07dd4560 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -303,10 +303,7 @@ function(px4_nuttx_generate_romfs) add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} - # TODO XXX hack to get nsh to work, copying real - # autostart in currently makes nsh fail over usb - COMMAND cmake -E touch ${romfs_temp_dir}/init.d/rc.autostart - #COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d + COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d #TODO add romfs cleanup of temp file .~, .swp etc COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} --folder ${romfs_temp_dir} From e6cbee74bf04dc4ceee610139b51dcb76bc92329 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 14 Sep 2015 00:16:49 +0200 Subject: [PATCH 138/389] Tools: Fix param code generation to generate correct union access based on type. Generate #error C-code for unknown types to prevent silent failure. --- Tools/px_generate_params.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Tools/px_generate_params.py b/Tools/px_generate_params.py index 2642206f3c..0efe778683 100755 --- a/Tools/px_generate_params.py +++ b/Tools/px_generate_params.py @@ -71,14 +71,19 @@ for group in root: if not start_name: start_name = param.attrib["name"] end_name = param.attrib["name"] + val_str = "#error UNKNOWN PARAM TYPE, FIX px_generate_params.py" + if (param.attrib["type"] == "FLOAT"): + val_str = ".val.f = " + elif (param.attrib["type"] == "INT32"): + val_str = ".val.i = " i+=1 src += """ { "%s", PARAM_TYPE_%s, - .val.f = %s + %s%s }, -""" % (param.attrib["name"], param.attrib["type"], param.attrib["default"]) +""" % (param.attrib["name"], param.attrib["type"], val_str, param.attrib["default"]) src += """ %d }; From 19c84126a44d4a3f311c6cdd6b95c7680e6e36ec Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 13 Sep 2015 18:30:32 -0400 Subject: [PATCH 139/389] Fixed parameter generation dependencies. --- cmake/common/px4_base.cmake | 37 ++++++++++++++++++++++------ src/firmware/nuttx/CMakeLists.txt | 6 ++--- src/firmware/posix/CMakeLists.txt | 3 --- src/firmware/qurt/CMakeLists.txt | 4 --- src/modules/systemlib/CMakeLists.txt | 6 +++++ 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 7e8ddabee0..482fc54aa5 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -701,17 +701,38 @@ function(px4_create_git_hash_header) endfunction() #============================================================================= -# parameter file generation +# +# px4_generate_parameters +# +# Generates a source file with all parameters. +# +# Usage: +# px4_generate_parameters(OUT ) +# +# Output: +# OUT : the generate source files +# +# Example: +# px4_generate_parameters(OUT parameters.c) # function(px4_generate_parameters) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py -s ${CMAKE_SOURCE_DIR}/src --board ${BOARD} --xml - ) - - execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py ${CMAKE_BINARY_DIR}/parameters.xml + px4_parse_function_args( + NAME px4_generate_parameters + ONE_VALUE OUT + REQUIRED OUT + ARGN ${ARGN}) + set(generated_files + ${CMAKE_CURRENT_BINARY_DIR}/px4_parameters.h + ${CMAKE_CURRENT_BINARY_DIR}/px4_parameters.c) + set_source_files_properties(${generated_files} + PROPERTIES GENERATED TRUE) + add_custom_command(OUTPUT ${generated_files} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py + -s ${CMAKE_SOURCE_DIR}/src --board CONFIG_ARCH_${BOARD} --xml + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py + parameters.xml ) + set(${OUT} ${generated_files} PARENT_SCOPE) endfunction() - # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 8cf5e64b3b..b069d8849b 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -8,10 +8,10 @@ px4_nuttx_generate_builtin_commands( px4_nuttx_generate_romfs(OUT romfs.o ROOT ROMFS/px4fmu_common) -px4_generate_parameters() - # add executable -add_executable(firmware_nuttx builtin_commands.c ${CMAKE_BINARY_DIR}/px4_parameters.c romfs.o) +add_executable(firmware_nuttx + builtin_commands.c + romfs.o) set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) set(main_link_flags "-T${nuttx_export_dir}/build/ld.script" diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt index 1ac73ba682..7c30f1dfa6 100644 --- a/src/firmware/posix/CMakeLists.txt +++ b/src/firmware/posix/CMakeLists.txt @@ -5,11 +5,8 @@ px4_posix_generate_builtin_commands( OUT apps.h MODULE_LIST ${module_libraries}) -px4_generate_parameters() - add_executable(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp - ${CMAKE_BINARY_DIR}/px4_parameters.c apps.h ) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index b4271ee12e..7f52c59e4c 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -14,18 +14,14 @@ px4_qurt_generate_builtin_commands( set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -px4_generate_parameters() - # Enable build without HexagonSDK to check link dependencies if ("${QURT_ENABLE_STUBS}" STREQUAL "1") add_executable(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c - ${CMAKE_BINARY_DIR}/px4_parameters.c ${CMAKE_BINARY_DIR}/apps.h) else("${QURT_ENABLE_STUBS}" STREQUAL "1") add_library(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c - ${CMAKE_BINARY_DIR}/px4_parameters.c ${CMAKE_BINARY_DIR}/apps.h) endif() diff --git a/src/modules/systemlib/CMakeLists.txt b/src/modules/systemlib/CMakeLists.txt index e69055c4a2..3acedcbdd6 100644 --- a/src/modules/systemlib/CMakeLists.txt +++ b/src/modules/systemlib/CMakeLists.txt @@ -31,7 +31,13 @@ # ############################################################################ +px4_generate_parameters(OUT param_files) + +# for generated files +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + set(SRCS + ${param_files} perf_counter.c param/param.c conversions.c From f43ccdaea1f515d06508b6edaafac0d0be956dbf Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 13 Sep 2015 18:55:48 -0400 Subject: [PATCH 140/389] Make parameters a separate library. --- cmake/configs/nuttx_px4fmu-v2_default.cmake | 1 + cmake/configs/nuttx_px4fmu-v2_simple.cmake | 1 + cmake/configs/posix_eagle_default.cmake | 1 + cmake/configs/posix_eagle_hil.cmake | 1 + cmake/configs/posix_eagle_release.cmake | 1 + cmake/configs/posix_sitl_simple.cmake | 1 + cmake/configs/qurt_eagle_hello.cmake | 1 + cmake/configs/qurt_eagle_hil.cmake | 1 + cmake/configs/qurt_eagle_muorb.cmake | 1 + cmake/configs/qurt_eagle_release.cmake | 1 + cmake/configs/qurt_eagle_test.cmake | 1 + cmake/configs/qurt_eagle_travis.cmake | 1 + src/modules/param/CMakeLists.txt | 50 +++++++++++++++++++++ src/modules/systemlib/CMakeLists.txt | 6 +-- 14 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/modules/param/CMakeLists.txt diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 60cb06a3dc..0ea1c0d800 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -97,6 +97,7 @@ set(config_module_list # # Library modules # + modules/param modules/systemlib modules/systemlib/mixer modules/controllib diff --git a/cmake/configs/nuttx_px4fmu-v2_simple.cmake b/cmake/configs/nuttx_px4fmu-v2_simple.cmake index ddd639ac5a..e6777cd32a 100644 --- a/cmake/configs/nuttx_px4fmu-v2_simple.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_simple.cmake @@ -69,6 +69,7 @@ set(config_module_list # # Library modules # + modules/param modules/systemlib modules/systemlib/mixer modules/controllib diff --git a/cmake/configs/posix_eagle_default.cmake b/cmake/configs/posix_eagle_default.cmake index 36c787edca..b30dcef5e3 100644 --- a/cmake/configs/posix_eagle_default.cmake +++ b/cmake/configs/posix_eagle_default.cmake @@ -22,6 +22,7 @@ set(config_module_list modules/mc_pos_control modules/mc_att_control + modules/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake index c4e5375766..ee5feb6535 100644 --- a/cmake/configs/posix_eagle_hil.cmake +++ b/cmake/configs/posix_eagle_hil.cmake @@ -17,6 +17,7 @@ set(config_module_list modules/mavlink + modules/param modules/systemlib modules/uORB modules/sensors diff --git a/cmake/configs/posix_eagle_release.cmake b/cmake/configs/posix_eagle_release.cmake index 36a9ad1be3..ab930abea3 100644 --- a/cmake/configs/posix_eagle_release.cmake +++ b/cmake/configs/posix_eagle_release.cmake @@ -15,6 +15,7 @@ set(config_module_list modules/mavlink + modules/param modules/systemlib modules/uORB modules/dataman diff --git a/cmake/configs/posix_sitl_simple.cmake b/cmake/configs/posix_sitl_simple.cmake index 10a02fa89f..b557401810 100644 --- a/cmake/configs/posix_sitl_simple.cmake +++ b/cmake/configs/posix_sitl_simple.cmake @@ -23,6 +23,7 @@ set(config_module_list systemcmds/reboot systemcmds/topic_listener modules/uORB + modules/param modules/systemlib modules/systemlib/mixer modules/sensors diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index 9076ec7511..45ae2b22ed 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -13,6 +13,7 @@ set(config_module_list # # Library modules # + modules/param modules/systemlib modules/uORB diff --git a/cmake/configs/qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake index e661ca5b62..bab551262d 100644 --- a/cmake/configs/qurt_eagle_hil.cmake +++ b/cmake/configs/qurt_eagle_hil.cmake @@ -33,6 +33,7 @@ set(config_module_list # # Library modules # + modules/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake index 5c83f9e68d..afdc35dad5 100644 --- a/cmake/configs/qurt_eagle_muorb.cmake +++ b/cmake/configs/qurt_eagle_muorb.cmake @@ -13,6 +13,7 @@ set(config_module_list # # Library modules # + modules/param modules/systemlib modules/uORB diff --git a/cmake/configs/qurt_eagle_release.cmake b/cmake/configs/qurt_eagle_release.cmake index 1807e0b56c..0b03dcea48 100644 --- a/cmake/configs/qurt_eagle_release.cmake +++ b/cmake/configs/qurt_eagle_release.cmake @@ -55,6 +55,7 @@ set(config_module_list # # Library modules # + modules/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index c25191f5b9..5e9cffc407 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -13,6 +13,7 @@ set(config_module_list # # Library modules # + modules/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index ab766f189c..15593df251 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -36,6 +36,7 @@ set(config_module_list # # Library modules # + modules/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/src/modules/param/CMakeLists.txt b/src/modules/param/CMakeLists.txt new file mode 100644 index 0000000000..4e15ca6e5a --- /dev/null +++ b/src/modules/param/CMakeLists.txt @@ -0,0 +1,50 @@ +############################################################################ +# +# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +px4_generate_parameters(OUT param_files) + +set(srcs + ${param_files} + ) + +px4_add_module( + MODULE modules__param + COMPILE_FLAGS + -Os + SRCS ${srcs} + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/systemlib/CMakeLists.txt b/src/modules/systemlib/CMakeLists.txt index 3acedcbdd6..6f0f7c5f54 100644 --- a/src/modules/systemlib/CMakeLists.txt +++ b/src/modules/systemlib/CMakeLists.txt @@ -31,13 +31,10 @@ # ############################################################################ -px4_generate_parameters(OUT param_files) - # for generated files -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_BINARY_DIR}/src/modules/param) set(SRCS - ${param_files} perf_counter.c param/param.c conversions.c @@ -82,5 +79,6 @@ px4_add_module( SRCS ${SRCS} DEPENDS platforms__common + modules__param ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 676a3d230c948100bb39c1595a9ec29272acc014 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 05:26:31 -0400 Subject: [PATCH 141/389] Work on px4io firmware building. --- .gitignore | 1 + CMakeLists.txt | 11 +- Makefile | 6 +- cmake/common/px4_base.cmake | 18 +-- cmake/configs/nuttx_px4fmu-v2_default.cmake | 12 ++ cmake/configs/nuttx_px4fmu-v2_simple.cmake | 13 +- cmake/configs/nuttx_sim_simple.cmake | 27 ++-- cmake/nuttx/px4_impl_nuttx.cmake | 36 +++-- .../Toolchain-arm-linux-gnueabihf.cmake | 2 +- .../toolchains/Toolchain-arm-none-eabi.cmake | 2 +- cmake/toolchains/Toolchain-native.cmake | 2 +- src/drivers/ms5611/CMakeLists.txt | 22 ++- src/firmware/nuttx/CMakeLists.txt | 61 +++++---- src/modules/px4iofirmware/CMakeLists.txt | 125 +++++++++++++++--- src/systemcmds/tests/CMakeLists.txt | 66 +++++---- 15 files changed, 276 insertions(+), 128 deletions(-) diff --git a/.gitignore b/.gitignore index 9d415d1839..1a6e278539 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,4 @@ src/platforms/posix/px4_messages/ src/platforms/posix-arm/px4_messages/ src/platforms/qurt/px4_messages/ ROMFS/*/*/rc.autostart +rootfs/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f04b1fdd6..8354de7399 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,8 @@ # Included CMake Files # --------------------------------------------------------------------------- # +# * All variables in config files must have the prefix "config_". +# # * Never set global variables in an included cmake file, # you may only define functions. This excludes config and Toolchain files. # This makes it clear to the user when variables are being set or targets @@ -121,6 +123,9 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR) # parameters # +set(CMAKE_BUILD_TYPE "" CACHE STRING "build type") +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY + STRINGS ";Debug;Release;RelWithDebInfo;MinSizeRel") set(CONFIG "nuttx_px4fmu-v2_default" CACHE STRING "desired configuration") file(GLOB_RECURSE configs RELATIVE cmake/configs "cmake/configs/*.cmake") set_property(CACHE CONFIG PROPERTY STRINGS ${configs}) @@ -178,8 +183,9 @@ string(REPLACE "_" ";" config_args ${CONFIG}) list(GET config_args 0 OS) list(GET config_args 1 BOARD) list(GET config_args 2 LABEL) +set(target_name "${OS}-${BOARD}-${LABEL}") -message(STATUS "OS=${OS} BOARD=${BOARD} LABEL=${LABEL}") +message(STATUS "${target_name}") #============================================================================= # programs @@ -271,6 +277,9 @@ foreach(module ${config_module_list}) endforeach() add_subdirectory(src/firmware/${OS}) +if (config_io_board) + #add_subdirectory(src/modules/px4iofirmware) +endif() #============================================================================= # generate git version diff --git a/Makefile b/Makefile index b1dd099eb6..db133aea51 100644 --- a/Makefile +++ b/Makefile @@ -92,13 +92,13 @@ qurt_eagle_travis: posix: posix_sitl_simple -sitl_quad: +sitl_quad: posix Tools/sitl_run.sh posix-configs/SITL/init/rcS -sitl_plane: +sitl_plane: posix Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing -sitl_ros: +sitl_ros: posix Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros # Other targets diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 482fc54aa5..022261a58d 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -103,7 +103,7 @@ function(px4_parse_function_args) endif() foreach(arg ${IN_REQUIRED}) if (NOT OUT_${arg}) - message(FATAL_ERROR "${IN_NAME} requires argument ${arg}, ARGN: ${IN_ARGN}") + message(FATAL_ERROR "${IN_NAME} requires argument ${arg}\nARGN: ${IN_ARGN}") endif() endforeach() foreach(arg ${IN_OPTIONS} ${IN_ONE_VALUE} ${IN_MULTI_VALUE}) @@ -593,25 +593,25 @@ function(px4_add_common_flags) ) set(added_include_dirs - src + ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/src - src/modules - src/include - src/lib - src/platforms + ${CMAKE_SOURCE_DIR}/src/modules + ${CMAKE_SOURCE_DIR}/src/include + ${CMAKE_SOURCE_DIR}/src/lib + ${CMAKE_SOURCE_DIR}/src/platforms # TODO Build/versioning was in Makefile, # do we need this, how does it work with cmake - src/drivers/boards/${BOARD} + ${CMAKE_SOURCE_DIR}/src/drivers/boards/${BOARD} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/src/modules/px4_messages ${CMAKE_BINARY_DIR}/src/modules - mavlink/include/mavlink + ${CMAKE_SOURCE_DIR}/mavlink/include/mavlink ) if (NOT ${OS} STREQUAL "qurt") list(APPEND added_include_dirs - src/lib/eigen + ${CMAKE_SOURCE_DIR}/src/lib/eigen ) endif() diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 0ea1c0d800..84885c1c59 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -165,6 +165,18 @@ set(config_extra_builtin_cmds sercon ) +set(config_io_board + px4io-v2 + ) + +set(config_extra_libs + ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a + ) + +set(config_io_extra_libs + ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM3l_math.a + ) + add_custom_target(sercon) set_target_properties(sercon PROPERTIES MAIN "sercon" STACK "2048") diff --git a/cmake/configs/nuttx_px4fmu-v2_simple.cmake b/cmake/configs/nuttx_px4fmu-v2_simple.cmake index e6777cd32a..c9b054052b 100644 --- a/cmake/configs/nuttx_px4fmu-v2_simple.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_simple.cmake @@ -3,7 +3,6 @@ include(nuttx/px4_impl_nuttx) set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake) set(config_module_list - # # Board support modules # @@ -127,6 +126,18 @@ set(config_extra_builtin_cmds sercon ) +set(config_io_board + px4io-v2 + ) + +set(config_extra_libs + ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a + ) + +set(config_io_extra_libs + ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM3l_math.a + ) + add_custom_target(sercon) set_target_properties(sercon PROPERTIES MAIN "sercon" STACK "2048") diff --git a/cmake/configs/nuttx_sim_simple.cmake b/cmake/configs/nuttx_sim_simple.cmake index a777e915f9..c457431ad6 100644 --- a/cmake/configs/nuttx_sim_simple.cmake +++ b/cmake/configs/nuttx_sim_simple.cmake @@ -5,16 +5,16 @@ message(WARNING "this is a work in progress and doesn't build yet") set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake) set(config_module_list - platforms/nuttx - platforms/nuttx/px4_layer + #platforms/nuttx + #platforms/nuttx/px4_layer platforms/common - drivers/led + #drivers/led drivers/device - modules/systemlib - modules/uORB - examples/px4_simple_app - lib/mathlib/math/filter - lib/conversion + #modules/systemlib + #modules/uORB + #examples/px4_simple_app + #lib/mathlib/math/filter + #lib/conversion ) set(config_firmware_options @@ -22,15 +22,4 @@ set(config_firmware_options ) set(config_extra_builtin_cmds - serdis - sercon ) - -add_custom_target(sercon) -set_target_properties(sercon PROPERTIES - MAIN "sercon" STACK "2048") - -add_custom_target(serdis) -set_target_properties(serdis PROPERTIES - MAIN "serdis" STACK "2048") - diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 0d07dd4560..8b82ed1704 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -61,6 +61,7 @@ include(common/px4_base) # # Input: # EXE : the executable to generate the firmware from +# BOARD : the board # # Options: # PARAM_XML : toggles generation of param_xml @@ -74,9 +75,9 @@ include(common/px4_base) function(px4_nuttx_add_firmware) px4_parse_function_args( NAME px4_nuttx_add_firmware - ONE_VALUE OUT EXE + ONE_VALUE BOARD OUT EXE OPTIONS PARAM_XML - REQUIRED EXE + REQUIRED OUT EXE BOARD ARGN ${ARGN}) set(process_params ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py) @@ -111,7 +112,7 @@ function(px4_nuttx_add_firmware) DEPENDS ${EXE} ) endif() - add_custom_target(build_firmware ALL DEPENDS ${OUT}) + add_custom_target(build_firmware_${BOARD} ALL DEPENDS ${OUT}) endfunction() #============================================================================= @@ -246,14 +247,14 @@ function(px4_nuttx_add_export) DEPENDS ${DEPENDS} __nuttx_copy_${CONFIG}) # extract - add_custom_command(OUTPUT nuttx_export_${BOARD}.stamp + add_custom_command(OUTPUT nuttx_export_${CONFIG}.stamp COMMAND ${RM} -rf ${nuttx_src}/nuttx-export - COMMAND ${UNZIP} ${BOARD}.export -d ${nuttx_src} - COMMAND ${TOUCH} nuttx_export_${BOARD}.stamp - DEPENDS ${DEPENDS} ${BOARD}.export) + COMMAND ${UNZIP} ${CONFIG}.export -d ${nuttx_src} + COMMAND ${TOUCH} nuttx_export_${CONFIG}.stamp + DEPENDS ${DEPENDS} ${CONFIG}.export) add_custom_target(${OUT} - DEPENDS nuttx_export_${BOARD}.stamp) + DEPENDS nuttx_export_${CONFIG}.stamp) endfunction() @@ -406,17 +407,24 @@ function(px4_os_add_flags) set(added_exe_linker_flags) # none currently - if ("${BOARD}" STREQUAL "px4fmu-v2") - set(arm_build_flags + set(cpu_flags) + if (${BOARD} STREQUAL "px4fmu-v2") + set(cpu_flags -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard ) - list(APPEND c_flags ${arm_build_flags}) - list(APPEND cxx_flags ${arm_build_flags}) + elseif (${BOARD} STREQUAL "px4io-v2") + set(cpu_flags + -mcpu=cortex-m3 + -mthumb + -march=armv7-m + ) endif() + list(APPEND c_flags ${cpu_flags}) + list(APPEND cxx_flags ${cpu_flags}) # output foreach(var ${inout_vars}) @@ -455,11 +463,11 @@ function(px4_os_prebuild_targets) ONE_VALUE OUT BOARD THREADS REQUIRED OUT BOARD ARGN ${ARGN}) - px4_nuttx_add_export(OUT nuttx_export + px4_nuttx_add_export(OUT nuttx_export_${BOARD} CONFIG ${BOARD} THREADS ${THREADS} DEPENDS git_nuttx) - add_custom_target(${OUT} DEPENDS nuttx_export) + add_custom_target(${OUT} DEPENDS nuttx_export_${BOARD}) endfunction() # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake b/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake index 2db5cf82b9..61d63f8677 100644 --- a/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake +++ b/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake @@ -46,7 +46,7 @@ foreach(tool objcopy nm ld) endforeach() # os tools -foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip) +foreach(tool echo patch grep rm mkdir nm genromfs cp touch make unzip) string(TOUPPER ${tool} TOOL) find_program(${TOOL} ${tool}) if(NOT ${TOOL}) diff --git a/cmake/toolchains/Toolchain-arm-none-eabi.cmake b/cmake/toolchains/Toolchain-arm-none-eabi.cmake index 5fab42f3c2..80da3ad1a2 100644 --- a/cmake/toolchains/Toolchain-arm-none-eabi.cmake +++ b/cmake/toolchains/Toolchain-arm-none-eabi.cmake @@ -46,7 +46,7 @@ foreach(tool objcopy nm ld gdb) endforeach() # os tools -foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip) +foreach(tool echo patch grep rm mkdir nm genromfs cp touch make unzip) string(TOUPPER ${tool} TOOL) find_program(${TOOL} ${tool}) if(NOT ${TOOL}) diff --git a/cmake/toolchains/Toolchain-native.cmake b/cmake/toolchains/Toolchain-native.cmake index 0f9ad12f14..888c73a6d8 100644 --- a/cmake/toolchains/Toolchain-native.cmake +++ b/cmake/toolchains/Toolchain-native.cmake @@ -8,7 +8,7 @@ foreach(tool nm ld) endforeach() # os tools -foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip) +foreach(tool echo patch grep rm mkdir nm genromfs cp touch make unzip) string(TOUPPER ${tool} TOOL) find_program(${TOOL} ${tool}) if(NOT ${TOOL}) diff --git a/src/drivers/ms5611/CMakeLists.txt b/src/drivers/ms5611/CMakeLists.txt index 8afca6ade0..7359bd9507 100644 --- a/src/drivers/ms5611/CMakeLists.txt +++ b/src/drivers/ms5611/CMakeLists.txt @@ -30,15 +30,29 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +set(srcs + ms5611_spi.cpp + ms5611_i2c.cpp + ) + +if(${OS} STREQUAL "nuttx") + list(APPEND srcs + ms5611_nuttx.cpp + ) +else() + list(APPEND srcs + ms5611_posix.cpp + ms5611_sim.cpp + ) + +endif() + px4_add_module( MODULE drivers__ms5611 MAIN ms5611 COMPILE_FLAGS -Os - SRCS - ms5611_nuttx.cpp - ms5611_spi.cpp - ms5611_i2c.cpp + SRCS ${srcs} DEPENDS platforms__common ) diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index b069d8849b..bb9aac3113 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -13,44 +13,57 @@ add_executable(firmware_nuttx builtin_commands.c romfs.o) 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) +set(link_libs + apps nuttx m gcc + ) + +if(NOT ${BOARD} STREQUAL "sim") + list(APPEND link_libs nosys) + set(main_link_flags + "-T${nuttx_export_dir}/build/ld.script" + "-Wl,-Map=${CMAKE_BINARY_DIR}/${BOARD}/main.map" + ) + px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") + set_target_properties(firmware_nuttx PROPERTIES LINK_FLAGS ${main_link_flags}) +endif() + +set(fw_file ${CMAKE_CURRENT_BINARY_DIR}/${target_name}.px4) target_link_libraries(firmware_nuttx -Wl,--start-group ${module_libraries} - ${cmsis_lib} - apps nuttx nosys m gcc + ${config_extra_libs} + ${link_libs} -Wl,--end-group) -set(fw_file ${CMAKE_CURRENT_BINARY_DIR}/${OS}-${BOARD}-${LABEL}.px4) - add_custom_target(check_weak - COMMAND ${NM} firmware_nuttx | grep " w " + COMMAND ${NM} firmware_nuttx | ${GREP} " w " | cat DEPENDS firmware_nuttx + VERBATIM ) -px4_nuttx_add_firmware(OUT ${fw_file} - EXE firmware_nuttx - ${config_firmware_options} - ) +if(NOT ${BOARD} STREQUAL "sim") + set(fw_file + ${CMAKE_CURRENT_BINARY_DIR}/${OS}-${BOARD}-${LABEL}.px4) -configure_file(gdbinit.in .gdbinit) + px4_nuttx_add_firmware(OUT ${fw_file} + BOARD ${BOARD} + EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx + ${config_firmware_options} + ) -add_custom_target(debug - COMMAND ${GDB} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx - DEPENDS firmware_nuttx - ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit - ) + configure_file(gdbinit.in .gdbinit) -px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} - BUNDLE ${fw_file}) + add_custom_target(debug + COMMAND ${GDB} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx + DEPENDS firmware_nuttx + ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit + ) + + px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} + BUNDLE ${fw_file}) +endif() install(FILES ${fw_file} DESTINATION .) diff --git a/src/modules/px4iofirmware/CMakeLists.txt b/src/modules/px4iofirmware/CMakeLists.txt index 0680fde22c..a8c5d681ab 100644 --- a/src/modules/px4iofirmware/CMakeLists.txt +++ b/src/modules/px4iofirmware/CMakeLists.txt @@ -30,27 +30,108 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ -px4_add_module( - MODULE modules__px4iofirmware - SRCS - adc.c - controls.c - dsm.c - px4io.c - registers.c - safety.c - sbus.c - ../systemlib/up_cxxinitialize.c - ../systemlib/perf_counter.c - mixer.cpp - ../systemlib/mixer/mixer.cpp - ../systemlib/mixer/mixer_group.cpp - ../systemlib/mixer/mixer_multirotor.cpp - ../systemlib/mixer/mixer_simple.cpp - ../systemlib/pwm_limit/pwm_limit.c - ../../lib/rc/st24.c - ../../lib/rc/sumd.c - DEPENDS - platforms__common + +# kill all flags above us, this is a different board (io) +set_directory_properties(PROPERTIES + INCLUDE_DIRECTORIES "" + LINK_DIRECTORIES "" + COMPILE_DEFINITIONS "" ) +set(c_flags) +set(exe_linker_flags) +set(cxx_flags) +set(include_dirs) +set(link_dirs) +set(definitions) + +px4_os_prebuild_targets(OUT io_prebuild_targets + BOARD ${config_io_board} + THREADS ${THREADS}) + +px4_os_add_flags( + BOARD ${config_io_board} + C_FLAGS c_flags + CXX_FLAGS cxx_flags + EXE_LINKER_FLAGS exe_linker_flags + INCLUDE_DIRS include_dirs + LINK_DIRS link_dirs + DEFINITIONS definitions) + +px4_join(OUT CMAKE_EXE_LINKER_FLAGS LIST "${exe_linker_flags}" GLUE " ") +px4_join(OUT CMAKE_C_FLAGS LIST "${c_flags}" GLUE " ") +px4_join(OUT CMAKE_CXX_FLAGS LIST "${cxx_flags}" GLUE " ") + +include_directories( + ${include_dirs} + ${CMAKE_BINARY_DIR}/src/modules/systemlib/mixer + ) +link_directories(${link_dirs}) +add_definitions(${definitions}) + +set(srcs + adc.c + controls.c + dsm.c + px4io.c + registers.c + safety.c + sbus.c + ../systemlib/up_cxxinitialize.c + ../systemlib/perf_counter.c + mixer.cpp + ../systemlib/mixer/mixer.cpp + ../systemlib/mixer/mixer_group.cpp + ../systemlib/mixer/mixer_multirotor.cpp + ../systemlib/mixer/mixer_simple.cpp + ../systemlib/pwm_limit/pwm_limit.c + ../../lib/rc/st24.c + ../../lib/rc/sumd.c + ../../drivers/stm32/drv_hrt.c + ../../drivers/stm32/drv_pwm_servo.c + ../../drivers/boards/${config_io_board}/px4iov2_init.c + ../../drivers/boards/${config_io_board}/px4iov2_pwm_servo.c + ) + +if(${config_io_board} STREQUAL "px4io-v1") + list(APPEND srcs + i2c.c + ) +elseif(${config_io_board} STREQUAL "px4io-v2") + list(APPEND srcs + serial.c + ../systemlib/hx_stream.c + ) +endif() + +add_executable(firmware_io_nuttx + ${srcs}) + +add_dependencies(firmware_io_nuttx + nuttx_export_${config_io_board} + msg_gen + io_prebuild_targets + ) + +set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${config_io_board}/NuttX/nuttx-export) +set(main_link_flags + "-T${nuttx_export_dir}/build/ld.script" + "-Wl,-Map=${CMAKE_BINARY_DIR}/${config_io_board}/main.map" + ) +px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") +set_target_properties(firmware_io_nuttx PROPERTIES LINK_FLAGS ${main_link_flags}) + +set(io_fw_file ${CMAKE_CURRENT_BINARY_DIR}/${config_io_board}.px4) + +target_link_libraries(firmware_io_nuttx + -Wl,--start-group + apps nuttx nosys m gcc + ${config_io_extra_libs} + -Wl,--end-group) + +px4_nuttx_add_firmware(OUT ${io_fw_file} + BOARD ${config_io_board} + EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_io_nuttx + ${config_firmware_options} + ) + # vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/systemcmds/tests/CMakeLists.txt b/src/systemcmds/tests/CMakeLists.txt index c58048433d..41af1c0417 100644 --- a/src/systemcmds/tests/CMakeLists.txt +++ b/src/systemcmds/tests/CMakeLists.txt @@ -30,6 +30,43 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ + +set(srcs + test_adc.c + test_bson.c + test_float.c + test_gpio.c + test_hott_telemetry.c + test_hrt.c + test_int.c + test_jig_voltages.c + test_led.c + test_sensors.c + test_servo.c + test_sleep.c + test_uart_baudchange.c + test_uart_console.c + test_uart_loopback.c + test_uart_send.c + test_mixer.cpp + test_mathlib.cpp + test_file.c + test_file2.c + tests_main.c + test_param.c + test_ppm_loopback.c + test_rc.c + test_conv.cpp + test_mount.c + test_eigen.cpp + ) + +if(${OS} STREQUAL "nuttx") + list(APPEND srcs + test_time.c + ) +endif() + px4_add_module( MODULE systemcmds__tests MAIN tests @@ -37,34 +74,7 @@ px4_add_module( COMPILE_FLAGS -Wframe-larger-than=6000 -O0 - SRCS - test_adc.c - test_bson.c - test_float.c - test_gpio.c - test_hott_telemetry.c - test_hrt.c - test_int.c - test_jig_voltages.c - test_led.c - test_sensors.c - test_servo.c - test_sleep.c - test_uart_baudchange.c - test_uart_console.c - test_uart_loopback.c - test_uart_send.c - test_mixer.cpp - test_mathlib.cpp - test_file.c - test_file2.c - tests_main.c - test_param.c - test_ppm_loopback.c - test_rc.c - test_conv.cpp - test_mount.c - test_eigen.cpp + SRCS ${srcs} DEPENDS platforms__common ) From 567431602aa1d4cfd5ba4ed103477d2ac34cd313 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Mon, 14 Sep 2015 19:55:53 -0400 Subject: [PATCH 142/389] Adds alias __errno to linker file fixed link, need to understand why. --- CMakeLists.txt | 2 +- cmake/configs/nuttx_px4fmu-v2_default.cmake | 2 +- nuttx-configs/px4io-v2/scripts/ld.script | 6 ++++++ src/modules/px4iofirmware/CMakeLists.txt | 1 + src/modules/systemlib/mixer/CMakeLists.txt | 3 +++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8354de7399..95cb91398a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,7 +278,7 @@ endforeach() add_subdirectory(src/firmware/${OS}) if (config_io_board) - #add_subdirectory(src/modules/px4iofirmware) + add_subdirectory(src/modules/px4iofirmware) endif() #============================================================================= diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 84885c1c59..33fcf3bbb2 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -174,7 +174,7 @@ set(config_extra_libs ) set(config_io_extra_libs - ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM3l_math.a + #${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM3l_math.a ) add_custom_target(sercon) diff --git a/nuttx-configs/px4io-v2/scripts/ld.script b/nuttx-configs/px4io-v2/scripts/ld.script index 69c2f9cb2e..2ff29bdab7 100755 --- a/nuttx-configs/px4io-v2/scripts/ld.script +++ b/nuttx-configs/px4io-v2/scripts/ld.script @@ -72,6 +72,12 @@ SECTIONS *(.gcc_except_table) *(.gnu.linkonce.r.*) _etext = ABSOLUTE(.); + + /* + * This is a hack to make the newlib libm __errno() call + * use the NuttX get_errno_ptr() function. + */ + __errno = get_errno_ptr; } > flash /* diff --git a/src/modules/px4iofirmware/CMakeLists.txt b/src/modules/px4iofirmware/CMakeLists.txt index a8c5d681ab..d5183bb04e 100644 --- a/src/modules/px4iofirmware/CMakeLists.txt +++ b/src/modules/px4iofirmware/CMakeLists.txt @@ -110,6 +110,7 @@ add_dependencies(firmware_io_nuttx nuttx_export_${config_io_board} msg_gen io_prebuild_targets + mixer_gen ) set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${config_io_board}/NuttX/nuttx-export) diff --git a/src/modules/systemlib/mixer/CMakeLists.txt b/src/modules/systemlib/mixer/CMakeLists.txt index bb2b4422a5..20187eb97f 100644 --- a/src/modules/systemlib/mixer/CMakeLists.txt +++ b/src/modules/systemlib/mixer/CMakeLists.txt @@ -37,6 +37,9 @@ add_custom_command(OUTPUT mixer_multirotor.generated.h COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/multi_tables.py > mixer_multirotor.generated.h) +add_custom_target(mixer_gen + DEPENDS mixer_multirotor.generated.h) + px4_add_module( MODULE modules__systemlib__mixer SRCS From 686caf4ca401f4db14e64e5e52393c9cec6187a6 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 16 Sep 2015 17:10:24 +0200 Subject: [PATCH 143/389] Fix semaphore handling for device on Mac OS --- Build/.keep | 0 src/drivers/device/device_posix.cpp | 24 +++++++++++++++++++++++- src/drivers/device/vdev.cpp | 2 +- src/drivers/device/vdev.h | 7 ++++--- 4 files changed, 28 insertions(+), 5 deletions(-) delete mode 100644 Build/.keep diff --git a/Build/.keep b/Build/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/drivers/device/device_posix.cpp b/src/drivers/device/device_posix.cpp index 5fc6a595ad..97cf2c8254 100644 --- a/src/drivers/device/device_posix.cpp +++ b/src/drivers/device/device_posix.cpp @@ -44,6 +44,7 @@ #include #include #include +#include namespace device { @@ -54,7 +55,24 @@ Device::Device(const char *name) : _name(name), _debug_enabled(false) { - sem_init(&_lock, 0, 1); + #ifndef __PX4_DARWIN + _lock = new sem_t; + int ret = sem_init(_lock, 0, 1); + + if (ret != 0) { + PX4_WARN("SEM INIT FAIL: ret %d, %s", ret, strerror(errno)); + } + #else + _lock_name = new char[strlen(_name) + 2]; + _lock_name[0] = '/'; + strcpy(&_lock_name[1], _name); + /* not using O_EXCL as the device handles are unique */ + _lock = sem_open(_lock_name, O_CREAT, 0777, 1); + + if (_lock == SEM_FAILED) { + PX4_WARN("SEM INIT FAIL: %s", strerror(errno)); + } + #endif /* setup a default device ID. When bus_type is UNKNOWN the other fields are invalid */ @@ -67,7 +85,11 @@ Device::Device(const char *name) : Device::~Device() { + #ifdef __PX4_DARWIN + sem_unlink(_name); + #else sem_destroy(&_lock); + #endif } int diff --git a/src/drivers/device/vdev.cpp b/src/drivers/device/vdev.cpp index 507cebbf83..430b121c09 100644 --- a/src/drivers/device/vdev.cpp +++ b/src/drivers/device/vdev.cpp @@ -64,7 +64,7 @@ private: px4_dev_t() {} }; -#define PX4_MAX_DEV 200 +#define PX4_MAX_DEV 500 static px4_dev_t *devmap[PX4_MAX_DEV]; /* diff --git a/src/drivers/device/vdev.h b/src/drivers/device/vdev.h index c39857bbf0..3b4aae01ed 100644 --- a/src/drivers/device/vdev.h +++ b/src/drivers/device/vdev.h @@ -161,6 +161,7 @@ public: protected: const char *_name; /**< driver name */ + char *_lock_name; /**< name of the semaphore */ bool _debug_enabled; /**< if true, debug messages are printed */ union DeviceId _device_id; /**< device identifier information */ @@ -180,7 +181,7 @@ protected: */ void lock() { DEVICE_DEBUG("lock"); - do {} while (sem_wait(&_lock) != 0); + do {} while (sem_wait(_lock) != 0); } /** @@ -188,11 +189,11 @@ protected: */ void unlock() { DEVICE_DEBUG("unlock"); - sem_post(&_lock); + sem_post(_lock); } private: - sem_t _lock; + sem_t * _lock; /** disable copy construction for this and all subclasses */ Device(const Device &); From 27055184deb43a9e0c049e25574a25676eefd3d4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 16 Sep 2015 17:37:05 +0200 Subject: [PATCH 144/389] Linux device build fix --- src/drivers/device/device_posix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/device/device_posix.cpp b/src/drivers/device/device_posix.cpp index 97cf2c8254..05ae355709 100644 --- a/src/drivers/device/device_posix.cpp +++ b/src/drivers/device/device_posix.cpp @@ -88,7 +88,7 @@ Device::~Device() #ifdef __PX4_DARWIN sem_unlink(_name); #else - sem_destroy(&_lock); + sem_destroy(_lock); #endif } From dd697d13431da05f4156c2f50aea6c91e6185301 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 16 Sep 2015 18:12:05 +0200 Subject: [PATCH 145/389] GPS: Remove unused header --- src/drivers/gps/gps.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index 41947f27e7..6c4b4eab7a 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include From c89f51b8efd7bdbac0af22fa253dfc73034599b2 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 16 Sep 2015 18:13:10 +0200 Subject: [PATCH 146/389] POSIX: Fix HRT semaphores for Mac OS --- src/platforms/posix/px4_layer/drv_hrt.c | 34 +++++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/src/platforms/posix/px4_layer/drv_hrt.c index 2fbe8cd70a..3afaa7f943 100644 --- a/src/platforms/posix/px4_layer/drv_hrt.c +++ b/src/platforms/posix/px4_layer/drv_hrt.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "hrt_work.h" static struct sq_queue_s callout_queue; @@ -59,7 +60,7 @@ static void hrt_call_reschedule(void); #define HRT_INTERVAL_MIN 50 #define HRT_INTERVAL_MAX 50000000 -static sem_t _hrt_lock; +static sem_t *_hrt_lock; static struct work_s _hrt_work; static hrt_abstime px4_timestart = 0; @@ -70,14 +71,12 @@ __EXPORT hrt_abstime hrt_reset(void); static void hrt_lock(void) { - //printf("hrt_lock\n"); - sem_wait(&_hrt_lock); + sem_wait(_hrt_lock); } static void hrt_unlock(void) { - //printf("hrt_unlock\n"); - sem_post(&_hrt_lock); + sem_post(_hrt_lock); } #ifdef __PX4_DARWIN @@ -87,22 +86,26 @@ static void hrt_unlock(void) #define MAC_GIGA UINT64_C(1000000000) #define CLOCK_MONOTONIC 1 #define clockid_t int +#define HRT_LOCK_NAME "/hrt_lock" static double px4_timebase = 0.0; +int clock_gettime(clockid_t clk_id, struct timespec *t); + int clock_gettime(clockid_t clk_id, struct timespec *t) { if (clk_id != CLOCK_MONOTONIC) { return 1; } - // XXX multithreading locking if (!px4_timestart) { - mach_timebase_info_data_t tb = { 0 }; + hrt_lock(); + mach_timebase_info_data_t tb = {}; mach_timebase_info(&tb); px4_timebase = tb.numer; px4_timebase /= tb.denom; px4_timestart = mach_absolute_time(); + hrt_unlock(); } memset(t, 0, sizeof(*t)); @@ -229,7 +232,22 @@ void hrt_init(void) { //printf("hrt_init\n"); sq_init(&callout_queue); - sem_init(&_hrt_lock, 0, 1); + + #ifdef __PX4_DARWIN + /* not using O_EXCL as the device handles are unique */ + _hrt_lock = sem_open(HRT_LOCK_NAME, O_CREAT, 0777, 1); + + if (_hrt_lock == SEM_FAILED) { + PX4_WARN("SEM INIT FAIL: %s", strerror(errno)); + } + #else + _hrt_lock = malloc(sizeof(sem_t)); + int sem_ret = sem_init(_hrt_lock, 0, 1); + if (sem_ret) { + PX4_WARN("SEM INIT FAIL: %s", strerror(errno)); + } + #endif + memset(&_hrt_work, 0, sizeof(_hrt_work)); } From 4dce80423cf6d0d296eebf3cd16e6d908dc661bc Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 16 Sep 2015 18:51:31 +0200 Subject: [PATCH 147/389] POSIX: Do not exit script on error --- src/platforms/posix/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/posix/main.cpp b/src/platforms/posix/main.cpp index 8199c321b5..fd9fdef5c6 100644 --- a/src/platforms/posix/main.cpp +++ b/src/platforms/posix/main.cpp @@ -184,7 +184,7 @@ int main(int argc, char **argv) if (infile.is_open()) { for (string line; getline(infile, line, '\n');) { - process_line(line, !daemon_mode); + process_line(line, false); } } else { From cc053bffcd6c9c41d5187f048c63783cbafc0f29 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 09:58:10 -0400 Subject: [PATCH 148/389] Added px4io bin to ROMFS. --- cmake/nuttx/px4_impl_nuttx.cmake | 4 ++++ src/modules/px4iofirmware/CMakeLists.txt | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 8b82ed1704..466e25b017 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -305,6 +305,10 @@ function(px4_nuttx_generate_romfs) COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d + COMMAND cmake -E make_directory ${romfs_temp_dir}/extras + COMMAND cmake -E copy + ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL}.bin + ${romfs_temp_dir}/extras #TODO add romfs cleanup of temp file .~, .swp etc COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} --folder ${romfs_temp_dir} diff --git a/src/modules/px4iofirmware/CMakeLists.txt b/src/modules/px4iofirmware/CMakeLists.txt index d5183bb04e..b7251b4a08 100644 --- a/src/modules/px4iofirmware/CMakeLists.txt +++ b/src/modules/px4iofirmware/CMakeLists.txt @@ -103,10 +103,12 @@ elseif(${config_io_board} STREQUAL "px4io-v2") ) endif() -add_executable(firmware_io_nuttx +set(fw_io_name ${config_io_board}_${LABEL}) + +add_executable(${fw_io_name} ${srcs}) -add_dependencies(firmware_io_nuttx +add_dependencies(${fw_io_name} nuttx_export_${config_io_board} msg_gen io_prebuild_targets @@ -119,11 +121,11 @@ set(main_link_flags "-Wl,-Map=${CMAKE_BINARY_DIR}/${config_io_board}/main.map" ) px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") -set_target_properties(firmware_io_nuttx PROPERTIES LINK_FLAGS ${main_link_flags}) +set_target_properties(${fw_io_name} PROPERTIES LINK_FLAGS ${main_link_flags}) set(io_fw_file ${CMAKE_CURRENT_BINARY_DIR}/${config_io_board}.px4) -target_link_libraries(firmware_io_nuttx +target_link_libraries(${fw_io_name} -Wl,--start-group apps nuttx nosys m gcc ${config_io_extra_libs} @@ -131,7 +133,7 @@ target_link_libraries(firmware_io_nuttx px4_nuttx_add_firmware(OUT ${io_fw_file} BOARD ${config_io_board} - EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_io_nuttx + EXE ${CMAKE_CURRENT_BINARY_DIR}/${fw_io_name} ${config_firmware_options} ) From 4830c7c9c1b7355fedcfb8785e316f0711921ade Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 10:39:54 -0400 Subject: [PATCH 149/389] Added io debug target. --- Makefile | 2 +- cmake/toolchains/Toolchain-arm-none-eabi.cmake | 2 +- src/firmware/nuttx/CMakeLists.txt | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index db133aea51..5041ff4c51 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ clean: rm -rf build_*/ # targets handled by cmake -cmake_targets = test upload package package_source debug check_weak +cmake_targets = test upload package package_source debug debug_io check_weak $(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ)))) .PHONY: clean diff --git a/cmake/toolchains/Toolchain-arm-none-eabi.cmake b/cmake/toolchains/Toolchain-arm-none-eabi.cmake index 80da3ad1a2..d067620f12 100644 --- a/cmake/toolchains/Toolchain-arm-none-eabi.cmake +++ b/cmake/toolchains/Toolchain-arm-none-eabi.cmake @@ -37,7 +37,7 @@ endif() cmake_force_cxx_compiler(${CXX_COMPILER} GNU) # compiler tools -foreach(tool objcopy nm ld gdb) +foreach(tool objcopy nm ld gdb gdbtui) string(TOUPPER ${tool} TOOL) find_program(${TOOL} arm-none-eabi-${tool}) if(NOT ${TOOL}) diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index bb9aac3113..36132e6f38 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -56,7 +56,14 @@ if(NOT ${BOARD} STREQUAL "sim") configure_file(gdbinit.in .gdbinit) add_custom_target(debug - COMMAND ${GDB} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx + COMMAND ${GDBTUI} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx + DEPENDS firmware_nuttx + ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit + ) + + add_custom_target(debug_io + COMMAND ${GDBTUI} + ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL} DEPENDS firmware_nuttx ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit ) From 8165cd21716e1423c067e6011d75b2a0cdc2f5e0 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 11:36:20 -0400 Subject: [PATCH 150/389] Fixed romfs dependency. --- cmake/nuttx/px4_impl_nuttx.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 466e25b017..3145de1cf9 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -301,20 +301,22 @@ function(px4_nuttx_generate_romfs) -s rc.autostart ) + + set(io_bin_image + ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL}.bin) + add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d COMMAND cmake -E make_directory ${romfs_temp_dir}/extras - COMMAND cmake -E copy - ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL}.bin - ${romfs_temp_dir}/extras + COMMAND cmake -E copy ${io_bin_image} ${romfs_temp_dir}/extras #TODO add romfs cleanup of temp file .~, .swp etc COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin -d ${romfs_temp_dir} -V "NSHInitVol" - DEPENDS ${romfs_files} rc.autostart + DEPENDS ${romfs_files} rc.autostart ${io_bin_image} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) From 9f5edb32bf735484faf6fda1e1c99a5b570a15b0 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 11:52:35 -0400 Subject: [PATCH 151/389] Made debugger tools optional. --- cmake/toolchains/Toolchain-arm-none-eabi.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/toolchains/Toolchain-arm-none-eabi.cmake b/cmake/toolchains/Toolchain-arm-none-eabi.cmake index d067620f12..45da0d965c 100644 --- a/cmake/toolchains/Toolchain-arm-none-eabi.cmake +++ b/cmake/toolchains/Toolchain-arm-none-eabi.cmake @@ -37,7 +37,7 @@ endif() cmake_force_cxx_compiler(${CXX_COMPILER} GNU) # compiler tools -foreach(tool objcopy nm ld gdb gdbtui) +foreach(tool objcopy nm ld) string(TOUPPER ${tool} TOOL) find_program(${TOOL} arm-none-eabi-${tool}) if(NOT ${TOOL}) @@ -45,6 +45,12 @@ foreach(tool objcopy nm ld gdb gdbtui) endif() endforeach() +# optional compiler tools +foreach(tool gdb gdbtui) + string(TOUPPER ${tool} TOOL) + find_program(${TOOL} arm-none-eabi-${tool}) +endforeach() + # os tools foreach(tool echo patch grep rm mkdir nm genromfs cp touch make unzip) string(TOUPPER ${tool} TOOL) From 7be3afe249dfde3b6d01064ff1c94a480269b91b Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 12:13:17 -0400 Subject: [PATCH 152/389] Fixed firmware name. --- cmake/common/px4_base.cmake | 4 ++-- src/modules/px4iofirmware/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 022261a58d..1d3f5b05a3 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -551,7 +551,7 @@ function(px4_add_common_flags) endif() set(c_compile_flags - -g3 + -g -std=gnu99 -fno-common ) @@ -560,7 +560,7 @@ function(px4_add_common_flags) -Wno-missing-field-initializers ) set(cxx_compile_flags - -g3 + -g -fno-exceptions -fno-rtti -std=gnu++0x diff --git a/src/modules/px4iofirmware/CMakeLists.txt b/src/modules/px4iofirmware/CMakeLists.txt index b7251b4a08..06313da061 100644 --- a/src/modules/px4iofirmware/CMakeLists.txt +++ b/src/modules/px4iofirmware/CMakeLists.txt @@ -123,7 +123,7 @@ set(main_link_flags px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") set_target_properties(${fw_io_name} PROPERTIES LINK_FLAGS ${main_link_flags}) -set(io_fw_file ${CMAKE_CURRENT_BINARY_DIR}/${config_io_board}.px4) +set(io_fw_file ${CMAKE_CURRENT_BINARY_DIR}/${fw-io_name}.px4) target_link_libraries(${fw_io_name} -Wl,--start-group From ef48715051f60b3cc7ae7e75bdaa0385c88b72cb Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 19 Sep 2015 18:22:00 +0200 Subject: [PATCH 153/389] POSIX: Add pthread mutex based semaphores --- src/platforms/posix/px4_layer/CMakeLists.txt | 1 + src/platforms/posix/px4_layer/px4_sem.cpp | 98 ++++++++++++++++++++ src/platforms/px4_posix.h | 35 +++++++ 3 files changed, 134 insertions(+) create mode 100644 src/platforms/posix/px4_layer/px4_sem.cpp diff --git a/src/platforms/posix/px4_layer/CMakeLists.txt b/src/platforms/posix/px4_layer/CMakeLists.txt index 295e882532..402e66e097 100644 --- a/src/platforms/posix/px4_layer/CMakeLists.txt +++ b/src/platforms/posix/px4_layer/CMakeLists.txt @@ -37,6 +37,7 @@ px4_add_module( SRCS px4_posix_impl.cpp px4_posix_tasks.cpp + px4_sem.cpp lib_crc32.c drv_hrt.c px4_log.c diff --git a/src/platforms/posix/px4_layer/px4_sem.cpp b/src/platforms/posix/px4_layer/px4_sem.cpp new file mode 100644 index 0000000000..c938389de4 --- /dev/null +++ b/src/platforms/posix/px4_layer/px4_sem.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** + * + * Copyright (c) 2015 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file px4_sem.cpp + * + * PX4 Middleware Wrapper Linux Implementation + */ + +#include +#include +#include +#include +#include +#include + +#ifdef __PX4_DARWIN + +#include + +#include + +int px4_sem_init(px4_sem_t *s, int pshared, unsigned value) +{ + // We do not used the process shared arg + (void)pshared; + s->value = value; + pthread_cond_init(&(s->wait), NULL); + pthread_mutex_init(&(s->lock), NULL); + + return 0; +} + +int px4_sem_wait(px4_sem_t *s) +{ + pthread_mutex_lock(&(s->lock)); + s->value--; + if(s->value < 0) { + pthread_cond_wait(&(s->wait), &(s->lock)); + } + pthread_mutex_unlock(&(s->lock)); + + return 0; +} + +int px4_sem_post(px4_sem_t *s) +{ + pthread_mutex_lock(&(s->lock)); + s->value++; + if(s->value <= 0) { + pthread_cond_signal(&(s->wait)); + } + pthread_mutex_unlock(&(s->lock)); + + return 0; +} + +int px4_sem_destroy(px4_sem_t *s) +{ + pthread_mutex_lock(&(s->lock)); + pthread_cond_destroy(&(s->wait)); + pthread_mutex_unlock(&(s->lock)); + pthread_mutex_destroy(&(s->lock)); + + return 0; +} + +#endif diff --git a/src/platforms/px4_posix.h b/src/platforms/px4_posix.h index d4309b11b0..e2d0143a0e 100644 --- a/src/platforms/px4_posix.h +++ b/src/platforms/px4_posix.h @@ -48,6 +48,41 @@ #include +/* Semaphore handling */ + +#ifdef __PX4_DARWIN + +__BEGIN_DECLS + +typedef struct +{ + pthread_mutex_t lock; + pthread_cond_t wait; + int value; +} px4_sem_t; + +__EXPORT int px4_sem_init(px4_sem_t *s, int pshared, unsigned value); +__EXPORT int px4_sem_wait(px4_sem_t *s); +__EXPORT int px4_sem_post(px4_sem_t *s); +__EXPORT int px4_sem_destroy(px4_sem_t *s); + +__END_DECLS + +#else + +typedef px4_sem_t sem_t + +#define px4_sem_init _GLOBAL sem_init +#define px4_sem_wait _GLOBAL sem_wait +#define px4_sem_post _GLOBAL px4_sem_post +#define px4_sem_destroy _GLOBAL sem_destroy + + + +#endif + +//################################### + #ifdef __PX4_NUTTX #define PX4_F_RDONLY 1 From 50061a95a4b9801de4733991ca619d7f9bda6a42 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 19 Sep 2015 18:24:14 +0200 Subject: [PATCH 154/389] POSIX: Add sem_getvalue() abstraction --- src/platforms/posix/px4_layer/px4_sem.cpp | 10 ++++++++++ src/platforms/px4_posix.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/platforms/posix/px4_layer/px4_sem.cpp b/src/platforms/posix/px4_layer/px4_sem.cpp index c938389de4..ebf0e9cd51 100644 --- a/src/platforms/posix/px4_layer/px4_sem.cpp +++ b/src/platforms/posix/px4_layer/px4_sem.cpp @@ -85,6 +85,16 @@ int px4_sem_post(px4_sem_t *s) return 0; } +int px4_sem_getvalue(px4_sem_t *s) +{ + int val; + pthread_mutex_lock(&(s->lock)); + val = s->value; + pthread_mutex_unlock(&(s->lock)); + + return val; +} + int px4_sem_destroy(px4_sem_t *s) { pthread_mutex_lock(&(s->lock)); diff --git a/src/platforms/px4_posix.h b/src/platforms/px4_posix.h index e2d0143a0e..3c138e5a70 100644 --- a/src/platforms/px4_posix.h +++ b/src/platforms/px4_posix.h @@ -64,6 +64,7 @@ typedef struct __EXPORT int px4_sem_init(px4_sem_t *s, int pshared, unsigned value); __EXPORT int px4_sem_wait(px4_sem_t *s); __EXPORT int px4_sem_post(px4_sem_t *s); +__EXPORT int px4_sem_getvalue(px4_sem_t *s); __EXPORT int px4_sem_destroy(px4_sem_t *s); __END_DECLS @@ -75,6 +76,7 @@ typedef px4_sem_t sem_t #define px4_sem_init _GLOBAL sem_init #define px4_sem_wait _GLOBAL sem_wait #define px4_sem_post _GLOBAL px4_sem_post +#define px4_sem_getvalue _GLOBAL px4_sem_getvalue #define px4_sem_destroy _GLOBAL sem_destroy From cd98cfe5557be649a18107571ce02511952a754e Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 13:44:02 -0400 Subject: [PATCH 155/389] cmake: ROMFS build overhaul. --- CMakeLists.txt | 2 + cmake/common/px4_base.cmake | 50 ++++++++++++++ cmake/nuttx/px4_impl_nuttx.cmake | 83 +++++++++++++++++++----- src/modules/px4iofirmware/CMakeLists.txt | 8 +-- 4 files changed, 119 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95cb91398a..918e5bd875 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,10 +277,12 @@ foreach(module ${config_module_list}) endforeach() add_subdirectory(src/firmware/${OS}) + if (config_io_board) add_subdirectory(src/modules/px4iofirmware) endif() + #============================================================================= # generate git version # diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 1d3f5b05a3..54ab915bfd 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -735,4 +735,54 @@ function(px4_generate_parameters) set(${OUT} ${generated_files} PARENT_SCOPE) endfunction() +#============================================================================= +# +# px4_copy_tracked +# +# Copy files to a directory and keep track of dependencies. +# +# Usage: +# px4_copy_tracked(OUT FILES DIR ) +# +# Input: +# FILES : the source files +# DEST : the directory to copy files to +# RELATIVE : relative directory for source files +# +# Output: +# OUT : the copied files +# +# Example: +# px4_copy_tracked(OUT copied_files FILES src_files DEST path RELATIVE path_rel) +# +function(px4_copy_tracked) + px4_parse_function_args( + NAME px4_copy_tracked + ONE_VALUE DEST OUT RELATIVE + MULTI_VALUE FILES + REQUIRED DEST OUT FILES + ARGN ${ARGN}) + set(files) + # before build, make sure dest directory exists + execute_process( + COMMAND cmake -E make_directory ${DEST}) + # create rule to copy each file and set dependency as source file + set(_files_out) + foreach(_file ${FILES}) + if (RELATIVE) + file(RELATIVE_PATH _file_path ${RELATIVE} ${_file}) + else() + set(_file_path ${_file}) + endif() + set(_dest_file ${DEST}/${_file_path}) + #message(STATUS "copy ${_file} -> ${_dest_file}") + add_custom_command(OUTPUT ${_dest_file} + COMMAND cmake -E copy ${_file} ${_dest_file} + DEPENDS ${_file}) + list(APPEND _files_out ${_dest_file}) + endforeach() + set(${OUT} ${_files_out} PARENT_SCOPE) +endfunction() + + # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 3145de1cf9..b138e01e40 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -258,6 +258,41 @@ function(px4_nuttx_add_export) endfunction() +#============================================================================= +# +# px4_nuttx_create_bin +# +# The functions generates a bin image for nuttx. +# +# Usage: +# px4_nuttx_create_bin(BIN EXE ) +# +# Input: +# EXE : the exe file +# +# Output: +# OUT : the binary output file +# +# Example: +# px4_nuttx_create_bin(OUT my_exe.bin EXE my_exe) +# +function(px4_nuttx_create_bin) + + px4_parse_function_args( + NAME px4_nuttx_create_bin + ONE_VALUE EXE OUT + REQUIRED EXE OUT + ARGN ${ARGN}) + + add_custom_command(OUTPUT ${OUT} + COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin + DEPENDS ${EXE}) + + set(${OUT} ${${OUT}} PARENT_SCOPE) + +endfunction() + + #============================================================================= # # px4_nuttx_generate_romfs @@ -265,10 +300,14 @@ endfunction() # The functions generates the ROMFS filesystem for nuttx. # # Usage: -# px4_nuttx_generate_romfs(OUT ROOT ) +# px4_nuttx_generate_romfs( +# OUT +# ROOT +# EXTRAS ) # # Input: # ROOT : the root of the ROMFS +# EXTRAS : list of extra files # # Output: # OUT : the generated ROMFS @@ -281,42 +320,50 @@ function(px4_nuttx_generate_romfs) px4_parse_function_args( NAME px4_nuttx_generate_romfs ONE_VALUE OUT ROOT + MULTI_VALUE EXTRAS REQUIRED OUT ROOT ARGN ${ARGN}) - file(GLOB_RECURSE romfs_files ${ROOT}/*) - set(romfs_temp_dir ${CMAKE_BINARY_DIR}/${ROOT}) + set(romfs_temp_dir ${CMAKE_BINARY_DIR}/tmp/${ROOT}) + set(romfs_dest_dir ${CMAKE_BINARY_DIR}/${ROOT}) set(romfs_src_dir ${CMAKE_SOURCE_DIR}/${ROOT}) - set(romfs_autostart ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py) set(romfs_pruner ${CMAKE_SOURCE_DIR}/Tools/px_romfs_pruner.py) set(bin_to_obj ${CMAKE_SOURCE_DIR}/cmake/nuttx/bin_to_obj.py) - #message(STATUS "temp_dir: ${romfs_temp_dir}") - #message(STATUS "src_dir: ${romfs_src_dir}") + file(GLOB_RECURSE romfs_src_files ${romfs_src_dir} ${romfs_src_dir}/*) - add_custom_command(OUTPUT rc.autostart - COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} - -a ${romfs_src_dir}/init.d - -s rc.autostart + px4_copy_tracked(OUT romfs_files + FILES ${romfs_src_files} + DEST ${romfs_dest_dir} + RELATIVE ${romfs_src_dir} ) + if (EXTRAS) + px4_copy_tracked(OUT extra_files + FILES ${EXTRAS} + DEST ${romfs_dest_dir}/extras + RELATIVE ${romfs_src_dir} + ) + list(APPEND romfs_files ${extra_files}) + endif() - set(io_bin_image - ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL}.bin) + add_custom_command(OUTPUT ${romfs_dest_dir}/init.d/rc.autostart + COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} + -a ${romfs_src_dir}/init.d + -s ${romfs_dest_dir}/init.d/rc.autostart + ) + list(APPEND romfs_files ${romfs_dest_dir}/init.d/rc.autostart) add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} - COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} - COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d - COMMAND cmake -E make_directory ${romfs_temp_dir}/extras - COMMAND cmake -E copy ${io_bin_image} ${romfs_temp_dir}/extras - #TODO add romfs cleanup of temp file .~, .swp etc + COMMAND cmake -E copy_directory ${romfs_dest_dir} ${romfs_temp_dir} COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin -d ${romfs_temp_dir} -V "NSHInitVol" - DEPENDS ${romfs_files} rc.autostart ${io_bin_image} + COMMAND cmake -E remove_directory ${romfs_temp_dir} + DEPENDS ${romfs_files} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/src/modules/px4iofirmware/CMakeLists.txt b/src/modules/px4iofirmware/CMakeLists.txt index 06313da061..9feed84674 100644 --- a/src/modules/px4iofirmware/CMakeLists.txt +++ b/src/modules/px4iofirmware/CMakeLists.txt @@ -123,18 +123,14 @@ set(main_link_flags px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ") set_target_properties(${fw_io_name} PROPERTIES LINK_FLAGS ${main_link_flags}) -set(io_fw_file ${CMAKE_CURRENT_BINARY_DIR}/${fw-io_name}.px4) - target_link_libraries(${fw_io_name} -Wl,--start-group apps nuttx nosys m gcc ${config_io_extra_libs} -Wl,--end-group) -px4_nuttx_add_firmware(OUT ${io_fw_file} - BOARD ${config_io_board} - EXE ${CMAKE_CURRENT_BINARY_DIR}/${fw_io_name} - ${config_firmware_options} +px4_nuttx_create_bin(OUT ${fw_io_name}.bin + EXE ${fw_io_name} ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 7b6dff7cdc2756f49a2ba46f8915bba40b73492d Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 17:57:54 -0400 Subject: [PATCH 156/389] Fix for romfs generation. --- cmake/nuttx/px4_impl_nuttx.cmake | 69 +++++++++++------------- cmake/test/cmake_tester.py | 52 ++++++++++++++++++ src/firmware/nuttx/CMakeLists.txt | 15 ++++-- src/modules/px4iofirmware/CMakeLists.txt | 6 ++- 4 files changed, 99 insertions(+), 43 deletions(-) create mode 100755 cmake/test/cmake_tester.py diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index b138e01e40..4bfe3566d0 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -40,7 +40,7 @@ # * px4_nuttx_add_firmware # * px4_nuttx_generate_builtin_commands # * px4_nuttx_add_export -# * px4_nuttx_generate_romfs +# * px4_nuttx_add_romfs # # Required OS Inteface Functions # @@ -295,12 +295,12 @@ endfunction() #============================================================================= # -# px4_nuttx_generate_romfs +# px4_nuttx_add_romfs # -# The functions generates the ROMFS filesystem for nuttx. +# The functions creates a ROMFS filesystem for nuttx. # # Usage: -# px4_nuttx_generate_romfs( +# px4_nuttx_add_romfs( # OUT # ROOT # EXTRAS ) @@ -310,64 +310,58 @@ endfunction() # EXTRAS : list of extra files # # Output: -# OUT : the generated ROMFS +# OUT : the ROMFS library target # # Example: -# px4_nuttx_generate_romfs(OUT my_romfs ROOT "ROMFS/my_board") +# px4_nuttx_add_romfs(OUT my_romfs ROOT "ROMFS/my_board") # -function(px4_nuttx_generate_romfs) +function(px4_nuttx_add_romfs) px4_parse_function_args( - NAME px4_nuttx_generate_romfs + NAME px4_nuttx_add_romfs ONE_VALUE OUT ROOT MULTI_VALUE EXTRAS REQUIRED OUT ROOT ARGN ${ARGN}) set(romfs_temp_dir ${CMAKE_BINARY_DIR}/tmp/${ROOT}) - set(romfs_dest_dir ${CMAKE_BINARY_DIR}/${ROOT}) set(romfs_src_dir ${CMAKE_SOURCE_DIR}/${ROOT}) set(romfs_autostart ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py) set(romfs_pruner ${CMAKE_SOURCE_DIR}/Tools/px_romfs_pruner.py) set(bin_to_obj ${CMAKE_SOURCE_DIR}/cmake/nuttx/bin_to_obj.py) + set(extras_dir ${CMAKE_CURRENT_BINARY_DIR}/extras) file(GLOB_RECURSE romfs_src_files ${romfs_src_dir} ${romfs_src_dir}/*) - px4_copy_tracked(OUT romfs_files - FILES ${romfs_src_files} - DEST ${romfs_dest_dir} - RELATIVE ${romfs_src_dir} - ) + set(cmake_test ${CMAKE_SOURCE_DIR}/cmake/test/cmake_tester.py) - if (EXTRAS) - px4_copy_tracked(OUT extra_files - FILES ${EXTRAS} - DEST ${romfs_dest_dir}/extras - RELATIVE ${romfs_src_dir} + + set(extras) + foreach(extra ${EXTRAS}) + get_filename_component(file_name ${extra} NAME) + set(file_dest ${extras_dir}/${file_name}) + add_custom_command(OUTPUT ${file_dest} + COMMAND cmake -E copy ${extra} ${file_dest} + DEPENDS ${extra} ) - list(APPEND romfs_files ${extra_files}) - endif() + list(APPEND extras ${file_dest}) + endforeach() + add_custom_target(collect_extras DEPENDS ${extras}) - add_custom_command(OUTPUT ${romfs_dest_dir}/init.d/rc.autostart - COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} - -a ${romfs_src_dir}/init.d - -s ${romfs_dest_dir}/init.d/rc.autostart - ) - list(APPEND romfs_files ${romfs_dest_dir}/init.d/rc.autostart) + message(STATUS "EXTRAS: ${extras}") - add_custom_command(OUTPUT romfs.bin + add_custom_command(OUTPUT romfs.o COMMAND cmake -E remove_directory ${romfs_temp_dir} - COMMAND cmake -E copy_directory ${romfs_dest_dir} ${romfs_temp_dir} + COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} + COMMAND cmake -E copy_directory ${extras_dir} ${romfs_temp_dir} + COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} + -a ${romfs_temp_dir}/init.d + -s ${romfs_temp_dir}/init.d/rc.autostart COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin -d ${romfs_temp_dir} -V "NSHInitVol" COMMAND cmake -E remove_directory ${romfs_temp_dir} - DEPENDS ${romfs_files} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - - add_custom_command(OUTPUT romfs.o COMMAND ${PYTHON_EXECUTABLE} ${bin_to_obj} --ld ${LD} --c_flags ${CMAKE_C_FLAGS} --c_compiler ${CMAKE_C_COMPILER} @@ -375,11 +369,12 @@ function(px4_nuttx_generate_romfs) --obj romfs.o --var romfs_img --bin romfs.bin - DEPENDS romfs.bin + DEPENDS ${romfs_src_files} ${extras} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - - set(${OUT} romfs.o PARENT_SCOPE) + add_library(${OUT} STATIC romfs.o) + set_target_properties(${OUT} PROPERTIES LINKER_LANGUAGE C) + set(${OUT} ${${OUT}} PARENT_SCOPE) endfunction() diff --git a/cmake/test/cmake_tester.py b/cmake/test/cmake_tester.py new file mode 100755 index 0000000000..34bebacb9d --- /dev/null +++ b/cmake/test/cmake_tester.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +""" +The module facilitates testing in cmake. +It takes a command and a regex for failure ok passing. +It passes if: + * No stderr output. + * Stdout doesn't match failure regex. + * Stdout matches ok regex if given. +""" +from __future__ import print_function +import argparse +import subprocess +import re +import sys + +#pylint: disable=invalid-name + +parser = argparse.ArgumentParser() + +parser.add_argument('cmd') +parser.add_argument('--re-fail') +parser.add_argument('--re-ok') +parser.add_argument('--verbose', '-v', dest='verbose', action='store_true') + +parser.set_defaults(verbose=False) +args = parser.parse_args() + +proc = subprocess.Popen(args.cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) +stdout, stderr = proc.communicate() + +if stderr != "": + print(stderr) + sys.exit(1) + +if args.re_fail is not None: + fail_match = re.search(args.re_fail, stdout) + if fail_match is not None: + print(stdout) + sys.exit(1) + +if args.re_ok is not None: + ok_match = re.search(args.re_ok, stdout) + if re.match(args.re_ok, stdout) is None: + print(stdout) + sys.exit(1) + +if args.verbose: + print(stdout) + +sys.exit(0) + +# vim: set et ft=python fenc=utf-8 ff=unix sts=4 sw=4 ts=4 : diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 36132e6f38..bf50a33814 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -5,17 +5,22 @@ px4_nuttx_generate_builtin_commands( ${config_extra_builtin_cmds} ) -px4_nuttx_generate_romfs(OUT romfs.o - ROOT ROMFS/px4fmu_common) +px4_nuttx_add_romfs(OUT romfs + ROOT ROMFS/px4fmu_common + EXTRAS ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL}.bin + ) + +add_dependencies(romfs fw_io) # add executable add_executable(firmware_nuttx - builtin_commands.c - romfs.o) + builtin_commands.c) + + set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) set(link_libs - apps nuttx m gcc + romfs apps nuttx m gcc ) if(NOT ${BOARD} STREQUAL "sim") diff --git a/src/modules/px4iofirmware/CMakeLists.txt b/src/modules/px4iofirmware/CMakeLists.txt index 9feed84674..43c59fb2db 100644 --- a/src/modules/px4iofirmware/CMakeLists.txt +++ b/src/modules/px4iofirmware/CMakeLists.txt @@ -129,8 +129,12 @@ target_link_libraries(${fw_io_name} ${config_io_extra_libs} -Wl,--end-group) -px4_nuttx_create_bin(OUT ${fw_io_name}.bin +px4_nuttx_create_bin(OUT ${CMAKE_CURRENT_BINARY_DIR}/${fw_io_name}.bin EXE ${fw_io_name} ) +add_custom_target(fw_io + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${fw_io_name}.bin) + + # vim: set noet ft=cmake fenc=utf-8 ff=unix : From bd33d546e3fc452e971a72eef4339ec9d0fb729e Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 18:10:57 -0400 Subject: [PATCH 157/389] Fixed extra dir. --- cmake/nuttx/px4_impl_nuttx.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 4bfe3566d0..394c3d5f6e 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -353,7 +353,7 @@ function(px4_nuttx_add_romfs) add_custom_command(OUTPUT romfs.o COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} - COMMAND cmake -E copy_directory ${extras_dir} ${romfs_temp_dir} + COMMAND cmake -E copy_directory ${extras_dir} ${romfs_temp_dir}/extras COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} -a ${romfs_temp_dir}/init.d -s ${romfs_temp_dir}/init.d/rc.autostart @@ -361,7 +361,7 @@ function(px4_nuttx_add_romfs) --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin -d ${romfs_temp_dir} -V "NSHInitVol" - COMMAND cmake -E remove_directory ${romfs_temp_dir} + #COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND ${PYTHON_EXECUTABLE} ${bin_to_obj} --ld ${LD} --c_flags ${CMAKE_C_FLAGS} --c_compiler ${CMAKE_C_COMPILER} From 2101ffbeca28d0faa2f5df81305ff3e42a43ab46 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 18:15:17 -0400 Subject: [PATCH 158/389] Removed extra print message. --- cmake/nuttx/px4_impl_nuttx.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 394c3d5f6e..7533e139f1 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -348,8 +348,6 @@ function(px4_nuttx_add_romfs) endforeach() add_custom_target(collect_extras DEPENDS ${extras}) - message(STATUS "EXTRAS: ${extras}") - add_custom_command(OUTPUT romfs.o COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} From a9f82c05375c96fa820c69a0ef0a42d192e15f13 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:26:30 +0200 Subject: [PATCH 159/389] CLANG: Improve compiler flags --- cmake/toolchains/Toolchain-posix-clang-native.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/toolchains/Toolchain-posix-clang-native.cmake b/cmake/toolchains/Toolchain-posix-clang-native.cmake index 88492dc960..3629ab0cdf 100644 --- a/cmake/toolchains/Toolchain-posix-clang-native.cmake +++ b/cmake/toolchains/Toolchain-posix-clang-native.cmake @@ -9,7 +9,6 @@ set(WARNINGS -Wpointer-arith -Wlogical-op -Wmissing-declarations - -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds @@ -19,8 +18,11 @@ set(WARNINGS -Werror=unused-variable -Werror=double-promotion -Werror=reorder - -Werror=uninitialized - -Werror=init-self + -Werror=uninitialized + -Werror=init-self + -Werror=return-type + -Wno-packed + -Wno-frame-larger-than= #-Wcast-qual - generates spurious noreturn attribute warnings, # try again later #-Wconversion - would be nice, but too many "risky-but-safe" From 604644d82379668eca81c7de7a174a29f79aa248 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:26:56 +0200 Subject: [PATCH 160/389] POSIX: Improvements on semaphore abstraction --- src/platforms/posix/px4_layer/drv_hrt.c | 23 ++++--------------- .../posix/px4_layer/px4_posix_impl.cpp | 3 ++- .../posix/px4_layer/px4_posix_tasks.cpp | 2 +- src/platforms/posix/px4_layer/px4_sem.cpp | 7 +++--- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/src/platforms/posix/px4_layer/drv_hrt.c index 3afaa7f943..74bfb9ee41 100644 --- a/src/platforms/posix/px4_layer/drv_hrt.c +++ b/src/platforms/posix/px4_layer/drv_hrt.c @@ -60,7 +60,7 @@ static void hrt_call_reschedule(void); #define HRT_INTERVAL_MIN 50 #define HRT_INTERVAL_MAX 50000000 -static sem_t *_hrt_lock; +static px4_sem_t _hrt_lock; static struct work_s _hrt_work; static hrt_abstime px4_timestart = 0; @@ -71,12 +71,12 @@ __EXPORT hrt_abstime hrt_reset(void); static void hrt_lock(void) { - sem_wait(_hrt_lock); + px4_sem_wait(&_hrt_lock); } static void hrt_unlock(void) { - sem_post(_hrt_lock); + px4_sem_post(&_hrt_lock); } #ifdef __PX4_DARWIN @@ -99,13 +99,11 @@ int clock_gettime(clockid_t clk_id, struct timespec *t) } if (!px4_timestart) { - hrt_lock(); mach_timebase_info_data_t tb = {}; mach_timebase_info(&tb); px4_timebase = tb.numer; px4_timebase /= tb.denom; px4_timestart = mach_absolute_time(); - hrt_unlock(); } memset(t, 0, sizeof(*t)); @@ -230,23 +228,12 @@ void hrt_call_delay(struct hrt_call *entry, hrt_abstime delay) */ void hrt_init(void) { - //printf("hrt_init\n"); sq_init(&callout_queue); - #ifdef __PX4_DARWIN - /* not using O_EXCL as the device handles are unique */ - _hrt_lock = sem_open(HRT_LOCK_NAME, O_CREAT, 0777, 1); - - if (_hrt_lock == SEM_FAILED) { - PX4_WARN("SEM INIT FAIL: %s", strerror(errno)); - } - #else - _hrt_lock = malloc(sizeof(sem_t)); - int sem_ret = sem_init(_hrt_lock, 0, 1); + int sem_ret = px4_sem_init(&_hrt_lock, 0, 1); if (sem_ret) { - PX4_WARN("SEM INIT FAIL: %s", strerror(errno)); + PX4_ERR("SEM INIT FAIL: %s", strerror(errno)); } - #endif memset(&_hrt_work, 0, sizeof(_hrt_work)); } diff --git a/src/platforms/posix/px4_layer/px4_posix_impl.cpp b/src/platforms/posix/px4_layer/px4_posix_impl.cpp index faf3b81990..5311ead749 100644 --- a/src/platforms/posix/px4_layer/px4_posix_impl.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_impl.cpp @@ -72,6 +72,7 @@ int px4_clock_gettime(clockid_t clk_id, struct timespec *tp) int px4_clock_settime(clockid_t clk_id, struct timespec *tp) { /* do nothing right now */ + return 0; } #endif @@ -86,7 +87,7 @@ void init_once(void); void init_once(void) { _shell_task_id = pthread_self(); - printf("[init] shell id: %lu\n", _shell_task_id); + printf("[init] shell id: %lu\n", (unsigned long)_shell_task_id); work_queues_init(); hrt_work_queue_init(); hrt_init(); diff --git a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp b/src/platforms/posix/px4_layer/px4_posix_tasks.cpp index de929e3a70..f112290cb3 100644 --- a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_tasks.cpp @@ -271,7 +271,7 @@ void px4_show_tasks() for (idx=0; idx < PX4_MAX_TASKS; idx++) { if (taskmap[idx].isused) { - PX4_INFO(" %-10s %lu", taskmap[idx].name.c_str(), taskmap[idx].pid); + PX4_INFO(" %-10s %lu", taskmap[idx].name.c_str(), (unsigned long)taskmap[idx].pid); count++; } } diff --git a/src/platforms/posix/px4_layer/px4_sem.cpp b/src/platforms/posix/px4_layer/px4_sem.cpp index ebf0e9cd51..70d9431c05 100644 --- a/src/platforms/posix/px4_layer/px4_sem.cpp +++ b/src/platforms/posix/px4_layer/px4_sem.cpp @@ -85,14 +85,13 @@ int px4_sem_post(px4_sem_t *s) return 0; } -int px4_sem_getvalue(px4_sem_t *s) +int px4_sem_getvalue(px4_sem_t *s, int *sval) { - int val; pthread_mutex_lock(&(s->lock)); - val = s->value; + *sval = s->value; pthread_mutex_unlock(&(s->lock)); - return val; + return 0; } int px4_sem_destroy(px4_sem_t *s) From d73deabf5c5c522713985c7f181adc1935387b2d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:27:28 +0200 Subject: [PATCH 161/389] Work queues: Move to POSIX semaphore abstraction --- src/platforms/posix/include/hrt_work.h | 9 ++++----- src/platforms/posix/work_queue/hrt_thread.c | 4 ++-- src/platforms/posix/work_queue/work_lock.c | 10 ++++------ src/platforms/posix/work_queue/work_thread.c | 8 ++++---- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/platforms/posix/include/hrt_work.h b/src/platforms/posix/include/hrt_work.h index 4584baf258..47cdf5872a 100644 --- a/src/platforms/posix/include/hrt_work.h +++ b/src/platforms/posix/include/hrt_work.h @@ -32,6 +32,7 @@ ****************************************************************************/ #include +#include #include #include @@ -39,7 +40,7 @@ __BEGIN_DECLS -extern sem_t _hrt_work_lock; +extern px4_sem_t _hrt_work_lock; extern struct wqueue_s g_hrt_work; void hrt_work_queue_init(void); @@ -49,15 +50,13 @@ void hrt_work_cancel(struct work_s *work); static inline void hrt_work_lock(void); static inline void hrt_work_lock() { - //PX4_INFO("hrt_work_lock"); - sem_wait(&_hrt_work_lock); + px4_sem_wait(&_hrt_work_lock); } static inline void hrt_work_unlock(void); static inline void hrt_work_unlock() { - //PX4_INFO("hrt_work_unlock"); - sem_post(&_hrt_work_lock); + px4_sem_post(&_hrt_work_lock); } __END_DECLS diff --git a/src/platforms/posix/work_queue/hrt_thread.c b/src/platforms/posix/work_queue/hrt_thread.c index 49a0a17a6a..02d089d145 100644 --- a/src/platforms/posix/work_queue/hrt_thread.c +++ b/src/platforms/posix/work_queue/hrt_thread.c @@ -66,7 +66,7 @@ struct wqueue_s g_hrt_work; /**************************************************************************** * Private Variables ****************************************************************************/ -sem_t _hrt_work_lock; +px4_sem_t _hrt_work_lock; /**************************************************************************** * Private Functions @@ -241,7 +241,7 @@ static int work_hrtthread(int argc, char *argv[]) void hrt_work_queue_init(void) { - sem_init(&_hrt_work_lock, 0, 1); + px4_sem_init(&_hrt_work_lock, 0, 1); // Create high priority worker thread g_hrt_work.pid = px4_task_spawn_cmd("wkr_hrt", diff --git a/src/platforms/posix/work_queue/work_lock.c b/src/platforms/posix/work_queue/work_lock.c index 3547362816..31fa1b7562 100644 --- a/src/platforms/posix/work_queue/work_lock.c +++ b/src/platforms/posix/work_queue/work_lock.c @@ -31,21 +31,19 @@ * ****************************************************************************/ #include -#include +#include #include #include "work_lock.h" -extern sem_t _work_lock[]; +extern px4_sem_t _work_lock[]; void work_lock(int id) { - //PX4_INFO("work_lock %d", id); - sem_wait(&_work_lock[id]); + px4_sem_wait(&_work_lock[id]); } void work_unlock(int id) { - //PX4_INFO("work_unlock %d", id); - sem_post(&_work_lock[id]); + px4_sem_post(&_work_lock[id]); } diff --git a/src/platforms/posix/work_queue/work_thread.c b/src/platforms/posix/work_queue/work_thread.c index 9e3a507a4d..942e3a1857 100644 --- a/src/platforms/posix/work_queue/work_thread.c +++ b/src/platforms/posix/work_queue/work_thread.c @@ -68,7 +68,7 @@ struct wqueue_s g_work[NWORKERS]; /**************************************************************************** * Private Variables ****************************************************************************/ -sem_t _work_lock[NWORKERS]; +px4_sem_t _work_lock[NWORKERS]; /**************************************************************************** * Private Functions @@ -187,10 +187,10 @@ static void work_process(struct wqueue_s *wqueue, int lock_id) ****************************************************************************/ void work_queues_init(void) { - sem_init(&_work_lock[HPWORK], 0, 1); - sem_init(&_work_lock[LPWORK], 0, 1); + px4_sem_init(&_work_lock[HPWORK], 0, 1); + px4_sem_init(&_work_lock[LPWORK], 0, 1); #ifdef CONFIG_SCHED_USRWORK - sem_init(&_work_lock[USRWORK], 0, 1); + px4_sem_init(&_work_lock[USRWORK], 0, 1); #endif // Create high priority worker thread From 76508ab5b5e5c1c2e70987795d6816a4e69fc770 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:27:41 +0200 Subject: [PATCH 162/389] Device:: Move to POSIX semaphore abstraction --- src/drivers/device/cdev.cpp | 4 ++-- src/drivers/device/device_posix.cpp | 27 +++++---------------------- src/drivers/device/vdev.cpp | 9 +++++---- src/drivers/device/vdev.h | 6 +++--- src/drivers/device/vdev_posix.cpp | 14 +++++++------- 5 files changed, 22 insertions(+), 38 deletions(-) diff --git a/src/drivers/device/cdev.cpp b/src/drivers/device/cdev.cpp index 3bc05b0c73..048357ebc8 100644 --- a/src/drivers/device/cdev.cpp +++ b/src/drivers/device/cdev.cpp @@ -306,7 +306,7 @@ CDev::poll(file_t *filp, struct pollfd *fds, bool setup) /* yes? post the notification */ if (fds->revents != 0) - sem_post(fds->sem); + px4_sem_post(fds->sem); } } else { @@ -343,7 +343,7 @@ CDev::poll_notify_one(struct pollfd *fds, pollevent_t events) /* if the state is now interesting, wake the waiter if it's still asleep */ /* XXX semcount check here is a vile hack; counting semphores should not be abused as cvars */ if ((fds->revents != 0) && (fds->sem->semcount <= 0)) - sem_post(fds->sem); + px4_sem_post(fds->sem); } pollevent_t diff --git a/src/drivers/device/device_posix.cpp b/src/drivers/device/device_posix.cpp index 05ae355709..bed97ff56d 100644 --- a/src/drivers/device/device_posix.cpp +++ b/src/drivers/device/device_posix.cpp @@ -55,24 +55,11 @@ Device::Device(const char *name) : _name(name), _debug_enabled(false) { - #ifndef __PX4_DARWIN - _lock = new sem_t; - int ret = sem_init(_lock, 0, 1); + int ret = px4_sem_init(&_lock, 0, 1); - if (ret != 0) { - PX4_WARN("SEM INIT FAIL: ret %d, %s", ret, strerror(errno)); - } - #else - _lock_name = new char[strlen(_name) + 2]; - _lock_name[0] = '/'; - strcpy(&_lock_name[1], _name); - /* not using O_EXCL as the device handles are unique */ - _lock = sem_open(_lock_name, O_CREAT, 0777, 1); - - if (_lock == SEM_FAILED) { - PX4_WARN("SEM INIT FAIL: %s", strerror(errno)); - } - #endif + if (ret != 0) { + PX4_WARN("SEM INIT FAIL: ret %d, %s", ret, strerror(errno)); + } /* setup a default device ID. When bus_type is UNKNOWN the other fields are invalid */ @@ -85,11 +72,7 @@ Device::Device(const char *name) : Device::~Device() { - #ifdef __PX4_DARWIN - sem_unlink(_name); - #else - sem_destroy(_lock); - #endif + px4_sem_destroy(&_lock); } int diff --git a/src/drivers/device/vdev.cpp b/src/drivers/device/vdev.cpp index 430b121c09..1900f19fbe 100644 --- a/src/drivers/device/vdev.cpp +++ b/src/drivers/device/vdev.cpp @@ -366,7 +366,7 @@ VDev::poll(file_t *filep, px4_pollfd_struct_t *fds, bool setup) /* yes? post the notification */ if (fds->revents != 0) - sem_post(fds->sem); + px4_sem_post(fds->sem); } else { PX4_WARN("Store Poll Waiter error."); } @@ -403,7 +403,7 @@ VDev::poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events) { PX4_DEBUG("VDev::poll_notify_one"); int value; - sem_getvalue(fds->sem, &value); + px4_sem_getvalue(fds->sem, &value); /* update the reported event set */ fds->revents |= fds->events & events; @@ -412,8 +412,9 @@ VDev::poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events) /* if the state is now interesting, wake the waiter if it's still asleep */ /* XXX semcount check here is a vile hack; counting semphores should not be abused as cvars */ - if ((fds->revents != 0) && (value <= 0)) - sem_post(fds->sem); + if ((fds->revents != 0) && (value <= 0)) { + px4_sem_post(fds->sem); + } } pollevent_t diff --git a/src/drivers/device/vdev.h b/src/drivers/device/vdev.h index 3b4aae01ed..89e06358f5 100644 --- a/src/drivers/device/vdev.h +++ b/src/drivers/device/vdev.h @@ -181,7 +181,7 @@ protected: */ void lock() { DEVICE_DEBUG("lock"); - do {} while (sem_wait(_lock) != 0); + do {} while (px4_sem_wait(&_lock) != 0); } /** @@ -189,11 +189,11 @@ protected: */ void unlock() { DEVICE_DEBUG("unlock"); - sem_post(_lock); + px4_sem_post(&_lock); } private: - sem_t * _lock; + px4_sem_t _lock; /** disable copy construction for this and all subclasses */ Device(const Device &); diff --git a/src/drivers/device/vdev_posix.cpp b/src/drivers/device/vdev_posix.cpp index 44aea614cc..cf6645e106 100644 --- a/src/drivers/device/vdev_posix.cpp +++ b/src/drivers/device/vdev_posix.cpp @@ -56,8 +56,8 @@ extern "C" { static void timer_cb(void *data) { - sem_t *p_sem = (sem_t *)data; - sem_post(p_sem); + px4_sem_t *p_sem = (px4_sem_t *)data; + px4_sem_post(p_sem); PX4_DEBUG("timer_handler: Timer expired"); } @@ -193,13 +193,13 @@ int px4_ioctl(int fd, int cmd, unsigned long arg) int px4_poll(px4_pollfd_struct_t *fds, nfds_t nfds, int timeout) { - sem_t sem; + px4_sem_t sem; int count = 0; int ret; unsigned int i; PX4_DEBUG("Called px4_poll timeout = %d", timeout); - sem_init(&sem, 0, 0); + px4_sem_init(&sem, 0, 0); // For each fd for (i=0; i Date: Sun, 20 Sep 2015 00:28:08 +0200 Subject: [PATCH 163/389] POSIX: PX4 posix header fixes --- src/platforms/px4_posix.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/platforms/px4_posix.h b/src/platforms/px4_posix.h index 3c138e5a70..9aa7c0e15a 100644 --- a/src/platforms/px4_posix.h +++ b/src/platforms/px4_posix.h @@ -64,7 +64,7 @@ typedef struct __EXPORT int px4_sem_init(px4_sem_t *s, int pshared, unsigned value); __EXPORT int px4_sem_wait(px4_sem_t *s); __EXPORT int px4_sem_post(px4_sem_t *s); -__EXPORT int px4_sem_getvalue(px4_sem_t *s); +__EXPORT int px4_sem_getvalue(px4_sem_t *s, int *sval); __EXPORT int px4_sem_destroy(px4_sem_t *s); __END_DECLS @@ -75,8 +75,8 @@ typedef px4_sem_t sem_t #define px4_sem_init _GLOBAL sem_init #define px4_sem_wait _GLOBAL sem_wait -#define px4_sem_post _GLOBAL px4_sem_post -#define px4_sem_getvalue _GLOBAL px4_sem_getvalue +#define px4_sem_post _GLOBAL sem_post +#define px4_sem_getvalue _GLOBAL sem_getvalue #define px4_sem_destroy _GLOBAL sem_destroy @@ -122,7 +122,7 @@ typedef struct { pollevent_t revents; /* The output event flags */ /* Required for PX4 compatability */ - sem_t *sem; /* Pointer to semaphore used to post output event */ + px4_sem_t *sem; /* Pointer to semaphore used to post output event */ void *priv; /* For use by drivers */ } px4_pollfd_struct_t; From aba2d007dfd5f7cc0bcbdad21992c14aa1105a7c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:28:24 +0200 Subject: [PATCH 164/389] IO: Move to semaphore abstraction --- src/drivers/px4io/px4io_serial.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/drivers/px4io/px4io_serial.cpp b/src/drivers/px4io/px4io_serial.cpp index c05883aeb8..344b1affa3 100644 --- a/src/drivers/px4io/px4io_serial.cpp +++ b/src/drivers/px4io/px4io_serial.cpp @@ -116,10 +116,10 @@ private: volatile unsigned _rx_dma_status; /** bus-ownership lock */ - sem_t _bus_semaphore; + px4_sem_t _bus_semaphore; /** client-waiting lock/signal */ - sem_t _completion_semaphore; + px4_sem_t _completion_semaphore; /** * Start the transaction with IO and wait for it to complete. @@ -177,8 +177,8 @@ PX4IO_serial::PX4IO_serial() : _tx_dma(nullptr), _rx_dma(nullptr), _rx_dma_status(_dma_status_inactive), - _bus_semaphore(SEM_INITIALIZER(0)), - _completion_semaphore(SEM_INITIALIZER(0)), + _bus_semaphore(px4_sem_initIALIZER(0)), + _completion_semaphore(px4_sem_initIALIZER(0)), _pc_txns(perf_alloc(PC_ELAPSED, "io_txns ")), _pc_dmasetup(perf_alloc(PC_ELAPSED, "io_dmasetup ")), _pc_retries(perf_alloc(PC_COUNT, "io_retries ")), @@ -219,8 +219,8 @@ PX4IO_serial::~PX4IO_serial() stm32_unconfiggpio(PX4IO_SERIAL_RX_GPIO); /* and kill our semaphores */ - sem_destroy(&_completion_semaphore); - sem_destroy(&_bus_semaphore); + px4_sem_destroy(&_completion_semaphore); + px4_sem_destroy(&_bus_semaphore); perf_free(_pc_txns); perf_free(_pc_dmasetup); @@ -280,8 +280,8 @@ PX4IO_serial::init() rCR1 = USART_CR1_RE | USART_CR1_TE | USART_CR1_UE | USART_CR1_IDLEIE; /* create semaphores */ - sem_init(&_completion_semaphore, 0, 0); - sem_init(&_bus_semaphore, 0, 1); + px4_sem_init(&_completion_semaphore, 0, 0); + px4_sem_init(&_bus_semaphore, 0, 1); /* XXX this could try talking to IO */ @@ -366,7 +366,7 @@ PX4IO_serial::write(unsigned address, void *data, unsigned count) return -EINVAL; } - sem_wait(&_bus_semaphore); + px4_sem_wait(&_bus_semaphore); int result; @@ -403,7 +403,7 @@ PX4IO_serial::write(unsigned address, void *data, unsigned count) perf_count(_pc_retries); } - sem_post(&_bus_semaphore); + px4_sem_post(&_bus_semaphore); if (result == OK) { result = count; @@ -423,7 +423,7 @@ PX4IO_serial::read(unsigned address, void *data, unsigned count) return -EINVAL; } - sem_wait(&_bus_semaphore); + px4_sem_wait(&_bus_semaphore); int result; @@ -468,7 +468,7 @@ PX4IO_serial::read(unsigned address, void *data, unsigned count) perf_count(_pc_retries); } - sem_post(&_bus_semaphore); + px4_sem_post(&_bus_semaphore); if (result == OK) { result = count; @@ -551,7 +551,7 @@ PX4IO_serial::_wait_complete() int ret; for (;;) { - ret = sem_timedwait(&_completion_semaphore, &abstime); + ret = px4_sem_timedwait(&_completion_semaphore, &abstime); if (ret == OK) { /* check for DMA errors */ @@ -627,7 +627,7 @@ PX4IO_serial::_do_rx_dma_callback(unsigned status) rCR3 &= ~(USART_CR3_DMAT | USART_CR3_DMAR); /* complete now */ - sem_post(&_completion_semaphore); + px4_sem_post(&_completion_semaphore); } } From fa27e59ac434f2febf13c712353bcc8559c9f036 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:28:39 +0200 Subject: [PATCH 165/389] dataman: Move to semaphore abstraction --- src/modules/dataman/dataman.c | 59 ++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/modules/dataman/dataman.c b/src/modules/dataman/dataman.c index 6c9e9f0ee6..f0d145d417 100644 --- a/src/modules/dataman/dataman.c +++ b/src/modules/dataman/dataman.c @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -82,7 +83,7 @@ typedef enum { /** Work task work item */ typedef struct { sq_entry_t link; /**< list linkage */ - sem_t wait_sem; + px4_sem_t wait_sem; unsigned char first; unsigned char func; ssize_t result; @@ -128,8 +129,8 @@ static const unsigned g_per_item_max_index[DM_KEY_NUM_KEYS] = { static unsigned int g_key_offsets[DM_KEY_NUM_KEYS]; /* Item type lock mutexes */ -static sem_t *g_item_locks[DM_KEY_NUM_KEYS]; -static sem_t g_sys_state_mutex; +static px4_sem_t *g_item_locks[DM_KEY_NUM_KEYS]; +static px4_sem_t g_sys_state_mutex; /* The data manager store file handle and file name */ static int g_fd = -1, g_task_fd = -1; @@ -140,7 +141,7 @@ static char *k_data_manager_device_path = NULL; typedef struct { sq_queue_t q; /* Nuttx queue */ - sem_t mutex; /* Mutual exclusion on work queue adds and deletes */ + px4_sem_t mutex; /* Mutual exclusion on work queue adds and deletes */ unsigned size; /* Current size of queue */ unsigned max_size; /* Maximum queue size reached */ } work_q_t; @@ -148,8 +149,8 @@ typedef struct { static work_q_t g_free_q; /* queue of free work items. So that we don't always need to call malloc and free*/ static work_q_t g_work_q; /* pending work items. To be consumed by worker thread */ -sem_t g_work_queued_sema; /* To notify worker thread a work item has been queued */ -sem_t g_init_sema; +px4_sem_t g_work_queued_sema; /* To notify worker thread a work item has been queued */ +px4_sem_t g_init_sema; static bool g_task_should_exit; /**< if true, dataman task should exit */ @@ -159,26 +160,26 @@ static const unsigned k_sector_size = DM_MAX_DATA_SIZE + DM_SECTOR_HDR_SIZE; /* static void init_q(work_q_t *q) { sq_init(&(q->q)); /* Initialize the NuttX queue structure */ - sem_init(&(q->mutex), 1, 1); /* Queue is initially unlocked */ + px4_sem_init(&(q->mutex), 1, 1); /* Queue is initially unlocked */ q->size = q->max_size = 0; /* Queue is initially empty */ } static inline void destroy_q(work_q_t *q) { - sem_destroy(&(q->mutex)); /* Destroy the queue lock */ + px4_sem_destroy(&(q->mutex)); /* Destroy the queue lock */ } static inline void lock_queue(work_q_t *q) { - sem_wait(&(q->mutex)); /* Acquire the queue lock */ + px4_sem_wait(&(q->mutex)); /* Acquire the queue lock */ } static inline void unlock_queue(work_q_t *q) { - sem_post(&(q->mutex)); /* Release the queue lock */ + px4_sem_post(&(q->mutex)); /* Release the queue lock */ } static work_q_item_t * @@ -221,7 +222,7 @@ create_work_item(void) /* If we got one then lock the item*/ if (item) { - sem_init(&item->wait_sem, 1, 0); /* Caller will wait on this... initially locked */ + px4_sem_init(&item->wait_sem, 1, 0); /* Caller will wait on this... initially locked */ } /* return the item pointer, or NULL if all failed */ @@ -233,7 +234,7 @@ create_work_item(void) static inline void destroy_work_item(work_q_item_t *item) { - sem_destroy(&item->wait_sem); /* Destroy the item lock */ + px4_sem_destroy(&item->wait_sem); /* Destroy the item lock */ /* Return the item to the free item queue for later reuse */ lock_queue(&g_free_q); sq_addfirst(&item->link, &(g_free_q.q)); @@ -277,10 +278,10 @@ enqueue_work_item_and_wait_for_result(work_q_item_t *item) unlock_queue(&g_work_q); /* tell the work thread that work is available */ - sem_post(&g_work_queued_sema); + px4_sem_post(&g_work_queued_sema); /* wait for the result */ - sem_wait(&item->wait_sem); + px4_sem_wait(&item->wait_sem); int result = item->result; @@ -628,7 +629,7 @@ dm_lock(dm_item_t item) } if (g_item_locks[item]) { - sem_wait(g_item_locks[item]); + px4_sem_wait(g_item_locks[item]); } } @@ -645,7 +646,7 @@ dm_unlock(dm_item_t item) } if (g_item_locks[item]) { - sem_post(g_item_locks[item]); + px4_sem_post(g_item_locks[item]); } } @@ -691,7 +692,7 @@ task_main(int argc, char *argv[]) } /* Initialize the item type locks, for now only DM_KEY_MISSION_STATE supports locking */ - sem_init(&g_sys_state_mutex, 1, 1); /* Initially unlocked */ + px4_sem_init(&g_sys_state_mutex, 1, 1); /* Initially unlocked */ for (unsigned i = 0; i < DM_KEY_NUM_KEYS; i++) { g_item_locks[i] = NULL; @@ -704,7 +705,7 @@ task_main(int argc, char *argv[]) init_q(&g_work_q); init_q(&g_free_q); - sem_init(&g_work_queued_sema, 1, 0); + px4_sem_init(&g_work_queued_sema, 1, 0); /* See if the data manage file exists and is a multiple of the sector size */ g_task_fd = open(k_data_manager_device_path, O_RDONLY | O_BINARY); @@ -729,14 +730,14 @@ task_main(int argc, char *argv[]) if (g_task_fd < 0) { warnx("Could not open data manager file %s", k_data_manager_device_path); - sem_post(&g_init_sema); /* Don't want to hang startup */ + px4_sem_post(&g_init_sema); /* Don't want to hang startup */ return -1; } if ((unsigned)lseek(g_task_fd, max_offset, SEEK_SET) != max_offset) { close(g_task_fd); warnx("Could not seek data manager file %s", k_data_manager_device_path); - sem_post(&g_init_sema); /* Don't want to hang startup */ + px4_sem_post(&g_init_sema); /* Don't want to hang startup */ return -1; } @@ -771,7 +772,7 @@ task_main(int argc, char *argv[]) printf(", data manager file '%s' size is %d bytes\n", k_data_manager_device_path, max_offset); /* Tell startup that the worker thread has completed its initialization */ - sem_post(&g_init_sema); + px4_sem_post(&g_init_sema); /* Start the endless loop, waiting for then processing work requests */ while (true) { @@ -784,7 +785,7 @@ task_main(int argc, char *argv[]) if (!g_task_should_exit) { /* wait for work */ - sem_wait(&g_work_queued_sema); + px4_sem_wait(&g_work_queued_sema); } /* Empty the work queue */ @@ -821,7 +822,7 @@ task_main(int argc, char *argv[]) } /* Inform the caller that work is done */ - sem_post(&work->wait_sem); + px4_sem_post(&work->wait_sem); } /* time to go???? */ @@ -846,8 +847,8 @@ task_main(int argc, char *argv[]) destroy_q(&g_work_q); destroy_q(&g_free_q); - sem_destroy(&g_work_queued_sema); - sem_destroy(&g_sys_state_mutex); + px4_sem_destroy(&g_work_queued_sema); + px4_sem_destroy(&g_sys_state_mutex); return 0; } @@ -857,7 +858,7 @@ start(void) { int task; - sem_init(&g_init_sema, 1, 0); + px4_sem_init(&g_init_sema, 1, 0); /* start the worker thread */ if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT, 1500, task_main, NULL)) <= 0) { @@ -866,8 +867,8 @@ start(void) } /* wait for the thread to actually initialize */ - sem_wait(&g_init_sema); - sem_destroy(&g_init_sema); + px4_sem_wait(&g_init_sema); + px4_sem_destroy(&g_init_sema); return 0; } @@ -888,7 +889,7 @@ stop(void) { /* Tell the worker task to shut down */ g_task_should_exit = true; - sem_post(&g_work_queued_sema); + px4_sem_post(&g_work_queued_sema); } static void From a2ea70c7a044bbb7ee33ba31f26caa1c30c91768 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:29:03 +0200 Subject: [PATCH 166/389] Simulator: Move to semaphore abstraction --- src/modules/simulator/simulator.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/simulator/simulator.h b/src/modules/simulator/simulator.h index af4b8a746c..f42baaf5ac 100644 --- a/src/modules/simulator/simulator.h +++ b/src/modules/simulator/simulator.h @@ -125,7 +125,7 @@ public: _max_readers(readers), _report_len(sizeof(RType)) { - sem_init(&_lock, 0, _max_readers); + px4_sem_init(&_lock, 0, _max_readers); } ~Report() {}; @@ -149,23 +149,23 @@ public: } protected: - void read_lock() { sem_wait(&_lock); } - void read_unlock() { sem_post(&_lock); } + void read_lock() { px4_sem_wait(&_lock); } + void read_unlock() { px4_sem_post(&_lock); } void write_lock() { for (int i=0; i<_max_readers; i++) { - sem_wait(&_lock); + px4_sem_wait(&_lock); } } void write_unlock() { for (int i=0; i<_max_readers; i++) { - sem_post(&_lock); + px4_sem_post(&_lock); } } int _readidx; - sem_t _lock; + px4_sem_t _lock; const int _max_readers; const int _report_len; RType _buf[2]; From b3a8ba4e9253aaba9f7505ac6226138ce4119bcc Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:29:22 +0200 Subject: [PATCH 167/389] param: Move to POSIX semaphore abstraction --- src/modules/systemlib/param/param.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 4efe7bea0d..4ba9d32004 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -147,14 +147,14 @@ static param_t param_find_internal(const char *name, bool notification); static void param_lock(void) { - //do {} while (sem_wait(¶m_sem) != 0); + //do {} while (px4_sem_wait(¶m_sem) != 0); } /** unlock the parameter store */ static void param_unlock(void) { - //sem_post(¶m_sem); + //px4_sem_post(¶m_sem); } /** assert that the parameter store is locked */ From 3599b577dfe5e43aaff0f72ad274800d4e75b17f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:29:38 +0200 Subject: [PATCH 168/389] Tests: Move to semaphore abstraction --- src/systemcmds/tests/test_dataman.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/systemcmds/tests/test_dataman.c b/src/systemcmds/tests/test_dataman.c index da73f68964..3478077b21 100644 --- a/src/systemcmds/tests/test_dataman.c +++ b/src/systemcmds/tests/test_dataman.c @@ -59,7 +59,7 @@ #include "dataman/dataman.h" -static sem_t *sems; +static px4_sem_t *sems; static int task_main(int argc, char *argv[]) @@ -137,12 +137,12 @@ task_main(int argc, char *argv[]) rend = hrt_absolute_time(); warnx("Test %d pass, hit %d, miss %d, io time read %llums. write %llums.", my_id, hit, miss, (rend - rstart) / NUM_MISSIONS_SUPPORTED / 1000, (wend - wstart) / NUM_MISSIONS_SUPPORTED / 1000); - sem_post(sems + my_id); + px4_sem_post(sems + my_id); return 0; fail: warnx("Test %d fail, buffer %02x %02x %02x %02x %02x %02x", my_id, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); - sem_post(sems + my_id); + px4_sem_post(sems + my_id); return -1; } @@ -155,7 +155,7 @@ int test_dataman(int argc, char *argv[]) num_tasks = atoi(argv[1]); } - sems = (sem_t *)malloc(num_tasks * sizeof(sem_t)); + sems = (px4_sem_t *)malloc(num_tasks * sizeof(px4_sem_t)); warnx("Running %d tasks", num_tasks); for (i = 0; i < num_tasks; i++) { @@ -165,7 +165,7 @@ int test_dataman(int argc, char *argv[]) const char *av[2]; av[0] = a; av[1] = 0; - sem_init(sems + i, 1, 0); + px4_sem_init(sems + i, 1, 0); /* start the task */ if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2048, task_main, av)) <= 0) { @@ -174,8 +174,8 @@ int test_dataman(int argc, char *argv[]) } for (i = 0; i < num_tasks; i++) { - sem_wait(sems + i); - sem_destroy(sems + i); + px4_sem_wait(sems + i); + px4_sem_destroy(sems + i); } free(sems); From f37f8fb977caf7c6c0cd1991e73d6dbce68cfc2c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:30:12 +0200 Subject: [PATCH 169/389] UAVCAN: Move to semaphore abstraction --- src/modules/uavcan/uavcan_main.cpp | 14 +++++++------- src/modules/uavcan/uavcan_main.hpp | 2 +- src/modules/uavcan/uavcan_virtual_can_driver.hpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index ed3ba5e445..511e5f7157 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -94,7 +94,7 @@ UavcanNode::UavcanNode(uavcan::ICanDriver &can_driver, uavcan::ISystemClock &sys std::abort(); } - res = sem_init(&_server_command_sem, 0 , 0); + res = px4_sem_init(&_server_command_sem, 0 , 0); if (res < 0) { std::abort(); @@ -158,7 +158,7 @@ UavcanNode::~UavcanNode() perf_free(_perfcnt_esc_mixer_output_elapsed); perf_free(_perfcnt_esc_mixer_total_elapsed); pthread_mutex_destroy(&_node_mutex); - sem_destroy(&_server_command_sem); + px4_sem_destroy(&_server_command_sem); } @@ -208,7 +208,7 @@ int UavcanNode::start_fw_server() } _fw_server_action = None; - sem_post(&_server_command_sem); + px4_sem_post(&_server_command_sem); return rv; } @@ -224,7 +224,7 @@ int UavcanNode::request_fw_check() } _fw_server_action = None; - sem_post(&_server_command_sem); + px4_sem_post(&_server_command_sem); return rv; } @@ -248,7 +248,7 @@ int UavcanNode::stop_fw_server() } _fw_server_action = None; - sem_post(&_server_command_sem); + px4_sem_post(&_server_command_sem); return rv; } @@ -263,7 +263,7 @@ int UavcanNode::fw_server(eServerAction action) case CheckFW: if (_fw_server_action == None) { _fw_server_action = action; - sem_wait(&_server_command_sem); + px4_sem_wait(&_server_command_sem); rv = _fw_server_status; } @@ -678,7 +678,7 @@ UavcanNode::control_callback(uintptr_t handle, uint8_t control_group, uint8_t co int UavcanNode::teardown() { - sem_post(&_server_command_sem); + px4_sem_post(&_server_command_sem); for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) { if (_control_subs[i] > 0) { diff --git a/src/modules/uavcan/uavcan_main.hpp b/src/modules/uavcan/uavcan_main.hpp index acc1c32843..d023fe4583 100644 --- a/src/modules/uavcan/uavcan_main.hpp +++ b/src/modules/uavcan/uavcan_main.hpp @@ -148,7 +148,7 @@ private: Node _node; ///< library instance pthread_mutex_t _node_mutex; - sem_t _server_command_sem; + px4_sem_t _server_command_sem; UavcanEscController _esc_controller; List _sensor_bridges; ///< List of active sensor bridges diff --git a/src/modules/uavcan/uavcan_virtual_can_driver.hpp b/src/modules/uavcan/uavcan_virtual_can_driver.hpp index 5ef9de0d87..1c861e481c 100644 --- a/src/modules/uavcan/uavcan_virtual_can_driver.hpp +++ b/src/modules/uavcan/uavcan_virtual_can_driver.hpp @@ -395,7 +395,7 @@ class VirtualCanDriver : public uavcan::ICanDriver, int rv = sem_getvalue(&sem, &count); if (rv > 0 && count <= 0) { - sem_post(&sem); + px4_sem_post(&sem); } } }; From 16717dc2d4730197a76b09beebd26de98e972e07 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:30:49 +0200 Subject: [PATCH 170/389] CLANG: Make deprecated warnings errors --- cmake/toolchains/Toolchain-posix-clang-native.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/toolchains/Toolchain-posix-clang-native.cmake b/cmake/toolchains/Toolchain-posix-clang-native.cmake index 3629ab0cdf..da687ce551 100644 --- a/cmake/toolchains/Toolchain-posix-clang-native.cmake +++ b/cmake/toolchains/Toolchain-posix-clang-native.cmake @@ -21,6 +21,7 @@ set(WARNINGS -Werror=uninitialized -Werror=init-self -Werror=return-type + -Werror=deprecated -Wno-packed -Wno-frame-larger-than= #-Wcast-qual - generates spurious noreturn attribute warnings, From 2c232567e4d7fc47fcaba5c6f8591ad2363d0629 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 19 Sep 2015 17:10:15 +0200 Subject: [PATCH 171/389] MAVLink app: Add broadcast until GCS is connected --- src/modules/mavlink/mavlink_main.cpp | 24 ++++++++++++++++++++++-- src/modules/mavlink/mavlink_main.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index ea810c8233..4fc3baf8df 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -178,6 +178,9 @@ Mavlink::Mavlink() : _rate_tx(0.0f), _rate_txerr(0.0f), _rate_rx(0.0f), + _myaddr{}, + _src_addr{}, + _bcast_addr{}, _socket_fd(-1), _protocol(SERIAL), _network_port(14556), @@ -883,8 +886,19 @@ Mavlink::send_message(const uint8_t msgid, const void *msg, uint8_t component_ID #else if (get_protocol() == UDP) { ret = sendto(_socket_fd, buf, packet_len, 0, (struct sockaddr *)&_src_addr, sizeof(_src_addr)); + + struct telemetry_status_s &tstatus = get_rx_status(); + + /* resend heartbeat via broadcast */ + if (((hrt_elapsed_time(&tstatus.heartbeat_time) > 3 * 1000 * 1000) || + (tstatus.heartbeat_time == 0)) && + msgid == MAVLINK_MSG_ID_HEARTBEAT) { + + (void)sendto(_socket_fd, buf, packet_len, 0, (struct sockaddr *)&_bcast_addr, sizeof(_bcast_addr)); + } + } else if (get_protocol() == TCP) { - // not implemented, but possible to do so + /* not implemented, but possible to do so */ warnx("TCP transport pending implementation"); } #endif @@ -975,12 +989,18 @@ Mavlink::init_udp() return; } - // set default target address + /* set default target address */ memset((char *)&_src_addr, 0, sizeof(_src_addr)); _src_addr.sin_family = AF_INET; inet_aton("127.0.0.1", &_src_addr.sin_addr); _src_addr.sin_port = htons(DEFAULT_REMOTE_PORT_UDP); + /* default broadcast address */ + memset((char *)&_bcast_addr, 0, sizeof(_bcast_addr)); + _bcast_addr.sin_family = AF_INET; + inet_aton("255.255.255.255", &_bcast_addr.sin_addr); + _bcast_addr.sin_port = htons(DEFAULT_REMOTE_PORT_UDP); + #endif } diff --git a/src/modules/mavlink/mavlink_main.h b/src/modules/mavlink/mavlink_main.h index 4d28b1c6e5..ef14562ccc 100644 --- a/src/modules/mavlink/mavlink_main.h +++ b/src/modules/mavlink/mavlink_main.h @@ -417,6 +417,7 @@ private: #ifdef __PX4_POSIX struct sockaddr_in _myaddr; struct sockaddr_in _src_addr; + struct sockaddr_in _bcast_addr; #endif int _socket_fd; From b66386ff8c5538be08329a1a70fc0a6e8ae0381c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:47:47 +0200 Subject: [PATCH 172/389] MAVLink: Correct defines for Darwin --- src/modules/mavlink/mavlink_main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 4fc3baf8df..ef7b8031b8 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -698,7 +698,7 @@ int Mavlink::mavlink_open_uart(int baud, const char *uart_name, struct termios * _is_usb_uart = true; } -#ifdef __PX4_LINUX +#if defined (__PX4_LINUX) || defined (__PX4_DARWIN) /* Put in raw mode */ cfmakeraw(&uart_config); #endif @@ -799,7 +799,7 @@ Mavlink::get_free_tx_buf() #ifndef __PX4_POSIX // No FIONWRITE on Linux -#if !defined(__PX4_LINUX) +#if !defined(__PX4_LINUX) && !defined(__PX4_DARWIN) (void) ioctl(_uart_fd, FIONWRITE, (unsigned long)&buf_free); #endif @@ -971,7 +971,7 @@ Mavlink::resend_message(mavlink_message_t *msg) void Mavlink::init_udp() { -#ifdef __PX4_LINUX +#if defined (__PX4_LINUX) || defined (__PX4_DARWIN) PX4_INFO("Setting up UDP w/port %d\n",_network_port); memset((char *)&_myaddr, 0, sizeof(_myaddr)); From 20bde7e5e8b1ba266f44bceeb7957e451df4fa0b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 00:50:34 +0200 Subject: [PATCH 173/389] Fix typedef for px4_sem_t --- src/platforms/px4_posix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/px4_posix.h b/src/platforms/px4_posix.h index 9aa7c0e15a..9674b1c896 100644 --- a/src/platforms/px4_posix.h +++ b/src/platforms/px4_posix.h @@ -71,7 +71,7 @@ __END_DECLS #else -typedef px4_sem_t sem_t +typedef sem_t px4_sem_t #define px4_sem_init _GLOBAL sem_init #define px4_sem_wait _GLOBAL sem_wait From 81725398561a3bca01539c74318b832cc338a953 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:22:17 +0200 Subject: [PATCH 174/389] POSIX: Fix px4_sem_t typedef --- src/platforms/px4_posix.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/platforms/px4_posix.h b/src/platforms/px4_posix.h index 9674b1c896..b061f89fa8 100644 --- a/src/platforms/px4_posix.h +++ b/src/platforms/px4_posix.h @@ -71,7 +71,7 @@ __END_DECLS #else -typedef sem_t px4_sem_t +typedef sem_t px4_sem_t; #define px4_sem_init _GLOBAL sem_init #define px4_sem_wait _GLOBAL sem_wait @@ -79,8 +79,6 @@ typedef sem_t px4_sem_t #define px4_sem_getvalue _GLOBAL sem_getvalue #define px4_sem_destroy _GLOBAL sem_destroy - - #endif //################################### From b39dc4694ba2ed3399d4a4a01a5b0a146f2af8dd Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:22:35 +0200 Subject: [PATCH 175/389] MAVLink: Fix NuttX build --- src/modules/mavlink/mavlink_main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index ef7b8031b8..58b5a3240a 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -178,9 +178,11 @@ Mavlink::Mavlink() : _rate_tx(0.0f), _rate_txerr(0.0f), _rate_rx(0.0f), +#ifdef __PX4_POSIX _myaddr{}, _src_addr{}, _bcast_addr{}, +#endif _socket_fd(-1), _protocol(SERIAL), _network_port(14556), From 089951250751fdfb866bfc456dd3a65794df5662 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:22:53 +0200 Subject: [PATCH 176/389] HRT: Do not depend on POSIX --- src/drivers/drv_hrt.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/drivers/drv_hrt.h b/src/drivers/drv_hrt.h index 3ef3dbce94..a40943d3f2 100644 --- a/src/drivers/drv_hrt.h +++ b/src/drivers/drv_hrt.h @@ -39,7 +39,6 @@ #pragma once -#include #include #include #include From cbc70616f9f3a42e65becb52a7f7baed9145ec70 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:23:05 +0200 Subject: [PATCH 177/389] LED: Do not depend on POSIX --- src/drivers/led/led.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/drivers/led/led.cpp b/src/drivers/led/led.cpp index 7ff53fc423..831e8f4634 100644 --- a/src/drivers/led/led.cpp +++ b/src/drivers/led/led.cpp @@ -38,7 +38,6 @@ */ #include -#include #include #include #include From ef61c4e2991af0e5e49f0ccc9f97318b3f80f7ed Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:23:27 +0200 Subject: [PATCH 178/389] IO: Remove outdated check --- src/drivers/px4io/px4io.cpp | 10 ++-------- src/drivers/px4io/px4io_serial.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 7694850181..507211caad 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -2973,10 +2973,7 @@ get_interface() #ifndef CONFIG_ARCH_BOARD_PX4FMU_V1 #ifdef PX4IO_SERIAL_BASE - /* try for a serial interface */ - if (PX4IO_serial_interface != nullptr) { - interface = PX4IO_serial_interface(); - } + interface = PX4IO_serial_interface(); #endif if (interface != nullptr) { @@ -2986,10 +2983,7 @@ get_interface() #endif #ifdef PX4_I2C_OBDEV_PX4IO - /* try for an I2C interface if we haven't got a serial one */ - if (PX4IO_i2c_interface != nullptr) { - interface = PX4IO_i2c_interface(); - } + interface = PX4IO_i2c_interface(); #endif if (interface != nullptr) { diff --git a/src/drivers/px4io/px4io_serial.cpp b/src/drivers/px4io/px4io_serial.cpp index 344b1affa3..2c38c0dd3c 100644 --- a/src/drivers/px4io/px4io_serial.cpp +++ b/src/drivers/px4io/px4io_serial.cpp @@ -39,6 +39,7 @@ /* XXX trim includes */ #include +#include #include #include @@ -177,8 +178,8 @@ PX4IO_serial::PX4IO_serial() : _tx_dma(nullptr), _rx_dma(nullptr), _rx_dma_status(_dma_status_inactive), - _bus_semaphore(px4_sem_initIALIZER(0)), - _completion_semaphore(px4_sem_initIALIZER(0)), + _bus_semaphore(SEM_INITIALIZER(0)), + _completion_semaphore(SEM_INITIALIZER(0)), _pc_txns(perf_alloc(PC_ELAPSED, "io_txns ")), _pc_dmasetup(perf_alloc(PC_ELAPSED, "io_dmasetup ")), _pc_retries(perf_alloc(PC_COUNT, "io_retries ")), @@ -551,7 +552,7 @@ PX4IO_serial::_wait_complete() int ret; for (;;) { - ret = px4_sem_timedwait(&_completion_semaphore, &abstime); + ret = sem_timedwait(&_completion_semaphore, &abstime); if (ret == OK) { /* check for DMA errors */ From b35435904c7abf6f9aaf22fa2d55298fc58d56a7 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:23:43 +0200 Subject: [PATCH 179/389] Q Estimator: Add missing check --- src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp b/src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp index 138a8c7e5c..72b35d3b5f 100644 --- a/src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp +++ b/src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp @@ -40,6 +40,7 @@ */ #include +#include #include #include #include From 616b9f7bc07addc4c21b563b3e2a177876bf7d0f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:25:16 +0200 Subject: [PATCH 180/389] Land detector: Add missing POSIX header --- src/modules/land_detector/FixedwingLandDetector.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/land_detector/FixedwingLandDetector.cpp b/src/modules/land_detector/FixedwingLandDetector.cpp index dac5e6a3f9..7cfe65bb7f 100644 --- a/src/modules/land_detector/FixedwingLandDetector.cpp +++ b/src/modules/land_detector/FixedwingLandDetector.cpp @@ -40,6 +40,8 @@ #include "FixedwingLandDetector.h" +#include +#include #include #include From 54493154b9740d9b57980f3822b13464dcf953d8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:25:43 +0200 Subject: [PATCH 181/389] INAV: Add missing POSIX header --- .../position_estimator_inav/position_estimator_inav_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/position_estimator_inav/position_estimator_inav_main.c b/src/modules/position_estimator_inav/position_estimator_inav_main.c index 892e50f3a1..77cb75073c 100644 --- a/src/modules/position_estimator_inav/position_estimator_inav_main.c +++ b/src/modules/position_estimator_inav/position_estimator_inav_main.c @@ -39,6 +39,7 @@ * @author Nuno Marques */ +#include #include #include #include From 5f2ae6ad674cddedba88ceb37bb013d42ca54044 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:25:55 +0200 Subject: [PATCH 182/389] SDLOG2: Add missing POSIX header --- src/modules/sdlog2/sdlog2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index 1667ed6ed1..b038cc0dcd 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #ifdef __PX4_DARWIN From bc8f4cf47ffbd32838b5bf7319821f750feef99e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:26:11 +0200 Subject: [PATCH 183/389] CLANG: Add more errors --- cmake/toolchains/Toolchain-posix-clang-native.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/toolchains/Toolchain-posix-clang-native.cmake b/cmake/toolchains/Toolchain-posix-clang-native.cmake index da687ce551..544f61f826 100644 --- a/cmake/toolchains/Toolchain-posix-clang-native.cmake +++ b/cmake/toolchains/Toolchain-posix-clang-native.cmake @@ -22,6 +22,7 @@ set(WARNINGS -Werror=init-self -Werror=return-type -Werror=deprecated + -Werror=unused-private-field -Wno-packed -Wno-frame-larger-than= #-Wcast-qual - generates spurious noreturn attribute warnings, From f58c4c1c1cc705e8f15f2d2abd27c512f9300854 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 18:59:35 -0400 Subject: [PATCH 184/389] Fix to gdbinit script. --- src/firmware/nuttx/gdbinit.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/firmware/nuttx/gdbinit.in b/src/firmware/nuttx/gdbinit.in index a927caeed0..2cb3727170 100644 --- a/src/firmware/nuttx/gdbinit.in +++ b/src/firmware/nuttx/gdbinit.in @@ -1,7 +1,7 @@ target extended ${DEBUG_PORT} -monitor swdp_scan +#monitor swdp_scan attach 1 monitor vector_catch disable hard set mem inaccessible-by-default off set print pretty -source Debug/PX4 +source ${CMAKE_SOURCE_DIR}/Debug/PX4 From 501f3cf2dfa7fb51caecc2febe49d9b811757683 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 19 Sep 2015 23:58:17 -0400 Subject: [PATCH 185/389] Fix for tracking nuttx config changes. --- cmake/nuttx/px4_impl_nuttx.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 7533e139f1..ca46ea13f8 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -231,6 +231,7 @@ function(px4_nuttx_add_export) DEPENDS nuttx_copy_${CONFIG}.stamp __nuttx_patch_${CONFIG}) # export + file(GLOB_RECURSE config_files ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG}/*) add_custom_command(OUTPUT ${CONFIG}.export COMMAND ${ECHO} Configuring NuttX for ${CONFIG} COMMAND ${MAKE} -C${nuttx_src}/nuttx -j${THREADS} @@ -244,7 +245,7 @@ function(px4_nuttx_add_export) -r CONFIG_ARCH_BOARD=${CONFIG} export COMMAND ${CP} -r ${nuttx_src}/nuttx/nuttx-export.zip ${CONFIG}.export - DEPENDS ${DEPENDS} __nuttx_copy_${CONFIG}) + DEPENDS ${config_files} ${DEPENDS} __nuttx_copy_${CONFIG}) # extract add_custom_command(OUTPUT nuttx_export_${CONFIG}.stamp From 36ae7c129dd27b3695a1b5b3282b48ea210bcd5f Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 20 Sep 2015 01:10:52 -0400 Subject: [PATCH 186/389] Fixed alignment issue. --- nuttx-configs/px4io-v2/scripts/ld.script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuttx-configs/px4io-v2/scripts/ld.script b/nuttx-configs/px4io-v2/scripts/ld.script index 2ff29bdab7..6cc77e9623 100755 --- a/nuttx-configs/px4io-v2/scripts/ld.script +++ b/nuttx-configs/px4io-v2/scripts/ld.script @@ -72,7 +72,6 @@ SECTIONS *(.gcc_except_table) *(.gnu.linkonce.r.*) _etext = ABSOLUTE(.); - /* * This is a hack to make the newlib libm __errno() call * use the NuttX get_errno_ptr() function. @@ -109,6 +108,7 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS _edata = ABSOLUTE(.); + . = ALIGN(4); } > sram AT > flash .bss : { From d05b3fcc0840b2df63820225cb637ae3cdb24773 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:53:22 +0200 Subject: [PATCH 187/389] Device: Split integrator into CPP and H --- src/drivers/device/CMakeLists.txt | 9 ++- src/drivers/device/integrator.cpp | 127 ++++++++++++++++++++++++++++++ src/drivers/device/integrator.h | 99 ++--------------------- 3 files changed, 138 insertions(+), 97 deletions(-) create mode 100644 src/drivers/device/integrator.cpp diff --git a/src/drivers/device/CMakeLists.txt b/src/drivers/device/CMakeLists.txt index b97339b892..95df2d1855 100644 --- a/src/drivers/device/CMakeLists.txt +++ b/src/drivers/device/CMakeLists.txt @@ -33,10 +33,12 @@ set(SRCS) +list(APPEND SRCS + ringbuffer.cpp + integrator.cpp +) + if(${OS} STREQUAL "nuttx") - list(APPEND SRCS - ringbuffer.cpp - ) if (NOT ${BOARD} STREQUAL "sim") list(APPEND SRCS device_nuttx.cpp @@ -54,7 +56,6 @@ else() vdev_posix.cpp i2c_posix.cpp sim.cpp - ringbuffer.cpp ) endif() diff --git a/src/drivers/device/integrator.cpp b/src/drivers/device/integrator.cpp new file mode 100644 index 0000000000..bc2baacc85 --- /dev/null +++ b/src/drivers/device/integrator.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** + * + * Copyright (c) 2015 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file integrator.cpp + * + * A resettable integrator + * + * @author Lorenz Meier + */ + +#include "integrator.h" + +Integrator::Integrator(uint64_t auto_reset_interval, bool coning_compensation) : + _auto_reset_interval(auto_reset_interval), + _last_integration(0), + _last_auto(0), + _integral_auto(0.0f, 0.0f, 0.0f), + _integral_read(0.0f, 0.0f, 0.0f), + _last_val(0.0f, 0.0f, 0.0f), + _last_delta(0.0f, 0.0f, 0.0f), + _auto_callback(nullptr), + _coning_comp_on(coning_compensation) +{ + +} + +Integrator::~Integrator() +{ + +} + +bool +Integrator::put(uint64_t timestamp, math::Vector<3> &val, math::Vector<3> &integral, uint64_t &integral_dt) +{ + bool auto_reset = false; + + if (_last_integration == 0) { + /* this is the first item in the integrator */ + _last_integration = timestamp; + _last_auto = timestamp; + _last_val = val; + return false; + } + + // Integrate + double dt = (double)(timestamp - _last_integration) / 1000000.0; + math::Vector<3> i = (val + _last_val) * dt * 0.5f; + + // Apply coning compensation if required + if (_coning_comp_on) { + // Coning compensation derived by Paul Riseborough and Jonathan Challinger, + // following: + // Tian et al (2010) Three-loop Integration of GPS and Strapdown INS with Coning and Sculling Compensation + // Available: http://www.sage.unsw.edu.au/snap/publications/tian_etal2010b.pdf + + i += ((_integral_auto + _last_delta * (1.0f / 6.0f)) % i) * 0.5f; + } + + _integral_auto += i; + _integral_read += i; + + _last_integration = timestamp; + _last_val = val; + _last_delta = i; + + if ((timestamp - _last_auto) > _auto_reset_interval) { + if (_auto_callback) { + /* call the callback */ + _auto_callback(timestamp, _integral_auto); + } + + integral = _integral_auto; + integral_dt = (timestamp - _last_auto); + + auto_reset = true; + _last_auto = timestamp; + _integral_auto(0) = 0.0f; + _integral_auto(1) = 0.0f; + _integral_auto(2) = 0.0f; + } + + return auto_reset; +} + +math::Vector<3> +Integrator::read(bool auto_reset) +{ + math::Vector<3> val = _integral_read; + if (auto_reset) { + _integral_read(0) = 0.0f; + _integral_read(1) = 0.0f; + _integral_read(2) = 0.0f; + } + + return val; +} diff --git a/src/drivers/device/integrator.h b/src/drivers/device/integrator.h index 6dc886de96..6de5c942d9 100644 --- a/src/drivers/device/integrator.h +++ b/src/drivers/device/integrator.h @@ -43,8 +43,6 @@ #include -#include - class Integrator { public: Integrator(uint64_t auto_reset_interval = 4000 /* 250 Hz */, bool coning_compensation = false); @@ -59,7 +57,7 @@ public: * @return true if putting the item triggered an integral reset * and the integral should be published */ - bool put(hrt_abstime timestamp, math::Vector<3> &val, math::Vector<3> &integral, uint64_t &integral_dt); + bool put(uint64_t timestamp, math::Vector<3> &val, math::Vector<3> &integral, uint64_t &integral_dt); /** * Get the current integral value @@ -79,105 +77,20 @@ public: /** * Get current integral start time */ - hrt_abstime current_integral_start() { return _last_auto; } + uint64_t current_integral_start() { return _last_auto; } private: - hrt_abstime _auto_reset_interval; /**< the interval after which the content will be published and the integrator reset */ - hrt_abstime _last_integration; /**< timestamp of the last integration step */ - hrt_abstime _last_auto; /**< last auto-announcement of integral value */ + uint64_t _auto_reset_interval; /**< the interval after which the content will be published and the integrator reset */ + uint64_t _last_integration; /**< timestamp of the last integration step */ + uint64_t _last_auto; /**< last auto-announcement of integral value */ math::Vector<3> _integral_auto; /**< the integrated value which auto-resets after _auto_reset_interval */ math::Vector<3> _integral_read; /**< the integrated value since the last read */ math::Vector<3> _last_val; /**< previously integrated last value */ math::Vector<3> _last_delta; /**< last local delta */ - void (*_auto_callback)(hrt_abstime, math::Vector<3>); /**< the function callback for auto-reset */ + void (*_auto_callback)(uint64_t, math::Vector<3>); /**< the function callback for auto-reset */ bool _coning_comp_on; /**< coning compensation */ /* we don't want this class to be copied */ Integrator(const Integrator&); Integrator operator=(const Integrator&); }; - -Integrator::Integrator(hrt_abstime auto_reset_interval, bool coning_compensation) : - _auto_reset_interval(auto_reset_interval), - _last_integration(0), - _last_auto(0), - _integral_auto(0.0f, 0.0f, 0.0f), - _integral_read(0.0f, 0.0f, 0.0f), - _last_val(0.0f, 0.0f, 0.0f), - _last_delta(0.0f, 0.0f, 0.0f), - _auto_callback(nullptr), - _coning_comp_on(coning_compensation) -{ - -} - -Integrator::~Integrator() -{ - -} - -bool -Integrator::put(uint64_t timestamp, math::Vector<3> &val, math::Vector<3> &integral, uint64_t &integral_dt) -{ - bool auto_reset = false; - - if (_last_integration == 0) { - /* this is the first item in the integrator */ - _last_integration = timestamp; - _last_auto = timestamp; - _last_val = val; - return false; - } - - // Integrate - double dt = (double)(timestamp - _last_integration) / 1000000.0; - math::Vector<3> i = (val + _last_val) * dt * 0.5f; - - // Apply coning compensation if required - if (_coning_comp_on) { - // Coning compensation derived by Paul Riseborough and Jonathan Challinger, - // following: - // Tian et al (2010) Three-loop Integration of GPS and Strapdown INS with Coning and Sculling Compensation - // Available: http://www.sage.unsw.edu.au/snap/publications/tian_etal2010b.pdf - - i += ((_integral_auto + _last_delta * (1.0f / 6.0f)) % i) * 0.5f; - } - - _integral_auto += i; - _integral_read += i; - - _last_integration = timestamp; - _last_val = val; - _last_delta = i; - - if ((timestamp - _last_auto) > _auto_reset_interval) { - if (_auto_callback) { - /* call the callback */ - _auto_callback(timestamp, _integral_auto); - } - - integral = _integral_auto; - integral_dt = (timestamp - _last_auto); - - auto_reset = true; - _last_auto = timestamp; - _integral_auto(0) = 0.0f; - _integral_auto(1) = 0.0f; - _integral_auto(2) = 0.0f; - } - - return auto_reset; -} - -math::Vector<3> -Integrator::read(bool auto_reset) -{ - math::Vector<3> val = _integral_read; - if (auto_reset) { - _integral_read(0) = 0.0f; - _integral_read(1) = 0.0f; - _integral_read(2) = 0.0f; - } - - return val; -} From 4d4216510f1ef2738adc7b01f92f8f9846e1adb9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:53:46 +0200 Subject: [PATCH 188/389] ECL: Add data validator group in CMake --- src/lib/ecl/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/ecl/CMakeLists.txt b/src/lib/ecl/CMakeLists.txt index 0830521ec0..0fd5b5f5e9 100644 --- a/src/lib/ecl/CMakeLists.txt +++ b/src/lib/ecl/CMakeLists.txt @@ -40,6 +40,8 @@ px4_add_module( attitude_fw/ecl_roll_controller.cpp attitude_fw/ecl_yaw_controller.cpp l1/ecl_l1_pos_controller.cpp + validation/data_validator.cpp + validation/data_validator_group.cpp DEPENDS platforms__common ) From a2caaa3c3c3783ebd16c33458f1339d0e43cba5c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:54:09 +0200 Subject: [PATCH 189/389] EKF: Fix param naming --- .../ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp index 5d6b7c2892..9f2d70d94b 100644 --- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp +++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp @@ -113,7 +113,7 @@ AttitudePositionEstimatorEKF *g_estimator = nullptr; } AttitudePositionEstimatorEKF::AttitudePositionEstimatorEKF() : - SuperBlock(NULL, "EKF"), + SuperBlock(NULL, "PE"), _task_should_exit(false), _task_running(false), _estimator_task(-1), @@ -202,9 +202,9 @@ AttitudePositionEstimatorEKF::AttitudePositionEstimatorEKF() : _newRangeData(false), _mavlink_fd(-1), - _mag_offset_x(this, "PE_MAGB_X"), - _mag_offset_y(this, "PE_MAGB_Y"), - _mag_offset_z(this, "PE_MAGB_Z"), + _mag_offset_x(this, "MAGB_X"), + _mag_offset_y(this, "MAGB_Y"), + _mag_offset_z(this, "MAGB_Z"), _parameters{}, _parameter_handles{}, _ekf(nullptr), From 067c0fd328d4212ecdaf158104a1e9e476127369 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:58:04 +0200 Subject: [PATCH 190/389] Commander: Add required POSIX header --- src/modules/commander/state_machine_helper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index 1fa2e27a89..2f3da424c6 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -48,6 +48,8 @@ #include #include +#include + #include #include #include From 88bb98379ecdedc98ad64fbe38f230381d179791 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:58:18 +0200 Subject: [PATCH 191/389] Land detector: Add required POSIX header --- src/modules/land_detector/LandDetector.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/land_detector/LandDetector.cpp b/src/modules/land_detector/LandDetector.cpp index 7f719d4cef..1de3c2f4a0 100644 --- a/src/modules/land_detector/LandDetector.cpp +++ b/src/modules/land_detector/LandDetector.cpp @@ -42,6 +42,8 @@ #include "LandDetector.h" #include //usleep #include +#include +#include LandDetector::LandDetector() : _landDetectedPub(0), From bbccb8ed5f36a5525bcea0bb2f6a1285e699ae0b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:58:29 +0200 Subject: [PATCH 192/389] Simulator: Add required POSIX header --- src/modules/simulator/simulator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/simulator/simulator.h b/src/modules/simulator/simulator.h index f42baaf5ac..a9b7e84e95 100644 --- a/src/modules/simulator/simulator.h +++ b/src/modules/simulator/simulator.h @@ -38,7 +38,7 @@ #pragma once -#include +#include #include #include #include From e2332281ad9e9b2f56df8bac388a2ce31e538ab5 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 10:58:45 +0200 Subject: [PATCH 193/389] Work queue: Add required POSIX header --- src/platforms/posix/work_queue/work_thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platforms/posix/work_queue/work_thread.c b/src/platforms/posix/work_queue/work_thread.c index 942e3a1857..ec565bcfcc 100644 --- a/src/platforms/posix/work_queue/work_thread.c +++ b/src/platforms/posix/work_queue/work_thread.c @@ -39,6 +39,7 @@ #include #include +#include #include #include #include From af11a224725fd6747306c66d19712d6a3e9c65c9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 11:01:41 +0200 Subject: [PATCH 194/389] Temporarily disable topic listener until it can deal with arrays --- src/systemcmds/topic_listener/CMakeLists.txt | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/systemcmds/topic_listener/CMakeLists.txt b/src/systemcmds/topic_listener/CMakeLists.txt index 2f720757ac..3d98a6d4f4 100644 --- a/src/systemcmds/topic_listener/CMakeLists.txt +++ b/src/systemcmds/topic_listener/CMakeLists.txt @@ -31,23 +31,23 @@ # ############################################################################ -add_custom_command(OUTPUT topic_listener.cpp - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/generate_listener.py ${CMAKE_SOURCE_DIR} > topic_listener.cpp - ) +#add_custom_command(OUTPUT topic_listener.cpp +# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/generate_listener.py ${CMAKE_SOURCE_DIR} > topic_listener.cpp +# ) -add_custom_target(generate_topic_listener - DEPENDS topic_listener.cpp) +#add_custom_target(generate_topic_listener +# DEPENDS topic_listener.cpp) -px4_add_module( - MODULE systemcmds__topic_listener - MAIN listener - STACK 1800 - COMPILE_FLAGS - -Os - SRCS - topic_listener.cpp - DEPENDS - platforms__common - generate_topic_listener - ) +#px4_add_module( +# MODULE systemcmds__topic_listener +# MAIN listener +# STACK 1800 +# COMPILE_FLAGS +# -Os +# SRCS +# topic_listener.cpp +# DEPENDS +# platforms__common +# generate_topic_listener +# ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 30d0dab8e67c339ab840014bd52a0f7e995f5d11 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 11:35:52 +0200 Subject: [PATCH 195/389] Simulator: Fix code style --- src/modules/simulator/simulator.cpp | 109 ++++++++-------- src/modules/simulator/simulator.h | 100 ++++++++------- src/modules/simulator/simulator_mavlink.cpp | 133 ++++++++++++-------- 3 files changed, 190 insertions(+), 152 deletions(-) diff --git a/src/modules/simulator/simulator.cpp b/src/modules/simulator/simulator.cpp index 3ec3b305f8..1656a3451f 100644 --- a/src/modules/simulator/simulator.cpp +++ b/src/modules/simulator/simulator.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include "simulator.h" @@ -91,27 +91,33 @@ bool Simulator::getAirspeedSample(uint8_t *buf, int len) return _airspeed.copyData(buf, len); } -void Simulator::write_MPU_data(void *buf) { +void Simulator::write_MPU_data(void *buf) +{ _mpu.writeData(buf); } -void Simulator::write_accel_data(void *buf) { +void Simulator::write_accel_data(void *buf) +{ _accel.writeData(buf); } -void Simulator::write_mag_data(void *buf) { +void Simulator::write_mag_data(void *buf) +{ _mag.writeData(buf); } -void Simulator::write_baro_data(void *buf) { +void Simulator::write_baro_data(void *buf) +{ _baro.writeData(buf); } -void Simulator::write_gps_data(void *buf) { +void Simulator::write_gps_data(void *buf) +{ _gps.writeData(buf); } -void Simulator::write_airspeed_data(void *buf) { +void Simulator::write_airspeed_data(void *buf) +{ _airspeed.writeData(buf); } @@ -119,20 +125,23 @@ int Simulator::start(int argc, char *argv[]) { int ret = 0; _instance = new Simulator(); + if (_instance) { drv_led_start(); + if (argv[2][1] == 's') { _instance->initializeSensorData(); #ifndef __PX4_QURT // Update sensor data _instance->pollForMAVLinkMessages(false); #endif + } else { // Update sensor data _instance->pollForMAVLinkMessages(true); } - } - else { + + } else { PX4_WARN("Simulator creation failed"); ret = 1; } @@ -153,52 +162,54 @@ __END_DECLS extern "C" { -int simulator_main(int argc, char *argv[]) -{ - int ret = 0; - if (argc == 3 && strcmp(argv[1], "start") == 0) { - if (strcmp(argv[2], "-s") == 0 || strcmp(argv[2], "-p") == 0) { - if (g_sim_task >= 0) { - warnx("Simulator already started"); - return 0; - } - g_sim_task = px4_task_spawn_cmd("Simulator", - SCHED_DEFAULT, - SCHED_PRIORITY_MAX - 5, - 1500, - Simulator::start, - argv); + int simulator_main(int argc, char *argv[]) + { + int ret = 0; - // now wait for the command to complete - while(true) { - if (Simulator::getInstance() && Simulator::getInstance()->isInitialized()) { - break; - } else { - usleep(100000); + if (argc == 3 && strcmp(argv[1], "start") == 0) { + if (strcmp(argv[2], "-s") == 0 || strcmp(argv[2], "-p") == 0) { + if (g_sim_task >= 0) { + warnx("Simulator already started"); + return 0; } + + g_sim_task = px4_task_spawn_cmd("Simulator", + SCHED_DEFAULT, + SCHED_PRIORITY_MAX - 5, + 1500, + Simulator::start, + argv); + + // now wait for the command to complete + while (true) { + if (Simulator::getInstance() && Simulator::getInstance()->isInitialized()) { + break; + + } else { + usleep(100000); + } + } + + } else { + usage(); + ret = -EINVAL; } - } - else - { + + } else if (argc == 2 && strcmp(argv[1], "stop") == 0) { + if (g_sim_task < 0) { + PX4_WARN("Simulator not running"); + + } else { + px4_task_delete(g_sim_task); + g_sim_task = -1; + } + + } else { usage(); ret = -EINVAL; } - } - else if (argc == 2 && strcmp(argv[1], "stop") == 0) { - if (g_sim_task < 0) { - PX4_WARN("Simulator not running"); - } - else { - px4_task_delete(g_sim_task); - g_sim_task = -1; - } - } - else { - usage(); - ret = -EINVAL; + + return ret; } - return ret; -} - } diff --git a/src/modules/simulator/simulator.h b/src/modules/simulator/simulator.h index af4b8a746c..ca7d851270 100644 --- a/src/modules/simulator/simulator.h +++ b/src/modules/simulator/simulator.h @@ -53,24 +53,25 @@ #include #include #include -namespace simulator { +namespace simulator +{ // FIXME - what is the endianness of these on actual device? #pragma pack(push, 1) struct RawAccelData { - float temperature; - float x; - float y; - float z; + float temperature; + float x; + float y; + float z; }; #pragma pack(pop) #pragma pack(push, 1) struct RawMagData { - float temperature; - float x; - float y; - float z; + float temperature; + float x; + float y; + float z; }; #pragma pack(pop) @@ -103,22 +104,23 @@ struct RawAirspeedData { #pragma pack(push, 1) struct RawGPSData { - int32_t lat; - int32_t lon; - int32_t alt; - uint16_t eph; - uint16_t epv; - uint16_t vel; - int16_t vn; - int16_t ve; - int16_t vd; - uint16_t cog; - uint8_t fix_type; - uint8_t satellites_visible; + int32_t lat; + int32_t lon; + int32_t alt; + uint16_t eph; + uint16_t epv; + uint16_t vel; + int16_t vn; + int16_t ve; + int16_t vd; + uint16_t cog; + uint8_t fix_type; + uint8_t satellites_visible; }; #pragma pack(pop) -template class Report { +template class Report +{ public: Report(int readers) : _readidx(0), @@ -135,6 +137,7 @@ public: if (len != _report_len) { return false; } + read_lock(); memcpy(outbuf, &_buf[_readidx], _report_len); read_unlock(); @@ -153,13 +156,13 @@ protected: void read_unlock() { sem_post(&_lock); } void write_lock() { - for (int i=0; i<_max_readers; i++) { + for (int i = 0; i < _max_readers; i++) { sem_wait(&_lock); } } void write_unlock() { - for (int i=0; i<_max_readers; i++) { + for (int i = 0; i < _max_readers; i++) { sem_post(&_lock); } } @@ -173,7 +176,8 @@ protected: }; -class Simulator { +class Simulator +{ public: static Simulator *getInstance(); @@ -211,32 +215,32 @@ public: private: Simulator() : - _accel(1), - _mpu(1), - _baro(1), - _mag(1), - _gps(1), - _airspeed(1), - _accel_pub(nullptr), - _baro_pub(nullptr), - _gyro_pub(nullptr), - _mag_pub(nullptr), - _initialized(false) + _accel(1), + _mpu(1), + _baro(1), + _mag(1), + _gps(1), + _airspeed(1), + _accel_pub(nullptr), + _baro_pub(nullptr), + _gyro_pub(nullptr), + _mag_pub(nullptr), + _initialized(false) #ifndef __PX4_QURT - , - _rc_channels_pub(nullptr), - _actuator_outputs_sub(-1), - _vehicle_attitude_sub(-1), - _manual_sub(-1), - _vehicle_status_sub(-1), - _rc_input{}, - _actuators{}, - _attitude{}, - _manual{}, - _vehicle_status{} + , + _rc_channels_pub(nullptr), + _actuator_outputs_sub(-1), + _vehicle_attitude_sub(-1), + _manual_sub(-1), + _vehicle_status_sub(-1), + _rc_input{}, + _actuators{}, + _attitude{}, + _manual{}, + _vehicle_status{} #endif {} - ~Simulator() { _instance=NULL; } + ~Simulator() { _instance = NULL; } void initializeSensorData(); diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index 81f5bf39eb..c9833addda 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -71,7 +71,8 @@ static socklen_t _addrlen = sizeof(_srcaddr); using namespace simulator; -void Simulator::pack_actuator_message(mavlink_hil_controls_t &actuator_msg) { +void Simulator::pack_actuator_message(mavlink_hil_controls_t &actuator_msg) +{ float out[8] = {}; const float pwm_center = (PWM_HIGHEST_MAX + PWM_LOWEST_MIN) / 2; @@ -96,6 +97,7 @@ void Simulator::pack_actuator_message(mavlink_hil_controls_t &actuator_msg) { out[i] = 0.0f; } } + } else { // convert back to range [-1, 1] for (unsigned i = 0; i < 8; i++) { @@ -122,29 +124,31 @@ void Simulator::pack_actuator_message(mavlink_hil_controls_t &actuator_msg) { actuator_msg.nav_mode = 0; } -void Simulator::send_controls() { +void Simulator::send_controls() +{ mavlink_hil_controls_t msg; pack_actuator_message(msg); //PX4_WARN("Sending HIL_CONTROLS msg"); send_mavlink_message(MAVLINK_MSG_ID_HIL_CONTROLS, &msg, 200); } -static void fill_rc_input_msg(struct rc_input_values *rc, mavlink_rc_channels_t *rc_channels) { +static void fill_rc_input_msg(struct rc_input_values *rc, mavlink_rc_channels_t *rc_channels) +{ rc->timestamp_publication = hrt_absolute_time(); rc->timestamp_last_signal = hrt_absolute_time(); rc->channel_count = rc_channels->chancount; rc->rssi = rc_channels->rssi; -/* PX4_WARN("RC: %d, %d, %d, %d, %d, %d, %d, %d", - rc_channels->chan1_raw, - rc_channels->chan2_raw, - rc_channels->chan3_raw, - rc_channels->chan4_raw, - rc_channels->chan5_raw, - rc_channels->chan6_raw, - rc_channels->chan7_raw, - rc_channels->chan8_raw); -*/ + /* PX4_WARN("RC: %d, %d, %d, %d, %d, %d, %d, %d", + rc_channels->chan1_raw, + rc_channels->chan2_raw, + rc_channels->chan3_raw, + rc_channels->chan4_raw, + rc_channels->chan5_raw, + rc_channels->chan6_raw, + rc_channels->chan7_raw, + rc_channels->chan8_raw); + */ rc->values[0] = rc_channels->chan1_raw; rc->values[1] = rc_channels->chan2_raw; @@ -166,7 +170,8 @@ static void fill_rc_input_msg(struct rc_input_values *rc, mavlink_rc_channels_t rc->values[17] = rc_channels->chan18_raw; } -void Simulator::update_sensors(mavlink_hil_sensor_t *imu) { +void Simulator::update_sensors(mavlink_hil_sensor_t *imu) +{ // write sensor data to memory so that drivers can copy data from there RawMPUData mpu; mpu.accel_x = imu->xacc; @@ -208,11 +213,12 @@ void Simulator::update_sensors(mavlink_hil_sensor_t *imu) { write_airspeed_data((void *)&airspeed); } -void Simulator::update_gps(mavlink_hil_gps_t *gps_sim) { +void Simulator::update_gps(mavlink_hil_gps_t *gps_sim) +{ RawGPSData gps; - gps.lat = gps_sim->lat; - gps.lon = gps_sim->lon; - gps.alt = gps_sim->alt; + gps.lat = gps_sim->lat; + gps.lon = gps_sim->lon; + gps.alt = gps_sim->alt; gps.eph = gps_sim->eph; gps.epv = gps_sim->epv; gps.vel = gps_sim->vel; @@ -226,23 +232,28 @@ void Simulator::update_gps(mavlink_hil_gps_t *gps_sim) { write_gps_data((void *)&gps); } -void Simulator::handle_message(mavlink_message_t *msg, bool publish) { - switch(msg->msgid) { +void Simulator::handle_message(mavlink_message_t *msg, bool publish) +{ + switch (msg->msgid) { case MAVLINK_MSG_ID_HIL_SENSOR: mavlink_hil_sensor_t imu; mavlink_msg_hil_sensor_decode(msg, &imu); + if (publish) { publish_sensor_topics(&imu); } + update_sensors(&imu); break; case MAVLINK_MSG_ID_HIL_GPS: mavlink_hil_gps_t gps_sim; mavlink_msg_hil_gps_decode(msg, &gps_sim); + if (publish) { //PX4_WARN("FIXME: Need to publish GPS topic. Not done yet."); } + update_gps(&gps_sim); break; @@ -253,17 +264,20 @@ void Simulator::handle_message(mavlink_message_t *msg, bool publish) { // publish message if (publish) { - if(_rc_channels_pub == nullptr) { + if (_rc_channels_pub == nullptr) { _rc_channels_pub = orb_advertise(ORB_ID(input_rc), &_rc_input); + } else { orb_publish(ORB_ID(input_rc), _rc_channels_pub, &_rc_input); } } + break; } } -void Simulator::send_mavlink_message(const uint8_t msgid, const void *msg, uint8_t component_ID) { +void Simulator::send_mavlink_message(const uint8_t msgid, const void *msg, uint8_t component_ID) +{ component_ID = 0; uint8_t payload_len = mavlink_message_lengths[msgid]; unsigned packet_len = payload_len + MAVLINK_NUM_NON_PAYLOAD_BYTES; @@ -280,7 +294,7 @@ void Simulator::send_mavlink_message(const uint8_t msgid, const void *msg, uint8 buf[5] = msgid; /* payload */ - memcpy(&buf[MAVLINK_NUM_HEADER_BYTES],msg, payload_len); + memcpy(&buf[MAVLINK_NUM_HEADER_BYTES], msg, payload_len); /* checksum */ uint16_t checksum; @@ -292,44 +306,51 @@ void Simulator::send_mavlink_message(const uint8_t msgid, const void *msg, uint8 buf[MAVLINK_NUM_HEADER_BYTES + payload_len + 1] = (uint8_t)(checksum >> 8); ssize_t len = sendto(_fd, buf, packet_len, 0, (struct sockaddr *)&_srcaddr, _addrlen); + if (len <= 0) { PX4_WARN("Failed sending mavlink message"); } } -void Simulator::poll_topics() { +void Simulator::poll_topics() +{ // copy new actuator data if available bool updated; orb_check(_actuator_outputs_sub, &updated); + if (updated) { orb_copy(ORB_ID(actuator_outputs), _actuator_outputs_sub, &_actuators); } orb_check(_vehicle_status_sub, &updated); + if (updated) { orb_copy(ORB_ID(vehicle_status), _vehicle_status_sub, &_vehicle_status); } } -void *Simulator::sending_trampoline(void *) { +void *Simulator::sending_trampoline(void *) +{ _instance->send(); return 0; // why do I have to put this??? } -void Simulator::send() { +void Simulator::send() +{ px4_pollfd_struct_t fds[1]; fds[0].fd = _actuator_outputs_sub; fds[0].events = POLLIN; int pret; - while(true) { + while (true) { // wait for up to 100ms for data pret = px4_poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100); //timed out - if (pret == 0) + if (pret == 0) { continue; + } // this is undesirable but not much we can do if (pret < 0) { @@ -349,23 +370,19 @@ void Simulator::send() { void Simulator::initializeSensorData() { - struct baro_report baro; - memset(&baro,0,sizeof(baro)); + struct baro_report baro = {}; baro.pressure = 120000.0f; // acceleration report - struct accel_report accel; - memset(&accel,0,sizeof(accel)); + struct accel_report accel = {}; accel.z = 9.81f; accel.range_m_s2 = 80.0f; // gyro report - struct gyro_report gyro; - memset(&gyro, 0 ,sizeof(gyro)); + struct gyro_report gyro = {}; // mag report - struct mag_report mag; - memset(&mag, 0 ,sizeof(mag)); + struct mag_report mag = {}; } void Simulator::pollForMAVLinkMessages(bool publish) @@ -410,6 +427,7 @@ void Simulator::pollForMAVLinkMessages(bool publish) if (serial_fd < 0) { PX4_INFO("Not using %s for radio control input. Assuming joystick input via MAVLink.", PIXHAWK_DEVICE); + } else { // tell the device to stream some messages @@ -435,10 +453,12 @@ void Simulator::pollForMAVLinkMessages(bool publish) // this is important for the UDP communication to work int pret = -1; PX4_INFO("Waiting for initial data on UDP. Please start the flight simulator to proceed.."); + while (pret <= 0) { - pret = ::poll(&fds[0], (sizeof(fds[0])/sizeof(fds[0])), 100); + pret = ::poll(&fds[0], (sizeof(fds[0]) / sizeof(fds[0])), 100); } - PX4_INFO("Found initial message, pret = %d",pret); + + PX4_INFO("Found initial message, pret = %d", pret); _initialized = true; // reset system time (void)hrt_reset(); @@ -460,11 +480,12 @@ void Simulator::pollForMAVLinkMessages(bool publish) // wait for new mavlink messages to arrive while (true) { - pret = ::poll(&fds[0], (sizeof(fds)/sizeof(fds[0])), 100); + pret = ::poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100); //timed out - if (pret == 0) + if (pret == 0) { continue; + } // this is undesirable but not much we can do if (pret < 0) { @@ -477,13 +498,13 @@ void Simulator::pollForMAVLinkMessages(bool publish) // got data from simulator if (fds[0].revents & POLLIN) { len = recvfrom(_fd, _buf, sizeof(_buf), 0, (struct sockaddr *)&_srcaddr, &_addrlen); + if (len > 0) { mavlink_message_t msg; mavlink_status_t status; - for (int i = 0; i < len; ++i) - { - if (mavlink_parse_char(MAVLINK_COMM_0, _buf[i], &msg, &status)) - { + + for (int i = 0; i < len; ++i) { + if (mavlink_parse_char(MAVLINK_COMM_0, _buf[i], &msg, &status)) { // have a message, handle it handle_message(&msg, publish); } @@ -494,13 +515,13 @@ void Simulator::pollForMAVLinkMessages(bool publish) // got data from PIXHAWK if (fds[1].revents & POLLIN) { len = ::read(serial_fd, serial_buf, sizeof(serial_buf)); + if (len > 0) { mavlink_message_t msg; mavlink_status_t status; - for (int i = 0; i < len; ++i) - { - if (mavlink_parse_char(MAVLINK_COMM_0, serial_buf[i], &msg, &status)) - { + + for (int i = 0; i < len; ++i) { + if (mavlink_parse_char(MAVLINK_COMM_0, serial_buf[i], &msg, &status)) { // have a message, handle it handle_message(&msg, publish); } @@ -612,15 +633,17 @@ int openUart(const char *uart_name, int baud) return uart_fd; } -int Simulator::publish_sensor_topics(mavlink_hil_sensor_t *imu) { +int Simulator::publish_sensor_topics(mavlink_hil_sensor_t *imu) +{ - //uint64_t timestamp = imu->time_usec; - uint64_t timestamp = hrt_absolute_time(); + //uint64_t timestamp = imu->time_usec; + uint64_t timestamp = hrt_absolute_time(); + + if ((imu->fields_updated & 0x1FFF) != 0x1FFF) { + PX4_DEBUG("All sensor fields in mavlink HIL_SENSOR packet not updated. Got %08x", imu->fields_updated); + } - if((imu->fields_updated & 0x1FFF)!=0x1FFF) { - PX4_DEBUG("All sensor fields in mavlink HIL_SENSOR packet not updated. Got %08x",imu->fields_updated); - } /* static int count=0; static uint64_t last_timestamp=0; @@ -717,5 +740,5 @@ int Simulator::publish_sensor_topics(mavlink_hil_sensor_t *imu) { } } - return OK; + return OK; } From ddd1b8224034442e38427758fa7a383b6fdde298 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 11:36:11 +0200 Subject: [PATCH 196/389] Simulated sensors: Publish valid data initially --- src/platforms/posix/drivers/accelsim/accelsim.cpp | 2 +- src/platforms/posix/drivers/gyrosim/gyrosim.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platforms/posix/drivers/accelsim/accelsim.cpp b/src/platforms/posix/drivers/accelsim/accelsim.cpp index 174c522383..cc299b5847 100644 --- a/src/platforms/posix/drivers/accelsim/accelsim.cpp +++ b/src/platforms/posix/drivers/accelsim/accelsim.cpp @@ -493,7 +493,7 @@ ACCELSIM::init() _accel_class_instance = register_class_devname(ACCEL_BASE_DEVICE_PATH); /* advertise sensor topic, measure manually to initialize valid report */ - struct accel_report arp; + struct accel_report arp = {}; _accel_reports->get(&arp); /* measurement will have generated a report, publish */ diff --git a/src/platforms/posix/drivers/gyrosim/gyrosim.cpp b/src/platforms/posix/drivers/gyrosim/gyrosim.cpp index 5eb8ff7fea..850bf0f9d1 100644 --- a/src/platforms/posix/drivers/gyrosim/gyrosim.cpp +++ b/src/platforms/posix/drivers/gyrosim/gyrosim.cpp @@ -466,7 +466,7 @@ GYROSIM::init() measure(); /* advertise sensor topic, measure manually to initialize valid report */ - struct accel_report arp; + struct accel_report arp = {}; _accel_reports->get(&arp); /* measurement will have generated a report, publish */ @@ -482,7 +482,7 @@ GYROSIM::init() /* advertise sensor topic, measure manually to initialize valid report */ - struct gyro_report grp; + struct gyro_report grp = {}; _gyro_reports->get(&grp); _gyro->_gyro_topic = orb_advertise_multi(ORB_ID(sensor_gyro), &grp, From 8509c5f220c95a9a9fe22023220b4eff4316ab60 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 12:53:33 +0200 Subject: [PATCH 197/389] Fix clock generation on Mac OS X --- src/platforms/posix/px4_layer/drv_hrt.c | 27 +++++++++++-------- .../posix/px4_layer/px4_posix_impl.cpp | 21 --------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/src/platforms/posix/px4_layer/drv_hrt.c index 74bfb9ee41..981857da45 100644 --- a/src/platforms/posix/px4_layer/drv_hrt.c +++ b/src/platforms/posix/px4_layer/drv_hrt.c @@ -37,6 +37,7 @@ * High-resolution timer with callouts and timekeeping. */ +#include #include #include #include @@ -85,14 +86,11 @@ static void hrt_unlock(void) #define MAC_NANO (+1.0E-9) #define MAC_GIGA UINT64_C(1000000000) #define CLOCK_MONOTONIC 1 -#define clockid_t int #define HRT_LOCK_NAME "/hrt_lock" static double px4_timebase = 0.0; -int clock_gettime(clockid_t clk_id, struct timespec *t); - -int clock_gettime(clockid_t clk_id, struct timespec *t) +int px4_clock_gettime(clockid_t clk_id, struct timespec *tp) { if (clk_id != CLOCK_MONOTONIC) { return 1; @@ -103,16 +101,23 @@ int clock_gettime(clockid_t clk_id, struct timespec *t) mach_timebase_info(&tb); px4_timebase = tb.numer; px4_timebase /= tb.denom; - px4_timestart = mach_absolute_time(); + // px4_timestart = mach_absolute_time(); } - memset(t, 0, sizeof(*t)); + memset(tp, 0, sizeof(*tp)); - double diff = (mach_absolute_time() - px4_timestart) * px4_timebase; - t->tv_sec = diff * MAC_NANO; - t->tv_nsec = diff - (t->tv_sec * MAC_GIGA); + double diff = mach_absolute_time() * px4_timebase; + tp->tv_sec = diff * MAC_NANO; + tp->tv_nsec = diff - (tp->tv_sec * MAC_GIGA); return 0; } + +int px4_clock_settime(clockid_t clk_id, struct timespec *tp) +{ + /* do nothing right now */ + return 0; +} + #endif /* @@ -123,11 +128,11 @@ hrt_abstime hrt_absolute_time(void) struct timespec ts; if (!px4_timestart) { - clock_gettime(CLOCK_MONOTONIC, &ts); + px4_clock_gettime(CLOCK_MONOTONIC, &ts); px4_timestart = ts_to_abstime(&ts); } - clock_gettime(CLOCK_MONOTONIC, &ts); + px4_clock_gettime(CLOCK_MONOTONIC, &ts); return ts_to_abstime(&ts) - px4_timestart; } diff --git a/src/platforms/posix/px4_layer/px4_posix_impl.cpp b/src/platforms/posix/px4_layer/px4_posix_impl.cpp index 5311ead749..19747556a9 100644 --- a/src/platforms/posix/px4_layer/px4_posix_impl.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_impl.cpp @@ -56,27 +56,6 @@ __BEGIN_DECLS long PX4_TICKS_PER_SEC = sysconf(_SC_CLK_TCK); -#ifdef __PX4_DARWIN -extern void hrt_init(void); - -int px4_clock_gettime(clockid_t clk_id, struct timespec *tp) -{ - uint64_t currtime = hrt_absolute_time(); - - tp->tv_sec = currtime / (1000 * 1000); - tp->tv_nsec = (currtime - (currtime * 1000 * 1000)) * 1000; - - return 0; -} - -int px4_clock_settime(clockid_t clk_id, struct timespec *tp) -{ - /* do nothing right now */ - return 0; -} - -#endif - __END_DECLS namespace px4 From b9efd8f4386835e7be885f59ec9c19c4b8ca1c90 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 12:53:56 +0200 Subject: [PATCH 198/389] Add lldb make targets --- Makefile | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5041ff4c51..177bdeeb86 100644 --- a/Makefile +++ b/Makefile @@ -92,15 +92,33 @@ qurt_eagle_travis: posix: posix_sitl_simple -sitl_quad: posix +run_sitl_quad: posix Tools/sitl_run.sh posix-configs/SITL/init/rcS -sitl_plane: posix +run_sitl_plane: posix Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing -sitl_ros: posix +run_sitl_ros: posix Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros +lldb_sitl_quad: posix + Tools/sitl_run.sh posix-configs/SITL/init/rcS lldb + +lldb_sitl_plane: posix + Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing lldb + +lldb_sitl_ros: posix + Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros lldb + +sitl_quad: + @echo "Deprecated. Use 'run_sitl_quad' instead." + +sitl_plane: + @echo "Deprecated. Use 'run_sitl_plane' instead." + +sitl_ros: + @echo "Deprecated. Use 'run_sitl_ros' instead." + # Other targets # -------------------------------------------------------------------- # explicity set default build target From 672a6d8f9b6701d71cfdf9bdb198c09642649356 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 12:54:22 +0200 Subject: [PATCH 199/389] Add debug targets to SITL run --- Tools/sitl_run.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 58ed4f6dd5..637982fd33 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -4,4 +4,12 @@ cd build_posix_sitl_simple/src/firmware/posix mkdir -p rootfs/fs/microsd mkdir -p rootfs/eeprom touch rootfs/eeprom/parameters -./mainapp ../../../../$1 +if [ "$2" == "lldb" ] +then + lldb -- mainapp ../../../../$1 +elif [ "$2" == "gdb" ] +then + gdb -- mainapp ../../../../$1 +else + ./mainapp ../../../../$1 +fi From 4de777fd2fa5e83129b29aadac3714f16f5d87c9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 12:55:18 +0200 Subject: [PATCH 200/389] Topic listener: Fix code generation --- Tools/generate_listener.py | 41 +++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/Tools/generate_listener.py b/Tools/generate_listener.py index 4e5b8ab088..1b55528372 100755 --- a/Tools/generate_listener.py +++ b/Tools/generate_listener.py @@ -20,17 +20,32 @@ for index,m in enumerate(raw_messages): temp_list = [] f = open(m,'r') for line in f.readlines(): - if(line.split(' ')[0] == "float32"): + if ('float32[' in line.split(' ')[0]): + num_floats = int(line.split(" ")[0].split("[")[1].split("]")[0]) + temp_list.append(("float_array",line.split(' ')[1].split('\t')[0].split('\n')[0],num_floats)) + if ('uint64[' in line.split(' ')[0]): + num_floats = int(line.split(" ")[0].split("[")[1].split("]")[0]) + temp_list.append(("uint64_array",line.split(' ')[1].split('\t')[0].split('\n')[0],num_floats)) + elif(line.split(' ')[0] == "float32"): temp_list.append(("float",line.split(' ')[1].split('\t')[0].split('\n')[0])) - elif(line.split(' ')[0] == "uint64"): + elif(line.split(' ')[0] == "uint64") and len(line.split('=')) == 1: temp_list.append(("uint64",line.split(' ')[1].split('\t')[0].split('\n')[0])) - elif (line.split(' ')[0] == "bool"): + elif(line.split(' ')[0] == "uint32") and len(line.split('=')) == 1: + temp_list.append(("uint32",line.split(' ')[1].split('\t')[0].split('\n')[0])) + elif(line.split(' ')[0] == "uint16") and len(line.split('=')) == 1: + temp_list.append(("uint16",line.split(' ')[1].split('\t')[0].split('\n')[0])) + elif(line.split(' ')[0] == "int64") and len(line.split('=')) == 1: + temp_list.append(("int64",line.split(' ')[1].split('\t')[0].split('\n')[0])) + elif(line.split(' ')[0] == "int32") and len(line.split('=')) == 1: + temp_list.append(("int32",line.split(' ')[1].split('\t')[0].split('\n')[0])) + elif(line.split(' ')[0] == "int16") and len(line.split('=')) == 1: + temp_list.append(("int16",line.split(' ')[1].split('\t')[0].split('\n')[0])) + elif (line.split(' ')[0] == "bool") and len(line.split('=')) == 1: temp_list.append(("bool",line.split(' ')[1].split('\t')[0].split('\n')[0])) elif (line.split(' ')[0] == "uint8") and len(line.split('=')) == 1: temp_list.append(("uint8",line.split(' ')[1].split('\t')[0].split('\n')[0])) - elif ('float32[' in line.split(' ')[0]): - num_floats = int(line.split(" ")[0].split("[")[1].split("]")[0]) - temp_list.append(("float_array",line.split(' ')[1].split('\t')[0].split('\n')[0],num_floats)) + elif (line.split(' ')[0] == "int8") and len(line.split('=')) == 1: + temp_list.append(("int8",line.split(' ')[1].split('\t')[0].split('\n')[0])) f.close() messages.append(m.split('/')[-1].split('.')[0]) @@ -131,12 +146,24 @@ for index,m in enumerate(messages[1:]): print("\t\t\tprintf(\"%s: %%f\\n \",(double)container.%s);" % (item[1], item[1])) elif item[0] == "float_array": print("\t\t\tprintf(\"%s:\");" % item[1]) - print("\t\t\tfor (int j=0;j<%d;j++) {" % item[2]) + print("\t\t\tfor (int j = 0; j < %d; j++) {" % item[2]) print("\t\t\t\tprintf(\"%%f \",(double)container.%s[j]);" % item[1]) print("\t\t\t}") print("\t\t\tprintf(\"\\n\");") elif item[0] == "uint64": print("\t\t\tprintf(\"%s: %%\" PRIu64 \"\\n \",container.%s);" % (item[1], item[1])) + elif item[0] == "uint64_array": + print("\t\t\tprintf(\"%s:\");" % item[1]) + print("\t\t\tfor (int j = 0; j < %d; j++) {" % item[2]) + print("\t\t\t\tprintf(\"%%\" PRIu64 \" \",container.%s[j]);" % item[1]) + print("\t\t\t}") + print("\t\t\tprintf(\"\\n\");") + elif item[0] == "int64": + print("\t\t\tprintf(\"%s: %%\" PRI64 \"\\n \",container.%s);" % (item[1], item[1])) + elif item[0] == "int32": + print("\t\t\tprintf(\"%s: %%d\\n \",container.%s);" % (item[1], item[1])) + elif item[0] == "uint32": + print("\t\t\tprintf(\"%s: %%d\\n \",container.%s);" % (item[1], item[1])) elif item[0] == "uint8": print("\t\t\tprintf(\"%s: %%u\\n \",container.%s);" % (item[1], item[1])) elif item[0] == "bool": From 324c786e0af8e16f1cb7fa900494405be3d532fc Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 12:55:32 +0200 Subject: [PATCH 201/389] Simulator: Init sensor data diligently --- src/modules/simulator/simulator_mavlink.cpp | 34 +++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index c9833addda..7f55db47bb 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -370,19 +370,35 @@ void Simulator::send() void Simulator::initializeSensorData() { - struct baro_report baro = {}; - baro.pressure = 120000.0f; + // write sensor data to memory so that drivers can copy data from there + RawMPUData mpu = {}; + mpu.accel_z = 9.81f; - // acceleration report - struct accel_report accel = {}; + write_MPU_data((void *)&mpu); + + RawAccelData accel = {}; accel.z = 9.81f; - accel.range_m_s2 = 80.0f; - // gyro report - struct gyro_report gyro = {}; + write_accel_data((void *)&accel); - // mag report - struct mag_report mag = {}; + RawMagData mag = {}; + mag.x = 0.4f; + mag.y = 0.0f; + mag.z = 0.6f; + + write_mag_data((void *)&mag); + + RawBaroData baro = {}; + // calculate air pressure from altitude (valid for low altitude) + baro.pressure = 120000.0f; + baro.altitude = 0.0f; + baro.temperature = 25.0f; + + write_baro_data((void *)&baro); + + RawAirspeedData airspeed {}; + + write_airspeed_data((void *)&airspeed); } void Simulator::pollForMAVLinkMessages(bool publish) From 59f71452d71ca6ad512a722946e67dc89db3b18b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 12:55:48 +0200 Subject: [PATCH 202/389] Sensor sim: Initialize sensor data to zero --- src/platforms/posix/drivers/accelsim/accelsim.cpp | 9 +++++---- src/platforms/posix/drivers/gyrosim/gyrosim.cpp | 14 ++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/platforms/posix/drivers/accelsim/accelsim.cpp b/src/platforms/posix/drivers/accelsim/accelsim.cpp index cc299b5847..fa0a256605 100644 --- a/src/platforms/posix/drivers/accelsim/accelsim.cpp +++ b/src/platforms/posix/drivers/accelsim/accelsim.cpp @@ -448,6 +448,9 @@ ACCELSIM::init() { int ret = ERROR; + struct mag_report mrp = {}; + struct accel_report arp = {}; + /* do SIM init first */ if (VDev::init() != OK) { PX4_WARN("SIM init failed"); @@ -478,7 +481,6 @@ ACCELSIM::init() measure(); /* advertise sensor topic, measure manually to initialize valid report */ - struct mag_report mrp; _mag_reports->get(&mrp); /* measurement will have generated a report, publish */ @@ -493,7 +495,6 @@ ACCELSIM::init() _accel_class_instance = register_class_devname(ACCEL_BASE_DEVICE_PATH); /* advertise sensor topic, measure manually to initialize valid report */ - struct accel_report arp = {}; _accel_reports->get(&arp); /* measurement will have generated a report, publish */ @@ -1014,7 +1015,7 @@ ACCELSIM::measure() } raw_accel_report; #pragma pack(pop) - accel_report accel_report; + accel_report accel_report = {}; /* start the performance counter */ perf_begin(_accel_sample_perf); @@ -1023,7 +1024,7 @@ ACCELSIM::measure() memset(&raw_accel_report, 0, sizeof(raw_accel_report)); raw_accel_report.cmd = DIR_READ | ACC_READ; - if(OK != transfer((uint8_t *)&raw_accel_report, (uint8_t *)&raw_accel_report, sizeof(raw_accel_report))) { + if (OK != transfer((uint8_t *)&raw_accel_report, (uint8_t *)&raw_accel_report, sizeof(raw_accel_report))) { return; } diff --git a/src/platforms/posix/drivers/gyrosim/gyrosim.cpp b/src/platforms/posix/drivers/gyrosim/gyrosim.cpp index 850bf0f9d1..50cc5091d8 100644 --- a/src/platforms/posix/drivers/gyrosim/gyrosim.cpp +++ b/src/platforms/posix/drivers/gyrosim/gyrosim.cpp @@ -419,6 +419,9 @@ GYROSIM::init() return ret; } + struct accel_report arp = {}; + struct gyro_report grp = {}; + /* allocate basic report buffers */ _accel_reports = new ringbuffer::RingBuffer(2, sizeof(accel_report)); if (_accel_reports == nullptr) { @@ -466,7 +469,6 @@ GYROSIM::init() measure(); /* advertise sensor topic, measure manually to initialize valid report */ - struct accel_report arp = {}; _accel_reports->get(&arp); /* measurement will have generated a report, publish */ @@ -482,7 +484,6 @@ GYROSIM::init() /* advertise sensor topic, measure manually to initialize valid report */ - struct gyro_report grp = {}; _gyro_reports->get(&grp); _gyro->_gyro_topic = orb_advertise_multi(ORB_ID(sensor_gyro), &grp, @@ -511,8 +512,9 @@ GYROSIM::transfer(uint8_t *send, uint8_t *recv, unsigned len) if (cmd == MPUREAD) { // Get data from the simulator Simulator *sim = Simulator::getInstance(); - if (sim == NULL) + if (sim == NULL) { return ENODEV; + } // FIXME - not sure what interrupt status should be recv[1] = 0; @@ -1012,7 +1014,7 @@ GYROSIM::measure() x++; } #endif - struct MPUReport mpu_report; + struct MPUReport mpu_report = {}; /* start measuring */ perf_begin(_sample_perf); @@ -1031,8 +1033,8 @@ GYROSIM::measure() /* * Report buffers. */ - accel_report arb; - gyro_report grb; + accel_report arb = {}; + gyro_report grb = {}; // for now use local time but this should be the timestamp of the simulator grb.timestamp = hrt_absolute_time(); From 1c27b9fa41503afc445d1acbdabaf44c45aeba2d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 12:56:03 +0200 Subject: [PATCH 203/389] Topic listener: Re-enable in build --- src/systemcmds/topic_listener/CMakeLists.txt | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/systemcmds/topic_listener/CMakeLists.txt b/src/systemcmds/topic_listener/CMakeLists.txt index 3d98a6d4f4..2f720757ac 100644 --- a/src/systemcmds/topic_listener/CMakeLists.txt +++ b/src/systemcmds/topic_listener/CMakeLists.txt @@ -31,23 +31,23 @@ # ############################################################################ -#add_custom_command(OUTPUT topic_listener.cpp -# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/generate_listener.py ${CMAKE_SOURCE_DIR} > topic_listener.cpp -# ) +add_custom_command(OUTPUT topic_listener.cpp + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/generate_listener.py ${CMAKE_SOURCE_DIR} > topic_listener.cpp + ) -#add_custom_target(generate_topic_listener -# DEPENDS topic_listener.cpp) +add_custom_target(generate_topic_listener + DEPENDS topic_listener.cpp) -#px4_add_module( -# MODULE systemcmds__topic_listener -# MAIN listener -# STACK 1800 -# COMPILE_FLAGS -# -Os -# SRCS -# topic_listener.cpp -# DEPENDS -# platforms__common -# generate_topic_listener -# ) +px4_add_module( + MODULE systemcmds__topic_listener + MAIN listener + STACK 1800 + COMPILE_FLAGS + -Os + SRCS + topic_listener.cpp + DEPENDS + platforms__common + generate_topic_listener + ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 4d98bd57b6ae8ac668fe531e1b6bc1f3b2fc530f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 13:09:03 +0200 Subject: [PATCH 204/389] Attitude estimator Q: Fix frame size warning --- src/modules/attitude_estimator_q/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/attitude_estimator_q/CMakeLists.txt b/src/modules/attitude_estimator_q/CMakeLists.txt index fd47087728..a727305b9a 100644 --- a/src/modules/attitude_estimator_q/CMakeLists.txt +++ b/src/modules/attitude_estimator_q/CMakeLists.txt @@ -33,6 +33,8 @@ px4_add_module( MODULE modules__attitude_estimator_q MAIN attitude_estimator_q + COMPILE_FLAGS + -Wframe-larger-than=1400 STACK 1200 SRCS attitude_estimator_q_main.cpp From 8218f8797e34f4fc38b5a464a5ecf97b9fc357dd Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 13:12:51 +0200 Subject: [PATCH 205/389] EKF Fix optimization level --- src/modules/ekf_att_pos_estimator/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/ekf_att_pos_estimator/CMakeLists.txt b/src/modules/ekf_att_pos_estimator/CMakeLists.txt index 9d4ae2de6f..9386cbf9fa 100644 --- a/src/modules/ekf_att_pos_estimator/CMakeLists.txt +++ b/src/modules/ekf_att_pos_estimator/CMakeLists.txt @@ -36,7 +36,7 @@ px4_add_module( COMPILE_FLAGS -Weffc++ -Wframe-larger-than=3400 - + -O3 SRCS ekf_att_pos_estimator_main.cpp ekf_att_pos_estimator_params.c From 673fdd8002ebdf48d2212b143b1940c73e5e8326 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 13:13:02 +0200 Subject: [PATCH 206/389] sdlog2: Fix stack size --- src/modules/sdlog2/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/sdlog2/CMakeLists.txt b/src/modules/sdlog2/CMakeLists.txt index 319e614d34..ddc1b30174 100644 --- a/src/modules/sdlog2/CMakeLists.txt +++ b/src/modules/sdlog2/CMakeLists.txt @@ -36,7 +36,7 @@ px4_add_module( PRIORITY "SCHED_PRIORITY_MAX-30" STACK 1200 COMPILE_FLAGS - -Wframe-larger-than=1400 + -Wframe-larger-than=1500 -Os SRCS sdlog2.c From 8a0277d654eeed672a79efef78e22cec90a42a01 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 13:13:19 +0200 Subject: [PATCH 207/389] Sensors app: Fix optimization level --- src/modules/sensors/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/sensors/CMakeLists.txt b/src/modules/sensors/CMakeLists.txt index 0d498032dd..fdfc2dd774 100644 --- a/src/modules/sensors/CMakeLists.txt +++ b/src/modules/sensors/CMakeLists.txt @@ -37,7 +37,7 @@ px4_add_module( STACK 1200 COMPILE_FLAGS -Wno-type-limits - -Os + -O3 SRCS sensors.cpp sensor_params.c From 985243c932220338f3366650daf562a96fdca7a8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 15:06:27 +0200 Subject: [PATCH 208/389] Merged --- src/modules/simulator/simulator_mavlink.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index 7f55db47bb..cc4ef2bdaa 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -458,10 +458,15 @@ void Simulator::pollForMAVLinkMessages(bool publish) char serial_buf[1024]; struct pollfd fds[2]; + unsigned fd_count = 1; fds[0].fd = _fd; fds[0].events = POLLIN; - fds[1].fd = serial_fd; - fds[1].events = POLLIN; + + if (serial_fd >= 0) { + fds[1].fd = serial_fd; + fds[1].events = POLLIN; + fd_count++; + } int len = 0; @@ -496,7 +501,7 @@ void Simulator::pollForMAVLinkMessages(bool publish) // wait for new mavlink messages to arrive while (true) { - pret = ::poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100); + pret = ::poll(&fds[0], fd_count, 100); //timed out if (pret == 0) { From 0973649eb776365fa4434f833289e4b856b3e2ca Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 15:06:55 +0200 Subject: [PATCH 209/389] POSIX: Provide lldb run target configuring lldb correctly --- Tools/posix_lldbinit | 3 +++ Tools/sitl_run.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 Tools/posix_lldbinit diff --git a/Tools/posix_lldbinit b/Tools/posix_lldbinit new file mode 100644 index 0000000000..a3e04d3a07 --- /dev/null +++ b/Tools/posix_lldbinit @@ -0,0 +1,3 @@ +run +pro hand -p true -s false -n false SIGCONT +continue diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 637982fd33..451dca8326 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -1,5 +1,5 @@ #!/bin/bash - +cp Tools/posix_lldbinit build_posix_sitl_simple/src/firmware/posix/.lldbinit cd build_posix_sitl_simple/src/firmware/posix mkdir -p rootfs/fs/microsd mkdir -p rootfs/eeprom From 941c898113d5de37a1e3390421220e86ac50612a Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 15:21:07 +0200 Subject: [PATCH 210/389] Navigator: Allow 200 ms wait time --- src/modules/navigator/navigator_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/navigator/navigator_main.cpp b/src/modules/navigator/navigator_main.cpp index 50b8746a71..bf8974cd8c 100644 --- a/src/modules/navigator/navigator_main.cpp +++ b/src/modules/navigator/navigator_main.cpp @@ -332,8 +332,8 @@ Navigator::task_main() while (!_task_should_exit) { - /* wait for up to 100ms for data */ - int pret = px4_poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100); + /* wait for up to 200ms for data */ + int pret = px4_poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 200); if (pret == 0) { /* timed out - periodic check for _task_should_exit, etc. */ From 8f14850aa2e34dedbf52c0cb8291a7d0dbb753a7 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 15:21:58 +0200 Subject: [PATCH 211/389] sdlog2: Fix compile warning on OS X --- src/modules/sdlog2/sdlog2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index 2aeb2e8c0c..59008f7187 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -173,7 +173,7 @@ PARAM_DEFINE_INT32(SDLOG_GPSTIME, 1); log_msgs_skipped++; \ } -#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) +#define SDLOG_MIN(X,Y) ((X) < (Y) ? (X) : (Y)) static bool main_thread_should_exit = false; /**< Deamon exit flag */ static bool thread_running = false; /**< Deamon status flag */ @@ -1402,7 +1402,7 @@ int sdlog2_thread_main(int argc, char *argv[]) if (copy_if_updated(ORB_ID(satellite_info), &subs.sat_info_sub, &buf.sat_info)) { /* log the SNR of each satellite for a detailed view of signal quality */ - unsigned sat_info_count = MIN(buf.sat_info.count, sizeof(buf.sat_info.snr) / sizeof(buf.sat_info.snr[0])); + unsigned sat_info_count = SDLOG_MIN(buf.sat_info.count, sizeof(buf.sat_info.snr) / sizeof(buf.sat_info.snr[0])); unsigned log_max_snr = sizeof(log_msg.body.log_GS0A.satellite_snr) / sizeof(log_msg.body.log_GS0A.satellite_snr[0]); log_msg.msg_type = LOG_GS0A_MSG; From 7c3725772a1cc4087454fe898dee1623832e2c7e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 15:22:15 +0200 Subject: [PATCH 212/389] Param: Be less verbose when nothing changes --- src/systemcmds/param/param.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index 7c5b4e8cc6..c50bb8e8dd 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -447,10 +447,7 @@ do_set(const char *name, const char *val, bool fail_on_not_found) char *end; int32_t newval = strtol(val, &end, 10); - if (i == newval) { - printf("unchanged\n"); - - } else { + if (i =!= newval) { printf("curr: %ld", (long)i); param_set(param, &newval); printf(" -> new: %ld\n", (long)newval); @@ -468,11 +465,8 @@ do_set(const char *name, const char *val, bool fail_on_not_found) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" - if (f == newval) { + if (f != newval) { #pragma GCC diagnostic pop - printf("unchanged\n"); - - } else { printf("curr: %4.4f", (double)f); param_set(param, &newval); printf(" -> new: %4.4f\n", (double)newval); From 74a98504394189d438f0da3aeedd0daedd2b35ed Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:40:33 +0200 Subject: [PATCH 213/389] Param: Be less verbose --- src/systemcmds/param/param.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index c50bb8e8dd..d38a13c676 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -431,10 +431,6 @@ do_set(const char *name, const char *val, bool fail_on_not_found) return (fail_on_not_found) ? 1 : 0; } - printf("%c %s: ", - param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'), - param_name(param)); - /* * Set parameter if type is known and conversion from string to value turns out fine */ @@ -447,7 +443,10 @@ do_set(const char *name, const char *val, bool fail_on_not_found) char *end; int32_t newval = strtol(val, &end, 10); - if (i =!= newval) { + if (i != newval) { + printf("%c %s: ", + param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'), + param_name(param)); printf("curr: %ld", (long)i); param_set(param, &newval); printf(" -> new: %ld\n", (long)newval); @@ -467,6 +466,9 @@ do_set(const char *name, const char *val, bool fail_on_not_found) if (f != newval) { #pragma GCC diagnostic pop + printf("%c %s: ", + param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'), + param_name(param)); printf("curr: %4.4f", (double)f); param_set(param, &newval); printf(" -> new: %4.4f\n", (double)newval); From 6db320741c7c745713db96042eed601b4063cb82 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:40:53 +0200 Subject: [PATCH 214/389] Makefile: support GDB debugging --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 177bdeeb86..0dbe379548 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,15 @@ lldb_sitl_plane: posix lldb_sitl_ros: posix Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros lldb +gdb_sitl_quad: posix + Tools/sitl_run.sh posix-configs/SITL/init/rcS lldb + +gdb_sitl_plane: posix + Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing lldb + +gdb_sitl_ros: posix + Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros lldb + sitl_quad: @echo "Deprecated. Use 'run_sitl_quad' instead." From 83558bfe14bce76fec18d5de7469fb45e96da790 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:41:11 +0200 Subject: [PATCH 215/389] SITL: Add missing PWM out sim --- cmake/configs/posix_sitl_simple.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/configs/posix_sitl_simple.cmake b/cmake/configs/posix_sitl_simple.cmake index b557401810..9d520d72f0 100644 --- a/cmake/configs/posix_sitl_simple.cmake +++ b/cmake/configs/posix_sitl_simple.cmake @@ -6,6 +6,8 @@ set(config_module_list drivers/led drivers/device drivers/boards/sitl + drivers/pwm_out_sim + drivers/rgbled platforms/common platforms/posix/px4_layer platforms/posix/work_queue From 715a0f0a50cca0e64b4532dcd63363a5a6810791 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:41:34 +0200 Subject: [PATCH 216/389] SITL: Fix paths --- posix-configs/SITL/init/rcS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posix-configs/SITL/init/rcS b/posix-configs/SITL/init/rcS index b340096721..35bf7abd5b 100644 --- a/posix-configs/SITL/init/rcS +++ b/posix-configs/SITL/init/rcS @@ -44,7 +44,7 @@ attitude_estimator_q start position_estimator_inav start mc_pos_control start mc_att_control start -mixer load /dev/pwm_output0 ../../ROMFS/px4fmu_common/mixers/quad_x.main.mix +mixer load /dev/pwm_output0 ../../../../ROMFS/px4fmu_common/mixers/quad_x.main.mix mavlink start -u 14556 -r 2000000 mavlink stream -r 80 -s POSITION_TARGET_LOCAL_NED -u 14556 mavlink stream -r 80 -s LOCAL_POSITION_NED -u 14556 From 84b4e30fbd634a476281ee593d63dd2a35370eca Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:42:03 +0200 Subject: [PATCH 217/389] sdlog2: Remove copying of deprecated file --- src/modules/sdlog2/sdlog2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index 59008f7187..6112bbce1a 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -1083,6 +1083,10 @@ int sdlog2_thread_main(int argc, char *argv[]) return 1; } +#if 0 + + // DEPRECATED + /* copy conversion scripts */ const char *converter_in = "/etc/logging/conv.zip"; char *converter_out = malloc(64); @@ -1093,6 +1097,7 @@ int sdlog2_thread_main(int argc, char *argv[]) } free(converter_out); +#endif /* initialize log buffer with specified size */ warnx("log buffer size: %i bytes", log_buffer_size); From 6a2e50d2a8ea88cde3a86f0981797379be13738a Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:42:48 +0200 Subject: [PATCH 218/389] Simulator: Cleaner data structure init --- src/modules/simulator/simulator_mavlink.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index cc4ef2bdaa..c83cec6351 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -128,7 +128,6 @@ void Simulator::send_controls() { mavlink_hil_controls_t msg; pack_actuator_message(msg); - //PX4_WARN("Sending HIL_CONTROLS msg"); send_mavlink_message(MAVLINK_MSG_ID_HIL_CONTROLS, &msg, 200); } @@ -173,7 +172,7 @@ static void fill_rc_input_msg(struct rc_input_values *rc, mavlink_rc_channels_t void Simulator::update_sensors(mavlink_hil_sensor_t *imu) { // write sensor data to memory so that drivers can copy data from there - RawMPUData mpu; + RawMPUData mpu = {}; mpu.accel_x = imu->xacc; mpu.accel_y = imu->yacc; mpu.accel_z = imu->zacc; @@ -184,21 +183,21 @@ void Simulator::update_sensors(mavlink_hil_sensor_t *imu) write_MPU_data((void *)&mpu); - RawAccelData accel; + RawAccelData accel = {}; accel.x = imu->xacc; accel.y = imu->yacc; accel.z = imu->zacc; write_accel_data((void *)&accel); - RawMagData mag; + RawMagData mag = {}; mag.x = imu->xmag; mag.y = imu->ymag; mag.z = imu->zmag; write_mag_data((void *)&mag); - RawBaroData baro; + RawBaroData baro = {}; // calculate air pressure from altitude (valid for low altitude) baro.pressure = (PRESS_GROUND - GRAVITY * DENSITY * imu->pressure_alt) / 100.0f; // convert from Pa to mbar baro.altitude = imu->pressure_alt; @@ -206,7 +205,7 @@ void Simulator::update_sensors(mavlink_hil_sensor_t *imu) write_baro_data((void *)&baro); - RawAirspeedData airspeed; + RawAirspeedData airspeed = {}; airspeed.temperature = imu->temperature; airspeed.diff_pressure = imu->diff_pressure; @@ -347,7 +346,7 @@ void Simulator::send() // wait for up to 100ms for data pret = px4_poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100); - //timed out + // timed out if (pret == 0) { continue; } From d32f9f043b70aa9f91624cbefe93d21b4d8f828d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:43:34 +0200 Subject: [PATCH 219/389] HRT: Better debugging --- src/platforms/posix/px4_layer/drv_hrt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/src/platforms/posix/px4_layer/drv_hrt.c index 981857da45..6456008daa 100644 --- a/src/platforms/posix/px4_layer/drv_hrt.c +++ b/src/platforms/posix/px4_layer/drv_hrt.c @@ -345,7 +345,7 @@ hrt_call_reschedule() static void hrt_call_internal(struct hrt_call *entry, hrt_abstime deadline, hrt_abstime interval, hrt_callout callout, void *arg) { - //PX4_INFO("hrt_call_internal deadline=%lu interval = %lu", deadline, interval); + PX4_DEBUG("hrt_call_internal deadline=%lu interval = %lu", deadline, interval); hrt_lock(); //PX4_INFO("hrt_call_internal after lock"); @@ -361,7 +361,7 @@ hrt_call_internal(struct hrt_call *entry, hrt_abstime deadline, hrt_abstime inte sq_rem(&entry->link, &callout_queue); } -#if 0 +#if 1 // Use this to debug busy CPU that keeps rescheduling with 0 period time if (interval < HRT_INTERVAL_MIN) { From b2a8dd18c00a6a66e7804673a556ff504119fccc Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:43:44 +0200 Subject: [PATCH 220/389] Gyrosim: More verbose output --- src/platforms/posix/drivers/gyrosim/gyrosim.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platforms/posix/drivers/gyrosim/gyrosim.cpp b/src/platforms/posix/drivers/gyrosim/gyrosim.cpp index 50cc5091d8..cbe1dbef41 100644 --- a/src/platforms/posix/drivers/gyrosim/gyrosim.cpp +++ b/src/platforms/posix/drivers/gyrosim/gyrosim.cpp @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -513,6 +512,7 @@ GYROSIM::transfer(uint8_t *send, uint8_t *recv, unsigned len) // Get data from the simulator Simulator *sim = Simulator::getInstance(); if (sim == NULL) { + PX4_WARN("failed accessing simulator"); return ENODEV; } @@ -531,6 +531,7 @@ GYROSIM::transfer(uint8_t *send, uint8_t *recv, unsigned len) if (recv) memcpy(&recv[1], &_regdata[reg-MPUREG_PRODUCT_ID], len-1); } + return PX4_OK; } @@ -767,8 +768,9 @@ GYROSIM::ioctl(device::file_t *filp, int cmd, unsigned long arg) bool want_start = (_call_interval == 0); /* if we need to start the poll state machine, do it */ - if (want_start) + if (want_start) { start(); + } return OK; } From 22d3ba2a8d6f6a1610ae767f3a5c4cf9525f184b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 16:52:47 +0200 Subject: [PATCH 221/389] PX4 Posix: Fix header --- src/platforms/px4_posix.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/platforms/px4_posix.h b/src/platforms/px4_posix.h index b061f89fa8..bd682d9ce5 100644 --- a/src/platforms/px4_posix.h +++ b/src/platforms/px4_posix.h @@ -71,13 +71,17 @@ __END_DECLS #else +__BEGIN_DECLS + typedef sem_t px4_sem_t; -#define px4_sem_init _GLOBAL sem_init -#define px4_sem_wait _GLOBAL sem_wait -#define px4_sem_post _GLOBAL sem_post -#define px4_sem_getvalue _GLOBAL sem_getvalue -#define px4_sem_destroy _GLOBAL sem_destroy +#define px4_sem_init sem_init +#define px4_sem_wait sem_wait +#define px4_sem_post sem_post +#define px4_sem_getvalue sem_getvalue +#define px4_sem_destroy sem_destroy + +__END_DECLS #endif From e38eba09344cd0a8a6bb755024ba20036b6c94cc Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 20 Sep 2015 11:17:31 -0400 Subject: [PATCH 222/389] cmake: Fix for posix sitl. --- Makefile | 2 +- Tools/sitl_run.sh | 3 ++- src/platforms/posix/drivers/barosim/barosim.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0dbe379548..ea1344a4ef 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ lldb_sitl_ros: posix Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros lldb gdb_sitl_quad: posix - Tools/sitl_run.sh posix-configs/SITL/init/rcS lldb + Tools/sitl_run.sh posix-configs/SITL/init/rcS gdb gdb_sitl_plane: posix Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing lldb diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 451dca8326..1a7741d6fd 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -1,5 +1,6 @@ #!/bin/bash cp Tools/posix_lldbinit build_posix_sitl_simple/src/firmware/posix/.lldbinit +cp Tools/posix.gdbinit build_posix_sitl_simple/src/firmware/posix/.gdbinit cd build_posix_sitl_simple/src/firmware/posix mkdir -p rootfs/fs/microsd mkdir -p rootfs/eeprom @@ -9,7 +10,7 @@ then lldb -- mainapp ../../../../$1 elif [ "$2" == "gdb" ] then - gdb -- mainapp ../../../../$1 + gdb --args mainapp ../../../../$1 else ./mainapp ../../../../$1 fi diff --git a/src/platforms/posix/drivers/barosim/barosim.h b/src/platforms/posix/drivers/barosim/barosim.h index 8eaa0c21f5..bac176d400 100644 --- a/src/platforms/posix/drivers/barosim/barosim.h +++ b/src/platforms/posix/drivers/barosim/barosim.h @@ -80,5 +80,5 @@ extern bool crc4(uint16_t *n_prom); } /* namespace */ /* interface factories */ -extern device::Device *BAROSIM_sim_interface(barosim::prom_u &prom_buf, uint8_t busnum) __attribute__((weak)); +extern device::Device *BAROSIM_sim_interface(barosim::prom_u &prom_buf, uint8_t busnum); typedef device::Device *(*BAROSIM_constructor)(barosim::prom_u &prom_buf, uint8_t busnum); From 1cdbd4ca1eecafb3249e02aa46068a520377e0ab Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 17:24:05 +0200 Subject: [PATCH 223/389] Update Vagrant to include ZIP and GDB --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 25ba1ce35c..9ef6327476 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -78,7 +78,7 @@ Vagrant.configure(2) do |config| echo "cd /Firmware" >> ~/.bashrc # Install software sudo apt-get update - sudo apt-get install -y build-essential ccache cmake clang-3.5 lldb-3.5 g++-4.8 gcc-4.8 genromfs libc6-i386 libncurses5-dev python-argparse python-empy python-serial s3cmd texinfo zlib1g-dev git-core + sudo apt-get install -y build-essential ccache cmake clang-3.5 lldb-3.5 g++-4.8 gcc-4.8 genromfs libc6-i386 libncurses5-dev python-argparse python-empy python-serial s3cmd texinfo zlib1g-dev git-core zip gdb pushd . cd ~ wget -q https://launchpadlibrarian.net/186124160/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 From 9778ed30d7dfefeec4de9cf67cb53bffa24f7dee Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 17:33:46 +0200 Subject: [PATCH 224/389] Fixed wing / IRIS startup: Fix relative paths --- posix-configs/SITL/init/rc.fixed_wing | 2 +- posix-configs/SITL/init/rc_iris_ros | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posix-configs/SITL/init/rc.fixed_wing b/posix-configs/SITL/init/rc.fixed_wing index 7cdad2f9dc..bdb2fb8e9d 100644 --- a/posix-configs/SITL/init/rc.fixed_wing +++ b/posix-configs/SITL/init/rc.fixed_wing @@ -39,7 +39,7 @@ navigator start ekf_att_pos_estimator start fw_att_control start fw_pos_control_l1 start -mixer load /dev/pwm_output0 ../../ROMFS/px4fmu_common/mixers/IO_pass.main.mix +mixer load /dev/pwm_output0 ../../../../ROMFS/px4fmu_common/mixers/IO_pass.main.mix mavlink start -u 14556 -r 60000 mavlink stream -r 50 -s POSITION_TARGET_LOCAL_NED -u 14556 mavlink stream -r 50 -s LOCAL_POSITION_NED -u 14556 diff --git a/posix-configs/SITL/init/rc_iris_ros b/posix-configs/SITL/init/rc_iris_ros index ffef510989..096f659d65 100644 --- a/posix-configs/SITL/init/rc_iris_ros +++ b/posix-configs/SITL/init/rc_iris_ros @@ -58,7 +58,7 @@ attitude_estimator_q start position_estimator_inav start mc_pos_control_m start mc_att_control_m start -mixer load /dev/pwm_output0 ../../ROMFS/px4fmu_common/mixers/quad_x.main.mix +mixer load /dev/pwm_output0 ../../../../ROMFS/px4fmu_common/mixers/quad_x.main.mix mavlink start -u 14556 -r 2000000 mavlink stream -r 80 -s POSITION_TARGET_LOCAL_NED -u 14556 mavlink stream -r 80 -s LOCAL_POSITION_NED -u 14556 From 9eb748ed5bf6eefd26c862d0cc29947c96c28991 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 20 Sep 2015 17:48:35 +0200 Subject: [PATCH 225/389] Always publish RC data from Pixhawk --- src/modules/simulator/simulator_mavlink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index c83cec6351..bf42d346b9 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -543,7 +543,7 @@ void Simulator::pollForMAVLinkMessages(bool publish) for (int i = 0; i < len; ++i) { if (mavlink_parse_char(MAVLINK_COMM_0, serial_buf[i], &msg, &status)) { // have a message, handle it - handle_message(&msg, publish); + handle_message(&msg, true); } } } From f424cc6b18f0d0382eedbb99bb80a4ccdc086ef3 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 7 Aug 2015 11:18:56 -1000 Subject: [PATCH 226/389] Using the uavcan stm32 clock driver to support UAVCAN time syncing Conflicts: src/lib/uavcan src/modules/systemlib/print_load_posix.c src/modules/uavcannode/module.mk --- src/lib/uavcan | 2 +- src/modules/uavcan/module.mk | 6 +-- src/modules/uavcan/uavcan_clock.cpp | 81 ----------------------------- 3 files changed, 4 insertions(+), 85 deletions(-) delete mode 100644 src/modules/uavcan/uavcan_clock.cpp diff --git a/src/lib/uavcan b/src/lib/uavcan index 3ae5400aa5..50dc08663a 160000 --- a/src/lib/uavcan +++ b/src/lib/uavcan @@ -1 +1 @@ -Subproject commit 3ae5400aa5ead18139106d30f730114d5e9b65dd +Subproject commit 50dc08663af2d9b55eae0ccf5f07c63db0ee8907 diff --git a/src/modules/uavcan/module.mk b/src/modules/uavcan/module.mk index da62e55634..f846fd27bc 100644 --- a/src/modules/uavcan/module.mk +++ b/src/modules/uavcan/module.mk @@ -44,8 +44,7 @@ WFRAME_LARGER_THAN = 1400 # Main SRCS += uavcan_main.cpp \ - uavcan_servers.cpp \ - uavcan_clock.cpp \ + uavcan_servers.cpp \ uavcan_params.c # Actuators @@ -70,7 +69,8 @@ override EXTRADEFINES := $(EXTRADEFINES) \ -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 \ -DUAVCAN_NO_ASSERTIONS \ -DUAVCAN_MEM_POOL_BLOCK_SIZE=48 \ --DUAVCAN_MAX_NETWORK_SIZE_HINT=16 +-DUAVCAN_MAX_NETWORK_SIZE_HINT=16 \ +-DUAVCAN_STM32_TIMER_NUMBER=2 # # libuavcan drivers for STM32 diff --git a/src/modules/uavcan/uavcan_clock.cpp b/src/modules/uavcan/uavcan_clock.cpp deleted file mode 100644 index fe8ba406a5..0000000000 --- a/src/modules/uavcan/uavcan_clock.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2014 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#include -#include - -/** - * @file uavcan_clock.cpp - * - * Implements a clock for the CAN node. - * - * @author Pavel Kirienko - */ - -namespace uavcan_stm32 -{ -namespace clock -{ - -uavcan::MonotonicTime getMonotonic() -{ - return uavcan::MonotonicTime::fromUSec(hrt_absolute_time()); -} - -uavcan::UtcTime getUtc() -{ - return uavcan::UtcTime(); -} - -void adjustUtc(uavcan::UtcDuration adjustment) -{ - (void)adjustment; -} - -uavcan::uint64_t getUtcUSecFromCanInterrupt(); - -uavcan::uint64_t getUtcUSecFromCanInterrupt() -{ - return 0; -} - -} // namespace clock - -SystemClock &SystemClock::instance() -{ - static SystemClock inst; - return inst; -} - -} - From d69be4b554dbaead3fba5d42c2e5de1e056acf37 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Sat, 8 Aug 2015 08:00:00 -1000 Subject: [PATCH 227/389] Added UAVCAN Time Synchronization Master capabilities to FMU --- src/modules/uavcan/module.mk | 2 +- src/modules/uavcan/uavcan_main.cpp | 68 +++++++++++++++++++++++++++++- src/modules/uavcan/uavcan_main.hpp | 14 +++++- 3 files changed, 81 insertions(+), 3 deletions(-) diff --git a/src/modules/uavcan/module.mk b/src/modules/uavcan/module.mk index f846fd27bc..77ff77c6d7 100644 --- a/src/modules/uavcan/module.mk +++ b/src/modules/uavcan/module.mk @@ -70,7 +70,7 @@ override EXTRADEFINES := $(EXTRADEFINES) \ -DUAVCAN_NO_ASSERTIONS \ -DUAVCAN_MEM_POOL_BLOCK_SIZE=48 \ -DUAVCAN_MAX_NETWORK_SIZE_HINT=16 \ --DUAVCAN_STM32_TIMER_NUMBER=2 +-DUAVCAN_STM32_TIMER_NUMBER=5 # # libuavcan drivers for STM32 diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index 5e4c8b228f..9daff4b075 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -77,7 +77,10 @@ UavcanNode::UavcanNode(uavcan::ICanDriver &can_driver, uavcan::ISystemClock &sys CDev("uavcan", UAVCAN_DEVICE_PATH), _node(can_driver, system_clock), _node_mutex(), - _esc_controller(_node) + _esc_controller(_node), + _time_sync_master(_node), + _time_sync_slave(_node), + _master_timer(_node) { _task_should_exit = false; _fw_server_action = None; @@ -459,6 +462,48 @@ int UavcanNode::add_poll_fd(int fd) } +void UavcanNode::handle_time_sync(const uavcan::TimerEvent &) +{ + + /* + * Check whether there are higher priority masters in the network. + * If there are, we need to activate the local slave in order to sync with them. + */ + if (_time_sync_slave.isActive()) { // "Active" means that the slave tracks at least one remote master in the network + if (_node.getNodeID() < _time_sync_slave.getMasterNodeID()) { + /* + * We're the highest priority master in the network. + * We need to suppress the slave now to prevent it from picking up unwanted sync messages from + * lower priority masters. + */ + _time_sync_slave.suppress(true); // SUPPRESS + + } else { + /* + * There is at least one higher priority master in the network. + * We need to allow the slave to adjust our local clock in order to be in sync. + */ + _time_sync_slave.suppress(false); // UNSUPPRESS + } + + } else { + /* + * There are no other time sync masters in the network, so we're the only time source. + * The slave must be suppressed anyway to prevent it from disrupting the local clock if a new + * lower priority master suddenly appears in the network. + */ + _time_sync_slave.suppress(true); + } + + /* + * Publish the sync message now, even if we're not a higher priority master. + * Other nodes will be able to pick the right master anyway. + */ + _time_sync_master.publish(); +} + + + int UavcanNode::run() { (void)pthread_mutex_lock(&_node_mutex); @@ -472,6 +517,27 @@ int UavcanNode::run() memset(&_outputs, 0, sizeof(_outputs)); + /* + * Set up the time synchronization + */ + + const int slave_init_res = _time_sync_slave.start(); + if (slave_init_res < 0) + { + warnx("Failed to start time_sync_slave"); + _task_should_exit = true; + } + + /* When we have a system wide notion of time update (i.e the transition from the initial + * System RTC setting to the GPS) we would call uavcan_stm32::clock::setUtc() when that + * happens, but for now we use adjustUtc with a correction of 0 + */ + uavcan_stm32::clock::adjustUtc(uavcan::UtcDuration::fromUSec(0)); + _master_timer.setCallback(TimerCallback(this, &UavcanNode::handle_time_sync)); + _master_timer.startPeriodic(uavcan::MonotonicDuration::fromMSec(1000)); + + + const int busevent_fd = ::open(uavcan_stm32::BusEvent::DevName, 0); if (busevent_fd < 0) { diff --git a/src/modules/uavcan/uavcan_main.hpp b/src/modules/uavcan/uavcan_main.hpp index acc1c32843..098d8ea55d 100644 --- a/src/modules/uavcan/uavcan_main.hpp +++ b/src/modules/uavcan/uavcan_main.hpp @@ -36,6 +36,9 @@ #include #include +#include +#include + #include #include @@ -48,7 +51,7 @@ #include "actuators/esc.hpp" #include "sensors/sensor_bridge.hpp" -# include "uavcan_servers.hpp" +#include "uavcan_servers.hpp" /** * @file uavcan_main.hpp @@ -121,6 +124,7 @@ public: void attachITxQueueInjector(ITxQueueInjector *injector) {_tx_injector = injector;} private: + void fill_node_info(); int init(uavcan::NodeID node_id); void node_spin_once(); @@ -150,6 +154,8 @@ private: pthread_mutex_t _node_mutex; sem_t _server_command_sem; UavcanEscController _esc_controller; + uavcan::GlobalTimeSyncMaster _time_sync_master; + uavcan::GlobalTimeSyncSlave _time_sync_slave; List _sensor_bridges; ///< List of active sensor bridges @@ -175,4 +181,10 @@ private: perf_counter_t _perfcnt_node_spin_elapsed = perf_alloc(PC_ELAPSED, "uavcan_node_spin_elapsed"); perf_counter_t _perfcnt_esc_mixer_output_elapsed = perf_alloc(PC_ELAPSED, "uavcan_esc_mixer_output_elapsed"); perf_counter_t _perfcnt_esc_mixer_total_elapsed = perf_alloc(PC_ELAPSED, "uavcan_esc_mixer_total_elapsed"); + + void handle_time_sync(const uavcan::TimerEvent &); + + typedef uavcan::MethodBinder TimerCallback; + uavcan::TimerEventForwarder _master_timer; + }; From 05ec165ed587f386898d9f16b0d45a95bc91b8e4 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 23 Sep 2015 04:00:01 -1000 Subject: [PATCH 228/389] Updated Submudule NuttX with cstdlib fixes ==master_cstdlib --- NuttX | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuttX b/NuttX index 8891d035df..aa15c32058 160000 --- a/NuttX +++ b/NuttX @@ -1 +1 @@ -Subproject commit 8891d035df45c8be570cfbd9419b438679faf7ee +Subproject commit aa15c32058acbda4cc2ee51e97d31e9e49225193 From 1996d2b55a71e1a713c7388cbca9cb6b67e97506 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Mon, 21 Sep 2015 18:18:24 -1000 Subject: [PATCH 229/389] Uavcan parameter and reset command line operations --- src/modules/uavcan/module.mk | 2 +- src/modules/uavcan/uavcan_main.cpp | 326 +++++++++++++++++++++++++++-- src/modules/uavcan/uavcan_main.hpp | 31 ++- 3 files changed, 339 insertions(+), 20 deletions(-) diff --git a/src/modules/uavcan/module.mk b/src/modules/uavcan/module.mk index 77ff77c6d7..9873d87fbe 100644 --- a/src/modules/uavcan/module.mk +++ b/src/modules/uavcan/module.mk @@ -40,7 +40,7 @@ MODULE_COMMAND = uavcan MAXOPTIMIZATION = -O3 MODULE_STACKSIZE = 3200 -WFRAME_LARGER_THAN = 1400 +WFRAME_LARGER_THAN = 1416 # Main SRCS += uavcan_main.cpp \ diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index 9daff4b075..96fca21ff1 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -55,6 +55,8 @@ #include "uavcan_main.hpp" #include +#include + //todo:The Inclusion of file_server_backend is killing // #include and leaving OK undefined # define OK 0 @@ -80,7 +82,8 @@ UavcanNode::UavcanNode(uavcan::ICanDriver &can_driver, uavcan::ISystemClock &sys _esc_controller(_node), _time_sync_master(_node), _time_sync_slave(_node), - _master_timer(_node) + _master_timer(_node), + _setget_response(0) { _task_should_exit = false; _fw_server_action = None; @@ -189,6 +192,239 @@ int UavcanNode::getHardwareVersion(uavcan::protocol::HardwareVersion &hwver) return rv; } +int UavcanNode::print_params(uavcan::protocol::param::GetSet::Response &resp) +{ + if (resp.value.is(uavcan::protocol::param::Value::Tag::integer_value)) { + return std::printf("name: %s %lld\n", resp.name.c_str(), + resp.value.to()); + + } else if (resp.value.is(uavcan::protocol::param::Value::Tag::real_value)) { + return std::printf("name: %s %.4f\n", resp.name.c_str(), + static_cast(resp.value.to())); + + } else if (resp.value.is(uavcan::protocol::param::Value::Tag::boolean_value)) { + return std::printf("name: %s %d\n", resp.name.c_str(), + resp.value.to()); + + } else if (resp.value.is(uavcan::protocol::param::Value::Tag::string_value)) { + return std::printf("name: %s '%s'\n", resp.name.c_str(), + resp.value.to().c_str()); + } + + return -1; +} + +void UavcanNode::cb_opcode(const uavcan::ServiceCallResult &result) +{ + uavcan::protocol::param::ExecuteOpcode::Response resp; + _callback_success = result.isSuccessful(); + resp = result.getResponse(); + _callback_success &= resp.ok; +} + +int UavcanNode::save_params(int remote_node_id) +{ + uavcan::protocol::param::ExecuteOpcode::Request opcode_req; + opcode_req.opcode = opcode_req.OPCODE_SAVE; + uavcan::ServiceClient client(_node); + client.setCallback(ExecuteOpcodeCallback(this, &UavcanNode::cb_opcode)); + _callback_success = false; + int call_res = client.call(remote_node_id, opcode_req); + + if (call_res >= 0) { + while (client.hasPendingCalls()) { + usleep(10000); + } + } + + if (!_callback_success) { + std::printf("Failed to save parameters: %d\n", call_res); + return -1; + } + + return 0; +} + +void UavcanNode::cb_restart(const uavcan::ServiceCallResult &result) +{ + uavcan::protocol::RestartNode::Response resp; + _callback_success = result.isSuccessful(); + resp = result.getResponse(); + _callback_success &= resp.ok; +} + +int UavcanNode::reset_node(int remote_node_id) +{ + uavcan::protocol::RestartNode::Request restart_req; + restart_req.magic_number = restart_req.MAGIC_NUMBER; + uavcan::ServiceClient client(_node); + client.setCallback(RestartNodeCallback(this, &UavcanNode::cb_restart)); + _callback_success = false; + int call_res = client.call(remote_node_id, restart_req); + + if (call_res >= 0) { + while (client.hasPendingCalls()) { + usleep(10000); + } + } + + if (!call_res) { + std::printf("Failed to reset node: %d\n", remote_node_id); + return -1; + } + + return 0; +} + +int UavcanNode::list_params(int remote_node_id) +{ + int rv = 0; + int index = 0; + uavcan::protocol::param::GetSet::Response resp; + set_setget_response(&resp); + + while (true) { + uavcan::protocol::param::GetSet::Request req; + req.index = index++; + _callback_success = false; + int call_res = get_set_param(remote_node_id, nullptr, req); + + if (call_res < 0 || !_callback_success) { + std::printf("Failed to get param: %d\n", call_res); + rv = -1; + break; + } + + if (resp.name.empty()) { // Empty name means no such param, which means we're finished + break; + } + + print_params(resp); + } + + free_setget_response(); + return rv; +} + + +void UavcanNode::cb_setget(const uavcan::ServiceCallResult &result) +{ + _callback_success = result.isSuccessful(); + *_setget_response = result.getResponse(); +} + +int UavcanNode::get_set_param(int remote_node_id, const char *name, uavcan::protocol::param::GetSet::Request &req) +{ + if (name != nullptr) { + req.name = name; + } + + uavcan::ServiceClient client(_node); + client.setCallback(GetSetCallback(this, &UavcanNode::cb_setget)); + _callback_success = false; + int call_res = client.call(remote_node_id, req); + + if (call_res >= 0) { + + while (client.hasPendingCalls()) { + usleep(10000); + } + + if (!_callback_success) { + call_res = -1; + } + } + + return call_res; +} + +int UavcanNode::set_param(int remote_node_id, const char *name, char *value) +{ + uavcan::protocol::param::GetSet::Request req; + uavcan::protocol::param::GetSet::Response resp; + set_setget_response(&resp); + int rv = get_set_param(remote_node_id, name, req); + + if (rv < 0 || resp.name.empty()) { + std::printf("Failed to retrieve param: %s\n", name); + rv = -1; + + } else { + + rv = 0; + req = {}; + + if (resp.value.is(uavcan::protocol::param::Value::Tag::integer_value)) { + int64_t i = std::strtoull(value, NULL, 10); + int64_t min = resp.min_value.to(); + int64_t max = resp.max_value.to(); + + if (i >= min && i <= max) { + req.value.to() = i; + + } else { + std::printf("Invalid value for: %s must be between %lld and %lld\n", name, min, max); + rv = -1; + } + + } else if (resp.value.is(uavcan::protocol::param::Value::Tag::real_value)) { + float f = static_cast(std::atof(value)); + float min = resp.min_value.to(); + float max = resp.max_value.to(); + + if (f >= min && f <= max) { + req.value.to() = f; + + } else { + std::printf("Invalid value for: %s must be between %.4f and %.4f\n", name, static_cast(min), + static_cast(max)); + rv = -1; + } + + } else if (resp.value.is(uavcan::protocol::param::Value::Tag::boolean_value)) { + int8_t i = (value[0] == '1' || value[0] == 't') ? 1 : 0; + req.value.to() = i; + + } else if (resp.value.is(uavcan::protocol::param::Value::Tag::string_value)) { + req.value.to() = value; + } + + if (rv == 0) { + rv = get_set_param(remote_node_id, name, req); + + if (rv < 0 || resp.name.empty()) { + std::printf("Failed to set param: %s\n", name); + return -1; + } + + return 0; + } + } + + free_setget_response(); + return rv; +} + +int UavcanNode::get_param(int remote_node_id, const char *name) +{ + uavcan::protocol::param::GetSet::Request req; + uavcan::protocol::param::GetSet::Response resp; + set_setget_response(&resp); + int rv = get_set_param(remote_node_id, name, req); + + if (rv < 0 || resp.name.empty()) { + std::printf("Failed to get param: %s\n", name); + rv = -1; + + } else { + print_params(resp); + rv = 0; + } + + free_setget_response(); + return rv; +} + int UavcanNode::start_fw_server() { int rv = -1; @@ -517,24 +753,24 @@ int UavcanNode::run() memset(&_outputs, 0, sizeof(_outputs)); - /* - * Set up the time synchronization - */ + /* + * Set up the time synchronization + */ - const int slave_init_res = _time_sync_slave.start(); - if (slave_init_res < 0) - { - warnx("Failed to start time_sync_slave"); - _task_should_exit = true; - } + const int slave_init_res = _time_sync_slave.start(); - /* When we have a system wide notion of time update (i.e the transition from the initial - * System RTC setting to the GPS) we would call uavcan_stm32::clock::setUtc() when that - * happens, but for now we use adjustUtc with a correction of 0 - */ - uavcan_stm32::clock::adjustUtc(uavcan::UtcDuration::fromUSec(0)); - _master_timer.setCallback(TimerCallback(this, &UavcanNode::handle_time_sync)); - _master_timer.startPeriodic(uavcan::MonotonicDuration::fromMSec(1000)); + if (slave_init_res < 0) { + warnx("Failed to start time_sync_slave"); + _task_should_exit = true; + } + + /* When we have a system wide notion of time update (i.e the transition from the initial + * System RTC setting to the GPS) we would call uavcan_stm32::clock::setUtc() when that + * happens, but for now we use adjustUtc with a correction of 0 + */ + uavcan_stm32::clock::adjustUtc(uavcan::UtcDuration::fromUSec(0)); + _master_timer.setCallback(TimerCallback(this, &UavcanNode::handle_time_sync)); + _master_timer.startPeriodic(uavcan::MonotonicDuration::fromMSec(1000)); @@ -936,7 +1172,7 @@ UavcanNode::print_info() static void print_usage() { warnx("usage: \n" - "\tuavcan {start [fw]|status|stop [all|fw]|arm|disarm|update fw}"); + "\tuavcan {start [fw]|status|stop [all|fw]|arm|disarm|update fw|param [set|get|list|save] nodeid [name] [value]}"); } extern "C" __EXPORT int uavcan_main(int argc, char *argv[]); @@ -1022,6 +1258,60 @@ int uavcan_main(int argc, char *argv[]) ::exit(0); } + /* + * Parameter setting commands + * + * uavcan param list + * uavcan param save + * uavcan param get + * uavcan param set + * + */ + int node_arg = !std::strcmp(argv[1], "reset") ? 2 : 3; + + if (!std::strcmp(argv[1], "param") || node_arg == 2) { + if (argc < node_arg + 1) { + errx(1, "Node id required"); + } + + int nodeid = atoi(argv[node_arg]); + + if (nodeid == 0 || nodeid > 127 || nodeid == inst->get_node().getNodeID().get()) { + errx(1, "Invalid Node id"); + } + + if (node_arg == 2) { + + return inst->reset_node(nodeid); + + } else if (!std::strcmp(argv[2], "list")) { + + return inst->list_params(nodeid); + + } else if (!std::strcmp(argv[2], "save")) { + + return inst->save_params(nodeid); + + } else if (!std::strcmp(argv[2], "get")) { + if (argc < 5) { + errx(1, "Name required"); + } + + return inst->get_param(nodeid, argv[4]); + + } else if (!std::strcmp(argv[2], "set")) { + if (argc < 5) { + errx(1, "Name required"); + } + + if (argc < 6) { + errx(1, "Value required"); + } + + return inst->set_param(nodeid, argv[4], argv[5]); + } + } + if (!std::strcmp(argv[1], "stop")) { if (fw) { diff --git a/src/modules/uavcan/uavcan_main.hpp b/src/modules/uavcan/uavcan_main.hpp index 098d8ea55d..23e9c89417 100644 --- a/src/modules/uavcan/uavcan_main.hpp +++ b/src/modules/uavcan/uavcan_main.hpp @@ -38,6 +38,9 @@ #include #include #include +#include +#include +#include #include #include @@ -122,7 +125,11 @@ public: static int getHardwareVersion(uavcan::protocol::HardwareVersion &hwver); int fw_server(eServerAction action); void attachITxQueueInjector(ITxQueueInjector *injector) {_tx_injector = injector;} - + int list_params(int remote_node_id); + int save_params(int remote_node_id); + int set_param(int remote_node_id, const char *name, char *value); + int get_param(int remote_node_id, const char *name); + int reset_node(int remote_node_id); private: void fill_node_info(); @@ -133,6 +140,16 @@ private: int start_fw_server(); int stop_fw_server(); int request_fw_check(); + int print_params(uavcan::protocol::param::GetSet::Response &resp); + int get_set_param(int nodeid, const char *name, uavcan::protocol::param::GetSet::Request &req); + void set_setget_response(uavcan::protocol::param::GetSet::Response *resp) + { + _setget_response = resp; + } + void free_setget_response(void) + { + _setget_response = nullptr; + } int _task = -1; ///< handle to the OS task bool _task_should_exit = false; ///< flag to indicate to tear down the CAN driver @@ -187,4 +204,16 @@ private: typedef uavcan::MethodBinder TimerCallback; uavcan::TimerEventForwarder _master_timer; + bool _callback_success; + uavcan::protocol::param::GetSet::Response *_setget_response; + typedef uavcan::MethodBinder &)> GetSetCallback; + typedef uavcan::MethodBinder &)> ExecuteOpcodeCallback; + typedef uavcan::MethodBinder &)> RestartNodeCallback; + void cb_setget(const uavcan::ServiceCallResult &result); + void cb_opcode(const uavcan::ServiceCallResult &result); + void cb_restart(const uavcan::ServiceCallResult &result); + }; From 2a36067cc7bf90d96ca78fec0dfeffd62eb9be66 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 23 Sep 2015 04:18:40 -1000 Subject: [PATCH 230/389] Added reset to usage --- src/modules/uavcan/uavcan_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index 96fca21ff1..b12f9e0211 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -1172,7 +1172,7 @@ UavcanNode::print_info() static void print_usage() { warnx("usage: \n" - "\tuavcan {start [fw]|status|stop [all|fw]|arm|disarm|update fw|param [set|get|list|save] nodeid [name] [value]}"); + "\tuavcan {start [fw]|status|stop [all|fw]|arm|disarm|update fw|param [set|get|list|save] nodeid [name] [value]|reset nodeid}"); } extern "C" __EXPORT int uavcan_main(int argc, char *argv[]); From 8eaf213eddd3025133d8ba6471324c14a2f956a5 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 23 Sep 2015 05:32:14 -1000 Subject: [PATCH 231/389] Update uavcan_main.cpp --- src/modules/uavcan/uavcan_main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index b12f9e0211..4b782eb404 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -766,9 +766,10 @@ int UavcanNode::run() /* When we have a system wide notion of time update (i.e the transition from the initial * System RTC setting to the GPS) we would call uavcan_stm32::clock::setUtc() when that - * happens, but for now we use adjustUtc with a correction of 0 + * happens, but for now we use adjustUtc with a correction of the hrt so that the + * time bases are the same */ - uavcan_stm32::clock::adjustUtc(uavcan::UtcDuration::fromUSec(0)); + uavcan_stm32::clock::adjustUtc(uavcan::UtcDuration::fromUSec(hrt_absolute_time())); _master_timer.setCallback(TimerCallback(this, &UavcanNode::handle_time_sync)); _master_timer.startPeriodic(uavcan::MonotonicDuration::fromMSec(1000)); From 996a6ee437e0a17ca6021efc96b5c45b008579d8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 23 Sep 2015 18:36:29 +0200 Subject: [PATCH 232/389] Commander: Do not lock in user on a single boot assignment failure --- src/modules/commander/commander.cpp | 4 ++-- src/modules/commander/state_machine_helper.cpp | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 250a92cfb4..c9d5259f33 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1930,9 +1930,9 @@ int commander_thread_main(int argc, char *argv[]) if (arming_ret == TRANSITION_CHANGED) { arming_state_changed = true; + } else { + print_reject_arm("NOT ARMING: Configuration error"); } - } else { - print_reject_arm("NOT ARMING: Configuration error"); } stick_on_counter = 0; diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index 2f3da424c6..c9c09ac300 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -93,6 +93,8 @@ static const char * const state_names[vehicle_status_s::ARMING_STATE_MAX] = { "ARMING_STATE_IN_AIR_RESTORE", }; +static bool sensor_feedback_provided = false; + transition_result_t arming_state_transition(struct vehicle_status_s *status, ///< current vehicle status const struct safety_s *safety, ///< current safety settings @@ -241,10 +243,12 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s (new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY) && (status->arming_state != vehicle_status_s::ARMING_STATE_STANDBY_ERROR) && (!status->condition_system_sensors_initialized)) { - mavlink_and_console_log_critical(mavlink_fd, "Not ready to fly: Sensors need inspection"); + if (!sensor_feedback_provided) { + mavlink_and_console_log_critical(mavlink_fd, "Not ready to fly: Sensors need inspection"); + sensor_feedback_provided = true; + } feedback_provided = true; valid_transition = false; - status->arming_state = vehicle_status_s::ARMING_STATE_STANDBY_ERROR; } // Finish up the state transition @@ -255,6 +259,11 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s status->arming_state = new_arming_state; } + /* reset feedback state */ + if (status->arming_state != vehicle_status_s::ARMING_STATE_STANDBY_ERROR) { + sensor_feedback_provided = false; + } + /* end of atomic state update */ #ifdef __PX4_NUTTX irqrestore(flags); From 27412ef2a28c54d343e10ec845fc4f9a2663fe26 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 23 Sep 2015 19:24:48 +0200 Subject: [PATCH 233/389] Update README to include Snapdragon Flight --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1abab0df13..7cb07907ff 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This repository contains the PX4 Flight Core, with the main applications located * [Downloads](http://px4.io/firmware/downloads) * Releases * [Downloads](https://github.com/PX4/Firmware/releases) -* Mailing list: [Google Groups](http://groups.google.com/group/px4users) +* Forum / Mailing list: [Google Groups](http://groups.google.com/group/px4users) ### Users ### @@ -29,7 +29,7 @@ Contributing guide: * [PX4 Contribution Guide](http://px4.io/dev/contributing) Software in the Loop guide: -Use software in the loop [to get started with the codebase](https://github.com/PX4/Firmware/tree/master/posix-configs/SITL) +Use software in the loop [to get started with the codebase](https://pixhawk.org/dev/simulation/native_sitl). Developer guide: http://px4.io/dev/ @@ -38,8 +38,10 @@ Testing guide: http://px4.io/dev/unit_tests This repository contains code supporting these boards: + * [Snapdragon Flight](https://www.intrinsyc.com/qualcomm-snapdragon-flight/) * FMUv1.x - * FMUv2.x + * FMUv2.x (Pixhawk) + * FMUv3.x (Pixhawk 2) * AeroCore (v1 and v2) * STM32F4Discovery (basic support) [Tutorial](https://pixhawk.org/modules/stm32f4discovery) From a5ad7641e31d76e14d55f541caf622a729c58e4b Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 23 Sep 2015 08:17:16 -1000 Subject: [PATCH 234/389] Updated Submodule NuttX with group delete fix and cstdlib fixes ==master --- NuttX | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuttX b/NuttX index aa15c32058..3009fb230e 160000 --- a/NuttX +++ b/NuttX @@ -1 +1 @@ -Subproject commit aa15c32058acbda4cc2ee51e97d31e9e49225193 +Subproject commit 3009fb230ec8232c4c4fd7798fd70ea9632692ec From 05a08252ff3f29b5ac684e97531a26a09e1310a9 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 23 Sep 2015 06:17:14 -1000 Subject: [PATCH 235/389] Bugfix:pthread_create retuns 0 on success and positive error on error without errono set --- src/modules/uavcan/uavcan_servers.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/uavcan/uavcan_servers.cpp b/src/modules/uavcan/uavcan_servers.cpp index 52f0ce9697..824b5182e2 100644 --- a/src/modules/uavcan/uavcan_servers.cpp +++ b/src/modules/uavcan/uavcan_servers.cpp @@ -98,6 +98,7 @@ UavcanServers::~UavcanServers() if (_mutex_inited) { (void)Lock::deinit(_subnode_mutex); } + _main_node.getDispatcher().removeRxFrameListener(); } @@ -164,9 +165,9 @@ int UavcanServers::start(uavcan::INode &main_node) rv = pthread_create(&_instance->_subnode_thread, &tattr, static_cast(run_trampoline), NULL); - if (rv < 0) { - warnx("pthread_create() failed: %d", errno); - rv = -errno; + if (rv != 0) { + rv = -rv; + warnx("pthread_create() failed: %d", rv); delete _instance; _instance = nullptr; } From d7fc0ee53cce11a6cf9af660fe86c550b6808ce8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 23 Sep 2015 22:42:36 +0200 Subject: [PATCH 236/389] Launch detection: Fix print statement --- src/lib/launchdetection/CatapultLaunchMethod.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/launchdetection/CatapultLaunchMethod.cpp b/src/lib/launchdetection/CatapultLaunchMethod.cpp index d514d895f4..63efe81f3c 100644 --- a/src/lib/launchdetection/CatapultLaunchMethod.cpp +++ b/src/lib/launchdetection/CatapultLaunchMethod.cpp @@ -78,13 +78,13 @@ void CatapultLaunchMethod::update(float accel_x) if (integrator > thresholdTime.get()) { if (motorDelay.get() > 0.0f) { state = LAUNCHDETECTION_RES_DETECTED_ENABLECONTROL; - warnx("Launch detected: state: enablecontrol, waiting %.2fs until using full" - " throttle", (double)motorDelay.get()); + warnx("Launch detected: enablecontrol, waiting %8.4fs until full throttle", + (double)(motorDelay.get()); } else { /* No motor delay set: go directly to enablemotors state */ state = LAUNCHDETECTION_RES_DETECTED_ENABLEMOTORS; - warnx("Launch detected: state: enablemotors (delay not activated)"); + warnx("Launch detected: enablemotors (delay not activated)"); } } From b07e02527db110c057b0a4d4eba3f65220eed476 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 15:59:47 -0400 Subject: [PATCH 237/389] Fixed catapult launch build error. --- src/lib/launchdetection/CatapultLaunchMethod.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/launchdetection/CatapultLaunchMethod.cpp b/src/lib/launchdetection/CatapultLaunchMethod.cpp index 63efe81f3c..35d8b00c42 100644 --- a/src/lib/launchdetection/CatapultLaunchMethod.cpp +++ b/src/lib/launchdetection/CatapultLaunchMethod.cpp @@ -79,7 +79,7 @@ void CatapultLaunchMethod::update(float accel_x) if (motorDelay.get() > 0.0f) { state = LAUNCHDETECTION_RES_DETECTED_ENABLECONTROL; warnx("Launch detected: enablecontrol, waiting %8.4fs until full throttle", - (double)(motorDelay.get()); + (double)(motorDelay.get())); } else { /* No motor delay set: go directly to enablemotors state */ From fa69a4f1e07cbf8edfffca62140714a5e83f524c Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 16:00:16 -0400 Subject: [PATCH 238/389] Fixed debug script for cmake. --- src/firmware/nuttx/gdbinit.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firmware/nuttx/gdbinit.in b/src/firmware/nuttx/gdbinit.in index 2cb3727170..e820673b21 100644 --- a/src/firmware/nuttx/gdbinit.in +++ b/src/firmware/nuttx/gdbinit.in @@ -1,5 +1,5 @@ target extended ${DEBUG_PORT} -#monitor swdp_scan +monitor swdp_scan attach 1 monitor vector_catch disable hard set mem inaccessible-by-default off From ebbe322dba5c790fee5dfdba457e839632bc3d29 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 16:16:49 -0400 Subject: [PATCH 239/389] Attempt to fix odd travis sitl build error. --- src/lib/launchdetection/CatapultLaunchMethod.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/launchdetection/CatapultLaunchMethod.cpp b/src/lib/launchdetection/CatapultLaunchMethod.cpp index 35d8b00c42..f13c7c4bfe 100644 --- a/src/lib/launchdetection/CatapultLaunchMethod.cpp +++ b/src/lib/launchdetection/CatapultLaunchMethod.cpp @@ -79,7 +79,7 @@ void CatapultLaunchMethod::update(float accel_x) if (motorDelay.get() > 0.0f) { state = LAUNCHDETECTION_RES_DETECTED_ENABLECONTROL; warnx("Launch detected: enablecontrol, waiting %8.4fs until full throttle", - (double)(motorDelay.get())); + double(motorDelay.get())); } else { /* No motor delay set: go directly to enablemotors state */ From 85cccbf9be5cb9f1834e4167701c10744e46fcce Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 16:21:27 -0400 Subject: [PATCH 240/389] Attempt 2 to fix posix sitl build for travis. --- src/lib/launchdetection/CatapultLaunchMethod.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/launchdetection/CatapultLaunchMethod.cpp b/src/lib/launchdetection/CatapultLaunchMethod.cpp index f13c7c4bfe..273da3ee76 100644 --- a/src/lib/launchdetection/CatapultLaunchMethod.cpp +++ b/src/lib/launchdetection/CatapultLaunchMethod.cpp @@ -41,6 +41,7 @@ #include "CatapultLaunchMethod.h" #include +#include namespace launchdetection { From b6d8fe3f0184a8594117a8a1f42af75b290b7c22 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 16:27:09 -0400 Subject: [PATCH 241/389] Another fix for travis sitl build. --- src/platforms/posix/drivers/gpssim/gpssim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/posix/drivers/gpssim/gpssim.cpp b/src/platforms/posix/drivers/gpssim/gpssim.cpp index 9108a6f228..3115ecb63e 100644 --- a/src/platforms/posix/drivers/gpssim/gpssim.cpp +++ b/src/platforms/posix/drivers/gpssim/gpssim.cpp @@ -37,7 +37,7 @@ */ #include -#include +#include #include #include #include From 2908a377cfd451050ecaadef4b5768b5baeffd8d Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 16:43:57 -0400 Subject: [PATCH 242/389] Found stc macro def issue for sitl build on travis. --- src/lib/launchdetection/CatapultLaunchMethod.cpp | 1 + src/platforms/posix/drivers/gpssim/gpssim.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/lib/launchdetection/CatapultLaunchMethod.cpp b/src/lib/launchdetection/CatapultLaunchMethod.cpp index 273da3ee76..8a0e8a3bb3 100644 --- a/src/lib/launchdetection/CatapultLaunchMethod.cpp +++ b/src/lib/launchdetection/CatapultLaunchMethod.cpp @@ -41,6 +41,7 @@ #include "CatapultLaunchMethod.h" #include +#define __STDC_FORMAT_MACROS 1 #include namespace launchdetection diff --git a/src/platforms/posix/drivers/gpssim/gpssim.cpp b/src/platforms/posix/drivers/gpssim/gpssim.cpp index 3115ecb63e..d94fc35f8a 100644 --- a/src/platforms/posix/drivers/gpssim/gpssim.cpp +++ b/src/platforms/posix/drivers/gpssim/gpssim.cpp @@ -37,6 +37,7 @@ */ #include +#define __STDC_FORMAT_MACROS #include #include #include From 3bf06d242f6a5fa3ba28780f6dc93e7299ae4b5c Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 16:45:18 -0400 Subject: [PATCH 243/389] Fix def for stdc format macros to match existing code. --- src/lib/launchdetection/CatapultLaunchMethod.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/launchdetection/CatapultLaunchMethod.cpp b/src/lib/launchdetection/CatapultLaunchMethod.cpp index 8a0e8a3bb3..6f233d52ad 100644 --- a/src/lib/launchdetection/CatapultLaunchMethod.cpp +++ b/src/lib/launchdetection/CatapultLaunchMethod.cpp @@ -41,7 +41,7 @@ #include "CatapultLaunchMethod.h" #include -#define __STDC_FORMAT_MACROS 1 +#define __STDC_FORMAT_MACROS #include namespace launchdetection From ed876b95c3a149e78f4c3b8d68fd88d0e38297ba Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 16:54:45 -0400 Subject: [PATCH 244/389] Added stdc_format_macros to err. --- src/modules/systemlib/err.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/systemlib/err.c b/src/modules/systemlib/err.c index 0011bca206..b7b6f0a9c3 100644 --- a/src/modules/systemlib/err.c +++ b/src/modules/systemlib/err.c @@ -40,6 +40,9 @@ #include +#define __STDC_FORMAT_MACROS +#include + #include #include #include From 6cdb373abbb3ca0a6d35ad86d2585313cac60148 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 16:56:35 -0400 Subject: [PATCH 245/389] Removed extra define from catapult launch. --- src/lib/launchdetection/CatapultLaunchMethod.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib/launchdetection/CatapultLaunchMethod.cpp b/src/lib/launchdetection/CatapultLaunchMethod.cpp index 6f233d52ad..f13c7c4bfe 100644 --- a/src/lib/launchdetection/CatapultLaunchMethod.cpp +++ b/src/lib/launchdetection/CatapultLaunchMethod.cpp @@ -41,8 +41,6 @@ #include "CatapultLaunchMethod.h" #include -#define __STDC_FORMAT_MACROS -#include namespace launchdetection { From 2a60ffd554bc31db2dd92bac4753ffdf140b2b90 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Thu, 24 Sep 2015 17:44:27 -0400 Subject: [PATCH 246/389] Added stdc_format_macros for all inttypes.h includes. --- src/drivers/drv_hrt.h | 1 + src/drivers/px4flow/i2c_frame.h | 3 ++- src/modules/controllib/block/Block.hpp | 1 + src/modules/px4iofirmware/protocol.h | 1 + src/modules/systemlib/uthash/uthash.h | 1 + src/platforms/posix/px4_layer/drv_hrt.c | 1 + src/platforms/px4_nodehandle.h | 1 + src/systemcmds/tests/test_int.c | 1 - 8 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/drivers/drv_hrt.h b/src/drivers/drv_hrt.h index a40943d3f2..a0bc87cf0b 100644 --- a/src/drivers/drv_hrt.h +++ b/src/drivers/drv_hrt.h @@ -41,6 +41,7 @@ #include #include +#define __STDC_FORMAT_MACROS #include #include diff --git a/src/drivers/px4flow/i2c_frame.h b/src/drivers/px4flow/i2c_frame.h index b391b1f6a8..a682c5f3de 100644 --- a/src/drivers/px4flow/i2c_frame.h +++ b/src/drivers/px4flow/i2c_frame.h @@ -40,8 +40,9 @@ #ifndef I2C_FRAME_H_ #define I2C_FRAME_H_ -#include +#define __STDC_FORMAT_MACROS 1 +#include typedef struct i2c_frame { diff --git a/src/modules/controllib/block/Block.hpp b/src/modules/controllib/block/Block.hpp index d169d35c5f..bb2a0e2657 100644 --- a/src/modules/controllib/block/Block.hpp +++ b/src/modules/controllib/block/Block.hpp @@ -39,6 +39,7 @@ #pragma once +#define __STDC_FORMAT_MACROS #include #include diff --git a/src/modules/px4iofirmware/protocol.h b/src/modules/px4iofirmware/protocol.h index 64ba0f93c4..673da0e44d 100644 --- a/src/modules/px4iofirmware/protocol.h +++ b/src/modules/px4iofirmware/protocol.h @@ -33,6 +33,7 @@ #pragma once +#define __STDC_FORMAT_MACROS #include /** diff --git a/src/modules/systemlib/uthash/uthash.h b/src/modules/systemlib/uthash/uthash.h index 9f83fc34f1..a8642833f6 100644 --- a/src/modules/systemlib/uthash/uthash.h +++ b/src/modules/systemlib/uthash/uthash.h @@ -61,6 +61,7 @@ do { typedef unsigned int uint32_t; typedef unsigned char uint8_t; #else +#define __STDC_FORMAT_MACROS #include /* uint32_t */ #endif diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/src/platforms/posix/px4_layer/drv_hrt.c index 6456008daa..10792b3089 100644 --- a/src/platforms/posix/px4_layer/drv_hrt.c +++ b/src/platforms/posix/px4_layer/drv_hrt.c @@ -43,6 +43,7 @@ #include #include #include +#define __STDC_FORMAT_MACROS #include #include #include "hrt_work.h" diff --git a/src/platforms/px4_nodehandle.h b/src/platforms/px4_nodehandle.h index b0deef16c1..497f3be04c 100644 --- a/src/platforms/px4_nodehandle.h +++ b/src/platforms/px4_nodehandle.h @@ -48,6 +48,7 @@ /* includes when building for ros */ #include "ros/ros.h" #include +#define __STDC_FORMAT_MACROS #include #include #else diff --git a/src/systemcmds/tests/test_int.c b/src/systemcmds/tests/test_int.c index 051a48e6c2..01092aa2d4 100644 --- a/src/systemcmds/tests/test_int.c +++ b/src/systemcmds/tests/test_int.c @@ -57,7 +57,6 @@ #include #include -#include /**************************************************************************** From 1abd61303f14f995b1dead7edc2fa05dc245f855 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Tue, 15 Sep 2015 12:22:58 -0700 Subject: [PATCH 247/389] qurt: Added patch for Eigen to use latest version Updated to 7.2 Hexagon toolchain Fixed issuse with stack usage Signed-off-by: Mark Charlebois --- CMakeLists.txt | 1 - cmake/common/px4_base.cmake | 13 +- cmake/configs/qurt_eagle_hello.cmake | 2 +- cmake/configs/qurt_eagle_hil.cmake | 2 +- cmake/configs/qurt_eagle_muorb.cmake | 2 +- cmake/configs/qurt_eagle_release.cmake | 2 +- cmake/configs/qurt_eagle_test.cmake | 2 +- cmake/configs/qurt_eagle_travis.cmake | 2 +- cmake/qurt/px4_impl_qurt.cmake | 14 +- cmake/qurt/qurt_eigen.patch | 50 ++-- cmake/toolchains/Toolchain-hexagon-7.2.cmake | 241 ++++++++++++++++++ src/firmware/qurt/CMakeLists.txt | 5 - .../ekf_att_pos_estimator/CMakeLists.txt | 11 +- .../position_estimator_inav/CMakeLists.txt | 7 +- src/systemcmds/mixer/CMakeLists.txt | 11 +- 15 files changed, 317 insertions(+), 48 deletions(-) create mode 100644 cmake/toolchains/Toolchain-hexagon-7.2.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 918e5bd875..351a0f6c36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,7 +219,6 @@ px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") px4_add_git_submodule(TARGET git_uavcan PATH "src/lib/uavcan") px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") -px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") add_custom_target(submodule_clean diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 54ab915bfd..2ed2382db4 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -486,7 +486,6 @@ function(px4_add_common_flags) -Wextra #-Wshadow # very verbose due to eigen -Wfloat-equal - -Wframe-larger-than=1024 -Wpointer-arith -Wmissing-declarations -Wpacked @@ -506,6 +505,10 @@ function(px4_add_common_flags) # but generates too many false positives ) + if (NOT ${OS} STREQUAL "qurt") + list(APPEND warnings -Wframe-larger-than=1024) + endif() + if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang") list(APPEND warnings -Wno-unused-const-variable @@ -609,11 +612,9 @@ function(px4_add_common_flags) ${CMAKE_SOURCE_DIR}/mavlink/include/mavlink ) - if (NOT ${OS} STREQUAL "qurt") - list(APPEND added_include_dirs - ${CMAKE_SOURCE_DIR}/src/lib/eigen - ) - endif() + list(APPEND added_include_dirs + src/lib/eigen + ) set(added_link_dirs) # none used currently diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index 45ae2b22ed..d7dd2a0598 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake index bab551262d..4b9f87d56c 100644 --- a/cmake/configs/qurt_eagle_hil.cmake +++ b/cmake/configs/qurt_eagle_hil.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake index afdc35dad5..77a94fd722 100644 --- a/cmake/configs/qurt_eagle_muorb.cmake +++ b/cmake/configs/qurt_eagle_muorb.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_release.cmake b/cmake/configs/qurt_eagle_release.cmake index 0b03dcea48..a6b3045835 100644 --- a/cmake/configs/qurt_eagle_release.cmake +++ b/cmake/configs/qurt_eagle_release.cmake @@ -20,7 +20,7 @@ set(target_libraries ) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) set(config_module_list # diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index 5e9cffc407..5e27fb7fa1 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index 15593df251..70184a976a 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -3,7 +3,7 @@ include(qurt/px4_impl_qurt) # Run a full link with build stubs to make sure qurt target isn't broken set(QURT_ENABLE_STUBS "1") -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) set(config_module_list drivers/device diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index d565210dfd..6f15a640f3 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -167,7 +167,6 @@ function(px4_os_add_flags) ${DSPAL_ROOT}/uart_esc/inc src/platforms/qurt/include src/platforms/posix/include - src/lib/eigen-3.2 ) set(added_definitions @@ -223,11 +222,14 @@ function(px4_os_prebuild_targets) ONE_VALUE OUT BOARD THREADS REQUIRED OUT BOARD ARGN ${ARGN}) - add_custom_target(${OUT} DEPENDS git_dspal git_eigen32) - add_custom_target(ALL DEPENDS git_eigen32) - execute_process( - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/eigen-3.2 - COMMAND patch -p1 -i ../../../cmake/qurt/qurt_eigen.patch) + add_custom_target(git_eigen_patched + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/eigen + COMMAND git checkout . + COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/cmake/qurt/qurt_eigen.patch + DEPENDS git_eigen) + add_custom_target(${OUT} DEPENDS git_dspal git_eigen_patched) + add_custom_target(ALL DEPENDS git_eigen) + endfunction() # vim: set noet fenc=utf-8 ff=unix nowrap: diff --git a/cmake/qurt/qurt_eigen.patch b/cmake/qurt/qurt_eigen.patch index 9ea57403ba..3b3e76d6ad 100644 --- a/cmake/qurt/qurt_eigen.patch +++ b/cmake/qurt/qurt_eigen.patch @@ -1,17 +1,37 @@ -This patch is required for QuRT. complex.h defines "I" and it replaces "I" in the -enum definition without this patch creating an error. - -diff --git a/Eigen/src/Core/SolveTriangular.h b/Eigen/src/Core/SolveTriangular.h -index ef17f28..1116270 100644 ---- a/Eigen/src/Core/SolveTriangular.h -+++ b/Eigen/src/Core/SolveTriangular.h -@@ -112,6 +112,9 @@ template - struct triangular_solver_unroller; +diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h +index 1ca1d66..9bc928b 100644 +--- a/Eigen/src/Core/util/Macros.h ++++ b/Eigen/src/Core/util/Macros.h +@@ -194,6 +194,12 @@ + #define EIGEN_ARCH_PPC 0 + #endif -+#ifdef __PX4_QURT -+#undef I ++/// \internal EIGEN_ARCH_HEXAGON set to 1 if the architecture is Hexagon ++#ifdef __HEXAGON_ARCH__ ++ #define EIGEN_ARCH_HEXAGON 1 ++#else ++ #define EIGEN_ARCH_HEXAGON 0 +#endif - template - struct triangular_solver_unroller { - enum { + + + // Operating system identification, EIGEN_OS_* +@@ -334,15 +340,16 @@ + #endif + + // Do we support r-value references? +-#if (__has_feature(cxx_rvalue_references) || \ ++#if ((__has_feature(cxx_rvalue_references) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) || \ + defined(__GXX_EXPERIMENTAL_CXX0X__) || \ +- (EIGEN_COMP_MSVC >= 1600)) ++ (EIGEN_COMP_MSVC >= 1600)) && (!defined(EIGEN_ARCH_HEXAGON))) + #define EIGEN_HAVE_RVALUE_REFERENCES + #endif + + // Does the compiler support result_of? +-#if (__has_feature(cxx_lambdas) || (defined(__cplusplus) && __cplusplus >= 201103L)) ++#if ((__has_feature(cxx_lambdas) || (defined(__cplusplus) && __cplusplus >= 201103L)) && \ ++ (!defined(EIGEN_ARCH_HEXAGON))) + #define EIGEN_HAS_STD_RESULT_OF 1 + #endif + diff --git a/cmake/toolchains/Toolchain-hexagon-7.2.cmake b/cmake/toolchains/Toolchain-hexagon-7.2.cmake new file mode 100644 index 0000000000..9cbc23bb24 --- /dev/null +++ b/cmake/toolchains/Toolchain-hexagon-7.2.cmake @@ -0,0 +1,241 @@ +# +# Copyright (C) 2015 Mark Charlebois. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +include(CMakeForceCompiler) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +include(common/px4_base) + +if(NOT HEXAGON_TOOLS_ROOT) + set(HEXAGON_TOOLS_ROOT /opt/7.2.09/Tools) +endif() + +macro (list2string out in) + set(list ${ARGV}) + list(REMOVE_ITEM list ${out}) + foreach(item ${list}) + set(${out} "${${out}} ${item}") + endforeach() +endmacro(list2string) + +set(V_ARCH "v5") +set(CROSSDEV "hexagon-") +set(HEXAGON_BIN ${HEXAGON_TOOLS_ROOT}/bin) +set(HEXAGON_LIB_DIR ${HEXAGON_TOOLS_ROOT}/gnu/hexagon/lib) +set(HEXAGON_ISS_DIR ${HEXAGON_TOOLS_ROOT}/lib/iss) +set(TOOLSLIB ${HEXAGON_TOOLS_ROOT}/target/hexagon/lib/${V_ARCH}/G0) + +# Use the HexagonTools compiler (6.4.05) +set(CMAKE_C_COMPILER ${HEXAGON_BIN}/${CROSSDEV}clang) +set(CMAKE_CXX_COMPILER ${HEXAGON_BIN}/${CROSSDEV}clang++) + +set(CMAKE_AR ${HEXAGON_BIN}/${CROSSDEV}ar CACHE FILEPATH "Archiver") +set(CMAKE_RANLIB ${HEXAGON_BIN}/${CROSSDEV}ranlib) +set(CMAKE_LINKER ${HEXAGON_BIN}/${CROSSDEV}ld.qcld) +set(CMAKE_NM ${HEXAGON_BIN}/${CROSSDEV}nm) +set(CMAKE_OBJDUMP ${HEXAGON_BIN}/${CROSSDEV}objdump) +set(CMAKE_OBJCOPY ${HEXAGON_BIN}/${CROSSDEV}objcopy) + +list2string(HEXAGON_INCLUDE_DIRS + -I${HEXAGON_TOOLS_ROOT}/target/hexagon/include + ) + +#set(DYNAMIC_LIBS -Wl,${TOOLSLIB}/pic/libstdc++.a) + +#set(MAXOPTIMIZATION -O0) + +# Base CPU flags for each of the supported architectures. +# +set(ARCHCPUFLAGS + -m${V_ARCH} + -G0 + ) + +add_definitions( + -D_PID_T -D_UID_T -D_TIMER_T + -Dnoreturn_function= + -D__EXPORT= + -Drestrict= + -D_DEBUG + -Wno-error=shadow + ) + +# optimisation flags +# +set(ARCHOPTIMIZATION + -O0 + -g + -fno-strict-aliasing + -fdata-sections + -fpic + -fno-zero-initialized-in-bss + ) + +# Language-specific flags +# +set(ARCHCFLAGS + -std=gnu99 + -D__CUSTOM_FILE_IO__ + ) +set(ARCHCXXFLAGS + -fno-exceptions + -fno-rtti +# -std=c++11 + -fno-threadsafe-statics + -DCONFIG_WCHAR_BUILTIN + -D__CUSTOM_FILE_IO__ + ) + +set(ARCHWARNINGS + -Wall + -Wextra + -Werror + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-gnu-array-member-paren-init + -Wno-cast-align + -Wno-missing-braces + -Wno-strict-aliasing +# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+ +# -Wcast-qual - generates spurious noreturn attribute warnings, try again later +# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code +# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives + ) + +# C-specific warnings +# +set(ARCHCWARNINGS + ${ARCHWARNINGS} + -Wstrict-prototypes + -Wnested-externs + ) + +# C++-specific warnings +# +set(ARCHWARNINGSXX + ${ARCHWARNINGS} + -Wno-missing-field-initializers + ) +exec_program(${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ARGS -print-libgcc-file-name OUTPUT_VARIABLE LIBGCC) +exec_program(${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ARGS -print-file-name=libm.a OUTPUT_VARIABLE LIBM) +set(EXTRA_LIBS ${EXTRA_LIBS} ${LIBM}) + +# Flags we pass to the C compiler +# +list2string(CFLAGS + ${ARCHCFLAGS} + ${ARCHCWARNINGS} + ${ARCHOPTIMIZATION} + ${ARCHCPUFLAGS} + ${ARCHINCLUDES} + ${INSTRUMENTATIONDEFINES} + ${ARCHDEFINES} + ${EXTRADEFINES} + ${EXTRACFLAGS} + ${HEXAGON_INCLUDE_DIRS} + ) + +# Flags we pass to the C++ compiler +# +list2string(CXXFLAGS + ${ARCHCXXFLAGS} + ${ARCHWARNINGSXX} + ${ARCHOPTIMIZATION} + ${ARCHCPUFLAGS} + ${ARCHXXINCLUDES} + ${INSTRUMENTATIONDEFINES} + ${ARCHDEFINES} + ${EXTRADEFINES} + ${EXTRACXXFLAGS} + ${HEXAGON_INCLUDE_DIRS} + ) + +# Flags we pass to the assembler +# +list2string(AFLAGS + ${CFLAGS} + -D__ASSEMBLY__ + ${EXTRADEFINES} + ${EXTRAAFLAGS} + ) + +# Set cmake flags +# +list2string(CMAKE_C_FLAGS + ${CMAKE_C_FLAGS} + ${CFLAGS} + ) + +set(QURT_CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "cflags") + +message(STATUS "CMAKE_C_FLAGS: -${CMAKE_C_FLAGS}-") + +list2string(CMAKE_CXX_FLAGS + ${CMAKE_CXX_FLAGS} + ${CXXFLAGS} + ) + +set(QURT_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "cxxflags") + +message(STATUS "CMAKE_CXX_FLAGS: -${CMAKE_CXX_FLAGS}-") + +# Flags we pass to the linker +# +list2string(CMAKE_EXE_LINKER_FLAGS + -g + -mv5 + -mG0lib + -lhexagon + -G0 + -fpic + -Wl,-Bsymbolic + -Wl,--wrap=malloc + -Wl,--wrap=calloc + -Wl,--wrap=free + -Wl,--wrap=realloc + -Wl,--wrap=memalign + -Wl,--wrap=__stack_chk_fail + -lc + ${EXTRALDFLAGS} + ) + +# where is the target environment +set(CMAKE_FIND_ROOT_PATH get_file_component(${C_COMPILER} PATH)) + +set(CMAKE_C_COMPILER_ID, "Clang") +set(CMAKE_CXX_COMPILER_ID, "Clang") + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index 7f52c59e4c..3dc12c57f6 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -1,10 +1,5 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) -set(V_ARCH v5) -set(HEXAGON_TOOLS_ROOT /opt/6.4.03) -set(TOOLSLIB - ${HEXAGON_TOOLS_ROOT}/dinkumware/lib/${V_ARCH}/G0) - px4_qurt_generate_builtin_commands( OUT ${CMAKE_BINARY_DIR}/apps.h MODULE_LIST ${module_libraries}) diff --git a/src/modules/ekf_att_pos_estimator/CMakeLists.txt b/src/modules/ekf_att_pos_estimator/CMakeLists.txt index 9386cbf9fa..5a70282103 100644 --- a/src/modules/ekf_att_pos_estimator/CMakeLists.txt +++ b/src/modules/ekf_att_pos_estimator/CMakeLists.txt @@ -30,13 +30,16 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ + +set(MODULE_CFLAGS -Weffc++) +if(NOT ${OS} STREQUAL "qurt") + list(APPEND MODULE_CFLAGS -Wframe-larger-than=3400) +endif() + px4_add_module( MODULE modules__ekf_att_pos_estimator MAIN ekf_att_pos_estimator - COMPILE_FLAGS - -Weffc++ - -Wframe-larger-than=3400 - -O3 + COMPILE_FLAGS ${MODULE_CFLAGS} SRCS ekf_att_pos_estimator_main.cpp ekf_att_pos_estimator_params.c diff --git a/src/modules/position_estimator_inav/CMakeLists.txt b/src/modules/position_estimator_inav/CMakeLists.txt index 5ba3d7b64d..0e801603a8 100644 --- a/src/modules/position_estimator_inav/CMakeLists.txt +++ b/src/modules/position_estimator_inav/CMakeLists.txt @@ -30,12 +30,15 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +set(MODULE_CFLAGS) +if(NOT ${OS} STREQUAL "qurt") + list(APPEND MODULE_CFLAGS -Wframe-larger-than=3800) +endif() px4_add_module( MODULE modules__position_estimator_inav MAIN position_estimator_inav STACK 1200 - COMPILE_FLAGS - -Wframe-larger-than=3800 + COMPILE_FLAGS ${MODULE_CFLAGS} SRCS position_estimator_inav_main.c diff --git a/src/systemcmds/mixer/CMakeLists.txt b/src/systemcmds/mixer/CMakeLists.txt index c49433c864..dd051b2772 100644 --- a/src/systemcmds/mixer/CMakeLists.txt +++ b/src/systemcmds/mixer/CMakeLists.txt @@ -30,13 +30,18 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +set(MIXER_CFLAGS -Os) +if(${OS} STREQUAL "qurt") + list(APPEND MIXER_CFLAGS -Wframe-larger-than=2176) +else() + list(APPEND MIXER_CFLAGS -Wframe-larger-than=2048) +endif() + px4_add_module( MODULE systemcmds__mixer MAIN mixer STACK 4096 - COMPILE_FLAGS - -Wframe-larger-than=2048 - -Os + COMPILE_FLAGS ${MIXER_CFLAGS} SRCS mixer.cpp DEPENDS From 300932bde34c8bceef159c75d71bd4ef9958ef14 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Mon, 21 Sep 2015 08:58:38 -0700 Subject: [PATCH 248/389] QuRT: fixes to unbreak cmake build for QuRT Updated DSPAL version. Fixed missing lib in config. Fixed heafers for missing timespec definition. Signed-off-by: Mark Charlebois --- cmake/common/px4_base.cmake | 9 ++++++--- cmake/configs/qurt_eagle_travis.cmake | 3 ++- src/drivers/drv_hrt.h | 2 +- src/lib/dspal | 2 +- src/modules/sensors/sensors.cpp | 4 ++-- src/platforms/posix/work_queue/hrt_thread.c | 1 + src/platforms/qurt/px4_layer/drv_hrt.c | 2 ++ 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 2ed2382db4..1de4dddb01 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -510,9 +510,12 @@ function(px4_add_common_flags) endif() if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang") - list(APPEND warnings - -Wno-unused-const-variable - ) + # QuRT 6.4.X compiler identifies as Clang but does not support this option + if (NOT ${OS} STREQUAL "qurt") + list(APPEND warnings + -Wno-unused-const-variable + ) + endif() else() list(APPEND warnings -Werror=unused-but-set-variable diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index 70184a976a..ec10d2a10c 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -41,6 +41,7 @@ set(config_module_list modules/systemlib/mixer modules/uORB modules/commander + modules/controllib # # Libraries @@ -50,7 +51,7 @@ set(config_module_list lib/geo lib/geo_lookup lib/conversion - modules/controllib + lib/ecl # # QuRT port diff --git a/src/drivers/drv_hrt.h b/src/drivers/drv_hrt.h index a0bc87cf0b..496e272d62 100644 --- a/src/drivers/drv_hrt.h +++ b/src/drivers/drv_hrt.h @@ -44,7 +44,7 @@ #define __STDC_FORMAT_MACROS #include -#include +#include #include __BEGIN_DECLS diff --git a/src/lib/dspal b/src/lib/dspal index 229f2f4d84..95e91546f4 160000 --- a/src/lib/dspal +++ b/src/lib/dspal @@ -1 +1 @@ -Subproject commit 229f2f4d8471564f01fe8330e5de1554a9b7aeb6 +Subproject commit 95e91546f42e6d88d34a2bb29d0f428a8706c9e4 diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index 86df382df8..5c2ec02be0 100644 --- a/src/modules/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -366,7 +366,7 @@ private: int init_sensor_class(const struct orb_metadata *meta, int *subs, - unsigned *priorities, unsigned *errcount); + uint32_t *priorities, uint32_t *errcount); /** * Update our local parameter cache. @@ -1949,7 +1949,7 @@ Sensors::task_main_trampoline(int argc, char *argv[]) int Sensors::init_sensor_class(const struct orb_metadata *meta, int *subs, - unsigned *priorities, unsigned *errcount) + uint32_t *priorities, uint32_t *errcount) { unsigned group_count = orb_group_count(meta); diff --git a/src/platforms/posix/work_queue/hrt_thread.c b/src/platforms/posix/work_queue/hrt_thread.c index ece3a72e79..efe09ea860 100644 --- a/src/platforms/posix/work_queue/hrt_thread.c +++ b/src/platforms/posix/work_queue/hrt_thread.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include diff --git a/src/platforms/qurt/px4_layer/drv_hrt.c b/src/platforms/qurt/px4_layer/drv_hrt.c index 45be19ec8a..b5d6bd20ff 100644 --- a/src/platforms/qurt/px4_layer/drv_hrt.c +++ b/src/platforms/qurt/px4_layer/drv_hrt.c @@ -37,10 +37,12 @@ * High-resolution timer with callouts and timekeeping. */ +#include #include #include #include #include +#include #include #include From 3f758490a4d2f0bb94fb69b8d133ef9f6c48d9f8 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Mon, 21 Sep 2015 14:20:21 -0700 Subject: [PATCH 249/389] QuRT: move to HexagonTools 7.4 toolchain Some subsystems error on frame size without the included patches. Signed-off-by: Mark Charlebois --- cmake/configs/qurt_eagle_hello.cmake | 2 +- cmake/configs/qurt_eagle_hil.cmake | 2 +- cmake/configs/qurt_eagle_muorb.cmake | 2 +- cmake/configs/qurt_eagle_release.cmake | 2 +- cmake/configs/qurt_eagle_test.cmake | 2 +- cmake/configs/qurt_eagle_travis.cmake | 2 +- ...ain-hexagon-7.2.cmake => Toolchain-hexagon-7.4.cmake} | 7 +++---- src/modules/attitude_estimator_q/CMakeLists.txt | 9 +++++++-- src/modules/commander/CMakeLists.txt | 9 +++++++-- 9 files changed, 23 insertions(+), 14 deletions(-) rename cmake/toolchains/{Toolchain-hexagon-7.2.cmake => Toolchain-hexagon-7.4.cmake} (98%) diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index d7dd2a0598..5b38a70649 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake index 4b9f87d56c..6bb9e0cbc3 100644 --- a/cmake/configs/qurt_eagle_hil.cmake +++ b/cmake/configs/qurt_eagle_hil.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake index 77a94fd722..6f4f12cf4d 100644 --- a/cmake/configs/qurt_eagle_muorb.cmake +++ b/cmake/configs/qurt_eagle_muorb.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_release.cmake b/cmake/configs/qurt_eagle_release.cmake index a6b3045835..f80c87d5fb 100644 --- a/cmake/configs/qurt_eagle_release.cmake +++ b/cmake/configs/qurt_eagle_release.cmake @@ -20,7 +20,7 @@ set(target_libraries ) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list # diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index 5e27fb7fa1..6f948d905c 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index ec10d2a10c..20293830e2 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -3,7 +3,7 @@ include(qurt/px4_impl_qurt) # Run a full link with build stubs to make sure qurt target isn't broken set(QURT_ENABLE_STUBS "1") -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.2.cmake) +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/toolchains/Toolchain-hexagon-7.2.cmake b/cmake/toolchains/Toolchain-hexagon-7.4.cmake similarity index 98% rename from cmake/toolchains/Toolchain-hexagon-7.2.cmake rename to cmake/toolchains/Toolchain-hexagon-7.4.cmake index 9cbc23bb24..9c4286044d 100644 --- a/cmake/toolchains/Toolchain-hexagon-7.2.cmake +++ b/cmake/toolchains/Toolchain-hexagon-7.4.cmake @@ -35,7 +35,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) include(common/px4_base) if(NOT HEXAGON_TOOLS_ROOT) - set(HEXAGON_TOOLS_ROOT /opt/7.2.09/Tools) + set(HEXAGON_TOOLS_ROOT /opt/7.4/Tools) endif() macro (list2string out in) @@ -95,7 +95,6 @@ set(ARCHOPTIMIZATION -g -fno-strict-aliasing -fdata-sections - -fpic -fno-zero-initialized-in-bss ) @@ -108,7 +107,7 @@ set(ARCHCFLAGS set(ARCHCXXFLAGS -fno-exceptions -fno-rtti -# -std=c++11 + -std=c++11 -fno-threadsafe-statics -DCONFIG_WCHAR_BUILTIN -D__CUSTOM_FILE_IO__ @@ -214,9 +213,9 @@ list2string(CMAKE_EXE_LINKER_FLAGS -g -mv5 -mG0lib - -lhexagon -G0 -fpic + -shared -Wl,-Bsymbolic -Wl,--wrap=malloc -Wl,--wrap=calloc diff --git a/src/modules/attitude_estimator_q/CMakeLists.txt b/src/modules/attitude_estimator_q/CMakeLists.txt index a727305b9a..3f89f45cdb 100644 --- a/src/modules/attitude_estimator_q/CMakeLists.txt +++ b/src/modules/attitude_estimator_q/CMakeLists.txt @@ -29,12 +29,17 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -############################################################################ +############################################################################# +set(MODULE_CFLAGS) +if (NOT ${OS} STREQUAL "qurt") + list(APPEND MODULE_CFLAGS + -Wframe-larger-than=1400) +endif() px4_add_module( MODULE modules__attitude_estimator_q MAIN attitude_estimator_q COMPILE_FLAGS - -Wframe-larger-than=1400 + ${MODULE_CFLAGS} STACK 1200 SRCS attitude_estimator_q_main.cpp diff --git a/src/modules/commander/CMakeLists.txt b/src/modules/commander/CMakeLists.txt index a831aa9bce..64954c6d69 100644 --- a/src/modules/commander/CMakeLists.txt +++ b/src/modules/commander/CMakeLists.txt @@ -30,13 +30,18 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +set(MODULE_CFLAGS -Os) + +if(NOT ${OS} STREQUAL "qurt") + list(APPEND MODULE_CFLAGS + -Wframe-larger-than=2200) +endif() px4_add_module( MODULE modules__commander MAIN commander STACK 5000 COMPILE_FLAGS - -Wframe-larger-than=2200 - -Os + ${MODULE_CFLAGS} SRCS commander.cpp commander_params.c From d4422f7018cd9c9a690dc02ce570ed5480c462ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=B6tter?= Date: Fri, 25 Sep 2015 11:04:02 +0200 Subject: [PATCH 250/389] Fixed Vagrant provisioning: - Added "zip" package needed for build - Run shell proviosioner as non-privileged (ie. "vagrant") user --- Vagrantfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 25ba1ce35c..086884adb7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -73,12 +73,12 @@ Vagrant.configure(2) do |config| # Enable provisioning with a shell script. Additional provisioners such as # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. - config.vm.provision "shell", inline: <<-SHELL + config.vm.provision "shell", privileged: false, inline: <<-SHELL # Ensure we start in the Firmware folder echo "cd /Firmware" >> ~/.bashrc # Install software sudo apt-get update - sudo apt-get install -y build-essential ccache cmake clang-3.5 lldb-3.5 g++-4.8 gcc-4.8 genromfs libc6-i386 libncurses5-dev python-argparse python-empy python-serial s3cmd texinfo zlib1g-dev git-core + sudo apt-get install -y build-essential ccache cmake clang-3.5 lldb-3.5 g++-4.8 gcc-4.8 genromfs libc6-i386 libncurses5-dev python-argparse python-empy python-serial s3cmd texinfo zlib1g-dev git-core zip pushd . cd ~ wget -q https://launchpadlibrarian.net/186124160/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 From 3c6d101792b508b1f68d3c89b5435eb6d6a84e0a Mon Sep 17 00:00:00 2001 From: James Goppert Date: Fri, 25 Sep 2015 08:29:35 -0400 Subject: [PATCH 251/389] Added support for ros-sitl. --- CMakeLists.txt | 23 ++- Makefile | 5 + cmake/ros-CMakeLists.txt | 333 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 353 insertions(+), 8 deletions(-) create mode 100644 cmake/ros-CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 351a0f6c36..5e89031d85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,19 @@ set(DEBUG_PORT "/dev/ttyACM0" CACHE STRING "debugging port") # # must come before project to set toolchain +string(REPLACE "_" ";" config_args ${CONFIG}) +list(GET config_args 0 OS) +list(GET config_args 1 BOARD) +list(GET config_args 2 LABEL) +set(target_name "${OS}-${BOARD}-${LABEL}") + +message(STATUS "${target_name}") + +# switch to ros CMake file if building ros +if (${OS} STREQUAL "ros") + include("cmake/ros-CMakeLists.txt") +else() # otherwise use the rest of this file + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(config_module "configs/${CONFIG}") include(${config_module}) @@ -179,14 +192,6 @@ set(version_patch 1) set(version "${version_major}.${version_minor}.${version_patch}") set(package-contact "px4users@googlegroups.com") -string(REPLACE "_" ";" config_args ${CONFIG}) -list(GET config_args 0 OS) -list(GET config_args 1 BOARD) -list(GET config_args 2 LABEL) -set(target_name "${OS}-${BOARD}-${LABEL}") - -message(STATUS "${target_name}") - #============================================================================= # programs # @@ -298,4 +303,6 @@ set(CPACK_GENERATOR "ZIP") set(CPACK_SOURCE_GENERATOR "ZIP") include(CPack) +endif() # ros alternative endif + # vim: set noet fenc=utf-8 ff=unix ft=cmake : diff --git a/Makefile b/Makefile index ea1344a4ef..387199e34b 100644 --- a/Makefile +++ b/Makefile @@ -87,11 +87,16 @@ nuttx_sim_simple: posix_sitl_simple: $(call cmake-build,$@) +ros_sitl_simple: + $(call cmake-build,$@) + qurt_eagle_travis: $(call cmake-build,$@) posix: posix_sitl_simple +ros: ros_sitl_simple + run_sitl_quad: posix Tools/sitl_run.sh posix-configs/SITL/init/rcS diff --git a/cmake/ros-CMakeLists.txt b/cmake/ros-CMakeLists.txt new file mode 100644 index 0000000000..59c5bac304 --- /dev/null +++ b/cmake/ros-CMakeLists.txt @@ -0,0 +1,333 @@ +cmake_minimum_required(VERSION 2.8.3) +project(px4) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +add_definitions(-D__PX4_ROS) +add_definitions(-D__EXPORT=) +add_definitions(-DMAVLINK_DIALECT=common) + +## Find catkin macros and libraries +## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) +## is used, also find other catkin packages +find_package(catkin REQUIRED COMPONENTS + roscpp + rospy + std_msgs + geometry_msgs + message_generation + cmake_modules + gazebo_msgs + sensor_msgs + mav_msgs + libmavconn + tf +) +find_package(Eigen REQUIRED) + +## System dependencies are found with CMake's conventions +# find_package(Boost REQUIRED COMPONENTS system) + + +## Uncomment this if the package has a setup.py. This macro ensures +## modules and global scripts declared therein get installed +## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html +# catkin_python_setup() + +################################################ +## Declare ROS messages, services and actions ## +################################################ + +## To declare and build messages, services or actions from within this +## package, follow these steps: +## * Let MSG_DEP_SET be the set of packages whose message types you use in +## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). +## * In the file package.xml: +## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET +## * If MSG_DEP_SET isn't empty the following dependencies might have been +## pulled in transitively but can be declared for certainty nonetheless: +## * add a build_depend tag for "message_generation" +## * add a run_depend tag for "message_runtime" +## * In this file (CMakeLists.txt): +## * add "message_generation" and every package in MSG_DEP_SET to +## find_package(catkin REQUIRED COMPONENTS ...) +## * add "message_runtime" and every package in MSG_DEP_SET to +## catkin_package(CATKIN_DEPENDS ...) +## * uncomment the add_*_files sections below as needed +## and list every .msg/.srv/.action file to be processed +## * uncomment the generate_messages entry below +## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) + +## Generate messages in the 'msg' folder +add_message_files( + FILES + rc_channels.msg + vehicle_attitude.msg + vehicle_attitude_setpoint.msg + manual_control_setpoint.msg + actuator_controls.msg + actuator_controls_0.msg + actuator_controls_virtual_mc.msg + vehicle_rates_setpoint.msg + mc_virtual_rates_setpoint.msg + vehicle_attitude.msg + vehicle_control_mode.msg + actuator_armed.msg + parameter_update.msg + vehicle_status.msg + vehicle_local_position.msg + position_setpoint.msg + position_setpoint_triplet.msg + vehicle_local_position_setpoint.msg + vehicle_global_velocity_setpoint.msg + offboard_control_mode.msg + vehicle_force_setpoint.msg + distance_sensor.msg +) + +## Generate services in the 'srv' folder +# add_service_files( +# FILES +# Service1.srv +# Service2.srv +# ) + +## Generate actions in the 'action' folder +# add_action_files( +# FILES +# Action1.action +# Action2.action +# ) + +## Generate added messages and services with any dependencies listed here +generate_messages( + DEPENDENCIES + std_msgs + gazebo_msgs +) + +################################### +## catkin specific configuration ## +################################### +## The catkin_package macro generates cmake config files for your package +## Declare things to be passed to dependent projects +## INCLUDE_DIRS: uncomment this if you package contains header files +## LIBRARIES: libraries you create in this project that dependent projects also need +## CATKIN_DEPENDS: catkin_packages dependent projects also need +## DEPENDS: system dependencies of this project that dependent projects also need +catkin_package( + INCLUDE_DIRS src/include + LIBRARIES px4 + CATKIN_DEPENDS message_runtime roscpp rospy std_msgs libmavconn + DEPENDS system_lib +) + +########### +## Build ## +########### + +## Specify additional locations of header files +## Your package locations should be listed before other locations +include_directories( + ${catkin_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/src/platforms + ${CMAKE_SOURCE_DIR}/src/platforms/ros/px4_messages + ${CMAKE_SOURCE_DIR}/src/include + ${CMAKE_SOURCE_DIR}/src/modules + ${CMAKE_BINARY_DIR}/src/modules + ${CMAKE_SOURCE_DIR}/src/ + ${CMAKE_SOURCE_DIR}/src/lib + ${EIGEN_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/integrationtests +) + +## generate multiplatform wrapper headers +## note that the message header files are generated as in any ROS project with generate_messages() +set(MULTIPLATFORM_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/platforms/ros/px4_messages) +set(MULTIPLATFORM_TEMPLATE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/msg/templates/px4/ros) +set(TOPICHEADER_TEMP_DIR ${CMAKE_BINARY_DIR}/topics_temporary) +set(MULTIPLATFORM_PREFIX px4_) +add_custom_target(multiplatform_message_headers ALL ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Tools/px_generate_uorb_topic_headers.py + -d ${CMAKE_CURRENT_SOURCE_DIR}/msg -o ${MULTIPLATFORM_HEADER_DIR} -e ${MULTIPLATFORM_TEMPLATE_DIR} + -t ${TOPICHEADER_TEMP_DIR} -p ${MULTIPLATFORM_PREFIX}) + +## Declare a cpp library +add_library(px4 + src/platforms/ros/px4_ros_impl.cpp + src/platforms/ros/perf_counter.cpp + src/platforms/ros/geo.cpp + src/lib/mathlib/math/Limits.cpp + src/modules/systemlib/circuit_breaker.cpp +) +add_dependencies(px4 ${PROJECT_NAME}_generate_messages_cpp multiplatform_message_headers) + +target_link_libraries(px4 + ${catkin_LIBRARIES} +) + +## Declare a test publisher +add_executable(publisher + src/examples/publisher/publisher_main.cpp + src/examples/publisher/publisher_example.cpp) +add_dependencies(publisher ${PROJECT_NAME}_generate_messages_cpp multiplatform_message_headers) +target_link_libraries(publisher + ${catkin_LIBRARIES} + px4 +) + +## Declare a test subscriber +add_executable(subscriber + src/examples/subscriber/subscriber_main.cpp + src/examples/subscriber/subscriber_example.cpp) +add_dependencies(subscriber ${PROJECT_NAME}_generate_messages_cpp multiplatform_message_headers) +target_link_libraries(subscriber + ${catkin_LIBRARIES} + px4 +) + +## MC Attitude Control +add_executable(mc_att_control + src/modules/mc_att_control_multiplatform/mc_att_control_main.cpp + src/modules/mc_att_control_multiplatform/mc_att_control.cpp + src/modules/mc_att_control_multiplatform/mc_att_control_base.cpp) +add_dependencies(mc_att_control ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(mc_att_control + ${catkin_LIBRARIES} + px4 +) + +## MC Position Control +add_executable(mc_pos_control + src/modules/mc_pos_control_multiplatform/mc_pos_control_main.cpp + src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp) +add_dependencies(mc_pos_control ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(mc_pos_control + ${catkin_LIBRARIES} + px4 +) + +## Attitude Estimator dummy +add_executable(attitude_estimator + src/platforms/ros/nodes/attitude_estimator/attitude_estimator.cpp) +add_dependencies(attitude_estimator ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(attitude_estimator + ${catkin_LIBRARIES} + px4 +) + +## Position Estimator dummy +add_executable(position_estimator + src/platforms/ros/nodes/position_estimator/position_estimator.cpp) +add_dependencies(position_estimator ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(position_estimator + ${catkin_LIBRARIES} + px4 +) + +## Manual input +add_executable(manual_input + src/platforms/ros/nodes/manual_input/manual_input.cpp) +add_dependencies(manual_input ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(manual_input + ${catkin_LIBRARIES} + px4 +) + +## Multicopter Mixer dummy +add_executable(mc_mixer + src/platforms/ros/nodes/mc_mixer/mc_mixer.cpp) +add_dependencies(mc_mixer ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(mc_mixer + ${catkin_LIBRARIES} + px4 +) + +## Commander dummy +add_executable(commander + src/platforms/ros/nodes/commander/commander.cpp) +add_dependencies(commander ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(commander + ${catkin_LIBRARIES} + px4 +) + +## Mavlink dummy +add_executable(mavlink + src/platforms/ros/nodes/mavlink/mavlink.cpp) +add_dependencies(mavlink ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(mavlink + ${catkin_LIBRARIES} + px4 +) + +## Offboard Position Setpoint Demo +add_executable(demo_offboard_position_setpoints + src/platforms/ros/nodes/demo_offboard_position_setpoints/demo_offboard_position_setpoints.cpp) +add_dependencies(demo_offboard_position_setpoints ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(demo_offboard_position_setpoints + ${catkin_LIBRARIES} + px4 +) + +## Offboard Attitude Setpoint Demo +add_executable(demo_offboard_attitude_setpoints + src/platforms/ros/nodes/demo_offboard_attitude_setpoints/demo_offboard_attitude_setpoints.cpp) +add_dependencies(demo_offboard_attitude_setpoints ${PROJECT_NAME}_generate_messages_cpp_cpp) +target_link_libraries(demo_offboard_attitude_setpoints + ${catkin_LIBRARIES} + px4 +) + +############# +## Install ## +############# + +# all install targets should use catkin DESTINATION variables +# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html + +## Mark executable scripts (Python etc.) for installation +## in contrast to setup.py, you can choose the destination +# install(PROGRAMS +# scripts/my_python_script +# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +# ) + +## Mark executables and/or libraries for installation +install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +) + +## Mark cpp header files for installation +# install(DIRECTORY include/${PROJECT_NAME}/ +# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} +# FILES_MATCHING PATTERN "*.h" +# PATTERN ".svn" EXCLUDE +# ) + +## Mark other files for installation (e.g. launch and bag files, etc.) +# install(FILES +# # myfile1 +# # myfile2 +# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} +# ) + +############# +## Testing ## +############# + +## Add gtest based cpp test target and link libraries +# catkin_add_gtest(${PROJECT_NAME}-test test/test_px4test.cpp) +# if(TARGET ${PROJECT_NAME}-test) +# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) +# endif() + +## Add folders to be run by python nosetests +# catkin_add_nosetests(test) + +if(CATKIN_ENABLE_TESTING) + find_package(rostest REQUIRED) + add_rostest(integrationtests/demo_tests/direct_tests.launch) + add_rostest(integrationtests/demo_tests/mavros_tests.launch) +endif() + + From ccf19d12f20a30e90d45f1aa73ca746565603773 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 26 Sep 2015 17:20:08 +0200 Subject: [PATCH 252/389] Commander: Provide better status feedback for sensor init / check routine --- src/modules/commander/state_machine_helper.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index c9c09ac300..d44f1f3506 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -243,7 +243,7 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s (new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY) && (status->arming_state != vehicle_status_s::ARMING_STATE_STANDBY_ERROR) && (!status->condition_system_sensors_initialized)) { - if (!sensor_feedback_provided) { + if (!sensor_feedback_provided || (new_arming_state == vehicle_status_s::ARMING_STATE_ARMED)) { mavlink_and_console_log_critical(mavlink_fd, "Not ready to fly: Sensors need inspection"); sensor_feedback_provided = true; } @@ -260,7 +260,8 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s } /* reset feedback state */ - if (status->arming_state != vehicle_status_s::ARMING_STATE_STANDBY_ERROR) { + if (status->arming_state != vehicle_status_s::ARMING_STATE_STANDBY_ERROR && + valid_transition) { sensor_feedback_provided = false; } @@ -271,15 +272,10 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s } if (ret == TRANSITION_DENIED) { -#define WARNSTR "INVAL: %s - %s" - /* only print to console here by default as this is too technical to be useful during operation */ - warnx(WARNSTR, state_names[status->arming_state], state_names[new_arming_state]); - - /* print to MAVLink if we didn't provide any feedback yet */ + /* print to MAVLink and console if we didn't provide any feedback yet */ if (!feedback_provided) { - mavlink_log_critical(mavlink_fd, WARNSTR, state_names[status->arming_state], state_names[new_arming_state]); + mavlink_and_console_log_critical(mavlink_fd, "INVAL: %s - %s", state_names[status->arming_state], state_names[new_arming_state]); } -#undef WARNSTR } return ret; From e2b801a3239df53c743e343caf5512ab772eeeb7 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sat, 26 Sep 2015 20:12:15 +0300 Subject: [PATCH 253/389] Fixes 2911 --- src/modules/uavcan/sensors/baro.cpp | 9 ++++++++- src/modules/uavcan/sensors/gnss.cpp | 10 +++++++++- src/modules/uavcan/sensors/mag.cpp | 9 ++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/modules/uavcan/sensors/baro.cpp b/src/modules/uavcan/sensors/baro.cpp index 1986de4247..694a3988a1 100644 --- a/src/modules/uavcan/sensors/baro.cpp +++ b/src/modules/uavcan/sensors/baro.cpp @@ -159,7 +159,14 @@ void UavcanBarometerBridge::air_pressure_sub_cb(const { baro_report report; - report.timestamp = msg.getMonotonicTimestamp().toUSec(); + /* + * FIXME HACK + * This code used to rely on msg.getMonotonicTimestamp().toUSec() instead of HRT. + * It stopped working when the time sync feature has been introduced, because it caused libuavcan + * to use an independent time source (based on hardware TIM5) instead of HRT. + * The proper solution is to be developed. + */ + report.timestamp = hrt_absolute_time(); report.temperature = last_temperature_kelvin - 273.15F; report.pressure = msg.static_pressure / 100.0F; // Convert to millibar report.error_count = 0; diff --git a/src/modules/uavcan/sensors/gnss.cpp b/src/modules/uavcan/sensors/gnss.cpp index 0830aba4ee..d80b4b425d 100644 --- a/src/modules/uavcan/sensors/gnss.cpp +++ b/src/modules/uavcan/sensors/gnss.cpp @@ -96,7 +96,15 @@ void UavcanGnssBridge::gnss_fix_sub_cb(const uavcan::ReceivedDataStructure Date: Sun, 27 Sep 2015 11:37:30 +0200 Subject: [PATCH 254/389] fix 'unterminated function-like macro invocation', fixes #2913 --- src/platforms/px4_log.h | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/platforms/px4_log.h b/src/platforms/px4_log.h index a8208313e6..0c1063883b 100644 --- a/src/platforms/px4_log.h +++ b/src/platforms/px4_log.h @@ -63,7 +63,7 @@ static inline void do_nothing(int level, ...) #define PX4_ERR(...) ROS_WARN(__VA_ARGS__) #define PX4_WARN(...) ROS_WARN(__VA_ARGS__) #define PX4_INFO(...) ROS_WARN(__VA_ARGS__) -#define PX4_DEBUG(...) +#define PX4_DEBUG(...) #elif defined(__PX4_QURT) #include "qurt_log.h" @@ -137,13 +137,13 @@ __END_DECLS * * To write to a specific stream for each message type, open the streams and * set __px4__log_startline to something like: - * if (level <= __px4_log_level_current) printf(_px4_fd[level], + * if (level <= __px4_log_level_current) printf(_px4_fd[level], * * Additional behavior can be added using "{\" for __px4__log_startline and * "}" for __px4__log_endline and any other required setup or teardown steps ****************************************************************************/ -#define __px4__log_startcond(cond) if (cond) printf( -#define __px4__log_startline(level) if (level <= __px4_log_level_current) printf( +#define __px4__log_printcond(cond, ...) if (cond) printf(__VA_ARGS__) +#define __px4__log_printline(level, ...) if (level <= __px4_log_level_current) printf(__VA_ARGS__) #define __px4__log_timestamp_fmt "%-10" PRIu64 " " #define __px4__log_timestamp_arg ,hrt_absolute_time() @@ -172,12 +172,12 @@ __END_DECLS * if the first arg/condition is true. ****************************************************************************/ #define __px4_log_named_cond(name, cond, FMT, ...) \ - __px4__log_startcond(cond)\ + __px4__log_printcond(cond,\ "%s " \ FMT\ __px4__log_end_fmt \ ,name, ##__VA_ARGS__\ - __px4__log_endline + ) /**************************************************************************** * __px4_log: @@ -187,12 +187,12 @@ __END_DECLS * printf("%-5s val is %d\n", __px4_log_level_str[3], val); ****************************************************************************/ #define __px4_log(level, FMT, ...) \ - __px4__log_startline(level)\ + __px4__log_printline(level,\ __px4__log_level_fmt \ FMT\ __px4__log_end_fmt \ __px4__log_level_arg(level), ##__VA_ARGS__\ - __px4__log_endline + ) /**************************************************************************** * __px4_log_timestamp: @@ -203,7 +203,7 @@ __END_DECLS * hrt_absolute_time(), val); ****************************************************************************/ #define __px4_log_timestamp(level, FMT, ...) \ - __px4__log_startline(level)\ + __px4__log_printline(level,\ __px4__log_level_fmt\ __px4__log_timestamp_fmt\ FMT\ @@ -211,7 +211,7 @@ __END_DECLS __px4__log_level_arg(level)\ __px4__log_timestamp_arg\ , ##__VA_ARGS__\ - __px4__log_endline + ) /**************************************************************************** * __px4_log_timestamp_thread: @@ -222,7 +222,7 @@ __END_DECLS * hrt_absolute_time(), pthread_self(), val); ****************************************************************************/ #define __px4_log_timestamp_thread(level, FMT, ...) \ - __px4__log_startline(level)\ + __px4__log_printline(level,\ __px4__log_level_fmt\ __px4__log_timestamp_fmt\ __px4__log_thread_fmt\ @@ -232,18 +232,18 @@ __END_DECLS __px4__log_timestamp_arg\ __px4__log_thread_arg\ , ##__VA_ARGS__\ - __px4__log_endline + ) /**************************************************************************** * __px4_log_file_and_line: * Convert a message in the form: * PX4_WARN("val is %d", val); * to - * printf("%-5s val is %d (file %s line %u)\n", + * printf("%-5s val is %d (file %s line %u)\n", * __px4_log_level_str[3], val, __FILE__, __LINE__); ****************************************************************************/ #define __px4_log_file_and_line(level, FMT, ...) \ - __px4__log_startline(level)\ + __px4__log_printline(level,\ __px4__log_level_fmt\ __px4__log_timestamp_fmt\ FMT\ @@ -253,19 +253,19 @@ __END_DECLS __px4__log_timestamp_arg\ , ##__VA_ARGS__\ __px4__log_file_and_line_arg\ - __px4__log_endline + ) /**************************************************************************** * __px4_log_timestamp_file_and_line: * Convert a message in the form: * PX4_WARN("val is %d", val); * to - * printf("%-5s %-10lu val is %d (file %s line %u)\n", + * printf("%-5s %-10lu val is %d (file %s line %u)\n", * __px4_log_level_str[3], hrt_absolute_time(), * val, __FILE__, __LINE__); ****************************************************************************/ #define __px4_log_timestamp_file_and_line(level, FMT, ...) \ - __px4__log_startline(level)\ + __px4__log_printline(level,\ __px4__log_level_fmt\ __px4__log_timestamp_fmt\ FMT\ @@ -275,19 +275,19 @@ __END_DECLS __px4__log_timestamp_arg\ , ##__VA_ARGS__\ __px4__log_file_and_line_arg\ - __px4__log_endline + ) /**************************************************************************** * __px4_log_thread_file_and_line: * Convert a message in the form: * PX4_WARN("val is %d", val); * to - * printf("%-5s %#X val is %d (file %s line %u)\n", - * __px4_log_level_str[3], pthread_self(), + * printf("%-5s %#X val is %d (file %s line %u)\n", + * __px4_log_level_str[3], pthread_self(), * val, __FILE__, __LINE__); ****************************************************************************/ #define __px4_log_thread_file_and_line(level, FMT, ...) \ - __px4__log_startline(level)\ + __px4__log_printline(level,\ __px4__log_level_fmt\ __px4__log_thread_fmt\ FMT\ @@ -297,19 +297,19 @@ __END_DECLS __px4__log_thread_arg\ , ##__VA_ARGS__\ __px4__log_file_and_line_arg\ - __px4__log_endline + ) /**************************************************************************** * __px4_log_timestamp_thread_file_and_line: * Convert a message in the form: * PX4_WARN("val is %d", val); * to - * printf("%-5s %-10lu %#X val is %d (file %s line %u)\n", - * __px4_log_level_str[3], hrt_absolute_time(), + * printf("%-5s %-10lu %#X val is %d (file %s line %u)\n", + * __px4_log_level_str[3], hrt_absolute_time(), * pthread_self(), val, __FILE__, __LINE__); ****************************************************************************/ #define __px4_log_timestamp_thread_file_and_line(level, FMT, ...) \ - __px4__log_startline(level)\ + __px4__log_printline(level,\ __px4__log_level_fmt\ __px4__log_timestamp_fmt\ __px4__log_thread_fmt\ @@ -321,7 +321,7 @@ __END_DECLS __px4__log_thread_arg\ , ##__VA_ARGS__\ __px4__log_file_and_line_arg\ - __px4__log_endline + ) /**************************************************************************** From 0a79c809adce17f6bb757249c5681d3da8daa679 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Sun, 27 Sep 2015 11:38:05 +0200 Subject: [PATCH 255/389] fix 'ignoring return value of function declared with warn_unused_result' --- src/systemcmds/esc_calib/esc_calib.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/systemcmds/esc_calib/esc_calib.c b/src/systemcmds/esc_calib/esc_calib.c index 8da9580207..86939ff686 100644 --- a/src/systemcmds/esc_calib/esc_calib.c +++ b/src/systemcmds/esc_calib/esc_calib.c @@ -233,7 +233,10 @@ esc_calib_main(int argc, char *argv[]) ret = poll(&fds, 1, 0); if (ret > 0) { - read(0, &c, 1); + if (read(0, &c, 1) <= 0) { + printf("ESC calibration read error\n"); + return 0; + } if (c == 'y' || c == 'Y') { break; @@ -315,7 +318,10 @@ esc_calib_main(int argc, char *argv[]) ret = poll(&fds, 1, 0); if (ret > 0) { - read(0, &c, 1); + if (read(0, &c, 1) <= 0) { + printf("ESC calibration read error\n"); + goto done; + } if (c == 13) { break; @@ -352,7 +358,10 @@ esc_calib_main(int argc, char *argv[]) ret = poll(&fds, 1, 0); if (ret > 0) { - read(0, &c, 1); + if (read(0, &c, 1) <= 0) { + printf("ESC calibration read error\n"); + goto done; + } if (c == 13) { break; From 866e07c3263b74e9639f17f5e3fa4773d2226fd2 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 27 Sep 2015 17:21:31 +0200 Subject: [PATCH 256/389] MAVLink app: Configure USB link correctly --- src/modules/mavlink/mavlink_main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 90729fb138..7b2ef9b129 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1693,6 +1693,10 @@ Mavlink::task_main(int argc, char *argv[]) case MAVLINK_MODE_CONFIG: // Enable a number of interesting streams we want via USB + configure_stream("SYS_STATUS", 1.0f); + configure_stream("GPS_GLOBAL_ORIGIN", 0.5f); + configure_stream("GLOBAL_POSITION_INT", 10.0f); + configure_stream("ATTITUDE_TARGET", 8.0f); configure_stream("PARAM_VALUE", 300.0f); configure_stream("MISSION_ITEM", 50.0f); configure_stream("NAMED_VALUE_FLOAT", 10.0f); @@ -1707,7 +1711,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("POSITION_TARGET_GLOBAL_INT", 10.0f); configure_stream("LOCAL_POSITION_NED", 30.0f); configure_stream("MANUAL_CONTROL", 5.0f); - configure_stream("HIGHRES_IMU", 100.0f); + configure_stream("HIGHRES_IMU", 50.0f); configure_stream("GPS_RAW_INT", 20.0f); configure_stream("CAMERA_TRIGGER", 500.0f); configure_stream("VTOL_STATE", 2.0f); From 5c52efece4b988ca8f13fc12c3975e32705f927a Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 27 Sep 2015 17:33:37 +0200 Subject: [PATCH 257/389] Sensors app: Rate limit new sensor discovery --- src/modules/sensors/sensors.cpp | 54 +++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index 86df382df8..ce6f7939ad 100644 --- a/src/modules/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -212,7 +212,7 @@ private: unsigned _accel_count; /**< raw accel data count */ unsigned _mag_count; /**< raw mag data count */ unsigned _baro_count; /**< raw baro data count */ - + int _rc_sub; /**< raw rc channels data subscription */ int _diff_pres_sub; /**< raw differential pressure subscription */ int _vcontrol_mode_sub; /**< vehicle control mode subscription */ @@ -1988,7 +1988,7 @@ Sensors::task_main() } while (0); if (ret) { - warnx("Sensor initialization failed"); + warnx("sensor initialization failed"); _sensors_task = -1; if (_fd_adc >=0) { px4_close(_fd_adc); @@ -2068,6 +2068,8 @@ Sensors::task_main() raw.timestamp = 0; + uint64_t _last_config_update = hrt_absolute_time(); + while (!_task_should_exit) { /* wait for up to 50ms for data */ @@ -2077,7 +2079,7 @@ Sensors::task_main() /* this is undesirable but not much we can do - might want to flag unhappy status */ if (pret < 0) { - warn("poll error %d, %d", pret, errno); + warnx("poll error %d, %d", pret, errno); continue; } @@ -2086,21 +2088,6 @@ Sensors::task_main() /* check vehicle status for changes to publication state */ vehicle_control_mode_poll(); - /* keep adding sensors as long as we are not armed */ - if (!_armed) { - _gyro_count = init_sensor_class(ORB_ID(sensor_gyro), &_gyro_sub[0], - &raw.gyro_priority[0], &raw.gyro_errcount[0]); - - _mag_count = init_sensor_class(ORB_ID(sensor_mag), &_mag_sub[0], - &raw.magnetometer_priority[0], &raw.magnetometer_errcount[0]); - - _accel_count = init_sensor_class(ORB_ID(sensor_accel), &_accel_sub[0], - &raw.accelerometer_priority[0], &raw.accelerometer_errcount[0]); - - _baro_count = init_sensor_class(ORB_ID(sensor_baro), &_baro_sub[0], - &raw.baro_priority[0], &raw.baro_errcount[0]); - } - /* the timestamp of the raw struct is updated by the gyro_poll() method */ /* copy most recent sensor data */ gyro_poll(raw); @@ -2129,11 +2116,32 @@ Sensors::task_main() orb_publish(ORB_ID(sensor_combined), _sensor_pub, &raw); } - /* check parameters for updates */ - parameter_update_poll(); + /* keep adding sensors as long as we are not armed, + * when not adding sensors poll for param updates + */ + if (!_armed && hrt_elapsed_time(&_last_config_update) > 500 * 1000) { + _gyro_count = init_sensor_class(ORB_ID(sensor_gyro), &_gyro_sub[0], + &raw.gyro_priority[0], &raw.gyro_errcount[0]); - /* check rc parameter map for updates */ - rc_parameter_map_poll(); + _mag_count = init_sensor_class(ORB_ID(sensor_mag), &_mag_sub[0], + &raw.magnetometer_priority[0], &raw.magnetometer_errcount[0]); + + _accel_count = init_sensor_class(ORB_ID(sensor_accel), &_accel_sub[0], + &raw.accelerometer_priority[0], &raw.accelerometer_errcount[0]); + + _baro_count = init_sensor_class(ORB_ID(sensor_baro), &_baro_sub[0], + &raw.baro_priority[0], &raw.baro_errcount[0]); + + _last_config_update = hrt_absolute_time(); + + } else { + + /* check parameters for updates */ + parameter_update_poll(); + + /* check rc parameter map for updates */ + rc_parameter_map_poll(); + } /* Look for new r/c input data */ rc_poll(); @@ -2152,7 +2160,7 @@ Sensors::start() ASSERT(_sensors_task == -1); /* start the task */ - _sensors_task = px4_task_spawn_cmd("sensors_task", + _sensors_task = px4_task_spawn_cmd("sensors", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2000, From afb68cb0abee4034582f93d7f383c287b9c9a109 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 27 Sep 2015 18:06:53 +0200 Subject: [PATCH 258/389] MAVLink: Switch to HOME_POSITION message --- src/modules/mavlink/mavlink_main.cpp | 6 ++-- src/modules/mavlink/mavlink_messages.cpp | 37 ++++++++++++++++-------- src/modules/mavlink/mavlink_receiver.cpp | 11 +++++++ 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 7b2ef9b129..95ed3e8f64 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1637,7 +1637,7 @@ Mavlink::task_main(int argc, char *argv[]) switch (_mode) { case MAVLINK_MODE_NORMAL: configure_stream("SYS_STATUS", 1.0f); - configure_stream("GPS_GLOBAL_ORIGIN", 0.5f); + configure_stream("HOME_POSITION", 0.5f); configure_stream("HIGHRES_IMU", 2.0f); configure_stream("ATTITUDE", 20.0f); configure_stream("VFR_HUD", 8.0f); @@ -1661,6 +1661,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("GLOBAL_POSITION_INT", 50.0f); configure_stream("LOCAL_POSITION_NED", 30.0f); configure_stream("CAMERA_CAPTURE", 2.0f); + configure_stream("HOME_POSITION", 0.5f); configure_stream("ATTITUDE_TARGET", 10.0f); configure_stream("POSITION_TARGET_GLOBAL_INT", 10.0f); configure_stream("POSITION_TARGET_LOCAL_NED", 10.0f); @@ -1683,6 +1684,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("VFR_HUD", 5.0f); configure_stream("GPS_RAW_INT", 1.0f); configure_stream("GLOBAL_POSITION_INT", 10.0f); + configure_stream("HOME_POSITION", 0.5f); configure_stream("ATTITUDE_TARGET", 10.0f); configure_stream("BATTERY_STATUS", 1.0f); configure_stream("SYSTEM_TIME", 1.0f); @@ -1694,7 +1696,7 @@ Mavlink::task_main(int argc, char *argv[]) case MAVLINK_MODE_CONFIG: // Enable a number of interesting streams we want via USB configure_stream("SYS_STATUS", 1.0f); - configure_stream("GPS_GLOBAL_ORIGIN", 0.5f); + configure_stream("HOME_POSITION", 0.5f); configure_stream("GLOBAL_POSITION_INT", 10.0f); configure_stream("ATTITUDE_TARGET", 8.0f); configure_stream("PARAM_VALUE", 300.0f); diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index 2068147fe7..de589a8bac 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -1326,43 +1326,43 @@ protected: }; -class MavlinkStreamGPSGlobalOrigin : public MavlinkStream +class MavlinkStreamHomePosition : public MavlinkStream { public: const char *get_name() const { - return MavlinkStreamGPSGlobalOrigin::get_name_static(); + return MavlinkStreamHomePosition::get_name_static(); } static const char *get_name_static() { - return "GPS_GLOBAL_ORIGIN"; + return "HOME_POSITION"; } uint8_t get_id() { - return MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN; + return MAVLINK_MSG_ID_HOME_POSITION; } static MavlinkStream *new_instance(Mavlink *mavlink) { - return new MavlinkStreamGPSGlobalOrigin(mavlink); + return new MavlinkStreamHomePosition(mavlink); } unsigned get_size() { - return _home_sub->is_published() ? (MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0; + return _home_sub->is_published() ? (MAVLINK_MSG_ID_HOME_POSITION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0; } private: MavlinkOrbSubscription *_home_sub; /* do not allow top copying this class */ - MavlinkStreamGPSGlobalOrigin(MavlinkStreamGPSGlobalOrigin &); - MavlinkStreamGPSGlobalOrigin& operator = (const MavlinkStreamGPSGlobalOrigin &); + MavlinkStreamHomePosition(MavlinkStreamHomePosition &); + MavlinkStreamHomePosition& operator = (const MavlinkStreamHomePosition &); protected: - explicit MavlinkStreamGPSGlobalOrigin(Mavlink *mavlink) : MavlinkStream(mavlink), + explicit MavlinkStreamHomePosition(Mavlink *mavlink) : MavlinkStream(mavlink), _home_sub(_mavlink->add_orb_subscription(ORB_ID(home_position))) {} @@ -1374,13 +1374,26 @@ protected: struct home_position_s home; if (_home_sub->update(&home)) { - mavlink_gps_global_origin_t msg; + mavlink_home_position_t msg; msg.latitude = home.lat * 1e7; msg.longitude = home.lon * 1e7; msg.altitude = home.alt * 1e3f; - _mavlink->send_message(MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, &msg); + msg.x = home.x; + msg.y = home.y; + msg.z = home.z; + + msg.q[0] = 1.0f; + msg.q[1] = 0.0f; + msg.q[2] = 0.0f; + msg.q[3] = 0.0f; + + msg.approach_x = 0.0f; + msg.approach_y = 0.0f; + msg.approach_z = 0.0f; + + _mavlink->send_message(MAVLINK_MSG_ID_HOME_POSITION, &msg); } } } @@ -2437,7 +2450,7 @@ const StreamListItem *streams_list[] = { new StreamListItem(&MavlinkStreamGlobalPositionInt::new_instance, &MavlinkStreamGlobalPositionInt::get_name_static), new StreamListItem(&MavlinkStreamLocalPositionNED::new_instance, &MavlinkStreamLocalPositionNED::get_name_static), new StreamListItem(&MavlinkStreamAttPosMocap::new_instance, &MavlinkStreamAttPosMocap::get_name_static), - new StreamListItem(&MavlinkStreamGPSGlobalOrigin::new_instance, &MavlinkStreamGPSGlobalOrigin::get_name_static), + new StreamListItem(&MavlinkStreamHomePosition::new_instance, &MavlinkStreamHomePosition::get_name_static), new StreamListItem(&MavlinkStreamServoOutputRaw<0>::new_instance, &MavlinkStreamServoOutputRaw<0>::get_name_static), new StreamListItem(&MavlinkStreamServoOutputRaw<1>::new_instance, &MavlinkStreamServoOutputRaw<1>::get_name_static), new StreamListItem(&MavlinkStreamServoOutputRaw<2>::new_instance, &MavlinkStreamServoOutputRaw<2>::get_name_static), diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 2eae087010..8d97b6a8c8 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -309,6 +309,10 @@ MavlinkReceiver::handle_message_command_long(mavlink_message_t *msg) } else if (cmd_mavlink.command == MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES) { /* send autopilot version message */ _mavlink->send_autopilot_capabilites(); + + } else if (cmd_mavlink.command == MAV_CMD_GET_HOME_POSITION) { + _mavlink->configure_stream_threadsafe("HOME_POSITION", 0.5f); + } else { if (msg->sysid == mavlink_system.sysid && msg->compid == mavlink_system.compid) { @@ -365,6 +369,13 @@ MavlinkReceiver::handle_message_command_int(mavlink_message_t *msg) /* terminate other threads and this thread */ _mavlink->_task_should_exit = true; + } else if (cmd_mavlink.command == MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES) { + /* send autopilot version message */ + _mavlink->send_autopilot_capabilites(); + + } else if (cmd_mavlink.command == MAV_CMD_GET_HOME_POSITION) { + _mavlink->configure_stream_threadsafe("HOME_POSITION", 0.5f); + } else { if (msg->sysid == mavlink_system.sysid && msg->compid == mavlink_system.compid) { From aa40f1fd9734e29bd741d9a0fb38ce907c8e22dc Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 27 Sep 2015 18:57:51 +0200 Subject: [PATCH 259/389] Commander: More detailed status --- src/modules/commander/commander.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index c9d5259f33..a8db500675 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -408,7 +408,8 @@ void usage(const char *reason) void print_status() { warnx("type: %s", (status.is_rotary_wing) ? "symmetric motion" : "forward motion"); - warnx("usb powered: %s", (status.usb_connected) ? "yes" : "no"); + warnx("power: USB: %s, BRICK: %s", (status.usb_connected) ? "[OK]" : "[NO]", + (status.condition_power_input_valid) ? " [OK]" : "[NO]"); warnx("avionics rail: %6.2f V", (double)status.avionics_power_rail_voltage); warnx("home: lat = %.7f, lon = %.7f, alt = %.2f ", _home.lat, _home.lon, (double)_home.alt); warnx("home: x = %.7f, y = %.7f, z = %.2f ", (double)_home.x, (double)_home.y, (double)_home.z); From 2d381d57b06239578b9f2358f0ae9c70ceb4b3ef Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Mon, 28 Sep 2015 11:21:42 +0200 Subject: [PATCH 260/389] remove var for relative include directories --- cmake/ros-CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmake/ros-CMakeLists.txt b/cmake/ros-CMakeLists.txt index 59c5bac304..aa42fb6ff4 100644 --- a/cmake/ros-CMakeLists.txt +++ b/cmake/ros-CMakeLists.txt @@ -128,15 +128,15 @@ catkin_package( ## Your package locations should be listed before other locations include_directories( ${catkin_INCLUDE_DIRS} - ${CMAKE_SOURCE_DIR}/src/platforms - ${CMAKE_SOURCE_DIR}/src/platforms/ros/px4_messages - ${CMAKE_SOURCE_DIR}/src/include - ${CMAKE_SOURCE_DIR}/src/modules + src/platforms + src/platforms/ros/px4_messages + src/include + src/modules ${CMAKE_BINARY_DIR}/src/modules - ${CMAKE_SOURCE_DIR}/src/ - ${CMAKE_SOURCE_DIR}/src/lib + src/ + src/lib ${EIGEN_INCLUDE_DIRS} - ${CMAKE_SOURCE_DIR}/integrationtests + integrationtests ) ## generate multiplatform wrapper headers From c5e66e41f13ffaaae9b437b577c872100daa91c8 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Mon, 28 Sep 2015 10:49:48 -0700 Subject: [PATCH 261/389] qurt: Must use latest version of Eigen The latest version of Eigen is required to build with the Hexagon 7.4 toolchain. Only certain C++11 features are supported and the latest version if Eigen provides these tests. A patch is required to add support for the Hexagon compiler. These changes force the sync and then update of eigen and allow it to be patched for qurt. The eigen-3.2 submodule was removed as it is no longer needed by the qurt build with the updated toolchain. Signed-off-by: Mark Charlebois --- .gitmodules | 3 --- cmake/common/px4_base.cmake | 2 +- cmake/qurt/px4_impl_qurt.cmake | 1 + src/lib/eigen-3.2 | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) delete mode 160000 src/lib/eigen-3.2 diff --git a/.gitmodules b/.gitmodules index 9db1631350..cb9a6ccf05 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,6 +22,3 @@ [submodule "src/lib/dspal"] path = src/lib/dspal url = https://github.com/mcharleb/dspal.git -[submodule "src/lib/eigen-3.2"] - path = src/lib/eigen-3.2 - url = https://github.com/PX4/eigen.git diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 1de4dddb01..c3a07df882 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -139,7 +139,7 @@ function(px4_add_git_submodule) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git_${NAME}.stamp WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND git submodule init ${PATH} - COMMAND git submodule update ${PATH} + COMMAND git submodule update -f ${PATH} COMMAND touch ${CMAKE_BINARY_DIR}/git_${NAME}.stamp ) add_custom_target(${TARGET} diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index 6f15a640f3..6c8a6340b1 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -225,6 +225,7 @@ function(px4_os_prebuild_targets) add_custom_target(git_eigen_patched WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/eigen COMMAND git checkout . + COMMAND git checkout master COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/cmake/qurt/qurt_eigen.patch DEPENDS git_eigen) add_custom_target(${OUT} DEPENDS git_dspal git_eigen_patched) diff --git a/src/lib/eigen-3.2 b/src/lib/eigen-3.2 deleted file mode 160000 index e7850ed81f..0000000000 --- a/src/lib/eigen-3.2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e7850ed81f9c469e02df496ef09ae32ec0379b71 From e7529839c7f8e9781b394d1e59eb0d338e7405e4 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Wed, 30 Sep 2015 10:55:13 +0200 Subject: [PATCH 262/389] Make sure the default fixed wing types (AERT/AETR) can arm the ESC. --- ROMFS/px4fmu_common/init.d/2101_fw_AERT | 4 ++++ ROMFS/px4fmu_common/init.d/2104_fw_AETR | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ROMFS/px4fmu_common/init.d/2101_fw_AERT b/ROMFS/px4fmu_common/init.d/2101_fw_AERT index 19a47cda8c..3631a1e36c 100644 --- a/ROMFS/px4fmu_common/init.d/2101_fw_AERT +++ b/ROMFS/px4fmu_common/init.d/2101_fw_AERT @@ -20,3 +20,7 @@ sh /etc/init.d/rc.fw_defaults set MIXER AERT + +# The ESC requires a specific pulse to arm. +set PWM_OUT 4 +set PWM_DISARMED p:PWM_DISARMED diff --git a/ROMFS/px4fmu_common/init.d/2104_fw_AETR b/ROMFS/px4fmu_common/init.d/2104_fw_AETR index 083eb42330..3113ede87a 100644 --- a/ROMFS/px4fmu_common/init.d/2104_fw_AETR +++ b/ROMFS/px4fmu_common/init.d/2104_fw_AETR @@ -20,3 +20,7 @@ sh /etc/init.d/rc.fw_defaults set MIXER AETR + +# The ESC requires a specific pulse to arm. +set PWM_OUT 3 +set PWM_DISARMED p:PWM_DISARMED From 5191731f229b9fd6cfbd752fa16aca0f0b5f62a4 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Mon, 28 Sep 2015 21:28:30 +0200 Subject: [PATCH 263/389] make romfs pruner script windows compatible When we open the file handle to write back the lines in binary mode, we don't change the line endings but instead leave them as they were before. This is impotant for Windows users as Python on Windows otherwise adds CRLF endings to the parameter files and they can't be correctly parsed by NuttX any more. --- Tools/px_romfs_pruner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/px_romfs_pruner.py b/Tools/px_romfs_pruner.py index aef1cc7a3b..78e4e69f72 100644 --- a/Tools/px_romfs_pruner.py +++ b/Tools/px_romfs_pruner.py @@ -76,7 +76,7 @@ def main(): pruned_content += line # overwrite old scratch file - with open(file_path, "w") as f: + with open(file_path, "wb") as f: f.write(pruned_content) From 21fadb9ea3e615f9d809ba41eb56ab9613485005 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 2 Oct 2015 11:04:32 +0200 Subject: [PATCH 264/389] Add distclean target --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 387199e34b..4d753670f7 100644 --- a/Makefile +++ b/Makefile @@ -139,7 +139,15 @@ sitl_ros: all: px4fmu-v2_default clean: - rm -rf build_*/ + @rm -rf build_*/ + +distclean: clean + @cd NuttX + @git clean -d -f -x + @cd .. + @cd src/lib/uavcan + @git clean -d -f -x + @cd ../../.. # targets handled by cmake cmake_targets = test upload package package_source debug debug_io check_weak From 068dd7676329473f3c648986ae5b1b136f5470e9 Mon Sep 17 00:00:00 2001 From: v01d Date: Sun, 20 Sep 2015 18:17:19 -0300 Subject: [PATCH 265/389] simulator: add publishing of HIL_OPTICAL_FLOW as uORB topic --- src/modules/simulator/simulator.h | 3 ++ src/modules/simulator/simulator_mavlink.cpp | 45 ++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/modules/simulator/simulator.h b/src/modules/simulator/simulator.h index af4b8a746c..5d8eedac2d 100644 --- a/src/modules/simulator/simulator.h +++ b/src/modules/simulator/simulator.h @@ -51,6 +51,7 @@ #include #include #include +#include #include #include namespace simulator { @@ -255,11 +256,13 @@ private: orb_advert_t _baro_pub; orb_advert_t _gyro_pub; orb_advert_t _mag_pub; + orb_advert_t _flow_pub; bool _initialized; // class methods int publish_sensor_topics(mavlink_hil_sensor_t *imu); + int publish_flow_topic(mavlink_hil_optical_flow_t *flow); #ifndef __PX4_QURT // uORB publisher handlers diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index ddbc79db76..a7c4d02f5e 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -229,6 +229,14 @@ void Simulator::handle_message(mavlink_message_t *msg, bool publish) { update_sensors(&imu); break; + case MAVLINK_MSG_ID_HIL_OPTICAL_FLOW: + mavlink_hil_optical_flow_t flow; + mavlink_msg_hil_optical_flow_decode(msg, &flow); + if (publish) { + publish_flow_topic(&flow); + } + break; + case MAVLINK_MSG_ID_HIL_GPS: mavlink_hil_gps_t gps_sim; mavlink_msg_hil_gps_decode(msg, &gps_sim); @@ -708,5 +716,40 @@ int Simulator::publish_sensor_topics(mavlink_hil_sensor_t *imu) { } } - return OK; + return OK; +} + +int Simulator::publish_flow_topic(mavlink_hil_optical_flow_t* flow_mavlink) +{ + uint64_t timestamp = hrt_absolute_time(); + + /* gyro */ + { + struct optical_flow_s flow; + memset(&flow, 0, sizeof(flow)); + + flow.sensor_id = flow_mavlink->sensor_id; + flow.timestamp = timestamp; + flow.time_since_last_sonar_update = 0; + flow.frame_count_since_last_readout = 0; // ? + flow.integration_timespan = flow_mavlink->integration_time_us; + + flow.ground_distance_m = flow_mavlink->distance; + flow.gyro_temperature = flow_mavlink->temperature; + flow.gyro_x_rate_integral = flow_mavlink->integrated_xgyro; + flow.gyro_y_rate_integral = flow_mavlink->integrated_ygyro; + flow.gyro_z_rate_integral = flow_mavlink->integrated_zgyro; + flow.pixel_flow_x_integral = flow_mavlink->integrated_x; + flow.pixel_flow_x_integral = flow_mavlink->integrated_y; + flow.quality = flow_mavlink->quality; + + if (_flow_pub == nullptr) { + _flow_pub = orb_advertise(ORB_ID(optical_flow), &flow); + + } else { + orb_publish(ORB_ID(optical_flow), _flow_pub, &flow); + } + } + + return OK; } From 2a1d83885145d2df7efea6783cc4862c8e211a37 Mon Sep 17 00:00:00 2001 From: v01d Date: Sun, 20 Sep 2015 18:31:18 -0300 Subject: [PATCH 266/389] always publish flow (no low-level sensor interface implemented yet) --- src/modules/simulator/simulator_mavlink.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index a7c4d02f5e..82dc7217b4 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -232,9 +232,7 @@ void Simulator::handle_message(mavlink_message_t *msg, bool publish) { case MAVLINK_MSG_ID_HIL_OPTICAL_FLOW: mavlink_hil_optical_flow_t flow; mavlink_msg_hil_optical_flow_decode(msg, &flow); - if (publish) { - publish_flow_topic(&flow); - } + publish_flow_topic(&flow); break; case MAVLINK_MSG_ID_HIL_GPS: From 645a7df6b940cf26a077c81f6d31a36a9f2c02e9 Mon Sep 17 00:00:00 2001 From: v01d Date: Sun, 20 Sep 2015 18:58:04 -0300 Subject: [PATCH 267/389] add OPTICAL_FLOW_RAD mavlink stream for SITL --- posix-configs/SITL/init/rcS | 1 + 1 file changed, 1 insertion(+) diff --git a/posix-configs/SITL/init/rcS b/posix-configs/SITL/init/rcS index b340096721..11b1af9a9a 100644 --- a/posix-configs/SITL/init/rcS +++ b/posix-configs/SITL/init/rcS @@ -53,5 +53,6 @@ mavlink stream -r 80 -s ATTITUDE -u 14556 mavlink stream -r 80 -s ATTITUDE_TARGET -u 14556 mavlink stream -r 20 -s RC_CHANNELS -u 14556 mavlink stream -r 250 -s HIGHRES_IMU -u 14556 +mavlink stream -r 10 -s OPTICAL_FLOW_RAD -u 14556 mavlink boot_complete sdlog2 start -r 100 -e -t -a From 4154ab4e2629a1ebfa0802b624223b97a375d52d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 10:03:50 +0200 Subject: [PATCH 268/389] Include named value float --- src/modules/mavlink/mavlink_main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 95ed3e8f64..ca5cf307e5 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1644,6 +1644,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("GPS_RAW_INT", 1.0f); configure_stream("GLOBAL_POSITION_INT", 3.0f); configure_stream("LOCAL_POSITION_NED", 3.0f); + configure_stream("NAMED_VALUE_FLOAT", 2.0f); configure_stream("RC_CHANNELS", 1.0f); configure_stream("SERVO_OUTPUT_RAW_0", 1.0f); configure_stream("POSITION_TARGET_GLOBAL_INT", 3.0f); @@ -1660,6 +1661,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("GPS_RAW_INT", 5.0f); configure_stream("GLOBAL_POSITION_INT", 50.0f); configure_stream("LOCAL_POSITION_NED", 30.0f); + configure_stream("NAMED_VALUE_FLOAT", 10.0f); configure_stream("CAMERA_CAPTURE", 2.0f); configure_stream("HOME_POSITION", 0.5f); configure_stream("ATTITUDE_TARGET", 10.0f); @@ -1701,7 +1703,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("ATTITUDE_TARGET", 8.0f); configure_stream("PARAM_VALUE", 300.0f); configure_stream("MISSION_ITEM", 50.0f); - configure_stream("NAMED_VALUE_FLOAT", 10.0f); + configure_stream("NAMED_VALUE_FLOAT", 50.0f); configure_stream("OPTICAL_FLOW_RAD", 10.0f); configure_stream("DISTANCE_SENSOR", 10.0f); configure_stream("VFR_HUD", 20.0f); From df133ae4fc8caf31072a8d5ae56fd1d731d8c850 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 12:47:55 +0200 Subject: [PATCH 269/389] Remove filter enable param --- .../attitude_estimator_ekf_params.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c index 30eb2a96e0..31496bd0c6 100755 --- a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c +++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c @@ -95,19 +95,6 @@ PARAM_DEFINE_FLOAT(EKF_ATT_V4_R1, 10000.0f); */ PARAM_DEFINE_FLOAT(EKF_ATT_V4_R2, 100.0f); -/** - * EKF attitude estimator enabled - * - * If enabled, it uses the older EKF filter. - * However users can enable the new quaternion - * based complimentary filter by setting EKF_ATT_ENABLED = 0. - * - * @min 0 - * @max 1 - * @group Attitude EKF estimator - */ -PARAM_DEFINE_INT32(EKF_ATT_ENABLED, 1); - /** * Moment of inertia matrix diagonal entry (1, 1) * From eef07b7fd2c76f60ff580dcd38aa9433a8f30854 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 12:48:51 +0200 Subject: [PATCH 270/389] Remove outdated filter version check --- ROMFS/px4fmu_common/init.d/rc.mc_apps | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.mc_apps b/ROMFS/px4fmu_common/init.d/rc.mc_apps index 914807889f..1dfe6c09bc 100644 --- a/ROMFS/px4fmu_common/init.d/rc.mc_apps +++ b/ROMFS/px4fmu_common/init.d/rc.mc_apps @@ -9,18 +9,7 @@ # filter by setting INAV_ENABLED = 0 if param compare INAV_ENABLED 1 then - # The system is defaulting to EKF_ATT_ENABLED = 1 - # and uses the older EKF filter. However users can - # enable the new quaternion based complimentary - # filter by setting EKF_ATT_ENABLED = 0. - # Note that on FMUv1, the EKF att estimator is not - # available and the Q estimator runs instead. - if param compare EKF_ATT_ENABLED 1 - then - attitude_estimator_ekf start - else - attitude_estimator_q start - fi + attitude_estimator_q start position_estimator_inav start else ekf_att_pos_estimator start From c62b9491cadf459b8a6b620f0293919c28eda001 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sat, 3 Oct 2015 13:50:07 +0300 Subject: [PATCH 271/389] Reverted 0e10638c7e0d43c6ed4d608ee418e759b0b77202 --- ROMFS/px4fmu_common/init.d/rcS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 8e7df42743..f14dd3015d 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -365,11 +365,6 @@ then then fi - # - # UAVCAN - # - sh /etc/init.d/rc.uavcan - # # Sensors System (start before Commander so Preflight checks are properly run) # @@ -576,6 +571,11 @@ then fi fi + # + # UAVCAN + # + sh /etc/init.d/rc.uavcan + # # Logging # From 73e83a503ca4b18df5f254ff81bb0d5dd7fe4cd4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 13:00:37 +0200 Subject: [PATCH 272/389] NuttX configs: Reduce buffer sizes where reasonable --- nuttx-configs/px4fmu-v1/nsh/defconfig | 10 +++++----- nuttx-configs/px4fmu-v2/nsh/defconfig | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nuttx-configs/px4fmu-v1/nsh/defconfig b/nuttx-configs/px4fmu-v1/nsh/defconfig index 874615d3b2..9692a854bc 100644 --- a/nuttx-configs/px4fmu-v1/nsh/defconfig +++ b/nuttx-configs/px4fmu-v1/nsh/defconfig @@ -420,7 +420,7 @@ CONFIG_PREALLOC_TIMERS=50 # Stack and heap information # CONFIG_IDLETHREAD_STACKSIZE=1000 -CONFIG_USERMAIN_STACKSIZE=3000 +CONFIG_USERMAIN_STACKSIZE=2500 CONFIG_PTHREAD_STACK_MIN=512 CONFIG_PTHREAD_STACK_DEFAULT=2048 @@ -518,8 +518,8 @@ CONFIG_USART1_2STOP=0 # # USART2 Configuration # -CONFIG_USART2_RXBUFSIZE=512 -CONFIG_USART2_TXBUFSIZE=512 +CONFIG_USART2_RXBUFSIZE=300 +CONFIG_USART2_TXBUFSIZE=300 CONFIG_USART2_BAUD=57600 CONFIG_USART2_BITS=8 CONFIG_USART2_PARITY=0 @@ -586,8 +586,8 @@ CONFIG_CDCACM_EPBULKIN_HSSIZE=512 CONFIG_CDCACM_NWRREQS=4 CONFIG_CDCACM_NRDREQS=4 CONFIG_CDCACM_BULKIN_REQLEN=96 -CONFIG_CDCACM_RXBUFSIZE=512 -CONFIG_CDCACM_TXBUFSIZE=2048 +CONFIG_CDCACM_RXBUFSIZE=300 +CONFIG_CDCACM_TXBUFSIZE=1800 CONFIG_CDCACM_VENDORID=0x26ac CONFIG_CDCACM_PRODUCTID=0x0010 CONFIG_CDCACM_VENDORSTR="3D Robotics" diff --git a/nuttx-configs/px4fmu-v2/nsh/defconfig b/nuttx-configs/px4fmu-v2/nsh/defconfig index 8f6af5d6b4..db7c41dae0 100644 --- a/nuttx-configs/px4fmu-v2/nsh/defconfig +++ b/nuttx-configs/px4fmu-v2/nsh/defconfig @@ -455,7 +455,7 @@ CONFIG_PREALLOC_TIMERS=50 # Stack and heap information # CONFIG_IDLETHREAD_STACKSIZE=1000 -CONFIG_USERMAIN_STACKSIZE=3000 +CONFIG_USERMAIN_STACKSIZE=2500 CONFIG_PTHREAD_STACK_MIN=512 CONFIG_PTHREAD_STACK_DEFAULT=2048 From 7b55f9d1f24502296c6767d658f4496f38721edb Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 13:00:55 +0200 Subject: [PATCH 273/389] FMU driver: Naming and stack cleanup --- src/drivers/px4fmu/fmu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index 3db4fb5e13..a0628283c0 100644 --- a/src/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp @@ -255,7 +255,7 @@ PX4FMU *g_fmu; } // namespace PX4FMU::PX4FMU() : - CDev("fmuservo", PX4FMU_DEVICE_PATH), + CDev("fmu", PX4FMU_DEVICE_PATH), _mode(MODE_NONE), _pwm_default_rate(50), _pwm_alt_rate(50), @@ -355,7 +355,7 @@ PX4FMU::init() _task = px4_task_spawn_cmd("fmuservo", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT, - 1200, + 900, (main_t)&PX4FMU::task_main_trampoline, nullptr); From 1df116612797fcd47ab8d76e22daeec23a25fee3 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 13:01:12 +0200 Subject: [PATCH 274/389] IO driver: Naming and stack cleanup --- src/drivers/px4io/px4io.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 507211caad..3c7c0d2994 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -868,7 +868,7 @@ PX4IO::init() _task = px4_task_spawn_cmd("px4io", SCHED_DEFAULT, SCHED_PRIORITY_ACTUATOR_OUTPUTS, - 1800, + 1500, (main_t)&PX4IO::task_main_trampoline, nullptr); From e0702ce48d25a57336ef987f8589210c1ac442ac Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 13:01:29 +0200 Subject: [PATCH 275/389] Commander: Build optimized for size --- src/modules/commander/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/commander/CMakeLists.txt b/src/modules/commander/CMakeLists.txt index 64954c6d69..aa8fd80fc1 100644 --- a/src/modules/commander/CMakeLists.txt +++ b/src/modules/commander/CMakeLists.txt @@ -42,6 +42,7 @@ px4_add_module( STACK 5000 COMPILE_FLAGS ${MODULE_CFLAGS} + -Os SRCS commander.cpp commander_params.c From 4f5e50396c774c5c3b76d721c1bf9a64d6195d1a Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 13:13:55 +0200 Subject: [PATCH 276/389] Sensors app: Stop the bad habit of params per board --- src/modules/sensors/sensor_params.c | 25 +------------------------ src/modules/sensors/sensors.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/modules/sensors/sensor_params.c b/src/modules/sensors/sensor_params.c index eba4d7077c..06f57a26a9 100644 --- a/src/modules/sensors/sensor_params.c +++ b/src/modules/sensors/sensor_params.c @@ -1807,36 +1807,13 @@ PARAM_DEFINE_INT32(RC_DSM_BIND, -1); */ PARAM_DEFINE_INT32(BAT_V_SCALE_IO, 10000); -#ifdef CONFIG_ARCH_BOARD_PX4FMU_V2 /** * Scaling factor for battery voltage sensor on FMU v2. * * @board CONFIG_ARCH_BOARD_PX4FMU_V2 * @group Battery Calibration */ -PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.0082f); -#elif CONFIG_ARCH_BOARD_AEROCORE -/** - * Scaling factor for battery voltage sensor on AeroCore. - * - * For R70 = 133K, R71 = 10K --> scale = 1.8 * 143 / (4096*10) = 0.0063 - * - * @board CONFIG_ARCH_BOARD_AEROCORE - * @group Battery Calibration - */ -PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.0063f); -#else -/** - * Scaling factor for battery voltage sensor on FMU v1. - * - * FMUv1 standalone: 1/(10 / (47+10)) * (3.3 / 4095) = 0.00459340659 - * FMUv1 with PX4IO: 0.00459340659 - * FMUv1 with PX4IOAR: (3.3f * 52.0f / 5.0f / 4095.0f) = 0.00838095238 - * - * @group Battery Calibration - */ -PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.00459340659f); -#endif +PARAM_DEFINE_FLOAT(BAT_V_SCALING, -1.0f); /** * Scaling factor for battery current sensor. diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index 43f10a80ff..2b275f6521 100644 --- a/src/modules/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -825,6 +825,16 @@ Sensors::parameters_update() /* scaling of ADC ticks to battery voltage */ if (param_get(_parameter_handles.battery_voltage_scaling, &(_parameters.battery_voltage_scaling)) != OK) { warnx("%s", paramerr); + } else if (_parameters.battery_voltage_scaling < 0.0f) { + /* apply scaling according to defaults if set to default */ + + #ifdef CONFIG_ARCH_BOARD_PX4FMU_V2 + _parameters.battery_voltage_scaling = 0.0082f; + #elif CONFIG_ARCH_BOARD_AEROCORE + _parameters.battery_voltage_scaling = 0.0063f; + #else + _parameters.battery_voltage_scaling = 0.00459340659f; + #endif } /* scaling of ADC ticks to battery current */ From d63231a23cdc4eb0b0a6539d7e78b1567d91524d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 13:17:26 +0200 Subject: [PATCH 277/389] sensors: Ensure safe batt scaling default exists --- src/modules/sensors/sensors.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index 2b275f6521..60e1a9aabb 100644 --- a/src/modules/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -832,8 +832,11 @@ Sensors::parameters_update() _parameters.battery_voltage_scaling = 0.0082f; #elif CONFIG_ARCH_BOARD_AEROCORE _parameters.battery_voltage_scaling = 0.0063f; - #else + #elif CONFIG_ARCH_BOARD_PX4FMU_V2 _parameters.battery_voltage_scaling = 0.00459340659f; + #else + /* ensure a missing default trips a low voltage lockdown */ + _parameters.battery_voltage_scaling = 0.00001f; #endif } From 6973023f5a8093b79f6350db838f2f9e2d0e57b8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 15:23:26 +0200 Subject: [PATCH 278/389] Attitude estimator Q: Raise vibration warning threshold --- src/modules/attitude_estimator_q/attitude_estimator_q_params.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/attitude_estimator_q/attitude_estimator_q_params.c b/src/modules/attitude_estimator_q/attitude_estimator_q_params.c index d4d9d10eb4..d72f62dc61 100644 --- a/src/modules/attitude_estimator_q/attitude_estimator_q_params.c +++ b/src/modules/attitude_estimator_q/attitude_estimator_q_params.c @@ -116,4 +116,4 @@ PARAM_DEFINE_FLOAT(ATT_BIAS_MAX, 0.05f); * @min 0.001 * @max 100 */ -PARAM_DEFINE_FLOAT(ATT_VIBE_THRESH, 0.1f); +PARAM_DEFINE_FLOAT(ATT_VIBE_THRESH, 0.2f); From 526bb51570b5e90881fd2884c3e83d3de65b7f06 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 15:24:24 +0200 Subject: [PATCH 279/389] Validation: Use error density instead of error count. Fail over to higher priority sensors once they become available. --- src/lib/ecl/validation/data_validator.cpp | 25 ++++++++-- src/lib/ecl/validation/data_validator.h | 10 +++- .../ecl/validation/data_validator_group.cpp | 49 ++++++++++++++----- src/lib/ecl/validation/data_validator_group.h | 1 + 4 files changed, 67 insertions(+), 18 deletions(-) diff --git a/src/lib/ecl/validation/data_validator.cpp b/src/lib/ecl/validation/data_validator.cpp index 037cb88645..737d9ea1a3 100644 --- a/src/lib/ecl/validation/data_validator.cpp +++ b/src/lib/ecl/validation/data_validator.cpp @@ -44,9 +44,10 @@ DataValidator::DataValidator(DataValidator *prev_sibling) : _time_last(0), - _timeout_interval(70000), + _timeout_interval(20000), _event_count(0), _error_count(0), + _error_density(0), _priority(0), _mean{0.0f}, _lp{0.0f}, @@ -68,6 +69,13 @@ void DataValidator::put(uint64_t timestamp, float val[3], uint64_t error_count_in, int priority_in) { _event_count++; + + if (error_count_in > _error_count) { + _error_density += (error_count_in - _error_count); + } else if (_error_density > 0) { + _error_density--; + } + _error_count = error_count_in; _priority = priority_in; @@ -123,7 +131,13 @@ DataValidator::confidence(uint64_t timestamp) return 0.0f; } - return 1.0f; + /* cap error density counter at window size */ + if (_error_density > ERROR_DENSITY_WINDOW) { + _error_density = ERROR_DENSITY_WINDOW; + } + + /* return local error density for last N measurements */ + return 1.0f - (_error_density / ERROR_DENSITY_WINDOW); } int @@ -136,12 +150,13 @@ void DataValidator::print() { if (_time_last == 0) { - ECL_INFO("\tno data\n"); + ECL_INFO("\tno data"); return; } for (unsigned i = 0; i < _dimensions; i++) { - ECL_INFO("\tval: %8.4f, lp: %8.4f mean dev: %8.4f RMS: %8.4f\n", - (double) _value[i], (double)_lp[i], (double)_mean[i], (double)_rms[i]); + ECL_INFO("\tval: %8.4f, lp: %8.4f mean dev: %8.4f RMS: %8.4f conf: %8.4f", + (double) _value[i], (double)_lp[i], (double)_mean[i], + (double)_rms[i], (double)confidence(hrt_absolute_time())); } } diff --git a/src/lib/ecl/validation/data_validator.h b/src/lib/ecl/validation/data_validator.h index 686a810c4e..dde9cb51aa 100644 --- a/src/lib/ecl/validation/data_validator.h +++ b/src/lib/ecl/validation/data_validator.h @@ -81,6 +81,12 @@ public: */ float* value() { return _value; } + /** + * Get the used status of this validator + * @return true if this validator ever saw data + */ + bool used() { return (_time_last > 0); } + /** * Get the priority of this validator * @return the stored priority @@ -112,6 +118,7 @@ private: uint64_t _timeout_interval; /**< interval in which the datastream times out in us */ uint64_t _event_count; /**< total data counter */ uint64_t _error_count; /**< error count */ + int _error_density; /**< ratio between successful reads and errors */ int _priority; /**< sensor nominal priority */ float _mean[_dimensions]; /**< mean of value */ float _lp[3]; /**< low pass value */ @@ -120,7 +127,8 @@ private: float _value[3]; /**< last value */ float _value_equal_count; /**< equal values in a row */ DataValidator *_sibling; /**< sibling in the group */ - const unsigned NORETURN_ERRCOUNT = 100; /**< if the error count reaches this value, return sensor as invalid */ + const unsigned NORETURN_ERRCOUNT = 10000; /**< if the error count reaches this value, return sensor as invalid */ + const float ERROR_DENSITY_WINDOW = 100.0f; /**< window in measurement counts for errors */ const unsigned VALUE_EQUAL_COUNT_MAX = 100; /**< if the sensor value is the same (accumulated also between axes) this many times, flag it */ /* we don't want this class to be copied */ diff --git a/src/lib/ecl/validation/data_validator_group.cpp b/src/lib/ecl/validation/data_validator_group.cpp index cdd1f6a677..e1ba53333e 100644 --- a/src/lib/ecl/validation/data_validator_group.cpp +++ b/src/lib/ecl/validation/data_validator_group.cpp @@ -97,24 +97,35 @@ DataValidatorGroup::get_best(uint64_t timestamp, int *index) // XXX This should eventually also include voting int pre_check_best = _curr_best; + float pre_check_confidence = 1.0f; + int pre_check_prio = -1; float max_confidence = -1.0f; int max_priority = -1000; int max_index = -1; - uint64_t min_error_count = 30000; DataValidator *best = nullptr; unsigned i = 0; while (next != nullptr) { float confidence = next->confidence(timestamp); - if (confidence > max_confidence || - (fabsf(confidence - max_confidence) < 0.01f && - ((next->error_count() < min_error_count) && - (next->priority() >= max_priority)))) { + + if (i == pre_check_best) { + pre_check_prio = next->priority(); + pre_check_confidence = confidence; + } + + /* + * Switch if: + * 1) the confidence is higher and priority is equal or higher + * 2) the confidence is no less than 1% different and the priority is higher + */ + if (((max_confidence < MIN_REGULAR_CONFIDENCE) && (confidence >= MIN_REGULAR_CONFIDENCE)) || + (confidence > max_confidence && (next->priority() >= max_priority)) || + (fabsf(confidence - max_confidence) < 0.01f && (next->priority() > max_priority)) + ) { max_index = i; max_confidence = confidence; max_priority = next->priority(); - min_error_count = next->error_count(); best = next; } @@ -125,17 +136,29 @@ DataValidatorGroup::get_best(uint64_t timestamp, int *index) /* the current best sensor is not matching the previous best sensor */ if (max_index != _curr_best) { + bool true_failsafe = true; + + /* check wether the switch was a failsafe or preferring a higher priority sensor */ + if (pre_check_prio != -1 && pre_check_prio < max_priority && + fabsf(pre_check_confidence - max_confidence) < 0.1f) { + /* this is not a failover */ + true_failsafe = false; + } + /* if we're no initialized, initialize the bookkeeping but do not count a failsafe */ if (_curr_best < 0) { _prev_best = max_index; } else { /* we were initialized before, this is a real failsafe */ _prev_best = pre_check_best; - _toggle_count++; - /* if this is the first time, log when we failed */ - if (_first_failover_time == 0) { - _first_failover_time = timestamp; + if (true_failsafe) { + _toggle_count++; + + /* if this is the first time, log when we failed */ + if (_first_failover_time == 0) { + _first_failover_time = timestamp; + } } } @@ -185,8 +208,10 @@ DataValidatorGroup::print() unsigned i = 0; while (next != nullptr) { - ECL_INFO("sensor #%u:\n", i); - next->print(); + if (next->used()) { + ECL_INFO("sensor #%u, prio: %d", i, next->priority()); + next->print(); + } next = next->sibling(); i++; } diff --git a/src/lib/ecl/validation/data_validator_group.h b/src/lib/ecl/validation/data_validator_group.h index f35e0d71c1..3756be2638 100644 --- a/src/lib/ecl/validation/data_validator_group.h +++ b/src/lib/ecl/validation/data_validator_group.h @@ -100,6 +100,7 @@ private: int _prev_best; /**< the previous best index */ uint64_t _first_failover_time; /**< timestamp where the first failover occured or zero if none occured */ unsigned _toggle_count; /**< number of back and forth switches between two sensors */ + static constexpr float MIN_REGULAR_CONFIDENCE = 0.9f; /* we don't want this class to be copied */ DataValidatorGroup(const DataValidatorGroup&); From 9625848c8a1ae84e1a7d398c281542200146a459 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 15:39:47 +0200 Subject: [PATCH 280/389] Data validator: Fix compile warning on signedness --- src/lib/ecl/validation/data_validator_group.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ecl/validation/data_validator_group.cpp b/src/lib/ecl/validation/data_validator_group.cpp index e1ba53333e..ac4bcc8b9b 100644 --- a/src/lib/ecl/validation/data_validator_group.cpp +++ b/src/lib/ecl/validation/data_validator_group.cpp @@ -109,7 +109,7 @@ DataValidatorGroup::get_best(uint64_t timestamp, int *index) while (next != nullptr) { float confidence = next->confidence(timestamp); - if (i == pre_check_best) { + if (static_cast(i) == pre_check_best) { pre_check_prio = next->priority(); pre_check_confidence = confidence; } From f984b566de11bb6ea0bef5001a013cc8e858ef21 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 15:40:24 +0200 Subject: [PATCH 281/389] sdlog2: Fix compile warnings --- src/modules/sdlog2/sdlog2.c | 58 ------------------------------------- 1 file changed, 58 deletions(-) diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index 6112bbce1a..fed68f1351 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -282,8 +282,6 @@ static int write_parameters(int fd); static bool file_exist(const char *filename); -static int file_copy(const char *file_old, const char *file_new); - /** * Check if there is still free space available */ @@ -1083,22 +1081,6 @@ int sdlog2_thread_main(int argc, char *argv[]) return 1; } -#if 0 - - // DEPRECATED - - /* copy conversion scripts */ - const char *converter_in = "/etc/logging/conv.zip"; - char *converter_out = malloc(64); - snprintf(converter_out, 64, "%s/conv.zip", log_root); - - if (file_copy(converter_in, converter_out) != OK) { - warn("unable to copy conversion scripts"); - } - - free(converter_out); -#endif - /* initialize log buffer with specified size */ warnx("log buffer size: %i bytes", log_buffer_size); @@ -1967,46 +1949,6 @@ bool file_exist(const char *filename) return stat(filename, &buffer) == 0; } -int file_copy(const char *file_old, const char *file_new) -{ - FILE *source, *target; - source = fopen(file_old, "r"); - int ret = 0; - - if (source == NULL) { - warnx("ERR: open in"); - return PX4_ERROR; - } - - target = fopen(file_new, "w"); - - if (target == NULL) { - fclose(source); - warnx("ERR: open out"); - return PX4_ERROR; - } - - char buf[128]; - int nread; - - while ((nread = fread(buf, 1, sizeof(buf), source)) > 0) { - ret = fwrite(buf, 1, nread, target); - - if (ret <= 0) { - warnx("error writing file"); - ret = PX4_ERROR; - break; - } - } - - fsync(fileno(target)); - - fclose(source); - fclose(target); - - return PX4_OK; -} - int check_free_space() { /* use statfs to determine the number of blocks left */ From ac7f177df4c1b17988352d7e83a2729f6b66356d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 15:39:47 +0200 Subject: [PATCH 282/389] Data validator: Fix compile warning on signedness --- src/lib/ecl/validation/data_validator_group.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ecl/validation/data_validator_group.cpp b/src/lib/ecl/validation/data_validator_group.cpp index e1ba53333e..ac4bcc8b9b 100644 --- a/src/lib/ecl/validation/data_validator_group.cpp +++ b/src/lib/ecl/validation/data_validator_group.cpp @@ -109,7 +109,7 @@ DataValidatorGroup::get_best(uint64_t timestamp, int *index) while (next != nullptr) { float confidence = next->confidence(timestamp); - if (i == pre_check_best) { + if (static_cast(i) == pre_check_best) { pre_check_prio = next->priority(); pre_check_confidence = confidence; } From 41f08f658daee3390e36f71298a458a34145f5c8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 17:24:47 +0200 Subject: [PATCH 283/389] IO v2: Move to the same file locations as for IOv1 --- src/drivers/boards/px4io-v2/{px4iov2_init.c => px4io_init.c} | 0 .../boards/px4io-v2/{px4iov2_pwm_servo.c => px4io_pwm_servo.c} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/drivers/boards/px4io-v2/{px4iov2_init.c => px4io_init.c} (100%) rename src/drivers/boards/px4io-v2/{px4iov2_pwm_servo.c => px4io_pwm_servo.c} (100%) diff --git a/src/drivers/boards/px4io-v2/px4iov2_init.c b/src/drivers/boards/px4io-v2/px4io_init.c similarity index 100% rename from src/drivers/boards/px4io-v2/px4iov2_init.c rename to src/drivers/boards/px4io-v2/px4io_init.c diff --git a/src/drivers/boards/px4io-v2/px4iov2_pwm_servo.c b/src/drivers/boards/px4io-v2/px4io_pwm_servo.c similarity index 100% rename from src/drivers/boards/px4io-v2/px4iov2_pwm_servo.c rename to src/drivers/boards/px4io-v2/px4io_pwm_servo.c From d0ca0ff8373e9a6e48af4bf51388faa289de6687 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 17:25:49 +0200 Subject: [PATCH 284/389] Added FMUv1 config --- Makefile | 3 + cmake/configs/nuttx_px4fmu-v1_default.cmake | 182 ++++++++++++++++++++ cmake/nuttx/px4_impl_nuttx.cmake | 24 ++- 3 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 cmake/configs/nuttx_px4fmu-v1_default.cmake diff --git a/Makefile b/Makefile index 4d753670f7..af8539f60f 100644 --- a/Makefile +++ b/Makefile @@ -75,6 +75,9 @@ endef # -------------------------------------------------------------------- # Do not put any spaces between function arguments. +px4fmu-v1_default: + $(call cmake-build,nuttx_px4fmu-v1_default) + px4fmu-v2_default: $(call cmake-build,nuttx_px4fmu-v2_default) diff --git a/cmake/configs/nuttx_px4fmu-v1_default.cmake b/cmake/configs/nuttx_px4fmu-v1_default.cmake new file mode 100644 index 0000000000..8e485a21b7 --- /dev/null +++ b/cmake/configs/nuttx_px4fmu-v1_default.cmake @@ -0,0 +1,182 @@ +include(nuttx/px4_impl_nuttx) + +set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake) + +set(config_module_list + # + # Board support modules + # + drivers/device + drivers/stm32 + drivers/stm32/adc + drivers/stm32/tone_alarm + drivers/led + drivers/px4fmu + drivers/px4io + drivers/boards/px4fmu-v1 + drivers/ardrone_interface + drivers/rgbled + drivers/mpu6000 + drivers/lsm303d + drivers/l3gd20 + drivers/hmc5883 + drivers/ms5611 + drivers/mb12xx + drivers/sf0x + drivers/ll40ls + drivers/trone + drivers/gps + drivers/pwm_out_sim + drivers/hott + drivers/hott/hott_telemetry + drivers/hott/hott_sensors + drivers/blinkm + drivers/airspeed + drivers/ets_airspeed + drivers/meas_airspeed + drivers/frsky_telemetry + modules/sensors + drivers/mkblctrl + drivers/px4flow + + # + # System commands + # + systemcmds/bl_update + systemcmds/mixer + systemcmds/param + systemcmds/perf + systemcmds/pwm + systemcmds/esc_calib + systemcmds/reboot + systemcmds/top + systemcmds/config + systemcmds/nshterm + systemcmds/mtd + systemcmds/dumpfile + systemcmds/ver + + # + # General system control + # + modules/commander + modules/navigator + modules/mavlink + modules/gpio_led + #modules/uavcan # have to fix CMakeLists.txt + modules/land_detector + + # + # Estimation modules (EKF/ SO3 / other filters) + # + # Too high RAM usage due to static allocations + # modules/attitude_estimator_ekf + modules/attitude_estimator_q + modules/ekf_att_pos_estimator + modules/position_estimator_inav + + # + # Vehicle Control + # + # modules/segway # XXX Needs GCC 4.7 fix + modules/fw_pos_control_l1 + modules/fw_att_control + modules/mc_att_control + modules/mc_pos_control + modules/vtol_att_control + + # + # Logging + # + modules/sdlog2 + + # + # Library modules + # + modules/param + modules/systemlib + modules/systemlib/mixer + modules/controllib + modules/uORB + modules/dataman + + # + # Libraries + # + #lib/mathlib/CMSIS + lib/mathlib + lib/mathlib/math/filter + lib/ecl + lib/external_lgpl + lib/geo + lib/geo_lookup + lib/conversion + lib/launchdetection + platforms/nuttx + + # had to add for cmake, not sure why wasn't in original config + platforms/common + platforms/nuttx/px4_layer + + # + # OBC challenge + # + modules/bottle_drop + + # + # Rover apps + # + examples/rover_steering_control + + # + # Demo apps + # + #examples/math_demo + # Tutorial code from + # https://px4.io/dev/px4_simple_app + #examples/px4_simple_app + + # Tutorial code from + # https://px4.io/dev/daemon + #examples/px4_daemon_app + + # Tutorial code from + # https://px4.io/dev/debug_values + #examples/px4_mavlink_debug + + # Tutorial code from + # https://px4.io/dev/example_fixedwing_control + #examples/fixedwing_control + + # Hardware test + #examples/hwtest +) + +set(config_firmware_options + PARAM_XML # generate param xml + ) + +set(config_extra_builtin_cmds + serdis + sercon + ) + +set(config_io_board + px4io-v1 + ) + +set(config_extra_libs + ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a + ) + +set(config_io_extra_libs + #${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM3l_math.a + ) + +add_custom_target(sercon) +set_target_properties(sercon PROPERTIES + MAIN "sercon" STACK "2048") + +add_custom_target(serdis) +set_target_properties(serdis PROPERTIES + MAIN "serdis" STACK "2048") diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index ca46ea13f8..add952a49b 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -455,7 +455,7 @@ function(px4_os_add_flags) set(added_exe_linker_flags) # none currently set(cpu_flags) - if (${BOARD} STREQUAL "px4fmu-v2") + if (${BOARD} STREQUAL "px4fmu-v1") set(cpu_flags -mcpu=cortex-m4 -mthumb @@ -463,6 +463,28 @@ function(px4_os_add_flags) -mfpu=fpv4-sp-d16 -mfloat-abi=hard ) + elseif (${BOARD} STREQUAL "px4fmu-v2") + set(cpu_flags + -mcpu=cortex-m4 + -mthumb + -march=armv7e-m + -mfpu=fpv4-sp-d16 + -mfloat-abi=hard + ) + elseif (${BOARD} STREQUAL "aerocore") + set(cpu_flags + -mcpu=cortex-m4 + -mthumb + -march=armv7e-m + -mfpu=fpv4-sp-d16 + -mfloat-abi=hard + ) + elseif (${BOARD} STREQUAL "px4io-v1") + set(cpu_flags + -mcpu=cortex-m3 + -mthumb + -march=armv7-m + ) elseif (${BOARD} STREQUAL "px4io-v2") set(cpu_flags -mcpu=cortex-m3 From 1ab23739ad57b51c42ef8eb5e5ffb9de70106635 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 17:26:04 +0200 Subject: [PATCH 285/389] IOv1: Error handling pointer hackery --- nuttx-configs/px4io-v1/scripts/ld.script | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nuttx-configs/px4io-v1/scripts/ld.script b/nuttx-configs/px4io-v1/scripts/ld.script index 69c2f9cb2e..1a73b432c1 100755 --- a/nuttx-configs/px4io-v1/scripts/ld.script +++ b/nuttx-configs/px4io-v1/scripts/ld.script @@ -72,6 +72,11 @@ SECTIONS *(.gcc_except_table) *(.gnu.linkonce.r.*) _etext = ABSOLUTE(.); + /* + * This is a hack to make the newlib libm __errno() call + * use the NuttX get_errno_ptr() function. + */ + __errno = get_errno_ptr; } > flash /* From d656aeb14fa8ce7bb453c8c7f34c6c9aab88312e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 17:26:23 +0200 Subject: [PATCH 286/389] FMUv1: Math exception hackery --- src/drivers/boards/px4fmu-v1/px4fmu_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/drivers/boards/px4fmu-v1/px4fmu_init.c b/src/drivers/boards/px4fmu-v1/px4fmu_init.c index 2b2b5ccd7a..b0e741017e 100644 --- a/src/drivers/boards/px4fmu-v1/px4fmu_init.c +++ b/src/drivers/boards/px4fmu-v1/px4fmu_init.c @@ -145,6 +145,7 @@ static struct spi_dev_s *spi3; #include +#if 0 #ifdef __cplusplus __EXPORT int matherr(struct __exception *e) { @@ -156,6 +157,7 @@ __EXPORT int matherr(struct exception *e) return 1; } #endif +#endif __EXPORT int nsh_archinitialize(void) { From c8e75c98b0fbb5ff783621fdb7e44f8f0a0c36f8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Oct 2015 17:27:13 +0200 Subject: [PATCH 287/389] IO configs: Use same filenames for all versions --- src/modules/px4iofirmware/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/px4iofirmware/CMakeLists.txt b/src/modules/px4iofirmware/CMakeLists.txt index 43c59fb2db..7b4c5652c6 100644 --- a/src/modules/px4iofirmware/CMakeLists.txt +++ b/src/modules/px4iofirmware/CMakeLists.txt @@ -88,8 +88,8 @@ set(srcs ../../lib/rc/sumd.c ../../drivers/stm32/drv_hrt.c ../../drivers/stm32/drv_pwm_servo.c - ../../drivers/boards/${config_io_board}/px4iov2_init.c - ../../drivers/boards/${config_io_board}/px4iov2_pwm_servo.c + ../../drivers/boards/${config_io_board}/px4io_init.c + ../../drivers/boards/${config_io_board}/px4io_pwm_servo.c ) if(${config_io_board} STREQUAL "px4io-v1") From e1bb61837146f13a3437b12d87b58c456a1724b8 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 3 Oct 2015 14:51:12 -0400 Subject: [PATCH 288/389] Working on uavcan building. --- .gitmodules | 2 +- CMakeLists.txt | 15 +++- Makefile | 8 +- cmake/configs/nuttx_px4fmu-v1_default.cmake | 4 +- cmake/configs/nuttx_px4fmu-v2_default.cmake | 4 +- cmake/configs/nuttx_px4fmu-v2_simple.cmake | 2 +- cmake/configs/nuttx_sim_simple.cmake | 2 +- cmake/configs/posix_eagle_default.cmake | 2 +- cmake/configs/posix_eagle_hil.cmake | 2 +- cmake/configs/posix_eagle_release.cmake | 2 +- cmake/configs/posix_sitl_simple.cmake | 2 +- cmake/configs/qurt_eagle_hello.cmake | 2 +- cmake/configs/qurt_eagle_hil.cmake | 2 +- cmake/configs/qurt_eagle_muorb.cmake | 2 +- cmake/configs/qurt_eagle_release.cmake | 2 +- cmake/configs/qurt_eagle_test.cmake | 2 +- cmake/configs/qurt_eagle_travis.cmake | 2 +- src/firmware/nuttx/CMakeLists.txt | 2 + src/lib/uavcan | 2 +- src/modules/uavcan/CMakeLists.txt | 97 +++++++++++++-------- 20 files changed, 97 insertions(+), 61 deletions(-) diff --git a/.gitmodules b/.gitmodules index cb9a6ccf05..b290823398 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = git://github.com/PX4/NuttX.git [submodule "src/lib/uavcan"] path = src/lib/uavcan - url = git://github.com/UAVCAN/libuavcan.git + url = git://github.com/jgoppert/libuavcan.git [submodule "Tools/genmsg"] path = Tools/genmsg url = https://github.com/ros/genmsg.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e89031d85..5a5f8b4790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,6 +155,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(config_module "configs/${CONFIG}") include(${config_module}) +# cmake modules +include(ExternalProject) + # require px4 module interface set(px4_required_interface px4_os_prebuild_targets @@ -269,6 +272,17 @@ px4_generate_messages(TARGET msg_gen DEPENDS git_genmsg git_gencpp ) +#============================================================================= +# external projects +# + +set(ep_base ${CMAKE_BINARY_DIR}/external) +set_property(DIRECTORY PROPERTY EP_BASE ${ep_base}) + +# add external project install folders to build +link_directories(${ep_base}/Install/lib) +include_directories(${ep_base}/Install/include) + #============================================================================= # subdirectories # @@ -286,7 +300,6 @@ if (config_io_board) add_subdirectory(src/modules/px4iofirmware) endif() - #============================================================================= # generate git version # diff --git a/Makefile b/Makefile index af8539f60f..af93c31772 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,9 @@ # directory build_nuttx_px4fmu-v2_default and then call make # in that directory with the target upload. +# explicity set default build target +all: px4fmu-v2_default + # Parsing # -------------------------------------------------------------------- # assume 1st argument passed is the main target, the @@ -138,9 +141,6 @@ sitl_ros: # Other targets # -------------------------------------------------------------------- -# explicity set default build target -all: px4fmu-v2_default - clean: @rm -rf build_*/ @@ -153,7 +153,7 @@ distclean: clean @cd ../../.. # targets handled by cmake -cmake_targets = test upload package package_source debug debug_io check_weak +cmake_targets = test upload package package_source debug debug_io check_weak libuavcan $(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ)))) .PHONY: clean diff --git a/cmake/configs/nuttx_px4fmu-v1_default.cmake b/cmake/configs/nuttx_px4fmu-v1_default.cmake index 8e485a21b7..5cd4756519 100644 --- a/cmake/configs/nuttx_px4fmu-v1_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v1_default.cmake @@ -1,6 +1,6 @@ include(nuttx/px4_impl_nuttx) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-none-eabi.cmake) set(config_module_list # @@ -63,7 +63,7 @@ set(config_module_list modules/navigator modules/mavlink modules/gpio_led - #modules/uavcan # have to fix CMakeLists.txt + modules/uavcan modules/land_detector # diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 33fcf3bbb2..51bdf151a5 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -1,6 +1,6 @@ include(nuttx/px4_impl_nuttx) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-none-eabi.cmake) set(config_module_list # @@ -67,7 +67,7 @@ set(config_module_list modules/navigator modules/mavlink modules/gpio_led - #modules/uavcan # have to fix CMakeLists.txt + modules/uavcan modules/land_detector # diff --git a/cmake/configs/nuttx_px4fmu-v2_simple.cmake b/cmake/configs/nuttx_px4fmu-v2_simple.cmake index c9b054052b..b1708cfc22 100644 --- a/cmake/configs/nuttx_px4fmu-v2_simple.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_simple.cmake @@ -1,6 +1,6 @@ include(nuttx/px4_impl_nuttx) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-none-eabi.cmake) set(config_module_list # diff --git a/cmake/configs/nuttx_sim_simple.cmake b/cmake/configs/nuttx_sim_simple.cmake index c457431ad6..a00b781a75 100644 --- a/cmake/configs/nuttx_sim_simple.cmake +++ b/cmake/configs/nuttx_sim_simple.cmake @@ -2,7 +2,7 @@ include(nuttx/px4_impl_nuttx) message(WARNING "this is a work in progress and doesn't build yet") -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake) set(config_module_list #platforms/nuttx diff --git a/cmake/configs/posix_eagle_default.cmake b/cmake/configs/posix_eagle_default.cmake index b30dcef5e3..fc97e70918 100644 --- a/cmake/configs/posix_eagle_default.cmake +++ b/cmake/configs/posix_eagle_default.cmake @@ -1,6 +1,6 @@ include(posix/px4_impl_posix) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake index ee5feb6535..cae322edb9 100644 --- a/cmake/configs/posix_eagle_hil.cmake +++ b/cmake/configs/posix_eagle_hil.cmake @@ -5,7 +5,7 @@ if("${DSPAL_STUBS_ENABLE}" STREQUAL "") set(DSPAL_STUBS_ENABLE "1") endif() -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/posix_eagle_release.cmake b/cmake/configs/posix_eagle_release.cmake index ab930abea3..8e3bb26078 100644 --- a/cmake/configs/posix_eagle_release.cmake +++ b/cmake/configs/posix_eagle_release.cmake @@ -5,7 +5,7 @@ if("${DSPAL_STUBS_ENABLE}" STREQUAL "") set(DSPAL_STUBS_ENABLE "1") endif() -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/posix_sitl_simple.cmake b/cmake/configs/posix_sitl_simple.cmake index 9d520d72f0..90fc72ce1c 100644 --- a/cmake/configs/posix_sitl_simple.cmake +++ b/cmake/configs/posix_sitl_simple.cmake @@ -1,6 +1,6 @@ include(posix/px4_impl_posix) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake) set(config_module_list drivers/led diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index 5b38a70649..c127216681 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake index 6bb9e0cbc3..0b48820254 100644 --- a/cmake/configs/qurt_eagle_hil.cmake +++ b/cmake/configs/qurt_eagle_hil.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake index 6f4f12cf4d..492225aa40 100644 --- a/cmake/configs/qurt_eagle_muorb.cmake +++ b/cmake/configs/qurt_eagle_muorb.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_release.cmake b/cmake/configs/qurt_eagle_release.cmake index f80c87d5fb..494416ed4f 100644 --- a/cmake/configs/qurt_eagle_release.cmake +++ b/cmake/configs/qurt_eagle_release.cmake @@ -20,7 +20,7 @@ set(target_libraries ) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list # diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index 6f948d905c..b2935f1fda 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -1,6 +1,6 @@ include(qurt/px4_impl_qurt) -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index 20293830e2..3b4672a115 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -3,7 +3,7 @@ include(qurt/px4_impl_qurt) # Run a full link with build stubs to make sure qurt target isn't broken set(QURT_ENABLE_STUBS "1") -set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake) set(config_module_list drivers/device diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index bf50a33814..2b1562b762 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -40,6 +40,8 @@ target_link_libraries(firmware_nuttx ${module_libraries} ${config_extra_libs} ${link_libs} + libuavcan_stm32_driver.a + libuavcan.a -Wl,--end-group) add_custom_target(check_weak diff --git a/src/lib/uavcan b/src/lib/uavcan index 50dc08663a..0b0e7bc6cc 160000 --- a/src/lib/uavcan +++ b/src/lib/uavcan @@ -1 +1 @@ -Subproject commit 50dc08663af2d9b55eae0ccf5f07c63db0ee8907 +Subproject commit 0b0e7bc6cc7fa6ec22905f3a519190e24714205d diff --git a/src/modules/uavcan/CMakeLists.txt b/src/modules/uavcan/CMakeLists.txt index 7cd3ddbb01..5cdcdbe8ca 100644 --- a/src/modules/uavcan/CMakeLists.txt +++ b/src/modules/uavcan/CMakeLists.txt @@ -30,6 +30,64 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ + +# uavcan project +set(uavcan_c_flags ${c_flags}) +list(REMOVE_ITEM uavcan_c_flags -std=gnu++0x -D__CUSTOM_FILE_IO__) +set(uavcan_cxx_flags ${cxx_flags}) +list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -D__CUSTOM_FILE_IO__) +set(uavcan_deps git_uavcan) +set(uavcan_platform generic) + +set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) + +string(TOUPPER "${OS}" OS_UPPER) + +set(uavcan_definitions + -DUAVCAN_NO_ASSERTIONS + -DUAVCAN_STM32_NUM_IFACES=2 + -DUAVCAN_USE_EXTERNAL_SNPRINT + -DUAVCAN_MEM_POOL_BLOCK_SIZE=48 + -DUAVCAN_MAX_NETWORK_SIZE_HINT=16 + -DUAVCAN_STM32_TIMER_NUMBER=5 + -DUAVCAN_STM32_${OS_UPPER}=1 + -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 + ) +set(uavcan_extra_flags ${uavcan_definitions}) + +if (${OS} STREQUAL "nuttx") + set(uavcan_platform stm32) + list(APPEND uavcan_extra_flags + -I${nuttx_export_dir}/include + -I${nuttx_export_dir}/include/cxx + -I${nuttx_export_dir}/arch/chip + -I${nuttx_export_dir}/arch/common + ) + list(APPEND uavcan_deps nuttx_export_${BOARD}) +endif() + +list(APPEND uavcan_c_flags ${uavcan_extra_flags}) +list(APPEND uavcan_cxx_flags ${uavcan_extra_flags}) + +px4_join(OUT uavcan_c_flags LIST "${uavcan_c_flags}" GLUE " ") +px4_join(OUT uavcan_cxx_flags LIST "${uavcan_cxx_flags}" GLUE " ") + +externalproject_add(libuavcan + DEPENDS ${uavcan_deps} + UPDATE_COMMAND git submodule update --init + SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan + CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DUAVCAN_PLATFORM=${uavcan_platform} + -DUAVCAN_OS=${OS} + -DCMAKE_CXX_FLAGS=${uavcan_cxx_flags} + -DCMAKE_C_FLAGS=${uavcan_c_flags} + -DCMAKE_INSTALL_PREFIX=${ep_base}/Install +) + +string(TOUPPER ${OS} OS_UPPER) + +add_definitions(${uavcan_definitions}) + px4_add_module( MODULE modules__uavcan MAIN uavcan @@ -41,7 +99,6 @@ px4_add_module( # Main uavcan_main.cpp uavcan_servers.cpp - uavcan_clock.cpp uavcan_params.c # Actuators @@ -55,43 +112,7 @@ px4_add_module( DEPENDS platforms__common + libuavcan ) -# TODO convert rest of module.mk - -## -## libuavcan -## -#include $(PX4_LIB_DIR)uavcan/libuavcan/include.mk -## Use the relitive path to keep the genrated files in the BUILD_DIR -#SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_SRC)) -#INCLUDE_DIRS += $(LIBUAVCAN_INC) -## Since actual compiler mode is C++11, the library will default to UAVCAN_CPP11, but it will fail to compile -## because this platform lacks most of the standard library and STL. Hence we need to force C++03 mode. -#override EXTRADEFINES := $(EXTRADEFINES) \ -#-DUAVCAN_CPP_VERSION=UAVCAN_CPP03 \ -#-DUAVCAN_NO_ASSERTIONS \ -#-DUAVCAN_MEM_POOL_BLOCK_SIZE=48 \ -#-DUAVCAN_MAX_NETWORK_SIZE_HINT=16 - -## -## libuavcan drivers for STM32 -## -#include $(PX4_LIB_DIR)uavcan/libuavcan_drivers/stm32/driver/include.mk -## Use the relitive path to keep the genrated files in the BUILD_DIR -#SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_STM32_SRC)) -#INCLUDE_DIRS += $(LIBUAVCAN_STM32_INC) -#override EXTRADEFINES := $(EXTRADEFINES) -DUAVCAN_STM32_NUTTX -DUAVCAN_STM32_NUM_IFACES=2 - -## -## libuavcan drivers for posix -## -#include $(PX4_LIB_DIR)uavcan/libuavcan_drivers/posix/include.mk -#INCLUDE_DIRS += $(LIBUAVCAN_POSIX_INC) - -## -## Invoke DSDL compiler -## -#$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR))) -#INCLUDE_DIRS += dsdlc_generated ## vim: set noet ft=cmake fenc=utf-8 ff=unix : From 132bd6a6315f28bbd670b06a0a2bc3030272e988 Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Mon, 5 Oct 2015 10:34:09 -0400 Subject: [PATCH 289/389] Fix ordering of TECS energy labels in sdlog format, copy fields as laid out in struct --- src/modules/sdlog2/sdlog2.c | 4 ++-- src/modules/sdlog2/sdlog2_messages.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index 253949b26e..cd08f4a386 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -1860,11 +1860,11 @@ int sdlog2_thread_main(int argc, char *argv[]) log_msg.body.log_TECS.airspeedDerivativeSp = buf.tecs_status.airspeedDerivativeSp; log_msg.body.log_TECS.airspeedDerivative = buf.tecs_status.airspeedDerivative; log_msg.body.log_TECS.totalEnergyError = buf.tecs_status.totalEnergyError; - log_msg.body.log_TECS.energyDistributionError = buf.tecs_status.energyDistributionError; log_msg.body.log_TECS.totalEnergyRateError = buf.tecs_status.totalEnergyRateError; + log_msg.body.log_TECS.energyDistributionError = buf.tecs_status.energyDistributionError; log_msg.body.log_TECS.energyDistributionRateError = buf.tecs_status.energyDistributionRateError; - log_msg.body.log_TECS.throttle_integ = buf.tecs_status.throttle_integ; log_msg.body.log_TECS.pitch_integ = buf.tecs_status.pitch_integ; + log_msg.body.log_TECS.throttle_integ = buf.tecs_status.throttle_integ; log_msg.body.log_TECS.mode = (uint8_t)buf.tecs_status.mode; LOGBUFFER_WRITE_AND_COUNT(TECS); } diff --git a/src/modules/sdlog2/sdlog2_messages.h b/src/modules/sdlog2/sdlog2_messages.h index 7f77a58e7b..1f1b979288 100644 --- a/src/modules/sdlog2/sdlog2_messages.h +++ b/src/modules/sdlog2/sdlog2_messages.h @@ -545,7 +545,7 @@ static const struct log_format_s log_formats[] = { LOG_FORMAT(GS0B, "BBBBBBBBBBBBBBBB", "s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15"), LOG_FORMAT(GS1A, "BBBBBBBBBBBBBBBB", "s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15"), LOG_FORMAT(GS1B, "BBBBBBBBBBBBBBBB", "s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15"), - LOG_FORMAT(TECS, "ffffffffffffffB", "ASP,AF,FSP,F,AsSP,AsF,AsDSP,AsD,EE,EDE,ERE,EDRE,PtchI,ThrI,M"), + LOG_FORMAT(TECS, "ffffffffffffffB", "ASP,AF,FSP,F,AsSP,AsF,AsDSP,AsD,EE,ERE,EDE,EDRE,PtchI,ThrI,M"), LOG_FORMAT(WIND, "ffff", "X,Y,CovX,CovY"), LOG_FORMAT(ENCD, "qfqf", "cnt0,vel0,cnt1,vel1"), LOG_FORMAT(TSYN, "Q", "TimeOffset"), From 45a1583c3bdab2189258a8a9ea1d72514df79a1d Mon Sep 17 00:00:00 2001 From: James Goppert Date: Mon, 5 Oct 2015 17:16:30 -0400 Subject: [PATCH 290/389] Uavcan update. --- src/lib/uavcan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/uavcan b/src/lib/uavcan index 0b0e7bc6cc..86c3397b1b 160000 --- a/src/lib/uavcan +++ b/src/lib/uavcan @@ -1 +1 @@ -Subproject commit 0b0e7bc6cc7fa6ec22905f3a519190e24714205d +Subproject commit 86c3397b1b423eeed86f21c8b08c8acfbd5add96 From 62467a4cdd5bb706c5db25735bf3c9d5278fc3dc Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 10:51:19 +0200 Subject: [PATCH 291/389] Fix Mac OS X Travis, fix UAVCAN URL --- .gitmodules | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index b290823398..cb9a6ccf05 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = git://github.com/PX4/NuttX.git [submodule "src/lib/uavcan"] path = src/lib/uavcan - url = git://github.com/jgoppert/libuavcan.git + url = git://github.com/UAVCAN/libuavcan.git [submodule "Tools/genmsg"] path = Tools/genmsg url = https://github.com/ros/genmsg.git diff --git a/.travis.yml b/.travis.yml index 56f6891cdb..31f85ade3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -102,7 +102,7 @@ script: - echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r' - make px4fmu-v2_default test - echo -en 'travis_fold:end:script.4\\r' - - make px4fmu-v2_default package + #- make px4fmu-v2_default package #- make posix -j4 #- ccache -s #- echo -en 'travis_fold:end:script.1\\r' From b1a44877b3531fb9586fc0c692d772e704c65b8a Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 11:20:31 +0200 Subject: [PATCH 292/389] Remove unused makefiles to prevent confusion of downstream adopters --- makefiles/README.txt | 86 ---- makefiles/firmware.mk | 381 ------------------ makefiles/library.mk | 169 -------- makefiles/module.mk | 234 ----------- makefiles/nuttx/board_aerocore.mk | 11 - makefiles/nuttx/board_px4-stm32f4discovery.mk | 11 - makefiles/nuttx/board_px4fmu-v1.mk | 11 - makefiles/nuttx/board_px4fmu-v2.mk | 11 - makefiles/nuttx/board_px4io-v1.mk | 11 - makefiles/nuttx/board_px4io-v2.mk | 11 - makefiles/nuttx/config_aerocore_default.mk | 126 ------ .../config_px4-stm32f4discovery_default.mk | 92 ----- makefiles/nuttx/config_px4fmu-v1_default.mk | 159 -------- makefiles/nuttx/config_px4fmu-v2_default.mk | 182 --------- .../nuttx/config_px4fmu-v2_multiplatform.mk | 168 -------- makefiles/nuttx/config_px4fmu-v2_test.mk | 116 ------ makefiles/nuttx/config_px4io-v1_default.mk | 10 - makefiles/nuttx/config_px4io-v2_default.mk | 10 - makefiles/nuttx/firmware_nuttx.mk | 121 ------ makefiles/nuttx/gumstix-aerocore.cfg | 10 - makefiles/nuttx/nuttx.mk | 85 ---- makefiles/nuttx/nuttx_px4.mk | 89 ---- makefiles/nuttx/nuttx_romfs.mk | 163 -------- makefiles/nuttx/toolchain_gnu-arm-eabi.mk | 342 ---------------- makefiles/nuttx/upload.mk | 50 --- makefiles/posix-arm/board_eagle.mk | 11 - makefiles/posix-arm/config_eagle_adsp.mk | 57 --- makefiles/posix-arm/config_eagle_default.mk | 79 ---- makefiles/posix-arm/config_eagle_hil.mk | 88 ---- .../posix-arm/config_eagle_muorb_test.mk | 90 ----- makefiles/posix-arm/ld.script | 46 --- makefiles/posix-arm/posix-arm.mk | 40 -- .../toolchain_gnu-arm-linux-gnueabihf.mk | 305 -------------- .../posix/DISABLE_config_posix_muorb_test.mk | 78 ---- makefiles/posix/board_posix.mk | 12 - makefiles/posix/config_posix_sitl.mk | 107 ----- makefiles/posix/firmware_posix.mk | 56 --- makefiles/posix/ld.script | 46 --- makefiles/posix/posix.mk | 40 -- makefiles/posix/posix_elf.mk | 75 ---- makefiles/posix/toolchain_native.mk | 369 ----------------- .../qurt/DISABLE_config_qurt_muorb_test.mk | 77 ---- makefiles/qurt/board_qurt.mk | 11 - makefiles/qurt/config_qurt_adsp.mk | 87 ---- makefiles/qurt/config_qurt_default.mk | 83 ---- makefiles/qurt/config_qurt_hello.mk | 74 ---- makefiles/qurt/config_qurt_hil.mk | 84 ---- makefiles/qurt/config_qurt_muorb_test.mk | 80 ---- makefiles/qurt/firmware_qurt.mk | 62 --- makefiles/qurt/qurt.mk | 39 -- makefiles/qurt/qurt_eigen.patch | 17 - makefiles/qurt/qurt_elf.mk | 85 ---- makefiles/qurt/setup.sh | 48 --- makefiles/qurt/toolchain_hexagon.mk | 345 ---------------- makefiles/setup.mk | 110 ----- 55 files changed, 5360 deletions(-) delete mode 100644 makefiles/README.txt delete mode 100644 makefiles/firmware.mk delete mode 100644 makefiles/library.mk delete mode 100644 makefiles/module.mk delete mode 100644 makefiles/nuttx/board_aerocore.mk delete mode 100644 makefiles/nuttx/board_px4-stm32f4discovery.mk delete mode 100644 makefiles/nuttx/board_px4fmu-v1.mk delete mode 100644 makefiles/nuttx/board_px4fmu-v2.mk delete mode 100644 makefiles/nuttx/board_px4io-v1.mk delete mode 100644 makefiles/nuttx/board_px4io-v2.mk delete mode 100644 makefiles/nuttx/config_aerocore_default.mk delete mode 100644 makefiles/nuttx/config_px4-stm32f4discovery_default.mk delete mode 100644 makefiles/nuttx/config_px4fmu-v1_default.mk delete mode 100644 makefiles/nuttx/config_px4fmu-v2_default.mk delete mode 100644 makefiles/nuttx/config_px4fmu-v2_multiplatform.mk delete mode 100644 makefiles/nuttx/config_px4fmu-v2_test.mk delete mode 100644 makefiles/nuttx/config_px4io-v1_default.mk delete mode 100644 makefiles/nuttx/config_px4io-v2_default.mk delete mode 100644 makefiles/nuttx/firmware_nuttx.mk delete mode 100644 makefiles/nuttx/gumstix-aerocore.cfg delete mode 100644 makefiles/nuttx/nuttx.mk delete mode 100644 makefiles/nuttx/nuttx_px4.mk delete mode 100644 makefiles/nuttx/nuttx_romfs.mk delete mode 100644 makefiles/nuttx/toolchain_gnu-arm-eabi.mk delete mode 100644 makefiles/nuttx/upload.mk delete mode 100644 makefiles/posix-arm/board_eagle.mk delete mode 100644 makefiles/posix-arm/config_eagle_adsp.mk delete mode 100644 makefiles/posix-arm/config_eagle_default.mk delete mode 100644 makefiles/posix-arm/config_eagle_hil.mk delete mode 100644 makefiles/posix-arm/config_eagle_muorb_test.mk delete mode 100644 makefiles/posix-arm/ld.script delete mode 100644 makefiles/posix-arm/posix-arm.mk delete mode 100644 makefiles/posix-arm/toolchain_gnu-arm-linux-gnueabihf.mk delete mode 100644 makefiles/posix/DISABLE_config_posix_muorb_test.mk delete mode 100644 makefiles/posix/board_posix.mk delete mode 100644 makefiles/posix/config_posix_sitl.mk delete mode 100644 makefiles/posix/firmware_posix.mk delete mode 100644 makefiles/posix/ld.script delete mode 100644 makefiles/posix/posix.mk delete mode 100644 makefiles/posix/posix_elf.mk delete mode 100644 makefiles/posix/toolchain_native.mk delete mode 100644 makefiles/qurt/DISABLE_config_qurt_muorb_test.mk delete mode 100644 makefiles/qurt/board_qurt.mk delete mode 100644 makefiles/qurt/config_qurt_adsp.mk delete mode 100644 makefiles/qurt/config_qurt_default.mk delete mode 100644 makefiles/qurt/config_qurt_hello.mk delete mode 100644 makefiles/qurt/config_qurt_hil.mk delete mode 100644 makefiles/qurt/config_qurt_muorb_test.mk delete mode 100644 makefiles/qurt/firmware_qurt.mk delete mode 100644 makefiles/qurt/qurt.mk delete mode 100644 makefiles/qurt/qurt_eigen.patch delete mode 100644 makefiles/qurt/qurt_elf.mk delete mode 100755 makefiles/qurt/setup.sh delete mode 100644 makefiles/qurt/toolchain_hexagon.mk delete mode 100644 makefiles/setup.mk diff --git a/makefiles/README.txt b/makefiles/README.txt deleted file mode 100644 index 9578793957..0000000000 --- a/makefiles/README.txt +++ /dev/null @@ -1,86 +0,0 @@ -PX4 Build System -================ - -The files in this directory implement the PX4 runtime firmware build system -and configuration for the standard PX4 boards and software, in conjunction -with Makefile in the parent directory. - -../Makefile - - Top-level makefile for the PX4 build system. - This makefile supports building NuttX archives for the NuttX based - configurations, as well as supervising the building of all - of the defined PX4 firmware configurations. - - Try 'make help' in the parent directory for documentation. - -firmware.mk - - Manages the build for one specific firmware configuration. - See the comments at the top of this file for detailed documentation. - - Builds modules, builtin command lists and the ROMFS (if configured). - - This is the makefile directly used by external build systems; it can - be configured to compile modules both inside and outside the PX4 - source tree. When used in this mode, at least BOARD, MODULES and - CONFIG_FILE must be set. - -firmware_nuttx.mk - - Called by firmware.mk to build NuttX based firmware. - -firmware_posix.mk - - Called by firmware.mk to build POSIX (non-ROS) based firmware. - -module.mk - - Called by firmware.mk to build individual modules. - See the comments at the top of this file for detailed documentation. - - Not normally used other than by firmware.mk. - -nuttx.mk - - Called by ../Makefile to build or download the NuttX archives if - PX4_TARGET_OS is set to "nuttx". - -posix.mk - - Called by ../Makefile to set POSIX specific parameters if - PX4_TARGET_OS is set to "posix". - -upload.mk - - Called by ../Makefile to upload files to a target board. Can be used - by external build systems as well. (NuttX targets only) - -setup.mk - - Provides common path and tool definitions. Implements host - system-specific compatibility hacks. Sets PX4_TARGET_OS. - -board_.mk - - Board-specific configuration for . Typically sets - CONFIG_ARCH and then includes the toolchain definition for the board. - -config__.mk - - Parameters for a specific configuration on a specific board. - The board name is derived from the filename. Sets MODULES to select - source modules to be included in the configuration, may also set - ROMFS_ROOT to build a ROMFS and BUILTIN_COMMANDS to include non-module - commands (e.g. from NuttX) - -toolchain_.mk - - Provides macros used to compile and link source files. - Accepts EXTRADEFINES to add additional pre-processor symbol definitions, - EXTRACFLAGS, EXTRACXXFLAGS, EXTRAAFLAGS and EXTRALDFLAGS to pass - additional flags to the C compiler, C++ compiler, assembler and linker - respectively. - - Defines the COMPILE, COMPILEXX, ASSEMBLE, PRELINK, ARCHIVE and LINK - macros that are used elsewhere in the build system. diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk deleted file mode 100644 index b8c8d4a85b..0000000000 --- a/makefiles/firmware.mk +++ /dev/null @@ -1,381 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Generic Makefile for PX4 firmware images. -# -# Requires: -# -# BOARD -# Must be set to a board name known to the PX4 distribution (as -# we need a corresponding NuttX export archive to link with). -# -# Optional: -# -# MODULES -# Contains a list of module paths or path fragments used -# to find modules. The names listed here are searched in -# the following directories: -# -# $(MODULE_SEARCH_DIRS) -# WORK_DIR -# MODULE_SRC -# PX4_MODULE_SRC -# -# Application directories are expected to contain a module.mk -# file which provides build configuration for the module. See -# makefiles/module.mk for more details. -# -# BUILTIN_COMMANDS -# Contains a list of built-in commands not explicitly provided -# by modules / libraries. Each entry in this list is formatted -# as ... -# -# PX4_BASE: -# Points to a PX4 distribution. Normally determined based on the -# path to this file. -# -# CONFIG: -# Used when searching for the configuration file, and available -# to module Makefiles to select optional features. -# If not set, CONFIG_FILE must be set and CONFIG will be derived -# automatically from it. -# -# CONFIG_FILE: -# If set, overrides the configuration file search logic. Sets -# CONFIG to the name of the configuration file, strips any -# leading config_ prefix and any suffix. e.g. config_board_foo.mk -# results in CONFIG being set to 'board_foo'. -# -# WORK_DIR: -# Sets the directory in which the firmware will be built. Defaults -# to the directory 'build' under the directory containing the -# parent Makefile. -# -# -# MODULE_SEARCH_DIRS: -# Extra directories to search first for MODULES before looking in the -# usual places. -# - -################################################################################ -# Paths and configuration -################################################################################ - -# -# Work out where this file is, so we can find other makefiles in the -# same directory. -# -# If PX4_BASE wasn't set previously, work out what it should be -# and set it here now. -# -MK_DIR ?= $(dir $(firstword $(MAKEFILE_LIST))) -ifeq ($(PX4_BASE),) -export PX4_BASE := $(abspath $(MK_DIR)/..) -endif -$(info % PX4_BASE = $(PX4_BASE)) -ifneq ($(words $(PX4_BASE)),1) -$(error Cannot build when the PX4_BASE path contains one or more space characters.) -endif - -# -# Set a default target so that included makefiles or errors here don't -# cause confusion. -# -# XXX We could do something cute here with $(DEFAULT_GOAL) if it's not one -# of the maintenance targets and set CONFIG based on it. -# -all: firmware - -# -# Get path and tool config -# -include $(MK_DIR)/setup.mk - -# -# Locate the configuration file -# -ifneq ($(CONFIG_FILE),) -CONFIG := $(subst config_,,$(basename $(notdir $(CONFIG_FILE)))) -else -CONFIG_FILE := $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/config_$(CONFIG).mk) -endif -ifeq ($(CONFIG),) -$(error Missing configuration name or file (specify with CONFIG=)) -endif -export CONFIG -include $(CONFIG_FILE) -$(info % CONFIG = $(CONFIG)) - -# -# Sanity-check the BOARD variable and then get the board config. -# If BOARD was not set by the configuration, extract it automatically. -# -# The board config in turn will fetch the toolchain configuration. -# -ifeq ($(BOARD),) -BOARD := $(firstword $(subst _, ,$(CONFIG))) -endif -BOARD_FILE := $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/board_$(BOARD).mk) -ifeq ($(BOARD_FILE),) -$(error Config $(CONFIG) references board $(BOARD), but no board definition file found) -endif -export BOARD -export BOARD_FILE -include $(BOARD_FILE) -$(info % BOARD = $(BOARD)) - -# -# If WORK_DIR is not set, create a 'build' directory next to the -# parent Makefile. -# -PARENT_MAKEFILE := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) -ifeq ($(WORK_DIR),) -export WORK_DIR := $(dir $(PARENT_MAKEFILE))build/ -endif -$(info % WORK_DIR = $(WORK_DIR)) - -# -# Things that, if they change, might affect everything -# -GLOBAL_DEPS += $(MAKEFILE_LIST) - -# -# Extra things we should clean -# -EXTRA_CLEANS = - - -# -# Append the per-board driver directory to the header search path. -# -INCLUDE_DIRS += $(PX4_MODULE_SRC)drivers/boards/$(BOARD) - -################################################################################ -# External library includes -################################################################################ - -INCLUDE_DIRS += $(PX4_BASE)src/lib/eigen/ - -################################################################################ -# OS specific libraries and paths -################################################################################ - -include $(PX4_MK_DIR)/$(PX4_TARGET_OS)/$(PX4_TARGET_OS).mk - -################################################################################ -# Modules -################################################################################ - -# where to look for modules -MODULE_SEARCH_DIRS += $(WORK_DIR) $(MODULE_SRC) $(PX4_MODULE_SRC) - -# sort and unique the modules list -MODULES := $(sort $(MODULES)) - -# locate the first instance of a module by full path or by looking on the -# module search path -define MODULE_SEARCH - $(firstword $(abspath $(wildcard $(1)/module.mk)) \ - $(abspath $(foreach search_dir,$(MODULE_SEARCH_DIRS),$(wildcard $(search_dir)/$(1)/module.mk))) \ - MISSING_$1) -endef - -# make a list of module makefiles and check that we found them all -MODULE_MKFILES := $(foreach module,$(MODULES),$(call MODULE_SEARCH,$(module))) -MISSING_MODULES := $(subst MISSING_,,$(filter MISSING_%,$(MODULE_MKFILES))) -ifneq ($(MISSING_MODULES),) -$(error Cant find module(s): $(MISSING_MODULES)) -endif - -# Make a list of the object files we expect to build from modules -# Note that this path will typically contain a double-slash at the WORK_DIR boundary; this must be -# preserved as it is used below to get the absolute path for the module.mk file correct. -# -MODULE_OBJS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)module.pre.o) - -# rules to build module objects -.PHONY: $(MODULE_OBJS) -$(MODULE_OBJS): relpath = $(patsubst $(WORK_DIR)%,%,$@) -$(MODULE_OBJS): mkfile = $(patsubst %module.pre.o,%module.mk,$(relpath)) -$(MODULE_OBJS): workdir = $(@D) -$(MODULE_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) - $(Q) $(MKDIR) -p $(workdir) - $(Q) $(MAKE) -r -f $(PX4_MK_DIR)module.mk \ - --no-print-directory -C $(workdir) \ - MODULE_WORK_DIR=$(workdir) \ - MODULE_OBJ=$@ \ - MODULE_MK=$(mkfile) \ - MODULE_NAME=$(lastword $(subst /, ,$(workdir))) \ - module - -# make a list of phony clean targets for modules -MODULE_CLEANS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)/clean) - -# rules to clean modules -.PHONY: $(MODULE_CLEANS) -$(MODULE_CLEANS): relpath = $(patsubst $(WORK_DIR)%,%,$@) -$(MODULE_CLEANS): mkfile = $(patsubst %clean,%module.mk,$(relpath)) -$(MODULE_CLEANS): - @$(ECHO) %% cleaning using $(mkfile) - $(Q) $(MAKE) -r -f $(PX4_MK_DIR)module.mk \ - MODULE_WORK_DIR=$(dir $@) \ - MODULE_MK=$(mkfile) \ - clean - -################################################################################ -# Libraries -################################################################################ - -# where to look for libraries -LIBRARY_SEARCH_DIRS += $(WORK_DIR) $(MODULE_SRC) $(PX4_MODULE_SRC) - -# sort and unique the library list -LIBRARIES := $(sort $(LIBRARIES)) - -# locate the first instance of a library by full path or by looking on the -# library search path -define LIBRARY_SEARCH - $(firstword $(abspath $(wildcard $(1)/library.mk)) \ - $(abspath $(foreach search_dir,$(LIBRARY_SEARCH_DIRS),$(wildcard $(search_dir)/$(1)/library.mk))) \ - MISSING_$1) -endef - -# make a list of library makefiles and check that we found them all -LIBRARY_MKFILES := $(foreach library,$(LIBRARIES),$(call LIBRARY_SEARCH,$(library))) -MISSING_LIBRARIES := $(subst MISSING_,,$(filter MISSING_%,$(LIBRARY_MKFILES))) -ifneq ($(MISSING_LIBRARIES),) -$(error Cant find library(s): $(MISSING_LIBRARIES)) -endif - -# Make a list of the archive files we expect to build from libraries -# Note that this path will typically contain a double-slash at the WORK_DIR boundary; this must be -# preserved as it is used below to get the absolute path for the library.mk file correct. -# -LIBRARY_LIBS := $(foreach path,$(dir $(LIBRARY_MKFILES)),$(WORK_DIR)$(path)library.a) - -# rules to build module objects -.PHONY: $(LIBRARY_LIBS) -$(LIBRARY_LIBS): relpath = $(patsubst $(WORK_DIR)%,%,$@) -$(LIBRARY_LIBS): mkfile = $(patsubst %library.a,%library.mk,$(relpath)) -$(LIBRARY_LIBS): workdir = $(@D) -$(LIBRARY_LIBS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) - $(Q) $(MKDIR) -p $(workdir) - $(Q) $(MAKE) -r -f $(PX4_MK_DIR)library.mk \ - --no-print-directory -C $(workdir) \ - LIBRARY_WORK_DIR=$(workdir) \ - LIBRARY_LIB=$@ \ - LIBRARY_MK=$(mkfile) \ - LIBRARY_NAME=$(lastword $(subst /, ,$(workdir))) \ - library - -# make a list of phony clean targets for modules -LIBRARY_CLEANS := $(foreach path,$(dir $(LIBRARY_MKFILES)),$(WORK_DIR)$(path)/clean) - -# rules to clean modules -.PHONY: $(LIBRARY_CLEANS) -$(LIBRARY_CLEANS): relpath = $(patsubst $(WORK_DIR)%,%,$@) -$(LIBRARY_CLEANS): mkfile = $(patsubst %clean,%library.mk,$(relpath)) -$(LIBRARY_CLEANS): - @$(ECHO) %% cleaning using $(mkfile) - $(Q) $(MAKE) -r -f $(PX4_MK_DIR)library.mk \ - LIBRARY_WORK_DIR=$(dir $@) \ - LIBRARY_MK=$(mkfile) \ - clean - -################################################################################ -# ROMFS generation -################################################################################ -ifeq ($(PX4_TARGET_OS),nuttx) -include $(MK_DIR)/nuttx/nuttx_romfs.mk -endif - -################################################################################ -# Default SRCS generation -################################################################################ - -# -# If there are no SRCS, the build will fail; in that case, generate an empty -# source file. -# -ifeq ($(SRCS),) -EMPTY_SRC = $(WORK_DIR)empty.c -$(EMPTY_SRC): - $(Q) $(ECHO) '/* this is an empty file */' > $@ - -SRCS += $(EMPTY_SRC) -endif - -################################################################################ -# Build rules -################################################################################ - -# -# Object files we will generate from sources -# -OBJS := $(foreach src,$(SRCS),$(WORK_DIR)$(src).o) - -# -# SRCS -> OBJS rules -# - -$(OBJS): $(GLOBAL_DEPS) - -$(filter %.c.o,$(OBJS)): $(WORK_DIR)%.c.o: %.c $(GLOBAL_DEPS) - $(call COMPILE,$<,$@) - -$(filter %.cpp.o,$(OBJS)): $(WORK_DIR)%.cpp.o: %.cpp $(GLOBAL_DEPS) - $(call COMPILEXX,$<,$@) - -$(filter %.S.o,$(OBJS)): $(WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS) - $(call ASSEMBLE,$<,$@) - -# Include the OS specific build rules -# The rules must define the "firmware" make target -# - -ifeq ($(PX4_TARGET_OS),nuttx) -include $(MK_DIR)/nuttx/nuttx_px4.mk -endif -ifeq ($(PX4_TARGET_OS),posix) -include $(MK_DIR)/posix/posix_elf.mk -endif -ifeq ($(PX4_TARGET_OS),posix-arm) -include $(MK_DIR)/posix/posix_elf.mk -endif -ifeq ($(PX4_TARGET_OS),qurt) -include $(MK_DIR)/qurt/qurt_elf.mk -endif - -# -# DEP_INCLUDES is defined by the toolchain include in terms of $(OBJS) -# --include $(DEP_INCLUDES) diff --git a/makefiles/library.mk b/makefiles/library.mk deleted file mode 100644 index e20fcce941..0000000000 --- a/makefiles/library.mk +++ /dev/null @@ -1,169 +0,0 @@ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Framework makefile for PX4 libraries -# -# This makefile is invoked by firmware.mk to build each of the linraries -# that will subsequently be linked into the firmware image. -# -# Applications are built as standard ar archives. Unlike modules, -# all public symbols in library objects are visible across the entire -# firmware stack. -# -# In general, modules should be preferred to libraries when possible. -# Libraries may also be pre-built. -# -# IMPORTANT NOTE: -# -# This makefile assumes it is being invoked in the library's output directory. -# - -# -# Variables that can be set by the library's library.mk: -# -# -# SRCS (optional) -# -# Lists the .c, cpp and .S files that should be compiled/assembled to -# produce the library. -# -# PREBUILT_LIB (optional) -# -# Names the prebuilt library in the source directory that should be -# linked into the firmware. -# -# INCLUDE_DIRS (optional, must be appended, ignored if SRCS not set) -# -# The list of directories searched for include files. If non-standard -# includes (e.g. those from another module) are required, paths to search -# can be added here. -# -# - -# -# Variables visible to the library's library.mk: -# -# CONFIG -# BOARD -# LIBRARY_WORK_DIR -# LIBRARY_LIB -# LIBRARY_MK -# Anything set in setup.mk, board_$(BOARD).mk and the toolchain file. -# Anything exported from config_$(CONFIG).mk -# - -################################################################################ -# No user-serviceable parts below. -################################################################################ - -ifeq ($(LIBRARY_MK),) -$(error No library makefile specified) -endif -$(info %% LIBRARY_MK = $(LIBRARY_MK)) - -# -# Get the board/toolchain config -# -include $(PX4_MK_DIR)/$(PX4_TARGET_OS)/board_$(BOARD).mk - -# -# Get the library's config -# -include $(LIBRARY_MK) -LIBRARY_SRC := $(dir $(LIBRARY_MK)) -$(info % LIBRARY_NAME = $(LIBRARY_NAME)) -$(info % LIBRARY_SRC = $(LIBRARY_SRC)) -$(info % LIBRARY_LIB = $(LIBRARY_LIB)) -$(info % LIBRARY_WORK_DIR = $(LIBRARY_WORK_DIR)) - -# -# Things that, if they change, might affect everything -# -GLOBAL_DEPS += $(MAKEFILE_LIST) - -################################################################################ -# Build rules -################################################################################ - -# -# What we're going to build -# -library: $(LIBRARY_LIB) - -ifneq ($(PREBUILT_LIB),) - -VPATH = $(LIBRARY_SRC) -$(LIBRARY_LIB): $(PREBUILT_LIB) $(GLOBAL_DEPS) - @$(ECHO) "PREBUILT: $(PREBUILT_LIB)" - $(Q) $(COPY) $< $@ - -else - -## -## Object files we will generate from sources -## - -OBJS = $(addsuffix .o,$(SRCS)) - -# -# SRCS -> OBJS rules -# - -$(OBJS): $(GLOBAL_DEPS) - -vpath %.c $(LIBRARY_SRC) -$(filter %.c.o,$(OBJS)): %.c.o: %.c $(GLOBAL_DEPS) - $(call COMPILE,$<,$@) - -vpath %.cpp $(LIBRARY_SRC) -$(filter %.cpp.o,$(OBJS)): %.cpp.o: %.cpp $(GLOBAL_DEPS) - $(call COMPILEXX,$<,$@) - -vpath %.S $(LIBRARY_SRC) -$(filter %.S.o,$(OBJS)): %.S.o: %.S $(GLOBAL_DEPS) - $(call ASSEMBLE,$<,$@) - -# -# Built product rules -# - -$(LIBRARY_LIB): $(OBJS) $(GLOBAL_DEPS) - $(call ARCHIVE,$@,$(OBJS)) - -endif - -# -# Utility rules -# - -clean: - $(Q) $(REMOVE) $(LIBRARY_LIB) $(OBJS) diff --git a/makefiles/module.mk b/makefiles/module.mk deleted file mode 100644 index c92abaec3f..0000000000 --- a/makefiles/module.mk +++ /dev/null @@ -1,234 +0,0 @@ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Framework makefile for PX4 modules -# -# This makefile is invoked by firmware.mk to build each of the modules -# that will subsequently be linked into the firmware image. -# -# Modules are built as prelinked objects with a limited set of exported -# symbols, as the global namespace is shared between all modules. Normally an -# module will just export one or more _main functions. -# -# IMPORTANT NOTE: -# -# This makefile assumes it is being invoked in the module's output directory. -# - -# -# Variables that can be set by the module's module.mk: -# -# -# SRCS (required) -# -# Lists the .c, cpp and .S files that should be compiled/assembled to -# produce the module. -# -# MODULE_COMMAND (optional) -# MODULE_ENTRYPOINT (optional if MODULE_COMMAND is set) -# MODULE_STACKSIZE (optional if MODULE_COMMAND is set) -# MODULE_PRIORITY (optional if MODULE_COMMAND is set) -# -# Defines a single builtin command exported by the module. -# MODULE_COMMAND must be unique for any configuration, but need not be the -# same as the module directory name. -# -# If MODULE_ENTRYPOINT is set, it names the function (which must be exported) -# that will be the entrypoint for the builtin command. It defaults to -# $(MODULE_COMMAND)_main. -# -# If MODULE_STACKSIZE is set, it is the size in bytes of the stack to be -# allocated for the builtin command. If it is not set, it defaults -# to CONFIG_PTHREAD_STACK_DEFAULT. -# -# If MODULE_PRIORITY is set, it is the thread priority for the builtin -# command. If it is not set, it defaults to SCHED_PRIORITY_DEFAULT. -# -# MODULE_COMMANDS (optional if MODULE_COMMAND is not set) -# -# Defines builtin commands exported by the module. Each word in -# the list should be formatted as: -# ... -# -# INCLUDE_DIRS (optional, must be appended) -# -# The list of directories searched for include files. If non-standard -# includes (e.g. those from another module) are required, paths to search -# can be added here. -# -# DEFAULT_VISIBILITY (optional) -# -# If not set, global symbols defined in a module will not be visible -# outside the module. Symbols that should be globally visible must be -# marked __EXPORT. -# If set, global symbols defined in a module will be globally visible. -# - -# -# Variables visible to the module's module.mk: -# -# CONFIG -# BOARD -# BOARD_FILE -# MODULE_WORK_DIR -# MODULE_OBJ -# MODULE_MK -# Anything set in setup.mk, board_$(BOARD).mk and the toolchain file. -# Anything exported from config_$(CONFIG).mk -# - -################################################################################ -# No user-serviceable parts below. -################################################################################ - -ifeq ($(MODULE_MK),) -$(error No module makefile specified) -endif -ifeq ($(V),1) -$(info %% MODULE_MK = $(MODULE_MK)) -endif - -# -# Get the board/toolchain config -# -include $(BOARD_FILE) - -# -# Get the module's config -# -include $(MODULE_MK) -MODULE_SRC := $(dir $(MODULE_MK)) -ifeq ($(V),1) -$(info % MODULE_NAME = $(MODULE_NAME)) -$(info % MODULE_SRC = $(MODULE_SRC)) -$(info % MODULE_OBJ = $(MODULE_OBJ)) -$(info % MODULE_WORK_DIR = $(MODULE_WORK_DIR)) -endif - -# -# Things that, if they change, might affect everything -# -GLOBAL_DEPS += $(MAKEFILE_LIST) - -################################################################################ -# Builtin command definitions -################################################################################ - -ifneq ($(MODULE_COMMAND),) -MODULE_ENTRYPOINT ?= $(MODULE_COMMAND)_main -MODULE_STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT -MODULE_PRIORITY ?= SCHED_PRIORITY_DEFAULT -MODULE_COMMANDS += $(MODULE_COMMAND).$(MODULE_PRIORITY).$(MODULE_STACKSIZE).$(MODULE_ENTRYPOINT) -CXXFLAGS += -DPX4_MAIN=$(MODULE_COMMAND)_app_main -endif - -ifneq ($(MODULE_COMMANDS),) -MODULE_COMMAND_FILES := $(addprefix $(WORK_DIR)/builtin_commands/COMMAND.,$(MODULE_COMMANDS)) - -# Create the command files -# Ensure that there is only one entry for each command -# -.PHONY: $(MODULE_COMMAND_FILES) -$(MODULE_COMMAND_FILES): command = $(word 2,$(subst ., ,$(notdir $(@)))) -$(MODULE_COMMAND_FILES): exclude = $(dir $@)COMMAND.$(command).* -$(MODULE_COMMAND_FILES): $(GLOBAL_DEPS) - @$(REMOVE) -f $(exclude) - @$(MKDIR) -p $(dir $@) - @$(ECHO) "CMD: $(command)" - $(Q) $(TOUCH) $@ -endif - -################################################################################ -# Adjust compilation flags to implement EXPORT -################################################################################ - -ifeq ($(DEFAULT_VISIBILITY),) -DEFAULT_VISIBILITY = hidden -else -DEFAULT_VISIBILITY = default -endif - -CFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(PX4_INCLUDE_DIR)visibility.h -CXXFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(PX4_INCLUDE_DIR)visibility.h - -################################################################################ -# Build rules -################################################################################ - -# -# What we're going to build -# -module: $(MODULE_OBJ) $(MODULE_COMMAND_FILES) - -# -# Object files we will generate from sources -# -OBJS = $(addsuffix .o,$(SRCS)) - -# -# Dependency files that will be auto-generated -# -DEPS = $(addsuffix .d,$(SRCS)) - -# -# SRCS -> OBJS rules -# - -$(OBJS): $(GLOBAL_DEPS) - -vpath %.c $(MODULE_SRC) -$(filter %.c.o,$(OBJS)): %.c.o: %.c $(GLOBAL_DEPS) - $(call COMPILE,$<,$@) - -vpath %.cpp $(MODULE_SRC) -$(filter %.cpp.o,$(OBJS)): %.cpp.o: %.cpp $(GLOBAL_DEPS) - $(call COMPILEXX,$<,$@) - -vpath %.S $(MODULE_SRC) -$(filter %.S.o,$(OBJS)): %.S.o: %.S $(GLOBAL_DEPS) - $(call ASSEMBLE,$<,$@) - -# -# Built product rules -# - -$(MODULE_OBJ): $(OBJS) $(GLOBAL_DEPS) - $(call PRELINK,$@,$(OBJS)) - -# -# Utility rules -# - -clean: - $(Q) $(REMOVE) $(MODULE_PRELINK) $(OBJS) - --include $(DEPS) diff --git a/makefiles/nuttx/board_aerocore.mk b/makefiles/nuttx/board_aerocore.mk deleted file mode 100644 index 71a0f264d0..0000000000 --- a/makefiles/nuttx/board_aerocore.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -# Board-specific definitions for the Gumstix AeroCore -# - -# -# Configure the toolchain -# -CONFIG_ARCH = CORTEXM4F -CONFIG_BOARD = AEROCORE - -include $(PX4_MK_DIR)/nuttx/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/nuttx/board_px4-stm32f4discovery.mk b/makefiles/nuttx/board_px4-stm32f4discovery.mk deleted file mode 100644 index 2477f55858..0000000000 --- a/makefiles/nuttx/board_px4-stm32f4discovery.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -# Board-specific definitions for the PX4_STM32F4DISCOVERY -# - -# -# Configure the toolchain -# -CONFIG_ARCH = CORTEXM4F -CONFIG_BOARD = PX4_STM32F4DISCOVERY - -include $(PX4_MK_DIR)/nuttx/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/nuttx/board_px4fmu-v1.mk b/makefiles/nuttx/board_px4fmu-v1.mk deleted file mode 100644 index 45156efcdc..0000000000 --- a/makefiles/nuttx/board_px4fmu-v1.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -# Board-specific definitions for the PX4FMU -# - -# -# Configure the toolchain -# -CONFIG_ARCH = CORTEXM4F -CONFIG_BOARD = PX4FMU_V1 - -include $(PX4_MK_DIR)/nuttx/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/nuttx/board_px4fmu-v2.mk b/makefiles/nuttx/board_px4fmu-v2.mk deleted file mode 100644 index 7c3e00c5d0..0000000000 --- a/makefiles/nuttx/board_px4fmu-v2.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -# Board-specific definitions for the PX4FMUv2 -# - -# -# Configure the toolchain -# -CONFIG_ARCH = CORTEXM4F -CONFIG_BOARD = PX4FMU_V2 - -include $(PX4_MK_DIR)/nuttx/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/nuttx/board_px4io-v1.mk b/makefiles/nuttx/board_px4io-v1.mk deleted file mode 100644 index 66731a5694..0000000000 --- a/makefiles/nuttx/board_px4io-v1.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -# Board-specific definitions for the PX4IO -# - -# -# Configure the toolchain -# -CONFIG_ARCH = CORTEXM3 -CONFIG_BOARD = PX4IO_V1 - -include $(PX4_MK_DIR)/nuttx/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/nuttx/board_px4io-v2.mk b/makefiles/nuttx/board_px4io-v2.mk deleted file mode 100644 index 94c3318199..0000000000 --- a/makefiles/nuttx/board_px4io-v2.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -# Board-specific definitions for the PX4IOv2 -# - -# -# Configure the toolchain -# -CONFIG_ARCH = CORTEXM3 -CONFIG_BOARD = PX4IO_V2 - -include $(PX4_MK_DIR)/nuttx/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/nuttx/config_aerocore_default.mk b/makefiles/nuttx/config_aerocore_default.mk deleted file mode 100644 index ba6bcdccde..0000000000 --- a/makefiles/nuttx/config_aerocore_default.mk +++ /dev/null @@ -1,126 +0,0 @@ -# -# Makefile for the AeroCore *default* configuration -# - -# -# Use the configuration's ROMFS. -# -ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/stm32 -MODULES += drivers/stm32/adc -MODULES += drivers/stm32/tone_alarm -MODULES += drivers/led -MODULES += drivers/px4fmu -MODULES += drivers/boards/aerocore -MODULES += drivers/lsm303d -MODULES += drivers/l3gd20 -MODULES += drivers/ms5611 -MODULES += drivers/gps -MODULES += drivers/pwm_out_sim -MODULES += modules/sensors - -# -# System commands -# -MODULES += systemcmds/ver -MODULES += systemcmds/mixer -MODULES += systemcmds/param -MODULES += systemcmds/perf -MODULES += systemcmds/pwm -MODULES += systemcmds/esc_calib -MODULES += systemcmds/reboot -MODULES += systemcmds/top -MODULES += systemcmds/config -MODULES += systemcmds/nshterm -MODULES += systemcmds/mtd -MODULES += systemcmds/dumpfile - -# -# General system control -# -MODULES += modules/commander -MODULES += modules/navigator -MODULES += modules/mavlink - -# -# Estimation modules (EKF / other filters) -# -# Too high RAM usage due to static allocations -#MODULES += modules/attitude_estimator_ekf -MODULES += modules/ekf_att_pos_estimator -MODULES += modules/attitude_estimator_q -MODULES += modules/position_estimator_inav - -# -# Vehicle Control -# -MODULES += modules/fw_pos_control_l1 -MODULES += modules/fw_att_control -MODULES += modules/mc_att_control -MODULES += modules/mc_pos_control - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/controllib -MODULES += modules/uORB -MODULES += modules/dataman - -# -# Libraries -# -LIBRARIES += lib/mathlib/CMSIS -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/ecl -MODULES += lib/external_lgpl -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion -MODULES += lib/launchdetection - -# -# Demo apps -# -#MODULES += examples/math_demo -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/hello_sky -MODULES += examples/px4_simple_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/daemon -#MODULES += examples/px4_daemon_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/debug_values -#MODULES += examples/px4_mavlink_debug - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control -#MODULES += examples/fixedwing_control - -# Hardware test -#MODULES += examples/hwtest - -# -# Transitional support - add commands from the NuttX export archive. -# -# In general, these should move to modules over time. -# -# Each entry here is ... but we use a helper macro -# to make the table a bit more readable. -# -define _B - $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) -endef - -BUILTIN_COMMANDS := \ - $(call _B, hello, , 2048, hello_main) \ - $(call _B, i2c, , 2048, i2c_main) diff --git a/makefiles/nuttx/config_px4-stm32f4discovery_default.mk b/makefiles/nuttx/config_px4-stm32f4discovery_default.mk deleted file mode 100644 index 8f73a7f047..0000000000 --- a/makefiles/nuttx/config_px4-stm32f4discovery_default.mk +++ /dev/null @@ -1,92 +0,0 @@ -# -# Makefile for the px4fmu_default configuration -# - -# -# Use the configuration's ROMFS, copy the PX4_STM32F4DISCOVERY firmware into -# the ROMFS if it's available -# -ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common -ROMFS_OPTIONAL_FILES = - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/stm32 -MODULES += drivers/led -MODULES += drivers/boards/px4-stm32f4discovery - -# -# System commands -# -MODULES += systemcmds/bl_update -MODULES += systemcmds/mixer -MODULES += systemcmds/param -MODULES += systemcmds/perf -MODULES += systemcmds/reboot -MODULES += systemcmds/top -MODULES += systemcmds/tests -MODULES += systemcmds/config -MODULES += systemcmds/nshterm -MODULES += systemcmds/ver - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/controllib -MODULES += modules/uORB - -# -# Libraries -# -LIBRARIES += lib/mathlib/CMSIS -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/ecl -MODULES += lib/external_lgpl -MODULES += lib/geo -MODULES += lib/conversion -MODULES += platforms/nuttx - -# -# Demo apps -# -#MODULES += examples/math_demo -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/hello_sky -MODULES += examples/px4_simple_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/daemon -#MODULES += examples/px4_daemon_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/debug_values -#MODULES += examples/px4_mavlink_debug - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control -#MODULES += examples/fixedwing_control - -# Hardware test -#MODULES += examples/hwtest - -# -# Transitional support - add commands from the NuttX export archive. -# -# In general, these should move to modules over time. -# -# Each entry here is ... but we use a helper macro -# to make the table a bit more readable. -# -define _B - $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) -endef - -# command priority stack entrypoint -BUILTIN_COMMANDS := \ - $(call _B, sercon, , 2048, sercon_main ) \ - $(call _B, serdis, , 2048, serdis_main ) diff --git a/makefiles/nuttx/config_px4fmu-v1_default.mk b/makefiles/nuttx/config_px4fmu-v1_default.mk deleted file mode 100644 index d7915ee8d0..0000000000 --- a/makefiles/nuttx/config_px4fmu-v1_default.mk +++ /dev/null @@ -1,159 +0,0 @@ -# -# Makefile for the px4fmu_default configuration -# - -# -# Use the configuration's ROMFS. -# -ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common -ROMFS_OPTIONAL_FILES = $(PX4_BASE)/Images/px4io-v1_default.bin - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/stm32 -MODULES += drivers/stm32/adc -MODULES += drivers/stm32/tone_alarm -MODULES += drivers/led -MODULES += drivers/px4io -MODULES += drivers/px4fmu -MODULES += drivers/boards/px4fmu-v1 -MODULES += drivers/ardrone_interface -MODULES += drivers/l3gd20 -MODULES += drivers/mpu6000 -MODULES += drivers/hmc5883 -MODULES += drivers/ms5611 -MODULES += drivers/ll40ls -MODULES += drivers/trone -MODULES += drivers/mb12xx -MODULES += drivers/gps -MODULES += drivers/pwm_out_sim -MODULES += drivers/blinkm -MODULES += drivers/rgbled -MODULES += drivers/mkblctrl -MODULES += drivers/airspeed -MODULES += drivers/ets_airspeed -MODULES += drivers/meas_airspeed -MODULES += drivers/frsky_telemetry -MODULES += modules/sensors -MODULES += drivers/px4flow - -# -# System commands -# -MODULES += systemcmds/mtd -MODULES += systemcmds/mixer -MODULES += systemcmds/param -MODULES += systemcmds/perf -MODULES += systemcmds/pwm -MODULES += systemcmds/esc_calib -MODULES += systemcmds/reboot -MODULES += systemcmds/top -MODULES += systemcmds/config -MODULES += systemcmds/nshterm -MODULES += systemcmds/dumpfile -MODULES += systemcmds/ver - -# -# General system control -# -MODULES += modules/commander -MODULES += modules/navigator -MODULES += modules/mavlink -MODULES += modules/gpio_led -MODULES += modules/land_detector - -# -# Estimation modules (EKF / other filters) -# -# Too high RAM usage due to static allocations -#MODULES += modules/attitude_estimator_ekf -MODULES += modules/ekf_att_pos_estimator -MODULES += modules/attitude_estimator_q -MODULES += modules/position_estimator_inav - -# -# Vehicle Control -# -MODULES += modules/fw_pos_control_l1 -MODULES += modules/fw_att_control -MODULES += modules/mc_att_control -MODULES += modules/mc_pos_control - -# -# Logging -# -MODULES += modules/sdlog2 - -# -# Unit tests -# -#MODULES += modules/unit_test -#MODULES += modules/commander/commander_tests - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/controllib -MODULES += modules/uORB -MODULES += modules/dataman - -# -# Libraries -# -LIBRARIES += lib/mathlib/CMSIS -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/ecl -MODULES += lib/external_lgpl -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion -MODULES += lib/launchdetection -MODULES += platforms/nuttx - -# -# Demo apps -# -#MODULES += examples/math_demo -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/hello_sky -#MODULES += examples/px4_simple_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/daemon -#MODULES += examples/px4_daemon_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/debug_values -#MODULES += examples/px4_mavlink_debug - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control -#MODULES += examples/fixedwing_control - -# Hardware test -#MODULES += examples/hwtest - -# Generate parameter XML file -GEN_PARAM_XML = 1 - -# -# Transitional support - add commands from the NuttX export archive. -# -# In general, these should move to modules over time. -# -# Each entry here is ... but we use a helper macro -# to make the table a bit more readable. -# -define _B - $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) -endef - -# command priority stack entrypoint -BUILTIN_COMMANDS := \ - $(call _B, sercon, , 2048, sercon_main ) \ - $(call _B, serdis, , 2048, serdis_main ) diff --git a/makefiles/nuttx/config_px4fmu-v2_default.mk b/makefiles/nuttx/config_px4fmu-v2_default.mk deleted file mode 100644 index 8d16e538a0..0000000000 --- a/makefiles/nuttx/config_px4fmu-v2_default.mk +++ /dev/null @@ -1,182 +0,0 @@ -# -# Makefile for the px4fmu_default configuration -# - -# -# Use the configuration's ROMFS, copy the px4iov2 firmware into -# the ROMFS if it's available -# -ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common -ROMFS_OPTIONAL_FILES = $(PX4_BASE)/Images/px4io-v2_default.bin - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/stm32 -MODULES += drivers/stm32/adc -MODULES += drivers/stm32/tone_alarm -MODULES += drivers/led -MODULES += drivers/px4fmu -MODULES += drivers/px4io -MODULES += drivers/boards/px4fmu-v2 -MODULES += drivers/rgbled -MODULES += drivers/mpu6000 -MODULES += drivers/mpu9250 -MODULES += drivers/lsm303d -MODULES += drivers/l3gd20 -MODULES += drivers/hmc5883 -MODULES += drivers/ms5611 -MODULES += drivers/mb12xx -MODULES += drivers/sf0x -MODULES += drivers/ll40ls -MODULES += drivers/trone -MODULES += drivers/gps -MODULES += drivers/pwm_out_sim -MODULES += drivers/hott -MODULES += drivers/hott/hott_telemetry -MODULES += drivers/hott/hott_sensors -MODULES += drivers/blinkm -MODULES += drivers/airspeed -MODULES += drivers/ets_airspeed -MODULES += drivers/meas_airspeed -MODULES += drivers/frsky_telemetry -MODULES += modules/sensors -MODULES += drivers/mkblctrl -MODULES += drivers/px4flow -MODULES += drivers/oreoled -MODULES += drivers/gimbal -MODULES += drivers/pwm_input -MODULES += drivers/camera_trigger - -# -# System commands -# -MODULES += systemcmds/bl_update -MODULES += systemcmds/mixer -MODULES += systemcmds/param -MODULES += systemcmds/perf -MODULES += systemcmds/pwm -MODULES += systemcmds/esc_calib -MODULES += systemcmds/reboot -MODULES += systemcmds/top -MODULES += systemcmds/config -MODULES += systemcmds/nshterm -MODULES += systemcmds/mtd -MODULES += systemcmds/dumpfile -MODULES += systemcmds/ver - -# -# General system control -# -MODULES += modules/commander -MODULES += modules/navigator -MODULES += modules/mavlink -MODULES += modules/gpio_led -MODULES += modules/uavcan -MODULES += modules/land_detector - -# -# Estimation modules (EKF/ SO3 / other filters) -# -# Removed from build due to large static allocations -#MODULES += modules/attitude_estimator_ekf -MODULES += modules/attitude_estimator_q -MODULES += modules/ekf_att_pos_estimator -MODULES += modules/position_estimator_inav - -# -# Vehicle Control -# -#MODULES += modules/segway # XXX Needs GCC 4.7 fix -MODULES += modules/fw_pos_control_l1 -MODULES += modules/fw_att_control -MODULES += modules/mc_att_control -MODULES += modules/mc_pos_control -MODULES += modules/vtol_att_control - -# -# Logging -# -MODULES += modules/sdlog2 - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/controllib -MODULES += modules/uORB -MODULES += modules/dataman - -# -# Libraries -# -LIBRARIES += lib/mathlib/CMSIS -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/ecl -MODULES += lib/external_lgpl -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion -MODULES += lib/launchdetection -MODULES += platforms/nuttx - -# -# OBC challenge -# -MODULES += modules/bottle_drop - -# -# PX4 flow estimator, good for indoors -# -MODULES += examples/flow_position_estimator - -# -# Rover apps -# -MODULES += examples/rover_steering_control - -# -# Demo apps -# -#MODULES += examples/math_demo -# Tutorial code from -# https://px4.io/dev/px4_simple_app -#MODULES += examples/px4_simple_app - -# Tutorial code from -# https://px4.io/dev/daemon -#MODULES += examples/px4_daemon_app - -# Tutorial code from -# https://px4.io/dev/debug_values -#MODULES += examples/px4_mavlink_debug - -# Tutorial code from -# https://px4.io/dev/example_fixedwing_control -#MODULES += examples/fixedwing_control - -# Hardware test -#MODULES += examples/hwtest - -# Generate parameter XML file -GEN_PARAM_XML = 1 - -# -# Transitional support - add commands from the NuttX export archive. -# -# In general, these should move to modules over time. -# -# Each entry here is ... but we use a helper macro -# to make the table a bit more readable. -# -define _B - $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) -endef - -# command priority stack entrypoint -BUILTIN_COMMANDS := \ - $(call _B, sercon, , 2048, sercon_main ) \ - $(call _B, serdis, , 2048, serdis_main ) diff --git a/makefiles/nuttx/config_px4fmu-v2_multiplatform.mk b/makefiles/nuttx/config_px4fmu-v2_multiplatform.mk deleted file mode 100644 index 41fc34023f..0000000000 --- a/makefiles/nuttx/config_px4fmu-v2_multiplatform.mk +++ /dev/null @@ -1,168 +0,0 @@ -# -# Makefile for the px4fmu_default configuration -# - -# -# Use the configuration's ROMFS, copy the px4iov2 firmware into -# the ROMFS if it's available -# -ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common -ROMFS_OPTIONAL_FILES = $(PX4_BASE)/Images/px4io-v2_default.bin - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/stm32 -MODULES += drivers/stm32/adc -MODULES += drivers/stm32/tone_alarm -MODULES += drivers/led -MODULES += drivers/px4fmu -MODULES += drivers/px4io -MODULES += drivers/boards/px4fmu-v2 -MODULES += drivers/rgbled -MODULES += drivers/mpu6000 -MODULES += drivers/lsm303d -MODULES += drivers/l3gd20 -MODULES += drivers/hmc5883 -MODULES += drivers/ms5611 -MODULES += drivers/mb12xx -# MODULES += drivers/sf0x -MODULES += drivers/ll40ls -# MODULES += drivers/trone -MODULES += drivers/gps -MODULES += drivers/pwm_out_sim -MODULES += drivers/hott -MODULES += drivers/hott/hott_telemetry -MODULES += drivers/hott/hott_sensors -# MODULES += drivers/blinkm -MODULES += drivers/airspeed -MODULES += drivers/ets_airspeed -MODULES += drivers/meas_airspeed -MODULES += drivers/frsky_telemetry -MODULES += modules/sensors -MODULES += drivers/mkblctrl -MODULES += drivers/px4flow - -# -# System commands -# -MODULES += systemcmds/bl_update -MODULES += systemcmds/mixer -MODULES += systemcmds/param -MODULES += systemcmds/perf -MODULES += systemcmds/pwm -MODULES += systemcmds/esc_calib -MODULES += systemcmds/reboot -MODULES += systemcmds/top -MODULES += systemcmds/config -MODULES += systemcmds/nshterm -MODULES += systemcmds/mtd -MODULES += systemcmds/dumpfile -MODULES += systemcmds/ver - -# -# General system control -# -MODULES += modules/commander -MODULES += modules/navigator -MODULES += modules/mavlink -MODULES += modules/gpio_led -# MODULES += modules/uavcan - -# -# Estimation modules (EKF/ SO3 / other filters) -# -MODULES += modules/attitude_estimator_ekf -MODULES += modules/ekf_att_pos_estimator -MODULES += modules/position_estimator_inav - -# -# Vehicle Control -# -#MODULES += modules/segway # XXX Needs GCC 4.7 fix -#MODULES += modules/fw_pos_control_l1 -#MODULES += modules/fw_att_control -# MODULES += modules/mc_att_control -MODULES += modules/mc_att_control_multiplatform -MODULES += examples/subscriber -MODULES += examples/publisher -# MODULES += modules/mc_pos_control -MODULES += modules/mc_pos_control_multiplatform -MODULES += modules/vtol_att_control - -# -# Logging -# -MODULES += modules/sdlog2 - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/controllib -MODULES += modules/uORB -MODULES += modules/dataman - -# -# Libraries -# -LIBRARIES += lib/mathlib/CMSIS -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/ecl -MODULES += lib/external_lgpl -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion -MODULES += lib/launchdetection -MODULES += platforms/nuttx - -# -# OBC challenge -# -MODULES += modules/bottle_drop - -# -# Demo apps -# -#MODULES += examples/math_demo -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/hello_sky -#MODULES += examples/px4_simple_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/daemon -#MODULES += examples/px4_daemon_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/debug_values -#MODULES += examples/px4_mavlink_debug - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control -#MODULES += examples/fixedwing_control - -# Hardware test -#MODULES += examples/hwtest - -# Generate parameter XML file -GEN_PARAM_XML = 1 - -# -# Transitional support - add commands from the NuttX export archive. -# -# In general, these should move to modules over time. -# -# Each entry here is ... but we use a helper macro -# to make the table a bit more readable. -# -define _B - $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) -endef - -# command priority stack entrypoint -BUILTIN_COMMANDS := \ - $(call _B, sercon, , 2048, sercon_main ) \ - $(call _B, serdis, , 2048, serdis_main ) diff --git a/makefiles/nuttx/config_px4fmu-v2_test.mk b/makefiles/nuttx/config_px4fmu-v2_test.mk deleted file mode 100644 index 9c8510e06d..0000000000 --- a/makefiles/nuttx/config_px4fmu-v2_test.mk +++ /dev/null @@ -1,116 +0,0 @@ -# -# Makefile for the px4fmu_default configuration -# - -# -# Use the configuration's ROMFS. -# -ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_test -ROMFS_OPTIONAL_FILES = $(PX4_BASE)/Images/px4io-v2_default.bin - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/stm32 -MODULES += drivers/stm32/adc -MODULES += drivers/stm32/tone_alarm -MODULES += drivers/led -MODULES += drivers/boards/px4fmu-v2 -MODULES += drivers/px4io -MODULES += drivers/rgbled -MODULES += drivers/mpu6000 -MODULES += drivers/lsm303d -MODULES += drivers/l3gd20 -MODULES += drivers/hmc5883 -MODULES += drivers/ms5611 -MODULES += drivers/pca8574 -MODULES += drivers/roboclaw -MODULES += drivers/airspeed -MODULES += drivers/ets_airspeed -MODULES += drivers/meas_airspeed -MODULES += systemcmds/perf -MODULES += systemcmds/reboot -MODULES += systemcmds/tests -MODULES += systemcmds/nshterm -MODULES += systemcmds/mtd -MODULES += systemcmds/ver -MODULES += systemcmds/top -MODULES += modules/sensors - -# -# System commands -# -MODULES += systemcmds/bl_update -MODULES += systemcmds/mixer -MODULES += systemcmds/param -MODULES += systemcmds/perf -MODULES += systemcmds/pwm -MODULES += systemcmds/esc_calib -MODULES += systemcmds/reboot -MODULES += systemcmds/top -MODULES += systemcmds/config -MODULES += systemcmds/nshterm -MODULES += systemcmds/mtd -MODULES += systemcmds/dumpfile -MODULES += systemcmds/ver - -# -# Example modules -# -MODULES += examples/matlab_csv_serial -MODULES += examples/subscriber -MODULES += examples/publisher - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/uORB -LIBRARIES += lib/mathlib/CMSIS -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/conversion -MODULES += platforms/nuttx - -# -# Example modules to test-build -# -MODULES += examples/flow_position_estimator -MODULES += examples/fixedwing_control -MODULES += examples/hwtest -MODULES += examples/matlab_csv_serial -MODULES += examples/px4_daemon_app -MODULES += examples/px4_mavlink_debug -MODULES += examples/px4_simple_app - -# -# Drivers / modules to test build, but not useful for test environment -# -MODULES += drivers/pca8574 - -# -# Tests -# - -MODULES += modules/unit_test -MODULES += modules/mavlink/mavlink_tests -MODULES += modules/commander/commander_tests - -# -# Transitional support - add commands from the NuttX export archive. -# -# In general, these should move to modules over time. -# -# Each entry here is ... but we use a helper macro -# to make the table a bit more readable. -# -define _B - $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) -endef - -# command priority stack entrypoint -BUILTIN_COMMANDS := \ - $(call _B, sercon, , 2048, sercon_main ) \ - $(call _B, serdis, , 2048, serdis_main ) diff --git a/makefiles/nuttx/config_px4io-v1_default.mk b/makefiles/nuttx/config_px4io-v1_default.mk deleted file mode 100644 index 73f8adf202..0000000000 --- a/makefiles/nuttx/config_px4io-v1_default.mk +++ /dev/null @@ -1,10 +0,0 @@ -# -# Makefile for the px4io_default configuration -# - -# -# Board support modules -# -MODULES += drivers/stm32 -MODULES += drivers/boards/px4io-v1 -MODULES += modules/px4iofirmware \ No newline at end of file diff --git a/makefiles/nuttx/config_px4io-v2_default.mk b/makefiles/nuttx/config_px4io-v2_default.mk deleted file mode 100644 index dbeaba3d37..0000000000 --- a/makefiles/nuttx/config_px4io-v2_default.mk +++ /dev/null @@ -1,10 +0,0 @@ -# -# Makefile for the px4iov2_default configuration -# - -# -# Board support modules -# -MODULES += drivers/stm32 -MODULES += drivers/boards/px4io-v2 -MODULES += modules/px4iofirmware \ No newline at end of file diff --git a/makefiles/nuttx/firmware_nuttx.mk b/makefiles/nuttx/firmware_nuttx.mk deleted file mode 100644 index ca4831b8bd..0000000000 --- a/makefiles/nuttx/firmware_nuttx.mk +++ /dev/null @@ -1,121 +0,0 @@ -# -# Built products -# -DESIRED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)$(config).px4) -STAGED_FIRMWARES = $(foreach config,$(KNOWN_CONFIGS),$(IMAGE_DIR)$(config).px4) -FIRMWARES = $(foreach config,$(KNOWN_CONFIGS),$(BUILD_DIR)$(config).build/firmware.px4) - -all: $(DESIRED_FIRMWARES) - -# -# Copy FIRMWARES into the image directory. -# -# XXX copying the .bin files is a hack to work around the PX4IO uploader -# not supporting .px4 files, and it should be deprecated onced that -# is taken care of. -# -$(STAGED_FIRMWARES): $(IMAGE_DIR)%.px4: $(BUILD_DIR)%.build/firmware.px4 - @$(ECHO) %% Copying $@ - $(Q) $(COPY) $< $@ - $(Q) $(COPY) $(patsubst %.px4,%.bin,$<) $(patsubst %.px4,%.bin,$@) - -# -# Generate FIRMWARES. -# -.PHONY: $(FIRMWARES) -$(BUILD_DIR)%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)%.build/firmware.px4,%,$@) -$(BUILD_DIR)%.build/firmware.px4: work_dir = $(BUILD_DIR)$(config).build/ -$(FIRMWARES): $(BUILD_DIR)%.build/firmware.px4: checkgitversion generateuorbtopicheaders checksubmodules - @$(ECHO) %%%% - @$(ECHO) %%%% Building $(config) in $(work_dir) - @$(ECHO) %%%% - $(Q) $(MKDIR) -p $(work_dir) - $(Q) $(MAKE) -r --no-print-directory -C $(work_dir) \ - -f $(PX4_MK_DIR)firmware.mk \ - CONFIG=$(config) \ - WORK_DIR=$(work_dir) \ - $(FIRMWARE_GOAL) - -# -# Make FMU firmwares depend on the corresponding IO firmware. -# -# This is a pretty vile hack, since it hard-codes knowledge of the FMU->IO dependency -# and forces the _default config in all cases. There has to be a better way to do this... -# -FMU_VERSION = $(patsubst px4fmu-%,%,$(word 1, $(subst _, ,$(1)))) -define FMU_DEP -$(BUILD_DIR)$(1).build/firmware.px4: $(IMAGE_DIR)px4io-$(call FMU_VERSION,$(1))_default.px4 -endef -FMU_CONFIGS := $(filter px4fmu%,$(CONFIGS)) -$(foreach config,$(FMU_CONFIGS),$(eval $(call FMU_DEP,$(config)))) - -# -# Build the NuttX export archives. -# -# Note that there are no explicit dependencies extended from these -# archives. If NuttX is updated, the user is expected to rebuild the -# archives/build area manually. Likewise, when the 'archives' target is -# invoked, all archives are always rebuilt. -# -# XXX Should support fetching/unpacking from a separate directory to permit -# downloads of the prebuilt archives as well... -# -NUTTX_ARCHIVES = $(foreach board,$(BOARDS),$(ARCHIVE_DIR)$(board).export) -.PHONY: archives -archives: checksubmodules $(NUTTX_ARCHIVES) - -# We cannot build these parallel; note that we also force -j1 for the -# sub-make invocations. -ifneq ($(filter archives,$(MAKECMDGOALS)),) -.NOTPARALLEL: -endif - -J?=1 - -$(ARCHIVE_DIR)%.export: board = $(notdir $(basename $@)) -$(ARCHIVE_DIR)%.export: configuration = nsh -$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC) - @$(ECHO) %% Configuring NuttX for $(board) - $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) - $(Q) $(MAKE) -r -j$(J) --no-print-directory -C $(NUTTX_SRC) -r $(MQUIET) distclean - $(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(board) .) - $(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(board)/$(configuration)) - @$(ECHO) %% Exporting NuttX for $(board) - $(Q) $(MAKE) -r -j$(J) --no-print-directory -C $(NUTTX_SRC) -r $(MQUIET) CONFIG_ARCH_BOARD=$(board) export - $(Q) $(MKDIR) -p $(dir $@) - $(Q) $(COPY) $(NUTTX_SRC)nuttx-export.zip $@ - $(Q) (cd $(NUTTX_SRC)/configs && $(RMDIR) $(board)) - -# -# The user can run the NuttX 'menuconfig' tool for a single board configuration with -# make BOARDS= menuconfig -# -ifeq ($(MAKECMDGOALS),menuconfig) -ifneq ($(words $(BOARDS)),1) -$(error BOARDS must specify exactly one board for the menuconfig goal) -endif -BOARD = $(BOARDS) -menuconfig: $(NUTTX_SRC) - @$(ECHO) %% Configuring NuttX for $(BOARD) - $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) - $(Q) $(MAKE) -r -j$(J) --no-print-directory -C $(NUTTX_SRC) -r $(MQUIET) distclean - $(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(BOARD) .) - $(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(BOARD)/nsh) - @$(ECHO) %% Running menuconfig for $(BOARD) - $(Q) $(MAKE) -r -j$(J) --no-print-directory -C $(NUTTX_SRC) -r $(MQUIET) oldconfig - $(Q) $(MAKE) -r -j$(J) --no-print-directory -C $(NUTTX_SRC) -r $(MQUIET) menuconfig - @$(ECHO) %% Saving configuration file - $(Q)$(COPY) $(NUTTX_SRC).config $(PX4_BASE)nuttx-configs/$(BOARD)/nsh/defconfig -else -menuconfig: - @$(ECHO) "" - @$(ECHO) "The menuconfig goal must be invoked without any other goal being specified" - @$(ECHO) "" - -endif - -$(NUTTX_SRC): checkgitversion checksubmodules - -$(UAVCAN_DIR): - $(Q) (./Tools/check_submodules.sh) - diff --git a/makefiles/nuttx/gumstix-aerocore.cfg b/makefiles/nuttx/gumstix-aerocore.cfg deleted file mode 100644 index ba217c0431..0000000000 --- a/makefiles/nuttx/gumstix-aerocore.cfg +++ /dev/null @@ -1,10 +0,0 @@ -# JTAG for the STM32F4x chip used on the Gumstix AeroCore is available on -# the first interface of a Quad FTDI chip. nTRST is bit 4. -interface ftdi -ftdi_vid_pid 0x0403 0x6011 - -ftdi_layout_init 0x0000 0x001b -ftdi_layout_signal nTRST -data 0x0010 - -source [find target/stm32f4x.cfg] -reset_config trst_only diff --git a/makefiles/nuttx/nuttx.mk b/makefiles/nuttx/nuttx.mk deleted file mode 100644 index 4ca1dc2ac6..0000000000 --- a/makefiles/nuttx/nuttx.mk +++ /dev/null @@ -1,85 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Rules and definitions related to handling the NuttX export archives when -# building firmware. -# - -MODULES += platforms/nuttx/px4_layer platforms/common - -# -# Check that the NuttX archive for the selected board is available. -# -NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)$(BOARD).export) -ifeq ($(NUTTX_ARCHIVE),) -$(error The NuttX export archive for $(BOARD) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE)) -endif - -# -# The NuttX config header should always be present in the NuttX archive, and -# if it changes, everything should be rebuilt. So, use it as the trigger to -# unpack the NuttX archive. -# -NUTTX_EXPORT_DIR = $(WORK_DIR)nuttx-export/ -NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)include/nuttx/config.h -$(info % NUTTX_EXPORT_DIR = $(NUTTX_EXPORT_DIR)) -$(info % NUTTX_CONFIG_HEADER = $(NUTTX_CONFIG_HEADER)) - - -GLOBAL_DEPS += $(NUTTX_CONFIG_HEADER) - -# -# Use the linker script from the NuttX export -# -LDSCRIPT += $(NUTTX_EXPORT_DIR)build/ld.script - -# -# Add directories from the NuttX export to the relevant search paths -# -INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)include \ - $(NUTTX_EXPORT_DIR)include/cxx \ - $(NUTTX_EXPORT_DIR)arch/chip \ - $(NUTTX_EXPORT_DIR)arch/common - -LIB_DIRS += $(NUTTX_EXPORT_DIR)libs -LIBS += -lapps -lnuttx -NUTTX_LIBS = $(NUTTX_EXPORT_DIR)libs/libapps.a \ - $(NUTTX_EXPORT_DIR)libs/libnuttx.a -LINK_DEPS += $(NUTTX_LIBS) - -$(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) - @$(ECHO) %% Unpacking $(NUTTX_ARCHIVE) - $(Q) $(UNZIP_CMD) -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) - $(Q) $(TOUCH) $@ - - $(LDSCRIPT): $(NUTTX_CONFIG_HEADER) - $(NUTTX_LIBS): $(NUTTX_CONFIG_HEADER) diff --git a/makefiles/nuttx/nuttx_px4.mk b/makefiles/nuttx/nuttx_px4.mk deleted file mode 100644 index 11e50e03ae..0000000000 --- a/makefiles/nuttx/nuttx_px4.mk +++ /dev/null @@ -1,89 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# What we're going to build. -# -PRODUCT_BUNDLE = $(WORK_DIR)firmware.px4 -PRODUCT_BIN = $(WORK_DIR)firmware.bin -PRODUCT_ELF = $(WORK_DIR)firmware.elf -PRODUCT_PARAMXML = $(WORK_DIR)/parameters.xml -PRODUCT_AIRFRAMEXML = $(WORK_DIR)/airframes.xml - -.PHONY: firmware -firmware: $(PRODUCT_BUNDLE) - -# -# Built product rules -# - -$(PRODUCT_BUNDLE): $(PRODUCT_BIN) - @$(ECHO) %% Generating $@ -ifdef GEN_PARAM_XML - $(Q) $(PYTHON) $(PX4_BASE)/Tools/px_process_params.py --src-path $(PX4_BASE)/src --board CONFIG_ARCH_BOARD_$(CONFIG_BOARD) --xml - $(Q) $(PYTHON) $(PX4_BASE)/Tools/px_process_airframes.py -a $(PX4_BASE)/ROMFS/px4fmu_common/init.d/ --board CONFIG_ARCH_BOARD_$(CONFIG_BOARD) --xml - $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \ - --git_identity $(PX4_BASE) \ - --parameter_xml $(PRODUCT_PARAMXML) \ - --airframe_xml $(PRODUCT_AIRFRAMEXML) \ - --image $< > $@ -else - $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \ - --git_identity $(PX4_BASE) \ - --image $< > $@ -endif - -$(PRODUCT_BIN): $(PRODUCT_ELF) - $(call SYM_TO_BIN,$<,$@) - -$(PRODUCT_ELF): $(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES) - $(call LINK,$@,$(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS)) - -# -# Utility rules -# - -.PHONY: upload -upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) - $(Q) $(MAKE) -f $(PX4_MK_DIR)/nuttx/upload.mk \ - METHOD=serial \ - CONFIG=$(CONFIG) \ - BOARD=$(BOARD) \ - BUNDLE=$(PRODUCT_BUNDLE) \ - BIN=$(PRODUCT_BIN) - -.PHONY: clean -clean: $(MODULE_CLEANS) - @$(ECHO) %% cleaning - $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_ELF) - $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS) - $(Q) $(RMDIR) $(NUTTX_EXPORT_DIR) - diff --git a/makefiles/nuttx/nuttx_romfs.mk b/makefiles/nuttx/nuttx_romfs.mk deleted file mode 100644 index 9554151360..0000000000 --- a/makefiles/nuttx/nuttx_romfs.mk +++ /dev/null @@ -1,163 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -################################################################################ -# ROMFS generation -################################################################################ - -ifneq ($(ROMFS_ROOT),) -ifeq ($(wildcard $(ROMFS_ROOT)),) -$(error ROMFS_ROOT specifies a directory that does not exist) -endif - -# -# Note that there is no support for more than one root directory or constructing -# a root from several templates. That would be a nice feature. -# - -# Add dependencies on anything in the ROMFS root directory -ROMFS_FILES += $(wildcard \ - $(ROMFS_ROOT)/* \ - $(ROMFS_ROOT)/*/* \ - $(ROMFS_ROOT)/*/*/* \ - $(ROMFS_ROOT)/*/*/*/* \ - $(ROMFS_ROOT)/*/*/*/*/* \ - $(ROMFS_ROOT)/*/*/*/*/*/*) -ifeq ($(ROMFS_FILES),) -$(error ROMFS_ROOT $(ROMFS_ROOT) specifies a directory containing no files) -endif -ROMFS_DEPS += $(ROMFS_FILES) - -# Extra files that may be copied into the ROMFS /extras directory -# ROMFS_EXTRA_FILES are required, ROMFS_OPTIONAL_FILES are optional -ROMFS_EXTRA_FILES += $(wildcard $(ROMFS_OPTIONAL_FILES)) -ROMFS_DEPS += $(ROMFS_EXTRA_FILES) - -ROMFS_IMG = romfs.img -ROMFS_SCRATCH = romfs_scratch -ROMFS_CSRC = $(ROMFS_IMG:.img=.c) -ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) -LIBS += $(ROMFS_OBJ) -LINK_DEPS += $(ROMFS_OBJ) - -# Add autostart script -ROMFS_AUTOSTART = $(PX4_BASE)/Tools/px_process_airframes.py - -# Remove all comments from startup and mixer files -ROMFS_PRUNER = $(PX4_BASE)/Tools/px_romfs_pruner.py - -# Turn the ROMFS image into an object file -$(ROMFS_OBJ): $(ROMFS_IMG) $(GLOBAL_DEPS) - $(call BIN_TO_OBJ,$<,$@,romfs_img) - -# Generate the ROMFS image from the root -$(ROMFS_IMG): $(ROMFS_SCRATCH) $(ROMFS_DEPS) $(GLOBAL_DEPS) - @$(ECHO) "ROMFS: $@" - $(Q) $(GENROMFS) -f $@ -d $(ROMFS_SCRATCH) -V "NSHInitVol" - -# Construct the ROMFS scratch root from the canonical root -$(ROMFS_SCRATCH): $(ROMFS_DEPS) $(GLOBAL_DEPS) - $(Q) $(MKDIR) -p $(ROMFS_SCRATCH) - $(Q) $(COPYDIR) $(ROMFS_ROOT)/* $(ROMFS_SCRATCH) -# delete all files in ROMFS_SCRATCH which start with a . or end with a ~ - $(Q) $(RM) $(ROMFS_SCRATCH)/*/.[!.]* $(ROMFS_SCRATCH)/*/*~ -ifneq ($(ROMFS_EXTRA_FILES),) - $(Q) $(MKDIR) -p $(ROMFS_SCRATCH)/extras - $(Q) $(COPY) $(ROMFS_EXTRA_FILES) $(ROMFS_SCRATCH)/extras -endif - $(Q) $(PYTHON) -u $(ROMFS_AUTOSTART) -a $(ROMFS_ROOT)/init.d/ -s $(ROMFS_SCRATCH)/init.d/rc.autostart - # Execute in standard dir as well - # so developers notice the generated file - $(Q) $(PYTHON) -u $(ROMFS_AUTOSTART) -a $(ROMFS_ROOT)/init.d/ -s $(ROMFS_ROOT)/init.d/rc.autostart - $(Q) $(PYTHON) -u $(ROMFS_PRUNER) --folder $(ROMFS_SCRATCH) - -EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG) - -endif - -################################################################################ -# Builtin command list generation -################################################################################ - -# -# Builtin commands can be generated by the configuration, in which case they -# must refer to commands that already exist, or indirectly generated by modules -# when they are built. -# -# The configuration supplies builtin command information in the BUILTIN_COMMANDS -# variable. Applications make empty files in $(WORK_DIR)/builtin_commands whose -# filename contains the same information. -# -# In each case, the command information consists of four fields separated with a -# period. These fields are the command's name, its thread priority, its stack size -# and the name of the function to call when starting the thread. -# -BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c - -# command definitions from modules (may be empty at Makefile parsing time...) -MODULE_COMMANDS = $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*))) - -# We must have at least one pre-defined builtin command in order to generate -# any of this. -# -ifneq ($(BUILTIN_COMMANDS),) - -# (BUILTIN_PROTO,,) -define BUILTIN_PROTO - $(ECHO) 'extern int $(word 4,$1)(int argc, char *argv[]);' >> $2; -endef - -# (BUILTIN_DEF,,) -define BUILTIN_DEF - $(ECHO) ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2; -endef - -# Don't generate until modules have updated their command files -$(BUILTIN_CSRC): $(GLOBAL_DEPS) $(MODULE_OBJS) $(MODULE_MKFILES) $(BUILTIN_COMMAND_FILES) - @$(ECHO) "CMDS: $@" - $(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@ - $(Q) $(ECHO) '#include ' >> $@ - $(Q) $(ECHO) '#include ' >> $@ - $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) - $(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) - $(Q) $(ECHO) 'const struct builtin_s g_builtins[] = {' >> $@ - $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) - $(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) - $(Q) $(ECHO) ' {NULL, 0, 0, NULL}' >> $@ - $(Q) $(ECHO) '};' >> $@ - $(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS) $(MODULE_COMMANDS));' >> $@ - -SRCS += $(BUILTIN_CSRC) - -EXTRA_CLEANS += $(BUILTIN_CSRC) - -endif - diff --git a/makefiles/nuttx/toolchain_gnu-arm-eabi.mk b/makefiles/nuttx/toolchain_gnu-arm-eabi.mk deleted file mode 100644 index 868c3d161e..0000000000 --- a/makefiles/nuttx/toolchain_gnu-arm-eabi.mk +++ /dev/null @@ -1,342 +0,0 @@ -# -# Copyright (C) 2012-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Definitions for a generic GNU ARM-EABI toolchain -# - -#$(info TOOLCHAIN gnu-arm-eabi) - -# Toolchain commands. Normally only used inside this file. -# -CROSSDEV = arm-none-eabi- - -CC = $(CROSSDEV)gcc -CXX = $(CROSSDEV)g++ -CPP = $(CROSSDEV)gcc -E -LD = $(CROSSDEV)ld -AR = $(CROSSDEV)ar rcs -NM = $(CROSSDEV)nm -OBJCOPY = $(CROSSDEV)objcopy -OBJDUMP = $(CROSSDEV)objdump - -# Check if the right version of the toolchain is available -# -CROSSDEV_VER_SUPPORTED = 4.7.4 4.7.5 4.7.6 4.8.4 4.9.3 -CROSSDEV_VER_FOUND = $(shell $(CC) -dumpversion) - -ifeq (,$(findstring $(CROSSDEV_VER_FOUND), $(CROSSDEV_VER_SUPPORTED))) -$(error Unsupported version of $(CC), found: $(CROSSDEV_VER_FOUND) instead of one in: $(CROSSDEV_VER_SUPPORTED)) -endif - - -# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup - -MAXOPTIMIZATION ?= -O3 - -# Base CPU flags for each of the supported architectures. -# -ARCHCPUFLAGS_CORTEXM4F = -mcpu=cortex-m4 \ - -mthumb \ - -march=armv7e-m \ - -mfpu=fpv4-sp-d16 \ - -mfloat-abi=hard - -ARCHCPUFLAGS_CORTEXM4 = -mcpu=cortex-m4 \ - -mthumb \ - -march=armv7e-m \ - -mfloat-abi=soft - -ARCHCPUFLAGS_CORTEXM3 = -mcpu=cortex-m3 \ - -mthumb \ - -march=armv7-m \ - -mfloat-abi=soft - -# Enabling stack checks if OS was build with them -# -TEST_FILE_STACKCHECK=$(WORK_DIR)nuttx-export/include/nuttx/config.h -TEST_VALUE_STACKCHECK=CONFIG_ARMV7M_STACKCHECK\ 1 -ENABLE_STACK_CHECKS=$(shell $(GREP) -q "$(TEST_VALUE_STACKCHECK)" $(TEST_FILE_STACKCHECK); echo $$?;) -ifeq ("$(ENABLE_STACK_CHECKS)","0") -ARCHINSTRUMENTATIONDEFINES_CORTEXM4F = -finstrument-functions -ffixed-r10 -ARCHINSTRUMENTATIONDEFINES_CORTEXM4 = -finstrument-functions -ffixed-r10 -ARCHINSTRUMENTATIONDEFINES_CORTEXM3 = -else -ARCHINSTRUMENTATIONDEFINES_CORTEXM4F = -ARCHINSTRUMENTATIONDEFINES_CORTEXM4 = -ARCHINSTRUMENTATIONDEFINES_CORTEXM3 = -endif - -# Pick the right set of flags for the architecture. -# -ARCHCPUFLAGS = $(ARCHCPUFLAGS_$(CONFIG_ARCH)) -ifeq ($(ARCHCPUFLAGS),) -$(error Must set CONFIG_ARCH to one of CORTEXM4F, CORTEXM4 or CORTEXM3) -endif - -# Set the board flags -# -ifeq ($(CONFIG_BOARD),) -$(error Board config does not define CONFIG_BOARD) -endif -ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) -D__PX4_NUTTX - -# optimisation flags -# -ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ - -g3 \ - -fno-strict-aliasing \ - -fno-strength-reduce \ - -fomit-frame-pointer \ - -funsafe-math-optimizations \ - -fno-builtin-printf \ - -ffunction-sections \ - -fdata-sections - -# enable precise stack overflow tracking -# note - requires corresponding support in NuttX -INSTRUMENTATIONDEFINES = $(ARCHINSTRUMENTATIONDEFINES_$(CONFIG_ARCH)) - -LIBC := $(shell ${CC} ${ARCHCPUFLAGS} -print-file-name=libc.a) - -# Language-specific flags -# -ARCHCFLAGS = -std=gnu99 -ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x -fno-threadsafe-statics -D__CUSTOM_FILE_IO__ - -# -# Provide defaults, but allow for module override -WFRAME_LARGER_THAN ?= 1024 - - - -# Generic warnings -# -ARCHWARNINGS = -Wall \ - -Wextra \ - -Werror \ - -Wdouble-promotion \ - -Wshadow \ - -Wfloat-equal \ - -Wpointer-arith \ - -Wmissing-declarations \ - -Wpacked \ - -Wno-unused-parameter \ - -Werror=format-security \ - -Werror=array-bounds \ - -Wfatal-errors \ - -Wformat=1 \ - -Werror=unused-but-set-variable \ - -Werror=unused-variable \ - -Werror=double-promotion \ - -Werror=reorder \ - -Werror=uninitialized \ - -Werror=init-self -# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+ -# -Wcast-qual - generates spurious noreturn attribute warnings, try again later -# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code -# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives - -# C-specific warnings -# -ARCHCWARNINGS = $(ARCHWARNINGS) \ - -Wbad-function-cast \ - -Wstrict-prototypes \ - -Wold-style-declaration \ - -Wmissing-parameter-type \ - -Wmissing-prototypes \ - -Wnested-externs - -# C++-specific warnings -# -ARCHWARNINGSXX = $(ARCHWARNINGS) \ - -Wno-missing-field-initializers - -# pull in *just* libm from the toolchain ... this is grody -LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) -EXTRA_LIBS += $(LIBM) - -# Flags we pass to the C compiler -# -CFLAGS = $(ARCHCFLAGS) \ - $(ARCHCWARNINGS) \ - $(ARCHOPTIMIZATION) \ - $(ARCHCPUFLAGS) \ - $(ARCHINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - $(EXTRADEFINES) \ - $(EXTRACFLAGS) \ - -fno-common \ - $(addprefix -I,$(INCLUDE_DIRS)) - -# Flags we pass to the C++ compiler -# -CXXFLAGS = $(ARCHCXXFLAGS) \ - $(ARCHWARNINGSXX) \ - $(ARCHOPTIMIZATION) \ - $(ARCHCPUFLAGS) \ - $(ARCHXXINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - -DCONFIG_WCHAR_BUILTIN \ - $(EXTRADEFINES) \ - $(EXTRACXXFLAGS) \ - $(addprefix -I,$(INCLUDE_DIRS)) - -# Flags we pass to the assembler -# -AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \ - $(EXTRADEFINES) \ - $(EXTRAAFLAGS) - -# Flags we pass to the linker -# -LDFLAGS += --warn-common \ - --gc-sections \ - $(EXTRALDFLAGS) \ - $(addprefix -T,$(LDSCRIPT)) \ - $(addprefix -L,$(LIB_DIRS)) - -# Compiler support library -# -LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) - -# Files that the final link depends on -# -LINK_DEPS += $(LDSCRIPT) - -# Files to include to get automated dependencies -# -DEP_INCLUDES = $(subst .o,.d,$(OBJS)) - -# Compile C source $1 to object $2 -# as a side-effect, generate a dependency file -# -define COMPILE - @$(ECHO) "CC: $1" - @$(MKDIR) -p $(dir $2) - $(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 -endef - -# Compile C++ source $1 to $2 -# as a side-effect, generate a dependency file -# -define COMPILEXX - @$(ECHO) "CXX: $1" - @$(MKDIR) -p $(dir $2) - $(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 -endef - -# Assemble $1 into $2 -# -define ASSEMBLE - @$(ECHO) "AS: $1" - @$(MKDIR) -p $(dir $2) - $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 -endef - -# Produce partially-linked $1 from files in $2 -# -define PRELINK - @$(ECHO) "PRELINK: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(LD) -Ur -Map $1.map -o $1 $2 && $(OBJCOPY) --localize-hidden $1 -endef - -# Update the archive $1 with the files in $2 -# -define ARCHIVE - @$(ECHO) "AR: $2" - @$(MKDIR) -p $(dir $1) - $(Q) $(AR) $1 $2 -endef - -# Link the objects in $2 into the binary $1 -# -define LINK - @$(ECHO) "LINK: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(LD) $(LDFLAGS) -Map $1.map -o $1 --start-group $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group -endef - -# Convert $1 from a linked object to a raw binary in $2 -# -define SYM_TO_BIN - @$(ECHO) "BIN: $2" - @$(MKDIR) -p $(dir $2) - $(Q) $(OBJCOPY) -O binary $1 $2 -endef - -# Take the raw binary $1 and make it into an object file $2. -# The symbol $3 points to the beginning of the file, and $3_len -# gives its length. -# -# - compile an empty file to generate a suitable object file -# - relink the object and insert the binary file -# - extract the length -# - create const unsigned $3_len with the extracted length as its value and compile it to an object file -# - link the two generated object files together -# - edit symbol names to suit -# -# NOTE: exercise caution using this with absolute pathnames; it looks -# like the MinGW tools insert an extra _ in the binary symbol name; e.g. -# the path: -# -# /d/px4/firmware/Build/px4fmu_default.build/romfs.img -# -# is assigned symbols like: -# -# _binary_d__px4_firmware_Build_px4fmu_default_build_romfs_img_size -# -# when we would expect -# -# _binary__d_px4_firmware_Build_px4fmu_default_build_romfs_img_size -# -define BIN_SYM_PREFIX - _binary_$(subst /,_,$(subst .,_,$1)) -endef -define BIN_TO_OBJ - @$(ECHO) "OBJ: $2" - @$(MKDIR) -p $(dir $2) - $(Q) $(ECHO) > $2.c - $(call COMPILE,$2.c,$2.c.o) - $(Q) $(LD) -r -o $2.bin.o $2.c.o -b binary $1 - $(Q) $(ECHO) "const unsigned int $3_len = 0x`$(NM) -p --radix=x $2.bin.o | $(GREP) $(call BIN_SYM_PREFIX,$1)_size$$ | $(GREP) -o ^[0-9a-fA-F]*`;" > $2.c - $(call COMPILE,$2.c,$2.c.o) - $(Q) $(LD) -r -o $2 $2.c.o $2.bin.o - $(Q) $(OBJCOPY) $2 \ - --redefine-sym $(call BIN_SYM_PREFIX,$1)_start=$3 \ - --strip-symbol $(call BIN_SYM_PREFIX,$1)_size \ - --strip-symbol $(call BIN_SYM_PREFIX,$1)_end \ - --rename-section .data=.rodata - $(Q) $(REMOVE) $2.c $2.c.o $2.bin.o -endef diff --git a/makefiles/nuttx/upload.mk b/makefiles/nuttx/upload.mk deleted file mode 100644 index e73c31dc31..0000000000 --- a/makefiles/nuttx/upload.mk +++ /dev/null @@ -1,50 +0,0 @@ -# -# Rules and tools for uploading firmware to various PX4 boards. -# - -UPLOADER = $(PX4_BASE)/Tools/px_uploader.py - -SYSTYPE := $(shell uname -s) - -# -# Serial port defaults. -# -# XXX The uploader should be smarter than this. -# -ifeq ($(SYSTYPE),Darwin) -SERIAL_PORTS ?= "/dev/tty.usbmodemPX*,/dev/tty.usbmodem*" -endif -ifeq ($(SYSTYPE),Linux) -SERIAL_PORTS ?= "/dev/serial/by-id/usb-3D_Robotics*,/dev/serial/by-id/pci-3D_Robotics*" -endif -ifeq ($(SERIAL_PORTS),) -SERIAL_PORTS = "COM32,COM31,COM30,COM29,COM28,COM27,COM26,COM25,COM24,COM23,COM22,COM21,COM20,COM19,COM18,COM17,COM16,COM15,COM14,COM13,COM12,COM11,COM10,COM9,COM8,COM7,COM6,COM5,COM4,COM3,COM2,COM1,COM0" -endif - -.PHONY: all upload-$(METHOD)-$(BOARD) -all: upload-$(METHOD)-$(BOARD) - -upload-serial-px4fmu-v1: $(BUNDLE) $(UPLOADER) - $(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE) - -upload-serial-px4fmu-v2: $(BUNDLE) $(UPLOADER) - $(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE) - -upload-serial-aerocore: - openocd -f $(PX4_BASE)/makefiles/nuttx/gumstix-aerocore.cfg -c 'init; reset halt; flash write_image erase $(PX4_BASE)/../Bootloader/px4aerocore_bl.bin 0x08000000; flash write_image erase $(PX4_BASE)/Build/aerocore_default.build/firmware.bin 0x08004000; reset run; exit' - -upload-serial-px4-stm32f4discovery: $(BUNDLE) $(UPLOADER) - $(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE) - -# -# JTAG firmware uploading with OpenOCD -# -JTAGCONFIG ?= interface/olimex-jtag-tiny.cfg - -upload-jtag-px4fmu: all - @$(ECHO) Attempting to flash PX4FMU board via JTAG - $(Q) $(OPENOCD) -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown - -upload-jtag-px4io: all - @$(ECHO) Attempting to flash PX4IO board via JTAG - $(Q) $(OPENOCD) -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown diff --git a/makefiles/posix-arm/board_eagle.mk b/makefiles/posix-arm/board_eagle.mk deleted file mode 100644 index 94dd049367..0000000000 --- a/makefiles/posix-arm/board_eagle.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -# Board-specific definitions for the POSIX port of PX4 -# - -# -# Configure the toolchain -# -CONFIG_ARCH = CORTEXA8 -CONFIG_BOARD = EAGLE - -include $(PX4_MK_DIR)/posix-arm/toolchain_gnu-arm-linux-gnueabihf.mk diff --git a/makefiles/posix-arm/config_eagle_adsp.mk b/makefiles/posix-arm/config_eagle_adsp.mk deleted file mode 100644 index e7e0d8cf6f..0000000000 --- a/makefiles/posix-arm/config_eagle_adsp.mk +++ /dev/null @@ -1,57 +0,0 @@ -# -# Makefile for the EAGLE *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device - -# -# System commands -# -MODULES += systemcmds/param -MODULES += systemcmds/ver - -# -# General system control -# -MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# - -# -# Vehicle Control -# - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/uORB -MODULES += modules/dataman - -# -# Libraries -# -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion -# -# Linux port -# -MODULES += platforms/posix/px4_layer -MODULES += platforms/posix/work_queue - -# -# Unit tests -# - -# -# muorb fastrpc changes. -# -MODULES += modules/muorb/krait diff --git a/makefiles/posix-arm/config_eagle_default.mk b/makefiles/posix-arm/config_eagle_default.mk deleted file mode 100644 index 1f335522cd..0000000000 --- a/makefiles/posix-arm/config_eagle_default.mk +++ /dev/null @@ -1,79 +0,0 @@ -# -# Makefile for the EAGLE *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/blinkm -MODULES += drivers/pwm_out_sim -MODULES += drivers/rgbled -MODULES += drivers/led -MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -MODULES += systemcmds/param -MODULES += systemcmds/mixer -MODULES += systemcmds/ver -#MODULES += systemcmds/topic_listener - -# -# General system control -# -MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -MODULES += modules/attitude_estimator_ekf -MODULES += modules/ekf_att_pos_estimator - -# -# Vehicle Control -# -#MODULES += modules/navigator -MODULES += modules/mc_pos_control -MODULES += modules/mc_att_control - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/uORB -MODULES += modules/dataman -MODULES += modules/sdlog2 -MODULES += modules/simulator -MODULES += modules/commander -MODULES += modules/controllib - -# -# Libraries -# -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion -# -# Linux port -# -MODULES += platforms/posix/px4_layer -MODULES += platforms/posix/work_queue - -# -# Unit tests -# -#MODULES += platforms/posix/tests/hello -#MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue - -# -# muorb fastrpc changes. -# -#MODULES += $(PX4_BASE)../muorb_krait diff --git a/makefiles/posix-arm/config_eagle_hil.mk b/makefiles/posix-arm/config_eagle_hil.mk deleted file mode 100644 index 522549d05b..0000000000 --- a/makefiles/posix-arm/config_eagle_hil.mk +++ /dev/null @@ -1,88 +0,0 @@ -# -# Makefile for the POSIXTEST *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/boards/sitl -#MODULES += drivers/blinkm -#MODULES += drivers/pwm_out_sim -#MODULES += drivers/rgbled -MODULES += drivers/led -#MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -MODULES += systemcmds/param -#MODULES += systemcmds/mixer -#MODULES += systemcmds/topic_listener -MODULES += systemcmds/ver - -# -# General system control -# -MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -#MODULES += modules/attitude_estimator_ekf -#MODULES += modules/ekf_att_pos_estimator - -# -# Vehicle Control -# -#MODULES += modules/navigator -#MODULES += modules/mc_pos_control -#MODULES += modules/mc_att_control - -# -# Library modules -# -MODULES += modules/systemlib -#MODULES += modules/systemlib/mixer -MODULES += modules/uORB -MODULES += modules/dataman -MODULES += modules/sdlog2 -MODULES += modules/simulator -MODULES += modules/commander -#MODULES += modules/controllib - -# -# Libraries -# -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion - -# -# Linux port -# -MODULES += platforms/posix/px4_layer -MODULES += platforms/posix/work_queue -#MODULES += platforms/posix/drivers/accelsim -#MODULES += platforms/posix/drivers/gyrosim -#MODULES += platforms/posix/drivers/adcsim -#MODULES += platforms/posix/drivers/barosim -#MODULES += platforms/posix/drivers/tonealrmsim -#MODULES += platforms/posix/drivers/airspeedsim -#MODULES += platforms/posix/drivers/gpssim - -# -# Unit tests -# -#MODULES += platforms/posix/tests/hello -#MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue - -# -# muorb fastrpc changes. -# -MODULES += modules/muorb/krait diff --git a/makefiles/posix-arm/config_eagle_muorb_test.mk b/makefiles/posix-arm/config_eagle_muorb_test.mk deleted file mode 100644 index bb87cd35fb..0000000000 --- a/makefiles/posix-arm/config_eagle_muorb_test.mk +++ /dev/null @@ -1,90 +0,0 @@ -# -# Makefile for the POSIXTEST *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -#MODULES += drivers/blinkm -#MODULES += drivers/pwm_out_sim -#MODULES += drivers/rgbled -#MODULES += drivers/led -#MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -#MODULES += systemcmds/param -#MODULES += systemcmds/mixer -#MODULES += systemcmds/topic_listener - -# -# General system control -# -#MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -#MODULES += modules/attitude_estimator_ekf -#MODULES += modules/ekf_att_pos_estimator - -# -# Vehicle Control -# -#MODULES += modules/navigator -#MODULES += modules/mc_pos_control -#MODULES += modules/mc_att_control - -# -# Library modules -# -#MODULES += modules/systemlib -#MODULES += modules/systemlib/mixer -MODULES += modules/uORB -#MODULES += modules/dataman -#MODULES += modules/sdlog2 -#MODULES += modules/simulator -#MODULES += modules/commander -#MODULES += modules/controllib - -# -# Libraries -# -#MODULES += lib/mathlib -#MODULES += lib/mathlib/math/filter -#MODULES += lib/geo -#MODULES += lib/geo_lookup -#MODULES += lib/conversion - -# -# Linux port -# -MODULES += platforms/posix/px4_layer -MODULES += platforms/posix/work_queue -#MODULES += platforms/posix/drivers/accelsim -#MODULES += platforms/posix/drivers/gyrosim -#MODULES += platforms/posix/drivers/adcsim -#MODULES += platforms/posix/drivers/barosim -#MODULES += platforms/posix/drivers/tonealrmsim -#MODULES += platforms/posix/drivers/airspeedsim -#MODULES += platforms/posix/drivers/gpssim - -# -# muorb fastrpc changes. -# -MODULES += modules/muorb/krait - - -# -# -# Unit tests -# -#MODULES += platforms/posix/tests/hello -#MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue -MODULES += platforms/posix/tests/muorb - diff --git a/makefiles/posix-arm/ld.script b/makefiles/posix-arm/ld.script deleted file mode 100644 index 32478e1e14..0000000000 --- a/makefiles/posix-arm/ld.script +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** - * ld.script - * - * Copyright (C) 2015 Mark Charlebois. All rights reserved. - * Author: Mark Charlebois - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -SECTIONS -{ - /* - * Construction data for parameters. - */ - __param : ALIGN(8) { - __param_start = .; - KEEP(*(__param*)) - __param_end = .; - } -} diff --git a/makefiles/posix-arm/posix-arm.mk b/makefiles/posix-arm/posix-arm.mk deleted file mode 100644 index 13cb97f0db..0000000000 --- a/makefiles/posix-arm/posix-arm.mk +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Rules and definitions related to handling the Linux specific impl when -# building firmware. -# - -MODULES += \ - platforms/common \ - platforms/posix/px4_layer - diff --git a/makefiles/posix-arm/toolchain_gnu-arm-linux-gnueabihf.mk b/makefiles/posix-arm/toolchain_gnu-arm-linux-gnueabihf.mk deleted file mode 100644 index 4eb3b0fd19..0000000000 --- a/makefiles/posix-arm/toolchain_gnu-arm-linux-gnueabihf.mk +++ /dev/null @@ -1,305 +0,0 @@ -# -# Copyright (C) 2012-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Definitions for a generic GNU ARM-EABI toolchain -# - -#$(info TOOLCHAIN arm-linux-gnueabihf) - -# Toolchain commands. Normally only used inside this file. -# -CROSSDEV = arm-linux-gnueabihf- - -CC ?= $(CROSSDEV)gcc -CXX ?= $(CROSSDEV)g++ -CPP ?= $(CROSSDEV)gcc -E -LD ?= $(CROSSDEV)ld -AR ?= $(CROSSDEV)ar rcs -NM ?= $(CROSSDEV)nm -OBJCOPY ?= $(CROSSDEV)objcopy -OBJDUMP ?= $(CROSSDEV)objdump -ifdef OECORE_NATIVE_SYSROOT -AR := $(AR) rcs -endif - -# Check if the right version of the toolchain is available -# -CROSSDEV_VER_SUPPORTED = 4.7.4 4.7.5 4.7.6 4.8.2 4.8.4 4.9.3 -CROSSDEV_VER_FOUND = $(shell $(CC) -dumpversion) - -ifeq (,$(findstring $(CROSSDEV_VER_FOUND), $(CROSSDEV_VER_SUPPORTED))) -$(error Unsupported version of $(CC), found: $(CROSSDEV_VER_FOUND) instead of one in: $(CROSSDEV_VER_SUPPORTED)) -endif - -ifndef POSIX_EXT_LIB_ROOT -$(error POSIX_EXT_LIB_ROOT is not set) -endif - -# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup - -MAXOPTIMIZATION ?= -O3 - -# Base CPU flags for each of the supported architectures. -# -ARCHCPUFLAGS_CORTEXA8 = -mtune=cortex-a8 \ - -mthumb-interwork \ - -march=armv7-a \ - -mfloat-abi=hard \ - -mfpu=neon - -# Pick the right set of flags for the architecture. -# -ARCHCPUFLAGS = $(ARCHCPUFLAGS_$(CONFIG_ARCH)) -ifeq ($(ARCHCPUFLAGS),) -$(error Must set CONFIG_ARCH to one of CORTEXA8 CORTEXM4F, CORTEXM4 or CORTEXM3) -endif - -# Set the board flags -# -ifeq ($(CONFIG_BOARD),) -$(error Board config does not define CONFIG_BOARD) -endif -ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) \ - -D__PX4_LINUX -D__PX4_POSIX \ - -Dnoreturn_function= \ - -I$(PX4_BASE)/src/modules/systemlib \ - -I$(PX4_BASE)/src/lib/eigen \ - -I$(PX4_BASE)/src/platforms/posix/include \ - -I$(PX4_BASE)/mavlink/include/mavlink \ - -Wno-error=shadow - -# optimisation flags -# -ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ - -g3 \ - -fno-strict-aliasing \ - -fomit-frame-pointer \ - -funsafe-math-optimizations \ - -fno-builtin-printf \ - -ffunction-sections \ - -fdata-sections - -# Language-specific flags -# -ARCHCFLAGS = -std=gnu99 -ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=c++0x -fno-threadsafe-statics -D__CUSTOM_FILE_IO__ - -# Generic warnings -# -ARCHWARNINGS = -Wall \ - -Wextra \ - -Werror \ - -Wfloat-equal \ - -Wpointer-arith \ - -Wmissing-declarations \ - -Wpacked \ - -Wno-unused-parameter \ - -Wno-packed \ - -Werror=format-security \ - -Werror=array-bounds \ - -Wfatal-errors \ - -Werror=unused-variable \ - -Werror=reorder \ - -Werror=uninitialized \ - -Werror=init-self \ - -Wformat=1 \ - -Werror=unused-but-set-variable \ - -Wno-error=double-promotion \ - -fno-strength-reduce \ - -Wno-error=unused-value - -ARCHOPTIMIZATION += -fno-strength-reduce - -# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+ -# -Wcast-qual - generates spurious noreturn attribute warnings, try again later -# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code -# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives - -# C-specific warnings -# -ARCHCWARNINGS = $(ARCHWARNINGS) \ - -Wbad-function-cast \ - -Wstrict-prototypes \ - -Wmissing-prototypes \ - -Wnested-externs - -# C++-specific warnings -# -ARCHWARNINGSXX = $(ARCHWARNINGS) \ - -Wno-missing-field-initializers - -# pull in *just* libm from the toolchain ... this is grody -LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) -#EXTRA_LIBS += $(LIBM) -EXTRA_LIBS += -lpx4muorb -ladsprpc -EXTRA_LIBS += -pthread -lm -lrt - -LIB_DIRS += $(POSIX_EXT_LIB_ROOT)/libs -INCLUDE_DIRS += $(POSIX_EXT_LIB_ROOT)/inc - -# Flags we pass to the C compiler -# -CFLAGS = $(ARCHCFLAGS) \ - $(ARCHCWARNINGS) \ - $(ARCHOPTIMIZATION) \ - $(ARCHCPUFLAGS) \ - $(ARCHINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - $(EXTRADEFINES) \ - $(EXTRACFLAGS) \ - -fno-common \ - $(addprefix -I,$(INCLUDE_DIRS)) - -# Flags we pass to the C++ compiler -# -CXXFLAGS = $(ARCHCXXFLAGS) \ - $(ARCHWARNINGSXX) \ - $(ARCHOPTIMIZATION) \ - $(ARCHCPUFLAGS) \ - $(ARCHXXINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - -DCONFIG_WCHAR_BUILTIN \ - $(EXTRADEFINES) \ - $(EXTRACXXFLAGS) \ - -Wno-effc++ \ - $(addprefix -I,$(INCLUDE_DIRS)) - -# Flags we pass to the assembler -# -AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \ - $(EXTRADEFINES) \ - $(EXTRAAFLAGS) - -LDSCRIPT = $(PX4_BASE)/makefiles/posix-arm/ld.script -# Flags we pass to the linker -# -LDFLAGS += $(EXTRALDFLAGS) \ - $(addprefix -L,$(LIB_DIRS)) - -# Compiler support library -# -LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) - -# Files that the final link depends on -# -#LINK_DEPS += $(LDSCRIPT) -LINK_DEPS += - -# Files to include to get automated dependencies -# -DEP_INCLUDES = $(subst .o,.d,$(OBJS)) - -# Compile C source $1 to object $2 -# as a side-effect, generate a dependency file -# -define COMPILE - @$(ECHO) "CC: $1" - @$(MKDIR) -p $(dir $2) - $(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 -endef - -# Compile C++ source $1 to $2 -# as a side-effect, generate a dependency file -# -define COMPILEXX - @$(ECHO) "CXX: $1" - @$(MKDIR) -p $(dir $2) - @echo $(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 - $(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 -endef - -# Assemble $1 into $2 -# -define ASSEMBLE - @$(ECHO) "AS: $1" - @$(MKDIR) -p $(dir $2) - $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 -endef - -# Produce partially-linked $1 from files in $2 -# -#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold -define PRELINK - @$(ECHO) "PRELINK: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(LD) -Ur -o $1 $2 - -endef -# Produce partially-linked $1 from files in $2 -# -#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold -define PRELINKF - @$(ECHO) "PRELINK: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(LD) -Ur -T$(LDSCRIPT) -o $1 $2 - -endef -# $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 - -# Update the archive $1 with the files in $2 -# -define ARCHIVE - @$(ECHO) "AR: $2" - @$(MKDIR) -p $(dir $1) - $(Q) $(AR) $1 $2 -endef - -# Link the objects in $2 into the shared library $1 -# -define LINK_A - @$(ECHO) "LINK_A: $1" - @$(MKDIR) -p $(dir $1) - echo "$(Q) $(AR) $1 $2" - $(Q) $(AR) $1 $2 -endef - -# Link the objects in $2 into the shared library $1 -# -define LINK_SO - @$(ECHO) "LINK_SO: $1" - @$(MKDIR) -p $(dir $1) - echo "$(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) $(EXTRA_LIBS)" - $(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) -pthread -lc -endef - -# Link the objects in $2 into the application $1 -# -define LINK - @$(ECHO) "LINK: $1" - @$(MKDIR) -p $(dir $1) - echo "$(Q) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $1 $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC)" - $(Q) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $1 $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC) - -endef - diff --git a/makefiles/posix/DISABLE_config_posix_muorb_test.mk b/makefiles/posix/DISABLE_config_posix_muorb_test.mk deleted file mode 100644 index 5f0074e2ba..0000000000 --- a/makefiles/posix/DISABLE_config_posix_muorb_test.mk +++ /dev/null @@ -1,78 +0,0 @@ -# -# Makefile for the Foo *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -#MODULES += drivers/blinkm -#MODULES += drivers/pwm_out_sim -#MODULES += drivers/led -#MODULES += drivers/rgbled -#MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -MODULES += systemcmds/param - -# -# General system control -# -#MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -#MODULES += modules/attitude_estimator_ekf -#MODULES += modules/ekf_att_pos_estimator - -# -# Vehicle Control -# -#MODULES += modules/mc_att_control - -# -# Library modules -# -MODULES += modules/systemlib -#MODULES += modules/systemlib/mixer -MODULES += modules/uORB -#MODULES += modules/dataman -#MODULES += modules/sdlog2 -#MODULES += modules/simulator -#MODULES += modules/commander - -# -# Libraries -# -#MODULES += lib/mathlib -#MODULES += lib/mathlib/math/filter -#MODULES += lib/geo -#MODULES += lib/geo_lookup -#MODULES += lib/conversion - -# -# posix port -# -MODULES += platforms/posix/px4_layer -#MODULES += platforms/posix/drivers/accelsim -#MODULES += platforms/posix/drivers/gyrosim -#MODULES += platforms/posix/drivers/adcsim -#MODULES += platforms/posix/drivers/barosim - -# -# muorb fastrpc changes. -# -#MODULES += $(PX4_BASE)../muorb_krait - -# -# Unit tests -# -MODULES += platforms/posix/tests/muorb -#MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue - diff --git a/makefiles/posix/board_posix.mk b/makefiles/posix/board_posix.mk deleted file mode 100644 index 4e8c9e9f58..0000000000 --- a/makefiles/posix/board_posix.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -# Board-specific definitions for the POSIX port of PX4 -# for use in SITL testing -# - -# -# Configure the toolchain -# -CONFIG_ARCH = NATIVE -CONFIG_BOARD = SITL - -include $(PX4_MK_DIR)/posix/toolchain_native.mk diff --git a/makefiles/posix/config_posix_sitl.mk b/makefiles/posix/config_posix_sitl.mk deleted file mode 100644 index b745d0e263..0000000000 --- a/makefiles/posix/config_posix_sitl.mk +++ /dev/null @@ -1,107 +0,0 @@ -# -# Makefile for the SITL configuration -# - -# -# Board support modules -# -MODULES += drivers/boards/sitl -MODULES += drivers/device -MODULES += drivers/blinkm -MODULES += drivers/pwm_out_sim -MODULES += drivers/rgbled -MODULES += drivers/led -MODULES += modules/sensors -MODULES += drivers/ms5611 - -# -# System commands -# -MODULES += systemcmds/param -MODULES += systemcmds/mixer -#MODULES += systemcmds/esc_calib -MODULES += systemcmds/tests -#MODULES += systemcmds/reboot -MODULES += systemcmds/topic_listener -MODULES += systemcmds/ver -MODULES += systemcmds/esc_calib -MODULES += systemcmds/reboot - -# -# General system control -# -MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -MODULES += modules/attitude_estimator_ekf -MODULES += modules/attitude_estimator_q -MODULES += modules/ekf_att_pos_estimator -MODULES += modules/attitude_estimator_q -MODULES += modules/position_estimator_inav - -# -# Vehicle Control -# -MODULES += modules/navigator -MODULES += modules/mc_pos_control -MODULES += modules/mc_att_control -MODULES += modules/mc_pos_control_multiplatform -MODULES += modules/mc_att_control_multiplatform -MODULES += modules/land_detector -MODULES += modules/fw_att_control -MODULES += modules/fw_pos_control_l1 - - - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/uORB -MODULES += modules/dataman -MODULES += modules/sdlog2 -MODULES += modules/simulator -MODULES += modules/commander -MODULES += modules/controllib - -# -# Libraries -# -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/ecl -MODULES += lib/external_lgpl -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion -MODULES += lib/launchdetection - - -# -# POSIX port -# -MODULES += platforms/posix/px4_layer -MODULES += platforms/posix/work_queue -MODULES += platforms/posix/drivers/accelsim -MODULES += platforms/posix/drivers/gyrosim -MODULES += platforms/posix/drivers/adcsim -MODULES += platforms/posix/drivers/barosim -MODULES += platforms/posix/drivers/tonealrmsim -MODULES += platforms/posix/drivers/airspeedsim -MODULES += platforms/posix/drivers/gpssim - -# -# Unit tests -# -#MODULES += platforms/posix/tests/hello -MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue - -# -# muorb fastrpc changes. -# -#MODULES += $(PX4_BASE)../muorb_krait diff --git a/makefiles/posix/firmware_posix.mk b/makefiles/posix/firmware_posix.mk deleted file mode 100644 index f6f087d449..0000000000 --- a/makefiles/posix/firmware_posix.mk +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Built products -# -FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)$(config).build/firmware.a) - -all: $(FIRMWARES) - -# -# Generate FIRMWARES. -# -.PHONY: $(FIRMWARES) -$(BUILD_DIR)%.build/firmware.a: config = $(patsubst $(BUILD_DIR)%.build/firmware.a,%,$@) -$(BUILD_DIR)%.build/firmware.a: work_dir = $(BUILD_DIR)$(config).build/ -$(FIRMWARES): $(BUILD_DIR)%.build/firmware.a: checkgitversion generateuorbtopicheaders - @$(ECHO) %%%% - @$(ECHO) %%%% Building $(config) in $(work_dir) - @$(ECHO) %%%% - $(Q) $(MKDIR) -p $(work_dir) - $(Q) $(MAKE) -r --no-print-directory -C $(work_dir) \ - -f $(PX4_MK_DIR)firmware.mk \ - CONFIG=$(config) \ - WORK_DIR=$(work_dir) \ - $(FIRMWARE_GOAL) - - diff --git a/makefiles/posix/ld.script b/makefiles/posix/ld.script deleted file mode 100644 index 32478e1e14..0000000000 --- a/makefiles/posix/ld.script +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** - * ld.script - * - * Copyright (C) 2015 Mark Charlebois. All rights reserved. - * Author: Mark Charlebois - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -SECTIONS -{ - /* - * Construction data for parameters. - */ - __param : ALIGN(8) { - __param_start = .; - KEEP(*(__param*)) - __param_end = .; - } -} diff --git a/makefiles/posix/posix.mk b/makefiles/posix/posix.mk deleted file mode 100644 index 13cb97f0db..0000000000 --- a/makefiles/posix/posix.mk +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Rules and definitions related to handling the Linux specific impl when -# building firmware. -# - -MODULES += \ - platforms/common \ - platforms/posix/px4_layer - diff --git a/makefiles/posix/posix_elf.mk b/makefiles/posix/posix_elf.mk deleted file mode 100644 index bbc7545a5e..0000000000 --- a/makefiles/posix/posix_elf.mk +++ /dev/null @@ -1,75 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Makefile for PX4 POSIX based firmware images. -# - -################################################################################ -# Build rules -################################################################################ - -# -# What we're going to build. -# -PRODUCT_SHARED_LIB = $(WORK_DIR)firmware.a -PRODUCT_SHARED_PRELINK = $(WORK_DIR)firmware.o - -.PHONY: firmware -firmware: $(PRODUCT_SHARED_LIB) $(WORK_DIR)mainapp - -# -# Built product rules -# - -$(PRODUCT_SHARED_PRELINK): $(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES) - $(call PRELINKF,$@,$(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS)) - -$(PRODUCT_SHARED_LIB): $(PRODUCT_SHARED_PRELINK) - $(call LINK_A,$@,$(PRODUCT_SHARED_PRELINK)) - -$(WORK_DIR)apps.h: $(WORK_DIR)builtin_commands - $(PX4_BASE)/Tools/posix_apps.py > $(WORK_DIR)apps.h - -MAIN = $(PX4_BASE)/src/platforms/posix/main.cpp -$(WORK_DIR)mainapp: $(PRODUCT_SHARED_LIB) $(WORK_DIR)apps.h - $(call LINK,$@, -I. $(MAIN) $(PRODUCT_SHARED_LIB)) - -# -# Utility rules -# - -.PHONY: clean -clean: $(MODULE_CLEANS) - @$(ECHO) %% cleaning - $(Q) $(REMOVE) $(PRODUCT_ELF) - $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS) - diff --git a/makefiles/posix/toolchain_native.mk b/makefiles/posix/toolchain_native.mk deleted file mode 100644 index c3a766d5ef..0000000000 --- a/makefiles/posix/toolchain_native.mk +++ /dev/null @@ -1,369 +0,0 @@ -# -# Copyright (C) 2012-2014 PX4 Development Team. All rights reuint32_tserved. -# -# 2005 Modified for clang and GCC on POSIX: -# Author: Mark Charlebois -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Definitions for a native GCC toolchain -# - -#$(info TOOLCHAIN native) - -# Toolchain commands. Normally only used inside this file. -# - -# Set to 1 for GCC-4.8.2 and to 0 for Clang-3.5 (Ubuntu 14.04) -USE_GCC?=0 - -ifeq ($(PX4_DEBUG_LEVEL),) -VERBOSITY_LEVEL= -else -VERBOSITY_LEVEL=-D$(PX4_DEBUG_LEVEL) -endif - -ifneq ($(USE_GCC),1) - -HAVE_CLANG35:=$(shell clang-3.5 -dumpversion 2>/dev/null) - -# Clang will report 4.2.1 as GCC version -HAVE_CLANG:=$(shell clang -dumpversion 2> /dev/null) - -#If using ubuntu 14.04 and packaged clang 3.5 -ifeq ($(HAVE_CLANG35),4.2.1) -USE_GCC=0 -CLANGVER=-3.5 -else - -#If using ubuntu 12.04 and downloaded clang 3.4.2 -ifeq ($(HAVE_CLANG),4.2.1) -USE_GCC=0 -CLANGVER= -endif -endif - -# If no version of clang was found -ifeq ($(HAVE_CLANG35),) -ifeq ($(HAVE_CLANG),) -$(error Clang not found. Try make USE_GCC=1) -endif -endif -endif # USE_GCC is not 1 - -ifeq ($(USE_GCC),1) -# GCC Options: -CC = gcc -CXX = g++ -CPP = gcc -E - -# GCC Version -DEV_VER_SUPPORTED = 4.8.1 4.8.2 4.9.1 - -else -# Clang options -CC = clang$(CLANGVER) -CXX = clang++$(CLANGVER) -CPP = clang$(CLANGVER) -E - -# Clang GCC reported version -DEV_VER_SUPPORTED = 4.2.1 -endif - -#LD = ld.gold -LD = ld.bfd -AR = ar rcs -NM = nm -OBJCOPY = objcopy -OBJDUMP = objdump - -# Check if the right version of the toolchain is available -# -DEV_VER_FOUND = $(shell $(CC) -dumpversion) - -ifeq (,$(findstring $(DEV_VER_FOUND), $(DEV_VER_SUPPORTED))) -$(error Unsupported version of $(CC), found: $(DEV_VER_FOUND) instead of one in: $(DEV_VER_SUPPORTED)) -endif - - -# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup - -MAXOPTIMIZATION ?= -O3 - -# Enabling stack checks if OS was build with them -# - -# Set the board flags -# -ifeq ($(CONFIG_BOARD),) -$(error Board config does not define CONFIG_BOARD) -endif -ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) \ - -Dnoreturn_function=__attribute__\(\(noreturn\)\) \ - $(VERBOSITY_LEVEL)\ - -I$(PX4_BASE)/src/modules/systemlib \ - -I$(PX4_BASE)/src/lib/eigen \ - -I$(PX4_BASE)/src/platforms/posix/include \ - -I$(PX4_BASE)/mavlink/include/mavlink \ - -Wno-error=shadow - -UNAME_S := $(shell uname -s) -ifeq ($(UNAME_S),Linux) - ARCHDEFINES += -D__PX4_POSIX -D__PX4_LINUX -endif -ifeq ($(UNAME_S),Darwin) - ARCHDEFINES += -D__PX4_POSIX -D__PX4_DARWIN -endif - -# optimisation flags -# -ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ - -g3 \ - -fno-strict-aliasing \ - -fomit-frame-pointer \ - -funsafe-math-optimizations \ - -fno-builtin-printf \ - -ffunction-sections \ - -fdata-sections - -# Language-specific flags -# -ARCHCFLAGS = -std=gnu99 -g -ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=c++11 -fno-threadsafe-statics -D__CUSTOM_FILE_IO__ -g - -# Generic warnings -# -# Disabled -# -Wshadow - Breaks for the libeigen package headers -# -Wframe-larger-than=1024 - Only needed for embedded - -ARCHWARNINGS = -Wall \ - -Wextra \ - -Werror \ - -Wfloat-equal \ - -Wpointer-arith \ - -Wmissing-declarations \ - -Wpacked \ - -Wno-unused-parameter \ - -Wno-packed \ - -Werror=format-security \ - -Werror=array-bounds \ - -Wfatal-errors \ - -Werror=unused-variable \ - -Werror=reorder \ - -Werror=uninitialized \ - -Werror=init-self - -# Add compiler specific options -ifeq ($(USE_GCC),1) -ARCHDEFINES += -ARCHWARNINGS += -Wdouble-promotion \ - -Wformat=1 \ - -Werror=unused-but-set-variable \ - -Werror=double-promotion -ARCHOPTIMIZATION += -fno-strength-reduce -else -ARCHWARNINGS += -Wno-gnu-array-member-paren-init -endif - -# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+ -# -Wcast-qual - generates spurious noreturn attribute warnings, try again later -# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code -# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives - -# C-specific warnings -# -ARCHCWARNINGS = $(ARCHWARNINGS) \ - -Wbad-function-cast \ - -Wstrict-prototypes \ - -Wmissing-prototypes \ - -Wnested-externs - -# Add compiler specific options -ifeq ($(USE_GCC),1) -ARCHCWARNINGS += -Wold-style-declaration \ - -Wmissing-parameter-type \ - -Wno-error=unused-local-typedefs \ - -Wno-error=enum-compare \ - -Wno-error=float-equal -endif - -# C++-specific warnings -# -ARCHWARNINGSXX = $(ARCHWARNINGS) \ - -Wno-missing-field-initializers - -# pull in *just* libm from the toolchain ... this is grody -LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) -#EXTRA_LIBS += $(LIBM) -#EXTRA_LIBS += ${PX4_BASE}../muorb_krait/lib/libmuorb.so -EXTRA_LIBS += -pthread -lm -lrt - -# Flags we pass to the C compiler -# -CFLAGS = $(ARCHCFLAGS) \ - $(ARCHCWARNINGS) \ - $(ARCHOPTIMIZATION) \ - $(ARCHCPUFLAGS) \ - $(ARCHINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - $(EXTRADEFINES) \ - $(EXTRACFLAGS) \ - -fno-common \ - $(addprefix -I,$(INCLUDE_DIRS)) - -# Flags we pass to the C++ compiler -# -CXXFLAGS = $(ARCHCXXFLAGS) \ - $(ARCHWARNINGSXX) \ - $(ARCHOPTIMIZATION) \ - $(ARCHCPUFLAGS) \ - $(ARCHXXINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - -DCONFIG_WCHAR_BUILTIN \ - $(EXTRADEFINES) \ - $(EXTRACXXFLAGS) \ - -Wno-effc++ \ - $(addprefix -I,$(INCLUDE_DIRS)) - -ifeq ($(USE_GCC),0) -CXXFLAGS += -Wno-deprecated-register \ - -Wno-tautological-constant-out-of-range-compare \ - -Wno-unused-private-field \ - -Wno-unused-const-variable -endif - -# Flags we pass to the assembler -# -AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \ - $(EXTRADEFINES) \ - $(EXTRAAFLAGS) - -LDSCRIPT = $(PX4_BASE)/makefiles/posix/ld.script -# Flags we pass to the linker -# -LDFLAGS += $(EXTRALDFLAGS) \ - $(addprefix -L,$(LIB_DIRS)) - -# Compiler support library -# -LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) - -# Files that the final link depends on -# -#LINK_DEPS += $(LDSCRIPT) -LINK_DEPS += - -# Files to include to get automated dependencies -# -DEP_INCLUDES = $(subst .o,.d,$(OBJS)) - -# Compile C source $1 to object $2 -# as a side-effect, generate a dependency file -# -define COMPILE - @$(ECHO) "CC: $1" - @$(MKDIR) -p $(dir $2) - $(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 -endef - -# Compile C++ source $1 to $2 -# as a side-effect, generate a dependency file -# -define COMPILEXX - @$(ECHO) "CXX: $1" - @$(MKDIR) -p $(dir $2) - @$(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 - $(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 -endef - -# Assemble $1 into $2 -# -define ASSEMBLE - @$(ECHO) "AS: $1" - @$(MKDIR) -p $(dir $2) - $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 -endef - -# Produce partially-linked $1 from files in $2 -# -#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold -define PRELINK - @$(ECHO) "PRELINK: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(LD) -Ur -o $1 $2 - -endef -# Produce partially-linked $1 from files in $2 -# -#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold -define PRELINKF - @$(ECHO) "PRELINK: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(LD) -Ur -T$(LDSCRIPT) -o $1 $2 - -endef -# $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 - -# Update the archive $1 with the files in $2 -# -define ARCHIVE - @$(ECHO) "AR: $2" - @$(MKDIR) -p $(dir $1) - $(Q) $(AR) $1 $2 -endef - -# Link the objects in $2 into the shared library $1 -# -define LINK_A - @$(ECHO) "LINK_A: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(AR) $1 $2 -endef - -# Link the objects in $2 into the shared library $1 -# -define LINK_SO - @$(ECHO) "LINK_SO: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) -pthread -lc -endef - -# Link the objects in $2 into the application $1 -# -define LINK - @$(ECHO) "LINK: $1" - @$(MKDIR) -p $(dir $1) - $(Q) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $1 $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC) - -endef - diff --git a/makefiles/qurt/DISABLE_config_qurt_muorb_test.mk b/makefiles/qurt/DISABLE_config_qurt_muorb_test.mk deleted file mode 100644 index 07f4355073..0000000000 --- a/makefiles/qurt/DISABLE_config_qurt_muorb_test.mk +++ /dev/null @@ -1,77 +0,0 @@ -# -# Makefile for the Foo *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -#MODULES += drivers/blinkm -#MODULES += drivers/pwm_out_sim -#MODULES += drivers/led -#MODULES += drivers/rgbled -#MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -#MODULES += systemcmds/param - -# -# General system control -# -#MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -#MODULES += modules/attitude_estimator_ekf -#MODULES += modules/ekf_att_pos_estimator - -# -# Vehicle Control -# -#MODULES += modules/mc_att_control - -# -# Library modules -# -#MODULES += modules/systemlib -#MODULES += modules/systemlib/mixer -MODULES += modules/uORB -#MODULES += modules/dataman -#MODULES += modules/sdlog2 -#MODULES += modules/simulator -#MODULES += modules/commander - -# -# Libraries -# -#MODULES += lib/mathlib -#MODULES += lib/mathlib/math/filter -#MODULES += lib/geo -#MODULES += lib/geo_lookup -#MODULES += lib/conversion - -# -# QuRT port -# -MODULES += platforms/qurt/px4_layer -#MODULES += platforms/posix/drivers/accelsim -#MODULES += platforms/posix/drivers/gyrosim -#MODULES += platforms/posix/drivers/adcsim -#MODULES += platforms/posix/drivers/barosim - -# -# Unit tests -# -MODULES += platforms/qurt/tests/muorb -#MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue - -# -# sources for muorb over fastrpc -# -MODULES += $(PX4_BASE)/../muorb_qurt/ diff --git a/makefiles/qurt/board_qurt.mk b/makefiles/qurt/board_qurt.mk deleted file mode 100644 index 1038a90b76..0000000000 --- a/makefiles/qurt/board_qurt.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -# Board-specific definitions for the Linux port of PX4 -# - -# -# Configure the toolchain -# -CONFIG_ARCH = HEXAGON -CONFIG_BOARD = QURTTEST - -include $(PX4_MK_DIR)/qurt/toolchain_hexagon.mk diff --git a/makefiles/qurt/config_qurt_adsp.mk b/makefiles/qurt/config_qurt_adsp.mk deleted file mode 100644 index fcd63eef57..0000000000 --- a/makefiles/qurt/config_qurt_adsp.mk +++ /dev/null @@ -1,87 +0,0 @@ -#Added configuration specific flags here. - -ifndef HEXAGON_DRIVERS_ROOT -$(error HEXAGON_DRIVERS_ROOT is not set) -endif -ifndef EAGLE_DRIVERS_SRC -$(error EAGLE_DRIVERS_SRC is not set) -endif - -INCLUDE_DIRS += $(HEXAGON_DRIVERS_ROOT)/inc - -# For Actual flight we need to link against the driver dynamic libraries -LDFLAGS += -L${HEXAGON_DRIVERS_ROOT}/libs -lmpu9x50 -LDFLAGS += -luart_esc -LDFLAGS += -lcsr_gps -LDFLAGS += -lrc_receiver - -# -# Makefile for the EAGLE QuRT *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -MODULES += modules/sensors -MODULES += $(EAGLE_DRIVERS_SRC)/mpu9x50 -MODULES += $(EAGLE_DRIVERS_SRC)/uart_esc -MODULES += $(EAGLE_DRIVERS_SRC)/rc_receiver -MODULES += $(EAGLE_DRIVERS_SRC)/csr_gps - -# -# System commands -# -MODULES += systemcmds/param - - -# -# General system control -# - -# -# Estimation modules (EKF/ SO3 / other filters) -# -MODULES += modules/ekf_att_pos_estimator -MODULES += modules/attitude_estimator_q -MODULES += modules/position_estimator_inav - -# -# Vehicle Control -# -MODULES += modules/mc_att_control -MODULES += modules/mc_pos_control - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/uORB -#MODULES += modules/dataman -MODULES += modules/commander -MODULES += modules/controllib - -# -# Libraries -# -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion - -# -# QuRT port -# -MODULES += platforms/qurt/px4_layer -MODULES += platforms/posix/work_queue - -# -# Unit tests -# - -# -# sources for muorb over fastrpc -# -MODULES += modules/muorb/adsp/ diff --git a/makefiles/qurt/config_qurt_default.mk b/makefiles/qurt/config_qurt_default.mk deleted file mode 100644 index e09754ab7b..0000000000 --- a/makefiles/qurt/config_qurt_default.mk +++ /dev/null @@ -1,83 +0,0 @@ -# -# Makefile for the Foo *default* configuration -# - -# -# Use the configuration's ROMFS. -# -#ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/blinkm -MODULES += drivers/pwm_out_sim -MODULES += drivers/led -MODULES += drivers/rgbled -MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -MODULES += systemcmds/param - -# -# General system control -# -#MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -#MODULES += modules/attitude_estimator_ekf -#MODULES += modules/ekf_att_pos_estimator - -# -# Vehicle Control -# -#MODULES += modules/mc_att_control - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/uORB -#MODULES += modules/dataman -#MODULES += modules/sdlog2 -#MODULES += modules/simulator -#MODULES += modules/commander - -# -# Libraries -# -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -#MODULES += lib/geo -#MODULES += lib/geo_lookup -MODULES += lib/conversion - -# -# QuRT port -# -MODULES += platforms/qurt/px4_layer -MODULES += platforms/posix/work_queue -MODULES += platforms/posix/drivers/accelsim -MODULES += platforms/posix/drivers/gyrosim -MODULES += platforms/posix/drivers/adcsim -MODULES += platforms/posix/drivers/barosim - -# -# Unit tests -# -MODULES += platforms/qurt/tests/hello -MODULES += platforms/posix/tests/vcdev_test -MODULES += platforms/posix/tests/hrt_test -MODULES += platforms/posix/tests/wqueue - -# -# sources for muorb over fastrpc -# -#MODULES += $(PX4_BASE)/../muorb_qurt/ diff --git a/makefiles/qurt/config_qurt_hello.mk b/makefiles/qurt/config_qurt_hello.mk deleted file mode 100644 index 2ec18b7fce..0000000000 --- a/makefiles/qurt/config_qurt_hello.mk +++ /dev/null @@ -1,74 +0,0 @@ -# -# Makefile for the Foo *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -#MODULES += drivers/blinkm -#MODULES += drivers/pwm_out_sim -#MODULES += drivers/led -#MODULES += drivers/rgbled -#MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -MODULES += systemcmds/param - -# -# General system control -# -#MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -#MODULES += modules/attitude_estimator_ekf -#MODULES += modules/ekf_att_pos_estimator - -# -# Vehicle Control -# -#MODULES += modules/mc_att_control - -# -# Library modules -# -MODULES += modules/systemlib -#MODULES += modules/systemlib/mixer -MODULES += modules/uORB -#MODULES += modules/dataman -#MODULES += modules/sdlog2 -#MODULES += modules/simulator -#MODULES += modules/commander - -# -# Libraries -# -#MODULES += lib/mathlib -#MODULES += lib/mathlib/math/filter -#MODULES += lib/geo -#MODULES += lib/geo_lookup -#MODULES += lib/conversion - -# -# QuRT port -# -MODULES += platforms/qurt/px4_layer -MODULES += platforms/posix/work_queue -#MODULES += platforms/posix/drivers/accelsim -#MODULES += platforms/posix/drivers/gyrosim -#MODULES += platforms/posix/drivers/adcsim -#MODULES += platforms/posix/drivers/barosim - -# -# Unit tests -# -MODULES += platforms/qurt/tests/hello -#MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue - diff --git a/makefiles/qurt/config_qurt_hil.mk b/makefiles/qurt/config_qurt_hil.mk deleted file mode 100644 index 6f14dd6a00..0000000000 --- a/makefiles/qurt/config_qurt_hil.mk +++ /dev/null @@ -1,84 +0,0 @@ -# -# Makefile for the Foo *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -MODULES += drivers/boards/sitl -#MODULES += drivers/blinkm -MODULES += drivers/pwm_out_sim -MODULES += drivers/led -MODULES += drivers/rgbled -MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -MODULES += systemcmds/param -MODULES += systemcmds/mixer - -# -# General system control -# -#MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -#MODULES += modules/attitude_estimator_ekf -MODULES += modules/ekf_att_pos_estimator -MODULES += modules/attitude_estimator_q -MODULES += modules/position_estimator_inav - -# -# Vehicle Control -# -MODULES += modules/mc_att_control -MODULES += modules/mc_pos_control - -# -# Library modules -# -MODULES += modules/systemlib -MODULES += modules/systemlib/mixer -MODULES += modules/uORB -#MODULES += modules/dataman -#MODULES += modules/sdlog2 -#MODULES += modules/simulator -MODULES += modules/commander - -# -# Libraries -# -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion -MODULES += modules/controllib - -# -# QuRT port -# -MODULES += platforms/qurt/px4_layer -MODULES += platforms/posix/work_queue -#MODULES += platforms/posix/drivers/accelsim -#MODULES += platforms/posix/drivers/gyrosim -#MODULES += platforms/posix/drivers/adcsim -#MODULES += platforms/posix/drivers/barosim - -# -# Unit tests -# -#MODULES += platforms/qurt/tests/muorb -#MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue - -# -# sources for muorb over fastrpc -# -MODULES += modules/muorb/adsp/ diff --git a/makefiles/qurt/config_qurt_muorb_test.mk b/makefiles/qurt/config_qurt_muorb_test.mk deleted file mode 100644 index 57a961734f..0000000000 --- a/makefiles/qurt/config_qurt_muorb_test.mk +++ /dev/null @@ -1,80 +0,0 @@ -# -# Makefile for the Foo *default* configuration -# - -# -# Board support modules -# -MODULES += drivers/device -#MODULES += drivers/blinkm -#MODULES += drivers/pwm_out_sim -#MODULES += drivers/led -#MODULES += drivers/rgbled -#MODULES += modules/sensors -#MODULES += drivers/ms5611 - -# -# System commands -# -#MODULES += systemcmds/param -#MODULES += systemcmds/mixer - -# -# General system control -# -#MODULES += modules/mavlink - -# -# Estimation modules (EKF/ SO3 / other filters) -# -#MODULES += modules/attitude_estimator_ekf -#MODULES += modules/ekf_att_pos_estimator - -# -# Vehicle Control -# -#MODULES += modules/mc_att_control -#MODULES += modules/mc_pos_control - -# -# Library modules -# -MODULES += modules/systemlib -#MODULES += modules/systemlib/mixer -MODULES += modules/uORB -#MODULES += modules/dataman -#MODULES += modules/sdlog2 -#MODULES += modules/simulator -#MODULES += modules/commander - -# -# Libraries -# -MODULES += lib/mathlib -MODULES += lib/mathlib/math/filter -MODULES += lib/geo -MODULES += lib/geo_lookup -MODULES += lib/conversion - -# -# QuRT port -# -MODULES += platforms/qurt/px4_layer -MODULES += platforms/posix/work_queue -#MODULES += platforms/posix/drivers/accelsim -#MODULES += platforms/posix/drivers/gyrosim -#MODULES += platforms/posix/drivers/adcsim -#MODULES += platforms/posix/drivers/barosim - -# -# Unit tests -# -MODULES += platforms/qurt/tests/muorb -#MODULES += platforms/posix/tests/vcdev_test -#MODULES += platforms/posix/tests/hrt_test -#MODULES += platforms/posix/tests/wqueue - -# -# sources for muorb over fastrpc -# -MODULES += modules/muorb/adsp/ diff --git a/makefiles/qurt/firmware_qurt.mk b/makefiles/qurt/firmware_qurt.mk deleted file mode 100644 index ac87683487..0000000000 --- a/makefiles/qurt/firmware_qurt.mk +++ /dev/null @@ -1,62 +0,0 @@ -# -# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Built products -# -FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)$(config).build/firmware.a) - -all: $(FIRMWARES) - -# -# Generate FIRMWARES. -# -.PHONY: $(FIRMWARES) -$(BUILD_DIR)%.build/firmware.a: config = $(patsubst $(BUILD_DIR)%.build/firmware.a,%,$@) -$(BUILD_DIR)%.build/firmware.a: work_dir = $(BUILD_DIR)$(config).build/ -$(FIRMWARES): $(BUILD_DIR)%.build/firmware.a: generateuorbtopicheaders - @$(ECHO) %%%% - @$(ECHO) %%%% Building $(config) in $(work_dir) - @$(ECHO) %%%% - $(Q) $(MKDIR) -p $(work_dir) - $(Q) $(MAKE) -r --no-print-directory -C $(work_dir) \ - -f $(PX4_MK_DIR)firmware.mk \ - CONFIG=$(config) \ - WORK_DIR=$(work_dir) \ - $(FIRMWARE_GOAL) - -HEXAGON_TOOLS_ROOT ?= /opt/6.4.03 -V_ARCH = v5 -HEXAGON_CLANG_BIN = $(addsuffix /qc/bin,$(HEXAGON_TOOLS_ROOT)) -SIM = $(HEXAGON_CLANG_BIN)/hexagon-sim -SIMFLAGS+= -m$(V_ARCH) -sim: - $(SIM) $(SIMFLAGS) Build/qurt_default.build/mainapp diff --git a/makefiles/qurt/qurt.mk b/makefiles/qurt/qurt.mk deleted file mode 100644 index 00bbe8dc8f..0000000000 --- a/makefiles/qurt/qurt.mk +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (C) 2015 Mark Charlebois. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Rules and definitions related to handling the Linux specific impl when -# building firmware. -# - -MODULES += \ - platforms/common - diff --git a/makefiles/qurt/qurt_eigen.patch b/makefiles/qurt/qurt_eigen.patch deleted file mode 100644 index 9ea57403ba..0000000000 --- a/makefiles/qurt/qurt_eigen.patch +++ /dev/null @@ -1,17 +0,0 @@ -This patch is required for QuRT. complex.h defines "I" and it replaces "I" in the -enum definition without this patch creating an error. - -diff --git a/Eigen/src/Core/SolveTriangular.h b/Eigen/src/Core/SolveTriangular.h -index ef17f28..1116270 100644 ---- a/Eigen/src/Core/SolveTriangular.h -+++ b/Eigen/src/Core/SolveTriangular.h -@@ -112,6 +112,9 @@ template - struct triangular_solver_unroller; - -+#ifdef __PX4_QURT -+#undef I -+#endif - template - struct triangular_solver_unroller { - enum { diff --git a/makefiles/qurt/qurt_elf.mk b/makefiles/qurt/qurt_elf.mk deleted file mode 100644 index 73f1cd4ece..0000000000 --- a/makefiles/qurt/qurt_elf.mk +++ /dev/null @@ -1,85 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Makefile for PX4 Linux based firmware images. -# - -################################################################################ -# Build rules -################################################################################ - -# -# What we're going to build. -# - -EXTRALDFLAGS = -Wl,-soname=libpx4.so -PRODUCT_SHARED_LIB = $(WORK_DIR)firmware.a -PRODUCT_SHARED_PRELINK = $(WORK_DIR)firmware.o - -.PHONY: firmware -firmware: $(PRODUCT_SHARED_LIB) $(WORK_DIR)libpx4.so $(WORK_DIR)mainapp - -# -# Built product rules -# - -$(PRODUCT_SHARED_PRELINK): $(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES) - $(call PRELINKF,$@,$(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS)) - -$(PRODUCT_SHARED_LIB): $(PRODUCT_SHARED_PRELINK) - $(call LINK_A,$@,$(PRODUCT_SHARED_PRELINK)) - -$(WORK_DIR)apps.cpp: $(PX4_BASE)/Tools/qurt_apps.py - $(PX4_BASE)/Tools/qurt_apps.py > $@ - -$(WORK_DIR)apps.o: $(WORK_DIR)apps.cpp - $(call COMPILEXX,$<, $@) - mv $(WORK_DIR)apps.cpp $(WORK_DIR)apps.cpp_sav - -$(WORK_DIR)libpx4.so: $(WORK_DIR)apps.o $(PRODUCT_SHARED_LIB) - $(call LINK_SO,$@, $^) - -$(WORK_DIR)dspal_stub.o: $(PX4_BASE)/src/platforms/qurt/dspal/dspal_stub.c - $(call COMPILENOSHARED,$^, $@) - -$(WORK_DIR)mainapp: $(WORK_DIR)dspal_stub.o - $(call LINK,$@, $^) - -# -# Utility rules -# - -.PHONY: clean -clean: $(MODULE_CLEANS) - @$(ECHO) %% cleaning - $(Q) $(REMOVE) $(PRODUCT_ELF) - $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS) diff --git a/makefiles/qurt/setup.sh b/makefiles/qurt/setup.sh deleted file mode 100755 index 8ffb13cc4b..0000000000 --- a/makefiles/qurt/setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################ -# -# Copyright (c) 2015 Mark Charlebois. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# ########################################################################### - -# -# This file is required to modify the PX4 project so it can be build with -# the Hexagon toolchain. -# -# 1. Downgrade Eigen to 3.2 because the C++11 features of latest version -# are not supported -# 2. Patch Eigen because the Hexagon toolchain complex.h defines "I" -# - -cd $1 -cd src/lib/eigen/ -git checkout . -git checkout e7850ed81f9c469e02df496ef09ae32ec0379b71 -patch -p1 < ../../../makefiles/qurt/qurt_eigen.patch - diff --git a/makefiles/qurt/toolchain_hexagon.mk b/makefiles/qurt/toolchain_hexagon.mk deleted file mode 100644 index 77a9d4e838..0000000000 --- a/makefiles/qurt/toolchain_hexagon.mk +++ /dev/null @@ -1,345 +0,0 @@ -# -# Copyright (C) 2015 Mark Charlebois. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Definitions for a generic GNU ARM-EABI toolchain -# - -#$(info TOOLCHAIN gnu-arm-eabi) - -# Toolchain commands. Normally only used inside this file. -# -HEXAGON_TOOLS_ROOT ?= /opt/6.4.03 -#HEXAGON_TOOLS_ROOT = /opt/6.4.05 -HEXAGON_SDK_ROOT ?= /opt/Hexagon_SDK/2.0 -V_ARCH = v5 -CROSSDEV = hexagon- -HEXAGON_BIN = $(addsuffix /gnu/bin,$(HEXAGON_TOOLS_ROOT)) -HEXAGON_CLANG_BIN = $(addsuffix /qc/bin,$(HEXAGON_TOOLS_ROOT)) -HEXAGON_LIB_DIR = $(HEXAGON_TOOLS_ROOT)/gnu/hexagon/lib -HEXAGON_ISS_DIR = $(HEXAGON_TOOLS_ROOT)/qc/lib/iss -TOOLSLIB = $(HEXAGON_TOOLS_ROOT)/dinkumware/lib/$(V_ARCH)/G0 -QCTOOLSLIB = $(HEXAGON_TOOLS_ROOT)/qc/lib/$(V_ARCH)/G0 -QURTLIB = $(HEXAGON_SDK_ROOT)/lib/common/qurt/ADSP$(V_ARCH)MP/lib -DSPAL_INCS ?= $(PX4_BASE)/src/lib/dspal - - -CC = $(HEXAGON_CLANG_BIN)/$(CROSSDEV)clang -CXX = $(HEXAGON_CLANG_BIN)/$(CROSSDEV)clang++ -CPP = $(HEXAGON_CLANG_BIN)/$(CROSSDEV)clang -E -LD = $(HEXAGON_BIN)/$(CROSSDEV)ld -AR = $(HEXAGON_BIN)/$(CROSSDEV)ar rcs -NM = $(HEXAGON_BIN)/$(CROSSDEV)nm -OBJCOPY = $(HEXAGON_BIN)/$(CROSSDEV)objcopy -OBJDUMP = $(HEXAGON_BIN)/$(CROSSDEV)objdump -HEXAGON_GCC = $(HEXAGON_BIN)/$(CROSSDEV)gcc - -QURTLIBS = \ - $(QCTOOLSLIB)/libdl.a \ - $(TOOLSLIB)/init.o \ - $(TOOLSLIB)/libc.a \ - $(TOOLSLIB)/libqcc.a \ - $(TOOLSLIB)/libstdc++.a \ - $(QURTLIB)/crt0.o \ - $(QURTLIB)/libqurt.a \ - $(QURTLIB)/libqurtkernel.a \ - $(QURTLIB)/libqurtcfs.a \ - $(QURTLIB)/libqube_compat.a \ - $(QURTLIB)/libtimer.a \ - $(QURTLIB)/libposix.a \ - $(QURTLIB)/../examples/cust_config.o \ - $(QCTOOLSLIB)/libhexagon.a \ - $(TOOLSLIB)/fini.o - -DYNAMIC_LIBS = \ - -Wl,$(TOOLSLIB)/pic/libstdc++.a - - -# Check if the right version of the toolchain is available -# -CROSSDEV_VER_SUPPORTED = 6.4.03 6.4.05 -CROSSDEV_VER_FOUND = $(shell $(CC) --version | sed -n 's/^.*version \([\. 0-9]*\),.*$$/\1/p') - -ifeq (,$(findstring $(CROSSDEV_VER_FOUND), $(CROSSDEV_VER_SUPPORTED))) -$(error Unsupported version of $(CC), found: $(CROSSDEV_VER_FOUND) instead of one in: $(CROSSDEV_VER_SUPPORTED)) -endif - - -# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup - -MAXOPTIMIZATION := -O0 - -# Base CPU flags for each of the supported architectures. -# -ARCHCPUFLAGS = -m$(V_ARCH) -G0 - - -# Set the board flags -# -ifeq ($(CONFIG_BOARD),) -$(error Board config does not define CONFIG_BOARD) -endif -ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) \ - -D__PX4_QURT -D__PX4_POSIX \ - -D_PID_T -D_UID_T -D_TIMER_T\ - -Dnoreturn_function= \ - -D__EXPORT= \ - -Drestrict= \ - -D_DEBUG \ - -I$(DSPAL_INCS)/include \ - -I$(DSPAL_INCS)/sys \ - -I$(HEXAGON_TOOLS_ROOT)/gnu/hexagon/include \ - -I$(PX4_BASE)/src/lib/eigen \ - -I$(PX4_BASE)/src/platforms/qurt/include \ - -I$(PX4_BASE)/src/platforms/posix/include \ - -I$(PX4_BASE)/mavlink/include/mavlink \ - -I$(PX4_BASE)/../inc \ - -I$(QURTLIB)/..//include \ - -I$(HEXAGON_SDK_ROOT)/inc \ - -I$(HEXAGON_SDK_ROOT)/inc/stddef \ - -Wno-error=shadow - - - -# optimisation flags -# -ARCHOPTIMIZATION = \ - -O0 \ - -g \ - -fno-strict-aliasing \ - -fdata-sections \ - -fpic \ - -fno-zero-initialized-in-bss - -#-fomit-frame-pointer \ -#-funsafe-math-optimizations \ -#-ffunction-sections -#$(MAXOPTIMIZATION) - -# enable precise stack overflow tracking -# note - requires corresponding support in NuttX -INSTRUMENTATIONDEFINES = $(ARCHINSTRUMENTATIONDEFINES_$(CONFIG_ARCH)) - -# Language-specific flags -# -ARCHCFLAGS = -std=gnu99 -D__CUSTOM_FILE_IO__ -ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x -fno-threadsafe-statics -D__CUSTOM_FILE_IO__ - -# Generic warnings -# -ARCHWARNINGS = -Wall \ - -Wextra \ - -Werror \ - -Wno-unused-parameter \ - -Wno-unused-function \ - -Wno-unused-variable \ - -Wno-gnu-array-member-paren-init \ - -Wno-cast-align \ - -Wno-missing-braces \ - -Wno-strict-aliasing -# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+ -# -Wcast-qual - generates spurious noreturn attribute warnings, try again later -# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code -# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives - -# C-specific warnings -# -ARCHCWARNINGS = $(ARCHWARNINGS) \ - -Wstrict-prototypes \ - -Wnested-externs - -# C++-specific warnings -# -ARCHWARNINGSXX = $(ARCHWARNINGS) \ - -Wno-missing-field-initializers - -# pull in *just* libm from the toolchain ... this is grody -LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) -EXTRA_LIBS += $(LIBM) - -# Flags we pass to the C compiler -# -CFLAGS = $(ARCHCFLAGS) \ - $(ARCHCWARNINGS) \ - $(ARCHOPTIMIZATION) \ - $(ARCHCPUFLAGS) \ - $(ARCHINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - $(EXTRADEFINES) \ - $(EXTRACFLAGS) \ - $(addprefix -I,$(INCLUDE_DIRS)) - - #-fno-common -# Flags we pass to the C++ compiler -# -CXXFLAGS = $(ARCHCXXFLAGS) \ - $(ARCHWARNINGSXX) \ - $(ARCHOPTIMIZATION) \ - $(ARCHCPUFLAGS) \ - $(ARCHXXINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - -DCONFIG_WCHAR_BUILTIN \ - $(EXTRADEFINES) \ - $(EXTRACXXFLAGS) \ - $(addprefix -I,$(INCLUDE_DIRS)) - -# Flags we pass to the assembler -# -AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \ - $(EXTRADEFINES) \ - $(EXTRAAFLAGS) - -LDSCRIPT = $(PX4_BASE)/makefiles/posix/ld.script -# Flags we pass to the linker -# -LDFLAGS += -g -mv5 -mG0lib -G0 -fpic -shared \ - -Wl,-Bsymbolic \ - -Wl,--wrap=malloc \ - -Wl,--wrap=calloc \ - -Wl,--wrap=free \ - -Wl,--wrap=realloc \ - -Wl,--wrap=memalign \ - -Wl,--wrap=__stack_chk_fail \ - -lc \ - $(EXTRALDFLAGS) \ - $(addprefix -L,$(LIB_DIRS)) - -# Compiler support library -# -LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) - -# Files that the final link depends on -# -LINK_DEPS += $(LDSCRIPT) - -# Files to include to get automated dependencies -# -DEP_INCLUDES = $(subst .o,.d,$(OBJS)) - -# Compile C source $1 to object $2 -# as a side-effect, generate a dependency file -# -define COMPILENOSHARED - @$(ECHO) "CC: $1" - @$(MKDIR) -p $(dir $2) - @echo $(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 - $(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 -endef - -# Compile C source $1 to object $2 for use in shared library -# as a side-effect, generate a dependency file -# -define COMPILE - @$(ECHO) "CC: $1" - @$(MKDIR) -p $(dir $2) - @echo $(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 - #$(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) -D__V_DYNAMIC__ -fPIC $(abspath $1) -o $2 - #$(CCACHE) $(CC) -MD -c $(CFLAGS) -D__V_DYNAMIC__ -D__FILENAME__=\"$(notdir $1)\" -fPIC $(abspath $1) -o $2 - $(CCACHE) $(CC) -c $(CFLAGS) -D__V_DYNAMIC__ -D__FILENAME__=\"$(notdir $1)\" $(abspath $1) -o $2 -endef - -# Compile C++ source $1 to $2 for use in shared library -# as a side-effect, generate a dependency file -# -define COMPILEXX - @$(ECHO) "CXX: $1" - @$(MKDIR) -p $(dir $2) - @echo $(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 - #$(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) -D__V_DYNAMIC__ -fPIC $(abspath $1) -o $2 - #$(CCACHE) $(CXX) -MD -c $(CXXFLAGS) -D__V_DYNAMIC__ -D__FILENAME__=\"$(notdir $1)\" -fPIC $(abspath $1) -o $2 - $(CCACHE) $(CXX) -c $(CXXFLAGS) -D__V_DYNAMIC__ -D__FILENAME__=\"$(notdir $1)\" $(abspath $1) -o $2 -endef - -# Assemble $1 into $2 -# -define ASSEMBLE - @$(ECHO) "AS: $1" - @$(MKDIR) -p $(dir $2) - $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 -endef - -# Produce partially-linked $1 from files in $2 -# -#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold -define PRELINK - @$(ECHO) "PRELINK: $1" - @$(MKDIR) -p $(dir $1) - @echo $(Q) $(LD) -Ur -o $1 $2 - $(Q) $(LD) -Ur -o $1 $2 - -endef -# Produce partially-linked $1 from files in $2 -# -#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold -define PRELINKF - @$(ECHO) "PRELINKF: $1" - @$(MKDIR) -p $(dir $1) - @echo $(Q) $(LD) -Ur -T$(LDSCRIPT) -o $1 $2 - $(Q) $(LD) -Ur -T$(LDSCRIPT) -o $1 $2 - -endef -# $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 - -# Update the archive $1 with the files in $2 -# -define ARCHIVE - @$(ECHO) "AR: $2" - @$(MKDIR) -p $(dir $1) - $(Q) $(AR) $1 $2 -endef - -# Link the objects in $2 into the shared library $1 -# -define LINK_A - @$(ECHO) "LINK_A: $1" - @$(MKDIR) -p $(dir $1) - echo "$(Q) $(AR) $1 $2" - $(Q) $(AR) $1 $2 -endef - -# Link the objects in $2 into the shared library $1 -# -define LINK_SO - @$(ECHO) "LINK_SO: $1" - @$(MKDIR) -p $(dir $1) - $(HEXAGON_GCC) $(LDFLAGS) -o $1 -Wl,--whole-archive $2 -Wl,--no-whole-archive $(LIBS) $(DYNAMIC_LIBS) -endef - -# Link the objects in $2 into the application $1 -# -define LINK - @$(ECHO) "LINK: $1" - @$(MKDIR) -p $(dir $1) - $(LD) --section-start .start=0x1d000000 -o $1 --start-group $2 $(EXTRA_LIBS) $(QURTLIBS) --end-group --dynamic-linker= -E --force-dynamic -endef - diff --git a/makefiles/setup.mk b/makefiles/setup.mk deleted file mode 100644 index dd5637bcd9..0000000000 --- a/makefiles/setup.mk +++ /dev/null @@ -1,110 +0,0 @@ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -# -# Path and tool setup -# - -export PX4_TARGET_OS ?= nuttx - -# PX4_TARGET_OS can be nuttx, posix, or qurt -ifeq ($(PX4_TARGET_OS),) -$(error Use: make PX4_TARGET_OS= where is nuttx, posix, or qurt) -endif - -# -# Some useful paths. -# -# Note that in general we always keep directory paths with the separator -# at the end, and join paths without explicit separators. This reduces -# the number of duplicate slashes we have lying around in paths, -# and is consistent with joining the results of $(dir) and $(notdir). -# -export PX4_INCLUDE_DIR = $(abspath $(PX4_BASE)/src/include)/ -export PX4_MODULE_SRC = $(abspath $(PX4_BASE)/src)/ -export PX4_LIB_DIR = $(abspath $(PX4_BASE)/src/lib)/ -export PX4_PLATFORMS_DIR = $(abspath $(PX4_BASE)/src/platforms)/ -export PX4_MK_DIR = $(abspath $(PX4_BASE)/makefiles)/ -export NUTTX_SRC = $(abspath $(PX4_BASE)/NuttX/nuttx)/ -export NUTTX_APP_SRC = $(abspath $(PX4_BASE)/NuttX/apps)/ -#export MAVLINK_SRC = $(abspath $(PX4_BASE)/mavlink/include/mavlink/v1.0)/ -export MAVLINK_SRC = $(abspath $(PX4_BASE)/mavlink)/ -export UAVCAN_DIR = $(abspath $(PX4_BASE)/uavcan)/ -export ROMFS_SRC = $(abspath $(PX4_BASE)/ROMFS)/ -export IMAGE_DIR = $(abspath $(PX4_BASE)/Images)/ -export BUILD_DIR = $(abspath $(PX4_BASE)/Build)/ -export ARCHIVE_DIR = $(abspath $(PX4_BASE)/Archives)/ -export PX4_VERSIONING_DIR = $(BUILD_DIR)versioning/ - -# -# Default include paths -# -export INCLUDE_DIRS := $(PX4_MODULE_SRC) \ - $(PX4_MODULE_SRC)/modules/ \ - $(PX4_INCLUDE_DIR) \ - $(PX4_LIB_DIR) \ - $(PX4_PLATFORMS_DIR) \ - $(PX4_VERSIONING_DIR) - -# -# Tools -# -export MKFW = $(PX4_BASE)/Tools/px_mkfw.py -export UPLOADER = $(PX4_BASE)/Tools/px_uploader.py -export COPY = cp -export COPYDIR = cp -Rf -export REMOVE = rm -f -export RMDIR = rm -rf -export GENROMFS = genromfs -export TOUCH = touch -export MKDIR = mkdir -export FIND = find -export ECHO = echo -export UNZIP_CMD = unzip -export PYTHON = python -export OPENOCD = openocd -export GREP = grep -export SIZE = size - -# -# Host-specific paths, hacks and fixups -# -export SYSTYPE := $(shell uname -s) - -ifeq ($(SYSTYPE),Darwin) -# Eclipse may not have the toolchain on its path. -export PATH := $(PATH):/usr/local/bin -endif - -# -# Makefile debugging. -# -export Q := $(if $(V),,@) From fa5071b3c5257c0d73160e850b6d1829bdd5cbc5 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 11:23:20 +0200 Subject: [PATCH 293/389] Remove module.mk files to prevent confusion of adopters upgrading --- src/drivers/airspeed/module.mk | 40 -------- src/drivers/ardrone_interface/module.mk | 43 --------- src/drivers/batt_smbus/module.mk | 8 -- src/drivers/blinkm/module.mk | 42 --------- src/drivers/bma180/module.mk | 42 --------- src/drivers/boards/aerocore/module.mk | 10 -- .../boards/px4-stm32f4discovery/module.mk | 7 -- src/drivers/boards/px4fmu-v1/module.mk | 12 --- src/drivers/boards/px4fmu-v2/module.mk | 12 --- src/drivers/boards/px4io-v1/module.mk | 8 -- src/drivers/boards/px4io-v2/module.mk | 8 -- src/drivers/boards/sitl/module.mk | 8 -- src/drivers/camera_trigger/module.mk | 42 --------- src/drivers/device/module.mk | 55 ----------- src/drivers/ets_airspeed/module.mk | 44 --------- src/drivers/frsky_telemetry/module.mk | 45 --------- src/drivers/gimbal/module.mk | 42 --------- src/drivers/gps/module.mk | 48 ---------- src/drivers/hmc5883/module.mk | 46 --------- src/drivers/hott/module.mk | 41 -------- src/drivers/irlock/module.mk | 9 -- src/drivers/l3gd20/module.mk | 12 --- src/drivers/led/module.mk | 40 -------- src/drivers/ll40ls/module.mk | 45 --------- src/drivers/lsm303d/module.mk | 12 --- src/drivers/mb12xx/module.mk | 42 --------- src/drivers/md25/module.mk | 44 --------- src/drivers/meas_airspeed/module.mk | 46 --------- src/drivers/mkblctrl/module.mk | 45 --------- src/drivers/mpu6000/module.mk | 46 --------- src/drivers/mpu9250/module.mk | 46 --------- src/drivers/ms5611/module.mk | 46 --------- src/drivers/oreoled/module.mk | 8 -- src/drivers/pca8574/module.mk | 8 -- src/drivers/pca9685/module.mk | 42 --------- src/drivers/pwm_input/module.mk | 42 --------- src/drivers/pwm_out_sim/module.mk | 44 --------- src/drivers/px4flow/module.mk | 46 --------- src/drivers/px4fmu/module.mk | 13 --- src/drivers/px4io/module.mk | 53 ----------- src/drivers/rgbled/module.mk | 10 -- src/drivers/roboclaw/module.mk | 43 --------- src/drivers/sf0x/module.mk | 43 --------- src/drivers/stm32/module.mk | 45 --------- src/drivers/trone/module.mk | 44 --------- src/lib/conversion/module.mk | 40 -------- src/lib/ecl/module.mk | 46 --------- src/lib/external_lgpl/module.mk | 50 ---------- src/lib/geo/module.mk | 38 -------- src/lib/geo_lookup/module.mk | 40 -------- src/lib/launchdetection/module.mk | 42 --------- src/lib/mathlib/module.mk | 44 --------- src/lib/rc/module.mk | 42 --------- src/modules/attitude_estimator_ekf/module.mk | 50 ---------- src/modules/attitude_estimator_q/module.mk | 43 --------- src/modules/bottle_drop/module.mk | 45 --------- src/modules/commander/module.mk | 60 ------------ src/modules/controllib/module.mk | 43 --------- src/modules/dataman/module.mk | 44 --------- src/modules/ekf_att_pos_estimator/module.mk | 46 --------- src/modules/fixedwing_backside/module.mk | 42 --------- src/modules/fw_att_control/module.mk | 47 ---------- src/modules/fw_pos_control_l1/module.mk | 53 ----------- src/modules/gpio_led/module.mk | 41 -------- src/modules/land_detector/module.mk | 17 ---- src/modules/mavlink/module.mk | 59 ------------ src/modules/mc_att_control/module.mk | 45 --------- .../mc_att_control_multiplatform/module.mk | 44 --------- src/modules/mc_pos_control/module.mk | 45 --------- .../mc_pos_control_multiplatform/module.mk | 48 ---------- src/modules/navigator/module.mk | 66 ------------- src/modules/position_estimator_inav/module.mk | 48 ---------- src/modules/px4iofirmware/module.mk | 30 ------ src/modules/sdlog2/module.mk | 51 ---------- src/modules/segway/module.mk | 42 --------- src/modules/sensors/module.mk | 48 ---------- src/modules/simulator/module.mk | 50 ---------- src/modules/systemlib/module.mk | 70 -------------- src/modules/uORB/module.mk | 66 ------------- src/modules/uavcan/module.mk | 94 ------------------- src/modules/unit_test/module.mk | 40 -------- src/modules/vtol_att_control/module.mk | 49 ---------- 82 files changed, 3245 deletions(-) delete mode 100644 src/drivers/airspeed/module.mk delete mode 100644 src/drivers/ardrone_interface/module.mk delete mode 100644 src/drivers/batt_smbus/module.mk delete mode 100644 src/drivers/blinkm/module.mk delete mode 100644 src/drivers/bma180/module.mk delete mode 100644 src/drivers/boards/aerocore/module.mk delete mode 100644 src/drivers/boards/px4-stm32f4discovery/module.mk delete mode 100644 src/drivers/boards/px4fmu-v1/module.mk delete mode 100644 src/drivers/boards/px4fmu-v2/module.mk delete mode 100644 src/drivers/boards/px4io-v1/module.mk delete mode 100644 src/drivers/boards/px4io-v2/module.mk delete mode 100644 src/drivers/boards/sitl/module.mk delete mode 100644 src/drivers/camera_trigger/module.mk delete mode 100644 src/drivers/device/module.mk delete mode 100644 src/drivers/ets_airspeed/module.mk delete mode 100644 src/drivers/frsky_telemetry/module.mk delete mode 100644 src/drivers/gimbal/module.mk delete mode 100644 src/drivers/gps/module.mk delete mode 100644 src/drivers/hmc5883/module.mk delete mode 100644 src/drivers/hott/module.mk delete mode 100644 src/drivers/irlock/module.mk delete mode 100644 src/drivers/l3gd20/module.mk delete mode 100644 src/drivers/led/module.mk delete mode 100644 src/drivers/ll40ls/module.mk delete mode 100644 src/drivers/lsm303d/module.mk delete mode 100644 src/drivers/mb12xx/module.mk delete mode 100644 src/drivers/md25/module.mk delete mode 100644 src/drivers/meas_airspeed/module.mk delete mode 100644 src/drivers/mkblctrl/module.mk delete mode 100644 src/drivers/mpu6000/module.mk delete mode 100644 src/drivers/mpu9250/module.mk delete mode 100644 src/drivers/ms5611/module.mk delete mode 100644 src/drivers/oreoled/module.mk delete mode 100644 src/drivers/pca8574/module.mk delete mode 100644 src/drivers/pca9685/module.mk delete mode 100644 src/drivers/pwm_input/module.mk delete mode 100644 src/drivers/pwm_out_sim/module.mk delete mode 100644 src/drivers/px4flow/module.mk delete mode 100644 src/drivers/px4fmu/module.mk delete mode 100644 src/drivers/px4io/module.mk delete mode 100644 src/drivers/rgbled/module.mk delete mode 100644 src/drivers/roboclaw/module.mk delete mode 100644 src/drivers/sf0x/module.mk delete mode 100644 src/drivers/stm32/module.mk delete mode 100644 src/drivers/trone/module.mk delete mode 100644 src/lib/conversion/module.mk delete mode 100644 src/lib/ecl/module.mk delete mode 100644 src/lib/external_lgpl/module.mk delete mode 100644 src/lib/geo/module.mk delete mode 100644 src/lib/geo_lookup/module.mk delete mode 100644 src/lib/launchdetection/module.mk delete mode 100644 src/lib/mathlib/module.mk delete mode 100644 src/lib/rc/module.mk delete mode 100644 src/modules/attitude_estimator_ekf/module.mk delete mode 100644 src/modules/attitude_estimator_q/module.mk delete mode 100644 src/modules/bottle_drop/module.mk delete mode 100644 src/modules/commander/module.mk delete mode 100644 src/modules/controllib/module.mk delete mode 100644 src/modules/dataman/module.mk delete mode 100644 src/modules/ekf_att_pos_estimator/module.mk delete mode 100644 src/modules/fixedwing_backside/module.mk delete mode 100644 src/modules/fw_att_control/module.mk delete mode 100644 src/modules/fw_pos_control_l1/module.mk delete mode 100644 src/modules/gpio_led/module.mk delete mode 100644 src/modules/land_detector/module.mk delete mode 100644 src/modules/mavlink/module.mk delete mode 100644 src/modules/mc_att_control/module.mk delete mode 100644 src/modules/mc_att_control_multiplatform/module.mk delete mode 100644 src/modules/mc_pos_control/module.mk delete mode 100644 src/modules/mc_pos_control_multiplatform/module.mk delete mode 100644 src/modules/navigator/module.mk delete mode 100644 src/modules/position_estimator_inav/module.mk delete mode 100644 src/modules/px4iofirmware/module.mk delete mode 100644 src/modules/sdlog2/module.mk delete mode 100644 src/modules/segway/module.mk delete mode 100644 src/modules/sensors/module.mk delete mode 100644 src/modules/simulator/module.mk delete mode 100644 src/modules/systemlib/module.mk delete mode 100644 src/modules/uORB/module.mk delete mode 100644 src/modules/uavcan/module.mk delete mode 100644 src/modules/unit_test/module.mk delete mode 100644 src/modules/vtol_att_control/module.mk diff --git a/src/drivers/airspeed/module.mk b/src/drivers/airspeed/module.mk deleted file mode 100644 index 5fbc75309c..0000000000 --- a/src/drivers/airspeed/module.mk +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the generic airspeed driver. -# - -SRCS = airspeed.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/ardrone_interface/module.mk b/src/drivers/ardrone_interface/module.mk deleted file mode 100644 index 285db1351c..0000000000 --- a/src/drivers/ardrone_interface/module.mk +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# AR.Drone motor driver -# - -MODULE_COMMAND = ardrone_interface -SRCS = ardrone_interface.c \ - ardrone_motor_control.c -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/batt_smbus/module.mk b/src/drivers/batt_smbus/module.mk deleted file mode 100644 index b32ea6e55f..0000000000 --- a/src/drivers/batt_smbus/module.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# driver for SMBus smart batteries -# - -MODULE_COMMAND = batt_smbus -SRCS = batt_smbus.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/blinkm/module.mk b/src/drivers/blinkm/module.mk deleted file mode 100644 index c906733175..0000000000 --- a/src/drivers/blinkm/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# BlinkM I2C LED driver -# - -MODULE_COMMAND = blinkm - -SRCS = blinkm.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/bma180/module.mk b/src/drivers/bma180/module.mk deleted file mode 100644 index 33433307a6..0000000000 --- a/src/drivers/bma180/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the BMA180 driver. -# - -MODULE_COMMAND = bma180 - -SRCS = bma180.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/aerocore/module.mk b/src/drivers/boards/aerocore/module.mk deleted file mode 100644 index 0a2d910091..0000000000 --- a/src/drivers/boards/aerocore/module.mk +++ /dev/null @@ -1,10 +0,0 @@ -# -# Board-specific startup code for the AeroCore -# - -SRCS = aerocore_init.c \ - aerocore_pwm_servo.c \ - aerocore_spi.c \ - aerocore_led.c - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/px4-stm32f4discovery/module.mk b/src/drivers/boards/px4-stm32f4discovery/module.mk deleted file mode 100644 index 6b75c08e92..0000000000 --- a/src/drivers/boards/px4-stm32f4discovery/module.mk +++ /dev/null @@ -1,7 +0,0 @@ -# -# Board-specific startup code for the PX4-STM32F4Discovery -# - -SRCS = px4discovery_init.c \ - px4discovery_usb.c \ - px4discovery_led.c diff --git a/src/drivers/boards/px4fmu-v1/module.mk b/src/drivers/boards/px4fmu-v1/module.mk deleted file mode 100644 index 5e1a27d5a1..0000000000 --- a/src/drivers/boards/px4fmu-v1/module.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -# Board-specific startup code for the PX4FMU -# - -SRCS = px4fmu_can.c \ - px4fmu_init.c \ - px4fmu_pwm_servo.c \ - px4fmu_spi.c \ - px4fmu_usb.c \ - px4fmu_led.c - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/px4fmu-v2/module.mk b/src/drivers/boards/px4fmu-v2/module.mk deleted file mode 100644 index 103232b0ca..0000000000 --- a/src/drivers/boards/px4fmu-v2/module.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -# Board-specific startup code for the PX4FMUv2 -# - -SRCS = px4fmu_can.c \ - px4fmu2_init.c \ - px4fmu_pwm_servo.c \ - px4fmu_spi.c \ - px4fmu_usb.c \ - px4fmu2_led.c - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/px4io-v1/module.mk b/src/drivers/boards/px4io-v1/module.mk deleted file mode 100644 index a7a14dd072..0000000000 --- a/src/drivers/boards/px4io-v1/module.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Board-specific startup code for the PX4IO -# - -SRCS = px4io_init.c \ - px4io_pwm_servo.c - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/px4io-v2/module.mk b/src/drivers/boards/px4io-v2/module.mk deleted file mode 100644 index 3f0e9a0b3a..0000000000 --- a/src/drivers/boards/px4io-v2/module.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Board-specific startup code for the PX4IOv2 -# - -SRCS = px4iov2_init.c \ - px4iov2_pwm_servo.c - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/sitl/module.mk b/src/drivers/boards/sitl/module.mk deleted file mode 100644 index c67272fc53..0000000000 --- a/src/drivers/boards/sitl/module.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Board-specific startup code for SITL -# - -SRCS = \ - sitl_led.c - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/camera_trigger/module.mk b/src/drivers/camera_trigger/module.mk deleted file mode 100644 index 54098cc855..0000000000 --- a/src/drivers/camera_trigger/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (C) 2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# External camera-IMU synchronisation via GPIO -# - -MODULE_COMMAND = camera_trigger -SRCS = camera_trigger.cpp \ - camera_trigger_params.c - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/device/module.mk b/src/drivers/device/module.mk deleted file mode 100644 index c206a5037c..0000000000 --- a/src/drivers/device/module.mk +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build the device driver framework. -# - -ifeq ($(PX4_TARGET_OS),nuttx) -SRCS = \ - device_nuttx.cpp \ - cdev.cpp \ - i2c_nuttx.cpp \ - pio.cpp \ - spi.cpp \ - ringbuffer.cpp -else -SRCS = \ - device_posix.cpp \ - vdev.cpp \ - vfile.cpp \ - vdev_posix.cpp \ - i2c_posix.cpp \ - sim.cpp \ - ringbuffer.cpp -endif diff --git a/src/drivers/ets_airspeed/module.mk b/src/drivers/ets_airspeed/module.mk deleted file mode 100644 index 8aaaf0ebb0..0000000000 --- a/src/drivers/ets_airspeed/module.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the Eagle Tree Airspeed V3 driver. -# - -MODULE_COMMAND = ets_airspeed - -SRCS = ets_airspeed.cpp - -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/frsky_telemetry/module.mk b/src/drivers/frsky_telemetry/module.mk deleted file mode 100644 index 78ad6f67ec..0000000000 --- a/src/drivers/frsky_telemetry/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# FrSky telemetry application. -# - -MODULE_COMMAND = frsky_telemetry - -SRCS = frsky_data.c \ - frsky_telemetry.c - -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/gimbal/module.mk b/src/drivers/gimbal/module.mk deleted file mode 100644 index cc0a10c6e3..0000000000 --- a/src/drivers/gimbal/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2014, 2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the gimbal high-level controller -# - -MODULE_COMMAND = gimbal - -SRCS = gimbal.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/gps/module.mk b/src/drivers/gps/module.mk deleted file mode 100644 index 4f99b0d3b5..0000000000 --- a/src/drivers/gps/module.mk +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# GPS driver -# - -MODULE_COMMAND = gps - -SRCS = gps.cpp \ - gps_helper.cpp \ - mtk.cpp \ - ashtech.cpp \ - ubx.cpp - -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/hmc5883/module.mk b/src/drivers/hmc5883/module.mk deleted file mode 100644 index d4028b511d..0000000000 --- a/src/drivers/hmc5883/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# HMC5883 driver -# - -MODULE_COMMAND = hmc5883 - -SRCS = hmc5883_i2c.cpp hmc5883_spi.cpp hmc5883.cpp - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/hott/module.mk b/src/drivers/hott/module.mk deleted file mode 100644 index 31a66d491d..0000000000 --- a/src/drivers/hott/module.mk +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Graupner HoTT Sensors messages. -# - -SRCS = messages.cpp \ - comms.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/irlock/module.mk b/src/drivers/irlock/module.mk deleted file mode 100644 index 5d9fbf4539..0000000000 --- a/src/drivers/irlock/module.mk +++ /dev/null @@ -1,9 +0,0 @@ -# -# Makefile to build the IRLock driver. -# - -MODULE_COMMAND = irlock - -SRCS = irlock.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/l3gd20/module.mk b/src/drivers/l3gd20/module.mk deleted file mode 100644 index 3d64d62be0..0000000000 --- a/src/drivers/l3gd20/module.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -# LSM303D accel/mag driver -# - -MODULE_COMMAND = l3gd20 -SRCS = l3gd20.cpp - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/led/module.mk b/src/drivers/led/module.mk deleted file mode 100644 index 5b7b4491b7..0000000000 --- a/src/drivers/led/module.mk +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build the LED driver. -# - -SRCS = led.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/ll40ls/module.mk b/src/drivers/ll40ls/module.mk deleted file mode 100644 index c2c5e1e22a..0000000000 --- a/src/drivers/ll40ls/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the PulsedLight Lidar-Lite driver. -# - -MODULE_COMMAND = ll40ls - -SRCS = ll40ls.cpp \ - LidarLite.cpp \ - LidarLiteI2C.cpp \ - LidarLitePWM.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/lsm303d/module.mk b/src/drivers/lsm303d/module.mk deleted file mode 100644 index 0421eb113e..0000000000 --- a/src/drivers/lsm303d/module.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -# LSM303D accel/mag driver -# - -MODULE_COMMAND = lsm303d -SRCS = lsm303d.cpp - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/mb12xx/module.mk b/src/drivers/mb12xx/module.mk deleted file mode 100644 index d751e93e4d..0000000000 --- a/src/drivers/mb12xx/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the Maxbotix Sonar driver. -# - -MODULE_COMMAND = mb12xx - -SRCS = mb12xx.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/md25/module.mk b/src/drivers/md25/module.mk deleted file mode 100644 index 3f9cf2d891..0000000000 --- a/src/drivers/md25/module.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# MD25 I2C Based Motor Controller -# http://www.robot-electronics.co.uk/htm/md25tech.htm -# - -MODULE_COMMAND = md25 - -SRCS = md25.cpp \ - md25_main.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/meas_airspeed/module.mk b/src/drivers/meas_airspeed/module.mk deleted file mode 100644 index 6f5909978b..0000000000 --- a/src/drivers/meas_airspeed/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the MEAS Spec airspeed sensor driver. -# - -MODULE_COMMAND = meas_airspeed - -SRCS = meas_airspeed.cpp - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/mkblctrl/module.mk b/src/drivers/mkblctrl/module.mk deleted file mode 100644 index 10468509ef..0000000000 --- a/src/drivers/mkblctrl/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012,2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Interface driver for the Mikrokopter BLCtrl -# - -MODULE_COMMAND = mkblctrl - -SRCS = mkblctrl.cpp \ - mkblctrl_params.c - -INCLUDE_DIRS += $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/mpu6000/module.mk b/src/drivers/mpu6000/module.mk deleted file mode 100644 index da9fcc0fc4..0000000000 --- a/src/drivers/mpu6000/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the MPU6000 driver. -# - -MODULE_COMMAND = mpu6000 - -SRCS = mpu6000.cpp - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/mpu9250/module.mk b/src/drivers/mpu9250/module.mk deleted file mode 100644 index 80ee992da4..0000000000 --- a/src/drivers/mpu9250/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the MPU6000 driver. -# - -MODULE_COMMAND = mpu9250 - -SRCS = mpu9250.cpp - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/ms5611/module.mk b/src/drivers/ms5611/module.mk deleted file mode 100644 index 7ff49d7354..0000000000 --- a/src/drivers/ms5611/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# MS5611 driver -# - -MODULE_COMMAND = ms5611 - -ifeq ($(PX4_TARGET_OS),nuttx) -SRCS = ms5611_nuttx.cpp ms5611_spi.cpp ms5611_i2c.cpp -else -SRCS = ms5611_posix.cpp ms5611_spi.cpp ms5611_i2c.cpp ms5611_sim.cpp -endif - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/oreoled/module.mk b/src/drivers/oreoled/module.mk deleted file mode 100644 index 96afdd5fdc..0000000000 --- a/src/drivers/oreoled/module.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Oreo LED driver -# - -MODULE_COMMAND = oreoled -SRCS = oreoled.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/pca8574/module.mk b/src/drivers/pca8574/module.mk deleted file mode 100644 index c53ed9ab2b..0000000000 --- a/src/drivers/pca8574/module.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# PCA8574 driver for RGB LED -# - -MODULE_COMMAND = pca8574 -SRCS = pca8574.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/pca9685/module.mk b/src/drivers/pca9685/module.mk deleted file mode 100644 index 7a5c7996ec..0000000000 --- a/src/drivers/pca9685/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Driver for the PCA9685 I2C PWM controller -# The chip is used on the adafruit I2C PWM converter, -# which allows to control servos via I2C. -# https://www.adafruit.com/product/815 - -MODULE_COMMAND = pca9685 - -SRCS = pca9685.cpp diff --git a/src/drivers/pwm_input/module.mk b/src/drivers/pwm_input/module.mk deleted file mode 100644 index a135ce777e..0000000000 --- a/src/drivers/pwm_input/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the PWM input driver. -# - -MODULE_COMMAND = pwm_input - -SRCS = pwm_input.cpp - -EXTRACXXFLAGS = -Wno-pmf-conversions diff --git a/src/drivers/pwm_out_sim/module.mk b/src/drivers/pwm_out_sim/module.mk deleted file mode 100644 index 286b4d21f1..0000000000 --- a/src/drivers/pwm_out_sim/module.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Hardware in the Loop (HIL) simulation actuator output bank -# - -MODULE_COMMAND = pwm_out_sim - -SRCS = pwm_out_sim.cpp - -MAXOPTIMIZATION = -Os - -MODULE_STACKSIZE = 1200 diff --git a/src/drivers/px4flow/module.mk b/src/drivers/px4flow/module.mk deleted file mode 100644 index 8d6964d103..0000000000 --- a/src/drivers/px4flow/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the PX4FLOW driver. -# - -MODULE_COMMAND = px4flow - -SRCS = px4flow.cpp - -MAXOPTIMIZATION = -Os - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Wno-attributes diff --git a/src/drivers/px4fmu/module.mk b/src/drivers/px4fmu/module.mk deleted file mode 100644 index 5a2806f4b5..0000000000 --- a/src/drivers/px4fmu/module.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Interface driver for the PX4FMU board -# - -MODULE_COMMAND = fmu -SRCS = fmu.cpp \ - px4fmu_params.c - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/px4io/module.mk b/src/drivers/px4io/module.mk deleted file mode 100644 index 9033d24b61..0000000000 --- a/src/drivers/px4io/module.mk +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Interface driver for the PX4IO board. -# - -MODULE_COMMAND = px4io - -SRCS = px4io.cpp \ - px4io_uploader.cpp \ - px4io_serial.cpp \ - px4io_i2c.cpp \ - px4io_params.c - -# XXX prune to just get UART registers -INCLUDE_DIRS += $(NUTTX_SRC)/arch/arm/src/stm32 $(NUTTX_SRC)/arch/arm/src/common - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/rgbled/module.mk b/src/drivers/rgbled/module.mk deleted file mode 100644 index f4f4e41427..0000000000 --- a/src/drivers/rgbled/module.mk +++ /dev/null @@ -1,10 +0,0 @@ -# -# TCA62724FMG driver for RGB LED -# - -MODULE_COMMAND = rgbled - -SRCS = rgbled.cpp \ - rgbled_params.c - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/roboclaw/module.mk b/src/drivers/roboclaw/module.mk deleted file mode 100644 index c5e55bdc30..0000000000 --- a/src/drivers/roboclaw/module.mk +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# RoboClaw Motor Controller -# - -MODULE_COMMAND = roboclaw - -SRCS = roboclaw_main.cpp \ - RoboClaw.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/sf0x/module.mk b/src/drivers/sf0x/module.mk deleted file mode 100644 index 26e77d1cc6..0000000000 --- a/src/drivers/sf0x/module.mk +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# -# Copyright (c) 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the Lightware laser range finder driver. -# - -MODULE_COMMAND = sf0x - -SRCS = sf0x.cpp \ - sf0x_parser.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/stm32/module.mk b/src/drivers/stm32/module.mk deleted file mode 100644 index 54428e270d..0000000000 --- a/src/drivers/stm32/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# STM32 driver support code -# -# Modules in this directory are compiled for all STM32 targets. -# - -SRCS = drv_hrt.c \ - drv_pwm_servo.c - -INCLUDE_DIRS += $(NUTTX_SRC)/arch/arm/src/stm32 $(NUTTX_SRC)/arch/arm/src/common - -MAXOPTIMIZATION = -Os diff --git a/src/drivers/trone/module.mk b/src/drivers/trone/module.mk deleted file mode 100644 index 38499c6c3e..0000000000 --- a/src/drivers/trone/module.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (c) 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the TeraRanger One range finder driver -# - -MODULE_COMMAND = trone - -SRCS = trone.cpp - -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os diff --git a/src/lib/conversion/module.mk b/src/lib/conversion/module.mk deleted file mode 100644 index 4593c48871..0000000000 --- a/src/lib/conversion/module.mk +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright (C) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Conversion library -# - -SRCS = rotation.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/lib/ecl/module.mk b/src/lib/ecl/module.mk deleted file mode 100644 index 747a7c5be0..0000000000 --- a/src/lib/ecl/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 Estimation and Control Library (ECL). All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Estimation and Control Library -# - -SRCS = attitude_fw/ecl_controller.cpp \ - attitude_fw/ecl_pitch_controller.cpp \ - attitude_fw/ecl_roll_controller.cpp \ - attitude_fw/ecl_yaw_controller.cpp \ - l1/ecl_l1_pos_controller.cpp \ - validation/data_validator.cpp \ - validation/data_validator_group.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/lib/external_lgpl/module.mk b/src/lib/external_lgpl/module.mk deleted file mode 100644 index 29d3514f68..0000000000 --- a/src/lib/external_lgpl/module.mk +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# W A R N I N G: The contents of this directory are license-incompatible -# with the rest of the codebase. Do NOT copy any parts of it -# into other folders. -# -# Acknowledgements: -# -# The algorithms in this folder have been developed by Paul Riseborough -# with support from Andrew Tridgell. -# Originally licensed as LGPL for APM. As this is built as library and -# linked, use of this code does not change the usability of PX4 in general -# or any of the license implications. -# - -SRCS = tecs/tecs.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/lib/geo/module.mk b/src/lib/geo/module.mk deleted file mode 100644 index d08ca4532f..0000000000 --- a/src/lib/geo/module.mk +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Geo library -# - -SRCS = geo.c diff --git a/src/lib/geo_lookup/module.mk b/src/lib/geo_lookup/module.mk deleted file mode 100644 index d7a10df2db..0000000000 --- a/src/lib/geo_lookup/module.mk +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright (c) 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Geo lookup table / data library -# - -SRCS = geo_mag_declination.c - -MAXOPTIMIZATION = -Os diff --git a/src/lib/launchdetection/module.mk b/src/lib/launchdetection/module.mk deleted file mode 100644 index d92f0bb45a..0000000000 --- a/src/lib/launchdetection/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013, 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Launchdetection Library -# - -SRCS = LaunchDetector.cpp \ - CatapultLaunchMethod.cpp \ - launchdetection_params.c - -MAXOPTIMIZATION = -Os diff --git a/src/lib/mathlib/module.mk b/src/lib/mathlib/module.mk deleted file mode 100644 index 191e2da739..0000000000 --- a/src/lib/mathlib/module.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Math library -# -SRCS = math/test/test.cpp \ - math/Limits.cpp - -# -# In order to include .config we first have to save off the -# current makefile name, since app.mk needs it. -# -APP_MAKEFILE := $(lastword $(MAKEFILE_LIST)) diff --git a/src/lib/rc/module.mk b/src/lib/rc/module.mk deleted file mode 100644 index 20f89c8473..0000000000 --- a/src/lib/rc/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Yuntec ST24 transmitter protocol decoder -# Graupnet HoTT transmitter protocol decoder -# - -SRCS = st24.c \ - sumd.c - -MAXOPTIMIZATION = -Os diff --git a/src/modules/attitude_estimator_ekf/module.mk b/src/modules/attitude_estimator_ekf/module.mk deleted file mode 100644 index 716b0aefe4..0000000000 --- a/src/modules/attitude_estimator_ekf/module.mk +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Attitude estimator (Extended Kalman Filter) -# - -MODULE_COMMAND = attitude_estimator_ekf - -SRCS = attitude_estimator_ekf_main.cpp \ - attitude_estimator_ekf_params.c \ - codegen/AttitudeEKF.c - -MODULE_STACKSIZE = 1200 - -EXTRACFLAGS = -Wno-float-equal -Wframe-larger-than=3700 - -ifeq ($(PX4_TARGET_OS),nuttx) -EXTRACXXFLAGS = -Wframe-larger-than=2600 -endif diff --git a/src/modules/attitude_estimator_q/module.mk b/src/modules/attitude_estimator_q/module.mk deleted file mode 100644 index b3688e4a9a..0000000000 --- a/src/modules/attitude_estimator_q/module.mk +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# -# Copyright (c) 2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Attitude estimator (quaternion based) -# - -MODULE_COMMAND = attitude_estimator_q - -SRCS = attitude_estimator_q_main.cpp \ - attitude_estimator_q_params.c - -MODULE_STACKSIZE = 1200 diff --git a/src/modules/bottle_drop/module.mk b/src/modules/bottle_drop/module.mk deleted file mode 100644 index df9f5473b0..0000000000 --- a/src/modules/bottle_drop/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Daemon application -# - -MODULE_COMMAND = bottle_drop - -SRCS = bottle_drop.cpp \ - bottle_drop_params.c - -MAXOPTIMIZATION = -Os - -MODULE_STACKSIZE = 1200 diff --git a/src/modules/commander/module.mk b/src/modules/commander/module.mk deleted file mode 100644 index e4fcea2c69..0000000000 --- a/src/modules/commander/module.mk +++ /dev/null @@ -1,60 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Main system state machine -# - -MODULE_COMMAND = commander -SRCS = commander.cpp \ - commander_params.c \ - state_machine_helper.cpp \ - commander_helper.cpp \ - calibration_routines.cpp \ - accelerometer_calibration.cpp \ - gyro_calibration.cpp \ - mag_calibration.cpp \ - baro_calibration.cpp \ - rc_calibration.cpp \ - airspeed_calibration.cpp \ - esc_calibration.cpp \ - PreflightCheck.cpp - -MODULE_STACKSIZE = 5000 - -MAXOPTIMIZATION = -Os - -ifeq ($(PX4_TARGET_OS),nuttx) -EXTRACXXFLAGS = -Wframe-larger-than=2400 -endif - diff --git a/src/modules/controllib/module.mk b/src/modules/controllib/module.mk deleted file mode 100644 index 2860d1efce..0000000000 --- a/src/modules/controllib/module.mk +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Control library -# -SRCS = test_params.c \ - block/Block.cpp \ - block/BlockParam.cpp \ - uorb/blocks.cpp \ - blocks.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/modules/dataman/module.mk b/src/modules/dataman/module.mk deleted file mode 100644 index 7ebe09fb7e..0000000000 --- a/src/modules/dataman/module.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Main Navigation Controller -# - -MODULE_COMMAND = dataman - -SRCS = dataman.c - -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os diff --git a/src/modules/ekf_att_pos_estimator/module.mk b/src/modules/ekf_att_pos_estimator/module.mk deleted file mode 100644 index 2a582ebbb8..0000000000 --- a/src/modules/ekf_att_pos_estimator/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Main EKF Attitude and Position Estimator -# - -MODULE_COMMAND = ekf_att_pos_estimator - -SRCS = ekf_att_pos_estimator_main.cpp \ - ekf_att_pos_estimator_params.c \ - estimator_22states.cpp \ - estimator_utilities.cpp - -EXTRACXXFLAGS = -Weffc++ -Wframe-larger-than=3400 - diff --git a/src/modules/fixedwing_backside/module.mk b/src/modules/fixedwing_backside/module.mk deleted file mode 100644 index 133728781d..0000000000 --- a/src/modules/fixedwing_backside/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Fixedwing backside controller -# - -MODULE_COMMAND = fixedwing_backside - -SRCS = fixedwing_backside_main.cpp \ - fixedwing.cpp \ - params.c diff --git a/src/modules/fw_att_control/module.mk b/src/modules/fw_att_control/module.mk deleted file mode 100644 index 3909926990..0000000000 --- a/src/modules/fw_att_control/module.mk +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Fixedwing attitude control application -# - -MODULE_COMMAND = fw_att_control - -SRCS = fw_att_control_main.cpp \ - fw_att_control_params.c - -# Startup handler, the actual app stack size is -# in the task_spawn command -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os diff --git a/src/modules/fw_pos_control_l1/module.mk b/src/modules/fw_pos_control_l1/module.mk deleted file mode 100644 index 8a8de708ee..0000000000 --- a/src/modules/fw_pos_control_l1/module.mk +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Fixedwing L1 position control application -# - -MODULE_COMMAND = fw_pos_control_l1 - -SRCS = fw_pos_control_l1_main.cpp \ - fw_pos_control_l1_params.c \ - landingslope.cpp \ - mtecs/mTecs.cpp \ - mtecs/limitoverride.cpp \ - mtecs/mTecs_params.c - -# Startup handler, the actual app stack size is -# in the task_spawn command -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os - -EXTRACXXFLAGS = -Wno-float-equal diff --git a/src/modules/gpio_led/module.mk b/src/modules/gpio_led/module.mk deleted file mode 100644 index 70c75b10cb..0000000000 --- a/src/modules/gpio_led/module.mk +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################ -# -# Copyright (C) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Status LED via GPIO driver -# - -MODULE_COMMAND = gpio_led -SRCS = gpio_led.c - -MAXOPTIMIZATION = -Os diff --git a/src/modules/land_detector/module.mk b/src/modules/land_detector/module.mk deleted file mode 100644 index 4eb7a1cb54..0000000000 --- a/src/modules/land_detector/module.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -# Land detector -# - -MODULE_COMMAND = land_detector - -SRCS = land_detector_main.cpp \ - land_detector_params.c \ - LandDetector.cpp \ - MulticopterLandDetector.cpp \ - FixedwingLandDetector.cpp - -EXTRACXXFLAGS = -Weffc++ -Os - -# Startup handler, the actual app stack size is -# in the task_spawn command -MODULE_STACKSIZE = 1200 diff --git a/src/modules/mavlink/module.mk b/src/modules/mavlink/module.mk deleted file mode 100644 index f197ebb7c9..0000000000 --- a/src/modules/mavlink/module.mk +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# MAVLink protocol to uORB interface process -# - -MODULE_COMMAND = mavlink - -SRCS += mavlink.c \ - mavlink_main.cpp \ - mavlink_mission.cpp \ - mavlink_parameters.cpp \ - mavlink_orb_subscription.cpp \ - mavlink_messages.cpp \ - mavlink_stream.cpp \ - mavlink_rate_limiter.cpp \ - mavlink_receiver.cpp \ - mavlink_ftp.cpp - -INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink - -MAXOPTIMIZATION = -Os - -MODULE_STACKSIZE = 1200 - -EXTRACXXFLAGS = -Weffc++ -Wno-attributes -Wno-packed -DMAVLINK_COMM_NUM_BUFFERS=3 - -EXTRACFLAGS = -Wno-packed -DMAVLINK_COMM_NUM_BUFFERS=3 diff --git a/src/modules/mc_att_control/module.mk b/src/modules/mc_att_control/module.mk deleted file mode 100644 index f32bc71bf2..0000000000 --- a/src/modules/mc_att_control/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Multirotor attitude controller (vector based, no Euler singularities) -# - -MODULE_COMMAND = mc_att_control - -SRCS = mc_att_control_main.cpp \ - mc_att_control_params.c - -# Startup handler, the actual app stack size is -# in the task_spawn command -MODULE_STACKSIZE = 1200 diff --git a/src/modules/mc_att_control_multiplatform/module.mk b/src/modules/mc_att_control_multiplatform/module.mk deleted file mode 100644 index 959f6492b0..0000000000 --- a/src/modules/mc_att_control_multiplatform/module.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Multirotor attitude controller (vector based, no Euler singularities) -# - -MODULE_COMMAND = mc_att_control_m - -SRCS = mc_att_control_main.cpp \ - mc_att_control_start_nuttx.cpp \ - mc_att_control.cpp \ - mc_att_control_base.cpp \ - mc_att_control_params.c diff --git a/src/modules/mc_pos_control/module.mk b/src/modules/mc_pos_control/module.mk deleted file mode 100644 index 48827897a1..0000000000 --- a/src/modules/mc_pos_control/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build multicopter position controller -# - -MODULE_COMMAND = mc_pos_control - -SRCS = mc_pos_control_main.cpp \ - mc_pos_control_params.c - -# Startup handler, the actual app stack size is -# in the task_spawn command -MODULE_STACKSIZE = 1200 diff --git a/src/modules/mc_pos_control_multiplatform/module.mk b/src/modules/mc_pos_control_multiplatform/module.mk deleted file mode 100644 index d6fe231e95..0000000000 --- a/src/modules/mc_pos_control_multiplatform/module.mk +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build multicopter position controller -# - -MODULE_COMMAND = mc_pos_control_m - -SRCS = mc_pos_control_main.cpp \ - mc_pos_control_start_nuttx.cpp \ - mc_pos_control.cpp \ - mc_pos_control_params.c - -# Only NuttX has a frame size limit -ifeq ($(PX4_TARGET_OS),nuttx) -EXTRACXXFLAGS = -Wframe-larger-than=1200 -endif diff --git a/src/modules/navigator/module.mk b/src/modules/navigator/module.mk deleted file mode 100644 index 0d7d6b9ef1..0000000000 --- a/src/modules/navigator/module.mk +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Main Navigation Controller -# - -MODULE_COMMAND = navigator - -SRCS = navigator_main.cpp \ - navigator_params.c \ - navigator_mode.cpp \ - mission_block.cpp \ - mission.cpp \ - mission_params.c \ - loiter.cpp \ - rtl.cpp \ - rtl_params.c \ - mission_feasibility_checker.cpp \ - geofence.cpp \ - geofence_params.c \ - datalinkloss.cpp \ - datalinkloss_params.c \ - rcloss.cpp \ - rcloss_params.c \ - enginefailure.cpp \ - gpsfailure.cpp \ - gpsfailure_params.c - -INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink - -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os - -EXTRACXXFLAGS = -Wno-sign-compare diff --git a/src/modules/position_estimator_inav/module.mk b/src/modules/position_estimator_inav/module.mk deleted file mode 100644 index 57b32954c5..0000000000 --- a/src/modules/position_estimator_inav/module.mk +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build position_estimator_inav -# - -MODULE_COMMAND = position_estimator_inav -SRCS = position_estimator_inav_main.c \ - position_estimator_inav_params.c \ - inertial_filter.c - -MODULE_STACKSIZE = 1200 - -ifeq ($(PX4_TARGEGT_OS),nuttx) -EXTRACFLAGS = -Wframe-larger-than=3800 -endif - diff --git a/src/modules/px4iofirmware/module.mk b/src/modules/px4iofirmware/module.mk deleted file mode 100644 index 34c231174f..0000000000 --- a/src/modules/px4iofirmware/module.mk +++ /dev/null @@ -1,30 +0,0 @@ - -SRCS = adc.c \ - controls.c \ - dsm.c \ - px4io.c \ - registers.c \ - safety.c \ - sbus.c \ - ../systemlib/up_cxxinitialize.c \ - ../systemlib/perf_counter.c \ - mixer.cpp \ - ../systemlib/mixer/mixer.cpp \ - ../systemlib/mixer/mixer_group.cpp \ - ../systemlib/mixer/mixer_multirotor.cpp \ - ../systemlib/mixer/mixer_simple.cpp \ - ../systemlib/pwm_limit/pwm_limit.c \ - ../../lib/rc/st24.c \ - ../../lib/rc/sumd.c - -ifeq ($(BOARD),px4io-v1) -SRCS += i2c.c -endif -ifeq ($(BOARD),px4io-v2) -SRCS += serial.c \ - ../systemlib/hx_stream.c -endif - -SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -include $(SELF_DIR)../systemlib/mixer/multi_tables.mk - \ No newline at end of file diff --git a/src/modules/sdlog2/module.mk b/src/modules/sdlog2/module.mk deleted file mode 100644 index 69afb39099..0000000000 --- a/src/modules/sdlog2/module.mk +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# sdlog2 Application -# - -MODULE_COMMAND = sdlog2 -# The main thread only buffers to RAM, needs a high priority -MODULE_PRIORITY = "SCHED_PRIORITY_MAX-30" - -SRCS = sdlog2.c \ - logbuffer.c - -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os - -ifeq ($(PX4_TARGET_OS),nuttx) -EXTRACFLAGS = -Wframe-larger-than=1600 -endif diff --git a/src/modules/segway/module.mk b/src/modules/segway/module.mk deleted file mode 100644 index d5da856010..0000000000 --- a/src/modules/segway/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# segway controller -# - -MODULE_COMMAND = segway - -SRCS = segway_main.cpp \ - BlockSegwayController.cpp \ - params.c diff --git a/src/modules/sensors/module.mk b/src/modules/sensors/module.mk deleted file mode 100644 index d92ebc00eb..0000000000 --- a/src/modules/sensors/module.mk +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the sensor data collector -# - -MODULE_COMMAND = sensors -MODULE_PRIORITY = "SCHED_PRIORITY_MAX-5" - -SRCS = sensors.cpp \ - sensor_params.c - -MODULE_STACKSIZE = 1200 - -MAXOPTIMIZATION = -Os - -EXTRACXXFLAGS = -Wno-type-limits diff --git a/src/modules/simulator/module.mk b/src/modules/simulator/module.mk deleted file mode 100644 index 80f619477d..0000000000 --- a/src/modules/simulator/module.mk +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################ -# -# Copyright (c) 2015 MArk Charlebois. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build simulator -# - -MODULE_COMMAND = simulator - -SRCS = simulator.cpp - -ifneq ($(PX4_TARGET_OS), qurt) -SRCS += simulator_mavlink.cpp -endif - -INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink - -EXTRACXXFLAGS = -Weffc++ -Wno-attributes -Wno-packed - -EXTRACFLAGS = -Wno-packed diff --git a/src/modules/systemlib/module.mk b/src/modules/systemlib/module.mk deleted file mode 100644 index 3232adf3e7..0000000000 --- a/src/modules/systemlib/module.mk +++ /dev/null @@ -1,70 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# System utility library -# - -SRCS = \ - perf_counter.c \ - param/param.c \ - conversions.c \ - cpuload.c \ - pid/pid.c \ - airspeed.c \ - system_params.c \ - mavlink_log.c \ - rc_check.c \ - otp.c \ - board_serial.c \ - pwm_limit/pwm_limit.c \ - mcu_version.c \ - bson/tinybson.c \ - circuit_breaker.cpp \ - circuit_breaker_params.c - -ifeq ($(PX4_TARGET_OS),nuttx) -SRCS += err.c \ - printload.c \ - up_cxxinitialize.c -else -SRCS += print_load_posix.c -endif - -ifneq ($(PX4_TARGET_OS),qurt) -SRCS += hx_stream.c -endif - -MAXOPTIMIZATION = -Os - -EXTRACFLAGS = -Wno-sign-compare diff --git a/src/modules/uORB/module.mk b/src/modules/uORB/module.mk deleted file mode 100644 index b483c00a80..0000000000 --- a/src/modules/uORB/module.mk +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build uORB -# - -MODULE_COMMAND = uorb - -MODULE_STACKSIZE = 2048 - -ifeq ($(PX4_TARGET_OS),nuttx) -SRCS = uORBDevices_nuttx.cpp \ - uORBTest_UnitTest.cpp \ - uORBManager_nuttx.cpp - -else -SRCS = uORBDevices_posix.cpp \ - uORBManager_posix.cpp -endif - -ifeq ($(PX4_TARGET_OS),posix) -SRCS += uORBTest_UnitTest.cpp -endif -ifeq ($(PX4_TARGET_OS),posix-arm) -SRCS += uORBTest_UnitTest.cpp -endif - -SRCS += objects_common.cpp \ - uORBUtils.cpp \ - uORB.cpp \ - uORBMain.cpp \ - Publication.cpp \ - Subscription.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/modules/uavcan/module.mk b/src/modules/uavcan/module.mk deleted file mode 100644 index 9873d87fbe..0000000000 --- a/src/modules/uavcan/module.mk +++ /dev/null @@ -1,94 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013-2015 PX4 Development Team. All rights reserved. -# Author: Pavel Kirienko -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# UAVCAN <--> uORB bridge -# - -MODULE_COMMAND = uavcan - -MAXOPTIMIZATION = -O3 -MODULE_STACKSIZE = 3200 -WFRAME_LARGER_THAN = 1416 - -# Main -SRCS += uavcan_main.cpp \ - uavcan_servers.cpp \ - uavcan_params.c - -# Actuators -SRCS += actuators/esc.cpp - -# Sensors -SRCS += sensors/sensor_bridge.cpp \ - sensors/gnss.cpp \ - sensors/mag.cpp \ - sensors/baro.cpp - -# -# libuavcan -# -include $(PX4_LIB_DIR)uavcan/libuavcan/include.mk -# Use the relitive path to keep the genrated files in the BUILD_DIR -SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_SRC)) -INCLUDE_DIRS += $(LIBUAVCAN_INC) -# Since actual compiler mode is C++11, the library will default to UAVCAN_CPP11, but it will fail to compile -# because this platform lacks most of the standard library and STL. Hence we need to force C++03 mode. -override EXTRADEFINES := $(EXTRADEFINES) \ --DUAVCAN_CPP_VERSION=UAVCAN_CPP03 \ --DUAVCAN_NO_ASSERTIONS \ --DUAVCAN_MEM_POOL_BLOCK_SIZE=48 \ --DUAVCAN_MAX_NETWORK_SIZE_HINT=16 \ --DUAVCAN_STM32_TIMER_NUMBER=5 - -# -# libuavcan drivers for STM32 -# -include $(PX4_LIB_DIR)uavcan/libuavcan_drivers/stm32/driver/include.mk -# Use the relitive path to keep the genrated files in the BUILD_DIR -SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_STM32_SRC)) -INCLUDE_DIRS += $(LIBUAVCAN_STM32_INC) -override EXTRADEFINES := $(EXTRADEFINES) -DUAVCAN_STM32_NUTTX -DUAVCAN_STM32_NUM_IFACES=2 - -# -# libuavcan drivers for posix -# -include $(PX4_LIB_DIR)uavcan/libuavcan_drivers/posix/include.mk -INCLUDE_DIRS += $(LIBUAVCAN_POSIX_INC) - -# -# Invoke DSDL compiler -# -$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR))) -INCLUDE_DIRS += dsdlc_generated diff --git a/src/modules/unit_test/module.mk b/src/modules/unit_test/module.mk deleted file mode 100644 index 5000790a59..0000000000 --- a/src/modules/unit_test/module.mk +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the unit test library. -# - -SRCS = unit_test.cpp - -MAXOPTIMIZATION = -Os diff --git a/src/modules/vtol_att_control/module.mk b/src/modules/vtol_att_control/module.mk deleted file mode 100644 index d3f9326b04..0000000000 --- a/src/modules/vtol_att_control/module.mk +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################ -# -# Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# VTOL attitude controller -# - -MODULE_COMMAND = vtol_att_control - -SRCS = vtol_att_control_main.cpp \ - vtol_att_control_params.c \ - tiltrotor_params.c \ - tiltrotor.cpp \ - vtol_type.cpp \ - tailsitter.cpp \ - standard_params.c \ - standard.cpp - -EXTRACXXFLAGS = -Wno-write-strings From b1d8e78813954843991c5b6a55bca4f7483e26f4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 11:24:40 +0200 Subject: [PATCH 294/389] Attitude EKF: Remove param file --- .../attitude_estimator_ekf/CMakeLists.txt | 1 - .../attitude_estimator_ekf_main.cpp | 40 +++++++++++++++++++ .../attitude_estimator_ekf_params.c | 40 ------------------- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/modules/attitude_estimator_ekf/CMakeLists.txt b/src/modules/attitude_estimator_ekf/CMakeLists.txt index 9a6ef24a4b..2c037d46bb 100644 --- a/src/modules/attitude_estimator_ekf/CMakeLists.txt +++ b/src/modules/attitude_estimator_ekf/CMakeLists.txt @@ -40,7 +40,6 @@ px4_add_module( SRCS attitude_estimator_ekf_main.cpp - attitude_estimator_ekf_params.c codegen/AttitudeEKF.c DEPENDS platforms__common diff --git a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp index 14f5470425..e408fb3c99 100755 --- a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp +++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp @@ -108,6 +108,46 @@ usage(const char *reason) fprintf(stderr, "usage: attitude_estimator_ekf {start|stop|status} [-p ]\n\n"); } +int parameters_init(struct attitude_estimator_ekf_param_handles *h) +{ + /* PID parameters */ + h->q0 = param_find("EKF_ATT_V3_Q0"); + h->q1 = param_find("EKF_ATT_V3_Q1"); + h->q2 = param_find("EKF_ATT_V3_Q2"); + h->q3 = param_find("EKF_ATT_V3_Q3"); + + h->r0 = param_find("EKF_ATT_V4_R0"); + h->r1 = param_find("EKF_ATT_V4_R1"); + h->r2 = param_find("EKF_ATT_V4_R2"); + + h->moment_inertia_J[0] = param_find("ATT_J11"); + h->moment_inertia_J[1] = param_find("ATT_J22"); + h->moment_inertia_J[2] = param_find("ATT_J33"); + h->use_moment_inertia = param_find("ATT_J_EN"); + + return OK; +} + +int parameters_update(const struct attitude_estimator_ekf_param_handles *h, struct attitude_estimator_ekf_params *p) +{ + param_get(h->q0, &(p->q[0])); + param_get(h->q1, &(p->q[1])); + param_get(h->q2, &(p->q[2])); + param_get(h->q3, &(p->q[3])); + + param_get(h->r0, &(p->r[0])); + param_get(h->r1, &(p->r[1])); + param_get(h->r2, &(p->r[2])); + + for (int i = 0; i < 3; i++) { + param_get(h->moment_inertia_J[i], &(p->moment_inertia_J[3 * i + i])); + } + + param_get(h->use_moment_inertia, &(p->use_moment_inertia)); + + return OK; +} + /** * The attitude_estimator_ekf app only briefly exists to start * the background job. The stack size assigned in the diff --git a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c index 31496bd0c6..92156c93e8 100755 --- a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c +++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c @@ -129,43 +129,3 @@ PARAM_DEFINE_FLOAT(ATT_J33, 0.0037); * @max 1 */ PARAM_DEFINE_INT32(ATT_J_EN, 0); - -int parameters_init(struct attitude_estimator_ekf_param_handles *h) -{ - /* PID parameters */ - h->q0 = param_find("EKF_ATT_V3_Q0"); - h->q1 = param_find("EKF_ATT_V3_Q1"); - h->q2 = param_find("EKF_ATT_V3_Q2"); - h->q3 = param_find("EKF_ATT_V3_Q3"); - - h->r0 = param_find("EKF_ATT_V4_R0"); - h->r1 = param_find("EKF_ATT_V4_R1"); - h->r2 = param_find("EKF_ATT_V4_R2"); - - h->moment_inertia_J[0] = param_find("ATT_J11"); - h->moment_inertia_J[1] = param_find("ATT_J22"); - h->moment_inertia_J[2] = param_find("ATT_J33"); - h->use_moment_inertia = param_find("ATT_J_EN"); - - return OK; -} - -int parameters_update(const struct attitude_estimator_ekf_param_handles *h, struct attitude_estimator_ekf_params *p) -{ - param_get(h->q0, &(p->q[0])); - param_get(h->q1, &(p->q[1])); - param_get(h->q2, &(p->q[2])); - param_get(h->q3, &(p->q[3])); - - param_get(h->r0, &(p->r[0])); - param_get(h->r1, &(p->r[1])); - param_get(h->r2, &(p->r[2])); - - for (int i = 0; i < 3; i++) { - param_get(h->moment_inertia_J[i], &(p->moment_inertia_J[3 * i + i])); - } - - param_get(h->use_moment_inertia, &(p->use_moment_inertia)); - - return OK; -} From 451e6883bd56e047a139c139848082ce183a7012 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 11:25:03 +0200 Subject: [PATCH 295/389] Att estimator Q: Remove param file --- src/modules/attitude_estimator_q/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/attitude_estimator_q/CMakeLists.txt b/src/modules/attitude_estimator_q/CMakeLists.txt index 3f89f45cdb..b4726b5c89 100644 --- a/src/modules/attitude_estimator_q/CMakeLists.txt +++ b/src/modules/attitude_estimator_q/CMakeLists.txt @@ -43,7 +43,6 @@ px4_add_module( STACK 1200 SRCS attitude_estimator_q_main.cpp - attitude_estimator_q_params.c DEPENDS platforms__common ) From e6d06666e0433d985b959a06d64ec2f60c04b91a Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 11:25:30 +0200 Subject: [PATCH 296/389] Bottle drop: Remove unused param file to prevent warning --- src/modules/bottle_drop/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/bottle_drop/CMakeLists.txt b/src/modules/bottle_drop/CMakeLists.txt index 0b03efe6e4..7c77cac340 100644 --- a/src/modules/bottle_drop/CMakeLists.txt +++ b/src/modules/bottle_drop/CMakeLists.txt @@ -38,7 +38,6 @@ px4_add_module( -Os SRCS bottle_drop.cpp - bottle_drop_params.c DEPENDS platforms__common ) From c2e9f8158632568a0947b868d10498bba017ae92 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 11:25:52 +0200 Subject: [PATCH 297/389] Commander: Remove unused param file from CMake to prevent empty linkage warning --- src/modules/commander/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/commander/CMakeLists.txt b/src/modules/commander/CMakeLists.txt index aa8fd80fc1..7cd5b045ef 100644 --- a/src/modules/commander/CMakeLists.txt +++ b/src/modules/commander/CMakeLists.txt @@ -45,7 +45,6 @@ px4_add_module( -Os SRCS commander.cpp - commander_params.c state_machine_helper.cpp commander_helper.cpp calibration_routines.cpp From c414c7ef636db967f9dfb105674e08926108a651 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 11:48:35 +0200 Subject: [PATCH 298/389] Always set RC in mode --- src/modules/commander/commander.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index a8db500675..948d5c661d 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1221,13 +1221,13 @@ int commander_thread_main(int argc, char *argv[]) // Run preflight check int32_t rc_in_off = 0; param_get(_param_autostart_id, &autostart_id); + param_get(_param_rc_in_off, &rc_in_off); + status.rc_input_mode = rc_in_off; if (is_hil_setup(autostart_id)) { // HIL configuration selected: real sensors will be disabled status.condition_system_sensors_initialized = false; set_tune_override(TONE_STARTUP_TUNE); //normal boot tune } else { - param_get(_param_rc_in_off, &rc_in_off); - status.rc_input_mode = rc_in_off; status.condition_system_sensors_initialized = Commander::preflightCheck(mavlink_fd, true, true, true, true, checkAirspeed, (status.rc_input_mode == vehicle_status_s::RC_IN_MODE_DEFAULT), !status.circuit_breaker_engaged_gpsfailure_check); if (!status.condition_system_sensors_initialized) { From 77b8ed671763849c86bf7d1dc0b3e429a9fa8b60 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Fri, 2 Oct 2015 10:12:00 +0200 Subject: [PATCH 299/389] check supported extensions for rc.autostart generation --- Tools/px4airframes/srcscanner.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tools/px4airframes/srcscanner.py b/Tools/px4airframes/srcscanner.py index cb31906a30..398c7ed067 100644 --- a/Tools/px4airframes/srcscanner.py +++ b/Tools/px4airframes/srcscanner.py @@ -16,9 +16,11 @@ class SourceScanner(object): extensions = tuple(parser.GetSupportedExtensions()) for dirname, dirnames, filenames in os.walk(srcdir): for filename in filenames: - path = os.path.join(dirname, filename) - if not self.ScanFile(path, parser): - return False + extension = os.path.splitext(filename)[1] + if extension in extensions: + path = os.path.join(dirname, filename) + if not self.ScanFile(path, parser): + return False return True def ScanFile(self, path, parser): From c26f980f37c110e5a1b48ea313a4896e7c947521 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Tue, 6 Oct 2015 15:15:08 +0200 Subject: [PATCH 300/389] added airframe extension .hil --- Tools/px4airframes/srcparser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/px4airframes/srcparser.py b/Tools/px4airframes/srcparser.py index 699a2cdc3b..fb491ede15 100644 --- a/Tools/px4airframes/srcparser.py +++ b/Tools/px4airframes/srcparser.py @@ -151,7 +151,7 @@ class SourceParser(object): Returns list of supported file extensions that can be parsed by this parser. The parser uses any extension. """ - return [""] + return ["", ".hil"] def Parse(self, path, contents): """ From 90f2e8d61a82be3b2cd60d112cfbd7fcf48af76b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 17:03:41 +0200 Subject: [PATCH 301/389] Force CMake to generate UNIX makefiles on all platforms --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index af93c31772..883e0663da 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ j ?= 4 # -------------------------------------------------------------------- # describe how to build a cmake config define cmake-build -+mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -DCONFIG=$(1) ++mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G"Unix Makefiles" -DCONFIG=$(1) +make -j$(j) -C $(PWD)/build_$@ --no-print-directory $(ARGS) endef From 0490046af45e8e4f8ae94961000211236ba25501 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 6 Oct 2015 17:22:38 +0200 Subject: [PATCH 302/389] MS5611: Increase the requirements about the PROM contents and CRC. --- src/drivers/ms5611/ms5611_i2c.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/drivers/ms5611/ms5611_i2c.cpp b/src/drivers/ms5611/ms5611_i2c.cpp index 74f67c0f26..86aa28a389 100644 --- a/src/drivers/ms5611/ms5611_i2c.cpp +++ b/src/drivers/ms5611/ms5611_i2c.cpp @@ -266,6 +266,9 @@ MS5611_I2C::_read_prom() */ usleep(3000); + uint8_t last_val = 0; + bool bits_stuck = true; + /* read and convert PROM words */ for (int i = 0; i < 8; i++) { uint8_t cmd = ADDR_PROM_SETUP + (i * 2); @@ -274,6 +277,16 @@ MS5611_I2C::_read_prom() break; } + /* check if all bytes are zero */ + if (i == 0) { + /* initalize to first byte read */ + last_val = prom_buf[0]; + } + + if (prom_buf[0] != last_val || prom_buf[1] != last_val) { + bits_stuck = false; + } + /* assemble 16 bit value and convert from big endian (sensor) to little endian (MCU) */ cvt.b[0] = prom_buf[1]; cvt.b[1] = prom_buf[0]; @@ -281,5 +294,5 @@ MS5611_I2C::_read_prom() } /* calculate CRC and return success/failure accordingly */ - return ms5611::crc4(&_prom.c[0]) ? PX4_OK : -EIO; + return (ms5611::crc4(&_prom.c[0]) && !bits_stuck) ? PX4_OK : -EIO; } From 7711a94a5ae047069cc27d814d778ef22a3ec53b Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 6 Oct 2015 11:28:10 -0400 Subject: [PATCH 303/389] Fixes cmake uavcan external project for cmake 2.8.12. --- src/modules/uavcan/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/uavcan/CMakeLists.txt b/src/modules/uavcan/CMakeLists.txt index 5cdcdbe8ca..f3d255d1e0 100644 --- a/src/modules/uavcan/CMakeLists.txt +++ b/src/modules/uavcan/CMakeLists.txt @@ -74,6 +74,7 @@ px4_join(OUT uavcan_cxx_flags LIST "${uavcan_cxx_flags}" GLUE " ") externalproject_add(libuavcan DEPENDS ${uavcan_deps} + DOWNLOAD_COMMAND "" UPDATE_COMMAND git submodule update --init SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} From 55f963be07dbb8acd147c290a0fcba0b4877336d Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 6 Oct 2015 12:10:23 -0400 Subject: [PATCH 304/389] Added ddd support. --- Makefile | 2 +- .../toolchains/Toolchain-arm-none-eabi.cmake | 14 +++++++++- src/firmware/nuttx/CMakeLists.txt | 26 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 883e0663da..1d2cd152ff 100644 --- a/Makefile +++ b/Makefile @@ -153,7 +153,7 @@ distclean: clean @cd ../../.. # targets handled by cmake -cmake_targets = test upload package package_source debug debug_io check_weak libuavcan +cmake_targets = test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak libuavcan $(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ)))) .PHONY: clean diff --git a/cmake/toolchains/Toolchain-arm-none-eabi.cmake b/cmake/toolchains/Toolchain-arm-none-eabi.cmake index 45da0d965c..ac13b9f517 100644 --- a/cmake/toolchains/Toolchain-arm-none-eabi.cmake +++ b/cmake/toolchains/Toolchain-arm-none-eabi.cmake @@ -49,6 +49,9 @@ endforeach() foreach(tool gdb gdbtui) string(TOUPPER ${tool} TOOL) find_program(${TOOL} arm-none-eabi-${tool}) + if(NOT ${TOOL}) + message(STATUS "could not find ${tool}") + endif() endforeach() # os tools @@ -56,7 +59,16 @@ foreach(tool echo patch grep rm mkdir nm genromfs cp touch make unzip) string(TOUPPER ${tool} TOOL) find_program(${TOOL} ${tool}) if(NOT ${TOOL}) - message(FATAL_ERROR "could not find ${TOOL}") + message(FATAL_ERROR "could not find ${tool}") + endif() +endforeach() + +# optional os tools +foreach(tool ddd) + string(TOUPPER ${tool} TOOL) + find_program(${TOOL} ${tool}) + if(NOT ${TOOL}) + message(STATUS "could not find ${tool}") endif() endforeach() diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 2b1562b762..8767f3fde5 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -63,18 +63,44 @@ if(NOT ${BOARD} STREQUAL "sim") 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 + ) + + add_custom_target(debug_tui COMMAND ${GDBTUI} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx DEPENDS firmware_nuttx ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit ) + add_custom_target(debug_ddd + COMMAND ${DDD} --debugger ${GDB} ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx + DEPENDS firmware_nuttx + ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit + ) + add_custom_target(debug_io + COMMAND ${GDB} + ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL} + DEPENDS firmware_nuttx + ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit + ) + + add_custom_target(debug_io_tui COMMAND ${GDBTUI} ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL} DEPENDS firmware_nuttx ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit ) + add_custom_target(debug_io_ddd + COMMAND ${DDD} --debugger ${GDB} + ${CMAKE_BINARY_DIR}/src/modules/px4iofirmware/${config_io_board}_${LABEL} + DEPENDS firmware_nuttx + ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit + ) + px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${fw_file}) endif() From 4dd59cd09aa94a34b7a70739a7ca2da94919a1ce Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 6 Oct 2015 14:10:31 -0400 Subject: [PATCH 305/389] Fixed param dependencies. --- CMakeLists.txt | 4 + cmake/common/px4_base.cmake | 94 ++++++++++++++++++--- cmake/configs/nuttx_px4fmu-v1_default.cmake | 4 - cmake/configs/nuttx_px4fmu-v2_default.cmake | 4 - cmake/configs/nuttx_px4fmu-v2_simple.cmake | 4 - cmake/configs/nuttx_sim_simple.cmake | 4 - cmake/configs/posix_sitl_simple.cmake | 5 -- cmake/nuttx/px4_impl_nuttx.cmake | 60 ++++++------- src/firmware/nuttx/CMakeLists.txt | 3 +- src/modules/param/CMakeLists.txt | 9 +- 10 files changed, 117 insertions(+), 74 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a5f8b4790..51927e1755 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,6 +271,10 @@ px4_generate_messages(TARGET msg_gen OS ${OS} DEPENDS git_genmsg git_gencpp ) +px4_generate_parameters_xml(OUT parameters.xml BOARD ${BOARD}) +px4_generate_airframes_xml(OUT airframes.xml BOARD ${BOARD}) +add_custom_target(xml_gen + DEPENDS parameters.xml airframes.xml) #============================================================================= # external projects diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index c3a07df882..797cb14fc1 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -706,24 +706,62 @@ endfunction() #============================================================================= # -# px4_generate_parameters +# px4_generate_parameters_xml +# +# Generates a parameters.xml file. +# +# Usage: +# px4_generate_parameters_xml(OUT ) +# +# Input: +# BOARD : the board +# +# Output: +# OUT : the generated xml file +# +# Example: +# px4_generate_parameters_xml(OUT parameters.xml) +# +function(px4_generate_parameters_xml) + px4_parse_function_args( + NAME px4_generate_parameters_xml + ONE_VALUE OUT BOARD + REQUIRED OUT BOARD + ARGN ${ARGN}) + set(path ${CMAKE_SOURCE_DIR}/src) + file(GLOB_RECURSE param_src_files ${path}/*.h* ${path}/*.c*) + add_custom_command(OUTPUT ${OUT} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py + -s ${path} --board CONFIG_ARCH_${BOARD} --xml + DEPENDS ${param_src_files} + ) + set(${OUT} ${${OUT}} PARENT_SCOPE) +endfunction() + +#============================================================================= +# +# px4_generate_parameters_source # # Generates a source file with all parameters. # # Usage: -# px4_generate_parameters(OUT ) +# px4_generate_parameters_source(OUT XML ) +# +# Input: +# XML : the parameters.xml file +# DEPS : target dependencies # # Output: -# OUT : the generate source files +# OUT : the generated source files # # Example: -# px4_generate_parameters(OUT parameters.c) +# px4_generate_parameters_source(OUT param_files XML parameters.xml) # -function(px4_generate_parameters) +function(px4_generate_parameters_source) px4_parse_function_args( - NAME px4_generate_parameters - ONE_VALUE OUT - REQUIRED OUT + NAME px4_generate_parameters_source + ONE_VALUE OUT XML DEPS + REQUIRED OUT XML ARGN ${ARGN}) set(generated_files ${CMAKE_CURRENT_BINARY_DIR}/px4_parameters.h @@ -731,14 +769,46 @@ function(px4_generate_parameters) set_source_files_properties(${generated_files} PROPERTIES GENERATED TRUE) add_custom_command(OUTPUT ${generated_files} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py - -s ${CMAKE_SOURCE_DIR}/src --board CONFIG_ARCH_${BOARD} --xml - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py - parameters.xml + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py ${XML} + DEPENDS ${XML} ${DEPS} ) set(${OUT} ${generated_files} PARENT_SCOPE) endfunction() +#============================================================================= +# +# px4_generate_airframes_xml +# +# Generates airframes.xml +# +# Usage: +# px4_generate_airframes_xml(OUT ) +# +# Input: +# XML : the airframes.xml file +# BOARD : the board +# +# Output: +# OUT : the generated source files +# +# Example: +# px4_generate_airframes_xml(OUT airframes.xml) +# +function(px4_generate_airframes_xml) + px4_parse_function_args( + NAME px4_generate_airframes_xml + ONE_VALUE OUT BOARD + REQUIRED OUT BOARD + ARGN ${ARGN}) + set(process_airframes ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py) + add_custom_command(OUTPUT ${OUT} + COMMAND ${PYTHON_EXECUTABLE} ${process_airframes} + -a ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common/init.d + --board CONFIG_ARCH_BOARD_${BOARD} --xml + ) + set(${OUT} ${${OUT}} PARENT_SCOPE) +endfunction() + #============================================================================= # # px4_copy_tracked diff --git a/cmake/configs/nuttx_px4fmu-v1_default.cmake b/cmake/configs/nuttx_px4fmu-v1_default.cmake index 5cd4756519..c8a178400a 100644 --- a/cmake/configs/nuttx_px4fmu-v1_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v1_default.cmake @@ -152,10 +152,6 @@ set(config_module_list #examples/hwtest ) -set(config_firmware_options - PARAM_XML # generate param xml - ) - set(config_extra_builtin_cmds serdis sercon diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 51bdf151a5..fec5f06370 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -156,10 +156,6 @@ set(config_module_list #examples/hwtest ) -set(config_firmware_options - PARAM_XML # generate param xml - ) - set(config_extra_builtin_cmds serdis sercon diff --git a/cmake/configs/nuttx_px4fmu-v2_simple.cmake b/cmake/configs/nuttx_px4fmu-v2_simple.cmake index b1708cfc22..070fbd703f 100644 --- a/cmake/configs/nuttx_px4fmu-v2_simple.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_simple.cmake @@ -117,10 +117,6 @@ set(config_module_list examples/hwtest ) -set(config_firmware_options - PARAM_XML # generate param xml - ) - set(config_extra_builtin_cmds serdis sercon diff --git a/cmake/configs/nuttx_sim_simple.cmake b/cmake/configs/nuttx_sim_simple.cmake index a00b781a75..068c6409f2 100644 --- a/cmake/configs/nuttx_sim_simple.cmake +++ b/cmake/configs/nuttx_sim_simple.cmake @@ -17,9 +17,5 @@ set(config_module_list #lib/conversion ) -set(config_firmware_options - PARAM_XML # generate param xml - ) - set(config_extra_builtin_cmds ) diff --git a/cmake/configs/posix_sitl_simple.cmake b/cmake/configs/posix_sitl_simple.cmake index 90fc72ce1c..227bffeab8 100644 --- a/cmake/configs/posix_sitl_simple.cmake +++ b/cmake/configs/posix_sitl_simple.cmake @@ -57,11 +57,6 @@ set(config_module_list lib/launchdetection ) - -set(config_firmware_options - PARAM_XML # generate param xml - ) - set(config_extra_builtin_cmds serdis sercon diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index add952a49b..89ec3d44c2 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -57,14 +57,14 @@ include(common/px4_base) # This function adds a nuttx firmware target. # # Usage: -# px4_nuttx_add_firmware(OUT EXE ) +# px4_nuttx_add_firmware(OUT EXE +# PARAM_XML AIRFRAMES_XML ) # # Input: # EXE : the executable to generate the firmware from # BOARD : the board -# -# Options: -# PARAM_XML : toggles generation of param_xml +# PARAM_XML : param xml file (optional) +# AIRFRAMES_XML : airframes xml file (optional) # # Output: # OUT : the generated firmware target @@ -75,43 +75,33 @@ include(common/px4_base) function(px4_nuttx_add_firmware) px4_parse_function_args( NAME px4_nuttx_add_firmware - ONE_VALUE BOARD OUT EXE - OPTIONS PARAM_XML + ONE_VALUE BOARD OUT EXE PARAM_XML AIRFRAMES_XML REQUIRED OUT EXE BOARD ARGN ${ARGN}) - set(process_params ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py) - set(process_airframes ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py) + set(extra_args) - - #TODO handle param_xml - if(PARAM_XML) - add_custom_command(OUTPUT ${OUT} - COMMAND ${PYTHON_EXECUTABLE} ${process_params} - --src-path ${CMAKE_SOURCE_DIR}/src - --board CONFIG_ARCH_BOARD_${BOARD} --xml - COMMAND ${PYTHON_EXECUTABLE} ${process_airframes} - -a ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common/init.d - --board CONFIG_ARCH_BOARD_${BOARD} --xml - COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py - --prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype - --git_identity ${CMAKE_SOURCE_DIR} - --parameter_xml parameters.xml - --airframe_xml airframes.xml - --image ${EXE}.bin > ${OUT} - DEPENDS ${EXE} - ) - else() - add_custom_command(OUTPUT ${OUT} - COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py - --prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype - --git_identity ${CMAKE_SOURCE_DIR} - --image ${EXE}.bin > ${OUT} - DEPENDS ${EXE} + if (PARAM_XML) + list(APPEND extra_args + --parameter_xml ${PARAM_XML} ) endif() + + if (AIRFRAMES_XML) + list(APPEND extra_args + --airframe_xml ${AIRFRAMES_XML} + ) + endif() + + add_custom_command(OUTPUT ${OUT} + COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py + --prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype + --git_identity ${CMAKE_SOURCE_DIR} + ${extra_args} + --image ${EXE}.bin > ${OUT} + DEPENDS ${EXE} + ) add_custom_target(build_firmware_${BOARD} ALL DEPENDS ${OUT}) endfunction() diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 8767f3fde5..c13183ba16 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -57,7 +57,8 @@ if(NOT ${BOARD} STREQUAL "sim") px4_nuttx_add_firmware(OUT ${fw_file} BOARD ${BOARD} EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx - ${config_firmware_options} + PARAM_XML ${CMAKE_BINARY_DIR}/parameters.xml + AIRFRAMES_XML ${CMAKE_BINARY_DIR}/airframes.xml ) configure_file(gdbinit.in .gdbinit) diff --git a/src/modules/param/CMakeLists.txt b/src/modules/param/CMakeLists.txt index 4e15ca6e5a..64bff2a0e1 100644 --- a/src/modules/param/CMakeLists.txt +++ b/src/modules/param/CMakeLists.txt @@ -33,17 +33,16 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) -px4_generate_parameters(OUT param_files) - -set(srcs - ${param_files} +px4_generate_parameters_source(OUT param_files + XML ${CMAKE_BINARY_DIR}/parameters.xml + DEPS xml_gen ) px4_add_module( MODULE modules__param COMPILE_FLAGS -Os - SRCS ${srcs} + SRCS ${param_files} DEPENDS platforms__common ) From f1cc601ca80203041bf6c183f1de08da401b3242 Mon Sep 17 00:00:00 2001 From: Micah Corah Date: Tue, 6 Oct 2015 17:15:08 -0400 Subject: [PATCH 306/389] L1 -> unit, L1 easily confused with L1 norm --- src/modules/mc_pos_control/mc_pos_control_main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp index dc98db02f3..36d87b9383 100644 --- a/src/modules/mc_pos_control/mc_pos_control_main.cpp +++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp @@ -803,7 +803,7 @@ void MulticopterPositionControl::control_auto(float dt) &curr_sp.data[0], &curr_sp.data[1]); curr_sp(2) = -(_pos_sp_triplet.current.alt - _ref_alt); - /* scaled space: 1 == position error resulting max allowed speed, L1 = 1 in this space */ + /* scaled space: 1 == position error resulting max allowed speed */ math::Vector<3> scale = _params.pos_p.edivide(_params.vel_max); // TODO add mult param here /* convert current setpoint to scaled space */ @@ -822,14 +822,14 @@ void MulticopterPositionControl::control_auto(float dt) if ((curr_sp - prev_sp).length() > MIN_DIST) { - /* find X - cross point of L1 sphere and trajectory */ + /* find X - cross point of unit sphere and trajectory */ math::Vector<3> pos_s = _pos.emult(scale); math::Vector<3> prev_sp_s = prev_sp.emult(scale); math::Vector<3> prev_curr_s = curr_sp_s - prev_sp_s; math::Vector<3> curr_pos_s = pos_s - curr_sp_s; float curr_pos_s_len = curr_pos_s.length(); if (curr_pos_s_len < 1.0f) { - /* copter is closer to waypoint than L1 radius */ + /* copter is closer to waypoint than unit radius */ /* check next waypoint and use it to avoid slowing down when passing via waypoint */ if (_pos_sp_triplet.next.valid) { math::Vector<3> next_sp; @@ -853,7 +853,7 @@ void MulticopterPositionControl::control_auto(float dt) if (cos_a_curr_next > 0.0f && cos_b > 0.0f) { float curr_next_s_len = curr_next_s.length(); - /* if curr - next distance is larger than L1 radius, limit it */ + /* if curr - next distance is larger than unit radius, limit it */ if (curr_next_s_len > 1.0f) { cos_a_curr_next /= curr_next_s_len; } @@ -870,7 +870,7 @@ void MulticopterPositionControl::control_auto(float dt) } else { bool near = cross_sphere_line(pos_s, 1.0f, prev_sp_s, curr_sp_s, pos_sp_s); if (near) { - /* L1 sphere crosses trajectory */ + /* unit sphere crosses trajectory */ } else { /* copter is too far from trajectory */ From 7749d1cb1c87fd79d0d4ad3bb43d40d365d3c4c4 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 13:45:53 -0400 Subject: [PATCH 307/389] cmake fix export paths for ninja -make nuttx build a bit quieter --- cmake/nuttx/px4_impl_nuttx.cmake | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 89ec3d44c2..72515c9d45 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -222,27 +222,22 @@ function(px4_nuttx_add_export) # export file(GLOB_RECURSE config_files ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG}/*) - add_custom_command(OUTPUT ${CONFIG}.export + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CONFIG}.export COMMAND ${ECHO} Configuring NuttX for ${CONFIG} - COMMAND ${MAKE} -C${nuttx_src}/nuttx -j${THREADS} - -r --quiet distclean - COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG} - ${nuttx_src}/nuttx/configs - COMMAND cd ${nuttx_src}/nuttx/tools && - ./configure.sh ${CONFIG}/nsh + COMMAND ${MAKE} -C${nuttx_src}/nuttx -r --quiet distclean + COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG} ${nuttx_src}/nuttx/configs + COMMAND cd ${nuttx_src}/nuttx/tools && ./configure.sh ${CONFIG}/nsh COMMAND ${ECHO} Exporting NuttX for ${CONFIG} - COMMAND ${MAKE} -C ${nuttx_src}/nuttx -j${THREADS} - -r CONFIG_ARCH_BOARD=${CONFIG} export - COMMAND ${CP} -r ${nuttx_src}/nuttx/nuttx-export.zip - ${CONFIG}.export + COMMAND ${MAKE} --quiet -C ${nuttx_src}/nuttx -j${THREADS} -r CONFIG_ARCH_BOARD=${CONFIG} export + COMMAND ${CP} -r ${nuttx_src}/nuttx/nuttx-export.zip ${CMAKE_BINARY_DIR}/${CONFIG}.export DEPENDS ${config_files} ${DEPENDS} __nuttx_copy_${CONFIG}) # extract add_custom_command(OUTPUT nuttx_export_${CONFIG}.stamp COMMAND ${RM} -rf ${nuttx_src}/nuttx-export - COMMAND ${UNZIP} ${CONFIG}.export -d ${nuttx_src} + COMMAND ${UNZIP} -q ${CMAKE_BINARY_DIR}/${CONFIG}.export -d ${nuttx_src} COMMAND ${TOUCH} nuttx_export_${CONFIG}.stamp - DEPENDS ${DEPENDS} ${CONFIG}.export) + DEPENDS ${DEPENDS} ${CMAKE_BINARY_DIR}/${CONFIG}.export) add_custom_target(${OUT} DEPENDS nuttx_export_${CONFIG}.stamp) From 330bacd229ab9b540e757d3acae491986187dd27 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 14:00:48 -0400 Subject: [PATCH 308/389] cmake nuttx slightly quieter --- cmake/nuttx/px4_impl_nuttx.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 72515c9d45..f48bdc135c 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -224,11 +224,11 @@ function(px4_nuttx_add_export) file(GLOB_RECURSE config_files ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG}/*) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CONFIG}.export COMMAND ${ECHO} Configuring NuttX for ${CONFIG} - COMMAND ${MAKE} -C${nuttx_src}/nuttx -r --quiet distclean + COMMAND ${MAKE} --no-print-directory -C${nuttx_src}/nuttx -r --quiet distclean COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG} ${nuttx_src}/nuttx/configs COMMAND cd ${nuttx_src}/nuttx/tools && ./configure.sh ${CONFIG}/nsh COMMAND ${ECHO} Exporting NuttX for ${CONFIG} - COMMAND ${MAKE} --quiet -C ${nuttx_src}/nuttx -j${THREADS} -r CONFIG_ARCH_BOARD=${CONFIG} export + COMMAND ${MAKE} --no-print-directory --quiet -C ${nuttx_src}/nuttx -j${THREADS} -r CONFIG_ARCH_BOARD=${CONFIG} export COMMAND ${CP} -r ${nuttx_src}/nuttx/nuttx-export.zip ${CMAKE_BINARY_DIR}/${CONFIG}.export DEPENDS ${config_files} ${DEPENDS} __nuttx_copy_${CONFIG}) From f13daa73147427ca78149913529854e4a9824ab3 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 14:32:31 -0400 Subject: [PATCH 309/389] cmake fix NuttX copy -on the 2nd run this was copying NuttX to NuttX/Nuttx --- cmake/nuttx/px4_impl_nuttx.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index f48bdc135c..13d120af26 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -213,8 +213,7 @@ function(px4_nuttx_add_export) # copy add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp COMMAND ${MKDIR} -p ${CMAKE_BINARY_DIR}/${CONFIG} - COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src} - COMMAND ${RM} -rf ${nuttx_src}/.git + COMMAND rsync -a --exclude=.git ${CMAKE_SOURCE_DIR}/NuttX/ ${nuttx_src}/ COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp DEPENDS ${DEPENDS}) add_custom_target(__nuttx_copy_${CONFIG} From 74a61a3610f8a9609abb712ac4cec0371c0f2770 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 14:57:55 -0400 Subject: [PATCH 310/389] cmake allow Ninja generator --- Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1d2cd152ff..56ec849d7b 100644 --- a/Makefile +++ b/Makefile @@ -59,12 +59,24 @@ all: px4fmu-v2_default ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) j ?= 4 +# disable ninja by default for now because it hides upload progress +#NINJA_BUILD := $(shell ninja --version 2>/dev/null) +ifdef NINJA_BUILD + PX4_CMAKE_GENERATOR ?= "Ninja" + PX4_MAKE = ninja + PX4_MAKE_ARGS = +else + PX4_CMAKE_GENERATOR ?= "Unix Makefiles" + PX4_MAKE = make + PX4_MAKE_ARGS = -j$(j) --no-print-directory +endif + # Functions # -------------------------------------------------------------------- # describe how to build a cmake config define cmake-build -+mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G"Unix Makefiles" -DCONFIG=$(1) -+make -j$(j) -C $(PWD)/build_$@ --no-print-directory $(ARGS) ++@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1); fi ++$(PX4_MAKE) -C $(PWD)/build_$@ $(PX4_MAKE_ARGS) $(ARGS) endef # create empty targets to avoid msgs for targets passed to cmake From 2529f07d440137d9fed0a712223f41709adf1375 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 15:26:19 -0400 Subject: [PATCH 311/389] restore format check --- .travis.yml | 2 +- Makefile | 3 +++ src/lib/launchdetection/CatapultLaunchMethod.cpp | 2 +- src/modules/systemlib/param/param.c | 2 +- src/systemcmds/param/param.c | 8 ++++---- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 31f85ade3d..68fb32dae8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,7 +87,7 @@ env: - PX4_AWS_BUCKET=px4-travis script: - #- make check_format + - make check_format - arm-none-eabi-gcc --version - echo 'Building POSIX Firmware..' && echo -en 'travis_fold:start:script.1\\r' - make posix_sitl_simple -j4 diff --git a/Makefile b/Makefile index 56ec849d7b..1e4546a3f7 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,9 @@ sitl_ros: # Other targets # -------------------------------------------------------------------- +check_format: + @./Tools/check_code_style.sh + clean: @rm -rf build_*/ diff --git a/src/lib/launchdetection/CatapultLaunchMethod.cpp b/src/lib/launchdetection/CatapultLaunchMethod.cpp index f13c7c4bfe..b5692cc7e7 100644 --- a/src/lib/launchdetection/CatapultLaunchMethod.cpp +++ b/src/lib/launchdetection/CatapultLaunchMethod.cpp @@ -79,7 +79,7 @@ void CatapultLaunchMethod::update(float accel_x) if (motorDelay.get() > 0.0f) { state = LAUNCHDETECTION_RES_DETECTED_ENABLECONTROL; warnx("Launch detected: enablecontrol, waiting %8.4fs until full throttle", - double(motorDelay.get())); + double(motorDelay.get())); } else { /* No motor delay set: go directly to enablemotors state */ diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 4ba9d32004..097e61e350 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -88,7 +88,7 @@ extern struct param_info_s *param_info_base; extern struct param_info_s *param_info_limit; #else // FIXME - start and end are reversed -static const struct param_info_s *param_info_base = (const struct param_info_s *)&px4_parameters; +static const struct param_info_s *param_info_base = (const struct param_info_s *) &px4_parameters; #endif #define param_info_count px4_parameters.param_count diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index d38a13c676..88f5197d27 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -445,8 +445,8 @@ do_set(const char *name, const char *val, bool fail_on_not_found) if (i != newval) { printf("%c %s: ", - param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'), - param_name(param)); + param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'), + param_name(param)); printf("curr: %ld", (long)i); param_set(param, &newval); printf(" -> new: %ld\n", (long)newval); @@ -467,8 +467,8 @@ do_set(const char *name, const char *val, bool fail_on_not_found) if (f != newval) { #pragma GCC diagnostic pop printf("%c %s: ", - param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'), - param_name(param)); + param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'), + param_name(param)); printf("curr: %4.4f", (double)f); param_set(param, &newval); printf(" -> new: %4.4f\n", (double)newval); From 6c10cf18e4f06706af99daf22e45a124b2e98515 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 16:31:18 -0400 Subject: [PATCH 312/389] re-enable Werror --- cmake/common/px4_base.cmake | 2 +- src/drivers/px4flow/i2c_frame.h | 2 +- src/drivers/px4fmu/CMakeLists.txt | 1 - src/drivers/px4io/CMakeLists.txt | 1 - src/modules/attitude_estimator_ekf/CMakeLists.txt | 2 +- src/modules/commander/CMakeLists.txt | 2 +- src/modules/ekf_att_pos_estimator/CMakeLists.txt | 2 +- src/modules/land_detector/CMakeLists.txt | 1 - src/modules/mavlink/CMakeLists.txt | 2 +- src/modules/mc_att_control_multiplatform/CMakeLists.txt | 2 ++ src/modules/mc_pos_control_multiplatform/CMakeLists.txt | 2 +- src/modules/position_estimator_inav/CMakeLists.txt | 2 +- src/modules/simulator/CMakeLists.txt | 2 +- src/modules/uavcan/CMakeLists.txt | 4 +++- src/platforms/posix/drivers/gyrosim/CMakeLists.txt | 1 - src/systemcmds/mixer/CMakeLists.txt | 2 +- 16 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 797cb14fc1..1093d367e9 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -482,13 +482,13 @@ function(px4_add_common_flags) set(warnings -Wall + -Werror -Wno-sign-compare -Wextra #-Wshadow # very verbose due to eigen -Wfloat-equal -Wpointer-arith -Wmissing-declarations - -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds diff --git a/src/drivers/px4flow/i2c_frame.h b/src/drivers/px4flow/i2c_frame.h index a682c5f3de..43e10e417c 100644 --- a/src/drivers/px4flow/i2c_frame.h +++ b/src/drivers/px4flow/i2c_frame.h @@ -41,7 +41,7 @@ #ifndef I2C_FRAME_H_ #define I2C_FRAME_H_ -#define __STDC_FORMAT_MACROS 1 +#define __STDC_FORMAT_MACROS #include typedef struct i2c_frame diff --git a/src/drivers/px4fmu/CMakeLists.txt b/src/drivers/px4fmu/CMakeLists.txt index 335da06c1e..492aad5939 100644 --- a/src/drivers/px4fmu/CMakeLists.txt +++ b/src/drivers/px4fmu/CMakeLists.txt @@ -35,7 +35,6 @@ px4_add_module( MAIN fmu STACK 1200 COMPILE_FLAGS - -Weffc++ -Os SRCS fmu.cpp diff --git a/src/drivers/px4io/CMakeLists.txt b/src/drivers/px4io/CMakeLists.txt index 818d2c33d6..5c180c6f82 100644 --- a/src/drivers/px4io/CMakeLists.txt +++ b/src/drivers/px4io/CMakeLists.txt @@ -35,7 +35,6 @@ px4_add_module( MAIN px4io STACK 1200 COMPILE_FLAGS - -Weffc++ -Os SRCS px4io.cpp diff --git a/src/modules/attitude_estimator_ekf/CMakeLists.txt b/src/modules/attitude_estimator_ekf/CMakeLists.txt index 2c037d46bb..65ab7eff02 100644 --- a/src/modules/attitude_estimator_ekf/CMakeLists.txt +++ b/src/modules/attitude_estimator_ekf/CMakeLists.txt @@ -35,7 +35,7 @@ px4_add_module( MAIN attitude_estimator_ekf STACK 1200 COMPILE_FLAGS - -Wframe-larger-than=2400 + -Wframe-larger-than=3000 -Wno-float-equal SRCS diff --git a/src/modules/commander/CMakeLists.txt b/src/modules/commander/CMakeLists.txt index 7cd5b045ef..698177edb6 100644 --- a/src/modules/commander/CMakeLists.txt +++ b/src/modules/commander/CMakeLists.txt @@ -34,7 +34,7 @@ set(MODULE_CFLAGS -Os) if(NOT ${OS} STREQUAL "qurt") list(APPEND MODULE_CFLAGS - -Wframe-larger-than=2200) + -Wframe-larger-than=2600) endif() px4_add_module( MODULE modules__commander diff --git a/src/modules/ekf_att_pos_estimator/CMakeLists.txt b/src/modules/ekf_att_pos_estimator/CMakeLists.txt index 5a70282103..907bb31ff3 100644 --- a/src/modules/ekf_att_pos_estimator/CMakeLists.txt +++ b/src/modules/ekf_att_pos_estimator/CMakeLists.txt @@ -31,7 +31,7 @@ # ############################################################################ -set(MODULE_CFLAGS -Weffc++) +set(MODULE_CFLAGS ) if(NOT ${OS} STREQUAL "qurt") list(APPEND MODULE_CFLAGS -Wframe-larger-than=3400) endif() diff --git a/src/modules/land_detector/CMakeLists.txt b/src/modules/land_detector/CMakeLists.txt index 37030f1795..3e89ff1a6b 100644 --- a/src/modules/land_detector/CMakeLists.txt +++ b/src/modules/land_detector/CMakeLists.txt @@ -35,7 +35,6 @@ px4_add_module( MAIN land_detector STACK 1200 COMPILE_FLAGS - -Weffc++ -Os SRCS diff --git a/src/modules/mavlink/CMakeLists.txt b/src/modules/mavlink/CMakeLists.txt index f9897dd194..f7f2127c4b 100644 --- a/src/modules/mavlink/CMakeLists.txt +++ b/src/modules/mavlink/CMakeLists.txt @@ -35,11 +35,11 @@ px4_add_module( MAIN mavlink STACK 1200 COMPILE_FLAGS - -Weffc++ -Wno-attributes -Wno-packed -DMAVLINK_COMM_NUM_BUFFERS=3 -Wno-packed + -Wframe-larger-than=2000 -Os SRCS mavlink.c diff --git a/src/modules/mc_att_control_multiplatform/CMakeLists.txt b/src/modules/mc_att_control_multiplatform/CMakeLists.txt index 22f9d16ee8..0edd51ce57 100644 --- a/src/modules/mc_att_control_multiplatform/CMakeLists.txt +++ b/src/modules/mc_att_control_multiplatform/CMakeLists.txt @@ -33,6 +33,8 @@ px4_add_module( MODULE modules__mc_att_control_multiplatform MAIN mc_att_control_m + COMPILE_FLAGS + -Wframe-larger-than=1300 SRCS mc_att_control_main.cpp mc_att_control_start_nuttx.cpp diff --git a/src/modules/mc_pos_control_multiplatform/CMakeLists.txt b/src/modules/mc_pos_control_multiplatform/CMakeLists.txt index 28c2d0948a..76750b90de 100644 --- a/src/modules/mc_pos_control_multiplatform/CMakeLists.txt +++ b/src/modules/mc_pos_control_multiplatform/CMakeLists.txt @@ -34,7 +34,7 @@ px4_add_module( MODULE modules__mc_pos_control_multiplatform MAIN mc_pos_control_m COMPILE_FLAGS - -Wframe-larger-than=1200 + -Wframe-larger-than=1900 SRCS mc_pos_control_main.cpp diff --git a/src/modules/position_estimator_inav/CMakeLists.txt b/src/modules/position_estimator_inav/CMakeLists.txt index 0e801603a8..7c5393de9c 100644 --- a/src/modules/position_estimator_inav/CMakeLists.txt +++ b/src/modules/position_estimator_inav/CMakeLists.txt @@ -32,7 +32,7 @@ ############################################################################ set(MODULE_CFLAGS) if(NOT ${OS} STREQUAL "qurt") - list(APPEND MODULE_CFLAGS -Wframe-larger-than=3800) + list(APPEND MODULE_CFLAGS -Wframe-larger-than=3900) endif() px4_add_module( MODULE modules__position_estimator_inav diff --git a/src/modules/simulator/CMakeLists.txt b/src/modules/simulator/CMakeLists.txt index 1e81695b97..97daf37d10 100644 --- a/src/modules/simulator/CMakeLists.txt +++ b/src/modules/simulator/CMakeLists.txt @@ -40,10 +40,10 @@ px4_add_module( MODULE modules__simulator MAIN simulator COMPILE_FLAGS - -Weffc++ -Wno-attributes -Wno-packed -Wno-packed + -Wframe-larger-than=1500 SRCS ${SIMULATOR_SRCS} diff --git a/src/modules/uavcan/CMakeLists.txt b/src/modules/uavcan/CMakeLists.txt index f3d255d1e0..f9b5a3696d 100644 --- a/src/modules/uavcan/CMakeLists.txt +++ b/src/modules/uavcan/CMakeLists.txt @@ -35,7 +35,7 @@ set(uavcan_c_flags ${c_flags}) list(REMOVE_ITEM uavcan_c_flags -std=gnu++0x -D__CUSTOM_FILE_IO__) set(uavcan_cxx_flags ${cxx_flags}) -list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -D__CUSTOM_FILE_IO__) +list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -Wundef -Werror -D__CUSTOM_FILE_IO__) set(uavcan_deps git_uavcan) set(uavcan_platform generic) @@ -94,6 +94,8 @@ px4_add_module( MAIN uavcan STACK 3200 COMPILE_FLAGS + -Wframe-larger-than=1500 + -Wno-deprecated-declarations -O3 SRCS diff --git a/src/platforms/posix/drivers/gyrosim/CMakeLists.txt b/src/platforms/posix/drivers/gyrosim/CMakeLists.txt index 184df706d3..335bee65d6 100644 --- a/src/platforms/posix/drivers/gyrosim/CMakeLists.txt +++ b/src/platforms/posix/drivers/gyrosim/CMakeLists.txt @@ -35,7 +35,6 @@ px4_add_module( MAIN gyrosim STACK 1200 COMPILE_FLAGS - -Weffc++ -Os SRCS gyrosim.cpp diff --git a/src/systemcmds/mixer/CMakeLists.txt b/src/systemcmds/mixer/CMakeLists.txt index dd051b2772..99ce2b1bad 100644 --- a/src/systemcmds/mixer/CMakeLists.txt +++ b/src/systemcmds/mixer/CMakeLists.txt @@ -34,7 +34,7 @@ set(MIXER_CFLAGS -Os) if(${OS} STREQUAL "qurt") list(APPEND MIXER_CFLAGS -Wframe-larger-than=2176) else() - list(APPEND MIXER_CFLAGS -Wframe-larger-than=2048) + list(APPEND MIXER_CFLAGS -Wframe-larger-than=2064) endif() px4_add_module( From d30c8ccab83401ea67de87ea34b1271ba86d45a3 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 17:11:06 -0400 Subject: [PATCH 313/389] travis-ci don't specify make threads --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 68fb32dae8..dd4e5b4401 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,14 +90,14 @@ script: - make check_format - arm-none-eabi-gcc --version - echo 'Building POSIX Firmware..' && echo -en 'travis_fold:start:script.1\\r' - - make posix_sitl_simple -j4 + - make posix_sitl_simple - echo -en 'travis_fold:end:script.1\\r' - echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r' - make posix_sitl_simple test - cat build_posix_sitl_simple/src/modules/systemlib/mixer/mixer_multirotor.generated.h - echo -en 'travis_fold:end:script.2\\r' - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r' - - make px4fmu-v2_default -j4 + - make px4fmu-v2_default - echo -en 'travis_fold:end:script.3\\r' - echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r' - make px4fmu-v2_default test From 644a0cd30ca4967d5e578d53e0835f72a83c4f4c Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 17:20:32 -0400 Subject: [PATCH 314/389] adjust attitude_estimator_ekf for posix_sitl_simple --- cmake/toolchains/Toolchain-posix-clang-native.cmake | 1 + src/modules/attitude_estimator_ekf/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/toolchains/Toolchain-posix-clang-native.cmake b/cmake/toolchains/Toolchain-posix-clang-native.cmake index 544f61f826..e52f3f4a64 100644 --- a/cmake/toolchains/Toolchain-posix-clang-native.cmake +++ b/cmake/toolchains/Toolchain-posix-clang-native.cmake @@ -1,6 +1,7 @@ set(WARNINGS -Wall + -Werror -Wextra -Wdouble-promotion -Wshadow diff --git a/src/modules/attitude_estimator_ekf/CMakeLists.txt b/src/modules/attitude_estimator_ekf/CMakeLists.txt index 65ab7eff02..30fb6f0091 100644 --- a/src/modules/attitude_estimator_ekf/CMakeLists.txt +++ b/src/modules/attitude_estimator_ekf/CMakeLists.txt @@ -35,7 +35,7 @@ px4_add_module( MAIN attitude_estimator_ekf STACK 1200 COMPILE_FLAGS - -Wframe-larger-than=3000 + -Wframe-larger-than=3100 -Wno-float-equal SRCS From e4a78124d877328553b807e4d1290af19a1a167b Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 18:17:20 -0400 Subject: [PATCH 315/389] posix add -Wno-varargs for OS X --- cmake/common/px4_base.cmake | 1 + cmake/toolchains/Toolchain-posix-clang-native.cmake | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 1093d367e9..019dcc16cf 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -490,6 +490,7 @@ function(px4_add_common_flags) -Wpointer-arith -Wmissing-declarations -Wno-unused-parameter + -Wno-varargs -Werror=format-security -Werror=array-bounds -Wfatal-errors diff --git a/cmake/toolchains/Toolchain-posix-clang-native.cmake b/cmake/toolchains/Toolchain-posix-clang-native.cmake index e52f3f4a64..0945b2b1f5 100644 --- a/cmake/toolchains/Toolchain-posix-clang-native.cmake +++ b/cmake/toolchains/Toolchain-posix-clang-native.cmake @@ -26,6 +26,7 @@ set(WARNINGS -Werror=unused-private-field -Wno-packed -Wno-frame-larger-than= + -Wno-varargs #-Wcast-qual - generates spurious noreturn attribute warnings, # try again later #-Wconversion - would be nice, but too many "risky-but-safe" @@ -59,6 +60,7 @@ set(C_FLAGS # set(CXX_WARNINGS -Wno-missing-field-initializers + -Wno-varargs ) set(CXX_FLAGS -fno-exceptions From a3d79c6e15a71ed5c8b179f90224d5a5b54742b0 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 18:20:57 -0400 Subject: [PATCH 316/389] cmake uavcan set cpp03 and silence install --- src/modules/uavcan/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/uavcan/CMakeLists.txt b/src/modules/uavcan/CMakeLists.txt index f9b5a3696d..38bf0bc111 100644 --- a/src/modules/uavcan/CMakeLists.txt +++ b/src/modules/uavcan/CMakeLists.txt @@ -76,8 +76,10 @@ externalproject_add(libuavcan DEPENDS ${uavcan_deps} DOWNLOAD_COMMAND "" UPDATE_COMMAND git submodule update --init + LOG_INSTALL 1 SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DUAVCAN_USE_CPP03=ON -DUAVCAN_PLATFORM=${uavcan_platform} -DUAVCAN_OS=${OS} -DCMAKE_CXX_FLAGS=${uavcan_cxx_flags} From 4151522902726802b34263670c715a654d4b9a22 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 6 Oct 2015 18:50:58 -0400 Subject: [PATCH 317/389] only enforce frame size for nuttx --- cmake/common/px4_base.cmake | 2 +- src/modules/attitude_estimator_ekf/CMakeLists.txt | 2 -- src/modules/attitude_estimator_q/CMakeLists.txt | 8 +++----- src/modules/commander/CMakeLists.txt | 6 ++---- src/modules/land_detector/CMakeLists.txt | 1 - src/modules/mavlink/CMakeLists.txt | 6 +++++- src/modules/mc_att_control/CMakeLists.txt | 4 ++++ src/modules/mc_att_control_multiplatform/CMakeLists.txt | 2 -- .../mc_att_control_multiplatform/mc_att_control.cpp | 2 -- src/modules/mc_att_control_multiplatform/mc_att_control.h | 2 -- src/modules/mc_pos_control_multiplatform/CMakeLists.txt | 3 --- src/modules/position_estimator_inav/CMakeLists.txt | 6 ++---- src/modules/sdlog2/CMakeLists.txt | 5 ++++- src/modules/simulator/CMakeLists.txt | 2 -- src/systemcmds/mixer/CMakeLists.txt | 2 +- 15 files changed, 22 insertions(+), 31 deletions(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 019dcc16cf..22cc19c0fe 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -506,7 +506,7 @@ function(px4_add_common_flags) # but generates too many false positives ) - if (NOT ${OS} STREQUAL "qurt") + if (${OS} STREQUAL "nuttx") list(APPEND warnings -Wframe-larger-than=1024) endif() diff --git a/src/modules/attitude_estimator_ekf/CMakeLists.txt b/src/modules/attitude_estimator_ekf/CMakeLists.txt index 30fb6f0091..8c68904661 100644 --- a/src/modules/attitude_estimator_ekf/CMakeLists.txt +++ b/src/modules/attitude_estimator_ekf/CMakeLists.txt @@ -35,9 +35,7 @@ px4_add_module( MAIN attitude_estimator_ekf STACK 1200 COMPILE_FLAGS - -Wframe-larger-than=3100 -Wno-float-equal - SRCS attitude_estimator_ekf_main.cpp codegen/AttitudeEKF.c diff --git a/src/modules/attitude_estimator_q/CMakeLists.txt b/src/modules/attitude_estimator_q/CMakeLists.txt index b4726b5c89..c74993ad67 100644 --- a/src/modules/attitude_estimator_q/CMakeLists.txt +++ b/src/modules/attitude_estimator_q/CMakeLists.txt @@ -31,15 +31,13 @@ # ############################################################################# set(MODULE_CFLAGS) -if (NOT ${OS} STREQUAL "qurt") - list(APPEND MODULE_CFLAGS - -Wframe-larger-than=1400) +if (${OS} STREQUAL "nuttx") + list(APPEND MODULE_CFLAGS -Wframe-larger-than=1400) endif() px4_add_module( MODULE modules__attitude_estimator_q MAIN attitude_estimator_q - COMPILE_FLAGS - ${MODULE_CFLAGS} + COMPILE_FLAGS ${MODULE_CFLAGS} STACK 1200 SRCS attitude_estimator_q_main.cpp diff --git a/src/modules/commander/CMakeLists.txt b/src/modules/commander/CMakeLists.txt index 698177edb6..d5c4aa0f12 100644 --- a/src/modules/commander/CMakeLists.txt +++ b/src/modules/commander/CMakeLists.txt @@ -31,10 +31,8 @@ # ############################################################################ set(MODULE_CFLAGS -Os) - -if(NOT ${OS} STREQUAL "qurt") - list(APPEND MODULE_CFLAGS - -Wframe-larger-than=2600) +if(${OS} STREQUAL "nuttx") + list(APPEND MODULE_CFLAGS -Wframe-larger-than=2300) endif() px4_add_module( MODULE modules__commander diff --git a/src/modules/land_detector/CMakeLists.txt b/src/modules/land_detector/CMakeLists.txt index 3e89ff1a6b..f18b3ed187 100644 --- a/src/modules/land_detector/CMakeLists.txt +++ b/src/modules/land_detector/CMakeLists.txt @@ -36,7 +36,6 @@ px4_add_module( STACK 1200 COMPILE_FLAGS -Os - SRCS land_detector_main.cpp land_detector_params.c diff --git a/src/modules/mavlink/CMakeLists.txt b/src/modules/mavlink/CMakeLists.txt index f7f2127c4b..c8a0e7d870 100644 --- a/src/modules/mavlink/CMakeLists.txt +++ b/src/modules/mavlink/CMakeLists.txt @@ -30,16 +30,20 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +if (${OS} STREQUAL "nuttx") + list(APPEND MODULE_CFLAGS -Wframe-larger-than=1500) +endif() px4_add_module( MODULE modules__mavlink MAIN mavlink STACK 1200 COMPILE_FLAGS + ${MODULE_CFLAGS} -Wno-attributes -Wno-packed -DMAVLINK_COMM_NUM_BUFFERS=3 -Wno-packed - -Wframe-larger-than=2000 + -Wno-tautological-constant-out-of-range-compare -Os SRCS mavlink.c diff --git a/src/modules/mc_att_control/CMakeLists.txt b/src/modules/mc_att_control/CMakeLists.txt index 3f4aeed93f..3c08772766 100644 --- a/src/modules/mc_att_control/CMakeLists.txt +++ b/src/modules/mc_att_control/CMakeLists.txt @@ -30,10 +30,14 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +if (${OS} STREQUAL "nuttx") + list(APPEND MODULE_CFLAGS -Wframe-larger-than=3500) +endif() px4_add_module( MODULE modules__mc_att_control MAIN mc_att_control STACK 1200 + COMPILE_FLAGS ${MODULE_CFLAGS} SRCS mc_att_control_main.cpp mc_att_control_params.c diff --git a/src/modules/mc_att_control_multiplatform/CMakeLists.txt b/src/modules/mc_att_control_multiplatform/CMakeLists.txt index 0edd51ce57..22f9d16ee8 100644 --- a/src/modules/mc_att_control_multiplatform/CMakeLists.txt +++ b/src/modules/mc_att_control_multiplatform/CMakeLists.txt @@ -33,8 +33,6 @@ px4_add_module( MODULE modules__mc_att_control_multiplatform MAIN mc_att_control_m - COMPILE_FLAGS - -Wframe-larger-than=1300 SRCS mc_att_control_main.cpp mc_att_control_start_nuttx.cpp diff --git a/src/modules/mc_att_control_multiplatform/mc_att_control.cpp b/src/modules/mc_att_control_multiplatform/mc_att_control.cpp index 63515f497d..98435a08f0 100644 --- a/src/modules/mc_att_control_multiplatform/mc_att_control.cpp +++ b/src/modules/mc_att_control_multiplatform/mc_att_control.cpp @@ -64,11 +64,9 @@ static const int ERROR = -1; MulticopterAttitudeControlMultiplatform::MulticopterAttitudeControlMultiplatform() : MulticopterAttitudeControlBase(), - _task_should_exit(false), _actuators_0_circuit_breaker_enabled(false), /* publications */ - _att_sp_pub(nullptr), _v_rates_sp_pub(nullptr), _actuators_0_pub(nullptr), _n(_appState), diff --git a/src/modules/mc_att_control_multiplatform/mc_att_control.h b/src/modules/mc_att_control_multiplatform/mc_att_control.h index de059fc9f3..12d4beadfc 100644 --- a/src/modules/mc_att_control_multiplatform/mc_att_control.h +++ b/src/modules/mc_att_control_multiplatform/mc_att_control.h @@ -85,10 +85,8 @@ public: void spin() { _n.spin(); } private: - bool _task_should_exit; /**< if true, sensor task should exit */ bool _actuators_0_circuit_breaker_enabled; /**< circuit breaker to suppress output */ - px4::Publisher *_att_sp_pub; /**< attitude setpoint publication */ px4::Publisher *_v_rates_sp_pub; /**< rate setpoint publication */ px4::Publisher *_actuators_0_pub; /**< attitude actuator controls publication */ diff --git a/src/modules/mc_pos_control_multiplatform/CMakeLists.txt b/src/modules/mc_pos_control_multiplatform/CMakeLists.txt index 76750b90de..f36acf4e33 100644 --- a/src/modules/mc_pos_control_multiplatform/CMakeLists.txt +++ b/src/modules/mc_pos_control_multiplatform/CMakeLists.txt @@ -33,9 +33,6 @@ px4_add_module( MODULE modules__mc_pos_control_multiplatform MAIN mc_pos_control_m - COMPILE_FLAGS - -Wframe-larger-than=1900 - SRCS mc_pos_control_main.cpp mc_pos_control_start_nuttx.cpp diff --git a/src/modules/position_estimator_inav/CMakeLists.txt b/src/modules/position_estimator_inav/CMakeLists.txt index 7c5393de9c..90ab4ad74c 100644 --- a/src/modules/position_estimator_inav/CMakeLists.txt +++ b/src/modules/position_estimator_inav/CMakeLists.txt @@ -30,16 +30,14 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ -set(MODULE_CFLAGS) -if(NOT ${OS} STREQUAL "qurt") - list(APPEND MODULE_CFLAGS -Wframe-larger-than=3900) +if(${OS} STREQUAL "nuttx") + list(APPEND MODULE_CFLAGS -Wframe-larger-than=3800) endif() px4_add_module( MODULE modules__position_estimator_inav MAIN position_estimator_inav STACK 1200 COMPILE_FLAGS ${MODULE_CFLAGS} - SRCS position_estimator_inav_main.c position_estimator_inav_params.c diff --git a/src/modules/sdlog2/CMakeLists.txt b/src/modules/sdlog2/CMakeLists.txt index ddc1b30174..b438f30fd5 100644 --- a/src/modules/sdlog2/CMakeLists.txt +++ b/src/modules/sdlog2/CMakeLists.txt @@ -30,13 +30,16 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ +if (${OS} STREQUAL "nuttx") + list(APPEND MODULE_CFLAGS -Wframe-larger-than=1500) +endif() px4_add_module( MODULE modules__sdlog2 MAIN sdlog2 PRIORITY "SCHED_PRIORITY_MAX-30" STACK 1200 COMPILE_FLAGS - -Wframe-larger-than=1500 + ${MODULE_CFLAGS} -Os SRCS sdlog2.c diff --git a/src/modules/simulator/CMakeLists.txt b/src/modules/simulator/CMakeLists.txt index 97daf37d10..de452c5de4 100644 --- a/src/modules/simulator/CMakeLists.txt +++ b/src/modules/simulator/CMakeLists.txt @@ -43,8 +43,6 @@ px4_add_module( -Wno-attributes -Wno-packed -Wno-packed - -Wframe-larger-than=1500 - SRCS ${SIMULATOR_SRCS} DEPENDS diff --git a/src/systemcmds/mixer/CMakeLists.txt b/src/systemcmds/mixer/CMakeLists.txt index 99ce2b1bad..703d8210fb 100644 --- a/src/systemcmds/mixer/CMakeLists.txt +++ b/src/systemcmds/mixer/CMakeLists.txt @@ -34,7 +34,7 @@ set(MIXER_CFLAGS -Os) if(${OS} STREQUAL "qurt") list(APPEND MIXER_CFLAGS -Wframe-larger-than=2176) else() - list(APPEND MIXER_CFLAGS -Wframe-larger-than=2064) + list(APPEND MIXER_CFLAGS -Wframe-larger-than=2100) endif() px4_add_module( From 46d093c060b9500df7a4b38f5b3d136c4f0f43c6 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Tue, 6 Oct 2015 18:50:21 +0200 Subject: [PATCH 318/389] implemented extended system state message --- src/modules/mavlink/mavlink_main.cpp | 8 +-- src/modules/mavlink/mavlink_messages.cpp | 63 ++++++++++++++++-------- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 3547341a71..e2c69d0084 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1673,7 +1673,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("ATTITUDE_TARGET", 8.0f); configure_stream("DISTANCE_SENSOR", 0.5f); configure_stream("OPTICAL_FLOW_RAD", 5.0f); - configure_stream("VTOL_STATE", 0.5f); + configure_stream("EXTENDED_SYS_STATE", 1.0f); break; case MAVLINK_MODE_ONBOARD: @@ -1699,7 +1699,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("ACTUATOR_CONTROL_TARGET0", 10.0f); /* camera trigger is rate limited at the source, do not limit here */ configure_stream("CAMERA_TRIGGER", 500.0f); - configure_stream("VTOL_STATE", 2.0f); + configure_stream("EXTENDED_SYS_STATE", 2.0f); break; case MAVLINK_MODE_OSD: @@ -1714,7 +1714,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("SYSTEM_TIME", 1.0f); configure_stream("RC_CHANNELS", 5.0f); configure_stream("SERVO_OUTPUT_RAW_0", 1.0f); - configure_stream("VTOL_STATE", 0.5f); + configure_stream("EXTENDED_SYS_STATE", 1.0f); break; case MAVLINK_MODE_CONFIG: @@ -1740,7 +1740,7 @@ Mavlink::task_main(int argc, char *argv[]) configure_stream("HIGHRES_IMU", 50.0f); configure_stream("GPS_RAW_INT", 20.0f); configure_stream("CAMERA_TRIGGER", 500.0f); - configure_stream("VTOL_STATE", 2.0f); + configure_stream("EXTENDED_SYS_STATE", 2.0f); default: break; diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index de589a8bac..c6dde06677 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -2361,76 +2362,96 @@ protected: } }; -class MavlinkStreamVtolState : public MavlinkStream +class MavlinkStreamExtendedSysState : public MavlinkStream { public: const char *get_name() const { - return MavlinkStreamVtolState::get_name_static(); + return MavlinkStreamExtendedSysState::get_name_static(); } static const char *get_name_static() { - return "VTOL_STATE"; + return "EXTENDED_SYS_STATE"; } uint8_t get_id() { - return MAVLINK_MSG_ID_VTOL_STATE; + return MAVLINK_MSG_ID_EXTENDED_SYS_STATE; } static MavlinkStream *new_instance(Mavlink *mavlink) { - return new MavlinkStreamVtolState(mavlink); + return new MavlinkStreamExtendedSysState(mavlink); } unsigned get_size() { - return MAVLINK_MSG_ID_VTOL_STATE_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES; + return MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES; } private: MavlinkOrbSubscription *_status_sub; + MavlinkOrbSubscription *_landed_sub; + mavlink_extended_sys_state_t _msg; /* do not allow top copying this class */ - MavlinkStreamVtolState(MavlinkStreamVtolState &); - MavlinkStreamVtolState &operator = (const MavlinkStreamVtolState &); + MavlinkStreamExtendedSysState(MavlinkStreamExtendedSysState &); + MavlinkStreamExtendedSysState &operator = (const MavlinkStreamExtendedSysState &); protected: - explicit MavlinkStreamVtolState(Mavlink *mavlink) : MavlinkStream(mavlink), - _status_sub(_mavlink->add_orb_subscription(ORB_ID(vehicle_status))) - {} + explicit MavlinkStreamExtendedSysState(Mavlink *mavlink) : MavlinkStream(mavlink), + _status_sub(_mavlink->add_orb_subscription(ORB_ID(vehicle_status))), + _landed_sub(_mavlink->add_orb_subscription(ORB_ID(vehicle_land_detected))), + _msg{} + { + + _msg.vtol_state = MAV_VTOL_STATE_UNDEFINED; + _msg.landed_state = MAV_LANDED_STATE_UNDEFINED; + } void send(const hrt_abstime t) { struct vehicle_status_s status; + struct vehicle_land_detected_s land_detected; + bool updated = false; if (_status_sub->update(&status)) { - mavlink_vtol_state_t msg; + updated = true; if (status.is_vtol) { if (status.is_rotary_wing) { if (status.in_transition_mode) { - msg.state = MAV_VTOL_STATE_TRANSITION_TO_FW; + _msg.vtol_state = MAV_VTOL_STATE_TRANSITION_TO_FW; } else { - msg.state = MAV_VTOL_STATE_MC; + _msg.vtol_state = MAV_VTOL_STATE_MC; } } else { if (status.in_transition_mode) { - msg.state = MAV_VTOL_STATE_TRANSITION_TO_MC; + _msg.vtol_state = MAV_VTOL_STATE_TRANSITION_TO_MC; } else { - msg.state = MAV_VTOL_STATE_FW; + _msg.vtol_state = MAV_VTOL_STATE_FW; } } - - } else { - msg.state = MAV_VTOL_STATE_UNDEFINED; } + } - _mavlink->send_message(MAVLINK_MSG_ID_VTOL_STATE, &msg); + if (_landed_sub->update(&land_detected)) { + updated = true; + + if (land_detected.landed) { + _msg.landed_state = MAV_LANDED_STATE_ON_GROUND; + + } else { + _msg.landed_state = MAV_LANDED_STATE_IN_AIR; + } + } + + if (updated) { + _mavlink->send_message(MAVLINK_MSG_ID_EXTENDED_SYS_STATE, &_msg); } } }; @@ -2470,6 +2491,6 @@ const StreamListItem *streams_list[] = { new StreamListItem(&MavlinkStreamCameraCapture::new_instance, &MavlinkStreamCameraCapture::get_name_static), new StreamListItem(&MavlinkStreamCameraTrigger::new_instance, &MavlinkStreamCameraTrigger::get_name_static), new StreamListItem(&MavlinkStreamDistanceSensor::new_instance, &MavlinkStreamDistanceSensor::get_name_static), - new StreamListItem(&MavlinkStreamVtolState::new_instance, &MavlinkStreamVtolState::get_name_static), + new StreamListItem(&MavlinkStreamExtendedSysState::new_instance, &MavlinkStreamExtendedSysState::get_name_static), nullptr }; From 83d391a37cd8a9df3584a9be3fa8db5e89ff373b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 7 Oct 2015 11:52:08 +0200 Subject: [PATCH 319/389] Updated MAVLink to latest master --- mavlink/include/mavlink/v1.0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mavlink/include/mavlink/v1.0 b/mavlink/include/mavlink/v1.0 index c390a63abf..86a2b147e4 160000 --- a/mavlink/include/mavlink/v1.0 +++ b/mavlink/include/mavlink/v1.0 @@ -1 +1 @@ -Subproject commit c390a63abfce15af0629bdf207c4b6a183fed118 +Subproject commit 86a2b147e4cec5066efdc6d030d69d902929e66f From 4de6012f12d94d3ca4e83b6cc2cf59e7b8461e96 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 7 Oct 2015 15:13:13 +0200 Subject: [PATCH 320/389] Commander: Only indicate green led if home position is valid --- msg/vehicle_status.msg | 1 - src/modules/commander/commander.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/msg/vehicle_status.msg b/msg/vehicle_status.msg index 1cf771ba3c..c0c6dc7f0f 100644 --- a/msg/vehicle_status.msg +++ b/msg/vehicle_status.msg @@ -121,7 +121,6 @@ bool condition_system_sensors_initialized bool condition_system_returned_to_home bool condition_auto_mission_available bool condition_global_position_valid # set to true by the commander app if the quality of the position estimate is good enough to use it for navigation -bool condition_launch_position_valid # indicates a valid launch position bool condition_home_position_valid # indicates a valid home position (a valid home position is not always a valid launch) bool condition_local_position_valid bool condition_local_altitude_valid diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 948d5c661d..d07ae10d71 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -2356,7 +2356,7 @@ control_status_leds(vehicle_status_s *status_local, const actuator_armed_s *actu } else if (status_local->battery_warning == vehicle_status_s::VEHICLE_BATTERY_WARNING_CRITICAL) { rgbled_set_color(RGBLED_COLOR_RED); } else { - if (status_local->condition_global_position_valid) { + if (status_local->condition_home_position_valid) { rgbled_set_color(RGBLED_COLOR_GREEN); } else { From 73fabc2b4d1b1460195d6305aa23f4b8177b4513 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 7 Oct 2015 16:30:24 +0200 Subject: [PATCH 321/389] dataman: Limit variable scope --- src/modules/dataman/dataman.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/dataman/dataman.c b/src/modules/dataman/dataman.c index f0d145d417..817b65dce3 100644 --- a/src/modules/dataman/dataman.c +++ b/src/modules/dataman/dataman.c @@ -149,8 +149,8 @@ typedef struct { static work_q_t g_free_q; /* queue of free work items. So that we don't always need to call malloc and free*/ static work_q_t g_work_q; /* pending work items. To be consumed by worker thread */ -px4_sem_t g_work_queued_sema; /* To notify worker thread a work item has been queued */ -px4_sem_t g_init_sema; +static px4_sem_t g_work_queued_sema; /* To notify worker thread a work item has been queued */ +static px4_sem_t g_init_sema; static bool g_task_should_exit; /**< if true, dataman task should exit */ From 81c7ee6566bc2cdd4a71419c285287cd0891305e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 7 Oct 2015 16:35:51 +0200 Subject: [PATCH 322/389] Commander: Only perform mode switch on manual input when switch position has changed. This allows mode switching from either tablet or controller to be enabled at the same time. --- src/modules/commander/commander.cpp | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index d07ae10d71..30f6f2ffa7 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -195,6 +195,13 @@ static struct offboard_control_mode_s offboard_control_mode; static struct home_position_s _home; static unsigned _last_mission_instance = 0; +static uint64_t last_manual_input = 0; +static switch_pos_t last_offboard_switch = 0; +static switch_pos_t last_return_switch = 0; +static switch_pos_t last_mode_switch = 0; +static switch_pos_t last_acro_switch = 0; +static switch_pos_t last_posctl_switch = 0; +static switch_pos_t last_loiter_switch = 0; struct vtol_vehicle_status_s vtol_status; @@ -586,6 +593,14 @@ bool handle_command(struct vehicle_status_s *status_local, const struct safety_s } else { cmd_result = vehicle_command_s::VEHICLE_CMD_RESULT_TEMPORARILY_REJECTED; + + if (arming_ret == TRANSITION_DENIED) { + mavlink_log_critical(mavlink_fd, "Rejecting arming cmd"); + } + + if (main_ret == TRANSITION_DENIED) { + mavlink_log_critical(mavlink_fd, "Rejecting mode switch cmd"); + } } } break; @@ -2183,7 +2198,6 @@ int commander_thread_main(int argc, char *argv[]) // TODO handle mode changes by commands if (main_state_changed || nav_state_changed) { status_changed = true; - warnx("main state: %s nav state: %s", main_states_str[status.main_state], nav_states_str[status.nav_state]); mavlink_log_info(mavlink_fd, "Flight mode: %s", nav_states_str[status.nav_state]); main_state_changed = false; } @@ -2412,6 +2426,27 @@ set_main_state_rc(struct vehicle_status_s *status_local, struct manual_control_s return main_state_transition(status_local,vehicle_status_s::MAIN_STATE_OFFBOARD); } + /* manual setpoint has not updated, do not re-evaluate it */ + if ((last_manual_input == sp_man->timestamp) || + ((last_offboard_switch == sp_man->offboard_switch) && + (last_return_switch == sp_man->return_switch) && + (last_mode_switch == sp_man->mode_switch) && + (last_acro_switch == sp_man->acro_switch) && + (last_posctl_switch == sp_man->posctl_switch) && + (last_loiter_switch == sp_man->loiter_switch))) { + + /* no timestamp change or no switch change -> nothing changed */ + return TRANSITION_NOT_CHANGED; + } + + last_manual_input = sp_man->timestamp; + last_offboard_switch = sp_man->offboard_switch; + last_return_switch = sp_man->return_switch; + last_mode_switch = sp_man->mode_switch; + last_acro_switch = sp_man->acro_switch; + last_posctl_switch = sp_man->posctl_switch; + last_loiter_switch = sp_man->loiter_switch; + /* offboard switch overrides main switch */ if (sp_man->offboard_switch == manual_control_setpoint_s::SWITCH_POS_ON) { res = main_state_transition(status_local,vehicle_status_s::MAIN_STATE_OFFBOARD); From 6126a8c0eee2fa8b46d39749253428180f38a681 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 7 Oct 2015 16:46:58 +0200 Subject: [PATCH 323/389] Commander: Disable unused strings, but keep them for now --- src/modules/commander/commander.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 30f6f2ffa7..9c43342c1e 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -925,16 +925,16 @@ int commander_thread_main(int argc, char *argv[]) param_t _param_eph = param_find("COM_HOME_H_T"); param_t _param_epv = param_find("COM_HOME_V_T"); - const char *main_states_str[vehicle_status_s::MAIN_STATE_MAX]; - main_states_str[vehicle_status_s::MAIN_STATE_MANUAL] = "MANUAL"; - main_states_str[vehicle_status_s::MAIN_STATE_ALTCTL] = "ALTCTL"; - main_states_str[vehicle_status_s::MAIN_STATE_POSCTL] = "POSCTL"; - main_states_str[vehicle_status_s::MAIN_STATE_AUTO_MISSION] = "AUTO_MISSION"; - main_states_str[vehicle_status_s::MAIN_STATE_AUTO_LOITER] = "AUTO_LOITER"; - main_states_str[vehicle_status_s::MAIN_STATE_AUTO_RTL] = "AUTO_RTL"; - main_states_str[vehicle_status_s::MAIN_STATE_ACRO] = "ACRO"; - main_states_str[vehicle_status_s::MAIN_STATE_STAB] = "STAB"; - main_states_str[vehicle_status_s::MAIN_STATE_OFFBOARD] = "OFFBOARD"; + // const char *main_states_str[vehicle_status_s::MAIN_STATE_MAX]; + // main_states_str[vehicle_status_s::MAIN_STATE_MANUAL] = "MANUAL"; + // main_states_str[vehicle_status_s::MAIN_STATE_ALTCTL] = "ALTCTL"; + // main_states_str[vehicle_status_s::MAIN_STATE_POSCTL] = "POSCTL"; + // main_states_str[vehicle_status_s::MAIN_STATE_AUTO_MISSION] = "AUTO_MISSION"; + // main_states_str[vehicle_status_s::MAIN_STATE_AUTO_LOITER] = "AUTO_LOITER"; + // main_states_str[vehicle_status_s::MAIN_STATE_AUTO_RTL] = "AUTO_RTL"; + // main_states_str[vehicle_status_s::MAIN_STATE_ACRO] = "ACRO"; + // main_states_str[vehicle_status_s::MAIN_STATE_STAB] = "STAB"; + // main_states_str[vehicle_status_s::MAIN_STATE_OFFBOARD] = "OFFBOARD"; const char *arming_states_str[vehicle_status_s::ARMING_STATE_MAX]; arming_states_str[vehicle_status_s::ARMING_STATE_INIT] = "INIT"; From a1d6cfcfb7ff36ff234494dab4b4cb9b7d0be7f2 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 8 Oct 2015 10:58:34 +0200 Subject: [PATCH 324/389] Remove old module.mk files to not confuse new users --- src/examples/fixedwing_control/module.mk | 45 ------------------- src/examples/hwtest/module.mk | 40 ----------------- src/examples/matlab_csv_serial/module.mk | 40 ----------------- src/examples/publisher/module.mk | 44 ------------------ src/examples/px4_daemon_app/module.mk | 42 ----------------- src/examples/px4_mavlink_debug/module.mk | 42 ----------------- src/examples/rover_steering_control/module.mk | 45 ------------------- src/examples/subscriber/module.mk | 45 ------------------- 8 files changed, 343 deletions(-) delete mode 100644 src/examples/fixedwing_control/module.mk delete mode 100644 src/examples/hwtest/module.mk delete mode 100644 src/examples/matlab_csv_serial/module.mk delete mode 100644 src/examples/publisher/module.mk delete mode 100644 src/examples/px4_daemon_app/module.mk delete mode 100644 src/examples/px4_mavlink_debug/module.mk delete mode 100644 src/examples/rover_steering_control/module.mk delete mode 100644 src/examples/subscriber/module.mk diff --git a/src/examples/fixedwing_control/module.mk b/src/examples/fixedwing_control/module.mk deleted file mode 100644 index da96054d3b..0000000000 --- a/src/examples/fixedwing_control/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Fixedwing Attitude Control Demo / Example Application -# - -MODULE_COMMAND = ex_fixedwing_control - -SRCS = main.c \ - params.c - -MODULE_STACKSIZE = 1200 - -EXTRACFLAGS = -Wframe-larger-than=1300 diff --git a/src/examples/hwtest/module.mk b/src/examples/hwtest/module.mk deleted file mode 100644 index 6e70863edb..0000000000 --- a/src/examples/hwtest/module.mk +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Hardware test example application -# - -MODULE_COMMAND = ex_hwtest - -SRCS = hwtest.c diff --git a/src/examples/matlab_csv_serial/module.mk b/src/examples/matlab_csv_serial/module.mk deleted file mode 100644 index 1629c2ce46..0000000000 --- a/src/examples/matlab_csv_serial/module.mk +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright (c) 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build position estimator -# - -MODULE_COMMAND = matlab_csv_serial - -SRCS = matlab_csv_serial.c diff --git a/src/examples/publisher/module.mk b/src/examples/publisher/module.mk deleted file mode 100644 index 62a5f8dd1f..0000000000 --- a/src/examples/publisher/module.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (c) 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Publisher Example Application -# - -MODULE_COMMAND = publisher - -SRCS = publisher_main.cpp \ - publisher_start_nuttx.cpp \ - publisher_example.cpp - -MODULE_STACKSIZE = 1200 diff --git a/src/examples/px4_daemon_app/module.mk b/src/examples/px4_daemon_app/module.mk deleted file mode 100644 index fc42231425..0000000000 --- a/src/examples/px4_daemon_app/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Daemon application -# - -MODULE_COMMAND = px4_daemon_app - -SRCS = px4_daemon_app.c - -MODULE_STACKSIZE = 1200 diff --git a/src/examples/px4_mavlink_debug/module.mk b/src/examples/px4_mavlink_debug/module.mk deleted file mode 100644 index c7ef97fc45..0000000000 --- a/src/examples/px4_mavlink_debug/module.mk +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Basic example application -# - -MODULE_COMMAND = px4_mavlink_debug - -SRCS = px4_mavlink_debug.c - -MODULE_STACKSIZE = 2000 diff --git a/src/examples/rover_steering_control/module.mk b/src/examples/rover_steering_control/module.mk deleted file mode 100644 index 8f7a7ed3af..0000000000 --- a/src/examples/rover_steering_control/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Rover Steering Demo / Example Application -# - -MODULE_COMMAND = rover_steering_control - -SRCS = main.cpp \ - params.c - -MODULE_STACKSIZE = 1200 - -EXTRACFLAGS = -Wframe-larger-than=1300 diff --git a/src/examples/subscriber/module.mk b/src/examples/subscriber/module.mk deleted file mode 100644 index 0e02c65b45..0000000000 --- a/src/examples/subscriber/module.mk +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (c) 2014 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Subscriber Example Application -# - -MODULE_COMMAND = subscriber - -SRCS = subscriber_main.cpp \ - subscriber_start_nuttx.cpp \ - subscriber_example.cpp \ - subscriber_params.c - -MODULE_STACKSIZE = 2400 From 207d4a0c6b861994f2625335ecb5528480425950 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 8 Oct 2015 12:09:48 +0200 Subject: [PATCH 325/389] Commander: Fix excessively large stack size --- src/modules/commander/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/commander/CMakeLists.txt b/src/modules/commander/CMakeLists.txt index d5c4aa0f12..5ca0ff2ca6 100644 --- a/src/modules/commander/CMakeLists.txt +++ b/src/modules/commander/CMakeLists.txt @@ -37,7 +37,7 @@ endif() px4_add_module( MODULE modules__commander MAIN commander - STACK 5000 + STACK 1200 COMPILE_FLAGS ${MODULE_CFLAGS} -Os From dc31cbb4f9e3fbf0d771d38f16497c9e6c10384e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 8 Oct 2015 12:25:34 +0200 Subject: [PATCH 326/389] FW pos control: Add missing dependencies for correct build order --- src/modules/fw_pos_control_l1/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/fw_pos_control_l1/CMakeLists.txt b/src/modules/fw_pos_control_l1/CMakeLists.txt index 530dd51b1e..78313eed84 100644 --- a/src/modules/fw_pos_control_l1/CMakeLists.txt +++ b/src/modules/fw_pos_control_l1/CMakeLists.txt @@ -46,5 +46,7 @@ px4_add_module( mtecs/mTecs_params.c DEPENDS platforms__common + lib__external_lgpl + lib__ecl ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : From 231140ca8ad3a649207acd1a4de1f508eac122e6 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 8 Oct 2015 14:19:02 -0400 Subject: [PATCH 327/389] cmake fix .git path --- cmake/common/px4_base.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 22cc19c0fe..51ff486868 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -698,6 +698,7 @@ function(px4_create_git_hash_header) COMMAND git log -n 1 --pretty=format:"%H" OUTPUT_VARIABLE git_desc OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) message(STATUS "GIT_DESC = ${git_desc}") set(git_desc_short) From 21c66dd8638a23089cacf7323ca14cb1ddf5a058 Mon Sep 17 00:00:00 2001 From: tumbili Date: Sun, 4 Oct 2015 19:59:40 +0200 Subject: [PATCH 328/389] don't allow arming/disarming by rc if rc control is disabled --- src/modules/commander/commander.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 9c43342c1e..db5f95d511 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1899,7 +1899,7 @@ int commander_thread_main(int argc, char *argv[]) /* check if left stick is in lower left position and we are in MANUAL or AUTO_READY mode or (ASSIST mode and landed) -> disarm * do it only for rotary wings */ - if (status.is_rotary_wing && + if (status.is_rotary_wing && status.rc_input_mode != vehicle_status_s::RC_IN_MODE_OFF && (status.arming_state == vehicle_status_s::ARMING_STATE_ARMED || status.arming_state == vehicle_status_s::ARMING_STATE_ARMED_ERROR) && (status.main_state == vehicle_status_s::MAIN_STATE_MANUAL || status.main_state == vehicle_status_s::MAIN_STATE_ACRO || @@ -1929,7 +1929,7 @@ int commander_thread_main(int argc, char *argv[]) } /* check if left stick is in lower right position and we're in MANUAL mode -> arm */ - if (sp_man.r > STICK_ON_OFF_LIMIT && sp_man.z < 0.1f) { + if (sp_man.r > STICK_ON_OFF_LIMIT && sp_man.z < 0.1f && status.rc_input_mode != vehicle_status_s::RC_IN_MODE_OFF ) { if (stick_on_counter > STICK_ON_OFF_COUNTER_LIMIT) { /* we check outside of the transition function here because the requirement From a33568cd494ae5b52aaa27d74a9bd2d64f4cd7c1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 9 Oct 2015 10:42:31 +0200 Subject: [PATCH 329/389] MAVLink: Fix initial broadcast mode. This helps to find the GCS --- src/modules/mavlink/mavlink_main.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index e2c69d0084..7fba62f3fd 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -896,7 +896,11 @@ Mavlink::send_message(const uint8_t msgid, const void *msg, uint8_t component_ID (tstatus.heartbeat_time == 0)) && msgid == MAVLINK_MSG_ID_HEARTBEAT) { - (void)sendto(_socket_fd, buf, packet_len, 0, (struct sockaddr *)&_bcast_addr, sizeof(_bcast_addr)); + int bret = sendto(_socket_fd, buf, packet_len, 0, (struct sockaddr *)&_bcast_addr, sizeof(_bcast_addr)); + + if (bret) { + PX4_WARN("sending broadcast failed"); + } } } else if (get_protocol() == TCP) { @@ -974,7 +978,7 @@ void Mavlink::init_udp() { #if defined (__PX4_LINUX) || defined (__PX4_DARWIN) - PX4_INFO("Setting up UDP w/port %d\n",_network_port); + PX4_INFO("Setting up UDP w/port %d",_network_port); memset((char *)&_myaddr, 0, sizeof(_myaddr)); _myaddr.sin_family = AF_INET; @@ -982,12 +986,18 @@ Mavlink::init_udp() _myaddr.sin_port = htons(_network_port); if ((_socket_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - PX4_WARN("create socket failed\n"); + PX4_WARN("create socket failed"); + return; + } + + int broadcast_opt = 1; + if (setsockopt(_socket_fd, SOL_SOCKET, SO_BROADCAST, &broadcast_opt, sizeof(broadcast_opt)) < 0) { + PX4_WARN("setting broadcast permission failed"); return; } if (bind(_socket_fd, (struct sockaddr *)&_myaddr, sizeof(_myaddr)) < 0) { - PX4_WARN("bind failed\n"); + PX4_WARN("bind failed"); return; } From c28ae649a33ab02fae96ba2a6fec0b5e686deae6 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Sat, 10 Oct 2015 01:15:22 -0700 Subject: [PATCH 330/389] Fixes for parameters.xml dependencies Moved definitions of parameters into *params.c in each module. This is used by the cmake file as a pattern for dependencies when generating the parameters.xml file. Signed-off-by: Mark Charlebois --- CMakeLists.txt | 2 +- cmake/common/px4_base.cmake | 4 +- cmake/qurt/px4_impl_qurt.cmake | 2 +- cmake/qurt/qurt_funcs.cmake | 2 - src/modules/mavlink/CMakeLists.txt | 1 + src/modules/mavlink/mavlink.c | 69 ------------- src/modules/mavlink/mavlink_params.c | 104 ++++++++++++++++++++ src/modules/muorb/adsp/px4muorb.cpp | 23 ++--- src/modules/sdlog2/CMakeLists.txt | 1 + src/modules/sdlog2/params.c | 77 +++++++++++++++ src/modules/sdlog2/sdlog2.c | 43 -------- src/platforms/qurt/px4_layer/CMakeLists.txt | 1 + src/platforms/qurt/px4_layer/main.cpp | 21 ++-- src/platforms/qurt/px4_layer/params.c | 43 ++++++++ src/platforms/qurt/px4_layer/qurt_stubs.c | 95 ++++++++---------- src/platforms/qurt/stubs/stubs_qurt.c | 2 + 16 files changed, 286 insertions(+), 204 deletions(-) create mode 100644 src/modules/mavlink/mavlink_params.c create mode 100644 src/modules/sdlog2/params.c create mode 100644 src/platforms/qurt/px4_layer/params.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 51927e1755..b6faa2448b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,7 +274,7 @@ px4_generate_messages(TARGET msg_gen px4_generate_parameters_xml(OUT parameters.xml BOARD ${BOARD}) px4_generate_airframes_xml(OUT airframes.xml BOARD ${BOARD}) add_custom_target(xml_gen - DEPENDS parameters.xml airframes.xml) + DEPENDS git_eigen parameters.xml airframes.xml) #============================================================================= # external projects diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 51ff486868..257254ba43 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -731,7 +731,9 @@ function(px4_generate_parameters_xml) REQUIRED OUT BOARD ARGN ${ARGN}) set(path ${CMAKE_SOURCE_DIR}/src) - file(GLOB_RECURSE param_src_files ${path}/*.h* ${path}/*.c*) + file(GLOB_RECURSE param_src_files + ${CMAKE_SOURCE_DIR}/src/*params.c + ) add_custom_command(OUTPUT ${OUT} COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py -s ${path} --board CONFIG_ARCH_${BOARD} --xml diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index 6c8a6340b1..49bd83f53b 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -229,7 +229,7 @@ function(px4_os_prebuild_targets) COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/cmake/qurt/qurt_eigen.patch DEPENDS git_eigen) add_custom_target(${OUT} DEPENDS git_dspal git_eigen_patched) - add_custom_target(ALL DEPENDS git_eigen) + add_custom_target(ALL DEPENDS git_eigen_patched) endfunction() diff --git a/cmake/qurt/qurt_funcs.cmake b/cmake/qurt/qurt_funcs.cmake index 7ecd0cc818..4690799b2b 100644 --- a/cmake/qurt/qurt_funcs.cmake +++ b/cmake/qurt/qurt_funcs.cmake @@ -46,5 +46,3 @@ # The macros are called from the top level CMakeLists.txt # px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") -px4_add_git_submodule(TARGET git_eigen32 PATH "src/lib/eigen-3.2") - diff --git a/src/modules/mavlink/CMakeLists.txt b/src/modules/mavlink/CMakeLists.txt index c8a0e7d870..a863328f03 100644 --- a/src/modules/mavlink/CMakeLists.txt +++ b/src/modules/mavlink/CMakeLists.txt @@ -56,6 +56,7 @@ px4_add_module( mavlink_rate_limiter.cpp mavlink_receiver.cpp mavlink_ftp.cpp + mavlink_params.c DEPENDS platforms__common ) diff --git a/src/modules/mavlink/mavlink.c b/src/modules/mavlink/mavlink.c index 0c2d56173a..1073d09c20 100644 --- a/src/modules/mavlink/mavlink.c +++ b/src/modules/mavlink/mavlink.c @@ -46,75 +46,6 @@ #include "mavlink_bridge_header.h" #include -/** - * MAVLink system ID - * @group MAVLink - * @min 1 - * @max 250 - */ -PARAM_DEFINE_INT32(MAV_SYS_ID, 1); - -/** - * MAVLink component ID - * @group MAVLink - * @min 1 - * @max 250 - */ -PARAM_DEFINE_INT32(MAV_COMP_ID, 1); - -/** - * MAVLink Radio ID - * - * When non-zero the MAVLink app will attempt to configure the - * radio to this ID and re-set the parameter to 0. If the value - * is negative it will reset the complete radio config to - * factory defaults. - * - * @group MAVLink - * @min -1 - * @max 240 - */ -PARAM_DEFINE_INT32(MAV_RADIO_ID, 0); - -/** - * MAVLink airframe type - * - * @min 1 - * @group MAVLink - */ -PARAM_DEFINE_INT32(MAV_TYPE, 1); - -/** - * Use/Accept HIL GPS message even if not in HIL mode - * - * If set to 1 incoming HIL GPS messages are parsed. - * - * @group MAVLink - */ -PARAM_DEFINE_INT32(MAV_USEHILGPS, 0); - -/** - * Forward external setpoint messages - * - * If set to 1 incoming external setpoint messages will be directly forwarded - * to the controllers if in offboard control mode - * - * @group MAVLink - */ -PARAM_DEFINE_INT32(MAV_FWDEXTSP, 1); - -/** - * Test parameter - * - * This parameter is not actively used by the system. Its purpose is to allow - * testing the parameter interface on the communication level. - * - * @group MAVLink - * @min -1000 - * @max 1000 - */ -PARAM_DEFINE_INT32(MAV_TEST_PAR, 1); - mavlink_system_t mavlink_system = { 100, 50 diff --git a/src/modules/mavlink/mavlink_params.c b/src/modules/mavlink/mavlink_params.c new file mode 100644 index 0000000000..4edaa7b582 --- /dev/null +++ b/src/modules/mavlink/mavlink_params.c @@ -0,0 +1,104 @@ +/**************************************************************************** + * + * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#include + +/** + * MAVLink system ID + * @group MAVLink + * @min 1 + * @max 250 + */ +PARAM_DEFINE_INT32(MAV_SYS_ID, 1); + +/** + * MAVLink component ID + * @group MAVLink + * @min 1 + * @max 250 + */ +PARAM_DEFINE_INT32(MAV_COMP_ID, 1); + +/** + * MAVLink Radio ID + * + * When non-zero the MAVLink app will attempt to configure the + * radio to this ID and re-set the parameter to 0. If the value + * is negative it will reset the complete radio config to + * factory defaults. + * + * @group MAVLink + * @min -1 + * @max 240 + */ +PARAM_DEFINE_INT32(MAV_RADIO_ID, 0); + +/** + * MAVLink airframe type + * + * @min 1 + * @group MAVLink + */ +PARAM_DEFINE_INT32(MAV_TYPE, 1); + +/** + * Use/Accept HIL GPS message even if not in HIL mode + * + * If set to 1 incoming HIL GPS messages are parsed. + * + * @group MAVLink + */ +PARAM_DEFINE_INT32(MAV_USEHILGPS, 0); + +/** + * Forward external setpoint messages + * + * If set to 1 incoming external setpoint messages will be directly forwarded + * to the controllers if in offboard control mode + * + * @group MAVLink + */ +PARAM_DEFINE_INT32(MAV_FWDEXTSP, 1); + +/** + * Test parameter + * + * This parameter is not actively used by the system. Its purpose is to allow + * testing the parameter interface on the communication level. + * + * @group MAVLink + * @min -1000 + * @max 1000 + */ +PARAM_DEFINE_INT32(MAV_TEST_PAR, 1); + diff --git a/src/modules/muorb/adsp/px4muorb.cpp b/src/modules/muorb/adsp/px4muorb.cpp index 53318f8e49..df951eb967 100644 --- a/src/modules/muorb/adsp/px4muorb.cpp +++ b/src/modules/muorb/adsp/px4muorb.cpp @@ -31,38 +31,30 @@ * ****************************************************************************/ #include "px4muorb.hpp" -//#include "qurt.h" #include "uORBFastRpcChannel.hpp" #include "uORBManager.hpp" #include #include #include -#include -#include +#include #include "px4_log.h" #include "uORB/topics/sensor_combined.h" #include "uORB.h" -#define _ENABLE_MUORB 1 - -extern "C" { -int dspal_main(int argc, const char *argv[]); -void HAP_power_request(int a, int b, int c); -}; - +__BEGIN_DECLS +extern int dspal_main(int argc, char *argv[]); +__END_DECLS int px4muorb_orb_initialize() { - int rc = 0; - PX4_WARN("Before calling dspal_entry() method..."); HAP_power_request(100, 100, 1000); // register the fastrpc muorb with uORBManager. uORB::Manager::get_instance()->set_uorb_communicator(uORB::FastRpcChannel::GetInstance()); - const char *argv[2] = { "dspal", "start" }; + const char *argv[] = { "dspal", "start" }; int argc = 2; - dspal_main(argc, argv); - PX4_WARN("After calling dspal_entry"); + int rc; + rc = dspal_main(argc, (char **)argv); return rc; } @@ -102,7 +94,6 @@ int px4muorb_remove_subscriber(const char *name) } return rc; - } int px4muorb_send_topic_data(const char *name, const uint8_t *data, int data_len_in_bytes) diff --git a/src/modules/sdlog2/CMakeLists.txt b/src/modules/sdlog2/CMakeLists.txt index b438f30fd5..1e33df2a86 100644 --- a/src/modules/sdlog2/CMakeLists.txt +++ b/src/modules/sdlog2/CMakeLists.txt @@ -44,6 +44,7 @@ px4_add_module( SRCS sdlog2.c logbuffer.c + params.c DEPENDS platforms__common ) diff --git a/src/modules/sdlog2/params.c b/src/modules/sdlog2/params.c new file mode 100644 index 0000000000..77575e2ad3 --- /dev/null +++ b/src/modules/sdlog2/params.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * + * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#include + +/** + * Logging rate. + * + * A value of -1 indicates the commandline argument + * should be obeyed. A value of 0 sets the minimum rate, + * any other value is interpreted as rate in Hertz. This + * parameter is only read out before logging starts (which + * commonly is before arming). + * + * @min -1 + * @max 1 + * @group SD Logging + */ +PARAM_DEFINE_INT32(SDLOG_RATE, -1); + +/** + * Enable extended logging mode. + * + * A value of -1 indicates the commandline argument + * should be obeyed. A value of 0 disables extended + * logging mode, a value of 1 enables it. This + * parameter is only read out before logging starts + * (which commonly is before arming). + * + * @min -1 + * @max 1 + * @group SD Logging + */ +PARAM_DEFINE_INT32(SDLOG_EXT, -1); + +/** + * Use timestamps only if GPS 3D fix is available + * + * A value of 1 constrains the log folder creation + * to only use the time stamp if a 3D GPS lock is + * present. + * + * @min 0 + * @max 1 + * @group SD Logging + */ +PARAM_DEFINE_INT32(SDLOG_GPSTIME, 1); diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index efb33c3da7..94719380f1 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -124,49 +124,6 @@ #define PX4_EPOCH_SECS 1234567890L -/** - * Logging rate. - * - * A value of -1 indicates the commandline argument - * should be obeyed. A value of 0 sets the minimum rate, - * any other value is interpreted as rate in Hertz. This - * parameter is only read out before logging starts (which - * commonly is before arming). - * - * @min -1 - * @max 1 - * @group SD Logging - */ -PARAM_DEFINE_INT32(SDLOG_RATE, -1); - -/** - * Enable extended logging mode. - * - * A value of -1 indicates the commandline argument - * should be obeyed. A value of 0 disables extended - * logging mode, a value of 1 enables it. This - * parameter is only read out before logging starts - * (which commonly is before arming). - * - * @min -1 - * @max 1 - * @group SD Logging - */ -PARAM_DEFINE_INT32(SDLOG_EXT, -1); - -/** - * Use timestamps only if GPS 3D fix is available - * - * A value of 1 constrains the log folder creation - * to only use the time stamp if a 3D GPS lock is - * present. - * - * @min 0 - * @max 1 - * @group SD Logging - */ -PARAM_DEFINE_INT32(SDLOG_GPSTIME, 1); - #define LOGBUFFER_WRITE_AND_COUNT(_msg) if (logbuffer_write(&lb, &log_msg, LOG_PACKET_SIZE(_msg))) { \ log_msgs_written++; \ } else { \ diff --git a/src/platforms/qurt/px4_layer/CMakeLists.txt b/src/platforms/qurt/px4_layer/CMakeLists.txt index c9720b7e8e..dcd217c05c 100644 --- a/src/platforms/qurt/px4_layer/CMakeLists.txt +++ b/src/platforms/qurt/px4_layer/CMakeLists.txt @@ -38,6 +38,7 @@ set(QURT_LAYER_SRCS drv_hrt.c qurt_stubs.c main.cpp + params.c ) if ("${QURT_ENABLE_STUBS}" STREQUAL "1") list(APPEND QURT_LAYER_SRCS diff --git a/src/platforms/qurt/px4_layer/main.cpp b/src/platforms/qurt/px4_layer/main.cpp index ba2374dcfd..15907ded78 100644 --- a/src/platforms/qurt/px4_layer/main.cpp +++ b/src/platforms/qurt/px4_layer/main.cpp @@ -1,6 +1,5 @@ /**************************************************************************** - * - * Copyright (C) 2015 Mark Charlebois. All rights reserved. + * Copyright (C) 2015 Mark Charlebois. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -42,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -100,15 +100,6 @@ static void process_commands(map &apps, const char *cmds) bool found_first_char = false; char arg[256]; - // This is added because it is a parameter used by commander, yet created by mavlink. Since mavlink is not - // running on QURT, we need to manually define it so it is available to commander. "2" is for quadrotor. - - // Following is hack to prevent duplicate parameter definition error in param parser - /** - * @board QuRT_App - */ - PARAM_DEFINE_INT32(MAV_TYPE,2); - // Eat leading whitespace eat_whitespace(b, i); @@ -152,7 +143,7 @@ extern void init_once(void); }; __BEGIN_DECLS -extern int dspal_main(int argc, char *argv[]); +int dspal_main(int argc, char *argv[]); __END_DECLS @@ -164,13 +155,13 @@ int dspal_entry( int argc, char* argv[] ) px4::init_once(); px4::init(argc, (char **)argv, "mainapp"); process_commands(apps, get_commands()); - usleep( 1000000 ); // give time for all commands to execute before starting external function + sleep(1); // give time for all commands to execute before starting external function if(qurt_external_hook) { qurt_external_hook(); } - for( ;; ){ - usleep( 1000000 ); + for(;;){ + sleep(1); } return 0; } diff --git a/src/platforms/qurt/px4_layer/params.c b/src/platforms/qurt/px4_layer/params.c new file mode 100644 index 0000000000..3ad35a6a12 --- /dev/null +++ b/src/platforms/qurt/px4_layer/params.c @@ -0,0 +1,43 @@ +/**************************************************************************** + * Copyright (C) 2015 Mark Charlebois. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#include + +// This is added because it is a parameter used by commander, yet created by mavlink. Since mavlink is not +// running on QURT, we need to manually define it so it is available to commander. "2" is for quadrotor. + +// Following is hack to prevent duplicate parameter definition error in param parser +/** + * @board QuRT_App + */ +PARAM_DEFINE_INT32(MAV_TYPE,2); + diff --git a/src/platforms/qurt/px4_layer/qurt_stubs.c b/src/platforms/qurt/px4_layer/qurt_stubs.c index 9764710fa0..1ec8f2e71f 100644 --- a/src/platforms/qurt/px4_layer/qurt_stubs.c +++ b/src/platforms/qurt/px4_layer/qurt_stubs.c @@ -31,107 +31,90 @@ * ****************************************************************************/ #include "px4_log.h" -//extern "C" { -void block_indefinite( void ); -void _Read_uleb( void ); -void _Parse_fde_instr( void ); -void _Parse_csd( void ); -void _Valbytes( void ); -void _Get_eh_data( void ); -void _Parse_lsda( void ); -void __cxa_guard_release( void ); -void _Read_enc_ptr( void ); -void _Read_sleb( void ); -void __cxa_guard_acquire( void ); -void __cxa_pure_virtual( void ); +#include + +void block_indefinite(void); +void _Read_uleb(void); +void _Parse_fde_instr(void); +void _Parse_csd(void); +void _Valbytes(void); +void _Get_eh_data(void); +void _Parse_lsda(void); +void __cxa_guard_release(void); +void _Read_enc_ptr(void); +void _Read_sleb(void); +void __cxa_guard_acquire(void); +void __cxa_pure_virtual(void); void block_indefinite( void ) { - for(;;) - { - volatile int x = 0; - ++x; - } + sem_t forever; + sem_init(&forever, 0, 0); + sem_wait(&forever); } void _Read_uleb( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void _Parse_fde_instr( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void _Parse_csd( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } -#if 0 -void _Locksyslock( int x ) -{ - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); -} - -void _Unlocksyslock( int x ) -{ - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); -} -#endif - void _Valbytes( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void _Get_eh_data( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void _Parse_lsda( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void __cxa_guard_release( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void _Read_enc_ptr( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void _Read_sleb( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void __cxa_guard_acquire( void ) { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } void __cxa_pure_virtual() { - PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); - block_indefinite(); + PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ ); + block_indefinite(); } - -//} diff --git a/src/platforms/qurt/stubs/stubs_qurt.c b/src/platforms/qurt/stubs/stubs_qurt.c index 0fb8ac71bf..f114791c4d 100644 --- a/src/platforms/qurt/stubs/stubs_qurt.c +++ b/src/platforms/qurt/stubs/stubs_qurt.c @@ -1,4 +1,6 @@ +#include #include +#include void HAP_debug(const char *msg, int level, const char *filename, int line) { From bc2ea895ea557a49845cbc526666bfed06bd134b Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Sat, 10 Oct 2015 01:22:35 -0700 Subject: [PATCH 331/389] renamed test_param.c test_params.c Changed name to match search pattern *params.h Signed-off-by: Mark Charlebois --- src/systemcmds/tests/CMakeLists.txt | 2 +- src/systemcmds/tests/{test_param.c => test_params.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/systemcmds/tests/{test_param.c => test_params.c} (100%) diff --git a/src/systemcmds/tests/CMakeLists.txt b/src/systemcmds/tests/CMakeLists.txt index 41af1c0417..25cad8505c 100644 --- a/src/systemcmds/tests/CMakeLists.txt +++ b/src/systemcmds/tests/CMakeLists.txt @@ -53,7 +53,7 @@ set(srcs test_file.c test_file2.c tests_main.c - test_param.c + test_params.c test_ppm_loopback.c test_rc.c test_conv.cpp diff --git a/src/systemcmds/tests/test_param.c b/src/systemcmds/tests/test_params.c similarity index 100% rename from src/systemcmds/tests/test_param.c rename to src/systemcmds/tests/test_params.c From 3af75438fd317179f68fd9517a312b94748071b1 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Sat, 10 Oct 2015 01:47:17 -0700 Subject: [PATCH 332/389] Create external/Install/{lib|include} These files are expected to exist for current cmake rules and cmake will warn if they do not exist. Signed-off-by: Mark Charlebois --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6faa2448b..948959ca32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -286,6 +286,9 @@ set_property(DIRECTORY PROPERTY EP_BASE ${ep_base}) # add external project install folders to build link_directories(${ep_base}/Install/lib) include_directories(${ep_base}/Install/include) +# add the directories so cmake won't warn +execute_process(COMMAND cmake -E make_directory ${ep_base}/Install/lib) +execute_process(COMMAND cmake -E make_directory ${ep_base}/Install/include) #============================================================================= # subdirectories From 2bbb1ad35fae4f698adb0eaf9b5861802ffc8035 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Tue, 6 Oct 2015 21:48:13 +0200 Subject: [PATCH 333/389] python3 fixes --- Tools/px_generate_params.py | 4 ++-- Tools/px_romfs_pruner.py | 2 +- cmake/nuttx/bin_to_obj.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tools/px_generate_params.py b/Tools/px_generate_params.py index 0efe778683..3df124f523 100755 --- a/Tools/px_generate_params.py +++ b/Tools/px_generate_params.py @@ -3,8 +3,8 @@ import xml.etree.ElementTree as ET import os if len(os.sys.argv) != 2: - print "Error in %s" % os.sys.argv[0] - print "Usage: %s " + print("Error in %s" % os.sys.argv[0]) + print("Usage: %s " % os.sys.argv[0]) raise SystemExit fp_header = open("px4_parameters.h", "w") diff --git a/Tools/px_romfs_pruner.py b/Tools/px_romfs_pruner.py index 78e4e69f72..85ff678b93 100644 --- a/Tools/px_romfs_pruner.py +++ b/Tools/px_romfs_pruner.py @@ -77,7 +77,7 @@ def main(): # overwrite old scratch file with open(file_path, "wb") as f: - f.write(pruned_content) + f.write(pruned_content.encode("ascii", errors='strict')) if __name__ == '__main__': diff --git a/cmake/nuttx/bin_to_obj.py b/cmake/nuttx/bin_to_obj.py index a4ad3d94df..64ba864295 100755 --- a/cmake/nuttx/bin_to_obj.py +++ b/cmake/nuttx/bin_to_obj.py @@ -41,7 +41,7 @@ def run_cmd(cmd, d): #print(cmd) proc = subprocess.Popen(cmd.split(), stdout=PIPE, stderr=PIPE) stdout, stderr = proc.communicate() - if stderr != "": + if stderr.decode() != "": raise RuntimeError(stderr) return stdout @@ -57,7 +57,7 @@ run_cmd("{ld:s} -r -o {obj:s}.bin.o {obj:s}.c.o -b binary {in_bin:s}", stdout = run_cmd("{nm:s} -p --radix=x {obj:s}.bin.o", locals()) re_string = r"^([0-9A-F-a-f]+) .*{sym:s}_size\n".format(**locals()) re_size = re.compile(re_string, re.MULTILINE) -size_match = re.search(re_size, stdout) +size_match = re.search(re_size, stdout.decode()) try: size = size_match.group(1) except AttributeError as e: From 1ea5dd58517d490fe5873eeb62bf9ba9cd65aefe Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 01:14:42 +0200 Subject: [PATCH 334/389] Do not complain about not yet ready for standby state. Fixes #2963 --- src/modules/commander/commander.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index db5f95d511..e86b7cfb9c 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1759,6 +1759,9 @@ int commander_thread_main(int argc, char *argv[]) if (arming_ret == TRANSITION_CHANGED) { arming_state_changed = true; + } else if (arming_ret == TRANSITION_DENIED) { + /* do not complain if not allowed into standby */ + arming_ret = TRANSITION_NOT_CHANGED; } } From f6f6b035d6d01e8423569020fcb9ea68658dc5a0 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Sat, 10 Oct 2015 02:19:59 -0700 Subject: [PATCH 335/389] Fixed cmake else statements Removed use of if(foo) else(foo) endif(foo) convention of cmake Signed-off-by: Mark Charlebois --- src/firmware/qurt/CMakeLists.txt | 2 +- src/platforms/qurt/px4_layer/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index 3dc12c57f6..b6d743186f 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -14,7 +14,7 @@ if ("${QURT_ENABLE_STUBS}" STREQUAL "1") add_executable(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c ${CMAKE_BINARY_DIR}/apps.h) -else("${QURT_ENABLE_STUBS}" STREQUAL "1") +else() add_library(mainapp ${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c ${CMAKE_BINARY_DIR}/apps.h) diff --git a/src/platforms/qurt/px4_layer/CMakeLists.txt b/src/platforms/qurt/px4_layer/CMakeLists.txt index dcd217c05c..b1b99b63f2 100644 --- a/src/platforms/qurt/px4_layer/CMakeLists.txt +++ b/src/platforms/qurt/px4_layer/CMakeLists.txt @@ -54,7 +54,7 @@ if ("${BOARD}" STREQUAL "eagle") # The CI test target can use the hil commands if ("${LABEL}" STREQUAL "travis") set(CONFIG_SRC commands_hil.c) - else("${LABEL}" STREQUAL "travis") + else() set(CONFIG_SRC commands_${LABEL}.c) endif() From acd7235880e43898513264c4b1caac48900a0cf9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 12:27:45 +0200 Subject: [PATCH 336/389] FMUv2: Add topic listener --- Tools/generate_listener.py | 21 ++++++++++++-------- cmake/configs/nuttx_px4fmu-v2_default.cmake | 1 + src/systemcmds/topic_listener/CMakeLists.txt | 4 +++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Tools/generate_listener.py b/Tools/generate_listener.py index 1b55528372..7849905a94 100755 --- a/Tools/generate_listener.py +++ b/Tools/generate_listener.py @@ -89,24 +89,28 @@ print(""" ****************************************************************************/ /** - * @file topic_listener.cpp, autogenerated by Tools/generate_listener.py + * @file topic_listener.cpp + * + * Autogenerated by Tools/generate_listener.py * * Tool for listening to topics when running flight stack on linux. */ + #include #include #include -#include -#include -#include -#include -#include -#include #include #include #include +#include +#include #define __STDC_FORMAT_MACROS #include + +#ifndef PRIu64 +#define PRIu64 "ull" +#endif + """) for m in messages: print("#include " % m) @@ -123,7 +127,7 @@ int listener_main(int argc, char *argv[]) { return 1; } """) -print("\tuint32_t num_msgs = (uint32_t)std::stoi(argv[2],NULL,10);") +print("\tunsigned num_msgs = atoi(argv[2]);") print("\tif(strncmp(argv[1],\"%s\",50)== 0) {" % messages[0]) print("\t\tsub = orb_subscribe(ORB_ID(%s));" % messages[0]) print("\t\tID = ORB_ID(%s);" % messages[0]) @@ -140,6 +144,7 @@ for index,m in enumerate(messages[1:]): print("\t\t\torb_check(sub,&updated);") print("\t\t\tupdated = true;") print("\t\t\tif(updated) {") + print("\t\tprintf(\"\\nTOPIC: %s\");" % m) print("\t\t\torb_copy(ID,sub,&container);") for item in message_elements[index+1]: if item[0] == "float": diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index fec5f06370..8788bbeb51 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -53,6 +53,7 @@ set(config_module_list systemcmds/pwm systemcmds/esc_calib systemcmds/reboot + systemcmds/topic_listener systemcmds/top systemcmds/config systemcmds/nshterm diff --git a/src/systemcmds/topic_listener/CMakeLists.txt b/src/systemcmds/topic_listener/CMakeLists.txt index 2f720757ac..eb3071f41b 100644 --- a/src/systemcmds/topic_listener/CMakeLists.txt +++ b/src/systemcmds/topic_listener/CMakeLists.txt @@ -36,7 +36,9 @@ add_custom_command(OUTPUT topic_listener.cpp ) add_custom_target(generate_topic_listener - DEPENDS topic_listener.cpp) + DEPENDS + topic_listener.cpp + ${CMAKE_SOURCE_DIR}/Tools/generate_listener.py) px4_add_module( MODULE systemcmds__topic_listener From 348c480feb5c606cd79923d461760e858b2e456b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 12:39:05 +0200 Subject: [PATCH 337/389] Improve formatting of topic listener output --- Tools/generate_listener.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Tools/generate_listener.py b/Tools/generate_listener.py index 7849905a94..1ebb316baf 100755 --- a/Tools/generate_listener.py +++ b/Tools/generate_listener.py @@ -108,7 +108,7 @@ print(""" #include #ifndef PRIu64 -#define PRIu64 "ull" +#define PRIu64 "llu" #endif """) @@ -128,51 +128,51 @@ int listener_main(int argc, char *argv[]) { } """) print("\tunsigned num_msgs = atoi(argv[2]);") -print("\tif(strncmp(argv[1],\"%s\",50)== 0) {" % messages[0]) +print("\tif (strncmp(argv[1],\"%s\",50) == 0) {" % messages[0]) print("\t\tsub = orb_subscribe(ORB_ID(%s));" % messages[0]) print("\t\tID = ORB_ID(%s);" % messages[0]) print("\t\tstruct %s_s container;" % messages[0]) print("\t\tmemset(&container, 0, sizeof(container));") for index,m in enumerate(messages[1:]): - print("\t} else if(strncmp(argv[1],\"%s\",50) == 0) {" % m) + print("\t} else if (strncmp(argv[1],\"%s\",50) == 0) {" % m) print("\t\tsub = orb_subscribe(ORB_ID(%s));" % m) print("\t\tID = ORB_ID(%s);" % m) print("\t\tstruct %s_s container;" % m) print("\t\tmemset(&container, 0, sizeof(container));") print("\t\tbool updated;") - print("\t\tfor(uint32_t i = 0;i Date: Sat, 10 Oct 2015 16:02:29 +0200 Subject: [PATCH 338/389] Dataman: Lower scheduling priority --- src/modules/dataman/dataman.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/dataman/dataman.c b/src/modules/dataman/dataman.c index 817b65dce3..aaa10b3318 100644 --- a/src/modules/dataman/dataman.c +++ b/src/modules/dataman/dataman.c @@ -860,8 +860,8 @@ start(void) px4_sem_init(&g_init_sema, 1, 0); - /* start the worker thread */ - if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT, 1500, task_main, NULL)) <= 0) { + /* start the worker thread with low priority for disk IO */ + if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT - 10, 1500, task_main, NULL)) <= 0) { warn("task start failed"); return -1; } From f50695c099d6947e08eb05fbb450437a7da371b4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 13:58:09 +0200 Subject: [PATCH 339/389] Flow: Remove unused perf counters on exit --- src/drivers/px4flow/px4flow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/drivers/px4flow/px4flow.cpp b/src/drivers/px4flow/px4flow.cpp index db0f45ec1f..134ce6a52b 100644 --- a/src/drivers/px4flow/px4flow.cpp +++ b/src/drivers/px4flow/px4flow.cpp @@ -216,6 +216,10 @@ PX4FLOW::~PX4FLOW() if (_reports != nullptr) { delete _reports; } + + perf_free(_sample_perf); + perf_free(_comms_errors); + perf_free(_buffer_overflows); } int From e11a753e241a6ce2b7864d27ec44a89ed0767228 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 16:20:49 +0200 Subject: [PATCH 340/389] Land detector: Disable params in build --- src/modules/land_detector/CMakeLists.txt | 1 - src/modules/land_detector/land_detector_params.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/modules/land_detector/CMakeLists.txt b/src/modules/land_detector/CMakeLists.txt index f18b3ed187..3882f246c2 100644 --- a/src/modules/land_detector/CMakeLists.txt +++ b/src/modules/land_detector/CMakeLists.txt @@ -38,7 +38,6 @@ px4_add_module( -Os SRCS land_detector_main.cpp - land_detector_params.c LandDetector.cpp MulticopterLandDetector.cpp FixedwingLandDetector.cpp diff --git a/src/modules/land_detector/land_detector_params.c b/src/modules/land_detector/land_detector_params.c index 57e616169b..d9201eb18a 100644 --- a/src/modules/land_detector/land_detector_params.c +++ b/src/modules/land_detector/land_detector_params.c @@ -38,8 +38,6 @@ * @author Johan Jansen */ -#include - /** * Multicopter max climb rate * From cf4e256b8382d3b9e793ca4a0c91d41c40e0d600 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 16:20:59 +0200 Subject: [PATCH 341/389] Systemlib: Disable params in build --- src/modules/systemlib/CMakeLists.txt | 2 -- src/modules/systemlib/circuit_breaker_params.c | 2 -- src/modules/systemlib/system_params.c | 3 --- 3 files changed, 7 deletions(-) diff --git a/src/modules/systemlib/CMakeLists.txt b/src/modules/systemlib/CMakeLists.txt index 6f0f7c5f54..59485fe494 100644 --- a/src/modules/systemlib/CMakeLists.txt +++ b/src/modules/systemlib/CMakeLists.txt @@ -41,7 +41,6 @@ set(SRCS cpuload.c pid/pid.c airspeed.c - system_params.c mavlink_log.c rc_check.c otp.c @@ -50,7 +49,6 @@ set(SRCS mcu_version.c bson/tinybson.c circuit_breaker.cpp - circuit_breaker_params.c ) if(${OS} STREQUAL "nuttx") diff --git a/src/modules/systemlib/circuit_breaker_params.c b/src/modules/systemlib/circuit_breaker_params.c index 20b9638d6a..36b35246db 100644 --- a/src/modules/systemlib/circuit_breaker_params.c +++ b/src/modules/systemlib/circuit_breaker_params.c @@ -42,8 +42,6 @@ * parameter needs to set to the key (magic). */ -#include - /** * Circuit breaker for power supply check * diff --git a/src/modules/systemlib/system_params.c b/src/modules/systemlib/system_params.c index a1632e53c9..8170e17bd1 100644 --- a/src/modules/systemlib/system_params.c +++ b/src/modules/systemlib/system_params.c @@ -37,9 +37,6 @@ * System wide parameters */ -#include -#include - /** * Auto-start script index. * From 5b9a19aa65c3e27fe979181ea9817ec7347c4fbf Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 17:45:31 +0200 Subject: [PATCH 342/389] Remove rsync dependency --- cmake/nuttx/px4_impl_nuttx.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 13d120af26..f48bdc135c 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -213,7 +213,8 @@ function(px4_nuttx_add_export) # copy add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp COMMAND ${MKDIR} -p ${CMAKE_BINARY_DIR}/${CONFIG} - COMMAND rsync -a --exclude=.git ${CMAKE_SOURCE_DIR}/NuttX/ ${nuttx_src}/ + COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src} + COMMAND ${RM} -rf ${nuttx_src}/.git COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp DEPENDS ${DEPENDS}) add_custom_target(__nuttx_copy_${CONFIG} From 614ca1e588061f17c58423eb4e17292516012cc1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 22:16:43 +0200 Subject: [PATCH 343/389] EKF: Move to 1000 Hz sampling / 250 Hz prediction / 80 Hz updates @ 27% CPU load --- .../AttitudePositionEstimatorEKF.h | 3 +++ src/modules/ekf_att_pos_estimator/CMakeLists.txt | 1 - .../ekf_att_pos_estimator_main.cpp | 11 ++++++++++- .../ekf_att_pos_estimator_params.c | 6 +----- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/modules/ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h b/src/modules/ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h index e4d924396a..57df913069 100644 --- a/src/modules/ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h +++ b/src/modules/ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h @@ -133,6 +133,8 @@ public: */ int set_debuglevel(unsigned debug) { _debug = debug; return 0; } + static constexpr unsigned MAX_PREDICITION_STEPS = 3; /**< maximum number of prediction steps between updates */ + private: bool _task_should_exit; /**< if true, sensor task should exit */ bool _task_running; /**< if true, task is running in its mainloop */ @@ -174,6 +176,7 @@ private: hrt_abstime _last_accel; hrt_abstime _last_mag; + unsigned _prediction_steps; struct sensor_combined_s _sensor_combined; diff --git a/src/modules/ekf_att_pos_estimator/CMakeLists.txt b/src/modules/ekf_att_pos_estimator/CMakeLists.txt index 907bb31ff3..6f109def1f 100644 --- a/src/modules/ekf_att_pos_estimator/CMakeLists.txt +++ b/src/modules/ekf_att_pos_estimator/CMakeLists.txt @@ -42,7 +42,6 @@ px4_add_module( COMPILE_FLAGS ${MODULE_CFLAGS} SRCS ekf_att_pos_estimator_main.cpp - ekf_att_pos_estimator_params.c estimator_22states.cpp estimator_utilities.cpp DEPENDS diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp index 9f2d70d94b..295a597fcd 100644 --- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp +++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp @@ -156,6 +156,7 @@ AttitudePositionEstimatorEKF::AttitudePositionEstimatorEKF() : _last_accel(0), _last_mag(0), + _prediction_steps(0), _sensor_combined{}, @@ -995,6 +996,14 @@ void AttitudePositionEstimatorEKF::updateSensorFusion(const bool fuseGPS, const _ekf->summedDelVel = _ekf->summedDelVel + _ekf->dVelIMU; _covariancePredictionDt += _ekf->dtIMU; + // only fuse every few steps + if (_prediction_steps < MAX_PREDICITION_STEPS) { + _prediction_steps++; + return; + } else { + _prediction_steps = 0; + } + // perform a covariance prediction if the total delta angle has exceeded the limit // or the time limit will be exceeded at the next IMU update if ((_covariancePredictionDt >= (_ekf->covTimeStepMax - _ekf->dtIMU)) @@ -1111,7 +1120,7 @@ int AttitudePositionEstimatorEKF::start() _estimator_task = px4_task_spawn_cmd("ekf_att_pos_estimator", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 20, - 4800, + 4200, (px4_main_t)&AttitudePositionEstimatorEKF::task_main_trampoline, nullptr); diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_params.c b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_params.c index 0d33e28c91..45e2f24939 100644 --- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_params.c +++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_params.c @@ -36,13 +36,9 @@ * * Parameters defined by the attitude and position estimator task * - * @author Lorenz Meier + * @author Lorenz Meier */ -#include - -#include - /* * Estimator parameters, accessible via MAVLink * From d2fb49e5f37e1a35d0b48138af6ef8d8671ec574 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 13:58:48 +0200 Subject: [PATCH 344/389] UAVCAN: Give the firmware upgrade thread a human-readable name --- src/modules/uavcan/uavcan_servers.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/uavcan/uavcan_servers.cpp b/src/modules/uavcan/uavcan_servers.cpp index 824b5182e2..451c5bbd81 100644 --- a/src/modules/uavcan/uavcan_servers.cpp +++ b/src/modules/uavcan/uavcan_servers.cpp @@ -273,6 +273,8 @@ int UavcanServers::init() __attribute__((optimize("-O0"))) pthread_addr_t UavcanServers::run(pthread_addr_t) { + prctl(PR_SET_NAME, "uavcan fw srv", 0); + Lock lock(_subnode_mutex); while (1) { From 129a4c3b53ac9a0bb6c241787739cc9de815ee54 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 16:01:54 +0200 Subject: [PATCH 345/389] FMU: Run in work queue --- src/drivers/px4fmu/fmu.cpp | 428 ++++++++++++++++++------------------- 1 file changed, 214 insertions(+), 214 deletions(-) diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index a0628283c0..ef063824c1 100644 --- a/src/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp @@ -133,14 +133,14 @@ private: unsigned _pwm_alt_rate; uint32_t _pwm_alt_rate_channels; unsigned _current_update_rate; - int _task; + struct work_s _work; int _armed_sub; int _param_sub; orb_advert_t _outputs_pub; unsigned _num_outputs; int _class_instance; - volatile bool _task_should_exit; + volatile bool _initialized; bool _servo_armed; bool _pwm_on; @@ -166,8 +166,11 @@ private: static bool arm_nothrottle() { return (_armed.prearmed && !_armed.armed); } - static void task_main_trampoline(int argc, char *argv[]); - void task_main(); + static void cycle_trampoline(void *arg); + + void cycle(); + void work_start(); + void work_stop(); static int control_callback(uintptr_t handle, uint8_t control_group, @@ -261,13 +264,13 @@ PX4FMU::PX4FMU() : _pwm_alt_rate(50), _pwm_alt_rate_channels(0), _current_update_rate(0), - _task(-1), + _work{}, _armed_sub(-1), _param_sub(-1), _outputs_pub(nullptr), _num_outputs(0), _class_instance(0), - _task_should_exit(false), + _initialized(false), _servo_armed(false), _pwm_on(false), _mixers(nullptr), @@ -300,23 +303,18 @@ PX4FMU::PX4FMU() : PX4FMU::~PX4FMU() { - if (_task != -1) { + if (_initialized) { /* tell the task we want it to go away */ - _task_should_exit = true; + work_stop(); - unsigned i = 10; + int i = 10; do { /* wait 50ms - it should wake every 100ms or so worst-case */ usleep(50000); + i--; - /* if we have given up, kill it */ - if (--i == 0) { - task_delete(_task); - break; - } - - } while (_task != -1); + } while (_initialized && i > 0); } /* clean up the alternate device node */ @@ -330,7 +328,7 @@ PX4FMU::init() { int ret; - ASSERT(_task == -1); + ASSERT(!_initialized); /* do regular cdev init */ ret = CDev::init(); @@ -348,31 +346,11 @@ PX4FMU::init() warnx("FAILED registering class device"); } - /* reset GPIOs */ - gpio_reset(); - - /* start the IO interface task */ - _task = px4_task_spawn_cmd("fmuservo", - SCHED_DEFAULT, - SCHED_PRIORITY_DEFAULT, - 900, - (main_t)&PX4FMU::task_main_trampoline, - nullptr); - - if (_task < 0) { - DEVICE_DEBUG("task start failed: %d", errno); - return -errno; - } + work_start(); return OK; } -void -PX4FMU::task_main_trampoline(int argc, char *argv[]) -{ - g_fmu->task_main(); -} - int PX4FMU::set_mode(Mode mode) { @@ -600,222 +578,245 @@ PX4FMU::publish_pwm_outputs(uint16_t *values, size_t numvalues) void -PX4FMU::task_main() +PX4FMU::work_start() { - /* force a reset of the update rate */ - _current_update_rate = 0; + /* schedule a cycle to start things */ + work_queue(HPWORK, &_work, (worker_t)&PX4FMU::cycle_trampoline, this, 0); +} - _armed_sub = orb_subscribe(ORB_ID(actuator_armed)); - _param_sub = orb_subscribe(ORB_ID(parameter_update)); +void +PX4FMU::cycle_trampoline(void *arg) +{ + PX4FMU *dev = reinterpret_cast(arg); -#ifdef HRT_PPM_CHANNEL - // rc input, published to ORB - struct rc_input_values rc_in; - orb_advert_t to_input_rc = 0; + dev->cycle(); +} - memset(&rc_in, 0, sizeof(rc_in)); - rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_PPM; -#endif +void +PX4FMU::cycle() +{ + if (!_initialized) { + /* reset GPIOs */ + gpio_reset(); - /* initialize PWM limit lib */ - pwm_limit_init(&_pwm_limit); + /* force a reset of the update rate */ + _current_update_rate = 0; - update_pwm_rev_mask(); + _armed_sub = orb_subscribe(ORB_ID(actuator_armed)); + _param_sub = orb_subscribe(ORB_ID(parameter_update)); - /* loop until killed */ - while (!_task_should_exit) { - if (_groups_subscribed != _groups_required) { - subscribe(); - _groups_subscribed = _groups_required; - /* force setting update rate */ - _current_update_rate = 0; + #ifdef HRT_PPM_CHANNEL + // rc input, published to ORB + struct rc_input_values rc_in; + orb_advert_t to_input_rc = 0; + + memset(&rc_in, 0, sizeof(rc_in)); + rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_PPM; + #endif + + /* initialize PWM limit lib */ + pwm_limit_init(&_pwm_limit); + + update_pwm_rev_mask(); + + _initialized = true; + } + + + if (_groups_subscribed != _groups_required) { + subscribe(); + _groups_subscribed = _groups_required; + /* force setting update rate */ + _current_update_rate = 0; + } + + /* + * Adjust actuator topic update rate to keep up with + * the highest servo update rate configured. + * + * We always mix at max rate; some channels may update slower. + */ + unsigned max_rate = (_pwm_default_rate > _pwm_alt_rate) ? _pwm_default_rate : _pwm_alt_rate; + + if (_current_update_rate != max_rate) { + _current_update_rate = max_rate; + int update_rate_in_ms = int(1000 / _current_update_rate); + + /* reject faster than 500 Hz updates */ + if (update_rate_in_ms < 2) { + update_rate_in_ms = 2; } - /* - * Adjust actuator topic update rate to keep up with - * the highest servo update rate configured. - * - * We always mix at max rate; some channels may update slower. - */ - unsigned max_rate = (_pwm_default_rate > _pwm_alt_rate) ? _pwm_default_rate : _pwm_alt_rate; - - if (_current_update_rate != max_rate) { - _current_update_rate = max_rate; - int update_rate_in_ms = int(1000 / _current_update_rate); - - /* reject faster than 500 Hz updates */ - if (update_rate_in_ms < 2) { - update_rate_in_ms = 2; - } - - /* reject slower than 10 Hz updates */ - if (update_rate_in_ms > 100) { - update_rate_in_ms = 100; - } - - DEVICE_DEBUG("adjusted actuator update interval to %ums", update_rate_in_ms); - - for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) { - if (_control_subs[i] > 0) { - orb_set_interval(_control_subs[i], update_rate_in_ms); - } - } - - // set to current max rate, even if we are actually checking slower/faster - _current_update_rate = max_rate; + /* reject slower than 10 Hz updates */ + if (update_rate_in_ms > 100) { + update_rate_in_ms = 100; } - /* sleep waiting for data, stopping to check for PPM - * input at 50Hz */ - int ret = ::poll(_poll_fds, _poll_fds_num, CONTROL_INPUT_DROP_LIMIT_MS); + DEVICE_DEBUG("adjusted actuator update interval to %ums", update_rate_in_ms); - /* this would be bad... */ - if (ret < 0) { - DEVICE_LOG("poll error %d", errno); - continue; + for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) { + if (_control_subs[i] > 0) { + orb_set_interval(_control_subs[i], update_rate_in_ms); + } + } - } else if (ret == 0) { - /* timeout: no control data, switch to failsafe values */ + // set to current max rate, even if we are actually checking slower/faster + _current_update_rate = max_rate; + } + + /* check if anything updated */ + int ret = ::poll(_poll_fds, _poll_fds_num, 0); + + /* this would be bad... */ + if (ret < 0) { + DEVICE_LOG("poll error %d", errno); + + } else if (ret == 0) { + /* timeout: no control data, switch to failsafe values */ // warnx("no PWM: failsafe"); - } else { + } else { - /* get controls for required topics */ - unsigned poll_id = 0; + /* get controls for required topics */ + unsigned poll_id = 0; - for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) { - if (_control_subs[i] > 0) { - if (_poll_fds[poll_id].revents & POLLIN) { - orb_copy(_control_topics[i], _control_subs[i], &_controls[i]); - } - - poll_id++; - } - } - - /* can we mix? */ - if (_mixers != nullptr) { - - size_t num_outputs; - - switch (_mode) { - case MODE_2PWM: - num_outputs = 2; - break; - - case MODE_4PWM: - num_outputs = 4; - break; - - case MODE_6PWM: - num_outputs = 6; - break; - - case MODE_8PWM: - num_outputs = 8; - break; - - default: - num_outputs = 0; - break; + for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) { + if (_control_subs[i] > 0) { + if (_poll_fds[poll_id].revents & POLLIN) { + orb_copy(_control_topics[i], _control_subs[i], &_controls[i]); } - /* do mixing */ - float outputs[_max_actuators]; - num_outputs = _mixers->mix(outputs, num_outputs, NULL); - - /* disable unused ports by setting their output to NaN */ - for (size_t i = 0; i < sizeof(outputs) / sizeof(outputs[0]); i++) { - if (i >= num_outputs) { - outputs[i] = NAN_VALUE; - } - } - - uint16_t pwm_limited[_max_actuators]; - - /* the PWM limit call takes care of out of band errors, NaN and constrains */ - pwm_limit_calc(_servo_armed, arm_nothrottle(), num_outputs, _reverse_pwm_mask, _disarmed_pwm, _min_pwm, _max_pwm, - outputs, pwm_limited, &_pwm_limit); - - /* output to the servos */ - for (size_t i = 0; i < num_outputs; i++) { - up_pwm_servo_set(i, pwm_limited[i]); - } - - publish_pwm_outputs(pwm_limited, num_outputs); + poll_id++; } } - /* check arming state */ - bool updated = false; - orb_check(_armed_sub, &updated); + /* can we mix? */ + if (_mixers != nullptr) { - if (updated) { - orb_copy(ORB_ID(actuator_armed), _armed_sub, &_armed); + size_t num_outputs; - /* update the armed status and check that we're not locked down */ - bool set_armed = (_armed.armed || _armed.prearmed) && !_armed.lockdown; + switch (_mode) { + case MODE_2PWM: + num_outputs = 2; + break; - if (_servo_armed != set_armed) { - _servo_armed = set_armed; + case MODE_4PWM: + num_outputs = 4; + break; + + case MODE_6PWM: + num_outputs = 6; + break; + + case MODE_8PWM: + num_outputs = 8; + break; + + default: + num_outputs = 0; + break; } - /* update PWM status if armed or if disarmed PWM values are set */ - bool pwm_on = (set_armed || _num_disarmed_set > 0); + /* do mixing */ + float outputs[_max_actuators]; + num_outputs = _mixers->mix(outputs, num_outputs, NULL); - if (_pwm_on != pwm_on) { - _pwm_on = pwm_on; - up_pwm_servo_arm(pwm_on); + /* disable unused ports by setting their output to NaN */ + for (size_t i = 0; i < sizeof(outputs) / sizeof(outputs[0]); i++) { + if (i >= num_outputs) { + outputs[i] = NAN_VALUE; + } } + + uint16_t pwm_limited[_max_actuators]; + + /* the PWM limit call takes care of out of band errors, NaN and constrains */ + pwm_limit_calc(_servo_armed, arm_nothrottle(), num_outputs, _reverse_pwm_mask, _disarmed_pwm, _min_pwm, _max_pwm, + outputs, pwm_limited, &_pwm_limit); + + /* output to the servos */ + for (size_t i = 0; i < num_outputs; i++) { + up_pwm_servo_set(i, pwm_limited[i]); + } + + publish_pwm_outputs(pwm_limited, num_outputs); + } + } + + /* check arming state */ + bool updated = false; + orb_check(_armed_sub, &updated); + + if (updated) { + orb_copy(ORB_ID(actuator_armed), _armed_sub, &_armed); + + /* update the armed status and check that we're not locked down */ + bool set_armed = (_armed.armed || _armed.prearmed) && !_armed.lockdown; + + if (_servo_armed != set_armed) { + _servo_armed = set_armed; } - orb_check(_param_sub, &updated); + /* update PWM status if armed or if disarmed PWM values are set */ + bool pwm_on = (set_armed || _num_disarmed_set > 0); - if (updated) { - parameter_update_s pupdate; - orb_copy(ORB_ID(parameter_update), _param_sub, &pupdate); - - update_pwm_rev_mask(); + if (_pwm_on != pwm_on) { + _pwm_on = pwm_on; + up_pwm_servo_arm(pwm_on); } + } + + orb_check(_param_sub, &updated); + + if (updated) { + parameter_update_s pupdate; + orb_copy(ORB_ID(parameter_update), _param_sub, &pupdate); + + update_pwm_rev_mask(); + } #ifdef HRT_PPM_CHANNEL - // see if we have new PPM input data - if (ppm_last_valid_decode != rc_in.timestamp_last_signal) { - // we have a new PPM frame. Publish it. - rc_in.channel_count = ppm_decoded_channels; + // see if we have new PPM input data + if (ppm_last_valid_decode != rc_in.timestamp_last_signal) { + // we have a new PPM frame. Publish it. + rc_in.channel_count = ppm_decoded_channels; - if (rc_in.channel_count > input_rc_s::RC_INPUT_MAX_CHANNELS) { - rc_in.channel_count = input_rc_s::RC_INPUT_MAX_CHANNELS; - } - - for (uint8_t i = 0; i < rc_in.channel_count; i++) { - rc_in.values[i] = ppm_buffer[i]; - } - - rc_in.timestamp_publication = ppm_last_valid_decode; - rc_in.timestamp_last_signal = ppm_last_valid_decode; - - rc_in.rc_ppm_frame_length = ppm_frame_length; - rc_in.rssi = RC_INPUT_RSSI_MAX; - rc_in.rc_failsafe = false; - rc_in.rc_lost = false; - rc_in.rc_lost_frame_count = 0; - rc_in.rc_total_frame_count = 0; - - /* lazily advertise on first publication */ - if (to_input_rc == 0) { - to_input_rc = orb_advertise(ORB_ID(input_rc), &rc_in); - - } else { - orb_publish(ORB_ID(input_rc), to_input_rc, &rc_in); - } + if (rc_in.channel_count > input_rc_s::RC_INPUT_MAX_CHANNELS) { + rc_in.channel_count = input_rc_s::RC_INPUT_MAX_CHANNELS; } -#endif + for (uint8_t i = 0; i < rc_in.channel_count; i++) { + rc_in.values[i] = ppm_buffer[i]; + } + rc_in.timestamp_publication = ppm_last_valid_decode; + rc_in.timestamp_last_signal = ppm_last_valid_decode; + + rc_in.rc_ppm_frame_length = ppm_frame_length; + rc_in.rssi = RC_INPUT_RSSI_MAX; + rc_in.rc_failsafe = false; + rc_in.rc_lost = false; + rc_in.rc_lost_frame_count = 0; + rc_in.rc_total_frame_count = 0; + + /* lazily advertise on first publication */ + if (to_input_rc == 0) { + to_input_rc = orb_advertise(ORB_ID(input_rc), &rc_in); + + } else { + orb_publish(ORB_ID(input_rc), to_input_rc, &rc_in); + } } +#endif + work_queue(HPWORK, &_work, (worker_t)&PX4FMU::cycle_trampoline, this, USEC2TICK(CONTROL_INPUT_DROP_LIMIT_MS * 1000)); +} + +void PX4FMU::work_stop() +{ + work_cancel(HPWORK, &_work); + for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) { if (_control_subs[i] > 0) { ::close(_control_subs[i]); @@ -834,8 +835,7 @@ PX4FMU::task_main() /* note - someone else is responsible for restoring the GPIO config */ /* tell the dtor that we are exiting */ - _task = -1; - _exit(0); + _initialized = false; } int From 0318c1b330c0c282a5c4bce1ff654d352051457e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 16:02:05 +0200 Subject: [PATCH 346/389] Land detector: Run in work queue --- src/modules/land_detector/LandDetector.cpp | 74 +++++++++++-------- src/modules/land_detector/LandDetector.h | 10 ++- .../land_detector/land_detector_main.cpp | 32 ++------ 3 files changed, 56 insertions(+), 60 deletions(-) diff --git a/src/modules/land_detector/LandDetector.cpp b/src/modules/land_detector/LandDetector.cpp index 1de3c2f4a0..ae6a1b5037 100644 --- a/src/modules/land_detector/LandDetector.cpp +++ b/src/modules/land_detector/LandDetector.cpp @@ -50,59 +50,69 @@ LandDetector::LandDetector() : _landDetected({0, false}), _arming_time(0), _taskShouldExit(false), - _taskIsRunning(false) + _taskIsRunning(false), + _work{} { // ctor } LandDetector::~LandDetector() { + work_cancel(LPWORK, &_work); _taskShouldExit = true; } +int LandDetector::start() +{ + /* schedule a cycle to start things */ + work_queue(LPWORK, &_work, (worker_t)&LandDetector::cycle_trampoline, this, 0); + + return 0; +} + void LandDetector::shutdown() { _taskShouldExit = true; } -void LandDetector::start() +void +LandDetector::cycle_trampoline(void *arg) { - // make sure this method has not already been called by another thread - if (isRunning()) { - return; + LandDetector *dev = reinterpret_cast(arg); + + dev->cycle(); +} + +void LandDetector::cycle() +{ + if (!_taskIsRunning) { + // advertise the first land detected uORB + _landDetected.timestamp = hrt_absolute_time(); + _landDetected.landed = false; + _landDetectedPub = orb_advertise(ORB_ID(vehicle_land_detected), &_landDetected); + + // initialize land detection algorithm + initialize(); + + // task is now running, keep doing so until shutdown() has been called + _taskIsRunning = true; + _taskShouldExit = false; } - // advertise the first land detected uORB - _landDetected.timestamp = hrt_absolute_time(); - _landDetected.landed = false; - _landDetectedPub = (uintptr_t)orb_advertise(ORB_ID(vehicle_land_detected), &_landDetected); + bool landDetected = update(); - // initialize land detection algorithm - initialize(); + // publish if land detection state has changed + if (_landDetected.landed != landDetected) { + _landDetected.timestamp = hrt_absolute_time(); + _landDetected.landed = landDetected; - // task is now running, keep doing so until shutdown() has been called - _taskIsRunning = true; - _taskShouldExit = false; - - while (isRunning()) { - - bool landDetected = update(); - - // publish if land detection state has changed - if (_landDetected.landed != landDetected) { - _landDetected.timestamp = hrt_absolute_time(); - _landDetected.landed = landDetected; - - // publish the land detected broadcast - orb_publish(ORB_ID(vehicle_land_detected), (orb_advert_t)_landDetectedPub, &_landDetected); - } - - // limit loop rate - usleep(1000000 / LAND_DETECTOR_UPDATE_RATE); + // publish the land detected broadcast + orb_publish(ORB_ID(vehicle_land_detected), (orb_advert_t)_landDetectedPub, &_landDetected); } - _taskIsRunning = false; - _exit(0); + if (!_taskShouldExit) { + work_queue(LPWORK, &_work, (worker_t)&LandDetector::cycle_trampoline, this, USEC2TICK(1000000 / LAND_DETECTOR_UPDATE_RATE)); + } } bool LandDetector::orb_update(const struct orb_metadata *meta, int handle, void *buffer) diff --git a/src/modules/land_detector/LandDetector.h b/src/modules/land_detector/LandDetector.h index 2ade4ac8c0..d28863b499 100644 --- a/src/modules/land_detector/LandDetector.h +++ b/src/modules/land_detector/LandDetector.h @@ -41,6 +41,7 @@ #ifndef __LAND_DETECTOR_H__ #define __LAND_DETECTOR_H__ +#include #include #include @@ -70,7 +71,9 @@ public: * @brief Blocking function that should be called from it's own task thread. This method will * run the underlying algorithm at the desired update rate and publish if the landing state changes. **/ - void start(); + int start(); + + static void cycle_trampoline(void *arg); protected: @@ -99,13 +102,16 @@ protected: static constexpr uint64_t LAND_DETECTOR_ARM_PHASE_TIME = 1000000; /**< time interval in which wider acceptance thresholds are used after arming */ protected: - uintptr_t _landDetectedPub; /**< publisher for position in local frame */ + orb_advert_t _landDetectedPub; /**< publisher for position in local frame */ struct vehicle_land_detected_s _landDetected; /**< local vehicle position */ uint64_t _arming_time; /**< timestamp of arming time */ private: bool _taskShouldExit; /**< true if it is requested that this task should exit */ bool _taskIsRunning; /**< task has reached main loop and is currently running */ + struct work_s _work; + + void cycle(); }; #endif //__LAND_DETECTOR_H__ diff --git a/src/modules/land_detector/land_detector_main.cpp b/src/modules/land_detector/land_detector_main.cpp index 34355c6b11..c4d0e5194d 100644 --- a/src/modules/land_detector/land_detector_main.cpp +++ b/src/modules/land_detector/land_detector_main.cpp @@ -67,47 +67,32 @@ extern "C" __EXPORT int land_detector_main(int argc, char *argv[]); //Private variables static LandDetector *land_detector_task = nullptr; -static int _landDetectorTaskID = -1; static char _currentMode[12]; -/** -* Deamon thread function -**/ -static void land_detector_deamon_thread(int argc, char *argv[]) -{ - land_detector_task->start(); -} - /** * Stop the task, force killing it if it doesn't stop by itself **/ static void land_detector_stop() { - if (land_detector_task == nullptr || _landDetectorTaskID == -1) { + if (land_detector_task == nullptr) { warnx("not running"); return; } land_detector_task->shutdown(); - //Wait for task to die + // Wait for task to die int i = 0; do { /* wait 20ms */ usleep(20000); - /* if we have given up, kill it */ - if (++i > 50) { - px4_task_delete(_landDetectorTaskID); - break; - } - } while (land_detector_task->isRunning()); + } while (land_detector_task->isRunning() && ++i < 50); delete land_detector_task; land_detector_task = nullptr; - _landDetectorTaskID = -1; warnx("land_detector has been stopped"); } @@ -116,7 +101,7 @@ static void land_detector_stop() **/ static int land_detector_start(const char *mode) { - if (land_detector_task != nullptr || _landDetectorTaskID != -1) { + if (land_detector_task != nullptr) { warnx("already running"); return -1; } @@ -140,14 +125,9 @@ static int land_detector_start(const char *mode) } //Start new thread task - _landDetectorTaskID = px4_task_spawn_cmd("land_detector", - SCHED_DEFAULT, - SCHED_PRIORITY_DEFAULT, - 1000, - (px4_main_t)&land_detector_deamon_thread, - nullptr); + int ret = land_detector_task->start(); - if (_landDetectorTaskID < 0) { + if (ret) { warnx("task start failed: %d", -errno); return -1; } From f7dd0d119b63a5dbb7ab51231fbc2a9e3801db43 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 16:21:47 +0200 Subject: [PATCH 347/389] Fix formatting in FMU driver --- src/drivers/px4fmu/fmu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index ef063824c1..dd6b274821 100644 --- a/src/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp @@ -605,14 +605,14 @@ PX4FMU::cycle() _armed_sub = orb_subscribe(ORB_ID(actuator_armed)); _param_sub = orb_subscribe(ORB_ID(parameter_update)); - #ifdef HRT_PPM_CHANNEL +#ifdef HRT_PPM_CHANNEL // rc input, published to ORB struct rc_input_values rc_in; orb_advert_t to_input_rc = 0; memset(&rc_in, 0, sizeof(rc_in)); rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_PPM; - #endif +#endif /* initialize PWM limit lib */ pwm_limit_init(&_pwm_limit); From 5b23345b0ffde7064b8556b4c38e0118242bec5c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 17:06:38 +0200 Subject: [PATCH 348/389] GPS: Remove excessive stack allocation --- src/drivers/gps/gps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index 6c4b4eab7a..35ee8658a0 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -229,7 +229,7 @@ GPS::init() /* start the GPS driver worker task */ _task = px4_task_spawn_cmd("gps", SCHED_DEFAULT, - SCHED_PRIORITY_SLOW_DRIVER, 1500, (main_t)&GPS::task_main_trampoline, nullptr); + SCHED_PRIORITY_SLOW_DRIVER, 1200, (main_t)&GPS::task_main_trampoline, nullptr); if (_task < 0) { warnx("task start failed: %d", errno); From a0bfd3a5bf693cae1fae4f65373f81f6b0a31d97 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 17:06:50 +0200 Subject: [PATCH 349/389] Dataman: Remove excessive stack allocation --- src/modules/dataman/dataman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/dataman/dataman.c b/src/modules/dataman/dataman.c index aaa10b3318..b10e7f7b7f 100644 --- a/src/modules/dataman/dataman.c +++ b/src/modules/dataman/dataman.c @@ -861,7 +861,7 @@ start(void) px4_sem_init(&g_init_sema, 1, 0); /* start the worker thread with low priority for disk IO */ - if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT - 10, 1500, task_main, NULL)) <= 0) { + if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT - 10, 1200, task_main, NULL)) <= 0) { warn("task start failed"); return -1; } From fb1af08234560eed41a1d009b051301ec3ab2945 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 17:07:06 +0200 Subject: [PATCH 350/389] FW att control: Remove excessive stack allocation --- src/modules/fw_att_control/fw_att_control_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/fw_att_control/fw_att_control_main.cpp b/src/modules/fw_att_control/fw_att_control_main.cpp index d06e9b9a74..a455cdf8b4 100644 --- a/src/modules/fw_att_control/fw_att_control_main.cpp +++ b/src/modules/fw_att_control/fw_att_control_main.cpp @@ -1146,7 +1146,7 @@ FixedwingAttitudeControl::start() _control_task = px4_task_spawn_cmd("fw_att_control", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, - 1600, + 1300, (px4_main_t)&FixedwingAttitudeControl::task_main_trampoline, nullptr); From 6e5097a8df61e27fa0c34f833711b79b5beeda4d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 17:07:23 +0200 Subject: [PATCH 351/389] FW pos control: Remove excessive stack allocation --- src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp b/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp index c3816f5374..1144387253 100644 --- a/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp +++ b/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp @@ -1965,7 +1965,7 @@ FixedwingPositionControl::start() _control_task = px4_task_spawn_cmd("fw_pos_control_l1", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, - 1600, + 1300, (px4_main_t)&FixedwingPositionControl::task_main_trampoline, nullptr); From 428297fd6f57f9f1ecd908324c394c83d85b2df9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 22:25:14 +0200 Subject: [PATCH 352/389] Revert "Remove rsync dependency" This reverts commit 5b9a19aa65c3e27fe979181ea9817ec7347c4fbf. --- cmake/nuttx/px4_impl_nuttx.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index f48bdc135c..13d120af26 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -213,8 +213,7 @@ function(px4_nuttx_add_export) # copy add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp COMMAND ${MKDIR} -p ${CMAKE_BINARY_DIR}/${CONFIG} - COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src} - COMMAND ${RM} -rf ${nuttx_src}/.git + COMMAND rsync -a --exclude=.git ${CMAKE_SOURCE_DIR}/NuttX/ ${nuttx_src}/ COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp DEPENDS ${DEPENDS}) add_custom_target(__nuttx_copy_${CONFIG} From 9a0b6aca90d9aa13eb94b7ffd876e649204c068b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 10 Oct 2015 22:25:14 +0200 Subject: [PATCH 353/389] Revert "Remove rsync dependency" This reverts commit 5b9a19aa65c3e27fe979181ea9817ec7347c4fbf. --- cmake/nuttx/px4_impl_nuttx.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index f48bdc135c..13d120af26 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -213,8 +213,7 @@ function(px4_nuttx_add_export) # copy add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp COMMAND ${MKDIR} -p ${CMAKE_BINARY_DIR}/${CONFIG} - COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src} - COMMAND ${RM} -rf ${nuttx_src}/.git + COMMAND rsync -a --exclude=.git ${CMAKE_SOURCE_DIR}/NuttX/ ${nuttx_src}/ COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp DEPENDS ${DEPENDS}) add_custom_target(__nuttx_copy_${CONFIG} From 8f1ffac1b20b8de27aa48a4d7778c491d5f9f077 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 11:35:16 +0200 Subject: [PATCH 354/389] Sensors: Fix build error with battery voltage scaling param --- src/modules/sensors/sensor_params.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/sensors/sensor_params.c b/src/modules/sensors/sensor_params.c index 06f57a26a9..1db6ed1b77 100644 --- a/src/modules/sensors/sensor_params.c +++ b/src/modules/sensors/sensor_params.c @@ -1810,7 +1810,6 @@ PARAM_DEFINE_INT32(BAT_V_SCALE_IO, 10000); /** * Scaling factor for battery voltage sensor on FMU v2. * - * @board CONFIG_ARCH_BOARD_PX4FMU_V2 * @group Battery Calibration */ PARAM_DEFINE_FLOAT(BAT_V_SCALING, -1.0f); From dda740b7094454c45e7e1f2d015c688390eab213 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 11:35:46 +0200 Subject: [PATCH 355/389] MAVLink app: Ensure to report battery status correctly according to MAVLink standards --- src/modules/mavlink/mavlink_messages.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index c6dde06677..fed42bef2b 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -556,7 +556,7 @@ protected: msg.errors_count2 = status.errors_count2; msg.errors_count3 = status.errors_count3; msg.errors_count4 = status.errors_count4; - msg.battery_remaining = (msg.voltage_battery > 0) ? + msg.battery_remaining = (status.condition_battery_voltage_valid) ? status.battery_remaining * 100.0f : -1; _mavlink->send_message(MAVLINK_MSG_ID_SYS_STATUS, &msg); @@ -571,14 +571,22 @@ protected: if (i < status.battery_cell_count) { bat_msg.voltages[i] = (status.battery_voltage / status.battery_cell_count) * 1000.0f; } else { - bat_msg.voltages[i] = 0; + bat_msg.voltages[i] = UINT16_MAX; } } - bat_msg.current_battery = status.battery_current * 100.0f; - bat_msg.current_consumed = status.battery_discharged_mah; + + if (status.condition_battery_voltage_valid) { + bat_msg.current_battery = (bat_msg.current_battery >= 0.0f) ? + status.battery_current * 100.0f : -1; + bat_msg.current_consumed = (bat_msg.current_consumed >= 0.0f) ? + status.battery_discharged_mah : -1; + bat_msg.battery_remaining = status.battery_remaining * 100.0f; + } else { + bat_msg.current_battery = -1.0f; + bat_msg.current_consumed = -1.0f; + bat_msg.battery_remaining = -1.0f; + } bat_msg.energy_consumed = -1.0f; - bat_msg.battery_remaining = (status.battery_voltage > 0) ? - status.battery_remaining * 100.0f : -1; _mavlink->send_message(MAVLINK_MSG_ID_BATTERY_STATUS, &bat_msg); } From 9b4514299243e76ab40014d9b14da1e1aa5454a1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 12:04:34 +0200 Subject: [PATCH 356/389] Abort compilation if some smart "developers" think downloading a ZIP file is a good idea. --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 1e4546a3f7..2473eeff43 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,14 @@ # ############################################################################ +# Enforce the presence of the GIT repository +# +# We depend on our submodules, so we have to prevent attempts to +# compile without it being present. +ifeq ($(wildcard .git),) + $(error YOU HAVE TO USE GIT TO DOWNLOAD THIS REPOSITORY. ABORTING.) +endif + # Help # -------------------------------------------------------------------- # Don't be afraid of this makefile, it is just passing From cdb2a5432b79a8c882d6c192c3fff615afbe683d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 13:12:54 +0200 Subject: [PATCH 357/389] FMUv1: Do not support CAN build, since its out of reach memory wise anyway --- cmake/configs/nuttx_px4fmu-v1_default.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/configs/nuttx_px4fmu-v1_default.cmake b/cmake/configs/nuttx_px4fmu-v1_default.cmake index c8a178400a..ed48bd4f34 100644 --- a/cmake/configs/nuttx_px4fmu-v1_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v1_default.cmake @@ -63,7 +63,6 @@ set(config_module_list modules/navigator modules/mavlink modules/gpio_led - modules/uavcan modules/land_detector # From 15e17f4a5879198a23212f8caa0c11784600da48 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 13:13:15 +0200 Subject: [PATCH 358/389] IOv1: Ensure image is aligned. --- nuttx-configs/px4io-v1/scripts/ld.script | 1 + 1 file changed, 1 insertion(+) diff --git a/nuttx-configs/px4io-v1/scripts/ld.script b/nuttx-configs/px4io-v1/scripts/ld.script index 1a73b432c1..6cc77e9623 100755 --- a/nuttx-configs/px4io-v1/scripts/ld.script +++ b/nuttx-configs/px4io-v1/scripts/ld.script @@ -108,6 +108,7 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS _edata = ABSOLUTE(.); + . = ALIGN(4); } > sram AT > flash .bss : { From b799c730f2f063d616f62940aa51dbcb5d268de7 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 13:13:32 +0200 Subject: [PATCH 359/389] Travis CI: Build FMUv1 image to ensure its operational --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index dd4e5b4401..5806f9d232 100644 --- a/.travis.yml +++ b/.travis.yml @@ -97,6 +97,7 @@ script: - cat build_posix_sitl_simple/src/modules/systemlib/mixer/mixer_multirotor.generated.h - echo -en 'travis_fold:end:script.2\\r' - echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r' + - make px4fmu-v1_default - make px4fmu-v2_default - echo -en 'travis_fold:end:script.3\\r' - echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r' From e96f4e1944bd54ccf75bdd2ccf354f656dc0df63 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 14:06:43 +0200 Subject: [PATCH 360/389] FMUv1: Fix CAN compilation --- cmake/configs/nuttx_px4fmu-v1_default.cmake | 1 + src/modules/uavcan/uavcan_main.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmake/configs/nuttx_px4fmu-v1_default.cmake b/cmake/configs/nuttx_px4fmu-v1_default.cmake index ed48bd4f34..d42d5adf75 100644 --- a/cmake/configs/nuttx_px4fmu-v1_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v1_default.cmake @@ -98,6 +98,7 @@ set(config_module_list modules/controllib modules/uORB modules/dataman + modules/uavcan # # Libraries diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index 57bc6c1809..1ba9d345fb 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -530,8 +530,10 @@ int UavcanNode::start(uavcan::NodeID node_id, uint32_t bitrate) * If no transceiver is connected, the RX pin will float, occasionally causing CAN controller to * fail during initialization. */ + #ifdef GPIO_CAN1_RX stm32_configgpio(GPIO_CAN1_RX); stm32_configgpio(GPIO_CAN1_TX); + #endif stm32_configgpio(GPIO_CAN2_RX | GPIO_PULLUP); stm32_configgpio(GPIO_CAN2_TX); From ad0e1fe2d7ac7e09afd5b3dc73a1f3f88446becd Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 15:43:17 +0200 Subject: [PATCH 361/389] ROMFS: Do not abort system boot on sensor error --- ROMFS/px4fmu_common/init.d/rc.sensors | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 517c77b872..08a044329f 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -112,4 +112,6 @@ fi # Wait 20 ms for sensors (because we need to wait for the HRT and work queue callbacks to fire) usleep 20000 -sensors start +if sensors start +then +fi From 67087c6428661618480d9f1fb9af1cf19b5dc5d1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 15:43:45 +0200 Subject: [PATCH 362/389] MS5611: Fix breakage introduced by failed Qualcomm MS5611 port --- src/drivers/ms5611/ms5611_i2c.cpp | 28 +++++++--------------------- src/drivers/ms5611/ms5611_nuttx.cpp | 2 +- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/drivers/ms5611/ms5611_i2c.cpp b/src/drivers/ms5611/ms5611_i2c.cpp index 86aa28a389..3a86a7f064 100644 --- a/src/drivers/ms5611/ms5611_i2c.cpp +++ b/src/drivers/ms5611/ms5611_i2c.cpp @@ -45,7 +45,6 @@ #include #include #include -//#include #include #include @@ -71,20 +70,16 @@ public: virtual ~MS5611_I2C(); virtual int init(); - virtual ssize_t read(device::file_t *handlep, char *data, size_t count); - virtual int ioctl(device::file_t *handlep, int cmd, unsigned long arg); + virtual int read(unsigned offset, void *data, unsigned count); + virtual int ioctl(unsigned operation, unsigned &arg); -#ifdef __PX4_NUTTX protected: virtual int probe(); -#endif private: ms5611::prom_u &_prom; -#ifdef __PX4_NUTTX int _probe_address(uint8_t address); -#endif /** * Send a reset command to the MS5611. @@ -116,13 +111,7 @@ MS5611_i2c_interface(ms5611::prom_u &prom_buf, uint8_t busnum) } MS5611_I2C::MS5611_I2C(uint8_t bus, ms5611::prom_u &prom) : - I2C("MS5611_I2C", -#ifdef __PX4_NUTTX - nullptr, bus, 0, 400000 -#else - "/dev/MS5611_I2C", bus, 0 -#endif - ), + I2C("MS5611_I2C", nullptr, bus, 0, 400000), _prom(prom) { } @@ -138,8 +127,8 @@ MS5611_I2C::init() return I2C::init(); } -ssize_t -MS5611_I2C::read(device::file_t *handlep, char *data, size_t buflen) +int +MS5611_I2C::read(unsigned offset, void *data, unsigned count) { union _cvt { uint8_t b[4]; @@ -163,11 +152,11 @@ MS5611_I2C::read(device::file_t *handlep, char *data, size_t buflen) } int -MS5611_I2C::ioctl(device::file_t *handlep, int cmd, unsigned long arg) +MS5611_I2C::ioctl(unsigned operation, unsigned &arg) { int ret; - switch (cmd) { + switch (operation) { case IOCTL_RESET: ret = _reset(); break; @@ -183,7 +172,6 @@ MS5611_I2C::ioctl(device::file_t *handlep, int cmd, unsigned long arg) return ret; } -#ifdef __PX4_NUTTX int MS5611_I2C::probe() { @@ -220,8 +208,6 @@ MS5611_I2C::_probe_address(uint8_t address) return PX4_OK; } -#endif - int MS5611_I2C::_reset() diff --git a/src/drivers/ms5611/ms5611_nuttx.cpp b/src/drivers/ms5611/ms5611_nuttx.cpp index 7c336dfcab..91dd785bc6 100644 --- a/src/drivers/ms5611/ms5611_nuttx.cpp +++ b/src/drivers/ms5611/ms5611_nuttx.cpp @@ -963,7 +963,7 @@ start(enum MS5611_BUS busid) continue; } - started |= start_bus(bus_options[i]); + started = started || start_bus(bus_options[i]); } if (!started) { From ef8ef0fb23041008f305c190ed68229315787408 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 16:34:58 +0200 Subject: [PATCH 363/389] FMUv1: Safe some RAM on buffers --- nuttx-configs/px4fmu-v1/nsh/defconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nuttx-configs/px4fmu-v1/nsh/defconfig b/nuttx-configs/px4fmu-v1/nsh/defconfig index 9692a854bc..b89b4039d8 100644 --- a/nuttx-configs/px4fmu-v1/nsh/defconfig +++ b/nuttx-configs/px4fmu-v1/nsh/defconfig @@ -506,8 +506,8 @@ CONFIG_MTD_BYTE_WRITE=y # # USART1 Configuration # -CONFIG_USART1_RXBUFSIZE=300 -CONFIG_USART1_TXBUFSIZE=300 +CONFIG_USART1_RXBUFSIZE=128 +CONFIG_USART1_TXBUFSIZE=128 CONFIG_USART1_BAUD=57600 CONFIG_USART1_BITS=8 CONFIG_USART1_PARITY=0 @@ -587,7 +587,7 @@ CONFIG_CDCACM_NWRREQS=4 CONFIG_CDCACM_NRDREQS=4 CONFIG_CDCACM_BULKIN_REQLEN=96 CONFIG_CDCACM_RXBUFSIZE=300 -CONFIG_CDCACM_TXBUFSIZE=1800 +CONFIG_CDCACM_TXBUFSIZE=1000 CONFIG_CDCACM_VENDORID=0x26ac CONFIG_CDCACM_PRODUCTID=0x0010 CONFIG_CDCACM_VENDORSTR="3D Robotics" @@ -722,11 +722,11 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_HPWORK=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=5000 -CONFIG_SCHED_WORKSTACKSIZE=1800 +CONFIG_SCHED_WORKSTACKSIZE=1600 CONFIG_SCHED_LPWORK=y CONFIG_SCHED_LPWORKPRIORITY=50 CONFIG_SCHED_LPWORKPERIOD=50000 -CONFIG_SCHED_LPWORKSTACKSIZE=1800 +CONFIG_SCHED_LPWORKSTACKSIZE=1600 # CONFIG_LIB_KBDCODEC is not set # CONFIG_LIB_SLCDCODEC is not set From 690372b62c13b0e7f2f3d71ab351c50e496b96c2 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 16:36:49 +0200 Subject: [PATCH 364/389] FMU driver: Fix for v1 boards --- src/drivers/px4fmu/fmu.cpp | 53 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index dd6b274821..4d82ef9e08 100644 --- a/src/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp @@ -136,6 +136,8 @@ private: struct work_s _work; int _armed_sub; int _param_sub; + struct rc_input_values _rc_in; + orb_advert_t _to_input_rc; orb_advert_t _outputs_pub; unsigned _num_outputs; int _class_instance; @@ -267,6 +269,8 @@ PX4FMU::PX4FMU() : _work{}, _armed_sub(-1), _param_sub(-1), + _rc_in{}, + _to_input_rc(nullptr), _outputs_pub(nullptr), _num_outputs(0), _class_instance(0), @@ -297,6 +301,12 @@ PX4FMU::PX4FMU() : memset(_controls, 0, sizeof(_controls)); memset(_poll_fds, 0, sizeof(_poll_fds)); +#ifdef HRT_PPM_CHANNEL + // rc input, published to ORB + memset(&_rc_in, 0, sizeof(_rc_in)); + _rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_PPM; +#endif + /* only enable this during development */ _debug_enabled = false; } @@ -605,15 +615,6 @@ PX4FMU::cycle() _armed_sub = orb_subscribe(ORB_ID(actuator_armed)); _param_sub = orb_subscribe(ORB_ID(parameter_update)); -#ifdef HRT_PPM_CHANNEL - // rc input, published to ORB - struct rc_input_values rc_in; - orb_advert_t to_input_rc = 0; - - memset(&rc_in, 0, sizeof(rc_in)); - rc_in.input_source = input_rc_s::RC_INPUT_SOURCE_PX4FMU_PPM; -#endif - /* initialize PWM limit lib */ pwm_limit_init(&_pwm_limit); @@ -778,34 +779,34 @@ PX4FMU::cycle() #ifdef HRT_PPM_CHANNEL // see if we have new PPM input data - if (ppm_last_valid_decode != rc_in.timestamp_last_signal) { + if (ppm_last_valid_decode != _rc_in.timestamp_last_signal) { // we have a new PPM frame. Publish it. - rc_in.channel_count = ppm_decoded_channels; + _rc_in.channel_count = ppm_decoded_channels; - if (rc_in.channel_count > input_rc_s::RC_INPUT_MAX_CHANNELS) { - rc_in.channel_count = input_rc_s::RC_INPUT_MAX_CHANNELS; + if (_rc_in.channel_count > input_rc_s::RC_INPUT_MAX_CHANNELS) { + _rc_in.channel_count = input_rc_s::RC_INPUT_MAX_CHANNELS; } - for (uint8_t i = 0; i < rc_in.channel_count; i++) { - rc_in.values[i] = ppm_buffer[i]; + for (uint8_t i = 0; i < _rc_in.channel_count; i++) { + _rc_in.values[i] = ppm_buffer[i]; } - rc_in.timestamp_publication = ppm_last_valid_decode; - rc_in.timestamp_last_signal = ppm_last_valid_decode; + _rc_in.timestamp_publication = ppm_last_valid_decode; + _rc_in.timestamp_last_signal = ppm_last_valid_decode; - rc_in.rc_ppm_frame_length = ppm_frame_length; - rc_in.rssi = RC_INPUT_RSSI_MAX; - rc_in.rc_failsafe = false; - rc_in.rc_lost = false; - rc_in.rc_lost_frame_count = 0; - rc_in.rc_total_frame_count = 0; + _rc_in.rc_ppm_frame_length = ppm_frame_length; + _rc_in.rssi = RC_INPUT_RSSI_MAX; + _rc_in.rc_failsafe = false; + _rc_in.rc_lost = false; + _rc_in.rc_lost_frame_count = 0; + _rc_in.rc_total_frame_count = 0; /* lazily advertise on first publication */ - if (to_input_rc == 0) { - to_input_rc = orb_advertise(ORB_ID(input_rc), &rc_in); + if (_to_input_rc == nullptr) { + _to_input_rc = orb_advertise(ORB_ID(input_rc), &_rc_in); } else { - orb_publish(ORB_ID(input_rc), to_input_rc, &rc_in); + orb_publish(ORB_ID(input_rc), _to_input_rc, &_rc_in); } } From a60277e9bad7b59c6481fe9f8d23ca33fc6bc284 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 16:37:19 +0200 Subject: [PATCH 365/389] FMUv1: Do not let the statically allocated UAVCAN RAM hog eat all the RAM we need --- cmake/configs/nuttx_px4fmu-v1_default.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/configs/nuttx_px4fmu-v1_default.cmake b/cmake/configs/nuttx_px4fmu-v1_default.cmake index d42d5adf75..ed48bd4f34 100644 --- a/cmake/configs/nuttx_px4fmu-v1_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v1_default.cmake @@ -98,7 +98,6 @@ set(config_module_list modules/controllib modules/uORB modules/dataman - modules/uavcan # # Libraries From 4ad82644fe49240207f20608b368c2cb565ba84b Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 11 Oct 2015 19:40:13 -0400 Subject: [PATCH 366/389] Removed uavcan from nuttx firmware for v1. --- cmake/configs/nuttx_px4fmu-v1_default.cmake | 1 - cmake/configs/nuttx_px4fmu-v2_default.cmake | 2 ++ src/firmware/nuttx/CMakeLists.txt | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/configs/nuttx_px4fmu-v1_default.cmake b/cmake/configs/nuttx_px4fmu-v1_default.cmake index d42d5adf75..ed48bd4f34 100644 --- a/cmake/configs/nuttx_px4fmu-v1_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v1_default.cmake @@ -98,7 +98,6 @@ set(config_module_list modules/controllib modules/uORB modules/dataman - modules/uavcan # # Libraries diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 8788bbeb51..89910bbd95 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -168,6 +168,8 @@ set(config_io_board set(config_extra_libs ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a + libuavcan.a + libuavcan_stm32_driver.a ) set(config_io_extra_libs diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index c13183ba16..6304ab2642 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -40,8 +40,6 @@ target_link_libraries(firmware_nuttx ${module_libraries} ${config_extra_libs} ${link_libs} - libuavcan_stm32_driver.a - libuavcan.a -Wl,--end-group) add_custom_target(check_weak From b7847e13a689440515c80d7ee1b197a58021ca48 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Sat, 8 Aug 2015 09:25:01 +0200 Subject: [PATCH 367/389] mtecs: quick hack: only write tecs topic on nuttx, need to solve this cleanly with inheritance. Introduced own mode enum. --- src/modules/fw_pos_control_l1/mtecs/mTecs.cpp | 24 +++++++++++++------ src/modules/fw_pos_control_l1/mtecs/mTecs.h | 16 +++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp b/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp index c07956fd6e..36ce58f2ff 100644 --- a/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp +++ b/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp @@ -52,7 +52,9 @@ mTecs::mTecs() : _mTecsEnabled(this, "ENABLED"), _airspeedMin(this, "FW_AIRSPD_MIN", false), /* Publications */ +#if defined(__PX4_NUTTX) _status(ORB_ID(tecs_status), &getPublications()), +#endif // defined(__PX4_NUTTX) /* control blocks */ _controlTotalEnergy(this, "THR"), _controlEnergyDistribution(this, "PIT", true), @@ -107,9 +109,11 @@ int mTecs::updateAltitudeSpeed(float flightPathAngle, float altitude, float alti debug("updateAltitudeSpeed: altitudeSp %.4f, altitude %.4f, altitude filtered %.4f, flightPathAngleSp %.4f", (double)altitudeSp, (double)altitude, (double)altitudeFiltered, (double)flightPathAngleSp); } +#if defined(__PX4_NUTTX) /* Write part of the status message */ _status.altitudeSp = altitudeSp; _status.altitude_filtered = altitudeFiltered; +#endif // defined(__PX4_NUTTX) /* use flightpath angle setpoint for total energy control */ @@ -143,9 +147,11 @@ int mTecs::updateFlightPathAngleSpeed(float flightPathAngle, float flightPathAng (double)airspeedFiltered, (double)accelerationLongitudinalSp); } +#if defined(__PX4_NUTTX) /* Write part of the status message */ _status.airspeedSp = airspeedSp; _status.airspeed_filtered = airspeedFiltered; +#endif // defined(__PX4_NUTTX) /* use longitudinal acceleration setpoint for total energy control */ @@ -200,23 +206,23 @@ int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flight } /* Check airspeed: if below safe value switch to underspeed mode (if not in land or takeoff mode) */ - if (mode != tecs_status_s::TECS_MODE_LAND && mode != tecs_status_s::TECS_MODE_TAKEOFF && airspeedFiltered < _airspeedMin.get()) { - mode = tecs_status_s::TECS_MODE_UNDERSPEED; + if (mode != MTECS_MODE_LAND && mode != MTECS_MODE_TAKEOFF && airspeedFiltered < _airspeedMin.get()) { + mode = MTECS_MODE_UNDERSPEED; } - /* Set special output limiters if we are not in TECS_MODE_NORMAL */ + /* Set special output limiters if we are not in MTECS_MODE_NORMAL */ BlockOutputLimiter *outputLimiterThrottle = &_controlTotalEnergy.getOutputLimiter(); BlockOutputLimiter *outputLimiterPitch = &_controlEnergyDistribution.getOutputLimiter(); - if (mode == tecs_status_s::TECS_MODE_TAKEOFF) { + if (mode == MTECS_MODE_TAKEOFF) { outputLimiterThrottle = &_BlockOutputLimiterTakeoffThrottle; outputLimiterPitch = &_BlockOutputLimiterTakeoffPitch; - } else if (mode == tecs_status_s::TECS_MODE_LAND) { + } else if (mode == MTECS_MODE_LAND) { // only limit pitch but do not limit throttle outputLimiterPitch = &_BlockOutputLimiterLandPitch; - } else if (mode == tecs_status_s::TECS_MODE_LAND_THROTTLELIM) { + } else if (mode == MTECS_MODE_LAND_THROTTLELIM) { outputLimiterThrottle = &_BlockOutputLimiterLandThrottle; outputLimiterPitch = &_BlockOutputLimiterLandPitch; - } else if (mode == tecs_status_s::TECS_MODE_UNDERSPEED) { + } else if (mode == MTECS_MODE_UNDERSPEED) { outputLimiterThrottle = &_BlockOutputLimiterUnderspeedThrottle; outputLimiterPitch = &_BlockOutputLimiterUnderspeedPitch; } @@ -226,6 +232,7 @@ int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flight * is running) */ limitOverride.applyOverride(*outputLimiterThrottle, *outputLimiterPitch); +// #if defined(__PX4_NUTTX) // /* Write part of the status message */ // _status.flightPathAngleSp = flightPathAngleSp; // _status.flightPathAngle = flightPathAngle; @@ -237,6 +244,7 @@ int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flight // _status.energyDistributionRateSp = energyDistributionRateSp; // _status.energyDistributionRate = energyDistributionRate; // _status.mode = mode; +// #endif // defined(__PX4_NUTTX) /** update control blocks **/ /* update total energy rate control block */ @@ -253,8 +261,10 @@ int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flight (double)accelerationLongitudinalSp, (double)airspeedDerivative); } +#if defined(__PX4_NUTTX) /* publish status message */ _status.update(); +#endif // defined(__PX4_NUTTX) /* clean up */ _firstIterationAfterReset = false; diff --git a/src/modules/fw_pos_control_l1/mtecs/mTecs.h b/src/modules/fw_pos_control_l1/mtecs/mTecs.h index e114cc3ae0..990cb62e2d 100644 --- a/src/modules/fw_pos_control_l1/mtecs/mTecs.h +++ b/src/modules/fw_pos_control_l1/mtecs/mTecs.h @@ -49,11 +49,25 @@ #include #include #include + +#if defined(__PX4_NUTTX) #include +#endif // defined(__PX4_NUTTX) namespace fwPosctrl { +/* corresponds to TECS_MODE in tecs_status.msg */ +enum MTECS_MODE { + MTECS_MODE_NORMAL = 0, + MTECS_MODE_UNDERSPEED = 1, + MTECS_MODE_TAKEOFF = 2, + MTECS_MODE_LAND = 3, + MTECS_MODE_LAND_THROTTLELIM = 4, + MTECS_MODE_BAD_DESCENT = 5, + MTECS_MODE_CLIMBOUT = 6 +}; + /* Main class of the mTecs */ class mTecs : public control::SuperBlock { @@ -101,7 +115,9 @@ protected: control::BlockParamFloat _airspeedMin; /**< minimal airspeed */ /* Publications */ +#if defined(__PX4_NUTTX) uORB::Publication _status; /**< publish internal values for logging */ +#endif // defined(__PX4_NUTTX) /* control blocks */ BlockFFPILimitedCustom _controlTotalEnergy; /**< FFPI controller for total energy control: output From 040d1da8a146727cf9e581583845cb45e18a582f Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Sun, 6 Sep 2015 15:46:59 +0200 Subject: [PATCH 368/389] add 2nd order low pass block --- src/modules/controllib/blocks.cpp | 8 ++++++++ src/modules/controllib/blocks.hpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/modules/controllib/blocks.cpp b/src/modules/controllib/blocks.cpp index f739446fa7..ed6bfb0f85 100644 --- a/src/modules/controllib/blocks.cpp +++ b/src/modules/controllib/blocks.cpp @@ -198,6 +198,14 @@ int blockHighPassTest() return 0; } +float BlockLowPass2::update(float input) +{ + if (_lp.get_cutoff_freq() != getFCutParam()) { + _lp.set_cutoff_frequency(_fs, getFCutParam()); + } + return _lp.apply(input); +} + float BlockIntegral::update(float input) { // trapezoidal integration diff --git a/src/modules/controllib/blocks.hpp b/src/modules/controllib/blocks.hpp index 979b9541be..ded54e9988 100644 --- a/src/modules/controllib/blocks.hpp +++ b/src/modules/controllib/blocks.hpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "block/Block.hpp" #include "block/BlockParam.hpp" @@ -163,6 +164,33 @@ protected: int __EXPORT blockHighPassTest(); +/** + * A 2nd order low pass filter block which uses the 2nd order low pass filter used by px4 + */ +class __EXPORT BlockLowPass2 : public Block +{ +public: +// methods + BlockLowPass2(SuperBlock *parent, const char *name, float sample_freq) : + Block(parent, name), + _fCut(this, ""), // only one parameter, no need to name + _fs(sample_freq), + _lp(_fs, _fCut.get()) + {}; + virtual ~BlockLowPass2() {}; + float update(float input); +// accessors + float getFCutParam() { return _fCut.get(); } + void setState(float state) { _lp.reset(state); } +protected: +// attributes + control::BlockParamFloat _fCut; + float _fs; + math::LowPassFilter2p _lp; +}; + +// XXX missing test function for BlockLowPass2 + /** * A rectangular integrator. * A limiter is built into the class to bound the From 2c5d810b065e9fc93be5a93109c527c733e0ab7d Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Sun, 6 Sep 2015 15:47:16 +0200 Subject: [PATCH 369/389] make mtecs use 2nd order low pass block --- src/modules/fw_pos_control_l1/mtecs/mTecs.cpp | 6 +++--- src/modules/fw_pos_control_l1/mtecs/mTecs.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp b/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp index 36ce58f2ff..49e1d735e0 100644 --- a/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp +++ b/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp @@ -60,9 +60,9 @@ mTecs::mTecs() : _controlEnergyDistribution(this, "PIT", true), _controlAltitude(this, "FPA", true), _controlAirSpeed(this, "ACC"), - _flightPathAngleLowpass(this, "FPA_LP"), - _altitudeLowpass(this, "ALT_LP"), - _airspeedLowpass(this, "A_LP"), + _flightPathAngleLowpass(this, "FPA_LP", 50), + _altitudeLowpass(this, "ALT_LP", 50), + _airspeedLowpass(this, "A_LP", 50), _airspeedDerivative(this, "AD"), _throttleSp(0.0f), _pitchSp(0.0f), diff --git a/src/modules/fw_pos_control_l1/mtecs/mTecs.h b/src/modules/fw_pos_control_l1/mtecs/mTecs.h index 990cb62e2d..0d6f2613a6 100644 --- a/src/modules/fw_pos_control_l1/mtecs/mTecs.h +++ b/src/modules/fw_pos_control_l1/mtecs/mTecs.h @@ -130,9 +130,9 @@ protected: setpoint */ /* Other calculation Blocks */ - control::BlockLowPass _flightPathAngleLowpass; /**< low pass filter for the flight path angle */ - control::BlockLowPass _altitudeLowpass; /**< low pass filter for altitude */ - control::BlockLowPass _airspeedLowpass; /**< low pass filter for airspeed */ + control::BlockLowPass2 _flightPathAngleLowpass; /**< low pass filter for the flight path angle */ + control::BlockLowPass2 _altitudeLowpass; /**< low pass filter for altitude */ + control::BlockLowPass2 _airspeedLowpass; /**< low pass filter for airspeed */ control::BlockDerivative _airspeedDerivative; /**< airspeed derivative calulation */ /* Output setpoints */ From b4ee05da03043aed4e6d165eb77b3e02933f3127 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Wed, 9 Sep 2015 06:24:00 +0200 Subject: [PATCH 370/389] add more accessors for 2nd order lp block and derivative block --- src/modules/controllib/blocks.cpp | 7 ++++++- src/modules/controllib/blocks.hpp | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/controllib/blocks.cpp b/src/modules/controllib/blocks.cpp index ed6bfb0f85..d97fa76974 100644 --- a/src/modules/controllib/blocks.cpp +++ b/src/modules/controllib/blocks.cpp @@ -200,10 +200,15 @@ int blockHighPassTest() float BlockLowPass2::update(float input) { + if (!isfinite(getState())) { + setState(input); + } + if (_lp.get_cutoff_freq() != getFCutParam()) { _lp.set_cutoff_frequency(_fs, getFCutParam()); } - return _lp.apply(input); + _state = _lp.apply(input); + return _state; } float BlockIntegral::update(float input) diff --git a/src/modules/controllib/blocks.hpp b/src/modules/controllib/blocks.hpp index ded54e9988..7084e69e0d 100644 --- a/src/modules/controllib/blocks.hpp +++ b/src/modules/controllib/blocks.hpp @@ -173,6 +173,7 @@ public: // methods BlockLowPass2(SuperBlock *parent, const char *name, float sample_freq) : Block(parent, name), + _state(0.0 / 0.0 /* initialize to invalid val, force into is_finite() check on first call */), _fCut(this, ""), // only one parameter, no need to name _fs(sample_freq), _lp(_fs, _fCut.get()) @@ -180,10 +181,12 @@ public: virtual ~BlockLowPass2() {}; float update(float input); // accessors + float getState() { return _state; } float getFCutParam() { return _fCut.get(); } - void setState(float state) { _lp.reset(state); } + void setState(float state) { _state = _lp.reset(state); } protected: // attributes + float _state; control::BlockParamFloat _fCut; float _fs; math::LowPassFilter2p _lp; @@ -291,6 +294,7 @@ public: void setU(float u) {_u = u;} float getU() {return _u;} float getLP() {return _lowPass.getFCut();} + float getO() { return _lowPass.getState(); } protected: // attributes float _u; /**< previous input */ From bd2ed0c93bb4d496fe37a669f08c9b0f70aa6266 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Wed, 9 Sep 2015 06:25:00 +0200 Subject: [PATCH 371/389] mtecs: add getters for some internal values --- src/modules/fw_pos_control_l1/mtecs/mTecs.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/fw_pos_control_l1/mtecs/mTecs.h b/src/modules/fw_pos_control_l1/mtecs/mTecs.h index 0d6f2613a6..09d9eec1d5 100644 --- a/src/modules/fw_pos_control_l1/mtecs/mTecs.h +++ b/src/modules/fw_pos_control_l1/mtecs/mTecs.h @@ -108,6 +108,10 @@ public: float getThrottleSetpoint() { return _throttleSp; } float getPitchSetpoint() { return _pitchSp; } float airspeedLowpassUpdate(float input) { return _airspeedLowpass.update(input); } + float getFlightPathAngleLowpassState() { return _flightPathAngleLowpass.getState(); } + float getAltitudeLowpassState() { return _altitudeLowpass.getState(); } + float getAirspeedLowpassState() { return _airspeedLowpass.getState(); } + float getAirspeedDerivativeLowpassState() { return _airspeedDerivative.getO(); } protected: /* parameters */ From ee001597ff86e5bed90a99eaf7a7d030964dab76 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Sun, 11 Oct 2015 15:20:40 +0200 Subject: [PATCH 372/389] fix posix build --- src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp b/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp index c3816f5374..d8bc71c463 100644 --- a/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp +++ b/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include From 09f370940ac30a5f1532cadeab317b683a43009c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 12 Oct 2015 12:25:06 +0200 Subject: [PATCH 373/389] POSIX UDP: Correct evaluation of broadcast return value --- src/modules/mavlink/mavlink_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 7fba62f3fd..297a76239b 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -898,7 +898,7 @@ Mavlink::send_message(const uint8_t msgid, const void *msg, uint8_t component_ID int bret = sendto(_socket_fd, buf, packet_len, 0, (struct sockaddr *)&_bcast_addr, sizeof(_bcast_addr)); - if (bret) { + if (bret <= 0) { PX4_WARN("sending broadcast failed"); } } From 2402f1fbdf981d637e584897cac23c96e798b540 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 12 Oct 2015 14:17:48 +0200 Subject: [PATCH 374/389] MAVLink receiver: Add missing integrals for gyro and accel topics --- src/modules/mavlink/mavlink_receiver.cpp | 16 ++++++++++++++++ src/modules/mavlink/mavlink_receiver.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 4d59226586..19fadb49ed 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -126,6 +126,7 @@ MavlinkReceiver::MavlinkReceiver(Mavlink *parent) : _control_mode_sub(orb_subscribe(ORB_ID(vehicle_control_mode))), _hil_frames(0), _old_timestamp(0), + _hil_last_frame(0), _hil_local_proj_inited(0), _hil_local_alt0(0.0f), _hil_local_proj_ref{}, @@ -1301,6 +1302,15 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) uint64_t timestamp = hrt_absolute_time(); + float dt; + + if (_hil_last_frame == 0 || timestamp - _hil_last_frame > 0.1f) { + dt = 0.01f; /* default to 100 Hz */ + } else { + dt = (timestamp - _hil_last_frame) / 1e6f; + } + _hil_last_frame = timestamp; + /* airspeed */ { struct airspeed_s airspeed; @@ -1419,6 +1429,9 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) hil_sensors.gyro_rad_s[0] = imu.xgyro; hil_sensors.gyro_rad_s[1] = imu.ygyro; hil_sensors.gyro_rad_s[2] = imu.zgyro; + hil_sensors.gyro_integral_rad[0] = hil_sensors.gyro_rad_s[0] * dt; + hil_sensors.gyro_integral_rad[1] = hil_sensors.gyro_rad_s[1] * dt; + hil_sensors.gyro_integral_rad[2] = hil_sensors.gyro_rad_s[2] * dt; hil_sensors.gyro_timestamp[0] = timestamp; hil_sensors.accelerometer_raw[0] = imu.xacc / mg2ms2; @@ -1427,6 +1440,9 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) hil_sensors.accelerometer_m_s2[0] = imu.xacc; hil_sensors.accelerometer_m_s2[1] = imu.yacc; hil_sensors.accelerometer_m_s2[2] = imu.zacc; + hil_sensors.accelerometer_integral_m_s[0] = hil_sensors.accelerometer_m_s2[0] * dt; + hil_sensors.accelerometer_integral_m_s[1] = hil_sensors.accelerometer_m_s2[1] * dt; + hil_sensors.accelerometer_integral_m_s[2] = hil_sensors.accelerometer_m_s2[2] * dt; hil_sensors.accelerometer_mode[0] = 0; // TODO what is this? hil_sensors.accelerometer_range_m_s2[0] = 32.7f; // int16 hil_sensors.accelerometer_timestamp[0] = timestamp; diff --git a/src/modules/mavlink/mavlink_receiver.h b/src/modules/mavlink/mavlink_receiver.h index 3f115e8718..7a513216fb 100644 --- a/src/modules/mavlink/mavlink_receiver.h +++ b/src/modules/mavlink/mavlink_receiver.h @@ -196,6 +196,7 @@ private: int _control_mode_sub; int _hil_frames; uint64_t _old_timestamp; + uint64_t _hil_last_frame; bool _hil_local_proj_inited; float _hil_local_alt0; struct map_projection_reference_s _hil_local_proj_ref; From e685ef3c951784ca8796ecf1057ace122f4fc393 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 12 Oct 2015 15:02:49 +0200 Subject: [PATCH 375/389] MAVLink receiver: Fix HIL msg reception --- src/modules/mavlink/mavlink_receiver.cpp | 19 ++++++++++++++++--- src/modules/mavlink/mavlink_receiver.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 19fadb49ed..b67641679e 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -129,6 +129,8 @@ MavlinkReceiver::MavlinkReceiver(Mavlink *parent) : _hil_last_frame(0), _hil_local_proj_inited(0), _hil_local_alt0(0.0f), + _hil_prev_gyro{}, + _hil_prev_accel{}, _hil_local_proj_ref{}, _offboard_control_mode{}, _att_sp{}, @@ -1311,6 +1313,10 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) } _hil_last_frame = timestamp; + if (dt < 0.001f) { + dt = 0.001f; + } + /* airspeed */ { struct airspeed_s airspeed; @@ -1432,7 +1438,10 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) hil_sensors.gyro_integral_rad[0] = hil_sensors.gyro_rad_s[0] * dt; hil_sensors.gyro_integral_rad[1] = hil_sensors.gyro_rad_s[1] * dt; hil_sensors.gyro_integral_rad[2] = hil_sensors.gyro_rad_s[2] * dt; + memcpy(&_hil_prev_gyro[0], &hil_sensors.gyro_integral_rad[0], sizeof(_hil_prev_gyro)); + hil_sensors.gyro_integral_dt[0] = dt * 1e6f; hil_sensors.gyro_timestamp[0] = timestamp; + hil_sensors.gyro_priority[0] = ORB_PRIO_HIGH; hil_sensors.accelerometer_raw[0] = imu.xacc / mg2ms2; hil_sensors.accelerometer_raw[1] = imu.yacc / mg2ms2; @@ -1440,12 +1449,15 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) hil_sensors.accelerometer_m_s2[0] = imu.xacc; hil_sensors.accelerometer_m_s2[1] = imu.yacc; hil_sensors.accelerometer_m_s2[2] = imu.zacc; - hil_sensors.accelerometer_integral_m_s[0] = hil_sensors.accelerometer_m_s2[0] * dt; - hil_sensors.accelerometer_integral_m_s[1] = hil_sensors.accelerometer_m_s2[1] * dt; - hil_sensors.accelerometer_integral_m_s[2] = hil_sensors.accelerometer_m_s2[2] * dt; + hil_sensors.accelerometer_integral_m_s[0] = (hil_sensors.accelerometer_m_s2[0] * dt + _hil_prev_accel[0]) / 2.0f; + hil_sensors.accelerometer_integral_m_s[1] = (hil_sensors.accelerometer_m_s2[1] * dt + _hil_prev_accel[1]) / 2.0f; + hil_sensors.accelerometer_integral_m_s[2] = (hil_sensors.accelerometer_m_s2[2] * dt + _hil_prev_accel[2]) / 2.0f; + memcpy(&_hil_prev_accel[0], &hil_sensors.accelerometer_integral_m_s[0], sizeof(_hil_prev_accel)); + hil_sensors.accelerometer_integral_dt[0] = dt * 1e6f; hil_sensors.accelerometer_mode[0] = 0; // TODO what is this? hil_sensors.accelerometer_range_m_s2[0] = 32.7f; // int16 hil_sensors.accelerometer_timestamp[0] = timestamp; + hil_sensors.accelerometer_priority[0] = ORB_PRIO_HIGH; hil_sensors.adc_voltage_v[0] = 0.0f; hil_sensors.adc_voltage_v[1] = 0.0f; @@ -1461,6 +1473,7 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) hil_sensors.magnetometer_mode[0] = 0; // TODO what is this hil_sensors.magnetometer_cuttoff_freq_hz[0] = 50.0f; hil_sensors.magnetometer_timestamp[0] = timestamp; + hil_sensors.magnetometer_priority[0] = ORB_PRIO_HIGH; hil_sensors.baro_pres_mbar[0] = imu.abs_pressure; hil_sensors.baro_alt_meter[0] = imu.pressure_alt; diff --git a/src/modules/mavlink/mavlink_receiver.h b/src/modules/mavlink/mavlink_receiver.h index 7a513216fb..2363516a9a 100644 --- a/src/modules/mavlink/mavlink_receiver.h +++ b/src/modules/mavlink/mavlink_receiver.h @@ -199,6 +199,8 @@ private: uint64_t _hil_last_frame; bool _hil_local_proj_inited; float _hil_local_alt0; + float _hil_prev_gyro[3]; + float _hil_prev_accel[3]; struct map_projection_reference_s _hil_local_proj_ref; struct offboard_control_mode_s _offboard_control_mode; struct vehicle_attitude_setpoint_s _att_sp; From a87776eb81b0517053d847dbe1c5fd4e5843add9 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Sun, 11 Oct 2015 16:06:41 +0200 Subject: [PATCH 376/389] add test for BlockLowPass2 --- src/modules/controllib/blocks.cpp | 32 ++++++++++++++++++++++++++++++- src/modules/controllib/blocks.hpp | 4 ++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/modules/controllib/blocks.cpp b/src/modules/controllib/blocks.cpp index d97fa76974..6a0b615910 100644 --- a/src/modules/controllib/blocks.cpp +++ b/src/modules/controllib/blocks.cpp @@ -39,6 +39,7 @@ #include #include +#include #include "blocks.hpp" @@ -51,6 +52,7 @@ int basicBlocksTest() blockLimitSymTest(); blockLowPassTest(); blockHighPassTest(); + blockLowPass2Test(); blockIntegralTest(); blockIntegralTrapTest(); blockDerivativeTest(); @@ -204,13 +206,41 @@ float BlockLowPass2::update(float input) setState(input); } - if (_lp.get_cutoff_freq() != getFCutParam()) { + if (fabsf(_lp.get_cutoff_freq() - getFCutParam()) > FLT_EPSILON) { _lp.set_cutoff_frequency(_fs, getFCutParam()); } _state = _lp.apply(input); return _state; } +int blockLowPass2Test() +{ + printf("Test BlockLowPass2\t\t: "); + BlockLowPass2 lowPass(NULL, "TEST_LP", 100); + // test initial state + ASSERT(equal(10.0f, lowPass.getFCutParam())); + ASSERT(equal(0.0f, lowPass.getState())); + ASSERT(equal(0.0f, lowPass.getDt())); + // set dt + lowPass.setDt(0.1f); + ASSERT(equal(0.1f, lowPass.getDt())); + // set state + lowPass.setState(1.0f); + ASSERT(equal(1.0f, lowPass.getState())); + // test update + ASSERT(equal(1.06745527f, lowPass.update(2.0f))); + + // test end condition + for (int i = 0; i < 100; i++) { + lowPass.update(2.0f); + } + + ASSERT(equal(2.0f, lowPass.getState())); + ASSERT(equal(2.0f, lowPass.update(2.0f))); + printf("PASS\n"); + return 0; +}; + float BlockIntegral::update(float input) { // trapezoidal integration diff --git a/src/modules/controllib/blocks.hpp b/src/modules/controllib/blocks.hpp index 7084e69e0d..786bfc06d3 100644 --- a/src/modules/controllib/blocks.hpp +++ b/src/modules/controllib/blocks.hpp @@ -165,7 +165,7 @@ protected: int __EXPORT blockHighPassTest(); /** - * A 2nd order low pass filter block which uses the 2nd order low pass filter used by px4 + * A 2nd order low pass filter block which uses the default px4 2nd order low pass filter */ class __EXPORT BlockLowPass2 : public Block { @@ -192,7 +192,7 @@ protected: math::LowPassFilter2p _lp; }; -// XXX missing test function for BlockLowPass2 +int __EXPORT blockLowPass2Test(); /** * A rectangular integrator. From d7274ac5f0f5429a5d937365c41cdda3484770c4 Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Mon, 12 Oct 2015 13:36:37 -0400 Subject: [PATCH 377/389] Enable hash check of used parameters to verify integrity of GCS local copy --- src/modules/mavlink/mavlink_parameters.cpp | 30 +++++++++++++++++----- src/modules/systemlib/param/param.c | 24 +++++++++++++++++ src/modules/systemlib/param/param.h | 7 +++++ 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/modules/mavlink/mavlink_parameters.cpp b/src/modules/mavlink/mavlink_parameters.cpp index 414b7ee96f..b005f3d80d 100644 --- a/src/modules/mavlink/mavlink_parameters.cpp +++ b/src/modules/mavlink/mavlink_parameters.cpp @@ -44,6 +44,8 @@ #include "mavlink_parameters.h" #include "mavlink_main.h" +#define HASH_PARAM "_HASH_CHECK" + MavlinkParametersManager::MavlinkParametersManager(Mavlink *mavlink) : MavlinkStream(mavlink), _send_all_index(-1), _rc_param_map_pub(nullptr), @@ -121,13 +123,27 @@ MavlinkParametersManager::handle_message(const mavlink_message_t *msg) /* when no index is given, loop through string ids and compare them */ if (req_read.param_index < 0) { - /* local name buffer to enforce null-terminated string */ - char name[MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN + 1]; - strncpy(name, req_read.param_id, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN); - /* enforce null termination */ - name[MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN] = '\0'; - /* attempt to find parameter and send it */ - send_param(param_find_no_notification(name)); + if (strncmp(req_read.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN) == 0) { + /* return hash check for cached params */ + uint32_t hash = param_hash_check(); + + /* build the one-off response message */ + mavlink_param_value_t msg; + msg.param_count = param_count_used(); + msg.param_index = -1; + strncpy(msg.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN); + msg.param_type = MAV_PARAM_TYPE_UINT32; + memcpy(&msg.param_value, &hash, sizeof(hash)); + _mavlink->send_message(MAVLINK_MSG_ID_PARAM_VALUE, &msg); + } else { + /* local name buffer to enforce null-terminated string */ + char name[MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN + 1]; + strncpy(name, req_read.param_id, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN); + /* enforce null termination */ + name[MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN] = '\0'; + /* attempt to find parameter and send it */ + send_param(param_find_no_notification(name)); + } } else { /* when index is >= 0, send this parameter again */ diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 097e61e350..d9976ccdaa 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -65,6 +65,8 @@ #include "uORB/topics/parameter_update.h" #include "px4_parameters.h" +#include + #if 0 # define debug(fmt, args...) do { warnx(fmt, ##args); } while(0) #else @@ -1035,3 +1037,25 @@ param_foreach(void (*func)(void *arg, param_t param), void *arg, bool only_chang func(arg, param); } } + +uint32_t param_hash_check(void) +{ + uint32_t param_hash = 0; + + param_lock(); + + /* compute the CRC32 over all string param names and 4 byte values */ + for (param_t param = 0; handle_in_range(param); param++) { + if (!param_used(param)) { + continue; + } + const char *name = param_name(param); + const void *val = param_get_value_ptr(param); + param_hash = crc32part((const uint8_t*)name, strlen(name), param_hash); + param_hash = crc32part(val, sizeof(union param_value_u), param_hash); + } + + param_unlock(); + + return param_hash; +} diff --git a/src/modules/systemlib/param/param.h b/src/modules/systemlib/param/param.h index d7cf666a71..f8334361f1 100644 --- a/src/modules/systemlib/param/param.h +++ b/src/modules/systemlib/param/param.h @@ -333,6 +333,13 @@ __EXPORT int param_save_default(void); */ __EXPORT int param_load_default(void); +/** + * Generate the hash of all parameters and their values + * + * @return CRC32 hash of all param_ids and values + */ +__EXPORT uint32_t param_hash_check(void); + /* * Macros creating static parameter definitions. * From 8a4699c65641388c7dee5aeb3adc6e90b33869ff Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Mon, 12 Oct 2015 15:26:11 -0400 Subject: [PATCH 378/389] Fix style --- src/modules/systemlib/param/param.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index d9976ccdaa..f606f20702 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -1049,9 +1049,10 @@ uint32_t param_hash_check(void) if (!param_used(param)) { continue; } + const char *name = param_name(param); const void *val = param_get_value_ptr(param); - param_hash = crc32part((const uint8_t*)name, strlen(name), param_hash); + param_hash = crc32part((const uint8_t *)name, strlen(name), param_hash); param_hash = crc32part(val, sizeof(union param_value_u), param_hash); } From 51e9f686e340b130d03adba859d25ef6b2a837ed Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 12 Oct 2015 15:06:20 -0700 Subject: [PATCH 379/389] Fix MAV_FRAME_MISSION usage --- src/modules/mavlink/mavlink_mission.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modules/mavlink/mavlink_mission.cpp b/src/modules/mavlink/mavlink_mission.cpp index 883fcd0f34..7e9f546d26 100644 --- a/src/modules/mavlink/mavlink_mission.cpp +++ b/src/modules/mavlink/mavlink_mission.cpp @@ -779,13 +779,12 @@ MavlinkMissionManager::parse_mavlink_mission_item(const mavlink_mission_item_t * mission_item->altitude_is_relative = true; break; - case MAV_FRAME_LOCAL_NED: - case MAV_FRAME_LOCAL_ENU: - return MAV_MISSION_UNSUPPORTED_FRAME; - case MAV_FRAME_MISSION: + // This is a mission item with no coordinate + break; + default: - return MAV_MISSION_ERROR; + return MAV_MISSION_UNSUPPORTED_FRAME; } switch (mavlink_mission_item->command) { From 96d90c0fe683f7ac3b22c3eb91712b20a32ae364 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 13 Oct 2015 10:07:05 +0200 Subject: [PATCH 380/389] Improve HIL data input --- src/modules/mavlink/mavlink_receiver.cpp | 32 +++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index b67641679e..88123b3e45 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -1306,16 +1306,14 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) float dt; - if (_hil_last_frame == 0 || timestamp - _hil_last_frame > 0.1f) { + if (_hil_last_frame == 0 || + (imu.time_usec - _hil_last_frame) > (0.1f * 1e6f) || + (_hil_last_frame >= imu.time_usec)) { dt = 0.01f; /* default to 100 Hz */ } else { - dt = (timestamp - _hil_last_frame) / 1e6f; - } - _hil_last_frame = timestamp; - - if (dt < 0.001f) { - dt = 0.001f; + dt = (imu.time_usec - _hil_last_frame) / 1e6f; } + _hil_last_frame = imu.time_usec; /* airspeed */ { @@ -1432,12 +1430,12 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) hil_sensors.gyro_raw[0] = imu.xgyro * 1000.0f; hil_sensors.gyro_raw[1] = imu.ygyro * 1000.0f; hil_sensors.gyro_raw[2] = imu.zgyro * 1000.0f; - hil_sensors.gyro_rad_s[0] = imu.xgyro; + hil_sensors.gyro_rad_s[0] = ((imu.xgyro * dt + _hil_prev_gyro[0]) / 2.0f) / dt; hil_sensors.gyro_rad_s[1] = imu.ygyro; hil_sensors.gyro_rad_s[2] = imu.zgyro; - hil_sensors.gyro_integral_rad[0] = hil_sensors.gyro_rad_s[0] * dt; - hil_sensors.gyro_integral_rad[1] = hil_sensors.gyro_rad_s[1] * dt; - hil_sensors.gyro_integral_rad[2] = hil_sensors.gyro_rad_s[2] * dt; + hil_sensors.gyro_integral_rad[0] = (hil_sensors.gyro_rad_s[0] * dt + _hil_prev_gyro[0]) / 2.0f; + hil_sensors.gyro_integral_rad[1] = (hil_sensors.gyro_rad_s[1] * dt + _hil_prev_gyro[1]) / 2.0f; + hil_sensors.gyro_integral_rad[2] = (hil_sensors.gyro_rad_s[2] * dt + _hil_prev_gyro[2]) / 2.0f; memcpy(&_hil_prev_gyro[0], &hil_sensors.gyro_integral_rad[0], sizeof(_hil_prev_gyro)); hil_sensors.gyro_integral_dt[0] = dt * 1e6f; hil_sensors.gyro_timestamp[0] = timestamp; @@ -1446,12 +1444,12 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg) hil_sensors.accelerometer_raw[0] = imu.xacc / mg2ms2; hil_sensors.accelerometer_raw[1] = imu.yacc / mg2ms2; hil_sensors.accelerometer_raw[2] = imu.zacc / mg2ms2; - hil_sensors.accelerometer_m_s2[0] = imu.xacc; - hil_sensors.accelerometer_m_s2[1] = imu.yacc; - hil_sensors.accelerometer_m_s2[2] = imu.zacc; - hil_sensors.accelerometer_integral_m_s[0] = (hil_sensors.accelerometer_m_s2[0] * dt + _hil_prev_accel[0]) / 2.0f; - hil_sensors.accelerometer_integral_m_s[1] = (hil_sensors.accelerometer_m_s2[1] * dt + _hil_prev_accel[1]) / 2.0f; - hil_sensors.accelerometer_integral_m_s[2] = (hil_sensors.accelerometer_m_s2[2] * dt + _hil_prev_accel[2]) / 2.0f; + hil_sensors.accelerometer_m_s2[0] = ((imu.xacc * dt + _hil_prev_accel[0]) / 2.0f) / dt; + hil_sensors.accelerometer_m_s2[1] = ((imu.yacc * dt + _hil_prev_accel[1]) / 2.0f) / dt; + hil_sensors.accelerometer_m_s2[2] = (((imu.zacc + 9.80665f) * dt + _hil_prev_accel[2]) / 2.0f) / dt - 9.80665f; + hil_sensors.accelerometer_integral_m_s[0] = (imu.xacc * dt + _hil_prev_accel[0]) / 2.0f; + hil_sensors.accelerometer_integral_m_s[1] = (imu.yacc * dt + _hil_prev_accel[1]) / 2.0f; + hil_sensors.accelerometer_integral_m_s[2] = ((imu.zacc + 9.80665f) * dt + _hil_prev_accel[2]) / 2.0f; memcpy(&_hil_prev_accel[0], &hil_sensors.accelerometer_integral_m_s[0], sizeof(_hil_prev_accel)); hil_sensors.accelerometer_integral_dt[0] = dt * 1e6f; hil_sensors.accelerometer_mode[0] = 0; // TODO what is this? From 76dcd8b7173df2ac5cd086028e1ce51c35eeec3c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 13 Oct 2015 18:56:33 +0200 Subject: [PATCH 381/389] EKF: Better output --- .../ekf_att_pos_estimator_main.cpp | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp index 295a597fcd..587d22bac4 100644 --- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp +++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp @@ -1180,11 +1180,12 @@ void AttitudePositionEstimatorEKF::print_status() PX4_INFO("states (terrain) [22]: %8.4f", (double)_ekf->states[22]); } else { - PX4_INFO("states (wind) [13-14]: %8.4f, %8.4f", (double)_ekf->states[13], (double)_ekf->states[14]); - PX4_INFO("states (earth mag) [15-17]: %8.4f, %8.4f, %8.4f", (double)_ekf->states[15], (double)_ekf->states[16], - (double)_ekf->states[17]); - PX4_INFO("states (body mag) [18-20]: %8.4f, %8.4f, %8.4f", (double)_ekf->states[18], (double)_ekf->states[19], - (double)_ekf->states[20]); + PX4_INFO("states (accel offs) [13]: %8.4f", (double)_ekf->states[13]); + PX4_INFO("states (wind) [14-15]: %8.4f, %8.4f", (double)_ekf->states[14], (double)_ekf->states[15]); + PX4_INFO("states (earth mag) [16-18]: %8.4f, %8.4f, %8.4f", (double)_ekf->states[16], (double)_ekf->states[17], + (double)_ekf->states[18]); + PX4_INFO("states (mag bias) [19-21]: %8.4f, %8.4f, %8.4f", (double)_ekf->states[19], (double)_ekf->states[20], + (double)_ekf->states[21]); } PX4_INFO("states: %s %s %s %s %s %s %s %s %s %s", @@ -1263,7 +1264,7 @@ void AttitudePositionEstimatorEKF::pollData() } else { _ekf->dVelIMU.x = 0.5f * (_ekf->accel.x + _sensor_combined.accelerometer_m_s2[_accel_main * 3 + 0]); _ekf->dVelIMU.y = 0.5f * (_ekf->accel.y + _sensor_combined.accelerometer_m_s2[_accel_main * 3 + 1]); - _ekf->dVelIMU.z = 0.5f * (_ekf->accel.z + _sensor_combined.accelerometer_m_s2[_accel_main * 3 + 2]); + _ekf->dVelIMU.z = 0.5f * (_ekf->accel.z + _sensor_combined.accelerometer_m_s2[_accel_main * 3 + 2]) + 9.80665f; } _ekf->accel.x = _sensor_combined.accelerometer_m_s2[_accel_main * 3 + 0]; @@ -1331,8 +1332,8 @@ void AttitudePositionEstimatorEKF::pollData() // leave this in as long as larger improvements are still being made. #if 0 - float deltaTIntegral = (_sensor_combined.gyro_integral_dt) / 1e6f; - float deltaTIntAcc = (_sensor_combined.accelerometer_integral_dt) / 1e6f; + float deltaTIntegral = (_sensor_combined.gyro_integral_dt[0]) / 1e6f; + float deltaTIntAcc = (_sensor_combined.accelerometer_integral_dt[0]) / 1e6f; static unsigned dtoverflow5 = 0; static unsigned dtoverflow10 = 0; @@ -1343,13 +1344,21 @@ void AttitudePositionEstimatorEKF::pollData() (double)deltaT, (double)deltaTIntegral, (double)deltaTIntAcc, dtoverflow5, dtoverflow10); - warnx("DRV: dang: %8.4f %8.4f dvel: %8.4f %8.4f", + warnx("EKF: dang: %8.4f %8.4f dvel: %8.4f %8.4f %8.4f", (double)_ekf->dAngIMU.x, (double)_ekf->dAngIMU.z, - (double)_ekf->dVelIMU.x, (double)_ekf->dVelIMU.z); + (double)_ekf->dVelIMU.x, (double)_ekf->dVelIMU.y, (double)_ekf->dVelIMU.z); - warnx("EKF: dang: %8.4f %8.4f dvel: %8.4f %8.4f", + warnx("INT: dang: %8.4f %8.4f dvel: %8.4f %8.4f %8.4f", + (double)(_sensor_combined.gyro_integral_rad[0]), (double)(_sensor_combined.gyro_integral_rad[2]), + (double)(_sensor_combined.accelerometer_integral_m_s[0]), + (double)(_sensor_combined.accelerometer_integral_m_s[1]), + (double)(_sensor_combined.accelerometer_integral_m_s[2])); + + warnx("DRV: dang: %8.4f %8.4f dvel: %8.4f %8.4f %8.4f", (double)(_sensor_combined.gyro_rad_s[0] * deltaT), (double)(_sensor_combined.gyro_rad_s[2] * deltaT), - (double)(_sensor_combined.accelerometer_m_s2[0] * deltaT), (double)(_sensor_combined.accelerometer_m_s2[2] * deltaT)); + (double)(_sensor_combined.accelerometer_m_s2[0] * deltaT), + (double)(_sensor_combined.accelerometer_m_s2[1] * deltaT), + (double)((_sensor_combined.accelerometer_m_s2[2] + 9.8665f) * deltaT)); lastprint = hrt_absolute_time(); } From 2c1e999e1a5859a31199e0fe4cb6a8e3f6e20111 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sat, 10 Oct 2015 23:36:40 -0400 Subject: [PATCH 382/389] cmake remove rsync dep --- cmake/nuttx/px4_impl_nuttx.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 13d120af26..5995a64157 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -213,7 +213,9 @@ function(px4_nuttx_add_export) # copy add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp COMMAND ${MKDIR} -p ${CMAKE_BINARY_DIR}/${CONFIG} - COMMAND rsync -a --exclude=.git ${CMAKE_SOURCE_DIR}/NuttX/ ${nuttx_src}/ + COMMAND ${RM} -rf ${nuttx_src} + COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src} + COMMAND ${RM} -rf ${nuttx_src}/.git COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp DEPENDS ${DEPENDS}) add_custom_target(__nuttx_copy_${CONFIG} From e8fd711a5c721230ac829db0904bc3d4f00ab455 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 12 Oct 2015 10:47:09 -0400 Subject: [PATCH 383/389] uorb generate interally set required paths --- Tools/px_generate_uorb_topic_headers.py | 5 +++++ cmake/common/px4_base.cmake | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Tools/px_generate_uorb_topic_headers.py b/Tools/px_generate_uorb_topic_headers.py index 3c9f5379c6..7ed0b3af19 100755 --- a/Tools/px_generate_uorb_topic_headers.py +++ b/Tools/px_generate_uorb_topic_headers.py @@ -43,6 +43,11 @@ import shutil import filecmp import argparse +import sys +px4_tools_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(px4_tools_dir + "/genmsg/src") +sys.path.append(px4_tools_dir + "/gencpp/src") + try: import genmsg.template_tools except ImportError as e: diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 257254ba43..65e96055a7 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -330,7 +330,6 @@ function(px4_generate_messages) if(NOT VERBOSE) set(QUIET "-q") endif() - set(PYTHONPATH "${CMAKE_SOURCE_DIR}/Tools/genmsg/src:${CMAKE_SOURCE_DIR}/Tools/gencpp/src:$ENV{PYTHONPATH}") set(msg_out_path ${CMAKE_BINARY_DIR}/src/modules/uORB/topics) set(msg_list) foreach(msg_file ${MSG_FILES}) @@ -342,7 +341,7 @@ function(px4_generate_messages) list(APPEND msg_files_out ${msg_out_path}/${msg}.h) endforeach() add_custom_command(OUTPUT ${msg_files_out} - COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} Tools/px_generate_uorb_topic_headers.py ${QUIET} -d msg @@ -363,7 +362,7 @@ function(px4_generate_messages) list(APPEND msg_multi_files_out ${msg_multi_out_path}/px4_${msg}.h) endforeach() add_custom_command(OUTPUT ${msg_multi_files_out} - COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} Tools/px_generate_uorb_topic_headers.py ${QUIET} -d msg @@ -425,7 +424,7 @@ function(px4_add_upload) endif() px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",") add_custom_target(${OUT} - COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${BUNDLE} DEPENDS ${BUNDLE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} From 1bfc919c83e93eddcd333a606a3da6df3b0f0dbd Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 12 Oct 2015 11:10:13 -0400 Subject: [PATCH 384/389] cmake generate MSYS Makefiles on windows --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2473eeff43..2505c75711 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,13 @@ ifdef NINJA_BUILD PX4_MAKE = ninja PX4_MAKE_ARGS = else - PX4_CMAKE_GENERATOR ?= "Unix Makefiles" + +ifdef SYSTEMROOT + # Windows + PX4_CMAKE_GENERATOR ?= "MSYS Makefiles" +else + PX4_CMAKE_GENERATOR ?= "Unix Makefiles" +endif PX4_MAKE = make PX4_MAKE_ARGS = -j$(j) --no-print-directory endif From 4e4d10d8b9b1b814729e529a461a37e284f8f0f2 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 12 Oct 2015 20:51:38 -0400 Subject: [PATCH 385/389] generate_listener.py don't depend on platform dependant slash --- Tools/generate_listener.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/generate_listener.py b/Tools/generate_listener.py index 1ebb316baf..d32bbc0f9c 100755 --- a/Tools/generate_listener.py +++ b/Tools/generate_listener.py @@ -1,6 +1,7 @@ #!/usr/bin/python import glob +import os import sys # This script is run from Build/_default.build/$(PX4_BASE)/Firmware/src/systemcmds/topic_listener @@ -48,7 +49,9 @@ for index,m in enumerate(raw_messages): temp_list.append(("int8",line.split(' ')[1].split('\t')[0].split('\n')[0])) f.close() - messages.append(m.split('/')[-1].split('.')[0]) + (m_head, m_tail) = os.path.split(m) + messages.append(m_tail.split('.')[0]) + #messages.append(m.split('/')[-1].split('.')[0]) message_elements.append(temp_list) num_messages = len(messages); From 3f0653e824949f5e991bc279d9f1f4749a7914c0 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 13 Oct 2015 00:47:58 -0400 Subject: [PATCH 386/389] bin_to_obj.py don't use full path to visibility.h --- cmake/common/px4_base.cmake | 4 +++- cmake/nuttx/bin_to_obj.py | 4 +++- cmake/nuttx/px4_impl_nuttx.cmake | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 65e96055a7..fe07a67666 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -535,6 +535,7 @@ function(px4_add_common_flags) -ffunction-sections -fdata-sections ) + if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") list(APPEND optimization_flags -fno-strength-reduce @@ -565,6 +566,7 @@ function(px4_add_common_flags) set(cxx_warnings -Wno-missing-field-initializers ) + set(cxx_compile_flags -g -fno-exceptions @@ -577,7 +579,7 @@ function(px4_add_common_flags) set(visibility_flags -fvisibility=hidden - "-include ${CMAKE_SOURCE_DIR}/src/include/visibility.h" + -include visibility.h ) set(added_c_flags diff --git a/cmake/nuttx/bin_to_obj.py b/cmake/nuttx/bin_to_obj.py index 64ba864295..4b99a6c29b 100755 --- a/cmake/nuttx/bin_to_obj.py +++ b/cmake/nuttx/bin_to_obj.py @@ -12,6 +12,7 @@ from subprocess import PIPE parser = argparse.ArgumentParser(description='Convert bin to obj.') parser.add_argument('--c_flags', required=True) parser.add_argument('--c_compiler', required=True) +parser.add_argument('--include_path', required=True) parser.add_argument('--nm', required=True) parser.add_argument('--ld', required=True) parser.add_argument('--objcopy', required=True) @@ -23,6 +24,7 @@ args = parser.parse_args() in_bin = args.bin c_flags = args.c_flags c_compiler = args.c_compiler +include_path = args.include_path nm = args.nm ld = args.ld obj = args.obj @@ -46,7 +48,7 @@ def run_cmd(cmd, d): return stdout # do compile -run_cmd("{c_compiler:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o", +run_cmd("{c_compiler:s} -I{include_path:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o", locals()) # link diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 5995a64157..2586478383 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -349,6 +349,7 @@ function(px4_nuttx_add_romfs) #COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND ${PYTHON_EXECUTABLE} ${bin_to_obj} --ld ${LD} --c_flags ${CMAKE_C_FLAGS} + --include_path "${CMAKE_SOURCE_DIR}/src/include" --c_compiler ${CMAKE_C_COMPILER} --nm ${NM} --objcopy ${OBJCOPY} --obj romfs.o From a45fe6343007dc7e0161f4038e460f9c74011757 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 13 Oct 2015 01:07:37 -0400 Subject: [PATCH 387/389] bin_to_obj.py fix windows regex size match --- cmake/nuttx/bin_to_obj.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/nuttx/bin_to_obj.py b/cmake/nuttx/bin_to_obj.py index 4b99a6c29b..80ce80d741 100755 --- a/cmake/nuttx/bin_to_obj.py +++ b/cmake/nuttx/bin_to_obj.py @@ -57,9 +57,10 @@ run_cmd("{ld:s} -r -o {obj:s}.bin.o {obj:s}.c.o -b binary {in_bin:s}", # get size of image stdout = run_cmd("{nm:s} -p --radix=x {obj:s}.bin.o", locals()) -re_string = r"^([0-9A-F-a-f]+) .*{sym:s}_size\n".format(**locals()) +re_string = r"^([0-9A-Fa-f]+) .*{sym:s}_size".format(**locals()) re_size = re.compile(re_string, re.MULTILINE) size_match = re.search(re_size, stdout.decode()) + try: size = size_match.group(1) except AttributeError as e: @@ -78,7 +79,7 @@ with open('{obj:s}.c'.format(**locals()), 'w') as f: **locals())) # do compile -run_cmd("{c_compiler:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o", +run_cmd("{c_compiler:s} -I{include_path:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o", locals()) # link From cc3695d0b73be26bf7b4f151b48736671eb7f513 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 13 Oct 2015 01:18:33 -0400 Subject: [PATCH 388/389] uavcan manually add src/include to include path --- src/modules/uavcan/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/uavcan/CMakeLists.txt b/src/modules/uavcan/CMakeLists.txt index 38bf0bc111..476acc5dd4 100644 --- a/src/modules/uavcan/CMakeLists.txt +++ b/src/modules/uavcan/CMakeLists.txt @@ -53,7 +53,7 @@ set(uavcan_definitions -DUAVCAN_STM32_${OS_UPPER}=1 -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 ) -set(uavcan_extra_flags ${uavcan_definitions}) +set(uavcan_extra_flags ${uavcan_definitions} -I${CMAKE_SOURCE_DIR}/src/include) if (${OS} STREQUAL "nuttx") set(uavcan_platform stm32) From 5865dc64348b9b2b7bc514965ba275937bc28263 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 14 Oct 2015 01:33:08 -0400 Subject: [PATCH 389/389] cmake add libuavcan as subdirectory -move uavcan submodule to src/modules/uavcan/libuavcan -adding libuavcan as a subdirectory simplifies inheriting all compile flags and include paths --- .gitmodules | 4 +- CMakeLists.txt | 2 +- Makefile | 4 +- Tools/check_code_style.sh | 2 +- cmake/common/px4_base.cmake | 4 +- cmake/configs/nuttx_px4fmu-v2_default.cmake | 4 +- nuttx-configs/px4fmu-v2/nsh/defconfig | 2 + src/lib/uavcan | 1 - src/modules/uavcan/CMakeLists.txt | 76 ++++++--------------- src/modules/uavcan/libuavcan | 1 + 10 files changed, 32 insertions(+), 68 deletions(-) delete mode 160000 src/lib/uavcan create mode 160000 src/modules/uavcan/libuavcan diff --git a/.gitmodules b/.gitmodules index cb9a6ccf05..2820e68539 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,8 +4,8 @@ [submodule "NuttX"] path = NuttX url = git://github.com/PX4/NuttX.git -[submodule "src/lib/uavcan"] - path = src/lib/uavcan +[submodule "src/modules/uavcan/libuavcan"] + path = src/modules/uavcan/libuavcan url = git://github.com/UAVCAN/libuavcan.git [submodule "Tools/genmsg"] path = Tools/genmsg diff --git a/CMakeLists.txt b/CMakeLists.txt index 948959ca32..6aec7f2e0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -224,7 +224,7 @@ px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest") -px4_add_git_submodule(TARGET git_uavcan PATH "src/lib/uavcan") +px4_add_git_submodule(TARGET git_uavcan PATH "src/modules/uavcan/libuavcan") px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen") px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal") diff --git a/Makefile b/Makefile index 2505c75711..a507be0826 100644 --- a/Makefile +++ b/Makefile @@ -177,9 +177,9 @@ distclean: clean @cd NuttX @git clean -d -f -x @cd .. - @cd src/lib/uavcan + @cd src/modules/uavcan/libuavcan @git clean -d -f -x - @cd ../../.. + @cd ../../../.. # targets handled by cmake cmake_targets = test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak libuavcan diff --git a/Tools/check_code_style.sh b/Tools/check_code_style.sh index db140fca45..bc59128317 100755 --- a/Tools/check_code_style.sh +++ b/Tools/check_code_style.sh @@ -25,7 +25,7 @@ for fn in $(find src/examples \ -path './NuttX' -prune -o \ -path './src/lib/eigen' -prune -o \ -path './src/lib/mathlib/CMSIS' -prune -o \ - -path './src/lib/uavcan' -prune -o \ + -path './src/modules/uavcan/libuavcan' -prune -o \ -path './src/modules/attitude_estimator_ekf/codegen' -prune -o \ -path './src/modules/ekf_att_pos_estimator' -prune -o \ -path './src/modules/sdlog2' -prune -o \ diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index fe07a67666..9a0b17b7a2 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -138,8 +138,7 @@ function(px4_add_git_submodule) string(REPLACE "/" "_" NAME ${PATH}) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git_${NAME}.stamp WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND git submodule init ${PATH} - COMMAND git submodule update -f ${PATH} + COMMAND git submodule update --init --recursive -f ${PATH} COMMAND touch ${CMAKE_BINARY_DIR}/git_${NAME}.stamp ) add_custom_target(${TARGET} @@ -544,7 +543,6 @@ function(px4_add_common_flags) endif() set(c_warnings - -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 89910bbd95..a242f4f736 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -168,8 +168,8 @@ set(config_io_board set(config_extra_libs ${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a - libuavcan.a - libuavcan_stm32_driver.a + uavcan + uavcan_stm32_driver ) set(config_io_extra_libs diff --git a/nuttx-configs/px4fmu-v2/nsh/defconfig b/nuttx-configs/px4fmu-v2/nsh/defconfig index db7c41dae0..871b214f49 100644 --- a/nuttx-configs/px4fmu-v2/nsh/defconfig +++ b/nuttx-configs/px4fmu-v2/nsh/defconfig @@ -1064,3 +1064,5 @@ CONFIG_SYSTEM_SYSINFO=y # # USB Monitor # + +CONFIG_NSOCKET_DESCRIPTORS=0 diff --git a/src/lib/uavcan b/src/lib/uavcan deleted file mode 160000 index 86c3397b1b..0000000000 --- a/src/lib/uavcan +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 86c3397b1b423eeed86f21c8b08c8acfbd5add96 diff --git a/src/modules/uavcan/CMakeLists.txt b/src/modules/uavcan/CMakeLists.txt index 476acc5dd4..3c7ad32998 100644 --- a/src/modules/uavcan/CMakeLists.txt +++ b/src/modules/uavcan/CMakeLists.txt @@ -31,65 +31,30 @@ # ############################################################################ -# uavcan project -set(uavcan_c_flags ${c_flags}) -list(REMOVE_ITEM uavcan_c_flags -std=gnu++0x -D__CUSTOM_FILE_IO__) -set(uavcan_cxx_flags ${cxx_flags}) -list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -Wundef -Werror -D__CUSTOM_FILE_IO__) -set(uavcan_deps git_uavcan) -set(uavcan_platform generic) - -set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) +set(UAVCAN_USE_CPP03 ON CACHE BOOL "uavcan cpp03") +set(UAVCAN_PLATFORM stm32 CACHE STRING "uavcan platform") string(TOUPPER "${OS}" OS_UPPER) - -set(uavcan_definitions - -DUAVCAN_NO_ASSERTIONS - -DUAVCAN_STM32_NUM_IFACES=2 - -DUAVCAN_USE_EXTERNAL_SNPRINT - -DUAVCAN_MEM_POOL_BLOCK_SIZE=48 - -DUAVCAN_MAX_NETWORK_SIZE_HINT=16 - -DUAVCAN_STM32_TIMER_NUMBER=5 - -DUAVCAN_STM32_${OS_UPPER}=1 - -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 - ) -set(uavcan_extra_flags ${uavcan_definitions} -I${CMAKE_SOURCE_DIR}/src/include) - -if (${OS} STREQUAL "nuttx") - set(uavcan_platform stm32) - list(APPEND uavcan_extra_flags - -I${nuttx_export_dir}/include - -I${nuttx_export_dir}/include/cxx - -I${nuttx_export_dir}/arch/chip - -I${nuttx_export_dir}/arch/common - ) - list(APPEND uavcan_deps nuttx_export_${BOARD}) -endif() - -list(APPEND uavcan_c_flags ${uavcan_extra_flags}) -list(APPEND uavcan_cxx_flags ${uavcan_extra_flags}) - -px4_join(OUT uavcan_c_flags LIST "${uavcan_c_flags}" GLUE " ") -px4_join(OUT uavcan_cxx_flags LIST "${uavcan_cxx_flags}" GLUE " ") - -externalproject_add(libuavcan - DEPENDS ${uavcan_deps} - DOWNLOAD_COMMAND "" - UPDATE_COMMAND git submodule update --init - LOG_INSTALL 1 - SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan - CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} +add_definitions( + -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 + -DUAVCAN_MAX_NETWORK_SIZE_HINT=16 + -DUAVCAN_MEM_POOL_BLOCK_SIZE=48 + -DUAVCAN_NO_ASSERTIONS + -DUAVCAN_PLATFORM=stm32 + -DUAVCAN_STM32_${OS_UPPER}=1 + -DUAVCAN_STM32_NUM_IFACES=2 + -DUAVCAN_STM32_TIMER_NUMBER=5 -DUAVCAN_USE_CPP03=ON - -DUAVCAN_PLATFORM=${uavcan_platform} - -DUAVCAN_OS=${OS} - -DCMAKE_CXX_FLAGS=${uavcan_cxx_flags} - -DCMAKE_C_FLAGS=${uavcan_c_flags} - -DCMAKE_INSTALL_PREFIX=${ep_base}/Install -) + -DUAVCAN_USE_EXTERNAL_SNPRINT + ) -string(TOUPPER ${OS} OS_UPPER) +add_subdirectory(libuavcan EXCLUDE_FROM_ALL) +add_dependencies(uavcan platforms__nuttx) -add_definitions(${uavcan_definitions}) +include_directories(libuavcan/libuavcan/include) +include_directories(libuavcan/libuavcan/include/dsdlc_generated) +include_directories(libuavcan/libuavcan_drivers/posix/include) +include_directories(libuavcan/libuavcan_drivers/stm32/driver/include) px4_add_module( MODULE modules__uavcan @@ -100,7 +65,6 @@ px4_add_module( -Wno-deprecated-declarations -O3 SRCS - # Main uavcan_main.cpp uavcan_servers.cpp @@ -117,7 +81,7 @@ px4_add_module( DEPENDS platforms__common - libuavcan + uavcan ) ## vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/uavcan/libuavcan b/src/modules/uavcan/libuavcan new file mode 160000 index 0000000000..0643879922 --- /dev/null +++ b/src/modules/uavcan/libuavcan @@ -0,0 +1 @@ +Subproject commit 0643879922239930cf7482777356f06891c26616