blob: 9a6cf009555de35de8ce535b79e22d48da687d82 [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/nxp_sdk.gni")
import("//build_overrides/mbedtls.gni")
import("${nxp_sdk_build_root}/nxp_sdk.gni")
import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni")
import("${mbedtls_root}/mbedtls.gni")
declare_args() {
# Build target to use for k32w1 SDK. Use this to set global SDK defines.
k32w1_sdk_target = ""
}
assert(k32w1_sdk_target != "", "k32w1_sdk_target must be specified")
group("nxp_sdk") {
public_deps = [ k32w1_sdk_target ]
}
config("mbedtls_k32w1_config") {
defines = [
"MBEDTLS_CONFIG_FILE=<third_party/openthread/repo/third_party/mbedtls/mbedtls-config.h>",
"MBEDTLS_USER_CONFIG_FILE=<src/platform/nxp/k32w/k32w1/k32w1-chip-mbedtls-config.h>",
# These options should really be in the config.h...
"MBEDTLS_FREESCALE_FREERTOS_CALLOC_ALT=1",
"MBEDTLS_THREADING_C=1",
"MBEDTLS_THREADING_ALT=1",
"MBEDTLS_X509_CSR_WRITE_C",
"MBEDTLS_X509_CREATE_C",
"MBEDTLS_PEM_WRITE_C",
"MBEDTLS_HKDF_C",
"MBEDTLS_ERROR_C",
"MBEDTLS_PKCS5_C",
"MBEDTLS_ECP_FIXED_POINT_OPTIM=0", # To reduce peak memory usage
"MBEDTLS_MPI_WINDOW_SIZE=1",
"MBEDTLS_ECP_WINDOW_SIZE=2",
"MBEDTLS_MPI_MAX_SIZE=32", # Maximum number of bytes for usable MPIs.
"MBEDTLS_ECP_MAX_BITS=256", # Maximum bit size of groups */
"MBEDTLS_ENTROPY_MAX_SOURCES=1", # Maximum number of sources supported
"MBEDTLS_ENTROPY_HARDWARE_ALT",
]
if (chip_mdns == "none") {
defines += [
"MBEDTLS_PK_WRITE_C",
"MBEDTLS_OID_C",
"MBEDTLS_BASE64_C",
]
}
if (chip_crypto == "platform") {
defines += [
# "MBEDTLS_CCM_ALT",
]
}
include_dirs = [ chip_root ]
}
mbedtls_target("mbedtls") {
sources = [
"${k32w1_sdk_root}/middleware/mbedtls/port/sssapi/ccm_alt.c",
"${k32w1_sdk_root}/middleware/mbedtls/port/sssapi/entropy_poll_alt.c",
]
public_configs = [ ":mbedtls_k32w1_config" ]
public_deps = [
":nxp_sdk",
"${chip_root}/third_party/openthread/platforms/nxp/k32w/k32w1:openthread_mbedtls_config_k32w1",
]
}