blob: c1415af3743f933cfb5f716e34356f61d349cc17 [file] [log] [blame]
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/chip.gni")
import("//build_overrides/jlink.gni")
import("//build_overrides/mbedtls.gni")
import("//build_overrides/openthread.gni")
import("//build_overrides/qpg_sdk.gni")
declare_args() {
# Location of the QPG SDK.
qpg_sdk_root = "${chip_root}/third_party/qpg_sdk/repo"
# subdirectory in qpg_sdk_root where the binary library builds (.a) are to be found
qpg_sdk_lib_dir = "Work"
# Target IC for QPG SDK
qpg_target_ic = "qpg6105"
# an option to disable referencing qorvo object archive files (*.a)
qpg_sdk_include_platform_libs = true
}
assert(qpg_sdk_root != "", "qpg_sdk_root must be specified")
assert(qpg_target_ic != "", "qpg_target_ic must be specified")
# Defines an QPG SDK build target.
#
# Parameters:
# qpg_sdk_root - The location of the QPG SDK.
# sources - The sources files to build.
template("qpg_sdk") {
if (defined(invoker.qpg_sdk_root)) {
qpg_sdk_root = invoker.qpg_sdk_root
}
if (defined(invoker.qpg_target_ic)) {
qpg_target_ic = invoker.qpg_target_ic
}
assert(qpg_sdk_root != "", "qpg_sdk_root must be specified")
assert(qpg_target_ic != "", "qpg_target_ic must be specified")
sdk_target_name = target_name
config("${sdk_target_name}_config") {
include_dirs = []
libs = []
if (defined(invoker.include_dirs)) {
include_dirs += invoker.include_dirs
}
include_dirs += [
"${qpg_sdk_root}/Components/Qorvo/Matter/qvCHIP/inc",
"${qpg_sdk_root}/Components/Qorvo/BSP/qvIO/inc",
"${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/inc",
"${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt",
"${mbedtls_root}/repo/include",
"${openthread_root}/include",
]
lib_dirs = []
#MBed TLS built from third_party/mbedtls tree - OT config not used
defines = [
"QORVO_CRYPTO_ENGINE",
"MBEDTLS_CONFIG_FILE=\"${qpg_target_ic}-mbedtls-config.h\"",
]
cflags = []
# Allow warning due to mbedtls
cflags += [
"-Wno-maybe-uninitialized",
"-Wno-shadow",
]
if (defined(invoker.defines)) {
defines += invoker.defines
}
}
source_set(sdk_target_name) {
sources = [
"${qpg_sdk_root}/Applications/Matter/shared/config/inc/FreeRTOSConfig.h",
"${qpg_sdk_root}/Applications/Matter/shared/config/src/hooks.c",
]
chip_glue_sources = [
#
"${qpg_sdk_root}/Components/Qorvo/BSP/qvIO/inc/qvIO.h",
"${qpg_sdk_root}/Components/Qorvo/Matter/qvCHIP/inc/qvCHIP.h",
]
sources += chip_glue_sources
mbedtls_alt_sources = [
# Add alt src
"${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/aes_alt.h",
"${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ccm_alt.h",
"${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ecjpake_alt.h",
"${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ecp_alt.h",
"${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/sha256_alt.h",
"${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/inc/${qpg_target_ic}-mbedtls-config.h",
"${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/src/trng.c",
]
mbedtls_sources = [
"${chip_root}/third_party/mbedtls/repo/library/asn1parse.c",
"${chip_root}/third_party/mbedtls/repo/library/asn1write.c",
"${chip_root}/third_party/mbedtls/repo/library/bignum.c",
"${chip_root}/third_party/mbedtls/repo/library/ccm.c",
"${chip_root}/third_party/mbedtls/repo/library/cipher.c",
"${chip_root}/third_party/mbedtls/repo/library/cipher_wrap.c",
"${chip_root}/third_party/mbedtls/repo/library/ctr_drbg.c",
"${chip_root}/third_party/mbedtls/repo/library/ecdsa.c",
"${chip_root}/third_party/mbedtls/repo/library/entropy.c",
"${chip_root}/third_party/mbedtls/repo/library/hkdf.c",
"${chip_root}/third_party/mbedtls/repo/library/hmac_drbg.c",
"${chip_root}/third_party/mbedtls/repo/library/md.c",
"${chip_root}/third_party/mbedtls/repo/library/oid.c",
"${chip_root}/third_party/mbedtls/repo/library/pk.c",
"${chip_root}/third_party/mbedtls/repo/library/pk_wrap.c",
"${chip_root}/third_party/mbedtls/repo/library/pkcs5.c",
"${chip_root}/third_party/mbedtls/repo/library/pkparse.c",
"${chip_root}/third_party/mbedtls/repo/library/pkwrite.c",
"${chip_root}/third_party/mbedtls/repo/library/platform.c",
"${chip_root}/third_party/mbedtls/repo/library/platform_util.c",
"${chip_root}/third_party/mbedtls/repo/library/sha1.c",
"${chip_root}/third_party/mbedtls/repo/library/sha256.c",
"${chip_root}/third_party/mbedtls/repo/library/x509_create.c",
"${chip_root}/third_party/mbedtls/repo/library/x509write_csr.c",
]
sources += mbedtls_sources + mbedtls_alt_sources
if (defined(invoker.sources)) {
sources += invoker.sources
}
public_configs = [ ":${sdk_target_name}_config" ]
public_deps = [ "${chip_root}/third_party/qpg_sdk:freertos" ]
if (qpg_sdk_include_platform_libs) {
public_deps += [
"${chip_root}/third_party/qpg_sdk:qpg_bootloader_lib",
"${chip_root}/third_party/qpg_sdk:qpg_glue_lib",
"${chip_root}/third_party/qpg_sdk:qpg_mbedtls_alt_lib",
"${chip_root}/third_party/qpg_sdk:qpg_openthread_glue_lib",
"${chip_root}/third_party/qpg_sdk:qpg_stack_lib",
]
}
}
}