|
| 1 | +# UF2 Bootloader for Arduino UNO R3 |
| 2 | + |
| 3 | +This projects allows flashing of Arduino UNO R3 via USB Mass Storage |
| 4 | +(i.e., file copy or drag and drop without needed to install any software). |
| 5 | + |
| 6 | +It implements it in firmware of the ATmega16u2 - the USB interface chip |
| 7 | +on the Arduino UNO. This firmware in turn talks to the `optiboot` bootloader |
| 8 | +running on the main ATmega328p chip. |
| 9 | + |
| 10 | +The mass storage interface accepts files in [UF2](https://github.com/microsoft/uf2) |
| 11 | +format. The new format (i.e., not `.hex` and not `.bin`) is necessary to implement |
| 12 | +a reliable mass storage flashing in the 512 bytes of RAM of the ATmega. The UF2 repository |
| 13 | +contains some conversion tools. |
| 14 | + |
| 15 | +## Building |
| 16 | + |
| 17 | +``` |
| 18 | +$ git clone https://github.com/abcminiuser/lufa lufa |
| 19 | +$ cd lufa/Projects |
| 20 | +$ git clone https://github.com/microsoft/uf2-uno |
| 21 | +$ cd uf2-uno |
| 22 | +$ make |
| 23 | +``` |
| 24 | + |
| 25 | +I'm using LUFA `170418` right now. You need to have `avr-gcc` etc in `PATH`. |
| 26 | +I'm using 4.9. |
| 27 | + |
| 28 | +## Installing |
| 29 | + |
| 30 | +* place the ATmega in DFU update mode by shorting two pins sticking out closest to the USB plug |
| 31 | +* under macOS or Linux install `dfu-programer` and run `make burn` |
| 32 | +* under Windows use [Atmel FLIP](http://www.atmel.com/tools/flip.aspx) |
| 33 | + |
| 34 | +Arduino provides [more detailed instructions](https://www.arduino.cc/en/Hacking/DFUProgramming8U2). |
| 35 | + |
| 36 | +Note: this bootloader is not currently compatible with Arduino IDE. If you want |
| 37 | +that, go back to the original bootloader (also following the instructions from the Arduino |
| 38 | +page above). |
| 39 | + |
| 40 | +## HID |
| 41 | + |
| 42 | +The firmware exposes a custom raw HID interface, implementing a small subset of |
| 43 | +[HF2 protocol](https://github.com/microsoft/uf2/blob/master/hf2.md), in particular |
| 44 | +the serial-forwarding parts. The serial can be accessed using the C-based |
| 45 | +`uf2tool` or using [PXT command line](https://makecode.com/cli). |
| 46 | + |
| 47 | +## License |
| 48 | + |
| 49 | +MIT |
| 50 | + |
| 51 | +This code is based on the Mass Storage example from [LUFA](), |
| 52 | +has a few lines and the RingBuffer from the [Arduino USBSERIAL firmware](), |
| 53 | +and lifts some code from the [SAMD21 UF2 Bootloader](https://github.com/microsoft/uf2-samd21). |
| 54 | +All these are MIT licensed. |
0 commit comments