From 88e8f47bdea04290ca8dea571ef3a3d57c5d806b Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Sun, 28 May 2023 11:17:39 -0700 Subject: [PATCH] Jump to correct bootloader address based on whether it's a 64x or 128x --- hal/at90usb646/board_hw.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hal/at90usb646/board_hw.h b/hal/at90usb646/board_hw.h index 8050bb2..cc3fc06 100644 --- a/hal/at90usb646/board_hw.h +++ b/hal/at90usb646/board_hw.h @@ -57,8 +57,16 @@ static inline void Board_EnterBootloader(void) // close the port after the USB disconnect DelayMS(2000); - // And, of course, go into the bootloader. - __asm__ __volatile__ ( "jmp 0xE000" ); + // Jump to the correct bootloader address based on whether this is an + // AT90USB128x or AT90USB64x + if (IsAT90USB128x()) + { + __asm__ __volatile__ ( "jmp 0x1E000" ); + } + else + { + __asm__ __volatile__ ( "jmp 0xE000" ); + } } #endif /* HAL_AT90USB646_BOARD_HW_H_ */