2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
25 #include "drivers/accgyro/accgyro_mpu.h"
26 #include "drivers/persistent.h"
27 #include "drivers/exti.h"
28 #include "drivers/nvic.h"
29 #include "drivers/system.h"
31 void forcedSystemResetWithoutDisablingCaches(void)
33 persistentObjectWrite(PERSISTENT_OBJECT_RESET_REASON
, RESET_NONE
);
38 void enableGPIOPowerUsageAndNoiseReductions(void)
40 __HAL_RCC_SYSCFG_CLK_ENABLE();
41 __HAL_RCC_D2SRAM1_CLK_ENABLE();
42 __HAL_RCC_D2SRAM2_CLK_ENABLE();
43 __HAL_RCC_D2SRAM3_CLK_ENABLE();
46 bool isMPUSoftReset(void)
48 if (cachedRccCsrValue
& RCC_RSR_SFTRSTF
)
54 uint32_t systemBootloaderAddress(void)
56 #if defined(STM32H743xx) || defined(STM32H750xx) || defined(STM32H723xx) || defined(STM32H725xx)
65 checkForBootLoaderRequest();
67 // Configure NVIC preempt/priority groups
68 HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITY_GROUPING
);
70 // cache RCC->CSR value to use it in isMPUSoftreset() and others
71 cachedRccCsrValue
= RCC
->CSR
;
73 enableGPIOPowerUsageAndNoiseReductions();
79 HAL_SYSTICK_Config(SystemCoreClock
/ 1000);
80 HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK
);