Browse Source

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 years ago
parent
commit
0ca415004a
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      common/bootloader.c

+ 4
- 3
common/bootloader.c View File

MCUSR &= ~(1<<WDRF); MCUSR &= ~(1<<WDRF);
wdt_disable(); wdt_disable();


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


ADCSRA = 0; TWCR = 0; UCSR0B = 0; ADCSRA = 0; TWCR = 0; UCSR0B = 0;
#endif #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 #endif

Loading…
Cancel
Save