-
-
Notifications
You must be signed in to change notification settings - Fork 724
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
Add Second Stage Bootloader (SBU) for MKRNB 1500 #549
Conversation
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.
LGTM 👍, let's take out the debugging statements and we should be golden.
|
||
constexpr size_t blockSize = 512; | ||
fileUtils.begin(); | ||
Serial1.begin(115200); |
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.
Hi 👋 Please eliminate all Serial output and re-build for a new binary header.
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.
Now they should be all gone :)
update_success = true; | ||
} | ||
if (update_success) { | ||
fileUtils.deleteFiles(); |
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.
Question ;) Will fileUtils.deleteFiles()
any files? Like also ones that the user is storing on the MKR NB 1500 modem? That's quite a realistic possibility given the fact that we provide that capability to the user via NBFileUtils
.
uint32_t read_bytes = 0; | ||
|
||
if (updateSize > SBU_SIZE) { | ||
updateSize = updateSize - SBU_SIZE - SBU_START; |
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.
Good Morning @giulcioffi ☕ 👋 I don't think this is quite right. The reason for this is that the first 0x2000 bytes of the MCU flash are occupied by the bootloader (the default bootloader, not the SBU) but those 0x2000 bytes of default bootloader are not included in the binary generated when compiling your Arduino sketch. Therefore I think it very likely that with the code like this you're skipping the last 0x2000 bytes of the actual application.
-updateSize = updateSize - SBU_SIZE - SBU_START;
+updateSize = updateSize - SBU_SIZE;
For reference compare to SSU.
…th_bootloader.mkrnb1500.bin
@@ -254,7 +254,7 @@ void initVariant() { | |||
|
|||
// put SARA modem in reset on start to conserve power if it's not used | |||
pinMode(SARA_RESETN, OUTPUT); | |||
digitalWrite(SARA_RESETN, HIGH); | |||
digitalWrite(SARA_RESETN, LOW); |
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.
Hi @giulcioffi ☕ So we are still putting the SARA in reset here. Is that still necessary given the changes in arduino-libraries/MKRNB#55 ? Cheers, Alex - Otherwise great PR ;) let's hash this one out in Slack and then we should be able to merge it in.
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.
All cleared ;)
SBU is a Second Stage bootloader for board MKRNB 1500 which uses Sara-R410M module. It follows the implementation of SSU for MKRGSM 1400, but using the power-on/off & reset sequences proper of Sara-R410M module (MKRNB/#47).
It exploits the File System APIs in library MKRNB to perform file operations from the module.
An example is provided to test how a file is loaded into the Sara module and then retrieved at the boot and flashed to be executed.