From e11c94602b3c51e275f95efbc625ab4873c2a243 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 Jun 2021 14:24:27 +1000 Subject: [PATCH] HAL_ChibiOS: define HAL_HAVE_HARDWARE_DOUBLE on F765, F777 and H7 --- .../AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py | 4 ++++ .../AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py | 4 ++++ .../AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py | 4 ++++ .../AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 12 ++++++++++++ 4 files changed, 24 insertions(+) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py index 40af97798c..f73162d3dc 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py @@ -42,6 +42,10 @@ mcu = { # this MCU has M7 instructions and hardware double precision 'CORTEX' : 'cortex-m7', 'CPU_FLAGS' : '-mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard', + + 'DEFINES' : { + 'HAL_HAVE_HARDWARE_DOUBLE' : '1' + } } DMA_Map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py index a0f2c9ede1..67d59a4aae 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py @@ -39,6 +39,10 @@ mcu = { # this MCU has M7 instructions and hardware double precision 'CORTEX' : 'cortex-m7', 'CPU_FLAGS' : '-mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard', + + 'DEFINES' : { + 'HAL_HAVE_HARDWARE_DOUBLE' : '1' + } } DMA_Map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py index 5fe36da577..1eacf9ec89 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py @@ -39,6 +39,10 @@ mcu = { # this MCU has M7 instructions and hardware double precision 'CORTEX' : 'cortex-m7', 'CPU_FLAGS' : '-mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard', + + 'DEFINES' : { + 'HAL_HAVE_HARDWARE_DOUBLE' : '1' + } } pincount = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 373ba80957..d74d9a020d 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -712,6 +712,12 @@ def write_mcu_config(f): if 'OTG2' in bytype: f.write('#define STM32_USB_USE_OTG2 TRUE\n') + defines = get_mcu_config('DEFINES', False) + if defines is not None: + for d in defines.keys(): + v = defines[d] + f.write("#ifndef %s\n#define %s %s\n#endif\n" % (d, d, v)) + if get_config('PROCESS_STACK', required=False): env_vars['PROCESS_STACK'] = get_config('PROCESS_STACK') else: @@ -812,6 +818,12 @@ def write_mcu_config(f): env_vars['CPU_FLAGS'] = ["-mcpu=%s" % cortex, "-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"] build_info['MCU'] = cortex + f.write(''' +#ifndef HAL_HAVE_HARDWARE_DOUBLE +#define HAL_HAVE_HARDWARE_DOUBLE 0 +#endif +''') + if get_mcu_config('EXPECTED_CLOCK'): f.write('#define HAL_EXPECTED_SYSCLOCK %u\n' % get_mcu_config('EXPECTED_CLOCK'))