UF2
More info
- Creator
- Microsoft (MakeCode)
- Released
- 2017
- Type
- Firmware file format
- Spec
- github.com/microsoft/uf2
A file format that lets you flash a microcontroller by dragging a file onto what looks like a USB stick.
Microsoft's MakeCode team designed it in 2017 so that students would never have to install a driver. The bootloader pretends to be a USB mass-storage device; the user copies a .uf2 file onto it and the board reboots into the new firmware. The trick is the block layout: every block is exactly 512 bytes, the size of a disk sector, and carries its own target address and magic numbers.
That means it does not matter in which order the operating system writes the sectors, or whether it sprinkles its own metadata files along the way — the bootloader recognises its blocks and ignores everything else. The RP2040 boot ROM, Adafruit's boards and CircuitPython all use it, which has made it the most common way to flash anything in the hobby world.