AVRMacPack and Xcode

6D1EDDCC-B888-4629-8116-6E8F9EC6D483.jpgThe AVRmacpack for AVR development on the Apple Mac contains command line tools. These are all well and good if you want to do things the traditional way with text editors, terminal windows and make files. No real problem. However, if you want the benefits of a modern IDE with things like function lists and refactoring, you might want to try Xcode. It is, after all, supplied with your Mac.

It took me rather longer than I would have liked to find out how to get going with this. AVRMacPack comes with a sample project template. Once you have installed the tools you will find it in

/usr/usr/local/AVRMacPack/etc/templates/TemplateProject

Interestingly, this appears to be the exact same template that can be found tucked away in the Arduino package for the Mac. To make this template available to Xcode, you will need to copy it in the appropriate place. As far as I can tell, this is

~/Library/Application Support/Developer/Shared/Xcode/Project Templates 

If you don’t know, the ~ is your home folder. To make it a bit clearer, rename the TemplateProject folder to something like AVR Project. I also put it into a folder called AVR in case I want to add other AVR project types later.Now, when you do File | New Project in Xcode, you should see a section called AVR in bold and, in there, your AVR project template.the template puts the code into a folder called firmware and places a Makefile in the project follder root. You will need to edit that Makefile to suit the details of your project – processor, clock speed etc.A project created in this way will build using the normal Xcode buttons. So far, however, I have not seem how to avoid opening a terminal to run the make flash command needed to program the target. Also, because the code is not associated with an Xcode target, refactoring will not work. Still, it is progress and I am sure that can be fixed at some stage. I know nothing about Xcode yet…

This entry was posted in AVR and tagged , . Bookmark the permalink.

3 Responses to AVRMacPack and Xcode

  1. peter scott says:

    XCode cant find avr-gcc
    seems to be looking in /usr/bin
    NOT /usr/local/AVRMacPack/bin/avr-gcc

    any idea?

    pete

  2. peteh says:

    I just checked the PATH variable on my machine and it includes this entry:
    /usr/local/AVRMacPack/bin

    I don’t remember adding this explicitly to the path but then I am not sure what I had for breakfast most days.

    The path was altered when I previously got the AVRMacPack stuff installed

    http://www.micromouseonline.com/sites/default/files/2009/02/24/avr-on-the-mac/

    The installer must have done this because it modified /etc/profile to include the following section:

    if [ -e "/usr/local/AVRMacPack" ]; then
    PATH=”$PATH:/usr/local/AVRMacPack/bin”
    export PATH
    fi

  3. Mosholder711 says:

    Very good, I really liked that. Do you know of somewhere I can check out more about it?

Leave a Reply