This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM 7 Assembly memory areas are not initialized

I am trying to write simple program using ARM 7 Assembly, but I cannot initialize memory region with simple data. Here is an 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 to 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 to 0x40000000 and SortArrayEnd points to 0x40000034, but there is no data

Memory map for data in separate area - i.stack.imgur.com/JNAK2.png

But as you may have noticed there is instruction for storing data in the memory STR r15, [r0] and it works perfectly data is stored there.

Next example works but as you can see I placed data inside code area and made it READWRITE that is probably bad idea. But in this case I can see my data in the 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 to 0
STOP B STOP
    LTORG

    END


Here is my memory map it starts from 0x00000000

Memory Map WIth Data placed in code Area - i.stack.imgur.com/Vfkwf.png

Please help to find the problem, I have spent several days trying to figure out what is wrong.

I am using uVision 4 and device is LCP2148.

Parents Reply Children