From 2ba4bf14789638d0cf299a519d061d199efbfe87 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 17 Nov 2023 06:17:22 +1100 Subject: [PATCH] HAL_ChibiOS: allow for --disable-networking --- .../hwdef/scripts/chibios_hwdef.py | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 5730f68585304c..6552630754f094 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -965,18 +965,19 @@ def write_mcu_config(self, f): f.write('#define STM32_USB_USE_OTG2 TRUE\n') if 'ETH1' in self.bytype: - f.write('// Configure for Ethernet support\n') - f.write('#define CH_CFG_USE_MAILBOXES TRUE\n') - f.write('#define HAL_USE_MAC TRUE\n') - f.write('#define MAC_USE_EVENTS TRUE\n') - f.write('#define STM32_ETH_BUFFERS_EXTERN\n') - f.write('#define AP_NETWORKING_ENABLED TRUE\n') self.build_flags.append('USE_LWIP=yes') - self.env_vars['WITH_NETWORKING'] = True - else: - f.write('#define AP_NETWORKING_ENABLED FALSE\n') - self.build_flags.append('USE_LWIP=no') - self.env_vars['WITH_NETWORKING'] = False + f.write(''' + +#ifndef AP_NETWORKING_ENABLED +// Configure for Ethernet support +#define AP_NETWORKING_ENABLED 1 +#define CH_CFG_USE_MAILBOXES TRUE +#define HAL_USE_MAC TRUE +#define MAC_USE_EVENTS TRUE +#define STM32_ETH_BUFFERS_EXTERN +#endif + +''') defines = self.get_mcu_config('DEFINES', False) if defines is not None: