diff options
author | Stefan Roese <sr@denx.de> | 2015-11-23 07:00:22 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-11-23 10:56:07 -0500 |
commit | 7d9cde1031040a4931d6e12da7d9767b7e1d85d4 (patch) | |
tree | 902ccb2b9d0212a5f1b4a98eee1dd4b7b4f34d98 /lib/Kconfig | |
parent | ddf7355a73f2e01bd8eec4b939d8749ac22ff574 (diff) |
lib/tiny-printf.c: Add tiny printf function for space limited environments
This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.
To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.
This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.
The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:
Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl
With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl
Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Diffstat (limited to 'lib/Kconfig')
-rw-r--r-- | lib/Kconfig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 30e84ed315..9d580e4115 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -36,6 +36,16 @@ config SYS_VSNPRINTF Thumb-2, about 420 bytes). Enable this option for safety when using sprintf() with data you do not control. +config USE_TINY_PRINTF + bool "Enable tiny printf() version" + help + This option enables a tiny, stripped down printf version. + This should only be used in space limited environments, + like SPL versions with hard memory limits. This version + reduces the code size by about 2.5KiB on armv7. + + The supported format specifiers are %c, %s, %u/%d and %x. + config REGEX bool "Enable regular expression support" default y if NET |