UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

取消
显示结果 
搜索替代 
您的意思是: 
Xilinx Employee
Xilinx Employee
433 次查看
注册日期: ‎02-16-2012

避免Xil_Assert系列宏导致的死循环

避免Xil_Assert系列宏导致的死循环

在调试模式下,Xil_Assert系列宏会调用Xil_Assert来检查参数是否正常。如果不正常,缺省情况下,没有打印,会进入死循环。
通过调用void Xil_AssertSetCallback(Xil_AssertCallback Routine), 设置回调函数, 可以自己处理失败情况,比如增加打印。
另外也可以修改变量Xil_AssertWait为0,可以避免死循环情况。

void Xil_Assert(const char8 *File, s32 Line)
{
/* if the callback has been set then invoke it */
if (Xil_AssertCallbackRoutine != 0) {
(*Xil_AssertCallbackRoutine)(File, Line);
}

/* if specified, wait indefinitely such that the assert will show up
* in testing
*/
while (Xil_AssertWait != 0) {
}
}

0 项奖励