AP_HAL_ChibiOS: allow IOMCU to be turned off in includes

This commit is contained in:
Peter Barker 2024-03-17 13:49:07 +11:00 committed by Peter Barker
parent 40dd8139eb
commit 7ea2928e52
1 changed files with 6 additions and 1 deletions

View File

@ -1856,7 +1856,7 @@ INCLUDE common.ld
if 'io_firmware.bin' not in self.romfs:
self.error("Need io_firmware.bin in ROMFS for IOMCU")
f.write('#define HAL_WITH_IO_MCU 1\n')
self.write_defaulting_define(f, 'HAL_WITH_IO_MCU', 1)
f.write('#define HAL_UART_IOMCU_IDX %u\n' % len(serial_list))
f.write(
'#define HAL_UART_IO_DRIVER ChibiOS::UARTDriver uart_io(HAL_UART_IOMCU_IDX)\n'
@ -2525,6 +2525,11 @@ Please run: Tools/scripts/build_bootloaders.py %s
if not self.is_periph_fw():
self.romfs["hwdef.dat"] = hwdat
def write_defaulting_define(self, f, name, value):
f.write(f"#ifndef {name}\n")
f.write(f"#define {name} {value}\n")
f.write("#endif\n")
def write_define(self, f, name, value):
f.write(f"#define {name} {value}\n")