Enable factory reset boot mode without a user switch
The documentation at https://docs.micropython.org/en/latest/pyboard/general.html describes a "filesystem reset" boot mode which can be triggered by holding down the user switch during the power up boot sequence:
filesystem reset: resets the flash filesystem to its factory state, then boots in safe mode.
For supported MicroPython boards that do not have a user switch (e.g. SparkFun MicroMod STM32 Processor), is there any way to trigger a "filesystem reset" from software?
If not, would it be possible to add a new machine.factory_reset() function to enable this? (similar to the machine.reset() and machine.soft_reset() functions described in https://docs.micropython.org/en/latest/library/machine.html?highlight=reset#machine.reset)
For the sake of completeness, it would also be nice to support resetting into the "safe boot" boot mode from software as well through something like a machine.safe_reset() function.
docs: Add reference for reset and boot sequence, document factory reset for esp32 & rp2.
Summary
This started out as a task to document boot.py and main.py on the rp2 port (Closes #15230). However, I realised the boot sequence and reset types were documented per-port and sometimes inconsistent so I decided to consolidate these into a common reference page that each port can link to.
In follow-up commits I added port-specific factory reset docs for esp32 and rp2 ports. These ports don't have any MicroPython-specific recovery features like Safe Mode boots, the factory reset process is to erase the entire flash. However, now it's explicitly documented as such.