@@ -2576,6 +2576,9 @@ FIT uImage format:
CONFIG_SPL_LIBCOMMON_SUPPORT
Support for common/libcommon.o in SPL binary
+ CONFIG_SPL_PRINTF_SUPPORT
+ Enable printf() support in common/libcommon.o
+
CONFIG_SPL_LIBDISK_SUPPORT
Support for disk/libdisk.o in SPL binary
@@ -805,9 +805,20 @@ int tstc(void);
/* stdout */
void putc(const char c);
void puts(const char *s);
+/*
+ * The printf() implementation needs 4~5KB of storage space which may not be
+ * available when building an SPL for SoCs with scarce internal RAM
+ * (8KB or less). To force printf() inclusion on an SPL we must define
+ * CONFIG_SPL_LIBCOMMON_SUPPORT and CONFIG_SPL_PRINTF_SUPPORT.
+ */
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_PRINTF_SUPPORT)
int printf(const char *fmt, ...)
__attribute__ ((format (__printf__, 1, 2)));
int vprintf(const char *fmt, va_list args);
+#else
+#define printf(fmt...) do {} while (0)
+#define vprintf(fmt, args) do {} while (0)
+#endif
/* stderr */
#define eputc(c) fputc(stderr, c)
The printf() implementation needs 4~5KB of storage space which may not be available when building an SPL for SoCs with scarce internal RAM (8KB or less). This patch adds a new option, CONFIG_SPL_PRINTF_SUPPORT, to deal with this. Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt> --- Changes for v3: - New patch Changes for v4: - None Changes for v5: - None --- README | 3 +++ include/common.h | 11 +++++++++++ 2 files changed, 14 insertions(+)