This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28P650DH: DEBUG这个宏定义何时会生效?是否有相关文档说明

Part Number: TMS320F28P650DH

DEBUG这个宏定义何时会生效?是否有相关文档说明

  • 没看到专门的文档说明,个人感觉主要影响driverlib等库的调试。driverlib的库函数有大量使用ASSERT来判断输入合法性,定义DEBUG后ASSERT在检测到错误输入时会报错。

    //*****************************************************************************
    //
    // The ASSERT macro, which does the actual assertion checking.  Typically, this
    // will be for procedure arguments.
    //
    //*****************************************************************************
    #ifdef DEBUG
    #ifdef __TMS320C28XX__
    //
    // When called from C28x application
    //
    #define ASSERT(expr) do                                                       \
                         {                                                        \
                             if(!(expr))                                          \
                             {                                                    \
                                 __error__(__FILE__, __LINE__);                   \
                             }                                                    \
                         }                                                        \
                         while((_Bool)0)
    #else
    //
    // When called from CLA application. Update as needed.
    //
    #define ASSERT(expr) do                                                       \
                         {                                                        \
                             if(!(expr))                                          \
                             {                                                    \
                                 __mdebugstop();                                  \
                             }                                                    \
                         }                                                        \
                         while((_Bool)0)
    #endif
    #else
    #define ASSERT(expr)
    #endif

  • 调试的时候定义DEBUG没问题,我想的是在正式程序中不希望有DEBUG宏,因为有了这个宏后,很影响我的中断耗时

  • 设置里面把预定义删掉

  • 好的,看起来这个能解决问题