免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 910 | 回复: 0
打印 上一主题 下一主题

学习uboot提供的指令 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-07-14 21:30 |只看该作者 |倒序浏览
最经修改了一个u-boot1.2.0,认真的对比着vivi代码进行了uboot代码的学习,主要是u-boot1.2.0/cpu/arm920t/start.S汇编代码的学习,并且添加了对nandflash启动支持,今天晚上终于实验成功,启动信息如下:
U-Boot 1.2.0 (Jul 14 2008 - 20:13:44)                                    

DRAM:   4 MB            
Flash:  0      
*** Warning - bad CRC, using default environment                                                

In:    serial            
Out:   serial            
Err:   serial  
其中还是存在错误,主要是DRAM与FLASH信息与本板子的实际不一致,还得进一步修改哦!
查看uboot的指令:
H2410F # help            
?       - alias for 'help'                          
autoscr - run script from memory                                
base    - print or set address offset                                    
bdinfo  - print Board Info structure                                    
boot    - boot default, i.e., run 'bootcmd'                                          
bootd   - boot default, i.e., run 'bootcmd'                                          
bootelf - Boot from an ELF image in memory                                          
bootm   - boot application image from memory                                            
bootp   - boot image via network using BootP/TFTP protocol                                                         
bootvx  - Boot vxWorks from an ELF image                                       
cmp     - memory compare                        
coninfo - print console devices and information                                               
cp      - memory copy                     
crc32   - checksum calculation                              
date    - get/set/reset date & time                                   
dcache  - enable or disable data cache                                      
echo    - echo args to console                              
erase   - erase FLASH memory                           
flinfo  - print FLASH memory information                                       
go      - start application at address 'addr'                                             
help    - print online help                           
icache  - enable or disable instruction cache                                             
iminfo  - print header information for application image                                                        
imls    - list all images found in flash                                      
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                        
mm      - memory modify (auto-incrementing)                                          
mtest   - simple RAM test                        
mw      - memory write (fill)                             
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                                    
protect - enable or disable FLASH write protection                                                  
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                                                         
setenv  - set environment variables                                   
sleep   - delay execution for some time                                       
tftpboot- boot image via network using TFTP protocol                                                   
version - print monitor version  
并且验证了loadb、ping、version、mtest(时间很长哦)、go等几个指令,还好都能用!
现在拷贝网上一些关于uboot指令的资料,学习下:
http://www.chinaeda.cn/show.aspx?id=2408&cid=58
Printenv 打印环境变量。
Uboot> printenv
baudrate=115200
ipaddr=192.168.1.1
ethaddr=12:34:56:78:9A:BC
serverip=192.168.1.5
Environment size: 80/8188 bytes
Setenv 设置新的变量
Uboot> setenv myboard AT91RM9200DK
Uboot> printenv
baudrate=115200
ipaddr=192.168.1.1
ethaddr=12:34:56:78:9A:BC
serverip=192.168.1.5
myboard=AT91RM9200DK
Environment size: 102/8188 bytes
Saveenv 保存变量
命令将当前定义的所有的变量及其值存入flash中。用来存储变量及其值的空间只有8k字节,应不要超过。
Loadb 通过串口Kermit协议下载二进制数据。
Tftp 通过网络下载程序,需要先设置好网络配置
Uboot> setenv ethaddr 12:34:56:78:9A:BC
Uboot> setenv ipaddr 192.168.1.1
Uboot> setenv serverip 192.168.1.254     (tftp服务器的地址)
下载bin文件到地址0x20000000处。
Uboot> tftp 20000000 application.bin (application.bin应位于tftp服务程序的目录)
Uboot> tftp 32000000 vm
Linux
把server(IP=环境变量中设置的serverip)中/tftpdroot/ 下的vm
Linux
通过TFTP读入到物理内存32000000处。
Md 显示内存区的内容。
Mm 修改内存,地址自动递增。
Nm 修改内存,地址不自动递增。
Mw 用模型填充内存
mw 32000000 ff 10000(把内存0x32000000开始的0x10000字节设为0xFF)
Cp 拷贝一块内存到另一块
Cmp 比较两块内存区
这些内存操作命令后都可加一个后缀表示操作数据的大小,比如cp.b表示按字节拷贝。
Protect 写保护操作
protect on 1:0-3(就是对第一块FLASH的0-3扇区进行保护)
protect off 1:0-3取消写保护
Erase 擦除扇区。
erase: 删除FLASH的扇区
erase 1:0-2(就是对每一块FLASH的0-2扇区进行删除)
对DataFlash的操作
U-Boot在引导时如果发现NPCS0和NPCS3上连有DataFlash,就会分配虚拟的地址给它,具体为 :
0xC0000000---NPCS0
0xD0000000---NPCS3
run 执行设置好的脚本
Uboot> setenv flashit tftp 20000000 mycode.bin\; erase 10020000 1002FFFF\;
cp.b 20000000 10020000 8000
Uboot> saveenv
Uboot> run flashit
bootcmd 保留的环境变量,也是一种脚本
如果定义了该变量,在autoboot模式下,将会执行该脚本的内容。
Go 执行内存中的二进制代码,一个简单的跳转到指定地址
Bootm 执行内存中的二进制代码
要求二进制代码为制定格式的。通常为mkimage处理过的二进制文件。
起动UBOOT TOOLS制作的压缩
Linux
内核, bootm 3200000
Bootp 通过网络启动,需要提前设置好硬件地址。
得到所有命令列表
help  help usb, 列出USB功能的使用说明
ping  注:只能开发板PING别的机器
usb
usb start:  起动usb 功能
usb inf  列出设备
usb scan:  扫描usb storage(u 盘)设备
kgo  起动没有压缩的
Linux
内核
kgo 32000000
fatls 列出DOS FAT文件系统
fatls usb 0列出第一块U盘中的文件
fatload 读入FAT中的一个文件
fatload usb 0:0 32000000 aa.txt 把USB中的aa.txt 读到物理内存0x32000000处!
flinfo 列出flash的信息
nfs
nfs 32000000 192.168.0.2:aa.txt
把192.168.0.2(
Linux
的NFS文件系统)中的NFS文件系统中的aa.txt 读入内存0x32000000处。
                               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/66601/showart_1081737.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP