mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Makefile: move opfw_resource rules from packaging to top Makefile
opfw_resource make target now depends on built firmware images. They are referenced directly from Qt resource file generated. No extra copies are now necessary.
This commit is contained in:
parent
853f9bf31e
commit
4082b1498a
25
Makefile
25
Makefile
@ -297,8 +297,8 @@ EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
|
||||
|
||||
# When building any of the "all_*" targets, tell all sub makefiles to display
|
||||
# additional details on each line of output to describe which build and target
|
||||
# that each line applies to.
|
||||
ifneq ($(strip $(filter all_%,$(MAKECMDGOALS))),)
|
||||
# that each line applies to. The same applies also to opfw_resource target.
|
||||
ifneq ($(strip $(filter all_% opfw_resource,$(MAKECMDGOALS))),)
|
||||
export ENABLE_MSG_EXTRA := yes
|
||||
endif
|
||||
|
||||
@ -756,6 +756,27 @@ endif
|
||||
#
|
||||
##############################
|
||||
|
||||
# Rules to generate GCS resources used to embed firmware binaries into the GCS.
|
||||
# They are used later by the vehicle setup wizard to update board firmware.
|
||||
# To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
|
||||
OPFW_RESOURCE := $(BUILD_DIR)/ground/opfw_resource/opfw_resource.qrc
|
||||
OPFW_RESOURCE_PREFIX := ../../../
|
||||
OPFW_FILES := $(foreach fw_targ, $(FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
|
||||
OPFW_CONTENTS := \
|
||||
<!DOCTYPE RCC><RCC version="1.0"> \
|
||||
<qresource prefix="/firmware"> \
|
||||
$(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
|
||||
</qresource> \
|
||||
</RCC>
|
||||
|
||||
.PHONY: opfw_resource
|
||||
opfw_resource: $(OPFW_RESOURCE)
|
||||
|
||||
$(OPFW_RESOURCE): $(FW_TARGETS)
|
||||
@$(ECHO) Generating OPFW resource file $(call toprel, $@)
|
||||
$(V1) $(MKDIR) -p $(dir $@)
|
||||
$(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
|
||||
|
||||
.PHONY: package
|
||||
package:
|
||||
$(V1) cd $@ && $(MAKE) --no-print-directory $@
|
||||
|
@ -491,7 +491,7 @@ void UploaderGadgetWidget::commonSystemBoot(bool safeboot)
|
||||
|
||||
bool UploaderGadgetWidget::autoUpdateCapable()
|
||||
{
|
||||
return QDir(":/build").exists();
|
||||
return QDir(":/firmware").exists();
|
||||
}
|
||||
|
||||
bool UploaderGadgetWidget::autoUpdate()
|
||||
@ -560,20 +560,29 @@ bool UploaderGadgetWidget::autoUpdate()
|
||||
}
|
||||
QString filename;
|
||||
emit autoUpdateSignal(LOADING_FW,QVariant());
|
||||
switch (dfu->devices[0].ID)
|
||||
{
|
||||
case 0x401:
|
||||
filename="fw_coptercontrol";
|
||||
switch (dfu->devices[0].ID) {
|
||||
case 0x301:
|
||||
filename = "fw_pipxtreme";
|
||||
break;
|
||||
case 0x401:
|
||||
case 0x402:
|
||||
filename="fw_coptercontrol";
|
||||
filename = "fw_coptercontrol";
|
||||
break;
|
||||
case 0x501:
|
||||
filename = "fw_osd";
|
||||
break;
|
||||
case 0x902:
|
||||
filename = "fw_revolution";
|
||||
break;
|
||||
case 0x903:
|
||||
filename = "fw_revomini";
|
||||
break;
|
||||
default:
|
||||
emit autoUpdateSignal(FAILURE,QVariant());
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
filename=":/build/"+filename+"/"+filename+".opfw";
|
||||
filename = ":/firmware/" + filename + ".opfw";
|
||||
QByteArray firmware;
|
||||
if(!QFile::exists(filename))
|
||||
{
|
||||
|
@ -110,7 +110,9 @@ package: | package_flight package_ground
|
||||
# and it depends on flight firmware images
|
||||
ground_package: | opfw_resource
|
||||
|
||||
opfw_resource: | all_fw
|
||||
.PHONY: opfw_resource
|
||||
opfw_resource: all_fw
|
||||
$(V1) $(MAKE) -C $(ROOT_DIR) $@
|
||||
|
||||
# Decide on a verbosity level based on the V= parameter
|
||||
export AT := @
|
||||
@ -138,22 +140,4 @@ ifeq ($(UNAME), Darwin)
|
||||
PLATFORM := osx
|
||||
endif
|
||||
|
||||
toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
|
||||
OPFW_FILES := $(foreach fw_targ, $(FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
|
||||
OPFW_CONTENTS := \
|
||||
<!DOCTYPE RCC><RCC version="1.0"> \
|
||||
<qresource> \
|
||||
$(foreach fw_file, $(OPFW_FILES), <file>$(fw_file)</file>) \
|
||||
</qresource> \
|
||||
</RCC>
|
||||
|
||||
.PHONY: opfw_resource
|
||||
opfw_resource:
|
||||
@echo Generating OPFW resource file $(call toprel, $(BUILD_DIR)/ground/$@)
|
||||
$(V1) mkdir -p $(BUILD_DIR)/ground/$@
|
||||
$(V1) mkdir -p $(BUILD_DIR)/ground/$@/build
|
||||
$(V1) echo '$(OPFW_CONTENTS)' > $(BUILD_DIR)/ground/$@/opfw_resource.qrc
|
||||
$(V1) $(foreach fw_targ, $(FW_TARGETS), mkdir -p $(BUILD_DIR)/ground/$@/build/$(fw_targ);)
|
||||
$(V1)$(foreach fw_targ, $(FW_TARGETS), cp $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw $(BUILD_DIR)/ground/$@/build/$(fw_targ)/;)
|
||||
|
||||
include $(WHEREAMI)/Makefile.$(PLATFORM)
|
||||
|
Loading…
x
Reference in New Issue
Block a user