Skip to content
Tags

Recompiling and uploading the Arduino Pro 3.3v bootloader

February 24, 2012

If you ever want to tweak the Arduino bootloader there are a few things you have to do: locate the bootloader for your board, make your changes, recompile it and finally upload the new bootloader to your board.

There are different ways to achieve the same result and here’s how I did it for the Arduino Pro 3.3v using Windows. I think most of this applies to any of the Arduino boards out there though.

Note that you will need a second Arduino board or a programmer to actually be able to upload the new bootloader.

Make your changes to the source code

The bootloader source code and the binary tool chain is distributed along with the Arduino IDE so if you are using it everything you need is already in your box.

1. Locate and edit the bootloader

For the Arduino Pro 3.3v this was located at

c:\arduino-1.0\hardware\arduino\bootloaders\atmega\ATmegaBOOT_168.c

Note that the same bootloader source file is used by different boards. The ‘make’ target defines what code is actually compiled in using #define’s

If you want to make changes yourself you need some experience in C programming and of course be familiar with the microcontroller itself.

If you are just applying changes from somebody else then you can just do it now.

2. Set the following environment vars so that the compiler can be called whithin a cmd prompt

Add the AVR32_HOME env var to point to the root of the binary tool chain

AVR32_HOME=c:\arduino-1.0\hardware\tools\avr

And add the following to your PATH env var

%AVR32_HOME%\bin;%AVR32_HOME%\utils\bin

Alternatively you can just install the WinAVR tools which will set the env vars for you

Recompile

1. Launch a cmd prompt and cd to the bootloader dir

c:\arduino-1.0\hardware\arduino\bootloaders\atmega\ATmegaBOOT_168.c

2. Recompile

del ATmegaBOOT_168_atmega328_pro_8MHz.hex

make atmega328_pro8

You could do a ‘make clean’ instead of deleting the hex file but that would wipe all the other bootloaders.

Having to delete the hex file to have make recompile the source is a bug in how the Make rules are defined which is preventing make to detect that your source code changed and recompile automatically.

Upload the new bootloader

The cheapest way to do this is to use another Arduino as a programmer

If you get sync errors from the IDE just try again.

Advertisements

From → Arduino

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: