[U-Boot] [PATCH 0/2] Small fixes to SPL/TPL logging

Simon South simon at simonsouth.net
Wed Oct 2 14:55:05 UTC 2019

These two patches fix small issues I encountered when enabling
debugging output for U-Boot's TPL.

The first fixes a typo in the description of the TPL_LOG_CONSOLE
configuration option.

The second adds a simple implementation of vsnprintf() to the
tiny-printf library. Without this, enabling either SPL or TPL logging
for systems (such as the PINE64 ROCK64) that also use the tiny
printf() implementation causes the build to fail with error messages

    aarch64-linux-gnu-ld.bfd: common/built-in.o: in function `_log':
    (...)/u-boot/common/log.c:212: undefined reference to `vsnprintf'
    make[1]: *** [scripts/Makefile.spl:404: spl/u-boot-spl] Error 1
    make: *** [Makefile:1762: spl/u-boot-spl] Error 2

To minimize the impact on code size, the function is built only when
logging is enabled, as it appears to be unneeded otherwise.

Note we could probably shave off a few bytes by having the existing
sprintf() and snprintf() functions call vsnprintf() when it's
available. I haven't made this change only because it isn't how the
existing code is written (printf() could call vprintf(), and
snprintf() could call sprintf(), yet neither do) and I assume this is
for a reason.

Simon South (2):
  common: Kconfig: Fix typo in TPL_LOG_CONSOLE description
  tiny-printf: Support vsnprintf()

 common/Kconfig    |  2 +-
 lib/tiny-printf.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)


More information about the U-Boot mailing list