Skip to content

Developer Information

Nico edited this page Aug 8, 2015 · 19 revisions

##How to compile the bootloader

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.

####How to use AVR-GCC 5.1 with LTO (required for 2.0.5) Download from here: https://github.com/arduino/Arduino/issues/660#issuecomment-120433193

Add the compiler temporary to your PATH variable before you compile.

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

Add -flto -fuse-linker-plugin to your CC_FLAGS and LD_FLAGS.

##USB PID/VID

The HoodLoader2 itself uses the official Arduinos VID and PID. The HID Project and the board definition files uses a special PID but this has nothing to do with the bootloader itself. See current inf file/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.