build: px4: pass board name directly

This commit is contained in:
Lucas De Marchi 2017-01-26 15:06:47 -08:00
parent c81d32a0b2
commit da297d2028
2 changed files with 15 additions and 6 deletions

View File

@ -420,6 +420,7 @@ class px4(Board):
def __init__(self):
self.version = None
self.bootloader_name = None
self.board_name = None
self.use_px4io = True
self.ROMFS_EXCLUDE = []
@ -428,6 +429,8 @@ class px4(Board):
cfg.fatal('configure: px4: version required')
if not self.bootloader_name:
cfg.fatal('configure: px4: bootloader name is required')
if not self.board_name:
cfg.fatal('configure: px4: board name is required')
super(px4, self).configure(cfg)
cfg.load('px4')
@ -462,6 +465,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.AP_PROGRAM_AS_STLIB = True
@ -481,6 +485,7 @@ class px4_v1(px4):
super(px4_v1, self).__init__()
self.version = '1'
self.bootloader_name = 'px4fmu_bl.bin'
self.board_name = 'px4fmu-v1'
self.romfs_exclude(['oreoled.bin'])
class px4_v2(px4):
@ -489,6 +494,7 @@ class px4_v2(px4):
super(px4_v2, self).__init__()
self.version = '2'
self.bootloader_name = 'px4fmuv2_bl.bin'
self.board_name = 'px4fmu-v2'
self.romfs_exclude(['oreoled.bin'])
class px4_v3(px4):
@ -497,6 +503,7 @@ class px4_v3(px4):
super(px4_v3, self).__init__()
self.version = '3'
self.bootloader_name = 'px4fmuv2_bl.bin'
self.board_name = 'px4fmu-v3'
class px4_v4(px4):
name = 'px4-v4'
@ -504,5 +511,6 @@ class px4_v4(px4):
super(px4_v4, self).__init__()
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'])

View File

@ -99,6 +99,7 @@ _upload_task = []
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()
@ -128,7 +129,7 @@ def px4_firmware(self):
fw_task = self.create_cmake_build_task(
'px4',
'build_firmware_px4fmu-v%s' % version,
'build_firmware_%s' % board_name,
)
fw_task.set_run_after(self.link_task)
@ -142,7 +143,7 @@ def px4_firmware(self):
fw_task.set_run_after(_cp_px4io)
firmware = px4.bldnode.make_node(
'src/firmware/nuttx/nuttx-px4fmu-v%s-apm.px4' % version,
'src/firmware/nuttx/nuttx-%s-apm.px4' % board_name,
)
fw_elf = px4.bldnode.make_node(
'src/firmware/nuttx/firmware_nuttx',
@ -236,7 +237,7 @@ def configure(cfg):
def bldpath(path):
return bldnode.make_node(path).abspath()
version = env.get_flat('PX4_VERSION')
board_name = env.get_flat('PX4_BOARD_NAME')
# TODO: we should move stuff from mk/PX4 to Tools/ardupilotwaf/px4 after
# stop using the make-based build system
@ -253,7 +254,7 @@ def configure(cfg):
if env.PX4_USE_PX4IO:
env.PX4IO_ELF_DEST = 'px4-extra-files/px4io'
nuttx_config='nuttx_px4fmu-v%s_apm' % version
nuttx_config='nuttx_%s_apm' % board_name
env.PX4_CMAKE_VARS = dict(
CONFIG=nuttx_config,
@ -285,7 +286,7 @@ def configure(cfg):
)
def build(bld):
version = bld.env.get_flat('PX4_VERSION')
board_name = bld.env.get_flat('PX4_BOARD_NAME')
px4 = bld.cmake(
name='px4',
cmake_src=bld.srcnode.find_dir('modules/PX4Firmware'),
@ -300,7 +301,7 @@ def build(bld):
px4.build(
'prebuild_targets',
group='dynamic_sources',
cmake_output_patterns='px4fmu-v%s/NuttX/nuttx-export/**/*.h' % version,
cmake_output_patterns='%s/NuttX/nuttx-export/**/*.h' % board_name,
)
bld(