summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2017-05-30 21:02:08 +1000
committerNathan Rossi <nathan@nathanrossi.com>2017-06-03 16:55:31 +1000
commitc0a15af0793ae501718589fb71245baa1f2ca97f (patch)
tree26b3253a545a296a9701f930e2243aff0272c601 /classes
parent9f106fd35c100d2b28ba2f6ea893702f85e0ffa3 (diff)
downloadmeta-xilinx-c0a15af0793ae501718589fb71245baa1f2ca97f.tar.gz
classes/zynqmp-pmu.bbclass: Create a extender class for the ZynqMP PMU
This class is an extender class similar to native/nativesdk/multilib that should be used with BBCLASSEXTEND. The purpose of this class is to allow the building of recipes for the ZynqMP PMU architecture along side building for the primary APU of the ZynqMP. Which allows for building the PMU firmware itself as well as its dependencies (e.g. newlib, libgloss). This class is intended for use with binutils-cross, gcc-cross, newlib, libgloss and pmu-firmware, but can be used globally. However there are limitations of this class and functional behaviour beyond the intended targets is not tested. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Tested-by: Alistair Francis <alistair.francis@xilinx.com> Tested-by: Koteswararao Nayudu <kotin@xilinx.com>
Diffstat (limited to 'classes')
-rw-r--r--classes/zynqmp-pmu.bbclass118
1 files changed, 118 insertions, 0 deletions
diff --git a/classes/zynqmp-pmu.bbclass b/classes/zynqmp-pmu.bbclass
new file mode 100644
index 00000000..72913445
--- /dev/null
+++ b/classes/zynqmp-pmu.bbclass
@@ -0,0 +1,118 @@
1#
2# This class handles configuring a recipe to build for the ZynqMP PMU
3# architecture. The reason for this class is due to limitations of multilib
4# with regards to multiple architectures (which do not work correctly).
5#
6# This class is specifically intended to extend the binutils-cross, gcc-cross,
7# newlib, libgloss and pmu-firmware recipes so that binaries can be emitted
8# which target the PMU architecture alongside building for the APU architecture
9# (ARM64). But the class can be applied globally via BBCLASSEXTEND in for
10# example a <machine>.conf.
11#
12# This class is almost the same as a multilib variant with custom TUNE_* setup
13# to allow for a switched TUNE_ARCH.
14#
15
16ORIG_TARGET_ARCH := "${TARGET_ARCH}"
17
18# zynqmp-pmu target arch (hardcoded based on pre-gen data from arch-microblaze.inc)
19ABIEXTENSION = ""
20TUNE_ARCH = "microblazeel"
21#TUNE_FEATURES_tune-microblaze += "v9.2 little-endian barrel-shift pattern-compare"
22TUNE_CCARGS = "-mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-reorder -mcpu=v9.2 -mxl-soft-mul -mxl-soft-div"
23TUNE_LDARGS = ""
24TUNE_ASARGS = ""
25TUNE_PKGARCH = "microblazeel-v9.2-bs-cmp"
26TARGET_OS = "elf"
27TARGET_FPU = "fpu-soft"
28
29# rebuild the MACHINE overrides
30MACHINEOVERRIDES = "${MACHINE}${@':${SOC_FAMILY}' if d.getVar('SOC_FAMILY') else ''}:microblaze"
31
32# override tune provided archs
33PACKAGE_EXTRA_ARCHS = "${TUNE_PKGARCH}"
34
35# baremetal equivalent config (note the tclibc is not included, this is purely
36# for recipes/etc that check for the value)
37TCLIBC = "baremetal"
38LIBCEXTENSION = ""
39LIBCOVERRIDE = ":libc-baremetal"
40USE_NLS = "no"
41IMAGE_LINGUAS = ""
42LIBC_DEPENDENCIES = ""
43
44# gcc-cross specific baremetal setup (due to the override order this is important)
45EXTRA_OECONF_pn-${MLPREFIX}gcc-cross-${TARGET_ARCH}_append = " --without-headers"
46
47EXTRA_OECONF_GCC_FLOAT = ""
48
49# Setup a multiarch like prefix.
50prefix = "/usr/${TARGET_SYS}"
51# Make sure GCC can search in the prefix dir (for libgcc)
52TOOLCHAIN_OPTIONS += "-B${RECIPE_SYSROOT}${includedir}/ -B${RECIPE_SYSROOT}${libdir}/"
53TOOLCHAIN_OPTIONS += "-I =${includedir} -L =${libdir}"
54
55python multitarget_zynqmp_pmu_virtclass_handler () {
56 variant = "zynqmp-pmu"
57 pn = d.getVar("PN")
58 if not (pn.startswith(variant + "-") or pn.endswith("-" + variant)):
59 return
60
61 if bb.data.inherits_class('native', e.data) or bb.data.inherits_class('nativesdk', e.data) or bb.data.inherits_class('crosssdk', e.data):
62 raise bb.parse.SkipPackage("Can't extend native/nativesdk/crosssdk recipes")
63
64 initialpn = e.data.getVar("PN").replace("-" + variant, "").replace(variant + "-", "")
65 e.data.setVar("MLPREFIX", variant + "-")
66 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-" + variant)
67
68 # work around for -cross recipes that embed the TARGET_ARCH value
69 if bb.data.inherits_class('cross', e.data):
70 if initialpn.endswith("-" + d.getVar("ORIG_TARGET_ARCH")):
71 initialpn = initialpn.replace("-" + d.getVar("ORIG_TARGET_ARCH"), "-" + d.getVar("TARGET_ARCH"))
72
73 e.data.setVar("PN", variant + "-" + initialpn)
74}
75
76addhandler multitarget_zynqmp_pmu_virtclass_handler
77multitarget_zynqmp_pmu_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
78
79python () {
80 variant = "zynqmp-pmu"
81 pn = d.getVar("PN")
82 if not pn.startswith(variant + "-"):
83 return
84
85 if pn.endswith("gcc-cross-" + d.getVar("TARGET_ARCH")):
86 # work around, DEPENDS _remove being immediate in gcc-cross
87 d.setVar("DEPENDS_remove", "virtual/%slibc-for-gcc" % d.getVar("TARGET_PREFIX"))
88
89 if pn.endswith("libgcc"):
90 # work around, strip depends on libc via do_package* tasks (this class cannot set ASSUME_PROVIDED += libc)
91 for i in ["do_package", "do_package_write_ipk", "do_package_write_deb", "do_package_write_rpm"]:
92 sanitized = " ".join([dep for dep in d.getVarFlag(i, "depends").split() if not dep.startswith("virtual/%s-libc" % variant)])
93 d.setVarFlag(i, "depends", sanitized)
94
95 import oe.classextend
96
97 clsextend = oe.classextend.ClassExtender(variant, d)
98
99 clsextend.map_depends_variable("DEPENDS")
100 clsextend.map_variable("PROVIDES")
101
102 clsextend.rename_packages()
103 clsextend.rename_package_variables((d.getVar("PACKAGEVARS") or "").split())
104
105 clsextend.map_packagevars()
106 clsextend.map_regexp_variable("PACKAGES_DYNAMIC")
107 clsextend.map_variable("PACKAGE_INSTALL")
108}
109
110# microblaze elf insane definitions not currently in insane.bbclass
111PACKAGEQA_EXTRA_MACHDEFFUNCS += "package_qa_get_machine_dict_microblazeelf"
112def package_qa_get_machine_dict_microblazeelf(machdata, d):
113 machdata["elf"] = {
114 "microblaze": (189, 0, 0, False, 32),
115 "microblazeeb":(189, 0, 0, False, 32),
116 "microblazeel":(189, 0, 0, True, 32),
117 }
118 return machdata