assert_failed问题

[复制链接]
7920|2
 楼主| tanybin 发表于 2010-12-2 16:45 | 显示全部楼层 |阅读模式
这两天在看103的资料。
看到库说明中,看到对输入参数的检测,上面说到如果参数错误会显示出对应的文件名和源代码的行号。也就是这个assert_failed处理。但是我在main.c文件里面看到这个函数的定义是如下
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\r\n", file, line) */
  /* Infinite loop */
  while (1)
  {
  }
}
我就想问,从上面代码看,显示出错文件名和行号的部分已经被注释掉了,只是一个空循环而已,是否要把printf("Wrong parameters value: file %s on line %d\r\n", file, line)这句释放出来,才能实现这个功能。还有就是如果实现,这个信息通过什么端口显示,显示在什么地方?printf一般是PC机打印在屏幕上的,可是103并没有屏幕啊。我新手一个,还请高手解释一下。
IJK 发表于 2010-12-2 17:08 | 显示全部楼层
这个信息通过什么端口显示,显示在什么地方?

这取决于开发环境,或者自己通过串口输出
 楼主| tanybin 发表于 2010-12-3 09:30 | 显示全部楼层
这个信息通过什么端口显示,显示在什么地方?

这取决于开发环境,或者自己通过串口输出
IJK 发表于 2010-12-2 17:08


你好,能说详细一点吗?printf("Wrong parameters value: file %s on line %d\r\n", file, line) 这句需要将其从注释中释放出来吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

6

主题

60

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部