core: debug: introduce DEBUG_PUTS()

The DEBUG() function requires a minimal stack size for printf().
This is not always availiable.
To still allow static debug messages, introduce DEBUG_PUTS() that
gets resolved to puts() and does not carry such stack size requirements.
This commit is contained in:
Benjamin Valentin 2019-11-20 19:09:47 +01:00
parent 1018a6fa67
commit a98a9e12e9

View File

@ -56,7 +56,7 @@ extern "C" {
printf(__VA_ARGS__); \
} \
else { \
puts("Cannot debug, stack too small"); \
puts("Cannot debug, stack too small. Consider using DEBUG_PUTS()."); \
} \
} while (0)
#else
@ -95,6 +95,14 @@ extern "C" {
* @note Another name for ::DEBUG_PRINT
*/
#define DEBUG(...) if (ENABLE_DEBUG) DEBUG_PRINT(__VA_ARGS__)
/**
* @def DEBUG_PUTS
*
* @brief Print debug information to stdout using puts(), so no stack size
* restrictions do apply.
*/
#define DEBUG_PUTS(str) if (ENABLE_DEBUG) puts(str)
/** @} */
/**