[U-Boot-Users] [PATCH][ARM] Rationalize ARM compiler options

Peter Pearse peter.pearse at arm.com
Tue Feb 26 11:50:22 CET 2008


Patch revised in light of list comments.
This patch completely replaces BOTH:-
"
Rationalize ARM compiler options
Date: 2008-02-18 14:50:39 GMT
"
AND
"
Rationalize ARM compiler options
Date: 2008-02-13 15:55:00 GMT
"
---
Signed-off-by: Peter Pearse <peter.pearse at arm.com>
---
diff --git a/cpu/arm1136/config.mk b/cpu/arm1136/config.mk
old mode 100644
new mode 100755
index 6ab0dd3..6b8c815
--- a/cpu/arm1136/config.mk
+++ b/cpu/arm1136/config.mk
@@ -20,16 +20,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
-# Make ARMv5 to allow more compilers to work, even though its v6.
-PLATFORM_CPPFLAGS += -march=armv5
 # =========================================================================
-#
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+# =========================================================================
 # Supply options according to compiler version
-#
 # =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,--march=armv6,)
 PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+
diff --git a/cpu/arm720t/config.mk b/cpu/arm720t/config.mk
old mode 100644
new mode 100755
index 641b91c..e6c4183
--- a/cpu/arm720t/config.mk
+++ b/cpu/arm720t/config.mk
@@ -21,15 +21,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi
 # =========================================================================
-#
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+# =========================================================================
 # Supply options according to compiler version
-#
 # =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,--march=armv4t,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+
diff --git a/cpu/arm920t/config.mk b/cpu/arm920t/config.mk
old mode 100644
new mode 100755
index 8db4adb..444e8d5
--- a/cpu/arm920t/config.mk
+++ b/cpu/arm920t/config.mk
@@ -20,15 +20,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4
 # =========================================================================
-#
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+# =========================================================================
 # Supply options according to compiler version
-#
 # =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,--march=armv4t,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+
diff --git a/cpu/arm925t/config.mk b/cpu/arm925t/config.mk
old mode 100644
new mode 100755
index 8db4adb..444e8d5
--- a/cpu/arm925t/config.mk
+++ b/cpu/arm925t/config.mk
@@ -20,15 +20,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4
 # =========================================================================
-#
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+# =========================================================================
 # Supply options according to compiler version
-#
 # =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,--march=armv4t,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+
diff --git a/cpu/arm926ejs/config.mk b/cpu/arm926ejs/config.mk
old mode 100644
new mode 100755
index 8db4adb..e56ea6e
--- a/cpu/arm926ejs/config.mk
+++ b/cpu/arm926ejs/config.mk
@@ -20,15 +20,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4
 # =========================================================================
-#
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+# =========================================================================
 # Supply options according to compiler version
-#
 # =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,--march=armv5te,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+
diff --git a/cpu/arm946es/config.mk b/cpu/arm946es/config.mk
old mode 100644
new mode 100755
index 81ca288..e56ea6e
--- a/cpu/arm946es/config.mk
+++ b/cpu/arm946es/config.mk
@@ -20,8 +20,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
+# =========================================================================
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+# =========================================================================
+# Supply options according to compiler version
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,--march=armv5te,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
 
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	 -msoft-float
-
-PLATFORM_CPPFLAGS +=  -march=armv4
diff --git a/cpu/arm_intcm/config.mk b/cpu/arm_intcm/config.mk
old mode 100644
new mode 100755
index 81ca288..6ddcbaf
--- a/cpu/arm_intcm/config.mk
+++ b/cpu/arm_intcm/config.mk
@@ -20,8 +20,17 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
+# =========================================================================
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+# =========================================================================
+# Supply options according to compiler version
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+# This cpu intended for unknown cpu - use lowest common architecture
+PLATFORM_CPPFLAGS +=$(call cc-option,--march=armv4,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
 
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	 -msoft-float
-
-PLATFORM_CPPFLAGS +=  -march=armv4
diff --git a/cpu/ixp/config.mk b/cpu/ixp/config.mk
old mode 100644
new mode 100755
index a71a20b..e149c25
--- a/cpu/ixp/config.mk
+++ b/cpu/ixp/config.mk
@@ -21,17 +21,19 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-BIG_ENDIAN = y
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float -mbig-endian
-
+# =========================================================================
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8	\
+	-mbig-endian
 PLATFORM_CPPFLAGS += -mbig-endian -march=armv5te -mtune=strongarm1100
 # =========================================================================
-#
 # Supply options according to compiler version
-#
 # =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+BIG_ENDIAN = y
+
+
diff --git a/cpu/lh7a40x/config.mk b/cpu/lh7a40x/config.mk
old mode 100644
new mode 100755
index 10e755b..956975f
--- a/cpu/lh7a40x/config.mk
+++ b/cpu/lh7a40x/config.mk
@@ -20,15 +20,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4
 # =========================================================================
-#
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+# =========================================================================
 # Supply options according to compiler version
-#
-# ========================================================================
+# =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,--march=armv4,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+
diff --git a/cpu/pxa/config.mk b/cpu/pxa/config.mk
old mode 100644
new mode 100755
index f0b86b7..4ee8d5d
--- a/cpu/pxa/config.mk
+++ b/cpu/pxa/config.mk
@@ -21,15 +21,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
+# =========================================================================
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
 PLATFORM_CPPFLAGS += -march=armv5te -mtune=xscale
 # =========================================================================
-#
 # Supply options according to compiler version
-#
-# ========================================================================
+# =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+
diff --git a/cpu/s3c44b0/config.mk b/cpu/s3c44b0/config.mk
old mode 100644
new mode 100755
index 6dc9c46..1fe9d7d
--- a/cpu/s3c44b0/config.mk
+++ b/cpu/s3c44b0/config.mk
@@ -21,15 +21,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi -msoft-float
 # =========================================================================
-#
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
+PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi
+# =========================================================================
 # Supply options according to compiler version
-#
-# ========================================================================
+# =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+
diff --git a/cpu/sa1100/config.mk b/cpu/sa1100/config.mk
old mode 100644
new mode 100755
index 5be7dfb..a99bbb1
--- a/cpu/sa1100/config.mk
+++ b/cpu/sa1100/config.mk
@@ -21,15 +21,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-msoft-float
-
+# =========================================================================
+# See doc/README.ARM.config.mk for a justification of the ARM specific
options
+# =========================================================================
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
 PLATFORM_CPPFLAGS += -march=armv4 -mtune=strongarm1100
 # =========================================================================
-#
 # Supply options according to compiler version
-#
-# ========================================================================
+# =========================================================================
 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)
+PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+
diff --git a/doc/README.ARM.config.mk b/doc/README.ARM.config.mk
new file mode 100755
index 0000000..88962ad
--- /dev/null
+++ b/doc/README.ARM.config.mk
@@ -0,0 +1,84 @@
+The GNU compiler ARM specific options in the ARM cpu directory config.mk
files
+are intended to be general enough to apply for all boards with those cpus,
+when compiled with the latest ELDK arm toolchains.
+Individual boards and/or blocks of code may have their performance and/or
+memory footprint improved by using more particular combinations of options
+and/or toolchains. Such changes can be applied in the relevant cpu
config.mk.
+You are encouraged to submit evidence of such improvements to
+u-boot-users at lists.sourceforge.net. However, it is unlikely that such
+individual settings will be incorporated into the main code-tree.
+This file might provide a good place to document them
+- see "Board and/or toolchain specific optimizations" below.
+---------------------------------------------------------------------------
---
+The make function cc-option imported from the linux kernel to
u-boot/config.mk
+is used to
+a)	check whether a particular option is supported by the toolchain
+b)	provide an alternative to unsupported options, where applicable.
+---------------------------------------------------------------------------
---
+-march indicates the architecture implemented by the processor core.
+Should the toolchain in use not support the correct architecture the
toolchain
+default is used i.e. the option is not passed.
+---------------------------------------------------------------------------
---
+The gcc-3.4.6 manual has:-
+-mapcs-32
+	Generate code for a processor running with a 32-bit program counter,
+	and conforming to the function calling standards for the APCS
+	32-bit option.
+	This flag is deprecated.
+	Future releases of GCC will make this flag unconditional.
+-malignment-traps
+	Generate code that will not trap if the MMU has alignment traps
+	enabled. On ARM architectures prior to ARMv4, there were no
+	instructions to	access half-word objects stored in memory. However,
+	when reading from memory a feature of the ARM architecture allows a
+	word load to be used, even if the address is unaligned, and the
+	processor core will rotate the data as it is being loaded.
+	This option tells the compiler that such misaligned accesses will
cause
+	a MMU trap and that it should instead synthesize the access as a
series
+	of byte accesses. The compiler can still use word accesses to load
+	half-word data if it knows that the address is aligned to a word
+	boundary.
+	This option has no effect when compiling for ARM architecture 4 or
+	later, since these processors have instructions to directly access
+	half-word objects in memory.
+---------------------------------------------------------------------------
---
+The gcc-2.9.53 manual has:-
+-mshort-load-bytes
+	Do not try to load half-words (eg `short's) by loading a word from
an
+	unaligned address. For some targets the MMU is configured to trap
+	unaligned loads; use this option to generate code that is safe in
+	these environments.
+---------------------------------------------------------------------------
---
+Floating point code will not be accepted into the U-Boot main tree.
+However, the ELDK toolchains provide soft floating point support
+(their libraries are built with the -msoft-float option). Hence, this
option can
+be supplied to the U-Boot code, when building with the ELDK toolchain, to
ensure
+any floating point arithmetic, included locally, links in the floating
point
+support code correctly. This option is not used in the main code tree since
code
+built with soft float support cannot be linked if the toolchain used has
not
+been built with the soft float option.
+---------------------------------------------------------------------------
---
+Please note:-
+a)	U-Boot is intended to be statically linked binary.
+	Hence toolchains which make linux kernel calls e.g. to raise()
should
+	not be used.
+b)	-ffixed-r8 will not allow access to the gd pointer in ARM FIQ mode
+	since FIQ mode has it's own r8.
+	A patch to use another shared register is planned by
+	peter.pearse<at>arm.com.
+c)	Information regarding the Code Sourcery EABI toolchains is available
+	from http://www.codesourcery.com.
+	See esp. http://www.codesourcery.com/archives.
+d)	If using a toolchain which has not been built to offer ARM/thumb
+	interworking the following line removes warnings of the form
+	"X does not support interworking, whereas Y does"
+		PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+e)	Link errors generally arise where the toolchain libraries have not
been
+	built with the same options as the U-Boot code. Generally this can
be
+	fixed by building the U-Boot code with the options used in building
the
+	toolchain libraries. Otherwise the toolchain needs to be rebuilt to
match
+	the U-Boot options.
+---------------------------------------------------------------------------
---
+Board and/or toolchain specific optimizations/problems
+======================================================
+
---
Regards 

Peter






More information about the U-Boot mailing list