本人板子上用的Flash芯片是S29AL016M,地址线用了16条,即1M*16bit,但是FlashBurn的烧写程序FBTC大多对应8bit,我想问问我这种用16bit的如何对FBTC进行修改.
具体下面三个位置不是非常清楚如何进行修改
1.
#define CE1_8 0xF3A88E02 /* reg to set CE1 as 8bit async */
#define CE1_32 0xF3A88E22 /* reg to set CE1 as 32bit async */
2.
void BurnFlash(u8 *data, u16 nBytes)
{
u16 timeout;
u8 c;
volatile u8 *pdata;
/* Put the Flash in normal mode */ *(volatile char *)FLASH_START = (char)0xf0;
// flash_erase((u32)flashnext, (u32)nBytes);
while(nBytes–) {
/* Prep AMD
* 32MBit (4M x 8) Flash Memory
* for writing a byte.
*/
*FLASH_PAGE = (u8)(((u32)flashnext & 0x380000) >> 19);
*(volatile char *)FLASH_ADDR2 = (char)FLASH_KEY1;
*(volatile char *)FLASH_ADDR1 = (char)FLASH_KEY2;
*(volatile char *)FLASH_ADDR2 = (char)FLASH_KEY3;
pdata = (volatile u8 *)((u32)flashnext & 0xffc7ffff);
*pdata = *data;
/* Spin here 'til programming completes
*/
c = *data++;
timeout = 0;
do timeout += 1;
while(*pdata != c && timeout < (u16)0xffff); flashnext++;
}
/* Put the Flash in normal mode */ *(volatile char *)FLASH_START = (char)0xf0;
}
3.
void EraseFlash(void)
{
int i;
/* Code to erase AMD29LV033C
* 32MBit (4MK X 8) Flash Memory
*/
*FLASH_PAGE = 0;
*(volatile char *)FLASH_ADDR2 = (char)FLASH_KEY1; //0xAA
*(volatile char *)FLASH_ADDR1 = (char)FLASH_KEY2; //0x55
*(volatile char *)FLASH_ADDR2 = (char)FLASH_KEY4; //0x80
*(volatile char *)FLASH_ADDR2 = (char)FLASH_KEY1; //0xAA
*(volatile char *)FLASH_ADDR1 = (char)FLASH_KEY2; //0X55
*(volatile char *)FLASH_ADDR2 = (char)FLASH_KEY5; //0X10
/* Wait until erase is done */
while(GetFlashVal(FLASH_START) != 0xff);
/* Put the Flash in normal mode */ *(volatile char *)FLASH_START = (char)0xf0;
/*
// Mark all sectors as erased for (i = 0; i < FLASH_SECTORS; i++)
erasetable[i] = 1;
*/ return;
}
关键是burnflash那个函数不会进行修改,有人进行指点下么.
user4068986:
没人么,谢谢大家.
Shine:
回复 user4068986:
flashburn针对TI EVM/DSK板,FBTC改起来很复杂啊,如果烧写自己的板子,一般都自己写个flash烧写程序。