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.
This commit is contained in:
Lucas De Marchi 2017-01-26 14:25:49 -08:00
parent 1455f8c513
commit c81d32a0b2
2 changed files with 9 additions and 8 deletions

View File

@ -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'])

View File

@ -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('')