Skip to content

Commit 31c9183

Browse files
committed
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
1 parent ab145bd commit 31c9183

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

hardware/arduino/avr/cores/arduino/USBCore.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,5 +277,22 @@ typedef struct
277277
#define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 }
278278
#define D_CDCCS4(_subtype,_d0) { 4, 0x24, _subtype, _d0 }
279279

280+
// Bootloader related fields
281+
// Old Caterina bootloader places the MAGIC key into unsafe RAM locations (it can be rewritten
282+
// by the running sketch before to actual reboot).
283+
// Newer bootloaders, recognizable by the LUFA "signature" at the end of the flash, can handle both
284+
// the usafe and the safe location. Check once (in USBCore.cpp) if the bootloader in new, then set the global
285+
// _updatedLUFAbootloader variable to true/false and place the magic key consequently
286+
#ifndef MAGIC_KEY
287+
#define MAGIC_KEY 0x7777
288+
#endif
289+
290+
#ifndef MAGIC_KEY_POS
291+
#define MAGIC_KEY_POS 0x0800
292+
#endif
293+
294+
#ifndef NEW_LUFA_SIGNATURE
295+
#define NEW_LUFA_SIGNATURE 0xDCFB
296+
#endif
280297

281298
#endif

0 commit comments

Comments
 (0)