diff --git a/optiboot/bootloaders/optiboot/optiboot.c b/optiboot/bootloaders/optiboot/optiboot.c index dec9c45ed..c5d5e9232 100644 --- a/optiboot/bootloaders/optiboot/optiboot.c +++ b/optiboot/bootloaders/optiboot/optiboot.c @@ -694,13 +694,18 @@ void pre_main(void) { // entry to this function will always be here, independent of // compilation, features etc asm volatile ( - " rjmp 1f\n" + " rjmp start_main\n" #if APP_NOSPM " ret\n" // if do_spm isn't include, return without doing anything #else " rjmp do_spm\n" #endif - "1:\n" + "set_osccal:\n" // start_main must difer only by extra 1s, so they can be overwritten to 0s after calibration is done. Here is rjmp is set default to 0x05 and would overwrite to 0x01. + " nop\n" + " ldi r24, 0xFF\n" + " sts %[osccal_reg], r24\n" + "start_main:\n" + : : [osccal_reg] "M" (_SFR_MEM_ADDR(OSCCAL)) : "r24" ); }