From ad9ec1de55268ac339144cc110d9185777f0a7f2 Mon Sep 17 00:00:00 2001 From: Delio Brignoli Date: Sun, 14 Jan 2018 17:22:44 +0100 Subject: [PATCH] Pin uint16_t bootloader_magic_key at the MAGIC_KEY_POS location to prevent magic key overwrite --- src/Arduboy2Core.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Arduboy2Core.cpp b/src/Arduboy2Core.cpp index cb6167a..6e02fa6 100644 --- a/src/Arduboy2Core.cpp +++ b/src/Arduboy2Core.cpp @@ -6,6 +6,10 @@ #include "Arduboy2Core.h" +// Reserve the location of the bootloader's magic key +// so it cannot be overwritten by program variables +uint16_t bootloader_magic_key __attribute__((used)) __attribute__((address(MAGIC_KEY_POS))); + const uint8_t PROGMEM lcdBootProgram[] = { // boot defaults are commented out but left here in case they // might prove useful for reference