自制板,参照5517EVM
按照SPRUHW2,使用hex55生成bin后,使用programmer下载后,没有提示完成,不知道是什么原因
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.
另外,烧录跟cmd,gel文件有关吗?
gel文件和cmd文件没有关系,GEL文件只有在ccs调试环境下使用。如果GEL文件里有初始化板子的代码,在脱机时需要把这部分代码搬移到应用程序中。
建议用仿真器跟踪一下代码,在nand_flash.c处设置断点,看运行到哪里出错了。
nand_flash.c
* Write the Boot-image to the NAND
**************************************************************************/
if (inputFileName[0] == '\0')
{
printf("Opening flashimg.bin...\n");
pInputFile = fopen("flashimg.bin","rb");
}
else
{
printf("Opening %s...\n", inputFileName);
pInputFile = fopen(inputFileName, "rb");
}
if (pInputFile == NULL)
{
printf("ERROR: Input file could not be opened\n");
exit(0);
}
else
{
printf("Input file opened\n");
}
/* Read all data from file and write it to the device (write full sectors) */
printf("Writing Boot-image to NAND...\n");
pTempSector = &nand_temp_sector[0];
addr = 0;
nand_sector = nand_page * pNand->sectorsPerPage;
while (!feof(pInputFile))
{
rcv_count = fread(FileData, 1, 2, pInputFile);
if (rcv_count == 0)
{
break; /* no more data to read */
}
if ((rcv_count & 1) != 0)
{
printf("ERROR: Input File has an odd number of bytes (invalid)\n");
exit(1);
}
*pTempSector++ = (FileData[0] << 8) | FileData[1];
addr++;
if ((addr%0x100) == 0)
{
printf("Programming... [TotalSize=%ld (0x%lX)]\n", addr, addr);
if (pAtaDrive->AtaWriteSector(nand_sector-1, pAtaDrive->pAtaMediaState, (AtaUint16 *)&nand_temp_sector[0], 0))
{
printf("ERROR in AtaWriteSector\n");
for (;;);
}
nand_sector++;
pTempSector = &nand_temp_sector[0];
}
}
/* If there is unwritten data, write the last sector */
if (pTempSector != &nand_temp_sector[0])
{
printf("Programming... [TotalSize=%ld (0x%lX)]\n", addr, addr);
if (pAtaDrive->AtaWriteSector(nand_sector-1, pAtaDrive->pAtaMediaState, (AtaUint16 *)&nand_temp_sector[0], 0))
{
printf("ERROR in AtaWriteSector\n");
for (;;);
}
}
/* Flush the last sector */
printf("Flushing Data...\n");
if (pAtaDrive->AtaWriteSectorFlush(pAtaDrive->pAtaMediaState))
{
printf("ERROR in AtaWriteSectorFlush\n");
for (;;);
}
fclose(pInputFile);
printf("done\n");
我单步了一下,发现在这个位置,返回值等于0,然后就跳出了
rcv_count = fread(FileData, 1, 2, pInputFile);
if (rcv_count == 0)
{
break; /* no more data to read */
}
有没有关于这个函数的说明,为什么会返回0
我单步了一下,发现在这个位置,返回值等于0,然后就跳出了
rcv_count = fread(FileData, 1, 2, pInputFile);
if (rcv_count == 0)
{
break; /* no more data to read */
}有没有关于这个函数的说明,为什么会返回0
我尝试把这一段屏蔽掉,又会卡在这里
if (pAtaDrive->AtaWriteSector(nand_sector-1, pAtaDrive->pAtaMediaState, (AtaUint16 *)&nand_temp_sector[0], 0))
{
printf("ERROR in AtaWriteSector\n");
for (;;);
}
我这到底是哪出问题了?
我又把原先大于64KB的bin文件重新编辑,删除了部分内容,以验证,是不是有哪里限制了64KB的容量
实测,这样就能烧入了
addr++;
if ((addr%0x100) == 0)
{
printf("Programming... [TotalSize=%ld (0x%lX)]\n", addr, addr);
也就是说,这个addr不能超过0x8000
但是这个是unsigned long,应该也不会超啊
我不明白是哪里限制了,请帮忙排查一下,谢谢
看到下面有个帖子类似的问题。
https://e2e.ti.com/support/processors-group/processors/f/processors-forum/272412/flash-writing-problem/953334
请试一下附件Spectrum Digital公司提供的的烧写程序。
flash_programming.zip
我将附件中的programmer.out加载后,烧录bin文件,效果与之前一致
原帖是说.ezdsp5555.out有效,应该是指ezDSP5535吧,
我又查了一下,这个ezDSP5535只有spiflash,而另一款c5515 ezdsp只有norflash
而我用的是NANDFLASH,所以这两个out文件也用不了
能不能帮我向英文论坛那边咨询一下,NANDFLASH大于64K,有没有办法烧录
谢谢
e2e工程师有回复了,是fread函数本身的限制。
You are correct. The fread() in rts55.lib does have size limitation of 64KB, because the num_left and num_read used in fread.c (rtssrc.zip in ccs\tools\compiler\C5500 Code Generation Tools 4.4.1\lib) is size_t which is unsigned int which is uint16.