Is the ESP32 IDF Non-volatile memory (NVS) integrity checked (CRC32 or checksum) between boots?
Posted: Tue Feb 15, 2022 3:32 pm
Is the (NVS) flash memory on board the ESP32 integrity checked between boot-ups? The structure of entry into the NVS memory for ints, strings and blobs contains a CRC32 checksum over the bytes in the entry (apart from the CRC field itself) according to the espressif documents, but there is no mention of whether the value in NVS is integrity checked when the device boots up or if the NVS value is accessed. Why is this CRC32 checksum in place if it is not being used? Or how is it used if it hasn't been documented.
There is mention of the partition table used to describe partitions in flash, being integrity checked during boot-up with a MD5 checksum. This is exactly the feature that I am looking for, but it seems to be limited to the partition table. If there was an event of the flash being corrupted but the partition table was unaffected, could the ESP32 load up corrupted values from the NVS flash? Is there some sort of error detection on board the ESP32 for flash memory corruption?
I have found the error code which corresponds to an invalid CRC check called: ESP_ERR_INVALID_CRC. I don't see the NVS API returning this as a valid error code in the documentation though, can the nvs_get or the nvs_get_str return this error code in any circumstances?
Thanks a lot for any advice or help on this issue.
Aary
There is mention of the partition table used to describe partitions in flash, being integrity checked during boot-up with a MD5 checksum. This is exactly the feature that I am looking for, but it seems to be limited to the partition table. If there was an event of the flash being corrupted but the partition table was unaffected, could the ESP32 load up corrupted values from the NVS flash? Is there some sort of error detection on board the ESP32 for flash memory corruption?
I have found the error code which corresponds to an invalid CRC check called: ESP_ERR_INVALID_CRC. I don't see the NVS API returning this as a valid error code in the documentation though, can the nvs_get or the nvs_get_str return this error code in any circumstances?
Thanks a lot for any advice or help on this issue.
Aary