免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2444 | 回复: 0
打印 上一主题 下一主题

uClinux下使用mtd-utils中的erase擦除mtd失败.. [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-10-09 10:00 |只看该作者 |倒序浏览
我的开发板是ARMSYS44B0-P,立宇泰的板子
我想把Bootloader + Kernel + JFFS2都放到Nor Flash(sst39vf1601 70-4C-EK)
现在,分区情况如下
/*
* uClinux-dist/linux2.4.x/drivers/mtd/maps/s3c44b0.c
*/
104 static struct mtd_partition GFirst_partitions[] = {
105         {
106                 name: "Bootloader (128KB)",
107                 size: 0x20000,
108                 offset: 0x000000,
109                 mask_flags: MTD_WRITEABLE
110         },
111         {
112                 name: "Kernel Image (1152KB)",
113                 size: 0x120000,
114                 offset: 0x020000,
115                 mask_flags: MTD_WRITEABLE
116         },
117         {
118                 name: "SnmpdCfg (768KB)",
119                 size: 0xc0000,
120                 offset: 0x140000
121 //              mask_flags: MTD_WRITEABLE
122         }
第三个分区就是给JFFS2用的.
我参考的是以下的这篇文章
http://www.linuxforum.net/forum/ ... &sb=8&o=all
因此也一样使用amd_flash.c作为调试的驱动程序
/*
* uClinux-dist/linux2.4.x/drivers/mtd/chips/amd_flash.c
*/
647     }, {
648         mfr_id: MANUFACTURER_SST,
649         dev_id: SST39VF1601,
650         name: "SST 39VF1601",
651         size: 0x00200000,
652 //      numeraseregions: 2,
653         numeraseregions: 3,
654         regions: {
655             { offset: 0x000000, erasesize: 0x1000, numblocks: 32 },  //BIOS--128KByte
656             { offset: 0x020000, erasesize: 0x1000, numblocks: 288 }, //Kernel--1152KByte
657             { offset: 0x120000, erasesize: 0x1000, numblocks: 192 }, //UserApp--768KByte
658 //          { offset: 0x000000, erasesize: 0x1000, numblocks: 256 },
659 //          { offset: 0x100000, erasesize: 0x1000, numblocks: 256 }
660         }

板子上电后:
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
                      ...
                      ...
GFirst flash device: 200000 at 0
MrGates flash device: Probing for AMD compatible flash...
GFirst flash device: regions=3
Creating 3 MTD partitions on "MrGates flash device":
0x00000000-0x00020000 : "Bootloader (128KB)"
mtd: Giving out device 0 to Bootloader (128KB)
0x00020000-0x00140000 : "Kernel Image (1152KB)"
mtd: Giving out device 1 to Kernel Image (1152KB)
0x00140000-0x00200000 : "SnmpdCfg (768KB)"
mtd: Giving out device 2 to SnmpdCfg (768KB)
ret = 0
init_mtdchar: allocated major number 90.
init_mtdblock: allocated major number 30.
                 ...
                 ...
Sash command shell (version 1.1.1)
/> ls -l /dev/mtd*
crw-------  1 0        0         90,   0  Jan  1 00:00 /dev/mtd0
crw-------  1 0        0         90,   2  Jan  1 00:00 /dev/mtd1
crw-------  1 0        0         90,   4  Jan  1 00:00 /dev/mtd2
brw-------  1 0        0         30,   0  Jan  1 00:00 /dev/mtdblock0
brw-------  1 0        0         30,   1  Jan  1 00:00 /dev/mtdblock1
brw-------  1 0        0         30,   2  Jan  1 00:00 /dev/mtdblock2

/> cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00020000 00001000 "Bootloader (128KB)"
mtd1: 00120000 00001000 "Kernel Image (1152KB)"
mtd2: 000c0000 00001000 "SnmpdCfg (768KB)"

问题出现在我进入系统后,虽然能够识别到芯片...可是第一步erase就失败了
我使用的uClinux里添加的erase和eraseall命令
/> erase /dev/mtd2
MTD_open
Erase Total 1 UniMTD_ioctl
MTD_ioctl
MTD_ioctl
amd_flash_erase: mtd->numeraseregions = 3
amd_flash_erase: addr = 0x140000,erasesize = 0x1000
amd_flash_erase: chipnum = 0,adr = 0x140000,len = 4096,
erase_one_block: chip->state = 0x0,adr = 0x140000,size = 0x1000
send_cmd: ready to invoke send_unlock()!
send_unlock: ready to invoke wide_write()!
wide_write: map->buswidth = 2
wide_write: map->buswidth = 2
send_unlock: completed!
send_cmd: send_unlock() returned!
send_cmd: ready to invoke wide_write()!
wide_write: map->buswidth = 2
send_cmd: completed!
send_cmd_to_addr: ready to invoke send_unlock()!
send_unlock: ready to invoke wide_write()!
wide_write: map->buswidth = 2
wide_write: map->buswidth = 2
send_unlock: completed!
send_cmd_to_addr: send_unlock() returned!
send_cmd_to_addr: ready to invoke wide_write()!
wide_write: map->buswidth = 2
send_cmd_to_addr: completed!
erase_one_block: Error Occurs! read8() = 0x7f
erase_one_block: MrGates flash device: verify error at 0x140000, size 0x1000.
Bad mode in data abort handler detected: mode IRQ_32
Vectors:
Stubs:
Internal error: Oops: 0
CPU: 0
pc : [<000004fa>]    lr : [<0c01e914>]    Not tainted
sp : 0c457e24  ip : 0c457e18  fp : 0c457ee0
r10: 0c268564  r9 : fffffffb  r8 : 00141000
r7 : 00000001  r6 : 00140000  r5 : 60000013  r4 : 00140000
r3 : 00000000  r2 : 00000001  r1 : 00000001  r0 : 00000051
Flags: nZCv  IRQs off  FIQs on  Mode IRQ_32  Segment user
Control: 0
Process erase (pid: 24, stackpage=0c457000)
Stack:
0c457e40:                                                                 0c01e914
0c457e60: 000004fa 60000092 ffffffff 0c2af2f0  00000004 0c2af2e0 00001000 0c2af2a0
0c457e80: 00000002 00000000 00001000 00140000  0c2af2e0 0c2af5e0 00000000 0c456000
0c457ea0: 00000000 00000000 00000000 0c456000  00000000 00000000 0c457f44 0c2af5e0
0c457ec0: 0c2c7560 0c457f34 0c456000 00000000  0c456000 0c457ef0 0c457ee4 0c0a5cf8
0c457ee0: 0c0a0eb4 0c457f7c 0c457ef4 0c0a6c78  0c0a5cc0 0c089d90 0c01c83c 0c0a6534
0c457f00: 00000000 0c456000 00000000 00000000  00000000 0c456000 00000000 00000000
0c457f20: 00000000 00000000 0c456000 00000000  00000000 00000000 0c456000 00000000
0c457f40: 00000000 00000000 0c457f48 0c457f48  0000004c 0c742f20 40084d02 00000003
0c457f60: ffffffe7 0c015b20 00000036 0c00b420  0c457fac 0c457f80 0c042f20 0c0a6a70
0c457f80: 0c0347c0 0c457f90 0c742f20 00000003  00000001 0c456000 0c015b20 00000000
0c457fa0: 00000000 0c457fb0 0c015980 0c042cb0  0c742f20 0c01b340 00000003 40084d02
0c457fc0: 0c742f20 00000000 0c742f20 00000003  00000001 00000000 00000000 00000000
0c457fe0: 00000000 00000000 00000008 0c742f08  0c73c7ec 0c73c7b8 60000010 00000003
Backtrace:
Function entered at [<0c0a0ea4>] from [<0c0a5cf8>]
Function entered at [<0c0a5cb0>] from [<0c0a6c78>]
Function entered at [<0c0a6a60>] from [<0c042f20>]
Function entered at [<0c042ca0>] from [<0c015980>]
Code: <1>Unhandled fault: alignment exception (93) at 0x00000001
fault-common.c(97): start_code=0xc73a040, start_stack=0xc742f84)
Internal error: Oops: 0
CPU: 0
pc : [<0c0197b8>]    lr : [<0c01e914>]    Not tainted
sp : 0c457ddc  ip : 0c457d88  fp : 0c457df4
r10: 0c268564  r9 : fffffffb  r8 : 00141000
r7 : ffffffff  r6 : 60000092  r5 : 000004fa  r4 : fffffffe
r3 : 000004f2  r2 : 00000000  r1 : 00000001  r0 : 00000006
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  Segment user
Control: 0
Process erase (pid: 24, stackpage=0c457000)
Stack:
0c457dc0:                            0c01e914  0c0197b8 60000093 ffffffff 0c457e24
0c457de0: 0c456000 0c457e24 0c457e0c 0c457df8  0c0199e0 0c0197a0 0c457e24 000004fa
0c457e00: 0c457e20 0c457e10 0c019b78 0c019938  0c457e60 00000000 0c457e24 0c01e914
0c457e20: 0c019b0c 00000051 00000001 00000001  00000000 00140000 60000013 00140000
0c457e40: 00000001 00141000 fffffffb 0c268564  0c457ee0 0c457e18 0c457e24 0c01e914
0c457e60: 000004fa 60000092 ffffffff 0c2af2f0  00000004 0c2af2e0 00001000 0c2af2a0
0c457e80: 00000002 00000000 00001000 00140000  0c2af2e0 0c2af5e0 00000000 0c456000
0c457ea0: 00000000 00000000 00000000 0c456000  00000000 00000000 0c457f44 0c2af5e0
0c457ec0: 0c2c7560 0c457f34 0c456000 00000000  0c456000 0c457ef0 0c457ee4 0c0a5cf8
0c457ee0: 0c0a0eb4 0c457f7c 0c457ef4 0c0a6c78  0c0a5cc0 0c089d90 0c01c83c 0c0a6534
0c457f00: 00000000 0c456000 00000000 00000000  00000000 0c456000 00000000 00000000
0c457f20: 00000000 00000000 0c456000 00000000  00000000 00000000 0c456000 00000000
0c457f40: 00000000 00000000 0c457f48 0c457f48  0000004c 0c742f20 40084d02 00000003
0c457f60: ffffffe7 0c015b20 00000036 0c00b420  0c457fac 0c457f80 0c042f20 0c0a6a70
0c457f80: 0c0347c0 0c457f90 0c742f20 00000003  00000001 0c456000 0c015b20 00000000
0c457fa0: 00000000 0c457fb0 0c015980 0c042cb0  0c742f20 0c01b340 00000003 40084d02
0c457fc0: 0c742f20 00000000 0c742f20 00000003  00000001 00000000 00000000 00000000
0c457fe0: 00000000 00000000 00000008 0c742f08  0c73c7ec 0c73c7b8 60000010 00000003
Backtrace:
Function entered at [<0c019790>] from [<0c0199e0>]
r5 = 0C457E24  r4 = 0C456000
Function entered at [<0c019928>] from [<0c019b78>]
r5 = 000004FA  r4 = 0C457E24
Function entered at [<0c019afc>] from [<0c01e914>]
r4 = 0C457E60
Code: e3a02000 e0853104 (e4b3c000) e3520000 0a000004
ts
**Ready To invoke ioctl()**
This is Non Region Erase()
non_region_erase() ioctl() return 0...
Performing Flash Erase of length 4096 at offset 0x0pid 24: failed 11

本人在程序里插入了不少的调试信息,问题始终出现在校验第三个MTD分区的首个字节的数据,因为它始终都显示是7F..而不是FF
我不知道是什么原因,对于内核的错误信息也没有经验,请高人帮助,如果还需要提供任何信息,请跟帖.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP