| # 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/at_cmd", |
| "${asr_sdk_build_root}/asr_sdk/common/alto/inc", |
| "${asr_sdk_build_root}/asr_sdk/common/alto/easylogger", |
| "${asr_sdk_build_root}/asr_sdk/freertos", |
| "${asr_sdk_build_root}/asr_sdk/freertos/Source/include", |
| "${asr_sdk_build_root}/asr_sdk/freertos/Source/portable/GCC", |
| "${asr_sdk_build_root}/asr_sdk/legartos", |
| "${asr_sdk_build_root}/asr_sdk/lib/ble", |
| "${asr_sdk_build_root}/asr_sdk/lib/security", |
| "${asr_sdk_build_root}/asr_sdk/lib/sys", |
| "${asr_sdk_build_root}/asr_sdk/lib/wifi", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_2.1.2/include", |
| "${asr_sdk_build_root}/asr_sdk/lwip/lwip_2.1.2/include/lwip", |
| "${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_2.1.2/port/include", |
| "${asr_sdk_build_root}/asr_sdk/lwip/mbedtls-mbedtls-2.18/include", |
| "${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/peripheral/asr/inc", |
| "${asr_sdk_build_root}/asr_sdk/peripheral/asr/inc/alto", |
| "${asr_sdk_build_root}/asr_sdk/peripheral/asr/inc/alto/alto", |
| "${asr_sdk_build_root}/asr_sdk/platform/alto/NMSIS/Core/Include", |
| "${asr_sdk_build_root}/asr_sdk/platform/alto/common", |
| "${asr_sdk_build_root}/asr_sdk/platform/alto/kv/include", |
| "${asr_sdk_build_root}/asr_sdk/platform/alto/system/include", |
| "${asr_sdk_build_root}/asr_sdk/projects/alto_demo/ble_demo/duet_hl_matter", |
| "${asr_sdk_build_root}/asr_sdk/version", |
| ] |
| |
| # 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 = [ |
| "ALTO_BLE_NO_BLOCK", |
| "__VTOR_PRESENT=1", |
| "CFG_DUET_BLE", |
| "CFG_REL", |
| "SONATA_RTOS_SUPPORT", |
| "CODE_USE_ALTO", |
| "_SPI_FLASH_240MHz_", |
| "DCDC_PFMMODE_CLOSE", |
| "LEGA_A0V2", |
| "_SPI_FLASH_ENABLE_", |
| "SYSTEM_SUPPORT_OS", |
| "WIFI_DEVICE", |
| "CFG_BATX=1", |
| "CFG_BARX=2", |
| "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_V30", |
| "CFG_HE", |
| "CFG_SOFTAP_SUPPORT", |
| "CFG_SNIFFER_SUPPORT", |
| "CFG_CUS_FRAME", |
| "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", |
| "SYSTEM_COREDUMP", |
| "CFG_REC", |
| "CFG_SNIFFER_UNICAST_SUPPORT", |
| "PS_CLOSE_APLL", |
| "CFG_SEG", |
| "PRINTF2_SUPPORT", |
| "AT_USER_DEBUG", |
| "CFG_PLF_RV32", |
| "SECURITY_ENGINE_INIT", |
| "DUET_RF_SLEEP", |
| "LOW_LEVEL_FLASH_RW_SUPPORT", |
| "CFG_RTC_INDEPENDENT", |
| "DHCPS_POOL_SET_SUPPORT", |
| "CFG_OPTIMIZE_CHANNEL_SENSITIVITY", |
| "CFG_SAE", |
| "USE_SMALL_STACK", |
| "CFG_MFP", |
| "CONFIG_IEEE80211W", |
| "WFA_CERTIFICATE_N", |
| "PRINTF2_SUPPORT", |
| "CFG_PLF_RV32", |
| "LEGA_A0V2", |
| "RTOS_FREERTOS", |
| "LEGA_RTOS_SUPPORT", |
| "LWIP_APP_IPERF", |
| "AT_USER_DEBUG", |
| "KV_SUPPORT", |
| "LWIP_DUALSTACK", |
| "DEBUG_BACKTRACE", |
| "DOWNLOAD_MODE=0", |
| "MULTI_HEAP_REGIONS", |
| "MBEDTLS_HW", |
| "MBEDTLS_HW_RSA", |
| "MBEDTLS_HW_ECC", |
| "MBEDTLS_HW_AES", |
| "MBEDTLS_HW_HASH", |
| "MBEDTLS_USER_CONFIG_FILE=<mbedtls_user_config.h>", |
| "CFG_FLASH_MAX_SIZE=0x400000", |
| "CONFIG_ENABLE_ASR_LEGA_RTOS=1", |
| "CFG_EASY_LOG_ENABLE=1", |
| "CFG_EASY_LOG_MODULE_EN=1", |
| ] |
| |
| cflags_c = [ |
| "-march=rv32imafc", |
| "-mabi=ilp32f", |
| "-mcmodel=medany", |
| "-Os", |
| "-fno-omit-frame-pointer", |
| "-fshort-enums", |
| "-fno-common", |
| "-ffunction-sections", |
| "-fdata-sections", |
| "-g", |
| "-Wall", |
| ] |
| |
| cflags_cc = cflags_c |
| |
| asmflags = cflags_c |
| |
| cflags_c += [ |
| "-Wno-sign-compare", |
| "-Wno-unused-function", |
| "-Wno-pointer-sign", |
| "-Wno-type-limits", |
| ] |
| |
| ldflags = [ |
| "-march=rv32imafc", |
| "-mabi=ilp32f", |
| "-mcmodel=medany", |
| "-lm", |
| "-g", |
| "-Wall", |
| "-lstdc++", |
| "-nostartfiles", |
| "-Wl,--gc-sections", |
| ] |
| |
| libs = [ "${chip_root}/third_party/asr/${asr_ic_family}/asr_sdk/lib/libasr_wifi6_v6.a" ] |
| |
| linker_script_flags = |
| "${asr_sdk_build_root}/asr_sdk/platform/alto/linker/gcc_flashxip.ld" |
| ldflags += [ "-T" + rebase_path(linker_script_flags, root_build_dir) ] |
| ble_symbol_flags = |
| "${asr_sdk_build_root}/asr_sdk/lib/ble/ble_rom_v10_0_8_asr_symbol.txt" |
| ldflags += [ "-Wl,-R" + rebase_path(ble_symbol_flags, root_build_dir) ] |
| ldflags += [ "-Wl,-z,max-page-size=4096" ] |
| } |
| |
| group("asr_build") { |
| public_configs = [ ":asr_sdk_config" ] |
| public_deps = [ asr_target_project ] |
| } |