STM32 --- 断言(assert_param)的开启和使用

默认,STM32的assert_param是没有开启检测,需要 #define USE_FULL_ASSERT

 

开启后,才能检测形参是否符合要求

 

// #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
#define assert_param( x ) if( x == 0 ) { for(;;); }
/* Exported functions ------------------------------------------------------- */
// void assert_failed(uint8_t* file, uint32_t line);

 

posted @ 2018-06-18 16:12  流水灯  阅读(419)  评论(0编辑  收藏  举报