首先需要确定 uboot 是否支持该功能。
U-Boot > ?
? - alias for 'help'
askenv - get environment variables from stdin
autoscr - run script from memory
base - print or set address offset
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
dhcp - boot image via network using DHCP/TFTP protocol
echo - echo args to console
eeprom - EEPROM sub-system
exit - exit script
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
go - start application at address 'addr'
help - print online help
iminfo - print header information for application image
imxtract- extract a part of a multi-image
itest - return true/false on integer compare
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
md - memory display
mdc - memory display cyclic
mii - MII utility commands
mm - memory modify (auto-incrementing)
mtest - simple RAM test
mw - memory write (fill)
mwc - memory write cyclic
nand - NAND sub-system
nboot - boot from NAND device
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
rarpboot- boot image via network using RARP/TFTP protocol
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
saves - save S-Record file over serial line
setenv - set environment variables
showvar- print local hushshell variables
sleep - delay execution for some time
test - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
usb - USB sub-system
usbboot - boot from USB device
version - print monitor version
U-Boot >
可知,uboot支持 kermit mode 和 ymodem mode 模式。
3.1.2.2.1.2. RS232
RS232的连接方式,是最常见的。 传输速度慢,优先使用NET
即,开发板上有串口接口,然后接了根RS232线,连到PC端,然后PC端用一个串口终端程序,连接开发板,比如常见的Windows XP系统自带的超级终端Hyper Terminal,功能强大的SecureCRT,以及Putty等等,都是不错的串口工具。
其中关于如何在Win7下面使用超级终端(Hyper Terminal),不了解的可以去参考:[11]
- Kermit
Kermit是一种协议,广泛使用的协议,用来传输文件和数据的协议,很早之前就有了此协议,所以现在很多地方都已实现和支持此协议。
关于Kermit和Ymodem的详情,去看我转的帖子:[2]
而关于Kermit,XModem,Ymodem和Zmodem之间的区别和联系,可以去看:[6]
目标
通过Kermit协议,将文件通过RS232接口传送到Uboot的内存中
前提
硬件
开发板中有RS232接口,并且已连接到PC端
软件
Uboot中已经实现kermit协议的loadb命令
这个,一般的uboot中都已实现。
此处说一个诡异的事情,之前遇到过,即使help中没有看到loadb的命令,但是实际也是支持loadb的,估计是uboot开发者,把此命令注释掉了,但是实际kermit协议用途太广泛,而uboot本身程序中早已经实现了,所以loadb还是已经在uboot中的了。
如何操作
在uboot中,输入loadb
在PC端使用串口程序去传送文件
以windows XP下的串口工具超级终端为例:
选择Transfer => Send File =>Protocol 选择Kermit,FileName选择你所要传送的文件->点击确定即可。然后就是慢慢传送文件了。
至于文件数据传输后,放在uboot的内存中的哪个位置,是由你uboot中的环境变量loadaddr决定,我这里的是loadaddr=0x800000。
当然,你也可以在执行loady的时候,后面加上你要的地址,比如:
loadb 0x1000000
Kermit协议,数据传输速度比较慢,我这里传输了个8MB的文件,大概要40分钟左右的。
- Ymodem
关于Ymodem协议,是从之前的Xmodem协议演化出来的,之后还有Zmodem。
简单的说就是,一个数据包大小为1KB的数据传输协议。
更多的解释,参见上面已经提到的[6]
目标
通过Ymodem协议,将文件通过RS232接口传送到Uboot的内存中
前提
硬件
开发板中有RS232接口,并且已连接到PC端
软件
Uboot中已经实现Ymodem协议的loady命令
如何操作
在uboot中,输入loady
在PC端使用串口程序去传送文件
以windows XP下的串口工具超级终端为例:
选择Transfer => Send File => Protocol 选择Ymodem,FileName选择你所要传送的文件 -> 点击确定即可。然后就是慢慢传送文件了。
示例
Bootldr> loady
## Ready for binary (ymodem) download to 0x00800000 at 115200 bps...
CCCxyzModem - CRC mode, 2(SOH)/8192(STX)/0(CAN) packets, 5 retries
## Total Size = 0x00800000 = 8388608 Bytes
相关软件:
【整理】如何在Win7中安装使用超级终端Hyper Terminal
http://www.crifan.com/order_how_to_install_in_win7_using_hyperterminal_hyper_terminal/