summaryrefslogtreecommitdiff
path: root/ports/stm32/main.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-03-22 16:38:49 +1100
committerDamien George <damien@micropython.org>2023-06-15 11:09:20 +1000
commit61339aa5062577ca1c75cb2443c78e5b5965c30b (patch)
tree037c0081d35ee4ac14614ec777b7d16828f5677f /ports/stm32/main.c
parentbd7196e1233a7c36fbd8be8fea71eaaad4fb62fa (diff)
stm32: Add initial support for H5 MCUs.
This commit adds initial support for STM32H5xx MCUs. The following features have been confirmed to be working on an STM32H573: - UART over REPL and USB CDC - USB CDC and MSC - internal flash filesystem - machine.Pin - machine.SPI transfers with DMA - machine.ADC - machine.RTC - pyb.LED - pyb.Switch - pyb.rng - mboot Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/stm32/main.c')
-rw-r--r--ports/stm32/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ports/stm32/main.c b/ports/stm32/main.c
index 15be21d48..2235e4de3 100644
--- a/ports/stm32/main.c
+++ b/ports/stm32/main.c
@@ -306,8 +306,10 @@ void stm32_main(uint32_t reset_mode) {
SCB->VTOR = MICROPY_HW_VTOR;
#endif
+ #if __CORTEX_M != 33
// Enable 8-byte stack alignment for IRQ handlers, in accord with EABI
SCB->CCR |= SCB_CCR_STKALIGN_Msk;
+ #endif
// Hook for a board to run code at start up, for example check if a
// bootloader should be entered instead of the main application.
@@ -336,6 +338,10 @@ void stm32_main(uint32_t reset_mode) {
SCB_EnableICache();
SCB_EnableDCache();
+ #elif defined(STM32H5)
+
+ HAL_ICACHE_Enable();
+
#elif defined(STM32L4)
#if !INSTRUCTION_CACHE_ENABLE
@@ -387,6 +393,13 @@ void stm32_main(uint32_t reset_mode) {
MICROPY_BOARD_EARLY_INIT();
// basic sub-system init
+ #if defined(STM32H5)
+ volatile uint32_t *src = (volatile uint32_t *)UID_BASE;
+ uint32_t *dest = (uint32_t *)&mp_hal_unique_id_address[0];
+ dest[0] = src[0];
+ dest[1] = src[1];
+ dest[2] = src[2];
+ #endif
#if defined(STM32WB)
rfcore_init();
#endif