blob: e54e1037371946b2e5e4febfdd2b1e752315cf5c [file] [log] [blame]
Brad Bishop286d45c2018-10-02 15:21:57 -04001SUMMARY = "Firmware for the PMU on the ZynqMP Programmable Silicon"
2HOMEPAGE = "https://github.com/Xilinx/embeddedsw"
3SECTION = "bsp"
4
5INHIBIT_DEFAULT_DEPS = "1"
6DEPENDS = "virtual/${TARGET_PREFIX}gcc newlib libgloss libgcc"
7
8# force this recipe to provide a target virtual/pmu-firmware. this is applied
9# after any class extender mapping and results in this recipe always providing
10# 'virtual/pmu-firmware'.
11python append_target_provides () {
12 d.appendVar("PROVIDES", " virtual/pmu-firmware")
13}
14addhandler append_target_provides
15append_target_provides[eventmask] = "bb.event.RecipeParsed"
16
17# This source links in a number of components with differing licenses, and some
18# licenses are not Open Source compatible. Additionally the pmu-firmware source
19# itself is licensed under a modified MIT license which restricts use to Xilinx
20# devices only.
21LICENSE = "Proprietary"
22LIC_FILES_CHKSUM = "file://../../../../license.txt;md5=04841c5ad8409b474da7180de5391926"
23
24inherit deploy
25
26XILINX_RELEASE_VERSION = "v2018.1"
27SRCREV = "aaa566bc3fa19255de4d434ebfa57ae3a9d261b2"
28PV = "${XILINX_RELEASE_VERSION}+git${SRCPV}"
29
30SRC_URI = "git://github.com/Xilinx/embeddedsw.git;protocol=https;nobranch=1"
31
32COMPATIBLE_HOST = "microblaze.*-elf"
33COMPATIBLE_MACHINE = "^$"
34COMPATIBLE_MACHINE_zynqmp = "zynqmp"
35
36PACKAGE_ARCH = "${MACHINE_ARCH}"
37
38S = "${WORKDIR}/git/lib/sw_apps/zynqmp_pmufw/src"
39
40# The makefile does not handle parallelization
41PARALLEL_MAKE = ""
42
43do_configure() {
44 # manually do the copy_bsp step first, so as to be able to fix up use of
45 # mb-* commands
46 ${S}/../misc/copy_bsp.sh
47}
48
49COMPILER = "${CC}"
50COMPILER_FLAGS = "-O2 -c"
51EXTRA_COMPILER_FLAGS = "-g -Wall -Wextra -Os -flto -ffat-lto-objects"
52ARCHIVER = "${AR}"
53
54# HACK: fix the dirty bug where xilsecure wants to call this PSVersion
55# function, which is not implemented for microblaze. The symbols never make it
56# into the final elf as the xilsecure function that uses it is not called in
57# pmufw.
58EXTRA_COMPILER_FLAGS_append = " -DXGetPSVersion_Info=atexit"
59
60BSP_DIR ?= "${S}/../misc/zynqmp_pmufw_bsp"
61BSP_TARGETS_DIR ?= "${BSP_DIR}/psu_pmu_0/libsrc"
62
63def bsp_make_vars(d):
64 s = ["COMPILER", "CC", "COMPILER_FLAGS", "EXTRA_COMPILER_FLAGS", "ARCHIVER", "AR", "AS"]
65 return " ".join(["\"%s=%s\"" % (v, d.getVar(v)) for v in s])
66
67do_compile() {
68 # the Makefile in ${S}/../misc/Makefile, does not handle CC, AR, AS, etc
69 # properly. So do its job manually. Preparing the includes first, then libs.
70 for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do
71 oe_runmake -C $(dirname $i) -s include ${@bsp_make_vars(d)}
72 done
73 for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do
74 oe_runmake -C $(dirname $i) -s libs ${@bsp_make_vars(d)}
75 done
76
77 # --build-id=none is required due to linker script not defining a location for it.
78 oe_runmake CC="${CC}" CC_FLAGS="-MMD -MP -Wl,--build-id=none"
79}
80
81do_install() {
82 :
83}
84
85PMU_FIRMWARE_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
86PMU_FIRMWARE_BASE_NAME[vardepsexclude] = "DATETIME"
87
88do_deploy() {
89 install -Dm 0644 ${B}/executable.elf ${DEPLOYDIR}/${PMU_FIRMWARE_BASE_NAME}.elf
90 ln -sf ${PMU_FIRMWARE_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf
91 ln -sf ${BPN}-${MACHINE}.elf ${DEPLOYDIR}/pmu-${MACHINE}.elf
92 ${OBJCOPY} -O binary ${B}/executable.elf ${B}/executable.bin
93 install -m 0644 ${B}/executable.bin ${DEPLOYDIR}/${PMU_FIRMWARE_BASE_NAME}.bin
94 ln -sf ${PMU_FIRMWARE_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin
95 ln -sf ${BPN}-${MACHINE}.bin ${DEPLOYDIR}/pmu-${MACHINE}.bin
96}
97addtask deploy before do_build after do_install
98
99BBCLASSEXTEND = "zynqmp-pmu"