1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

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
This commit is contained in:
Stacey Sheldon 2011-05-23 15:11:53 -04:00
parent 6ec6425f5e
commit 0a67730d0f
22 changed files with 328 additions and 503 deletions

339
Makefile
View File

@ -77,13 +77,13 @@ help:
@echo " all_flight - Build all firmware, bootloaders and bootloader updaters"
@echo " all_fw - Build only firmware for all boards"
@echo " all_bl - Build only bootloaders for all boards"
@echo " all_blupd - Build only bootloader updaters for all boards"
@echo " all_bu - Build only bootloader updaters for all boards"
@echo
@echo " all_clean - Remove your build directory ($(BUILD_DIR))"
@echo " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
@echo " all_fw_clean - Remove firmware for all boards"
@echo " all_bl_clean - Remove bootlaoders for all boards"
@echo " all_blupd_clean - Remove bootloader updaters for all boards"
@echo " all_bu_clean - Remove bootloader updaters for all boards"
@echo
@echo " [Firmware]"
@echo " <board> - Build firmware for <board>"
@ -98,9 +98,9 @@ help:
@echo " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
@echo
@echo " [Bootloader Updater]"
@echo " blupd_<board> - Build bootloader updater for <board>"
@echo " supported boards are ($(BLUPD_TARGETS))"
@echo " blupd_<board>_clean - Remove bootloader updater for <board>"
@echo " bu_<board> - Build bootloader updater for <board>"
@echo " supported boards are ($(BU_TARGETS))"
@echo " bu_<board>_clean - Remove bootloader updater for <board>"
@echo
@echo " [Simulation]"
@echo " sim_posix - Build OpenPilot simulation firmware for"
@ -311,254 +311,113 @@ uavobjects_clean:
#
##############################
FW_TARGETS := openpilot ahrs coptercontrol pipxtreme ins
BL_TARGETS := $(addprefix bl_, $(FW_TARGETS))
BLUPD_TARGETS := $(addprefix blupd_, $(FW_TARGETS))
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
# $(2) = Name of board used in source tree (e.g. CopterControl)
define FW_TEMPLATE
.PHONY: $(1) fw_$(1)
$(1): fw_$(1)_opf
fw_$(1): fw_$(1)_opf
fw_$(1)_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/fw_$(1)/dep
$(V1) cd $(ROOT_DIR)/flight/$(2) && \
$$(MAKE) -r --no-print-directory \
BOARD_NAME=$(1) \
TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
$$*
.PHONY: $(1)_clean
$(1)_clean: fw_$(1)_clean
fw_$(1)_clean:
$(V0) @echo " CLEAN $$@"
$(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
endef
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
# $(2) = Name of board used in source tree (e.g. CopterControl)
define BL_TEMPLATE
.PHONY: bl_$(1)
bl_$(1): bl_$(1)_bin
bl_$(1)_bino: bl_$(1)_bin
bl_$(1)_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_$(1)/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/$(2) && \
$$(MAKE) -r --no-print-directory \
BOARD_NAME=$(1) \
TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
$$*
.PHONY: bl_$(1)_clean
bl_$(1)_clean:
$(V0) @echo " CLEAN $$@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
endef
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
define BU_TEMPLATE
.PHONY: bu_$(1)
bu_$(1): bu_$(1)_opf
bu_$(1)_%: bl_$(1)_bino
$(V1) mkdir -p $(BUILD_DIR)/bu_$(1)/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$$(MAKE) -r --no-print-directory \
BOARD_NAME=$(1) \
TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
$$*
.PHONY: bu_$(1)_clean
bu_$(1)_clean:
$(V0) @echo " CLEAN $$@"
$(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
endef
ALL_BOARDS := openpilot ahrs coptercontrol pipxtreme ins
# Friendly names of each board (used to find source tree)
openpilot_friendly := OpenPilot
coptercontrol_friendly := CopterControl
pipxtreme_friendly := PipXtreme
ins_friendly := INS
ahrs_friendly := AHRS
FW_TARGETS := $(addprefix fw_, $(ALL_BOARDS))
BL_TARGETS := $(addprefix bl_, $(ALL_BOARDS))
BU_TARGETS := $(addprefix bu_, $(ALL_BOARDS))
# FIXME: The INS build doesn't have a bootloader or bootloader
# updater yet so we need to filter them out to prevent errors.
BL_TARGETS := $(filter-out bl_ins, $(BL_TARGETS))
BLUPD_TARGETS := $(filter-out blupd_ins, $(BLUPD_TARGETS))
BL_TARGETS := $(filter-out bl_ins, $(BL_TARGETS))
BU_TARGETS := $(filter-out bu_ins, $(BU_TARGETS))
.PHONY: all_fw all_fw_clean
all_fw: $(addsuffix _opf, $(FW_TARGETS))
all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
all_fw: $(addsuffix _opf, $(FW_TARGETS))
all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
.PHONY: all_bl all_bl_clean
all_bl: $(addsuffix _bin, $(BL_TARGETS))
all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
all_bl: $(addsuffix _bin, $(BL_TARGETS))
all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
.PHONY: all_blupd all_blupd_clean
all_blupd: $(addsuffix _bin, $(BLUPD_TARGETS))
all_blupd_clean: $(addsuffix _clean, $(BLUPD_TARGETS))
.PHONY: all_bu all_bu_clean
all_bu: $(addsuffix _opf, $(BU_TARGETS))
all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
.PHONY: all_flight all_flight_clean
all_flight: all_fw all_bl all_blupd
all_flight_clean: all_fw_clean all_bl_clean all_blupd_clean
all_flight: all_fw all_bl all_bu
all_flight_clean: all_fw_clean all_bl_clean all_bu_clean
.PHONY: openpilot
openpilot: openpilot_opf
# Expand the bootloader updater rules
$(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_friendly))))
openpilot_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/openpilot/dep
$(V1) cd $(ROOT_DIR)/flight/OpenPilot && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/openpilot" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: openpilot_clean
openpilot_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/openpilot
.PHONY: bl_openpilot
bl_openpilot: bl_openpilot_bin
bl_openpilot_bino: bl_openpilot_bin
bl_openpilot_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_openpilot/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/OpenPilot && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_openpilot" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_openpilot_clean
bl_openpilot_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_openpilot
.PHONY: blupd_openpilot
blupd_openpilot: blupd_openpilot_bin
blupd_openpilot_%: bl_openpilot_bino
$(V1) mkdir -p $(BUILD_DIR)/blupd_openpilot/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/blupd_openpilot" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
BOARD=STM3210E_OP MODEL=HD MODEL_SUFFIX=_OP \
BLOBJ=$(BUILD_DIR)/bl_openpilot/OpenPilot_BL.bin.o $*
.PHONY: blupd_openpilot_clean
blupd_openpilot_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/blupd_openpilot
.PHONY: ahrs
ahrs: ahrs_opf
ahrs_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/ahrs/dep
$(V1) cd $(ROOT_DIR)/flight/AHRS && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/ahrs" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: ahrs_clean
ahrs_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/ahrs
.PHONY: bl_ahrs
bl_ahrs: bl_ahrs_bin
bl_ahrs_bino: bl_ahrs_bin
bl_ahrs_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_ahrs/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/AHRS && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_ahrs" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_ahrs_clean
bl_ahrs_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_ahrs
.PHONY: blupd_ahrs
blupd_ahrs: blupd_ahrs_bin
blupd_ahrs_%: bl_ahrs_bino bl_ahrs
$(V1) mkdir -p $(BUILD_DIR)/blupd_ahrs/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/blupd_ahrs" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
BOARD=STM32103CB_AHRS MODEL=MD \
BLOBJ=$(BUILD_DIR)/bl_ahrs/AHRS_BL.bin.o $*
.PHONY: blupd_ahrs_clean
blupd_ahrs_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/blupd_ahrs
.PHONY: coptercontrol
coptercontrol: coptercontrol_opf
coptercontrol_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/coptercontrol/dep
$(V1) cd $(ROOT_DIR)/flight/CopterControl && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: coptercontrol_clean
coptercontrol_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/coptercontrol
.PHONY: bl_coptercontrol
bl_coptercontrol: bl_coptercontrol_bin
bl_coptercontrol_bino: bl_coptercontrol_bin
bl_coptercontrol_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_coptercontrol/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/CopterControl && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_coptercontrol_clean
bl_coptercontrol_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_coptercontrol
.PHONY: blupd_coptercontrol
blupd_coptercontrol: blupd_coptercontrol_bin
blupd_coptercontrol_%: bl_coptercontrol_bino
$(V1) mkdir -p $(BUILD_DIR)/blupd_coptercontrol/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/blupd_coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
BOARD=STM32103CB_CC_Rev1 MODEL=MD MODEL_SUFFIX=_CC \
BLOBJ=$(BUILD_DIR)/bl_coptercontrol/CopterControl_BL.bin.o $*
.PHONY: blupd_coptercontrol_clean
blupd_coptercontrol_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/blupd_coptercontrol
.PHONY: pipxtreme
pipxtreme: pipxtreme_opf
pipxtreme_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/pipxtreme/dep
$(V1) cd $(ROOT_DIR)/flight/PipXtreme && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/pipxtreme" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: pipxtreme_clean
pipxtreme_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/pipxtreme
.PHONY: bl_pipxtreme
bl_pipxtreme: bl_pipxtreme_bin
bl_pipxtreme_bino: bl_pipxtreme_bin
bl_pipxtreme_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_pipxtreme/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/PipXtreme && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_pipxtreme" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_pipxtreme_clean
bl_pipxtreme_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_pipxtreme
.PHONY: blupd_pipxtreme
blupd_pipxtreme: blupd_pipxtreme_bin
blupd_pipxtreme_%: bl_pipxtreme_bino
$(V1) mkdir -p $(BUILD_DIR)/blupd_pipxtreme/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/blupd_pipxtreme" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
BOARD=STM32103CB_PIPXTREME MODEL=MD MODEL_SUFFIX=_CC \
BLOBJ=$(BUILD_DIR)/bl_pipxtreme/PipXtreme_BL.bin.o $*
.PHONY: blupd_pipxtreme_clean
blupd_pipxtreme_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/blupd_pipxtreme
.PHONY: ins
ins: ins_opf
ins_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/ins/dep
$(V1) cd $(ROOT_DIR)/flight/INS && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/ins" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: ins_clean
ins_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/ins
.PHONY: bl_ins
bl_ins: bl_ins_elf
bl_ins_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_ins/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/INS && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_ins" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_ins_clean
bl_ins_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_ins
# Expand the firmware rules
$(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_friendly))))
# Expand the bootloader rules
$(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_friendly))))
.PHONY: sim_posix
sim_posix: sim_posix_elf

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../)
include $(TOP)/make/firmware-defs.mk
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)
# Set developer code and compile options
# Set to YES for debugging
@ -41,21 +48,6 @@ 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
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/ahrs
# Target file name (without extension).
TARGET = AHRS
# Paths
AHRS = ./
AHRSINC = $(AHRS)/inc
@ -160,7 +152,7 @@ CPPSRCARM =
# 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
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -301,9 +293,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08002000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08002000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -382,7 +374,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,0x02,0x01))
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
.PHONY: elf lss sym hex bin bino opf
elf: $(OUTDIR)/$(TARGET).elf

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../../)
include $(TOP)/make/firmware-defs.mk
include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk
# Target file name (without extension).
TARGET := bl_$(BOARD_NAME)
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR := $(TOP)/build/$(TARGET)
# Set developer code and compile options
# Set to YES for debugging
@ -41,23 +48,6 @@ 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
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/bl_ahrs
# Target file name (without extension).
TARGET = AHRS_BL
# Paths
AHRS_BL = ./
AHRS_BLINC = $(AHRS_BL)/inc
@ -149,7 +139,7 @@ CPPSRCARM =
# 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
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -293,9 +283,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../../)
include $(TOP)/make/firmware-defs.mk
include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk
# Target file name (without extension).
TARGET = bu_$(BOARD_NAME)
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR := $(TOP)/build/$(TARGET)
# Set developer code and compile options
# Set to YES to compile for debugging
@ -51,21 +58,6 @@ 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 ?= NULL
MODEL ?= NULL
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = ../../../build/bootloaders/BootloaderUpdater
# Target file name (without extension).
TARGET = BL_Updater
# Paths
OPSYSTEM = .
OPSYSTEMINC = $(OPSYSTEM)/inc
@ -309,9 +301,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08003000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08003000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -364,6 +356,7 @@ program: $(OUTDIR)/$(TARGET).bin
endif
# Link: create ELF output file from object files.
BLOBJ := $(TOP)/build/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin.o
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ) $(BLOBJ)))
# Assemble: create object files from assembler source files.
@ -392,14 +385,16 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
.PHONY: elf lss sym hex bin bino opf
elf: $(OUTDIR)/$(TARGET).elf
elf.stripped: $(OUTDIR)/$(TARGET).elf.stripped
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
opf: $(OUTDIR)/$(TARGET).opf
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../../)
include $(TOP)/make/firmware-defs.mk
include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk
# Target file name (without extension).
TARGET := bl_$(BOARD_NAME)
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR := $(TOP)/build/$(TARGET)
# Set developer code and compile options
# Set to YES to compile for debugging
@ -48,21 +55,6 @@ 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_CC_Rev1
MODEL = MD
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/bl_coptercontrol
# Target file name (without extension).
TARGET = CopterControl_BL
# Paths
OPSYSTEM = .
OPSYSTEMINC = $(OPSYSTEM)/inc
@ -181,7 +173,7 @@ CPPSRCARM =
# 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
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -343,9 +335,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../../)
include $(TOP)/make/firmware-defs.mk
include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk
# Target file name (without extension).
TARGET := bl_$(BOARD_NAME)
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR := $(TOP)/build/$(TARGET)
# Set developer code and compile options
# Set to YES to compile for debugging
@ -48,21 +55,6 @@ 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 = STM32F103RET
BOARD = STM3210E_OP
MODEL = HD
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/bl_openpilot
# Target file name (without extension).
TARGET = OpenPilot_BL
# Paths
OPSYSTEM = .
OPSYSTEMINC = $(OPSYSTEM)/inc
@ -184,7 +176,7 @@ CPPSRCARM =
# 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)_OP.S
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -346,9 +338,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../../)
include $(TOP)/make/firmware-defs.mk
include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk
# Target file name (without extension).
TARGET := bl_$(BOARD_NAME)
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR := $(TOP)/build/$(TARGET)
# Set developer code and compile options
# Set to YES to compile for debugging
@ -48,21 +55,6 @@ 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_PIPXTREME
MODEL = MD
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/bl_pipxtreme
# Target file name (without extension).
TARGET = PipXtreme_BL
# Paths
OPSYSTEM = .
OPSYSTEMINC = $(OPSYSTEM)/inc
@ -180,7 +172,7 @@ CPPSRCARM =
# 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
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -342,9 +334,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../)
include $(TOP)/make/firmware-defs.mk
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)
# Set developer code and compile options
# Set to YES to compile for debugging
@ -57,21 +64,6 @@ FLASH_TOOL = OPENOCD
# List of modules to include
MODULES = Telemetry Attitude Stabilization Actuator ManualControl FirmwareIAP
# 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_CC_Rev1
MODEL = MD
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/coptercontrol
# Target file name (without extension).
TARGET = CopterControl
# Paths
OPSYSTEM = ./System
OPSYSTEMINC = $(OPSYSTEM)/inc
@ -299,7 +291,7 @@ CPPSRCARM =
# 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)_CC.S
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -477,9 +469,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08003000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08003000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -576,7 +568,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,0x04,0x01))
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
.PHONY: elf lss sym hex bin bino opf
elf: $(OUTDIR)/$(TARGET).elf

View File

@ -25,11 +25,17 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../)
include $(TOP)/make/firmware-defs.mk
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)
# Set developer code and compile options
# Set to YES for debugging
DEBUG ?= YES
USE_BOOTLOADER ?= NO
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= YES
@ -42,26 +48,6 @@ 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 = STM32F103RET
BOARD = STM3210E_INS
MODEL = HD
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/ins
# Target file name (without extension).
TARGET = INS
# Paths
INS = ./
INSINC = $(INS)/inc
@ -168,7 +154,7 @@ CPPSRCARM =
# 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
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -231,9 +217,8 @@ CDEFS = -DSTM32F10X_$(MODEL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DUSE_$(BOARD)
CDEFS += -DIN_INS
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
@ -311,7 +296,8 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
# Program
@ -359,19 +345,12 @@ 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
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
endif
# Link: create ELF output file from object files.
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ)))
@ -402,7 +381,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,0x05,0x01))
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
.PHONY: elf lss sym hex bin bino opf
elf: $(OUTDIR)/$(TARGET).elf

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../)
include $(TOP)/make/firmware-defs.mk
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)
# Set developer code and compile options
# Set to YES to compile for debugging
@ -59,21 +66,6 @@ PYMODULES = FlightPlan
#MODULES = Telemetry
#MODULES += Osd/OsdEtStd
# 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 = STM32F103RET
BOARD = STM3210E_OP
MODEL = HD
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/openpilot
# Target file name (without extension).
TARGET = OpenPilot
# Paths
OPSYSTEM = ./System
OPSYSTEMINC = $(OPSYSTEM)/inc
@ -287,7 +279,7 @@ CPPSRCARM =
# 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)_OP.S
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -453,9 +445,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08005000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08005000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -556,7 +548,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,0x01,0x01))
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
.PHONY: elf lss sym hex bin bino opf
elf: $(OUTDIR)/$(TARGET).elf

View File

@ -1,9 +1,9 @@
/**
******************************************************************************
*
* @file link_STM3210E_INS_HD_BL.ld
* @file link_STM3210E_INS_HD_NB.ld
* @author David "Buzz" Carlson (buzz@chebuzz.com)
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
* @brief PiOS linker for the OpenPilot INS board
* @see The GNU Public License (GPL) Version 3
*
@ -24,26 +24,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Memory Spaces Definitions */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x08005000, LENGTH = 492K
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}
_estack = 0x20004FF0;
/* This is the size of the stack for early init and for all FreeRTOS IRQs */
_irq_stack_size = 0x400;
/* Check valid alignment for VTOR */
ASSERT(ORIGIN(FLASH) == ALIGN(ORIGIN(FLASH), 0x80), "Start of memory region flash not aligned for startup vector table");
ASSERT(ORIGIN(BL_FLASH) == ALIGN(ORIGIN(BL_FLASH), 0x80), "Start of memory region flash not aligned for startup vector table");
/*
this sends all unreferenced IRQHandlers to reset
@ -210,7 +195,7 @@ SECTIONS
{
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
} > BL_FLASH
/* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
.flashtext :
@ -218,7 +203,7 @@ SECTIONS
. = ALIGN(4);
*(.flashtext) /* Startup code */
. = ALIGN(4);
} >FLASH
} > BL_FLASH
/* init sections */
@ -229,7 +214,7 @@ SECTIONS
KEEP(*(.initcalluavobj.init))
. = ALIGN(4);
__uavobj_initcall_end = .;
} >FLASH
} > BL_FLASH
/* the program code is stored in the .text section, which goes to Flash */
.text :
@ -247,7 +232,7 @@ SECTIONS
_etext = .;
/* This is used by the startup in order to initialize the .data secion */
_sidata = _etext;
} >FLASH
} > BL_FLASH
/*
@ -354,6 +339,13 @@ SECTIONS
__exidx_start = .;
__exidx_end = .;
.boardinfo :
{
. = ALIGN(4);
KEEP(*(.boardinfo))
. = ALIGN(4);
} > BD_INFO
/* after that it's only debugging information. */
/* remove the debugging information from the standard libraries */

View File

@ -0,0 +1,13 @@
/* Memory Spaces Definitions */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x10000
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x05000 - 0x00080
BD_INFO (r) : ORIGIN = 0x08005000 - 0x80, LENGTH = 0x00080
FLASH (rx) : ORIGIN = 0x08005000, LENGTH = 0x80000 - 0x05000
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}

View File

@ -24,21 +24,6 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Memory Spaces Definitions */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}
_estack = 0x20004FF0;
/* This is the size of the stack for early init and for all FreeRTOS IRQs */
_irq_stack_size = 0x400;
@ -62,10 +47,10 @@ PROVIDE ( HardFault_Handler = 0 ) ;
PROVIDE ( MemManage_Handler = 0 ) ;
PROVIDE ( BusFault_Handler = 0 ) ;
PROVIDE ( UsageFault_Handler = 0 ) ;
PROVIDE ( SVC_Handler = 0 ) ;
PROVIDE ( vPortSVCHandler = 0 ) ;
PROVIDE ( DebugMon_Handler = 0 ) ;
PROVIDE ( PendSV_Handler = 0 ) ;
PROVIDE ( SysTick_Handler = 0 ) ;
PROVIDE ( xPortPendSVHandler = 0 ) ;
PROVIDE ( xPortSysTickHandler = 0 ) ;
PROVIDE ( WWDG_IRQHandler = 0 ) ;
PROVIDE ( PVD_IRQHandler = 0 ) ;
@ -204,13 +189,18 @@ PROVIDE ( SCB = (SCS_BASE + 0x0D00) ) ;
SECTIONS
{
.boardinfo :
{
. = ALIGN(4);
PROVIDE(pios_board_info_blob = .);
} > BD_INFO
/* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
.isr_vector :
{
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
} > FLASH
/* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
.flashtext :
@ -218,7 +208,7 @@ SECTIONS
. = ALIGN(4);
*(.flashtext) /* Startup code */
. = ALIGN(4);
} >FLASH
} > FLASH
/* init sections */
@ -229,7 +219,7 @@ SECTIONS
KEEP(*(.initcalluavobj.init))
. = ALIGN(4);
__uavobj_initcall_end = .;
} >FLASH
} > FLASH
/* the program code is stored in the .text section, which goes to Flash */
.text :
@ -247,7 +237,7 @@ SECTIONS
_etext = .;
/* This is used by the startup in order to initialize the .data secion */
_sidata = _etext;
} >FLASH
} > FLASH
/*

View File

@ -2,7 +2,7 @@
_irq_stack_size = 0x400;
/* Check valid alignment for VTOR */
ASSERT(ORIGIN(FLASH) == ALIGN(ORIGIN(FLASH), 0x80), "Start of memory region flash not aligned for startup vector table");
ASSERT(ORIGIN(BL_FLASH) == ALIGN(ORIGIN(BL_FLASH), 0x80), "Start of memory region flash not aligned for startup vector table");
/*
this sends all unreferenced IRQHandlers to reset

View File

@ -25,6 +25,13 @@
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../)
include $(TOP)/make/firmware-defs.mk
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)
# Debugging (YES/NO) ?
DEBUG ?= NO
@ -43,23 +50,6 @@ FLASH_TOOL = OPENOCD
# Include the USB files (YES/NO) ?
USE_USB = YES
# 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_PIPXTREME
#CHIP = STM32F103C8T
#BOARD = STM32103C8_PIPXTREME
MODEL = MD
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/pipxtreme
# Target file name (without extension).
TARGET = PipXtreme
# Paths
HOME_DIR = ./
HOME_DIR_INC = $(HOME_DIR)/inc
@ -192,7 +182,7 @@ CPPSRCARM =
# 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
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -342,9 +332,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08003000 bin"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08003000 bin"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -422,7 +412,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,0x03,0x01))
$(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
.PHONY: elf lss sym hex bin bino opf
elf: $(OUTDIR)/$(TARGET).elf

View File

@ -0,0 +1,13 @@
BOARD_TYPE := 0x02
BOARD_REVISION := 0x01
BOOTLOADER_VERSION := 0x00
HW_TYPE := 0x00
MCU := cortex-m3
CHIP := STM32F103CBT
BOARD := STM32103CB_AHRS
MODEL := MD
MODEL_SUFFIX :=
START_OF_BL_CODE := 0x08000000
START_OF_FW_CODE := 0x08002000

View File

@ -0,0 +1,13 @@
BOARD_TYPE := 0x04
BOARD_REVISION := 0x01
BOOTLOADER_VERSION := 0x00
HW_TYPE := 0x01
MCU := cortex-m3
CHIP := STM32F103CBT
BOARD := STM32103CB_CC_Rev1
MODEL := MD
MODEL_SUFFIX := _CC
START_OF_BL_CODE := 0x08000000
START_OF_FW_CODE := 0x08003000

View File

@ -0,0 +1,13 @@
BOARD_TYPE := 0x05
BOARD_REVISION := 0x01
BOOTLOADER_VERSION := 0x00
HW_TYPE := 0x00
MCU := cortex-m3
CHIP := STM32F103RET
BOARD := STM3210E_INS
MODEL := HD
MODEL_SUFFIX := _OP
START_OF_BL_CODE := 0x08000000
START_OF_FW_CODE := 0x08002000

View File

@ -0,0 +1,13 @@
BOARD_TYPE := 0x01
BOARD_REVISION := 0x01
BOOTLOADER_VERSION := 0x00
HW_TYPE := 0x00
MCU := cortex-m3
CHIP := STM32F103RET
BOARD := STM3210E_OP
MODEL := HD
MODEL_SUFFIX := _OP
START_OF_BL_CODE := 0x08000000
START_OF_FW_CODE := 0x08005000

View File

@ -0,0 +1,13 @@
BOARD_TYPE := 0x03
BOARD_REVISION := 0x01
BOOTLOADER_VERSION := 0x00
HW_TYPE := 0x00
MCU := cortex-m3
CHIP := STM32F103CBT
BOARD := STM32103CB_PIPXTREME
MODEL := MD
MODEL_SUFFIX :=
START_OF_BL_CODE := 0x08000000
START_OF_FW_CODE := 0x08003000

View File

@ -46,7 +46,7 @@ MSG_ASMFROMC_ARM := ${quote} AS(C)-ARM ${quote}
MSG_PYMITEINIT := ${quote} PY ${quote}
MSG_INSTALLING := ${quote} INSTALL ${quote}
MSG_OPFIRMWARE := ${quote} OPF ${quote}
MSG_FWDESC := ${quote} FWDESC ${quote}
MSG_FWINFO := ${quote} FWINFO ${quote}
toprel = $(subst $(realpath $(TOP))/,,$(abspath $(1)))
@ -108,7 +108,7 @@ endef
# $(3) = board revision in hex
define OPF_TEMPLATE
$(1).firmwareinfo.c: $(1) $(TOP)/make/templates/firmwareinfotemplate.c
@echo $(MSG_FWDESC) $$(call toprel, $$@)
@echo $(MSG_FWINFO) $$(call toprel, $$@)
$(V1) python $(TOP)/make/scripts/version-info.py \
--path=$(TOP) \
--template=$(TOP)/make/templates/firmwareinfotemplate.c \

View File

@ -18,7 +18,7 @@ RELEASE_LBL := $(shell $(VERSION_CMD) --format=\$${DATE}-\$${TAG_OR_HASH8}\$${D
RELEASE_DIR := $(BUILD_DIR)/release-$(RELEASE_LBL)
FW_DIR := $(RELEASE_DIR)/firmware-$(RELEASE_LBL)
BL_DIR := $(FW_DIR)/bootloaders
BLUPD_DIR := $(FW_DIR)/bootloader_updaters
BU_DIR := $(FW_DIR)/bootloader_updaters
# Clean build options (recommended for package testing only)
ifeq ($(CLEAN_BUILD), NO)
@ -38,7 +38,7 @@ FW_TARGETS_INPUT := coptercontrol openpilot
FW_TARGETS_TOOLS := coptercontrol
FW_TARGETS := $(FW_TARGETS_COMMON) $(FW_TARGETS_INPUT)
BL_TARGETS := $(addprefix bl_, $(FW_TARGETS))
BLUPD_TARGETS := $(addprefix blupd_, $(FW_TARGETS))
BU_TARGETS := $(addprefix bu_, $(FW_TARGETS))
help:
@echo
@ -106,13 +106,13 @@ $(eval $(call INSTALL_TEMPLATE,fw_ppm,uavobjects,$(FW_DIR),,-ppm-$(RELEASE_LBL),
$(eval $(call INSTALL_TEMPLATE,all_bl,uavobjects,$(BL_DIR),,-$(RELEASE_LBL),,,$(BL_TARGETS),bin))
# Bootloader Updaters
$(eval $(call INSTALL_TEMPLATE,blupd_coptercontrol,all_bl,$(BLUPD_DIR),CopterControl_,-$(RELEASE_LBL),,,blupd_coptercontrol,install))
$(eval $(call INSTALL_TEMPLATE,blupd_ahrs,all_bl,$(BLUPD_DIR),AHRS_,-$(RELEASE_LBL),,,blupd_ahrs,install))
$(eval $(call INSTALL_TEMPLATE,blupd_openpilot,all_bl,$(BLUPD_DIR),OpenPilot_,-$(RELEASE_LBL),,,blupd_openpilot,install))
$(eval $(call INSTALL_TEMPLATE,blupd_pipxtreme,all_bl,$(BLUPD_DIR),PipXtreme_,-$(RELEASE_LBL),,,blupd_pipxtreme,install))
$(eval $(call INSTALL_TEMPLATE,bu_coptercontrol,all_bl,$(BU_DIR),CopterControl_,-$(RELEASE_LBL),,,bu_coptercontrol,install))
$(eval $(call INSTALL_TEMPLATE,bu_ahrs,all_bl,$(BU_DIR),AHRS_,-$(RELEASE_LBL),,,bu_ahrs,install))
$(eval $(call INSTALL_TEMPLATE,bu_openpilot,all_bl,$(BU_DIR),OpenPilot_,-$(RELEASE_LBL),,,bu_openpilot,install))
$(eval $(call INSTALL_TEMPLATE,bu_pipxtreme,all_bl,$(BU_DIR),PipXtreme_,-$(RELEASE_LBL),,,bu_pipxtreme,install))
# CopterControl flash eraser tool
$(eval $(call INSTALL_TEMPLATE,fw_tools,uavobjects,$(BLUPD_DIR),,-FlashEraser-$(RELEASE_LBL),ERASE_FLASH=YES,clean,$(FW_TARGETS_TOOLS),install))
$(eval $(call INSTALL_TEMPLATE,fw_tools,uavobjects,$(BU_DIR),,-FlashEraser-$(RELEASE_LBL),ERASE_FLASH=YES,clean,$(FW_TARGETS_TOOLS),install))
# Order-only dependencies
# They are bit complicated to support parallel (-j) builds and to create
@ -128,15 +128,15 @@ fw_tools: | fw_spektrum # ordered build, replace fw_spektrum by fw_ppm if uncomm
release_fw: | fw_common fw_pwm fw_spektrum # fw_ppm
release_blupd: | $(BLUPD_TARGETS)
release_bu: | $(BU_TARGETS)
release_flight: | release_fw release_blupd fw_tools
release_flight: | release_fw release_bu fw_tools
release_ground: | ground_package
release: | release_flight release_ground
.PHONY: help uavobjects all_clean release release_flight release_fw release_blupd release_ground
.PHONY: help uavobjects all_clean release release_flight release_fw release_bu release_ground
# Decide on a verbosity level based on the V= parameter
export AT := @