| # 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/efr32_sdk.gni") |
| import("//build_overrides/jlink.gni") |
| import("//build_overrides/mbedtls.gni") |
| import("${efr32_sdk_build_root}/efr32_sdk.gni") |
| |
| import("${chip_root}/src/lib/lib.gni") |
| import("silabs_board.gni") |
| |
| declare_args() { |
| wisemcu_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk" |
| examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" |
| } |
| |
| # Defines an siwx917 SDK build target. |
| # |
| # Parameters: |
| # wisemcu_sdk_root - The location of the wisemcu SDK. |
| # sources - The sources files to build. |
| template("siwx917_sdk") { |
| sdk_target_name = target_name |
| |
| config("${sdk_target_name}_config") { |
| include_dirs = [] |
| libs = [] |
| if (defined(invoker.include_dirs)) { |
| include_dirs += invoker.include_dirs |
| } |
| |
| # Treat these includes as system includes, so warnings in them are not fatal. |
| _include_dirs = [ |
| "${chip_root}/examples/platform/silabs/SiWx917/SiWx917", |
| "${chip_root}/examples/platform/silabs/SiWx917/SiWx917/hal", |
| "${sdk_support_root}/platform/emdrv/nvm3/inc", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/inc", |
| "${chip_root}/third_party/mbedtls/repo/include", |
| "${chip_root}/third_party/mbedtls/repo/library", |
| "${wisemcu_sdk_root}/platforms/si91x/hal/inc", |
| "${wisemcu_sdk_root}/sapi/include", |
| |
| "${chip_root}/src/platform/silabs/SiWx917/bluetooth", |
| |
| ### CCP includes ### |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/inc", |
| "${wisemcu_sdk_root}/platforms/si91x/core/chip/inc", |
| "${wisemcu_sdk_root}/platforms/si91x/core/config", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/cmsis_driver/config", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/rom_driver/inc", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/inc", |
| |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/cmsis_driver", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/cmsis_driver/CMSIS/Driver/Include", |
| "${wisemcu_sdk_root}/platforms/si91x/boards/brd4325x/inc", |
| "${wisemcu_sdk_root}/platforms/si91x/core/cmsis", |
| "${wisemcu_sdk_root}/third_party/freertos/include", |
| "${wisemcu_sdk_root}/third_party/freertos/portable/GCC/ARM_CM4F", |
| "${examples_plat_dir}/device/inc", |
| "${chip_root}/src/platform/silabs/rs911x", |
| ] |
| |
| # Note that we're setting the mbedTLS and PSA configuration files through a |
| # define. This means the build system by default does not pick up changes in |
| # the content of these, only when changing the filename itself. |
| # To fix this, these files are also manually depended upon in the source set |
| # declared in siwx917_mbedtls_config further down this file. |
| defines = [ |
| "MBEDTLS_CONFIG_FILE=\"siwx917-chip-mbedtls-config.h\"", |
| "__STARTUP_CLEAR_BSS", |
| "HARD_FAULT_LOG_ENABLE", |
| "SILABS_LOG_ENABLED=${silabs_log_enabled}", |
| "SL_HEAP_SIZE=32768", |
| "SL_WIFI=1", |
| "CCP_SI917_BRINGUP", |
| "RS911X_WIFI", |
| "RSI_WLAN_ENABLE", |
| "RSI_WITH_OS", |
| "RSI_M4_INTERFACE", #Enable CCP bus Interface |
| "RSI_WLAN_API_ENABLE", |
| "LITTLE_ENDIAN_ORDER", |
| "_CHIP_9118", |
| "NVM3_DEFAULT_NVM_SIZE=40960", |
| "NVM3_DEFAULT_MAX_OBJECT_SIZE=4092", |
| "KVS_MAX_ENTRIES=${kvs_max_entries}", |
| "${silabs_mcu}=1", |
| "${silabs_board}=1", |
| "__HEAP_SIZE=0", |
| "PLATFORM_HEADER=\"platform-header.h\"", |
| "USE_NVM3=1", |
| "RSI_ARM_CM4F", |
| "SIWX_917", |
| "BRD4325A", |
| "CHIP_9117", |
| "RSI_BLE_ENABLE=1", |
| "TINYCRYPT_PRIMITIVES", |
| "OPTIMIZE_TINYCRYPT_ASM", |
| "__error_t_defined", |
| "RSI_SAMPLE_HAL", |
| ] |
| |
| if (chip_build_libshell) { |
| defines += [ "ENABLE_CHIP_SHELL" ] |
| } |
| |
| import("${chip_root}/src/platform/silabs/wifi_args.gni") |
| defines += [ "LWIP_NETIF_API=1" ] |
| if (lwip_ipv4) { |
| defines += [ |
| "LWIP_IPV4=1", |
| |
| # adds following options to provide |
| # them to .cpp source files |
| # flags ported from lwipopts file |
| # TODO: move lwipopts to one location |
| "LWIP_ARP=1", |
| "LWIP_ICMP=1", |
| "LWIP_IGMP=1", |
| "LWIP_DHCP=1", |
| ] |
| } else { |
| defines += [ "LWIP_IPV4=0" ] |
| } |
| if (lwip_ipv6) { |
| defines += [ "LWIP_IPV6=1" ] |
| } else { |
| defines += [ "LWIP_IPV6=0" ] |
| } |
| |
| defines += board_defines |
| |
| if (chip_enable_wifi_ipv4) { |
| defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4=1" ] |
| } |
| if (invoker.enable_dic) { |
| _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] |
| } |
| |
| # Enabling led interface |
| if (use_wstk_leds) { |
| defines += [ "ENABLE_WSTK_LEDS" ] |
| } |
| |
| if (defined(invoker.enable_sleepy_device)) { |
| if (invoker.enable_sleepy_device) { |
| defines += [ |
| "CHIP_DEVICE_CONFIG_ENABLE_SED=1", |
| "SL_CATALOG_POWER_MANAGER_PRESENT", |
| "SL_CATALOG_SLEEPTIMER_PRESENT", |
| ] |
| } |
| } |
| |
| if (chip_build_libshell) { # matter shell |
| defines += [ "ENABLE_CHIP_SHELL" ] |
| } |
| |
| if (enable_dic) { |
| defines += [ "DIC_ENABLE=1" ] |
| } |
| |
| libs += [ "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM4_gcc.a" ] |
| |
| cflags = [] |
| foreach(include_dir, _include_dirs) { |
| cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] |
| } |
| |
| cflags += [ |
| "-Wno-maybe-uninitialized", |
| "-Wno-shadow", |
| "-Wno-empty-body", |
| "-Wno-cpp", |
| "-Wno-missing-braces", |
| "-Wno-sign-compare", |
| "-Wno-error", |
| "-Wno-unknown-warning-option", |
| "-Wno-unused-variable", |
| "-Wno-unused-function", |
| ] |
| |
| if (defined(invoker.defines)) { |
| defines += invoker.defines |
| } |
| } |
| |
| source_set("siwx917_mbedtls_config") { |
| # We're setting the mbedTLS config flags here as the siwx917_sdk target |
| # acts as the mbedTLS target for SiWx917 builds. We need this for the build |
| # system to recompile mbedTLS (= the SDK) when the mbedTLS config gets |
| # edited. |
| sources = [ |
| "${chip_root}/src/platform/silabs/SiWx917/siwx917-chip-mbedtls-config.h", |
| ] |
| |
| public_deps = [ "${chip_root}/src/crypto:crypto_buildconfig" ] |
| } |
| |
| source_set(sdk_target_name) { |
| sources = [ |
| # sapi |
| "${wisemcu_sdk_root}/sapi/bluetooth/rsi_ble_gap_apis.c", |
| "${wisemcu_sdk_root}/sapi/bluetooth/rsi_ble_gatt_apis.c", |
| "${wisemcu_sdk_root}/sapi/bluetooth/rsi_bt_common_apis.c", |
| "${wisemcu_sdk_root}/sapi/common/rsi_apis_non_rom.c", |
| "${wisemcu_sdk_root}/sapi/common/rsi_apis_rom.c", |
| "${wisemcu_sdk_root}/sapi/common/rsi_common_apis.c", |
| "${wisemcu_sdk_root}/sapi/common/rsi_device_init_apis.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_bt_ble.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_common.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_device_init.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_driver.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_driver_event_handlers.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_events.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_events_rom.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_iap.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_nwk.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_nwk_rom.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_pkt_mgmt.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_pkt_mgmt_rom.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_queue.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_queue_rom.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_scheduler.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_scheduler_rom.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_setregion_countryinfo.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_timer.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_utils.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_utils_rom.c", |
| "${wisemcu_sdk_root}/sapi/driver/rsi_wlan.c", |
| "${wisemcu_sdk_root}/sapi/network/socket/rsi_socket.c", |
| "${wisemcu_sdk_root}/sapi/network/socket/rsi_socket_rom.c", |
| "${wisemcu_sdk_root}/sapi/rtos/freertos_wrapper/rsi_os_wrapper.c", |
| "${wisemcu_sdk_root}/sapi/wlan/rsi_wlan_apis.c", |
| |
| # platform |
| "${wisemcu_sdk_root}/platforms/si91x/boards/brd4325x/src/rsi_board.c", |
| "${wisemcu_sdk_root}/platforms/si91x/core/chip/src/rsi_deepsleep_commonflash.c", |
| "${wisemcu_sdk_root}/platforms/si91x/core/chip/src/rsi_ps_ram_func.c", |
| "${wisemcu_sdk_root}/platforms/si91x/core/chip/src/rsi_system_config.c", |
| "${wisemcu_sdk_root}/platforms/si91x/core/chip/src/system_RS1xxxx.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/clock_update.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_comparator.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_egpio.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_udma.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_udma_wrapper.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_usart.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_ipmu.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_pll.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_power_save.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_processor_sensor.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_rtc.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_temp_sensor.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_time_period.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_ulpss_clk.c", |
| "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_wwdt.c", |
| "${wisemcu_sdk_root}/platforms/si91x/hal/src/rsi_bootup_config.c", |
| "${wisemcu_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_interrupt.c", |
| "${wisemcu_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_m4_rom.c", |
| |
| # modified hal |
| "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_m4.c", |
| "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_platform_init.c", |
| "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_timer.c", |
| |
| # startup |
| "${examples_plat_dir}/device/src/startup_RS1xxxx.c", |
| |
| # nvm3 |
| "${sdk_support_root}/platform/emdrv/nvm3/src/ccp_flash_dev.c", |
| "${sdk_support_root}/platform/emdrv/nvm3/src/ccp_flash_intf.c", |
| "${sdk_support_root}/platform/emdrv/nvm3/src/ccp_flash_prg.c", |
| "${sdk_support_root}/platform/emdrv/nvm3/src/nvm3_default.c", |
| "${sdk_support_root}/platform/emdrv/nvm3/src/nvm3_hal_flash_ccp.c", |
| "${sdk_support_root}/platform/emdrv/nvm3/src/nvm3_lock.c", |
| |
| # freertos |
| "${wisemcu_sdk_root}/third_party/freertos/croutine.c", |
| "${wisemcu_sdk_root}/third_party/freertos/event_groups.c", |
| "${wisemcu_sdk_root}/third_party/freertos/list.c", |
| "${wisemcu_sdk_root}/third_party/freertos/portable/GCC/ARM_CM4F/port.c", |
| "${wisemcu_sdk_root}/third_party/freertos/queue.c", |
| "${wisemcu_sdk_root}/third_party/freertos/stream_buffer.c", |
| "${wisemcu_sdk_root}/third_party/freertos/tasks.c", |
| "${wisemcu_sdk_root}/third_party/freertos/timers.c", |
| |
| # mbedtls |
| "${chip_root}/third_party/mbedtls/repo/library/aes.c", |
| "${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/constant_time.c", |
| "${chip_root}/third_party/mbedtls/repo/library/ctr_drbg.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/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/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/pkcs5.c", |
| "${chip_root}/third_party/mbedtls/repo/library/platform.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/x509_create.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/ecc.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/ecc_dh.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/ecc_dsa.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/error.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/oid.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/pk.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/pk_wrap.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/pkparse.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/pkwrite.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/platform_util.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/x509_crt.c", |
| "${sdk_support_root}/matter/mbedtls/tinycrypt/src/x509write_csr.c", |
| ] |
| |
| public_deps = [ |
| ":siwx917_mbedtls_config", |
| "${segger_rtt_root}:segger_rtt", |
| "${segger_rtt_root}:segger_rtt_printf", |
| "${segger_rtt_root}:segger_rtt_syscalls", |
| ] |
| |
| if (defined(invoker.sources)) { |
| sources += invoker.sources |
| } |
| if (invoker.enable_dic) { |
| sources += [ |
| "${chip_root}/third_party/mbedtls/repo/library/base64.c", |
| "${chip_root}/third_party/mbedtls/repo/library/debug.c", |
| "${chip_root}/third_party/mbedtls/repo/library/ecjpake.c", |
| "${chip_root}/third_party/mbedtls/repo/library/pem.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/ssl_ciphersuites.c", |
| "${chip_root}/third_party/mbedtls/repo/library/ssl_cli.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_tls.c", |
| "${chip_root}/third_party/mbedtls/repo/library/x509.c", |
| "${chip_root}/third_party/silabs/mqtt/stack/mqtt.c", |
| ] |
| } |
| |
| public_configs = [ ":${sdk_target_name}_config" ] |
| } |
| } |