1、 内存/寄存器操作指令 nm 修改内存值 (指定地址)admin管理员组文章数量:1530517
格式: nm [.b, .w, .l] address mm 修改内存值(地址自动加一)
格式: mm [.b, .w, .l] address md 显示内存值
格式: md [.b, .w, .l] address [# of objects] mw 用指定的数据填充内存
格式: mw [.b, .w, .l] address value [count] cp 内存的拷贝(包括内存与Nor Flash间的数据拷贝)
格式:cp [.b, .w, .l] source target count 上面是查看和修改内存值的指令,可以查看和修改SDRAM和寄存器值。
[.b, .w, .l]代表了查看和修改形式:Byte、word、long
使用范例:
[u-boot@apple_guet]# md.b 0x30008000 20 |
先熄灭后点亮LED1的范例:(这个实验要结合芯片数据手册和mini2440的原理图来理解)
[u-boot@MINI2440]# md 0x56000014 1 |
2、Nor Flash指令 Nor Flash 的命令经常用于烧写数据到Nor Flash 。
flinfo 打印Flash存储器的信息,并列出所有Sector。
flinfo N 单独打Flash存储器N Block的信息。(在有多块Nor Flash时使用) 使用范例:
[u-boot@apple_guet]# flinfo |
因为Nor Flash的读取接口和SDRAM是一样的,所以Nor Flash的读取也是使用md命令。范例如下:
[u-boot@apple_guet]# md.b 0x0 20 |
protect :对Flash 写保护的操作,可以使能和解除写保护。
格式:
protect on/off start end
protect on/off start +end
protect on/off N:SF[-SL]
protect on/off bank N
protect on/off all
第1 个参数on 代表使能写保护;off 代表解除写保护。
第2 、3 参数是指定Flash 写保护操作范围
start end是照起始地址和结束地址定义范围,start是擦除块的起始地址;end 是擦除末尾块的结束地址。
例如:擦除Sector 2和Sector 3区域命令为erase 20000 3ffff 。
start +end是照起始地址和操作字节数定义范围,这种方式最常用。start是擦除块的起始地址;end 是擦除的字节数。
例如:擦除Sector 2和Sector 3区域命令为erase 20000 +20000
N:SF[-SL]是按照组和扇区,N 表示Flash 的Block号,SF 表示擦除起始Sector号,SL 表示擦除结束Sector号。
例如:擦除Block1 的Sector 2和Sector 3区域命令为erase 1:2-3。
bank N是擦除整个Block,擦除Block号为N 的整个Flash。
all是擦除全部Flash。
注意:Nor Flash擦除的最小单位是Sector,也就是0x10000字节,如果你定义的大小不满1 Sector或超过Sector的边界,那么被定义到的Sector会被全部擦除。
erase :擦除Flash的命令
格式:
erase start end
erase start +end
erase N:SF[-SL]
erase bank N
erase all
参数是指定Flash 擦除操作范围,跟写保护的方式相同。
以下的范例将mini2440的Nor Flash的Sector 16写保护,再解除保护,擦除数据,最后将起始的20字节拷贝到Sector 16。
[u-boot@apple_guet]# flinfo 1 |
3、USB 操作指令
指令 | 功能 |
usb reset | 初始化USB控制器 |
usb stop [f] | 关闭USB控制器 |
usb tree | 已连接的USB设备树 |
usb info [dev] | 显示USB设备[dev]的信息 |
usb storage | 显示已连接的USB存储设备 |
usb dev [dev] | 显示和设置当前USB存储设备 |
usb part [dev] | 显示USB存储设备[dev]的分区信息 |
usb read addr blk# cnt | 读取USB存储设备数据 |
[u-boot@apple_guet]# usb reset 30008000: fa 31 c0 8e d8 8e c0 8e d0 bc 00 7c fb fc 89 e6 .1.........|.... 30008010: bf 00 06 b9 00 01 f3 a5 ea dc 06 00 00 10 00 01 ................ 30008020: 00 00 7c 00 00 00 00 00 00 00 00 00 00 80 3f 00 ..|...........?. 30008030: ff 00 ed 01 1e 0e 1f 3a 16 10 00 74 06 1f ea 36 .......:...t...6 30008040: e7 00 f0 3d fb 54 75 05 8c d8 fb eb 1d 80 fc 08 ...=.Tu......... 30008050: 75 1b e8 81 00 8a 36 13 00 fe ce 8b 0e 15 00 86 u.....6......... 30008060: cd c0 e1 06 0a 0e 11 00 31 c0 f8 eb 65 80 fc 02 ........1...e... 30008070: 72 cb 80 fc 04 77 c6 60 80 cc 40 50 be 00 00 c7 r....w.`..@P.... 30008080: 04 10 00 30 e4 89 44 02 89 5c 04 8c 44 06 66 31 ...0..D..\..D.f1 30008090: c0 66 89 44 0c 88 f0 f6 26 11 00 88 cf 88 eb c0 .f.D....&....... 300080a0: ef 06 81 e1 3f 00 01 c8 48 89 c7 a1 13 00 f7 26 ....?...H......& 300080b0: 11 00 f7 e3 01 f8 81 d2 00 00 89 44 08 89 54 0a ...........D..T. 300080c0: 58 30 c0 8a 16 10 00 e8 0c 00 88 26 03 00 61 a1 X0.........&..a. 300080d0: 02 00 1f ca 02 00 9c ff 1e 22 00 c3 80 fa 8f 7f ........."...... 300080e0: 04 88 16 2d 06 be 87 07 e8 8d 00 be be 07 31 c0 ...-..........1. 300080f0: b9 04 00 f6 04 80 74 03 40 89 f5 81 c6 10 00 e2 ......t.@....... 30008100: f2 48 74 02 cd 18 bf 05 00 be 1d 06 c7 44 02 01 .Ht..........D.. 30008110: 00 66 8b 46 08 66 89 44 08 b8 00 42 8a 16 2d 06 .f.F.f.D...B..-. 30008120: cd 13 73 0d 4f 74 49 30 e4 8a 16 2d 06 cd 13 eb ..s.OtI0...-.... 30008130: d8 a1 fe 7d 3d 55 aa 75 37 fa 66 a1 4c 00 66 a3 ...}=U.u7.f.L.f. 30008140: 3f 06 be 13 04 8b 04 48 89 04 c1 e0 06 8e c0 31 ?......H.......1 30008150: ff be 1d 06 b9 60 00 fc f3 a5 c7 06 4c 00 17 00 .....`......L... 30008160: a3 4e 00 fb 8a 16 2d 06 89 ee fa ea 00 7c 00 00 .N....-......|.. 30008170: be aa 07 e8 02 00 eb fe ac 20 c0 74 09 b4 0e bb ......... .t.... 30008180: 07 00 cd 10 eb f2 c3 53 74 61 72 74 20 62 6f 6f .......Start boo 30008190: 74 69 6e 67 20 66 72 6f 6d 20 55 53 42 20 64 65 ting from USB de 300081a0: 76 69 63 65 2e 2e 2e 0d 0a 00 42 6f 6f 74 20 66 vice......Boot f 300081b0: 61 69 6c 65 64 00 00 00 ea eb d4 ca 00 00 00 00 ailed........... 300081c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 300081d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 300081e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 01 ................ 300081f0: 01 00 0c fe 7f ec 3f 00 00 00 c1 17 79 00 55 aa ......?.....y.U. |
4、SD卡(MMC)指令
SD卡的使用命令比较简单,只有初始化和设备信息的显示,读写是通过文件系统命令实现的。
mmc init [dev] - 初始化MMC子系统
mmc device [dev] - 查看和设置当前设备
使用和USB类似,在所有的命令使用前,必须先插入SD卡,然后使用:mmc init,以初始化MMC 控制器,获取设备信息。
我在mini2440中插入1GB SD卡:
[u-boot@apple_guet]# mmc init Serial number: 7864775 Manufacturing date: 11/2006 CRC: 0x4f, b0 = 1 READ_BL_LEN=6, C_SIZE_MULT=7, C_SIZE=4095 size = 0 SD Card detected RCA: 0x2 type: SD mmc1 is available [u-boot@apple_guet]# mmc device mmc1 is current device |
fatinfo:显示文件系统的相关信息
格式:fatinfo <interface> <dev[:part]>
Interface:代表接口,如usb、mmc;
dev:代表设备编号,如0、1……;
part:代表存储设备中的分区,如1、2……。
fatload:从FAT32文件系统中读取二进制文件到SDRAM。
格式:fatload <interface> <dev[:part]> <addr> <filename> [bytes]
Interface、dev和part同上;
addr:代表写入SDRAM的地址;
filename:代表存储设备中的文件名;
bytes:代表从存储设备中读取的文件大小,可不填;如果填的数据比文件小,就只读取bytes字节,如果填的数据比文件大,也只读取文件的大小。
fatls:列出FAT32文件系统中目录里的文件。
格式:fatls <interface> <dev[:part]> [directory]
Interface、dev和part同上;
directoryr:代表所要查看的目录,可不填,默认为/。
这些指令基本上要和U盘或者SD卡同时使用,主要用于读取这些移动存储器上的FAT32分区。
使用范例:
[u-boot@apple_guet]# usb part 0 |
7、 系统引导指令
boot 和bootd 都是运行ENV”bootcmd”中指定的指令。
bootm 指令是专门用于启动在SDRAM中的用U-boot的mkimage工具处理过的内核映像。
格式:bootm [addr [arg ...]]
addr 是内核映像所在的SDRAM中的地址
当启动的是Linux内核时,'arg' 可以使 initrd 的地址。
[u-boot@apple_guet]# setenv bootcmd tftp\;bootm |
7、EEPROM 读写指令
eeprom - I2C 接口的EEPROM 读写指令
格式:
eeprom read addr off cnt
eeprom write addr off cnt
第一个参数addr 是要写入或读出的数据在SDRAM中的存放地址;
第二个参数off 是在EEPROM中的偏移;
第三个参数cnt 是读写的数据字节数。
使用范例:
[u-boot@apple_guet]# md.b 0x30008000 2 |
8、设置和读取RTC指令
date - 设置和读取RTC
格式:
date [MMDDhhmm[[CC]YY][.ss]]
MM:月份
DD:日期
hh:小时
mm 分钟
CC:年份的前两个数字
YY:年份的后两个数字
ss:秒数
使用范例:
[u-boot@MINI2440]# date |
9、脚本运行指令
run var [...]
var :ENV中的脚本名使用范例:
[u-boot@apple_guet]# setenv a_run_test echo $bootfile \; version |
10、系统重启指令
reset - 重启CPU
[u-boot@apple_guet]# resetresetting ...
U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)
modified by tekkamanninja (tekkamanninja@163.com)
Love Linux
I2C: ready
DRAM: 64 MB
Flash: 2 MB
NAND: 128 MiB
Video: 240x320x16 20kHz 62Hz
In: serial
Out: serial
Err: serial
Net: dm9000
U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)
modified by apple_guet
(apple_guet@163.com)
Love Linux
Hit any key to stop autoboot: 0
[u-boot@apple_guet]#
版权声明:本文标题:uboot常用 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1725876037a1046655.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论