From 7d4bca50419f2b2e57f92e9bec1cbbbe6d846fc1 Mon Sep 17 00:00:00 2001 From: Scott Allen Date: Mon, 13 Nov 2017 17:41:23 +0100 Subject: Always read key to check for new LUFA bootloader Instead of checking for the NEW_LUFA_SIGNATURE once in program memory and then setting a flag which is used for further checks, a function is used that always checks program memory directly. If a flag is used, there's a slight chance that its location in RAM could fall on MAGIC_KEY_POS. In this case, an aborted USB auto-reset sequence may fail. --- cores/arduino/USBCore.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cores/arduino/USBCore.h') diff --git a/cores/arduino/USBCore.h b/cores/arduino/USBCore.h index 18560b6..4210ced 100644 --- a/cores/arduino/USBCore.h +++ b/cores/arduino/USBCore.h @@ -285,8 +285,7 @@ typedef struct // 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 +// the usafe and the safe location. #ifndef MAGIC_KEY #define MAGIC_KEY 0x7777 #endif -- cgit v1.2.3-18-g5258