免费注册 查看新帖 |

Chinaunix

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

s3c2440下vxworks的tffs文件系统调试 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-21 08:41 |只看该作者 |倒序浏览

使用BCNG2440开发板,该板配置了AM29LV160DB的FLASH。
目标:实现vxworks下的tffs文件系统。
2007-1-16
1、使用最新的bsp,构建一个新的工程,然后在vxworks配置选项中增加tffs的支持,以及tffs show的支持,重新编译内核,发现bsp目录下自动拷贝了一个新的systffs.c文件,然后报告编译错误,
E:\Tornado2.2\target\config\bcng2440\sysTffs.c:116:69: #error "sysTffs : Verify system mac
ros and function before first use"
不知道error宏是干什么用的,只好把这句话删掉。
哦,让第一次编译一定出现出错,提醒你进行各种宏定义,
先不管这么多的东西,把修改地址
#define FLASH_BASE_ADRS  0x00000000
重新编译,能够成功,下载,结果如下:
-> tffsShow
0: **** communication failed with error -1 ****
value = 48 = 0x30 = '0'
-> tffsShowAll
TFFS Version 2.2
0: **** communication failed with error -1 ****
value = 48 = 0x30 = '0'
把原始代码下的wamdmtd.c程序拷贝到BSP目录,在工程中添加改文件,重新编译内核,显示找不到.h文件,后来修改:
#include "tffs/flflash.h"
#include "tffs/backgrnd.h"
才能编译通过,同时修改代码,增加对我们的flash的支持,
#define Am29LV160_FLASH      0x0149  /*added by xiyong*/
vol.type == Am29LV160_FLASH )
重新编译,下载,错误一样,在
进一步跟踪,发现根本没有进入flwAmdMTDIdentify函数:

更换wamdmtd.c文件名为ximtd.c
修改flwAmdMTDIdentify为xyflwAmdMTDIdentify,并且修改
MTDidentifyRoutine mtdTable[] =
#ifdef INCLUDE_MTD_WAMD
    xyflwAmdMTDIdentify,
#endif
即使是这样,也没有调用xyflwAmdMTDIdentify
如何才能让tffs去调用自己的flash读写函数呢,是不是默认中已经有了一个库,去调用默认的库了。
 
后来,发现在vxworks内核配置中不能配置支持WAMD,并且在systffs中不能定义支持WAMD,否则会死机。
进一步证实,如果名字不改变为xyflwAmdMTDIdentify,也会死机,看来ximtd.c中的所有的接口函数都需要重新命名。
 
2、总结现在的情况


1)在BSP目录下Makefile包含ximtd.o
MACH_EXTRA = ximtd.o
2)systffs.c文件增加
#define  INCLUDE_MTD_AM29LV160
去掉其他flash的驱动
3)tffsconfig.c文件修改
FLStatus xyflwAmdMTDIdentify (FLFlash vol); 
函数申明,并修改
MTDidentifyRoutine mtdTable[] =
#ifdef INCLUDE_MTD_ AM29LV160
    xyflwAmdMTDIdentify,
#endif
4)ximtd.c文件修改
#define Am29LV160_FLASH      0x0149  /*added by xiyong*/
FLStatus xyflwAmdMTDIdentify (FLFlash vol)
{……
      vol.type == Am29LV160_FLASH )   /*xiyong add here*/
    vol.chipSize = 0x200000l * vol.interleaving;
5)重新生成vxworks内核,
去掉MMU的配置,添加tffs的组建,FTL,以及tffsshow等组件,编译下载,现在的现象是:
xiyong debug:tffsShowAllaa
-> TFFS Version 2.2 noOfDrives 1
xiyong debug:flwAmdMTDIdentify
xiyong debug:flwAmdMTDIdentify vol.type is 49
0: **** communication failed with error -1 ****
终于调用了自己的函数
现在的问题是flash ID读出现了问题,本来应该读出0x0149,现在是高位不见了。
 
3、继续调试


2007-1-18
使用以前的8260的amd的代码,发现
vol.interleaving = 2需要改为1
现在能够显示了
-> tffsShowAll
xiyong debug:tffsShowAllaa
TFFS Version 2.2 noOfDrives 1
0: socket=RFA: type=0x149, unitSize=0x10000, mediaSize=0x200000
value = 49 = 0x31 = '1'
但是运行
tffsSysFormat死机
经过反复的调试,发现在擦除和写的操作中都需要关闭中断。
-> sysTffsFormat
Debug: 5 entering AMD MTD identification routine.
Debug: Identified AMD or Fujitsu flash media.
Debug: 5 entering AMD MTD identification routine.
Debug: Identified AMD or Fujitsu flash media.
Debug:  entering AMD MTD flwAmdMTDErase routine firstBlock 8 numOfBlocks 1.
Debug:  flwAmdMTDErase flashPtr 80000
Debug:  AMD MTD flwAmdMTDErase end.
Debug:  entering AMD MTD flwAmdMTDWrite routine address 80000 length 4c.
Debug:  2 flwAmdMTDWrite routine unlockAddr1 80aaa unlockAddr2 80554 data is 13 3 43 49 53
 46 30 0 46 54
Debug:  entering AMD MTD flwAmdMTDWrite routine address 80014 length 2.
Debug:  2 flwAmdMTDWrite routine unlockAddr1 80aaa unlockAddr2 80554 data is 8 0 0 0 8 0 0
 0 7c f4
Debug:  entering AMD MTD flwAmdMTDErase routine firstBlock 9 numOfBlocks 1.
Debug:  flwAmdMTDErase flashPtr 90000
Debug:  AMD MTD flwAmdMTDErase end.
Debug:  entering AMD MTD flwAmdMTDWrite routine address 90000 length 4c.
Debug:  2 flwAmdMTDWrite routine unlockAddr1 90aaa unlockAddr2 90554 data is 13 3 43 49 53
 46 30 0 46 54
Debug:  entering AMD MTD flwAmdMTDWrite routine address 90014 length 2.
Debug:  2 flwAmdMTDWrite routine unlockAddr1 90aaa unlockAddr2 90554 data is 9 0 ff 33 9 0
 0 0 7c f4
………….
Debug:  entering AMD MTD flwAmdMTDWrite routine address 800fc length 4.
Debug:  2 flwAmdMTDWrite routine unlockAddr1 80aaa unlockAddr2 80554 data is fe ff ff ff 4
0 2a 0 0 2e 4
Debug:  entering AMD MTD flwAmdMTDWrite routine address 85c00 length 200.
Debug:  2 flwAmdMTDWrite routine unlockAddr1 80aaa unlockAddr2 80554 data is 0 0 0 0 0 0 0
 0 0 0
Debug:  entering AMD MTD flwAmdMTDWrite routine address 800fc length 4.
Debug:  2 flwAmdMTDWrite routine unlockAddr1 80aaa unlockAddr2 80554 data is 40 2a 0 0 40 
2a 0 0 2e 4
value = 0 = 0x0
-> d 0x80000
00080000:  0313 4943 4653 0030 5446 314c 3030 0100   *..CISF0.FTL100..*
00080010:  0001 0000 0008 1009 0008 0018 3a00 0016   *.............:..*
00080020:  0000 0001 0017 ff00 0000 0000 0000 0000   *................*
00080030:  0044 0000 ffff ffff ffff ffff ffff ffff   *D...............*
00080040:  ffff ffff 0030 0000 0030 0000 d240 ffff   *....0...0...@...*
00080050:  d440 ffff d640 ffff d840 ffff da40 ffff   *@...@...@...@...*
00080060:  dc40 ffff de40 ffff e040 ffff e240 ffff   *@...@...@...@...*
00080070:  e440 ffff e640 ffff e840 ffff ea40 ffff   *@...@...@...@...*
00080080:  ec40 ffff ee40 ffff f040 ffff f240 ffff   *@...@...@...@...*
00080090:  f440 ffff f640 ffff f840 ffff fa40 ffff   *@...@...@...@...*
000800a0:  fc40 ffff fe40 ffff 0040 0000 0240 0000   *@...@...@...@...*
000800b0:  0440 0000 0640 0000 0840 0000 0a40 0000   *@...@...@...@...*
000800c0:  0c40 0000 0e40 0000 1040 0000 1240 0000   *@...@...@...@...*
000800d0:  1440 0000 1640 0000 1840 0000 1a40 0000   *@...@...@...@...*
000800e0:  1c40 0000 1e40 0000 2040 0000 2240 0000   *@...@...@ ..@"..*
000800f0:  2440 0000 2640 0000 2840 0000 2a40 0000   *@$..@&..@(..@*..*
value = 0 = 0x0
->  usrTffsConfig (0, 0, "/tffs0/");
Debug: 5 entering AMD MTD identification routine.
Debug: Identified AMD or Fujitsu flash media.
value = 0 = 0x0
-> devs
drv name
  0 /null
  1 /tyCo/0
  1 /tyCo/1
  5 bcng:
  6 /vio
  3 /tffs0/
value = 0 = 0x0
->
 
对于ARM CPU来说,flash的操作,必须要关闭中断,
以前在powerpc上并没有这个问题。
 
4、MMU的tffs调试


2007-1-19
修改了flash的基地址为0xf0000000,然后调用tffsShow,报错;
还是首先修改flash.c应用测试程序,碰到的问题有:


1)
#define _WR(addr,data) *((U16 *)(FlashBaseAddr+(addr<<1)) )=(U16)data
#define _RD(addr) ( *(  (U16 *)(FlashBaseAddr+(addr<<1)) ))
增加一个基地址,但是基地址不能左移,否则就会报错;
发现只能读,而不能写,原来是syslib.c中对于flash的定义为禁止写的,打开即可。


2)这个时候发现MMU下的tffs已经实现了。
 
现在有一个问题,就是bootrom中的BSP对flash基地址的定义为0,而在vxworks中的定义为0xf0000000;
实际上,vxworks没有必要启动tffs,除非是实现自我更新。


您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP