AVRMacPack works well enough in Xcode but I don’t understand Xcode so I wen looking for an alternative. While trawling through back issues of SERVO magazine, I came across a pair of articles by Dennis Clarke about setting up Eclipse with AVRMacPack and the avr-eclipse plugin. One of my recurring mistakes is the feeling that you can’t have enough development tools so I gave it a go…
The AVRMacPack installation, I already had on the machine. It neatly puts everything your need – the compiler, avrdude and so on – into the folder /usr/local for you. Next I had to get, and install a copy of Eclipse. That is mostly straightforward. A suitable tarball can be had from
At the time of writing, the current release is ‘Ganymede’ – version 3.4.2. In the Servo articles, Dennis Clark refers to the ‘Europa’ release which seems to install slightly differently. The tarball contains a single folder called eclipse. I dragged this straight into the Applications folder on my iMac. In there is an application icon for eclipse. It can be dragged to the dock if you want rapid access to it. Otherwise, double clicking will launched Eclipse. By default, it will ask you where to put the workspace. Several workspaces can be created and you can switch between them at will. I renamed this one to distinguish it form another, workspace folder on my machine. At this stage, you could have a little play with the options. I was a bit disappointed in the welcome splash screen since the text by the links didn’t render properly. To see fundamental errors that early in your experience with a product is never encouraging. Now I needed the avr-eclipse plugin. That can be had from:
The link takes you straight to a wiki and, if you follow the link for downloading, you will find instructions on how to grab the plugin directly from eclipse. It goes like this:
- In eclipse, click Help | Software Updates
- Choose Available Software then Add Site…
- Enter this URL: http://avr-eclipse.sourceforge.net/updatesite/
- After a pause while the site is checked, you should see the AVR Eclipse Plugin listed.
- Tick the appropriate boxes and click the Install… button
- After a while the plugin will have downloaded and you can hit Next and agree to the license.
- Eclipse needs to restart and you should be ready to go./li>
It should be imediately apparent that Eclipse now knows about the AVR because there is a new menu item called (reasonably enough) AVR. This is used to program the target device. For now, you can choose File | new… to create a new C project:
The project is set up without any files so it is now a simple matter of adding or writing the relevant source code files and the project can be built in the normal Eclipse manner. AVRMacPack gives a choice of versions for the GCC compiler to be used. I left mine set as it arrived which uses avr-gcc version 4.3.2. After a bit more fiddling, I tried the programmer. Avrdude is the programmer of choice and I had already got this working on an Arduino board when trying the Xcode tools. In there I had to edit the makefile to get the options right. Here I change the project properties and it is all a lot more comprehensive. The Arduino can be programmed with a direct USB connection thanks to its on-board usb-serial converter and the bootloader that emulates an avrisp (STK500). The programmer needs the -F flag (set in the advanced settings tab) to override the checking of the device signature. The serial speed is set to 19,200 baud and everything works almost like magic. After the project is built, a click of the programming button and it just sorts itself out. Marvellous. If I had realised that avrdude was so handy before, I would have used it ages ago.