跬步千里,窥叶知秋

跬步千里,窥叶知秋

Nand flash(三)MTD tests support测试flash性能

嵌入式Linux开发过程中,经常会使用到nor flash,nand flash等存储设备,由于flash的芯片型号和接口类型较多,性能不一,我们需要对系统中使用的flash性能进行分析,并对设备工作的稳定性进行测试

flash设备在嵌入式系统中,会被驱动为MTD分区,在linux kernel中,提供了针对MTD的测试模块,方面开发人员对flash的功能,性能,稳定性等进行测试。

使用make ARCH=arm  menuconfig打开kernel配置界面,配置 "Device Drivers" -> "Memory Technology Device (MTD) support" -> "MTD tests support",该选项只可以配置为按模块编译,保存配置后退出。

使用make  modules编译代码,生成测试工具模块,存储在目录drivers/mtd/tests中,包括以下内容:

mtd_nandecctest.ko:nand flash的ECC校验测试

mtd_pagetest.ko:nand flash的page读写测试

mtd_speedtest.ko:MTD分区的读写速度测试

mtd_subpagetest.ko:nand flash的sub-page接口测试

mtd_oobtest.ko:nand falsh的OOB区域读写测试

mtd_readtest.ko:读取整个MTD分区

mtd_stresstest.ko:随机读写,擦除操作测试

mtd_torturetest.ko:该功能可用于做稳定性或者寿命测试,随机操作直到发生错误

(1).如何使用MTD test:
进入Kernel后,使用也很简单
比如:insmod mtd_speedtest.ko dev=3
注:此处的dev指的是你mtd设备number,我这里的:
# cat /proc/mtd
dev:    size   erasesize name
mtd0: 00100000 00080000 "U-Boot"
mtd1: 00800000 00080000 "Kernel"
mtd2: 0c800000 00080000 "Root filesystem"
mtd3: 04000000 00080000 "Temp"
mtd4: 69000000 00080000 "Data"
dev=3,就是mtd3,就是上面的Temp分区。
(2)举例如何使用:
最后列举一些测试结果如下:
# ls
mtd_oobtest.ko          mtd_readtest.ko         mtd_subpagetest.ko
mtd_speedtest.ko        mtd_torturetest.ko
mtd_pagetest.ko         mtd_stresstest.ko
# insmod mtd_speedtest.ko dev=3
=================================================
mtd_speedtest: MTD device: 3
mtd_speedtest: MTD device size 67108864, eraseblock size 524288, page size 4096, count of eraseblocks 128, pages per eraseblock 128, OOB size 128
mtd_speedtest: scanning for bad eraseblocks
mtd_speedtest: scanned 128 eraseblocks, 0 are bad
mtd_speedtest: testing eraseblock write speed
mtd_speedtest: eraseblock write speed is 1754 KiB/s
mtd_speedtest: testing eraseblock read speed
mtd_speedtest: eraseblock read speed is 2443 KiB/s
mtd_speedtest: testing page write speed
mtd_speedtest: page write speed is 1748 KiB/s
mtd_speedtest: testing page read speed
mtd_speedtest: page read speed is 2439 KiB/s
mtd_speedtest: testing 2 page write speed
mtd_speedtest: 2 page write speed is 1751 KiB/s
mtd_speedtest: testing 2 page read speed
mtd_speedtest: 2 page read speed is 2440 KiB/s
mtd_speedtest: Testing erase speed
mtd_speedtest: erase speed is 439838 KiB/s
mtd_speedtest: finished
=================================================
# insmod mtd_oobtest.ko dev=3
=================================================
mtd_oobtest: MTD device: 3
mtd_oobtest: MTD device size 67108864, eraseblock size 524288, page size 4096, count of eraseblocks 128, pages per eraseblock 128, OOB size 128
mtd_oobtest: scanning for bad eraseblocks
mtd_oobtest: scanned 128 eraseblocks, 0 are bad
mtd_oobtest: test 1 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 128 eraseblocks
mtd_oobtest: writing OOBs of whole device
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written 128 eraseblocks
mtd_oobtest: verifying all eraseblocks
mtd_oobtest: verified up to eraseblock 0
mtd_oobtest: verified 128 eraseblocks
mtd_oobtest: test 2 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 128 eraseblocks
mtd_oobtest: writing OOBs of whole device
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written 128 eraseblocks
mtd_oobtest: verifying all eraseblocks
mtd_oobtest: verified up to eraseblock 0
mtd_oobtest: verified 128 eraseblocks
mtd_oobtest: test 3 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 128 eraseblocks
mtd_oobtest: writing OOBs of whole device
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written 128 eraseblocks
mtd_oobtest: verifying all eraseblocks
mtd_oobtest: verified up to eraseblock 0
mtd_oobtest: verified 128 eraseblocks
mtd_oobtest: test 4 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 128 eraseblocks
mtd_oobtest: attempting to start write past end of OOB
mtd_oobtest: an error is expected...
mtd_oobtest: error occurred as expected
mtd_oobtest: attempting to start read past end of OOB
mtd_oobtest: an error is expected...
mtd_oobtest: error occurred as expected
mtd_oobtest: attempting to write past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error occurred as expected
mtd_oobtest: attempting to read past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error: read past end of device
mtd_oobtest: attempting to write past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error occurred as expected
mtd_oobtest: attempting to read past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error: read past end of device
mtd_oobtest: test 5 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 128 eraseblocks
mtd_oobtest: writing OOBs of whole device
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written 127 eraseblocks
mtd_oobtest: verifying all eraseblocks
mtd_oobtest: verified up to eraseblock 0
mtd_oobtest: verified 127 eraseblocks
mtd_oobtest: finished with 2 errors
=================================================




阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/JerryGou/article/details/80346289
文章标签: nanaflash
个人分类: NAND
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

Nand flash(三)MTD tests support测试flash性能

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭