在ARM ATC培训期间,做的一个小练习,让2440开发板启动并驱动了LED,瞒好玩的……之前做嵌入式linux项目的时候,并不了解开发板的启动过程,现在一步步慢慢地把之前没学的东西都拾起来了。
写完init.s,后将其烧进0x0地址,就可以启动了。
AREA init, CODE, READONLY
ENTRY
ldr pc, =START
ldr pc, =0xa0000004
ldr pc, =0xa0000008
ldr pc, =0xa000000c
ldr pc, =0xa0000010
ldr pc, =0xa0000014
ldr pc, =0xa0000018
ldr pc, =0xa000001c
START
;SET CPSR
mrs r0, cpsr
bic r0, r0, #0x0003
msr cpsr_c, r0
;BWSCON
ldr r0, =0x48000000
ldr r1, =0x22121110
str r1, [r0]
;BANKCON6
ldr r0, =0x4800001c
ldr r1, =0x00018005
str r1, [r0]
;REFRESH
ldr r0, =0x48000024
ldr r1, =0x00960542
str r1, [r0]
;BANKSIZE
ldr r0, =0x48000028
ldr r1, =0x00000032
str r1, [r0]
;MODE REG SET BANK6
ldr r0, =0x4800002c
ldr r1, =0x00000030
str r1, [r0]
;LED
start
LDR r0,=0x56000050
MOV r1,#0x4000
loop
MOV r3, r1
STR r1,[r0]
LDR r0,=0x56000054
LDR r1,=0x55
STR r1,[r0]
stop
LDR r0,=0x56000050
MOV r1, r3, ROR #2
B loop
END