Created
July 23, 2018 11:31
-
-
Save prrraveen/2613bbe3477da9fc5b1bf2143c25fadc to your computer and use it in GitHub Desktop.
jump to bootloader from main app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include <util/delay.h> | |
#include <avr/wdt.h> | |
typedef void (*do_reboot_t)(void); | |
const do_reboot_t do_reboot = (do_reboot_t)((FLASHEND-1023)>>1); | |
int main (void) | |
{ | |
DDRB = 0xFF; | |
for (int i=0; i < 15; i++) { | |
// toggle PORTB pins | |
PORTB ^= 0xFF; | |
// wait one second | |
_delay_ms(300); | |
} | |
//MCUSR=0; | |
do_reboot(); | |
//MCUSR = 0; | |
//wdt_reset(); | |
//wdt_enable(WDTO_1S); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment