AP_HAL_ChibiOS: embed any bootloader found for a board

This commit is contained in:
Peter Barker 2018-06-27 16:45:44 +10:00 committed by Andrew Tridgell
parent 347fbe4ae0
commit e332bece0f
2 changed files with 20 additions and 2 deletions

View File

@ -939,9 +939,29 @@ def write_GPIO_config(f):
(label, p.port, p.pin))
f.write('\n')
def bootloader_path():
# always embed a bootloader if it is available
this_dir = os.path.realpath(__file__)
rootdir = os.path.relpath(os.path.join(this_dir, "../../../../.."))
hwdef_dirname = os.path.basename(os.path.dirname(args.hwdef))
bootloader_filename = "%s_bl.bin" % (hwdef_dirname,)
bootloader_path = os.path.join(rootdir,
"Tools",
"bootloaders",
bootloader_filename)
if os.path.exists(bootloader_path):
return os.path.realpath(bootloader_path)
return None
def write_ROMFS(outdir):
'''create ROMFS embedded header'''
from embed import create_embedded_h
bp = bootloader_path()
if bp is not None:
romfs.append( ("bootloader.bin", bp) )
create_embedded_h(os.path.join(outdir, 'ap_romfs_embedded.h'), romfs)
def write_prototype_file():

View File

@ -138,5 +138,3 @@ define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_SPARKY2
define STM32_PWM_USE_ADVANCED TRUE
define BOARD_PWM_COUNT_DEFAULT 7
ROMFS bootloader.bin Tools/bootloaders/sparky2_bl.bin