From c2746ca9f90a9e2c7a6c1ba32d4b1b40b14e0a73 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 4 Feb 2019 12:41:00 +1100 Subject: [PATCH] HAL_ChibiOS: simplify H7 hwdef.dat --- .../hwdef/NucleoH743/hwdef-bl.dat | 8 +--- .../AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef.dat | 6 --- .../hwdef/Pixhawk4Pro/hwdef-bl.dat | 41 +++++++++++++++++++ .../hwdef/Pixhawk4Pro/hwdef.dat | 41 +++++++++++++++++++ .../hwdef/common/stm32h7_mcuconf.h | 21 ++++++++++ 5 files changed, 104 insertions(+), 13 deletions(-) create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Pixhawk4Pro/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Pixhawk4Pro/hwdef.dat diff --git a/libraries/AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef-bl.dat index b45307472f..dd219a87aa 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef-bl.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef-bl.dat @@ -7,18 +7,12 @@ MCU STM32H7xx STM32H743xx # crystal frequency OSCILLATOR_HZ 8000000 -define STM32_LSEDRV (3U << 3U) define STM32_HSE_BYPASS -define STM32_LSECLK 32768 -define STM32_PLL1_DIVM_VALUE 4 -define STM32_PLL2_DIVM_VALUE 4 -define STM32_PLL3_DIVM_VALUE 8 - # board ID for firmware load APJ_BOARD_ID 139 -FLASH_SIZE_KB 2048 +FLASH_SIZE_KB 1920 # bootloader is installed at zero offset FLASH_RESERVE_START_KB 0 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef.dat index c6069f607e..94cd852dbd 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/NucleoH743/hwdef.dat @@ -7,14 +7,8 @@ MCU STM32H7xx STM32H743xx # crystal frequency OSCILLATOR_HZ 8000000 -define STM32_LSEDRV (3U << 3U) define STM32_HSE_BYPASS -define STM32_LSECLK 32768 -define STM32_PLL1_DIVM_VALUE 4 -define STM32_PLL2_DIVM_VALUE 4 -define STM32_PLL3_DIVM_VALUE 8 - # board ID for firmware load APJ_BOARD_ID 139 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk4Pro/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk4Pro/hwdef-bl.dat new file mode 100644 index 0000000000..700355e88e --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk4Pro/hwdef-bl.dat @@ -0,0 +1,41 @@ +# hw definition file for processing by chibios_hwdef.py +# for F743 bootloader + +# MCU class and specific type +MCU STM32H7xx STM32H743xx + +# crystal frequency +OSCILLATOR_HZ 16000000 + +# board ID for firmware load +APJ_BOARD_ID 139 + +FLASH_SIZE_KB 2048 + +# bootloader is installed at zero offset +FLASH_RESERVE_START_KB 0 + +# the location where the bootloader will put the firmware +# the H743 has 128k sectors +define FLASH_BOOTLOADER_LOAD_KB 128 + +PB1 LED_RED OUTPUT LOW # red +PC6 LED_ACTIVITY OUTPUT LOW # green +PC7 LED_BOOTLOADER OUTPUT LOW # blue + +define HAL_LED_ON 0 + +# board voltage +STM32_VDD 330U + +# order of UARTs (and USB) +UART_ORDER OTG1 + +PA11 OTG_FS_DM OTG1 +PA12 OTG_FS_DP OTG1 + +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +define HAL_USE_EMPTY_STORAGE 1 +define HAL_STORAGE_SIZE 16384 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk4Pro/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk4Pro/hwdef.dat new file mode 100644 index 0000000000..51039f7250 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk4Pro/hwdef.dat @@ -0,0 +1,41 @@ +# hw definition file for processing by chibios_hwdef.py +# for F743 bootloader + +# MCU class and specific type +MCU STM32H7xx STM32H743xx + +# crystal frequency +OSCILLATOR_HZ 16000000 + +# board ID for firmware load +APJ_BOARD_ID 139 + +FLASH_SIZE_KB 2048 + +# bootloader is installed at zero offset +FLASH_RESERVE_START_KB 0 + +# the location where the bootloader will put the firmware +# the H743 has 128k sectors +define FLASH_BOOTLOADER_LOAD_KB 128 + +PB1 LED_RED OUTPUT LOW # red +PC6 LED_ACTIVITY OUTPUT HIGH # green +PC7 LED_BOOTLOADER OUTPUT HIGH # blue + +define HAL_LED_ON 0 + +# board voltage +STM32_VDD 330U + +# order of UARTs (and USB) +UART_ORDER OTG1 + +PA11 OTG_FS_DM OTG1 +PA12 OTG_FS_DP OTG1 + +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +define HAL_USE_EMPTY_STORAGE 1 +define HAL_STORAGE_SIZE 16384 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/stm32h7_mcuconf.h b/libraries/AP_HAL_ChibiOS/hwdef/common/stm32h7_mcuconf.h index a7c34ea5fb..b86b1541c8 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/stm32h7_mcuconf.h +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/stm32h7_mcuconf.h @@ -18,6 +18,27 @@ */ #pragma once + +#ifndef STM32_LSECLK +#define STM32_LSECLK 32768U +#endif + +#ifndef STM32_LSEDRV +#define STM32_LSEDRV (3U << 3U) +#endif + +#ifndef STM32_PLL1_DIVM_VALUE +#define STM32_PLL1_DIVM_VALUE (STM32_HSECLK / 2000000U) +#endif + +#ifndef STM32_PLL2_DIVM_VALUE +#define STM32_PLL2_DIVM_VALUE (STM32_HSECLK / 2000000U) +#endif + +#ifndef STM32_PLL3_DIVM_VALUE +#define STM32_PLL3_DIVM_VALUE (STM32_HSECLK / 1000000U) +#endif + /* * General settings. */