-
Notifications
You must be signed in to change notification settings - Fork 28
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
Cannot boot after flashing #44
Comments
Are you seeing expected behavior? Toboot entry is forced after updating: https://github.com/im-tomu/tomu-bootloader/blob/master/booster/main.c#L74 The |
Sorry, I wasn't clear. I meant the situation when reflashing the bootloader itself using an external programmer. What I'm doing is that I have both the bootloader and an application already in flash, and then I use OpenOCD and J-Link to flash a new version of the bootloader through the SWD pins, without touching the application. After I However, the process of reflashing the bootloader through SWD seems to scramble some of the RAM, at least the boot token. I expect the RAM is used as a buffer during flashing, or something. So what happens is that the bootloader looks at the reset cause, and sees that it is not Everything works fine after power-toggling the device, so it's just an inconvenience for toboot developers. |
Since it's generally a 32-bit machine, what if we only consider the |
I feel using an eight-bit number for this purpose is a bit hazardous. And I doubt anything would scramble the second word in RAM while leaving the first one (magic number) intact. So I still think just having a special value in the |
The bootloader cannot boot an application immediately after the bootloader has been flashed and reset. This is a (minor) inconvenience when developing the bootloader.
The problem is that flashing leaves the contents of RAM in an unspecified state with the reset cause
SYSREQRST
. The bootloader only initializes the boot token when the reset cause isPORST
and otherwise assumes that it has valid contents. So what happens is that after flashing the bootloader happily checks the value ofboot_count
field of the boot token, and this field most probably contains some large value left by the flashing. Hence the application boot is aborted due toBOOT_FAILED_TOO_MANY_TIMES
.To solve this, the bootloader should somehow verify that the boot token contents are valid without depending on the reset cause. Perhaps use some (non-zero) magic value in the
magic
field of the boot token even when not forcing bootloader entry?The text was updated successfully, but these errors were encountered: