NUTDEBUG

From Nutwiki
Revision as of 17:02, 27 October 2016 by Harald (Talk | contribs) (1 revision imported)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Using NUTDEBUG

I've used the NutTrace functions with some success, hopefully the following is the right way....

  1. Re-compile the required library with the appropriate DEBUG line enabled/uncommented. - I use a full recompile using NutConfigurator.
  2. Fully relink your application (in ICCAVR use shift F9). If you dont compile the library, fully recompile using configurator, and fully relink your app, you can sometimes get strange, intermittent issues due to memory structures changing slightly in location.
  3. In your main app, call the NutTrace function which enables the trace function after the desired target stream is initialised. This sets the local trace flag in the library in question. see example below for chat.c You should pass the stream/device pointer to this function - you can send debug to uarts or (i think) any stream.
  4. Remember, when removing the debug option, recompile the library, recompile all libraries (nut configurator), and then fully relink your application.
// tell your application about the NutTraceXXX function
void NutTraceChat(FILE * stream, u_char flags);
// Tell the trace function to send trace data to the uart
// (uart must be already opened/initialised)
NutTraceChat(uart1, (u_char)1);