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

Signed-off-by: Peter Pearse peter.pearse@arm.com --- diff --git a/cpu/arm1136/config.mk b/cpu/arm1136/config.mk old mode 100644 new mode 100755 index 6ab0dd3..5c64aa7 --- a/cpu/arm1136/config.mk +++ b/cpu/arm1136/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +# # See file CREDITS for list of people who contributed to this # project. # @@ -20,16 +21,15 @@ # 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
-# Make ARMv5 to allow more compilers to work, even though its v6. -PLATFORM_CPPFLAGS += -march=armv5 +PLATFORM_CPPFLAGS += -march=armv6 # ========================================================================= -# # Supply options according to compiler version -# # ========================================================================= PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) -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..2da312e --- a/cpu/arm720t/config.mk +++ b/cpu/arm720t/config.mk @@ -21,15 +21,15 @@ # 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
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ - -msoft-float - -PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi +PLATFORM_CPPFLAGS += -march=armv4t # ========================================================================= -# # 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,)) + diff --git a/cpu/arm920t/config.mk b/cpu/arm920t/config.mk old mode 100644 new mode 100755 index 8db4adb..b5605b3 --- a/cpu/arm920t/config.mk +++ b/cpu/arm920t/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +# # See file CREDITS for list of people who contributed to this # project. # @@ -20,15 +21,15 @@ # 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
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ - -msoft-float - -PLATFORM_CPPFLAGS += -march=armv4 +PLATFORM_CPPFLAGS += -march=armv4t # ========================================================================= -# # 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,)) + diff --git a/cpu/arm925t/config.mk b/cpu/arm925t/config.mk old mode 100644 new mode 100755 index 8db4adb..b5605b3 --- a/cpu/arm925t/config.mk +++ b/cpu/arm925t/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +# # See file CREDITS for list of people who contributed to this # project. # @@ -20,15 +21,15 @@ # 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
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ - -msoft-float - -PLATFORM_CPPFLAGS += -march=armv4 +PLATFORM_CPPFLAGS += -march=armv4t # ========================================================================= -# # 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,)) + diff --git a/cpu/arm926ejs/config.mk b/cpu/arm926ejs/config.mk old mode 100644 new mode 100755 index 8db4adb..7f531f8 --- a/cpu/arm926ejs/config.mk +++ b/cpu/arm926ejs/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +# # See file CREDITS for list of people who contributed to this # project. # @@ -20,15 +21,15 @@ # 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
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ - -msoft-float - -PLATFORM_CPPFLAGS += -march=armv4 +PLATFORM_CPPFLAGS += -march=armv5te # ========================================================================= -# # 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,)) + diff --git a/cpu/arm946es/config.mk b/cpu/arm946es/config.mk old mode 100644 new mode 100755 index 81ca288..7f531f8 --- a/cpu/arm946es/config.mk +++ b/cpu/arm946es/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +# # See file CREDITS for list of people who contributed to this # project. # @@ -20,8 +21,15 @@ # 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
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ - -msoft-float +PLATFORM_CPPFLAGS += -march=armv5te +# ========================================================================= +# 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_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..6766074 --- a/cpu/arm_intcm/config.mk +++ b/cpu/arm_intcm/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +# # See file CREDITS for list of people who contributed to this # project. # @@ -20,8 +21,15 @@ # 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 +# This cpu intended for unknown cpu - use lowest common architecture +PLATFORM_CPPFLAGS += -march=armv4 +# ========================================================================= +# 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 += -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..da67bae --- a/cpu/ixp/config.mk +++ b/cpu/ixp/config.mk @@ -21,17 +21,18 @@ # 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,)) + +BIG_ENDIAN = y + + diff --git a/cpu/lh7a40x/config.mk b/cpu/lh7a40x/config.mk old mode 100644 new mode 100755 index 10e755b..dfa6dfd --- a/cpu/lh7a40x/config.mk +++ b/cpu/lh7a40x/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +# # See file CREDITS for list of people who contributed to this # project. # @@ -20,15 +21,14 @@ # 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 # ========================================================================= -# # 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,)) diff --git a/cpu/pxa/config.mk b/cpu/pxa/config.mk old mode 100644 new mode 100755 index f0b86b7..bd9ef17 --- a/cpu/pxa/config.mk +++ b/cpu/pxa/config.mk @@ -21,15 +21,14 @@ # 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,)) diff --git a/cpu/s3c44b0/config.mk b/cpu/s3c44b0/config.mk old mode 100644 new mode 100755 index 6dc9c46..8e77969 --- a/cpu/s3c44b0/config.mk +++ b/cpu/s3c44b0/config.mk @@ -21,15 +21,14 @@ # 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
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ - -msoft-float - -PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi -msoft-float +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,)) diff --git a/cpu/sa1100/config.mk b/cpu/sa1100/config.mk old mode 100644 new mode 100755 index 5be7dfb..cf9c296 --- a/cpu/sa1100/config.mk +++ b/cpu/sa1100/config.mk @@ -21,15 +21,14 @@ # 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,)) diff --git a/doc/README.ARM.config.mk b/doc/README.ARM.config.mk new file mode 100755 index 0000000..d9d35e4 --- /dev/null +++ b/doc/README.ARM.config.mk @@ -0,0 +1,74 @@ +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. You are encouraged to submit evidence of such +improvements to u-boot-users@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. + +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. + -mshort-load-bytes + +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. + +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) U-Boot contains no floating point code, hence the -msoft-float option + is not valid. +c) -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. +d) Information regarding the Code Sourcery EABI toolchains is available + from http://www.codesourcery.com. + See esp. http://www.codesourcery.com/archives. +e) If using a toolchain which has not been built to offer ARM/thumb + interworking the following line, added to config.mk will remove + warnings of the form "X does not support interworking, whereas Y does" + + PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,) + +Board and/or toolchain specific optimizations +============================================= +TBD
--- Also available from git://linux-arm.org/u-boot-armdev.git#080212_options

In message 1202918100.6285.8.camel@us710-oe.cambridge.arm.com you wrote:
Signed-off-by: Peter Pearse peter.pearse@arm.com
diff --git a/cpu/arm1136/config.mk b/cpu/arm1136/config.mk old mode 100644 new mode 100755 index 6ab0dd3..5c64aa7 --- a/cpu/arm1136/config.mk +++ b/cpu/arm1136/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +# # See file CREDITS for list of people who contributed to this
Please don't add too many empty lines.
# project. # @@ -20,16 +21,15 @@ # 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
Why exactly are you dropping -msoft-float here?
-# Make ARMv5 to allow more compilers to work, even though its v6. -PLATFORM_CPPFLAGS += -march=armv5 +PLATFORM_CPPFLAGS += -march=armv6
Why exactly are you changing this?
--- a/cpu/arm720t/config.mk +++ b/cpu/arm720t/config.mk @@ -21,15 +21,15 @@ # 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
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \
- -msoft-float
-PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi +PLATFORM_CPPFLAGS += -march=armv4t # ========================================================================= -# # 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,))
Please don't add trailing empty lines.
old mode 100644 new mode 100755 index 8db4adb..b5605b3 --- a/cpu/arm920t/config.mk +++ b/cpu/arm920t/config.mk @@ -2,6 +2,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, gj@denx.de # +#
Please don't add random empty lines.
etc. etc.
Best regards,
Wolfgang Denk
participants (2)
-
Peter Pearse
-
Wolfgang Denk