这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » 请woodhead兄,jackwang兄帮忙,一片flash建立tffs问题

共5条 1/1 1 跳转至

请woodhead兄,jackwang兄帮忙,一片flash建立tffs问题

菜鸟
2007-06-11 03:37:06     打赏

同一片norflash上建立tffs的困惑问题,大侠请帮忙

开发环境,2410+am29lv160db
#define FLASH_BOOT_ADRS (0x00100000)
#define FLASH_BOOT_SIZE (0x00100000)

#define SETUP_ERASE 0x80
#define SETUP_WRITE 0xa0
#define READ_ID 0x90
#define SECTOR_ERASE 0x30
#define BLOCK_ERASE 0x50

#define READ_ARRAY 0xf0

#define UNLOCK_1 0xaa

#define UNLOCK_2 0x55

#define UNLOCK_ADDR1 0x555
#define UNLOCK_ADDR2 0x2aa
调用如下
-> tffsShow
shine**********lv160MTDIdentify routine
shine**********ret is 100000,call by lv160MTDMap0
shine**********the baseFlashPtr is 100000,call by lv160MTDIdentify
shine**********ret is 100000,call by lv160MTDMap0
shine**********fllv160Identify routine
shine**********thisVars->unlockAddr1 100aaa,thisVars->unlockAddr2 100554,call by fllv160Identify
shine**********ret is 100002,call by lv160MTDMap0
shine**********the flashPtr is 100002,call by fllv160Identify
shine**********ret is 100000,call by lv160MTDMap0
shine**********identify ok
0: socket=RFA: type=0x2249, unitSize=0x10000, mediaSize=0x100000
value = 50 = 0x32 = '2' 结果 成功辨识

-> sysTffsFormat
同蓝色部分
shine**********ret is 100000,call by lv160MTDMap0
shine**********ret is 110000,call by lv160MTDMap0
shine**********ret is 120000,call by lv160MTDMap0
shine**********ret is 130000,call by lv160MTDMap0
shine**********ret is 140000,call by lv160MTDMap0
shine**********ret is 150000,call by lv160MTDMap0
shine**********ret is 160000,call by lv160MTDMap0
shine**********ret is 170000,call by lv160MTDMap0
shine**********ret is 180000,call by lv160MTDMap0
shine**********ret is 190000,call by lv160MTDMap0
shine**********ret is 1a0000,call by lv160MTDMap0
shine**********ret is 1b0000,call by lv160MTDMap0
shine**********ret is 1c0000,call by lv160MTDMap0
shine**********ret is 1d0000,call by lv160MTDMap0
shine**********ret is 1e0000,call by lv160MTDMap0
shine**********ret is 1f0000,call by lv160MTDMap0
同蓝色部分

value = -1 = 0xffffffff 结果 不成功,好像是没有调用到擦写函数



-> tffsDevCreate

输出同上,只是value值改变如下

value = 0 = 0x0 结果 像是成功了,但是调用usrTffsConfig显示不到 tffs设备



-> tffsDevFormat

同sysTffsFormat
shine**********lv160MTDErase routine
shine**********ret is 100000,call by lv160MTDMap0

Exception number 12: Task: 0x33e18b98 (t17)

Instruction prefetch abort
Program Counter: 0x200000
Status Register: 0x20000097
value = 0 = 0x0 结果 进入到lv160MTDErase函数出现异常

异常的位置在lv160MTDErase 函数中*thisVars->unlockAddr1 = UNLOCK_1;停止了!

个人分析如下:

1.命令字序列不对,是否应该是0x8080,0xa0a0,.......

2.如网上说讲在擦写时候应该要屏蔽中断?用intLock函数,如果是应该怎么用?

3.调用—>i
NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY
---------- ------------ -------- --- ---------- -------- -------- ------- -----
tExcTask excTask 33ec26b4 0 PEND 300b8980 33ec25bc 0 0
tLogTask logTask 33ebfd38 0 PEND 300b8980 33ebfc50 0 0
tShell shell 33e33380 1 READY 300afc8c 33e33014 0 0
tWdbTask wdbTask 33e35580 3 PEND 3001e3ec 33e354b4 0 0
t5 300a580c 33e22ee8 4 SUSPEND 200000 300c45d0 0 0

tNetTask netTask 33e81050 50 PEND 3001e3ec 33e80fd0 0 0
tFtpdTask 30049fbc 33e395ec 55 PEND 3001e3ec 33e394c8 0 0
tTffsPTask flPollTask 33ebe478 100 DELAY 300aebbc 33ebe3f4 0 9
value = 0 = 0x0
注意t5 为什么pc值是200000





希望此贴能引起大侠们的关注,帮所有在一片flash上建立文件系统的人指条明路!




关键词: woodhead     jackwang     帮忙     一片     f    

菜鸟
2007-06-12 20:33:00     打赏
2楼

*thisVars->unlockAddr1 = UNLOCK_1;这句出错的时候,前面的地址是多少?是map后的地址吗?能否吧擦除函数贴出来看看。


菜鸟
2007-06-13 05:54:00     打赏
3楼

谢谢woodhead的回答:

函数如下:(是用的amine老师的那个版本改的)

static FLStatus lv160MTDErase(FLFlash vol, int firstErasableBlock, int numOfErasableBlocks)
{
int iBlock; FlashWPTR flashPtr;
unsigned int offset;
printf("shine**********lv160MTDErase routine\n");
printf("shine**********firstErasableBlock is %x and %d\n\n\n",firstErasableBlock,firstErasableBlock);
printf("shine**********numOfErasableBlocks is %d\n",numOfErasableBlocks);
if(numOfErasableBlocks <= 0) return ERROR;

for (iBlock = 0; iBlock < numOfErasableBlocks; iBlock++)
{
int i;
offset = (firstErasableBlock + iBlock) * vol.erasableBlockSize;
flashPtr = (FlashWPTR) vol.map(&vol, offset, vol.interleaving);

*thisVars->unlockAddr1 = UNLOCK_1;
*thisVars->unlockAddr2 = UNLOCK_2;
*thisVars->unlockAddr1 = SETUP_ERASE;
*thisVars->unlockAddr1 = UNLOCK_1;
*thisVars->unlockAddr2 = UNLOCK_2;
*flashPtr = SECTOR_ERASE;

lv160OpOverDetect((void *)flashPtr, 0x2000000);

for(i=0; i<vol.erasableBlockSize/2; i++,flashPtr++)
{
if(*flashPtr != 0xffff) break;
}

*flashPtr = READ_ARRAY;

if(i < vol.erasableBlockSize/2)
{
#ifdef DEBUG_PRINT
DEBUG_PRINT("Debug: lv160MTDErase fail.\n");
#endif
return flWriteFault;
}
}
printf("\Erase ok\n");
return flOK;
}

tffsDevFormat调用到lv160MTDErase函数时显示如下:

shine**********lv160MTDErase routine

shine**********firstErasableBlock is 0 and 0

shine**********numOfErasableBlocks is 1 (这里numOfErasableBlocks=1 个人觉得应该是16个块呀)
shine**********ret is 100000,call by lv160MTDMap0(对应于上面的红色的调用map函数)

Exception number 12: Task: 0x33e18b98 (t17)

Instruction prefetch abort
Program Counter: 0x200000
Status Register: 0x20000097
value = 0 = 0x0

编译器跟踪得出如下错误:

Unable to disassemble at address 0x200000

请woodhead兄帮忙,再次表示感谢


菜鸟
2007-06-13 17:20:00     打赏
4楼

thisVars->unlockAddr1只是个offset吧?在

*thisVars->unlockAddr1 = UNLOCK_1;
的左值加上地址flashPtr试试看。


菜鸟
2007-06-14 05:56:00     打赏
5楼

谢谢woodhead兄的回答!

问题不在这里,thisvars的地址在Identify函数里已经转换过,如下

baseFlashPtr = (FlashWPTR)vol.map (&vol, (CardAddress)0, vol.interleaving);/*这里调用map函数1次*/
printf("shine**********the baseFlashPtr is %x\n,call by lv160MTDIdentify\n",baseFlashPtr);
/*UNLOCK_ADDR为字地址, 赋值转换x2*/
thisVars->unlockAddr1 = (FlashWPTR)((long)baseFlashPtr) + UNLOCK_ADDR1;
thisVars->unlockAddr2 = (FlashWPTR)((long)baseFlashPtr) + UNLOCK_ADDR2;

不是这里的问题

我今天终于调试成功了,问题很多,一时说不清,等以后写个详细的调试日记,呵呵

再次谢谢woodhead兄从百忙中抽出时间给我回复!


共5条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]