[PATCH v4 2/5] debug_uart: Replace debug functions with dummies if CONFIG_DEBUG_UART is not set
Quentin Schulz
quentin.schulz at cherry.de
Fri May 16 17:27:18 CEST 2025
Hi Lukasz,
On 5/15/25 5:55 PM, Lukasz Czechowski wrote:
> 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 at thaumatec.com>
> ---
> include/debug_uart.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/include/debug_uart.h b/include/debug_uart.h
> index 714b369e6fed..4526dca24ac6 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,17 @@ void printdec(unsigned int value);
> _DEBUG_UART_ANNOUNCE \
> } \
>
> +#else
> +
> +#define DEBUG_UART_FUNCS
> +
> +#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)
> +
There are a few additional functions that aren't redefined here:
_printch
printhex1
printhex
debug_uart_init
any particular reason for not having included them?
Cheers,
Quentin
More information about the U-Boot
mailing list