This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
开发环境为CCS6.1,C5535加外部SPI FLASH,仿真正常,现在想把程序烧到外部flash里,采用了官网提供的TI SPI Flash Programmer和SPI Boot Files发现都无法完成下载,程序提示以下错误,求大神解救,out文件已转换为bin文件。
Can't find a source file at "/tmp/TI_MKLIB4kQNZn/SRC/exit.c"
Locate the file or edit the source lookup path to include its location.
程序没运行,可能是你的程序有问题。
spiflash_writer主函数main最后没有while(1),运行完后自然就进入exit.c退出了。上面根本就不是什么错误。
void main( void )
{
/* Initialize BSL */
EZDSP5535_init( );
/* Display test ID */
printf( "\nRunning SPI FLASH Writer...\n");
/* Call test function */
TestFail = spiflash_writer( );
/* Check for test fail */
if ( TestFail != 0 )
{
/* Print error message */
printf( " FAIL... error code %d... quitting\n", TestFail );
}
else
{
/* Print pass message */
printf( " PASS\n" );
printf( "\n***ALL Tests Passed***\n" );
}
StopTest();
}
而spiflash_writer函数里回读校验,又怎么会没有写进去。
Int16 spiflash_writer( )
{
Uint32 i, j, pages;
Uint16* pdata;
Int32 fileSize = 0;
FILE *fPtr;
Uint16 *ramPtr;
/* Read the filename from host */
printf("Enter the file Name:\r\n");
scanf("%s", fileName);
fflush(stdin);
/* Open a File from the hard drive */
printf("Opening file...\r\n");
fPtr = fopen(fileName, "rb");
if(fPtr == NULL)
{
printf("ERROR: File %s Open failed\r\n", fileName);
return 1;
}
fileSize = 0; // Initialize size to 0
/* Get file size */
fseek(fPtr,0,SEEK_END);
fileSize = ftell(fPtr);
/* Setup pointer in RAM for temporary storage of data */
ramPtr = (Uint16*) bootImage;
if(fileSize == 0) // Check if file was found
{
printf("ERROR: File read failed.. Closing program.\r\n");
fclose (fPtr);
return 1;
}
fseek(fPtr,0,SEEK_SET);
if (fileSize != fread(ramPtr, 1, fileSize, fPtr)) // Read file to ram and check if read properly
{
printf("WARNING: File Size mismatch.\r\n");
return 1;
}
fseek(fPtr,0,SEEK_SET);
/* Calculate number of pages */
pages = (fileSize / spiflash_PAGESIZE) + 1;
/* Initialize the SPI interface */
EZDSP5535_SPIFLASH_init( );
/* Erase target area in spiflash */
printf("Erasing target area...\r\n");
EZDSP5535_SPIFLASH_erase( 0, fileSize);
/* Write to SPIFLASH */
printf("Writing file...\r\n");
for ( i = 0 ; i < pages ; i++ )
{
/* Write a page */
EZDSP5535_SPIFLASH_write( ((Uint32)bootImage + (i * spiflash_PAGESIZE)), i * spiflash_PAGESIZE, spiflash_PAGESIZE );
}
/* Read and verify SPIFLASH */
printf("Checking file...\r\n");
for ( i = 0 ; i < pages ; i++ )
{
/* Read a page */
EZDSP5535_SPIFLASH_read( i * spiflash_PAGESIZE, ( Uint32 )rx, spiflash_PAGESIZE );
/* Check the pattern */
pdata = ( Uint16* )((Uint32)bootImage + (i * spiflash_PAGESIZE));
for ( j = 0 ; j < spiflash_PAGESIZE; j++ )
{
if ( ((*pdata++) & 0xFF)!= (rx[j]))
return 1; // Fail
}
}
return 0;
Hu Schuman 说:1.console窗口打印出all tests passed是不是说明程序已经下载进去了?
理论上是的。
Hu Schuman 说:3.示波器上看到上电时spiclk上有5个字节加6个字节的clk信号,是否为boot信号,但是之后就没有了,5535没有去从flash里读程序?
说明芯片bootloader有去读flash, 但是没有完成,是不是你的bin文件转换的不对啊。你是怎么转的?
Hu Schuman 说:4.5535是否有硬件管脚设置让其进入spiflash boot模式?
不需要,C5535是按顺序从boot外设读关键字的,读到关键字才继续从该外设读数据。
1.今天继续调试了下,发现SPICLK有5个字节加6个字节应该是尝试读16位SPI(5个字节)和尝试24位SPI(6个字节)是吗?
2.16位的不管,我用的是24位的,从spiflash_write里看出下载到FLASH里的bootImage第0位为0x00,第1位为0x02,然后从6个字节的波形图里来看,确实读到了0x00 0x02(6个字节具体为0x03 0x00 0x00 0x00 0x00 0x02),然后就没有然后了,关键字是从地址0开始的2个字节吗?按理说5535应该继续往下读吧?求大神解答下,小弟感激不尽。