From e56b63fd7e4400b8c6bca5d42d53dd6786f2a293 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 18 Dec 2021 20:02:31 -0500 Subject: [PATCH] stm32: Reorganize stm32h7.c into major code blocks Signed-off-by: Kevin O'Connor --- src/stm32/stm32h7.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/stm32/stm32h7.c b/src/stm32/stm32h7.c index 1a637e79..cd5ed0c6 100644 --- a/src/stm32/stm32h7.c +++ b/src/stm32/stm32h7.c @@ -4,15 +4,17 @@ // // This file may be distributed under the terms of the GNU GPLv3 license. - -// I2C is not supported - #include "autoconf.h" // CONFIG_CLOCK_REF_FREQ #include "board/armcm_boot.h" // VectorTable #include "command.h" // DECL_CONSTANT_STR #include "internal.h" // enable_pclock #include "sched.h" // sched_main + +/**************************************************************** + * Clock setup + ****************************************************************/ + #define FREQ_PERIPH (CONFIG_CLOCK_FREQ / 4) // Enable a peripheral clock @@ -101,12 +103,6 @@ gpio_clock_enable(GPIO_TypeDef *regs) enable_pclock((uint32_t)regs); } -// Handle USB reboot requests -void -usb_request_bootloader(void) -{ -} - #if !CONFIG_STM32_CLOCK_REF_INTERNAL DECL_CONSTANT_STR("RESERVE_PINS_crystal", "PH0,PH1"); #endif @@ -224,13 +220,28 @@ clock_setup(void) } } + +/**************************************************************** + * USB bootloader + ****************************************************************/ + +// Handle USB reboot requests +void +usb_request_bootloader(void) +{ +} + + +/**************************************************************** + * Startup + ****************************************************************/ + // Main entry point - called from armcm_boot.c:ResetHandler() void armcm_main(void) { // Run SystemInit() and then restore VTOR SystemInit(); - SCB->VTOR = (uint32_t)VectorTable; clock_setup();