|
|
|
@ -30,16 +30,16 @@ ATMEGA_KEYBOARD_DATA(KBD4x);
|
|
|
|
|
constexpr int8_t KBD4x::led_count;
|
|
|
|
|
|
|
|
|
|
#define BOOTLOADER_RESET_KEY 0xB007B007
|
|
|
|
|
uint32_t reset_key __attribute__ ((section (".noinit")));
|
|
|
|
|
uint32_t reset_key __attribute__((section(".noinit")));
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This function runs before main(), and jumps to the bootloader after a reset
|
|
|
|
|
* initiated by .resetDevice().
|
|
|
|
|
*/
|
|
|
|
|
void _bootloader_jump_after_watchdog_reset()
|
|
|
|
|
__attribute__((used, naked, section(".init3")));
|
|
|
|
|
__attribute__((used, naked, section(".init3")));
|
|
|
|
|
void _bootloader_jump_after_watchdog_reset() {
|
|
|
|
|
if ((MCUSR & (1<<WDRF)) && reset_key == BOOTLOADER_RESET_KEY) {
|
|
|
|
|
if ((MCUSR & (1 << WDRF)) && reset_key == BOOTLOADER_RESET_KEY) {
|
|
|
|
|
reset_key = 0;
|
|
|
|
|
|
|
|
|
|
((void (*)(void))(((FLASHEND + 1L) - 4096) >> 1))();
|
|
|
|
|