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

LPC2148 assembly code. Trying to read data from read-write memory but Label showing blank data

I am trying to copy data from LUT from one location and copying it to another location. Here is the code

AREA    Program, CODE, READONLY
    EXPORT __main
    ENTRY

__main
    ldr     r0, =SourceL        ; Address of SourceL
    ldr     r1, =DestinationL   ; Address of DestinationL
    ldr     r2, [r0]            ; r2 contains data@SourceL
    ldr     r3, [r1]            ; r3 contains data@DestinationL

    mov     r4, #245
    str     r4, [r1]

    SWI     &11

    AREA MyData, DATA, READWRITE

SourceL
    DCW     &1234
    ALIGN

DestinationL
    DCW     &0
    ALIGN

    END

This is a very basic ARM7TDMI assembly code. When I see the address of Labels(in debugger). SourceL is 0x40000000 and DestinationL is 0x40000004.

But when is see the memory locations, they are having values zero.

But in LUT SourceL is having value &1234.

When I try to store some data at memory representing by label DestinationL I am able to successfully do that.

This is not the only case of this above code.

The example code in the ARM website

AREA    StrCopy, CODE, READONLY
      EXPORT    __main
      ENTRY                             ; Mark first instruction to execute

__main
    LDR     r1, =srcstr               ; Pointer to first string
    LDR     r0, =dststr               ; Pointer to second string

    BL      strcopy                   ; Call subroutine to do copy
stop
    MOV     r0, #0x18                 ; angel_SWIreason_ReportException
    LDR     r1, =0x20026              ; ADP_Stopped_ApplicationExit
    SVC     #0x123456                 ; ARM semihosting (formerly SWI)

strcopy
    LDRB    r2, [r1],#1               ; Load byte and update address
    STRB    r2, [r0],#1               ; Store byte and update address
    CMP     r2, #0                    ; Check for zero terminator
    BNE     strcopy                   ; Keep going if not
    MOV     pc,lr                     ; Return

    AREA    Strings, DATA, READWRITE
 srcstr  DCB     "First string - source",0
 dststr  DCB     "Second string - des
    END

The memory corresponding to srcstr is showing zero only.

I am using KEIL IDE for programming.

Why data in LUT is not shown in the memory location?

Thanks!!!

Parents Reply Children