2011-01-14 02:38:19 +01:00
|
|
|
#####
|
|
|
|
# Project: OpenPilot
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Makefile for OpenPilot project build PiOS and the AP.
|
|
|
|
#
|
|
|
|
# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#####
|
|
|
|
|
2011-02-23 05:18:53 +01:00
|
|
|
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
|
|
|
|
TOP := $(realpath $(WHEREAMI)/../../)
|
|
|
|
include $(TOP)/make/firmware-defs.mk
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk
|
|
|
|
|
|
|
|
# Target file name (without extension).
|
|
|
|
TARGET := fw_$(BOARD_NAME)
|
|
|
|
|
|
|
|
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
|
|
|
|
OUTDIR := $(TOP)/build/$(TARGET)
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
# Set developer code and compile options
|
|
|
|
# Set to YES to compile for debugging
|
2011-02-08 17:34:24 +01:00
|
|
|
DEBUG ?= NO
|
2011-01-14 02:38:19 +01:00
|
|
|
|
2011-06-17 16:50:10 +02:00
|
|
|
# Include objects that are just nice information to show
|
2012-08-22 08:25:54 +02:00
|
|
|
STACK_DIAGNOSTICS ?= NO
|
|
|
|
MIXERSTATUS_DIAGNOSTICS ?= NO
|
|
|
|
RATEDESIRED_DIAGNOSTICS ?= NO
|
|
|
|
I2C_WDG_STATS_DIAGNOSTICS ?= NO
|
2012-04-03 09:06:49 +02:00
|
|
|
DIAG_TASKS ?= NO
|
2011-06-17 16:50:10 +02:00
|
|
|
|
2012-09-27 18:51:12 +02:00
|
|
|
#Or just turn on all the above diagnostics. WARNING: This consumes massive amounts of memory.
|
|
|
|
ALL_DIGNOSTICS ?=NO
|
2012-08-22 08:25:54 +02:00
|
|
|
|
2011-04-30 00:38:26 +02:00
|
|
|
# Set to YES to build a FW version that will erase all flash memory
|
|
|
|
ERASE_FLASH ?= NO
|
2011-01-14 02:38:19 +01:00
|
|
|
# Set to YES to use the Servo output pins for debugging via scope or logic analyser
|
|
|
|
ENABLE_DEBUG_PINS ?= NO
|
|
|
|
|
|
|
|
# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs
|
|
|
|
ENABLE_AUX_UART ?= NO
|
|
|
|
|
|
|
|
# Set to YES when using Code Sourcery toolchain
|
2012-02-07 08:12:55 +01:00
|
|
|
CODE_SOURCERY ?= NO
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
# Remove command is different for Code Sourcery on Windows
|
|
|
|
ifeq ($(CODE_SOURCERY), YES)
|
|
|
|
REMOVE_CMD = cs-rm
|
|
|
|
else
|
|
|
|
REMOVE_CMD = rm
|
|
|
|
endif
|
|
|
|
|
|
|
|
FLASH_TOOL = OPENOCD
|
|
|
|
|
2012-02-22 21:57:45 +01:00
|
|
|
# Optional module and driver defaults
|
|
|
|
USE_CAMERASTAB ?= YES
|
|
|
|
USE_COMUSBBRIDGE ?= YES
|
|
|
|
USE_GPS ?= YES
|
|
|
|
USE_TXPID ?= YES
|
|
|
|
USE_I2C ?= NO
|
|
|
|
USE_ALTITUDE ?= NO
|
2012-08-02 11:32:59 +02:00
|
|
|
USE_AUTOTUNE ?= YES
|
2012-02-22 21:57:45 +01:00
|
|
|
TEST_FAULTS ?= NO
|
|
|
|
|
|
|
|
# List of optional modules to include
|
|
|
|
OPTMODULES =
|
|
|
|
ifeq ($(USE_CAMERASTAB), YES)
|
|
|
|
OPTMODULES += CameraStab
|
|
|
|
endif
|
|
|
|
ifeq ($(USE_COMUSBBRIDGE), YES)
|
|
|
|
OPTMODULES += ComUsbBridge
|
|
|
|
endif
|
2011-10-22 23:41:18 +02:00
|
|
|
ifeq ($(USE_GPS), YES)
|
2011-09-28 21:02:02 +02:00
|
|
|
OPTMODULES += GPS
|
2011-10-22 23:41:18 +02:00
|
|
|
endif
|
2012-02-22 21:57:45 +01:00
|
|
|
ifeq ($(USE_TXPID), YES)
|
2011-11-13 15:25:58 +01:00
|
|
|
OPTMODULES += TxPID
|
2012-02-22 21:57:45 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(USE_ALTITUDE), YES)
|
|
|
|
ifeq ($(USE_I2C), YES)
|
|
|
|
OPTMODULES += Altitude
|
|
|
|
else
|
|
|
|
$(error "Altitude module (USE_ALTITUDE=YES) requires i2c (USE_I2C=YES)")
|
|
|
|
endif
|
|
|
|
endif
|
2011-12-31 04:53:09 +01:00
|
|
|
ifeq ($(TEST_FAULTS), YES)
|
|
|
|
OPTMODULES += Fault
|
|
|
|
endif
|
2012-07-31 09:35:33 +02:00
|
|
|
ifeq ($(USE_AUTOTUNE), YES)
|
|
|
|
OPTMODULES += Autotune
|
|
|
|
endif
|
2011-12-31 04:53:09 +01:00
|
|
|
|
2012-02-22 21:57:45 +01:00
|
|
|
# List of mandatory modules to include
|
2011-08-20 13:02:44 +02:00
|
|
|
MODULES = Attitude Stabilization Actuator ManualControl FirmwareIAP
|
|
|
|
# Telemetry must be last to grab the optional modules (why?)
|
2011-06-18 18:59:02 +02:00
|
|
|
MODULES += Telemetry
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
# Paths
|
|
|
|
OPSYSTEM = ./System
|
|
|
|
OPSYSTEMINC = $(OPSYSTEM)/inc
|
2011-01-14 02:38:24 +01:00
|
|
|
OPUAVTALK = ../UAVTalk
|
2011-01-14 02:38:19 +01:00
|
|
|
OPUAVTALKINC = $(OPUAVTALK)/inc
|
2011-01-14 02:38:24 +01:00
|
|
|
OPUAVOBJ = ../UAVObjects
|
2011-01-14 02:38:19 +01:00
|
|
|
OPUAVOBJINC = $(OPUAVOBJ)/inc
|
|
|
|
OPTESTS = ./Tests
|
2011-01-14 02:38:24 +01:00
|
|
|
OPMODULEDIR = ../Modules
|
2011-01-14 02:38:19 +01:00
|
|
|
FLIGHTLIB = ../Libraries
|
2011-01-14 02:38:24 +01:00
|
|
|
FLIGHTLIBINC = $(FLIGHTLIB)/inc
|
2012-08-02 11:12:12 +02:00
|
|
|
MATHLIB = ../Libraries/math
|
|
|
|
MATHLIBINC = ../Libraries/math
|
2011-01-14 02:38:19 +01:00
|
|
|
PIOS = ../PiOS
|
|
|
|
PIOSINC = $(PIOS)/inc
|
|
|
|
PIOSSTM32F10X = $(PIOS)/STM32F10x
|
|
|
|
PIOSCOMMON = $(PIOS)/Common
|
|
|
|
PIOSBOARDS = $(PIOS)/Boards
|
|
|
|
APPLIBDIR = $(PIOSSTM32F10X)/Libraries
|
|
|
|
STMLIBDIR = $(APPLIBDIR)
|
|
|
|
STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver
|
|
|
|
STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver
|
|
|
|
STMSPDSRCDIR = $(STMSPDDIR)/src
|
|
|
|
STMSPDINCDIR = $(STMSPDDIR)/inc
|
|
|
|
STMUSBSRCDIR = $(STMUSBDIR)/src
|
|
|
|
STMUSBINCDIR = $(STMUSBDIR)/inc
|
|
|
|
CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3
|
|
|
|
DOSFSDIR = $(APPLIBDIR)/dosfs
|
|
|
|
MSDDIR = $(APPLIBDIR)/msd
|
2012-10-09 17:08:06 +02:00
|
|
|
RTOSDIR = $(PIOSCOMMON)/Libraries/FreeRTOS
|
2011-01-14 02:38:19 +01:00
|
|
|
RTOSSRCDIR = $(RTOSDIR)/Source
|
|
|
|
RTOSINCDIR = $(RTOSSRCDIR)/include
|
2012-10-09 17:08:06 +02:00
|
|
|
RTOSPORTDIR = $(APPLIBDIR)/FreeRTOS/Source
|
2011-01-14 02:38:19 +01:00
|
|
|
DOXYGENDIR = ../Doc/Doxygen
|
|
|
|
AHRSBOOTLOADER = ../Bootloaders/AHRS/
|
|
|
|
AHRSBOOTLOADERINC = $(AHRSBOOTLOADER)/inc
|
|
|
|
PYMITE = $(FLIGHTLIB)/PyMite
|
|
|
|
PYMITELIB = $(PYMITE)/lib
|
|
|
|
PYMITEPLAT = $(PYMITE)/platform/openpilot
|
|
|
|
PYMITETOOLS = $(PYMITE)/tools
|
|
|
|
PYMITEVM = $(PYMITE)/vm
|
|
|
|
PYMITEINC = $(PYMITEVM)
|
|
|
|
PYMITEINC += $(PYMITEPLAT)
|
|
|
|
PYMITEINC += $(OUTDIR)
|
|
|
|
FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib
|
|
|
|
FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans
|
2012-01-23 01:41:41 +01:00
|
|
|
HWDEFSINC = ../board_hw_defs/$(BOARD_NAME)
|
2011-01-14 02:38:19 +01:00
|
|
|
|
2011-01-29 17:15:16 +01:00
|
|
|
OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight
|
2011-01-24 09:14:00 +01:00
|
|
|
|
2011-01-14 02:38:19 +01:00
|
|
|
# List C source files here. (C dependencies are automatically generated.)
|
|
|
|
# use file-extension c for "c-only"-files
|
|
|
|
|
|
|
|
ifndef TESTAPP
|
|
|
|
## MODULES
|
2011-08-20 13:02:44 +02:00
|
|
|
SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}}
|
2011-01-14 02:38:19 +01:00
|
|
|
SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}}
|
|
|
|
## OPENPILOT CORE:
|
|
|
|
SRC += ${OPMODULEDIR}/System/systemmod.c
|
2011-01-14 02:38:44 +01:00
|
|
|
SRC += $(OPSYSTEM)/coptercontrol.c
|
2011-01-14 02:38:19 +01:00
|
|
|
SRC += $(OPSYSTEM)/pios_board.c
|
|
|
|
SRC += $(OPSYSTEM)/alarms.c
|
|
|
|
SRC += $(OPUAVTALK)/uavtalk.c
|
|
|
|
SRC += $(OPUAVOBJ)/uavobjectmanager.c
|
|
|
|
SRC += $(OPUAVOBJ)/eventdispatcher.c
|
|
|
|
else
|
|
|
|
## TESTCODE
|
|
|
|
SRC += $(OPTESTS)/test_common.c
|
|
|
|
SRC += $(OPTESTS)/$(TESTAPP).c
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## UAVOBJECTS
|
|
|
|
ifndef TESTAPP
|
2011-06-04 19:36:33 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/accessorydesired.c
|
2011-01-29 17:15:16 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/objectpersistence.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c
|
2011-12-31 04:53:09 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/faultsettings.c
|
2011-05-03 18:04:44 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/flightstatus.c
|
2011-01-29 17:15:16 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/systemstats.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/systemalarms.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/systemsettings.c
|
2011-03-02 02:25:27 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/stabilizationdesired.c
|
2011-01-29 17:15:16 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/actuatordesired.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c
|
2012-01-24 06:28:45 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/accels.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/gyros.c
|
2011-01-29 17:15:16 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/attitudeactual.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/i2cstats.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/mixersettings.c
|
2011-02-01 02:55:54 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c
|
2011-02-01 03:18:26 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/attitudesettings.c
|
2011-06-23 07:46:41 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c
|
2011-08-10 03:43:48 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/cameradesired.c
|
2011-08-20 01:24:06 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/gpsposition.c
|
2012-06-28 09:02:14 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c
|
bootcfg: use UAVobj to control boot-time HW config
This should mark an end to the compile-time selection of HW
configurations.
Minor changes in board initialization for all platforms:
- Most config structs are marked static to prevent badly written
drivers from directly referring to config data.
- Adapt to changes in .irq fields in config data.
- Adapt to changes in USART IRQ handling.
Major changes in board initialization for CC:
- Use HwSettings UAVObj to decide which drivers to attach to
the "main" port and the flexi port, and select the appropriate
device configuration data.
- HwSettings allows choosing between Disabled, Telemetry, SBUS,
Spektrum,GPS, and I2C for each of the two ports.
- Use ManualControlSettings.InputMode to init/configure the
appropriate receiver module, and register its available rx channels
with the PIOS_RCVR layer. Can choose between PWM, Spektrum and PPM
at board init time. PPM driver is broken, and SBUS will work once
it is added to this UAVObj as an option.
- CC build now includes code for SBUS, Spektrum and PWM receivers in
every firmware image.
PIOS_USART driver:
- Now handles its own low-level IRQs internally
- If NULL upper-level IRQ handler is bound in at board init time
then rx/tx is satisfied by internal PIOS_USART buffered IO routines
which are (typically) attached to the COM layer.
- If an alternate upper-level IRQ handler is bound in at board init
then that handler is called and expected to clear down the USART
IRQ sources. This is used by Spektrum and SBUS drivers.
PIOS_SBUS and PIOS_SPEKTRUM drivers:
- Improved data/API hiding
- No longer assume they know where their config data is stored which
allows for boot-time alternate configurations for the driver.
- Now registers an upper-level IRQ handlerwith the USART layer to
decouple the driver from which USART it is actually attached to.
2011-07-06 02:21:00 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/hwsettings.c
|
2011-07-28 14:22:47 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c
|
2011-08-02 07:27:37 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/receiveractivity.c
|
2012-07-31 09:35:33 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/relaytuningsettings.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/relaytuning.c
|
2011-06-17 16:50:10 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/taskinfo.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/mixerstatus.c
|
|
|
|
SRC += $(OPUAVSYNTHDIR)/ratedesired.c
|
2012-01-14 21:17:24 +01:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/baroaltitude.c
|
2011-09-16 22:36:44 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/txpidsettings.c
|
2012-08-29 16:04:47 +02:00
|
|
|
SRC += $(OPUAVSYNTHDIR)/airspeedactual.c
|
2011-06-17 16:50:10 +02:00
|
|
|
|
2011-01-14 02:38:19 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
## PIOS Hardware (STM32F10x)
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_sys.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_led.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_delay.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_usart.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_irq.c
|
2012-05-01 07:30:41 +02:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_adc.c
|
2011-01-14 02:38:19 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_servo.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_i2c.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_spi.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_ppm.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_pwm.c
|
2011-11-04 20:40:34 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_dsm.c
|
2011-06-13 02:04:49 +02:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_sbus.c
|
2011-01-14 02:38:19 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_debug.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_exti.c
|
2011-05-29 13:52:22 +02:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_rtc.c
|
2011-01-14 02:38:19 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_wdg.c
|
2011-08-07 03:20:46 +02:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
2011-08-13 05:23:16 +02:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_tim.c
|
2011-12-24 20:10:23 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
2011-01-14 02:38:19 +01:00
|
|
|
|
2011-09-08 03:39:56 +02:00
|
|
|
# PIOS USB related files (separated to make code maintenance more easy)
|
2012-01-02 20:03:15 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_usb.c
|
2011-09-10 05:26:19 +02:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_usbhook.c
|
2011-01-14 02:38:47 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
2012-08-06 03:45:27 +02:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_usb_rctx.c
|
2012-01-02 20:03:15 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_usb_cdc.c
|
2011-01-14 02:38:47 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
2012-01-02 20:03:15 +01:00
|
|
|
SRC += $(OPSYSTEM)/pios_usb_board_data.c
|
|
|
|
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c
|
2012-01-14 20:17:06 +01:00
|
|
|
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
|
2012-05-19 22:15:47 +02:00
|
|
|
SRC += $(PIOSCOMMON)/pios_usb_util.c
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
## PIOS Hardware (Common)
|
2011-06-04 15:55:15 +02:00
|
|
|
SRC += $(PIOSCOMMON)/pios_crc.c
|
2011-05-14 21:23:02 +02:00
|
|
|
SRC += $(PIOSCOMMON)/pios_flashfs_objlist.c
|
2012-01-25 07:23:24 +01:00
|
|
|
SRC += $(PIOSCOMMON)/pios_flash_jedec.c
|
2011-01-17 09:45:37 +01:00
|
|
|
SRC += $(PIOSCOMMON)/pios_adxl345.c
|
2012-03-26 07:22:59 +02:00
|
|
|
SRC += $(PIOSCOMMON)/pios_mpu6000.c
|
2011-01-14 02:38:19 +01:00
|
|
|
SRC += $(PIOSCOMMON)/pios_com.c
|
2012-01-24 17:32:42 +01:00
|
|
|
#SRC += $(PIOSCOMMON)/pios_i2c_esc.c
|
|
|
|
#SRC += $(PIOSCOMMON)/pios_bmp085.c
|
2011-06-25 15:27:28 +02:00
|
|
|
SRC += $(PIOSCOMMON)/pios_rcvr.c
|
2011-07-28 14:22:47 +02:00
|
|
|
SRC += $(PIOSCOMMON)/pios_gcsrcvr.c
|
2011-01-14 02:38:19 +01:00
|
|
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
|
|
|
## Libraries for flight calculations
|
|
|
|
SRC += $(FLIGHTLIB)/fifo_buffer.c
|
2011-01-17 09:45:43 +01:00
|
|
|
SRC += $(FLIGHTLIB)/CoordinateConversions.c
|
2012-01-16 03:37:10 +01:00
|
|
|
SRC += $(FLIGHTLIB)/taskmonitor.c
|
2012-08-02 11:12:12 +02:00
|
|
|
SRC += $(MATHLIB)/sin_lookup.c
|
|
|
|
SRC += $(MATHLIB)/pid.c
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
## CMSIS for STM32
|
|
|
|
SRC += $(CMSISDIR)/core_cm3.c
|
|
|
|
SRC += $(CMSISDIR)/system_stm32f10x.c
|
|
|
|
|
|
|
|
## Used parts of the STM-Library
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_adc.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_dac.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_i2c.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_iwdg.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c
|
|
|
|
SRC += $(STMSPDSRCDIR)/misc.c
|
|
|
|
|
|
|
|
## STM32 USB Library
|
2011-01-14 02:38:47 +01:00
|
|
|
SRC += $(STMUSBSRCDIR)/usb_core.c
|
|
|
|
SRC += $(STMUSBSRCDIR)/usb_init.c
|
|
|
|
SRC += $(STMUSBSRCDIR)/usb_int.c
|
|
|
|
SRC += $(STMUSBSRCDIR)/usb_mem.c
|
|
|
|
SRC += $(STMUSBSRCDIR)/usb_regs.c
|
|
|
|
SRC += $(STMUSBSRCDIR)/usb_sil.c
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
## RTOS
|
|
|
|
SRC += $(RTOSSRCDIR)/list.c
|
|
|
|
SRC += $(RTOSSRCDIR)/queue.c
|
|
|
|
SRC += $(RTOSSRCDIR)/tasks.c
|
|
|
|
|
|
|
|
## RTOS Portable
|
2012-10-09 17:08:06 +02:00
|
|
|
SRC += $(RTOSPORTDIR)/portable/GCC/ARM_CM3/port.c
|
|
|
|
SRC += $(RTOSPORTDIR)/portable/MemMang/heap_1.c
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
## Dosfs file system
|
2011-01-14 02:38:24 +01:00
|
|
|
#SRC += $(DOSFSDIR)/dosfs.c
|
|
|
|
#SRC += $(DOSFSDIR)/dfs_sdcard.c
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
## PyMite files
|
|
|
|
#SRC += $(wildcard ${PYMITEVM}/*.c)
|
|
|
|
#SRC += $(wildcard ${PYMITEPLAT}/*.c)
|
|
|
|
#SRC += $(OUTDIR)/pmlib_img.c
|
|
|
|
#SRC += $(OUTDIR)/pmlib_nat.c
|
|
|
|
#SRC += $(OUTDIR)/pmlibusr_img.c
|
|
|
|
#SRC += $(OUTDIR)/pmlibusr_nat.c
|
|
|
|
|
|
|
|
## Mass Storage Device
|
|
|
|
#SRC += $(MSDDIR)/msd.c
|
|
|
|
#SRC += $(MSDDIR)/msd_bot.c
|
|
|
|
#SRC += $(MSDDIR)/msd_desc.c
|
|
|
|
#SRC += $(MSDDIR)/msd_memory.c
|
|
|
|
#SRC += $(MSDDIR)/msd_scsi.c
|
|
|
|
#SRC += $(MSDDIR)/msd_scsi_data.c
|
|
|
|
|
|
|
|
# List C source files here which must be compiled in ARM-Mode (no -mthumb).
|
|
|
|
# use file-extension c for "c-only"-files
|
|
|
|
## just for testing, timer.c could be compiled in thumb-mode too
|
|
|
|
SRCARM =
|
|
|
|
|
|
|
|
# List C++ source files here.
|
|
|
|
# use file-extension .cpp for C++-files (not .C)
|
|
|
|
CPPSRC =
|
|
|
|
|
|
|
|
# List C++ source files here which must be compiled in ARM-Mode.
|
|
|
|
# use file-extension .cpp for C++-files (not .C)
|
|
|
|
#CPPSRCARM = $(TARGET).cpp
|
|
|
|
CPPSRCARM =
|
|
|
|
|
|
|
|
# List Assembler source files here.
|
|
|
|
# Make them always end in a capital .S. Files ending in a lowercase .s
|
|
|
|
# will not be considered source files but generated files (assembler
|
|
|
|
# output from the compiler), and will be deleted upon "make clean"!
|
|
|
|
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
|
|
|
# it will preserve the spelling of the filenames, and gcc itself does
|
|
|
|
# care about how the name is spelled on its command-line.
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
# List Assembler source files here which must be assembled in ARM-Mode..
|
|
|
|
ASRCARM =
|
|
|
|
|
|
|
|
# List any extra directories to look for include files here.
|
|
|
|
# Each directory must be seperated by a space.
|
|
|
|
EXTRAINCDIRS = $(OPSYSTEM)
|
|
|
|
EXTRAINCDIRS += $(OPSYSTEMINC)
|
|
|
|
EXTRAINCDIRS += $(OPUAVTALK)
|
|
|
|
EXTRAINCDIRS += $(OPUAVTALKINC)
|
|
|
|
EXTRAINCDIRS += $(OPUAVOBJ)
|
|
|
|
EXTRAINCDIRS += $(OPUAVOBJINC)
|
2011-01-24 09:14:00 +01:00
|
|
|
EXTRAINCDIRS += $(OPUAVSYNTHDIR)
|
2011-01-14 02:38:19 +01:00
|
|
|
EXTRAINCDIRS += $(PIOS)
|
|
|
|
EXTRAINCDIRS += $(PIOSINC)
|
|
|
|
EXTRAINCDIRS += $(FLIGHTLIBINC)
|
2012-08-02 11:12:12 +02:00
|
|
|
EXTRAINCDIRS += $(MATHLIBINC)
|
2011-01-14 02:38:19 +01:00
|
|
|
EXTRAINCDIRS += $(PIOSSTM32F10X)
|
|
|
|
EXTRAINCDIRS += $(PIOSCOMMON)
|
|
|
|
EXTRAINCDIRS += $(PIOSBOARDS)
|
|
|
|
EXTRAINCDIRS += $(STMSPDINCDIR)
|
|
|
|
EXTRAINCDIRS += $(STMUSBINCDIR)
|
|
|
|
EXTRAINCDIRS += $(CMSISDIR)
|
|
|
|
EXTRAINCDIRS += $(DOSFSDIR)
|
|
|
|
EXTRAINCDIRS += $(MSDDIR)
|
|
|
|
EXTRAINCDIRS += $(RTOSINCDIR)
|
|
|
|
EXTRAINCDIRS += $(APPLIBDIR)
|
2012-10-09 17:08:06 +02:00
|
|
|
EXTRAINCDIRS += $(RTOSPORTDIR)/portable/GCC/ARM_CM3
|
2011-01-14 02:38:19 +01:00
|
|
|
EXTRAINCDIRS += $(AHRSBOOTLOADERINC)
|
|
|
|
EXTRAINCDIRS += $(PYMITEINC)
|
2012-01-23 01:41:41 +01:00
|
|
|
EXTRAINCDIRS += $(HWDEFSINC)
|
2011-01-14 02:38:19 +01:00
|
|
|
|
2011-08-20 13:02:44 +02:00
|
|
|
EXTRAINCDIRS += ${foreach MOD, ${OPTMODULES} ${MODULES}, ${OPMODULEDIR}/${MOD}/inc} ${OPMODULEDIR}/System/inc
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
# List any extra directories to look for library files here.
|
|
|
|
# Also add directories where the linker should search for
|
|
|
|
# includes from linker-script to the list
|
|
|
|
# Each directory must be seperated by a space.
|
|
|
|
EXTRA_LIBDIRS =
|
|
|
|
|
|
|
|
# Extra Libraries
|
|
|
|
# Each library-name must be seperated by a space.
|
|
|
|
# i.e. to link with libxyz.a, libabc.a and libefsl.a:
|
|
|
|
# EXTRA_LIBS = xyz abc efsl
|
|
|
|
# for newlib-lpc (file: libnewlibc-lpc.a):
|
|
|
|
# EXTRA_LIBS = newlib-lpc
|
|
|
|
EXTRA_LIBS =
|
|
|
|
|
|
|
|
# Path to Linker-Scripts
|
|
|
|
LINKERSCRIPTPATH = $(PIOSSTM32F10X)
|
|
|
|
|
|
|
|
# Optimization level, can be [0, 1, 2, 3, s].
|
|
|
|
# 0 = turn off optimization. s = optimize for size.
|
|
|
|
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
|
|
|
|
|
|
|
ifeq ($(DEBUG),YES)
|
2011-01-24 08:51:48 +01:00
|
|
|
OPT = 1
|
2011-01-14 02:38:19 +01:00
|
|
|
else
|
|
|
|
OPT = s
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Output format. (can be ihex or binary or both)
|
|
|
|
# binary to create a load-image in raw-binary format i.e. for SAM-BA,
|
|
|
|
# ihex to create a load-image in Intel hex format
|
|
|
|
#LOADFORMAT = ihex
|
|
|
|
#LOADFORMAT = binary
|
|
|
|
LOADFORMAT = both
|
|
|
|
|
|
|
|
# Debugging format.
|
|
|
|
DEBUGF = dwarf-2
|
|
|
|
|
|
|
|
# Place project-specific -D (define) and/or
|
|
|
|
# -U options for C here.
|
|
|
|
CDEFS = -DSTM32F10X_$(MODEL)
|
|
|
|
CDEFS += -DUSE_STDPERIPH_DRIVER
|
|
|
|
CDEFS += -DUSE_$(BOARD)
|
|
|
|
ifeq ($(ENABLE_DEBUG_PINS), YES)
|
|
|
|
CDEFS += -DPIOS_ENABLE_DEBUG_PINS
|
|
|
|
endif
|
2012-10-11 06:06:28 +02:00
|
|
|
ifeq ($(ENABLE_DEBUG_CONSOLE), YES)
|
|
|
|
CDEFS += -DPIOS_INCLUDE_DEBUG_CONSOLE
|
2011-01-14 02:38:19 +01:00
|
|
|
endif
|
2011-05-01 21:10:27 +02:00
|
|
|
ifeq ($(ERASE_FLASH), YES)
|
|
|
|
CDEFS += -DERASE_FLASH
|
|
|
|
endif
|
2011-06-18 22:54:32 +02:00
|
|
|
|
|
|
|
ifneq ($(USE_GPS), NO)
|
2011-06-18 22:19:57 +02:00
|
|
|
CDEFS += -DUSE_GPS
|
2011-02-13 18:43:44 +01:00
|
|
|
endif
|
|
|
|
|
2011-03-21 10:18:21 +01:00
|
|
|
ifeq ($(USE_I2C), YES)
|
|
|
|
CDEFS += -DUSE_I2C
|
|
|
|
endif
|
|
|
|
|
2012-01-14 22:55:55 +01:00
|
|
|
# Declare all non-optional modules as built-in to force inclusion
|
|
|
|
CDEFS += ${foreach MOD, ${MODULES}, -DMODULE_$(MOD)_BUILTIN }
|
|
|
|
|
2011-01-14 02:38:19 +01:00
|
|
|
# Place project-specific -D and/or -U options for
|
|
|
|
# Assembler with preprocessor here.
|
|
|
|
#ADEFS = -DUSE_IRQ_ASM_WRAPPER
|
|
|
|
ADEFS = -D__ASSEMBLY__
|
|
|
|
|
|
|
|
# Compiler flag to set the C Standard level.
|
|
|
|
# c89 - "ANSI" C
|
|
|
|
# gnu89 - c89 plus GCC extensions
|
|
|
|
# c99 - ISO C99 standard (not yet fully implemented)
|
|
|
|
# gnu99 - c99 plus GCC extensions
|
|
|
|
CSTANDARD = -std=gnu99
|
|
|
|
|
|
|
|
#-----
|
|
|
|
|
|
|
|
# Compiler flags.
|
|
|
|
|
|
|
|
# -g*: generate debugging information
|
|
|
|
# -O*: optimization level
|
|
|
|
# -f...: tuning, see GCC manual and avr-libc documentation
|
|
|
|
# -Wall...: warning level
|
|
|
|
# -Wa,...: tell GCC to pass this to the assembler.
|
|
|
|
# -adhlns...: create assembler listing
|
|
|
|
#
|
|
|
|
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
|
|
|
|
|
|
|
|
ifeq ($(DEBUG),YES)
|
2012-01-16 00:06:35 +01:00
|
|
|
CFLAGS += -DDEBUG
|
2011-01-14 02:38:19 +01:00
|
|
|
endif
|
|
|
|
|
2012-09-27 18:51:12 +02:00
|
|
|
#The following Makefile command, ifneq (, $(filter) $(A), $(B) $(C)) is equivalent
|
|
|
|
# to the pseudocode `if(A== B || A==C)`
|
|
|
|
ifneq (,$(filter YES,$(STACK_DIAGNOSTICS) $(ALL_DIGNOSTICS)))
|
2012-08-22 08:25:54 +02:00
|
|
|
CFLAGS += -DSTACK_DIAGNOSTICS
|
|
|
|
endif
|
|
|
|
|
2012-09-27 18:51:12 +02:00
|
|
|
ifneq (,$(filter YES,$(MIXERSTATUS_DIAGNOSTICS) $(ALL_DIGNOSTICS)))
|
2012-08-22 08:25:54 +02:00
|
|
|
CFLAGS += -DMIXERSTATUS_DIAGNOSTICS
|
|
|
|
endif
|
|
|
|
|
2012-09-27 18:51:12 +02:00
|
|
|
ifneq (,$(filter YES,$(RATEDESIRED_DIAGNOSTICS) $(ALL_DIGNOSTICS)))
|
2012-08-22 08:25:54 +02:00
|
|
|
CFLAGS += -DRATEDESIRED_DIAGNOSTICS
|
|
|
|
endif
|
|
|
|
|
2012-09-27 18:51:12 +02:00
|
|
|
ifneq (,$(filter YES,$(I2C_WDG_STATS_DIAGNOSTICS) $(ALL_DIGNOSTICS)))
|
2012-08-22 08:25:54 +02:00
|
|
|
CFLAGS += -DI2C_WDG_STATS_DIAGNOSTICS
|
2011-06-17 16:50:10 +02:00
|
|
|
endif
|
|
|
|
|
2012-09-27 18:51:12 +02:00
|
|
|
ifneq (,$(filter YES,$(DIAG_TASKS) $(ALL_DIGNOSTICS)))
|
2012-01-16 00:06:35 +01:00
|
|
|
CFLAGS += -DDIAG_TASKS
|
2011-06-17 16:50:10 +02:00
|
|
|
endif
|
|
|
|
|
2011-05-15 02:41:08 +02:00
|
|
|
CFLAGS += -g$(DEBUGF)
|
2011-01-14 02:38:19 +01:00
|
|
|
CFLAGS += -O$(OPT)
|
2011-02-23 05:18:53 +01:00
|
|
|
CFLAGS += -mcpu=$(MCU)
|
2011-01-14 02:38:19 +01:00
|
|
|
CFLAGS += $(CDEFS)
|
|
|
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
|
|
|
|
|
2011-01-24 08:51:48 +01:00
|
|
|
#CFLAGS += -fno-cprop-registers -fno-defer-pop -fno-guess-branch-probability -fno-section-anchors
|
|
|
|
#CFLAGS += -fno-if-conversion -fno-if-conversion2 -fno-ipa-pure-const -fno-ipa-reference -fno-merge-constants
|
2011-06-23 07:46:41 +02:00
|
|
|
#CFLAGS += -fno-split-wide-types -fno-tree-ccp -fno-tree-ch -fno-tree-copy-prop -fno-tree-copyrename
|
2011-01-24 08:51:48 +01:00
|
|
|
#CFLAGS += -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-tree-fre -fno-tree-sink -fno-tree-sra
|
|
|
|
#CFLAGS += -fno-tree-ter
|
|
|
|
#CFLAGS += -g$(DEBUGF) -DDEBUG
|
|
|
|
|
2011-01-14 02:38:19 +01:00
|
|
|
CFLAGS += -mapcs-frame
|
|
|
|
CFLAGS += -fomit-frame-pointer
|
2011-09-11 19:49:09 +02:00
|
|
|
ifeq ($(CODE_SOURCERY), YES)
|
2011-01-14 02:38:19 +01:00
|
|
|
CFLAGS += -fpromote-loop-indices
|
2011-09-11 19:49:09 +02:00
|
|
|
endif
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
CFLAGS += -Wall
|
|
|
|
CFLAGS += -Werror
|
2012-08-12 02:13:09 +02:00
|
|
|
CFLAGS += -ffunction-sections -fdata-sections
|
2011-01-14 02:38:19 +01:00
|
|
|
CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
|
|
|
|
# Compiler flags to generate dependency files:
|
|
|
|
CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d
|
|
|
|
|
|
|
|
# flags only for C
|
|
|
|
#CONLYFLAGS += -Wnested-externs
|
|
|
|
CONLYFLAGS += $(CSTANDARD)
|
|
|
|
|
|
|
|
# Assembler flags.
|
|
|
|
# -Wa,...: tell GCC to pass this to the assembler.
|
|
|
|
# -ahlns: create listing
|
2011-02-23 05:18:53 +01:00
|
|
|
ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp
|
2011-01-14 02:38:19 +01:00
|
|
|
ASFLAGS += $(ADEFS)
|
|
|
|
ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
|
|
|
|
ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
|
|
|
|
|
|
|
MATH_LIB = -lm
|
|
|
|
|
|
|
|
# Linker flags.
|
|
|
|
# -Wl,...: tell GCC to pass this to linker.
|
|
|
|
# -Map: create map file
|
|
|
|
# --cref: add cross reference to map file
|
|
|
|
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
|
|
|
|
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
|
|
|
|
LDFLAGS += -lc
|
|
|
|
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
|
|
|
|
LDFLAGS += $(MATH_LIB)
|
|
|
|
LDFLAGS += -lc -lgcc
|
|
|
|
|
|
|
|
# Set linker-script name depending on selected submodel name
|
2011-04-25 00:37:45 +02:00
|
|
|
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
|
|
|
|
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
# Define programs and commands.
|
|
|
|
REMOVE = $(REMOVE_CMD) -f
|
|
|
|
PYTHON = python
|
|
|
|
|
|
|
|
# List of all source files.
|
|
|
|
ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC)
|
|
|
|
# List of all source files without directory and file-extension.
|
|
|
|
ALLSRCBASE = $(notdir $(basename $(ALLSRC)))
|
|
|
|
|
|
|
|
# Define all object files.
|
|
|
|
ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
|
|
|
|
|
|
|
|
# Define all listing files (used for make clean).
|
|
|
|
LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE)))
|
|
|
|
# Define all depedency-files (used for make clean).
|
|
|
|
DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE)))
|
|
|
|
|
|
|
|
# Default target.
|
2011-06-17 07:13:19 +02:00
|
|
|
all: build
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
ifeq ($(LOADFORMAT),ihex)
|
|
|
|
build: elf hex lss sym
|
|
|
|
else
|
|
|
|
ifeq ($(LOADFORMAT),binary)
|
|
|
|
build: elf bin lss sym
|
|
|
|
else
|
|
|
|
ifeq ($(LOADFORMAT),both)
|
|
|
|
build: elf hex bin lss sym
|
|
|
|
else
|
|
|
|
$(error "$(MSG_FORMATERROR) $(FORMAT)")
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Generate code for PyMite
|
2011-06-23 07:46:41 +02:00
|
|
|
#$(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h: $(wildcard $(PYMITELIB)/*.py) $(wildcard $(PYMITEPLAT)/*.py) $(wildcard $(FLIGHTPLANLIB)/*.py) $(wildcard $(FLIGHTPLANS)/*.py)
|
2011-02-23 05:18:53 +01:00
|
|
|
# @echo $(MSG_PYMITEINIT) $(call toprel, $@)
|
2011-01-14 02:38:19 +01:00
|
|
|
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py)
|
|
|
|
# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h
|
|
|
|
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py
|
|
|
|
|
|
|
|
# Link: create ELF output file from object files.
|
2011-02-23 05:18:53 +01:00
|
|
|
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ)))
|
|
|
|
|
2011-01-14 02:38:19 +01:00
|
|
|
# Assemble: create object files from assembler source files.
|
|
|
|
$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src))))
|
|
|
|
|
|
|
|
# Assemble: create object files from assembler source files. ARM-only
|
|
|
|
$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src))))
|
|
|
|
|
|
|
|
# Compile: create object files from C source files.
|
|
|
|
$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src))))
|
|
|
|
|
|
|
|
# Compile: create object files from C source files. ARM-only
|
|
|
|
$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src))))
|
|
|
|
|
|
|
|
# Compile: create object files from C++ source files.
|
|
|
|
$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src))))
|
|
|
|
|
|
|
|
# Compile: create object files from C++ source files. ARM-only
|
|
|
|
$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src))))
|
|
|
|
|
|
|
|
# Compile: create assembler files from C source files. ARM/Thumb
|
2011-02-23 05:18:53 +01:00
|
|
|
$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
# Compile: create assembler files from C source files. ARM only
|
2011-02-23 05:18:53 +01:00
|
|
|
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
|
|
|
|
|
2011-03-26 13:37:44 +01:00
|
|
|
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
|
|
|
|
|
2011-05-25 06:20:02 +02:00
|
|
|
$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
|
2011-05-21 19:55:15 +02:00
|
|
|
|
2011-05-24 07:10:31 +02:00
|
|
|
# Add jtag targets (program and wipe)
|
2012-02-25 18:35:29 +01:00
|
|
|
$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG)))
|
2011-05-24 07:10:31 +02:00
|
|
|
|
2011-05-25 06:20:02 +02:00
|
|
|
.PHONY: elf lss sym hex bin bino opfw
|
2011-02-23 05:18:53 +01:00
|
|
|
elf: $(OUTDIR)/$(TARGET).elf
|
|
|
|
lss: $(OUTDIR)/$(TARGET).lss
|
|
|
|
sym: $(OUTDIR)/$(TARGET).sym
|
|
|
|
hex: $(OUTDIR)/$(TARGET).hex
|
|
|
|
bin: $(OUTDIR)/$(TARGET).bin
|
2011-03-26 13:37:44 +01:00
|
|
|
bino: $(OUTDIR)/$(TARGET).bin.o
|
2011-05-25 06:20:02 +02:00
|
|
|
opfw: $(OUTDIR)/$(TARGET).opfw
|
2011-02-23 05:18:53 +01:00
|
|
|
|
|
|
|
# Display sizes of sections.
|
|
|
|
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
# Generate Doxygen documents
|
|
|
|
docs:
|
|
|
|
doxygen $(DOXYGENDIR)/doxygen.cfg
|
|
|
|
|
2011-05-13 10:20:53 +02:00
|
|
|
# Install: install binary file with prefix/suffix into install directory
|
2011-05-25 06:20:02 +02:00
|
|
|
install: $(OUTDIR)/$(TARGET).opfw
|
2011-05-13 10:20:53 +02:00
|
|
|
ifneq ($(INSTALL_DIR),)
|
|
|
|
@echo $(MSG_INSTALLING) $(call toprel, $<)
|
2011-05-14 22:17:08 +02:00
|
|
|
$(V1) mkdir -p $(INSTALL_DIR)
|
2011-05-25 06:20:02 +02:00
|
|
|
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw
|
2011-05-13 10:20:53 +02:00
|
|
|
else
|
|
|
|
$(error INSTALL_DIR must be specified for $@)
|
|
|
|
endif
|
|
|
|
|
2011-01-14 02:38:19 +01:00
|
|
|
# Target: clean project.
|
2011-02-23 05:18:53 +01:00
|
|
|
clean: clean_list
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
clean_list :
|
|
|
|
@echo $(MSG_CLEANING)
|
2011-02-23 05:18:53 +01:00
|
|
|
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map
|
|
|
|
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf
|
|
|
|
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex
|
|
|
|
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
|
|
|
|
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
|
|
|
|
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
|
2011-03-26 13:37:44 +01:00
|
|
|
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
|
2011-02-23 05:18:53 +01:00
|
|
|
$(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.c)
|
|
|
|
$(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.h)
|
|
|
|
$(V1) $(REMOVE) $(ALLOBJ)
|
|
|
|
$(V1) $(REMOVE) $(LSTFILES)
|
|
|
|
$(V1) $(REMOVE) $(DEPFILES)
|
|
|
|
$(V1) $(REMOVE) $(SRC:.c=.s)
|
|
|
|
$(V1) $(REMOVE) $(SRCARM:.c=.s)
|
|
|
|
$(V1) $(REMOVE) $(CPPSRC:.cpp=.s)
|
|
|
|
$(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s)
|
2011-01-14 02:38:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Create output files directory
|
|
|
|
# all known MS Windows OS define the ComSpec environment variable
|
|
|
|
ifdef ComSpec
|
2011-01-24 21:01:06 +01:00
|
|
|
$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL)
|
2011-01-14 02:38:19 +01:00
|
|
|
else
|
2011-01-24 21:01:06 +01:00
|
|
|
$(shell mkdir -p $(OUTDIR) 2>/dev/null)
|
2011-01-14 02:38:19 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Include the dependency files.
|
|
|
|
ifdef ComSpec
|
2011-01-24 21:01:06 +01:00
|
|
|
-include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*)
|
2011-01-14 02:38:19 +01:00
|
|
|
else
|
2011-01-24 21:01:06 +01:00
|
|
|
-include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
|
2011-01-14 02:38:19 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Listing of phony targets.
|
2011-06-17 07:13:19 +02:00
|
|
|
.PHONY : all build clean clean_list install
|