From c8806acaf5d16a3f1df6312844a995e669c0fd83 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 25 Jul 2019 19:13:26 +1000 Subject: [PATCH] HAL_ChibiOS: use AP_PERIPH env var --- libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef-bl.dat | 3 +++ libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef.dat | 3 +++ libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef-bl.dat index 5d46b5ab96..4cfa488fc1 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef-bl.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef-bl.dat @@ -9,6 +9,9 @@ FLASH_BOOTLOADER_LOAD_KB 25 # board ID for firmware load APJ_BOARD_ID 3 +# setup build for a peripheral firmware +env AP_PERIPH 1 + # crystal frequency OSCILLATOR_HZ 8000000 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef.dat index 033f5bdb13..f66aa02eed 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/f103-periph/hwdef.dat @@ -13,6 +13,9 @@ define HAL_STORAGE_SIZE 800 # board ID for firmware load APJ_BOARD_ID 3 +# setup build for a peripheral firmware +env AP_PERIPH 1 + # crystal frequency OSCILLATOR_HZ 8000000 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index ccca3ee7ff..99391969c6 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -551,7 +551,7 @@ def write_mcu_config(f): f.write('#define HAL_USE_SERIAL_USB TRUE\n') if 'OTG2' in bytype: f.write('#define STM32_USB_USE_OTG2 TRUE\n') - if have_type_prefix('CAN') and not mcu_series.startswith("STM32F1"): + if have_type_prefix('CAN') and not 'AP_PERIPH' in env_vars: enable_can(f) if get_config('PROCESS_STACK', required=False):