mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
Merge branch 'next' of ssh://git.openpilot.org/OpenPilot into OP-932-Modularize_Radio_Driver
This commit is contained in:
commit
33cb06b1b0
25
Makefile
25
Makefile
@ -261,9 +261,9 @@ fw_$(1)_%: uavobjects_flight
|
|||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
|
||||||
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
|
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
|
||||||
$$(MAKE) -r --no-print-directory \
|
$$(MAKE) -r --no-print-directory \
|
||||||
|
BUILD_TYPE=fw \
|
||||||
BOARD_NAME=$(1) \
|
BOARD_NAME=$(1) \
|
||||||
BOARD_SHORT_NAME=$(2) \
|
BOARD_SHORT_NAME=$(2) \
|
||||||
BUILD_TYPE=fw \
|
|
||||||
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
|
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
|
||||||
OUTDIR=$(BUILD_DIR)/fw_$(1) \
|
OUTDIR=$(BUILD_DIR)/fw_$(1) \
|
||||||
TARGET=fw_$(1) \
|
TARGET=fw_$(1) \
|
||||||
@ -288,9 +288,9 @@ bl_$(1)_%:
|
|||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
|
||||||
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
|
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
|
||||||
$$(MAKE) -r --no-print-directory \
|
$$(MAKE) -r --no-print-directory \
|
||||||
|
BUILD_TYPE=bl \
|
||||||
BOARD_NAME=$(1) \
|
BOARD_NAME=$(1) \
|
||||||
BOARD_SHORT_NAME=$(2) \
|
BOARD_SHORT_NAME=$(2) \
|
||||||
BUILD_TYPE=bl \
|
|
||||||
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
|
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
|
||||||
OUTDIR=$(BUILD_DIR)/bl_$(1) \
|
OUTDIR=$(BUILD_DIR)/bl_$(1) \
|
||||||
TARGET=bl_$(1) \
|
TARGET=bl_$(1) \
|
||||||
@ -326,9 +326,9 @@ bu_$(1)_%: bl_$(1)_bino
|
|||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
|
||||||
$(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
|
$(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
|
||||||
$$(MAKE) -r --no-print-directory \
|
$$(MAKE) -r --no-print-directory \
|
||||||
|
BUILD_TYPE=bu \
|
||||||
BOARD_NAME=$(1) \
|
BOARD_NAME=$(1) \
|
||||||
BOARD_SHORT_NAME=$(2) \
|
BOARD_SHORT_NAME=$(2) \
|
||||||
BUILD_TYPE=bu \
|
|
||||||
TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
|
TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
|
||||||
OUTDIR=$(BUILD_DIR)/bu_$(1) \
|
OUTDIR=$(BUILD_DIR)/bu_$(1) \
|
||||||
TARGET=bu_$(1) \
|
TARGET=bu_$(1) \
|
||||||
@ -350,9 +350,9 @@ ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
|
|||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
|
||||||
$(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
|
$(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
|
||||||
$$(MAKE) -r --no-print-directory \
|
$$(MAKE) -r --no-print-directory \
|
||||||
|
BUILD_TYPE=ef \
|
||||||
BOARD_NAME=$(1) \
|
BOARD_NAME=$(1) \
|
||||||
BOARD_SHORT_NAME=$(2) \
|
BOARD_SHORT_NAME=$(2) \
|
||||||
BUILD_TYPE=ef \
|
|
||||||
DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
|
DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
|
||||||
TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
|
TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
|
||||||
OUTDIR=$(BUILD_DIR)/ef_$(1) \
|
OUTDIR=$(BUILD_DIR)/ef_$(1) \
|
||||||
@ -656,20 +656,9 @@ ut_$(1)_%: $$(UT_OUT_DIR)
|
|||||||
$(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
|
$(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
|
||||||
$$(MAKE) -r --no-print-directory \
|
$$(MAKE) -r --no-print-directory \
|
||||||
BUILD_TYPE=ut \
|
BUILD_TYPE=ut \
|
||||||
BOARD_SHORT_NAME=$(1) \
|
TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
|
||||||
TCHAIN_PREFIX="" \
|
|
||||||
REMOVE_CMD="$(RM)" \
|
|
||||||
\
|
|
||||||
TARGET=$(1) \
|
|
||||||
OUTDIR="$(UT_OUT_DIR)/$(1)" \
|
OUTDIR="$(UT_OUT_DIR)/$(1)" \
|
||||||
\
|
TARGET=$(1) \
|
||||||
PIOS=$(PIOS) \
|
|
||||||
OPUAVOBJ=$(OPUAVOBJ) \
|
|
||||||
OPUAVTALK=$(OPUAVTALK) \
|
|
||||||
FLIGHTLIB=$(FLIGHTLIB) \
|
|
||||||
\
|
|
||||||
GTEST_DIR=$(GTEST_DIR) \
|
|
||||||
\
|
|
||||||
$$*
|
$$*
|
||||||
|
|
||||||
.PHONY: ut_$(1)_clean
|
.PHONY: ut_$(1)_clean
|
||||||
@ -879,6 +868,7 @@ help:
|
|||||||
@$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
|
@$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
|
||||||
@$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
|
@$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
|
||||||
@$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
|
@$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
|
||||||
|
@$(ECHO) " gtest_install - Install the GoogleTest framework"
|
||||||
@$(ECHO) " These targets are not updated yet and are probably broken:"
|
@$(ECHO) " These targets are not updated yet and are probably broken:"
|
||||||
@$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
|
@$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
|
||||||
@$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
|
@$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
|
||||||
@ -886,6 +876,7 @@ help:
|
|||||||
@$(ECHO) " android_sdk_install - Install the Android SDK tools"
|
@$(ECHO) " android_sdk_install - Install the Android SDK tools"
|
||||||
@$(ECHO) " Install all available tools:"
|
@$(ECHO) " Install all available tools:"
|
||||||
@$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
|
@$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
|
||||||
|
@$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
|
||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
@$(ECHO) " Other tool options are:"
|
@$(ECHO) " Other tool options are:"
|
||||||
@$(ECHO) " <tool>_version - Display <tool> version"
|
@$(ECHO) " <tool>_version - Display <tool> version"
|
||||||
|
@ -92,6 +92,7 @@ static bool accel_filter_enabled = false;
|
|||||||
static float accels_filtered[3];
|
static float accels_filtered[3];
|
||||||
static float grot_filtered[3];
|
static float grot_filtered[3];
|
||||||
static float yawBiasRate = 0;
|
static float yawBiasRate = 0;
|
||||||
|
static float rollPitchBiasRate = 0.0f;
|
||||||
static float gyroGain = 0.42;
|
static float gyroGain = 0.42;
|
||||||
static int16_t accelbias[3];
|
static int16_t accelbias[3];
|
||||||
static float q[4] = {1,0,0,0};
|
static float q[4] = {1,0,0,0};
|
||||||
@ -216,17 +217,19 @@ static void AttitudeTask(void *parameters)
|
|||||||
FlightStatusGet(&flightStatus);
|
FlightStatusGet(&flightStatus);
|
||||||
|
|
||||||
if((xTaskGetTickCount() < 7000) && (xTaskGetTickCount() > 1000)) {
|
if((xTaskGetTickCount() < 7000) && (xTaskGetTickCount() > 1000)) {
|
||||||
// For first 7 seconds use accels to get gyro bias
|
// Use accels to initialise attitude and calculate gyro bias
|
||||||
accelKp = 1;
|
accelKp = 1;
|
||||||
accelKi = 0.9;
|
accelKi = 0.0f;
|
||||||
yawBiasRate = 0.01;
|
yawBiasRate = 0.01;
|
||||||
|
rollPitchBiasRate = 0.01f;
|
||||||
accel_filter_enabled = false;
|
accel_filter_enabled = false;
|
||||||
init = 0;
|
init = 0;
|
||||||
}
|
}
|
||||||
else if (zero_during_arming && (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMING)) {
|
else if (zero_during_arming && (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMING)) {
|
||||||
accelKp = 1;
|
accelKp = 1;
|
||||||
accelKi = 0.9;
|
accelKi = 0.0f;
|
||||||
yawBiasRate = 0.01;
|
yawBiasRate = 0.01;
|
||||||
|
rollPitchBiasRate = 0.01f;
|
||||||
accel_filter_enabled = false;
|
accel_filter_enabled = false;
|
||||||
init = 0;
|
init = 0;
|
||||||
} else if (init == 0) {
|
} else if (init == 0) {
|
||||||
@ -234,6 +237,7 @@ static void AttitudeTask(void *parameters)
|
|||||||
AttitudeSettingsAccelKiGet(&accelKi);
|
AttitudeSettingsAccelKiGet(&accelKi);
|
||||||
AttitudeSettingsAccelKpGet(&accelKp);
|
AttitudeSettingsAccelKpGet(&accelKp);
|
||||||
AttitudeSettingsYawBiasRateGet(&yawBiasRate);
|
AttitudeSettingsYawBiasRateGet(&yawBiasRate);
|
||||||
|
rollPitchBiasRate = 0.0f
|
||||||
if (accel_alpha > 0.0f)
|
if (accel_alpha > 0.0f)
|
||||||
accel_filter_enabled = true;
|
accel_filter_enabled = true;
|
||||||
init = 1;
|
init = 1;
|
||||||
@ -357,6 +361,10 @@ static int32_t updateSensors(AccelsData * accels, GyrosData * gyros)
|
|||||||
gyros->z += gyro_correct_int[2];
|
gyros->z += gyro_correct_int[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force the roll & pitch gyro rates to average to zero during initialisation
|
||||||
|
gyro_correct_int[0] += - gyros->x * rollPitchBiasRate;
|
||||||
|
gyro_correct_int[1] += - gyros->y * rollPitchBiasRate;
|
||||||
|
|
||||||
// Because most crafts wont get enough information from gravity to zero yaw gyro, we try
|
// Because most crafts wont get enough information from gravity to zero yaw gyro, we try
|
||||||
// and make it average zero (weakly)
|
// and make it average zero (weakly)
|
||||||
gyro_correct_int[2] += - gyros->z * yawBiasRate;
|
gyro_correct_int[2] += - gyros->z * yawBiasRate;
|
||||||
@ -428,6 +436,10 @@ static int32_t updateSensorsCC3D(AccelsData * accelsData, GyrosData * gyrosData)
|
|||||||
gyrosData->z += gyro_correct_int[2];
|
gyrosData->z += gyro_correct_int[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force the roll & pitch gyro rates to average to zero during initialisation
|
||||||
|
gyro_correct_int[0] += - gyros->x * rollPitchBiasRate;
|
||||||
|
gyro_correct_int[1] += - gyros->y * rollPitchBiasRate;
|
||||||
|
|
||||||
// Because most crafts wont get enough information from gravity to zero yaw gyro, we try
|
// Because most crafts wont get enough information from gravity to zero yaw gyro, we try
|
||||||
// and make it average zero (weakly)
|
// and make it average zero (weakly)
|
||||||
gyro_correct_int[2] += - gyrosData->z * yawBiasRate;
|
gyro_correct_int[2] += - gyrosData->z * yawBiasRate;
|
||||||
|
@ -387,12 +387,15 @@ static int32_t PIOS_Flash_Jedec_EraseChip(uintptr_t flash_id)
|
|||||||
while (PIOS_Flash_Jedec_Busy(flash_dev) != 0) {
|
while (PIOS_Flash_Jedec_Busy(flash_dev) != 0) {
|
||||||
#if defined(FLASH_FREERTOS)
|
#if defined(FLASH_FREERTOS)
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
if ((i++) % 100 == 0)
|
if ((i++) % 100 == 0) {
|
||||||
#else
|
#else
|
||||||
if ((i++) % 10000 == 0)
|
if ((i++) % 10000 == 0) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PIOS_LED_HEARTBEAT
|
||||||
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,9 @@ static int32_t logfs_erase_all_arenas()
|
|||||||
uint16_t num_arenas = logfs.cfg->total_fs_size / logfs.cfg->arena_size;
|
uint16_t num_arenas = logfs.cfg->total_fs_size / logfs.cfg->arena_size;
|
||||||
|
|
||||||
for (uint16_t arena = 0; arena < num_arenas; arena++) {
|
for (uint16_t arena = 0; arena < num_arenas; arena++) {
|
||||||
|
#ifdef PIOS_LED_HEARTBEAT
|
||||||
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
||||||
|
#endif
|
||||||
if (logfs_erase_arena(arena) != 0)
|
if (logfs_erase_arena(arena) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,11 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/* STM32 Std Peripherals Lib */
|
/* STM32 Std Peripherals Lib */
|
||||||
#ifdef STM32F4XX
|
#if defined(STM32F10X)
|
||||||
|
#include <stm32f10x.h>
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
#include <stm32f4xx.h>
|
#include <stm32f4xx.h>
|
||||||
#include <stm32f4xx_rcc.h>
|
#include <stm32f4xx_rcc.h>
|
||||||
#else
|
|
||||||
#include <stm32f10x.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* PIOS board specific feature selection */
|
/* PIOS board specific feature selection */
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# @file Makefile
|
# @file Makefile
|
||||||
# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
|
# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
|
||||||
|
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
|
||||||
# @addtogroup
|
# @addtogroup
|
||||||
# @{
|
# @{
|
||||||
# @addtogroup
|
# @addtogroup
|
||||||
@ -23,21 +24,17 @@
|
|||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
|
ifndef OPENPILOT_IS_COOL
|
||||||
TOP := $(realpath $(WHEREAMI)/../../../)
|
$(error Top level Makefile must be used to build this target)
|
||||||
include $(TOP)/make/firmware-defs.mk
|
endif
|
||||||
|
|
||||||
|
include $(ROOT_DIR)/make/firmware-defs.mk
|
||||||
|
|
||||||
|
EXTRAINCDIRS += $(TOPDIR)
|
||||||
EXTRAINCDIRS += $(PIOS)/inc
|
EXTRAINCDIRS += $(PIOS)/inc
|
||||||
|
|
||||||
CFLAGS += -O0
|
SRC += $(PIOS)/common/pios_flashfs_logfs.c
|
||||||
CFLAGS += -Wall -Werror
|
|
||||||
CFLAGS += -g
|
|
||||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
|
|
||||||
|
|
||||||
CFLAGS += "-DFLASH_IMAGE_FILE=\"$(OUTDIR)/theflash.bin\""
|
CFLAGS += "-DFLASH_IMAGE_FILE=\"$(OUTDIR)/theflash.bin\""
|
||||||
|
|
||||||
CONLYFLAGS += -std=gnu99
|
include $(ROOT_DIR)/make/unittest.mk
|
||||||
|
|
||||||
SRC := $(PIOS)/common/pios_flashfs_logfs.c
|
|
||||||
|
|
||||||
include $(TOP)/make/unittest.mk
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
#ifndef OPENPILOT_H
|
||||||
|
#define OPENPILOT_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define PIOS_Assert(x) if (!(x)) { while (1) ; }
|
#define PIOS_Assert(x) if (!(x)) { while (1) ; }
|
||||||
|
|
||||||
#define PIOS_DEBUG_Assert(x) PIOS_Assert(x)
|
#define PIOS_DEBUG_Assert(x) PIOS_Assert(x)
|
||||||
|
|
||||||
|
#endif /* OPENPILOT_H */
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
#if defined(PIOS_INCLUDE_FLASH)
|
#ifndef PIOS_H
|
||||||
|
#define PIOS_H
|
||||||
|
|
||||||
|
/* PIOS board specific feature selection */
|
||||||
|
#include "pios_config.h"
|
||||||
|
|
||||||
|
#ifdef PIOS_INCLUDE_FLASH
|
||||||
#include <pios_flash.h>
|
#include <pios_flash.h>
|
||||||
#include <pios_flashfs.h>
|
#include <pios_flashfs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* PIOS_H */
|
||||||
|
@ -1 +1,7 @@
|
|||||||
|
#ifndef PIOS_CONFIG_H
|
||||||
|
#define PIOS_CONFIG_H
|
||||||
|
|
||||||
|
/* Enable/Disable PiOS modules */
|
||||||
#define PIOS_INCLUDE_FLASH
|
#define PIOS_INCLUDE_FLASH
|
||||||
|
|
||||||
|
#endif /* PIOS_CONFIG_H */
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# nsis_install (Windows only)
|
# nsis_install (Windows only)
|
||||||
# uncrustify_install
|
# uncrustify_install
|
||||||
# doxygen_install
|
# doxygen_install
|
||||||
|
# gtest_install
|
||||||
#
|
#
|
||||||
# TODO:
|
# TODO:
|
||||||
# openocd_install
|
# openocd_install
|
||||||
@ -24,7 +25,6 @@
|
|||||||
# stm32flash_install
|
# stm32flash_install
|
||||||
# dfuutil_install
|
# dfuutil_install
|
||||||
# android_sdk_install
|
# android_sdk_install
|
||||||
# gtest_install
|
|
||||||
#
|
#
|
||||||
# TODO:
|
# TODO:
|
||||||
# help in the top Makefile
|
# help in the top Makefile
|
||||||
@ -79,6 +79,8 @@ else ifeq ($(UNAME), Windows)
|
|||||||
DOXYGEN_URL := http://wiki.openpilot.org/download/attachments/18612236/doxygen-1.8.3.1-windows.tar.bz2
|
DOXYGEN_URL := http://wiki.openpilot.org/download/attachments/18612236/doxygen-1.8.3.1-windows.tar.bz2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
GTEST_URL := http://wiki.openpilot.org/download/attachments/18612236/gtest-1.6.0.zip
|
||||||
|
|
||||||
# Changing PYTHON_DIR, also update it in ground\openpilotgcs\src\app\gcsversioninfo.pri
|
# Changing PYTHON_DIR, also update it in ground\openpilotgcs\src\app\gcsversioninfo.pri
|
||||||
ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2013q1
|
ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2013q1
|
||||||
QT_SDK_DIR := $(TOOLS_DIR)/qt-4.8.4
|
QT_SDK_DIR := $(TOOLS_DIR)/qt-4.8.4
|
||||||
@ -87,24 +89,30 @@ PYTHON_DIR := $(TOOLS_DIR)/python-2.7.4
|
|||||||
NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode
|
NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode
|
||||||
UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.60
|
UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.60
|
||||||
DOXYGEN_DIR := $(TOOLS_DIR)/doxygen-1.8.3.1
|
DOXYGEN_DIR := $(TOOLS_DIR)/doxygen-1.8.3.1
|
||||||
|
GTEST_DIR := $(TOOLS_DIR)/gtest-1.6.0
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
#
|
#
|
||||||
# All toolchains available for the platform
|
# Build only and all toolchains available for the platform
|
||||||
#
|
#
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
ALL_SDK_TARGETS := arm_sdk qt_sdk
|
BUILD_SDK_TARGETS := arm_sdk qt_sdk
|
||||||
ifeq ($(UNAME), Windows)
|
ifeq ($(UNAME), Windows)
|
||||||
ALL_SDK_TARGETS += mingw python nsis
|
BUILD_SDK_TARGETS += mingw python nsis
|
||||||
endif
|
endif
|
||||||
ALL_SDK_TARGETS += uncrustify doxygen
|
ALL_SDK_TARGETS := $(BUILD_SDK_TARGETS) gtest uncrustify doxygen
|
||||||
|
|
||||||
.PHONY: all_sdk_install all_sdk_clean all_sdk_distclean all_sdk_version
|
define GROUP_SDK_TEMPLATE
|
||||||
all_sdk_install: $(addsuffix _install,$(ALL_SDK_TARGETS))
|
.PHONY: $(1)_install $(1)_clean $(1)_distclean $(1)_version
|
||||||
all_sdk_clean: $(addsuffix _clean,$(ALL_SDK_TARGETS))
|
$(1)_install: $(addsuffix _install,$(2))
|
||||||
all_sdk_distclean: $(addsuffix _distclean,$(ALL_SDK_TARGETS))
|
$(1)_clean: $(addsuffix _clean,$(2))
|
||||||
all_sdk_version: $(addsuffix _version,$(ALL_SDK_TARGETS))
|
$(1)_distclean: $(addsuffix _distclean,$(2))
|
||||||
|
$(1)_version: $(addsuffix _version,$(2))
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call GROUP_SDK_TEMPLATE,build_sdk,$(BUILD_SDK_TARGETS)))
|
||||||
|
$(eval $(call GROUP_SDK_TEMPLATE,all_sdk,$(ALL_SDK_TARGETS)))
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
#
|
#
|
||||||
@ -122,14 +130,14 @@ export CUT := cut
|
|||||||
export SED := sed
|
export SED := sed
|
||||||
|
|
||||||
# Used only by this Makefile
|
# Used only by this Makefile
|
||||||
|
GIT := git
|
||||||
|
CURL := curl
|
||||||
TAR := tar
|
TAR := tar
|
||||||
|
UNZIP := unzip
|
||||||
|
OPENSSL := openssl
|
||||||
ANT := ant
|
ANT := ant
|
||||||
JAVAC := javac
|
JAVAC := javac
|
||||||
JAR := jar
|
JAR := jar
|
||||||
GIT := git
|
|
||||||
CURL := curl
|
|
||||||
OPENSSL := openssl
|
|
||||||
DOXYGEN := doxygen
|
|
||||||
|
|
||||||
# Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
|
# Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
|
||||||
# It does not work if make started under msysGit installed into a path with spaces.
|
# It does not work if make started under msysGit installed into a path with spaces.
|
||||||
@ -173,9 +181,11 @@ MSG_NOTICE = $(QUOTE) NOTE $(QUOTE)
|
|||||||
ifeq ($(V), 1)
|
ifeq ($(V), 1)
|
||||||
CURL_OPTIONS :=
|
CURL_OPTIONS :=
|
||||||
MAKE_SILENT :=
|
MAKE_SILENT :=
|
||||||
|
UNZIP_SILENT :=
|
||||||
else
|
else
|
||||||
CURL_OPTIONS := --silent
|
CURL_OPTIONS := --silent
|
||||||
MAKE_SILENT := --silent
|
MAKE_SILENT := --silent
|
||||||
|
UNZIP_SILENT := -q
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# MSYS tar workaround
|
# MSYS tar workaround
|
||||||
@ -237,7 +247,10 @@ $(1)_install: $(1)_clean | $(DL_DIR) $(TOOLS_DIR)
|
|||||||
|
|
||||||
@$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(2))
|
@$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(2))
|
||||||
$(V1) $(MKDIR) -p $$(call toprel, $(dir $(2)))
|
$(V1) $(MKDIR) -p $$(call toprel, $(dir $(2)))
|
||||||
|
$(if $(filter $(suffix $(4)), .zip),
|
||||||
|
$(V1) $(UNZIP) $(UNZIP_SILENT) -d $$(call toprel, $(dir $(2))) $$(call toprel, $(DL_DIR)/$(4)),
|
||||||
$(V1) $(TAR) $(TAR_OPTIONS) -C $$(call toprel, $(dir $(2))) -xf $$(call toprel, $(DL_DIR)/$(4))
|
$(V1) $(TAR) $(TAR_OPTIONS) -C $$(call toprel, $(dir $(2))) -xf $$(call toprel, $(DL_DIR)/$(4))
|
||||||
|
)
|
||||||
|
|
||||||
$(5)
|
$(5)
|
||||||
|
|
||||||
@ -523,7 +536,19 @@ endif
|
|||||||
doxygen_version:
|
doxygen_version:
|
||||||
-$(V1) $(ECHO) "Doxygen `$(DOXYGEN) --version`"
|
-$(V1) $(ECHO) "Doxygen `$(DOXYGEN) --version`"
|
||||||
|
|
||||||
|
##############################
|
||||||
|
#
|
||||||
|
# GoogleTest
|
||||||
|
#
|
||||||
|
##############################
|
||||||
|
|
||||||
|
$(eval $(call TOOL_INSTALL_TEMPLATE,gtest,$(GTEST_DIR),$(GTEST_URL),$(notdir $(GTEST_URL))))
|
||||||
|
|
||||||
|
export GTEST_DIR
|
||||||
|
|
||||||
|
.PHONY: gtest_version
|
||||||
|
gtest_version:
|
||||||
|
-$(V1) $(SED) -n "s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR)/configure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -790,28 +815,6 @@ android_sdk_update:
|
|||||||
$(V0) @echo " UPDATE $(ANDROID_SDK_DIR)"
|
$(V0) @echo " UPDATE $(ANDROID_SDK_DIR)"
|
||||||
$(ANDROID_SDK_DIR)/tools/android update sdk --no-ui -t platform-tools,android-16,addon-google_apis-google-16
|
$(ANDROID_SDK_DIR)/tools/android update sdk --no-ui -t platform-tools,android-16,addon-google_apis-google-16
|
||||||
|
|
||||||
# Set up Google Test (gtest) tools
|
|
||||||
GTEST_DIR := $(TOOLS_DIR)/gtest-1.6.0
|
|
||||||
|
|
||||||
.PHONY: gtest_install
|
|
||||||
gtest_install: | $(DL_DIR) $(TOOLS_DIR)
|
|
||||||
gtest_install: GTEST_URL := http://googletest.googlecode.com/files/gtest-1.6.0.zip
|
|
||||||
gtest_install: GTEST_FILE := $(notdir $(GTEST_URL))
|
|
||||||
gtest_install: gtest_clean
|
|
||||||
# download the file unconditionally since google code gives back 404
|
|
||||||
# for HTTP HEAD requests which are used when using the wget -N option
|
|
||||||
$(V1) [ ! -f "$(DL_DIR)/$(GTEST_FILE)" ] || $(RM) -f "$(DL_DIR)/$(GTEST_FILE)"
|
|
||||||
$(V1) $(WGET) -P "$(DL_DIR)" --trust-server-name "$(GTEST_URL)"
|
|
||||||
|
|
||||||
# extract the source
|
|
||||||
$(V1) [ ! -d "$(GTEST_DIR)" ] || $(RM) -rf "$(GTEST_DIR)"
|
|
||||||
$(V1) mkdir -p "$(GTEST_DIR)"
|
|
||||||
$(V1) unzip -q -d "$(TOOLS_DIR)" "$(DL_DIR)/$(GTEST_FILE)"
|
|
||||||
|
|
||||||
.PHONY: gtest_clean
|
|
||||||
gtest_clean:
|
|
||||||
$(V0) @echo " CLEAN $(GTEST_DIR)"
|
|
||||||
$(V1) [ ! -d "$(GTEST_DIR)" ] || $(RM) -rf "$(GTEST_DIR)"
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
#
|
#
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# @file unittest.mk
|
# @file unittest.mk
|
||||||
# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
|
# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
|
||||||
|
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
|
||||||
# @addtogroup
|
# @addtogroup
|
||||||
# @{
|
# @{
|
||||||
# @addtogroup
|
# @addtogroup
|
||||||
@ -23,25 +24,11 @@
|
|||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# Flags passed to the preprocessor.
|
# Use native toolchain and disable THUMB mode for unit tests
|
||||||
CPPFLAGS += -I$(GTEST_DIR)/include
|
override ARM_SDK_PREFIX :=
|
||||||
|
|
||||||
# Flags passed to the C++ compiler.
|
|
||||||
CXXFLAGS += -g -Wall -Wextra
|
|
||||||
|
|
||||||
# Google Test needs the pthread library
|
|
||||||
LDFLAGS += -lpthread
|
|
||||||
|
|
||||||
#################################
|
|
||||||
#
|
|
||||||
# Template to build the user test
|
|
||||||
#
|
|
||||||
#################################
|
|
||||||
|
|
||||||
# Need to disable THUMB mode for unit tests
|
|
||||||
override THUMB :=
|
override THUMB :=
|
||||||
|
|
||||||
EXTRAINCDIRS += .
|
# Unit test source files
|
||||||
ALLSRC := $(SRC) $(wildcard ./*.c)
|
ALLSRC := $(SRC) $(wildcard ./*.c)
|
||||||
ALLCPPSRC := $(wildcard ./*.cpp) $(GTEST_DIR)/src/gtest_main.cc
|
ALLCPPSRC := $(wildcard ./*.cpp) $(GTEST_DIR)/src/gtest_main.cc
|
||||||
ALLSRCBASE := $(notdir $(basename $(ALLSRC) $(ALLCPPSRC)))
|
ALLSRCBASE := $(notdir $(basename $(ALLSRC) $(ALLCPPSRC)))
|
||||||
@ -50,13 +37,29 @@ ALLOBJ := $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
|
|||||||
$(foreach src,$(ALLSRC),$(eval $(call COMPILE_C_TEMPLATE,$(src))))
|
$(foreach src,$(ALLSRC),$(eval $(call COMPILE_C_TEMPLATE,$(src))))
|
||||||
$(foreach src,$(ALLCPPSRC),$(eval $(call COMPILE_CXX_TEMPLATE,$(src))))
|
$(foreach src,$(ALLCPPSRC),$(eval $(call COMPILE_CXX_TEMPLATE,$(src))))
|
||||||
|
|
||||||
|
|
||||||
# Specific extensions to CPPFLAGS only for the google test library
|
# Specific extensions to CPPFLAGS only for the google test library
|
||||||
$(OUTDIR)/gtest-all.o: CPPFLAGS += -I$(GTEST_DIR)
|
$(OUTDIR)/gtest-all.o: CPPFLAGS += -I$(GTEST_DIR)
|
||||||
$(eval $(call COMPILE_CXX_TEMPLATE, $(GTEST_DIR)/src/gtest-all.cc))
|
|
||||||
|
|
||||||
|
$(eval $(call COMPILE_CXX_TEMPLATE, $(GTEST_DIR)/src/gtest-all.cc))
|
||||||
$(eval $(call LINK_CXX_TEMPLATE,$(OUTDIR)/$(TARGET).elf,$(ALLOBJ) $(OUTDIR)/gtest-all.o))
|
$(eval $(call LINK_CXX_TEMPLATE,$(OUTDIR)/$(TARGET).elf,$(ALLOBJ) $(OUTDIR)/gtest-all.o))
|
||||||
|
|
||||||
|
# Flags passed to the preprocessor
|
||||||
|
CPPFLAGS += -I$(GTEST_DIR)/include
|
||||||
|
|
||||||
|
# Flags passed to the C++ compiler
|
||||||
|
CXXFLAGS += -g -Wall -Wextra
|
||||||
|
|
||||||
|
# Flags passed to the C compiler
|
||||||
|
CONLYFLAGS += -std=gnu99
|
||||||
|
|
||||||
|
# Common compiler flags
|
||||||
|
CFLAGS += -O0 -g
|
||||||
|
CFLAGS += -Wall -Werror
|
||||||
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||||
|
|
||||||
|
# Google Test needs the pthread library
|
||||||
|
LDFLAGS += -lpthread
|
||||||
|
|
||||||
.PHONY: elf
|
.PHONY: elf
|
||||||
elf: $(OUTDIR)/$(TARGET).elf
|
elf: $(OUTDIR)/$(TARGET).elf
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user