-
so, I'm getting to the point of releasing my updated firmware to the first testing community. There are a few 1000 devices out there with the old, Sming 4.2 based firmware that this shall replace. Many of those users do not have the means to flash the device, in many places, the devices are hard to access, so upgrading through OTA is a must. I've read up on the PRs when adding partition table support to rBoot and where to put them but I'm still unclear on a few things. What I have now:
flashing the new layout yields
My key question here is: how do I get from the original state to the new rBoot + partition table layout? I suppose the best way is a two step upgrade? I'm still wondering why my full build, when OTA'd, won't boot when the boot loader has not changed. |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 47 replies
-
If there's no valid partition table then boot will fail. See
Yes, that was the original thinking. Bit clunky, though isn't it?! Perhaps we can do this in one step, like this: Add to application's
Add this to your application:
Note: You will get a 'file not found' error because the partition table gets built after compiling the application. You can run Alternatively we could build the table directly ( and we don't need to set
IMPORTANT! I spotted a bug which needs fixing first:
|
Beta Was this translation helpful? Give feedback.
-
iteresting. When is this called? How does the old bootloader know that entrypoint? Thinking about it: the max size for a rom partition on the esp8266 is still just under 1MB, right? I was hoping to fit my webapp into FSTRINGS in the firmware and stay <1MB, but that will only work if I sparsify the webfonts I use (to get a few material icons). That may still be worth it, but there seems to be no way to do that as part of the build process. I was hoping to have two 1.5MB rom partitions and one 1MB filesystem - but that's not an option on the ESP, I guess. I complained to a web-developer friend of mine that my quasar frontend is more than 512kB in size when gzipped and he fell over backwards laughing. Sometimes I feel us embedded people are ... rather unusual 🗡️ |
Beta Was this translation helpful? Give feedback.
-
very cool stuff, thanks for he insight! |
Beta Was this translation helpful? Give feedback.
-
NB. Forgot to call Here's a third way building the partition table layout in code. No external file dependencies.
Just another small patch to keep the code simple as possible:
|
Beta Was this translation helpful? Give feedback.
-
I like using the external partition table rather than building it in code. I would think that keeps it more in line with the idea of hwconfig. Otherwise, for a future maintainer (and future me), there will be two code changes to make when really only one would suffice. |
Beta Was this translation helpful? Give feedback.
-
My thinking is that I want to move the webapp into flash strings, provided I have the space. For that reason, I am currently distinguishing between partition layout v1 (two Roms, two spiffs) and v2 (two Roms one spiffs, or maybe Littlefs). Anyway: I have today rebuilt with your first suggestion and am happy to report that I could successfully boot into the new code. |
Beta Was this translation helpful? Give feedback.
-
hmmm... maybe I was a bit too quick here. When OTA'ing the same controller a 2nd time, I'm getting a garbled spiffs partition. so old Firmware -> new firmware, running rom is rom1 and spiffs is spiffs1 -> all is well
so, it looks like the spiffs0 has partially been written but has some garbled directory content. I believe that the "rtc time init..." line is part of the boot process, but at least at this time, it always shows up and after that there is mojibake. I looked at the Sming 4.2 component.mk
and the RBOOT_SPIFFS_0 = 0x100000 bugs me - I thought with RBOOT_BIG_FLASH = 1, the first 1MB flash blocks would be the two ROM as is witht he modern two-roms-two-spiffs.hw? how can spiffs0 start at 0x100000? my partition as written to flash is this:
that makes total sense to me, but would indicate that the 2nd MByte block is used for rom1 - as it should. technically, at this point, nothing from the old layout should be around anymore, whatever it was, the new images would have overwritten the locations for rom1 and spiffs1 first and rom0 and spiffs0 then - but I have not seen this issue with any of the controllers that I fully flashed on the command line. Any hint would be appreciatd. |
Beta Was this translation helpful? Give feedback.
-
Look at your
The
|
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
ok, I believe that while clearing the flash bock is a good thing, I think I found the real issue here:
ota.getNextBootPartition() returns rom1 and ota.getRunningPartition() yields the same! since getNextBootPartition calls rboot_get_current_rom()
it will return rom1/spiffs1 even though that's what is currently running and therefore spiffs0 is never flashed. [edit]
ok, so immediately after OTA reboot, I print
due to
That would at least begin to explain it. If I initiate the next OTA in TEMP mode, the same partitions would be written to but after that, a switch would happen. The garbled content of spiffs0 is just due to the spiffs metadata format change. Question is: should this be this way? do I need to handle something in TEMP mode or is this a bug in handling the rboot conf ? |
Beta Was this translation helpful? Give feedback.
-
I agree a check is required to reject any firmware update when running in temporary mode.
However, I don't see any message in your boot logs indicating a temporary boot... |
Beta Was this translation helpful? Give feedback.
-
I've also spotted some debug statements which need fixing, such as
Must use |
Beta Was this translation helpful? Give feedback.
-
You'll want the I'm not sure exactly what you store in SPIFFS, but if there's a lot of static (immutable) files have you considered using FWFS? See https://sming.readthedocs.io/en/latest/_inc/Sming/Components/IFS/index.html |
Beta Was this translation helpful? Give feedback.
-
Found a bug #2730 which explains the absence of the |
Beta Was this translation helpful? Give feedback.
-
What commit from your |
Beta Was this translation helpful? Give feedback.
-
The two patches above are included in latest Sming develop branch. |
Beta Was this translation helpful? Give feedback.
OK, so the partition layout is still incorrect (AFAIK) so let's try and get that sorted first. Forget about the boot sector for now - the existing boot sector should work. Try this: