void bootloader(void)
{
-#define BOOTLOADER_ADDR 0x1f800
+#ifndef USE_USB
+#define BOOTLOADER_ADDR 0x3f000
if (pgm_read_byte_far(BOOTLOADER_ADDR) == 0xff) {
printf_P(PSTR("Bootloader is not present\r\n"));
return;
}
cli();
/* ... very specific :( */
+ TIMSK0 = 0;
+ TIMSK1 = 0;
+ TIMSK2 = 0;
+ TIMSK3 = 0;
+ TIMSK4 = 0;
+ TIMSK5 = 0;
EIMSK = 0;
+ UCSR0B = 0;
+ UCSR1B = 0;
+ UCSR2B = 0;
+ UCSR3B = 0;
SPCR = 0;
TWCR = 0;
ACSR = 0;
ADCSRA = 0;
- __asm__ __volatile__ ("ldi r31,0xf0\n");
+ EIND = 1;
+ __asm__ __volatile__ ("ldi r31,0xf8\n");
__asm__ __volatile__ ("ldi r30,0x00\n");
- __asm__ __volatile__ ("ijmp\n");
-
- /* never returns */
+ __asm__ __volatile__ ("eijmp\n");
+#endif
}
void xbee_mainloop(void)