From 7ea2928e528924c4bcda31b45ce84c3dbb2c02fb Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sun, 17 Mar 2024 13:49:07 +1100 Subject: [PATCH] AP_HAL_ChibiOS: allow IOMCU to be turned off in includes --- libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 1a3e5adc22..148cd4277a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -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")