int main(int argc,char* argv[])
这样之后以前在汇编中使用的如下全局量初始化代码需要去掉,
HOP
add r2, pc,#-(8+.-CInitData) ; @ where to read values (relative)
ldmia r2, {r0, r1, r3, r4}
cmp r0, r1 ; Check that they are different
beq EndRW
LoopRW
cmp r1, r3 ; Copy init data
ldrcc r2, [r0], #4
strcc r2, [r1], #4
bcc LoopRW
EndRW
mov r2, #0
LoopZI
cmp r3, r4 ; Zero init
strcc r2, [r3], #4
bcc LoopZI
b EndInitC
CInitData
IMPORT |Image$$RO$$Limit| ; End of ROM code (=start of ROM data)
IMPORT |Image$$RW$$Base| ; Base of RAM to initialise
IMPORT |Image$$ZI$$Base| ; Base and limit of area
IMPORT |Image$$ZI$$Limit| ; Top of zero init segment
DCD |Image$$RO$$Limit| ; End of ROM code (=start of ROM data)
DCD |Image$$RW$$Base| ; Base of RAM to initialise
DCD |Image$$ZI$$Base| ; Base and limit of area
DCD |Image$$ZI$$Limit| ; Top of zero init segment
EndInitC
因为int main(int argc,char* argv[])
已经自己做了实现[luther.gliethttp]
[0x0a00000e] beq _zero_region
[0xe8b00070] ldmia r0!,{r4-r6}
[0xe1540005] cmp r4,r5
[0x0afffffa] beq _move_region
[0xe3140001] tst r4,#1
[0x1084400b] addne r4,r4,r11
[0xe3150001] tst r5,#1
[0x1085500b] addne r5,r5,r11
[0xe3150002] tst r5,#2
[0x10855009] addne r5,r5,r9
[0xe3c55003] bic r5,r5,#3
[0xe2566004] subs r6,r6,#4
[0x24947004] ldrcs r7,[r4],#4
[0x24857004] strcs r7,[r5],#4
[0x8afffffb] bhi _move_loop
[0xeaffffee] b _move_region
阅读(1467) | 评论(0) | 转发(0) |