Image grohtml-302861.png


This page briefly describes how to install and use GNU Modula-2 to produce ATMega8 binaries. Mild warning, these packages are the first ones I’ve built and they do conflict with the gcc-avr and gcc-doc packages in Etch.

Assuming you are still willing to install the GNU Modula-2 cross compiler and you are using Debian Etch then add these lines to your /etc/apt/sources.list file.

#
#  GNU Modula-2 repo
#
deb http://floppsie.comp.glam.ac.uk/debian/ etch main non-free contrib
deb-src http://floppsie.comp.glam.ac.uk/debian/ etch main non-free contrib

Now from the command line you should:

# apt-get remove gcc-avr
# apt-get remove gcc-doc
# apt-get install gm2-avr

This will remove two conflicting avr packages (if you have installed them) and install gm2-avr, binutils-avr and avr-libc. Note that the last two packages are newer than those currently in Etch and they match the gcc version which gm2 is grafted upon, namely gcc-4.1.2. Inside the gm2-avr package there is a gcc (4.1.2) built as a cross compiler for the avr.

A tiny example avr project can be found here gm2-avr-example-0.2.tar.gz and it would be sensible to download it, just as a reference. Now untar the example project, and build it.

$ tar zxf gm2-avr-example-0.2.tar.gz
$ cd gm2-avr-example-0.2
$ make clean
$ make

Inside this directory the makefile contains various rules to build a flashing LED program and download it to a ATMega8 using uisp. It also contains rules to build the executable suitable for simulation with simulavr. The test program pulses a LED in the following circuit. I obtained my ATMega8 hardware from tuxgraphics and built the low cost development board as described in the same article. If you have problems email the GNU Modula-2 mailing list.


This document was produced using groff-1.19.