From e0957c2bccc3cc4ced7220341b77238830960c56 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 12 Mar 2020 16:31:15 +1100 Subject: [PATCH] HAL_ChibiOS: include hwdef.dat in ROMFS this allows download via ftp --- .../AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 252d9fcfb0..939a600860 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -97,6 +97,8 @@ imu_list = [] compass_list = [] baro_list = [] +all_lines = [] + mcu_type = None dual_USB_enabled = False @@ -1586,6 +1588,13 @@ def write_alt_config(f): f.write(" { %u, %s, PAL_LINE(GPIO%s,%uU)}, /* %s */ \\\n" % (alt, p.pal_modeline(), p.port, p.pin, str(p))) f.write('}\n\n') +def write_all_lines(hwdat): + f = open(hwdat, 'w') + f.write('\n'.join(all_lines)) + f.close() + flash_size = get_config('FLASH_SIZE_KB', type=int) + if flash_size > 1024: + romfs["hwdef.dat"] = hwdat def write_hwdef_header(outfilename): '''write hwdef header file''' @@ -1833,6 +1842,7 @@ def process_line(line): '''process one line of pin definition file''' global allpins, imu_list, compass_list, baro_list global mcu_type, mcu_series + all_lines.append(line) a = shlex.split(line) # keep all config lines for later use alllines.append(line) @@ -1973,6 +1983,9 @@ print("Setup for MCU %s" % mcu_type) # build a list for peripherals for DMA resolver periph_list = build_peripheral_list() +# write out hw.dat for ROMFS +write_all_lines(os.path.join(outdir, "hw.dat")) + # write out hwdef.h write_hwdef_header(os.path.join(outdir, "hwdef.h"))