From patchwork Wed Nov 11 21:00:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 543100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id AF7DE141301 for ; Thu, 12 Nov 2015 08:00:51 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=X2qEAkIg; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 656BD4B72A; Wed, 11 Nov 2015 22:00:49 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dzbSCmoxApmk; Wed, 11 Nov 2015 22:00:49 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DBDAC4B721; Wed, 11 Nov 2015 22:00:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DFFB74B721 for ; Wed, 11 Nov 2015 22:00:46 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jh_sSJEsQNGE for ; Wed, 11 Nov 2015 22:00:46 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) by theia.denx.de (Postfix) with ESMTPS id 73ADE4B71E for ; Wed, 11 Nov 2015 22:00:42 +0100 (CET) Received: by iofh3 with SMTP id h3so45864081iof.3 for ; Wed, 11 Nov 2015 13:00:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=mPJGMFNcxMIS/Rw+c93D07K3kW8rzLqFKp78f57IrT0=; b=X2qEAkIgzrnARekoGZqXudF3rwq0mBgfw+iuYffrqel6TMqG/8aFCwmufGVVSyzA/U AWWyp6IqrAXE+6GV0JCcpd1V7BzNnDDAoLptEnq9nEQk7si6o5i8Z/x+GdJ+MprmtB/y BBiRinf9mTDoOoHsedMjsJJaV+FUJvVmi0lUlTO5DZ7B3jyCZiouFz3nYErogg9f2nLj rAVoVoGaZ26aKDLnsIZoTFxfL7dBVgGY3xzKzOkJSgUSeSGNVaVyqVqXZd6MP3LDudub ejq3enXvVEi5jzZvxrUMZydIrpwEHy9nE5jXw++Ik/jWVzg+krHSxVrWWqRNHoiBw5Yq J5tw== MIME-Version: 1.0 X-Received: by 10.107.3.227 with SMTP id e96mr11215505ioi.30.1447275641535; Wed, 11 Nov 2015 13:00:41 -0800 (PST) Received: by 10.79.1.76 with HTTP; Wed, 11 Nov 2015 13:00:41 -0800 (PST) In-Reply-To: References: <1447273397-22833-1-git-send-email-festevam@gmail.com> Date: Wed, 11 Nov 2015 19:00:41 -0200 Message-ID: From: Fabio Estevam To: Simon Glass Cc: U-Boot Mailing List , Fabio Estevam , Tom Rini Subject: Re: [U-Boot] [PATCH] ARM: crt0: Pass malloc base address X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Hi Simon and Albert, On Wed, Nov 11, 2015 at 6:41 PM, Fabio Estevam wrote: > Hi Simon, > > On Wed, Nov 11, 2015 at 6:26 PM, Simon Glass wrote: > >> Thanks for digging into this. But this should be set up in board_init_f_mem(): >> >> #if defined(CONFIG_SYS_MALLOC_F) && \ >> (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START)) >> top -= CONFIG_SYS_MALLOC_F_LEN; >> gd->malloc_base = top; >> #endif >> >> Is it possible that the #ifdef logic is wrong for your board? > > Good point. Looks like this is the problem indeed. > > I have manually removed the #ifdef logic just for testing: > > --- a/common/init/board_init.c > +++ b/common/init/board_init.c > @@ -50,11 +50,8 @@ ulong board_init_f_mem(ulong top) > #endif > arch_setup_gd(gd_ptr); > > -#if defined(CONFIG_SYS_MALLOC_F) && \ > - (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START)) > top -= CONFIG_SYS_MALLOC_F_LEN; > gd->malloc_base = top; > -#endif > > return top; > } > > ,and then malloc() works fine in SPL. If I change the logic like this then malloc() works: Shouldn't we test for defined(CONFIG_SPL_BUILD) instead of !defined(CONFIG_SPL_BUILD)? Thanks --- a/common/init/board_init.c +++ b/common/init/board_init.c @@ -51,7 +51,7 @@ ulong board_init_f_mem(ulong top) arch_setup_gd(gd_ptr); #if defined(CONFIG_SYS_MALLOC_F) && \ - (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START)) + (defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START)) top -= CONFIG_SYS_MALLOC_F_LEN; gd->malloc_base = top; #endif