Skip to content

Commit

Permalink
Build Qorvo libraries, use QMatter v0.9.0.0-libs
Browse files Browse the repository at this point in the history
Build Qorvo libraries instead of using binary artifacts
Reduce mbedtls sources list
Use ld path without '_mrom' in the name
use compiler executables from $PATH
  • Loading branch information
q-thla committed Sep 28, 2022
1 parent dc66d4e commit a6b2310
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 103 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
branch = master
[submodule "qpg_sdk"]
path = third_party/qpg_sdk/repo
url = https://github.com/Qorvo/qpg-connectedhomeip
branch = master
url = https://github.com/Qorvo/QMatter
branch = v0.9.0.0-libs
platforms = qpg
[submodule "zap"]
path = third_party/zap/repo
Expand Down
4 changes: 0 additions & 4 deletions third_party/openthread/platforms/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ source_set("libopenthread-qpg") {
]
include_dirs += [ "${openthread_root}/examples/apps" ]

if (qpg_sdk_include_platform_libs) {
libs = [ "${qpg_sdk_root}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_${qpg_target_ic}_mtd/libOpenThreadQorvoGlue_${qpg_target_ic}_mtd.a" ]
}

public_deps = [
":openthread_core_config_qpg",
"${openthread_root}/src/core:libopenthread_core_headers",
Expand Down
131 changes: 131 additions & 0 deletions third_party/qpg_sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,134 @@ freertos_target("freertos") {

public_configs = [ ":qpg_freertos_config" ]
}

template("qpg_make_build") {
forward_variables_from(invoker,
[
"make_sources",
"make_args",
"make_output",
])
action(target_name) {
script = "make.py"
sources = make_sources
outputs = make_output
args = [
"-s",

#use PATH variable lookup for compiler
"TOOLCHAIN=",
]
args += make_args
}
}

qpg_make_build("qpg_mbedtls_alt") {
make_sources = [ "${qpg_sdk_root}/Components/ThirdParty/Silex" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/mbedtls_alt_${qpg_target_ic}/libmbedtls_alt_${qpg_target_ic}.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) +
"/Libraries/Qorvo/mbedtls_alt/Makefile.mbedtls_alt_${qpg_target_ic}",
"MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/mbedtls/repo",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/mbedtls_alt_${qpg_target_ic}",
]
}

static_library("qpg_mbedtls_alt_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_mbedtls_alt" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/mbedtls_alt_${qpg_target_ic}/libmbedtls_alt_${qpg_target_ic}.a" ]
}

qpg_make_build("qpg_stack") {
make_sources = [ "${qpg_sdk_root}/Components/Qorvo" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/QorvoStack/libQorvoStack_${qpg_target_ic}.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) +
"/Libraries/Qorvo/QorvoStack/Makefile.QorvoStack_${qpg_target_ic}",
"FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/freertos/repo",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/QorvoStack",
]
}

static_library("qpg_stack_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_stack" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/QorvoStack/libQorvoStack_${qpg_target_ic}.a" ]
}

qpg_make_build("qpg_glue") {
make_sources = [ "${qpg_sdk_root}/Components/Qorvo/Matter" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/MatterQorvoGlue/libMatterQorvoGlue_${qpg_target_ic}_libbuild.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) + "/Libraries/Qorvo/MatterQorvoGlue/Makefile.MatterQorvoGlue_${qpg_target_ic}_libbuild",
"FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/freertos/repo",
"MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/mbedtls/repo",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/MatterQorvoGlue",
]
}
static_library("qpg_glue_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_glue" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/MatterQorvoGlue/libMatterQorvoGlue_${qpg_target_ic}_libbuild.a" ]
}

# openthread toevoegen
# bootloader build
#
qpg_make_build("qpg_bootloader") {
make_sources = [ "${qpg_sdk_root}/Libraries/Qorvo/Bootloader" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/Bootloader_${qpg_target_ic}_compr_secure/libBootloader_${qpg_target_ic}_compr_secure.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) + "/Libraries/Qorvo/Bootloader/Makefile.Bootloader_${qpg_target_ic}_compr_secure",
"FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/freertos/repo",
"MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/mbedtls/repo",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/Bootloader_${qpg_target_ic}_compr_secure",
"UMB_WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/UMB_QPG6105DK_B01_nrt_flash_compr_secure",
]
}
config("qpg_retain_bootloader") {
ldflags = [
"-Wl,-u_binary_bl_userlicense_bin_start",
"-Wl,-u_binary_bootloader_bin_start",
]
}

static_library("qpg_bootloader_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_bootloader" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/Bootloader_${qpg_target_ic}_compr_secure/libBootloader_${qpg_target_ic}_compr_secure.a" ]
public_configs = [ ":qpg_retain_bootloader" ]
}

qpg_make_build("qpg_openthread_glue") {
make_sources = [ "${qpg_sdk_root}/Components/Qorvo/Matter" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_mtd/libOpenThreadQorvoGlue_${qpg_target_ic}_mtd.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) + "/Libraries/Qorvo/OpenThreadQorvoGlue/Makefile.OpenThreadQorvoGlue_${qpg_target_ic}_mtd",
"FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/freertos/repo",
"MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/mbedtls/repo",
"OPENTHREAD_REPO_DIR =" + rebase_path(chip_root, root_build_dir) +
"/third_party/openthread/repo",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_${qpg_target_ic}_mtd",
]
}
static_library("qpg_openthread_glue_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_openthread_glue" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_mtd/libOpenThreadQorvoGlue_${qpg_target_ic}_mtd.a" ]
}
23 changes: 23 additions & 0 deletions third_party/qpg_sdk/make.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
#
# Copyright (c) 2022 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.
#

'''Python wrapper to call make based builds within the SDK
'''
import subprocess
import sys

subprocess.run(['make', '-j'] + sys.argv[1:], check=True)
129 changes: 33 additions & 96 deletions third_party/qpg_sdk/qpg_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ declare_args() {
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
# for connectedhomeip-qpg: Binaries (default)
# for matter endnodes sdk: Work
qpg_sdk_lib_dir = "Binaries"
qpg_sdk_lib_dir = "Work"

# Target IC for QPG SDK
qpg_target_ic = "qpg6105"
Expand Down Expand Up @@ -69,28 +67,12 @@ template("qpg_sdk") {
"${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",
"${qpg_sdk_root}/Components/ThirdParty/Lwip",
"${qpg_sdk_root}/Components/ThirdParty/Lwip/arch",
"${mbedtls_root}/repo/include",
"${openthread_root}/include",
]

lib_dirs = []

if (qpg_sdk_include_platform_libs) {
libs += [
"${qpg_sdk_root}/${qpg_sdk_lib_dir}/MatterQorvoGlue_${qpg_target_ic}_libbuild/libMatterQorvoGlue_${qpg_target_ic}_libbuild.a",
"${qpg_sdk_root}/${qpg_sdk_lib_dir}/QorvoStack_${qpg_target_ic}/libQorvoStack_${qpg_target_ic}.a",
"${qpg_sdk_root}/${qpg_sdk_lib_dir}/mbedtls_alt_${qpg_target_ic}/libmbedtls_alt_${qpg_target_ic}.a",
"${qpg_sdk_root}/${qpg_sdk_lib_dir}/Bootloader_${qpg_target_ic}_compr_secure/libBootloader_${qpg_target_ic}_compr_secure.a",
]
}

ldflags = [
"-Wl,-u_binary_bl_userlicense_bin_start",
"-Wl,-u_binary_bootloader_bin_start",
]

#MBed TLS built from third_party/mbedtls tree - OT config not used
defines = [
"QORVO_CRYPTO_ENGINE",
Expand All @@ -111,114 +93,69 @@ template("qpg_sdk") {

source_set(sdk_target_name) {
sources = [
"${chip_root}/third_party/mbedtls/repo/include/mbedtls/platform.h",
"${chip_root}/third_party/mbedtls/repo/library/aes.c",
"${chip_root}/third_party/mbedtls/repo/library/aesni.c",
"${chip_root}/third_party/mbedtls/repo/library/arc4.c",
"${chip_root}/third_party/mbedtls/repo/library/aria.c",
"${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/base64.c",
"${chip_root}/third_party/mbedtls/repo/library/bignum.c",
"${chip_root}/third_party/mbedtls/repo/library/blowfish.c",
"${chip_root}/third_party/mbedtls/repo/library/camellia.c",
"${chip_root}/third_party/mbedtls/repo/library/ccm.c",
"${chip_root}/third_party/mbedtls/repo/library/certs.c",
"${chip_root}/third_party/mbedtls/repo/library/chacha20.c",
"${chip_root}/third_party/mbedtls/repo/library/chachapoly.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/cmac.c",
"${chip_root}/third_party/mbedtls/repo/library/constant_time.c",
"${chip_root}/third_party/mbedtls/repo/library/ctr_drbg.c",
"${chip_root}/third_party/mbedtls/repo/library/debug.c",
"${chip_root}/third_party/mbedtls/repo/library/des.c",
"${chip_root}/third_party/mbedtls/repo/library/dhm.c",
"${chip_root}/third_party/mbedtls/repo/library/ecdh.c",
"${chip_root}/third_party/mbedtls/repo/library/ecdsa.c",
"${chip_root}/third_party/mbedtls/repo/library/ecjpake.c",
"${chip_root}/third_party/mbedtls/repo/library/ecp.c",
"${chip_root}/third_party/mbedtls/repo/library/ecp_curves.c",
"${chip_root}/third_party/mbedtls/repo/library/entropy.c",
"${chip_root}/third_party/mbedtls/repo/library/entropy_poll.c",
"${chip_root}/third_party/mbedtls/repo/library/error.c",
"${chip_root}/third_party/mbedtls/repo/library/gcm.c",
"${chip_root}/third_party/mbedtls/repo/library/havege.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/md2.c",
"${chip_root}/third_party/mbedtls/repo/library/md4.c",
"${chip_root}/third_party/mbedtls/repo/library/md5.c",
"${chip_root}/third_party/mbedtls/repo/library/memory_buffer_alloc.c",
"${chip_root}/third_party/mbedtls/repo/library/net_sockets.c",
"${chip_root}/third_party/mbedtls/repo/library/nist_kw.c",
"${chip_root}/third_party/mbedtls/repo/library/oid.c",
"${chip_root}/third_party/mbedtls/repo/library/padlock.c",
"${chip_root}/third_party/mbedtls/repo/library/pem.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/pkcs11.c",
"${chip_root}/third_party/mbedtls/repo/library/pkcs12.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/poly1305.c",
"${chip_root}/third_party/mbedtls/repo/library/psa_crypto.c",
"${chip_root}/third_party/mbedtls/repo/library/psa_crypto_driver_wrappers.c",
"${chip_root}/third_party/mbedtls/repo/library/psa_crypto_se.c",
"${chip_root}/third_party/mbedtls/repo/library/psa_crypto_slot_management.c",
"${chip_root}/third_party/mbedtls/repo/library/psa_crypto_storage.c",
"${chip_root}/third_party/mbedtls/repo/library/psa_its_file.c",
"${chip_root}/third_party/mbedtls/repo/library/ripemd160.c",
"${chip_root}/third_party/mbedtls/repo/library/rsa.c",
"${chip_root}/third_party/mbedtls/repo/library/rsa_internal.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/sha512.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_cache.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_ciphersuites.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_cli.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_cookie.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_msg.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_srv.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_ticket.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_tls.c",
"${chip_root}/third_party/mbedtls/repo/library/ssl_tls13_keys.c",
"${chip_root}/third_party/mbedtls/repo/library/threading.c",
"${chip_root}/third_party/mbedtls/repo/library/timing.c",
"${chip_root}/third_party/mbedtls/repo/library/version.c",
"${chip_root}/third_party/mbedtls/repo/library/version_features.c",
"${chip_root}/third_party/mbedtls/repo/library/x509.c",
"${chip_root}/third_party/mbedtls/repo/library/x509_create.c",
"${chip_root}/third_party/mbedtls/repo/library/x509_crl.c",
"${chip_root}/third_party/mbedtls/repo/library/x509_crt.c",
"${chip_root}/third_party/mbedtls/repo/library/x509_csr.c",
"${chip_root}/third_party/mbedtls/repo/library/x509write_crt.c",
"${chip_root}/third_party/mbedtls/repo/library/x509write_csr.c",
"${chip_root}/third_party/mbedtls/repo/library/xtea.c",
"${qpg_sdk_root}/Applications/Matter/shared/config/inc/FreeRTOSConfig.h",
"${qpg_sdk_root}/Applications/Matter/shared/config/src/hooks.c",
"${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_hardware_poll
"${qpg_sdk_root}/Components/Qorvo/BSP/qvIO/inc/qvIO.h",
"${qpg_sdk_root}/Components/Qorvo/Matter/qvCHIP/inc/qvCHIP.h",
]
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",
]
}
}
}
2 changes: 1 addition & 1 deletion third_party/qpg_sdk/repo
Submodule repo updated from 35ccb3 to e92a7e

0 comments on commit a6b2310

Please sign in to comment.