zoukankan      html  css  js  c++  java
  • 关于Xil_Assert断言产生的死循环,导致程序未执行的问题

    XGpioPs_SetDirection(Gpio,0x7,0x01);

    I am designed to write XGpioPs_SetDirectionPin(Gpio,0x07,0x01) but make a mistake !

    The driver api will check the validity of parameters:

    Xil_AssertVoid(InstancePtr != NULL);

        Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

        Xil_AssertVoid(Pin < XGPIOPS_DEVICE_MAX_PIN_NUM);

        Xil_AssertVoid((Direction == 0) || (Direction == 1));

    Go into sentence: Xil_AssertVoid(Pin < XGPIOPS_DEVICE_MAX_PIN_NUM);

    if (Expression) { \

    Xil_AssertStatus = XIL_ASSERT_NONE; \

    } else { \

    Xil_Assert(__FILE__, __LINE__); \

    Xil_AssertStatus = XIL_ASSERT_OCCURRED; \

    return; \

    }

    Once the parameters occur false and the following 2 sentences will be executed:

    Xil_Assert(__FILE__, __LINE__);

    Xil_AssertStatus = XIL_ASSERT_OCCURRED;

    It just set the Xil_AssertStatus flag and transform the error location information to the specified routes.

    void Xil_Assert(const char *File, int 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) {

        }

    }

    Once the routes equal 0, that's no route being set, just run endless loop.

    So if you application seems go away but no error message has been output or the specified flow has not been executed, just to think about the

    ASSERT loop.

     

     

     

     

     

     

     

     

  • 相关阅读:
    myeclipse 代码提示(alt+/)
    彻底解决mysql中文乱码
    Pycharm取消默认的右击运行unittest方法
    解决Ubuntu的root账号无法登录SSH问题-Permission denied, please try again.
    language support图标在哪里?怎么消失了?
    Ubuntu安装谷歌输入法或者搜狗
    最大流算法-ISAP
    WC2013-糖果公园
    bzoj4032-最短不公共子串
    bzoj1031-字符加密
  • 原文地址:https://www.cnblogs.com/dragen/p/3134101.html
Copyright © 2011-2022 走看看