xref: /openbmc/openbmc/poky/meta/conf/machine/include/arm/feature-arm-thumb.inc (revision c124f4f2e04dca16a428a76c89677328bc7bf908)
1
2TUNEVALID[thumb] = "Support Thumb instructions"
3
4# If the device supports ARM, then respect ARM_THUMB_OPT (which can be "arm" or "thumb")
5# If the device doesn't support ARM, then always set "thumb" even when
6# some recipe explicitly sets ARM_INSTRUCTION_SET to "arm"
7ARM_THUMB_OPT = "${@['arm', 'thumb'][d.getVar('ARM_INSTRUCTION_SET') == 'thumb']}"
8ARM_M_OPT = "${@bb.utils.contains('TUNE_FEATURES', 'arm', '${ARM_THUMB_OPT}', 'thumb', d)}"
9
10python () {
11    if bb.utils.contains('TUNE_FEATURES', 'thumb', False, True, d):
12        return
13    selected = d.getVar('ARM_INSTRUCTION_SET')
14    if selected == None:
15        return
16    used = d.getVar('ARM_M_OPT')
17    if selected != used:
18        pn = d.getVar('PN')
19        bb.warn("Recipe '%s' selects ARM_INSTRUCTION_SET to be '%s', but tune configuration overrides it to '%s'" % (pn, selected, used))
20}
21
22TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_M_OPT}', '', d)}"
23
24ARM_THUMB_SUFFIX = "t2"
25ARM_THUMB_SUFFIX:armv4 = "t"
26ARM_THUMB_SUFFIX:armv5 = "t"
27ARM_THUMB_SUFFIX:armv6 = "t"
28
29# Add suffix from ARM_THUMB_SUFFIX only if after all this we still set ARM_M_OPT to thumb
30ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', '${ARM_THUMB_SUFFIX}', '', d) if d.getVar('ARM_M_OPT') == 'thumb' else ''}"
31
32# what about armv7m devices which don't support -marm (e.g. Cortex-M3)?
33TARGET_CC_KERNEL_ARCH += "${@bb.utils.contains('TUNE_FEATURES', 'thumb', '-mno-thumb-interwork -marm', '', d)}"
34