Skip to content

Commit

Permalink
[nrf noup] Lock thread stack before factory reset
Browse files Browse the repository at this point in the history
This commit fix a problem with thread activity interrupting factory reset.
This activity used to led to “Factory reset fail: -6”.
Writing to cleared nvm flash pages caused the problem.

Signed-off-by: Patryk Lipinski <patryk.lipinski@nordicsemi.no>
Signed-off-by: Michał Szablowski <michal.szablowski@nordicsemi.no>
  • Loading branch information
LipinskiPNordicSemi authored and doublemis1 committed Jan 26, 2024
1 parent 288b64a commit 99cfd7a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/platform/Zephyr/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg)
{
ChipLogProgress(DeviceLayer, "Performing factory reset");

// Lock the Thread to not interupt in settings during factory reset
#ifdef CONFIG_NET_L2_OPENTHREAD
ThreadStackMgr().LockThreadStack();
#endif

#ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_NVS
void * storage = nullptr;
int status = settings_storage_get(&storage);
Expand Down

0 comments on commit 99cfd7a

Please sign in to comment.