build: px4: pass px4io name directly

This commit is contained in:
Lucas De Marchi 2017-01-26 15:49:39 -08:00
parent da297d2028
commit 1a58d3c447
2 changed files with 12 additions and 15 deletions

View File

@ -421,7 +421,7 @@ class px4(Board):
self.version = None
self.bootloader_name = None
self.board_name = None
self.use_px4io = True
self.px4io_name = None
self.ROMFS_EXCLUDE = []
def configure(self, cfg):
@ -466,7 +466,7 @@ class px4(Board):
env.PX4_VERSION = self.version
env.PX4_BOOTLOADER_NAME = self.bootloader_name
env.PX4_BOARD_NAME = self.board_name
env.PX4_USE_PX4IO = True if self.use_px4io else False
env.PX4_PX4IO_NAME = self.px4io_name
env.AP_PROGRAM_AS_STLIB = True
@ -486,6 +486,7 @@ class px4_v1(px4):
self.version = '1'
self.bootloader_name = 'px4fmu_bl.bin'
self.board_name = 'px4fmu-v1'
self.px4io_name = 'px4io-v1'
self.romfs_exclude(['oreoled.bin'])
class px4_v2(px4):
@ -495,6 +496,7 @@ class px4_v2(px4):
self.version = '2'
self.bootloader_name = 'px4fmuv2_bl.bin'
self.board_name = 'px4fmu-v2'
self.px4io_name = 'px4io-v2'
self.romfs_exclude(['oreoled.bin'])
class px4_v3(px4):
@ -504,6 +506,7 @@ class px4_v3(px4):
self.version = '3'
self.bootloader_name = 'px4fmuv2_bl.bin'
self.board_name = 'px4fmu-v3'
self.px4io_name = 'px4io-v2'
class px4_v4(px4):
name = 'px4-v4'
@ -512,5 +515,4 @@ class px4_v4(px4):
self.version = '4'
self.bootloader_name = 'px4fmuv4_bl.bin'
self.board_name = 'px4fmu-v4'
self.use_px4io = False
self.romfs_exclude(['oreoled.bin', 'px4io.bin'])
self.romfs_exclude(['oreoled.bin'])

View File

@ -98,23 +98,18 @@ _upload_task = []
@after_method('process_source')
def px4_firmware(self):
global _cp_px4io, _firmware_semaphorish_tasks, _upload_task
version = self.env.get_flat('PX4_VERSION')
board_name = self.env.get_flat('PX4_BOARD_NAME')
px4 = self.bld.cmake('px4')
px4.vars['APM_PROGRAM_LIB'] = self.link_task.outputs[0].abspath()
if self.env.PX4_USE_PX4IO and not _cp_px4io:
if self.env.PX4_PX4IO_NAME and not _cp_px4io:
px4io_task = self.create_cmake_build_task('px4', 'fw_io')
if version == '3':
px4io_version = '2'
else:
px4io_version = version
px4io = px4io_task.cmake.bldnode.make_node(
'src/modules/px4iofirmware/px4io-v%s.bin' % px4io_version,
'src/modules/px4iofirmware/%s.bin' % self.env.PX4_PX4IO_NAME,
)
px4io_elf = px4.bldnode.make_node(
'src/modules/px4iofirmware/px4io-v%s' % px4io_version
'src/modules/px4iofirmware/%s' % self.env.PX4_PX4IO_NAME
)
px4io_task.set_outputs([px4io, px4io_elf])
@ -139,7 +134,7 @@ def px4_firmware(self):
fw_task.set_run_after(t)
_firmware_semaphorish_tasks = []
if self.env.PX4_USE_PX4IO and _cp_px4io.generator is self:
if self.env.PX4_PX4IO_NAME and _cp_px4io.generator is self:
fw_task.set_run_after(_cp_px4io)
firmware = px4.bldnode.make_node(
@ -251,7 +246,7 @@ def configure(cfg):
env.PX4_NUTTX_ROOT = srcpath('modules/PX4NuttX')
env.PX4_UAVCAN_ROOT = srcpath('modules/uavcan')
if env.PX4_USE_PX4IO:
if env.PX4_PX4IO_NAME:
env.PX4IO_ELF_DEST = 'px4-extra-files/px4io'
nuttx_config='nuttx_%s_apm' % board_name
@ -326,7 +321,7 @@ the same directory of their corresponding ELF files.
You can use the option --upload to upload the firmware to the PX4 board if you
have one connected.''')
if bld.env.PX4_USE_PX4IO:
if bld.env.PX4_PX4IO_NAME:
build_summary.text('')
build_summary.text('PX4IO')
summary_data_list = bld.size_summary([bld.env.PX4IO_ELF_DEST])