How does factory reset work?

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.


If you take the most common example of factory defaults, it's your PC's UEFI (BIOS).

It is made with a flash chip and a volatile battery backup SRAM memory chip. The flash chip contains the program, and the SRAM contains the settings.

On factory reset, the contents of the volatile sram are erased. On the next boot, it detects that the checksum of the settings is invalid and restores the defaults contained in the program.

This is not limited to battery backup SRAM, the same can be done with FLASH or EEPROM. But battery backup SRAM can be erased without powering up the machine.


Another term is factory recovery, this simply means that it contains the main program twice. But only one copy can by upgraded by the user.
Dual-BIOS is an example of this.

On higher level systems, like phones and computers, it means that it uses the installation files to restore the operating system to factory conditions.


Factory reset is whatever you want it to be. It depends on the application and device type.

I usually do two things:

  1. Ensure that there is always a reliable way to enter the bootloader, so that even a partial/wrong firmware update can't brick the device.
  2. Have a way to reset the firmware settings in case the user changes something, a particular setting combination will crash the application etc.

Both can be done with buttons (long presses, short presses), DIP switches or other communication means (eg. UART, USB).

For example if you use one GPIO for a single button you could use it the following way:

  1. Power-on + button pressed = invoke bootloader
  2. Power-on, button not pressed = wait 3s, blink a led, if a button is pressed (within the window) and held for 5s then reset firmware settings