mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
makefile: Add EF (Entire Flash) targets for all boards
These new build targets will construct a flash image that includes both a bootloader as well as a firmware image all in one. Examples: make ef_coptercontrol make ef_revolution This also adds support for a new target for writing this EF image to boards that support a DFU interface (only F4-based boards). This can be done by running: make dfuutil_install # Boot board with SBL asserted to activate STM32 DFU ROM # Attach USB cable make ef_revolution_dfu Bootloader images are also now padded out to occupy the full BL flash region.
This commit is contained in:
parent
ce544cf4ab
commit
4fafbb13ed
38
Makefile
38
Makefile
@ -490,17 +490,42 @@ bu_$(1)_clean:
|
||||
$(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
define EF_TEMPLATE
|
||||
.PHONY: ef_$(1)
|
||||
EF_$(1)_IMAGE_NAME := $(BUILD_DIR)/ef_$(1)/ef_$(1).bin
|
||||
ef_$(1): $(BUILD_DIR)/ef_$(1)/ef_$(1).bin
|
||||
|
||||
|
||||
$$(EF_$(1)_IMAGE_NAME): bl_$(1)_bin fw_$(1)_bin
|
||||
$(V0) @echo " FLASH IMG $$@"
|
||||
$(V1) mkdir -p $(BUILD_DIR)/ef_$(1)
|
||||
$(V1) cat $(BUILD_DIR)/bl_$(1)/bl_$(1).bin $(BUILD_DIR)/fw_$(1)/fw_$(1).bin > $$(EF_$(1)_IMAGE_NAME)
|
||||
|
||||
.PHONY: ef_$(1)_dfu
|
||||
ef_$(1)_dfu: $$(EF_$(1)_IMAGE_NAME)
|
||||
$(V0) @echo " DFU RESCUE $$@"
|
||||
$(V1) sudo $(DFUUTIL_DIR)/bin/dfu-util -l && sudo $(DFUUTIL_DIR)/bin/dfu-util -d 0483:df11 -c 1 -i 0 -a 0 -D $$< -s 0x08000000
|
||||
|
||||
.PHONY: ef_$(1)_clean
|
||||
ef_$(1)_clean:
|
||||
$(V0) @echo " CLEAN $$@"
|
||||
$(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
|
||||
endef
|
||||
|
||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||
define BOARD_PHONY_TEMPLATE
|
||||
.PHONY: all_$(1)
|
||||
all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
|
||||
all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
|
||||
all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
|
||||
all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
|
||||
|
||||
.PHONY: all_$(1)_clean
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
|
||||
all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
|
||||
endef
|
||||
|
||||
ALL_BOARDS := coptercontrol pipxtreme revolution
|
||||
@ -514,6 +539,7 @@ revolution_friendly := Revolution
|
||||
FW_BOARDS := $(ALL_BOARDS)
|
||||
BL_BOARDS := $(ALL_BOARDS)
|
||||
BU_BOARDS := $(ALL_BOARDS)
|
||||
EF_BOARDS := $(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.
|
||||
@ -524,6 +550,7 @@ BU_BOARDS := $(filter-out ins, $(ALL_BOARDS))
|
||||
FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
|
||||
BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
|
||||
BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
|
||||
EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
|
||||
|
||||
.PHONY: all_fw all_fw_clean
|
||||
all_fw: $(addsuffix _opfw, $(FW_TARGETS))
|
||||
@ -537,9 +564,13 @@ all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
|
||||
all_bu: $(addsuffix _opfw, $(BU_TARGETS))
|
||||
all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
|
||||
|
||||
.PHONY: all_ef all_ef_clean
|
||||
all_ef: $(EF_TARGETS))
|
||||
all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
|
||||
|
||||
.PHONY: all_flight all_flight_clean
|
||||
all_flight: all_fw all_bl all_bu
|
||||
all_flight_clean: all_fw_clean all_bl_clean all_bu_clean
|
||||
all_flight: all_fw all_bl all_bu all_ef
|
||||
all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
|
||||
|
||||
# Expand the groups of targets for each board
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
|
||||
@ -553,6 +584,9 @@ $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_fr
|
||||
# Expand the bootloader rules
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_friendly))))
|
||||
|
||||
# Expand the entire-flash rules
|
||||
$(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_friendly))))
|
||||
|
||||
.PHONY: sim_posix
|
||||
sim_posix: sim_posix_elf
|
||||
|
||||
|
@ -75,6 +75,7 @@ SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.boardinfo))
|
||||
. = ALIGN(ORIGIN(BD_INFO)+LENGTH(BD_INFO));
|
||||
} > BD_INFO
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
|
@ -68,6 +68,7 @@ SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.boardinfo))
|
||||
. = ALIGN(ORIGIN(BD_INFO)+LENGTH(BD_INFO));
|
||||
} > BD_INFO
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user