config/target.in
author Michael Hope <michael.hope@linaro.org>
Wed Oct 19 15:27:32 2011 +1300 (2011-10-19)
changeset 2739 f320e22f2cba
parent 2737 b5179235b925
child 2772 d4ac8609878e
permissions -rw-r--r--
arch: add softfp support

Some architectures support a mixed hard/soft floating point, where
the compiler emits hardware floating point instructions, but passes
the operands in core (aka integer) registers.

For example, ARM supports this mode (to come in the next changeset).

Add support for softfp cross compilers to the GCC and GLIBC
configuration. Needed for Ubuntu and other distros that are softfp.

Signed-off-by: Michael Hope <michael.hope@linaro.org>
[yann.morin.1998@anciens.enib.fr: split the original patch]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     1 # Target definition: architecture, optimisations, etc...
     2 
     3 menu "Target options"
     4 
     5 config ARCH
     6     string
     7 
     8 # Pre-declare target optimisation variables
     9 config ARCH_SUPPORTS_BOTH_MMU
    10 config ARCH_SUPPORTS_BOTH_ENDIAN
    11 config ARCH_SUPPORTS_32
    12 config ARCH_SUPPORTS_64
    13 config ARCH_SUPPORT_ARCH
    14 config ARCH_SUPPORT_ABI
    15 config ARCH_SUPPORT_CPU
    16 config ARCH_SUPPORT_TUNE
    17 config ARCH_SUPPORT_FPU
    18 config ARCH_SUPPORT_SOFTFP
    19 
    20 config ARCH_DEFAULT_HAS_MMU
    21 config ARCH_DEFAULT_BE
    22 config ARCH_DEFAULT_LE
    23 config ARCH_DEFAULT_32
    24 config ARCH_DEFAULT_64
    25 
    26 config ARCH_ARCH
    27 config ARCH_ABI
    28 config ARCH_CPU
    29 config ARCH_TUNE
    30 config ARCH_FPU
    31 config ARCH_BE
    32 config ARCH_LE
    33 config ARCH_32
    34 config ARCH_64
    35 config ARCH_BITNESS
    36 config ARCH_FLOAT_HW
    37 config ARCH_FLOAT_SW
    38 config TARGET_CFLAGS
    39 config TARGET_LDFLAGS
    40 
    41 source "config.gen/arch.in"
    42 
    43 #--------------------------------------
    44 comment "Generic target options"
    45 
    46 config ARCH_SUPPORTS_BOTH_MMU
    47     bool
    48 
    49 config ARCH_DEFAULT_HAS_MMU
    50     bool
    51 
    52 config ARCH_USE_MMU
    53     bool
    54     prompt "Use the MMU" if ARCH_SUPPORTS_BOTH_MMU
    55     default y if ARCH_DEFAULT_HAS_MMU
    56     help
    57       If your architecture has an MMU and you want to use it,
    58       say 'Y' here.
    59       
    60       OTOH, if you don't want to use the MMU, or your arch
    61       lacks an MMU, say 'N' here.
    62       
    63       Note that some architectures (eg. ARM) has variants that
    64       lacks an MMU (eg. ARM Cortex-M3), while other variants
    65       have one (eg. ARM Cortex-A8).
    66 
    67 #--------------------------------------
    68 config ARCH_SUPPORTS_BOTH_ENDIAN
    69     bool
    70 
    71 config ARCH_DEFAULT_BE
    72     bool
    73 
    74 config ARCH_DEFAULT_LE
    75     bool
    76 
    77 choice
    78     bool
    79     prompt "Endianness:"
    80     depends on ARCH_SUPPORTS_BOTH_ENDIAN
    81     default ARCH_BE if ARCH_DEFAULT_BE
    82     default ARCH_LE if ARCH_DEFAULT_LE
    83 
    84 config ARCH_BE
    85     bool
    86     prompt "Big endian"
    87 
    88 config ARCH_LE
    89     bool
    90     prompt "Little endian"
    91 
    92 endchoice
    93 
    94 #--------------------------------------
    95 config ARCH_SUPPORTS_32
    96     bool
    97 
    98 config ARCH_SUPPORTS_64
    99     bool
   100 
   101 config ARCH_DEFAULT_32
   102     bool
   103 
   104 config ARCH_DEFAULT_64
   105     bool
   106 
   107 config ARCH_BITNESS
   108     int
   109     default "32"    if ARCH_32
   110     default "64"    if ARCH_64
   111 
   112 choice
   113     bool
   114     prompt "Bitness:"
   115     default ARCH_32 if ARCH_DEFAULT_32
   116     default ARCH_64 if ARCH_DEFAULT_64
   117 
   118 config ARCH_32
   119     bool
   120     prompt "32-bit"
   121     depends on ARCH_SUPPORTS_32
   122 
   123 config ARCH_64
   124     bool
   125     prompt "64-bit"
   126     depends on ARCH_SUPPORTS_64
   127 
   128 endchoice
   129 
   130 #--------------------------------------
   131 comment "Target optimisations"
   132 
   133 config ARCH_SUPPORT_ARCH
   134     bool
   135 
   136 config ARCH_SUPPORT_ABI
   137     bool
   138 
   139 config ARCH_SUPPORT_CPU
   140     bool
   141 
   142 config ARCH_SUPPORT_TUNE
   143     bool
   144 
   145 config ARCH_SUPPORT_FPU
   146     bool
   147 
   148 config ARCH_SUPPORT_SOFTFP
   149     bool
   150 
   151 config ARCH_ARCH
   152     string
   153     prompt "Architecture level"
   154     depends on ARCH_SUPPORT_ARCH
   155     default ""
   156     help
   157       GCC uses this name to determine what kind of instructions it can emit
   158       when generating assembly code. This option can be used in conjunction
   159       with or instead of the ARCH_CPU option (above), or a (command-line)
   160       -mcpu= option.
   161       
   162       This is the configuration flag --with-arch=XXXX, and the runtime flag
   163       -march=XXX.
   164       
   165       Pick a value from the gcc manual for your choosen gcc version and your
   166       target CPU.
   167       
   168       Leave blank if you don't know, or if your target architecture does not
   169       offer this option.
   170 
   171 config ARCH_ABI
   172     string
   173     prompt "Generate code for the specific ABI"
   174     depends on ARCH_SUPPORT_ABI
   175     default ""
   176     help
   177       Generate code for the given ABI.
   178 
   179       This is the configuration flag --with-abi=XXXX, and the runtime flag
   180       -mabi=XXX.
   181 
   182       Pick a value from the gcc manual for your choosen gcc version and your
   183       target CPU.
   184 
   185       Leave blank if you don't know, or if your target architecture does not
   186       offer this option.
   187 
   188 config ARCH_CPU
   189     string
   190     prompt "Emit assembly for CPU"
   191     depends on ARCH_SUPPORT_CPU
   192     default ""
   193     help
   194       This specifies the name of the target processor. GCC uses this name
   195       to determine what kind of instructions it can emit when generating
   196       assembly code.
   197       
   198       This is the configuration flag --with-cpu=XXXX, and the runtime flag
   199       -mcpu=XXX.
   200 
   201       Pick a value from the gcc manual for your choosen gcc version and your
   202       target CPU.
   203       
   204       Leave blank if you don't know, or if your target architecture does not
   205       offer this option.
   206 
   207 config ARCH_TUNE
   208     string
   209     prompt "Tune for CPU"
   210     depends on ARCH_SUPPORT_TUNE
   211     default ""
   212     help
   213       This option is very similar to the ARCH_CPU option (above), except
   214       that instead of specifying the actual target processor type, and hence
   215       restricting which instructions can be used, it specifies that GCC should
   216       tune the performance of the code as if the target were of the type
   217       specified in this option, but still choosing the instructions that it
   218       will generate based on the cpu specified by the ARCH_CPU option
   219       (above), or a (command-line) -mcpu= option.
   220       
   221       This is the configuration flag --with-tune=XXXX, and the runtime flag
   222       -mtune=XXX.
   223       
   224       Pick a value from the gcc manual for your choosen gcc version and your
   225       target CPU.
   226       
   227       Leave blank if you don't know, or if your target architecture does not
   228       offer this option.
   229 
   230 config ARCH_FPU
   231     string
   232     prompt "Use specific FPU"
   233     depends on ARCH_SUPPORT_FPU
   234     default ""
   235     help
   236       On some targets (eg. ARM), you can specify the kind of FPU to emit
   237       code for.
   238 
   239       This is the configuration flag --with-fpu=XXX, and the runtime flag
   240       -mfpu=XXX.
   241       
   242       See below wether to actually emit FP opcodes, or to emulate them.
   243       
   244       Pick a value from the gcc manual for your choosen gcc version and your
   245       target CPU.
   246       
   247       Leave blank if you don't know, or if your target architecture does not
   248       offer this option.
   249 
   250 choice
   251     bool
   252     prompt "Floating point:"
   253 
   254 config ARCH_FLOAT_HW
   255     bool
   256     prompt "hardware (FPU)"
   257     help
   258       Emit hardware floating point opcodes.
   259       
   260       If you've got a processor with a FPU, then you want that.
   261       If your hardware has no FPU, you still can use HW floating point, but
   262       need to compile support for FPU emulation in your kernel. Needless to
   263       say that emulating the FPU is /slooowwwww/...
   264       
   265       One situation you'd want HW floating point without a FPU is if you get
   266       binary blobs from different vendors that are compiling this way and
   267       can't (don't wan't to) change.
   268 
   269 config ARCH_FLOAT_SW
   270     bool
   271     prompt "software"
   272     help
   273       Do not emit any hardware floating point opcode.
   274       
   275       If your processor has no FPU, then you most probably want this, as it
   276       is faster than emulating the FPU in the kernel.
   277 
   278 config ARCH_FLOAT_SOFTFP
   279     bool
   280     prompt "softfp"
   281     depends on ARCH_SUPPORT_SOFTFP
   282     help
   283       Emit hardware floating point opcodes but use the software
   284       floating point calling convention.
   285 
   286       Architectures such as ARM use different registers for passing
   287       floating point values depending on if they're in software mode
   288       or hardware mode.  softfp emits FPU instructions but uses the
   289       software FP calling convention allowing softfp code to
   290       interoperate with legacy software only code.
   291 
   292       If in doubt, use 'software' or 'hardware' mode instead.
   293 
   294 endchoice
   295 
   296 config TARGET_CFLAGS
   297     string
   298     prompt "Target CFLAGS"
   299     default ""
   300     help
   301       Used to add specific options when compiling libraries of the toolchain,
   302       that will run on the target (eg. libc.so).
   303       
   304       Note that the options above for ARCH, ABI, CPU, TUNE and FPU will be
   305       automatically used. You don't need to specify them here.
   306       
   307       Leave blank if you don't know better.
   308 
   309 config TARGET_LDFLAGS
   310     string
   311     prompt "Target LDFLAGS"
   312     default ""
   313     help
   314       Used to add specific options when linking libraries of the toolchain,
   315       that will run on your target.
   316       
   317       Leave blank if you don't know better.
   318 
   319 config ARCH_FLOAT
   320     string
   321     default "hard"   if ARCH_FLOAT_HW
   322     default "soft"   if ARCH_FLOAT_SW
   323     default "softfp" if ARCH_FLOAT_SOFTFP
   324 
   325 source "config.gen/arch.in.2"
   326 
   327 endmenu