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.

C6678开发,SRIO初始化问题



    工程师您好,我们开发C6678,为了实现它和FPGA通信,之前在你们的帮助下SRIO接口测试程序通过,能够打印“port_ok!”,当我们把MAC层工程代码移植到该接口测试版本里后,即加上总体软件初始化后,程序运行会卡在SRIO硬件初始化程序中,具体位置如下图示:且main()中位于SRIO初始化函数位置之前的Cache、PLL初始化函数里相关信息的打印函数均没有打印出来(程序单步执行时,经过了各函数中的printf()函数,但没有打印出来)。

    当注释掉总体软件初始化程序后,程序卡在:如下方代码中注释位置,但Cache、PLL初始化函数里相关信息的打印函数均可以打印出来。

void unlock_mem_prot_regs()
{
int i;

/*1. Write a 1 to the KEYR field in the MPLKCMD register. This resets some internal
status for the MPLK0 through the MPLK3 registers.*/
gpCGEM_regs->MPLKCMD = (1<<CSL_CGEM_MPLKCMD_KEYR_SHIFT);

/*2. Write the unlock key to MPLK0 through the MPLK3 registers. The hardware
compares the written value with the stored key value. Software must write to all
four registers exactly once. The writes can arrive in any order.*/
for(i=0; i<4; i++)
{
gpCGEM_regs->MPLK[i] = mem_prot_key[i];
}

/*3. Write a 1 to the UNLOCK field in the MPLKCMD register. If the key written in
step 2 matches the stored key, the hardware disengages the lock. If the key written
in step 2 does not match, the hardware signals an exception. The hardware
reports the fault address as the address of the MPLKCMD register.*/
gpCGEM_regs->MPLKCMD = (1<<CSL_CGEM_MPLKCMD_UNLOCK_SHIFT);

/*wait to make sure it is unlocked*/
while(1==(gpCGEM_regs->MPLKSTAT&CSL_CGEM_MPLKSTAT_LK_MASK));    /*程序卡住的位置*/
}

    起初我们猜想是我们工程代码中全局变量动态分配的内存空间和cmd中为DDR、SRIO等操作的内存空间冲突,于是在程序运行暂停后观察了全局变量的起始地址,即为我为DDR_far分配的内存起始地址,难道是内存空间分配不够还是有什么其他可能性?请您为我们指导一下,谢谢啦!

  • 不知道您说的系统总体初始化代码是什么呢,SYS PLL这些配置是必需的,SRIO 驱动程序未正常初始化的原因很多,从您上面描述来看,建议先检查下SRIO PLL配置,看是否你们加入自己代码后相较于之前测试通过的SRIO测试工程在SRIO CLK, SYS CLK这块有没有变化?

  •     工程师您好,我们查了一下:如果将代码、数据或者堆栈等分配到了DDR中,在目标配置文件中需要加载GEL文件。我们因为代码中全部变量大,就将.far定义在DDR中,我们加载了GEL文件之后,初始化正常,但是收不到来自物理层的GPIO中断了,这会是什么原因呢?