level 1
梦cc雪
楼主
给下面的代码添加适当的中文注释说明;2)说明这段代码的主要功能,并画出流程图。
.globl _start
_start: b reset
reset:
ldr r0, IC_BASE
mov r1, #0x00
str r1, [r0, #ICMR]
ldr r0, PWR_BASE
ldr r1, cpuspeed
str r1, [r0, #PPCR]
bl ledinit
bl memsetup
ldr r0, RST_BASE
ldr r1, [r0, #RCSR]
and r1, r1, #0x0f
teq r1, #0x08
bne normal_boot /* no, continue booting */
mov r1, #0x08
str r1, [r0, #RCSR] ;
/* handle Power Manager Sleep Status Register (PSSR), see 9.5.7.5 from [1]*/
ldr r1, [r0, #PSSR]
orr r1, r1, #0x08
orr r1, r1, #0x10
str r1, [r0, #PSSR]
/* get the value from the PSPR and jump to it */
ldr r0, PWR_BASE
ldr r1, [r0, #PSPR]
mov pc, r1
normal_boot:
mov r7, #0x1000
mov r6, r7, lsl #8 /* 4k << 2^8 = 1MB */
ldr r5, BLOB_START
relocate:
adr r0, _start
add r2, r0, #(64 * 1024) /* blob maximum size is 64kB */
add r0, r0, #0x400 /* skip first 1024 bytes */
ldr r1, BLOB_START
/* r0 = source address
* r1 = target address
* r2 = source end address
*/
copy_loop:
ldmia r0!, {r3-r10}
stmia r1!, {r3-r10}
cmp r0, r2
ble copy_loop
bl led_off
ldr r0, BLOB_START
mov pc, r0
2009年12月30日 14点12分
1
.globl _start
_start: b reset
reset:
ldr r0, IC_BASE
mov r1, #0x00
str r1, [r0, #ICMR]
ldr r0, PWR_BASE
ldr r1, cpuspeed
str r1, [r0, #PPCR]
bl ledinit
bl memsetup
ldr r0, RST_BASE
ldr r1, [r0, #RCSR]
and r1, r1, #0x0f
teq r1, #0x08
bne normal_boot /* no, continue booting */
mov r1, #0x08
str r1, [r0, #RCSR] ;
/* handle Power Manager Sleep Status Register (PSSR), see 9.5.7.5 from [1]*/
ldr r1, [r0, #PSSR]
orr r1, r1, #0x08
orr r1, r1, #0x10
str r1, [r0, #PSSR]
/* get the value from the PSPR and jump to it */
ldr r0, PWR_BASE
ldr r1, [r0, #PSPR]
mov pc, r1
normal_boot:
mov r7, #0x1000
mov r6, r7, lsl #8 /* 4k << 2^8 = 1MB */
ldr r5, BLOB_START
relocate:
adr r0, _start
add r2, r0, #(64 * 1024) /* blob maximum size is 64kB */
add r0, r0, #0x400 /* skip first 1024 bytes */
ldr r1, BLOB_START
/* r0 = source address
* r1 = target address
* r2 = source end address
*/
copy_loop:
ldmia r0!, {r3-r10}
stmia r1!, {r3-r10}
cmp r0, r2
ble copy_loop
bl led_off
ldr r0, BLOB_START
mov pc, r0