Using gdb, ddd, and simulavr with the 2006-03-05 AVR Toolchain

checking the simulator:

$ simulavr -L
  at90s1200
  at90s2313
  at90s4414
  at90s8515
  atmega8
  atmega16
  atmega103
  atmega128
  at43usb351
  at43usb353
  at43usb355
  at43usb320
  at43usb325
  at43usb326

starting the simulator server

$ simulavr --device atmega8 --gdbserver

Simulating a atmega8 device.

devsupp.c:338: MESSAGE: TODO: attach IO Reg 'TWBR' at 0x0020
...[ lots more like this ]...
avrcore.c:475: MESSAGE: attach: Internal SRAM from 0x0060 to 0x045f
decoder.c:3875: MESSAGE: generating opcode lookup_table
main.c:415: MESSAGE: Simulating clock frequency of 8000000 Hz
Waiting on port 1212 for gdb client to connect...

now simulavr is ready to simulate an atmega8 and is waiting for a client to connect on TCP port 1212.

in the following example, the “stdiodemo” test elf from the avr-libc examples is used, and I started programs from within the base of the avr-libc examples dir.

avr-ddd --debugger $AVRROOT/bin/avr-gdb

screenshot-01.jpg

(gdb) file stdiodemo/stdiodemo.elf

screenshot-02.jpg

(gdb) target remote localhost:1212
Remote debugging using localhost:1212
0x00000000 in __vectors ()

screenshot-03.jpg

(gdb) load
Loading section .text, size 0x147c lma 0x0
Loading section .data, size 0x74 lma 0x147c
Start address 0x0, load size 5360
Transfer rate: 2858666 bits/sec, 184 bytes/write.

screenshot-04.jpg

(gdb) break stdiodemo.c:53
Breakpoint 1 at 0xce: file stdiodemo.c, line 53.

screenshot-05.jpg

(gdb) step
Single stepping until exit from function __vectors,
which has no line number information.
0x00000064 in __init ()
(gdb) continue
Continuing.
Breakpoint 1, main () at stdiodemo.c:58

screenshot-06.jpg

a screenshot showing the registers window:
screenshot-07.jpg

a set of screenshots showing avr-ddd and simulavr’s display window.

the binary loaded into this version is a much simpler assembly program chosen to illustrate the simulavr display window. in the avr-ddd screenshot, I’ve marked the instruction that the debugger has just executed and the associated define, showing that it has just set the r16 register to 0xFF. in the simulavr display window screenshot, I’ve marked the section showing how the r16 register field reflects this change.

admittedly, this is not not terribly impressive, but it does show that the applications have the potential for practical use.

screenshot-08a.png screenshot-08b.png

Leave a comment

  • Categories

  • Need Code Written?

  • Need a Coding Job?

  • Tags

  • Archives