fix bootloader enable routine
This commit is contained in:
parent
a6e8d7e033
commit
3a1f58ce18
@ -460,6 +460,18 @@ int __attribute__ ((noreturn, OS_main)) main(void)
|
|||||||
DDRC &= ~(1 << AVR_BTLDR_EN_PIN);
|
DDRC &= ~(1 << AVR_BTLDR_EN_PIN);
|
||||||
PORTC &= ~(1 << AVR_BTLDR_EN_PIN);
|
PORTC &= ~(1 << AVR_BTLDR_EN_PIN);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if watchdog reset, disable watchdog and jump to app
|
||||||
|
*/
|
||||||
|
if (reset & _BV(WDRF)) {
|
||||||
|
uart_puts("Found watchdog reset\n\r");
|
||||||
|
MCUSR = 0;
|
||||||
|
wdt_disable();
|
||||||
|
uart_puts("Jump to 0x0000\n\r");
|
||||||
|
jump_to_app();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((AVR_BTLDR_EN_IN & ( 1 << AVR_BTLDR_EN_PIN)) == 0){
|
if ((AVR_BTLDR_EN_IN & ( 1 << AVR_BTLDR_EN_PIN)) == 0){
|
||||||
banner();
|
banner();
|
||||||
uart_puts("Bootloader flashing is disabled\n\r");
|
uart_puts("Bootloader flashing is disabled\n\r");
|
||||||
@ -467,8 +479,6 @@ int __attribute__ ((noreturn, OS_main)) main(void)
|
|||||||
leave_bootloader();
|
leave_bootloader();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if power-on reset, quit bootloader via watchdog reset
|
* if power-on reset, quit bootloader via watchdog reset
|
||||||
@ -479,17 +489,6 @@ int __attribute__ ((noreturn, OS_main)) main(void)
|
|||||||
MCUSR = 0;
|
MCUSR = 0;
|
||||||
leave_bootloader();
|
leave_bootloader();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* if watchdog reset, disable watchdog and jump to app
|
|
||||||
*/
|
|
||||||
else if (reset & _BV(WDRF)) {
|
|
||||||
uart_puts("Found watchdog reset\n\r");
|
|
||||||
MCUSR = 0;
|
|
||||||
wdt_disable();
|
|
||||||
uart_puts("Jump to 0x0000\n\r");
|
|
||||||
jump_to_app();
|
|
||||||
}
|
|
||||||
|
|
||||||
banner();
|
banner();
|
||||||
uart_puts("Enter programming mode\n\r");
|
uart_puts("Enter programming mode\n\r");
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user