From: Marek Vasut Date: Fri, 1 Mar 2019 11:30:26 +0100 Subject: [U-Boot] [PATCH] spl: add debug print for early malloc usage In-Reply-To: <20190226212752.1373-1-simon.k.r.goldschmidt@gmail.com> References: <20190226212752.1373-1-simon.k.r.goldschmidt@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2/26/19 10:27 PM, Simon Goldschmidt wrote: > 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 > --- > > common/spl/spl.c | 2 ++ > 1 file changed, 2 insertions(+) > > 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); Shouldn't this use %p ? > ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN; > gd->malloc_base = ptr; > gd->malloc_limit = CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN; > -- Best regards, Marek Vasut