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.

csl 3.01 SD card例程JTAG仿真和烧到Flash后运行有差异

您好,

我用CCS4跑这个例程(C:\c55xx_csl_3.01\ccs_v4.0_examples\mmc_sd\CSL_MMCSD_SdCardFSExtExample),一切都OK。SD card的数据也OK。但是我尝试将.out文件用命令生成.bin文件后,烧写到Nand Flash当中,程序出现了一些很不合逻辑的事情。以下是我的代码,我为了确定程序执行逻辑,加了LED灯闪烁。

本来按照逻辑,我是不需要再SD card initialization Successful这个打印之前加LED闪烁。因为后面程序出错或者成功的地方我都加了LED闪烁,用闪烁次数来表示出什么错或者成功运行。但是程序运行以后,LED一直没有闪烁,这让我很迷惑,我怀疑程序死在了 configSdCard里面,为了确认这个想法,我在SD card initialization Successful的前面加了LED闪烁,但是奇怪的事情发生了,我加完以后,程序居然能够一直运行到了在读写成功的那个地方LED闪烁了5次。由于我的板子串口输出有问题,所以我只能通过LED来判断。请帮忙分析一下这个问题,多谢!

{
CSL_Status status;
AtaError ataStatus;
Bool testFailed;
unsigned long i=0;



status=Uart_Init();
if(status!=CSL_SOK)
{

//blink 2 times 
EVM5515_LED_on(0);
EVM5515_waitusec(500000);
EVM5515_LED_off(0);
EVM5515_waitusec(500000);
EVM5515_LED_on(0);
EVM5515_waitusec(500000);
EVM5515_LED_off(0);
return;
}
//EVM5515_LED_init();
for(i=0;i<1000;i++)
{
testFailed = FALSE;

EVM5515_waitusec(500000);

EVM5515_LED_off(0);
printf("MMCSD-ATAFS TESTS!\n\n");

printf("MMCSD-ATAFS POLL MODE TEST!\n\n");

status = configSdCard(CSL_MMCSD_OPMODE_POLLED);
if(status != CSL_SOK)
{
testFailed = TRUE;
/////INSTRUMENTATION FOR BATCH TESTING -- Part 2 --
///// Reseting PaSs_StAtE to 0 if error detected here.
PaSs_StAtE = 0x0000; // Was intialized to 1 at declaration.
/////
printf("SD card initialization Failed\n");
printf("\nMMCSD-ATAFS POLL MODE TEST FAILED!!\n");

//blink 2 times
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
}
else
{
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
printf("SD card initialization Successful\n");
ataStatus = mmcConfigFs("pollTest");
if(ataStatus != ATA_ERROR_NONE)
{
testFailed = TRUE;
/////INSTRUMENTATION FOR BATCH TESTING -- Part 2 --
///// Reseting PaSs_StAtE to 0 if error detected here.
PaSs_StAtE = 0x0000; // Was intialized to 1 at declaration.
/////
printf("\nMMCSD-ATAFS POLL MODE TEST FAILED!!\n");

//blink 3 times
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
}
else
{
printf("\nMMCSD-ATAFS POLL MODE TEST PASSED!!\n");
}
}

/////INSTRUMENTATION FOR BATCH TESTING -- Part 3 --
///// At program exit, copy "PaSs_StAtE" into "PaSs".
PaSs = PaSs_StAtE; //If flow gets here, override PaSs' initial 0 with
///// // pass/fail value determined during program execution.
///// Note: Program should next exit to C$$EXIT and halt, where DSS, under
///// control of a host PC script, will read and record the PaSs' value.
/////

if (testFailed == TRUE)
{

//blink 4 times
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
printf("\n\nMMCSD-ATAFS TESTS FAILED!!\n\n");
// exit(EXIT_FAILURE);
}
else
{
printf("\n\nMMCSD-ATAFS TESTS PASSED!!\n\n");

//blink 5 times
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
EVM5515_waitusec(100000);
EVM5515_LED_on(0);
EVM5515_waitusec(100000);
EVM5515_LED_off(0);
//exit(EXIT_SUCCESS);
}
}
}

  • 可以用仿真器跟进去看是否死在configSdCard函数这里。

    具体跟踪方法请参考下面的链接。

    http://processors.wiki.ti.com/index.php/Debugging_Boot_Issues#.22Load_Symbols.22_instead_of_.22Load_Program.22

  • Dear Shine,

    按照上面的方法,我查看到了程序是卡在mmcConfigFs函数里面,好像并没有死机,而是卡在一个同步的MMC读函数里面。如果我尝试暂停仿真,就会有如下的报错,请帮忙分析一下,为什么仿真可以,而烧到Flash去的程序会有问题。以下是callstack和报错: