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.

     

     

     

     

     

     

     

     

  • 相关阅读:
    poj2409 Let it Bead
    bzoj1004 Cards
    Burnside引理和polay计数学习小记
    poj3294 --Life Forms
    poj3261 -- Milk Patterns
    Arch linux安装
    各种开源协议介绍
    grub2 rescue模式
    mongoDB-3.x Master Slave Replication
    Unix-like包管理器一览
  • 原文地址:https://www.cnblogs.com/dragen/p/3134101.html
Copyright © 2011-2022 走看看