I am running Kinetis Bootlader 1.2 on TWR-K65F180M. How do I enable the debug_printfs? The board is flashed over USB SDA. I tried defining DEBUG within KDS. But couldn't find corresponding outputs either in KDS console or ACM.
I tried to include the utility files within hello_world example, which did not compile properly. I am hoping to resolve the compile errors. But wanted to check whether there is a simpler solution, which I failed to notice.
Many Thanks,
Tony
Just to update, I have managed to get printfs working using the example code. But am still keen to know if there is an alternative method..
Hello Tony,
Please tell me what's mean about the "an alternative method." ?
And tell me which KDS version do you use ?
'"I tried to include the utility files within hello_world example, which did not compile properly." does it still have error , if yes, could you please
show the error on KDS ?
BR
Alice
Hello,
I have the same question, how do you get debug_printf() to work? I tried the IAR example. Also noticed none of the uarts are configured. I thought defining DEBUG would make it work but no luck.
I saw this comment in fsl_platform_common.h:
//! This print function will only output text when the @a DEBUG macro is defined.
But not sure what an @a DEBUG macro is.
Thanks,
Mark
Hello Mark,
Could you please tell me which demo proeject ?
The SDK demo ? the KBOOT demo ?
Also which board.
BR
Alice
Hi Alice
You never came back and answered Mark on his question.
I have a similar problem, and would like to get printfs working for debugging.
I'm using the following tools and SDK for development.
KDS V3.2
KSDK 1.3
MQX 5.0
In the fsl_platform_common.h there is the following definition of a debug printf
#define debug_printf(x, ...) do {} while (false)
Obviously this does nothing as it simply loops forever. The only call to this method is from main, which has after bootloader_run();
debug_printf("Warning: reached end of main()\r\n");
There is also this definition...
#if (defined(DEBUG) || defined(_DEBUG)) && !defined(DEBUG_PRINT_DISABLE)
static inline void debug_printf(const char * format, ...);
//! @brief Debug print utility.
//!
//! This print function will only output text when the @a DEBUG macro is defined.
static inline void debug_printf(const char * format, ...)
{
va_list args;
va_start(args, format);
vprintf(format, args);
// Temporarily disable MISRA rule 14.2
#if defined(__ICCARM__)
#pragma diag_suppress=Pm049
#endif
va_end(args);
#if defined(__ICCARM__)
#pragma diag_default=Pm049
#endif
}
#else // (DEBUG || _DEBUG) && !DEBUG_PRINT_DISABLE
What is the @a DEBUG? and if I define my own DEBUG will debug_printf become operational?
How is the UART setup for printfs?
Regards
Jerome
Hey Jerome I'm having the same issue, did you solved it?
Hi Irfan
Yes, I solved my issue although I was not the OP.
Without looking at the code....I can tell you what I did.
You need to overwrite the "weak" read write functions for STDIO that printf and the like use for outputting onto the serial port.
These functions will have your low level putch and getch to your serial UART.
After many days searching forums, googling I put various references together to come up with my own solution.
The most helpful I found was by Erich Styger on MCU on Eclipse. See below link>
printf() and scanf() with GNU ARM Libraries | MCU on Eclipse
You can essentially copy paste this code...and change the UARTx to the port of your choice....and printf should work like a charm.
If you need more info let me know.
Regards
Jerome
Hello Jerome Pitt,
Sorry to reply you late.
As to this thread has gone that long a time, could you please describe your new question at this time
in detail, for example, IDE , board.. thanks.
BR
Alice