Patchwork [U-Boot] tegra: override compiler flags for low level init code

login
register
mail settings
Submitter Allen Martin
Date May 14, 2012, 11:14 p.m.
Message ID <1337037279-18562-1-git-send-email-amartin@nvidia.com>
Download mbox | patch
Permalink /patch/159216/
State Accepted
Commit f3717ac5848ec389919596d5e518b528fb8bebdd
Headers show

Comments

Allen Martin - May 14, 2012, 11:14 p.m.
Override -march setting for tegra to -march=armv4t for files that are
necessary for low level init on tegra.

The recent change to use -march=armv7-a for armv7 caused a regression
on tegra because tegra starts boot on a arm7tdmi processor before
transferring control to the cortex-a9.  While still executing on the
arm7tdmi there are calls to getenv_ulong() and memset() that cause an
illegal instruction exception if compiled for armv7.

Signed-off-by: Allen Martin <amartin@nvidia.com>
---
 arch/arm/cpu/armv7/tegra2/config.mk |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Stephen Warren - May 14, 2012, 11:23 p.m.
On 05/14/2012 05:14 PM, Allen Martin wrote:
> Override -march setting for tegra to -march=armv4t for files that are
> necessary for low level init on tegra.
> 
> The recent change to use -march=armv7-a for armv7 caused a regression
> on tegra because tegra starts boot on a arm7tdmi processor before
> transferring control to the cortex-a9.  While still executing on the
> arm7tdmi there are calls to getenv_ulong() and memset() that cause an
> illegal instruction exception if compiled for armv7.
> 
> Signed-off-by: Allen Martin <amartin@nvidia.com>

Tested-by: Stephen Warren <swarren@wwwdotorg.org>

(This seems to be necessary to use gcc-4.6.1, but not gcc-4.5.3. The
Whistler patches I just sent were tested with this fix in place)
Allen Martin - June 4, 2012, 5:54 p.m.
On Mon, May 14, 2012 at 04:23:33PM -0700, Stephen Warren wrote:
> On 05/14/2012 05:14 PM, Allen Martin wrote:
> > Override -march setting for tegra to -march=armv4t for files that are
> > necessary for low level init on tegra.
> > 
> > The recent change to use -march=armv7-a for armv7 caused a regression
> > on tegra because tegra starts boot on a arm7tdmi processor before
> > transferring control to the cortex-a9.  While still executing on the
> > arm7tdmi there are calls to getenv_ulong() and memset() that cause an
> > illegal instruction exception if compiled for armv7.
> > 
> > Signed-off-by: Allen Martin <amartin@nvidia.com>
> 
> Tested-by: Stephen Warren <swarren@wwwdotorg.org>
> 
> (This seems to be necessary to use gcc-4.6.1, but not gcc-4.5.3. The
> Whistler patches I just sent were tested with this fix in place)

Hi Tom, could you pick this up in u-boot-tegra?  Without it tegra is
currently broken in both u-boot-tegra and u-boot gits depending on the
compiler you use. 

-Allen
Stephen Warren - June 4, 2012, 6 p.m.
On 06/04/2012 11:54 AM, Allen Martin wrote:
> On Mon, May 14, 2012 at 04:23:33PM -0700, Stephen Warren wrote:
>> On 05/14/2012 05:14 PM, Allen Martin wrote:
>>> Override -march setting for tegra to -march=armv4t for files that are
>>> necessary for low level init on tegra.
>>>
>>> The recent change to use -march=armv7-a for armv7 caused a regression
>>> on tegra because tegra starts boot on a arm7tdmi processor before
>>> transferring control to the cortex-a9.  While still executing on the
>>> arm7tdmi there are calls to getenv_ulong() and memset() that cause an
>>> illegal instruction exception if compiled for armv7.
>>>
>>> Signed-off-by: Allen Martin <amartin@nvidia.com>
>>
>> Tested-by: Stephen Warren <swarren@wwwdotorg.org>
>>
>> (This seems to be necessary to use gcc-4.6.1, but not gcc-4.5.3. The
>> Whistler patches I just sent were tested with this fix in place)
> 
> Hi Tom, could you pick this up in u-boot-tegra?  Without it tegra is
> currently broken in both u-boot-tegra and u-boot gits depending on the
> compiler you use. 

It's been there for a while, I believe, at least in u-boot-tegra/master.
Allen Martin - June 4, 2012, 6:06 p.m.
On Mon, Jun 04, 2012 at 11:00:35AM -0700, Stephen Warren wrote:
> On 06/04/2012 11:54 AM, Allen Martin wrote:
> > Hi Tom, could you pick this up in u-boot-tegra?  Without it tegra is
> > currently broken in both u-boot-tegra and u-boot gits depending on the
> > compiler you use. 
> 
> It's been there for a while, I believe, at least in u-boot-tegra/master.

Ah you're right sorry, my remote was stale.  What's the next merge
window to get this into u-boot/master?  I imagine other people must be
running into this too.

-Allen

Patch

diff --git a/arch/arm/cpu/armv7/tegra2/config.mk b/arch/arm/cpu/armv7/tegra2/config.mk
index fe9ef5b..4dd8cb8 100644
--- a/arch/arm/cpu/armv7/tegra2/config.mk
+++ b/arch/arm/cpu/armv7/tegra2/config.mk
@@ -24,10 +24,13 @@ 
 # MA 02111-1307 USA
 #
 
-# Tegra has an ARMv4T CPU which runs board_init_f(), so we must build this
-# file with compatible flags
+# Tegra has an ARMv4T CPU which runs board_init_f(), so we must build these
+# files with compatible flags
 ifdef CONFIG_TEGRA2
 CFLAGS_arch/arm/lib/board.o += -march=armv4t
+CFLAGS_arch/arm/lib/memset.o += -march=armv4t
+CFLAGS_lib/string.o += -march=armv4t
+CFLAGS_common/cmd_nvedit.o += -march=armv4t
 endif
 
 USE_PRIVATE_LIBGCC = yes