ATNGW100 Hello World

First install the (latest) toolchain.
Had some dependency problems, installed these first:


http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost/libboost-date-time1.34.1_1.34.1-11ubuntu1_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost/libboost-filesystem1.34.1_1.34.1-11ubuntu1_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost1.38/libboost-filesystem1.38.0_1.38.0-6ubuntu6_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost1.38/libboost-system1.38.0_1.38.0-6ubuntu6_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost/libboost-thread1.34.1_1.34.1-11ubuntu1_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost1.38/libboost-thread1.38.0_1.38.0-6ubuntu6_i386.deb

http://cz.archive.ubuntu.com/ubuntu/pool/universe/x/xerces27/libxerces27_2.7.0-5_i386.deb

http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8-6ubuntu0.2_i386.deb

I have a dirty Ubuntu now, but there was no other way. :-(

Then i downloaded the latest avr32 studio.

Edited Project->Properties->C/C++ Build->Settings-> AVR32/GNU g++ Linker-> libraries to include stdc++ in /usr/lib/gcc/avr32/4.3.2. This includes the static library in the binary that will be build. Necessary because there’s no dynamic libs on the board (resources!). If you don’t change this option, it wil compile with dynamic libs and it won’t run on the device.

AVR32 Studio doesn’t build my Hello World program with the following error:

Internal Builder: Cannot run program "avr32-linux-g++": Unknown reason
Build error occurred, build is stopped

The avr32-linux-g++ does not exist. I had to download the buildroot from http://www.atmel.no/buildroot/ to build the tool chain which includes this binary. I chose the 2.2.1 release to have working drivers for abdac en ac97. This may be handy in my future experiments.
Should be easy with:

$make atngw100
$make source
$make

Got very strange errors, but made sure there were no space in the path to the directory I’m in and now I’m getting further.

During compilation I got the following error:

scripts/unifdef.c:209: error: conflicting types for 'getline'
/usr/include/stdio.h:653: note: previous declaration of 'getline' was
here

I renamed all occurences of ‘getline’ in unifdef.c to ‘parseline’ and the compilation gets beyond this point. This error exists because the next version of glibc changes the default _POSIX_C_SOURCE level, which exposes getline() from stdio.h.

Following error: avr32_linux_user_guide_2.0.0.tar.gz not found.
Downloaded it from:


http://www.atmel.no/buildroot/source/mirror/avr32_linux_user_guide_2.0.0.tar.gz

and put it in the right dir.

Got an error while building Samba. Disabled it with make menuconfig, because I won’t use Samba in this context. Pragmatic thinking!

Another error:

/buildroot-avr32-v2.2.1/build_avr32/makedevs/makedevs.c: In function main:
/buildroot-avr32-v2.2.1/build_avr32/makedevs/makedevs.c:531: error: ignoring return value of system, declared with attribute warn_unused_result

and the solution is (found it somewhere else):
change line 531 to
return system(“/bin/sync”);

The build is complete now!

I added the directory that contains avr32-linux-g++ to Window->Preferences->C/C++->Environment in a PATH variable.

I’m trying to build this program for the ngw100 target:

#include
#include 

int main()
{
	printf("Hello World!\n");
	return 0;
}

I got this error:

In function
> `__gnu_cxx::__verbose_terminate_handler()':
> ../../../../../gcc-4.1.1/libstdc++-v3/libsupc++/vterminate.cc:89:
> undefined reference to `_impure_ptr'
> make: *** [hello] Error 1

I configured the linker to link to the libs that were created with buildroot and it worked. Don’t forget to tick the option ‘static linking’, otherwise it will link with the dynamic libstdc++ library, which doesn’t work on the device.

It works perfectly now! A lot of work for a little Hello World program, but I’m happy with the result.

Advertisement

One thought on “ATNGW100 Hello World

  1. Tracy says:

    I have had my NGW100 for quite a while. I dusted it off recently and had the same GCC errors as yourself. Although I didn’t have the dependency problems you had. I found your note and someones Patch to make it right in the GCC and the buildroot.

    I got the Mediama Tech touchscreen adapter board RMT1 and am trying to get everything up and running to program in QT and whatever else is out there ;] BTW, the Mediama board supports ac97 audio too.

    I’d like to keep in touch with you about your NGW100 projects. Post some pictures of your successes!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.