各位TI的工程师好:
我在使用该开发板用官方文件(spi_boot_files),烧程序。一开始的一个小程序测试我的操作没问题。但是,随后一个比较大的工程遇到了问题,程序报错WARNING: File Size mismatch,经过检查我发现该程序定义了一个Uint8 bootImage[60000];而我的bin文件的size超过了6000。我把bootimage数组扩大后,cmd文件又报错了,请问各位这该怎么解决??附上烧程序的代码:
#include "ezdsp5535.h"
#include "ezdsp5535_spiflash.h"
#include "csl_spi.h"
#include "stdio.h"
#include "ezdsp5535_spiflash.h"
#include "csl_spi.h"
#include "stdio.h"
Uint8 bootImage[60000];
static Uint16 rx[spiflash_PAGESIZE];
static Uint16 rx[spiflash_PAGESIZE];
Uint8 fileName[256];
/*
*
* spiflash_writer( )
* Writes Demo to SPI ROM and then verifies it.
*
*/
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);
/*
*
* spiflash_writer( )
* Writes Demo to SPI ROM and then verifies it.
*
*/
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
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);
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);
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);
{
printf("WARNING: File Size mismatch.\r\n");
return 1;
}
fseek(fPtr,0,SEEK_SET);
/* Calculate number of pages */
pages = (fileSize / spiflash_PAGESIZE) + 1;
pages = (fileSize / spiflash_PAGESIZE) + 1;
/* Initialize the SPI interface */
EZDSP5535_SPIFLASH_init( );
EZDSP5535_SPIFLASH_init( );
/* Erase target area in spiflash */
printf("Erasing target area…\r\n");
EZDSP5535_SPIFLASH_erase( 0, fileSize);
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 );
}
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 );
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;
}
pdata = ( Uint16* )((Uint32)bootImage + (i * spiflash_PAGESIZE));
for ( j = 0 ; j < spiflash_PAGESIZE; j++ )
{
if ( ((*pdata++) & 0xFF)!= (rx[j]))
return 1; // Fail
}
}
return 0;
}
Shine:
请问把bootimage数组扩大后,cmd文件报什么错?