is anyone familiar with this? I am looking through my C books but cannot find any information on this.
Basically, I am looking to "how to trace Embedded code"
Thanks in advance
Printable View
is anyone familiar with this? I am looking through my C books but cannot find any information on this.
Basically, I am looking to "how to trace Embedded code"
Thanks in advance
What do you mean with tracing embedded code? You mean adding trace logging?
These are two logging macros which I have put in a file which I use in my home projects.
By turning the compiler switch USE_TRACE_LOGGING on, the macros will print some text to the screen. If the compiler switch is not turned on, then nothing is done. You can use it like this in your functions:Code:#ifdef USE_TRACE_LOGGING
#define LOG_TRACE_ENTRY printf ("LOGGING: TRACE-ENTRY %s\n", __FUNCTION__);
#define LOG_TRACE_EXIT printf ("LOGGING: TRACE-EXIT %s\n", __FUNCTION__);
#else
#define LOG_TRACE_ENTRY(fn)
#define LOG_TRACE_EXIT(fn)
#endif
Note that __FUNCTION__ is a GCC specific feature which gives the name of the function. So it is not ANSI C.Code:int function ()
{
LOG_TRACE_ENTRY;
LOG_TRACE_EXIT;
}