aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-bsp/embeddedsw/psm-firmware_2023.2.bbappend
blob: 61d42e60cdf6080e227abcbac79030d6dbaa4af9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Should not need any external patches
SRC_URI = "${EMBEDDEDSW_SRCURI}"

# We WANT to default to this version when available
DEFAULT_PREFERENCE = "100"

inherit xsctapp xsctyaml

# This needs to match the value in psmfw.bbappend
PSM_FIRMWARE_IMAGE_NAME = "psm-firmware-${MACHINE}"

B = "${S}/${XSCTH_PROJ}"

XSCTH_PROC_IP = "psv_psm"
XSCTH_PROC_IP:versal-net = "psx_psm"
XSCTH_APP  = "versal PSM Firmware"

# XSCT version provides it's own toolchain, so can build in any environment
COMPATIBLE_HOST:versal = "${HOST_SYS}"

# Clear this for a Linux build, using the XSCT toolchain
EXTRA_OEMAKE:linux = ""

# Workaround for hardcoded toolchain items
XSCT_PATH_ADD:append:elf = "\
${UNPACKDIR}/bin:"

MB_OBJCOPY = "mb-objcopy"

do_compile:prepend:elf() {
  mkdir -p ${UNPACKDIR}/bin
  echo "#! /bin/bash\n${CC} \$@" > ${UNPACKDIR}/bin/mb-gcc
  echo "#! /bin/bash\n${AS} \$@" > ${UNPACKDIR}/bin/mb-as
  echo "#! /bin/bash\n${AR} \$@" > ${UNPACKDIR}/bin/mb-ar
  echo "#! /bin/bash\n${AR} \$@" > ${UNPACKDIR}/bin/mb-gcc-ar
  echo "#! /bin/bash\n${OBJCOPY} \$@" > ${UNPACKDIR}/bin/mb-objcopy
  chmod 0755 ${UNPACKDIR}/bin/mb-gcc
  chmod 0755 ${UNPACKDIR}/bin/mb-as
  chmod 0755 ${UNPACKDIR}/bin/mb-ar
  chmod 0755 ${UNPACKDIR}/bin/mb-gcc-ar
  chmod 0755 ${UNPACKDIR}/bin/mb-objcopy
}

do_compile:append() {
  ${MB_OBJCOPY} -O binary ${B}/${XSCTH_PROJ}/executable.elf ${B}/${XSCTH_PROJ}/executable.bin
}

# xsctapp sets it's own do_install, replace it with the real one
do_install() {
    :
}

do_deploy() {
    install -Dm 0644 ${B}/${XSCTH_PROJ}/executable.elf ${DEPLOYDIR}/${PSM_FIRMWARE_BASE_NAME}.elf
    ln -sf ${PSM_FIRMWARE_BASE_NAME}.elf ${DEPLOYDIR}/${PSM_FIRMWARE_IMAGE_NAME}.elf
    install -m 0644 ${B}/${XSCTH_PROJ}/executable.bin ${DEPLOYDIR}/${PSM_FIRMWARE_BASE_NAME}.bin
    ln -sf ${PSM_FIRMWARE_BASE_NAME}.bin ${DEPLOYDIR}/${PSM_FIRMWARE_IMAGE_NAME}.bin
}