blob: 4828fb552e07aa58c85e733f7ac6c68b972694ad [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
9SRC_URI = "gitsm://github.com/ARM-software/SCP-firmware.git;protocol=https;branch=master"
10
11SRCREV = "673d014f3861ad81cc5ab06d2884a314a610799b"
12
13PROVIDES += "virtual/control-processor-firmware"
14
15SCP_BUILD_RELEASE ?= "1"
16SCP_PLATFORM ?= "invalid"
17SCP_COMPILER ?= "arm-none-eabi"
18SCP_LOG_LEVEL ?= "WARN"
19SCP_PLATFORM_FEATURE_SET ?= "0"
20
21INHIBIT_DEFAULT_DEPS = "1"
22DEPENDS = "virtual/arm-none-eabi-gcc-native \
23 cmake-native \
24 ninja-native \
25 "
26
27# For now we only build with GCC, so stop meta-clang trying to get involved
28TOOLCHAIN = "gcc"
29
30SCP_BUILD_STR = "${@bb.utils.contains('SCP_BUILD_RELEASE', '1', 'release', 'debug', d)}"
31
32inherit deploy
33
34B = "${WORKDIR}/build"
35S = "${WORKDIR}/git"
36
37# Allow platform specific copying of only scp or both scp & mcp, default to both
38FW_TARGETS ?= "scp mcp"
39FW_INSTALL ?= "ramfw romfw"
40PACKAGE_ARCH = "${MACHINE_ARCH}"
41COMPATIBLE_MACHINE ?= "invalid"
42
43LDFLAGS[unexport] = "1"
44CFLAGS[unexport] = "1"
45
46EXTRA_OECMAKE = "-D CMAKE_BUILD_TYPE=${SCP_BUILD_STR} \
47 -D SCP_LOG_LEVEL=${SCP_LOG_LEVEL} \
48 -D SCP_PLATFORM_FEATURE_SET=${SCP_PLATFORM_FEATURE_SET} \
49 "
50
51do_configure() {
52 for FW in ${FW_TARGETS}; do
53 for TYPE in ${FW_INSTALL}; do
54 cmake -GNinja ${EXTRA_OECMAKE} -S ${S} -B "${B}/${TYPE}/${FW}" -D SCP_FIRMWARE_SOURCE_DIR="${SCP_PLATFORM}/${FW}_${TYPE}"
55 done
56 done
57}
58
59do_configure[cleandirs] += "${B}"
60
61do_compile() {
62 for FW in ${FW_TARGETS}; do
63 for TYPE in ${FW_INSTALL}; do
64 cmake --build ${B}/${TYPE}/${FW} --target all
65 done
66 done
67}
68
69do_install() {
70 install -d ${D}/firmware
71 for TYPE in ${FW_INSTALL}; do
72 for FW in ${FW_TARGETS}; do
73 if [ "$TYPE" = "romfw" ]; then
74 if [ "$FW" = "scp" ]; then
75 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-bl1.bin" "${D}/firmware/${FW}_${TYPE}.bin"
76 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-bl1" "${D}/firmware/${FW}_${TYPE}.elf"
77 elif [ "$FW" = "mcp" ]; then
78 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-mcp-bl1.bin" "${D}/firmware/${FW}_${TYPE}.bin"
79 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-mcp-bl1" "${D}/firmware/${FW}_${TYPE}.elf"
80 fi
81 elif [ "$TYPE" = "ramfw" ]; then
82 if [ "$FW" = "scp" ]; then
83 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-bl2.bin" "${D}/firmware/${FW}_${TYPE}.bin"
84 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-bl2" "${D}/firmware/${FW}_${TYPE}.elf"
85 elif [ "$FW" = "mcp" ]; then
86 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-mcp-bl2.bin" "${D}/firmware/${FW}_${TYPE}.bin"
87 install -D "${B}/${TYPE}/${FW}/bin/${SCP_PLATFORM}-mcp-bl2" "${D}/firmware/${FW}_${TYPE}.elf"
88 fi
89 fi
90 done
91 done
92}
93
94FILES:${PN} = "/firmware"
95SYSROOT_DIRS += "/firmware"
96
97FILES:${PN}-dbg += "/firmware/*.elf"
98# Skip QA check for relocations in .text of elf binaries
99INSANE_SKIP:${PN}-dbg = "arch textrel"
100INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
101INHIBIT_PACKAGE_STRIP = "1"
102
103do_deploy() {
104 # Copy the images to deploy directory
105 cp -rf ${D}/firmware/* ${DEPLOYDIR}/
106}
107addtask deploy after do_install