diff options
Diffstat (limited to 'meta/conf/machine/include/arm/feature-arm-thumb.inc')
-rw-r--r-- | meta/conf/machine/include/arm/feature-arm-thumb.inc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/conf/machine/include/arm/feature-arm-thumb.inc b/meta/conf/machine/include/arm/feature-arm-thumb.inc new file mode 100644 index 0000000000..a94386f577 --- /dev/null +++ b/meta/conf/machine/include/arm/feature-arm-thumb.inc | |||
@@ -0,0 +1,44 @@ | |||
1 | # The instruction set the compiler should use when generating application | ||
2 | # code. The kernel is always compiled with arm code at present. arm code | ||
3 | # is the original 32 bit ARM instruction set, thumb code is the 16 bit | ||
4 | # encoded RISC sub-set. Thumb code is smaller (maybe 70% of the ARM size) | ||
5 | # but requires more instructions (140% for 70% smaller code) so may be | ||
6 | # slower. | ||
7 | TUNEVALID[thumb] = "Use thumb instructions instead of ARM" | ||
8 | ARM_THUMB_OPT = "${@['arm', 'thumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}" | ||
9 | ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', 't', '', d)}" | ||
10 | ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', 't', '', d)}" | ||
11 | ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', 't', '', d)}" | ||
12 | ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 't2', '', d)}" | ||
13 | ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7r', 't2', '', d)}" | ||
14 | ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7m', 't2', '', d)}" | ||
15 | |||
16 | # If the device supports ARM, then respect ARM_THUMB_OPT (which can be "arm" or "thumb") | ||
17 | # If the defice doesn't support ARM, then always set "thumb" even when | ||
18 | # some recipe explicitly sets ARM_INSTRUCTION_SET to "arm" | ||
19 | ARM_M_OPT = "${@bb.utils.contains('TUNE_FEATURES', 'arm', '${ARM_THUMB_OPT}', 'thumb', d)}" | ||
20 | python () { | ||
21 | selected = d.getVar('ARM_INSTRUCTION_SET', True) | ||
22 | if selected == None: | ||
23 | return | ||
24 | used = d.getVar('ARM_M_OPT', True) | ||
25 | if selected != used: | ||
26 | pn = d.getVar('PN', True) | ||
27 | bb.warn("Recipe '%s' selects ARM_INSTRUCTION_SET to be '%s', but tune configuration overrides it to '%s'" % (pn, selected, used)) | ||
28 | } | ||
29 | |||
30 | TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_M_OPT}', '', d)}" | ||
31 | OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ':thumb', '', d)}" | ||
32 | |||
33 | ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', '${ARM_THUMB_SUFFIX}', '', d)}" | ||
34 | |||
35 | # Whether to compile with code to allow interworking between the two | ||
36 | # instruction sets. This allows thumb code to be executed on a primarily | ||
37 | # arm system and vice versa. It is strongly recommended that DISTROs not | ||
38 | # turn this off - the actual cost is very small. | ||
39 | TUNEVALID[no-thumb-interwork] = "Disable mixing of thumb and ARM functions" | ||
40 | TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'no-thumb-interwork', ' -mno-thumb-interwork', ' -mthumb-interwork', d)}" | ||
41 | OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'no-thumb-interwork', ':thumb-interwork', '', d)}" | ||
42 | |||
43 | # what about armv7m devices which don't support -marm (e.g. Cortex-M3)? | ||
44 | TARGET_CC_KERNEL_ARCH += "-mno-thumb-interwork -marm" | ||