From 2842730868c6cb97285acdc2373f51350f101d4e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Mar 2021 15:53:44 +1100 Subject: [PATCH] HAL_ChibiOS: fixed F3 CAN build --- libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 5 ++++- 1 file changed, 4 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 d7371a16df..573de6e53c 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -632,7 +632,7 @@ def enable_can(f): else: can_order = [] for i in range(1,3): - if 'CAN%u' % i in bytype: + if 'CAN%u' % i in bytype or (i == 1 and 'CAN' in bytype): can_order.append(i) base_list = [] @@ -648,6 +648,9 @@ def enable_can(f): f.write('#define HAL_CAN_INTERFACE_REV_LIST %s\n' % ','.join([str(i) for i in can_rev_order])) f.write('#define HAL_CAN_BASE_LIST %s\n' % ','.join(base_list)) f.write('#define HAL_NUM_CAN_IFACES %d\n' % len(base_list)) + global mcu_type + if 'CAN' in bytype and mcu_type.startswith("STM32F3"): + f.write('#define CAN1_BASE CAN_BASE\n') env_vars['HAL_NUM_CAN_IFACES'] = str(len(base_list))