mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Makefile: use exported variables in firmware-defs.mk
Note that $(QUOTE) variable is uppercased. Windows make does not export lowercased variables with export keyword (even if must do). Conflicts: make/firmware-defs.mk
This commit is contained in:
parent
60a7d7e454
commit
8a98920f3d
@ -438,14 +438,6 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Test if quotes are needed for the echo-command
|
|
||||||
result = ${shell echo "test"}
|
|
||||||
ifeq (${result}, test)
|
|
||||||
quote = '
|
|
||||||
else
|
|
||||||
quote =
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Generate intermediate code
|
# 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
|
gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h
|
||||||
|
|
||||||
|
@ -450,14 +450,6 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Test if quotes are needed for the echo-command
|
|
||||||
result = ${shell echo "test"}
|
|
||||||
ifeq (${result}, test)
|
|
||||||
quote = '
|
|
||||||
else
|
|
||||||
quote =
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Generate intermediate code
|
# 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
|
gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h
|
||||||
|
|
||||||
|
@ -483,14 +483,6 @@ endif
|
|||||||
#create compile-time module auto-initialisation
|
#create compile-time module auto-initialisation
|
||||||
MODNAMES = ${notdir $(subst /revolution,,$(MODULES))}
|
MODNAMES = ${notdir $(subst /revolution,,$(MODULES))}
|
||||||
|
|
||||||
# Test if quotes are needed for the echo-command
|
|
||||||
result = ${shell echo "test"}
|
|
||||||
ifeq (${result}, test)
|
|
||||||
quote = '
|
|
||||||
else
|
|
||||||
quote =
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Generate intermediate code
|
# 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
|
gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h
|
||||||
|
|
||||||
|
@ -1,66 +1,77 @@
|
|||||||
# Toolchain prefix (i.e arm-elf- -> arm-elf-gcc.exe)
|
#
|
||||||
TCHAIN_PREFIX ?= arm-none-eabi-
|
# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
|
||||||
|
ifndef OPENPILOT_IS_COOL
|
||||||
|
$(error Top level Makefile must be used to build this target)
|
||||||
|
endif
|
||||||
|
|
||||||
# Define toolchain component names.
|
# Define toolchain component names.
|
||||||
CC = $(TCHAIN_PREFIX)gcc
|
CC = $(ARM_SDK_PREFIX)gcc
|
||||||
CXX = $(TCHAIN_PREFIX)g++
|
CXX = $(ARM_SDK_PREFIX)g++
|
||||||
AR = $(TCHAIN_PREFIX)ar
|
AR = $(ARM_SDK_PREFIX)ar
|
||||||
OBJCOPY = $(TCHAIN_PREFIX)objcopy
|
OBJCOPY = $(ARM_SDK_PREFIX)objcopy
|
||||||
OBJDUMP = $(TCHAIN_PREFIX)objdump
|
OBJDUMP = $(ARM_SDK_PREFIX)objdump
|
||||||
SIZE = $(TCHAIN_PREFIX)size
|
SIZE = $(ARM_SDK_PREFIX)size
|
||||||
NM = $(TCHAIN_PREFIX)nm
|
NM = $(ARM_SDK_PREFIX)nm
|
||||||
STRIP = $(TCHAIN_PREFIX)strip
|
STRIP = $(ARM_SDK_PREFIX)strip
|
||||||
INSTALL = install
|
|
||||||
|
|
||||||
THUMB = -mthumb
|
THUMB = -mthumb
|
||||||
|
|
||||||
# Test if quotes are needed for the echo-command
|
|
||||||
result = ${shell echo "test"}
|
|
||||||
ifeq (${result}, test)
|
|
||||||
quote = '
|
|
||||||
# This line is just to clear out the single quote above '
|
|
||||||
else
|
|
||||||
quote =
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Add a board designator to the terse message text
|
# Add a board designator to the terse message text
|
||||||
ifeq ($(ENABLE_MSG_EXTRA),yes)
|
ifeq ($(ENABLE_MSG_EXTRA),yes)
|
||||||
MSG_EXTRA := [$(BUILD_TYPE)|$(BOARD_SHORT_NAME)]
|
MSG_EXTRA := [$(BUILD_TYPE)|$(BOARD_SHORT_NAME)]
|
||||||
else
|
else
|
||||||
MSG_BOARD :=
|
MSG_EXTRA :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define Messages
|
# Define Messages
|
||||||
# English
|
# English
|
||||||
MSG_FORMATERROR = ${quote} Can not handle output-format${quote}
|
MSG_FORMATERROR = ${QUOTE} Can not handle output-format${QUOTE}
|
||||||
MSG_MODINIT = ${quote} MODINIT $(MSG_EXTRA) ${quote}
|
MSG_MODINIT = ${QUOTE} MODINIT $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_SIZE = ${quote} SIZE $(MSG_EXTRA) ${quote}
|
MSG_SIZE = ${QUOTE} SIZE $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_LOAD_FILE = ${quote} BIN/HEX $(MSG_EXTRA) ${quote}
|
MSG_LOAD_FILE = ${QUOTE} BIN/HEX $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_BIN_OBJ = ${quote} BINO $(MSG_EXTRA) ${quote}
|
MSG_BIN_OBJ = ${QUOTE} BINO $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_STRIP_FILE = ${quote} STRIP $(MSG_EXTRA) ${quote}
|
MSG_STRIP_FILE = ${QUOTE} STRIP $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_EXTENDED_LISTING = ${quote} LIS $(MSG_EXTRA) ${quote}
|
MSG_EXTENDED_LISTING = ${QUOTE} LIS $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_SYMBOL_TABLE = ${quote} NM $(MSG_EXTRA) ${quote}
|
MSG_SYMBOL_TABLE = ${QUOTE} NM $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_ARCHIVING = ${quote} AR $(MSG_EXTRA) ${quote}
|
MSG_ARCHIVING = ${QUOTE} AR $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_LINKING = ${quote} LD $(MSG_EXTRA) ${quote}
|
MSG_LINKING = ${QUOTE} LD $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_COMPILING = ${quote} CC ${MSG_EXTRA} ${quote}
|
MSG_COMPILING = ${QUOTE} CC $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_COMPILING_ARM = ${quote} CC-ARM $(MSG_EXTRA) ${quote}
|
MSG_COMPILING_ARM = ${QUOTE} CC-ARM $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_COMPILINGCXX = ${quote} CXX $(MSG_EXTRA) ${quote}
|
MSG_COMPILINGCXX = ${QUOTE} CXX $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_COMPILINGCXX_ARM = ${quote} CXX-ARM $(MSG_EXTRA) ${quote}
|
MSG_COMPILINGCXX_ARM = ${QUOTE} CXX-ARM $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_ASSEMBLING = ${quote} AS $(MSG_EXTRA) ${quote}
|
MSG_ASSEMBLING = ${QUOTE} AS $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_ASSEMBLING_ARM = ${quote} AS-ARM $(MSG_EXTRA) ${quote}
|
MSG_ASSEMBLING_ARM = ${QUOTE} AS-ARM $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_CLEANING = ${quote} CLEAN $(MSG_EXTRA) ${quote}
|
MSG_CLEANING = ${QUOTE} CLEAN $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_ASMFROMC = ${quote} AS(C) $(MSG_EXTRA) ${quote}
|
MSG_ASMFROMC = ${QUOTE} AS(C) $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_ASMFROMC_ARM = ${quote} AS(C)-ARM $(MSG_EXTRA) ${quote}
|
MSG_ASMFROMC_ARM = ${QUOTE} AS(C)-ARM $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_PYMITEINIT = ${quote} PY $(MSG_EXTRA) ${quote}
|
MSG_PYMITEINIT = ${QUOTE} PY $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_INSTALLING = ${quote} INSTALL $(MSG_EXTRA) ${quote}
|
MSG_INSTALLING = ${QUOTE} INSTALL $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_OPFIRMWARE = ${quote} OPFW $(MSG_EXTRA) ${quote}
|
MSG_OPFIRMWARE = ${QUOTE} OPFW $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_FWINFO = ${quote} FWINFO $(MSG_EXTRA) ${quote}
|
MSG_FWINFO = ${QUOTE} FWINFO $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_JTAG_PROGRAM = ${quote} JTAG-PGM $(MSG_EXTRA) ${quote}
|
MSG_JTAG_PROGRAM = ${QUOTE} JTAG-PGM $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_JTAG_WIPE = ${quote} JTAG-WIPE $(MSG_EXTRA) ${quote}
|
MSG_JTAG_WIPE = ${QUOTE} JTAG-WIPE $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_PADDING = ${quote} PADDING $(MSG_EXTRA) ${quote}
|
MSG_PADDING = ${QUOTE} PADDING $(MSG_EXTRA) ${QUOTE}
|
||||||
MSG_FLASH_IMG = ${quote} FLASH_IMG $(MSG_EXTRA) ${quote}
|
MSG_FLASH_IMG = ${QUOTE} FLASH_IMG $(MSG_EXTRA) ${QUOTE}
|
||||||
|
|
||||||
toprel = $(subst $(realpath $(TOP))/,,$(abspath $(1)))
|
# Function for converting an absolute path to one relative
|
||||||
|
# to the top of the source tree.
|
||||||
|
toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
|
||||||
|
|
||||||
# Display compiler version information.
|
# Display compiler version information.
|
||||||
.PHONY: gccversion
|
.PHONY: gccversion
|
||||||
@ -69,25 +80,25 @@ gccversion:
|
|||||||
|
|
||||||
# Create final output file (.hex) from ELF output file.
|
# Create final output file (.hex) from ELF output file.
|
||||||
%.hex: %.elf
|
%.hex: %.elf
|
||||||
@echo $(MSG_LOAD_FILE) $(call toprel, $@)
|
@$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||||
$(V1) $(OBJCOPY) -O ihex $< $@
|
$(V1) $(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
# Create stripped output file (.elf.stripped) from ELF output file.
|
# Create stripped output file (.elf.stripped) from ELF output file.
|
||||||
%.elf.stripped: %.elf
|
%.elf.stripped: %.elf
|
||||||
@echo $(MSG_STRIP_FILE) $(call toprel, $@)
|
@$(ECHO) $(MSG_STRIP_FILE) $(call toprel, $@)
|
||||||
$(V1) $(STRIP) --strip-unneeded $< -o $@
|
$(V1) $(STRIP) --strip-unneeded $< -o $@
|
||||||
|
|
||||||
# Create final output file (.bin) from ELF output file.
|
# Create final output file (.bin) from ELF output file.
|
||||||
%.bin: %.elf
|
%.bin: %.elf
|
||||||
@echo $(MSG_LOAD_FILE) $(call toprel, $@)
|
@$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||||
$(V1) $(OBJCOPY) -O binary $< $@
|
$(V1) $(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
%.bin: %.o
|
%.bin: %.o
|
||||||
@echo $(MSG_LOAD_FILE) $(call toprel, $@)
|
@$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@)
|
||||||
$(V1) $(OBJCOPY) -O binary $< $@
|
$(V1) $(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
%.bin.o: %.bin
|
%.bin.o: %.bin
|
||||||
@echo $(MSG_BIN_OBJ) $(call toprel, $@)
|
@$(ECHO) $(MSG_BIN_OBJ) $(call toprel, $@)
|
||||||
$(V1) $(OBJCOPY) -I binary -O elf32-littlearm --binary-architecture arm \
|
$(V1) $(OBJCOPY) -I binary -O elf32-littlearm --binary-architecture arm \
|
||||||
--rename-section .data=.rodata,alloc,load,readonly,data,contents \
|
--rename-section .data=.rodata,alloc,load,readonly,data,contents \
|
||||||
--wildcard \
|
--wildcard \
|
||||||
@ -99,12 +110,12 @@ gccversion:
|
|||||||
# Create extended listing file/disassambly from ELF output file.
|
# Create extended listing file/disassambly from ELF output file.
|
||||||
# using objdump testing: option -C
|
# using objdump testing: option -C
|
||||||
%.lss: %.elf
|
%.lss: %.elf
|
||||||
@echo $(MSG_EXTENDED_LISTING) $(call toprel, $@)
|
@$(ECHO) $(MSG_EXTENDED_LISTING) $(call toprel, $@)
|
||||||
$(V1) $(OBJDUMP) -h -S -C -r $< > $@
|
$(V1) $(OBJDUMP) -h -S -C -r $< > $@
|
||||||
|
|
||||||
# Create a symbol table from ELF output file.
|
# Create a symbol table from ELF output file.
|
||||||
%.sym: %.elf
|
%.sym: %.elf
|
||||||
@echo $(MSG_SYMBOL_TABLE) $(call toprel, $@)
|
@$(ECHO) $(MSG_SYMBOL_TABLE) $(call toprel, $@)
|
||||||
$(V1) $(NM) -n $< > $@
|
$(V1) $(NM) -n $< > $@
|
||||||
|
|
||||||
define SIZE_TEMPLATE
|
define SIZE_TEMPLATE
|
||||||
@ -113,7 +124,7 @@ size: $(1)_size
|
|||||||
|
|
||||||
.PHONY: $(1)_size
|
.PHONY: $(1)_size
|
||||||
$(1)_size: $(1)
|
$(1)_size: $(1)
|
||||||
@echo $(MSG_SIZE) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_SIZE) $$(call toprel, $$<)
|
||||||
$(V1) $(SIZE) -A $$<
|
$(V1) $(SIZE) -A $$<
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -124,63 +135,62 @@ endef
|
|||||||
define OPFW_TEMPLATE
|
define OPFW_TEMPLATE
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
$(1).firmwareinfo.c: $(1) $(TOP)/make/templates/firmwareinfotemplate.c FORCE
|
$(1).firmwareinfo.c: $(1) $(ROOT_DIR)/make/templates/firmwareinfotemplate.c FORCE
|
||||||
@echo $(MSG_FWINFO) $$(call toprel, $$@)
|
@$(ECHO) $(MSG_FWINFO) $$(call toprel, $$@)
|
||||||
$(V1) python $(TOP)/make/scripts/version-info.py \
|
$(V1) $(VERSION_INFO) \
|
||||||
--path=$(TOP) \
|
--template=$(ROOT_DIR)/make/templates/firmwareinfotemplate.c \
|
||||||
--template=$(TOP)/make/templates/firmwareinfotemplate.c \
|
|
||||||
--outfile=$$@ \
|
--outfile=$$@ \
|
||||||
--image=$(1) \
|
--image=$(1) \
|
||||||
--type=$(2) \
|
--type=$(2) \
|
||||||
--revision=$(3) \
|
--revision=$(3) \
|
||||||
--uavodir=$(TOP)/shared/uavobjectdefinition
|
--uavodir=$(ROOT_DIR)/shared/uavobjectdefinition
|
||||||
|
|
||||||
$(eval $(call COMPILE_C_TEMPLATE, $(1).firmwareinfo.c))
|
$(eval $(call COMPILE_C_TEMPLATE, $(1).firmwareinfo.c))
|
||||||
|
|
||||||
$(OUTDIR)/$(notdir $(basename $(1))).opfw : $(1) $(1).firmwareinfo.bin
|
$(OUTDIR)/$(notdir $(basename $(1))).opfw : $(1) $(1).firmwareinfo.bin
|
||||||
@echo $(MSG_OPFIRMWARE) $$(call toprel, $$@)
|
@$(ECHO) $(MSG_OPFIRMWARE) $$(call toprel, $$@)
|
||||||
$(V1) cat $(1) $(1).firmwareinfo.bin > $$@
|
$(V1) $(CAT) $(1) $(1).firmwareinfo.bin > $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Assemble: create object files from assembler source files.
|
# Assemble: create object files from assembler source files.
|
||||||
define ASSEMBLE_TEMPLATE
|
define ASSEMBLE_TEMPLATE
|
||||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||||
@echo $(MSG_ASSEMBLING) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_ASSEMBLING) $$(call toprel, $$<)
|
||||||
$(V1) $(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$@
|
$(V1) $(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Assemble: create object files from assembler source files. ARM-only
|
# Assemble: create object files from assembler source files. ARM-only
|
||||||
define ASSEMBLE_ARM_TEMPLATE
|
define ASSEMBLE_ARM_TEMPLATE
|
||||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||||
@echo $(MSG_ASSEMBLING_ARM) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_ASSEMBLING_ARM) $$(call toprel, $$<)
|
||||||
$(V1) $(CC) -c $$(ASFLAGS) $$< -o $$@
|
$(V1) $(CC) -c $$(ASFLAGS) $$< -o $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Compile: create object files from C source files.
|
# Compile: create object files from C source files.
|
||||||
define COMPILE_C_TEMPLATE
|
define COMPILE_C_TEMPLATE
|
||||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||||
@echo $(MSG_COMPILING) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_COMPILING) $$(call toprel, $$<)
|
||||||
$(V1) $(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
$(V1) $(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Compile: create object files from C source files. ARM-only
|
# Compile: create object files from C source files. ARM-only
|
||||||
define COMPILE_C_ARM_TEMPLATE
|
define COMPILE_C_ARM_TEMPLATE
|
||||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||||
@echo $(MSG_COMPILING_ARM) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_COMPILING_ARM) $$(call toprel, $$<)
|
||||||
$(V1) $(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
$(V1) $(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Compile: create object files from C++ source files.
|
# Compile: create object files from C++ source files.
|
||||||
define COMPILE_CXX_TEMPLATE
|
define COMPILE_CXX_TEMPLATE
|
||||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||||
@echo $(MSG_COMPILINGCXX) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_COMPILINGCXX) $$(call toprel, $$<)
|
||||||
$(V1) $(CXX) -c $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $$< -o $$@
|
$(V1) $(CXX) -c $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $$< -o $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Compile: create object files from C++ source files. ARM-only
|
# Compile: create object files from C++ source files. ARM-only
|
||||||
define COMPILE_CXX_ARM_TEMPLATE
|
define COMPILE_CXX_ARM_TEMPLATE
|
||||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||||
@echo $(MSG_COMPILINGCXX_ARM) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_COMPILINGCXX_ARM) $$(call toprel, $$<)
|
||||||
$(V1) $(CPP) -c $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $$< -o $$@
|
$(V1) $(CPP) -c $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $$< -o $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -192,7 +202,7 @@ define ARCHIVE_TEMPLATE
|
|||||||
.SECONDARY : $(1)
|
.SECONDARY : $(1)
|
||||||
.PRECIOUS : $(2)
|
.PRECIOUS : $(2)
|
||||||
$(1): $(2)
|
$(1): $(2)
|
||||||
@echo $(MSG_ARCHIVING) $$(call toprel, $$@)
|
@$(ECHO) $(MSG_ARCHIVING) $$(call toprel, $$@)
|
||||||
ifeq ($(3),)
|
ifeq ($(3),)
|
||||||
$(V1) $(AR) rcs $$@ $(2)
|
$(V1) $(AR) rcs $$@ $(2)
|
||||||
else
|
else
|
||||||
@ -215,7 +225,7 @@ define LINK_TEMPLATE
|
|||||||
.SECONDARY : $(1)
|
.SECONDARY : $(1)
|
||||||
.PRECIOUS : $(2) $(3)
|
.PRECIOUS : $(2) $(3)
|
||||||
$(1): $(2) $(3)
|
$(1): $(2) $(3)
|
||||||
@echo $(MSG_LINKING) $$(call toprel, $$@)
|
@$(ECHO) $(MSG_LINKING) $$(call toprel, $$@)
|
||||||
$(V1) $(CC) $(THUMB) $$(CFLAGS) $(2) $(3) --output $$@ $$(LDFLAGS)
|
$(V1) $(CC) $(THUMB) $$(CFLAGS) $(2) $(3) --output $$@ $$(LDFLAGS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -226,21 +236,21 @@ define LINK_CXX_TEMPLATE
|
|||||||
.SECONDARY : $(1)
|
.SECONDARY : $(1)
|
||||||
.PRECIOUS : $(2)
|
.PRECIOUS : $(2)
|
||||||
$(1): $(2)
|
$(1): $(2)
|
||||||
@echo $(MSG_LINKING) $$(call toprel, $$@)
|
@$(ECHO) $(MSG_LINKING) $$(call toprel, $$@)
|
||||||
$(V1) $(CXX) $(THUMB) $$(CFLAGS) $(2) --output $$@ $$(LDFLAGS)
|
$(V1) $(CXX) $(THUMB) $$(CFLAGS) $(2) --output $$@ $$(LDFLAGS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Compile: create assembler files from C source files. ARM/Thumb
|
# Compile: create assembler files from C source files. ARM/Thumb
|
||||||
define PARTIAL_COMPILE_TEMPLATE
|
define PARTIAL_COMPILE_TEMPLATE
|
||||||
$($(1):.c=.s) : %.s : %.c
|
$($(1):.c=.s) : %.s : %.c
|
||||||
@echo $(MSG_ASMFROMC) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_ASMFROMC) $$(call toprel, $$<)
|
||||||
$(V1) $(CC) $(THUMB) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
$(V1) $(CC) $(THUMB) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Compile: create assembler files from C source files. ARM only
|
# Compile: create assembler files from C source files. ARM only
|
||||||
define PARTIAL_COMPILE_ARM_TEMPLATE
|
define PARTIAL_COMPILE_ARM_TEMPLATE
|
||||||
$($(1):.c=.s) : %.s : %.c
|
$($(1):.c=.s) : %.s : %.c
|
||||||
@echo $(MSG_ASMFROMC_ARM) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_ASMFROMC_ARM) $$(call toprel, $$<)
|
||||||
$(V1) $(CC) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
$(V1) $(CC) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -254,13 +264,10 @@ define JTAG_TEMPLATE
|
|||||||
# Options for OpenOCD flash-programming
|
# Options for OpenOCD flash-programming
|
||||||
# see openocd.pdf/openocd.texi for further information
|
# see openocd.pdf/openocd.texi for further information
|
||||||
|
|
||||||
# if OpenOCD is in the $PATH just set OPENOCDEXE=openocd
|
|
||||||
OOCD_EXE ?= openocd
|
|
||||||
|
|
||||||
# debug level
|
# debug level
|
||||||
OOCD_JTAG_SETUP = -d0
|
OOCD_JTAG_SETUP = -d0
|
||||||
# interface and board/target settings (using the OOCD target-library here)
|
# interface and board/target settings (using the OOCD target-library here)
|
||||||
OOCD_JTAG_SETUP += -s $(TOP)/flight/Project/OpenOCD
|
OOCD_JTAG_SETUP += -s $(ROOT_DIR)/flight/Project/OpenOCD
|
||||||
OOCD_JTAG_SETUP += -f $(4) -f $(5)
|
OOCD_JTAG_SETUP += -f $(4) -f $(5)
|
||||||
|
|
||||||
# initialize
|
# initialize
|
||||||
@ -272,8 +279,8 @@ OOCD_BOARD_RESET += -c "reset halt"
|
|||||||
|
|
||||||
.PHONY: program
|
.PHONY: program
|
||||||
program: $(1)
|
program: $(1)
|
||||||
@echo $(MSG_JTAG_PROGRAM) $$(call toprel, $$<)
|
@$(ECHO) $(MSG_JTAG_PROGRAM) $$(call toprel, $$<)
|
||||||
$(V1) $(OOCD_EXE) \
|
$(V1) $(OPENOCD) \
|
||||||
$$(OOCD_JTAG_SETUP) \
|
$$(OOCD_JTAG_SETUP) \
|
||||||
$$(OOCD_BOARD_RESET) \
|
$$(OOCD_BOARD_RESET) \
|
||||||
-c "flash write_image erase $$< $(2) bin" \
|
-c "flash write_image erase $$< $(2) bin" \
|
||||||
@ -283,12 +290,11 @@ program: $(1)
|
|||||||
|
|
||||||
.PHONY: wipe
|
.PHONY: wipe
|
||||||
wipe:
|
wipe:
|
||||||
@echo $(MSG_JTAG_WIPE) wiping $(3) bytes starting from $(2)
|
@$(ECHO) $(MSG_JTAG_WIPE) wiping $(3) bytes starting from $(2)
|
||||||
$(V1) $(OOCD_EXE) \
|
$(V1) $(OPENOCD) \
|
||||||
$$(OOCD_JTAG_SETUP) \
|
$$(OOCD_JTAG_SETUP) \
|
||||||
$$(OOCD_BOARD_RESET) \
|
$$(OOCD_BOARD_RESET) \
|
||||||
-c "flash erase_address pad $(2) $(3)" \
|
-c "flash erase_address pad $(2) $(3)" \
|
||||||
-c "reset run" \
|
-c "reset run" \
|
||||||
-c "shutdown"
|
-c "shutdown"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user