IDE 1.5.x board definitions...

With the coming of Arduino IDE 1.5.x comes a whole new ball game! The developers, in their wisdom, have decided to change the way Arduino boards are defined and they have added a new "Board" menu structure. It is an improvement but, it isn't backwardly compatible with the older IDE 1.0.x definitions.

A "boards.txt" definition for an ATmega328 with bootloader for Arduino IDE 1.0.x A "boards.txt" definition for an ATmega328 with bootloader for Arduino IDE 1.5.x
atmega328.name=ATmega328 (8MHz - With Bootloader - No BOD)
# Upload
atmega328.upload.maximum_size=30720
atmega328.upload.protocol=arduino
atmega328.upload.speed=57600
# Bootload
atmega328.bootloader.low_fuses=0xE2
atmega328.bootloader.high_fuses=0xDA
atmega328.bootloader.extended_fuses=0x07
atmega328.bootloader.path=arduino:atmega
atmega328.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328.bootloader.unlock_bits=0x3F
atmega328.bootloader.lock_bits=0x0F
# Build
atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=8000000L
atmega328.build.core=arduino:arduino
atmega328.build.variant=atmega328-22
atmega328.name=ATmega328 (8MHz - With Bootloader - No BOD)
# Upload
atmega328.upload.tool=avrdude
atmega328.upload.maximum_size=30720
atmega328.upload.maximum_data_size=2048
atmega328.upload.protocol=arduino
atmega328.upload.speed=57600
# Bootload
atmega328.bootloader.tool=avrdude
atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328.bootloader.low_fuses=0xE2
atmega328.bootloader.high_fuses=0xDA
atmega328.bootloader.extended_fuses=0x07
atmega328.bootloader.unlock_bits=0x3F
atmega328.bootloader.lock_bits=0x0F
# Build
atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=8000000L
atmega328.build.core=arduino:arduino
atmega328.build.variant=atmega328-22

On the left we have a definition for an ATmega328 for IDE 1.0.x and on the right we have a definition for the same AVR for IDE 1.5.x. I have highlighted the differences so, let's discuss them:

has been removed from the new IDE 1.5.x board definition entries. The path is now included in the "bootloader.file=" entry in IDE 1.5.x

" has been added to the new IDE to allow for future use with tools other than avrdude, for now, it stays as avrdude.

" is a new entry and is simply the RAM size of the AVR. This is used to calculate the remaining RAM during the compile and is reported at the bottom of the output window.

" is a new entry and specifies what tools will be used for bootloading, for now, it stays as avrdude.

OK so far? well it's not as simple as it was previously!

 

A "boards.txt" definition for an ATmega328 without bootloader for Arduino IDE 1.0.x. Note the "#" commented-out entries A "boards.txt" definition for an ATmega328 without bootloader for Arduino IDE 1.5.x. Note there are no "#" commented-out entries
atmega328-8n.name=ATmega328 (8MHz - Without Bootloader - No BOD)
# Upload
atmega328-8n.upload.maximum_size=32768
atmega328-8n.upload.protocol=stk500v1
atmega328-8n.upload.speed=19200
# Bootload
atmega328-8n.bootloader.low_fuses=0xE2
atmega328-8n.bootloader.high_fuses=0xDA
atmega328-8n.bootloader.extended_fuses=0x07
#atmega328-8n.bootloader.path=atmega328
#atmega328-8n.bootloader.file=
#atmega328-8n.bootloader.unlock_bits=0x3F
#atmega328-8n.bootloader.lock_bits=0x3F
# Build
atmega328-8n.build.mcu=atmega328p
atmega328-8n.build.f_cpu=8000000L
atmega328-8n.build.core=arduino:arduino
atmega328-8n.build.variant=atmega328-22
atmega328-8n.name=ATmega328 (8MHz - Without Bootloader - No BOD)
# Upload
atmega328-8n.upload.tool=avrdude
atmega328-8n.upload.protocol=stk500v1
atmega328-8n.upload.speed=19200
atmega328-8n.upload.maximum_size=32768
atmega328-8n.upload.maximum_data_size=2048
# Bootload
atmega328-8n.bootloader.tool=avrdude
atmega328-8n.bootloader.file=atmega328/empty.hex
atmega328-8n.bootloader.low_fuses=0xE2
atmega328-8n.bootloader.high_fuses=0xDA
atmega328-8n.bootloader.extended_fuses=0x07
atmega328-8n.bootloader.unlock_bits=0x3F
atmega328-8n.bootloader.lock_bits=0x3F
# Build
atmega328-8n.build.mcu=atmega328p
atmega328-8n.build.f_cpu=8000000L
atmega328-8n.build.core=arduino:arduino
atmega328-8n.build.variant=atmega328-22

f we didn't want to use a bootloader in IDE 1.0.x we could simply comment-out the entries using the "#" character, as shown, and the IDE would just set/reset the fuses. The same goes for the "unlock" and "lock" fuse bits. IDE 1.5.x now requires these entries whether we want to use them or not so we have to specify something for the IDE to do.

" in IDE 1.5.x points to a dummy or "empty.hex" file which is nothing more than an empty sketch HEX file. It doesn't matter what we write to the AVR, within reason, as we are going to overwrite the code anyway when we upload the sketch.

" is set to "unlock" all the lock fuse bits as we do not need to protect a bootloader from being overwritten.

" is set to NOT set any lock fuse bits for the same reason.

If you do leave out any entries or "#" comment them out, the IDE will generate various error messages about missing parameters. I saw a post recently on a Forum where someone was trying to write definitions for IDE 1.5.x and they had actually added the "missing" parameters to the board definition. Please don't try this, if a parameter is reported as "missing" it's because the entries in the definition are incorrect.

Unfortunately, there are more factors involved! Not only have the "boards.txt" definitions changed but the whole folder structure has as well. We discussed previously how "boards.txt" files as well as core. bootloader and variant files could be placed in your "Projects\hardware" folder and this is still true but, Arduino have added a layer to the folder structure and a new file "platform.txt" as shown below:

IDE 1.0.x folder structure IDE 1.5.x folder structure
C:\Arduino_Projects
hardware
atmega328
bootloaders
cores
variants
boards.txt
C:\Arduino_Projects
hardware
atmega328
avr
bootloaders
cores
variants
boards.txt
platform.txt

There are actually 2 specified " sub folders called "avr" and "sam". "sam" is for the new Arduino boards using the SAM processors but we will not discuss these here as we only deal with AVRs. S0, for IDE 1.5.x you need to use the new folder structure.

The "platform.txt" file is a new addition which "brings out" functions that were previously buried deep within the IDE. This file is used during compiling and upload/bootload to create the commands necessary to communicate with AVRDUDE for example and a lot more besides. I am not going to go into any detail on this file as you can borrow the one provided in the Arduino IDE environment where the default "boards.txt" file is stored. Only take the "avr" one, not the "sam" one and copy it, don't remove the original.

The reason we need to make a copy of the "platform.txt" file is because it is used, not only for the functions described above but, for identifying the AVR devices in the Board menu on the IDE window. If you make a copy of the "platform.txt" file in your "Projects\hardware\device" folder you will need to edit a line in the "platform.txt" file.

 

# Arduino AVR Core and platform.
# ------------------------------

# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification

name=ATmel ATmega AVR Devices
version=1.5.6

Above are the first few lines of the AVR "platform.txt" file. All that is necessary to use a copy of this file with your own definitions is to change the highlighted entry "name=". Change this to suit your needs i.e. "ATmega328 AVR devices" and save the file. When you open the IDE, your board definitions and the "name=" entry that you have altered will show in your Board menu, as greyed-out text, on the IDE as shown below.