blob: 0b47ccad02056d49fddb319d7726d30213d9959f [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001
2TUNEVALID[thumb] = "Support Thumb instructions"
3
4ARM_THUMB_SUFFIX = "${@bb.utils.contains_any('TUNE_FEATURES', 'armv4 armv5 armv6', 't', 't2', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05005
6# If the device supports ARM, then respect ARM_THUMB_OPT (which can be "arm" or "thumb")
Brad Bishop6e60e8b2018-02-01 10:27:11 -05007# If the device doesn't support ARM, then always set "thumb" even when
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008# some recipe explicitly sets ARM_INSTRUCTION_SET to "arm"
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009ARM_THUMB_OPT = "${@['arm', 'thumb'][d.getVar('ARM_INSTRUCTION_SET') == 'thumb']}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010ARM_M_OPT = "${@bb.utils.contains('TUNE_FEATURES', 'arm', '${ARM_THUMB_OPT}', 'thumb', d)}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012python () {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050013 if bb.utils.contains('TUNE_FEATURES', 'thumb', False, True, d):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014 return
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015 selected = d.getVar('ARM_INSTRUCTION_SET')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016 if selected == None:
17 return
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018 used = d.getVar('ARM_M_OPT')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019 if selected != used:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050020 pn = d.getVar('PN')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021 bb.warn("Recipe '%s' selects ARM_INSTRUCTION_SET to be '%s', but tune configuration overrides it to '%s'" % (pn, selected, used))
22}
23
24TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_M_OPT}', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025
26# Add suffix from ARM_THUMB_SUFFIX only if after all this we still set ARM_M_OPT to thumb
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', '${ARM_THUMB_SUFFIX}', '', d) if d.getVar('ARM_M_OPT') == 'thumb' else ''}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029# what about armv7m devices which don't support -marm (e.g. Cortex-M3)?
30TARGET_CC_KERNEL_ARCH += "${@bb.utils.contains('TUNE_FEATURES', 'thumb', '-mno-thumb-interwork -marm', '', d)}"