From c81d32a0b2c3e8617588349bcd9c73fdea01d6b7 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Thu, 26 Jan 2017 14:25:49 -0800 Subject: [PATCH] build: px4: pass bootloader name directly Don't derive the bootloader name from the version. Other boards using the PX4 layer may not necessarily have "px4fmu" name, let alone the version. --- Tools/ardupilotwaf/boards.py | 8 ++++++++ Tools/ardupilotwaf/px4.py | 9 +-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index b1861838fd..403532bb5f 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -419,12 +419,15 @@ class px4(Board): def __init__(self): self.version = None + self.bootloader_name = None self.use_px4io = True self.ROMFS_EXCLUDE = [] def configure(self, cfg): if not self.version: cfg.fatal('configure: px4: version required') + if not self.bootloader_name: + cfg.fatal('configure: px4: bootloader name is required') super(px4, self).configure(cfg) cfg.load('px4') @@ -458,6 +461,7 @@ class px4(Board): env.ROMFS_EXCLUDE = self.ROMFS_EXCLUDE env.PX4_VERSION = self.version + env.PX4_BOOTLOADER_NAME = self.bootloader_name env.PX4_USE_PX4IO = True if self.use_px4io else False env.AP_PROGRAM_AS_STLIB = True @@ -476,6 +480,7 @@ class px4_v1(px4): def __init__(self): super(px4_v1, self).__init__() self.version = '1' + self.bootloader_name = 'px4fmu_bl.bin' self.romfs_exclude(['oreoled.bin']) class px4_v2(px4): @@ -483,6 +488,7 @@ class px4_v2(px4): def __init__(self): super(px4_v2, self).__init__() self.version = '2' + self.bootloader_name = 'px4fmuv2_bl.bin' self.romfs_exclude(['oreoled.bin']) class px4_v3(px4): @@ -490,11 +496,13 @@ class px4_v3(px4): def __init__(self): super(px4_v3, self).__init__() self.version = '3' + self.bootloader_name = 'px4fmuv2_bl.bin' class px4_v4(px4): name = 'px4-v4' def __init__(self): super(px4_v4, self).__init__() self.version = '4' + self.bootloader_name = 'px4fmuv4_bl.bin' self.use_px4io = False self.romfs_exclude(['oreoled.bin', 'px4io.bin']) diff --git a/Tools/ardupilotwaf/px4.py b/Tools/ardupilotwaf/px4.py index e1ebe98273..0471165a19 100644 --- a/Tools/ardupilotwaf/px4.py +++ b/Tools/ardupilotwaf/px4.py @@ -237,19 +237,12 @@ def configure(cfg): return bldnode.make_node(path).abspath() version = env.get_flat('PX4_VERSION') - - if env.PX4_VERSION == '1': - bootloader_name = 'px4fmu_bl.bin' - elif env.PX4_VERSION in ['2','3']: - bootloader_name = 'px4fmuv2_bl.bin' - else: - bootloader_name = 'px4fmuv%s_bl.bin' % version # TODO: we should move stuff from mk/PX4 to Tools/ardupilotwaf/px4 after # stop using the make-based build system env.PX4_ROMFS_SRC = 'mk/PX4/ROMFS' env.PX4_ROMFS_BLD = 'px4-extra-files/ROMFS' - env.PX4_BOOTLOADER = 'mk/PX4/bootloader/%s' % bootloader_name + env.PX4_BOOTLOADER = 'mk/PX4/bootloader/%s' % env.PX4_BOOTLOADER_NAME env.PX4_ADD_GIT_HASHES = srcpath('Tools/scripts/add_git_hashes.py') env.PX4_APM_ROOT = srcpath('')