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.

     

     

     

     

     

     

     

     

  • 相关阅读:
    简单两步 ~ 绕过 "Paused in debugger"
    Python3 与 C# 并发编程之~ 线程篇
    【翻译】七个习惯提高Python程序的性能
    Jupyter-Notebook 远程访问
    Ubuntu18.04下给Jupyter-NoteBook设置默认工作路径(附Win设置和pip版)
    Python3 与 C# 并发编程之~ 进程篇
    Python3 与 C# 并发编程之~进程先导篇
    交叉编译调试qemu_guest_agent
    OVN简单部署
    OVN学习(三)
  • 原文地址:https://www.cnblogs.com/dragen/p/3134101.html
Copyright © 2011-2022 走看看