Hi I want to use debug_print macro that will able do what printf does,but I am working with micrium(RTOS) which is not supporting printf.So Can anyone help me how to implement debug_print macro supporting micrium RTOS
-
_There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs._ – Sourav Ghosh May 13 '16 at 08:47
-
Please show your research effort till time. Please read [Ask] page first. – Sourav Ghosh May 13 '16 at 08:47
-
Let's set the records straight. Are you looking to print into a log file, or a global buffer of some sort? – barak manos May 13 '16 at 08:50
-
#define debug_print(fmt, ...) APP_TRACE_INFO((fmt,##__VA_ARGS__) – Yallamanda Dosakayala May 13 '16 at 08:50
-
#define APP_TRACE_INFO(x) APP_TRACE x – Yallamanda Dosakayala May 13 '16 at 08:53
-
#define APP_TRACE printf – Yallamanda Dosakayala May 13 '16 at 08:53
-
The RTOS likely has nothing to do with printf. – kkrambo May 13 '16 at 10:48
-
Micrium is a company not an RTOS - presumably you mean MicroC/OS-II or III? – Clifford May 14 '16 at 22:52
-
What toolchain and target processor are you using? (the RTOS is largely irrelevant). To what device are you outputting the text? Your question title asks for a "printf function", but the body asks for a "debug_print macro" - what is it you actually need? I presume that if you had a printf, you can write the macro - so you don't need help with the macro, but with printf support. If that is the case, then that is what you should ask. – Clifford May 14 '16 at 23:10
1 Answers
It is not the responsibility of the RTOS to provide printf - your compiler's standard library does that - you may need to implement low-level support for your chose output device; what you need to do will depend on the library and/or toolchain. Most small RTOS's provide little more than scheduling, timing, synchronisation and IPC services and provide no I/O support. That does not mean of course that you cannot use the RTOS services to implement I/O support.
If your library does not provide a printf or its support is too heavyweight for your needs (some implementations require a lot of stack space, and full format specifier support can be expensive in code space on very small targets), there are plenty of lightweight implementations such as Tiny Printf.

- 88,407
- 13
- 85
- 165