libs/libc/stdio: This commits makes the nano-printf the defualt logic for the printf family. The legacy printf is still available via CONFIG_LIBC_PRINT_LEGACY. This commit also modifies the nano-prinf configure: The PRINT_LEVEL is not long selectable. Instead, a not CONFIG_LIBC_PRINT_MINIMAL boolean setting was added and the PRINT_LEVEL is derived from a combination of CONFIG_LIBC_PRINT_MINIMAL, CONFIG_LIBC_FLOATINGPOINT, and CONFIG_LIBC_LONG_LONG.
This commit is contained in:
parent
bc5908d9fd
commit
76a2f6c2a2
@ -48,7 +48,17 @@ config NUNGET_CHARS
|
|||||||
int "Number unget() characters"
|
int "Number unget() characters"
|
||||||
default 2
|
default 2
|
||||||
---help---
|
---help---
|
||||||
Number of characters that can be buffered by ungetc() (Only if NFILE_STREAMS > 0)
|
Number of characters that can be buffered by ungetc() (Only if
|
||||||
|
NFILE_STREAMS > 0)
|
||||||
|
|
||||||
|
config LIBC_PRINT_LEGACY
|
||||||
|
bool "Enable legacy printf logic"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
By default, printf (and friends) are implemented using a port from
|
||||||
|
newlib-nano. That port can be signifcantly smaller, especially if
|
||||||
|
floating support is enabled. This option may is avaiable, however,
|
||||||
|
to revert to the legacy printf version is so desired.
|
||||||
|
|
||||||
config LIBC_FLOATINGPOINT
|
config LIBC_FLOATINGPOINT
|
||||||
bool "Enable floating point in printf"
|
bool "Enable floating point in printf"
|
||||||
@ -57,12 +67,6 @@ config LIBC_FLOATINGPOINT
|
|||||||
By default, floating point support in printf, sscanf, etc. is
|
By default, floating point support in printf, sscanf, etc. is
|
||||||
disabled. This option will enable floating point support.
|
disabled. This option will enable floating point support.
|
||||||
|
|
||||||
if CONFIG_NANO_PRINTF is enabled, tnen this option works a
|
|
||||||
little differently. You still have to select
|
|
||||||
CONFIG_NANO_PRINTLEVEL=3 to get floating point support. In
|
|
||||||
case, this option extends the range of acceptable
|
|
||||||
values that will permit selection of CONFIG_NANO_PRINTLEVEL=3.
|
|
||||||
|
|
||||||
config LIBC_LONG_LONG
|
config LIBC_LONG_LONG
|
||||||
bool "Enable long long support in printf"
|
bool "Enable long long support in printf"
|
||||||
default y if !DEFAULT_SMALL
|
default y if !DEFAULT_SMALL
|
||||||
@ -76,6 +80,20 @@ config LIBC_LONG_LONG
|
|||||||
libraries that will be drawn into the build if long long support
|
libraries that will be drawn into the build if long long support
|
||||||
is enabled.
|
is enabled.
|
||||||
|
|
||||||
|
config LIBC_PRINT_MINIMAL
|
||||||
|
bool "Minimal formatting support in printf"
|
||||||
|
default y if DEFAULT_SMALL
|
||||||
|
default n if !DEFAULT_SMALL
|
||||||
|
depends on !LIBC_FLOATINGPOINT && !LIBC_LONG_LONG && !LIBC_PRINT_LEGACY
|
||||||
|
---help---
|
||||||
|
Enables support for long long formats in printf, sscanf, etc. is
|
||||||
|
enabled. This is enabled by default but if you are trying to
|
||||||
|
reduce the FLASH footprint, then disabling this feature is one
|
||||||
|
option. The FLASH saves comes not from disabling the long long
|
||||||
|
formats, but rather from omitting the large long long arithmetic
|
||||||
|
libraries that will be drawn into the build if long long support
|
||||||
|
is enabled.
|
||||||
|
|
||||||
config LIBC_SCANSET
|
config LIBC_SCANSET
|
||||||
bool "Scanset support"
|
bool "Scanset support"
|
||||||
default n
|
default n
|
||||||
@ -114,29 +132,4 @@ config MEMCPY_VIK
|
|||||||
Select this option for improved performance at the expense of increased
|
Select this option for improved performance at the expense of increased
|
||||||
size. See licensing information in the top-level COPYING file.
|
size. See licensing information in the top-level COPYING file.
|
||||||
|
|
||||||
config NANO_PRINTF
|
|
||||||
bool "Use nano printf code"
|
|
||||||
default y if DEFAULT_SMALL
|
|
||||||
default n if !DEFAULT_SMALL
|
|
||||||
---help---
|
|
||||||
Replace printf code with version from newlib-nano. Can be
|
|
||||||
signifcantly smaller, especially if floating support is enabled.
|
|
||||||
However, it does not include 'long long' support.
|
|
||||||
|
|
||||||
config NANO_PRINTLEVEL
|
|
||||||
int "Nano printf support level"
|
|
||||||
default 2 if !LIBC_FLOATINGPOINT
|
|
||||||
default 3 if LIBC_FLOATINGPOINT
|
|
||||||
range 1 2 if !LIBC_FLOATINGPOINT && !LIBC_LONG_LONG
|
|
||||||
range 1 3 if LIBC_FLOATINGPOINT && !LIBC_LONG_LONG
|
|
||||||
range 2 2 if !LIBC_FLOATINGPOINT && LIBC_LONG_LONG
|
|
||||||
range 2 3 if LIBC_FLOATINGPOINT && LIBC_LONG_LONG
|
|
||||||
depends on NANO_PRINTF
|
|
||||||
---help---
|
|
||||||
Nano printf can be built into more than one support level. The
|
|
||||||
default is to offer the usual modifiers and integer formatting
|
|
||||||
support (level 2). Level 1 maintains a minimal version that just
|
|
||||||
offers integer formatting, but no modifier support whatsoever.
|
|
||||||
Level 3 is intented for floating point support.
|
|
||||||
|
|
||||||
endmenu #Standard C I/O
|
endmenu #Standard C I/O
|
||||||
|
@ -45,24 +45,20 @@ CSRCS += lib_zeroinstream.c lib_nullinstream.c lib_nulloutstream.c
|
|||||||
CSRCS += lib_sscanf.c lib_vsscanf.c lib_libvscanf.c lib_libnoflush.c
|
CSRCS += lib_sscanf.c lib_vsscanf.c lib_libvscanf.c lib_libnoflush.c
|
||||||
CSRCS += lib_libsnoflush.c
|
CSRCS += lib_libsnoflush.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_NANO_PRINTF),y)
|
ifeq ($(CONFIG_LIBC_PRINT_LEGACY),y)
|
||||||
|
|
||||||
CSRCS += nano_libvsprintf.c nano_ultoa_invert.c
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_NANO_PRINTLEVEL),3)
|
|
||||||
|
|
||||||
CSRCS += nano_dtoa_engine.c nano_dtoa_data.c
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
CSRCS += lib_libvsprintf.c
|
CSRCS += lib_libvsprintf.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_LIBC_FLOATINGPOINT),y)
|
ifeq ($(CONFIG_LIBC_FLOATINGPOINT),y)
|
||||||
CSRCS += lib_dtoa.c
|
CSRCS += lib_dtoa.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
CSRCS += nano_libvsprintf.c nano_ultoa_invert.c
|
||||||
|
ifeq ($(CONFIG_LIBC_FLOATINGPOINT),y)
|
||||||
|
CSRCS += nano_dtoa_engine.c nano_dtoa_data.c
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The remaining sources files depend upon C streams
|
# The remaining sources files depend upon C streams
|
||||||
|
@ -66,24 +66,15 @@
|
|||||||
* is to offer the usual modifiers and integer formatting support
|
* is to offer the usual modifiers and integer formatting support
|
||||||
* (level 2). Level 1 maintains a minimal version that just offers
|
* (level 2). Level 1 maintains a minimal version that just offers
|
||||||
* integer formatting, but no modifier support whatsoever. Level 3 is
|
* integer formatting, but no modifier support whatsoever. Level 3 is
|
||||||
* intented for floating point support.
|
* intended for floating point support.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NANO_PRINTLEVEL)
|
#if defined(CONFIG_LIBC_FLOATINGPOINT)
|
||||||
# define PRINTF_LEVEL CONFIG_NANO_PRINTLEVEL
|
|
||||||
#elif defined(CONFIG_LIBC_FLOATINGPOINT)
|
|
||||||
# define PRINTF_LEVEL PRINTF_FLT
|
# define PRINTF_LEVEL PRINTF_FLT
|
||||||
|
#elif defined(CONFIG_LIB_LONG_LONG) || !defined(CONFIG_LIBC_PRINT_MINIMAL)
|
||||||
|
# define PRINT_LEVEL PRINTF_STD
|
||||||
#else
|
#else
|
||||||
# define PRINTF_LEVEL PRINTF_STD
|
# define PRINT_LEVEL PRINTF_MIN
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PRINTF_LEVEL == PRINTF_MIN || PRINTF_LEVEL == PRINTF_STD || \
|
|
||||||
PRINTF_LEVEL == PRINTF_FLT
|
|
||||||
|
|
||||||
/* OK */
|
|
||||||
|
|
||||||
#else
|
|
||||||
# error "Not a known printf level."
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef putc
|
#ifdef putc
|
||||||
|
Loading…
Reference in New Issue
Block a user