mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 07:13:33 +08:00
+3
-3
@@ -87,17 +87,17 @@ env:
|
||||
- PX4_AWS_BUCKET=px4-travis
|
||||
|
||||
script:
|
||||
#- make check_format
|
||||
- make check_format
|
||||
- arm-none-eabi-gcc --version
|
||||
- echo 'Building POSIX Firmware..' && echo -en 'travis_fold:start:script.1\\r'
|
||||
- make posix_sitl_simple -j4
|
||||
- make posix_sitl_simple
|
||||
- echo -en 'travis_fold:end:script.1\\r'
|
||||
- echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r'
|
||||
- make posix_sitl_simple test
|
||||
- cat build_posix_sitl_simple/src/modules/systemlib/mixer/mixer_multirotor.generated.h
|
||||
- echo -en 'travis_fold:end:script.2\\r'
|
||||
- echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.3\\r'
|
||||
- make px4fmu-v2_default -j4
|
||||
- make px4fmu-v2_default
|
||||
- echo -en 'travis_fold:end:script.3\\r'
|
||||
- echo 'Running Tests..' && echo -en 'travis_fold:start:script.4\\r'
|
||||
- make px4fmu-v2_default test
|
||||
|
||||
@@ -59,12 +59,24 @@ all: px4fmu-v2_default
|
||||
ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
||||
j ?= 4
|
||||
|
||||
# disable ninja by default for now because it hides upload progress
|
||||
#NINJA_BUILD := $(shell ninja --version 2>/dev/null)
|
||||
ifdef NINJA_BUILD
|
||||
PX4_CMAKE_GENERATOR ?= "Ninja"
|
||||
PX4_MAKE = ninja
|
||||
PX4_MAKE_ARGS =
|
||||
else
|
||||
PX4_CMAKE_GENERATOR ?= "Unix Makefiles"
|
||||
PX4_MAKE = make
|
||||
PX4_MAKE_ARGS = -j$(j) --no-print-directory
|
||||
endif
|
||||
|
||||
# Functions
|
||||
# --------------------------------------------------------------------
|
||||
# describe how to build a cmake config
|
||||
define cmake-build
|
||||
+mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G"Unix Makefiles" -DCONFIG=$(1)
|
||||
+make -j$(j) -C $(PWD)/build_$@ --no-print-directory $(ARGS)
|
||||
+@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1); fi
|
||||
+$(PX4_MAKE) -C $(PWD)/build_$@ $(PX4_MAKE_ARGS) $(ARGS)
|
||||
endef
|
||||
|
||||
# create empty targets to avoid msgs for targets passed to cmake
|
||||
@@ -141,6 +153,9 @@ sitl_ros:
|
||||
|
||||
# Other targets
|
||||
# --------------------------------------------------------------------
|
||||
check_format:
|
||||
@./Tools/check_code_style.sh
|
||||
|
||||
clean:
|
||||
@rm -rf build_*/
|
||||
|
||||
|
||||
@@ -482,14 +482,15 @@ function(px4_add_common_flags)
|
||||
|
||||
set(warnings
|
||||
-Wall
|
||||
-Werror
|
||||
-Wno-sign-compare
|
||||
-Wextra
|
||||
#-Wshadow # very verbose due to eigen
|
||||
-Wfloat-equal
|
||||
-Wpointer-arith
|
||||
-Wmissing-declarations
|
||||
-Wpacked
|
||||
-Wno-unused-parameter
|
||||
-Wno-varargs
|
||||
-Werror=format-security
|
||||
-Werror=array-bounds
|
||||
-Wfatal-errors
|
||||
@@ -505,7 +506,7 @@ function(px4_add_common_flags)
|
||||
# but generates too many false positives
|
||||
)
|
||||
|
||||
if (NOT ${OS} STREQUAL "qurt")
|
||||
if (${OS} STREQUAL "nuttx")
|
||||
list(APPEND warnings -Wframe-larger-than=1024)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -213,8 +213,7 @@ function(px4_nuttx_add_export)
|
||||
# copy
|
||||
add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp
|
||||
COMMAND ${MKDIR} -p ${CMAKE_BINARY_DIR}/${CONFIG}
|
||||
COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src}
|
||||
COMMAND ${RM} -rf ${nuttx_src}/.git
|
||||
COMMAND rsync -a --exclude=.git ${CMAKE_SOURCE_DIR}/NuttX/ ${nuttx_src}/
|
||||
COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp
|
||||
DEPENDS ${DEPENDS})
|
||||
add_custom_target(__nuttx_copy_${CONFIG}
|
||||
@@ -222,27 +221,22 @@ function(px4_nuttx_add_export)
|
||||
|
||||
# export
|
||||
file(GLOB_RECURSE config_files ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG}/*)
|
||||
add_custom_command(OUTPUT ${CONFIG}.export
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CONFIG}.export
|
||||
COMMAND ${ECHO} Configuring NuttX for ${CONFIG}
|
||||
COMMAND ${MAKE} -C${nuttx_src}/nuttx -j${THREADS}
|
||||
-r --quiet distclean
|
||||
COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG}
|
||||
${nuttx_src}/nuttx/configs
|
||||
COMMAND cd ${nuttx_src}/nuttx/tools &&
|
||||
./configure.sh ${CONFIG}/nsh
|
||||
COMMAND ${MAKE} --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} -C ${nuttx_src}/nuttx -j${THREADS}
|
||||
-r CONFIG_ARCH_BOARD=${CONFIG} export
|
||||
COMMAND ${CP} -r ${nuttx_src}/nuttx/nuttx-export.zip
|
||||
${CONFIG}.export
|
||||
COMMAND ${MAKE} --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} ${CONFIG}.export -d ${nuttx_src}
|
||||
COMMAND ${UNZIP} -q ${CMAKE_BINARY_DIR}/${CONFIG}.export -d ${nuttx_src}
|
||||
COMMAND ${TOUCH} nuttx_export_${CONFIG}.stamp
|
||||
DEPENDS ${DEPENDS} ${CONFIG}.export)
|
||||
DEPENDS ${DEPENDS} ${CMAKE_BINARY_DIR}/${CONFIG}.export)
|
||||
|
||||
add_custom_target(${OUT}
|
||||
DEPENDS nuttx_export_${CONFIG}.stamp)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
set(WARNINGS
|
||||
-Wall
|
||||
-Werror
|
||||
-Wextra
|
||||
-Wdouble-promotion
|
||||
-Wshadow
|
||||
@@ -25,6 +26,7 @@ set(WARNINGS
|
||||
-Werror=unused-private-field
|
||||
-Wno-packed
|
||||
-Wno-frame-larger-than=
|
||||
-Wno-varargs
|
||||
#-Wcast-qual - generates spurious noreturn attribute warnings,
|
||||
# try again later
|
||||
#-Wconversion - would be nice, but too many "risky-but-safe"
|
||||
@@ -58,6 +60,7 @@ set(C_FLAGS
|
||||
#
|
||||
set(CXX_WARNINGS
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-varargs
|
||||
)
|
||||
set(CXX_FLAGS
|
||||
-fno-exceptions
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#ifndef I2C_FRAME_H_
|
||||
#define I2C_FRAME_H_
|
||||
|
||||
#define __STDC_FORMAT_MACROS 1
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef struct i2c_frame
|
||||
|
||||
@@ -35,7 +35,6 @@ px4_add_module(
|
||||
MAIN fmu
|
||||
STACK 1200
|
||||
COMPILE_FLAGS
|
||||
-Weffc++
|
||||
-Os
|
||||
SRCS
|
||||
fmu.cpp
|
||||
|
||||
@@ -35,7 +35,6 @@ px4_add_module(
|
||||
MAIN px4io
|
||||
STACK 1200
|
||||
COMPILE_FLAGS
|
||||
-Weffc++
|
||||
-Os
|
||||
SRCS
|
||||
px4io.cpp
|
||||
|
||||
@@ -79,7 +79,7 @@ void CatapultLaunchMethod::update(float accel_x)
|
||||
if (motorDelay.get() > 0.0f) {
|
||||
state = LAUNCHDETECTION_RES_DETECTED_ENABLECONTROL;
|
||||
warnx("Launch detected: enablecontrol, waiting %8.4fs until full throttle",
|
||||
double(motorDelay.get()));
|
||||
double(motorDelay.get()));
|
||||
|
||||
} else {
|
||||
/* No motor delay set: go directly to enablemotors state */
|
||||
|
||||
@@ -35,9 +35,7 @@ px4_add_module(
|
||||
MAIN attitude_estimator_ekf
|
||||
STACK 1200
|
||||
COMPILE_FLAGS
|
||||
-Wframe-larger-than=2400
|
||||
-Wno-float-equal
|
||||
|
||||
SRCS
|
||||
attitude_estimator_ekf_main.cpp
|
||||
codegen/AttitudeEKF.c
|
||||
|
||||
@@ -31,15 +31,13 @@
|
||||
#
|
||||
#############################################################################
|
||||
set(MODULE_CFLAGS)
|
||||
if (NOT ${OS} STREQUAL "qurt")
|
||||
list(APPEND MODULE_CFLAGS
|
||||
-Wframe-larger-than=1400)
|
||||
if (${OS} STREQUAL "nuttx")
|
||||
list(APPEND MODULE_CFLAGS -Wframe-larger-than=1400)
|
||||
endif()
|
||||
px4_add_module(
|
||||
MODULE modules__attitude_estimator_q
|
||||
MAIN attitude_estimator_q
|
||||
COMPILE_FLAGS
|
||||
${MODULE_CFLAGS}
|
||||
COMPILE_FLAGS ${MODULE_CFLAGS}
|
||||
STACK 1200
|
||||
SRCS
|
||||
attitude_estimator_q_main.cpp
|
||||
|
||||
@@ -31,10 +31,8 @@
|
||||
#
|
||||
############################################################################
|
||||
set(MODULE_CFLAGS -Os)
|
||||
|
||||
if(NOT ${OS} STREQUAL "qurt")
|
||||
list(APPEND MODULE_CFLAGS
|
||||
-Wframe-larger-than=2200)
|
||||
if(${OS} STREQUAL "nuttx")
|
||||
list(APPEND MODULE_CFLAGS -Wframe-larger-than=2300)
|
||||
endif()
|
||||
px4_add_module(
|
||||
MODULE modules__commander
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
set(MODULE_CFLAGS -Weffc++)
|
||||
set(MODULE_CFLAGS )
|
||||
if(NOT ${OS} STREQUAL "qurt")
|
||||
list(APPEND MODULE_CFLAGS -Wframe-larger-than=3400)
|
||||
endif()
|
||||
|
||||
@@ -35,9 +35,7 @@ px4_add_module(
|
||||
MAIN land_detector
|
||||
STACK 1200
|
||||
COMPILE_FLAGS
|
||||
-Weffc++
|
||||
-Os
|
||||
|
||||
SRCS
|
||||
land_detector_main.cpp
|
||||
land_detector_params.c
|
||||
|
||||
@@ -30,16 +30,20 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
if (${OS} STREQUAL "nuttx")
|
||||
list(APPEND MODULE_CFLAGS -Wframe-larger-than=1500)
|
||||
endif()
|
||||
px4_add_module(
|
||||
MODULE modules__mavlink
|
||||
MAIN mavlink
|
||||
STACK 1200
|
||||
COMPILE_FLAGS
|
||||
-Weffc++
|
||||
${MODULE_CFLAGS}
|
||||
-Wno-attributes
|
||||
-Wno-packed
|
||||
-DMAVLINK_COMM_NUM_BUFFERS=3
|
||||
-Wno-packed
|
||||
-Wno-tautological-constant-out-of-range-compare
|
||||
-Os
|
||||
SRCS
|
||||
mavlink.c
|
||||
|
||||
@@ -30,10 +30,14 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
if (${OS} STREQUAL "nuttx")
|
||||
list(APPEND MODULE_CFLAGS -Wframe-larger-than=3500)
|
||||
endif()
|
||||
px4_add_module(
|
||||
MODULE modules__mc_att_control
|
||||
MAIN mc_att_control
|
||||
STACK 1200
|
||||
COMPILE_FLAGS ${MODULE_CFLAGS}
|
||||
SRCS
|
||||
mc_att_control_main.cpp
|
||||
mc_att_control_params.c
|
||||
|
||||
@@ -64,11 +64,9 @@ static const int ERROR = -1;
|
||||
|
||||
MulticopterAttitudeControlMultiplatform::MulticopterAttitudeControlMultiplatform() :
|
||||
MulticopterAttitudeControlBase(),
|
||||
_task_should_exit(false),
|
||||
_actuators_0_circuit_breaker_enabled(false),
|
||||
|
||||
/* publications */
|
||||
_att_sp_pub(nullptr),
|
||||
_v_rates_sp_pub(nullptr),
|
||||
_actuators_0_pub(nullptr),
|
||||
_n(_appState),
|
||||
|
||||
@@ -85,10 +85,8 @@ public:
|
||||
void spin() { _n.spin(); }
|
||||
|
||||
private:
|
||||
bool _task_should_exit; /**< if true, sensor task should exit */
|
||||
bool _actuators_0_circuit_breaker_enabled; /**< circuit breaker to suppress output */
|
||||
|
||||
px4::Publisher<px4_vehicle_attitude_setpoint> *_att_sp_pub; /**< attitude setpoint publication */
|
||||
px4::Publisher<px4_vehicle_rates_setpoint> *_v_rates_sp_pub; /**< rate setpoint publication */
|
||||
px4::Publisher<px4_actuator_controls_0> *_actuators_0_pub; /**< attitude actuator controls publication */
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
px4_add_module(
|
||||
MODULE modules__mc_pos_control_multiplatform
|
||||
MAIN mc_pos_control_m
|
||||
COMPILE_FLAGS
|
||||
-Wframe-larger-than=1200
|
||||
|
||||
SRCS
|
||||
mc_pos_control_main.cpp
|
||||
mc_pos_control_start_nuttx.cpp
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
set(MODULE_CFLAGS)
|
||||
if(NOT ${OS} STREQUAL "qurt")
|
||||
if(${OS} STREQUAL "nuttx")
|
||||
list(APPEND MODULE_CFLAGS -Wframe-larger-than=3800)
|
||||
endif()
|
||||
px4_add_module(
|
||||
@@ -39,7 +38,6 @@ px4_add_module(
|
||||
MAIN position_estimator_inav
|
||||
STACK 1200
|
||||
COMPILE_FLAGS ${MODULE_CFLAGS}
|
||||
|
||||
SRCS
|
||||
position_estimator_inav_main.c
|
||||
position_estimator_inav_params.c
|
||||
|
||||
@@ -30,13 +30,16 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
if (${OS} STREQUAL "nuttx")
|
||||
list(APPEND MODULE_CFLAGS -Wframe-larger-than=1500)
|
||||
endif()
|
||||
px4_add_module(
|
||||
MODULE modules__sdlog2
|
||||
MAIN sdlog2
|
||||
PRIORITY "SCHED_PRIORITY_MAX-30"
|
||||
STACK 1200
|
||||
COMPILE_FLAGS
|
||||
-Wframe-larger-than=1500
|
||||
${MODULE_CFLAGS}
|
||||
-Os
|
||||
SRCS
|
||||
sdlog2.c
|
||||
|
||||
@@ -40,11 +40,9 @@ px4_add_module(
|
||||
MODULE modules__simulator
|
||||
MAIN simulator
|
||||
COMPILE_FLAGS
|
||||
-Weffc++
|
||||
-Wno-attributes
|
||||
-Wno-packed
|
||||
-Wno-packed
|
||||
|
||||
SRCS
|
||||
${SIMULATOR_SRCS}
|
||||
DEPENDS
|
||||
|
||||
@@ -88,7 +88,7 @@ extern struct param_info_s *param_info_base;
|
||||
extern struct param_info_s *param_info_limit;
|
||||
#else
|
||||
// FIXME - start and end are reversed
|
||||
static const struct param_info_s *param_info_base = (const struct param_info_s *)&px4_parameters;
|
||||
static const struct param_info_s *param_info_base = (const struct param_info_s *) &px4_parameters;
|
||||
#endif
|
||||
|
||||
#define param_info_count px4_parameters.param_count
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
set(uavcan_c_flags ${c_flags})
|
||||
list(REMOVE_ITEM uavcan_c_flags -std=gnu++0x -D__CUSTOM_FILE_IO__)
|
||||
set(uavcan_cxx_flags ${cxx_flags})
|
||||
list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -D__CUSTOM_FILE_IO__)
|
||||
list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -Wundef -Werror -D__CUSTOM_FILE_IO__)
|
||||
set(uavcan_deps git_uavcan)
|
||||
set(uavcan_platform generic)
|
||||
|
||||
@@ -76,8 +76,10 @@ externalproject_add(libuavcan
|
||||
DEPENDS ${uavcan_deps}
|
||||
DOWNLOAD_COMMAND ""
|
||||
UPDATE_COMMAND git submodule update --init
|
||||
LOG_INSTALL 1
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan
|
||||
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
-DUAVCAN_USE_CPP03=ON
|
||||
-DUAVCAN_PLATFORM=${uavcan_platform}
|
||||
-DUAVCAN_OS=${OS}
|
||||
-DCMAKE_CXX_FLAGS=${uavcan_cxx_flags}
|
||||
@@ -94,6 +96,8 @@ px4_add_module(
|
||||
MAIN uavcan
|
||||
STACK 3200
|
||||
COMPILE_FLAGS
|
||||
-Wframe-larger-than=1500
|
||||
-Wno-deprecated-declarations
|
||||
-O3
|
||||
SRCS
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ px4_add_module(
|
||||
MAIN gyrosim
|
||||
STACK 1200
|
||||
COMPILE_FLAGS
|
||||
-Weffc++
|
||||
-Os
|
||||
SRCS
|
||||
gyrosim.cpp
|
||||
|
||||
@@ -34,7 +34,7 @@ set(MIXER_CFLAGS -Os)
|
||||
if(${OS} STREQUAL "qurt")
|
||||
list(APPEND MIXER_CFLAGS -Wframe-larger-than=2176)
|
||||
else()
|
||||
list(APPEND MIXER_CFLAGS -Wframe-larger-than=2048)
|
||||
list(APPEND MIXER_CFLAGS -Wframe-larger-than=2100)
|
||||
endif()
|
||||
|
||||
px4_add_module(
|
||||
|
||||
@@ -445,8 +445,8 @@ do_set(const char *name, const char *val, bool fail_on_not_found)
|
||||
|
||||
if (i != newval) {
|
||||
printf("%c %s: ",
|
||||
param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'),
|
||||
param_name(param));
|
||||
param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'),
|
||||
param_name(param));
|
||||
printf("curr: %ld", (long)i);
|
||||
param_set(param, &newval);
|
||||
printf(" -> new: %ld\n", (long)newval);
|
||||
@@ -467,8 +467,8 @@ do_set(const char *name, const char *val, bool fail_on_not_found)
|
||||
if (f != newval) {
|
||||
#pragma GCC diagnostic pop
|
||||
printf("%c %s: ",
|
||||
param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'),
|
||||
param_name(param));
|
||||
param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'),
|
||||
param_name(param));
|
||||
printf("curr: %4.4f", (double)f);
|
||||
param_set(param, &newval);
|
||||
printf(" -> new: %4.4f\n", (double)newval);
|
||||
|
||||
Reference in New Issue
Block a user