Skip to content

Developer Information

Nico edited this page Mar 25, 2018 · 19 revisions

How to compile the bootloader

HoodLoader2.0.5 requires AVR-GCC 5.1 with LTO. You can download from here. You better use a Linux PC to recompile the bootloader, that is the simplest way to do it.

# Make sure avr-libc is installed
sudo apt-get install avr-libc

# You can also install avr-gcc 4.8.1, but we need 5.1 anyways.
sudo apt-get install gcc-avr

Add the avr-gcc 5.1 compiler temporary to your PATH variable before you compile. I placed the downloaded folder into ~/bin/

PATH=~/bin/pkg-x86_64-unknown-linux-gnu/bin:$PATH
export PATH

# Add "-flto -fuse-linker-plugin" to your CC_FLAGS and LD_FLAGS in the makefile
# if you want to compile a different project with avr-gcc 5.1 and LTO

Old instructions for 2.0.4 or older

You can compile the bootloader with a Raspberry Pi, Ubuntu or Windows yourself. Everything you need is covered here (avr-gcc 4.7.2, 4.8.1 and 4.9.2 as well!). See this tutorial on how to get the newer 4.8.1 for raspberry pi and this tutorial to get the newest 4.9.2 for Windows.

HoodLoader2.0.3 compiles with 3958(+2 for Mega) bytes with avr-gcc 4.7.2 and with 3908(+2 for Mega) bytes with avr-gcc 4.8.1.

USB PID/VID

The HoodLoader2 itself uses the official Arduinos VID and PID. The board definition file use a special PID (for the actual 16u2 custom program). But this has nothing to do with the bootloader itself. See current boards.txt for more used PIDs

#define LUFA_VID					0x03EB
#define LUFA_PID					0x204A

#define ARDUINO_VID					0x2341
#define ARDUINO_UNO_PID				0x0043 // R3 (0001 R1)
#define ARDUINO_MEGA_PID			0x0042 // R3 (0010 R1)
#define ARDUINO_MEGA_ADK_PID		0x0044 // R3 (003F R1)

HoodLoader2atmega16u2.vid.0=0x2341
HoodLoader2atmega16u2.pid.0=0x484C
HoodLoader2atmega32u2.pid.0=0x484D
HoodLoader2atmega8u2.pid.0=0x484E
HoodLoader2at90usb162.pid.0=0x484F

Changes to the Atmega Bootloader Programmer

To upload the HoodLoader2 I used a modification of Nick Gammon's Atmega Bootloader Programmer. Instructions can be found here.

One of the change was to add new bootloader files. You can convert your hex file as described with Nick's Lua script. One thing to add is the address of the 16u2 in the end_addresses array (line 16). The new .lua script is also in the repository now.

You need to download the MUSHclient as described in his instructions. He provides a simple, ready to use zip file.