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!!!
>>Why data in LUT is not shown in the memory location?
Because RAM doesn't magically get initialized. You'd need to unpack the load region, or place all the constants in ROM and copy them into RAM yourself.
Please guide me how to do that? I am new to assembly coding.
Then take this as an opportunity to read some of the documentation rather than have me read it to you, critical thinking is not a scripted exercise.
Take the data you currently expect to appear in RAM, and move those lines to the ROM (Read Only) section
Thats only my question. How to do that? Thorough scatter file or something else? I have to create a scatter file? By default keil doesnt include it? Because I couldnt see it in the project. If not the scatter file thn what?
Some introductory books here: http://www.keil.com/books/armbooks.asp
Just tell me for this issue what needs to be done?
startup file is generated by KEIL and so is scatter file.
In which file I have to do the modifiction?
While using C this never occured.
I have experience in C but trying assembly for the first time.