Fork me on GitHub

【嵌入式学习分享】1.裸板LED

start.s:

.global _start
_start:
/ 关看门狗 /
/ 往WTCON(0x53000000)写0 /
ldr r0, =0x53000000
mov r1, #0
str r1, [r0]
/ 设置GPBCON GPB5,6,7,8输出 /
ldr r1, =0x56000010
mov r0, #0x15400
str r0, [r1]
/ 设置GPBDAT让LED2 (B6)输出0 /
ldr r1, =0x56000014
mov r0, #0
str r0, [r1]
main:
b main

Makefile:

led.bin:start.o
arm-linux-ld -Ttext 0 -o led.elf start.o
arm-linux-objcopy -O binary led.elf led.bin
arm-linux-objdump -D led.elf > led.dis
start.o:start.s
arm-linux-gcc -o start.o start.s -c

 

于是,LED2点亮了。