ソースを参照

Fix bootloader jump use word address

- Call of function pointer is compiled into 'icall' instruction.
It should use word address but it has used byte address :( It seems
jump has worked luckily by chance until now. why it worked?
tags/v1.9
tmk 10年前
コミット
0ca415004a
1個のファイルの変更4行の追加3行の削除
  1. 4
    3
      common/bootloader.c

+ 4
- 3
common/bootloader.c ファイルの表示

@@ -71,7 +71,8 @@ void bootloader_jump_after_watchdog_reset(void)
MCUSR &= ~(1<<WDRF);
wdt_disable();

((void (*)(void))BOOTLOADER_START)();
// This is compled into 'icall', address should be in word unit, not byte.
((void (*)(void))(BOOTLOADER_START/2))();
}
}

@@ -141,7 +142,7 @@ void bootloader_jump(void) {
ADCSRA = 0; TWCR = 0; UCSR0B = 0;
#endif

// start Bootloader
((void (*)(void))BOOTLOADER_START)();
// This is compled into 'icall', address should be in word unit, not byte.
((void (*)(void))(BOOTLOADER_START/2))();
}
#endif

読み込み中…
キャンセル
保存