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!
Hi, thanks for creating and sharing Snagboot! I’m very curious to try it out. I have a i.MX6ULL system that uses barebox as a bootloader. Do you know someone who ever used snagrecover with a different bootloader than u-boot?
Hello, we briefly experimented with Barebox for i.MX SoCs but it didn’t seem to fit in the current recovery process. However this doesn’t mean that substituting Barebox for U-Boot is completely impossible so if you’re more familiar with Barebox than I was, maybe you’ll find a way to make it work!
Any chance someone is working on adding support for various Rockchip SoCs?
Hello, we looked into it at one point but U-Boot support for Rockchip SoCs doesn’t seem to include any sort of USB boot protocol in the SPL stage which makes it very complicated to design a practical Snagboot recovery process.