Recovering and reflashing a bricked board can be a tedious process. It often involves flashing an SD card to bring your device back up, and it gets worse if the board does not have an SD card slot to begin with. Thankfully, most embedded platforms almost always include some form of recovery via USB or UART, which usually involves sending a boot image to the platform’s ROM code. A few tools exist that leverage this functionality to offer quick recovery and reflashing via USB, such as STM32CubeProgrammer, SAM-BA or UUU. However, these tools are all vendor-specific, which means that developers working on various kinds of platforms have to switch between different tools and learn how to use each one.
To address this issue, Bootlin is happy to release today a new recovery and reflashing tool, called Snagboot, which intends to be a generic and open-source replacement to the vendor-specific tools mentioned earlier. It is composed of two parts:
- snagrecover, which uses vendor-specific ROM code mechanisms to initialize external RAM and run your bootloader (typically U-Boot), without modifying any non-volatile memories.
- snagflash, which communicates with your bootloader over USB to flash system images to non-volatile memories, using either DFU, USB Mass Storage or fastboot.
Snagboot currently supports about 50 different SoC models, from six different SoC families:
- STMicroelectronics STM32MP1
- Microchip SAMA5
- NXP i.MX6/7/8
- Texas Instruments AM335x
- Allwinner Sunxi
- Texas Instruments AM62x
You can get it from PyPI or browse the sources on github. Our extensive user guide gives all the details on how to setup and use Snagboot on supported platforms. We hope that this tool will be useful to embedded software engineers and that it will continue to grow as support for more SoCs/platforms is added! If you’re familiar with a certain SoC family’s boot process, don’t hesitate to contribute to the project by adding support for your platform!