Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented load of OSCCAL value (draft) #343

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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