waf: create abin files for some px4 builds

needed for skyviper web UI upload
This commit is contained in:
Andrew Tridgell 2018-02-08 18:12:33 +11:00
parent 507fcb0f27
commit 36695fe1f6
3 changed files with 26 additions and 1 deletions

View File

@ -811,6 +811,7 @@ class skyviper_v2450_px4(px4_v3):
LAND_DETECTOR_ACCEL_MAX = 2
)
env.PX4_RC_S_SCRIPT = 'init.d/rcS_no_microSD'
env.BUILD_ABIN = True
class px4_v4(px4):
name = 'px4-v4'

View File

@ -63,7 +63,7 @@ class generate_fw(Task.Task):
run_str='${OBJCOPY} -O binary ${SRC} ${SRC}.bin && \
python ${UPLOAD_TOOLS}/px_mkfw.py --image ${SRC}.bin \
--prototype ${BUILDROOT}/apj.prototype > ${TGT} && \
${CHIBIOS_SCRIPTS}/make_abin.sh ${SRC}.bin ${SRC}.abin'
${TOOLS_SCRIPTS}/make_abin.sh ${SRC}.bin ${SRC}.abin'
always_run = True
def keyword(self):
return "Generating"
@ -117,6 +117,7 @@ def configure(cfg):
env.PT_DIR = srcpath('Tools/ardupilotwaf/chibios/image')
env.UPLOAD_TOOLS = srcpath('Tools/ardupilotwaf')
env.CHIBIOS_SCRIPTS = srcpath('libraries/AP_HAL_ChibiOS/hwdef/scripts')
env.TOOLS_SCRIPTS = srcpath('Tools/scripts')
env.APJ_TOOL = srcpath('Tools/scripts/apj_tool.py')
env.SERIAL_PORT = srcpath('/dev/serial/by-id/*_STLink*')

View File

@ -72,6 +72,24 @@ class px4_copy(Task.Task):
def __str__(self):
return self.outputs[0].path_from(self.generator.bld.bldnode)
class create_abin(Task.Task):
'''create an abin file - used for uploading to a skyviper'''
color = 'CYAN'
def run(self):
from subprocess import call
elf_name = self.inputs[0].abspath()
bin_name = elf_name + ".bin"
abin_name = self.outputs[0].abspath()
call(['arm-none-eabi-objcopy', '-Obinary', elf_name, bin_name])
call(['Tools/scripts/make_abin.sh', bin_name, abin_name])
def keyword(self):
return "Creating abin for %s to" % self.inputs[0].name
def __str__(self):
return self.outputs[0].path_from(self.generator.bld.bldnode)
class px4_add_git_hashes(Task.Task):
run_str = '${PYTHON} ${PX4_ADD_GIT_HASHES} --ardupilot ${PX4_APM_ROOT} --px4 ${PX4_ROOT} --nuttx ${PX4_NUTTX_ROOT} ${SRC} ${TGT}'
color = 'CYAN'
@ -159,6 +177,11 @@ def px4_firmware(self):
cp_elf.set_run_after(fw_task)
_firmware_semaphorish_tasks.append(cp_elf)
if self.env.BUILD_ABIN:
fw_abin_dest = self.bld.bldnode.make_node(os.path.join(self.program_dir, self.program_name + '.abin'))
create_abin = self.create_task('create_abin', fw_elf, fw_abin_dest)
create_abin.set_run_after(fw_task)
self.build_summary = dict(
target=self.name,
binary=fw_elf_dest.path_from(self.bld.bldnode),