#ifdef DEBUG /******************************************************************************* * Function Name: assert_failed * Description : Reports the name of the source file and the source line number * where the assert_param error has occurred. * Input : - file: pointer to the source file name * - line: assert_param error line source number * Output : None * Return : None *******************************************************************************/ void assert_failed(u8* file, u32 line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d
", file, line) */
#ifdef DEBUG
/*******************************************************************************
* Function Name: assert_failed
* Description : Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* Input : - file: pointer to the source file name
* - line: assert_param error line source number
* Output : None
* Return : None
*******************************************************************************/
void assert_failed(u8* file, u32 line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d ", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
后边这个半截的错误返回程序就不用解释了。
---------------------------------
方便输出调试信息吧.
如果使能debug,你自己可以在debug函数里面输出想要看的debug信息.
看过很多高手写的代码。一般都如原子说的调试信息。
#define printf debug
要使用printf这个函数,需要加头文件#include<stdio.h>。然后把stdio.h中的extern char putchar (char);
然后你把char putchar (char)函数,修改成你相应的UARSTx.这样DEBUG出来的调试信息就出现在你相应的UARSTx里。
一周热门 更多>