From: Tom Rini <tr...@konsulko.com> Sent: Wednesday, May 7, 2025 7:43 PM > On Wed, Apr 30, 2025 at 12:35:48PM +0200, Christoph Niedermaier wrote: > >> The formatting with %pa / %pap behaves like %x, which results in an >> incorrect value being output. To improve this, a new fine-tuning >> Kconfig SPL_USE_TINY_PRINTF_POINTER_SUPPORT for pointer formatting >> has been added. If it is enabled, the output of %pa / %pap should >> be correct, and if it is disabled, the pointer formatting is >> completely unsupported. In addition to indicate unsupported formatting, >> '?' will be output. This allows enabling pointer formatting only >> when needed. For SPL_NET and NET_LWIP it is selected by default. >> Then it also supports the formatting with %pm, %pM and %pI4. >> >> In summery this level of %p support for tiny printf is possible now: >> >> 1) The standard tiny printf won't have support for pointer formatting. >> So it doesn't print misleading values for %pa, instead '?' will be >> output: >> %p => ? >> %pa => ?a >> %pap => ?ap >> >> 2) If SPL_USE_TINY_PRINTF_POINTER_SUPPORT is enabled or DEBUG is defined >> tiny printf supports formatting %p and %pa / %pap. >> >> 3) If SPL_NET or NET_LWIP is enabled the support of pointers is extended >> for %pm, %pM and %pI4. >> >> Signed-off-by: Christoph Niedermaier <cniederma...@dh-electronics.com> >> --- >> Cc: Tom Rini <tr...@konsulko.com> >> Cc: Simon Glass <s...@chromium.org> >> Cc: Michael Walle <mwa...@kernel.org> >> Cc: Quentin Schulz <quentin.sch...@cherry.de> >> Cc: Marek Vasut <ma...@denx.de> >> Cc: Benedikt Spranger <b.spran...@linutronix.de> >> Cc: Jerome Forissier <jerome.foriss...@linaro.org> >> Cc: John Ogness <john.ogn...@linutronix.de> >> Cc: Ilias Apalodimas <ilias.apalodi...@linaro.org> >> --- >> V2: - Rebase on current master >> - Extend commit message >> - Restrict use to SPL >> - Rename Kconfig to SPL_USE_TINY_PRINTF_POINTER_SUPPORT >> - Replace _DEBUG with defined(DEBUG) >> - Output '?' if %pm, %pM and %pI4 isn't available >> - Add break on case '%' >> V3: - Add missing output '?' for the default case >> --- >> Kconfig | 1 + >> common/spl/Kconfig | 1 + >> lib/Kconfig | 8 +++++++ >> lib/tiny-printf.c | 52 +++++++++++++++++++++++----------------------- >> 4 files changed, 36 insertions(+), 26 deletions(-) >> >> diff --git a/Kconfig b/Kconfig >> index 51358633762..b8eec3fc931 100644 >> --- a/Kconfig >> +++ b/Kconfig >> @@ -774,6 +774,7 @@ config NET >> >> config NET_LWIP >> bool "Use lwIP for networking stack" >> + select SPL_USE_TINY_PRINTF_POINTER_SUPPORT if SPL_USE_TINY_PRINTF >> imply NETDEVICES >> help >> Include networking support based on the lwIP (lightweight IP) > > Sorry I missed this bug until now. This (and the subsequent parts of the > patch referencing lwIP) aren't right. There's no SPL_NET_LWIP support > (and not planned at this point), so what this does is grow platforms > like xilinx_zynq_virt which use lwIP in U-Boot and tiny printf in SPL, > but shouldn't since there's no SPL_NET_LWIP.
I didn't know that, I took it from the tiny printf pointer handling code. I will remove all lwIP references in version 4. Thanks and regards Christoph