当前位置: 首页 > 工具软件 > tinyscript > 使用案例 >

【Tiny4412】Uboot常用命令

莘光华
2023-12-01

00. 目录

01. Uboot帮助命令

? 帮助
help 帮助

 DengJin #help 
    ?       - alias for 'help'   帮助
    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   从内存中启动elf镜像
    bootm   - boot application image from memory    从内存中启动应用镜像
    bootp   - boot image via network using BOOTP/TFTP protocol 通过网络协议引导镜像
    bootvx  - Boot vxWorks from an ELF image
    chpart  - change active partition    改变活动的分区
    cmp     - memory compare        内存比较
    coninfo - print console devices and information 串口设备和信息
    cp      - memory copy   内存拷贝
    crc32   - checksum calculation crc32校验
    dcache  - enable or disable data cache  使能或者禁用数据cache
    dnw     - dnw     - initialize USB device and ready to receive for Windows server (specific)

    echo    - echo args to console   输出参数到串口
    editenv - edit environment variable 编辑环境变量
    emmc    - Open/Close eMMC boot Partition    关闭或者打开emmc分区
    env     - environment handling commands 环境变量操作
    exit    - exit script   退出
    ext2format- ext2format - disk format by ext2    格式化ext3

    ext2load- load binary file from a Ext2 filesystem 从ext2文件系统中加载二进制文件
    ext2ls  - list files in a directory (default /) 列出ext2文件系统中的文件
    ext3format- ext3format - disk format by ext3    使用ext3格式化分区

    false   - do nothing, unsuccessfully    
    fastboot- fastboot- use USB Fastboot protocol  usb fastboot协议

    fatformat- fatformat - disk format by FAT32 格式化

    fatinfo - fatinfo - print information about filesystem 
    fatload - fatload - load binary file from a dos filesystem

    fatls   - list files in a directory (default /)
    fdisk   - fdisk for sd/mmc.  分区

    go      - start application at address 'addr' 从指定地址启动应用程序
    help    - print command description/usage	帮助信息
    icache  - enable or disable instruction cache 使能和禁用指令cache
    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     内存的内容显示
    mm      - memory modify (auto-incrementing address)   内存的内容修改
    mmc     - MMC sub system
    mmcinfo - mmcinfo <dev num>-- display MMC info 显示MMC信息
    movi    - movi  - sd/mmc r/w sub system for SMDK board
    mtdparts- define flash/nand partitions
    mtest   - simple RAM read/write test
    mw      - memory write (fill)
    nfs     - boot image via network using NFS protocol 使用NFS协议启动镜像
    nm      - memory modify (constant address) 内存修改
    ping    - send ICMP ECHO_REQUEST to network host
    printenv- print environment variables 打印环境变量
    reginfo - print register information     打印寄存器信息
    reset   - Perform RESET of the CPU     重置CPU     
    run     - run commands in an environment variable 运行环境变量中的命令
    saveenv - save environment variables to persistent storage 保存设置
    setenv  - set environment variables     设置环境变量
    showvar - print local hushshell variables
    sleep   - delay execution for some time     睡眠
    source  - run script from memory 从内存中运行脚本
    test    - minimal test like /bin/sh
    tftpboot- boot image via network using TFTP protocol
    true    - do nothing, successfully
    usb     - USB sub-system
    version - print monitor version 输出u-boot的版本

02. md命令

DengJin # help md
md - memory display

Usage:
md [.b, .w, .l] address [# of objects]
DengJin # 

# 默认显示256字节
DengJin # md 40000000
40000000: ffffffff ffffffff ffffffff ffffffff    ................
40000010: ffffffff ffffffff ffffffff ffffffff    ................
40000020: ffffffff ffffffff ffffffff ffffffff    ................
40000030: ffffffff ffffffff ffffffff ffffffff    ................
40000040: ffffffff ffffffff ffffffff ffffffff    ................
40000050: ffffffff ffffffff ffffffff ffffffff    ................
40000060: ffffffff ffffffff ffffffff ffffffff    ................
40000070: ffffffff ffffffff ffffffff ffffffff    ................
40000080: ffffffff ffffffff ffffffff ffffffff    ................
40000090: ffffffff ffffffff ffffffff ffffffff    ................
400000a0: ffffffff ffffffff ffffffff ffffffff    ................
400000b0: ffffffff ffffffff ffffffff ffffffff    ................
400000c0: ffffffff ffffffff ffffffff ffffffff    ................
400000d0: ffffffff ffffffff ffffffff ffffffff    ................
400000e0: ffffffff ffffffff ffffffff ffffffff    ................
400000f0: ffffffff ffffffff ffffffff ffffffff    ................
DengJin # 

# 以字节为单位显示64个字节
DengJin # md.b 400000000
00000000: 06 00 00 ea fe ff ff ea fe ff ff ea fe ff ff ea    ................
00000010: fe ff ff ea fe ff ff ea 1a 30 00 ea 1b 30 00 ea    .........0...0..
00000020: a4 01 9f e5 00 10 a0 e3 00 10 80 e5 9c 01 9f e5    ................
00000030: 00 00 90 e5 3e 00 00 e2 3e 00 30 e3 0d 00 00 1a    ....>...>.0.....
DengJin # 

# 从指定的地址开始显示8个字节
DengJin # md.b 40000000 8
40000000: ff ff ff ff ff ff ff ff    ........
DengJin # 

# 以两个字节为单位 显示8个单位
DengJin # md.w 40000000 8
40000000: ffff ffff ffff ffff ffff ffff ffff ffff    ................
DengJin # 

# 显示四个字节
DengJin # md.l 40000000 1
40000000: ffffffff    ....
DengJin # 


03. mm命令

内存修改内容命令

DengJin # help mm
mm - memory modify (auto-incrementing address)

Usage:
mm [.b, .w, .l] address
DengJin # 

# 字节
DengJin # mm.b 40008000
40008000: ff ? 0xff
40008001: ff ? 0xee
40008002: ff ? 
40008003: ff ? 
40008004: ff ? quit

# 两个字节为单位
DengJin # mm.w 40008000
40008000: eeff ? 0x1111
40008002: ffff ? 0x2222
40008004: ffff ? 0x3333
40008006: ffff ? quit

# 四个字节为单位
DengJin # mm.l 40008000
40008000: 22221111 ? 11
40008004: ffff3333 ? 2
40008008: ffffffff ? 33
4000800c: ffffffff ? 44
40008010: ffffffff ? 55
40008014: ffffffff ? 66
40008018: ffffffff ? 77
4000801c: ffffffff ? 88
40008020: ffffffff ? quit

应用示例一:控制LED灯

# LED --->  GPM4_0 GPM4_1 GPM4_2 GPM4_3
# CON 0x110002E0 
# DAT 0x110002E4

# 所有的灯亮
DengJin #mm.l 0x110002E4  
110002e4: 0000000c ? 0
110002e8: 00005555 ? quit

# 所有的灯灭
DengJin #mm.l 0x110002E4
110002e4: 00000000 ? 0xf
110002e8: 00005555 ? quit

应用示例二:控制蜂鸣器

# Buzzer ---> GPD0_0

# CON 0x114000A0
# DAT 0x114000A4

# 配置为输出
DengJin #mm.l 0x114000A0
114000a0: 00000000 ? 0x1
114000a4: 0000000c ? quit


# 高电平 峰鸣器叫
DengJin #mm.l 0x114000A4
114000a4: 0000000c ? 0xd
114000a8: 00000055 ? quit


# 低电平 峰鸣器不叫
DengJin #mm.l 0x114000A4
114000a4: 0000000d ? c
114000a8: 00000055 ? quit

04. printenv命令

DengJin # help printenv
printenv - print environment variables

Usage:
printenv 
    - print values of all environment variables
printenv name ...
    - print value of environment variable 'name'
DengJin # 

# 输出环境变量
DengJin #printenv
baudrate=115200  波特率
bootcmd=movi read kernel 0 40008000;movi read rootfs 0 41000000 400000;bootm 40008000 41000000
bootdelay=5 启动内核的时候延时
ethaddr=00:40:5c:26:0a:5b   硬件地址
gatewayip=192.168.0.1       网关
ipaddr=192.168.0.20         IP地址
netmask=255.255.255.0       掩码
serverip=192.168.0.10       服务器的IP地址

Environment size: 252/16380 bytes
DengJin #

05. setenv命令

DengJin # help setenv
setenv - set environment variables

Usage:
setenv name value ...
    - set environment variable 'name' to 'value ...'
setenv name
    - delete environment variable 'name'
DengJin # 


# 设置环境变量
DengJin #setenv aa 33


# 变量名后没有值 那么就是取消环境变量
DengJin #setenv aa 

06. saveenv命令

DengJin # help saveenv
saveenv - save environment variables to persistent storage

Usage:
saveenv 
DengJin # 

# 保存环境变量
DengJin #saveenv
Saving Environment to SMDK bootable device...
done

07. reset命令

DengJin # help reset
reset - Perform RESET of the CPU

Usage:
reset 
DengJin # 

# 重新启动u-boot
DengJin #reset

08. base命令

DengJin # help base
base - print or set address offset

Usage:
base 
    - print address offset for memory commands
base off
    - set address offset for memory commands to 'off'
DengJin # 


# 设置偏移地址
DengJin # base 40008000
Base Address: 0x40008000

# 打印偏移地址
DengJin # base
Base Address: 0x40008000
DengJin # 

09. bdinfo命令

DengJin # help bdinfo
bdinfo - print Board Info structure

Usage:
bdinfo 
DengJin # 

DengJin # bdinfo
arch_number = 0x00001200
boot_params = 0x40000100
DRAM bank   = 0x00000000
-> start    = 0x40000000
-> size     = 0x10000000
DRAM bank   = 0x00000001
-> start    = 0x50000000
-> size     = 0x10000000
DRAM bank   = 0x00000002
-> start    = 0x60000000
-> size     = 0x10000000
DRAM bank   = 0x00000003
-> start    = 0x70000000
-> size     = 0x0FF00000
ethaddr     = 00:40:5c:26:0a:5b
ip_addr     = 192.168.0.20
baudrate    = 0 bps
TLB addr    = 0x3FFF0000
relocaddr   = 0x43E00000
reloc off   = 0x00000000
irq_sp      = 0x43CFBF58
sp start    = 0x43CFBF50
FB base     = 0x00000000
DengJin # 

10. cmp命令

DengJin # help cmp
cmp - memory compare

Usage:
cmp [.b, .w, .l] addr1 addr2 count
DengJin # 

11. coninfo命令

DengJin # help coninfo
coninfo - print console devices and information

Usage:
coninfo 
DengJin # coninfo
List of available devices:
serial   80000003 SIO 
DengJin # 

12. crc32命令

DengJin # help crc32
crc32 - checksum calculation

Usage:
crc32 address count [addr]
    - compute CRC32 checksum [save at addr]
DengJin # crc32 40000000 8
CRC32 for 40000000 ... 40000007 ==> 2144df1c
DengJin # 

13. dcache

DengJin # help dcache
dcache - enable or disable data cache

Usage:
dcache [on, off]
    - enable or disable data (writethrough) cache

# 查看dcache状态
DengJin # dcache   
Data (writethrough) Cache is OFF
DengJin # 

14. echo命令

DengJin # help echo
echo - echo args to console

Usage:
echo [args..]
    - echo args to console; \c suppresses newline
    
# 输出信息到终端
DengJin # echo "hello world"
hello world
DengJin # 


15. emmc命令

DengJin # help emmc
emmc - Open/Close eMMC boot Partition

Usage:
emmc open <device num> 
emmc close <device num> 

16. env命令

DengJin # help env
env - environment handling commands

Usage:
env default -f - reset default environment
env edit name - edit environment variable
env export [-t | -b | -c] addr [size] - export environmnt
env import [-d] [-t | -b | -c] addr [size] - import environmnt
env print [name ...] - print environment
env run var [...] - run commands in an environment variable
env save - save environment
env set [-f] name [arg ...]

17. exit命令

DengJin # help exit
exit - exit script

Usage:
exit 
DengJin # exit
exit not allowed from main input shell.
DengJin # 

18. version命令

DengJin # help version
version - print monitor version

Usage:
version 

# 输出uboot版本信息
DengJin # version

U-Boot 2010.12 (Jun 04 2020 - 20:12:26) for TINY4412
DengJin # 

19. source命令

DengJin # help source 
source - run script from memory

Usage:
source [addr]
        - run script starting at addr
        - A valid image header must be present
DengJin # 


20. sleep命令

DengJin # help sleep
sleep - delay execution for some time

Usage:
sleep N
    - delay execution for N seconds (N is _decimal_ !!!)
DengJin # sleep 3
DengJin # 

21. showvar命令

DengJin # help showvar
showvar - print local hushshell variables

Usage:
showvar 
    - print values of all hushshell variables
showvar name ...
    - print value of hushshell variable 'name'
DengJin # showvar
HUSH_VERSION=0.01
DengJin # 

22. reginfo命令

DengJin # help reginfo
reginfo - print register information

Usage:
reginfo 
DengJin # 

23. 附录

其它命令放在后面部署环境的时候使用…

 类似资料: