Setup of Eclipse Luna for AVR Plugin Development

1 Introduction

I wanted to modify the official AVR Plugin to change its default MCU type and frequency settings, as I am too lazy to change it for new projects all the time. Since the documentation on the AVR Plugin website is a little bit outdated, I had to guess the necessary steps myself. So if you want to modify the plugin, develop bugfixes or if you are just curious, read on.

2 Setup of Eclipse

Download the Eclipse IDE for Java Developers and extract the source archive into a folder of your choice. I prefer putting everything together, so I renamed the eclipse folder to eclipseAVRPluginDev.

Now start Eclipse. You will be asked to specify a workspace directory first. Here, I created a directory eclipseAVRPluginDev/workspace and selected it. The first thing we need to do is to install some additional plugins. Open the Help menu and click on Install New Software... On the Work with: combo box we select the Luna software site. After the list of available components is refreshed, select the following components:

    • Eclipse Plug-in Development Environment from the General Purpose Tools category.

    • C/C++ Development Tools from the Programming Languages category.

After installing these components and restarting Eclipse, you need to open the Install New Software... item again and enter the URL for SWTBot,, in the Work with: combo box. You can now click the Addbutton to remember it and to give it a name, e.g., SWTBot. Now select from the SWTBot - API category the items SWTBot for Eclipse Forms Testing, SWTBot for Eclipse Testing and SWTBot for SWT Testing, and click Next to install it.

3 Building the AVR Plugin

To get the AVR Plugin, you need git (ask Google on how to install it, if you don’t have it yet) and you get your read-only copy by executing the following command:

git clone git:// avr-eclipse-code

This will fetch the repository and save it in the subdirectory avr-eclipse-code. Again, I put everything into the eclipseAVRPluginDev directory, so I executed this command from there.

To make sure you work on the latest official release, you should change the version in the git repository. Enter the avr-eclipse-code directory and execute git checkout R2.4.2. This will set the working version to 2.4.2, the latest official version when writing this document.

Now open Eclipse, evtl. close the Welcome page, and select Import from the File menu. From the category General, select Existing Projects into Workspace. In the next dialog, select the avr-eclipse-code directory as the root directory, make sure all components are selected and click Finish. After the import the initial build takes place that will take a while.

The initial build will fail because the default API baseline was not configured yet. To fix this, select the Problems tab and open the Errors list. Perform a right click on the API baseline error and select Quick Fix. Now click Finish and you get a new dialog to create a new API baseline. Click the Add Baseline... button, give the baseline a name, e.g., Luna, and select your Eclipse directory. Then click Finish to close this dialog and then Apply on the previous dialog. The Problems tab should now be error free.

Now it is time to code your modifications. In the next section, I’ll explain how to change the default MCU and frequency of the plugin, but first let me explain how to export the plugin so that you can test and deploy it.

From the File menu select Export. Then open the Plug-in Development category and select Deployable features. Select the de.innot.avreclipse feature, select an output directory, e.g., a subdirectory called dist, and on the Options tab, deselect theGenerate p2 repository checkbox. Then click Finish. If you get an error message about a cycle dependency, you need to modify the dependencies of the module de.innot.avreclipse.core.test module. Open the MANIFEST.MF file under the META.INF folder of this module and select the Dependencies tab. Here, remove the dependency to de.innot.avreclipse.core.managedbuildsystem and save your changes. Then perform the previous export steps again.

After the plugin was successfully exported, you’ll find the subdirectories features and plugins in your dist folder. This dist folder is now suited to be put into the dropins directory of your local Eclipse installation. Simply copy the dist folder into the dropinsdirectory and rename it to something like avreclipse.

4 Changing Default Parameters

The default parameters like MCU type and frequency are found in the de.innot.avreclipse.core module in the file src/ file. Here, you can change the variables DEFAULT_MCUTYPE to your prefered MCU, e.g., atmega328p for the Arduino, and the DEFAULT_FCPU to 16000000. If you like to specify your settings on a per build configuration basis, you can also edit the file src/ and change the variable DEFAULT_PER_CONFIG to true.