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

AREA Directive problem in ARM LPC2148

Hi all,

I am making some small programs in ARM assembly language.

I am using KEIL software for the programming and compialtion.

The problem I am facing is during a program in which data form one memory is copied to another memory.

The example I am following is given in the help file with KEIL uvision.

The Program is as follows :

=====================================================

AREA Word, CODE, READONLY ; name this block of code

num EQU 20 ; set number of words to be copied

ENTRY ; mark the first instruction called

EXPORT __main
__main
LDR r0, =src ; r0 = pointer to source block
LDR r1, =dst ; r1 = pointer to destination block
MOV r2, #num ; r2 = number of words to copy
wordcopy
LDR r3, [r0], #4 ; load a word from the source and
STR r3, [r1], #4 ; store it to the destination
SUBS r2, r2, #1 ; decrement the counter
BNE wordcopy ; ... copy more
stop
MOV r0, #0x18 ; angel_SWIreason_ReportException
LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit
SVC #0x123456 ; ARM semihosting (formerly SWI)

AREA BlockData, DATA, READWRITE
src DCD 1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4
dst DCD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
END

=====================================================

The Problem is data is not copied in the destination address nor I can read the data from the source.

As I am using KEIL so there is Startup.s file and I have commented the last part in the file which is :

=====================================================

; Enter the C code

IMPORT __main
LDR R0, =__main
BX R0

; IF :DEF:__MICROLIB
; ; EXPORT __heap_base
; EXPORT __heap_limit

; ELSE
; User Initial Stack & Heap
; AREA |.text|, CODE, READONLY

; IMPORT __use_two_region_memory
; EXPORT __user_initial_stackheap
;__user_initial_stackheap

; LDR R0, = Heap_Mem
; LDR R1, =(Stack_Mem + USR_Stack_Size)
; LDR R2, = (Heap_Mem + Heap_Size)
; LDR R3, = Stack_Mem
; BX LR
; ENDIF

=====================================================

and thats why I had used EXPORT __main in the starting of the progam.

Could any one please tell me what the problem is and where I am doing the mistakes.
As I am new to arm assembly ... so cant figure it out

regards
Arvind

Parents
  • Thanx for ur reply ...

    But my point is ... is this the correct way of doing ...

    If i have to read and write the same memory at same time ... then what?

    I am using only KEIL debugger and not the real ARM board ... so is this so that ... it will work on the borad correctly?

    What mistake I am making here ... ?

    regards
    Arvind

Reply
  • Thanx for ur reply ...

    But my point is ... is this the correct way of doing ...

    If i have to read and write the same memory at same time ... then what?

    I am using only KEIL debugger and not the real ARM board ... so is this so that ... it will work on the borad correctly?

    What mistake I am making here ... ?

    regards
    Arvind

Children
No data