From 79452fff85b68d79fbd2e33226d9623713782454 Mon Sep 17 00:00:00 2001 From: jflyper Date: Thu, 18 Jul 2019 12:22:20 +0900 Subject: [PATCH] [F1] Update boot loader request related --- src/main/drivers/system_stm32f10x.c | 38 +++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/main/drivers/system_stm32f10x.c b/src/main/drivers/system_stm32f10x.c index 8bc4b506b5..64afceed6c 100644 --- a/src/main/drivers/system_stm32f10x.c +++ b/src/main/drivers/system_stm32f10x.c @@ -37,8 +37,10 @@ void systemReset(void) SCB->AIRCR = AIRCR_VECTKEY_MASK | (uint32_t)0x04; } -void systemResetToBootloader(void) +void systemResetToBootloader(bootloaderRequestType_e requestType) { + UNUSED(requestType); + // 1FFFF000 -> 20000200 -> SP // 1FFFF004 -> 1FFFF021 -> PC @@ -46,6 +48,23 @@ void systemResetToBootloader(void) systemReset(); } +static void checkForBootLoaderRequest(void) +{ + void(*bootJump)(void); + + if (*((uint32_t *)0x20004FF0) == 0xDEADBEEF) { + + *((uint32_t *)0x20004FF0) = 0x0; + + __enable_irq(); + __set_MSP(*((uint32_t *)0x1FFFF000)); + + bootJump = (void(*)(void))(*((uint32_t *) 0x1FFFF004)); + bootJump(); + while (1); + } +} + void enableGPIOPowerUsageAndNoiseReductions(void) { RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE); @@ -113,20 +132,3 @@ void systemInit(void) // SysTick SysTick_Config(SystemCoreClock / 1000); } - -static void checkForBootLoaderRequest(void) -{ - void(*bootJump)(void); - - if (*((uint32_t *)0x20004FF0) == 0xDEADBEEF) { - - *((uint32_t *)0x20004FF0) = 0x0; - - __enable_irq(); - __set_MSP(*((uint32_t *)0x1FFFF000)); - - bootJump = (void(*)(void))(*((uint32_t *) 0x1FFFF004)); - bootJump(); - while (1); - } -}