Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions optiboot/bootloaders/optiboot/optiboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
}

Expand Down