From 96518c9eda51b7a22f2065d9e0444b23f1086980 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 21 Feb 2022 19:28:29 +1100 Subject: [PATCH] HAL_ChibiOS: added CPU defines to hwdef needed for checks like defined(STM32F1) --- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F100xB.py | 6 +++++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F103xB.py | 6 +++++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F105xC.py | 7 ++++++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F303xC.py | 7 ++++++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F405xx.py | 7 ++++++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F407xx.py | 7 ++++++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F412Rx.py | 5 +++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F427xx.py | 6 +++++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F469xx.py | 7 ++++++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F732xx.py | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F745xx.py | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py | 3 ++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py | 3 ++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G431xx.py | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G441xx.py | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G474xx.py | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G491xx.py | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py | 3 ++- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H750xx.py | 5 +++-- libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H757xx.py | 5 +++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L431xx.py | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L476xx.py | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L496xx.py | 4 ++++ 23 files changed, 100 insertions(+), 13 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F100xB.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F100xB.py index 40b5896611..3e2702c20a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F100xB.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F100xB.py @@ -29,7 +29,11 @@ mcu = { (0x20000000, 8, 1), # main memory, DMA safe ], - 'EXPECTED_CLOCK' : 24000000 + 'EXPECTED_CLOCK' : 24000000, + + 'DEFINES' : { + 'STM32F1' : '1', + } } ADC1_map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F103xB.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F103xB.py index ba77cd5049..79fbeaa5fc 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F103xB.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F103xB.py @@ -26,7 +26,11 @@ mcu = { (0x20000000, 20, 1), # main memory, DMA safe ], - 'EXPECTED_CLOCK' : 72000000 + 'EXPECTED_CLOCK' : 72000000, + + 'DEFINES' : { + 'STM32F1' : '1', + } } ADC1_map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F105xC.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F105xC.py index 669fd2a1a4..7713c8278f 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F105xC.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F105xC.py @@ -25,7 +25,12 @@ mcu = { (0x20000000, 64, 1), # main memory, DMA safe ], - 'EXPECTED_CLOCK' : 72000000 + 'EXPECTED_CLOCK' : 72000000, + + 'DEFINES' : { + 'STM32F1' : '1', + } + } ADC1_map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F303xC.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F303xC.py index 41c02844b5..c2cace3c75 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F303xC.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F303xC.py @@ -20,7 +20,12 @@ mcu = { (0x10000000, 8, 2), # CCM memory, faster, but not DMA safe ], - 'EXPECTED_CLOCK' : 72000000 + 'EXPECTED_CLOCK' : 72000000, + + 'DEFINES' : { + 'STM32F3' : '1', + } + } AltFunction_map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F405xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F405xx.py index 771362d4c9..9816a57372 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F405xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F405xx.py @@ -20,7 +20,12 @@ mcu = { (0x10000000, 64, 2), # CCM memory, faster, but not DMA safe ], - 'EXPECTED_CLOCK' : 168000000 + 'EXPECTED_CLOCK' : 168000000, + + 'DEFINES' : { + 'STM32F4' : '1', + } + } AltFunction_map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F407xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F407xx.py index 3bfea70ee3..dcfff684d3 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F407xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F407xx.py @@ -20,7 +20,12 @@ mcu = { (0x10000000, 64, 2), # CCM memory, faster, but not DMA safe ], - 'EXPECTED_CLOCK' : 168000000 + 'EXPECTED_CLOCK' : 168000000, + + 'DEFINES' : { + 'STM32F4' : '1', + } + } DMA_Map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F412Rx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F412Rx.py index 0d8597f2ec..aea174c867 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F412Rx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F412Rx.py @@ -20,6 +20,11 @@ mcu = { ], 'EXPECTED_CLOCK' : 100000000, + + 'DEFINES' : { + 'STM32F4' : '1', + } + } DMA_Map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F427xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F427xx.py index 339b8caaa1..33d5929fac 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F427xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F427xx.py @@ -20,7 +20,11 @@ mcu = { (0x10000000, 64, 2), # CCM memory, faster, but not DMA safe ], - 'EXPECTED_CLOCK' : 168000000 + 'EXPECTED_CLOCK' : 168000000, + + 'DEFINES' : { + 'STM32F4' : '1', + } } DMA_Map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F469xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F469xx.py index b9cde287a1..2997997a40 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F469xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F469xx.py @@ -33,7 +33,12 @@ mcu = { (0x10000000, 64, 1), # CCM memory, faster, not DMA safe ], - 'EXPECTED_CLOCK' : 180000000 + 'EXPECTED_CLOCK' : 180000000, + + 'DEFINES' : { + 'STM32F4' : '1', + } + } DMA_Map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F732xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F732xx.py index f510de7bd9..9469b406fc 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F732xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F732xx.py @@ -24,6 +24,10 @@ mcu = { 'EXPECTED_CLOCK' : 216000000, + 'DEFINES' : { + 'STM32F7' : '1', + }, + # this board has M7 instructions, but single precision only FPU # we build as m4 as it makes for a smaller build, and given the 1M # flash limit we care more about size diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F745xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F745xx.py index 748e6153a7..082115776a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F745xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F745xx.py @@ -22,6 +22,10 @@ mcu = { 'EXPECTED_CLOCK' : 216000000, + 'DEFINES' : { + 'STM32F7' : '1', + }, + # this board has M7 instructions, but single precision only FPU # we build as m4 as it makes for a smaller build, and given the 1M # flash limit we care more about size diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py index f73162d3dc..02522932e8 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py @@ -44,7 +44,8 @@ mcu = { 'CPU_FLAGS' : '-mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard', 'DEFINES' : { - 'HAL_HAVE_HARDWARE_DOUBLE' : '1' + 'HAL_HAVE_HARDWARE_DOUBLE' : '1', + 'STM32F7' : '1', } } diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py index fbc95bd1ae..28174fc5cd 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F777xx.py @@ -41,7 +41,8 @@ mcu = { 'CPU_FLAGS' : '-mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard', 'DEFINES' : { - 'HAL_HAVE_HARDWARE_DOUBLE' : '1' + 'HAL_HAVE_HARDWARE_DOUBLE' : '1', + 'STM32F7' : '1', } } diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G431xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G431xx.py index d02c58739a..cd45083a7a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G431xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G431xx.py @@ -21,6 +21,10 @@ mcu = { ], 'EXPECTED_CLOCK' : 168000000, + + 'DEFINES' : { + 'STM32G4' : '1', + } } # max pin package is 128 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G441xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G441xx.py index e9f70a62de..3fd6cb7861 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G441xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G441xx.py @@ -21,6 +21,10 @@ mcu = { ], 'EXPECTED_CLOCK' : 168000000, + + 'DEFINES' : { + 'STM32G4' : '1', + } } # max pin package is 128 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G474xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G474xx.py index fca8d19edd..2c496bcb39 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G474xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G474xx.py @@ -21,6 +21,10 @@ mcu = { ], 'EXPECTED_CLOCK' : 168000000, + + 'DEFINES' : { + 'STM32G4' : '1', + } } # max pin package is 128 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G491xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G491xx.py index aa3052c1ef..c7733ebab9 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G491xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32G491xx.py @@ -21,6 +21,10 @@ mcu = { ], 'EXPECTED_CLOCK' : 168000000, + + 'DEFINES' : { + 'STM32G4' : '1', + } } # max pin package is 128 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py index a5fee9e302..90323a9106 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py @@ -54,7 +54,8 @@ mcu = { 'DEFINES' : { 'HAL_HAVE_HARDWARE_DOUBLE' : '1', - 'HAL_WITH_MCU_MONITORING' : '1' + 'HAL_WITH_MCU_MONITORING' : '1', + 'STM32H7' : '1', } } diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H750xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H750xx.py index e85faae940..1d7d9ac433 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H750xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H750xx.py @@ -68,8 +68,9 @@ mcu = { 'CPU_FLAGS' : '-mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard', 'DEFINES' : { - 'HAL_HAVE_HARDWARE_DOUBLE' : '1' - } + 'HAL_HAVE_HARDWARE_DOUBLE' : '1', + 'STM32H7' : '1', + } } pincount = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H757xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H757xx.py index c5db294e43..53b571e560 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H757xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H757xx.py @@ -66,6 +66,11 @@ 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', + 'STM32H7' : '1', + } } pincount = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L431xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L431xx.py index c8fb76610b..7d2c265a5e 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L431xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L431xx.py @@ -35,6 +35,10 @@ mcu = { ], 'EXPECTED_CLOCK' : 80000000, + + 'DEFINES' : { + 'STM32L4' : '1', + } } DMA_Map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L476xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L476xx.py index f7afbf2aaa..80403e64f2 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L476xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L476xx.py @@ -36,6 +36,10 @@ mcu = { ], 'EXPECTED_CLOCK' : 80000000, + + 'DEFINES' : { + 'STM32L4' : '1', + } } DMA_Map = { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L496xx.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L496xx.py index 0c470015f6..417d4ec05b 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L496xx.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L496xx.py @@ -36,6 +36,10 @@ mcu = { ], 'EXPECTED_CLOCK' : 80000000, + + 'DEFINES' : { + 'STM32L4' : '1', + } } DMA_Map = {