feedforward 发表于 2020-3-14 09:07:12

关于NuttX的DEBUGASSERT

nuttx的DEBUGASSERT定义于/nuttx/include/assert.h
在menuconfig中使能DEBUG ASSERTIONS后DEBUGASSERT被定义,否则为空:

DEBUGASSERT的条件为false时将调用PANIC()停止系统运行。
#define ASSERT(f)      do { if (!(f)) PANIC(); } while (0)
#define VERIFY(f)      do { if ((f) < 0) PANIC(); } while (0)

#ifdef CONFIG_DEBUG_ASSERTIONS
#define DEBUGPANIC()   PANIC()
#define DEBUGASSERT(f) ASSERT(f)
#define DEBUGVERIFY(f) VERIFY(f)
#else
#define DEBUGPANIC()
#define DEBUGASSERT(f)
#define DEBUGVERIFY(f) ((void)(f))
#endif



页: [1]
查看完整版本: 关于NuttX的DEBUGASSERT