GNAT for AVR32 UC3
The source code available on this page enables the usage of Ada 2005 on AVR32 and supports the Ravenscar profile and the new Ada 2005 timing events and execution-time control features on the UC3 microcontroller. A short paper describing this system was published on DATE'09 and is available here.
The system is tested on the EVK1100 evaluation board. Programming and debugging of the system is done using the JTAG ICE Mk II.
The building of the system is not very streamlined as of yet, and the compiler has known bugs. DO NOT USE IN PRODUCTION SYSTEMS!
Installing the compiler
These instructions are tested on Debian GNU/Linux only.
You first need to download and install the GNAT GPL 2010 compiler from AdaCore in order to build the cross-compiler. Work is in progress to make GNAT GPL 2011 work with the AVR32. If GNAT does not find library files like crt1.o this might work:
cd /lib sudo mkdir x86_64-pc-linux-gnu cd x86_64-pc-linux-gnu ln -s ../x86_64-linux-gnu 4.3.6 cd /usr/lib sudo mkdir x86_64-pc-linux-gnu cd x86_64-pc-linux-gnu ln -s ../x86_64-linux-gnu 4.3.6''
AVR32 GNU Toolchain from Atmel installed. As it seems that the deb-repositority from Atmel is somewhat outdated, it is recommendend to install AVR32 Studio 2.7 instead.
cd /opt sudo unzip ../path/to/download/ase4-ide-2.7.0*.zip sudo chgrp -R users as4e-ide sudo ln -s /opt/as4e-ide/plugins/com.atmel.avr.toolchains.linux.x86_64_184.108.40.206012011657/os/linux/x86_64/bin/ /opt/as4e-ide/bin export PATH="/opt/as4e-ide/bin:$PATH"
It is handy to add the export of PATH for GNAT and the AVR32 toolchain to you .bashrc file.
To build the cross-compiler first download and extract the source code:
mkdir avr32-gnat cd avr32-gnat wget folk.ntnu.no/gregerts/avr32gnat/avr32-gnat-2010.tar.bz2 tar xjf avr32-gnat-2010.tar.bz2
Now we may build the compiler using GNAT GPL 2010:
mkdir obj cd obj ../src/configure --target=avr32 \ --enable-languages="c,ada" \ --disable-libada --disable-threads \ --disable-libmudflap --without-headers \ --disable-libssp --disable-libgomp \ --with-gnu-as --with-as=/opt/as4e-ide/bin/avr32-as \ --with-gnu-ld --with-ld=/opt/as4e-ide/bin/avr32-ld make make -C gcc cross-gnattools sudo make install
Bare-board run-time environment
After the compiler is installed download the bare-board kernel using GIT:
cd git clone git://github.com/gregerts/GNATforAVR32.git
This will download the master branch of the run-time environment in the folder avr32-ravenscar. Now we may build the run-time environment using our newly built compiler:
cd GNATforAVR32/src make make install
We need to manually make links from the compiler install dir to library dir of the run-time environment in order to build ordinary applications:
cd /usr/local/lib/gcc/avr32/4.3.3 sudo ln -s /path/to/GNATforAVR32/build/adainclude sudo ln -s /path/to/GNATforAVR32/build/adalib
If everything went well you may now compile and test a simple application for the EVK1100 evaluation board:
cd GNATforAVR32/tests/timers-1 make make install
Applications may be debugged using GDB with the JTAG ICE Mk II. Example:
cd GNATforAVR32/tests/application make make install make debug
This starts the program avr32gdbproxy. Now you may start a debugging session using avr32-gdb. In avr32-gdb (executed in the application directory with the bianry 'main' as argument) type the following:
target extended-remote:4242 dir ../common dir ../../src
You may now set breakpoints in both the application and kernel code. Debugging the AVR32 is described in more detail here.
Please refer to the GIT tutorial here on GITHub for how to create your own branches and send patches. Please report bugs and send patches to gregerts (at) itk.ntnu.no.
Plans are made to:
- Add support for more Ada features in the run-time library.
- Create a thick interface to the AVR32 UC3 framework developed by Atmel. This will provide peripheral drivers and also optimized math procedures.
- Test for other UC3 devices.