Skip to content

Commit a73c18c

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 e336eb4 commit a73c18c

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

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

+17
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

hardware/arduino/avr/variants/leonardo/pins_arduino.h

-18
Original file line numberDiff line numberDiff line change
@@ -366,22 +366,4 @@ const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
366366
// Alias SerialUSB to Serial
367367
#define SerialUSB SERIAL_PORT_USBVIRTUAL
368368

369-
// Bootloader related fields
370-
// Old Caterina bootloader places the MAGIC key into unsafe RAM locations (it can be rewritten
371-
// by the running sketch before to actual reboot).
372-
// Newer bootloaders, recognizable by the LUFA "signature" at the end of the flash, can handle both
373-
// the usafe and the safe location. Check once (in USBCore.cpp) if the bootloader in new, then set the global
374-
// _updatedLUFAbootloader variable to true/false and place the magic key consequently
375-
#ifndef MAGIC_KEY
376-
#define MAGIC_KEY 0x7777
377-
#endif
378-
379-
#ifndef MAGIC_KEY_POS
380-
#define MAGIC_KEY_POS 0x0800
381-
#endif
382-
383-
#ifndef NEW_LUFA_SIGNATURE
384-
#define NEW_LUFA_SIGNATURE 0xDCFB
385-
#endif
386-
387369
#endif /* Pins_Arduino_h */

0 commit comments

Comments
 (0)