aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/USBCore.h
diff options
context:
space:
mode:
authorMartino Facchin <m.facchin@arduino.cc>2016-05-18 14:23:40 +0200
committerMartino Facchin <m.facchin@arduino.cc>2016-05-18 14:23:40 +0200
commitcc4ddc358716f9a73205aed4e7726e0cd156b500 (patch)
tree42173dc1e69d78594aa8292072a221dbffc63fe8 /cores/arduino/USBCore.h
parentd2db502f8d86251df909e2454fa3a41cdaffa82c (diff)
Move Caterina_BL related defines into generic USBCore.h
In an excess of confidence, these defines were added to Leonardo's variant.h 3rd party boards sometimes avoid inheriting this variant but they still define USBCON, thus breaking the build
Diffstat (limited to 'cores/arduino/USBCore.h')
-rw-r--r--cores/arduino/USBCore.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/cores/arduino/USBCore.h b/cores/arduino/USBCore.h
index 4e08d71..66f3b5b 100644
--- a/cores/arduino/USBCore.h
+++ b/cores/arduino/USBCore.h
@@ -277,5 +277,22 @@ typedef struct
#define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 }
#define D_CDCCS4(_subtype,_d0) { 4, 0x24, _subtype, _d0 }
+// Bootloader related fields
+// Old Caterina bootloader places the MAGIC key into unsafe RAM locations (it can be rewritten
+// by the running sketch before to actual reboot).
+// Newer bootloaders, recognizable by the LUFA "signature" at the end of the flash, can handle both
+// the usafe and the safe location. Check once (in USBCore.cpp) if the bootloader in new, then set the global
+// _updatedLUFAbootloader variable to true/false and place the magic key consequently
+#ifndef MAGIC_KEY
+#define MAGIC_KEY 0x7777
+#endif
+
+#ifndef MAGIC_KEY_POS
+#define MAGIC_KEY_POS 0x0800
+#endif
+
+#ifndef NEW_LUFA_SIGNATURE
+#define NEW_LUFA_SIGNATURE 0xDCFB
+#endif
#endif