On Fri, Jan 30, 2004 at 08:33:36AM +0000, Adrian wrote:
> > To install avarice:
> >
> > cd /usr/ports/devel/avarice && make install
> >
> > To install avr-gdb;
> >
> > cd /usr/ports/devel/avr-gdb && make install
> >
> > To install a pretty good simulator:
> >
> > cd /usr/ports/devel/simulavr && make install
>
>
> I have tried to use these (binary distribution of
> WinAVR) but couldn't work it out. Could you point me
> to a guide to getting it set up and which of the
> output files from GCC are required for what?
Sorry, I have no experience using these under Windows. On FreeBSD
Unix, setting up is as easy as the above commands. Regarding the
output from GCC, the final linking step produces an ELF format file.
You then use avr-objdump to pull out the relevent sections from the
ELF file to produce an Intel Hex, Motorola S-Record, or raw binary
file that is ready for uploading to your target. When you want to
debug, you invoke the debugger on the orginal ELF file. Be sure to
compile with symbols (-g option to avr-gcc). Sample command lines
might look like this:
to compile:
avr-gcc -mmcu=atmega128 -g -o test.elf test.c
to produce Intel Hex:
avr-objcopy -O ihex test.elf test.hex
to produce Motorola S-Record:
avr-objcopy -O srec test.elf test.srec
to produce raw binary:
avr-objcopy -O binary test.elf test.bin
to upload the Hex file using AVRDUDE:
avrdude -p m128 -c stk500 -U flash:w:test.hex
to start avarice talking to your JTAGICE:
avarice -j /dev/cuaa2 --part atmega128 localhost 1212
to start an avr-gdb session on that:
avr-gdb test.elf
gdb> target remote localhost:1212
You should now be sitting at the reset vector in gdb, ready to start
setting breakpoints, etc.
Of course, most of these commands are typically placed in a Makefile,
so compiling and producing all the output files is typically achieved
by just typing 'make', so there's not as much typing as it seems.
-Brian
--
Brian Dean, bsd@bdmicro.com
BDMICRO - Maker of the MAVRIC ATmega128 Dev Board
http://www.bdmicro.com/