| # Copyright (c) 2023 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/asr.gni") |
| import("${asr_sdk_build_root}/asr_sdk.gni") |
| import("${chip_root}/src/platform/ASR/args.gni") |
| |
| declare_args() { |
| # Build target to use for asr SDK. Use this to set global SDK defines. |
| asr_target_project = "" |
| } |
| |
| assert(asr_target_project != "", "asr_target_project must be specified") |
| |
| # Add includes, cflags, asmflags, etc in config |
| config("asr_sdk_config") { |
| _include_dirs = [ |
| "${asr_sdk_build_root}/asr_sdk/config", |
| "${asr_sdk_build_root}/asr_sdk/config/lwip_if", |
| "${asr_sdk_build_root}/asr_sdk/matter", |
| "${asr_sdk_build_root}/asr_sdk/freertos/Source/include", |
| "${asr_sdk_build_root}/asr_sdk/freertos/Source/portable/MemMang", |
| "${asr_sdk_build_root}/asr_sdk/freertos/Source/portable/GCC/ARM_CM4F", |
| "${asr_sdk_build_root}/asr_sdk/lib/wifi", |
| "${asr_sdk_build_root}/asr_sdk/lib/ble", |
| "${asr_sdk_build_root}/asr_sdk/lib/sys", |
| "${asr_sdk_build_root}/asr_sdk/lib/security", |
| "${asr_sdk_build_root}/asr_sdk/version", |
| "${asr_sdk_build_root}/asr_sdk/peripheral/duet/inc", |
| "${asr_sdk_build_root}/asr_sdk/common/duet", |
| "${asr_sdk_build_root}/asr_sdk/common/duet/easylogger", |
| "${asr_sdk_build_root}/asr_sdk/security/duet/inc", |
| "${asr_sdk_build_root}/asr_sdk/platform/duet", |
| "${asr_sdk_build_root}/asr_sdk/platform/duet/CMSIS/Include", |
| "${asr_sdk_build_root}/asr_sdk/platform/duet/system/include", |
| "${asr_sdk_build_root}/asr_sdk/platform/duet/kv/include", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_2.1.2/include", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_2.1.2/port/include", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_2.1.2/include/lwip", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_app", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_app/lwip_app_ping", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_2.1.2/include/lwip/prot", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_2.1.2/include/netif", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_app/iperf", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_app/ota", |
| "${asr_sdk_build_root}/asr_sdk/lwip/mbedtls-mbedtls-2.18/include", |
| "${asr_sdk_build_root}/asr_sdk/lwip/mbedtls-mbedtls-2.18/include/mbedtls", |
| "${asr_sdk_build_root}/asr_sdk/lwip/mbedtls-mbedtls-2.18/asr_mbedtls/", |
| "${asr_sdk_build_root}/asr_sdk/lwip/mbedtls-mbedtls-2.18/asr_mbedtls/alt", |
| "${asr_sdk_build_root}/asr_sdk/demo/matter_demo/app/ble_demo/duet_hl_matter", |
| "${asr_sdk_build_root}/asr_sdk/platform/duet/kv/include", |
| ] |
| |
| # Also add project include path (passed in from project build) |
| proj_path = get_label_info(asr_target_project, "dir") |
| _include_dirs += [ "/" + rebase_path("${proj_path}/include", "/", ".") ] |
| |
| cflags = [] |
| foreach(include_dir, _include_dirs) { |
| cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] |
| } |
| |
| # Pull out defines from generated json |
| defines = [ |
| "_SPI_FLASH_240MHz_", |
| "DCDC_PFMMODE_CLOSE", |
| "LEGA_A0V2", |
| "DUET_CM4", |
| "_SPI_FLASH_ENABLE_", |
| "SYSTEM_SUPPORT_OS", |
| "WIFI_DEVICE", |
| "CFG_BATX=1", |
| "CFG_BARX=1", |
| "CFG_REORD_BUF=4", |
| "CFG_SPC=4", |
| "CFG_TXDESC0=4", |
| "CFG_TXDESC1=4", |
| "CFG_TXDESC2=4", |
| "CFG_TXDESC3=4", |
| "CFG_TXDESC4=4", |
| "CFG_CMON", |
| "CFG_MDM_VER_V21", |
| "CFG_SOFTAP_SUPPORT", |
| "CFG_SNIFFER_SUPPORT", |
| "CFG_CUS_FRAME", |
| "AT_USER_DEBUG", |
| "CFG_WF_DBG=1", |
| "__FPU_PRESENT=1", |
| "DX_CC_TEE", |
| "HASH_SHA_512_SUPPORTED", |
| "CC_HW_VERSION=0xF0", |
| "DLLI_MAX_BUFF_SIZE=0x10000", |
| "SSI_CONFIG_TRNG_MODE=0", |
| "LWIP_APP_IPERF", |
| "SYSTEM_RECOVERY", |
| "LWIP_DUALSTACK", |
| "SYSTEM_COREDUMP", |
| "CFG_REC", |
| "CFG_SNIFFER_UNICAST_SUPPORT", |
| "CFG_OS_VERSION_CHECK", |
| "PS_CLOSE_APLL", |
| "CFG_STA_AP_COEX_N", |
| "CFG_SOFTAP_SWITCH_CHAN_N", |
| "CFG_PLF_DUET", |
| "SONATA_RTOS_SUPPORT", |
| "CFG_SEG", |
| "CFG_DUET_FREERTOS", |
| "PRINTF2_SUPPORT", |
| "DUET_RF_SLEEP", |
| "CFG_DUET_BLE", |
| "CFG_RTC_INDEPENDENT", |
| "CFG_SAE", |
| "CFG_SAE_AUTH_OPT", |
| "CFG_MFP", |
| "CONFIG_IEEE80211W", |
| "WFA_CERTIFICATE_N", |
| "CFG_DUET_5822S", |
| "CFG_DUET_5822T", |
| "MBEDTLS_HW", |
| "MBEDTLS_HW_RSA", |
| "MBEDTLS_HW_ECC", |
| "MBEDTLS_HW_AES", |
| "MBEDTLS_HW_HASH", |
| "MBEDTLS_USER_CONFIG_FILE=<mbedtls_user_config.h>", |
| "CONFIG_ENABLE_ASR_LEGA_RTOS=1", |
| "CFG_EASY_LOG_ENABLE=1", |
| "CFG_EASY_LOG_MODULE_EN=1", |
| ] |
| |
| cflags_c = [ |
| "-mcpu=cortex-m4", |
| "-Os", |
| "-mfloat-abi=softfp", |
| "-mfpu=fpv4-sp-d16", |
| "-mthumb", |
| "-ffunction-sections", |
| "-fdata-sections", |
| "-g", |
| "-Wall", |
| ] |
| |
| cflags_cc = cflags_c |
| |
| asmflags = cflags_c |
| |
| ldflags = cflags_c |
| |
| cflags_c += [ |
| "-Wno-sign-compare", |
| "-Wno-unused-function", |
| "-Wno-pointer-sign", |
| "-Wno-type-limits", |
| ] |
| |
| ldflags += [ "-Wl,--gc-sections" ] |
| |
| libs = [ |
| "${chip_root}/third_party/asr/${asr_ic_family}/asr_sdk/lib/5822s/libasr_combo_v6.a", |
| "${chip_root}/third_party/asr/${asr_ic_family}/asr_sdk/lib/ble/lib_ble_mesh.a", |
| "${chip_root}/third_party/asr/${asr_ic_family}/asr_sdk/lib/security/lib_security.a", |
| ] |
| |
| linker_script_flags = |
| "${asr_sdk_build_root}/asr_sdk/demo/matter_demo/app/ld/5822t/gcc.ld" |
| ldflags += [ "-T" + rebase_path(linker_script_flags, root_build_dir) ] |
| ble_symbol_flags = "${asr_sdk_build_root}/asr_sdk/lib/ble/asr_ble_rom_symbol_v20200507204845.txt" |
| ldflags += [ "-Wl,-R" + rebase_path(ble_symbol_flags, root_build_dir) ] |
| } |
| |
| group("asr_build") { |
| public_configs = [ ":asr_sdk_config" ] |
| public_deps = [ asr_target_project ] |
| } |