Build system: Add support for airframes config file

This commit is contained in:
Lorenz Meier
2015-07-28 23:45:30 +02:00
parent f226e808b2
commit 4471b18117
3 changed files with 21 additions and 0 deletions

12
Tools/airframes.xml Normal file
View File

@@ -0,0 +1,12 @@
<?xml version='1.0' encoding='UTF-8'?>
<airframes>
<airframe_group name="StandardPlane">
<airframe name="Multiplex Easystar 1/2" id="2100"/>
<airframe name="Generic AERT" id="2101"/>
</airframe_group>
<airframe_group name="QuadRotorX">
<airframe name="Generic 10 inch Quad" id="4001"/>
<airframe name="DJI F330 8 inch Quad" id="4010"/>
<airframe name="DJI F450 10 inch Quad" id="4011"/>
</airframe_group>
</airframes>

View File

@@ -74,6 +74,7 @@ parser.add_argument("--summary", action="store", help="set a brief description")
parser.add_argument("--description", action="store", help="set a longer description")
parser.add_argument("--git_identity", action="store", help="the working directory to check for git identity")
parser.add_argument("--parameter_xml", action="store", help="the parameters.xml file")
parser.add_argument("--airframe_xml", action="store", help="the airframes.xml file")
parser.add_argument("--image", action="store", help="the firmware image")
args = parser.parse_args()
@@ -107,6 +108,11 @@ if args.parameter_xml != None:
bytes = f.read()
desc['parameter_xml_size'] = len(bytes)
desc['parameter_xml'] = base64.b64encode(zlib.compress(bytes,9)).decode('utf-8')
if args.airframe_xml != None:
f = open(args.airframe_xml, "rb")
bytes = f.read()
desc['airframe_xml_size'] = len(bytes)
desc['airframe_xml'] = base64.b64encode(zlib.compress(bytes,9)).decode('utf-8')
if args.image != None:
f = open(args.image, "rb")
bytes = f.read()

View File

@@ -36,6 +36,7 @@ PRODUCT_BUNDLE = $(WORK_DIR)firmware.px4
PRODUCT_BIN = $(WORK_DIR)firmware.bin
PRODUCT_ELF = $(WORK_DIR)firmware.elf
PRODUCT_PARAMXML = $(WORK_DIR)/parameters.xml
PRODUCT_AIRFRAMEXML = $(WORK_DIR)/airframes.xml
.PHONY: firmware
firmware: $(PRODUCT_BUNDLE)
@@ -48,9 +49,11 @@ $(PRODUCT_BUNDLE): $(PRODUCT_BIN)
@$(ECHO) %% Generating $@
ifdef GEN_PARAM_XML
$(Q) $(PYTHON) $(PX4_BASE)/Tools/px_process_params.py --src-path $(PX4_BASE)/src --board CONFIG_ARCH_BOARD_$(CONFIG_BOARD) --xml
$(Q) $(COPY) $(PX4_BASE)/Tools/airframes.xml $(WORK_DIR)/airframes.xml
$(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \
--git_identity $(PX4_BASE) \
--parameter_xml $(PRODUCT_PARAMXML) \
--airframe_xml $(PRODUCT_AIRFRAMEXML) \
--image $< > $@
else
$(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \