HAL_ChibiOS: include hwdef.dat in ROMFS

this allows download via ftp
This commit is contained in:
Andrew Tridgell 2020-03-12 16:31:15 +11:00
parent c1d4a5bd35
commit e0957c2bcc

View File

@ -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"))