forked from Archive/PX4-Autopilot
Merge branch 'master' of github.com:PX4/Firmware into control_state
This commit is contained in:
commit
c22c678b7d
|
@ -17,7 +17,9 @@
|
|||
.~lock.*
|
||||
Archives/*
|
||||
Build/*
|
||||
Testing/
|
||||
build/*
|
||||
build_*/
|
||||
core
|
||||
cscope.out
|
||||
Firmware.sublime-workspace
|
||||
|
@ -52,3 +54,4 @@ src/platforms/posix/px4_messages/
|
|||
src/platforms/posix-arm/px4_messages/
|
||||
src/platforms/qurt/px4_messages/
|
||||
ROMFS/*/*/rc.autostart
|
||||
rootfs/
|
||||
|
|
|
@ -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
|
||||
|
|
115
.travis.yml
115
.travis.yml
|
@ -3,8 +3,12 @@
|
|||
|
||||
language: cpp
|
||||
|
||||
# use travis-ci docker based infrastructure
|
||||
sudo: false
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
sudo: false
|
||||
- os: osx
|
||||
osx_image: beta-xcode6.3
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
@ -32,17 +36,34 @@ addons:
|
|||
- texinfo
|
||||
- zlib1g-dev
|
||||
|
||||
before_install:
|
||||
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
|
||||
pushd .
|
||||
&& cd ~
|
||||
&& wget https://launchpadlibrarian.net/186124160/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2
|
||||
&& tar -jxf gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2
|
||||
&& exportline="export PATH=$HOME/gcc-arm-none-eabi-4_8-2014q3/bin:\$PATH"
|
||||
&& if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
|
||||
&& . ~/.profile
|
||||
&& popd
|
||||
&& mkdir -p ~/bin
|
||||
&& wget -O ~/bin/astyle https://github.com/PX4/astyle/releases/download/2.05.1/astyle-linux && chmod +x ~/bin/astyle
|
||||
&& astyle --version
|
||||
&& if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||
;
|
||||
elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
|
||||
brew tap PX4/homebrew-px4
|
||||
&& brew update
|
||||
&& brew install genromfs
|
||||
&& brew install kconfig-frontends
|
||||
&& brew install gcc-arm-none-eabi
|
||||
&& brew install astyle
|
||||
&& sudo easy_install pip
|
||||
&& sudo pip install pyserial empy
|
||||
;
|
||||
fi
|
||||
|
||||
before_script:
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||
# General toolchain dependencies
|
||||
- pushd .
|
||||
- cd ~
|
||||
- wget https://launchpadlibrarian.net/186124160/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2
|
||||
- tar -jxf gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2
|
||||
- exportline="export PATH=$HOME/gcc-arm-none-eabi-4_8-2014q3/bin:\$PATH"
|
||||
- if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
|
||||
- . ~/.profile
|
||||
- popd
|
||||
# setup ccache
|
||||
- mkdir -p ~/bin
|
||||
- ln -s /usr/bin/ccache ~/bin/arm-none-eabi-g++
|
||||
|
@ -56,9 +77,6 @@ before_script:
|
|||
- ln -s /usr/bin/ccache ~/bin/g++-4.8
|
||||
- ln -s /usr/bin/ccache ~/bin/gcc-4.8
|
||||
- export PATH=~/bin:$PATH
|
||||
# grab astyle 2.05.1
|
||||
- wget -O ~/bin/astyle https://github.com/PX4/astyle/releases/download/2.05.1/astyle-linux && chmod +x ~/bin/astyle
|
||||
- astyle --version
|
||||
|
||||
env:
|
||||
global:
|
||||
|
@ -70,41 +88,54 @@ 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
|
||||
- make posix_sitl_simple
|
||||
- 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
|
||||
- make posix_sitl_simple test
|
||||
- cat build_posix_sitl_simple/src/modules/systemlib/mixer/mixer_multirotor.generated.h
|
||||
- echo -en 'travis_fold:end:script.2\\r'
|
||||
- echo 'Building NuttX..' && echo -en 'travis_fold:start:script.3\\r'
|
||||
- make archives
|
||||
- ccache -s
|
||||
- echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r'
|
||||
- make px4fmu-v1_default
|
||||
- make px4fmu-v2_default
|
||||
- echo -en 'travis_fold:end:script.3\\r'
|
||||
- echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.4\\r'
|
||||
- make -j4
|
||||
- make size
|
||||
- ccache -s
|
||||
- echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r'
|
||||
- make px4fmu-v2_default test
|
||||
- echo -en 'travis_fold:end:script.4\\r'
|
||||
- zip Firmware.zip Images/*.px4
|
||||
#- make px4fmu-v2_default package
|
||||
#- make posix -j4
|
||||
#- ccache -s
|
||||
#- echo -en 'travis_fold:end:script.1\\r'
|
||||
#- echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r'
|
||||
#- make tests
|
||||
#- cat src/modules/systemlib/mixer/mixer_multirotor.generated.h
|
||||
#- echo -en 'travis_fold:end:script.2\\r'
|
||||
#- echo 'Building NuttX..' && echo -en 'travis_fold:start:script.3\\r'
|
||||
#- make archives
|
||||
#- ccache -s
|
||||
#- echo -en 'travis_fold:end:script.3\\r'
|
||||
#- echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.4\\r'
|
||||
#- make -j4
|
||||
#- make size
|
||||
#- ccache -s
|
||||
#- echo -en 'travis_fold:end:script.4\\r'
|
||||
#- zip Firmware.zip Images/*.px4
|
||||
|
||||
after_script:
|
||||
- git clone git://github.com/PX4/CI-Tools.git
|
||||
- ./CI-Tools/s3cmd-configure
|
||||
# upload newest build for this branch with s3 index
|
||||
- ./CI-Tools/s3cmd-put Images/px4*.px4 CI-Tools/directory/index.html Firmware/$TRAVIS_BRANCH/
|
||||
# archive newest build by date with s3 index
|
||||
- ./CI-Tools/s3cmd-put Firmware.zip archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/
|
||||
- ./CI-Tools/s3cmd-put CI-Tools/directory/index.html archives/Firmware/$TRAVIS_BRANCH/
|
||||
# upload top level index.html and timestamp.html
|
||||
- ./CI-Tools/s3cmd-put CI-Tools/index.html index.html
|
||||
- ./CI-Tools/s3cmd-put CI-Tools/timestamp.html timestamp.html
|
||||
- echo ""
|
||||
- echo "Binaries have been posted to:"
|
||||
- echo https://px4-travis.s3.amazonaws.com/archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/Firmware.zip
|
||||
#after_script:
|
||||
#- git clone git://github.com/PX4/CI-Tools.git
|
||||
#- ./CI-Tools/s3cmd-configure
|
||||
## upload newest build for this branch with s3 index
|
||||
#- ./CI-Tools/s3cmd-put Images/px4*.px4 CI-Tools/directory/index.html Firmware/$TRAVIS_BRANCH/
|
||||
## archive newest build by date with s3 index
|
||||
#- ./CI-Tools/s3cmd-put Firmware.zip archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/
|
||||
#- ./CI-Tools/s3cmd-put CI-Tools/directory/index.html archives/Firmware/$TRAVIS_BRANCH/
|
||||
## upload top level index.html and timestamp.html
|
||||
#- ./CI-Tools/s3cmd-put CI-Tools/index.html index.html
|
||||
#- ./CI-Tools/s3cmd-put CI-Tools/timestamp.html timestamp.html
|
||||
#- echo ""
|
||||
#- echo "Binaries have been posted to:"
|
||||
#- echo https://px4-travis.s3.amazonaws.com/archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/Firmware.zip
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
|
|
630
CMakeLists.txt
630
CMakeLists.txt
|
@ -1,332 +1,328 @@
|
|||
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)
|
||||
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
|
||||
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_eigen PATH "src/lib/eigen")
|
||||
px4_add_git_submodule(TARGET git_nuttx PATH "NuttX")
|
||||
px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal")
|
||||
|
||||
add_custom_target(submodule_clean
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git submodule deinit -f .
|
||||
COMMAND rm -rf .git/modules/*
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# 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 git_eigen 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 :
|
||||
|
|
405
Makefile
405
Makefile
|
@ -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,176 @@
|
|||
# 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
|
||||
|
||||
# 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.
|
||||
#
|
||||
# Get path and tool configuration
|
||||
# Example usage:
|
||||
#
|
||||
export PX4_BASE := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))/
|
||||
include $(PX4_BASE)makefiles/setup.mk
|
||||
|
||||
# make px4fmu-v2_default (builds)
|
||||
# make px4fmu-v2_default upload (builds and uploads)
|
||||
# make px4fmu-v2_default test (builds and tests)
|
||||
#
|
||||
# Get a version string provided by git
|
||||
# This assumes that git command is available and that
|
||||
# the directory holding this file also contains .git directory
|
||||
#
|
||||
GIT_DESC := $(shell git log -1 --pretty=format:%H)
|
||||
ifneq ($(words $(GIT_DESC)),1)
|
||||
GIT_DESC := "unknown_git_version"
|
||||
endif
|
||||
# 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.
|
||||
|
||||
GIT_DESC_SHORT := $(shell echo $(GIT_DESC) | cut -c1-16)
|
||||
# explicity set default build target
|
||||
all: px4fmu-v2_default
|
||||
|
||||
#
|
||||
# Canned firmware configurations that we (know how to) build.
|
||||
#
|
||||
KNOWN_CONFIGS := $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/config_*.mk))))
|
||||
CONFIGS ?= $(KNOWN_CONFIGS)
|
||||
# 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
|
||||
|
||||
#
|
||||
# Boards that we (know how to) build NuttX export kits for.
|
||||
#
|
||||
KNOWN_BOARDS := $(subst board_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/board_*.mk))))
|
||||
BOARDS ?= $(KNOWN_BOARDS)
|
||||
|
||||
#
|
||||
# Debugging
|
||||
#
|
||||
MQUIET = --no-print-directory
|
||||
#MQUIET = --print-directory
|
||||
|
||||
################################################################################
|
||||
# No user-serviceable parts below
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# If the user has listed a config as a target, strip it out and override CONFIGS.
|
||||
#
|
||||
FIRMWARE_GOAL = firmware
|
||||
EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS))
|
||||
ifneq ($(EXPLICIT_CONFIGS),)
|
||||
CONFIGS := $(EXPLICIT_CONFIGS)
|
||||
.PHONY: $(EXPLICIT_CONFIGS)
|
||||
$(EXPLICIT_CONFIGS): all
|
||||
|
||||
#
|
||||
# If the user has asked to upload, they must have also specified exactly one
|
||||
# config.
|
||||
#
|
||||
ifneq ($(filter upload,$(MAKECMDGOALS)),)
|
||||
ifneq ($(words $(EXPLICIT_CONFIGS)),1)
|
||||
$(error In order to upload, exactly one board config must be specified)
|
||||
endif
|
||||
FIRMWARE_GOAL = upload
|
||||
.PHONY: upload
|
||||
upload:
|
||||
@:
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PX4_TARGET_OS),nuttx)
|
||||
include $(PX4_BASE)makefiles/nuttx/firmware_nuttx.mk
|
||||
endif
|
||||
ifeq ($(PX4_TARGET_OS),posix)
|
||||
include $(PX4_BASE)makefiles/posix/firmware_posix.mk
|
||||
endif
|
||||
ifeq ($(PX4_TARGET_OS),posix-arm)
|
||||
include $(PX4_BASE)makefiles/posix/firmware_posix.mk
|
||||
endif
|
||||
ifeq ($(PX4_TARGET_OS),qurt)
|
||||
include $(PX4_BASE)makefiles/qurt/firmware_qurt.mk
|
||||
endif
|
||||
|
||||
qurt_fixup:
|
||||
makefiles/qurt/setup.sh $(PX4_BASE)
|
||||
|
||||
restore:
|
||||
cd src/lib/eigen && git checkout .
|
||||
git submodule update
|
||||
|
||||
#
|
||||
# Versioning
|
||||
#
|
||||
|
||||
GIT_VER_FILE = $(PX4_VERSIONING_DIR).build_git_ver
|
||||
GIT_HEADER_FILE = $(PX4_VERSIONING_DIR)build_git_version.h
|
||||
|
||||
$(GIT_VER_FILE) :
|
||||
$(Q) if [ ! -f $(GIT_VER_FILE) ]; then \
|
||||
$(MKDIR) -p $(PX4_VERSIONING_DIR); \
|
||||
$(ECHO) "" > $(GIT_VER_FILE); \
|
||||
fi
|
||||
|
||||
.PHONY: checkgitversion
|
||||
checkgitversion: $(GIT_VER_FILE)
|
||||
$(Q) if [ "$(GIT_DESC)" != "$(shell cat $(GIT_VER_FILE))" ]; then \
|
||||
$(ECHO) "/* Auto Magically Generated file */" > $(GIT_HEADER_FILE); \
|
||||
$(ECHO) "/* Do not edit! */" >> $(GIT_HEADER_FILE); \
|
||||
$(ECHO) "#define PX4_GIT_VERSION_STR \"$(GIT_DESC)\"" >> $(GIT_HEADER_FILE); \
|
||||
$(ECHO) "#define PX4_GIT_VERSION_BINARY 0x$(GIT_DESC_SHORT)" >> $(GIT_HEADER_FILE); \
|
||||
$(ECHO) $(GIT_DESC) > $(GIT_VER_FILE); \
|
||||
fi
|
||||
#
|
||||
# Sizes
|
||||
#
|
||||
|
||||
.PHONY: size
|
||||
size:
|
||||
$(Q) for elfs in Build/*; do if [ -f $$elfs/firmware.elf ]; then $(SIZE) $$elfs/firmware.elf; fi done
|
||||
|
||||
|
||||
#
|
||||
# Submodule Checks
|
||||
#
|
||||
|
||||
.PHONY: checksubmodules
|
||||
checksubmodules:
|
||||
$(Q) ($(PX4_BASE)/Tools/check_submodules.sh $(PX4_TARGET_OS))
|
||||
|
||||
.PHONY: updatesubmodules
|
||||
updatesubmodules:
|
||||
$(Q) (git submodule init)
|
||||
$(Q) (git submodule update)
|
||||
|
||||
MSG_DIR = $(PX4_BASE)msg
|
||||
UORB_TEMPLATE_DIR = $(PX4_BASE)msg/templates/uorb
|
||||
MULTIPLATFORM_TEMPLATE_DIR = $(PX4_BASE)msg/templates/px4/uorb
|
||||
TOPICS_DIR = $(PX4_BASE)src/modules/uORB/topics
|
||||
MULTIPLATFORM_HEADER_DIR = $(PX4_BASE)src/platforms/$(PX4_TARGET_OS)/px4_messages
|
||||
MULTIPLATFORM_PREFIX = px4_
|
||||
TOPICHEADER_TEMP_DIR = $(BUILD_DIR)topics_temporary
|
||||
MULTI_TOPICHEADER_TEMP_DIR = $(BUILD_DIR)multi_topics_temporary
|
||||
GENMSG_PYTHONPATH = $(PX4_BASE)Tools/genmsg/src
|
||||
GENCPP_PYTHONPATH = $(PX4_BASE)Tools/gencpp/src
|
||||
|
||||
.PHONY: generateuorbtopicheaders
|
||||
generateuorbtopicheaders: checksubmodules
|
||||
@$(ECHO) "Generating uORB topic headers"
|
||||
$(Q) (PYTHONPATH=$(GENMSG_PYTHONPATH):$(GENCPP_PYTHONPATH):$(PYTHONPATH) $(PYTHON) \
|
||||
$(PX4_BASE)Tools/px_generate_uorb_topic_headers.py \
|
||||
-d $(MSG_DIR) -o $(TOPICS_DIR) -e $(UORB_TEMPLATE_DIR) -t $(TOPICHEADER_TEMP_DIR))
|
||||
@$(ECHO) "Generating multiplatform uORB topic wrapper headers"
|
||||
$(Q) (PYTHONPATH=$(GENMSG_PYTHONPATH):$(GENCPP_PYTHONPATH):$(PYTHONPATH) $(PYTHON) \
|
||||
$(PX4_BASE)Tools/px_generate_uorb_topic_headers.py \
|
||||
-d $(MSG_DIR) -o $(MULTIPLATFORM_HEADER_DIR) -e $(MULTIPLATFORM_TEMPLATE_DIR) -t $(MULTI_TOPICHEADER_TEMP_DIR) -p $(MULTIPLATFORM_PREFIX))
|
||||
|
||||
#
|
||||
# Testing targets
|
||||
#
|
||||
testbuild:
|
||||
$(Q) (cd $(PX4_BASE) && $(MAKE) distclean && $(MAKE) archives && $(MAKE) -j8)
|
||||
$(Q) (zip -r Firmware.zip $(PX4_BASE)/Images)
|
||||
|
||||
nuttx posix posix-arm qurt:
|
||||
ifeq ($(GOALS),)
|
||||
$(MAKE) PX4_TARGET_OS=$@ $(GOALS)
|
||||
# disable ninja by default for now because it hides upload progress
|
||||
#NINJA_BUILD := $(shell ninja --version 2>/dev/null)
|
||||
ifdef NINJA_BUILD
|
||||
PX4_CMAKE_GENERATOR ?= "Ninja"
|
||||
PX4_MAKE = ninja
|
||||
PX4_MAKE_ARGS =
|
||||
else
|
||||
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
|
||||
|
||||
# Functions
|
||||
# --------------------------------------------------------------------
|
||||
# describe how to build a cmake config
|
||||
define cmake-build
|
||||
+@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1); fi
|
||||
+$(PX4_MAKE) -C $(PWD)/build_$@ $(PX4_MAKE_ARGS) $(ARGS)
|
||||
endef
|
||||
|
||||
# create empty targets to avoid msgs for targets passed to cmake
|
||||
define cmake-targ
|
||||
$(1):
|
||||
@#
|
||||
.PHONY: $(1)
|
||||
endef
|
||||
|
||||
# ADD CONFIGS HERE
|
||||
# --------------------------------------------------------------------
|
||||
# Do not put any spaces between function arguments.
|
||||
|
||||
px4fmu-v1_default:
|
||||
$(call cmake-build,nuttx_px4fmu-v1_default)
|
||||
|
||||
px4fmu-v2_default:
|
||||
$(call cmake-build,nuttx_px4fmu-v2_default)
|
||||
|
||||
px4fmu-v2_simple:
|
||||
$(call cmake-build,nuttx_px4fmu-v2_simple)
|
||||
|
||||
nuttx_sim_simple:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
posix_sitl_simple:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
ros_sitl_simple:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
qurt_eagle_travis:
|
||||
$(call cmake-build,$@)
|
||||
|
||||
posix: posix_sitl_simple
|
||||
|
||||
ros: ros_sitl_simple
|
||||
|
||||
run_sitl_quad: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rcS
|
||||
|
||||
run_sitl_plane: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing
|
||||
|
||||
run_sitl_ros: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros
|
||||
|
||||
lldb_sitl_quad: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rcS lldb
|
||||
|
||||
lldb_sitl_plane: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing lldb
|
||||
|
||||
lldb_sitl_ros: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros lldb
|
||||
|
||||
gdb_sitl_quad: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rcS gdb
|
||||
|
||||
gdb_sitl_plane: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing lldb
|
||||
|
||||
gdb_sitl_ros: posix
|
||||
Tools/sitl_run.sh posix-configs/SITL/init/rc_iris_ros lldb
|
||||
|
||||
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
|
||||
@echo "Deprecated. Use 'run_sitl_quad' instead."
|
||||
|
||||
sitl_plane:
|
||||
$(Q) Tools/sitl_run.sh posix-configs/SITL/init/rc.fixed_wing
|
||||
@echo "Deprecated. Use 'run_sitl_plane' instead."
|
||||
|
||||
qurtrun:
|
||||
$(MAKE) PX4_TARGET_OS=qurt sim
|
||||
sitl_ros:
|
||||
@echo "Deprecated. Use 'run_sitl_ros' instead."
|
||||
|
||||
#
|
||||
# Unittest targets. Builds and runs the host-level
|
||||
# unit tests.
|
||||
.PHONY: tests
|
||||
tests: generateuorbtopicheaders
|
||||
$(Q) (mkdir -p $(PX4_BASE)/unittests/build && cd $(PX4_BASE)/unittests/build && cmake .. && $(MAKE) --no-print-directory unittests)
|
||||
|
||||
.PHONY: check_format
|
||||
# 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_*/
|
||||
|
||||
.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)
|
||||
@cd NuttX
|
||||
@git clean -d -f -x
|
||||
@cd ..
|
||||
@cd src/modules/uavcan/libuavcan
|
||||
@git clean -d -f -x
|
||||
@cd ../../../..
|
||||
|
||||
#
|
||||
# Print some help text
|
||||
#
|
||||
.PHONY: help
|
||||
help:
|
||||
@$(ECHO) ""
|
||||
@$(ECHO) " PX4 firmware builder"
|
||||
@$(ECHO) " ===================="
|
||||
@$(ECHO) ""
|
||||
@$(ECHO) " Available targets:"
|
||||
@$(ECHO) " ------------------"
|
||||
@$(ECHO) ""
|
||||
ifeq ($(PX4_TARGET_OS),nuttx)
|
||||
@$(ECHO) " archives"
|
||||
@$(ECHO) " Build the NuttX RTOS archives that are used by the firmware build."
|
||||
@$(ECHO) ""
|
||||
endif
|
||||
@$(ECHO) " all"
|
||||
@$(ECHO) " Build all firmware configs: $(CONFIGS)"
|
||||
@$(ECHO) " A limited set of configs can be built with CONFIGS=<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
|
||||
# targets handled by cmake
|
||||
cmake_targets = test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak libuavcan
|
||||
$(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
|
||||
#
|
||||
#clean-all:
|
||||
# @rm -rf Build/*
|
||||
#
|
||||
#help:
|
||||
# @echo
|
||||
# @echo "Type 'make ' and hit the tab key twice to see a list of the available"
|
||||
# @echo "build configurations."
|
||||
# @echo
|
||||
|
|
2
NuttX
2
NuttX
|
@ -1 +1 @@
|
|||
Subproject commit 8891d035df45c8be570cfbd9419b438679faf7ee
|
||||
Subproject commit 3009fb230ec8232c4c4fd7798fd70ea9632692ec
|
|
@ -16,7 +16,7 @@ This repository contains the PX4 Flight Core, with the main applications located
|
|||
* [Downloads](http://px4.io/firmware/downloads)
|
||||
* Releases
|
||||
* [Downloads](https://github.com/PX4/Firmware/releases)
|
||||
* Mailing list: [Google Groups](http://groups.google.com/group/px4users)
|
||||
* Forum / Mailing list: [Google Groups](http://groups.google.com/group/px4users)
|
||||
|
||||
### Users ###
|
||||
|
||||
|
@ -29,7 +29,7 @@ Contributing guide:
|
|||
* [PX4 Contribution Guide](http://px4.io/dev/contributing)
|
||||
|
||||
Software in the Loop guide:
|
||||
Use software in the loop [to get started with the codebase](https://github.com/PX4/Firmware/tree/master/posix-configs/SITL)
|
||||
Use software in the loop [to get started with the codebase](https://pixhawk.org/dev/simulation/native_sitl).
|
||||
|
||||
Developer guide:
|
||||
http://px4.io/dev/
|
||||
|
@ -38,8 +38,10 @@ Testing guide:
|
|||
http://px4.io/dev/unit_tests
|
||||
|
||||
This repository contains code supporting these boards:
|
||||
* [Snapdragon Flight](https://www.intrinsyc.com/qualcomm-snapdragon-flight/)
|
||||
* FMUv1.x
|
||||
* FMUv2.x
|
||||
* FMUv2.x (Pixhawk)
|
||||
* FMUv3.x (Pixhawk 2)
|
||||
* AeroCore (v1 and v2)
|
||||
* STM32F4Discovery (basic support) [Tutorial](https://pixhawk.org/modules/stm32f4discovery)
|
||||
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
sh /etc/init.d/rc.fw_defaults
|
||||
|
||||
set MIXER AERT
|
||||
|
||||
# The ESC requires a specific pulse to arm.
|
||||
set PWM_OUT 4
|
||||
set PWM_DISARMED p:PWM_DISARMED
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
sh /etc/init.d/rc.fw_defaults
|
||||
|
||||
set MIXER AETR
|
||||
|
||||
# The ESC requires a specific pulse to arm.
|
||||
set PWM_OUT 3
|
||||
set PWM_DISARMED p:PWM_DISARMED
|
||||
|
|
|
@ -9,18 +9,7 @@
|
|||
# filter by setting INAV_ENABLED = 0
|
||||
if param compare INAV_ENABLED 1
|
||||
then
|
||||
# The system is defaulting to EKF_ATT_ENABLED = 1
|
||||
# and uses the older EKF filter. However users can
|
||||
# enable the new quaternion based complimentary
|
||||
# filter by setting EKF_ATT_ENABLED = 0.
|
||||
# Note that on FMUv1, the EKF att estimator is not
|
||||
# available and the Q estimator runs instead.
|
||||
if param compare EKF_ATT_ENABLED 1
|
||||
then
|
||||
attitude_estimator_ekf start
|
||||
else
|
||||
attitude_estimator_q start
|
||||
fi
|
||||
attitude_estimator_q start
|
||||
position_estimator_inav start
|
||||
else
|
||||
ekf_att_pos_estimator start
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -365,11 +365,6 @@ then
|
|||
then
|
||||
fi
|
||||
|
||||
#
|
||||
# UAVCAN
|
||||
#
|
||||
sh /etc/init.d/rc.uavcan
|
||||
|
||||
#
|
||||
# Sensors System (start before Commander so Preflight checks are properly run)
|
||||
#
|
||||
|
@ -576,6 +571,11 @@ then
|
|||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# UAVCAN
|
||||
#
|
||||
sh /etc/init.d/rc.uavcan
|
||||
|
||||
#
|
||||
# Logging
|
||||
#
|
||||
|
|
|
@ -25,7 +25,7 @@ for fn in $(find src/examples \
|
|||
-path './NuttX' -prune -o \
|
||||
-path './src/lib/eigen' -prune -o \
|
||||
-path './src/lib/mathlib/CMSIS' -prune -o \
|
||||
-path './src/lib/uavcan' -prune -o \
|
||||
-path './src/modules/uavcan/libuavcan' -prune -o \
|
||||
-path './src/modules/attitude_estimator_ekf/codegen' -prune -o \
|
||||
-path './src/modules/ekf_att_pos_estimator' -prune -o \
|
||||
-path './src/modules/sdlog2' -prune -o \
|
||||
|
|
|
@ -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,37 @@ for index,m in enumerate(raw_messages):
|
|||
temp_list = []
|
||||
f = open(m,'r')
|
||||
for line in f.readlines():
|
||||
if(line.split(' ')[0] == "float32"):
|
||||
if ('float32[' in line.split(' ')[0]):
|
||||
num_floats = int(line.split(" ")[0].split("[")[1].split("]")[0])
|
||||
temp_list.append(("float_array",line.split(' ')[1].split('\t')[0].split('\n')[0],num_floats))
|
||||
if ('uint64[' in line.split(' ')[0]):
|
||||
num_floats = int(line.split(" ")[0].split("[")[1].split("]")[0])
|
||||
temp_list.append(("uint64_array",line.split(' ')[1].split('\t')[0].split('\n')[0],num_floats))
|
||||
elif(line.split(' ')[0] == "float32"):
|
||||
temp_list.append(("float",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif(line.split(' ')[0] == "uint64"):
|
||||
elif(line.split(' ')[0] == "uint64") and len(line.split('=')) == 1:
|
||||
temp_list.append(("uint64",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif (line.split(' ')[0] == "bool"):
|
||||
elif(line.split(' ')[0] == "uint32") and len(line.split('=')) == 1:
|
||||
temp_list.append(("uint32",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif(line.split(' ')[0] == "uint16") and len(line.split('=')) == 1:
|
||||
temp_list.append(("uint16",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif(line.split(' ')[0] == "int64") and len(line.split('=')) == 1:
|
||||
temp_list.append(("int64",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif(line.split(' ')[0] == "int32") and len(line.split('=')) == 1:
|
||||
temp_list.append(("int32",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif(line.split(' ')[0] == "int16") and len(line.split('=')) == 1:
|
||||
temp_list.append(("int16",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif (line.split(' ')[0] == "bool") and len(line.split('=')) == 1:
|
||||
temp_list.append(("bool",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif (line.split(' ')[0] == "uint8") and len(line.split('=')) == 1:
|
||||
temp_list.append(("uint8",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif ('float32[' in line.split(' ')[0]):
|
||||
num_floats = int(line.split(" ")[0].split("[")[1].split("]")[0])
|
||||
temp_list.append(("float_array",line.split(' ')[1].split('\t')[0].split('\n')[0],num_floats))
|
||||
elif (line.split(' ')[0] == "int8") and len(line.split('=')) == 1:
|
||||
temp_list.append(("int8",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
|
||||
f.close()
|
||||
messages.append(m.split('/')[-1].split('.')[0])
|
||||
(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 +92,28 @@ print("""
|
|||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file topic_listener.cpp, autogenerated by Tools/generate_listener.py
|
||||
* @file topic_listener.cpp
|
||||
*
|
||||
* Autogenerated by Tools/generate_listener.py
|
||||
*
|
||||
* Tool for listening to topics when running flight stack on linux.
|
||||
*/
|
||||
|
||||
#include <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
|
||||
|
||||
""")
|
||||
for m in messages:
|
||||
print("#include <uORB/topics/%s.h>" % m)
|
||||
|
@ -108,39 +130,52 @@ 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: %%f\\n\",(double)container.%s);" % (item[1], item[1]))
|
||||
elif item[0] == "float_array":
|
||||
print("\t\t\tprintf(\"%s:\");" % item[1])
|
||||
print("\t\t\tfor (int j=0;j<%d;j++) {" % item[2])
|
||||
print("\t\t\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\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: %%\" PRI64 \"\\n\",container.%s);" % (item[1], item[1]))
|
||||
elif item[0] == "int32":
|
||||
print("\t\t\tprintf(\"%s: %%d\\n\",container.%s);" % (item[1], item[1]))
|
||||
elif item[0] == "uint32":
|
||||
print("\t\t\tprintf(\"%s: %%d\\n\",container.%s);" % (item[1], item[1]))
|
||||
elif item[0] == "uint8":
|
||||
print("\t\t\tprintf(\"%s: %%u\\n \",container.%s);" % (item[1], item[1]))
|
||||
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 {")
|
||||
|
|
|
@ -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
|
|
@ -151,7 +151,7 @@ class SourceParser(object):
|
|||
Returns list of supported file extensions that can be parsed by this
|
||||
parser. The parser uses any extension.
|
||||
"""
|
||||
return [""]
|
||||
return ["", ".hil"]
|
||||
|
||||
def Parse(self, path, contents):
|
||||
"""
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -76,8 +76,8 @@ def main():
|
|||
pruned_content += line
|
||||
|
||||
# overwrite old scratch file
|
||||
with open(file_path, "w") as f:
|
||||
f.write(pruned_content)
|
||||
with open(file_path, "wb") as f:
|
||||
f.write(pruned_content.encode("ascii", errors='strict'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
#!/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
|
||||
cp Tools/posix_lldbinit build_posix_sitl_simple/src/firmware/posix/.lldbinit
|
||||
cp Tools/posix.gdbinit build_posix_sitl_simple/src/firmware/posix/.gdbinit
|
||||
cd build_posix_sitl_simple/src/firmware/posix
|
||||
mkdir -p rootfs/fs/microsd
|
||||
mkdir -p rootfs/eeprom
|
||||
touch rootfs/eeprom/parameters
|
||||
if [ "$2" == "lldb" ]
|
||||
then
|
||||
lldb -- mainapp ../../../../$1
|
||||
elif [ "$2" == "gdb" ]
|
||||
then
|
||||
gdb --args mainapp ../../../../$1
|
||||
else
|
||||
./mainapp ../../../../$1
|
||||
fi
|
||||
|
|
|
@ -73,12 +73,12 @@ Vagrant.configure(2) do |config|
|
|||
# Enable provisioning with a shell script. Additional provisioners such as
|
||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
||||
# documentation for more information about their specific syntax and use.
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
config.vm.provision "shell", privileged: false, inline: <<-SHELL
|
||||
# Ensure we start in the Firmware folder
|
||||
echo "cd /Firmware" >> ~/.bashrc
|
||||
# Install software
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential ccache cmake clang-3.5 lldb-3.5 g++-4.8 gcc-4.8 genromfs libc6-i386 libncurses5-dev python-argparse python-empy python-serial s3cmd texinfo zlib1g-dev git-core
|
||||
sudo apt-get install -y build-essential ccache cmake clang-3.5 lldb-3.5 g++-4.8 gcc-4.8 genromfs libc6-i386 libncurses5-dev python-argparse python-empy python-serial s3cmd texinfo zlib1g-dev git-core zip gdb
|
||||
pushd .
|
||||
cd ~
|
||||
wget -q https://launchpadlibrarian.net/186124160/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2
|
||||
|
|
|
@ -0,0 +1,865 @@
|
|||
############################################################################
|
||||
#
|
||||
# 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_${NAME}.stamp
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git submodule update --init --recursive -f ${PATH}
|
||||
COMMAND touch ${CMAKE_BINARY_DIR}/git_${NAME}.stamp
|
||||
)
|
||||
add_custom_target(${TARGET}
|
||||
DEPENDS git_${NAME}.stamp
|
||||
)
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_prepend_string
|
||||
#
|
||||
# This function prepends a string to a list
|
||||
#
|
||||
# Usage:
|
||||
# px4_prepend_string(OUT <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 "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
|
||||
)
|
||||
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
|
||||
-Wno-varargs
|
||||
-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} STREQUAL "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
|
||||
)
|
||||
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} STREQUAL "Clang")
|
||||
list(APPEND optimization_flags
|
||||
-fno-strength-reduce
|
||||
-fno-builtin-printf
|
||||
)
|
||||
endif()
|
||||
|
||||
set(c_warnings
|
||||
-Wstrict-prototypes
|
||||
-Wmissing-prototypes
|
||||
-Wnested-externs
|
||||
)
|
||||
|
||||
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
|
||||
list(APPEND c_warnings
|
||||
-Wold-style-declaration
|
||||
-Wmissing-parameter-type
|
||||
)
|
||||
endif()
|
||||
|
||||
set(c_compile_flags
|
||||
-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} STREQUAL "Clang")
|
||||
set(added_exe_link_flags
|
||||
-Wl,--warn-common
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
else()
|
||||
set(added_exe_link_flags
|
||||
-Wl,--warn-common
|
||||
)
|
||||
endif()
|
||||
|
||||
# output
|
||||
foreach(var ${inout_vars})
|
||||
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 log -n 1 --pretty=format:"%H"
|
||||
OUTPUT_VARIABLE git_desc
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
message(STATUS "GIT_DESC = ${git_desc}")
|
||||
set(git_desc_short)
|
||||
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,185 @@
|
|||
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/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,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,35 @@
|
|||
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
|
||||
|
||||
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,71 @@
|
|||
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
|
||||
)
|
||||
|
||||
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.4.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.4.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.4.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.4.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.4.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.4.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
|
||||
)
|
||||
|
|
@ -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 ${RM} -rf ${nuttx_src}
|
||||
COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src}
|
||||
COMMAND ${RM} -rf ${nuttx_src}/.git
|
||||
COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp
|
||||
DEPENDS ${DEPENDS})
|
||||
add_custom_target(__nuttx_copy_${CONFIG}
|
||||
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
|
||||
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,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_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(git_eigen_patched
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/eigen
|
||||
COMMAND git checkout .
|
||||
COMMAND git checkout master
|
||||
COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/cmake/qurt/qurt_eigen.patch
|
||||
DEPENDS git_eigen)
|
||||
add_custom_target(${OUT} DEPENDS git_dspal git_eigen_patched)
|
||||
add_custom_target(ALL DEPENDS git_eigen_patched)
|
||||
|
||||
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()
|
||||
|
||||
|
|
@ -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 :
|
|
@ -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 : #}
|
|
@ -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-none-eabi-gcc compiler")
|
||||
endif()
|
||||
cmake_force_c_compiler(${C_COMPILER} GNU)
|
||||
|
||||
find_program(CXX_COMPILER arm-linux-gnueabihf-g++)
|
||||
if(NOT CXX_COMPILER)
|
||||
message(FATAL_ERROR "could not find arm-none-eabi-g++ compiler")
|
||||
endif()
|
||||
cmake_force_cxx_compiler(${CXX_COMPILER} GNU)
|
||||
|
||||
# compiler tools
|
||||
foreach(tool objcopy nm ld)
|
||||
string(TOUPPER ${tool} TOOL)
|
||||
find_program(${TOOL} arm-linux-gnueabihf-${tool})
|
||||
if(NOT ${TOOL})
|
||||
message(FATAL_ERROR "could not find ${tool}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# os tools
|
||||
foreach(tool echo patch grep rm mkdir nm genromfs 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,240 @@
|
|||
#
|
||||
# Copyright (C) 2015 Mark Charlebois. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
include(CMakeForceCompiler)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
include(common/px4_base)
|
||||
|
||||
if(NOT HEXAGON_TOOLS_ROOT)
|
||||
set(HEXAGON_TOOLS_ROOT /opt/7.4/Tools)
|
||||
endif()
|
||||
|
||||
macro (list2string out in)
|
||||
set(list ${ARGV})
|
||||
list(REMOVE_ITEM list ${out})
|
||||
foreach(item ${list})
|
||||
set(${out} "${${out}} ${item}")
|
||||
endforeach()
|
||||
endmacro(list2string)
|
||||
|
||||
set(V_ARCH "v5")
|
||||
set(CROSSDEV "hexagon-")
|
||||
set(HEXAGON_BIN ${HEXAGON_TOOLS_ROOT}/bin)
|
||||
set(HEXAGON_LIB_DIR ${HEXAGON_TOOLS_ROOT}/gnu/hexagon/lib)
|
||||
set(HEXAGON_ISS_DIR ${HEXAGON_TOOLS_ROOT}/lib/iss)
|
||||
set(TOOLSLIB ${HEXAGON_TOOLS_ROOT}/target/hexagon/lib/${V_ARCH}/G0)
|
||||
|
||||
# Use the HexagonTools compiler (6.4.05)
|
||||
set(CMAKE_C_COMPILER ${HEXAGON_BIN}/${CROSSDEV}clang)
|
||||
set(CMAKE_CXX_COMPILER ${HEXAGON_BIN}/${CROSSDEV}clang++)
|
||||
|
||||
set(CMAKE_AR ${HEXAGON_BIN}/${CROSSDEV}ar CACHE FILEPATH "Archiver")
|
||||
set(CMAKE_RANLIB ${HEXAGON_BIN}/${CROSSDEV}ranlib)
|
||||
set(CMAKE_LINKER ${HEXAGON_BIN}/${CROSSDEV}ld.qcld)
|
||||
set(CMAKE_NM ${HEXAGON_BIN}/${CROSSDEV}nm)
|
||||
set(CMAKE_OBJDUMP ${HEXAGON_BIN}/${CROSSDEV}objdump)
|
||||
set(CMAKE_OBJCOPY ${HEXAGON_BIN}/${CROSSDEV}objcopy)
|
||||
|
||||
list2string(HEXAGON_INCLUDE_DIRS
|
||||
-I${HEXAGON_TOOLS_ROOT}/target/hexagon/include
|
||||
)
|
||||
|
||||
#set(DYNAMIC_LIBS -Wl,${TOOLSLIB}/pic/libstdc++.a)
|
||||
|
||||
#set(MAXOPTIMIZATION -O0)
|
||||
|
||||
# Base CPU flags for each of the supported architectures.
|
||||
#
|
||||
set(ARCHCPUFLAGS
|
||||
-m${V_ARCH}
|
||||
-G0
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-D_PID_T -D_UID_T -D_TIMER_T
|
||||
-Dnoreturn_function=
|
||||
-D__EXPORT=
|
||||
-Drestrict=
|
||||
-D_DEBUG
|
||||
-Wno-error=shadow
|
||||
)
|
||||
|
||||
# optimisation flags
|
||||
#
|
||||
set(ARCHOPTIMIZATION
|
||||
-O0
|
||||
-g
|
||||
-fno-strict-aliasing
|
||||
-fdata-sections
|
||||
-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,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()
|
|
@ -0,0 +1,90 @@
|
|||
|
||||
set(WARNINGS
|
||||
-Wall
|
||||
-Werror
|
||||
-Wextra
|
||||
-Wdouble-promotion
|
||||
-Wshadow
|
||||
-Wfloat-equal
|
||||
-Wframe-larger-than=1024
|
||||
-Wpointer-arith
|
||||
-Wlogical-op
|
||||
-Wmissing-declarations
|
||||
-Wno-unused-parameter
|
||||
-Werror=format-security
|
||||
-Werror=array-bounds
|
||||
-Wfatal-errors
|
||||
-Wformat=1
|
||||
-Werror=unused-but-set-variable
|
||||
-Werror=unused-variable
|
||||
-Werror=double-promotion
|
||||
-Werror=reorder
|
||||
-Werror=uninitialized
|
||||
-Werror=init-self
|
||||
-Werror=return-type
|
||||
-Werror=deprecated
|
||||
-Werror=unused-private-field
|
||||
-Wno-packed
|
||||
-Wno-frame-larger-than=
|
||||
-Wno-varargs
|
||||
#-Wcast-qual - generates spurious noreturn attribute warnings,
|
||||
# try again later
|
||||
#-Wconversion - would be nice, but too many "risky-but-safe"
|
||||
# conversions in the code
|
||||
#-Wcast-align - would help catch bad casts in some cases,
|
||||
# but generates too many false positives
|
||||
)
|
||||
|
||||
set(OPT_FLAGS
|
||||
-Os -g3
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# c flags
|
||||
#
|
||||
set(C_WARNINGS
|
||||
-Wbad-function-cast
|
||||
-Wstrict-prototypes
|
||||
-Wold-style-declaration
|
||||
-Wmissing-parameter-type
|
||||
-Wmissing-prototypes
|
||||
-Wnested-externs
|
||||
)
|
||||
set(C_FLAGS
|
||||
-std=gnu99
|
||||
-fno-common
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# cxx flags
|
||||
#
|
||||
set(CXX_WARNINGS
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-varargs
|
||||
)
|
||||
set(CXX_FLAGS
|
||||
-fno-exceptions
|
||||
-fno-rtti
|
||||
-std=gnu++0x
|
||||
-fno-threadsafe-statics
|
||||
-DCONFIG_WCHAR_BUILTIN
|
||||
-D__CUSTOM_FILE_IO__
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# ld flags
|
||||
#
|
||||
set(LD_FLAGS
|
||||
-Wl,--warn-common
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# misc flags
|
||||
#
|
||||
set(VISIBILITY_FLAGS
|
||||
-fvisibility=hidden
|
||||
"-include ${CMAKE_SOURCE_DIR}/src/include/visibility.h"
|
||||
)
|
||||
set(EXE_LINK_FLAGS)
|
||||
|
|
@ -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)
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# ROMFS generation
|
||||
################################################################################
|
||||
|
||||
ifneq ($(ROMFS_ROOT),)
|
||||
ifeq ($(wildcard $(ROMFS_ROOT)),)
|
||||
$(error ROMFS_ROOT specifies a directory that does not exist)
|
||||
endif
|
||||
|
||||
#
|
||||
# Note that there is no support for more than one root directory or constructing
|
||||
# a root from several templates. That would be a nice feature.
|
||||
#
|
||||
|
||||
# Add dependencies on anything in the ROMFS root directory
|
||||
ROMFS_FILES += $(wildcard \
|
||||
$(ROMFS_ROOT)/* \
|
||||
$(ROMFS_ROOT)/*/* \
|
||||
$(ROMFS_ROOT)/*/*/* \
|
||||
$(ROMFS_ROOT)/*/*/*/* \
|
||||
$(ROMFS_ROOT)/*/*/*/*/* \
|
||||
$(ROMFS_ROOT)/*/*/*/*/*/*)
|
||||
ifeq ($(ROMFS_FILES),)
|
||||
$(error ROMFS_ROOT $(ROMFS_ROOT) specifies a directory containing no files)
|
||||
endif
|
||||
ROMFS_DEPS += $(ROMFS_FILES)
|
||||
|
||||
# Extra files that may be copied into the ROMFS /extras directory
|
||||
# ROMFS_EXTRA_FILES are required, ROMFS_OPTIONAL_FILES are optional
|
||||
ROMFS_EXTRA_FILES += $(wildcard $(ROMFS_OPTIONAL_FILES))
|
||||
ROMFS_DEPS += $(ROMFS_EXTRA_FILES)
|
||||
|
||||
ROMFS_IMG = romfs.img
|
||||
ROMFS_SCRATCH = romfs_scratch
|
||||
ROMFS_CSRC = $(ROMFS_IMG:.img=.c)
|
||||
ROMFS_OBJ = $(ROMFS_CSRC:.c=.o)
|
||||
LIBS += $(ROMFS_OBJ)
|
||||
LINK_DEPS += $(ROMFS_OBJ)
|
||||
|
||||
# Add autostart script
|
||||
ROMFS_AUTOSTART = $(PX4_BASE)/Tools/px_process_airframes.py
|
||||
|
||||
# Remove all comments from startup and mixer files
|
||||
ROMFS_PRUNER = $(PX4_BASE)/Tools/px_romfs_pruner.py
|
||||
|
||||
# Turn the ROMFS image into an object file
|
||||
$(ROMFS_OBJ): $(ROMFS_IMG) $(GLOBAL_DEPS)
|
||||
$(call BIN_TO_OBJ,$<,$@,romfs_img)
|
||||
|
||||
# Generate the ROMFS image from the root
|
||||
$(ROMFS_IMG): $(ROMFS_SCRATCH) $(ROMFS_DEPS) $(GLOBAL_DEPS)
|
||||
@$(ECHO) "ROMFS: $@"
|
||||
$(Q) $(GENROMFS) -f $@ -d $(ROMFS_SCRATCH) -V "NSHInitVol"
|
||||
|
||||
# Construct the ROMFS scratch root from the canonical root
|
||||
$(ROMFS_SCRATCH): $(ROMFS_DEPS) $(GLOBAL_DEPS)
|
||||
$(Q) $(MKDIR) -p $(ROMFS_SCRATCH)
|
||||
$(Q) $(COPYDIR) $(ROMFS_ROOT)/* $(ROMFS_SCRATCH)
|
||||
# delete all files in ROMFS_SCRATCH which start with a . or end with a ~
|
||||
$(Q) $(RM) $(ROMFS_SCRATCH)/*/.[!.]* $(ROMFS_SCRATCH)/*/*~
|
||||
ifneq ($(ROMFS_EXTRA_FILES),)
|
||||
$(Q) $(MKDIR) -p $(ROMFS_SCRATCH)/extras
|
||||
$(Q) $(COPY) $(ROMFS_EXTRA_FILES) $(ROMFS_SCRATCH)/extras
|
||||
endif
|
||||
$(Q) $(PYTHON) -u $(ROMFS_AUTOSTART) -a $(ROMFS_ROOT)/init.d/ -s $(ROMFS_SCRATCH)/init.d/rc.autostart
|
||||
# Execute in standard dir as well
|
||||
# so developers notice the generated file
|
||||
$(Q) $(PYTHON) -u $(ROMFS_AUTOSTART) -a $(ROMFS_ROOT)/init.d/ -s $(ROMFS_ROOT)/init.d/rc.autostart
|
||||
$(Q) $(PYTHON) -u $(ROMFS_PRUNER) --folder $(ROMFS_SCRATCH)
|
||||
|
||||
EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG)
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Builtin command list generation
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# Builtin commands can be generated by the configuration, in which case they
|
||||
# must refer to commands that already exist, or indirectly generated by modules
|
||||
# when they are built.
|
||||
#
|
||||
# The configuration supplies builtin command information in the BUILTIN_COMMANDS
|
||||
# variable. Applications make empty files in $(WORK_DIR)/builtin_commands whose
|
||||
# filename contains the same information.
|
||||
#
|
||||
# In each case, the command information consists of four fields separated with a
|
||||
# period. These fields are the command's name, its thread priority, its stack size
|
||||
# and the name of the function to call when starting the thread.
|
||||
#
|
||||
BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c
|
||||
|
||||
# command definitions from modules (may be empty at Makefile parsing time...)
|
||||
MODULE_COMMANDS = $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*)))
|
||||
|
||||
# We must have at least one pre-defined builtin command in order to generate
|
||||
# any of this.
|
||||
#
|
||||
ifneq ($(BUILTIN_COMMANDS),)
|
||||
|
||||
# (BUILTIN_PROTO,<cmdspec>,<outputfile>)
|
||||
define BUILTIN_PROTO
|
||||
$(ECHO) 'extern int $(word 4,$1)(int argc, char *argv[]);' >> $2;
|
||||
endef
|
||||
|
||||
# (BUILTIN_DEF,<cmdspec>,<outputfile>)
|
||||
define BUILTIN_DEF
|
||||
$(ECHO) ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2;
|
||||
endef
|
||||
|
||||
# Don't generate until modules have updated their command files
|
||||
$(BUILTIN_CSRC): $(GLOBAL_DEPS) $(MODULE_OBJS) $(MODULE_MKFILES) $(BUILTIN_COMMAND_FILES)
|
||||
@$(ECHO) "CMDS: $@"
|
||||
$(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@
|
||||
$(Q) $(ECHO) '#include <nuttx/config.h>' >> $@
|
||||
$(Q) $(ECHO) '#include <nuttx/binfmt/builtin.h>' >> $@
|
||||
$(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@))
|
||||
$(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@))
|
||||
$(Q) $(ECHO) 'const struct builtin_s g_builtins[] = {' >> $@
|
||||
$(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@))
|
||||
$(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@))
|
||||
$(Q) $(ECHO) ' {NULL, 0, 0, NULL}' >> $@
|
||||
$(Q) $(ECHO) '};' >> $@
|
||||
$(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS) $(MODULE_COMMANDS));' >> $@
|
||||
|
||||
SRCS += $(BUILTIN_CSRC)
|
||||
|
||||
EXTRA_CLEANS += $(BUILTIN_CSRC)
|
||||
|
||||
endif
|
||||
|
|
@ -1,342 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2012-2014 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Definitions for a generic GNU ARM-EABI toolchain
|
||||
#
|
||||
|
||||
#$(info TOOLCHAIN gnu-arm-eabi)
|
||||
|
||||
# Toolchain commands. Normally only used inside this file.
|
||||
#
|
||||
CROSSDEV = arm-none-eabi-
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
# Check if the right version of the toolchain is available
|
||||
#
|
||||
CROSSDEV_VER_SUPPORTED = 4.7.4 4.7.5 4.7.6 4.8.4 4.9.3
|
||||
CROSSDEV_VER_FOUND = $(shell $(CC) -dumpversion)
|
||||
|
||||
ifeq (,$(findstring $(CROSSDEV_VER_FOUND), $(CROSSDEV_VER_SUPPORTED)))
|
||||
$(error Unsupported version of $(CC), found: $(CROSSDEV_VER_FOUND) instead of one in: $(CROSSDEV_VER_SUPPORTED))
|
||||
endif
|
||||
|
||||
|
||||
# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup
|
||||
|
||||
MAXOPTIMIZATION ?= -O3
|
||||
|
||||
# Base CPU flags for each of the supported architectures.
|
||||
#
|
||||
ARCHCPUFLAGS_CORTEXM4F = -mcpu=cortex-m4 \
|
||||
-mthumb \
|
||||
-march=armv7e-m \
|
||||
-mfpu=fpv4-sp-d16 \
|
||||
-mfloat-abi=hard
|
||||
|
||||
ARCHCPUFLAGS_CORTEXM4 = -mcpu=cortex-m4 \
|
||||
-mthumb \
|
||||
-march=armv7e-m \
|
||||
-mfloat-abi=soft
|
||||
|
||||
ARCHCPUFLAGS_CORTEXM3 = -mcpu=cortex-m3 \
|
||||
-mthumb \
|
||||
-march=armv7-m \
|
||||
-mfloat-abi=soft
|
||||
|
||||
# Enabling stack checks if OS was build with them
|
||||
#
|
||||
TEST_FILE_STACKCHECK=$(WORK_DIR)nuttx-export/include/nuttx/config.h
|
||||
TEST_VALUE_STACKCHECK=CONFIG_ARMV7M_STACKCHECK\ 1
|
||||
ENABLE_STACK_CHECKS=$(shell $(GREP) -q "$(TEST_VALUE_STACKCHECK)" $(TEST_FILE_STACKCHECK); echo $$?;)
|
||||
ifeq ("$(ENABLE_STACK_CHECKS)","0")
|
||||
ARCHINSTRUMENTATIONDEFINES_CORTEXM4F = -finstrument-functions -ffixed-r10
|
||||
ARCHINSTRUMENTATIONDEFINES_CORTEXM4 = -finstrument-functions -ffixed-r10
|
||||
ARCHINSTRUMENTATIONDEFINES_CORTEXM3 =
|
||||
else
|
||||
ARCHINSTRUMENTATIONDEFINES_CORTEXM4F =
|
||||
ARCHINSTRUMENTATIONDEFINES_CORTEXM4 =
|
||||
ARCHINSTRUMENTATIONDEFINES_CORTEXM3 =
|
||||
endif
|
||||
|
||||
# Pick the right set of flags for the architecture.
|
||||
#
|
||||
ARCHCPUFLAGS = $(ARCHCPUFLAGS_$(CONFIG_ARCH))
|
||||
ifeq ($(ARCHCPUFLAGS),)
|
||||
$(error Must set CONFIG_ARCH to one of CORTEXM4F, CORTEXM4 or CORTEXM3)
|
||||
endif
|
||||
|
||||
# Set the board flags
|
||||
#
|
||||
ifeq ($(CONFIG_BOARD),)
|
||||
$(error Board config does not define CONFIG_BOARD)
|
||||
endif
|
||||
ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) -D__PX4_NUTTX
|
||||
|
||||
# optimisation flags
|
||||
#
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \
|
||||
-g3 \
|
||||
-fno-strict-aliasing \
|
||||
-fno-strength-reduce \
|
||||
-fomit-frame-pointer \
|
||||
-funsafe-math-optimizations \
|
||||
-fno-builtin-printf \
|
||||
-ffunction-sections \
|
||||
-fdata-sections
|
||||
|
||||
# enable precise stack overflow tracking
|
||||
# note - requires corresponding support in NuttX
|
||||
INSTRUMENTATIONDEFINES = $(ARCHINSTRUMENTATIONDEFINES_$(CONFIG_ARCH))
|
||||
|
||||
LIBC := $(shell ${CC} ${ARCHCPUFLAGS} -print-file-name=libc.a)
|
||||
|
||||
# Language-specific flags
|
||||
#
|
||||
ARCHCFLAGS = -std=gnu99
|
||||
ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x -fno-threadsafe-statics -D__CUSTOM_FILE_IO__
|
||||
|
||||
#
|
||||
# Provide defaults, but allow for module override
|
||||
WFRAME_LARGER_THAN ?= 1024
|
||||
|
||||
|
||||
|
||||
# Generic warnings
|
||||
#
|
||||
ARCHWARNINGS = -Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-Wdouble-promotion \
|
||||
-Wshadow \
|
||||
-Wfloat-equal \
|
||||
-Wpointer-arith \
|
||||
-Wmissing-declarations \
|
||||
-Wpacked \
|
||||
-Wno-unused-parameter \
|
||||
-Werror=format-security \
|
||||
-Werror=array-bounds \
|
||||
-Wfatal-errors \
|
||||
-Wformat=1 \
|
||||
-Werror=unused-but-set-variable \
|
||||
-Werror=unused-variable \
|
||||
-Werror=double-promotion \
|
||||
-Werror=reorder \
|
||||
-Werror=uninitialized \
|
||||
-Werror=init-self
|
||||
# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+
|
||||
# -Wcast-qual - generates spurious noreturn attribute warnings, try again later
|
||||
# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code
|
||||
# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives
|
||||
|
||||
# C-specific warnings
|
||||
#
|
||||
ARCHCWARNINGS = $(ARCHWARNINGS) \
|
||||
-Wbad-function-cast \
|
||||
-Wstrict-prototypes \
|
||||
-Wold-style-declaration \
|
||||
-Wmissing-parameter-type \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs
|
||||
|
||||
# C++-specific warnings
|
||||
#
|
||||
ARCHWARNINGSXX = $(ARCHWARNINGS) \
|
||||
-Wno-missing-field-initializers
|
||||
|
||||
# pull in *just* libm from the toolchain ... this is grody
|
||||
LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a)
|
||||
EXTRA_LIBS += $(LIBM)
|
||||
|
||||
# Flags we pass to the C compiler
|
||||
#
|
||||
CFLAGS = $(ARCHCFLAGS) \
|
||||
$(ARCHCWARNINGS) \
|
||||
$(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) \
|
||||
$(ARCHINCLUDES) \
|
||||
$(INSTRUMENTATIONDEFINES) \
|
||||
$(ARCHDEFINES) \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRACFLAGS) \
|
||||
-fno-common \
|
||||
$(addprefix -I,$(INCLUDE_DIRS))
|
||||
|
||||
# Flags we pass to the C++ compiler
|
||||
#
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) \
|
||||
$(ARCHWARNINGSXX) \
|
||||
$(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) \
|
||||
$(ARCHXXINCLUDES) \
|
||||
$(INSTRUMENTATIONDEFINES) \
|
||||
$(ARCHDEFINES) \
|
||||
-DCONFIG_WCHAR_BUILTIN \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRACXXFLAGS) \
|
||||
$(addprefix -I,$(INCLUDE_DIRS))
|
||||
|
||||
# Flags we pass to the assembler
|
||||
#
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRAAFLAGS)
|
||||
|
||||
# Flags we pass to the linker
|
||||
#
|
||||
LDFLAGS += --warn-common \
|
||||
--gc-sections \
|
||||
$(EXTRALDFLAGS) \
|
||||
$(addprefix -T,$(LDSCRIPT)) \
|
||||
$(addprefix -L,$(LIB_DIRS))
|
||||
|
||||
# Compiler support library
|
||||
#
|
||||
LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name)
|
||||
|
||||
# Files that the final link depends on
|
||||
#
|
||||
LINK_DEPS += $(LDSCRIPT)
|
||||
|
||||
# Files to include to get automated dependencies
|
||||
#
|
||||
DEP_INCLUDES = $(subst .o,.d,$(OBJS))
|
||||
|
||||
# Compile C source $1 to object $2
|
||||
# as a side-effect, generate a dependency file
|
||||
#
|
||||
define COMPILE
|
||||
@$(ECHO) "CC: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Compile C++ source $1 to $2
|
||||
# as a side-effect, generate a dependency file
|
||||
#
|
||||
define COMPILEXX
|
||||
@$(ECHO) "CXX: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Assemble $1 into $2
|
||||
#
|
||||
define ASSEMBLE
|
||||
@$(ECHO) "AS: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Produce partially-linked $1 from files in $2
|
||||
#
|
||||
define PRELINK
|
||||
@$(ECHO) "PRELINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(LD) -Ur -Map $1.map -o $1 $2 && $(OBJCOPY) --localize-hidden $1
|
||||
endef
|
||||
|
||||
# Update the archive $1 with the files in $2
|
||||
#
|
||||
define ARCHIVE
|
||||
@$(ECHO) "AR: $2"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(AR) $1 $2
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the binary $1
|
||||
#
|
||||
define LINK
|
||||
@$(ECHO) "LINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(LD) $(LDFLAGS) -Map $1.map -o $1 --start-group $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group
|
||||
endef
|
||||
|
||||
# Convert $1 from a linked object to a raw binary in $2
|
||||
#
|
||||
define SYM_TO_BIN
|
||||
@$(ECHO) "BIN: $2"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(OBJCOPY) -O binary $1 $2
|
||||
endef
|
||||
|
||||
# Take the raw binary $1 and make it into an object file $2.
|
||||
# The symbol $3 points to the beginning of the file, and $3_len
|
||||
# gives its length.
|
||||
#
|
||||
# - compile an empty file to generate a suitable object file
|
||||
# - relink the object and insert the binary file
|
||||
# - extract the length
|
||||
# - create const unsigned $3_len with the extracted length as its value and compile it to an object file
|
||||
# - link the two generated object files together
|
||||
# - edit symbol names to suit
|
||||
#
|
||||
# NOTE: exercise caution using this with absolute pathnames; it looks
|
||||
# like the MinGW tools insert an extra _ in the binary symbol name; e.g.
|
||||
# the path:
|
||||
#
|
||||
# /d/px4/firmware/Build/px4fmu_default.build/romfs.img
|
||||
#
|
||||
# is assigned symbols like:
|
||||
#
|
||||
# _binary_d__px4_firmware_Build_px4fmu_default_build_romfs_img_size
|
||||
#
|
||||
# when we would expect
|
||||
#
|
||||
# _binary__d_px4_firmware_Build_px4fmu_default_build_romfs_img_size
|
||||
#
|
||||
define BIN_SYM_PREFIX
|
||||
_binary_$(subst /,_,$(subst .,_,$1))
|
||||
endef
|
||||
define BIN_TO_OBJ
|
||||
@$(ECHO) "OBJ: $2"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(ECHO) > $2.c
|
||||
$(call COMPILE,$2.c,$2.c.o)
|
||||
$(Q) $(LD) -r -o $2.bin.o $2.c.o -b binary $1
|
||||
$(Q) $(ECHO) "const unsigned int $3_len = 0x`$(NM) -p --radix=x $2.bin.o | $(GREP) $(call BIN_SYM_PREFIX,$1)_size$$ | $(GREP) -o ^[0-9a-fA-F]*`;" > $2.c
|
||||
$(call COMPILE,$2.c,$2.c.o)
|
||||
$(Q) $(LD) -r -o $2 $2.c.o $2.bin.o
|
||||
$(Q) $(OBJCOPY) $2 \
|
||||
--redefine-sym $(call BIN_SYM_PREFIX,$1)_start=$3 \
|
||||
--strip-symbol $(call BIN_SYM_PREFIX,$1)_size \
|
||||
--strip-symbol $(call BIN_SYM_PREFIX,$1)_end \
|
||||
--rename-section .data=.rodata
|
||||
$(Q) $(REMOVE) $2.c $2.c.o $2.bin.o
|
||||
endef
|
|
@ -1,50 +0,0 @@
|
|||
#
|
||||
# Rules and tools for uploading firmware to various PX4 boards.
|
||||
#
|
||||
|
||||
UPLOADER = $(PX4_BASE)/Tools/px_uploader.py
|
||||
|
||||
SYSTYPE := $(shell uname -s)
|
||||
|
||||
#
|
||||
# Serial port defaults.
|
||||
#
|
||||
# XXX The uploader should be smarter than this.
|
||||
#
|
||||
ifeq ($(SYSTYPE),Darwin)
|
||||
SERIAL_PORTS ?= "/dev/tty.usbmodemPX*,/dev/tty.usbmodem*"
|
||||
endif
|
||||
ifeq ($(SYSTYPE),Linux)
|
||||
SERIAL_PORTS ?= "/dev/serial/by-id/usb-3D_Robotics*,/dev/serial/by-id/pci-3D_Robotics*"
|
||||
endif
|
||||
ifeq ($(SERIAL_PORTS),)
|
||||
SERIAL_PORTS = "COM32,COM31,COM30,COM29,COM28,COM27,COM26,COM25,COM24,COM23,COM22,COM21,COM20,COM19,COM18,COM17,COM16,COM15,COM14,COM13,COM12,COM11,COM10,COM9,COM8,COM7,COM6,COM5,COM4,COM3,COM2,COM1,COM0"
|
||||
endif
|
||||
|
||||
.PHONY: all upload-$(METHOD)-$(BOARD)
|
||||
all: upload-$(METHOD)-$(BOARD)
|
||||
|
||||
upload-serial-px4fmu-v1: $(BUNDLE) $(UPLOADER)
|
||||
$(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE)
|
||||
|
||||
upload-serial-px4fmu-v2: $(BUNDLE) $(UPLOADER)
|
||||
$(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE)
|
||||
|
||||
upload-serial-aerocore:
|
||||
openocd -f $(PX4_BASE)/makefiles/nuttx/gumstix-aerocore.cfg -c 'init; reset halt; flash write_image erase $(PX4_BASE)/../Bootloader/px4aerocore_bl.bin 0x08000000; flash write_image erase $(PX4_BASE)/Build/aerocore_default.build/firmware.bin 0x08004000; reset run; exit'
|
||||
|
||||
upload-serial-px4-stm32f4discovery: $(BUNDLE) $(UPLOADER)
|
||||
$(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE)
|
||||
|
||||
#
|
||||
# JTAG firmware uploading with OpenOCD
|
||||
#
|
||||
JTAGCONFIG ?= interface/olimex-jtag-tiny.cfg
|
||||
|
||||
upload-jtag-px4fmu: all
|
||||
@$(ECHO) Attempting to flash PX4FMU board via JTAG
|
||||
$(Q) $(OPENOCD) -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown
|
||||
|
||||
upload-jtag-px4io: all
|
||||
@$(ECHO) Attempting to flash PX4IO board via JTAG
|
||||
$(Q) $(OPENOCD) -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown
|
|
@ -1,11 +0,0 @@
|
|||
#
|
||||
# Board-specific definitions for the POSIX port of PX4
|
||||
#
|
||||
|
||||
#
|
||||
# Configure the toolchain
|
||||
#
|
||||
CONFIG_ARCH = CORTEXA8
|
||||
CONFIG_BOARD = EAGLE
|
||||
|
||||
include $(PX4_MK_DIR)/posix-arm/toolchain_gnu-arm-linux-gnueabihf.mk
|
|
@ -1,57 +0,0 @@
|
|||
#
|
||||
# Makefile for the EAGLE *default* configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/device
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
MODULES += systemcmds/param
|
||||
MODULES += systemcmds/ver
|
||||
|
||||
#
|
||||
# General system control
|
||||
#
|
||||
MODULES += modules/mavlink
|
||||
|
||||
#
|
||||
# Estimation modules (EKF/ SO3 / other filters)
|
||||
#
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
MODULES += modules/systemlib
|
||||
MODULES += modules/uORB
|
||||
MODULES += modules/dataman
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
MODULES += lib/mathlib
|
||||
MODULES += lib/mathlib/math/filter
|
||||
MODULES += lib/geo
|
||||
MODULES += lib/geo_lookup
|
||||
MODULES += lib/conversion
|
||||
#
|
||||
# Linux port
|
||||
#
|
||||
MODULES += platforms/posix/px4_layer
|
||||
MODULES += platforms/posix/work_queue
|
||||
|
||||
#
|
||||
# Unit tests
|
||||
#
|
||||
|
||||
#
|
||||
# muorb fastrpc changes.
|
||||
#
|
||||
MODULES += modules/muorb/krait
|
|
@ -1,79 +0,0 @@
|
|||
#
|
||||
# Makefile for the EAGLE *default* configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/device
|
||||
MODULES += drivers/blinkm
|
||||
MODULES += drivers/pwm_out_sim
|
||||
MODULES += drivers/rgbled
|
||||
MODULES += drivers/led
|
||||
MODULES += modules/sensors
|
||||
#MODULES += drivers/ms5611
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
MODULES += systemcmds/param
|
||||
MODULES += systemcmds/mixer
|
||||
MODULES += systemcmds/ver
|
||||
#MODULES += systemcmds/topic_listener
|
||||
|
||||
#
|
||||
# General system control
|
||||
#
|
||||
MODULES += modules/mavlink
|
||||
|
||||
#
|
||||
# Estimation modules (EKF/ SO3 / other filters)
|
||||
#
|
||||
MODULES += modules/attitude_estimator_ekf
|
||||
MODULES += modules/ekf_att_pos_estimator
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
#MODULES += modules/navigator
|
||||
MODULES += modules/mc_pos_control
|
||||
MODULES += modules/mc_att_control
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
MODULES += modules/systemlib
|
||||
MODULES += modules/systemlib/mixer
|
||||
MODULES += modules/uORB
|
||||
MODULES += modules/dataman
|
||||
MODULES += modules/sdlog2
|
||||
MODULES += modules/simulator
|
||||
MODULES += modules/commander
|
||||
MODULES += modules/controllib
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
MODULES += lib/mathlib
|
||||
MODULES += lib/mathlib/math/filter
|
||||
MODULES += lib/geo
|
||||
MODULES += lib/geo_lookup
|
||||
MODULES += lib/conversion
|
||||
#
|
||||
# Linux port
|
||||
#
|
||||
MODULES += platforms/posix/px4_layer
|
||||
MODULES += platforms/posix/work_queue
|
||||
|
||||
#
|
||||
# Unit tests
|
||||
#
|
||||
#MODULES += platforms/posix/tests/hello
|
||||
#MODULES += platforms/posix/tests/vcdev_test
|
||||
#MODULES += platforms/posix/tests/hrt_test
|
||||
#MODULES += platforms/posix/tests/wqueue
|
||||
|
||||
#
|
||||
# muorb fastrpc changes.
|
||||
#
|
||||
#MODULES += $(PX4_BASE)../muorb_krait
|
|
@ -1,88 +0,0 @@
|
|||
#
|
||||
# Makefile for the POSIXTEST *default* configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/device
|
||||
MODULES += drivers/boards/sitl
|
||||
#MODULES += drivers/blinkm
|
||||
#MODULES += drivers/pwm_out_sim
|
||||
#MODULES += drivers/rgbled
|
||||
MODULES += drivers/led
|
||||
#MODULES += modules/sensors
|
||||
#MODULES += drivers/ms5611
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
MODULES += systemcmds/param
|
||||
#MODULES += systemcmds/mixer
|
||||
#MODULES += systemcmds/topic_listener
|
||||
MODULES += systemcmds/ver
|
||||
|
||||
#
|
||||
# General system control
|
||||
#
|
||||
MODULES += modules/mavlink
|
||||
|
||||
#
|
||||
# Estimation modules (EKF/ SO3 / other filters)
|
||||
#
|
||||
#MODULES += modules/attitude_estimator_ekf
|
||||
#MODULES += modules/ekf_att_pos_estimator
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
#MODULES += modules/navigator
|
||||
#MODULES += modules/mc_pos_control
|
||||
#MODULES += modules/mc_att_control
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
MODULES += modules/systemlib
|
||||
#MODULES += modules/systemlib/mixer
|
||||
MODULES += modules/uORB
|
||||
MODULES += modules/dataman
|
||||
MODULES += modules/sdlog2
|
||||
MODULES += modules/simulator
|
||||
MODULES += modules/commander
|
||||
#MODULES += modules/controllib
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
MODULES += lib/mathlib
|
||||
MODULES += lib/mathlib/math/filter
|
||||
MODULES += lib/geo
|
||||
MODULES += lib/geo_lookup
|
||||
MODULES += lib/conversion
|
||||
|
||||
#
|
||||
# Linux port
|
||||
#
|
||||
MODULES += platforms/posix/px4_layer
|
||||
MODULES += platforms/posix/work_queue
|
||||
#MODULES += platforms/posix/drivers/accelsim
|
||||
#MODULES += platforms/posix/drivers/gyrosim
|
||||
#MODULES += platforms/posix/drivers/adcsim
|
||||
#MODULES += platforms/posix/drivers/barosim
|
||||
#MODULES += platforms/posix/drivers/tonealrmsim
|
||||
#MODULES += platforms/posix/drivers/airspeedsim
|
||||
#MODULES += platforms/posix/drivers/gpssim
|
||||
|
||||
#
|
||||
# Unit tests
|
||||
#
|
||||
#MODULES += platforms/posix/tests/hello
|
||||
#MODULES += platforms/posix/tests/vcdev_test
|
||||
#MODULES += platforms/posix/tests/hrt_test
|
||||
#MODULES += platforms/posix/tests/wqueue
|
||||
|
||||
#
|
||||
# muorb fastrpc changes.
|
||||
#
|
||||
MODULES += modules/muorb/krait
|
|
@ -1,90 +0,0 @@
|
|||
#
|
||||
# Makefile for the POSIXTEST *default* configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/device
|
||||
#MODULES += drivers/blinkm
|
||||
#MODULES += drivers/pwm_out_sim
|
||||
#MODULES += drivers/rgbled
|
||||
#MODULES += drivers/led
|
||||
#MODULES += modules/sensors
|
||||
#MODULES += drivers/ms5611
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
#MODULES += systemcmds/param
|
||||
#MODULES += systemcmds/mixer
|
||||
#MODULES += systemcmds/topic_listener
|
||||
|
||||
#
|
||||
# General system control
|
||||
#
|
||||
#MODULES += modules/mavlink
|
||||
|
||||
#
|
||||
# Estimation modules (EKF/ SO3 / other filters)
|
||||
#
|
||||
#MODULES += modules/attitude_estimator_ekf
|
||||
#MODULES += modules/ekf_att_pos_estimator
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
#MODULES += modules/navigator
|
||||
#MODULES += modules/mc_pos_control
|
||||
#MODULES += modules/mc_att_control
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
#MODULES += modules/systemlib
|
||||
#MODULES += modules/systemlib/mixer
|
||||
MODULES += modules/uORB
|
||||
#MODULES += modules/dataman
|
||||
#MODULES += modules/sdlog2
|
||||
#MODULES += modules/simulator
|
||||
#MODULES += modules/commander
|
||||
#MODULES += modules/controllib
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
#MODULES += lib/mathlib
|
||||
#MODULES += lib/mathlib/math/filter
|
||||
#MODULES += lib/geo
|
||||
#MODULES += lib/geo_lookup
|
||||
#MODULES += lib/conversion
|
||||
|
||||
#
|
||||
# Linux port
|
||||
#
|
||||
MODULES += platforms/posix/px4_layer
|
||||
MODULES += platforms/posix/work_queue
|
||||
#MODULES += platforms/posix/drivers/accelsim
|
||||
#MODULES += platforms/posix/drivers/gyrosim
|
||||
#MODULES += platforms/posix/drivers/adcsim
|
||||
#MODULES += platforms/posix/drivers/barosim
|
||||
#MODULES += platforms/posix/drivers/tonealrmsim
|
||||
#MODULES += platforms/posix/drivers/airspeedsim
|
||||
#MODULES += platforms/posix/drivers/gpssim
|
||||
|
||||
#
|
||||
# muorb fastrpc changes.
|
||||
#
|
||||
MODULES += modules/muorb/krait
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# Unit tests
|
||||
#
|
||||
#MODULES += platforms/posix/tests/hello
|
||||
#MODULES += platforms/posix/tests/vcdev_test
|
||||
#MODULES += platforms/posix/tests/hrt_test
|
||||
#MODULES += platforms/posix/tests/wqueue
|
||||
MODULES += platforms/posix/tests/muorb
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Rules and definitions related to handling the Linux specific impl when
|
||||
# building firmware.
|
||||
#
|
||||
|
||||
MODULES += \
|
||||
platforms/common \
|
||||
platforms/posix/px4_layer
|
||||
|
|
@ -1,305 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2012-2014 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Definitions for a generic GNU ARM-EABI toolchain
|
||||
#
|
||||
|
||||
#$(info TOOLCHAIN arm-linux-gnueabihf)
|
||||
|
||||
# Toolchain commands. Normally only used inside this file.
|
||||
#
|
||||
CROSSDEV = arm-linux-gnueabihf-
|
||||
|
||||
CC ?= $(CROSSDEV)gcc
|
||||
CXX ?= $(CROSSDEV)g++
|
||||
CPP ?= $(CROSSDEV)gcc -E
|
||||
LD ?= $(CROSSDEV)ld
|
||||
AR ?= $(CROSSDEV)ar rcs
|
||||
NM ?= $(CROSSDEV)nm
|
||||
OBJCOPY ?= $(CROSSDEV)objcopy
|
||||
OBJDUMP ?= $(CROSSDEV)objdump
|
||||
ifdef OECORE_NATIVE_SYSROOT
|
||||
AR := $(AR) rcs
|
||||
endif
|
||||
|
||||
# Check if the right version of the toolchain is available
|
||||
#
|
||||
CROSSDEV_VER_SUPPORTED = 4.7.4 4.7.5 4.7.6 4.8.2 4.8.4 4.9.3
|
||||
CROSSDEV_VER_FOUND = $(shell $(CC) -dumpversion)
|
||||
|
||||
ifeq (,$(findstring $(CROSSDEV_VER_FOUND), $(CROSSDEV_VER_SUPPORTED)))
|
||||
$(error Unsupported version of $(CC), found: $(CROSSDEV_VER_FOUND) instead of one in: $(CROSSDEV_VER_SUPPORTED))
|
||||
endif
|
||||
|
||||
ifndef POSIX_EXT_LIB_ROOT
|
||||
$(error POSIX_EXT_LIB_ROOT is not set)
|
||||
endif
|
||||
|
||||
# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup
|
||||
|
||||
MAXOPTIMIZATION ?= -O3
|
||||
|
||||
# Base CPU flags for each of the supported architectures.
|
||||
#
|
||||
ARCHCPUFLAGS_CORTEXA8 = -mtune=cortex-a8 \
|
||||
-mthumb-interwork \
|
||||
-march=armv7-a \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=neon
|
||||
|
||||
# Pick the right set of flags for the architecture.
|
||||
#
|
||||
ARCHCPUFLAGS = $(ARCHCPUFLAGS_$(CONFIG_ARCH))
|
||||
ifeq ($(ARCHCPUFLAGS),)
|
||||
$(error Must set CONFIG_ARCH to one of CORTEXA8 CORTEXM4F, CORTEXM4 or CORTEXM3)
|
||||
endif
|
||||
|
||||
# Set the board flags
|
||||
#
|
||||
ifeq ($(CONFIG_BOARD),)
|
||||
$(error Board config does not define CONFIG_BOARD)
|
||||
endif
|
||||
ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) \
|
||||
-D__PX4_LINUX -D__PX4_POSIX \
|
||||
-Dnoreturn_function= \
|
||||
-I$(PX4_BASE)/src/modules/systemlib \
|
||||
-I$(PX4_BASE)/src/lib/eigen \
|
||||
-I$(PX4_BASE)/src/platforms/posix/include \
|
||||
-I$(PX4_BASE)/mavlink/include/mavlink \
|
||||
-Wno-error=shadow
|
||||
|
||||
# optimisation flags
|
||||
#
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \
|
||||
-g3 \
|
||||
-fno-strict-aliasing \
|
||||
-fomit-frame-pointer \
|
||||
-funsafe-math-optimizations \
|
||||
-fno-builtin-printf \
|
||||
-ffunction-sections \
|
||||
-fdata-sections
|
||||
|
||||
# Language-specific flags
|
||||
#
|
||||
ARCHCFLAGS = -std=gnu99
|
||||
ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=c++0x -fno-threadsafe-statics -D__CUSTOM_FILE_IO__
|
||||
|
||||
# Generic warnings
|
||||
#
|
||||
ARCHWARNINGS = -Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-Wfloat-equal \
|
||||
-Wpointer-arith \
|
||||
-Wmissing-declarations \
|
||||
-Wpacked \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-packed \
|
||||
-Werror=format-security \
|
||||
-Werror=array-bounds \
|
||||
-Wfatal-errors \
|
||||
-Werror=unused-variable \
|
||||
-Werror=reorder \
|
||||
-Werror=uninitialized \
|
||||
-Werror=init-self \
|
||||
-Wformat=1 \
|
||||
-Werror=unused-but-set-variable \
|
||||
-Wno-error=double-promotion \
|
||||
-fno-strength-reduce \
|
||||
-Wno-error=unused-value
|
||||
|
||||
ARCHOPTIMIZATION += -fno-strength-reduce
|
||||
|
||||
# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+
|
||||
# -Wcast-qual - generates spurious noreturn attribute warnings, try again later
|
||||
# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code
|
||||
# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives
|
||||
|
||||
# C-specific warnings
|
||||
#
|
||||
ARCHCWARNINGS = $(ARCHWARNINGS) \
|
||||
-Wbad-function-cast \
|
||||
-Wstrict-prototypes \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs
|
||||
|
||||
# C++-specific warnings
|
||||
#
|
||||
ARCHWARNINGSXX = $(ARCHWARNINGS) \
|
||||
-Wno-missing-field-initializers
|
||||
|
||||
# pull in *just* libm from the toolchain ... this is grody
|
||||
LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a)
|
||||
#EXTRA_LIBS += $(LIBM)
|
||||
EXTRA_LIBS += -lpx4muorb -ladsprpc
|
||||
EXTRA_LIBS += -pthread -lm -lrt
|
||||
|
||||
LIB_DIRS += $(POSIX_EXT_LIB_ROOT)/libs
|
||||
INCLUDE_DIRS += $(POSIX_EXT_LIB_ROOT)/inc
|
||||
|
||||
# Flags we pass to the C compiler
|
||||
#
|
||||
CFLAGS = $(ARCHCFLAGS) \
|
||||
$(ARCHCWARNINGS) \
|
||||
$(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) \
|
||||
$(ARCHINCLUDES) \
|
||||
$(INSTRUMENTATIONDEFINES) \
|
||||
$(ARCHDEFINES) \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRACFLAGS) \
|
||||
-fno-common \
|
||||
$(addprefix -I,$(INCLUDE_DIRS))
|
||||
|
||||
# Flags we pass to the C++ compiler
|
||||
#
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) \
|
||||
$(ARCHWARNINGSXX) \
|
||||
$(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) \
|
||||
$(ARCHXXINCLUDES) \
|
||||
$(INSTRUMENTATIONDEFINES) \
|
||||
$(ARCHDEFINES) \
|
||||
-DCONFIG_WCHAR_BUILTIN \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRACXXFLAGS) \
|
||||
-Wno-effc++ \
|
||||
$(addprefix -I,$(INCLUDE_DIRS))
|
||||
|
||||
# Flags we pass to the assembler
|
||||
#
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRAAFLAGS)
|
||||
|
||||
LDSCRIPT = $(PX4_BASE)/makefiles/posix-arm/ld.script
|
||||
# Flags we pass to the linker
|
||||
#
|
||||
LDFLAGS += $(EXTRALDFLAGS) \
|
||||
$(addprefix -L,$(LIB_DIRS))
|
||||
|
||||
# Compiler support library
|
||||
#
|
||||
LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name)
|
||||
|
||||
# Files that the final link depends on
|
||||
#
|
||||
#LINK_DEPS += $(LDSCRIPT)
|
||||
LINK_DEPS +=
|
||||
|
||||
# Files to include to get automated dependencies
|
||||
#
|
||||
DEP_INCLUDES = $(subst .o,.d,$(OBJS))
|
||||
|
||||
# Compile C source $1 to object $2
|
||||
# as a side-effect, generate a dependency file
|
||||
#
|
||||
define COMPILE
|
||||
@$(ECHO) "CC: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Compile C++ source $1 to $2
|
||||
# as a side-effect, generate a dependency file
|
||||
#
|
||||
define COMPILEXX
|
||||
@$(ECHO) "CXX: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
@echo $(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2
|
||||
$(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Assemble $1 into $2
|
||||
#
|
||||
define ASSEMBLE
|
||||
@$(ECHO) "AS: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Produce partially-linked $1 from files in $2
|
||||
#
|
||||
#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold
|
||||
define PRELINK
|
||||
@$(ECHO) "PRELINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(LD) -Ur -o $1 $2
|
||||
|
||||
endef
|
||||
# Produce partially-linked $1 from files in $2
|
||||
#
|
||||
#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold
|
||||
define PRELINKF
|
||||
@$(ECHO) "PRELINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(LD) -Ur -T$(LDSCRIPT) -o $1 $2
|
||||
|
||||
endef
|
||||
# $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1
|
||||
|
||||
# Update the archive $1 with the files in $2
|
||||
#
|
||||
define ARCHIVE
|
||||
@$(ECHO) "AR: $2"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(AR) $1 $2
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the shared library $1
|
||||
#
|
||||
define LINK_A
|
||||
@$(ECHO) "LINK_A: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
echo "$(Q) $(AR) $1 $2"
|
||||
$(Q) $(AR) $1 $2
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the shared library $1
|
||||
#
|
||||
define LINK_SO
|
||||
@$(ECHO) "LINK_SO: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
echo "$(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) $(EXTRA_LIBS)"
|
||||
$(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) -pthread -lc
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the application $1
|
||||
#
|
||||
define LINK
|
||||
@$(ECHO) "LINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
echo "$(Q) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $1 $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC)"
|
||||
$(Q) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $1 $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC)
|
||||
|
||||
endef
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
#
|
||||
# Makefile for the Foo *default* configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/device
|
||||
#MODULES += drivers/blinkm
|
||||
#MODULES += drivers/pwm_out_sim
|
||||
#MODULES += drivers/led
|
||||
#MODULES += drivers/rgbled
|
||||
#MODULES += modules/sensors
|
||||
#MODULES += drivers/ms5611
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
MODULES += systemcmds/param
|
||||
|
||||
#
|
||||
# General system control
|
||||
#
|
||||
#MODULES += modules/mavlink
|
||||
|
||||
#
|
||||
# Estimation modules (EKF/ SO3 / other filters)
|
||||
#
|
||||
#MODULES += modules/attitude_estimator_ekf
|
||||
#MODULES += modules/ekf_att_pos_estimator
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
#MODULES += modules/mc_att_control
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
MODULES += modules/systemlib
|
||||
#MODULES += modules/systemlib/mixer
|
||||
MODULES += modules/uORB
|
||||
#MODULES += modules/dataman
|
||||
#MODULES += modules/sdlog2
|
||||
#MODULES += modules/simulator
|
||||
#MODULES += modules/commander
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
#MODULES += lib/mathlib
|
||||
#MODULES += lib/mathlib/math/filter
|
||||
#MODULES += lib/geo
|
||||
#MODULES += lib/geo_lookup
|
||||
#MODULES += lib/conversion
|
||||
|
||||
#
|
||||
# posix port
|
||||
#
|
||||
MODULES += platforms/posix/px4_layer
|
||||
#MODULES += platforms/posix/drivers/accelsim
|
||||
#MODULES += platforms/posix/drivers/gyrosim
|
||||
#MODULES += platforms/posix/drivers/adcsim
|
||||
#MODULES += platforms/posix/drivers/barosim
|
||||
|
||||
#
|
||||
# muorb fastrpc changes.
|
||||
#
|
||||
#MODULES += $(PX4_BASE)../muorb_krait
|
||||
|
||||
#
|
||||
# Unit tests
|
||||
#
|
||||
MODULES += platforms/posix/tests/muorb
|
||||
#MODULES += platforms/posix/tests/vcdev_test
|
||||
#MODULES += platforms/posix/tests/hrt_test
|
||||
#MODULES += platforms/posix/tests/wqueue
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#
|
||||
# Board-specific definitions for the POSIX port of PX4
|
||||
# for use in SITL testing
|
||||
#
|
||||
|
||||
#
|
||||
# Configure the toolchain
|
||||
#
|
||||
CONFIG_ARCH = NATIVE
|
||||
CONFIG_BOARD = SITL
|
||||
|
||||
include $(PX4_MK_DIR)/posix/toolchain_native.mk
|
|
@ -1,107 +0,0 @@
|
|||
#
|
||||
# Makefile for the SITL configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/boards/sitl
|
||||
MODULES += drivers/device
|
||||
MODULES += drivers/blinkm
|
||||
MODULES += drivers/pwm_out_sim
|
||||
MODULES += drivers/rgbled
|
||||
MODULES += drivers/led
|
||||
MODULES += modules/sensors
|
||||
MODULES += drivers/ms5611
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
MODULES += systemcmds/param
|
||||
MODULES += systemcmds/mixer
|
||||
#MODULES += systemcmds/esc_calib
|
||||
MODULES += systemcmds/tests
|
||||
#MODULES += systemcmds/reboot
|
||||
MODULES += systemcmds/topic_listener
|
||||
MODULES += systemcmds/ver
|
||||
MODULES += systemcmds/esc_calib
|
||||
MODULES += systemcmds/reboot
|
||||
|
||||
#
|
||||
# General system control
|
||||
#
|
||||
MODULES += modules/mavlink
|
||||
|
||||
#
|
||||
# Estimation modules (EKF/ SO3 / other filters)
|
||||
#
|
||||
MODULES += modules/attitude_estimator_ekf
|
||||
MODULES += modules/attitude_estimator_q
|
||||
MODULES += modules/ekf_att_pos_estimator
|
||||
MODULES += modules/attitude_estimator_q
|
||||
MODULES += modules/position_estimator_inav
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
MODULES += modules/navigator
|
||||
MODULES += modules/mc_pos_control
|
||||
MODULES += modules/mc_att_control
|
||||
MODULES += modules/mc_pos_control_multiplatform
|
||||
MODULES += modules/mc_att_control_multiplatform
|
||||
MODULES += modules/land_detector
|
||||
MODULES += modules/fw_att_control
|
||||
MODULES += modules/fw_pos_control_l1
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
MODULES += modules/systemlib
|
||||
MODULES += modules/systemlib/mixer
|
||||
MODULES += modules/uORB
|
||||
MODULES += modules/dataman
|
||||
MODULES += modules/sdlog2
|
||||
MODULES += modules/simulator
|
||||
MODULES += modules/commander
|
||||
MODULES += modules/controllib
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
MODULES += lib/mathlib
|
||||
MODULES += lib/mathlib/math/filter
|
||||
MODULES += lib/ecl
|
||||
MODULES += lib/external_lgpl
|
||||
MODULES += lib/geo
|
||||
MODULES += lib/geo_lookup
|
||||
MODULES += lib/conversion
|
||||
MODULES += lib/launchdetection
|
||||
|
||||
|
||||
#
|
||||
# POSIX port
|
||||
#
|
||||
MODULES += platforms/posix/px4_layer
|
||||
MODULES += platforms/posix/work_queue
|
||||
MODULES += platforms/posix/drivers/accelsim
|
||||
MODULES += platforms/posix/drivers/gyrosim
|
||||
MODULES += platforms/posix/drivers/adcsim
|
||||
MODULES += platforms/posix/drivers/barosim
|
||||
MODULES += platforms/posix/drivers/tonealrmsim
|
||||
MODULES += platforms/posix/drivers/airspeedsim
|
||||
MODULES += platforms/posix/drivers/gpssim
|
||||
|
||||
#
|
||||
# Unit tests
|
||||
#
|
||||
#MODULES += platforms/posix/tests/hello
|
||||
MODULES += platforms/posix/tests/vcdev_test
|
||||
#MODULES += platforms/posix/tests/hrt_test
|
||||
#MODULES += platforms/posix/tests/wqueue
|
||||
|
||||
#
|
||||
# muorb fastrpc changes.
|
||||
#
|
||||
#MODULES += $(PX4_BASE)../muorb_krait
|
|
@ -1,56 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Built products
|
||||
#
|
||||
FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)$(config).build/firmware.a)
|
||||
|
||||
all: $(FIRMWARES)
|
||||
|
||||
#
|
||||
# Generate FIRMWARES.
|
||||
#
|
||||
.PHONY: $(FIRMWARES)
|
||||
$(BUILD_DIR)%.build/firmware.a: config = $(patsubst $(BUILD_DIR)%.build/firmware.a,%,$@)
|
||||
$(BUILD_DIR)%.build/firmware.a: work_dir = $(BUILD_DIR)$(config).build/
|
||||
$(FIRMWARES): $(BUILD_DIR)%.build/firmware.a: checkgitversion generateuorbtopicheaders
|
||||
@$(ECHO) %%%%
|
||||
@$(ECHO) %%%% Building $(config) in $(work_dir)
|
||||
@$(ECHO) %%%%
|
||||
$(Q) $(MKDIR) -p $(work_dir)
|
||||
$(Q) $(MAKE) -r --no-print-directory -C $(work_dir) \
|
||||
-f $(PX4_MK_DIR)firmware.mk \
|
||||
CONFIG=$(config) \
|
||||
WORK_DIR=$(work_dir) \
|
||||
$(FIRMWARE_GOAL)
|
||||
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Rules and definitions related to handling the Linux specific impl when
|
||||
# building firmware.
|
||||
#
|
||||
|
||||
MODULES += \
|
||||
platforms/common \
|
||||
platforms/posix/px4_layer
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue