avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] avr-gdb and simulavr memory addressing


From: manders1
Subject: [avr-gcc-list] avr-gdb and simulavr memory addressing
Date: Wed, 2 Jul 2003 09:13:46 -0400

I tried to port some code that was running properly under
AVR Studio 3.55 and also on an AT90S8535.  I got it to
assemble correctly using avr-as but when I was trying to
run it in the simulavr (avr-sim) I ran into a few error
messages that don't make any sense.  They seem to be
coming from simulavr as a result of avr-gdb requesting
data from memory locations that are out of bounds but it
isn't clear why avr-gdb is requesting this data.  These
error messages come out during execution of lines 22-25.

Another thing I don't understand is the exact address
used for SRAM.  Avr-gdb says it loads the .data section
at 0x18 right after the .text section.  However when I
print the address of the first .data byte (var1) using
"print &var1" I get 0x800060.  The real address though
seems to be 0x60 as expected if I dump the memory with
"x/xb 0x60".  Is this normal?


   1                    .file   "mark.s"
   2                    .arch   avr2
   3                    
   4                    tmp = 16
   5                    SPL = 0x3D
   6                    SPH = 0x3E
   7                    ZL  = 30
   8                    ZH  = 31
   9                    RAMEND = 0x25F
  10                    
  11                    .data
  12 0000 00        var1:   .byte   0
  13 0001 00        var2:   .byte   0
  14                    .text
  15                    
  16                    start:
  17 0000 02E0              ldi     tmp, hi8 (RAMEND)
  18 0002 0EBF              out     SPH, tmp
  19 0004 0FE5              ldi     tmp, lo8 (RAMEND)
  20 0006 0DBF              out     SPL, tmp
  21                    
  22 0008 00E0              ldi     tmp, pm_hi8 (var1)
  23 000a F02F              mov      ZH, tmp
  24 000c 00E0              ldi     tmp, pm_lo8 (var1)
  25 000e E02F              mov      ZL, tmp
  26 0010 01D0              rcall   ini
  27                    loop:
  28 0012 FFCF              rjmp    loop
  29                    
  30                    ini:
  31 0014 00E0              ldi     tmp, 0
  32 0016 0895              ret

~/AVR> avr-gdb mark
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i586-pc-linux-gnu --target=avr"...

(gdb) target remote localhost:1212
Remote debugging using localhost:1212
start () at mark.s:17
17          ldi     tmp, hi8 (RAMEND)
Current language:  auto; currently asm

(gdb) load
Loading section .text, size 0x18 lma 0x0
Loading section .data, size 0x2 lma 0x18
Start address 0x0, load size 26
Transfer rate: 208 bits in <1 sec, 13 bytes/write.

(gdb) print &var1
$1 = (<data variable, no debug info> *) 0x800060

(gdb) stepi
18          out     SPH, tmp
start () at mark.s:19
19          ldi     tmp, lo8 (RAMEND)
20          out     SPL, tmp
start () at mark.s:22
22          ldi     tmp, pm_hi8 (var1)
23          mov      ZH, tmp
24          ldi     tmp, pm_lo8 (var1)
25          mov      ZL, tmp
26          rcall   ini
ini () at mark.s:31
31          ldi     tmp, 0
32          ret
(gdb)

------------------------------

~/AVR> avr-sim -g -d at90s8515

Simulating a at90s8515 device.

MESSAGE: file decoder.c: line 3352: generating opcode lookup_table
Waiting on port 1212 for gdb client to connect...
Connection opened by host 0.0.0.0, port 1439.
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0260
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0261
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0260
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0261
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0260
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0261
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0260
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0261
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0260
WARNING: file memory.c: line 148: **** Attempt to read invalid addr: 0x0261

--
mark anderson
address@hidden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]