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.

     

     

     

     

     

     

     

     

  • 相关阅读:
    Ne10编译安装
    AR中的SLAM(一)
    2016总结&2017计划
    DSO之光度标定
    DBoW2库介绍
    Kinect2.0 for Mac开箱
    SVO原理解析
    【漏洞复现】PHPCMS wap模块 SQL注入(附EXP)
    【编程开发】PHP---面向对象教程
    【编程开发】Python---列表
  • 原文地址:https://www.cnblogs.com/dragen/p/3134101.html
Copyright © 2011-2022 走看看