-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
NVS support in bootloader (IDFGH-1184) #3495
Comments
I don't think it is entirely practical, have you considered using the same strategy as otadata using 2 sectors to store raw binary data? |
That is exactly what am I currently doing... 2 sectors containing the same data with CRC checksum on each. But - NVS is far more generic and capable, and I feel like I'm re-inventing the wheel. It can't be that I'm the only one who finds NVS useful in the context of the bootloader... |
Hi, |
Not arguing against it's usefulness, but bootloader runs from ram and can't conflict with the app sections it is going to then load to ram so minimal footprint is desirable. |
Hi @shlomos @avrahamshukron , Thanks for sending this request and giving some information about your requirements. Is there any more details you can give about exactly what conditions you are checking for during the early boots? We have some current plans for adding optional bootloader support for detecting cases like the device getting stuck in boot/WDT loops. Adding NVS support in the bootloader is a non-trivial amount of work, and it's relatively risky because we don't support bootloader OTA updates - the NVS partition format would need to remain compatible with the bootloader for the life of the product, and any bugs in the bootloader NVS implementation will remain there for the life of the product. However I totally appreciate that the alternative is fairly primitive and fiddly by comparison. The more details you can give us about exactly what case(s) you are checking for, what persistent information you need (and which parts of this information are written by the app vs written by the bootloader), the more chance there is that we can figure out a way to accommodate these use cases. |
Our product is basically an IoT device that will be deployed by the thousands in field. Once deployed, the cost of retrieving it back for maintenance is too high so our software and firmware needs to be reliable enough and contain recovery mechanisms. But there's a catch 22 here: So we came up with the following scheme that revolves around 2 software images:
There bootloader job is to load the correct image based on some logic that we devised. This logic uses some non-volatile data, such as boot counter (SOFT_BOOT_COUNTER), external WD configuration (EXT_WD_TIME) and weather to load the recovery or normal image (IMAGE_SELECT). On power-on reset, the bootloader will load the recovery image. On soft reset:
This is the basic flow, I left a few details out for brevity and because some of it is confidential. Hope that helps... |
Environment
git describe --tags
to find it): v3.2xtensa-esp32-elf-gcc --version
to find it): 1.22.0-80-g6c4433aProblem Description
I have a custom bootloader with some recovery mechanism implemented for my product.
The bootloader needs some persistent data to perform its operation (E.g boot counter, external WD time to configure etc.).
The easiest way to save such data in a reliable matter is NVS.
Unfortunately, in is not available in the bootloader binary and it is not trivial to compile it into the bootloader.
It would be really helpful to have NVS support in the bootloader, especially for mass-production products.
The text was updated successfully, but these errors were encountered: