2012-03-20 18:08:39 +01:00
|
|
|
#####
|
|
|
|
#
|
2013-03-23 13:21:34 +01:00
|
|
|
# TODO: This file should be reworked. It will be done as a part of sim target refactoring.
|
2012-03-20 18:08:39 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#####
|
|
|
|
|
2013-03-23 13:21:34 +01:00
|
|
|
override ARM_SDK_PREFIX :=
|
2012-03-22 18:50:33 +01:00
|
|
|
override THUMB :=
|
2012-03-20 18:08:39 +01:00
|
|
|
|
2013-04-16 15:57:11 +02:00
|
|
|
include ../board-info.mk
|
2013-03-23 13:21:34 +01:00
|
|
|
include $(ROOT_DIR)/make/firmware-defs.mk
|
2012-03-20 18:08:39 +01:00
|
|
|
|
|
|
|
# Set developer code and compile options
|
|
|
|
# Set to YES for debugging
|
2012-06-19 04:27:12 +02:00
|
|
|
DEBUG ?= YES
|
2012-03-20 18:08:39 +01:00
|
|
|
|
|
|
|
# List of modules to include
|
2012-05-22 18:45:23 +02:00
|
|
|
MODULES = ManualControl Stabilization GPS
|
2012-05-24 23:28:13 +02:00
|
|
|
MODULES += PathPlanner
|
|
|
|
MODULES += FixedWingPathFollower
|
|
|
|
MODULES += VtolPathFollower
|
2012-03-20 18:08:39 +01:00
|
|
|
MODULES += CameraStab
|
|
|
|
MODULES += Telemetry
|
2013-11-17 02:54:26 +01:00
|
|
|
MODULES += Logging
|
2012-10-20 15:22:54 +02:00
|
|
|
MODULES += FirmwareIAP
|
2013-05-19 21:44:33 +02:00
|
|
|
MODULES += StateEstimation
|
2013-07-19 15:30:33 +02:00
|
|
|
#MODULES += Sensors/simulated/Sensors
|
|
|
|
MODULES += Airspeed
|
2012-03-22 18:50:33 +01:00
|
|
|
#MODULES += OveroSync
|
2012-03-20 18:08:39 +01:00
|
|
|
|
|
|
|
# Paths
|
2013-04-15 20:47:23 +02:00
|
|
|
OPSYSTEM = .
|
2013-04-16 23:44:06 +02:00
|
|
|
BOARDINC = ..
|
2012-03-20 18:08:39 +01:00
|
|
|
OPSYSTEMINC = $(OPSYSTEM)/inc
|
2013-04-16 23:44:06 +02:00
|
|
|
OPUAVTALK = ../../../../uavtalk
|
2012-03-20 18:08:39 +01:00
|
|
|
OPUAVTALKINC = $(OPUAVTALK)/inc
|
2013-04-16 23:44:06 +02:00
|
|
|
OPUAVOBJ = ../../../../uavobjects
|
2012-03-20 18:08:39 +01:00
|
|
|
OPUAVOBJINC = $(OPUAVOBJ)/inc
|
|
|
|
PIOSINC = $(PIOS)/inc
|
2013-04-24 23:24:38 +02:00
|
|
|
OPMODULEDIR = ../../../../modules
|
|
|
|
FLIGHTLIB = ../../../../libraries
|
2012-11-27 07:23:44 +01:00
|
|
|
FLIGHTLIBINC = $(FLIGHTLIB)/inc
|
|
|
|
MATHLIB = $(FLIGHTLIB)/math
|
|
|
|
MATHLIBINC = $(FLIGHTLIB)/math
|
2012-03-20 18:08:39 +01:00
|
|
|
PIOSPOSIX = $(PIOS)/posix
|
|
|
|
PIOSCOMMON = $(PIOS)/posix
|
2013-05-02 23:31:14 +02:00
|
|
|
PIOSCORECOMMON = $(PIOS)/common
|
2013-04-24 23:38:56 +02:00
|
|
|
PIOSCOMMONLIB = $(PIOS)/common/libraries
|
2012-03-20 18:08:39 +01:00
|
|
|
BOOT =
|
|
|
|
BOOTINC =
|
|
|
|
UAVOBJSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight
|
|
|
|
|
|
|
|
# optional component libraries
|
2013-04-24 23:38:56 +02:00
|
|
|
include $(PIOS)/common/libraries/FreeRTOS/library.mk
|
2013-03-25 01:59:40 +01:00
|
|
|
include $(FLIGHTLIB)/PyMite/pymite.mk
|
2012-03-20 18:08:39 +01:00
|
|
|
|
|
|
|
# List C source files here. (C dependencies are automatically generated.)
|
|
|
|
# use file-extension c for "c-only"-files
|
|
|
|
|
|
|
|
## MODULES
|
|
|
|
SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}}
|
2012-03-22 18:50:33 +01:00
|
|
|
SRC += ${OUTDIR}/InitMods.c
|
2012-03-20 18:08:39 +01:00
|
|
|
## OPENPILOT CORE:
|
|
|
|
SRC += ${OPMODULEDIR}/System/systemmod.c
|
|
|
|
SRC += $(OPSYSTEM)/simposix.c
|
|
|
|
SRC += $(OPSYSTEM)/pios_board.c
|
2013-03-30 19:57:16 +01:00
|
|
|
SRC += $(FLIGHTLIB)/alarms.c
|
2012-03-20 18:08:39 +01:00
|
|
|
SRC += $(OPUAVTALK)/uavtalk.c
|
|
|
|
SRC += $(OPUAVOBJ)/uavobjectmanager.c
|
|
|
|
SRC += $(OPUAVOBJ)/eventdispatcher.c
|
2013-04-13 21:50:47 +02:00
|
|
|
SRC += $(OPUAVOBJ)/callbackscheduler.c
|
2012-05-22 22:06:26 +02:00
|
|
|
SRC += $(UAVOBJSYNTHDIR)/uavobjectsinit.c
|
2012-03-20 18:08:39 +01:00
|
|
|
|
|
|
|
SRC += $(FLIGHTLIB)/CoordinateConversions.c
|
|
|
|
SRC += $(FLIGHTLIB)/fifo_buffer.c
|
|
|
|
SRC += $(FLIGHTLIB)/WorldMagModel.c
|
|
|
|
SRC += $(FLIGHTLIB)/insgps13state.c
|
2012-05-24 23:28:13 +02:00
|
|
|
SRC += $(FLIGHTLIB)/paths.c
|
2012-11-11 18:22:01 +01:00
|
|
|
SRC += $(FLIGHTLIB)/sanitycheck.c
|
2012-03-20 18:08:39 +01:00
|
|
|
|
2012-09-16 15:56:35 +02:00
|
|
|
SRC += $(MATHLIB)/sin_lookup.c
|
|
|
|
SRC += $(MATHLIB)/pid.c
|
2012-03-20 18:08:39 +01:00
|
|
|
|
2013-05-02 23:31:14 +02:00
|
|
|
SRC += $(PIOSCORECOMMON)/pios_task_monitor.c
|
2013-11-24 15:40:32 +01:00
|
|
|
SRC += $(PIOSCORECOMMON)/pios_dosfs_logfs.c
|
|
|
|
SRC += $(PIOSCORECOMMON)/pios_debuglog.c
|
2013-05-02 23:31:14 +02:00
|
|
|
|
2013-03-23 13:21:34 +01:00
|
|
|
## PIOS Hardware
|
2012-03-20 18:08:39 +01:00
|
|
|
include $(PIOS)/posix/library.mk
|
|
|
|
|
|
|
|
include ./UAVObjects.inc
|
|
|
|
SRC += $(UAVOBJSRC)
|
|
|
|
|
|
|
|
# List any extra directories to look for include files here.
|
|
|
|
# Each directory must be seperated by a space.
|
|
|
|
EXTRAINCDIRS += $(PIOS)
|
|
|
|
EXTRAINCDIRS += $(PIOSINC)
|
2013-04-16 23:44:06 +02:00
|
|
|
EXTRAINCDIRS += $(BOARDINC)
|
2012-03-20 18:08:39 +01:00
|
|
|
EXTRAINCDIRS += $(OPSYSTEMINC)
|
|
|
|
EXTRAINCDIRS += $(OPUAVTALK)
|
|
|
|
EXTRAINCDIRS += $(OPUAVTALKINC)
|
|
|
|
EXTRAINCDIRS += $(OPUAVOBJ)
|
|
|
|
EXTRAINCDIRS += $(OPUAVOBJINC)
|
|
|
|
EXTRAINCDIRS += $(UAVOBJSYNTHDIR)
|
|
|
|
EXTRAINCDIRS += $(FLIGHTLIBINC)
|
2012-09-16 15:56:35 +02:00
|
|
|
EXTRAINCDIRS += $(MATHLIBINC)
|
2012-03-20 18:08:39 +01:00
|
|
|
EXTRAINCDIRS += $(PIOSCOMMON)
|
|
|
|
EXTRAINCDIRS += $(CMSISDIR)
|
|
|
|
EXTRAINCDIRS += $(OPUAVSYNTHDIR)
|
|
|
|
EXTRAINCDIRS += $(BOOTINC)
|
|
|
|
|
2013-03-25 01:59:40 +01:00
|
|
|
EXTRAINCDIRS += ${foreach MOD, ${MODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc
|
2012-10-20 15:22:54 +02:00
|
|
|
|
|
|
|
BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE)
|
|
|
|
BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION)
|
|
|
|
BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE)
|
|
|
|
BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION)
|
|
|
|
BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE)
|
|
|
|
BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE)
|
|
|
|
BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE)
|
|
|
|
|
|
|
|
# Since we are simulating all this firmware the code needs to know what the BL would
|
|
|
|
# normally contain
|
|
|
|
CFLAGS += $(BLONLY_CDEFS)
|
|
|
|
|
2012-03-20 18:08:39 +01:00
|
|
|
ifeq ($(DEBUG),YES)
|
|
|
|
CFLAGS += -O0
|
|
|
|
CFLAGS += -DGENERAL_COV
|
|
|
|
CFLAGS += -finstrument-functions -ffixed-r10
|
|
|
|
else
|
|
|
|
CFLAGS += -Os
|
|
|
|
endif
|
|
|
|
|
|
|
|
# common architecture-specific flags from the device-specific library makefile
|
|
|
|
CFLAGS += $(ARCHFLAGS)
|
|
|
|
|
2012-05-22 22:06:26 +02:00
|
|
|
CFLAGS += $(UAVOBJDEFINE)
|
2012-08-22 08:25:54 +02:00
|
|
|
|
2013-03-23 13:21:34 +01:00
|
|
|
CFLAGS += -DDIAG_STACK
|
|
|
|
CFLAGS += -DDIA_MIXERSTATUS
|
|
|
|
CFLAGS += -DDIAG_RATEDESIRED
|
|
|
|
CFLAGS += -DDIAG_I2C_WDG_STATS
|
2012-03-20 18:08:39 +01:00
|
|
|
CFLAGS += -DDIAG_TASKS
|
2013-03-23 13:21:34 +01:00
|
|
|
# Or all of above:
|
|
|
|
#CFLAGS += -DDIAG_ALL
|
2012-03-20 18:08:39 +01:00
|
|
|
|
|
|
|
# This is not the best place for these. Really should abstract out
|
|
|
|
# to the board file or something
|
|
|
|
#CFLAGS += -DSTM32F4XX
|
|
|
|
CFLAGS += -DMEM_SIZE=1024000000
|
|
|
|
|
|
|
|
# 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 += -DHSE_VALUE=$(OSCILLATOR_FREQ)
|
|
|
|
CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ)
|
|
|
|
CDEFS += -DUSE_STDPERIPH_DRIVER
|
|
|
|
CDEFS += -DUSE_$(BOARD)
|
|
|
|
|
|
|
|
# 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++)
|
|
|
|
|
|
|
|
CFLAGS += -g$(DEBUGF)
|
|
|
|
|
|
|
|
CFLAGS += -ffast-math
|
|
|
|
|
|
|
|
#CFLAGS += -mcpu=$(MCU)
|
|
|
|
CFLAGS += $(CDEFS)
|
|
|
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
|
|
|
|
|
|
|
|
#CFLAGS += -mapcs-frame
|
|
|
|
CFLAGS += -fomit-frame-pointer
|
|
|
|
ifeq ($(CODE_SOURCERY), YES)
|
|
|
|
CFLAGS += -fpromote-loop-indices
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS += -Wall
|
|
|
|
#CFLAGS += -Werror
|
|
|
|
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
|
|
|
|
ASFLAGS = $(ARCHFLAGS) -I. -x assembler-with-cpp
|
|
|
|
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
|
2012-03-22 18:50:33 +01:00
|
|
|
#LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
|
|
|
|
LDFLAGS = -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
|
2012-03-20 18:08:39 +01:00
|
|
|
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
|
|
|
|
LDFLAGS += -lc
|
|
|
|
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
|
|
|
|
LDFLAGS += $(MATH_LIB)
|
2012-03-22 18:50:33 +01:00
|
|
|
LDFLAGS += -lc -lgcc -lpthread -lrt
|
2012-03-20 18:08:39 +01:00
|
|
|
|
2013-04-15 16:02:01 +02:00
|
|
|
#Linker scripts
|
2012-03-20 18:08:39 +01:00
|
|
|
LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP))
|
|
|
|
|
|
|
|
|
|
|
|
# Define programs and commands.
|
2013-03-23 13:21:34 +01:00
|
|
|
REMOVE = $(RM) -f
|
2012-03-20 18:08:39 +01:00
|
|
|
|
|
|
|
# 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.
|
2013-04-30 02:02:36 +02:00
|
|
|
ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE) uavobjectsinit.o.firmware_info ))
|
2012-03-20 18:08:39 +01:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
all: gccversion build
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
# Link: create ELF output file from object files.
|
2013-03-23 13:21:34 +01:00
|
|
|
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ)))
|
2012-03-20 18:08:39 +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
|
|
|
|
$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
|
|
|
|
|
|
|
|
# Compile: create assembler files from C source files. ARM only
|
|
|
|
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
|
|
|
|
|
|
|
|
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
|
|
|
|
|
|
|
|
$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
|
|
|
|
|
2012-10-20 16:07:16 +02:00
|
|
|
$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/uavobjectsinit.o,$(BOARD_TYPE),$(BOARD_REVISION)))
|
|
|
|
|
2012-03-20 18:08:39 +01:00
|
|
|
# Add jtag targets (program and wipe)
|
|
|
|
$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG)))
|
|
|
|
|
|
|
|
.PHONY: elf lss sym hex bin bino opfw
|
|
|
|
elf: $(OUTDIR)/$(TARGET).elf
|
|
|
|
lss: $(OUTDIR)/$(TARGET).lss
|
|
|
|
sym: $(OUTDIR)/$(TARGET).sym
|
|
|
|
hex: $(OUTDIR)/$(TARGET).hex
|
|
|
|
bin: $(OUTDIR)/$(TARGET).bin
|
|
|
|
bino: $(OUTDIR)/$(TARGET).bin.o
|
|
|
|
opfw: $(OUTDIR)/$(TARGET).opfw
|
|
|
|
|
|
|
|
# Display sizes of sections.
|
|
|
|
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
|
|
|
|
|
|
|
|
# Install: install binary file with prefix/suffix into install directory
|
|
|
|
install: $(OUTDIR)/$(TARGET).opfw
|
|
|
|
ifneq ($(INSTALL_DIR),)
|
|
|
|
@echo $(MSG_INSTALLING) $(call toprel, $<)
|
|
|
|
$(V1) mkdir -p $(INSTALL_DIR)
|
|
|
|
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw
|
|
|
|
else
|
|
|
|
$(error INSTALL_DIR must be specified for $@)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Target: clean project.
|
|
|
|
clean: clean_list
|
|
|
|
|
|
|
|
clean_list :
|
|
|
|
@echo $(MSG_CLEANING)
|
|
|
|
$(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
|
|
|
|
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
|
|
|
|
$(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)
|
|
|
|
|
|
|
|
# Create output files directory
|
|
|
|
# all known MS Windows OS define the ComSpec environment variable
|
|
|
|
ifdef ComSpec
|
|
|
|
$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL)
|
|
|
|
else
|
|
|
|
$(shell mkdir -p $(OUTDIR) 2>/dev/null)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Include the dependency files.
|
|
|
|
ifdef ComSpec
|
|
|
|
-include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*)
|
|
|
|
else
|
|
|
|
-include $(shell mkdir $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
|
|
|
|
endif
|
|
|
|
|
2012-03-22 18:50:33 +01:00
|
|
|
#create compile-time module auto-initialisation
|
2012-03-23 08:27:26 +01:00
|
|
|
MODNAMES = ${notdir $(subst /revolution,,$(MODULES))}
|
|
|
|
|
2012-03-22 18:50:33 +01:00
|
|
|
# Generate intermediate code
|
|
|
|
gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h
|
|
|
|
|
|
|
|
# Generate code for module initialization
|
|
|
|
${OUTDIR}/InitMods.c: Makefile
|
2013-03-23 13:21:34 +01:00
|
|
|
$(V1) $(ECHO) $(MSG_MODINIT $(call toprel, $@))
|
|
|
|
$(V1) $(ECHO) $(QUOTE)// Autogenerated file$(QUOTE) > ${OUTDIR}/InitMods.c
|
|
|
|
$(V1) $(ECHO) $(QUOTE)${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Initialize(void);}$(QUOTE) >> ${OUTDIR}/InitMods.c
|
|
|
|
$(V1) $(ECHO) $(QUOTE)${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Start(void);}$(QUOTE) >> ${OUTDIR}/InitMods.c
|
|
|
|
$(V1) $(ECHO) $(QUOTE)void InitModules() {$(QUOTE) >> ${OUTDIR}/InitMods.c
|
|
|
|
$(V1) $(ECHO) $(QUOTE)${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}$(QUOTE) >> ${OUTDIR}/InitMods.c
|
|
|
|
$(V1) $(ECHO) $(QUOTE)}$(QUOTE) >> ${OUTDIR}/InitMods.c
|
|
|
|
$(V1) $(ECHO) $(QUOTE)void StartModules() {$(QUOTE) >> ${OUTDIR}/InitMods.c
|
|
|
|
$(V1) $(ECHO) $(QUOTE)${foreach MOD, ${MODNAMES}, ${MOD}Start();}$(QUOTE) >> ${OUTDIR}/InitMods.c
|
|
|
|
$(V1) $(ECHO) $(QUOTE)}$(QUOTE) >> ${OUTDIR}/InitMods.c
|
2012-03-22 18:50:33 +01:00
|
|
|
|
2012-03-20 18:08:39 +01:00
|
|
|
# Listing of phony targets.
|
|
|
|
.PHONY : all build clean clean_list install
|