diff options
author | Lukasz Czechowski <lukasz.czechowski@thaumatec.com> | 2025-05-20 13:36:42 +0200 |
---|---|---|
committer | Kever Yang <kever.yang@rock-chips.com> | 2025-06-06 17:12:20 +0800 |
commit | 0fb68337f2482f0397681b92d13bcfbf3741cd06 (patch) | |
tree | cff78ec0199c1f70fab67e7c4518cdac3e587fbe | |
parent | 6773a46f1131fe95bcddb7472635e07a5fd249f8 (diff) |
debug_uart: Replace debug functions with dummies if CONFIG_DEBUG_UART is not set
In case DEBUG UART is not used, define dummy macros replacing
the actual function implementations that will not be available.
This allows to compile code and avoid linker errors.
Redefine the DEBUG_UART_FUNCS macro if DEBUG UART is not available,
to avoid compilation errors.
Signed-off-by: Lukasz Czechowski <lukasz.czechowski@thaumatec.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
-rw-r--r-- | include/debug_uart.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/debug_uart.h b/include/debug_uart.h index 714b369e6fe..d5e397d5e0a 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -128,6 +128,8 @@ void printdec(unsigned int value); (1 << CONFIG_DEBUG_UART_SHIFT), \ CONFIG_DEBUG_UART_SHIFT) +#ifdef CONFIG_DEBUG_UART + /* * Now define some functions - this should be inserted into the serial driver */ @@ -197,4 +199,22 @@ void printdec(unsigned int value); _DEBUG_UART_ANNOUNCE \ } \ +#else + +#define DEBUG_UART_FUNCS + +#define _printch(ch) (void)(ch) +#define printhex1(digit) (void)(digit) +#define printhex(value, digits) do { (void)(value); (void)(digits); } while(0) + +#define printch(ch) (void)(ch) +#define printascii(str) (void)(str) +#define printhex2(value) (void)(value) +#define printhex4(value) (void)(value) +#define printhex8(value) (void)(value) +#define printdec(value) (void)(value) +#define debug_uart_init() ((void)0) + +#endif + #endif |