uboot sf 命令用法 |
您所在的位置:网站首页 › sf951678239675788 › uboot sf 命令用法 |
uboot中如果支持spi/qspi flash, 那么可以使用sf的erase, read, write命令操作spi flash sf read用来读取flash数据到内存 sf write写内存数据到flash sf erase 擦除指定位置,指定长度的flash内容, 在进行写flash的时候一定要先进行擦除,否则会失败,因为flash只能从1变为0。 具体用法 sf - SPI flash sub-system Usage: sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus and chip select sf read addr offset len - read `len' bytes starting at `offset' to memory at `addr' sf write addr offset len - write `len' bytes from memory at `addr' to flash at `offset' sf erase offset [+]len - erase `len' bytes from `offset' `+len' round up `len' to block size sf update addr offset len - erase and write `len' bytes from memory at `addr' to flash at `offset'
用法: sf probe 0在使用sf的其他命令之前必须先进行此操作进行连接flash。否则会出现如下情况。 sf write 0x82000000 0x8000 0x20000 把内存0x8200 0000处的数据, 写入flash的偏移0x80000, 写入数据长度为0x20000(128KB), 操作偏移和长度最小单位是Byte sf read 0x82000000 0x10000 0x20000 把flash偏移0x10000(64KB)处, 长度为0x20000(128KB)的数据, 写入到内存0x82000000, 操作偏移和长度最小单位是Byte sf erase 0x0 0x10000 擦除偏移0x0处, 到0x10000之间的擦除块, 擦除操作是以erase block为单位的, 要求offset和len参数必须是erase block对齐的 从sf命令,可以看出几点: 1. spi flash没有oob数据存在, 也就是不用考虑EDC ECC, 也没有坏块管理概念. 2. 支持Byte级的读写操作, 支持随机访问. 如何查看flash的内容 可以结合uboot md命令查看内存数据 md 0x82000000 0x100如下操作 打印0x82000000开始, 长度范围0x100字节的内存数据 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |