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

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

[avr-gcc-list] simulavr 0.0.14 give "Cannot access memory at address 0x1


From: Klaus Rudolph
Subject: [avr-gcc-list] simulavr 0.0.14 give "Cannot access memory at address 0x1"
Date: Mon, 4 Mar 2002 16:38:17 +0100 (MET)

Hi Theodore,

with the newer 0.0.14 version of simulavr i got the error:
Cannot access memory at address 0x1
after a few steps through the code with the gdb debugger with pre9 patch.
The older
0.0.13 runs fine!

Here is the code i assembled:
#include <io8515.h>


#define maintmp r16
#define maintmp2 r17
#define maintmp3 r18
#define bank1_tmp r19
#define bank2_tmp r20

#define ANZ_BANK 4

main:
    ldi maintmp, 0x80
    ldi maintmp2, 0x00
    out SPL, maintmp
    out SPH, maintmp2
    rcall mainin
    rjmp main

mainin:
    ldi maintmp, 14 ;minimum irq to find
setnew:
    ldi ZL, lo8(array);
    ldi ZH, hi8(array);

    mov bank1_tmp, maintmp
    lsr bank1_tmp
    lsr bank1_tmp
    lsr bank1_tmp

    andi maintmp, 0x07  ; nur maske 0..7 bits stehen lassen
    inc maintmp         ;werte > und nicht >=

    add ZL, bank1_tmp
    clr maintmp3
    adc ZH, maintmp3
    rjmp in_loop

loop:
    clr maintmp     ;min_bi_offset=0! alles bits im naechsten Byte gueltig!
    adiw ZL, 1
    inc bank1_tmp   ;byte offset
    cpi bank1_tmp, ANZ_BANK
    breq nothing_found
in_loop:
    clr maintmp2    ;bi_offset remember !!later -1!!!!
    lpm
    tst r0
    breq loop

    mov maintmp3, r0

inner_loop:
    inc maintmp2    ;bit offset
    cpi maintmp2, 8
    breq loop

    lsr maintmp3
    brcc inner_loop

vergleich:
    cp maintmp, maintmp2    ; bi_offset, min_bi_offset
    brpl inner_loop

we_have_found:
    ;werte aus bi_offset und bank ausrechnen
    dec maintmp2
    lsl bank1_tmp
    lsl bank1_tmp
    lsl bank1_tmp
    add bank1_tmp, maintmp2
    mov maintmp, bank1_tmp
    clc
end1:
    rjmp end2   ;only for the breakpoint in debugger


nothing_found:
    sec         ;ist sec oder clc ?????????
end2:
    ret

array:
    .byte 0x08, 0x0, 0x1c, 0x54


i start the debugger session with 
ddd --debugger avr-gdb --command gdbinit

where gdbinit is:
set remoteaddresssize 32
file a.out
target remote localhost:1212
load
break end2
break setnew
continue
stepi

after give the following comands:
continue
stepi
stepi
some more stepi's :-)
the code comes back to the main: function
in line 4 of main, write SPH the error message 
Cannot access memory at address 0x1
is given and the session stops.

Any ideas?

Sorry for such long mail, but it is not easy to get the same error in other
configurations, so i send the original error generating code. 
In hope, that will be make the simulavr stable.
Perhaps i have overseen an change to simulavr? 

Thanks
    Klaus



-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

avr-gcc-list at http://avr1.org



reply via email to

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