uboo对内存操作读写命令的基本使用

内存操作命令

直接对DRAM进行读写的操作,uboot常用的内存操作命令有md,nm,mm,mw,cp和cmp.

md命令: 显示内存值

c 复制代码
# md
md - memory display
Usage:
md [.b, .w, .l, .q] address [# of objects]
b:1个字节 byte 
w:2个字节 world 
l:4个字节 long 
of objects 以word 为单位的16进制数目
md.b 80000000 14   //以内存开始地址80000000的内存数据
80000000: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a    ................
80000010: 0a 0a 0a 0a 
md.l 80000000 14
80000000: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000010: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000020: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000030: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000040: f7c62eba 83cc816e a1c2ec9e d457444a    ....n.......JDW.

nm命令用于修改指定地址内存值 //按q退出

c 复制代码
Usage:
nm [.b, .w, .l, .q] address
# nm.l 80000000
80000000: 00000000 ? 99
80000000: 00000099 ? q
# md.l 80000000
80000000: 00000099

mm命令用于修改指定地址内存值,地址会++

c 复制代码
# mm.l 80000000   
80000000: 0a0a0a0a ? 0x00
80000004: 0a0a0a0a ? 3
80000008: 0a0a0a0a ? 33
8000000c: 0a0a0a0a ? 33
80000010: 0a0a0a0a ? 33
80000014: 0a0a0a0a ? q
# md.l 80000000 6
80000000: 00000000 00000003 00000033 00000033    ........3...3...
80000010: 00000033 0a0a0a0a                      3.......

mw命令

命令mw用于使用一个指定的数据填充一段内存

c 复制代码
# mw
mw - memory write (fill)
Usage:
mw [.b, .w, .l, .q] address value [count]
# mw.l 80000000  0a0a0a0a 10
# md.l 80000000 10
80000000: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000010: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000020: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000030: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
# 

cp命令

cp是数据拷贝命令,用于将DRAM中数据从一段内存拷贝到另一段内存中.

c 复制代码
Usage:
cp [.b, .w, .l, .q] source target count
cp.l 80000000 80000010 10
# mw.l 80000000  0a0a0a0a 10
# cp.l 80000000 80000010 10 
# md.l 80000010 10          
80000010: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000020: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000030: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................
80000040: 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a    ................

cmp命令:

比较命令,用于比较两段内存的数据是否相等

c 复制代码
Usage:
cmp [.b, .w, .l, .q] addr1 addr2 count
# cmp.l 80000000  80000010 10
Total of 16 word(s) were the same

# cmp.l 80000000  80000050 10    
word at 0x0000000080000000 (0xa0a0a0a) != word at 0x0000000080000050 (0xedb43e85)   //不相等
Total of 0 word(s) were the same
相关推荐
White_Mountain10 分钟前
在Ubuntu中配置mysql,并允许外部访问数据库
数据库·mysql·ubuntu
cominglately2 小时前
centos单机部署seata
linux·运维·centos
魏 无羡2 小时前
linux CentOS系统上卸载docker
linux·kubernetes·centos
coder_pig2 小时前
📝小记:Ubuntu 部署 Jenkins 打包 Flutter APK
flutter·ubuntu·jenkins
CircleMouse2 小时前
Centos7, 使用yum工具,出现 Could not resolve host: mirrorlist.centos.org
linux·运维·服务器·centos
木子Linux3 小时前
【Linux打怪升级记 | 问题01】安装Linux系统忘记设置时区怎么办?3个方法教你回到东八区
linux·运维·服务器·centos·云计算
mit6.8243 小时前
Ubuntu 系统下性能剖析工具: perf
linux·运维·ubuntu
鹏大师运维3 小时前
聊聊开源的虚拟化平台--PVE
linux·开源·虚拟化·虚拟机·pve·存储·nfs
watermelonoops3 小时前
Windows安装Ubuntu,Deepin三系统启动问题(XXX has invalid signature 您需要先加载内核)
linux·运维·ubuntu·deepin
滴水之功4 小时前
VMware OpenWrt怎么桥接模式联网
linux·openwrt