@@ -87,7 +87,13 @@ TUNE_RISCV_ABI - This is the generated ABI that corresponds to the ARCH and
ISA variation. The ISA affects the ABI when the 'e', 'f'
and 'd' extension are used.
-TUNE_RISCV_PKGARCH - This is the generated PKGARCH value.
+TUNE_RISCV_PKGARCH - This is the PKGARCH value generated from TUNE_FEATURES.
+
+RISCVPKGARCH - This is the package arch actually used. As with ARMPKGARCH
+ on arm, each tune sets it as a literal in
+ RISCVPKGARCH:tune-<name>, so that it only changes when
+ deliberately changed. Tunes that don't set it fall back to
+ TUNE_RISCV_PKGARCH.
The standard variables are defined as:
@@ -99,7 +105,7 @@ not adequate for some reason. It is expected that most, if not all,
implementations will use the default behavior.
TUNE_ARCH = "${TUNE_RISCV_ARCH}"
-TUNE_PKGARCH = "${TUNE_RISCV_PKGARCH}"
+TUNE_PKGARCH = "${RISCVPKGARCH}"
The above two will always base their setting off the standard TUNE_FEATURES.
@@ -121,9 +121,13 @@ TUNE_CCARGS = "${@ '-march=${TUNE_RISCV_MARCH} -mabi=${TUNE_RISCV_ABI}' if not d
TUNE_ARCH = "${TUNE_RISCV_ARCH}"
# Construct TUNE_PKGARCH
-# This should result in a package are like:
+# As with ARMPKGARCH on arm, each tune sets its package arch as a literal in
+# RISCVPKGARCH:tune-<name>, so that it only changes when deliberately changed.
+# Tunes that don't set it fall back to TUNE_RISCV_PKGARCH, which is built from
+# TUNE_FEATURES above, e.g.:
# riscv32imac
-TUNE_PKGARCH = "${TUNE_RISCV_PKGARCH}"
+RISCVPKGARCH = "${@d.getVar('RISCVPKGARCH:tune-${DEFAULTTUNE}') or d.getVar('TUNE_RISCV_PKGARCH')}"
+TUNE_PKGARCH = "${RISCVPKGARCH}"
# Misc settings
# Fix: ld: unrecognized option '--hash-style=sysv'
@@ -6,27 +6,35 @@ AVAILTUNES += "riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64n
# Default
TUNE_FEATURES:tune-riscv64gc := "${@oe.tune.riscv_isa_to_tune("rv64gc")}"
-PACKAGE_EXTRA_ARCHS:tune-riscv64gc = "${TUNE_RISCV_PKGARCH}"
+RISCVPKGARCH:tune-riscv64gc ?= "riscv64imafdc_zicsr_zifencei"
+PACKAGE_EXTRA_ARCHS:tune-riscv64gc = "${RISCVPKGARCH:tune-riscv64gc}"
TUNE_FEATURES:tune-riscv64gcv := "${@oe.tune.riscv_isa_to_tune("rv64gcv")}"
-PACKAGE_EXTRA_ARCHS:tune-riscv64gcv = "${TUNE_RISCV_PKGARCH}"
+RISCVPKGARCH:tune-riscv64gcv ?= "riscv64imafdcv_zicsr_zifencei"
+PACKAGE_EXTRA_ARCHS:tune-riscv64gcv = "${RISCVPKGARCH:tune-riscv64gcv}"
TUNE_FEATURES:tune-riscv32gc := "${@oe.tune.riscv_isa_to_tune("rv32gc")}"
-PACKAGE_EXTRA_ARCHS:tune-riscv32gc = "${TUNE_RISCV_PKGARCH}"
+RISCVPKGARCH:tune-riscv32gc ?= "riscv32imafdc_zicsr_zifencei"
+PACKAGE_EXTRA_ARCHS:tune-riscv32gc = "${RISCVPKGARCH:tune-riscv32gc}"
# Compatibility aliases so that layers using old tunes don't break
TUNE_FEATURES:tune-riscv64 := "${TUNE_FEATURES:tune-riscv64gc}"
+RISCVPKGARCH:tune-riscv64 ?= "${RISCVPKGARCH:tune-riscv64gc}"
PACKAGE_EXTRA_ARCHS:tune-riscv64 = "${PACKAGE_EXTRA_ARCHS:tune-riscv64gc}"
TUNE_FEATURES:tune-riscv32 := "${TUNE_FEATURES:tune-riscv32gc}"
+RISCVPKGARCH:tune-riscv32 ?= "${RISCVPKGARCH:tune-riscv32gc}"
PACKAGE_EXTRA_ARCHS:tune-riscv32 = "${PACKAGE_EXTRA_ARCHS:tune-riscv32gc}"
# No float
TUNE_FEATURES:tune-riscv64nf := "${@oe.tune.riscv_isa_to_tune("rv64imac_zicsr_zifencei")}"
-PACKAGE_EXTRA_ARCHS:tune-riscv64nf = "${TUNE_RISCV_PKGARCH}"
+RISCVPKGARCH:tune-riscv64nf ?= "riscv64imac_zicsr_zifencei"
+PACKAGE_EXTRA_ARCHS:tune-riscv64nf = "${RISCVPKGARCH:tune-riscv64nf}"
TUNE_FEATURES:tune-riscv32nf := "${@oe.tune.riscv_isa_to_tune("rv32imac_zicsr_zifencei")}"
-PACKAGE_EXTRA_ARCHS:tune-riscv32nf = "${TUNE_RISCV_PKGARCH}"
+RISCVPKGARCH:tune-riscv32nf ?= "riscv32imac_zicsr_zifencei"
+PACKAGE_EXTRA_ARCHS:tune-riscv32nf = "${RISCVPKGARCH:tune-riscv32nf}"
# no compressed
TUNE_FEATURES:tune-riscv64nc := "${@oe.tune.riscv_isa_to_tune("rv64imafd_zicsr_zifencei")}"
-PACKAGE_EXTRA_ARCHS:tune-riscv64nc = "${TUNE_RISCV_PKGARCH}"
+RISCVPKGARCH:tune-riscv64nc ?= "riscv64imafd_zicsr_zifencei"
+PACKAGE_EXTRA_ARCHS:tune-riscv64nc = "${RISCVPKGARCH:tune-riscv64nc}"
Set each generic RISC-V tune's package arch as a literal in RISCVPKGARCH:tune-<name>, matching how we do so for ARM and ARMPKGARCH. Include a fallback to TUNE_RISCV_PKGARCH for tunes that don't set RISCVPKGARCH:tune-<name>. No package arch changes. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> --- meta/conf/machine/include/riscv/README | 10 ++++++++-- .../conf/machine/include/riscv/arch-riscv.inc | 8 ++++++-- .../conf/machine/include/riscv/tune-riscv.inc | 20 +++++++++++++------ 3 files changed, 28 insertions(+), 10 deletions(-)