aboutsummaryrefslogtreecommitdiff
path: root/src/modules/systemlib/systemlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/systemlib/systemlib.c')
-rw-r--r--src/modules/systemlib/systemlib.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/modules/systemlib/systemlib.c b/src/modules/systemlib/systemlib.c
index 96276b56a..57a751e1c 100644
--- a/src/modules/systemlib/systemlib.c
+++ b/src/modules/systemlib/systemlib.c
@@ -50,9 +50,19 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <stm32_pwr.h>
+
#include "systemlib.h"
-__EXPORT extern void systemreset(void) {
+void
+systemreset(bool to_bootloader)
+{
+ if (to_bootloader) {
+ stm32_pwr_enablebkp();
+
+ /* XXX wow, this is evil - write a magic number into backup register zero */
+ *(uint32_t *)0x40002850 = 0xb007b007;
+ }
up_systemreset();
}