ARM 7 Assembly memory areas are not initialized -
i trying write simple program using arm 7 assembly, cannot initialize memory region simple data. here example
area reset, code, readwrite entry ldr r0, =sortarray ;load start address ldr r1, =sortarrayend ; load end address str r15, [r0] ldr r4, [r0] sub r2, r2, #1 ; r2 contains (length-1) mov r6, #0 ; r6 sum set 0 stop b stop ltorg area my_data, data, readwrite align sortarray dcd 1,5,20,32,13,66,3,5,23,64,112,66,22 sortarrayend end
this doesn't loads data in memory, in debug mode sortarray
in r0
register points 0x40000000
, sortarrayend
points 0x40000034
, there no data
memory map data in separate area
but may have noticed there instruction storing data in memory str r15, [r0]
, works data stored there.
next example works can see placed data inside code area , made readwrite
bad idea. in case can see data in memory.
area reset, code, readwrite sortarray dcd 1,5,20,32,13,66,3,5,23,64,112,66,22 sortarrayend entry ldr r0, =sortarray ;load start address ldr r1, =sortarrayend ; load end address str r15, [r0] ldr r4, [r0] sub r2, r2, #1 ; r2 contains (length-1) mov r6, #0 ; r6 sum set 0 stop b stop ltorg end
here memory map starts 0x00000000
memory map data placed in code area
please find problem, have spent several days trying figure out wrong.
i using uvision 4
, device lcp2148
.
unfortunately, inquiry not clear appears asking multiple questions; namely, "... memory areas not initialized" , "... sortarrayend points 0x40000034, there no data".
sortarrayend should not contain data since not storing it. if trying store value r15 sortarrayend need point register pointing memory address sortarrayend. hope helps. i'm using gnu.
.data sortarray: .word 1,5,20,32,13,66,3,5,23,64,112,66,22 sortarrayend: .word 0 .text .global main main: nop ldr r0,=sortarray ldr r1,=sortarrayend str r15, [r1] // random value
illustrated gdb:
(gdb) x/16d $r0 0x11036: 1 5 20 32 0x11046: 13 66 3 5 0x11056: 23 64 112 66 0x11066: 22 33800 0 0 (gdb) x/16d $r1 0x1106a: 33800 0 0 0 0x1107a: 0 0 0 0 0x1108a: 0 0 0 0 0x1109a: 0 0 0 0
Comments
Post a Comment