历史上的今天
今天是:2025年01月20日(星期一)
2020年01月20日 | stm32 官方例子main函数最后一段代码#ifdef USE_FULLASSERT
2020-01-20 来源:eefocus
代码如下:
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %drn", file, line) */
/* Infinite loop */
while(1)
{
}
}
#endif
调试用的。在stm32f10x_conf.h文件中,有如下宏定义
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function which reports
* the name of the source file and the source line number of the call
* that failed. If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0: assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
如果你定义了USE_FULL_ASSERT
就可以在assert_failed,加入:
printf("Wrong parameters value: file %s on line %drn", file, line);
就可以使用assert_param(expr) 来判断当前参数是够正确,如果不正确,就会打印出错的文件,以及出错的行。
这样就可以方面调试信息了。
史海拾趣
|
http://blog.eeworld.net/zhblue/archive/2007/01/02/1472585.aspx 今天我也原创一回,谁给我推荐推荐,算然短点,还是希望我们linux版友支持 … 查看全部问答> |
|
哪里有好的教程呀? http://msdn2.microsoft.com/en-us/embedded/bb267253.aspx… 查看全部问答> |
|
Socket 错误一览表from“http://tb.blog.csdn.net/TrackBack.aspx?PostId=1955429”出现网络联机错误Socket error #11001表示您的计算机无法连上服务器,请检查您的Proxy设定以及Proxy相关账号,或暂时取消您防毒软件的「个人防火墙」。· 出现网络 ...… 查看全部问答> |
|
因为2012的影响,让我DIY UFO,我准备购买仪表,机器,和材料。不知道这里有没有UFO DIY的路过者,可以交流一下研究结果,与制造步骤。 放个片来点吸引力: … 查看全部问答> |
|
简介:注意那些意外谐振响应您曾经将输入电压接通到您的电源却发现它已经失效了吗?短暂的输入电压上升时间和可产生两倍于输入电源电压的高 Q 谐振电路可能会是问题所在。如果您迅速中断感应元件中的电流便会出现类似问题。会出现这类问题的一些情 ...… 查看全部问答> |
|
转帖:感谢作者 分区PBR详解: 分区引导扇区知识 一、FAT32的分区引导扇区 分区引导扇区DBR(DOS BOOT RECORD)是由FORMAT高级格式化命令写到该扇区的内容;DBR是由硬盘的MBR装载的程序段。DBR装入内存后,即开始执行该引导程序段,其主要功能 ...… 查看全部问答> |
|
本帖最后由 paulhyde 于 2014-9-15 03:30 编辑 由于altium designer没法更好的显示原理图,所以用TINA做了这个原理图,请大家帮我看看有什么问题 这是我自制的pcb 测试的时候出现两个三个问题,第一个问题就是ths3001和buf634级联的地方那个Ro ...… 查看全部问答> |




