The optiboot bootloader is an optimized version of the old Arduino bootloader. It is used by the Arduino Uno now and for many Arduino-compatible projects. Its main advantage about the original bootloader is the much smaller size of only 512 bytes, freeing up 1,5kB of precious flash memory compared to the 2kB of the original one. More information on the project website on google code.
The current version 5.0 supports the ATmega1284P out-of-the-box and allows for some configuration from the compile command line. In most cases there is no need anymore to do any changes to the source code. The minimum bootblock size for the ATmega1284 is 1kB, leaving 130048 bytes free for uploading your sketches.
Compiling and uploading
The example is tested on Mint 13 (based on Ubuntu 12.04), but it should be the same for any Unix-like system.
- Get the source from the project website
- unpack the zip file.
make LED=A4 ISPTOOL=usbasp atmega1284_isp
That’s all! If that was too fast for you, you can do the compiling and uploading steps separately:
make atmega1284 LED=A4
avrdude -pm1284p -c usbasp -e -u -U lock:w:0x3f:m -U efuse:w:0xFD:m -U hfuse:w:0xDE:m -U lfuse:w:0xF7:m
avrdude -pm1284p -c usbasp -U flash:w:optiboot_atmega1284p.hex -U lock:w:0x2f:m
building on Windows
On Windows systems the build process is more complex, as you don’t have a proper make enviroment there and the Arduino-IDE does not allow any parameters. So you have to edit the Makefile before you do the compile.
Follow the instructions on the optiboot project website, but after unpacking the files open the Makefile Inside the optiboot folder: bootloaders/optiboot/Makefile and search for these lines (currently line 451):
$(MAKE) $(CHIP) AVR_FREQ=16000000L LED=B7
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
LED=A4 and save the file. Be sure that neither you nor your editor touches the line layout. The indended lines are required to start with exacty one tab, not with any spaces, otherwise the build process will fail. Continue as normal, choose the mighty1284p board.
A precompiled binary can be found in the download section.