Browse Source

HAL_ChibiOS: include hwdef.dat in ROMFS

this allows download via ftp
c415-sdk
Andrew Tridgell 5 years ago
parent
commit
e0957c2bcc
  1. 13
      libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py

13
libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py

@ -97,6 +97,8 @@ imu_list = [] @@ -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): @@ -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): @@ -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) @@ -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"))

Loading…
Cancel
Save