Skip to contentSkip to conversation

spl: don't use %#l with CONFIG_USE_TINY_PRINTF

PATCH New Oded Gabbay 4 participants 4 messages Dec 28, 2016 – Jan 19, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: don't use %#l with CONFIG_USE_TINY_PRINTF

In the tiny-printf implementation, there is no support for %# and/or %l. This patch checks if CONFIG_USE_TINY_PRINTF is defined and if so, prints a different debug statement which doesn't use %#l

---
 common/spl/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
common/spl/spl.c +5 -0
index f7df834..23dfa2d 100644
@@ -385,9 +385,14 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		debug("Unsupported OS image.. Jumping nevertheless..\n");
 	}
 #if defined(CONFIG_SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE)
+#ifdef CONFIG_USE_TINY_PRINTF
+	debug("SPL malloc() used 0x%x bytes (%d KB)\n",
+		(uint) gd->malloc_ptr, (uint) gd->malloc_ptr / 1024);
+#else
 	debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
 	      gd->malloc_ptr / 1024);
 #endif
+#endif
 
 	debug("loaded - jumping to U-Boot...");
 	spl_board_prepare_for_boot();
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 spl: don't use %#l with CONFIG_USE_TINY_PRINTF

Quoted 9 lines · Oded Gabbay

In the tiny-printf implementation, there is no support for %# and/or %l. This patch checks if CONFIG_USE_TINY_PRINTF is defined and if so, prints a different debug statement which doesn't use %#l

---
 common/spl/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
#2 lore raw

PATCH 1/1 spl: don't use %#l with CONFIG_USE_TINY_PRINTF

In reply to Oded Gabbay

2016-12-28 17:12 GMT+09:00 Oded Gabbay <[email protected]>:

Quoted 17 lines

In the tiny-printf implementation, there is no support for %# and/or %l. This patch checks if CONFIG_USE_TINY_PRINTF is defined and if so, prints a different debug statement which doesn't use %#l

---
 common/spl/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
common/spl/spl.c +0 -0
index f7df834..23dfa2d 100644
@@ -385,9 +385,14 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
                debug("Unsupported OS image.. Jumping nevertheless..\n");
        }

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 396

Quoted 10 lines
common/spl/spl.c +5 -0
 #if defined(CONFIG_SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE)
+#ifdef CONFIG_USE_TINY_PRINTF
+       debug("SPL malloc() used 0x%x bytes (%d KB)\n",
+               (uint) gd->malloc_ptr, (uint) gd->malloc_ptr / 1024);
+#else
        debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
              gd->malloc_ptr / 1024);
 #endif
+#endif
 

Please do not patch around with CONFIG_USE_TINY_PRINTF.

What you need to do is to fix tiny_printf() implementation.

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

PATCH 1/1 spl: don't use %#l with CONFIG_USE_TINY_PRINTF

Quoted 32 lines · Masahiro Yamada

2016-12-28 17:12 GMT+09:00 Oded Gabbay <[email protected]>:

Quoted 17 lines

In the tiny-printf implementation, there is no support for %# and/or %l. This patch checks if CONFIG_USE_TINY_PRINTF is defined and if so, prints a different debug statement which doesn't use %#l

---
 common/spl/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
common/spl/spl.c +0 -0
index f7df834..23dfa2d 100644
@@ -385,9 +385,14 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
                debug("Unsupported OS image.. Jumping nevertheless..\n");
        }

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 396

Quoted 10 lines
common/spl/spl.c +5 -0
 #if defined(CONFIG_SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE)
+#ifdef CONFIG_USE_TINY_PRINTF
+       debug("SPL malloc() used 0x%x bytes (%d KB)\n",
+               (uint) gd->malloc_ptr, (uint) gd->malloc_ptr / 1024);
+#else
        debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
              gd->malloc_ptr / 1024);
 #endif
+#endif
 

Please do not patch around with CONFIG_USE_TINY_PRINTF.

Quoted 1 line

What you need to do is to fix tiny_printf() implementation.

That was the first suggestion, but that adds to the tiny printf size. I would say we just re-write the code here to always print correctly for TINY_PRINTF (and further, in this specific case print bytes or KB, not both, and preferably just bytes).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170118/2f760bed/attachment.sig>