海思Hi35xx 通过uboot 读取U盘文件进行固件升级

海思Hi35xx 通过uboot 读取U盘文件进行固件升级 JQ 2023-11-24 16:27:11 353

前言

基本过程为:uboot 启动后,通过命令将U盘的的文件读取到内存中,再通过uboot 的flash 写入命令将读取到内存中的升级文件写入到flash的固定位置。

(一)usb常用命令

uboot一般支持对usb的操作命令有:start,reset,stop,tree,info,storage,dev,part,read,write等。

Usage:
usb start - start (scan) USB controller
usb reset - reset (rescan) USB controller
usb stop [f] - stop USB [f]=force stop
usb tree - show USB device tree
usb info [dev] - show available USB devices
usb storage - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#' to memory address `addr'
usb write addr blk# cnt - write `cnt' blocks starting at block `blk#' from memory address `addr'

1.usb start

Wisdom # usb start
(Re)start USB...
USB:   scanning bus for devices... 
2 USB Device(s) found
       scanning bus for storage devices... iVendor 0 iProduct 0
iVendor 5E3 iProduct 727
ss->subclass : 0x6 
usb_stor_get_info->1496,blksz:512
1 Storage Device(s) found
Wisdom #

2.usb tree

Wisdom # usb tree

Device Tree:
  1  Hub (12 Mb/s, 0mA)
  |   OHCI Root Hub 
  |
  +-2  Mass Storage (12 Mb/s, 500mA)
       Generic USB Storage 000000000250

3.usb infor

Wisdom # 
Wisdom # usb info
1: Hub,  USB Revision 1.10
 -  OHCI Root Hub 
 - Class: Hub
 - PacketSize: 8  Configurations: 1
 - Vendor: 0x0000  Product 0x0000 Version 0.0
   Configuration: 1
   - Interfaces: 1 Self Powered 0mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 1
     - Class Hub
     - Endpoint 1 In Interrupt MaxPacket 2 Interval 255ms

2: Mass Storage,  USB Revision 2.0
 - Generic USB Storage 000000000250
 - Class: (from Interface) Mass Storage
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x05e3  Product 0x0727 Version 2.80
   Configuration: 1
   - Interfaces: 1 Bus Powered 500mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 2
     - Class Mass Storage, Transp. SCSI, Bulk only
     - Endpoint 1 In Bulk MaxPacket 64
     - Endpoint 2 Out Bulk MaxPacket 64

4.usb part

Wisdom # usb part
index: 0

Partition Map for USB device 0  --   Partition Type: DOS

Partition     Start Sector     Num Sectors     Type
    1                 8192         7618560       b
index: 1
Wisdom # 
5.usb storage
Wisdom # usb storage
  Device 0: Vendor: Generic  Rev: 0250 Prod: STORAGE DEVICE  
            Type: Removable Hard Disk
            Capacity: 3724.0 MB = 3.6 GB (7626752 x 512)
Wisdom #

(二)U盘升级操作

1. usb start  开始usb 操作

Wisdom # usb start
(Re)start USB...
USB:   scanning bus for devices... 
2 USB Device(s) found
       scanning bus for storage devices... iVendor 0 iProduct 0
iVendor 5E3 iProduct 727
ss->subclass : 0x6 
usb_stor_get_info->1496,blksz:512
1 Storage Device(s) found

2. fatls usb 0  查看usb 中的文件

Wisdom # fatls usb 0
index: 0
            .trash-1000/
            4.8.7/
            5.9.0/
            20190323/
            dejavu/
            fb/
            install/
            mouse/
            qt_4.8_install/
            rules.d/
   935839   gui_test 
      727   profile 
  3671576   uidemo18 
  3190568   uimage 

4 file(s), 10 dir(s)

Wisdom #

3. 擦除内存中的一块空间用来放置升级文件:

将0x82000000开始的 4M空间填上0xFF

mw.b 82000000 ff 400000

4. 加载usb的升级文件到内存

fatload usb 0 0x82000000 uimage

5. 擦除flash中原来的数据

nand erase 100000 400000

6. 将内存中的升级文件写入到flash中去

nand write 82000000 100000 400000

3~6操作过程

Wisdom # mw.b 82000000 ff 400000
Wisdom # fatload usb 0 0x82000000 uimage
index: 0
##########################################################################################################################################################################################

3190568 bytes read
Wisdom # nand erase 100000 400000

NAND erase: device 0 offset 0x100000, size 0x400000
Erasing at 0x4e0000 -- 100% complete.
OK
Wisdom # nand write 82000000 100000 400000

NAND write: device 0 offset 0x100000, size 0x400000
 4194304 bytes written: OK
Wisdom #

全部升级操作命令:

usb start
fatls usb 0 
mw.b 82000000 ff 400000	
fatload usb 0 0x82000000 uimage 
nand erase 100000 400000  
nand write 82000000 100000 400000


声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
JQ
红包 1 收藏 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
JQ
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区