aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/avr/bootloader.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/avr/bootloader.c')
-rw-r--r--tmk_core/common/avr/bootloader.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index ad547b985..98a24d178 100644
--- a/tmk_core/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
@@ -1,6 +1,7 @@
1#include <stdint.h> 1#include <stdint.h>
2#include <stdbool.h> 2#include <stdbool.h>
3#include <avr/io.h> 3#include <avr/io.h>
4#include <avr/eeprom.h>
4#include <avr/interrupt.h> 5#include <avr/interrupt.h>
5#include <avr/wdt.h> 6#include <avr/wdt.h>
6#include <util/delay.h> 7#include <util/delay.h>
@@ -89,6 +90,10 @@ void bootloader_jump(void) {
89 _delay_ms(5); 90 _delay_ms(5);
90 #endif 91 #endif
91 92
93 #ifdef EEPROM_BOOTLOADER_START
94 eeprom_write_byte((uint8_t *)EEPROM_BOOTLOADER_START, 0x00);
95 #endif
96
92 // watchdog reset 97 // watchdog reset
93 reset_key = BOOTLOADER_RESET_KEY; 98 reset_key = BOOTLOADER_RESET_KEY;
94 wdt_enable(WDTO_250MS); 99 wdt_enable(WDTO_250MS);
@@ -114,6 +119,11 @@ void bootloader_jump(void) {
114 #endif 119 #endif
115} 120}
116 121
122#ifdef __AVR_ATmega32A__
123// MCUSR is actually called MCUCSR in ATmega32A
124#define MCUSR MCUCSR
125#endif
126
117/* this runs before main() */ 127/* this runs before main() */
118void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3"))); 128void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3")));
119void bootloader_jump_after_watchdog_reset(void) 129void bootloader_jump_after_watchdog_reset(void)