This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 02e671a4279 libs/libc/stdio: default to LIBC_PRINTF_MINIMAL on
DEFAULT_SMALL
02e671a4279 is described below
commit 02e671a4279174746d1d7f5d78615d8d7c27fdc4
Author: Swatantra Yadav <[email protected]>
AuthorDate: Wed Nov 25 16:08:10 2026 +0530
libs/libc/stdio: default to LIBC_PRINTF_MINIMAL on DEFAULT_SMALL
NuttX provides three printf profiles: Minimal, Default, and Full.
Currently, the profile choice unconditionally defaults to
LIBC_PRINTF_DEFAULT across all targets, preventing memory-constrained
systems (CONFIG_DEFAULT_SMALL=y) from benefiting from the Minimal
profile by default.
This change sets the default printf profile to LIBC_PRINTF_MINIMAL
when DEFAULT_SMALL is enabled. This reduces text size by omitting
unneeded conversions and features:
- On stm32f103-minimum:nsh (Cortex-M3): -440 B Flash
(53,255 B -> 52,815 B)
- On nucleo-f072rb:nsh (Cortex-M0): -332 B Flash
(46,792 B -> 46,460 B)
- On rv-virt:nsh (32-bit RISC-V): -3,324 B Flash
(231,490 B -> 228,166 B)
- On qemu-armv8a:nsh (arm64): -3,720 B Flash
(329,564 B -> 325,844 B)
Additionally, with LIBC_PRINTF_MINIMAL, CONFIG_STREAM_OUT_BUFFER_SIZE
defaults to 0, saving 64 bytes of stack frame on dprintf() and
vdprintf() calls and omitting lib_bufferedoutstream.c from compilation.
Standard targets (!DEFAULT_SMALL) continue to default to
LIBC_PRINTF_DEFAULT.
Related to #20414
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Swatantra Yadav <[email protected]>
---
Documentation/os/libs/libc/printf.rst | 5 +++--
libs/libc/stdio/Kconfig | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/os/libs/libc/printf.rst
b/Documentation/os/libs/libc/printf.rst
index 14713f91e3f..d0a97077418 100644
--- a/Documentation/os/libs/libc/printf.rst
+++ b/Documentation/os/libs/libc/printf.rst
@@ -285,8 +285,9 @@ Options and profiles
====================
Each feature is an option with its own prompt. A profile only sets the default
-of each option: select one in *Library Routines*, *printf profile*. You can
add
-or remove any feature in any profile.
+of each option: select one in *Library Routines*, *printf profile*. The
profile
+defaults to Minimal when ``DEFAULT_SMALL`` is enabled, and to Default
otherwise.
+You can add or remove any feature in any profile.
============================= ========== =========== ======
Option Minimal Default Full
diff --git a/libs/libc/stdio/Kconfig b/libs/libc/stdio/Kconfig
index d8419f88ac0..68fdbafd255 100644
--- a/libs/libc/stdio/Kconfig
+++ b/libs/libc/stdio/Kconfig
@@ -75,6 +75,7 @@ config NUNGET_CHARS
choice
prompt "printf profile"
+ default LIBC_PRINTF_MINIMAL if DEFAULT_SMALL
default LIBC_PRINTF_DEFAULT
---help---
A profile only sets the defaults of the printf feature options.