Building for the NGW100 Part 2: An easier way

So on my last post about cross-compiling programs for the NGW100, I went through the trouble of setting up a virtual environment to be able to use the provided build environment. I realized today that that is largely unnecessary, and it would be much easier to just extract the files from the provided packages and write a little wrapper script to set up the environment to build from that location. Its much easier, and much faster (as long as you have a system that can execute x86 binaries natively):

To begin with, we need to extract the build environment and other goodies from the provided package files. This is necessary because they are not compatible with the more recent release of Ubuntu that I am using.

First, get the BSP (board support package) ISO from Atmel at Either burn it to a CD or mount it using a loopback interface.

Next, extract these files. Change to a directory where you want to put them, and issue this string of commands:

for file in /media/cdrom/devel/linux/ubuntu/dapper/*.deb
    dpkg-deb -x $file ./

This should result in the creation of a new directory ./usr, with all of the files in it. At this point, there are a few choices; this tree could be copied verbatim into the system /usr directory, and everything would probably just work. However, I would like to keep my build environment separate from the rest of my system, so I wrote a little script to add this tree to my user environment, which can be invoked when I need to compile for avr. Here is the script, to be placed in the directory containing the usr directory above (I call the script

export PATH=$DIR/usr/bin/:$PATH
export C_INCLUDE_PATH=$DIR/usr/include
export CPLUS_INCLUDE_PATH=$DIR/usr/include
export LIBRARY_PATH=$DIR/usr/lib
export LD_LIBRARY_PATH=$DIR/usr/lib

These options may or may not be correct, but they seem to work for me so far. To invoke the script, use the . operator to apply the environment variables to the current shell:


As a test, construct a simple program and compile it for the ngw100:

echo -e '#include <stdio.h> \n int main(){ printf("hello!\\n"); return 0; }' > test.c
avr32-linux-gcc test.c -o test

This should produce an executable named test, which can be copied over to the NGW100 and run. At this point, everything should be good to go!

This entry was posted in tech. Bookmark the permalink.

5 Responses to Building for the NGW100 Part 2: An easier way

  1. Pingback: C i b o M a h t o . c o m » Enabling extra serial ports for the NGW100

  2. Karen Robertson says:

    Can this be accomplished if you are trying to build using Windows XP OS or do you have to be in a Linux environment. Please help, I am trying to open serial ports to write to a Parallax Boe-Bot..

  3. Karen Robertson says:

    Also what terminal will you have to use in Windows XP…

  4. mahto says:

    Hi Karen,

    Are you trying to connect an NGW100 to a boe-bot, or the Windows computer?

    If you want to program a boe-bot, that would probably be an entirely different set of tools.

    If you want to get started with programming the NGW100 on Windows, you might want to check out the guide at: (pardon the name). The terminal that you would use then is the Cygwin shell, which should be covered there.


  5. Karen Robertson says:

    Thanks, alot and yes the Boe-Bot will be directly attached to the serial port on the NGW100 and html codes are on the board’s server

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>