spl: Allow tiny printf() to be controlled in SPL and TPL
authorSimon Glass <sjg@chromium.org>
Wed, 25 Sep 2019 14:56:27 +0000 (08:56 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Tue, 8 Oct 2019 05:57:45 +0000 (13:57 +0800)
At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
18 files changed:
arch/arm/Kconfig
arch/arm/mach-omap2/Kconfig
arch/arm/mach-rmobile/Kconfig
arch/arm/mach-rmobile/Kconfig.32
arch/arm/mach-socfpga/Kconfig
common/spl/Kconfig
common/xyzModem.c
configs/am335x_pdu001_defconfig
configs/ls1043ardb_nand_SECURE_BOOT_defconfig
configs/ls1043ardb_nand_defconfig
configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
configs/ls1043ardb_sdcard_defconfig
configs/sandbox_spl_defconfig
drivers/gpio/gpio-uclass.c
drivers/mmc/mmc.c
drivers/mtd/spi/sf-uclass.c
lib/Kconfig
lib/Makefile

index 3b0e315061aafcaee60309bcf00443c7d5006596..7086db368fb6e7a6e553950b853fe5bba13080b1 100644 (file)
@@ -954,7 +954,7 @@ config ARCH_SUNXI
        select USB if DISTRO_DEFAULTS
        select USB_KEYBOARD if DISTRO_DEFAULTS
        select USB_STORAGE if DISTRO_DEFAULTS
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply CMD_DM
        imply CMD_GPT
        imply CMD_UBI if NAND
index ed8056e87186777eaac8fbc91831bb62838aabc2..4c87cbc00f743e4c13e1b6f792054796442874e0 100644 (file)
@@ -11,7 +11,7 @@ config OMAP34XX
        select ARM_ERRATA_454179
        select ARM_ERRATA_621766
        select ARM_ERRATA_725233
-       select USE_TINY_PRINTF if SPL
+       select SPL_USE_TINY_PRINTF if SPL
        imply NAND_OMAP_GPMC
        imply SPL_FS_EXT4
        imply SPL_FS_FAT
@@ -31,7 +31,7 @@ config OMAP34XX
 
 config OMAP44XX
        bool "OMAP44XX SoC"
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply NAND_OMAP_ELM
        imply NAND_OMAP_GPMC
        imply SPL_DISPLAY_PRINT
@@ -124,7 +124,7 @@ config AM33XX
        imply SPL_NAND_SUPPORT
        imply SYS_I2C_OMAP24XX
        imply SYS_THUMB_BUILD
-       imply USE_TINY_PRINTF
+       imply SPL_USE_TINY_PRINTF
        help
          Support for AM335x SOC from Texas Instruments.
          The AM335x high performance SOC features a Cortex-A8
index 52ab89142578fbb819a912398516ea98d1a5ec6d..8343000c8faae5055419af0f94d64e38546612c1 100644 (file)
@@ -32,7 +32,7 @@ config RCAR_GEN3
        imply SPL_SYS_MALLOC_SIMPLE
        imply SPL_TINY_MEMSET
        imply SPL_YMODEM_SUPPORT
-       imply USE_TINY_PRINTF
+       imply SPL_USE_TINY_PRINTF
 
 config RZA1
        prompt "Renesas ARM SoCs RZ/A1 (32bit)"
index 1441c8069207bb066ef1d3910ea1e0075ce92e7b..d5e437f0d2e2b4e67df9f6f9282c29a5b75d1ce8 100644 (file)
@@ -65,7 +65,7 @@ config TARGET_GOSE
        select DM_SERIAL
        select SPL_TINY_MEMSET
        select SUPPORT_SPL
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply CMD_DM
 
 config TARGET_KOELSCH
@@ -74,7 +74,7 @@ config TARGET_KOELSCH
        select DM_SERIAL
        select SPL_TINY_MEMSET
        select SUPPORT_SPL
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply CMD_DM
 
 config TARGET_LAGER
@@ -83,7 +83,7 @@ config TARGET_LAGER
        select DM_SERIAL
        select SPL_TINY_MEMSET
        select SUPPORT_SPL
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply CMD_DM
 
 config TARGET_KZM9G
@@ -95,7 +95,7 @@ config TARGET_ALT
        select DM_SERIAL
        select SPL_TINY_MEMSET
        select SUPPORT_SPL
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply CMD_DM
 
 config TARGET_SILK
@@ -104,7 +104,7 @@ config TARGET_SILK
        select DM_SERIAL
        select SPL_TINY_MEMSET
        select SUPPORT_SPL
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply CMD_DM
 
 config TARGET_PORTER
@@ -113,7 +113,7 @@ config TARGET_PORTER
        select DM_SERIAL
        select SPL_TINY_MEMSET
        select SUPPORT_SPL
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply CMD_DM
 
 config TARGET_STOUT
@@ -122,7 +122,7 @@ config TARGET_STOUT
        select DM_SERIAL
        select SPL_TINY_MEMSET
        select SUPPORT_SPL
-       select USE_TINY_PRINTF
+       select SPL_USE_TINY_PRINTF
        imply CMD_DM
 
 endchoice
index 1d914648e314fbfde805c3947c2a1d927b3fb486..ee79953fcc2e197da667196a39e340995532ca84 100644 (file)
@@ -45,7 +45,7 @@ config TARGET_SOCFPGA_ARRIA10
        select SPL_SYSCON if SPL
        select ETH_DESIGNWARE_SOCFPGA
        imply FPGA_SOCFPGA
-       imply USE_TINY_PRINTF
+       imply SPL_USE_TINY_PRINTF
 
 config TARGET_SOCFPGA_CYCLONE5
        bool
@@ -59,7 +59,7 @@ config TARGET_SOCFPGA_GEN5
        imply SPL_SIZE_LIMIT_SUBTRACT_MALLOC
        imply SPL_STACK_R
        imply SPL_SYS_MALLOC_SIMPLE
-       imply USE_TINY_PRINTF
+       imply SPL_USE_TINY_PRINTF
 
 config TARGET_SOCFPGA_STRATIX10
        bool
index 62b93c112b1f4e010622bdcc59ffd2b5feb7965c..048b85ba7a2d8446cab3dc6289355a048e83f3d6 100644 (file)
@@ -963,7 +963,7 @@ config SPL_SERIAL_SUPPORT
          for displaying messages while SPL is running. It also brings in
          printf() and panic() functions. This should normally be enabled
          unless there are space reasons not to. Even then, consider
-         enabling USE_TINY_PRINTF which is a small printf() version.
+         enabling SPL_USE_TINY_PRINTF which is a small printf() version.
 
 config SPL_SPI_FLASH_SUPPORT
        bool "Support SPI flash drivers"
index e85da74a698f373c837987228f2a99b4a318a136..6bf2375671d2825668457472e29c9e81a12fef28 100644 (file)
@@ -173,7 +173,7 @@ parse_num (char *s, unsigned long *val, char **es, char *delim)
 }
 
 
-#if defined(DEBUG) && !defined(CONFIG_USE_TINY_PRINTF)
+#if defined(DEBUG) && !CONFIG_IS_ENABLED(USE_TINY_PRINTF)
 /*
  * Note: this debug setup works by storing the strings in a fixed buffer
  */
index e69f81b6e549f84b53fbde0f0a4777c87143b50f..1a1d58d3cc8aee1f334345445f08823e1511b00f 100644 (file)
@@ -51,5 +51,5 @@ CONFIG_SPL_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_TPS65910=y
 CONFIG_CONS_INDEX=4
-# CONFIG_USE_TINY_PRINTF is not set
+# CONFIG_SPL_USE_TINY_PRINTF is not set
 # CONFIG_EFI_LOADER is not set
index 7aa8c54a128b2c4eed02e03c026dfebf3673b00b..c45fc68ac3f7198499e78672e32c97b8ccbd048a 100644 (file)
@@ -67,7 +67,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
-# CONFIG_USE_TINY_PRINTF is not set
+# CONFIG_SPL_USE_TINY_PRINTF is not set
 CONFIG_RSA=y
 CONFIG_SPL_RSA=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
index 22ccf526f69640eaecc6799a7e713a9aea5a1385..a9e58047acc4d428f962a62ae25138ac52bc231c 100644 (file)
@@ -67,5 +67,5 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
-# CONFIG_USE_TINY_PRINTF is not set
+# CONFIG_SPL_USE_TINY_PRINTF is not set
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
index 486a2e089b775e73c1ef317d9fc1324d6ea03de7..bdfa13a0a71a7512bfd3473204b4ad2c84422897 100644 (file)
@@ -65,7 +65,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
-# CONFIG_USE_TINY_PRINTF is not set
+# CONFIG_SPL_USE_TINY_PRINTF is not set
 CONFIG_RSA=y
 CONFIG_SPL_RSA=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
index b3c2970207c8cfda6fc06e4b73d50ff3cfb167f7..01adbf0b192fd48cd134aeb288ab3cfe8c517a75 100644 (file)
@@ -65,5 +65,5 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
-# CONFIG_USE_TINY_PRINTF is not set
+# CONFIG_SPL_USE_TINY_PRINTF is not set
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
index 0b3391a2a6b7caa29ae862bb340ff014493e87ee..409b8a38d5e0c0205272a67855ce539c94ee3075 100644 (file)
@@ -191,7 +191,7 @@ CONFIG_OSD=y
 CONFIG_SANDBOX_OSD=y
 CONFIG_FS_CBFS=y
 CONFIG_FS_CRAMFS=y
-# CONFIG_USE_TINY_PRINTF is not set
+# CONFIG_SPL_USE_TINY_PRINTF is not set
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_TPM=y
 CONFIG_LZ4=y
index 01cfa2f7884884d0a6c61674da5992f2e7a04555..90fbed455b8da8269f49a3062032e199dab2beb7 100644 (file)
@@ -294,7 +294,7 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label)
 
 static int dm_gpio_requestf(struct gpio_desc *desc, const char *fmt, ...)
 {
-#if !defined(CONFIG_SPL_BUILD) || !defined(CONFIG_USE_TINY_PRINTF)
+#if !defined(CONFIG_SPL_BUILD) || !CONFIG_IS_ENABLED(USE_TINY_PRINTF)
        va_list args;
        char buf[40];
 
@@ -343,7 +343,7 @@ int gpio_request(unsigned gpio, const char *label)
  */
 int gpio_requestf(unsigned gpio, const char *fmt, ...)
 {
-#if !defined(CONFIG_SPL_BUILD) || !defined(CONFIG_USE_TINY_PRINTF)
+#if !defined(CONFIG_SPL_BUILD) || !CONFIG_IS_ENABLED(USE_TINY_PRINTF)
        va_list args;
        char buf[40];
 
index c8f71cd0c1b6e34883aa77d6ba54e7f41500ffcf..6bece7f3073a51fd75c9c996d5d0680dfc3f40cc 100644 (file)
@@ -2577,7 +2577,7 @@ static int mmc_startup(struct mmc *mmc)
        bdesc->lba = lldiv(mmc->capacity, mmc->read_bl_len);
 #if !defined(CONFIG_SPL_BUILD) || \
                (defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && \
-               !defined(CONFIG_USE_TINY_PRINTF))
+               !CONFIG_IS_ENABLED(USE_TINY_PRINTF))
        sprintf(bdesc->vendor, "Man %06x Snr %04x%04x",
                mmc->cid[0] >> 24, (mmc->cid[2] & 0xffff),
                (mmc->cid[3] >> 16) & 0xffff);
index 719a2fd23ae29fb83d080a9b59faec0ee426ab9c..c6107522be033eb8c0a0ed3dd94f093e2cf04bf6 100644 (file)
@@ -66,7 +66,7 @@ int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
        char *str;
        int ret;
 
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_TINY_PRINTF)
+#if defined(CONFIG_SPL_BUILD) && CONFIG_IS_ENABLED(USE_TINY_PRINTF)
        str = "spi_flash";
 #else
        char name[30];
index 3da45a5ec3221f8ea80091e06d21a9723b45cf02..135f0b372b074270beab7450a542edeeef94124f 100644 (file)
@@ -40,12 +40,12 @@ config PRINTF
 config SPL_PRINTF
        bool
        select SPL_SPRINTF
-       select SPL_STRTO if !USE_TINY_PRINTF
+       select SPL_STRTO if !SPL_USE_TINY_PRINTF
 
 config TPL_PRINTF
        bool
        select TPL_SPRINTF
-       select TPL_STRTO if !USE_TINY_PRINTF
+       select TPL_STRTO if !TPL_USE_TINY_PRINTF
 
 config SPRINTF
        bool
@@ -95,9 +95,9 @@ config SYS_HZ
          get_timer() must operate in milliseconds and this option must be
          set to 1000.
 
-config USE_TINY_PRINTF
+config SPL_USE_TINY_PRINTF
        bool "Enable tiny printf() version"
-       depends on SPL || TPL
+       depends on SPL
        default y
        help
          This option enables a tiny, stripped down printf version.
@@ -107,6 +107,18 @@ config USE_TINY_PRINTF
 
          The supported format specifiers are %c, %s, %u/%d and %x.
 
+config TPL_USE_TINY_PRINTF
+       bool "Enable tiny printf() version"
+       depends on TPL
+       default y if SPL_USE_TINY_PRINTF
+       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 PANIC_HANG
        bool "Do not reset the system on fatal error"
        help
index 2fffd68f943cb9e207bc4218e26cc98b5b039e96..d248d8626cea1ee2951c9380bd749b0754fe8418 100644 (file)
@@ -106,7 +106,7 @@ obj-y += panic.o
 
 ifeq ($(CONFIG_$(SPL_TPL_)BUILD),y)
 # SPL U-Boot may use full-printf, tiny-printf or none at all
-ifdef CONFIG_USE_TINY_PRINTF
+ifdef CONFIG_$(SPL_TPL_)USE_TINY_PRINTF
 obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += tiny-printf.o
 else
 obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += vsprintf.o strmhz.o