]> git.droids-corp.org - fpv.git/commitdiff
imuboard: fix call to bootloader
authorOlivier Matz <zer0@droids-corp.org>
Wed, 20 May 2015 21:35:48 +0000 (23:35 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Wed, 20 May 2015 22:13:27 +0000 (00:13 +0200)
imuboard/main.c

index 5410074ba7e9e6e744cdfa2a82d0737c96a25e18..7de8acb2c2bb94ec24c1941b6fc653a89b529655 100644 (file)
@@ -28,6 +28,9 @@
 /* fuses:
  * avrdude -p atmega1284p -P usb -c avrispmkii -U lfuse:w:0xff:m -U hfuse:w:0x91:m -U efuse:w:0xff:m
  * -> it failed but I answered y, then make reset and it was ok
+ *
+ * with bootloader:
+ * avrdude -p atmega1284p -P usb -c avrispmkii -U lfuse:w:0xff:m -U hfuse:w:0x90:m -U efuse:w:0xff:m
  */
 
 #include <aversive.h>
@@ -72,7 +75,7 @@ volatile uint32_t global_ms;
 
 void bootloader(void)
 {
-#define BOOTLOADER_ADDR 0x3f000
+#define BOOTLOADER_ADDR 0x1e000
        if (pgm_read_byte_far(BOOTLOADER_ADDR) == 0xff) {
                printf_P(PSTR("Bootloader is not present\r\n"));
                return;
@@ -91,10 +94,10 @@ void bootloader(void)
        ACSR = 0;
        ADCSRA = 0;
 
-       /* XXX */
-       /* __asm__ __volatile__ ("ldi r31,0xf8\n"); */
-       /* __asm__ __volatile__ ("ldi r30,0x00\n"); */
-       /* __asm__ __volatile__ ("eijmp\n"); */
+       __asm__ __volatile__ ("ldi r30,0x00\n");
+       __asm__ __volatile__ ("ldi r31,0xf0\n");
+       //__asm__ __volatile__ ("eijmp\n");
+       __asm__ __volatile__ ("ijmp\n");
 }
 
 /* return time in milliseconds on unsigned 16 bits */