Adding a board definitions & other files to the Arduino IDE...

The Arduino IDE includes definitions for the actual Arduino boards but what the definitions are really about is the type of AVR. For example, the Arduino Uno board type listed in the "Tools/Board" menu refers to the Atmega328P device specifically.

So, the "boards.txt" file contains the necessary details for the programming and uploading of bootloaders and sketches and the "core" files discussed earlier contain the specific configuration details such as which pin on the Atmega328P becomes "Pin 0" on the Arduino Uno board. The cores, as discussed, also contain all the basic definitions and functions required to enable you to start writing code.

Not all AVRs are catered for in "boards.txt" and the "cores" folder so we'll take a look at adding a non-standard device such as the ATTiny85. If you are not familiar with this device it is a complete AVR in an 8 pin package. It only has 5 usable I/O pins (this can be made up to 6 with special programming*) but we will stick with the basic form.

*No matter how tempting the thought of using the "Reset" pin on an ATtiny or any other AVR may be, NEVER, NEVER attempt to alter the fuse settings to do this. On any AVR with a configurable "Reset" pin, setting it to become a normal I/O pin will require a High Voltage Programmer to put the Reset pin back to its original configuration! In fact, without a High Voltage Programmer, the AVR will effectively be "bricked"!

We will need to create a new board definition and decide which core file to use as, with only 5 I/O pins (0 - 4), we can't program it as if it is an Atmega328P.

Core files and board definitions for the ATTiny85 (and other devices in this series) can be found on the Internet but there are a number of different offerings with different approaches. The ATTiny85 files I will deal with here seem to be the most popular and can be found here. All of the information on this site is designed for and will only work with Arduino IDE 1.x.x so don't download the "1.5" version as this is specifically for Arduino IDE 1.5 and it will not work with IDE 1.x.x.

This will give you a ZIP file containing the following files and folders:

 bootloaders ( Contains a sub-folder which in turn contains "empty" bootloader HEX files) We don't really need any bootloader files for the ATtiny AVRs
cores ( Contains 2 sub-folders, "empty" and "tiny" which contain the ATTiny core files). The ATtiny core files are trimmed versions of the Arduino core files with unnecessary sections and definitions removed
 license.txt ( The license)
ProspectiveBoards.txt ( Contains board definitions for use with the above)
 README ( Details of how to install the folders and files) Ignore these and follow the instructions below

If you haven't already done so, you are strongly advised to create a "Projects" folder for all your sketches. This is for your sketches only and does not affect the Arduino IDE examples. From now on I'll assume that you have created a "Projects" folder on your C: drive called "Arduino_Projects" (you can create a "Projects" folder wherever you wish).

Please refer to Chapter 3 for details of how to create a "Projects" folder.

You can use the "libraries" folder to store all the libraries that you download from the Internet. The "hardware" folder is going to hold all the core, bootloader and variant files you might download to support non-standard IDE AVR devices.

For this example I am using the ATtiny core files etc. but the method for installing support files for other AVRs is the same.

C:\
Arduino_Projects
hardware
      avr
tiny
bootloaders
cores
license.txt
ProspectiveBoards.txt
README

The "ProspectiveBoards.txt" files is a "boards.txt" file containing a large number of ATtiny definitions. This file can be copied and the copy renamed to "boards.txt". The new "boards.txt" file can be edited to remove unwanted entries or make changes to existing entries to suit your purposes. The "boards.txt" file entries are dealt with later in this tutorial.

A "hardware" sub folder does not have to contain core and bootloader files and can simply be used to hold a "boards.txt" file containing AVR definitions.

For example, if you want to program non-standard ATmega328 AVRs using 8MHz internal clocks, you will want to use the Arduino cores and possibly, bootloaders. To keep the board definitions separate from the Arduino ones, simply create a folder in "C:\Arduino_Projects\hardware\" called "atmega328". and create a "boards.txt" file in the "atmega328" folder containing your new definitions.

The Arduino IDE will search through its own folders as well as your "Projects" folder and collate any "boards.txt" files it finds into a list which it displays in the "Tools/Board" menu of the IDE.