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.

C55x怎么在外部SDRAM上运行程序?



平台:C5515

操作系统:DSP/BIOS

IDE:CCS 6.0

当前程序运行正常,基本占满了片上的DARAM和SARAM,为了后续增加功能,需要使用外挂的SDRAM来运行程序。

step1.查看编译生成的.map文件,发现.text段最大,为0x000226c0字节。

step2.打开.tcf文件,将.text段从原来的SARAM改为SRAM,即SDRAM。

step3.在.ccxml文件中使用GEL文件。

GEL文件中只保留一个有效的函数

OnTargetConnect()
{
//GEL_Reset();
//Peripheral_Reset();
ProgramPLL_100MHz();
SDRAM_INIT();
GEL_TextOut("Target Connection Complete.\n"); 
}

调用的两个函数代码如下:

ProgramPLL_100MHz() {
    int i;

    GEL_TextOut("Configuring PLL (100.00 MHz).\n");
    /* Enable clocks to all peripherals */
    *(short *)PCGCR1@IO = 0x0;
    *(short *)PCGCR2@IO = 0x0;

    /* Bypass PLL */
    *(short *)CCR2@IO = 0x0;

    /* Set CLR_CNTL = 0 */
    *(short *)CGCR1@IO = *(short *)CGCR1@IO & 0x7FFF;

    *(short *)CGCR1@IO =  0x8BE8;
    *(short *)CGCR2@IO =  0x8000;
    *(short *)CGCR3@IO =  0x0806;
    *(short *)CGCR4@IO =  0x0000; 

    /* Wait for PLL lock */
    for(i=0;i<0x7fff;i++);

    /* Switch to PLL clk */ 
    *(short *)CCR2@IO = 0x1;

    GEL_TextOut("PLL Init Done.\n");
    
}

/* mSDRAM = MT48H4M16LF-8 */
/* Timings based on EMIF clk = 100MHz */

SDRAM_INIT() 
{
    int i;

    /* reset EMIF */
    *(short *)PRCR@IO = 0x0002;
    for(i=0;i<0xff;i++);

    //enable SDRAM clock
    *(short*)CLKCFGL@IO=0x0001;

	/* enable word writes to EMIF regs */
    *(short *)ESCR@IO = 0;

    /* step 1 */
    *(short *)SDTIMR1@IO = 0x4710;
    *(short *)SDTIMR2@IO = 0x3911;
    *(short *)SDSRETR@IO = 0x0007;

    /* step 2 */
    *(short *)SDRCR@IO = 0x04E3;
    
    /* step 3 */
    *(short *)SDCR1@IO = 0x4720;
    *(short *)SDCR2@IO = 0x0001;

    /* step 4 */
    for(i=0;i<0xff;i++);

    /* step 5 */
    *(short *)SDRCR@IO = 0x061A;

    GEL_TextOut("SDRAM Initialization Complete.\n");
}

step4.编译,在线调试功能正常

step5.将编译生成的.out文件通过hex55.exe转换成.bin文件。所用的.cmd文件内容如下:

-boot
-v5505
-serial8
-reg_config 0x1C1F,0x0
-reg_config 0x1C20,0x8BB4
-reg_config 0x1C21,0x8000
-reg_config 0x1C22,0x0806
-reg_config 0x1C23,0x0200
-reg_config 0x3000,0x0002
-delay 0x500
-reg_config 0x1C1F,0x1
-reg_config 0x1C05,0x0002 -delay 0x500 -reg_config 0x1c1e,0x0001 -reg_config 0x1c33,0x0000 -reg_config 0x1020,0x4710 -reg_config 0x1021,0x3911 -reg_config 0x103C,0x0007 -reg_config 0x100C,0x04E3 -reg_config 0x1008,0x4720 -reg_config 0x1009,0x0001 -delay 0x500 -reg_config 0x100C,0x061A -b -o EVM_Sample.bin EVM_Sample.out

即,在.cmd文件中实现GEL文件的两个函数的功能。

step6.烧录到SPI flash上,无法正常运行

请问:上述操作是否正确?

如果不正确,怎样操作才能实现在脱机情况下,在SDRAM运行程序呢?