uboot sf 命令用法

uboot sf 命令用法


转载至:http://blog.csdn.net/kickxxx/article/details/56012456


536人阅读 评论(0) 收藏 举报

分类:

uboot中如果支持spi/qspi flash,那么可以使用sf的erase,read,write命令操作spi flash


sf read用来读取flash数据到内存

sf write写内存数据到flash

sf erase 擦除指定位置,指定长度的flash内容,擦除后内容全1


具体用法

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 memor 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

在使用sf read sf write之前,一定要调用sf probe


sf write 0x82000000 0x0 0x20000

把内存0x8200 0000处的数据,写入flash的偏移0x0,写入数据长度为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级的读写操作,支持随机访问.


如何验证读写效果

可以结合uboot md命令,sf read,sf write都涉及到内存操作,可以用md查看内存数据

md 0x82000000 0x100

打印0x82000000开始,长度范围256字节的内存数据

相关文章

  译序:JWMediaPlayer是开源的网页使用的Flash播放器。本...
    Flash编程原理都是只能将1写为0,而不能将0写成1.所...
 上传setenvgatewayip192.168.1.1;setenvserverip192.168.1...
Error:FlashDownloadFailed-"Cortex-M3"出现一般有...
jPlayer是一个用于控制和播放mp3文件的jQuery插件。它在后台...
#ifndef__FONTUPD_H__#define__FONTUPD_H__#include"sy...