From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Date: Tue, 26 Feb 2019 21:27:52 +0000 (+0100)
Subject: spl: add debug print for early malloc usage
X-Git-Tag: v2025.01-rc5-pxa1908~3103^2
X-Git-Url: http://git.dujemihanovic.xyz/html/static/git-favicon.png?a=commitdiff_plain;h=438dcabb75d6b9b0e7f887befb753d1863f14deb;p=u-boot.git

spl: add debug print for early malloc usage

To find out how big the early malloc heap must be in SPL, add a debug
print statement that dumps its usage before switching to relocated heap
in spl_relocate_stack_gd() via CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 2e2af1b28e..88d4b8a9bf 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -728,6 +728,8 @@ ulong spl_relocate_stack_gd(void)
 
 #if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_VAL(SYS_MALLOC_F_LEN)
 	if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
+		debug("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n",
+		      gd->malloc_ptr, gd->malloc_ptr / 1024);
 		ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
 		gd->malloc_base = ptr;
 		gd->malloc_limit = CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;