blob: 1c9a118160aec2a37156b422bed6aa5173b65c2d [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001
2TUNEVALID[thumb] = "Support Thumb instructions"
3
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004# If the device supports ARM, then respect ARM_THUMB_OPT (which can be "arm" or "thumb")
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005# If the device doesn't support ARM, then always set "thumb" even when
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006# some recipe explicitly sets ARM_INSTRUCTION_SET to "arm"
Brad Bishop6e60e8b2018-02-01 10:27:11 -05007ARM_THUMB_OPT = "${@['arm', 'thumb'][d.getVar('ARM_INSTRUCTION_SET') == 'thumb']}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008ARM_M_OPT = "${@bb.utils.contains('TUNE_FEATURES', 'arm', '${ARM_THUMB_OPT}', 'thumb', d)}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010python () {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050011 if bb.utils.contains('TUNE_FEATURES', 'thumb', False, True, d):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012 return
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013 selected = d.getVar('ARM_INSTRUCTION_SET')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014 if selected == None:
15 return
Brad Bishop6e60e8b2018-02-01 10:27:11 -050016 used = d.getVar('ARM_M_OPT')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 if selected != used:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018 pn = d.getVar('PN')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019 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)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023
Brad Bishop79641f22019-09-10 07:20:22 -040024ARM_THUMB_SUFFIX = "t2"
Patrick Williams213cb262021-08-07 19:21:33 -050025ARM_THUMB_SUFFIX:armv4 = "t"
26ARM_THUMB_SUFFIX:armv5 = "t"
27ARM_THUMB_SUFFIX:armv6 = "t"
Brad Bishop79641f22019-09-10 07:20:22 -040028
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029# 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 -050030ARMPKGSFX_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 -050031
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032# 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)}"