工程师您好,我们开发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分配的内存起始地址,难道是内存空间分配不够还是有什么其他可能性?请您为我们指导一下,谢谢啦!
