From d02d0c968169bbc32677822cdcf5748c26b22535 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 23 Jul 2014 13:45:20 +1000 Subject: [PATCH 1/4] Remove -march=armv6 if -mcpu is already specified in compiler options --- it breaks older gcc --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fa9f54866..ebf801ba1 100644 --- a/Makefile +++ b/Makefile @@ -339,7 +339,7 @@ DEFINES += -DFASTPATH endif ifeq (${ARCH}, arm) -CFLAGS += -mtune=${CPU} -marm -march=${ARMV} +CFLAGS += -mtune=${CPU} -marm ASFLAGS += -mcpu=${CPU} DEFINES += -D$(shell echo ${ARMV}|tr [:lower:] [:upper:]|tr - _) ifeq (${CPU},cortex-a8) From ac1270684d71ac377a08ee63c9ad728af8eff6c6 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Thu, 24 Jul 2014 15:04:25 +1000 Subject: [PATCH 2/4] Fix Beagle builds For the toolchain we have, armv6 is incompatible with cpu=arm1136jf-2, but with cpu-cortex-a?, arch=armv7-a is required. --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index ebf801ba1..31f3219bf 100644 --- a/Makefile +++ b/Makefile @@ -344,9 +344,11 @@ ASFLAGS += -mcpu=${CPU} DEFINES += -D$(shell echo ${ARMV}|tr [:lower:] [:upper:]|tr - _) ifeq (${CPU},cortex-a8) DEFINES += -DARM_CORTEX_A8 +CFLAGS += -march=${ARCH} else ifeq (${CPU},cortex-a9) DEFINES += -DARM_CORTEX_A9 +CFLAGS += -march=${ARCH} endif endif endif From 649d123da5ab1a2aaf920ab441b602eae0a45d4c Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Fri, 25 Jul 2014 09:51:04 +1000 Subject: [PATCH 3/4] Fix compilation errors on Cortex-A8 Different version of GCC need diffferent combinations of -mcpu -mtune= and -march to build properly for KZM (armv6) and cortex-a8 Make CFLAGS and ASFLAGS consistent, and rely on GCC knowing which arch is which wwhen told what CPU to build for. --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 31f3219bf..2584ca994 100644 --- a/Makefile +++ b/Makefile @@ -339,16 +339,14 @@ DEFINES += -DFASTPATH endif ifeq (${ARCH}, arm) -CFLAGS += -mtune=${CPU} -marm +CFLAGS += -mtune=${CPU} -marm -mcpu=${CPU} ASFLAGS += -mcpu=${CPU} DEFINES += -D$(shell echo ${ARMV}|tr [:lower:] [:upper:]|tr - _) ifeq (${CPU},cortex-a8) DEFINES += -DARM_CORTEX_A8 -CFLAGS += -march=${ARCH} else ifeq (${CPU},cortex-a9) DEFINES += -DARM_CORTEX_A9 -CFLAGS += -march=${ARCH} endif endif endif From eb774331e4e448f1633a051670c45bf4b14a1ba3 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Fri, 25 Jul 2014 12:40:43 +1000 Subject: [PATCH 4/4] More compiler fixes The in-kernel-directory Makefile was trying to reset CFLAGS, and sometimes sets them to conflict with the ones set by the Kbuild system. Only set CFLAGS and ASFLAGS for standalone builds. (standalone builds are only really supported for KZM anyway). --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2584ca994..0d9de5aa8 100644 --- a/Makefile +++ b/Makefile @@ -338,9 +338,12 @@ ifdef FASTPATH DEFINES += -DFASTPATH endif +# Only set CFLAGS if we're building standalone. +# common/Makefile.Flags sets NK_CFLAGS in Kbuild environments. +ifndef NK_CFLAGS ifeq (${ARCH}, arm) -CFLAGS += -mtune=${CPU} -marm -mcpu=${CPU} -ASFLAGS += -mcpu=${CPU} +CFLAGS += -mtune=${CPU} -marm -march=${ARMV} +ASFLAGS += -mcpu=${CPU} -march=${ARMV} DEFINES += -D$(shell echo ${ARMV}|tr [:lower:] [:upper:]|tr - _) ifeq (${CPU},cortex-a8) DEFINES += -DARM_CORTEX_A8 @@ -355,6 +358,7 @@ ifeq (${ARCH}, ia32) CFLAGS += -m32 -mno-mmx -mno-sse ASFLAGS += --32 endif +endif ifeq (${CPU}, arm1136jf-s) DEFINES += -DARM1136_WORKAROUND