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