Electronic – How does factory reset work

bootloadercembeddedfirmwarestm32

All embedded devices includes a "Factory reset" option that allows the user to reset his device if something is wrong.

I am developing a Firmware on an STM32 board. The firmware includes a boot loader that allows to upgrade the application via UART (By sending a binary file that contains the new image) and I want to add another feature: A factory reset. When the user choose this option, the board shall load the original image.

What is a Factory reset? Is it about loading the whole binary file into memory again or it's just calling a function that reinitialize variables modified by the end user?

What are the best practices to do so?

Where to store the original FW? is it in an internal or external flash?

Best Answer

Generally speaking the factory reset function you mention will restore any saved variable data information back to default values. It is not true that all embedded devices have this capability. Some do but not all.

If you want your device to support a return to factory default firmware itself then your design has to incorporate a memory into the circuit to store that image. A common component for this is a SPI flash chip. Then your boot loader also needs to be changed to support a mode of getting a firmware image from the SPI flash chip instead of getting the image in through the serial port. If your device does not support user replaceable firmware then it is usually not necessary to provide a means to restore to factory default firmware.