mini2440的裸板程序-tftp烧写

1、得使用好用到uboot加裸板程序

2、裸板程序如下:

 

ledon.S

.text
.global _start
_start:
	LDR R0,=0x56000010  @R0设置为GPBCON寄存器。此寄存器用于选择端口B各引脚的功能:是输出、输入或者其他

	MOV R1,#0x00001400 @设置R1=0x00000100,LED1 on,LED2 off,GPB5/GPB6 output port,
	@GPB5,bit11:bit10=0b01;GPB6,bit13:bit12=0b01
	@GPBCON=0b0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 0100 0000 0000
	@GPBCON=0x00001400
	
	STR R1,[R0] @R0中放入R1. 设置GPB5 GPB6为输出引脚,为[11:10]=0b01 ,[13:12]=0b01
				@以上完成了GPFCON寄存器的设置,此时GPB5  GPB6 为输出引脚
	LDR R0,=0x56000014 @R0设为GPBDAT寄存器,此寄存器用于读取/写入端口B各引脚的数据
	MOV R1,#0x00000040 @R1改为0x00000040
						@GPB5 output low,GPB6 output high,bit5=0b0,bit6=0b1

	STR R1,[R0] @R0中,放入R1。GPB5输出0,LED1点亮,GPB6输出1,LED2 not bright
MAIN_LOOP:
	B MAIN_LOOP

	

Makefile

CFLAGS 	:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -ffreestanding
ledon.bin:ledon.S
	arm-linux-gcc -g -c ledon.S -o ledon.o 
	arm-linux-ld  -Ttext  0x00000000 ledon.o -o ledon_elf
	arm-linux-objcopy -O binary  -S ledon_elf ledon.bin
clean:
	rm -rf  *.bin *elf *.o

生成二进制文件

ledon.bin

3、uboot阶段设置板子及相关烧写命令如下:

setenv ipaddr 192.168.2.226
setenv serverip 192.168.2.27
setenv gatewayip 192.168.2.255
saveenv


tftp 0x30008000 u-Superboot2440.bin;nand erase 0 0x60000;nand write 0x30008000 0 0x60000
tftp 0x30008000 ledon.bin;nand erase 60000 500000;nand write 0x30008000 0x60000 0x500000

or


tftp 0x30008000 u-boot.bin;nand erase 0 0x60000;nand write 0x30008000 0 0x60000
tftp 0x30008000 ledon.bin;nand erase 60000 500000;nand write 0x30008000 0x60000 0x500000
 

4、烧写后,重启就可以看到效果。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值