- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a Nios application which sometimes shows little debug info through jtag uart. Excluding error conditions, debug prints take place only when application starts and whenever a network connection is accepted or closed.
My concern is if this could affect the performance or may possibly cause problems when, on the field, the jtag is not connected. I mean, is jtag uart data queued in a buffer which keeps on increasing and eventually can end up in a heap overflow, reduced system speed or something like that? Or maybe data is automatically discarded by the driver if no jtag connection exists? Should I remove all debug prints in the release or can I safely leave them in the code? Regards CrisLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It depends on the driver. The one from the Altera HAL (the driver used with ucOS, or when no OS is used) will just stop putting data in the buffer once it is full. You can therefore safely continue to write to the jtag uart, the only loss in system speed is due to the time spent to process the strings in the printf fuctions.
The driver for the eCos operating systems hangs when its buffer is full, until a JTAG connection is available to dump the dada. For the other operating systems I don't know, but you can experiment a bit with a simple test software. An elegant way of dealing with it can be to use# defines in your code. As an example you can define a debug_printf macro than would usually map to the printf() function when debugging, but do nothing in the released code. That way you just have one define to change in the release code. This can even be done automatically in the makefile (or the IDE, depending on the tool you are using).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok. I use HAL driver with ucOS, then I understand this is actually safe.
Before, I did some experimental tests, as you suggested, but since my printf were minimal, I couldn't test long enough to be sure the problem would never appear when the board operates for an indefinite period of time. The debug_print macro was exactly what I thought to implement in case there could be problems, but I wanted to avoid searching and replacing the printf all around the code. Thank you- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can probably do:# define printf if (DEBUG_BUILD) printf
then# define DEBUG_BUILD to 1 or 0
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page