14c4212e9SVincent Guittot# SCMI server library is built from SCP-firmware source tree. 24c4212e9SVincent Guittot# The firmware is made of a framework, a product and modules. 34c4212e9SVincent Guittot# Only modules used by firmware must be built, as stated by 4bf870398SVincent Guittot# CFG_SCPFW_MOD_* switches. SCP-firmware needs a C source and 54c4212e9SVincent Guittot# a header file to be generated to describe embedded modules. 64c4212e9SVincent Guittot# This is done through cmake configuration of the package. 74c4212e9SVincent Guittot# The toolchain build directive must also match the list of 84c4212e9SVincent Guittot# embedded modules. 94c4212e9SVincent Guittot 104c4212e9SVincent Guittotscpfw-path = $(CFG_SCP_FIRMWARE) 11bf870398SVincent Guittotscpfw-product = optee/$(CFG_SCMI_SCPFW_PRODUCT) 124c4212e9SVincent Guittotscpfw-out-path := $(out-dir)/$(libdir) 134c4212e9SVincent Guittot 144c4212e9SVincent Guittotscpfw-integ-version-maj = 2 15bf870398SVincent Guittotscpfw-integ-version-min = 14 164c4212e9SVincent Guittotscpfw-integ-version-pat = 0 174c4212e9SVincent Guittotscpfw-integ-version = $(scpfw-integ-version-maj).$(scpfw-integ-version-min).$(scpfw-integ-version-pat) 184c4212e9SVincent Guittot 194c4212e9SVincent Guittotsrcs-y += scmi_server.c 20*ce6ea411SValentin Caronsrcs-$(CFG_SCMI_SCPFW_FROM_DT) += scmi_server_scpfw.c 214c4212e9SVincent Guittotincdirs-y += include 224c4212e9SVincent Guittot 234c4212e9SVincent Guittot# SCP-firmware cmake configuration generates header fwk_module_idx.h and 244c4212e9SVincent Guittot# source files fwk_module_list.c needed for scp-firmware compilation. 254c4212e9SVincent Guittotscpfw-cmake-flags-y = -DSCP_FIRMWARE_SOURCE_DIR:PATH=$(scpfw-product)/fw \ 264c4212e9SVincent Guittot -DSCP_LOG_LEVEL="TRACE" \ 274c4212e9SVincent Guittot -DDISABLE_CPPCHECK=1 \ 284c4212e9SVincent Guittot -DCFG_NUM_THREADS=$(CFG_NUM_THREADS) \ 29ecaf032bSGatien Chevallier -DSCP_OPTEE_DIR:PATH=$(CURDIR) 304c4212e9SVincent Guittot 3108204d7eSEtienne Carriere# CMake does not need to check the cross compilation toolchain since we do not 3208204d7eSEtienne Carriere# compile any source file with CMake, we only generate some SCP-firmware 3308204d7eSEtienne Carriere# files. 3408204d7eSEtienne Carrierescpfw-cmake-flags-y += -DCMAKE_C_COMPILER_WORKS=1 3508204d7eSEtienne Carriere 364c4212e9SVincent Guittotifeq ($(cmd-echo-silent),true) 374c4212e9SVincent Guittotscpfw-cmake-redirect = >/dev/null 384c4212e9SVincent Guittotendif 394c4212e9SVincent Guittot 404c4212e9SVincent Guittotgensrcs-y += fwk_module_list 414c4212e9SVincent Guittotforce-gensrc-fwk_module_list := y 424c4212e9SVincent Guittotproduce-fwk_module_list = build/framework/src/fwk_module_list.c 434c4212e9SVincent Guittotrecipe-fwk_module_list = cmake -S $(scpfw-path) -B $(scpfw-out-path)/build \ 444c4212e9SVincent Guittot $(scpfw-cmake-flags-y) --log-level=WARNING $(scpfw-cmake-redirect) 454c4212e9SVincent Guittotdepends-fwk_module_list = $(scpfw-path)/product/$(scpfw-product)/fw/Firmware.cmake $(conf-file) 464c4212e9SVincent Guittot# Include path of generated header file fwk_module_idx.h 474c4212e9SVincent Guittotincdirs_ext-y += $(scpfw-out-path)/build/framework/include 484c4212e9SVincent Guittot 494c4212e9SVincent Guittotcppflags-lib-y += -DBUILD_VERSION_MAJOR=$(scpfw-integ-version-maj) \ 504c4212e9SVincent Guittot -DBUILD_VERSION_MINOR=$(scpfw-integ-version-min) \ 514c4212e9SVincent Guittot -DBUILD_VERSION_PATCH=$(scpfw-integ-version-pat) 524c4212e9SVincent Guittot 534c4212e9SVincent Guittotscpfw-impl-version := $(shell git -C $(scpfw-path) describe --tags --always --dirty=-dev 2>/dev/null || \ 544c4212e9SVincent Guittot echo Unknown_$(scpfw-integ-version)) 554c4212e9SVincent Guittotcppflags-lib-y += -DBUILD_VERSION_DESCRIBE_STRING=\"$(scpfw-impl-version)\" 564c4212e9SVincent Guittot 574c4212e9SVincent Guittotcppflags-lib-y += -DFWK_LOG_LEVEL=$(CFG_SCPFW_LOG_LEVEL) 584c4212e9SVincent Guittotifneq ($(CFG_SCPFW_LOG_LEVEL),0) 594c4212e9SVincent Guittotcppflags-lib-y += -DFMW_LOG_MINIMAL_BANNER=1 604c4212e9SVincent Guittotendif 614c4212e9SVincent Guittot 624c4212e9SVincent Guittotcflags-lib-y += -Wno-cast-align \ 634c4212e9SVincent Guittot -Wno-nonnull-compare \ 644c4212e9SVincent Guittot -Wno-unused-parameter \ 654c4212e9SVincent Guittot -Wno-suggest-attribute=format \ 664c4212e9SVincent Guittot -Wno-declaration-after-statement 674c4212e9SVincent Guittot 684c4212e9SVincent Guittot# The below directives will be removed once SCP-firmware pull requests 694c4212e9SVincent Guittot# 728 and 732 are merged. 704c4212e9SVincent Guittotcflags-lib-y += -Wno-undef \ 714c4212e9SVincent Guittot -Wno-missing-prototypes \ 724c4212e9SVincent Guittot -Wno-missing-declarations \ 734c4212e9SVincent Guittot -Wno-unused-but-set-variable \ 744c4212e9SVincent Guittot -Wno-suggest-attribute=format 754c4212e9SVincent Guittot 764c4212e9SVincent Guittot# Notification implementation has strict aliasing issues 774c4212e9SVincent Guittotcflags-lib-$(CFG_SCPFW_NOTIFICATION) += -Wno-strict-aliasing 784c4212e9SVincent Guittot 794c4212e9SVincent Guittotcppflags-lib-y += -DBUILD_HAS_SUB_SYSTEM_MODE=1 \ 804c4212e9SVincent Guittot -DBUILD_HAS_BASE_PROTOCOL 814c4212e9SVincent Guittot 824c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_NOTIFICATION) += -DBUILD_HAS_NOTIFICATION \ 834c4212e9SVincent Guittot -DBUILD_HAS_SCMI_NOTIFICATIONS 844c4212e9SVincent Guittot 854c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_FAST_CHANNELS) += -DBUILD_HAS_FAST_CHANNELS \ 864c4212e9SVincent Guittot -DBUILD_HAS_SCMI_FAST_CHANNELS 874c4212e9SVincent Guittot 884c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_CLOCK_TREE_MGMT) += -DBUILD_HAS_CLOCK_TREE_MGMT 894c4212e9SVincent Guittot 904c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_SCMI_PERF_FAST_CHANNELS) += -DBUILD_HAS_SCMI_PERF_FAST_CHANNELS 914c4212e9SVincent Guittot 92f5b856d8SNicola Mazzucatocppflags-lib-$(CFG_SCPFW_SCMI_PERF_PROTOCOL_OPS) \ 93f5b856d8SNicola Mazzucato += -DBUILD_HAS_SCMI_PERF_PROTOCOL_OPS 94f5b856d8SNicola Mazzucato 954c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_SCMI_SENSOR_EVENTS) += -DBUILD_HAS_SCMI_SENSOR_EVENTS 964c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_SCMI_SENSOR_V2) += -DBUILD_HAS_SCMI_SENSOR_V2 \ 974c4212e9SVincent Guittot -DBUILD_HAS_SENSOR_TIMESTAMP \ 984c4212e9SVincent Guittot -DBUILD_HAS_SENSOR_MULTI_AXIS \ 994c4212e9SVincent Guittot -DBUILD_HAS_SENSOR_EXT_ATTRIBS \ 1004c4212e9SVincent Guittot -DBUILD_HAS_SENSOR_SIGNED_VALUE 1014c4212e9SVincent Guittot 1024c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_SENSOR_TIMESTAMP) += -DBUILD_HAS_SENSOR_TIMESTAMP 1034c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_SENSOR_MULTI_AXIS) += -DBUILD_HAS_SENSOR_MULTI_AXI 1044c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_SENSOR_EXT_ATTRIBS) += -DBUILD_HAS_SENSOR_EXT_ATTRIBS 1054c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_SENSOR_SIGNED_VALUE) += -DBUILD_HAS_SENSOR_SIGNED_VALUE 1064c4212e9SVincent Guittotcppflags-lib-$(CFG_SCPFW_INBAND_MSG_SUPPORT) += -DBUILD_HAS_INBAND_MSG_SUPPORT 1074c4212e9SVincent Guittot 108bf870398SVincent Guittot# Include SCP-firmware make files 109bf870398SVincent Guittotinclude $(scpfw-path)/product/optee/sub.mk 1104c4212e9SVincent Guittot 111