blob: 58482cd37b2fc69af55dda68e372e5485e616392 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001SUMMARY = "SCP and MCP Firmware"
2DESCRIPTION = "Firmware for SCP and MCP software reference implementation"
3HOMEPAGE = "https://github.com/ARM-software/SCP-firmware"
4
5LICENSE = "BSD-3-Clause & Apache-2.0"
6LIC_FILES_CHKSUM = "file://license.md;beginline=5;md5=9db9e3d2fb8d9300a6c3d15101b19731 \
7 file://contrib/cmsis/git/LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e"
8
Andrew Geisslerea144b032023-01-27 16:03:57 -06009SRC_URI_SCP_FIRMWARE ?= "gitsm://github.com/ARM-software/SCP-firmware.git;protocol=https"
Andrew Geissler23e02792023-07-21 09:06:10 -050010SRC_URI = "${SRC_URI_SCP_FIRMWARE};branch=${SRCBRANCH} \
11 file://optee-private-includes.patch"
Brad Bishopbec4ebc2022-08-03 09:55:16 -040012
Andrew Geissler23e02792023-07-21 09:06:10 -050013SRCBRANCH = "master"
Patrick Williams520786c2023-06-25 16:20:36 -050014SRCREV = "0c7236b1851d90124210a0414fd982dc55322c7c"
Brad Bishopbec4ebc2022-08-03 09:55:16 -040015
16PROVIDES += "virtual/control-processor-firmware"
17
Andrew Geissler2daf84b2023-03-31 09:57:23 -050018CMAKE_BUILD_TYPE ?= "RelWithDebInfo"
Andrew Geissler23e02792023-07-21 09:06:10 -050019SCP_PLATFORM ?= "${MACHINE}"
Brad Bishopbec4ebc2022-08-03 09:55:16 -040020SCP_LOG_LEVEL ?= "WARN"
21SCP_PLATFORM_FEATURE_SET ?= "0"
22
23INHIBIT_DEFAULT_DEPS = "1"
Patrick Williams520786c2023-06-25 16:20:36 -050024DEPENDS = "gcc-arm-none-eabi-native \
Brad Bishopbec4ebc2022-08-03 09:55:16 -040025 cmake-native \
26 ninja-native \
27 "
28
29# For now we only build with GCC, so stop meta-clang trying to get involved
30TOOLCHAIN = "gcc"
31
Patrick Williamsb542dec2023-06-09 01:26:37 -050032# remove once arm-none-eabi-gcc updates to 13 or newer like poky
33DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map"
34
Brad Bishopbec4ebc2022-08-03 09:55:16 -040035inherit deploy
36
37B = "${WORKDIR}/build"
38S = "${WORKDIR}/git"
39
40# Allow platform specific copying of only scp or both scp & mcp, default to both
41FW_TARGETS ?= "scp mcp"
42FW_INSTALL ?= "ramfw romfw"
Andrew Geissler2daf84b2023-03-31 09:57:23 -050043
Brad Bishopbec4ebc2022-08-03 09:55:16 -040044PACKAGE_ARCH = "${MACHINE_ARCH}"
45COMPATIBLE_MACHINE ?= "invalid"
46
Andrew Geissler2daf84b2023-03-31 09:57:23 -050047export CFLAGS = "${DEBUG_PREFIX_MAP}"
48export ASMFLAGS = "${DEBUG_PREFIX_MAP}"
Brad Bishopbec4ebc2022-08-03 09:55:16 -040049
Andrew Geissler2daf84b2023-03-31 09:57:23 -050050LDFLAGS[unexport] = "1"
51
52EXTRA_OECMAKE = "-D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
Brad Bishopbec4ebc2022-08-03 09:55:16 -040053 -D SCP_LOG_LEVEL=${SCP_LOG_LEVEL} \
54 -D SCP_PLATFORM_FEATURE_SET=${SCP_PLATFORM_FEATURE_SET} \
Andrew Geisslerea144b032023-01-27 16:03:57 -060055 -D DISABLE_CPPCHECK=1 \
Andrew Geissler23e02792023-07-21 09:06:10 -050056 -D SCP_TOOLCHAIN=GNU \
Brad Bishopbec4ebc2022-08-03 09:55:16 -040057 "
58
59do_configure() {
Andrew Geissler2daf84b2023-03-31 09:57:23 -050060 for FW in ${FW_TARGETS}; do
61 for TYPE in ${FW_INSTALL}; do
Andrew Geissler23e02792023-07-21 09:06:10 -050062 bbnote Configuring ${SCP_PLATFORM}/${FW}_${TYPE}...
63 cmake -GNinja ${EXTRA_OECMAKE} -S ${S} -B "${B}/${TYPE}/${FW}" -D SCP_FIRMWARE_SOURCE_DIR:PATH="${SCP_PLATFORM}/${FW}_${TYPE}"
Andrew Geissler2daf84b2023-03-31 09:57:23 -050064 done
65 done
Brad Bishopbec4ebc2022-08-03 09:55:16 -040066}
67
68do_configure[cleandirs] += "${B}"
69
70do_compile() {
Andrew Geissler2daf84b2023-03-31 09:57:23 -050071 for FW in ${FW_TARGETS}; do
72 for TYPE in ${FW_INSTALL}; do
Andrew Geissler23e02792023-07-21 09:06:10 -050073 bbnote Building ${SCP_PLATFORM}/${FW}_${TYPE}...
Andrew Geissler2daf84b2023-03-31 09:57:23 -050074 VERBOSE=1 cmake --build ${B}/${TYPE}/${FW} --target all
75 done
76 done
Brad Bishopbec4ebc2022-08-03 09:55:16 -040077}
78
79do_install() {
Andrew Geissler2daf84b2023-03-31 09:57:23 -050080 install -d ${D}/firmware
81 for TYPE in ${FW_INSTALL}; do
82 for FW in ${FW_TARGETS}; do
83 if [ "$TYPE" = "romfw" ]; then
84 if [ "$FW" = "scp" ]; then
85 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-bl1.bin" "${D}/firmware/${FW}_${TYPE}.bin"
Patrick Williams8e7b46e2023-05-01 14:19:06 -050086 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-bl1.elf" "${D}/firmware/${FW}_${TYPE}.elf"
87 else
88 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-${FW}-bl1.bin" "${D}/firmware/${FW}_${TYPE}.bin"
89 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-${FW}-bl1.elf" "${D}/firmware/${FW}_${TYPE}.elf"
Andrew Geissler2daf84b2023-03-31 09:57:23 -050090 fi
91 elif [ "$TYPE" = "ramfw" ]; then
92 if [ "$FW" = "scp" ]; then
93 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-bl2.bin" "${D}/firmware/${FW}_${TYPE}.bin"
Patrick Williams8e7b46e2023-05-01 14:19:06 -050094 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-bl2.elf" "${D}/firmware/${FW}_${TYPE}.elf"
95 else
96 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-${FW}-bl2.bin" "${D}/firmware/${FW}_${TYPE}.bin"
97 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-${FW}-bl2.elf" "${D}/firmware/${FW}_${TYPE}.elf"
Andrew Geissler2daf84b2023-03-31 09:57:23 -050098 fi
99 fi
100 done
101 done
Brad Bishopbec4ebc2022-08-03 09:55:16 -0400102}
103
104FILES:${PN} = "/firmware"
105SYSROOT_DIRS += "/firmware"
106
107FILES:${PN}-dbg += "/firmware/*.elf"
Andrew Geissler2daf84b2023-03-31 09:57:23 -0500108# These binaries are specifically for 32-bit arm
109INSANE_SKIP:${PN}-dbg += "arch"
Brad Bishopbec4ebc2022-08-03 09:55:16 -0400110INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
111INHIBIT_PACKAGE_STRIP = "1"
112
113do_deploy() {
114 # Copy the images to deploy directory
115 cp -rf ${D}/firmware/* ${DEPLOYDIR}/
116}
117addtask deploy after do_install