-
Notifications
You must be signed in to change notification settings - Fork 134
Add dev bootloader chip erase #1999
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,15 @@ | ||
| loadfile $file | ||
| // Reset and halt the device | ||
| r | ||
|
|
||
| // Temporarily disable bootloader protection before flashing. | ||
| // NVMCTRL_CTRLB = NVMCTRL_CTRLB_CMDEX_KEY | NVMCTRL_CTRLB_CMD_SBPDIS. | ||
| w2 0x41004004 0xA51A | ||
|
|
||
| // Flash | ||
| loadfile $file 0 noreset | ||
|
|
||
| // Reset | ||
| r | ||
|
|
||
| // Quit | ||
| q | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,6 +156,9 @@ int main(void) | |
| // screen_sprintf_debug(1000, "got frame"); | ||
| da14531_handler(frame, uart_write_queue); | ||
| } | ||
| if (!hww_data && rust_bytequeue_num(uart_write_queue) == 0) { | ||
| bootloader_process_pending_action(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why all the effort to wait until the response is done and not do it right away when handling OP_CHIP_ERASE? We do it too for the hww reset and reboot API calls in the firmware - the client simply knows to not expect a response in these cases.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, we are pretty unique in having a request/reponse protocol and allow some requests to not have responses, so I totally forgot about it. |
||
| } | ||
| } | ||
| #endif | ||
|
|
||
|
|
@@ -167,6 +170,9 @@ int main(void) | |
| hww_data = NULL; | ||
| } | ||
| } | ||
| if (!hww_data && !hid_hww_write_busy()) { | ||
| bootloader_process_pending_action(); | ||
| } | ||
| #if PLATFORM_BITBOX02PLUS == 1 | ||
| } | ||
| #endif | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Doesn't the chip erase bootprot too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the user row is not reset by chip erase.