-
Notifications
You must be signed in to change notification settings - Fork 188
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
[Question] is 'setBootProt' dangerous? #73
Comments
not sure, it could be wrong - if you have other code that works please submit it as a PR |
Yes, I'm not sure as well, that's why I asked |
@ladyada may you check in a brand new board, loading a boot code without fuse programming, what are the content in user page (512 bytes), I think my board has lost them, since fuse are programmed as soon as board starts the first time (since no 16k are protected by default) |
The SAMD51 data sheet says:
So I think you're right, The SAMD21 makes the calibration data unwritable, and it's in a different row. The fuse fixing code was added because we were seeing broken boards where the entire user page was set to all 1's (by some unknown cause), which was enabling the watchdog timer. We only reset the first two words if they appear to have been completely smashed (all 1's). You're right that a factory-fresh chip would only need BOOTPROT bits to be cleared, with no page erase necessary. But someone could also want to use an update-bootloader UF2 after using Atmel Studio, etc., and so BOOTPROT might not be pristine. @ladyada I'm not sure what the factory programmers are doing in terms of preserving bytes past the first two words. |
@dhalbert not only first 8 words (32 bits) but more, user page is 512 and when you format it you lose also some "personal" data stored by users.
The problem is that if for some reason a board has executed the "restore" fuses code then we lost all "factory defaults" and I don't know what is the use of that. Edit: And for sure every board Adafruit sold has lost them (since first time you execute boot code you write bootprotect fuses) |
Proposed a PR..I close this |
pybadge and pygamer fixes; new boards; improved splashscreen display; merge from upstream
Hello,
I'm creating code to program SEE size and I'm getting some hints from function above.
When fuses to set boot code protection are to be written, code does:
exec_cmd(NVMCTRL_CTRLB_CMD_EP);
this will format a page so 512 bytes set to 0xFF (but why format? if we only clear bits no format is required)
program then write fuses[0] and fuses[1] (first 64 bits)
and finally:
exec_cmd(NVMCTRL_CTRLB_CMD_WQW);
but SAMD51 datasheets writes:
so do we destroy something?
The text was updated successfully, but these errors were encountered: