我现在用了c6748的spi0接了spiflash,用的不是omapl138,也就是不带arm,只是一块c6748+spiflash,接口用了spi0.现在 想烧写程序进spiflash,不知道这个问题怎么解决。是用omapl138的spiwriter+ccs吗?修改代码的话具体怎么修改呢?因为138带arm的,我看代码里面有1808的配置,这块影不影响?也就是138的spiwriter能不能适用我这种情况呢?我是自己做的产品板。
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.
这个工程名就还带着DSP后缀,相比较其它几个工程的名字就是为了告知用户这是一个DSP的工程。再说这种读文件写SPI的C代码本身跟CPU核也不相关啊,就算是ARM的工程,大不了把工程的几个C文件重新建个DSP的工程就好了,直接看代码:
static Uint32 LOCAL_spiwriter()
{
SPI_MEM_InfoHandle hSpiMemInfo;
Int8 fileName[256];
Uint32 baseAddress = 0;
Bool useHeaderForApp = FALSE;
DEBUG_printString( "Starting ");
DEBUG_printString( (String) devString);
DEBUG_printString( " SPIWriter.\r\n");
// Prep device for SPI writing (pinmux/PSC)
DEVICE_SPIInit(DEVICE_SPIBOOT_PERIPHNUM);
// Initialize SPI Memory Device
hSpiMemInfo = SPI_MEM_open(DEVICE_SPIBOOT_PERIPHNUM, DEVICE_SPIBOOT_CSNUM, hDEVICE_SPI_config);
if (hSpiMemInfo == NULL)
{
DEBUG_printString( "\tERROR: SPI Memory Initialization failed.\r\n" );
return E_FAIL;
}
DEBUG_printString("Will you be writing a UBL image? (Y or y) \r\n"); //这里选N,直接跳到后面一步。
DEBUG_readString(fileName);
fflush(stdin);
if ((strcmp(fileName,"y") == 0) || (strcmp(fileName,"Y") == 0))
{
// Read the AIS file from host
DEBUG_printString("Enter the binary AIS UBL file name (enter 'none' to skip): \r\n");
DEBUG_readString(fileName);
fflush(stdin);
LOCAL_GetAndWriteFileData(hSpiMemInfo, fileName, baseAddress, FALSE);
// Assume that the UBL will fit in the first block of the SPI flash
baseAddress += hSpiMemInfo->hMemParams->blockSize;
useHeaderForApp = TRUE;
}
// Read the AIS file from host
DEBUG_printString("Enter the application file name (enter 'none' to skip): \r\n"); //输入你要烧的AIS文件名,带上路径
DEBUG_readString(fileName);
fflush(stdin);
if (LOCAL_GetAndWriteFileData(hSpiMemInfo, fileName, baseAddress, useHeaderForApp) != E_PASS)
{
DEBUG_printString("SPI Flashing Failed!");
return E_FAIL;
}
return E_PASS;
}
Tony,非常抱歉,我是个新手。所以问的详细了一点。我想问下用AISGEN.exe配置spi0flash的时候具体需要设置什么参数呢?我随便设置了一下
然后用ccs写了一下,最后报出的结果是:
[C674X_0] Starting OMAP-L138 SPIWriter.
Will you be writing a UBL image? (Y or y)
n
Enter the application file name (enter 'none' to skip):
D:\Users\NORMAN.ARESINTEL\USBworkspace\test\Debug\test.ais
INFO: File read complete.
这个是不是表示已经烧写成功了呢?我板子重新上电发现程序可能没有跑起来啊
看代码,也要看到打印下面的信息才算烧写成功啊:
void main( void )
{
Uint32 status;
// Init memory alloc pointer to start of external memory
UTIL_setCurrMemPtr(0);
// System init
if (DEVICE_init() !=E_PASS)
{
exit();
}
// Execute the SPI flashing
status = LOCAL_spiwriter();
if (status != E_PASS)
{
DEBUG_printString("\tSPI flashing failed!\r\n");
}
else
{
DEBUG_printString("\tSPI boot preparation was successful!\r\n" );
}
}
单从配置AIS文件的角度,只要选对boot mode就可以了,至于PLL, DDR,外设等,那要看你的代码里是否用到DDR,是否在代码里配置了PLL。如果代码里用了DDR,则必需在AISGEN里配置DDR,且要保证配的值是正确的,不然也是跑不起来的。
简单的方法是先把过程跑通,用一个简单的程序,只用到片上内存点个灯看能不能boot起来。
谢谢指点,我去试一下。要是我用的是spi0的话这个spiwriter不需要做任何改动吗?现在我们芯片是m25p64。我按照这个网址http://processors.wiki.ti.com/index.php/Serial_Boot_and_Flash_Loading_Utility_for_OMAP-L138#Modifications_for_Custom_Boards的方法修改了spi的那两个文件。就是把device_spi.h的#define DEVICE_SPIBOOT_PERIPHNUM 后边的值改成了0,因为我用的spi0,然后烧了一个我的测试工程,提示是成功了。但是就是没有跑起来。请问是不是还要修改device_spi.c里面的参数?
const SPI_MEM_ParamsObj DEVICE_SPI_MEM_params =
{
SPI_MEM_TYPE_FLASH,
24, // addrWidth
256, // pageSize
#ifdef AM1810
4096, // sectorSize
#else
0, // sectorSize
#endif
8*1024, // blockSize
64*1024*1024 // memorySize
};
就是这个。具体是怎么修改呢?另外里面有个AM1808这个不影响吗?