Hi,
Is there a way to detect if new software has been flashed to the system? That is, upon restart, I would like to check if this is brand new software, and if so, take certain actions. I think I can save some kind of build number to nv ram, and then check on boot if the build number is the same as the last one, but I wonder if there is already a facility provided.
Thanks
Detect if new software flashed
Re: Detect if new software flashed
Ive not heard of such a capability. However, if you generate a hash of the content of the executing partition and save it in NVS then the next time you start you can compute the hash again and see if it matches what was previously saved.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Detect if new software flashed
Just put a print statement in your code to print the version that you called it and look at it with a terminal program. To be quite frank, your explanation of your problem is woefully lacking. Hence wondering why you don't know if you did or didn't flash new software to the ESP32.
John A
John A
Re: Detect if new software flashed
In fact there probably is SHA256 checksum of ESP image in flash so you don't have to compute it. Take a look at https://github.com/espressif/esp-idf/bl ... e_format.c. Unfortunately there is no note about it here https://github.com/espressif/esptool/wi ... age-Format.
Re: Detect if new software flashed
We're adding an API to return this SHA value as part of IDF v3.2. This will give you a canonical identifier for the app.
However if you actually want to do version updates (ie migrate some NVS schema, or set some values when a new version is loaded) then I suggest adding a version constant somewhere in your app and check it. You can save the last loaded version in NVS as an integer, and compare to the version compiled into the running app.
However if you actually want to do version updates (ie migrate some NVS schema, or set some values when a new version is loaded) then I suggest adding a version constant somewhere in your app and check it. You can save the last loaded version in NVS as an integer, and compare to the version compiled into the running app.
Re: Detect if new software flashed
Thanks, sounds like until 3.2 easiest thing is to save a build/version number to nvs and then check upon boot.
Who is online
Users browsing this forum: YaCy [Bot] and 62 guests