I've used the NutTrace functions with some success, hopefully the following is the right way....
- Re-compile the required library with the appropriate DEBUG line enabled/uncommented. - I use a full recompile using NutConfigurator.
- 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.
- 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.
- 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);