TODO: improve this README file...
How to build this project
So you want to build this project? Let's build it together, step-by-step!
Want a quick list of available make targets? Run
All commands listed here assume you are inside the
firmware directory (the
These steps only need to be done once. They are the initial setup of the project.
Mount the hardware on your breadboard. You can find a short description at the Hardware description comment in
main.cfile. Hopefully, in future, there will be a nice SVG and PNG circuit schematic.
hardwareconfig.hand check if those definitions are consistent with the hardware. Basically, just check if the USB D- and USB D+ are connected to the correct pins.
- Check if
TWI_TWBRvalue is correct. It should be updated if you use a different clock rate.
- Check if
TWI_BUFFER_SIZEis big enough. Unless you modify the firmware, the value here don't need to be changed.
- Check if
AVRDUDE_PARAMSaccording to your AVR programmer, if you use something other than USBasp.
- If you use a clock other than 12MHz, update
- If you use a microcontroller other than ATmega8, update
- Also look at the
writefusetarget. Check if the value of those fuse bits make sense for you (and for your hardware).
make writefuseto write the fuse bits.
Writing the bootloader (optional)
This section is completely optional. You don't need a bootloader. It's just cool and handy, but you don't need it. Feel free to skip these steps.
This project comes with USBaspLoader. After it is written to the microcontroller, and any later firmware update can be done without the need of a dedicated AVR programmer.
After the bootloader is written, if a certain condition is true (a specific button is held down) during the device boot, then the bootloader will take control and the device will identify itself as USBasp. Writing to this "virtual" USBasp will actually update the firmware, without the need of any extra hardware.
make boot. This will compile the bootloader.
make writeboot. This will write the bootloader to the microcontroller. You need an AVR programmer for this step.
make cleanto clean up compiled files. This is required because the compiled files from the bootloader are incompatible with the main project (and vice-versa).
Writing the main firmware
You either need an AVR programmer, or you need to start the bootloader on the microcontroller (see the previous section).
make. If it fails, try running
After you edit the firmware, you only need to redo these two steps.
That's all, folks!
And have fun!