summaryrefslogtreecommitdiff
path: root/tmk_core/common/avr/bootloader.c
diff options
context:
space:
mode:
authorXyverz <xyverz@gmail.com>2017-02-10 23:34:27 -0800
committerXyverz <xyverz@gmail.com>2017-02-10 23:34:27 -0800
commit902d5077cd54f3a964e3276d7858212d975818ec (patch)
treecddf5a379614f421908bbe57ae5d396cc1e2ed37 /tmk_core/common/avr/bootloader.c
parent4d7105c2cf47c7604b54cdf488b4eb9d08c1f1cf (diff)
parent835556da9111d91b71c545d6a273e843f07631ae (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'tmk_core/common/avr/bootloader.c')
-rw-r--r--tmk_core/common/avr/bootloader.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index ad547b9853..34db8d0b0a 100644
--- a/tmk_core/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
@@ -1,6 +1,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
+#include <avr/eeprom.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <util/delay.h>
@@ -89,6 +90,12 @@ void bootloader_jump(void) {
_delay_ms(5);
#endif
+ #ifdef BOOTLOADHID_BOOTLOADER
+ // force bootloadHID to stay in bootloader mode, so that it waits
+ // for a new firmware to be flashed
+ eeprom_write_byte((uint8_t *)1, 0x00);
+ #endif
+
// watchdog reset
reset_key = BOOTLOADER_RESET_KEY;
wdt_enable(WDTO_250MS);
@@ -114,6 +121,11 @@ void bootloader_jump(void) {
#endif
}
+#ifdef __AVR_ATmega32A__
+// MCUSR is actually called MCUCSR in ATmega32A
+#define MCUSR MCUCSR
+#endif
+
/* this runs before main() */
void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3")));
void bootloader_jump_after_watchdog_reset(void)