nand flash测试工具集

本文介绍了mtd-utils(v1.4.1)的下载、编译及使用方法。包括mtd_debug工具读取mtd层信息和擦除NAND Flash分区,以及nanddump工具的用法和选项说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<1>Download mtd-utils(v1.4.1)
http://git.infradead.org/mtd-utils.git
git clone git://git.infradead.org/mtd-utils.git

<2>Compile
mtd_debug:
arm-none-linux-gnueabi-gcc -static mtd_debug.c -o mtd_debug -I./include

nanddump:
arm-none-linux-gnueabi-gcc -c lib/libmtd.c  -I./include
arm-none-linux-gnueabi-gcc -c lib/libmtd_legacy.c  -I./include
arm-none-linux-gnueabi-gcc -static nanddump.c libmtd.o libmtd_legacy.o -o nanddump -I./include

<3>How to use mtd_debug
# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 000c0000 00020000 "Bootloader"
mtd1: 00040000 00020000 "misc"
mtd2: 01080000 00020000 "recovery"
mtd3: 00600000 00020000 "Kernel"
mtd4: 06000000 00020000 "system"
mtd5: 03c00000 00020000 "cache"
mtd6: 031c0000 00020000 "userdata"
mtd7: 00060000 00020000 "NVM"

a).Read some information from mtd layer.
# ./mtd_debug info /dev/mtd/mtd0
mtd.type = MTD_NANDFLASH
mtd.flags = MTD_CAP_ROM
mtd.size = 786432 (768K)
mtd.erasesize = 131072 (128K)
mtd.writesize = 2048 (2K)
mtd.oobsize = 64
regions = 0

b).Erase the nand flash partitions.
# ./mtd_debug erase /dev/mtd/mtd7 0 0x00060000
Erased 393216 bytes from address 0x00000000 in flash

<4>How to use the nanddump
# ./nanddump
Usage: nanddump [OPTIONS] MTD-device
Dumps the contents of a nand mtd partition.

           --help            display this help and exit
           --version            output version information and exit
-f file    --file=file          dump to file
-i         --ignoreerrors       ignore errors
-l length  --length=length      length
-n         --noecc              read without error correction
-o         --omitoob            omit oob data
-b         --omitbad            omit bad blocks from the dump
-p         --prettyprint        print nice (hexdump)
-s addr    --startaddress=addr  start address

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值