mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Start to break up drv/system.c to avoid #ifdef.
This commit is contained in:
parent
c7cd7adee9
commit
d407a4d15e
4 changed files with 44 additions and 20 deletions
20
src/main/drivers/system_stm32f10x.c
Normal file
20
src/main/drivers/system_stm32f10x.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000)
|
||||
|
||||
void systemReset(bool toBootloader)
|
||||
{
|
||||
if (toBootloader) {
|
||||
// 1FFFF000 -> 20000200 -> SP
|
||||
// 1FFFF004 -> 1FFFF021 -> PC
|
||||
|
||||
*((uint32_t *)0x20004FF0) = 0xDEADBEEF; // 20KB STM32F103
|
||||
}
|
||||
|
||||
// Generate system reset
|
||||
SCB->AIRCR = AIRCR_VECTKEY_MASK | (uint32_t)0x04;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue