mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 10:43:34 +08:00
Merged master to beta
This commit is contained in:
@@ -17,7 +17,9 @@
|
||||
.~lock.*
|
||||
Archives/*
|
||||
Build/*
|
||||
Testing/
|
||||
build/*
|
||||
build_*/
|
||||
core
|
||||
cscope.out
|
||||
Firmware.sublime-workspace
|
||||
@@ -52,3 +54,6 @@ src/platforms/posix/px4_messages/
|
||||
src/platforms/posix-arm/px4_messages/
|
||||
src/platforms/qurt/px4_messages/
|
||||
ROMFS/*/*/rc.autostart
|
||||
rootfs/
|
||||
*.autosave
|
||||
CMakeLists.txt.user
|
||||
|
||||
+11
-8
@@ -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
|
||||
@@ -13,12 +13,15 @@
|
||||
[submodule "Tools/gencpp"]
|
||||
path = Tools/gencpp
|
||||
url = https://github.com/ros/gencpp.git
|
||||
[submodule "unittests/gtest"]
|
||||
path = unittests/gtest
|
||||
url = https://github.com/sjwilks/gtest.git
|
||||
[submodule "src/lib/eigen"]
|
||||
path = src/lib/eigen
|
||||
url = https://github.com/PX4/eigen.git
|
||||
[submodule "src/lib/dspal"]
|
||||
path = src/lib/dspal
|
||||
url = https://github.com/mcharleb/dspal.git
|
||||
[submodule "Tools/jMAVSim"]
|
||||
path = Tools/jMAVSim
|
||||
url = https://github.com/PX4/jMAVSim.git
|
||||
[submodule "Tools/sitl_gazebo"]
|
||||
path = Tools/sitl_gazebo
|
||||
url = https://github.com/PX4/sitl_gazebo.git
|
||||
[submodule "unittests/googletest"]
|
||||
path = unittests/googletest
|
||||
url = https://github.com/google/googletest.git
|
||||
|
||||
+72
-49
@@ -3,8 +3,14 @@
|
||||
|
||||
language: cpp
|
||||
|
||||
# use travis-ci docker based infrastructure
|
||||
sudo: false
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- os: linux
|
||||
sudo: false
|
||||
- os: osx
|
||||
osx_image: beta-xcode6.3
|
||||
sudo: true
|
||||
|
||||
cache:
|
||||
directories:
|
||||
@@ -15,16 +21,18 @@ addons:
|
||||
sources:
|
||||
- kubuntu-backports
|
||||
- ubuntu-toolchain-r-test
|
||||
- george-edison55-precise-backports
|
||||
packages:
|
||||
- build-essential
|
||||
- ccache
|
||||
- cmake
|
||||
- clang-3.5
|
||||
- cmake
|
||||
- g++-4.8
|
||||
- gcc-4.8
|
||||
- genromfs
|
||||
- libc6-i386
|
||||
- libncurses5-dev
|
||||
- ninja-build
|
||||
- python-argparse
|
||||
- python-empy
|
||||
- python-serial
|
||||
@@ -32,21 +40,43 @@ 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
|
||||
&& git clone git://github.com/PX4/CI-Tools.git
|
||||
&& ./CI-Tools/s3cmd-configure
|
||||
&& 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 astyle
|
||||
&& brew install gcc-arm-none-eabi
|
||||
&& brew install genromfs
|
||||
&& brew install kconfig-frontends
|
||||
&& brew install ninja
|
||||
&& 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++
|
||||
- ln -s /usr/bin/ccache ~/bin/arm-none-eabi-gcc
|
||||
- ln -s /usr/bin/ccache ~/bin/arm-none-eabi-size
|
||||
- ln -s /usr/bin/ccache ~/bin/arm-none-eabi-objcopy
|
||||
- ln -s /usr/bin/ccache ~/bin/clang++
|
||||
- ln -s /usr/bin/ccache ~/bin/clang++-3.4
|
||||
- ln -s /usr/bin/ccache ~/bin/clang++-3.5
|
||||
@@ -56,12 +86,10 @@ 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:
|
||||
- NINJA_BUILD=1
|
||||
# AWS KEY: $PX4_AWS_KEY
|
||||
- secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA="
|
||||
# AWS SECRET: $PX4_AWS_SECRET
|
||||
@@ -70,41 +98,36 @@ 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 -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
|
||||
- echo 'Building POSIX Firmware..' && make posix_sitl_simple
|
||||
- echo 'Running Tests..' && make posix_sitl_simple test
|
||||
- echo 'Building UAVCAN node firmware..' && git clone https://github.com/thiemar/vectorcontrol
|
||||
- cd vectorcontrol
|
||||
- BOARD=s2740vc_1_0 make && BOARD=px4esc_1_6 make
|
||||
- cd ..
|
||||
- mkdir -p ROMFS/px4fmu_common/uavcan/fw/com.thiemar.s2740vc-v1/1.0/
|
||||
- mkdir -p ROMFS/px4fmu_common/uavcan/fw/org.pixhawk.px4esc-v1/1.0/
|
||||
- cp vectorcontrol/firmware/com.thiemar.s2740vc-v1-1.0.*.bin ROMFS/px4fmu_common/uavcan/fw/com.thiemar.s2740vc-v1/1.0/.
|
||||
- cp vectorcontrol/firmware/org.pixhawk.px4esc-v1-1.0.*.bin ROMFS/px4fmu_common/uavcan/fw/org.pixhawk.px4esc-v1/1.0/.
|
||||
- echo 'Building NuttX px4fmu-v1 Firmware..' && make px4fmu-v1_default
|
||||
- echo 'Building NuttX px4fmu-v2 Firmware..' && make px4fmu-v2_default
|
||||
- echo 'Running Tests..' && make px4fmu-v2_default test
|
||||
|
||||
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
|
||||
after_success:
|
||||
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
|
||||
cp build_px4fmu-v1_default/src/firmware/nuttx/nuttx-px4fmu-v1-default.px4 px4fmu-v1_default.px4
|
||||
&& cp build_px4fmu-v2_default/src/firmware/nuttx/nuttx-px4fmu-v2-default.px4 px4fmu-v2_default.px4
|
||||
&& zip Firmware.zip px4fmu-v1_default.px4 px4fmu-v2_default.px4
|
||||
&& ./CI-Tools/s3cmd-put px4fmu-v1_default.px4 px4fmu-v2_default.px4 build_px4fmu-v2_default/parameters.xml build_px4fmu-v2_default/airframes.xml CI-Tools/directory/index.html Firmware/$TRAVIS_BRANCH/
|
||||
&& ./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/
|
||||
&& ./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
|
||||
;
|
||||
fi
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
|
||||
+330
-317
@@ -1,332 +1,345 @@
|
||||
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)
|
||||
#=============================================================================
|
||||
# CMAKE CODING STANDARD FOR PX4
|
||||
#
|
||||
# Structure
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# * Common functions should be included in px_base.cmake.
|
||||
#
|
||||
# * OS/ board specific fucntions should be include in
|
||||
# px_impl_${OS}.cmake or px4_impl_${OS}_${BOARD}.cmake.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# * 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") <-- tag is referring to name of if
|
||||
# # do somthing
|
||||
# endif (${var} STREQUAL "1") <-- tag is referring to name of if
|
||||
#
|
||||
# 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
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# * Use px4_parse_function_args to parse functions and check for required
|
||||
# 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.
|
||||
#
|
||||
# * 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
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# * 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
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
## System dependencies are found with CMake's conventions
|
||||
# find_package(Boost REQUIRED COMPONENTS system)
|
||||
# Warning: Changing this modifies CMake's internal workings
|
||||
# and leads to wrong toolchain detection
|
||||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||
|
||||
#=============================================================================
|
||||
# parameters
|
||||
#
|
||||
|
||||
## 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()
|
||||
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})
|
||||
set(THREADS "4" CACHE STRING
|
||||
"number of threads to use for external build processes")
|
||||
set(DEBUG_PORT "/dev/ttyACM0" CACHE STRING "debugging port")
|
||||
|
||||
################################################
|
||||
## Declare ROS messages, services and actions ##
|
||||
################################################
|
||||
#=============================================================================
|
||||
# configuration
|
||||
#
|
||||
# must come before project to set toolchain
|
||||
|
||||
## 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 ...)
|
||||
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}")
|
||||
|
||||
## 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
|
||||
)
|
||||
message(STATUS "${target_name}")
|
||||
|
||||
## Generate services in the 'srv' folder
|
||||
# add_service_files(
|
||||
# FILES
|
||||
# Service1.srv
|
||||
# Service2.srv
|
||||
# )
|
||||
# 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
|
||||
|
||||
## Generate actions in the 'action' folder
|
||||
# add_action_files(
|
||||
# FILES
|
||||
# Action1.action
|
||||
# Action2.action
|
||||
# )
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
set(config_module "configs/${CONFIG}")
|
||||
include(${config_module})
|
||||
|
||||
## Generate added messages and services with any dependencies listed here
|
||||
generate_messages(
|
||||
DEPENDENCIES
|
||||
std_msgs
|
||||
gazebo_msgs
|
||||
)
|
||||
# cmake modules
|
||||
include(ExternalProject)
|
||||
|
||||
###################################
|
||||
## 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
|
||||
)
|
||||
# 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_module_list
|
||||
)
|
||||
foreach(conf ${px4_required_config})
|
||||
if(NOT DEFINED ${conf})
|
||||
message(FATAL_ERROR "cmake/${config_module} must define ${conf}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
###########
|
||||
## 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)
|
||||
#=============================================================================
|
||||
# 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
|
||||
cmake_policy(SET CMP0046 NEW) # no non-existent targets as dependencies
|
||||
cmake_policy(SET CMP0025 OLD) # still report AppleClang as Clang
|
||||
endif()
|
||||
if (NOT ${CMAKE_VERSION} VERSION_LESS 3.1.0)
|
||||
cmake_policy(SET CMP0054 NEW) # don't dereference quoted variables
|
||||
endif()
|
||||
|
||||
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")
|
||||
|
||||
#=============================================================================
|
||||
# programs
|
||||
#
|
||||
find_package(PythonInterp REQUIRED)
|
||||
|
||||
#=============================================================================
|
||||
# cmake modules
|
||||
#
|
||||
enable_testing()
|
||||
|
||||
#=============================================================================
|
||||
# check required toolchain variables
|
||||
#
|
||||
set(required_variables
|
||||
CMAKE_C_COMPILER_ID
|
||||
)
|
||||
foreach(var ${required_variables})
|
||||
if (NOT ${var})
|
||||
message(FATAL_ERROR "Toolchain/config must define ${var}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#=============================================================================
|
||||
# git
|
||||
#
|
||||
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/modules/uavcan/libuavcan")
|
||||
px4_add_git_submodule(TARGET git_nuttx PATH "NuttX")
|
||||
px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal")
|
||||
px4_add_git_submodule(TARGET git_jmavsim PATH "Tools/jMAVSim")
|
||||
px4_add_git_submodule(TARGET git_gazebo PATH "Tools/sitl_gazebo")
|
||||
|
||||
add_custom_target(submodule_clean
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git submodule deinit -f .
|
||||
COMMAND rm -rf .git/modules/*
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# misc targets
|
||||
#
|
||||
add_custom_target(check_format
|
||||
COMMAND Tools/check_code_style.sh
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(config
|
||||
COMMAND cmake-gui .
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# external libraries
|
||||
#
|
||||
px4_os_prebuild_targets(OUT prebuild_targets
|
||||
BOARD ${BOARD}
|
||||
THREADS ${THREADS})
|
||||
|
||||
#=============================================================================
|
||||
# build 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)
|
||||
|
||||
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
|
||||
)
|
||||
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
|
||||
#
|
||||
|
||||
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)
|
||||
# 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
|
||||
#
|
||||
set(module_libraries)
|
||||
foreach(module ${config_module_list})
|
||||
add_subdirectory(src/${module})
|
||||
px4_mangle_name(${module} mangled_name)
|
||||
list(APPEND module_libraries ${mangled_name})
|
||||
#message(STATUS "adding module: ${module}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(src/firmware/${OS})
|
||||
|
||||
if (config_io_board)
|
||||
add_subdirectory(src/modules/px4iofirmware)
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# generate git version
|
||||
#
|
||||
px4_create_git_hash_header(HEADER ${CMAKE_BINARY_DIR}/build_git_version.h)
|
||||
|
||||
#=============================================================================
|
||||
# packaging
|
||||
#
|
||||
# Important to having packaging at end of cmake file.
|
||||
#
|
||||
set(CPACK_PACKAGE_VERSION ${version})
|
||||
set(CPACK_PACKAGE_CONTACT ${package_contact})
|
||||
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 :
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
||||
# 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
|
||||
@@ -28,280 +29,178 @@
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Enforce the presence of the GIT repository
|
||||
#
|
||||
# Top-level Makefile for building PX4 firmware images.
|
||||
#
|
||||
|
||||
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))
|
||||
# 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
|
||||
|
||||
#
|
||||
# Get path and tool configuration
|
||||
#
|
||||
export PX4_BASE := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))/
|
||||
include $(PX4_BASE)makefiles/setup.mk
|
||||
|
||||
#
|
||||
# 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"
|
||||
CMAKE_VER := $(shell Tools/check_cmake.sh; echo $$?)
|
||||
ifneq ($(CMAKE_VER),0)
|
||||
$(warning Not a valid CMake version or CMake not installed.)
|
||||
$(warning On Ubuntu, install or upgrade via:)
|
||||
$(warning )
|
||||
$(warning 3rd party PPA:)
|
||||
$(warning sudo add-apt-repository ppa:george-edison55/cmake-3.x -y)
|
||||
$(warning sudo apt-get update)
|
||||
$(warning sudo apt-get install cmake)
|
||||
$(warning )
|
||||
$(warning Official website:)
|
||||
$(warning wget https://cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.sh)
|
||||
$(warning chmod +x cmake-3.3.2-Linux-x86_64.sh)
|
||||
$(warning sudo mkdir /opt/cmake-3.3.2)
|
||||
$(warning sudo ./cmake-3.3.2-Linux-x86_64.sh --prefix=/opt/cmake-3.3.2 --exclude-subdir)
|
||||
$(warning export PATH=/opt/cmake-3.3.2/bin:$$PATH)
|
||||
$(warning )
|
||||
$(error Fatal)
|
||||
endif
|
||||
|
||||
GIT_DESC_SHORT := $(shell echo $(GIT_DESC) | cut -c1-16)
|
||||
|
||||
# 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.
|
||||
#
|
||||
# Canned firmware configurations that we (know how to) build.
|
||||
# Example usage:
|
||||
#
|
||||
KNOWN_CONFIGS := $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/config_*.mk))))
|
||||
CONFIGS ?= $(KNOWN_CONFIGS)
|
||||
|
||||
# make px4fmu-v2_default (builds)
|
||||
# make px4fmu-v2_default upload (builds and uploads)
|
||||
# make px4fmu-v2_default test (builds and tests)
|
||||
#
|
||||
# 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)
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Debugging
|
||||
#
|
||||
MQUIET = --no-print-directory
|
||||
#MQUIET = --print-directory
|
||||
# explicity set default build target
|
||||
all: px4fmu-v2_default
|
||||
|
||||
################################################################################
|
||||
# No user-serviceable parts below
|
||||
################################################################################
|
||||
# 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))
|
||||
j ?= 4
|
||||
|
||||
#
|
||||
# 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)
|
||||
NINJA_BUILD := $(shell ninja --version 2>/dev/null)
|
||||
ifdef NINJA_BUILD
|
||||
PX4_CMAKE_GENERATOR ?= "Ninja"
|
||||
PX4_MAKE = ninja
|
||||
PX4_MAKE_ARGS =
|
||||
else
|
||||
export PX4_TARGET_OS=$@
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
# Functions
|
||||
# --------------------------------------------------------------------
|
||||
# describe how to build a cmake config
|
||||
define cmake-build
|
||||
+@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(PWD)/build_$@/Makefile ]; then rm -rf $(PWD)/build_$@; fi
|
||||
+@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then git submodule update --init --recursive --force && 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
|
||||
|
||||
qurtrun:
|
||||
$(MAKE) PX4_TARGET_OS=qurt sim
|
||||
# create empty targets to avoid msgs for targets passed to cmake
|
||||
define cmake-targ
|
||||
$(1):
|
||||
@#
|
||||
.PHONY: $(1)
|
||||
endef
|
||||
|
||||
#
|
||||
# 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)
|
||||
# ADD CONFIGS HERE
|
||||
# --------------------------------------------------------------------
|
||||
# Do not put any spaces between function arguments.
|
||||
|
||||
.PHONY: check_format
|
||||
px4fmu-v1_default:
|
||||
$(call cmake-build,nuttx_px4fmu-v1_default)
|
||||
|
||||
px4fmu-v2_default:
|
||||
$(call cmake-build,nuttx_px4fmu-v2_default)
|
||||
|
||||
px4fmu-v2_simple:
|
||||
$(call cmake-build,nuttx_px4fmu-v2_simple)
|
||||
|
||||
px4fmu-v2_lpe:
|
||||
$(call cmake-build,nuttx_px4fmu-v2_lpe)
|
||||
|
||||
nuttx_sim_simple:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
posix_sitl_simple:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
posix_sitl_lpe:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
ros_sitl_simple:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
qurt_eagle_travis:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
qurt_eagle_release:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
posix_eagle_release:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
posix: posix_sitl_simple
|
||||
|
||||
posix_sitl_default: posix_sitl_simple
|
||||
|
||||
ros: ros_sitl_simple
|
||||
|
||||
sitl_deprecation:
|
||||
@echo "Deprecated. Use 'make posix_sitl_default jmavsim' or"
|
||||
@echo "'make posix_sitl_default gazebo' if Gazebo is preferred."
|
||||
|
||||
sitl_quad: sitl_deprecation
|
||||
sitl_plane: sitl_deprecation
|
||||
sitl_ros: sitl_deprecation
|
||||
|
||||
# Other targets
|
||||
# --------------------------------------------------------------------
|
||||
check_format:
|
||||
$(Q) (./Tools/check_code_style.sh)
|
||||
@./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)
|
||||
@rm -rf build_*/
|
||||
@(cd NuttX && git clean -d -f -x)
|
||||
@(cd src/modules/uavcan/libuavcan && git clean -d -f -x)
|
||||
|
||||
.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)
|
||||
# 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 \
|
||||
run_cmake_config config gazebo gazebo_gdb gazebo_lldb jmavsim \
|
||||
jmavsim_gdb jmavsim_lldb gazebo_gdb_iris gazebo_lldb_vtol gazebo_iris gazebo_vtol
|
||||
$(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ))))
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~")
|
||||
|
||||
# Future:
|
||||
#$(CONFIGS):
|
||||
## @cd Build/$@ && cmake ../.. -DCONFIG=$@
|
||||
# @cd Build/$@ && make
|
||||
#
|
||||
# Print some help text
|
||||
#clean-all:
|
||||
# @rm -rf Build/*
|
||||
#
|
||||
.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=<list-of-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 <target> help' where target is"
|
||||
@$(ECHO) " one of: "
|
||||
@$(ECHO) " nuttx"
|
||||
@$(ECHO) " posix"
|
||||
@$(ECHO) " qurt"
|
||||
@$(ECHO) ""
|
||||
endif
|
||||
|
||||
#help:
|
||||
# @echo
|
||||
# @echo "Type 'make ' and hit the tab key twice to see a list of the available"
|
||||
# @echo "build configurations."
|
||||
# @echo
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
[](https://gitter.im/PX4/Firmware?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
This repository contains the PX4 Flight Core, with the main applications located in the src/modules directory. It also contains the PX4 Drone Platform, which contains drivers and middleware to run drones.
|
||||
This repository contains the [PX4 Flight Core](http://px4.io), with the main applications located in the src/modules directory. It also contains the PX4 Drone Platform, which contains drivers and middleware to run drones.
|
||||
|
||||
* Official Website: http://px4.io
|
||||
* License: BSD 3-clause (see [LICENSE.md](https://github.com/PX4/Firmware/blob/master/LICENSE.md))
|
||||
@@ -32,7 +32,7 @@ Software in the Loop guide:
|
||||
Use software in the loop [to get started with the codebase](https://pixhawk.org/dev/simulation/native_sitl).
|
||||
|
||||
Developer guide:
|
||||
http://px4.io/dev/
|
||||
http://dev.px4.io
|
||||
|
||||
Testing guide:
|
||||
http://px4.io/dev/unit_tests
|
||||
|
||||
@@ -28,11 +28,3 @@ fi
|
||||
set MIXER quad_w
|
||||
|
||||
set PWM_OUT 1234
|
||||
set PWM_MIN 1200
|
||||
|
||||
set MIXER_AUX pass
|
||||
set PWM_AUX_RATE 50
|
||||
set PWM_AUX_OUT 1234
|
||||
set PWM_AUX_DISARMED 1000
|
||||
set PWM_AUX_MIN 1000
|
||||
set PWM_AUX_MAX 2000
|
||||
|
||||
@@ -32,6 +32,3 @@ fi
|
||||
set MIXER quad_w
|
||||
|
||||
set PWM_OUT 1234
|
||||
|
||||
set PWM_MIN 1200
|
||||
set PWM_MAX 1950
|
||||
|
||||
@@ -30,7 +30,4 @@ fi
|
||||
|
||||
set MIXER quad_w
|
||||
|
||||
set PWM_MIN 1210
|
||||
set PWM_MAX 2100
|
||||
|
||||
set PWM_OUT 1234
|
||||
|
||||
@@ -30,7 +30,6 @@ fi
|
||||
set MIXER sk450_deadcat
|
||||
|
||||
set PWM_OUT 1234
|
||||
set PWM_MIN 1050
|
||||
|
||||
set PWM_AUX_OUT 1234
|
||||
# set PWM_AUX_MIN 900
|
||||
|
||||
@@ -4,6 +4,17 @@
|
||||
#
|
||||
# @type Hexarotor Coaxial
|
||||
#
|
||||
# @output MAIN1 front right top, CW; angle:60; direction:CW
|
||||
# @output MAIN2 front right bottom, CCW; angle:60; direction:CCW
|
||||
# @output MAIN3 back top, CW; angle:180; direction:CW
|
||||
# @output MAIN4 back bottom, CCW; angle:180; direction:CCW
|
||||
# @output MAIN5 front left top, CW; angle:-60; direction:CW
|
||||
# @output MAIN6 front left bottom, CCW;angle:-60; direction:CCW
|
||||
#
|
||||
# @output AUX1 feed-through of RC AUX1 channel
|
||||
# @output AUX2 feed-through of RC AUX2 channel
|
||||
# @output AUX3 feed-through of RC AUX3 channel
|
||||
#
|
||||
# @maintainer Lorenz Meier <lorenz@px4.io>
|
||||
#
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# @output AUX2 feed-through of RC AUX2 channel
|
||||
# @output AUX3 feed-through of RC AUX3 channel
|
||||
#
|
||||
# @maintainer Simon Wilks <simon@px4.io>
|
||||
# @maintainer Lorenz Meier <lorenz@px4.io>
|
||||
#
|
||||
|
||||
sh /etc/init.d/rc.fw_defaults
|
||||
@@ -39,6 +39,9 @@ then
|
||||
param set FW_RR_P 0.04
|
||||
fi
|
||||
|
||||
# Configure this as plane
|
||||
set MAV_TYPE 1
|
||||
# Set mixer
|
||||
set MIXER wingwing
|
||||
# Provide ESC a constant 1000 us pulse
|
||||
set PWM_OUT 4
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#!nsh
|
||||
#
|
||||
# @name Lumenier QAV250
|
||||
#
|
||||
# @type Quadrotor x
|
||||
#
|
||||
# @output AUX1 feed-through of RC AUX1 channel
|
||||
# @output AUX2 feed-through of RC AUX2 channel
|
||||
# @output AUX3 feed-through of RC AUX3 channel
|
||||
#
|
||||
# @maintainer Mark Whitehorn <kd0aij@gmail.com>
|
||||
#
|
||||
|
||||
sh /etc/init.d/4001_quad_x
|
||||
|
||||
if [ $AUTOCNF == yes ]
|
||||
then
|
||||
param set MC_ROLL_P 7.0
|
||||
param set MC_ROLLRATE_P 0.08
|
||||
param set MC_ROLLRATE_I 0.05
|
||||
param set MC_ROLLRATE_D 0.003
|
||||
param set MC_PITCH_P 7.0
|
||||
param set MC_PITCHRATE_P 0.08
|
||||
param set MC_PITCHRATE_I 0.1
|
||||
param set MC_PITCHRATE_D 0.003
|
||||
param set MC_YAW_P 2.8
|
||||
param set MC_YAWRATE_P 0.2
|
||||
param set MC_YAWRATE_I 0.1
|
||||
param set MC_YAWRATE_D 0.0
|
||||
param set PWM_MIN 1075
|
||||
param set PWM_THR_MIN 0.06
|
||||
param set PWM_MANTHR_MIN 0.06
|
||||
fi
|
||||
|
||||
@@ -15,13 +15,12 @@ sh /etc/init.d/4001_quad_x
|
||||
|
||||
if [ $AUTOCNF == yes ]
|
||||
then
|
||||
# TODO REVIEW
|
||||
param set MC_ROLL_P 7.0
|
||||
param set MC_ROLLRATE_P 0.16
|
||||
param set MC_ROLLRATE_P 0.15
|
||||
param set MC_ROLLRATE_I 0.05
|
||||
param set MC_ROLLRATE_D 0.01
|
||||
param set MC_PITCH_P 7.0
|
||||
param set MC_PITCHRATE_P 0.16
|
||||
param set MC_PITCHRATE_P 0.15
|
||||
param set MC_PITCHRATE_I 0.05
|
||||
param set MC_PITCHRATE_D 0.01
|
||||
param set MC_YAW_P 2.8
|
||||
|
||||
@@ -9,21 +9,16 @@
|
||||
# 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
|
||||
if param compare LPE_ENABLED 1
|
||||
then
|
||||
attitude_estimator_q start
|
||||
local_position_estimator start
|
||||
else
|
||||
ekf_att_pos_estimator start
|
||||
fi
|
||||
fi
|
||||
|
||||
if mc_att_control start
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -260,11 +260,11 @@ then
|
||||
#
|
||||
# Check if PX4IO present and update firmware if needed
|
||||
#
|
||||
if [ -f /etc/extras/px4io-v2_default.bin ]
|
||||
if [ -f /etc/extras/px4io-v2.bin ]
|
||||
then
|
||||
set IO_FILE /etc/extras/px4io-v2_default.bin
|
||||
set IO_FILE /etc/extras/px4io-v2.bin
|
||||
else
|
||||
set IO_FILE /etc/extras/px4io-v1_default.bin
|
||||
set IO_FILE /etc/extras/px4io-v1.bin
|
||||
fi
|
||||
|
||||
if px4io checkcrc ${IO_FILE}
|
||||
@@ -391,6 +391,14 @@ then
|
||||
#
|
||||
set TTYS1_BUSY no
|
||||
|
||||
#
|
||||
# Check if UAVCAN is enabled, default to it for ESCs
|
||||
#
|
||||
if param greater UAVCAN_ENABLE 2
|
||||
then
|
||||
set OUTPUT_MODE uavcan_esc
|
||||
fi
|
||||
|
||||
# If OUTPUT_MODE == none then something is wrong with setup and we shouldn't try to enable output
|
||||
if [ $OUTPUT_MODE != none ]
|
||||
then
|
||||
|
||||
@@ -55,11 +55,11 @@ else
|
||||
echo "[param] FAILED loading $PARAM_FILE"
|
||||
fi
|
||||
|
||||
if [ -f /etc/extras/px4io-v2_default.bin ]
|
||||
if [ -f /etc/extras/px4io-v2.bin ]
|
||||
then
|
||||
set io_file /etc/extras/px4io-v2_default.bin
|
||||
set io_file /etc/extras/px4io-v2.bin
|
||||
else
|
||||
set io_file /etc/extras/px4io-v1_default.bin
|
||||
set io_file /etc/extras/px4io-v1.bin
|
||||
fi
|
||||
|
||||
if px4io start
|
||||
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
cmake_ver=`cmake --version`
|
||||
|
||||
if [[ $cmake_ver == "" ]]
|
||||
then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [[ $cmake_ver == *"2.8"* ]] || [[ $cmake_ver == *"2.9"* ]] || [[ $cmake_ver == *"3.0"* ]] || [[ $cmake_ver == *"3.1"* ]]
|
||||
then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
+20
-10
@@ -4,28 +4,38 @@ failed=0
|
||||
for fn in $(find src/examples \
|
||||
src/systemcmds \
|
||||
src/include \
|
||||
src/drivers/blinkm \
|
||||
src/drivers/bma180 \
|
||||
src/drivers/pca9685 \
|
||||
src/drivers/pca8574 \
|
||||
src/drivers/md25 \
|
||||
src/drivers/ms5611 \
|
||||
src/drivers/stm32 \
|
||||
src/drivers/px4io \
|
||||
src/drivers/px4fmu \
|
||||
src/drivers \
|
||||
src/platforms \
|
||||
src/firmware \
|
||||
src/lib/launchdetection \
|
||||
src/lib/geo \
|
||||
src/lib/geo_lookup \
|
||||
src/lib/conversion \
|
||||
src/lib/rc \
|
||||
src/lib/version \
|
||||
src/modules/attitude_estimator_q \
|
||||
src/modules/gpio_led \
|
||||
src/modules/land_detector \
|
||||
src/modules/muorb \
|
||||
src/modules/px4iofirmware \
|
||||
src/modules/param \
|
||||
src/modules/sensors \
|
||||
src/modules/simulator \
|
||||
src/modules/uORB \
|
||||
src/modules/bottle_drop \
|
||||
src/modules/dataman \
|
||||
src/modules/fixedwing_backside \
|
||||
src/modules/segway \
|
||||
src/modules/local_position_estimator \
|
||||
src/modules/unit_test \
|
||||
src/modules/systemlib \
|
||||
src/modules/controllib \
|
||||
-path './Build' -prune -o \
|
||||
-path './mavlink' -prune -o \
|
||||
-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 \
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$GIT_SUBMODULES_ARE_EVIL" ] && {
|
||||
# GIT_SUBMODULES_ARE_EVIL is set, meaning user doesn't want submodules
|
||||
echo "Skipping submodules. NUTTX_SRC is set to $NUTTX_SRC"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ -d NuttX/nuttx ];
|
||||
then
|
||||
STATUSRETVAL=$(git submodule summary | grep -A20 -i "NuttX" | grep "<")
|
||||
if [ -z "$STATUSRETVAL" ]; then
|
||||
echo "Checked NuttX submodule, correct version found"
|
||||
else
|
||||
echo ""
|
||||
echo ""
|
||||
echo "New commits required:"
|
||||
echo "$(git submodule summary)"
|
||||
echo ""
|
||||
echo ""
|
||||
echo " NuttX sub repo not at correct version. Try 'git submodule update'"
|
||||
echo " or follow instructions on http://pixhawk.org/dev/git/submodules"
|
||||
echo ""
|
||||
echo " DO NOT FORGET TO RUN 'make distclean && make archives' AFTER EACH NUTTX UPDATE!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
|
||||
|
||||
if [ -d mavlink/include/mavlink/v1.0 ];
|
||||
then
|
||||
STATUSRETVAL=$(git submodule summary | grep -A20 -i "mavlink/include/mavlink/v1.0" | grep "<")
|
||||
if [ -z "$STATUSRETVAL" ]; then
|
||||
echo "Checked mavlink submodule, correct version found"
|
||||
else
|
||||
echo ""
|
||||
echo ""
|
||||
echo "New commits required:"
|
||||
echo "$(git submodule summary)"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "mavlink sub repo not at correct version. Try 'git submodule update'"
|
||||
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
|
||||
|
||||
if [ -d uavcan ]
|
||||
then
|
||||
STATUSRETVAL=$(git submodule summary | grep -A20 -i uavcan | grep "<")
|
||||
if [ -z "$STATUSRETVAL" ]
|
||||
then
|
||||
echo "Checked uavcan submodule, correct version found"
|
||||
else
|
||||
echo ""
|
||||
echo ""
|
||||
echo "New commits required:"
|
||||
echo "$(git submodule summary)"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "uavcan sub repo not at correct version. Try 'git submodule update'"
|
||||
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
|
||||
if [ -d src/lib/eigen ]
|
||||
then
|
||||
echo "ARG = $1"
|
||||
if [ $1 = "qurt" ]
|
||||
then
|
||||
# QuRT needs to use Eigen 3.2 because the toolchain doews not support C++11
|
||||
STATUSRETVAL=$(true)
|
||||
else
|
||||
STATUSRETVAL=$(git submodule summary | grep -A20 -i eigen | grep "<")
|
||||
if [ -z "$STATUSRETVAL" ]
|
||||
then
|
||||
echo "Checked Eigen submodule, correct version found"
|
||||
else
|
||||
echo ""
|
||||
echo ""
|
||||
echo "New commits required:"
|
||||
echo "$(git submodule summary)"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "eigen sub repo not at correct version. Try 'git submodule update'"
|
||||
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
|
||||
if [ -d Tools/gencpp ]
|
||||
then
|
||||
STATUSRETVAL=$(git submodule summary | grep -A20 -i gencpp | grep "<")
|
||||
if [ -z "$STATUSRETVAL" ]
|
||||
then
|
||||
echo "Checked gencpp submodule, correct version found"
|
||||
else
|
||||
echo ""
|
||||
echo ""
|
||||
echo "New commits required:"
|
||||
echo "$(git submodule summary)"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "gencpp sub repo not at correct version. Try 'git submodule update'"
|
||||
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
|
||||
if [ -d Tools/genmsg ]
|
||||
then
|
||||
STATUSRETVAL=$(git submodule summary | grep -A20 -i genmsg | grep "<")
|
||||
if [ -z "$STATUSRETVAL" ]
|
||||
then
|
||||
echo "Checked genmsg submodule, correct version found"
|
||||
else
|
||||
echo ""
|
||||
echo ""
|
||||
echo "New commits required:"
|
||||
echo "$(git submodule summary)"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "genmsg sub repo not at correct version. Try 'git submodule update'"
|
||||
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+78
-26
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
# This script is run from Build/<target>_default.build/$(PX4_BASE)/Firmware/src/systemcmds/topic_listener
|
||||
@@ -20,20 +21,42 @@ 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))
|
||||
elif ('float64[' in line.split(' ')[0]):
|
||||
num_floats = int(line.split(" ")[0].split("[")[1].split("]")[0])
|
||||
temp_list.append(("double_array",line.split(' ')[1].split('\t')[0].split('\n')[0],num_floats))
|
||||
elif ('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] == "float64"):
|
||||
temp_list.append(("double",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
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])
|
||||
(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);
|
||||
@@ -74,24 +97,32 @@ 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 <px4_middleware.h>
|
||||
#include <px4_app.h>
|
||||
#include <px4_config.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include <uORB/uORB.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifndef PRIu64
|
||||
#define PRIu64 "llu"
|
||||
#endif
|
||||
|
||||
#ifndef PRId64
|
||||
#define PRId64 "lld"
|
||||
#endif
|
||||
|
||||
""")
|
||||
for m in messages:
|
||||
print("#include <uORB/topics/%s.h>" % m)
|
||||
@@ -108,39 +139,60 @@ int listener_main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
""")
|
||||
print("\tuint32_t num_msgs = (uint32_t)std::stoi(argv[2],NULL,10);")
|
||||
print("\tif(strncmp(argv[1],\"%s\",50)== 0) {" % messages[0])
|
||||
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])
|
||||
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<num_msgs;i++) {")
|
||||
print("\t\tfor (unsigned i = 0; i < num_msgs; i++) {")
|
||||
print("\t\t\torb_check(sub,&updated);")
|
||||
print("\t\t\tupdated = true;")
|
||||
print("\t\t\tif(updated) {")
|
||||
print("\t\t\tif (updated) {")
|
||||
print("\t\tprintf(\"\\nTOPIC: %s #%%d\\n\", i);" % m)
|
||||
print("\t\t\torb_copy(ID,sub,&container);")
|
||||
for item in message_elements[index+1]:
|
||||
if item[0] == "float":
|
||||
print("\t\t\tprintf(\"%s: %%f\\n \",(double)container.%s);" % (item[1], item[1]))
|
||||
print("\t\t\tprintf(\"%s: %%8.4f\\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\t\tprintf(\"%%f \",(double)container.%s[j]);" % item[1])
|
||||
print("\t\t\tprintf(\"%s: \");" % item[1])
|
||||
print("\t\t\tfor (int j = 0; j < %d; j++) {" % item[2])
|
||||
print("\t\t\t\tprintf(\"%%8.4f \",(double)container.%s[j]);" % item[1])
|
||||
print("\t\t\t}")
|
||||
print("\t\t\tprintf(\"\\n\");")
|
||||
elif item[0] == "double":
|
||||
print("\t\t\tprintf(\"%s: %%8.4f\\n\",(double)container.%s);" % (item[1], item[1]))
|
||||
elif item[0] == "double_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(\"%%8.4f \",(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]))
|
||||
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: %%\" PRId64 \"\\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]))
|
||||
print("\t\t\tprintf(\"%s: %%u\\n\",container.%s);" % (item[1], item[1]))
|
||||
elif item[0] == "bool":
|
||||
print("\t\t\tprintf(\"%s: %%s\\n \",container.%s ? \"True\" : \"False\");" % (item[1], item[1]))
|
||||
print("\t\t\tprintf(\"%s: %%s\\n\",container.%s ? \"True\" : \"False\");" % (item[1], item[1]))
|
||||
print("\t\t\t}")
|
||||
print("\t\t}")
|
||||
print("\t} else {")
|
||||
|
||||
Submodule
+1
Submodule Tools/jMAVSim added at fd9ed5df04
+1
-1
@@ -1,2 +1,2 @@
|
||||
handle SIGCONT nostop
|
||||
handle SIGCONT nostop noprint nopass
|
||||
run
|
||||
|
||||
+12
-1
@@ -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 <microseconds>" << endl;
|
||||
return 1;
|
||||
}
|
||||
usleep(atoi(argv[1]));
|
||||
return 0;
|
||||
}
|
||||
""")
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
run
|
||||
pro hand -p true -s false -n false SIGCONT
|
||||
continue
|
||||
@@ -1,5 +1,6 @@
|
||||
from xml.sax.saxutils import escape
|
||||
import codecs
|
||||
import os
|
||||
|
||||
class RCOutput():
|
||||
def __init__(self, groups, board):
|
||||
@@ -30,7 +31,7 @@ class RCOutput():
|
||||
for group in groups:
|
||||
result += "# GROUP: %s\n\n" % group.GetName()
|
||||
for param in group.GetParams():
|
||||
path = param.GetPath().rsplit('/', 1)[1]
|
||||
path = os.path.split(param.GetPath())[1]
|
||||
id_val = param.GetId()
|
||||
name = param.GetFieldValue("short_desc")
|
||||
long_desc = param.GetFieldValue("long_desc")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
|
||||
class ParameterGroup(object):
|
||||
"""
|
||||
@@ -151,7 +152,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):
|
||||
"""
|
||||
@@ -160,7 +161,7 @@ class SourceParser(object):
|
||||
"""
|
||||
|
||||
airframe_id = None
|
||||
airframe_id = path.rsplit('/',1)[1].split('_',1)[0]
|
||||
airframe_id = os.path.split(path)[1].split('_',1)[0]
|
||||
|
||||
# Skip if not numeric
|
||||
if (not self.IsNumber(airframe_id)):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -72,9 +72,13 @@ class XMLOutput():
|
||||
xml_field.text = value
|
||||
for code in param.GetOutputCodes():
|
||||
value = param.GetOutputValue(code)
|
||||
valstrs = value.split(";")
|
||||
xml_field = ET.SubElement(xml_param, "output")
|
||||
xml_field.attrib["name"] = code
|
||||
xml_field.text = value
|
||||
for attrib in valstrs[1:]:
|
||||
attribstrs = attrib.split(":")
|
||||
xml_field.attrib[attribstrs[0].strip()] = attribstrs[1].strip()
|
||||
xml_field.text = valstrs[0]
|
||||
if last_param_name != param.GetName():
|
||||
board_specific_param_set = False
|
||||
indent(xml_parameters)
|
||||
|
||||
@@ -45,6 +45,7 @@ class Parameter(object):
|
||||
"min": 5,
|
||||
"max": 4,
|
||||
"unit": 3,
|
||||
"decimal": 2,
|
||||
# all others == 0 (sorted alphabetically)
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ class SourceParser(object):
|
||||
re_remove_dots = re.compile(r'\.+$')
|
||||
re_remove_carriage_return = re.compile('\n+')
|
||||
|
||||
valid_tags = set(["group", "board", "min", "max", "unit"])
|
||||
valid_tags = set(["group", "board", "min", "max", "unit", "decimal"])
|
||||
|
||||
# Order of parameter groups
|
||||
priority = {
|
||||
|
||||
Executable
+99
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env python
|
||||
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 <parameters.xml>" % os.sys.argv[0])
|
||||
raise SystemExit
|
||||
|
||||
fp_header = open("px4_parameters.h", "w")
|
||||
fp_src = open("px4_parameters.c", "w")
|
||||
|
||||
tree = ET.parse(os.sys.argv[1])
|
||||
root = tree.getroot()
|
||||
|
||||
# Generate the header file content
|
||||
header = """
|
||||
#include <stdint.h>
|
||||
#include <systemlib/param/param.h>
|
||||
|
||||
// DO NOT EDIT
|
||||
// This file is autogenerated from parameters.xml
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
struct px4_parameters_t {
|
||||
"""
|
||||
start_name = ""
|
||||
end_name = ""
|
||||
|
||||
for group in root:
|
||||
if group.tag == "group":
|
||||
header += """
|
||||
/*****************************************************************
|
||||
* %s
|
||||
****************************************************************/""" % group.attrib["name"]
|
||||
for param in group:
|
||||
if not start_name:
|
||||
start_name = param.attrib["name"]
|
||||
end_name = param.attrib["name"]
|
||||
header += """
|
||||
const struct param_info_s __param__%s;""" % param.attrib["name"]
|
||||
header += """
|
||||
const unsigned int param_count;
|
||||
};
|
||||
|
||||
extern const struct px4_parameters_t px4_parameters;
|
||||
"""
|
||||
|
||||
# Generate the C file content
|
||||
src = """
|
||||
#include <px4_parameters.h>
|
||||
|
||||
// DO NOT EDIT
|
||||
// This file is autogenerated from paramaters.xml
|
||||
|
||||
const
|
||||
#ifndef __PX4_DARWIN
|
||||
__attribute__((used, section("__param")))
|
||||
#endif
|
||||
struct px4_parameters_t px4_parameters = {
|
||||
"""
|
||||
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"]
|
||||
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,
|
||||
%s%s
|
||||
},
|
||||
""" % (param.attrib["name"], param.attrib["type"], val_str, param.attrib["default"])
|
||||
src += """
|
||||
%d
|
||||
};
|
||||
|
||||
//extern const struct px4_parameters_t px4_parameters;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
""" % i
|
||||
|
||||
fp_header.write(header)
|
||||
fp_src.write(src)
|
||||
|
||||
@@ -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:
|
||||
@@ -79,7 +84,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 +141,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 +158,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 +167,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 +183,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 +201,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 +219,5 @@ if __name__ == "__main__":
|
||||
args.outputdir,
|
||||
args.templatedir,
|
||||
args.temporarydir,
|
||||
args.prefix)
|
||||
args.prefix,
|
||||
args.quiet)
|
||||
|
||||
@@ -57,7 +57,7 @@ def main():
|
||||
for (root, dirs, files) in os.walk(args.folder):
|
||||
for file in files:
|
||||
# only prune text files
|
||||
if ".zip" in file or ".bin" in file or ".swp" in file or ".data" in file:
|
||||
if ".zip" in file or ".bin" in file or ".swp" in file or ".data" in file or ".DS_Store" in file:
|
||||
continue
|
||||
|
||||
file_path = os.path.join(root, file)
|
||||
@@ -74,10 +74,9 @@ def main():
|
||||
else:
|
||||
if not line.isspace() and not line.strip().startswith("#"):
|
||||
pruned_content += line
|
||||
|
||||
# overwrite old scratch file
|
||||
# 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__':
|
||||
|
||||
Submodule
+1
Submodule Tools/sitl_gazebo added at 7d855cd385
+95
-3
@@ -1,5 +1,97 @@
|
||||
#!/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
|
||||
rc_script=$1
|
||||
debugger=$2
|
||||
program=$3
|
||||
model=$4
|
||||
build_path=$5
|
||||
curr_dir=`pwd`
|
||||
|
||||
echo SITL ARGS
|
||||
echo rc_script: $rc_script
|
||||
echo debugger: $debugger
|
||||
echo program: $program
|
||||
echo model: $model
|
||||
echo build_path: $build_path
|
||||
|
||||
if [ "$model" == "" ] || [ "$model" == "none" ]
|
||||
then
|
||||
echo "empty model, setting iris as default"
|
||||
model="iris"
|
||||
fi
|
||||
|
||||
if [ "$#" != 5 ]
|
||||
then
|
||||
echo usage: sitl_run.sh rc_script debugger program model build_path
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# kill process names that might stil
|
||||
# be running from last time
|
||||
pkill gazebo
|
||||
pkill mainapp
|
||||
jmavsim_pid=`jps | grep Simulator | cut -d" " -f1`
|
||||
if [ -n "$jmavsim_pid" ]
|
||||
then
|
||||
kill $jmavsim_pid
|
||||
fi
|
||||
|
||||
cp Tools/posix_lldbinit $build_path/src/firmware/posix/.lldbinit
|
||||
cp Tools/posix.gdbinit $build_path/src/firmware/posix/.gdbinit
|
||||
|
||||
SIM_PID=0
|
||||
|
||||
if [ "$program" == "jmavsim" ] && [ "$no_sim" == "" ]
|
||||
then
|
||||
cd Tools/jMAVSim
|
||||
ant
|
||||
java -Djava.ext.dirs= -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator -udp 127.0.0.1:14560 &
|
||||
SIM_PID=`echo $!`
|
||||
elif [ "$3" == "gazebo" ] && [ "$no_sim" == "" ]
|
||||
then
|
||||
if [ -x "$(command -v gazebo)" ]
|
||||
then
|
||||
# Set the plugin path so Gazebo finds our model and sim
|
||||
export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}:$curr_dir/Tools/sitl_gazebo/Build
|
||||
# Set the model path so Gazebo finds the airframes
|
||||
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:$curr_dir/Tools/sitl_gazebo/models
|
||||
# Disable online model lookup since this is quite experimental and unstable
|
||||
export GAZEBO_MODEL_DATABASE_URI=""
|
||||
export SITL_GAZEBO_PATH=$curr_dir/Tools/sitl_gazebo
|
||||
mkdir -p Tools/sitl_gazebo/Build
|
||||
cd Tools/sitl_gazebo/Build
|
||||
cmake ..
|
||||
make -j4
|
||||
gzserver ../worlds/${model}.world &
|
||||
SIM_PID=`echo $!`
|
||||
gzclient &
|
||||
GUI_PID=`echo $!`
|
||||
else
|
||||
echo "You need to have gazebo simulator installed!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cd $build_path/src/firmware/posix
|
||||
mkdir -p rootfs/fs/microsd
|
||||
mkdir -p rootfs/eeprom
|
||||
touch rootfs/eeprom/parameters
|
||||
# Start Java simulator
|
||||
if [ "$debugger" == "lldb" ]
|
||||
then
|
||||
lldb -- mainapp ../../../../${rc_script}_${program}
|
||||
elif [ "$debugger" == "gdb" ]
|
||||
then
|
||||
gdb --args mainapp ../../../../${rc_script}_${program}
|
||||
else
|
||||
./mainapp ../../../../${rc_script}_${program}
|
||||
fi
|
||||
|
||||
if [ "$program" == "jmavsim" ]
|
||||
then
|
||||
kill -9 $SIM_PID
|
||||
elif [ "$program" == "gazebo" ]
|
||||
then
|
||||
kill -9 $SIM_PID
|
||||
kill -9 $GUI_PID
|
||||
fi
|
||||
|
||||
Vendored
+7
-3
@@ -26,7 +26,7 @@ Vagrant.configure(2) do |config|
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
# config.vm.network "private_network", ip: "192.168.33.10"
|
||||
config.vm.network "private_network", ip: "192.168.33.10"
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
@@ -37,7 +37,7 @@ Vagrant.configure(2) do |config|
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
config.vm.synced_folder ".", "/Firmware"
|
||||
config.vm.synced_folder ".", "/Firmware", type: "nfs"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
@@ -77,14 +77,18 @@ Vagrant.configure(2) do |config|
|
||||
# Ensure we start in the Firmware folder
|
||||
echo "cd /Firmware" >> ~/.bashrc
|
||||
# Install software
|
||||
sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded -y
|
||||
sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
|
||||
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 zip
|
||||
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 gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
|
||||
pushd .
|
||||
cd ~
|
||||
wget -q 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
|
||||
exportline2="export HEXAGON_TOOLS_ROOT=$HOME/Qualcomm/HEXAGON_Tools/7.2.10/Tools"
|
||||
if grep -Fxq "$exportline2" ~/.profile; then echo nothing to do ; else echo $exportline2 >> ~/.profile; fi
|
||||
. ~/.profile
|
||||
popd
|
||||
# setup ccache
|
||||
|
||||
@@ -0,0 +1,871 @@
|
||||
############################################################################
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# 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.
|
||||
# It is inteded to be called by other functions.
|
||||
#
|
||||
# Usage:
|
||||
# px4_parse_function_args(
|
||||
# NAME <name>
|
||||
# [ OPTIONS <list> ]
|
||||
# [ ONE_VALUE <list> ]
|
||||
# [ MULTI_VALUE <list> ]
|
||||
# REQUIRED <list>
|
||||
# ARGN <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}\nARGN: ${IN_ARGN}")
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(arg ${IN_OPTIONS} ${IN_ONE_VALUE} ${IN_MULTI_VALUE})
|
||||
set(${arg} ${OUT_${arg}} PARENT_SCOPE)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_git_submodule
|
||||
#
|
||||
# This function add a git submodule target.
|
||||
#
|
||||
# Usage:
|
||||
# px4_add_git_submodule(TARGET <target> PATH <path>)
|
||||
#
|
||||
# Input:
|
||||
# PATH : git submodule path
|
||||
#
|
||||
# Output:
|
||||
# TARGET : git target
|
||||
#
|
||||
# Example:
|
||||
# px4_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_init_${NAME}.stamp
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git submodule init ${PATH}
|
||||
COMMAND touch ${CMAKE_BINARY_DIR}/git_init_${NAME}.stamp
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/.gitmodules
|
||||
)
|
||||
add_custom_target(${TARGET}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git submodule update --recursive ${PATH}
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/git_init_${NAME}.stamp
|
||||
)
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_prepend_string
|
||||
#
|
||||
# This function prepends a string to a list
|
||||
#
|
||||
# Usage:
|
||||
# px4_prepend_string(OUT <output-list> STR <string> LIST <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 <string>
|
||||
# [ MAIN <string> ]
|
||||
# [ STACK <string> ]
|
||||
# [ COMPILE_FLAGS <list> ]
|
||||
# [ INCLUDES <list> ]
|
||||
# [ DEPENDS <string> ]
|
||||
# )
|
||||
#
|
||||
# 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(MAIN)
|
||||
set_target_properties(${MODULE} PROPERTIES
|
||||
COMPILE_DEFINITIONS PX4_MAIN=${MAIN}_app_main)
|
||||
endif()
|
||||
|
||||
if(INCLUDES)
|
||||
target_include_directories(${MODULE} ${INCLUDES})
|
||||
endif()
|
||||
|
||||
if(DEPENDS)
|
||||
add_dependencies(${MODULE} ${DEPENDS})
|
||||
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()
|
||||
|
||||
# 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}})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_generate_messages
|
||||
#
|
||||
# This function generates source code from ROS msg definitions.
|
||||
#
|
||||
# Usage:
|
||||
# px4_generate_messages(TARGET <target> MSGS <msg-files>)
|
||||
#
|
||||
# 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 <target>
|
||||
# MSG_FILES <files> OS <operating-system>
|
||||
# [ DEPENDS <dependencies> ]
|
||||
# )
|
||||
#
|
||||
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(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 ${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 ${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 <target> BUNDLE <file.px4>)
|
||||
#
|
||||
# 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_add_upload
|
||||
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 serial_ports
|
||||
"COM${port}")
|
||||
endforeach()
|
||||
endif()
|
||||
px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",")
|
||||
add_custom_target(${OUT}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${BUNDLE}
|
||||
DEPENDS ${BUNDLE}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "uploading ${BUNDLE}"
|
||||
VERBATIM
|
||||
USES_TERMINAL
|
||||
)
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_common_flags
|
||||
#
|
||||
# Set ths default build flags.
|
||||
#
|
||||
# Usage:
|
||||
# px4_add_common_flags(
|
||||
# BOARD <in-string>
|
||||
# C_FLAGS <inout-variable>
|
||||
# CXX_FLAGS <inout-variable>
|
||||
# EXE_LINKER_FLAGS <inout-variable>
|
||||
# INCLUDE_DIRS <inout-variable>
|
||||
# LINK_DIRS <inout-variable>
|
||||
# DEFINITIONS <inout-variable>)
|
||||
#
|
||||
# Input:
|
||||
# BOARD : board
|
||||
#
|
||||
# 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(
|
||||
# BOARD px4fmu-v2
|
||||
# C_FLAGS CMAKE_C_FLAGS
|
||||
# CXX_FLAGS CMAKE_CXX_FLAGS
|
||||
# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS
|
||||
# INCLUDES <list>)
|
||||
#
|
||||
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} BOARD
|
||||
REQUIRED ${inout_vars} BOARD
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(warnings
|
||||
-Wall
|
||||
-Werror
|
||||
-Wno-sign-compare
|
||||
-Wextra
|
||||
#-Wshadow # very verbose due to eigen
|
||||
-Wfloat-equal
|
||||
-Wpointer-arith
|
||||
-Wmissing-declarations
|
||||
-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 (${OS} STREQUAL "nuttx")
|
||||
list(APPEND warnings -Wframe-larger-than=1024)
|
||||
endif()
|
||||
|
||||
if (${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
|
||||
# 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
|
||||
-Wno-varargs
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
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} MATCHES ".*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} MATCHES ".*Clang.*")
|
||||
list(APPEND c_warnings
|
||||
-Wold-style-declaration
|
||||
-Wmissing-parameter-type
|
||||
)
|
||||
endif()
|
||||
|
||||
set(c_compile_flags
|
||||
-g
|
||||
-std=gnu99
|
||||
-fno-common
|
||||
)
|
||||
|
||||
set(cxx_warnings
|
||||
-Wno-missing-field-initializers
|
||||
)
|
||||
|
||||
set(cxx_compile_flags
|
||||
-g
|
||||
-fno-exceptions
|
||||
-fno-rtti
|
||||
-std=gnu++0x
|
||||
-fno-threadsafe-statics
|
||||
-DCONFIG_WCHAR_BUILTIN
|
||||
-D__CUSTOM_FILE_IO__
|
||||
)
|
||||
|
||||
set(visibility_flags
|
||||
-fvisibility=hidden
|
||||
-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
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}/src
|
||||
${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
|
||||
${CMAKE_SOURCE_DIR}/src/drivers/boards/${BOARD}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}/src/modules/px4_messages
|
||||
${CMAKE_BINARY_DIR}/src/modules
|
||||
${CMAKE_SOURCE_DIR}/mavlink/include/mavlink
|
||||
)
|
||||
|
||||
list(APPEND added_include_dirs
|
||||
src/lib/eigen
|
||||
)
|
||||
|
||||
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}
|
||||
)
|
||||
|
||||
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES ".*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})
|
||||
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()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# 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()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# 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 rev-parse HEAD
|
||||
OUTPUT_VARIABLE git_desc
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
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()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_generate_parameters_xml
|
||||
#
|
||||
# Generates a parameters.xml file.
|
||||
#
|
||||
# Usage:
|
||||
# px4_generate_parameters_xml(OUT <param-xml_file>)
|
||||
#
|
||||
# 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
|
||||
${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
|
||||
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_source(OUT <list-source-files> XML <param-xml-file>)
|
||||
#
|
||||
# Input:
|
||||
# XML : the parameters.xml file
|
||||
# DEPS : target dependencies
|
||||
#
|
||||
# Output:
|
||||
# OUT : the generated source files
|
||||
#
|
||||
# Example:
|
||||
# px4_generate_parameters_source(OUT param_files XML parameters.xml)
|
||||
#
|
||||
function(px4_generate_parameters_source)
|
||||
px4_parse_function_args(
|
||||
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
|
||||
${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_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 <airframe-xml-file>)
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# Copy files to a directory and keep track of dependencies.
|
||||
#
|
||||
# Usage:
|
||||
# px4_copy_tracked(OUT <dest-files> FILES <in-files> DIR <dir-name>)
|
||||
#
|
||||
# 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:
|
||||
@@ -0,0 +1,177 @@
|
||||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/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/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_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")
|
||||
@@ -0,0 +1,186 @@
|
||||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/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-v2
|
||||
drivers/rgbled
|
||||
drivers/mpu6000
|
||||
drivers/mpu9250
|
||||
drivers/lsm303d
|
||||
drivers/l3gd20
|
||||
drivers/hmc5883
|
||||
drivers/ms5611
|
||||
drivers/mb12xx
|
||||
drivers/srf02
|
||||
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/topic_listener
|
||||
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
|
||||
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_extra_builtin_cmds
|
||||
serdis
|
||||
sercon
|
||||
)
|
||||
|
||||
set(config_io_board
|
||||
px4io-v2
|
||||
)
|
||||
|
||||
set(config_extra_libs
|
||||
${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a
|
||||
uavcan
|
||||
uavcan_stm32_driver
|
||||
)
|
||||
|
||||
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")
|
||||
@@ -0,0 +1,5 @@
|
||||
include(cmake/configs/nuttx_px4fmu-v2_default.cmake)
|
||||
|
||||
list(APPEND config_module_list
|
||||
modules/local_position_estimator
|
||||
)
|
||||
@@ -0,0 +1,143 @@
|
||||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/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-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/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
|
||||
|
||||
#
|
||||
# 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_extra_builtin_cmds
|
||||
serdis
|
||||
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")
|
||||
|
||||
add_custom_target(serdis)
|
||||
set_target_properties(serdis PROPERTIES
|
||||
MAIN "serdis" STACK "2048")
|
||||
@@ -0,0 +1,21 @@
|
||||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
message(WARNING "this is a work in progress and doesn't build yet")
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake)
|
||||
|
||||
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_extra_builtin_cmds
|
||||
)
|
||||
@@ -0,0 +1,46 @@
|
||||
include(posix/px4_impl_posix)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
drivers/blinkm
|
||||
drivers/pwm_out_sim
|
||||
drivers/rgbled
|
||||
drivers/led
|
||||
drivers/boards/sitl
|
||||
|
||||
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/param
|
||||
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/common
|
||||
platforms/posix/px4_layer
|
||||
platforms/posix/work_queue
|
||||
)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
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_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
drivers/boards/sitl
|
||||
drivers/led
|
||||
|
||||
systemcmds/param
|
||||
systemcmds/ver
|
||||
|
||||
modules/mavlink
|
||||
|
||||
modules/param
|
||||
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/common
|
||||
platforms/posix/px4_layer
|
||||
platforms/posix/work_queue
|
||||
modules/muorb/krait
|
||||
)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
include(posix/px4_impl_posix)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
||||
modules/uORB
|
||||
|
||||
platforms/posix/px4_layer
|
||||
platforms/posix/work_queue
|
||||
|
||||
modules/muorb/krait
|
||||
)
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
include(posix/px4_impl_posix)
|
||||
|
||||
# Use build stubs unless explicitly set not to
|
||||
if("${DSPAL_STUBS_ENABLE}" STREQUAL "")
|
||||
set(DSPAL_STUBS_ENABLE "1")
|
||||
endif()
|
||||
|
||||
if ("${QRL_SDK_DIR}" STREQUAL "")
|
||||
set(QRL_SDK_DIR /opt/qrlsdk)
|
||||
endif()
|
||||
|
||||
set(CMAKE_PROGRAM_PATH
|
||||
"${QRL_SDK_DIR}/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin"
|
||||
${CMAKE_PROGRAM_PATH}
|
||||
)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
||||
systemcmds/param
|
||||
systemcmds/ver
|
||||
|
||||
modules/mavlink
|
||||
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/uORB
|
||||
modules/dataman
|
||||
|
||||
lib/mathlib
|
||||
lib/mathlib/math/filter
|
||||
lib/geo
|
||||
lib/geo_lookup
|
||||
lib/conversion
|
||||
|
||||
platforms/common
|
||||
platforms/posix/px4_layer
|
||||
platforms/posix/work_queue
|
||||
|
||||
modules/muorb/krait
|
||||
)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
include(cmake/configs/posix_sitl_simple.cmake)
|
||||
|
||||
list(APPEND config_module_list
|
||||
modules/local_position_estimator
|
||||
)
|
||||
|
||||
set(config_sitl_rcS
|
||||
posix-configs/SITL/init/rcS_lpe
|
||||
)
|
||||
@@ -0,0 +1,92 @@
|
||||
include(posix/px4_impl_posix)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake)
|
||||
|
||||
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
|
||||
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/param
|
||||
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_extra_builtin_cmds
|
||||
serdis
|
||||
sercon
|
||||
)
|
||||
|
||||
set(config_sitl_rcS
|
||||
posix-configs/SITL/init/rcS
|
||||
CACHE FILEPATH "init script for sitl"
|
||||
)
|
||||
|
||||
set(config_sitl_viewer
|
||||
jmavsim
|
||||
CACHE STRING "viewer for sitl"
|
||||
)
|
||||
set_property(CACHE config_sitl_viewer
|
||||
PROPERTY STRINGS "jmavsim;none")
|
||||
|
||||
set(config_sitl_debugger
|
||||
disable
|
||||
CACHE STRING "debugger for sitl"
|
||||
)
|
||||
set_property(CACHE config_sitl_debugger
|
||||
PROPERTY STRINGS "disable;gdb;lldb")
|
||||
|
||||
|
||||
|
||||
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")
|
||||
@@ -0,0 +1,28 @@
|
||||
include(qurt/px4_impl_qurt)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
systemcmds/param
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/uORB
|
||||
|
||||
#
|
||||
# QuRT port
|
||||
#
|
||||
platforms/common
|
||||
platforms/qurt/px4_layer
|
||||
platforms/posix/work_queue
|
||||
platforms/qurt/tests/hello
|
||||
)
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
include(qurt/px4_impl_qurt)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
|
||||
|
||||
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/param
|
||||
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
|
||||
)
|
||||
@@ -0,0 +1,41 @@
|
||||
include(qurt/px4_impl_qurt)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
systemcmds/param
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
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
|
||||
)
|
||||
@@ -0,0 +1,85 @@
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.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
|
||||
|
||||
#
|
||||
# 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/param
|
||||
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
|
||||
)
|
||||
@@ -0,0 +1,39 @@
|
||||
include(qurt/px4_impl_qurt)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
systemcmds/param
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/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/posix/tests/vcdev_test
|
||||
platforms/posix/tests/hrt_test
|
||||
platforms/posix/tests/wqueue
|
||||
)
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
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_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.2.10.cmake)
|
||||
|
||||
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/param
|
||||
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
|
||||
lib/ecl
|
||||
|
||||
#
|
||||
# QuRT port
|
||||
#
|
||||
platforms/common
|
||||
platforms/qurt/px4_layer
|
||||
platforms/posix/work_queue
|
||||
|
||||
#
|
||||
# sources for muorb over fastrpc
|
||||
#
|
||||
modules/muorb/adsp
|
||||
)
|
||||
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/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('--include_path', 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
|
||||
include_path = args.include_path
|
||||
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.decode() != "":
|
||||
raise RuntimeError(stderr)
|
||||
return stdout
|
||||
|
||||
# do compile
|
||||
run_cmd("{c_compiler:s} -I{include_path: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_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:
|
||||
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
|
||||
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} -I{include_path: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 :
|
||||
@@ -0,0 +1,10 @@
|
||||
/* builtin command list - automatically generated, do not edit */
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/binfmt/builtin.h>
|
||||
#include <nuttx/config.h>
|
||||
${builtin_apps_decl_string}
|
||||
const struct builtin_s g_builtins[] = {
|
||||
${builtin_apps_string}
|
||||
{NULL, 0, 0, NULL}
|
||||
};
|
||||
const int g_builtin_count = ${command_count};
|
||||
@@ -0,0 +1,529 @@
|
||||
############################################################################
|
||||
#
|
||||
# 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_nuttx_add_firmware
|
||||
# * px4_nuttx_generate_builtin_commands
|
||||
# * px4_nuttx_add_export
|
||||
# * px4_nuttx_add_romfs
|
||||
#
|
||||
# Required OS Inteface Functions
|
||||
#
|
||||
# * px4_os_add_flags
|
||||
# * px4_os_prebuild_targets
|
||||
#
|
||||
|
||||
include(common/px4_base)
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_nuttx_add_firmware
|
||||
#
|
||||
# This function adds a nuttx firmware target.
|
||||
#
|
||||
# Usage:
|
||||
# px4_nuttx_add_firmware(OUT <out-target> EXE <in-executable>
|
||||
# PARAM_XML <param_xml> AIRFRAMES_XML <airframes_xml>)
|
||||
#
|
||||
# Input:
|
||||
# EXE : the executable to generate the firmware from
|
||||
# BOARD : the board
|
||||
# PARAM_XML : param xml file (optional)
|
||||
# AIRFRAMES_XML : airframes xml file (optional)
|
||||
#
|
||||
# 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 BOARD OUT EXE PARAM_XML AIRFRAMES_XML
|
||||
REQUIRED OUT EXE BOARD
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(extra_args)
|
||||
|
||||
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()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_nuttx_generate_builtin_commands
|
||||
#
|
||||
# This function generates the builtin_commands.c src for nuttx
|
||||
#
|
||||
# Usage:
|
||||
# px4_nuttx_generate_builtin_commands(
|
||||
# MODULE_LIST <in-list>
|
||||
# OUT <file>)
|
||||
#
|
||||
# Input:
|
||||
# MODULE_LIST : list of modules
|
||||
#
|
||||
# Output:
|
||||
# OUT : generated builtin_commands.c src
|
||||
#
|
||||
# Example:
|
||||
# px4_nuttx_generate_builtin_commands(
|
||||
# OUT <generated-src> 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})
|
||||
#message("generating builtin for: ${module}")
|
||||
# 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/nuttx/builtin_commands.c.in
|
||||
${OUT})
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_nuttx_add_export
|
||||
#
|
||||
# This function generates a nuttx export.
|
||||
#
|
||||
# Usage:
|
||||
# px4_nuttx_add_export(
|
||||
# OUT <out-target>
|
||||
# CONFIG <in-string>
|
||||
# DEPENDS <in-list>)
|
||||
#
|
||||
# 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 ${MKDIR} -p ${nuttx_src}
|
||||
COMMAND ${CP} -a ${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
|
||||
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} --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} --no-print-directory --quiet -C ${nuttx_src}/nuttx -j${THREADS} -r CONFIG_ARCH_BOARD=${CONFIG} export > /dev/null
|
||||
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} -q ${CMAKE_BINARY_DIR}/${CONFIG}.export -d ${nuttx_src}
|
||||
COMMAND ${TOUCH} nuttx_export_${CONFIG}.stamp
|
||||
DEPENDS ${DEPENDS} ${CMAKE_BINARY_DIR}/${CONFIG}.export)
|
||||
|
||||
add_custom_target(${OUT}
|
||||
DEPENDS nuttx_export_${CONFIG}.stamp)
|
||||
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_nuttx_create_bin
|
||||
#
|
||||
# The functions generates a bin image for nuttx.
|
||||
#
|
||||
# Usage:
|
||||
# px4_nuttx_create_bin(BIN <out-file> EXE <in-file>)
|
||||
#
|
||||
# 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_add_romfs
|
||||
#
|
||||
# The functions creates a ROMFS filesystem for nuttx.
|
||||
#
|
||||
# Usage:
|
||||
# px4_nuttx_add_romfs(
|
||||
# OUT <out-target>
|
||||
# ROOT <in-directory>
|
||||
# EXTRAS <in-list>)
|
||||
#
|
||||
# Input:
|
||||
# ROOT : the root of the ROMFS
|
||||
# EXTRAS : list of extra files
|
||||
#
|
||||
# Output:
|
||||
# OUT : the ROMFS library target
|
||||
#
|
||||
# Example:
|
||||
# px4_nuttx_add_romfs(OUT my_romfs ROOT "ROMFS/my_board")
|
||||
#
|
||||
function(px4_nuttx_add_romfs)
|
||||
|
||||
px4_parse_function_args(
|
||||
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_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}/*)
|
||||
|
||||
set(cmake_test ${CMAKE_SOURCE_DIR}/cmake/test/cmake_tester.py)
|
||||
|
||||
|
||||
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 extras ${file_dest})
|
||||
endforeach()
|
||||
add_custom_target(collect_extras DEPENDS ${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}
|
||||
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
|
||||
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}
|
||||
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
|
||||
--var romfs_img
|
||||
--bin romfs.bin
|
||||
DEPENDS ${romfs_src_files} ${extras}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
add_library(${OUT} STATIC romfs.o)
|
||||
set_target_properties(${OUT} PROPERTIES LINKER_LANGUAGE C)
|
||||
set(${OUT} ${${OUT}} PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_os_add_flags
|
||||
#
|
||||
# Set ths nuttx build flags.
|
||||
#
|
||||
# Usage:
|
||||
# px4_os_add_flags(
|
||||
# C_FLAGS <inout-variable>
|
||||
# CXX_FLAGS <inout-variable>
|
||||
# EXE_LINKER_FLAGS <inout-variable>
|
||||
# INCLUDE_DIRS <inout-variable>
|
||||
# LINK_DIRS <inout-variable>
|
||||
# DEFINITIONS <inout-variable>)
|
||||
#
|
||||
# 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_os_add_flags(
|
||||
# C_FLAGS CMAKE_C_FLAGS
|
||||
# CXX_FLAGS CMAKE_CXX_FLAGS
|
||||
# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS
|
||||
# INCLUDES <list>)
|
||||
#
|
||||
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(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
|
||||
|
||||
set(cpu_flags)
|
||||
if (${BOARD} STREQUAL "px4fmu-v1")
|
||||
set(cpu_flags
|
||||
-mcpu=cortex-m4
|
||||
-mthumb
|
||||
-march=armv7e-m
|
||||
-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
|
||||
-mthumb
|
||||
-march=armv7-m
|
||||
)
|
||||
endif()
|
||||
list(APPEND c_flags ${cpu_flags})
|
||||
list(APPEND cxx_flags ${cpu_flags})
|
||||
|
||||
# output
|
||||
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_os_prebuild_targets
|
||||
#
|
||||
# This function generates os dependent targets
|
||||
|
||||
# Usage:
|
||||
# px4_os_prebuild_targets(
|
||||
# OUT <out-list_of_targets>
|
||||
# BOARD <in-string>
|
||||
# )
|
||||
#
|
||||
# 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})
|
||||
px4_nuttx_add_export(OUT nuttx_export_${BOARD}
|
||||
CONFIG ${BOARD}
|
||||
THREADS ${THREADS}
|
||||
DEPENDS git_nuttx)
|
||||
add_custom_target(${OUT} DEPENDS nuttx_export_${BOARD})
|
||||
endfunction()
|
||||
|
||||
# vim: set noet fenc=utf-8 ff=unix nowrap:
|
||||
@@ -0,0 +1,88 @@
|
||||
/* builtin command list - automatically generated, do not edit */
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <px4_tasks.h>
|
||||
#include <px4_posix.h>
|
||||
#include <px4_log.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
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[]);
|
||||
}
|
||||
|
||||
static map<string,px4_main_t> app_map(void)
|
||||
{
|
||||
static map<string,px4_main_t> 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;
|
||||
|
||||
return apps;
|
||||
}
|
||||
|
||||
map<string,px4_main_t> apps = app_map();
|
||||
|
||||
static void list_builtins(void)
|
||||
{
|
||||
cout << "Builtin Commands:" << endl;
|
||||
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
|
||||
cout << '\t' << it->first << endl;
|
||||
}
|
||||
|
||||
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) {
|
||||
cout << "Usage: sleep <seconds>" << endl;
|
||||
return 1;
|
||||
}
|
||||
sleep(atoi(argv[1]));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,3 +44,4 @@ SECTIONS
|
||||
__param_end = .;
|
||||
}
|
||||
}
|
||||
INSERT AFTER .rodata;
|
||||
@@ -0,0 +1,236 @@
|
||||
############################################################################
|
||||
#
|
||||
# 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_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(common/px4_base)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/posix)
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_posix_generate_builtin_commands
|
||||
#
|
||||
# This function generates the builtin_commands.c src for posix
|
||||
#
|
||||
# Usage:
|
||||
# px4_posix_generate_builtin_commands(
|
||||
# MODULE_LIST <in-list>
|
||||
# OUT <file>)
|
||||
#
|
||||
# Input:
|
||||
# MODULE_LIST : list of modules
|
||||
#
|
||||
# Output:
|
||||
# OUT : generated builtin_commands.c src
|
||||
#
|
||||
# Example:
|
||||
# px4_posix_generate_builtin_commands(
|
||||
# OUT <generated-src> 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/apps.h_in
|
||||
${OUT})
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_os_add_flags
|
||||
#
|
||||
# Set ths posix build flags.
|
||||
#
|
||||
# Usage:
|
||||
# px4_os_add_flags(
|
||||
# C_FLAGS <inout-variable>
|
||||
# CXX_FLAGS <inout-variable>
|
||||
# EXE_LINKER_FLAGS <inout-variable>
|
||||
# INCLUDE_DIRS <inout-variable>
|
||||
# LINK_DIRS <inout-variable>
|
||||
# DEFINITIONS <inout-variable>)
|
||||
#
|
||||
# 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 <list>)
|
||||
#
|
||||
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
|
||||
)
|
||||
|
||||
if(UNIX AND APPLE)
|
||||
set(added_definitions
|
||||
-D__PX4_POSIX
|
||||
-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
|
||||
)
|
||||
|
||||
|
||||
# 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 <out-list_of_targets>
|
||||
# BOARD <in-string>
|
||||
# )
|
||||
#
|
||||
# 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()
|
||||
@@ -0,0 +1,84 @@
|
||||
/* builtin command list - automatically generated, do not edit */
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <px4_tasks.h>
|
||||
#include <px4_posix.h>
|
||||
#include <px4_log.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
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<string,px4_main_t> &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<string,px4_main_t> &apps)
|
||||
{
|
||||
printf("Builtin Commands:\\n");
|
||||
for (map<string,px4_main_t>::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 <seconds>" );
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
############################################################################
|
||||
#
|
||||
# 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(common/px4_base)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/qurt)
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_qurt_generate_builtin_commands
|
||||
#
|
||||
# This function generates the builtin_commands.c src for qurt
|
||||
#
|
||||
# Usage:
|
||||
# px4_qurt_generate_builtin_commands(
|
||||
# MODULE_LIST <in-list>
|
||||
# OUT <file>)
|
||||
#
|
||||
# Input:
|
||||
# MODULE_LIST : list of modules
|
||||
#
|
||||
# Output:
|
||||
# OUT : generated builtin_commands.c src
|
||||
#
|
||||
# Example:
|
||||
# px4_qurt_generate_builtin_commands(
|
||||
# OUT <generated-src> 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}\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/qurt/apps.h_in ${OUT})
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_os_add_flags
|
||||
#
|
||||
# Set ths qurt build flags.
|
||||
#
|
||||
# Usage:
|
||||
# px4_os_add_flags(
|
||||
# C_FLAGS <inout-variable>
|
||||
# CXX_FLAGS <inout-variable>
|
||||
# EXE_LINKER_FLAGS <inout-variable>
|
||||
# INCLUDE_DIRS <inout-variable>
|
||||
# LINK_DIRS <inout-variable>
|
||||
# DEFINITIONS <inout-variable>)
|
||||
#
|
||||
# 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 <list>)
|
||||
#
|
||||
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
|
||||
)
|
||||
|
||||
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 <out-list_of_targets>
|
||||
# BOARD <in-string>
|
||||
# )
|
||||
#
|
||||
# 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} DEPENDS git_dspal)
|
||||
|
||||
endfunction()
|
||||
|
||||
# vim: set noet fenc=utf-8 ff=unix nowrap:
|
||||
@@ -0,0 +1,37 @@
|
||||
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
|
||||
|
||||
+/// \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
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved.
|
||||
# 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
|
||||
@@ -31,14 +31,18 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
#=============================================================================
|
||||
# FILE: posix/px4_target_impl.cmake
|
||||
#
|
||||
# Math library
|
||||
# Each PX4 target OS must implement the cmake/${OS}/px4_target_impl.cmake
|
||||
# rules for their target that implement the following macros:
|
||||
#
|
||||
SRCS = math/test/test.cpp \
|
||||
math/Limits.cpp
|
||||
|
||||
# px4_target_set_flags
|
||||
# px4_target_validate_config
|
||||
# px4_target_firmware
|
||||
# px4_target_rules
|
||||
# px4_target_testing
|
||||
#
|
||||
# In order to include .config we first have to save off the
|
||||
# current makefile name, since app.mk needs it.
|
||||
# The macros are called from the top level CMakeLists.txt
|
||||
#
|
||||
APP_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||
px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal")
|
||||
@@ -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}
|
||||
src/platforms
|
||||
src/platforms/ros/px4_messages
|
||||
src/include
|
||||
src/modules
|
||||
${CMAKE_BINARY_DIR}/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)
|
||||
endif()
|
||||
|
||||
|
||||
Executable
+91
@@ -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/scripts/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 :
|
||||
Executable
+50
@@ -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 :
|
||||
@@ -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@
|
||||
@@ -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 : #}
|
||||
Executable
+52
@@ -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 :
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
uorb start
|
||||
accelsim start
|
||||
px4_simple_app
|
||||
shutdown
|
||||
@@ -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-linux-gnueabihf-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-linux-gnueabihf-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 arm-linux-gnueabihf-${tool}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# os tools
|
||||
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}")
|
||||
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)
|
||||
@@ -0,0 +1,85 @@
|
||||
# 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()
|
||||
|
||||
# optional compiler tools
|
||||
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
|
||||
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}")
|
||||
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()
|
||||
|
||||
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)
|
||||
@@ -0,0 +1,254 @@
|
||||
#
|
||||
# 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 ("$ENV{HEXAGON_TOOLS_ROOT}" STREQUAL "")
|
||||
message(FATAL_ERROR
|
||||
"The HexagonTools version 7.2.10 must be installed and the environment variable HEXAGON_TOOLS_ROOT must be set"
|
||||
"(e.g. export HEXAGON_TOOLS_ROOT=/opt/HEXAGON_Tools/7.2.10/Tools)")
|
||||
else()
|
||||
set(HEXAGON_TOOLS_ROOT $ENV{HEXAGON_TOOLS_ROOT})
|
||||
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 (7.2.10)
|
||||
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_HAS_C9X
|
||||
-D__EXPORT=
|
||||
-Drestrict=
|
||||
-D_DEBUG
|
||||
-Wno-error=shadow
|
||||
)
|
||||
|
||||
# optimisation flags
|
||||
#
|
||||
set(ARCHOPTIMIZATION
|
||||
-O0
|
||||
-g
|
||||
-fno-strict-aliasing
|
||||
-fdata-sections
|
||||
-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)
|
||||
|
||||
# The Hexagon compiler doesn't support the -rdynamic flag and this is set
|
||||
# in the base cmake scripts. We have to redefine the __linux_compiler_gnu
|
||||
# macro for cmake 2.8 to work
|
||||
set(__LINUX_COMPILER_GNU 1)
|
||||
macro(__linux_compiler_gnu lang)
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "")
|
||||
endmacro()
|
||||
|
||||
@@ -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(common/px4_base)
|
||||
|
||||
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)
|
||||
@@ -0,0 +1,17 @@
|
||||
# compiler tools
|
||||
foreach(tool 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 cp touch make unzip)
|
||||
string(TOUPPER ${tool} TOOL)
|
||||
find_program(${TOOL} ${tool})
|
||||
if(NOT ${TOOL})
|
||||
message(FATAL_ERROR "could not find ${TOOL}")
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -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_<boardname>.mk
|
||||
|
||||
Board-specific configuration for <boardname>. Typically sets
|
||||
CONFIG_ARCH and then includes the toolchain definition for the board.
|
||||
|
||||
config_<boardname>_<configname>.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_<toolchainname>.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.
|
||||
@@ -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:
|
||||
# <absolute path>
|
||||
# $(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 <command>.<priority>.<stacksize>.<entrypoint>
|
||||
#
|
||||
# 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=<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)
|
||||
@@ -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)
|
||||
@@ -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 <command>_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:
|
||||
# <command>.<priority>.<stacksize>.<entrypoint>
|
||||
#
|
||||
# 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)
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 <command>.<priority>.<stacksize>.<entrypoint> 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)
|
||||
@@ -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 <command>.<priority>.<stacksize>.<entrypoint> 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 )
|
||||
@@ -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 <command>.<priority>.<stacksize>.<entrypoint> 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 )
|
||||
@@ -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 <command>.<priority>.<stacksize>.<entrypoint> 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 )
|
||||
@@ -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 <command>.<priority>.<stacksize>.<entrypoint> 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 )
|
||||
@@ -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 <command>.<priority>.<stacksize>.<entrypoint> 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 )
|
||||
@@ -1,10 +0,0 @@
|
||||
#
|
||||
# Makefile for the px4io_default configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/stm32
|
||||
MODULES += drivers/boards/px4io-v1
|
||||
MODULES += modules/px4iofirmware
|
||||
@@ -1,10 +0,0 @@
|
||||
#
|
||||
# Makefile for the px4iov2_default configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/stm32
|
||||
MODULES += drivers/boards/px4io-v2
|
||||
MODULES += modules/px4iofirmware
|
||||
@@ -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=<boardname> 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)
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user