Install CYGWIN . Important: Select everything in 'Admin', 'Devel' and 'Utils'. Use the default dir c:\cygwin. Select latest versions of GCC (at least 3.1.1) and binutils (later than 6th of July 2002).
Select the latest version of GDB 2002xxxx (not GDB 2001xxxx), this will install the latest tk/tcl libraries needed for the AVR-GDB build.
A good and late version of gcc 3.2 and the bin-utils are available prebuild from www.avrfreaks.com. Just download and install.
Install to the default c:\avrgcc. Make a link in the /usr/bin directory to the
avr bin directory. $ cd /usr/bin ln --symolic c:/avrbin/bin avr-1.0.0 STK200
interface
I use a variant of the STK200 interface from the PC parallell port to the AVR. This port interface use a 74HC244 to buffer the input and output pins of the parallell port and protects the parallell port if anything should be wrong with your circuit. A schematic can be found at LancOS page. This interface is compatible both with UISP and the AVR monitor.
UISP is the BEST programmer for AVR. Download it from http://savannah.gnu.org/download/uisp/uisp-20020626.tar.gz or http://www.amelek.gda.pl/avr/uisp/uisp-20020626.tar.gz and compile the code. Should compile ok directly under CYGWIN. UISP uses giveio.sys to get direct access to your parallell port. giveio.sys is a kernel mode device driver that give full io access to the process that opens the device. You need to be administrator to install the device.
UISP program
$ tar -xf uisp-2002xxxx
$ cd uisp-2002xxxx
$ make
$ make install
The install program for the giveio.sys service
$ tar -xf giveio-src.tar
$ cd giveio-src
$ make
$ ./giveio-install --install
The AVR debug monitor consist of two parts. One part is running in the AVR chip and uses the TIMER0 interrupt to single step instruction within the AVR chip. The other part is run on the PC and is communicating with the AVR part. With the monitor you can single step and inspect memory, both flash and RAM.
Note:The monitor cannot single step instructions or break on breakpoint when interrupts are disabled. Debugging SIGNAL() interrupts is not possible.
Download the monitor from here. You may want to keep your GDB updated as some of the AVR stuff is beginning to find it's way into release versions of GDB.
The PC Host
$ tar -xf avrmon-stk200-0.7.0
$ cd avrmon-stk200-0.7.0
$ cd host
$ make
$ make install
AVR target. Edit make file to select correct AVR processor and UISP programmer. STK200 is recommended since it's the only one that works with the monitor.
$ cd target
$ make
$ make upload
Testing. When AVR has been successfully loaded with the target program you can start the monitor. The monitor should then print "Hello from AVR". This string is actually sent from the AVR and is displayed by the debug monitor.
Next step is to verify that you can do a telnet to the debug monitor. Start the monitor using "mon localhost". The monitor will now be accepting telnet connection on port 11111. Start telnet to localhost:11111 by starting "telnet localhost 11111".
I'm a fan GUI so I choose the download the insight gdb version. Download the LATEST tarball from sources.redhat.com. Ver 5.2 won't do, must be a snapshot from latest.
You also need two patch files for GDB to be able to communicate with the avr-mon.
$ cd /usr/src
$ bunzip2 --keep --stdout insight-xxx.bz2 | tar --extract
$ mkdir avrgdb_build
$ cd avrgdb_build
$ /usr/src/insightxxx/configure --target=avr --program-prefix=avr-
$ ./mon localhost
(gdb) target avr-mon localhost:11111
Heres the modified avr_make and makefile I use for my projects. It contains some new targets:
When running under CYGWIN the "SHELL = " line in the AVRFreaks must be removed otherwise make will keep going eventhough there are compilation errors.