From 4ef026c30483a724bd577bf739e1da2474bc1001 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Sun, 11 Oct 2015 11:43:35 -0700 Subject: arm: Disable unaligned accesses From reading ARM architecture related documentation if appears that while unaligned memory access is supported by the processor in general it is not supported if MMU is disabled. The problem in question can be easily reproduced by building the code without this patch, MMU disabled, and trying to run 'memtest' command. Which would in turn call mem_test() which would eventually call show_progress(). That last function, if build without -mno-unaligned-access would result in unaligned memory access which would result in Barebox hanging. This patch instructs the compiler to not generate any unaligned accesses to memory thus avoiding the problem. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- arch/arm/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/arm/Makefile') diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 721aa9bd9d..cae05ff52b 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -13,6 +13,13 @@ AS += -EL LD += -EL endif +# Unaligned access is not supported when MMU is disabled, so given how +# at least some of the code would be executed with MMU off, lets be +# conservative and instruct the compiler not to generate any unaligned +# accesses +CFLAGS += -mno-unaligned-access + + # This selects which instruction set is used. # Note that GCC does not numerically define an architecture version # macro, but instead defines a whole series of macros which makes -- cgit v1.2.3