|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
运行这个程序,为什么用DCD不能按照要求将src中的数据初始化为1,2,3,4,....而全部是0?
Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
; <h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Heap_Size EQU 0x00000200
num
EQU 20
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
PRESERVE8
THUMB
AREA RESET, DATA, READONLY
DCD __initial_sp
DCD Reset_Handler
DCD src
AREA Block, CODE, READONLY
ENTRY
;CODE32
Start
Reset_Handler PROC
EXPORT Reset_Handler
[WEAK]
ENDP
;LDR R0,=src
;LDR R1,=dst
;LDR R2,[R0,#4]
;MOV R3,R0
;STR R2,[R1]
;B .
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)
B .
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 |
|