From owner-freebsd-arm@FreeBSD.ORG Wed May 7 02:09:27 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A3DB9D9 for ; Wed, 7 May 2014 02:09:27 +0000 (UTC) Received: from mail-pa0-x22a.google.com (mail-pa0-x22a.google.com [IPv6:2607:f8b0:400e:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F083F48 for ; Wed, 7 May 2014 02:09:27 +0000 (UTC) Received: by mail-pa0-f42.google.com with SMTP id rd3so378784pab.29 for ; Tue, 06 May 2014 19:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=7ZtAeYv0NqbE+oUCeGIn7EjQvfOfEEkf9RqqgK+fDmI=; b=v7S4odHq8feHv2L+y4CY9RSZ04SZWAjyyOULEcQBZftFAV6sYc6LkVmDIdN6whLidT sd9mh4F93fk0ETNojsdEhJjXaWE0frvkpK0NEdOxwryF04NT5mtfXysx06hDe7lpcrPO I1x7GsgtXrm5df1YWXRmzkhHt2BXMSY6VN14RApw0vzw8efYbW6WdevMutCjv2DmQ4DK 3a6BcwxNBMo7BeB0CR90/gi1DeKQAMNKulyBRwq7dgwcXoXcxF+gQXm2j6BgqBRZ/NQU zZXbn64ykbOFOVReHMCTWLV5PBCxYo4dHHPzRMKATH2GZwBXp9Ua/VWU2q/g/f3vyWln rWQw== X-Received: by 10.66.249.233 with SMTP id yx9mr13112786pac.3.1399428566624; Tue, 06 May 2014 19:09:26 -0700 (PDT) Received: from [216.131.71.123] ([216.131.71.123]) by mx.google.com with ESMTPSA id sh5sm169668pbc.21.2014.05.06.19.09.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 May 2014 19:09:25 -0700 (PDT) Message-ID: <536995CF.4060404@gmail.com> Date: Wed, 07 May 2014 10:09:19 +0800 From: Xuebing Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Jeroen Hofstee Subject: Re: [U-Boot] Latest u-boot release on BeagleBone Black for FreeBSD References: <5343B8B9.6040607@gmail.com> <1399203211.1994.25.camel@yellow> In-Reply-To: <1399203211.1994.25.camel@yellow> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: trini@ti.com, u-boot@lists.denx.de, vanbaren@cideas.com, freebsd-arm@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 May 2014 02:09:27 -0000 On 05/04/2014 07:33 PM, Jeroen Hofstee wrote: > Hello Xuebing, (freebsd-arm added on cc), > > On di, 2014-04-08 at 16:52 +0800, Xuebing Wang wrote: >> Hi u-boot community, >> >> I am trying to port u-boot (release u-boot-2014.04-rc3.tar.bz2) to >> FreeBSD on BeagleBone Black. >> >> In FreeBSD, there is a u-boot loader (named ubldr), which can call >> u-boot API to get fdt (Flat Device Tree) data. >> >> I have to comment out below 3 lines, in order to get correct fdt data in >> FreeBSD ubldr from u-boot. Would you please advice what is the best way >> to fix this? >> >> In file common/env_common.c: >> const uchar *env_get_addr(int index) >> { >> // if (gd->env_valid) >> // return (uchar *)(gd->env_addr + index); >> // else >> return &default_environment[index]; >> } >> > Assuming that you checked that your environment is valid you might be > facing the fact that the gd pointer is corrupted. gd is a pointer to the > "global data" and used for storing globals which are available before > and after relocation. On (32bit) ARM this value used to be stored in > register r8 but moved to r9 (llvm cannot reserve an arbitrary register, > but can reserve r9 for platform specific usage). If ubldr uses r9 you > end up with a invalid gd pointer when calling back into u-boot. ubldr > now reserves r8 and r9 so a recent version should work fine on an older > U-boot as well as current master. > > Can you check the latest ubldr? Hi Jeroen, Thanks for your response. 1) Today, I tested ubldr in the snapshot build FreeBSD-11.0-CURRENT-arm-armv6-BEAGLEBONE-20140428-r265054.img.bz2 without commenting out those 3 lines, I still can not get "fdt ls" in ubldr command line. After commenting out those 3 lines and rebuild u-boot, I can get "fdt ls" in ubldr command line. Note: All my previous test was based on FreeBSD-11.0-CURRENT-arm-armv6-BEAGLEBONE-20140323-r263665.img.bz2 2) Would you please point to me which revision that reserves both r8 and r9? Thanks. > Regards, > Jeroen > > > -- Thanks, Xuebing Wang