
Patch revised in light of list comments. This patch completely replaces:- " Rationalize ARM compiler options Date: 2008-02-13 15:55:00 GMT " --- Signed-off-by: Peter Pearse peter.pearse@arm.com --- diff --git a/cpu/arm1136/config.mk b/cpu/arm1136/config.mk index 6ab0dd3..cf47130 100644 --- a/cpu/arm1136/config.mk +++ b/cpu/arm1136/config.mk @@ -20,16 +20,15 @@ # 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 -msoft-float +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,)) +PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)) +PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)) + diff --git a/cpu/arm720t/config.mk b/cpu/arm720t/config.mk index 641b91c..378751c 100644 --- 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 # - -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 -msoft-float +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,)) +PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)) +PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)) + diff --git a/cpu/arm920t/config.mk b/cpu/arm920t/config.mk index 8db4adb..7ecf8c3 100644 --- a/cpu/arm920t/config.mk +++ b/cpu/arm920t/config.mk @@ -20,15 +20,15 @@ # 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 -msoft-float +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,)) +PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)) +PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)) + diff --git a/cpu/arm925t/config.mk b/cpu/arm925t/config.mk index 8db4adb..7ecf8c3 100644 --- a/cpu/arm925t/config.mk +++ b/cpu/arm925t/config.mk @@ -20,15 +20,15 @@ # 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 -msoft-float +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,)) +PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)) +PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)) + diff --git a/cpu/arm926ejs/config.mk b/cpu/arm926ejs/config.mk index 8db4adb..88182bc 100644 --- a/cpu/arm926ejs/config.mk +++ b/cpu/arm926ejs/config.mk @@ -20,15 +20,15 @@ # 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 -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_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)) +PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)) + diff --git a/cpu/arm946es/config.mk b/cpu/arm946es/config.mk index 81ca288..88182bc 100644 --- a/cpu/arm946es/config.mk +++ b/cpu/arm946es/config.mk @@ -20,8 +20,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 -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,)) +PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,))
-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 index 81ca288..954f366 100644 --- a/cpu/arm_intcm/config.mk +++ b/cpu/arm_intcm/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 -msoft-float +# 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,)) +PLATFORM_RELFLAGS +=$(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 index a71a20b..f18113a 100644 --- 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 -msoft-float \ + -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,)) +BIG_ENDIAN = y + + diff --git a/cpu/lh7a40x/config.mk b/cpu/lh7a40x/config.mk index 10e755b..58269f0 100644 --- a/cpu/lh7a40x/config.mk +++ b/cpu/lh7a40x/config.mk @@ -20,15 +20,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 -msoft-float 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 +=$(call cc-option,-mshort-load-bytes,)) +PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)) diff --git a/cpu/pxa/config.mk b/cpu/pxa/config.mk index f0b86b7..3cb4b16 100644 --- 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 -msoft-float 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,)) diff --git a/cpu/s3c44b0/config.mk b/cpu/s3c44b0/config.mk index 6dc9c46..4dfd17c 100644 --- 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 # - -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 -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,)) +PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,)) +PLATFORM_RELFLAGS +=$(call cc-option,-malignment-traps,)) diff --git a/cpu/sa1100/config.mk b/cpu/sa1100/config.mk index 5be7dfb..67d3b26 100644 --- 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 -msoft-float 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,)) diff --git a/doc/README.ARM.config.mk b/doc/README.ARM.config.mk new file mode 100644 index 0000000..016cd1d --- /dev/null +++ b/doc/README.ARM.config.mk @@ -0,0 +1,75 @@ +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@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. +--------------------------------------------------------------------------- --- +Floating point code will not be accepted into the U-Boot main tree. +However, the ELDK toolchains provide floating point support and are built +with the -msoft-float option. Hence, this option is supplied to the U-Boot code +to ensure any floating point arithmetic, included locally, links in the floating +point support code correctly. +--------------------------------------------------------------------------- --- +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, 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 --