Hi,everyone! A problem here:The cygnal's MCU has two serial ports,so "printf" function must be reworked.But I don't know how to do it. Give me a hand! Thanks a lot!
Instead of if (debug) clauses, try this:
#ifdef DBG # define debug #else # define debug while (0) #endif // Usage: single line debug printf("Got here\n"); // Usage: multiple line debug { g_errno = 12; printf("Got error, %d\n", g_errno); }
You may check this info.: http://www.keil.com/support/docs/788.htm
Mark, Yes, of course, that gives you compile-time control to produce an image which either has debug output or doesn't. I needed the ability to enable/disable the debug output at run-time In fact, I did also use conditional-compilation so that I could build either a completely "clean" (debug-free) image, or one with the runtime-controllable debug