]> granicus.if.org Git - esp-idf/commit
components/nvs: handle more cases where sudden power off may happen
authorIvan Grokhotkov <ivan@espressif.com>
Mon, 22 Aug 2016 04:11:32 +0000 (12:11 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Tue, 23 Aug 2016 04:08:00 +0000 (12:08 +0800)
commit7998b6ca2efb948cf6b06440a30f7450ced6feeb
tree4961ce2f14faa4e480f148b45b618bcbef27476b
parent7447d0860513dc8e87532e5958a8b29a08a818bf
components/nvs: handle more cases where sudden power off may happen

This commit fixes several issues with state handling in nvs::Page. It also adds extra consistency checks in nvs::PageManger initialization.
These changes were verified with a new long-running test ("test recovery from sudden poweroff"). This test works by repeatedly performing same pseudorandom sequence of calls to nvs_ APIs. Each time it repeats the sequence, it introduces a failure into one of flash operations (write or erase). So if one iteration of this test needs, say, 25000 flash operations, then this test will run 25000 iterations, each time introducing the failure point at different location.
components/nvs_flash/include/nvs.h
components/nvs_flash/src/nvs_page.cpp
components/nvs_flash/src/nvs_page.hpp
components/nvs_flash/src/nvs_pagemanager.cpp
components/nvs_flash/test/spi_flash_emulation.h
components/nvs_flash/test/test_nvs.cpp