From 7c379452d368bafbbe1fe3cea621295424ced1e1 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Wed, 24 Aug 2016 14:46:34 +0200 Subject: Put reset_reason in .bootinfo. --- bootloader.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bootloader.cpp') diff --git a/bootloader.cpp b/bootloader.cpp index 46ce294..ab99e6b 100644 --- a/bootloader.cpp +++ b/bootloader.cpp @@ -10,7 +10,7 @@ Pin button = GPIOA[3]; Pin led = GPIOA[4]; -static uint32_t& reset_reason = *(uint32_t*)0x10000000; +uint32_t reset_reason __attribute__((section(".bootinfo"))); static const uint32_t* firmware_vtors = (uint32_t*)0x8002000; static bool do_reset; @@ -245,10 +245,10 @@ USB_strings usb_strings(usb); bool normal_boot() { // Check if this was a reset-to-bootloader. - //if(reset_reason == 0xb007) { - // reset_reason = 0; - // return false; - //} + if(reset_reason == 0xb007) { + reset_reason = 0; + return false; + } // Check that reset vector is a valid flash address. uint32_t reset_vector = firmware_vtors[1]; -- cgit v1.2.3