-
Notifications
You must be signed in to change notification settings - Fork 17
Modifying the existing Arduino IDE
In order to implement the changes for the XMega for Arduino project, you will need to modify the Arduino IDE.
Typically this will be stored in '/usr/local/arduino' or '/usr/share/arduino' for operating systems like FreeBSD and Linux.
For Windows, it is typically stored in "C:\Program Files\Arduino" (or, if you hate 'spaces in file names' like me, you put it into "C:\Arduino").
The Arduino consists of some specific directories that contain information about the various board types, the 'core' code for these, and the 'variant' code that applies to specific 'variants'. The XMega for Arduino project adds the 'xmega' core and several variants for the various processors.
BASE: /usr/local/arduino or /usr/share/arduino
(On windows, typically C:\Program Files\Arduino)
-- hardware/arduino - contains 'boards.txt'
+----- cores
+----- arduino - built-in
+----- robot - built-in
+----- xmega - added (symlink or copy)
+----- variants
+----- arduino - built-in
+----- mega - built-in
etc.
+----- xmega64d4 - added (symlink or copy)
+----- xmega32e5 - added (symlink or copy)
+----- xmega128a1 - added (symlink or copy)
etc.
The 'cores' sub-directory is what it says on the tin. It contains the 'core' files for a series of processors or board types, implementing the startup code and basic peripheral support (digital and analog I/O, interrupts, hardware serial, etc.). The xmega is different enough that it cannot use the existing 'core' support code.
In the case of the 'avrdude.conf' file, it is typically in /usr/local/etc or /usr/etc depending on your OS. For Windows, it will be in the 'hardware/tools/avr/etc' directory (on non-windows OSs the 'hardware/tools/avr' directory is typically a symbolic link to /usr or /usr/local depending on where avrdude stores the avrdude.conf file).
The 'boards.txt' file is located in the 'hardware/arduino' directory (as described above). It contains one set of entries for each 'board type' described in the file. These are the board types that show up when you use the 'Tools / Board' menu in the Arduino IDE, in case you ever wondered where all of those come from.
A typical 'boards.txt' entry might look like this:
xmega64d4.name=ATXMega64D4
xmega64d4.upload.protocol=arduino
xmega64d4.upload.maximum_size=65536
xmega64d4.upload.speed=115200
xmega64d4.build.mcu=atxmega64d4
xmega64d4.build.f_cpu=32000000L
xmega64d4.build.core=xmega
xmega64d4.build.variant=xmega64d4
The 'xmega64d4' prefix identifies this as a unique board type.
The '.name' entry is the name used in the 'Tools / Board' menu
The '.upload.protocol' entry identifies the flash protocol (arduino or wiring)
The '.upload.maximum_size' entry identifies the flash image size
The '.upload.speed' entry identifies the baud rate (115k for xmega)
The '.build.mcu' entry identifies the correct CPU for gcc
The '.build.f_cpu' entry assigns 'F_CPU' for the CPU frequency (in Hz)
The '.build.core' entry assigns the correct 'core' implementation (xmega)
The '.build.variant' entry assignes the correct 'variant'. In this case, xmega64d4.
- Download 'XMega For Arduino' source
- Apply 'patch.boards.txt' and the appropriate 'patch.avrdudeXXX.conf'
(Optionally you can manually modify these files) - Create symbolic links for (or copy, on windows) the 'cores' and 'variants' trees from 'XMega For Arduino'
- Apply patches for compilers and tools (including 'avrdude') as needed
NOTE: this may require some significant effort on your part - Re-start the Arduino IDE. New board types should now be visible (and fully supported)
To correctly apply a patch using the supplied patch files, you will need the 'patch' utility. Under Cygwin, this means installing the 'patch' package.
- Change the working directory to the root of the Arduino IDE, namely /usr/local/arduino (or similar) as described above
Under Cygwin, this is likely to be something like
/cygdrive/C/Program\ Files/Arduino - Apply the 'boards.txt' patch as follows:
patch -p0 <boards.txt.patch - Apply the 'avrdude.conf' patch as follows (use the correct version):
patch -p0 <patch-avrdude.5.11-avrdude.conf (for avrdude 5.11)
- or -
patch -p0 <patch-avrdude.6.1-avrdude.conf (for version 6.1) - 'Your Mileage May Vary' if you've modified the files or have different avrdude.conf files than the ones I created patch files for
© 2015-2019 (and later) by S.F.T. Inc.
You may freely use this documentation as you see fit, provided that appropriate credit is made, similar to a BSD or MIT license.