summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-09-18 09:03:03 +0200
committertmk <nobody@nowhere>2013-09-18 09:10:53 +0200
commit0ca415004a453b2a841880d3a66492c664505737 (patch)
tree00640fe61df993e31c09905d029f2dcccce8282b
parentc7faa51ee843198c1b6a1dfeb0f1842c4e3ea0e6 (diff)
downloadqmk_firmware-0ca415004a453b2a841880d3a66492c664505737.tar.gz
qmk_firmware-0ca415004a453b2a841880d3a66492c664505737.tar.xz
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?
-rw-r--r--common/bootloader.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/common/bootloader.c b/common/bootloader.c
index 43a7e47ce..cda295b18 100644
--- a/common/bootloader.c
+++ b/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