2010-11-23 19:19:56 +01:00
|
|
|
#####
|
|
|
|
# Project: OpenPilot AHRS
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Makefile for OpenPilot AHRS project
|
|
|
|
#
|
|
|
|
# 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
|
2010-11-23 19:19:56 +01:00
|
|
|
|
|
|
|
# Set developer code and compile options
|
|
|
|
# Set to YES for debugging
|
2011-04-11 20:47:36 +02:00
|
|
|
DEBUG ?= NO
|
2011-01-28 13:31:13 +01:00
|
|
|
USE_BOOTLOADER ?= NO
|
2010-11-23 19:19:56 +01:00
|
|
|
|
|
|
|
# Set to YES when using Code Sourcery toolchain
|
2011-04-11 20:47:36 +02:00
|
|
|
CODE_SOURCERY ?= YES
|
2010-11-23 19:19:56 +01:00
|
|
|
|
|
|
|
ifeq ($(CODE_SOURCERY), YES)
|
|
|
|
REMOVE_CMD = cs-rm
|
|
|
|
else
|
|
|
|
REMOVE_CMD = rm
|
|
|
|
endif
|
|
|
|
|
|
|
|
FLASH_TOOL = OPENOCD
|
|
|
|
|
|
|
|
# MCU name, submodel and board
|
|
|
|
# - MCU used for compiler-option (-mcpu)
|
|
|
|
# - MODEL used for linker-script name (-T) and passed as define
|
|
|
|
# - BOARD just passed as define (optional)
|
|
|
|
MCU = cortex-m3
|
|
|
|
CHIP = STM32F103CBT
|
|
|
|
BOARD = STM32103CB_AHRS
|
|
|
|
MODEL = MD
|
|
|
|
ifeq ($(USE_BOOTLOADER), YES)
|
|
|
|
BOOT_MODEL = $(MODEL)_BL
|
|
|
|
else
|
|
|
|
BOOT_MODEL = $(MODEL)_NB
|
|
|
|
endif
|
2011-02-23 05:18:53 +01:00
|
|
|
|
2010-11-23 19:19:56 +01:00
|
|
|
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
|
2011-02-23 05:18:53 +01:00
|
|
|
OUTDIR = $(TOP)/build/ahrs
|
2010-11-23 19:19:56 +01:00
|
|
|
|
|
|
|
# Target file name (without extension).
|
|
|
|
TARGET = AHRS
|
|
|
|
|
|
|
|
# Paths
|
|
|
|
AHRS = ./
|
|
|
|
AHRSINC = $(AHRS)/inc
|
|
|
|
PIOS = ../PiOS
|
|
|
|
PIOSINC = $(PIOS)/inc
|
|
|
|
FLIGHTLIB = ../Libraries
|
|
|
|
FLIGHTLIBINC = ../Libraries/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
|
|
|
|
CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3
|
|
|
|
OPDIR = ../OpenPilot
|
2011-01-14 02:38:34 +01:00
|
|
|
OPUAVOBJ = ../UAVObjects
|
2010-11-23 19:19:56 +01:00
|
|
|
OPUAVOBJINC = $(OPUAVOBJ)/inc
|
2010-10-16 19:54:00 +02:00
|
|
|
OPSYSINC = $(OPDIR)/System/inc
|
|
|
|
BOOT = ../Bootloaders/AHRS
|
2010-11-23 19:19:56 +01:00
|
|
|
BOOTINC = $(BOOT)/inc
|
|
|
|
|
2011-01-24 09:14:00 +01:00
|
|
|
OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight
|
2011-01-22 18:38:15 +01:00
|
|
|
|
2010-11-23 19:19:56 +01:00
|
|
|
# List C source files here. (C dependencies are automatically generated.)
|
|
|
|
# use file-extension c for "c-only"-files
|
|
|
|
|
|
|
|
## AHRS:
|
|
|
|
SRC = ahrs.c
|
|
|
|
SRC += pios_board.c
|
|
|
|
SRC += ahrs_timer.c
|
|
|
|
SRC += $(FLIGHTLIB)/ahrs_spi_comm.c
|
|
|
|
SRC += $(FLIGHTLIB)/ahrs_comm_objects.c
|
|
|
|
SRC += $(BOOT)/ahrs_spi_program_slave.c
|
|
|
|
SRC += $(BOOT)/ahrs_slave_test.c
|
|
|
|
SRC += $(BOOT)/ahrs_spi_program.c
|
2010-12-24 20:38:54 +01:00
|
|
|
SRC += insgps13state.c
|
2010-11-23 19:19:56 +01:00
|
|
|
SRC += $(FLIGHTLIB)/CoordinateConversions.c
|
2010-11-23 19:19:58 +01:00
|
|
|
SRC += $(FLIGHTLIB)/fifo_buffer.c
|
2010-11-23 19:19:56 +01:00
|
|
|
|
|
|
|
## PIOS Hardware (STM32F10x)
|
2011-01-16 03:45:22 +01:00
|
|
|
SRC += $(PIOSSTM32F10X)/pios_adc.c
|
2010-11-23 19:19:56 +01:00
|
|
|
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
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_i2c.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_spi.c
|
|
|
|
SRC += $(PIOSSTM32F10X)/pios_exti.c
|
|
|
|
|
|
|
|
## PIOS Hardware (Common)
|
|
|
|
SRC += $(PIOSCOMMON)/pios_com.c
|
|
|
|
SRC += $(PIOSCOMMON)/pios_hmc5843.c
|
|
|
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
2010-12-15 20:06:28 +01:00
|
|
|
SRC += $(PIOSCOMMON)/pios_iap.c
|
2011-04-23 19:40:41 +02:00
|
|
|
SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
2010-11-23 19:19:56 +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)/misc.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.
|
|
|
|
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL).S
|
|
|
|
|
|
|
|
# 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 += $(PIOS)
|
|
|
|
EXTRAINCDIRS += $(PIOSINC)
|
|
|
|
EXTRAINCDIRS += $(FLIGHTLIBINC)
|
|
|
|
EXTRAINCDIRS += $(PIOSSTM32F10X)
|
|
|
|
EXTRAINCDIRS += $(PIOSCOMMON)
|
|
|
|
EXTRAINCDIRS += $(PIOSBOARDS)
|
|
|
|
EXTRAINCDIRS += $(STMSPDINCDIR)
|
|
|
|
EXTRAINCDIRS += $(CMSISDIR)
|
|
|
|
EXTRAINCDIRS += $(AHRSINC)
|
2011-01-22 18:38:15 +01:00
|
|
|
EXTRAINCDIRS += $(OPUAVSYNTHDIR)
|
2010-11-23 19:19:56 +01:00
|
|
|
EXTRAINCDIRS += $(BOOTINC)
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
CFLAGS += -O0
|
|
|
|
CFLAGS += -DGENERAL_COV
|
|
|
|
else
|
|
|
|
CFLAGS += -Os
|
|
|
|
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)
|
|
|
|
CDEFS += -DIN_AHRS
|
|
|
|
ifeq ($(USE_BOOTLOADER), YES)
|
|
|
|
CDEFS += -DUSE_BOOTLOADER
|
|
|
|
endif
|
|
|
|
# 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
|
|
|
|
|
2011-02-23 05:18:53 +01:00
|
|
|
CFLAGS += -mcpu=$(MCU)
|
2010-11-23 19:19:56 +01:00
|
|
|
CFLAGS += $(CDEFS)
|
|
|
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
|
|
|
|
|
2011-04-11 20:47:36 +02:00
|
|
|
CFLAGS += -mapcs-frame
|
2010-11-23 19:19:56 +01:00
|
|
|
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
|
2011-02-23 05:18:53 +01:00
|
|
|
ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp
|
2010-11-23 19:19:56 +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-01-13 18:34:22 +01:00
|
|
|
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld
|
2010-11-23 19:19:56 +01:00
|
|
|
|
2011-04-24 17:19:00 +02:00
|
|
|
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
|
|
|
|
# Program
|
2010-11-23 19:19:56 +01:00
|
|
|
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
|
|
|
|
# Verify
|
|
|
|
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
|
|
|
|
# reset target
|
|
|
|
OOCD_CL+=-c "reset run"
|
2011-04-24 17:19:00 +02:00
|
|
|
# # terminate OOCD after programming
|
2010-11-23 19:19:56 +01:00
|
|
|
OOCD_CL+=-c shutdown
|
2011-04-24 17:19:00 +02:00
|
|
|
|
2010-11-23 19:19:56 +01:00
|
|
|
|
|
|
|
# Define programs and commands.
|
|
|
|
REMOVE = $(REMOVE_CMD) -f
|
|
|
|
###SHELL = sh
|
|
|
|
###COPY = cp
|
|
|
|
|
|
|
|
# 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-02-23 05:18:53 +01:00
|
|
|
all: gccversion build
|
2010-11-23 19:19:56 +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
|
|
|
|
|
|
|
|
# Program the device.
|
|
|
|
ifeq ($(USE_BOOTLOADER), YES)
|
|
|
|
# Program the device with OP Upload Tool".
|
|
|
|
program: $(OUTDIR)/$(TARGET).bin
|
|
|
|
@echo ${quote}Programming with OP Upload Tool${quote}
|
|
|
|
../../ground/src/experimental/upload-build-desktop/debug/OPUploadTool -d 1 -p $(OUTDIR)/$(TARGET).bin
|
|
|
|
else
|
|
|
|
ifeq ($(FLASH_TOOL),OPENOCD)
|
|
|
|
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
|
|
|
|
program: $(OUTDIR)/$(TARGET).elf
|
|
|
|
@echo ${quote}Programming with OPENOCD${quote}
|
|
|
|
$(OOCD_EXE) $(OOCD_CL)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Link: create ELF output file from object files.
|
2011-02-23 05:18:53 +01:00
|
|
|
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ)))
|
2010-11-23 19:19:56 +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))
|
2010-11-23 19:19:56 +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))
|
|
|
|
|
|
|
|
.PHONY: elf lss sym hex bin
|
|
|
|
elf: $(OUTDIR)/$(TARGET).elf
|
|
|
|
lss: $(OUTDIR)/$(TARGET).lss
|
|
|
|
sym: $(OUTDIR)/$(TARGET).sym
|
|
|
|
hex: $(OUTDIR)/$(TARGET).hex
|
|
|
|
bin: $(OUTDIR)/$(TARGET).bin
|
|
|
|
|
|
|
|
# Display sizes of sections.
|
|
|
|
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
|
|
|
|
.PHONY: size
|
|
|
|
size: $(OUTDIR)/$(TARGET).elf_size
|
2010-11-23 19:19:56 +01:00
|
|
|
|
|
|
|
# Generate Doxygen documents
|
|
|
|
docs:
|
|
|
|
doxygen $(DOXYGENDIR)/doxygen.cfg
|
|
|
|
|
|
|
|
# Target: clean project.
|
2011-02-23 05:18:53 +01:00
|
|
|
clean: clean_list
|
2010-11-23 19:19:56 +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
|
|
|
|
$(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)
|
2010-11-23 19:19:56 +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)
|
2010-11-23 19:19:56 +01:00
|
|
|
else
|
2011-01-24 21:01:06 +01:00
|
|
|
$(shell mkdir -p $(OUTDIR) 2>/dev/null)
|
2010-11-23 19:19:56 +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/*)
|
2010-11-23 19:19:56 +01:00
|
|
|
else
|
|
|
|
-include $(shell mkdir $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Listing of phony targets.
|
2011-02-23 05:18:53 +01:00
|
|
|
.PHONY : all build clean clean_list program
|