使用Eclipse调试嵌入式系统 - 如何打印登录文件? [英] Debugging embedded system with Eclipse - HOW TO PRINT TO A LOGGING FILE?

查看:202
本文介绍了使用Eclipse调试嵌入式系统 - 如何打印登录文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用STM32F4上的一个项目,我正在使用Eclipse。我有一些程序的问题 - 它似乎有一个随机的行为 - 有时它的工作正常,其他时候它有一些错误。有时,当我尝试使用断点进行调试时,我会得到美丽的HardFault处理程序,它真的与我的大脑混淆。



对于这个小小的主题段落,只是想让您知道为什么我决定在程序中的某些关键时刻使用打印到日志文件,以便我可以看到在哪些状态和哪些功能发生问题。我正在通过Eclipse(gdb)的JTAG界面进行调试,我需要知道Eclipse中是否集成了一个简单的方法,这可以帮助我在程序中使用类似fprintf的函数来写入磁盘上的文件。



如果没有,任何其他解决方案?



感谢

解决方案

我不喜欢将调试输出日志连接到Jtag通信端口,因为开发后日志将不可用。



我通常构建一个可以通过任何可用介质(UART,USB,Ethernet或SDCARD)发送日志消息的SystemLog库。这就是我建议你做的事情。如果stdlib在您的项目中可用,您应该使用snprintf系列函数,这将有助于您完成开发和支持团队的任何失败事件。



构建您的SystemLog。



此外,您可以通过调用串行控制台通讯器(如果使用UART)在您的makefile中将日志输出集成到eclipse控制台中,在此情况下,您的makefile也必须闪烁目标。


I'm currently working on a project on STM32F4 and I'm using Eclipse. I've got some problems with the program - it seems to have a random behavior - sometimes it works fine, other times it has some errors. Sometimes when I try do debug with breakpoints I get the beautiful HardFault Handler and it really messes with my brains.

Sorry for the little off-topic paragraph, just wanted to let you know why I decided to use printing to a log file at some key moments in the program so I can see in which states and in which functions does the problem occur. I'm debugging through a JTAG interface with Eclipse (gdb) and I need to know if there is an easy method integrated in Eclipse that may help me use fprintf-like functions inside my program to write to a file on the disk.

If no, any other solutions?

Thanks

解决方案

I do not like to connect the debug output log to the Jtag communication port because the log will not be available after development.

I usually build an SystemLog library that can send the log messages through any medium that is available (UART, USB, Ethernet or SDCARD). That's what I'd recommend you to do. It will help you through the development, and the support team on the event of any failure on field.

If stdlib is available in your project you should use the snprintf family functions to build your SystemLog.

Also, you can integrate the log output to the eclipse console by calling a serial console communicator (if you use UART) on you makefile, in this case, your makefile will have to flash the target as well.

这篇关于使用Eclipse调试嵌入式系统 - 如何打印登录文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆