From b8d4c4ae92435f07dd26f70b36207c72492a1955 Mon Sep 17 00:00:00 2001 From: wyhong <30567533+wy-hh@users.noreply.github.com> Date: Thu, 5 Jan 2023 00:46:03 +0800 Subject: [PATCH] [Bouffalolab] Refactor Bouffalolab SDK gn scripts (#24132) * create bl_iot_sdk.gni * update bl_iot_sdk.gni * remove more 702 specific-name * update bl602 * update bl602 & bl702 * update toolchain path * fix issues for bl602 * fix parition table for bl702 * fix restyle --- build_overrides/bouffalolab_iot_sdk.gni | 6 +- .../bouffalolab/args.gni | 12 +- .../bouffalolab}/toolchain/BUILD.gn | 0 .../toolchain/riscv_toolchain.gni | 0 .../build_overrides/bouffalolab_iot_sdk.gni | 9 +- .../lighting-app/bouffalolab/bl602/BUILD.gn | 12 +- .../bouffalolab/bl602/CHIPProjectConfig.h | 2 + .../lighting-app/bouffalolab/bl602/args.gni | 2 +- .../lighting-app/bouffalolab/bl702/BUILD.gn | 9 +- .../lighting-app/bouffalolab/bl702/args.gni | 2 +- .../bouffalolab/common/AppTask.cpp | 3 +- examples/platform/bouffalolab/bl602/BUILD.gn | 2 +- .../bouffalolab/bl602/FreeRTOSConfig.h | 188 ++-- .../bl602/route_hook/bl_route_hook.c | 1 + examples/platform/bouffalolab/bl702/BUILD.gn | 2 +- .../platform/bouffalolab/common/plat/main.cpp | 3 +- scripts/build/builders/bouffalolab.py | 3 +- scripts/examples/gn_bouffalolab_example.sh | 2 +- src/lwip/BUILD.gn | 10 +- .../bouffalolab/BL602/BL602Config.cpp | 61 +- .../bouffalolab/BL602/CHIPMem-Platform.cpp | 2 +- .../BL602/ConfigurationManagerImpl.cpp | 4 +- .../BL602/ConfigurationManagerImpl.h | 1 - .../BL602/ConnectivityManagerImpl.cpp | 6 +- .../BL602/DiagnosticDataProviderImpl.cpp | 8 +- .../BL602/KeyValueStoreManagerImpl.cpp | 4 +- src/platform/bouffalolab/BL602/Logging.cpp | 10 +- .../BL602/NetworkCommissioningDriver.cpp | 11 +- .../BL602/NetworkCommissioningDriver.h | 2 +- .../BL602/NetworkCommissioningWiFiDriver.cpp | 2 +- .../bouffalolab/BL602/PlatformManagerImpl.cpp | 14 +- .../bouffalolab/BL602/PlatformManagerImpl.h | 10 +- src/platform/bouffalolab/BL602/args.gni | 4 +- .../bouffalolab/BL602/wifi_mgmr_portable.c | 14 +- src/platform/bouffalolab/BL702/BUILD.gn | 6 +- src/platform/bouffalolab/BL702/Logging.cpp | 11 +- .../BL702/ThreadStackManagerImpl.cpp | 64 +- src/platform/bouffalolab/BL702/args.gni | 7 +- .../bouffalolab/BL702/bl702Config.cpp | 1 - third_party/bouffalolab/bl602/BUILD.gn | 12 +- third_party/bouffalolab/bl602/bl602_board.gni | 30 - third_party/bouffalolab/bl602/bl602_sdk.gni | 636 ------------- third_party/bouffalolab/bl602/bl_iot_sdk.gni | 889 ++++++++++++++++++ third_party/bouffalolab/bl702/BUILD.gn | 12 +- .../bouffalolab/bl702/bl702_executable.gni | 72 -- third_party/bouffalolab/bl702/bl702_sdk.gni | 821 ---------------- third_party/bouffalolab/bl702/bl_iot_sdk.gni | 826 ++++++++++++++++ .../bouffalolab_board.gni} | 9 +- .../bouffalolab_executable.gni} | 22 +- .../bl602_riscv.gni => common/rsicv.gni} | 2 - third_party/bouffalolab/repo | 2 +- 51 files changed, 1991 insertions(+), 1852 deletions(-) rename third_party/bouffalolab/bl702/bl702_riscv.gni => config/bouffalolab/args.gni (68%) rename {examples/platform/bouffalolab/common => config/bouffalolab}/toolchain/BUILD.gn (100%) rename {examples/platform/bouffalolab/common => config/bouffalolab}/toolchain/riscv_toolchain.gni (100%) delete mode 100644 third_party/bouffalolab/bl602/bl602_board.gni delete mode 100644 third_party/bouffalolab/bl602/bl602_sdk.gni create mode 100644 third_party/bouffalolab/bl602/bl_iot_sdk.gni delete mode 100644 third_party/bouffalolab/bl702/bl702_executable.gni delete mode 100644 third_party/bouffalolab/bl702/bl702_sdk.gni create mode 100644 third_party/bouffalolab/bl702/bl_iot_sdk.gni rename third_party/bouffalolab/{bl702/bl702_board.gni => common/bouffalolab_board.gni} (78%) rename third_party/bouffalolab/{bl602/bl602_executable.gni => common/bouffalolab_executable.gni} (81%) rename third_party/bouffalolab/{bl602/bl602_riscv.gni => common/rsicv.gni} (96%) diff --git a/build_overrides/bouffalolab_iot_sdk.gni b/build_overrides/bouffalolab_iot_sdk.gni index 77ab3440927271..2a87174c734d84 100644 --- a/build_overrides/bouffalolab_iot_sdk.gni +++ b/build_overrides/bouffalolab_iot_sdk.gni @@ -13,11 +13,7 @@ # limitations under the License. declare_args() { - # Root directory for bl602 SDK build files. - bl602_sdk_build_root = "//third_party/bouffalolab/bl602" - - # Root directory for bl702 SDK build files. - bl702_sdk_build_root = "//third_party/bouffalolab/bl702" + bouffalolab_iot_sdk_build_root = "//third_party/bouffalolab/" bouffalolab_sdk_root = "/opt/bouffalolab_sdk" } diff --git a/third_party/bouffalolab/bl702/bl702_riscv.gni b/config/bouffalolab/args.gni similarity index 68% rename from third_party/bouffalolab/bl702/bl702_riscv.gni rename to config/bouffalolab/args.gni index 2c525322f81cf8..a85d0ea655d0b4 100644 --- a/third_party/bouffalolab/bl702/bl702_riscv.gni +++ b/config/bouffalolab/args.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Project CHIP Authors +# 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. @@ -12,10 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("bl702_board.gni") +# Options from standalone-chip.mk that differ from configure defaults. These +# options are used from examples/. -riscv_arch = "rv32imfc" -riscv_abi = "ilp32f" -# riscv_cpu = "" -# riscv_float_abi = "hard" -# riscv_fpu = "" +custom_toolchain = + "//third_party/connectedhomeip/config/bouffalolab/toolchain:riscv_gcc" diff --git a/examples/platform/bouffalolab/common/toolchain/BUILD.gn b/config/bouffalolab/toolchain/BUILD.gn similarity index 100% rename from examples/platform/bouffalolab/common/toolchain/BUILD.gn rename to config/bouffalolab/toolchain/BUILD.gn diff --git a/examples/platform/bouffalolab/common/toolchain/riscv_toolchain.gni b/config/bouffalolab/toolchain/riscv_toolchain.gni similarity index 100% rename from examples/platform/bouffalolab/common/toolchain/riscv_toolchain.gni rename to config/bouffalolab/toolchain/riscv_toolchain.gni diff --git a/examples/build_overrides/bouffalolab_iot_sdk.gni b/examples/build_overrides/bouffalolab_iot_sdk.gni index 1eb018a7ef2c85..d66989f09abd37 100644 --- a/examples/build_overrides/bouffalolab_iot_sdk.gni +++ b/examples/build_overrides/bouffalolab_iot_sdk.gni @@ -13,13 +13,8 @@ # limitations under the License. declare_args() { - # Root directory for bl602 SDK build files. - bl602_sdk_build_root = - "//third_party/connectedhomeip/third_party/bouffalolab/bl602" - - # Root directory for bl702 SDK build files. - bl702_sdk_build_root = - "//third_party/connectedhomeip/third_party/bouffalolab/bl702" + bouffalolab_iot_sdk_build_root = + "//third_party/connectedhomeip/third_party/bouffalolab" bouffalolab_sdk_root = "/opt/bouffalolab_sdk" } diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index 369b732b02f49b..0b341d50c32675 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -16,8 +16,8 @@ import("//build_overrides/bouffalolab_iot_sdk.gni") import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("${bl602_sdk_build_root}/bl602_executable.gni") -import("${bl602_sdk_build_root}/bl602_sdk.gni") +import("${bouffalolab_iot_sdk_build_root}/bl602/bl_iot_sdk.gni") +import("${bouffalolab_iot_sdk_build_root}/common/bouffalolab_executable.gni") import("${build_root}/config/defaults.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -51,7 +51,7 @@ declare_args() { baudrate = 2000000 } -bl602_sdk("sdk") { +bl_iot_sdk("sdk") { include_dirs = [ "${chip_root}/src/platform/bouffalolab/BL602", "${example_dir}", @@ -66,6 +66,7 @@ bl602_sdk("sdk") { "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", "OTA_PERIODIC_QUERY_TIMEOUT=${ota_periodic_query_timeout}", "CHIP_UART_BAUDRATE=${baudrate}", + "SYS_AOS_LOOP_ENABLE", ] if (chip_enable_pw_rpc) { @@ -77,7 +78,7 @@ bl602_sdk("sdk") { } } -bl602_executable("lighting_app") { +bouffalolab_executable("lighting_app") { output_name = "chip-bl602-lighting-example.out" defines = [ @@ -85,8 +86,10 @@ bl602_executable("lighting_app") { "CHIP_UART_BAUDRATE=${baudrate}", "BL602_ENABLE", "START_ENTRY=bfl_main", + "SYS_AOS_LOOP_ENABLE", ] + bl_plat_name = "bl602" sources = [ "${examples_plat_dir}/route_hook/bl_route_hook.c", "${examples_plat_dir}/route_hook/bl_route_table.c", @@ -195,6 +198,7 @@ bl602_executable("lighting_app") { sources += [ "${examples_plat_common_dir}/plat/OTAConfig.cpp" ] } + cflags_c = [ "-Wno-sign-compare" ] ldscript = "${examples_plat_dir}/ldscripts/flash_rom.ld" ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] diff --git a/examples/lighting-app/bouffalolab/bl602/CHIPProjectConfig.h b/examples/lighting-app/bouffalolab/bl602/CHIPProjectConfig.h index 22befede6a48c4..9e9934c227c465 100644 --- a/examples/lighting-app/bouffalolab/bl602/CHIPProjectConfig.h +++ b/examples/lighting-app/bouffalolab/bl602/CHIPProjectConfig.h @@ -144,3 +144,5 @@ #define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 + +#define CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE 128 diff --git a/examples/lighting-app/bouffalolab/bl602/args.gni b/examples/lighting-app/bouffalolab/bl602/args.gni index 464b0c63ff827c..1a7e2dd427e021 100644 --- a/examples/lighting-app/bouffalolab/bl602/args.gni +++ b/examples/lighting-app/bouffalolab/bl602/args.gni @@ -17,7 +17,7 @@ import("//build_overrides/pigweed.gni") import("${chip_root}/config/standalone/args.gni") import("${chip_root}/src/platform/bouffalolab/BL602/args.gni") -bl602_sdk_target = get_label_info(":sdk", "label_no_toolchain") +bl_iot_sdk_target = get_label_info(":sdk", "label_no_toolchain") pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" pw_assert_BACKEND = "$dir_pw_assert_log" diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index 5872505775bd15..65822676f89e04 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -16,8 +16,8 @@ import("//build_overrides/bouffalolab_iot_sdk.gni") import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("${bl702_sdk_build_root}/bl702_executable.gni") -import("${bl702_sdk_build_root}/bl702_sdk.gni") +import("${bouffalolab_iot_sdk_build_root}/bl702/bl_iot_sdk.gni") +import("${bouffalolab_iot_sdk_build_root}/common/bouffalolab_executable.gni") import("${build_root}/config/defaults.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -54,7 +54,7 @@ declare_args() { baudrate = 2000000 } -bl702_sdk("sdk") { +bl_iot_sdk("sdk") { include_dirs = [ "${example_dir}", "${example_common_dir}", @@ -88,8 +88,9 @@ bl702_sdk("sdk") { } } -bl702_executable("lighting_app") { +bouffalolab_executable("lighting_app") { output_name = "chip-bl702-lighting-example.out" + bl_plat_name = "bl702" defines = [ "APP_TASK_STACK_SIZE=2044", diff --git a/examples/lighting-app/bouffalolab/bl702/args.gni b/examples/lighting-app/bouffalolab/bl702/args.gni index ecfb7424c6d2e6..c76c3d0f267d17 100644 --- a/examples/lighting-app/bouffalolab/bl702/args.gni +++ b/examples/lighting-app/bouffalolab/bl702/args.gni @@ -17,7 +17,7 @@ import("//build_overrides/pigweed.gni") import("${chip_root}/config/standalone/args.gni") import("${chip_root}/src/platform/bouffalolab/BL702/args.gni") -bl702_sdk_target = get_label_info(":sdk", "label_no_toolchain") +bl_iot_sdk_target = get_label_info(":sdk", "label_no_toolchain") pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" pw_assert_BACKEND = "$dir_pw_assert_log" diff --git a/examples/lighting-app/bouffalolab/common/AppTask.cpp b/examples/lighting-app/bouffalolab/common/AppTask.cpp index cae6be58e7dd75..2fe2a403357717 100644 --- a/examples/lighting-app/bouffalolab/common/AppTask.cpp +++ b/examples/lighting-app/bouffalolab/common/AppTask.cpp @@ -417,7 +417,8 @@ void AppTask::ChipEventHandler(const ChipDeviceEvent * event, intptr_t arg) #if CHIP_DEVICE_CONFIG_ENABLE_WIFI case DeviceEventType::kWiFiConnectivityChange: - ChipLogProgress(NotSpecified, "Wi-Fi state changed\r\n", ConnectivityMgr().IsWiFiStationConnected()); + ChipLogProgress(NotSpecified, "Wi-Fi state changed to %s.\r\n", + ConnectivityMgr().IsWiFiStationConnected() ? "connected" : "disconnected"); chip::app::DnssdServer::Instance().StartServer(); NetworkCommissioning::BLWiFiDriver::GetInstance().SaveConfiguration(); diff --git a/examples/platform/bouffalolab/bl602/BUILD.gn b/examples/platform/bouffalolab/bl602/BUILD.gn index d6ca0038a370ee..8e85778ebd1f57 100644 --- a/examples/platform/bouffalolab/bl602/BUILD.gn +++ b/examples/platform/bouffalolab/bl602/BUILD.gn @@ -15,7 +15,7 @@ import("//build_overrides/bouffalolab_iot_sdk.gni") import("//build_overrides/chip.gni") -import("${bl602_sdk_build_root}/bl602_sdk.gni") +import("${bouffalolab_iot_sdk_build_root}/bl602/bl_iot_sdk.gni") config("chip_examples_project_config") { include_dirs = [ "project_include" ] diff --git a/examples/platform/bouffalolab/bl602/FreeRTOSConfig.h b/examples/platform/bouffalolab/bl602/FreeRTOSConfig.h index 7d8553139871bb..96379643d791e3 100644 --- a/examples/platform/bouffalolab/bl602/FreeRTOSConfig.h +++ b/examples/platform/bouffalolab/bl602/FreeRTOSConfig.h @@ -97,11 +97,8 @@ 1 tab == 4 spaces! */ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H #include "platform.h" #include @@ -118,116 +115,101 @@ extern "C" { * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ -/* Tickless mode is not used. */ - -/* Some of the standard demo test tasks assume a tick rate of 1KHz, even -though that is faster than would normally be warranted by a real -application. */ -#define configTICK_RATE_HZ (1000) - -/* The full demo always has tasks to run so the tick will never be turned -off. The blinky demo will use the default tickless idle implementation to -turn the tick off. */ -#define configUSE_TICKLESS_IDLE (0) +#define configSUPPORT_STATIC_ALLOCATION 1 -/* Hook function related definitions. */ -#define configUSE_TICK_HOOK (0) -#define configCHECK_FOR_STACK_OVERFLOW (2) -#define configUSE_MALLOC_FAILED_HOOK (1) -#define configUSE_IDLE_HOOK (0) - -#define configENERGY_MODE (sleepEM1) - -/* Main functions*/ -/* Run time stats gathering related definitions. */ -#define configGENERATE_RUN_TIME_STATS (0) - -/* Co-routine related definitions. */ -#define configUSE_CO_ROUTINES (0) +#define configCLINT_BASE_ADDRESS CLINT_CTRL_ADDR +#define configCLIC_TIMER_ENABLE_ADDRESS (0x02800407) +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 0 +#ifndef configUSE_TICKLESS_IDLE +// Maybe Compile flags is passed by command line +#define configUSE_TICKLESS_IDLE 1 +#endif +#define configCPU_CLOCK_HZ (10 * 1000 * 1000) /*QEMU*/ +#define configTICK_RATE_HZ ((TickType_t) 1000) +#define configMAX_PRIORITIES (32) +/* Creating idle task */ +/* -1 -> prvInitialiseNewTask: (subtract 1 to get top of stack) pxTopOfStack = &( pxNewTCB->pxStack[ ulStackDepth - ( uint32_t ) 1 + * ] ); */ +/* -1 -> prvInitialiseNewTask: (subtract 1 in case not matching 8 bytes alignment) pxTopOfStack = ( StackType_t * ) ( ( ( + * portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); */ +/* Running idle task */ +/* -12 -> prvIdleTask: addi sp, sp, -48 */ +/* -16 -> prvIdleTask.xTaskResumeAll: addi sp, sp, -64 */ +/* Here comes an interrupt after prvIdleTask.xTaskResumeAll.vTaskExitCritical */ +/* -30 -> freertos_risc_v_trap_handler: addi sp, sp, -portCONTEXT_SIZE */ +/* -34 -> portasmSAVE_ADDITIONAL_REGISTERS: addi sp, sp, -(portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE) */ +/* Checking for stack overflow */ +/* 4 -> taskCHECK_FOR_STACK_OVERFLOW: if( ( pulStack[ 0 ] != ulCheckValue ) || ( pulStack[ 1 ] != ulCheckValue ) || ( pulStack[ 2 + * ] != ulCheckValue ) || ( pulStack[ 3 ] != ulCheckValue ) ) */ +#define configMINIMAL_STACK_SIZE ((unsigned short) 114) /* SIZE-1-1-12-16-30-34>=4 */ +#define configTOTAL_HEAP_SIZE ((size_t) 14100) +#define configMAX_TASK_NAME_LEN (16) +#define configUSE_TRACE_FACILITY 1 +#define configUSE_STATS_FORMATTING_FUNCTIONS 1 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 8 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configGENERATE_RUN_TIME_STATS 0 +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 #define configMAX_CO_ROUTINE_PRIORITIES (2) -/* Software timer related definitions. */ -#define configUSE_TIMERS (1) -#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) /* Highest priority */ -#define configTIMER_QUEUE_LENGTH (4) +/* Software timer definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) +#define configTIMER_QUEUE_LENGTH 4 #define configTIMER_TASK_STACK_DEPTH (400) -/* Cortex-M specific definitions. */ -#ifdef __NVIC_PRIO_BITS -/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ -#define configPRIO_BITS (__NVIC_PRIO_BITS) -#else -#define configPRIO_BITS 3 /* 7 priority levels */ +/* Task priorities. Allow these to be overridden. */ +#ifndef uartPRIMARY_PRIORITY +#define uartPRIMARY_PRIORITY (configMAX_PRIORITIES - 3) #endif -/* The lowest interrupt priority that can be used in a call to a "set priority" -function. */ -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY (0x07) - -/* The highest interrupt priority that can be used by any interrupt service -routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL -INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER -PRIORITY THAN THIS! (higher priorities are lower numeric values. */ -#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY (0x03) - -/* Interrupt priorities used by the kernel port layer itself. These are generic -to all Cortex-M ports, and do not rely on any particular library functions. */ -#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) -/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! -See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ -#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) - -/* FreeRTOS MPU specific definitions. */ -#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS (0) - -#define configCPU_CLOCK_HZ (10 * 1000 * 1000) -#define configUSE_PREEMPTION (1) -#define configUSE_TIME_SLICING (1) -#define configUSE_PORT_OPTIMISED_TASK_SELECTION (1) -#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */ -#define configMAX_PRIORITIES (32) -#define configMINIMAL_STACK_SIZE ((unsigned short) 112) /* Number of words to use for Idle and Timer stacks */ -#define configMAX_TASK_NAME_LEN (16) -#define configUSE_16_BIT_TICKS (0) -#define configIDLE_SHOULD_YIELD (1) -#define configUSE_MUTEXES (1) -#define configUSE_RECURSIVE_MUTEXES (1) -#define configUSE_COUNTING_SEMAPHORES (1) -#define configQUEUE_REGISTRY_SIZE (8) -// #define configUSE_QUEUE_SETS (0) -// #define configUSE_NEWLIB_REENTRANT (0) -#define configENABLE_BACKWARD_COMPATIBILITY (1) -#define configSUPPORT_STATIC_ALLOCATION (1) - /* Optional functions - most linkers will remove unused functions anyway. */ -#define INCLUDE_vTaskPrioritySet (1) -#define INCLUDE_uxTaskPriorityGet (1) -#define INCLUDE_vTaskDelete (1) -#define INCLUDE_vTaskSuspend (1) -// #define INCLUDE_xResumeFromISR (1) -#define INCLUDE_vTaskDelayUntil (1) -#define INCLUDE_vTaskDelay (1) -#define INCLUDE_xTaskGetSchedulerState (0) -#define INCLUDE_xTaskGetCurrentTaskHandle (0) -#define INCLUDE_uxTaskGetStackHighWaterMark (1) -#define INCLUDE_xTaskGetIdleTaskHandle (0) -// #define INCLUDE_xTimerGetTimerDaemonTaskHandle (1) -// #define INCLUDE_pcTaskGetTaskName (1) -#define INCLUDE_eTaskGetState (1) -// #define INCLUDE_xEventGroupSetBitFromISR (1) -#define INCLUDE_xTimerPendFunctionCall (1) - +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 + +/* Overwrite some of the stack sizes allocated to various test and demo tasks. +Like all task stack sizes, the value is the number of words, not bytes. */ +#define bktBLOCK_TIME_TASK_STACK_SIZE 100 +#define notifyNOTIFIED_TASK_STACK_SIZE 120 +#define priSUSPENDED_RX_TASK_STACK_SIZE 90 +#define tmrTIMER_TEST_TASK_STACK_SIZE 100 +#define ebRENDESVOUS_TEST_TASK_STACK_SIZE 100 +#define ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE 115 +#define genqMUTEX_TEST_TASK_STACK_SIZE 90 +#define genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE 100 +#define recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE 90 + +extern void vAssertCalled(void); /* Stop if an assertion fails. */ #define configASSERT(x) \ if ((x) == 0) \ vAssertCalled() -/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS -standard names. */ -// #define vPortSVCHandler SVC_Handler -// #define xPortPendSVHandler PendSV_Handler -#define xPortSysTickHandler SysTick_Handler +#if (configUSE_TICKLESS_IDLE != 0) +#include "portmacro.h" +extern void vApplicationSleep(TickType_t xExpectedIdleTime); +#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) vApplicationSleep(xExpectedIdleTime) +#endif -#ifdef __cplusplus -} #endif diff --git a/examples/platform/bouffalolab/bl602/route_hook/bl_route_hook.c b/examples/platform/bouffalolab/bl602/route_hook/bl_route_hook.c index 230cccadd52657..bcdbcc4edef34a 100644 --- a/examples/platform/bouffalolab/bl602/route_hook/bl_route_hook.c +++ b/examples/platform/bouffalolab/bl602/route_hook/bl_route_hook.c @@ -12,6 +12,7 @@ #include "lwip/prot/ip6.h" #include "lwip/prot/nd6.h" #include "lwip/raw.h" +#include typedef struct bl_route_hook_t { diff --git a/examples/platform/bouffalolab/bl702/BUILD.gn b/examples/platform/bouffalolab/bl702/BUILD.gn index 8dc352bbdf5be2..df3ea0e637521e 100644 --- a/examples/platform/bouffalolab/bl702/BUILD.gn +++ b/examples/platform/bouffalolab/bl702/BUILD.gn @@ -15,7 +15,7 @@ import("//build_overrides/bouffalolab_iot_sdk.gni") import("//build_overrides/chip.gni") -import("${bl702_sdk_build_root}/bl702_sdk.gni") +import("${bouffalolab_iot_sdk_build_root}/bl702/bl_iot_sdk.gni") config("chip_examples_project_config") { include_dirs = [ "project_include" ] diff --git a/examples/platform/bouffalolab/common/plat/main.cpp b/examples/platform/bouffalolab/common/plat/main.cpp index 29090ddbb02ee2..8dad0e2a958877 100644 --- a/examples/platform/bouffalolab/common/plat/main.cpp +++ b/examples/platform/bouffalolab/common/plat/main.cpp @@ -31,9 +31,10 @@ #include #include -#include extern "C" { +#include + #ifdef BL702_ENABLE #include #include diff --git a/scripts/build/builders/bouffalolab.py b/scripts/build/builders/bouffalolab.py index ed22de8ad88bb5..52e1e4e01e90d3 100644 --- a/scripts/build/builders/bouffalolab.py +++ b/scripts/build/builders/bouffalolab.py @@ -89,7 +89,8 @@ def __init__(self, self.argsOpt = [] self.chip_name = bouffalo_chip - toolchain = os.path.join(root, '../../examples/platform/bouffalolab/common/toolchain') + + toolchain = os.path.join(root, os.path.split(os.path.realpath(__file__))[0], '../../../config/bouffalolab/toolchain') toolchain = 'custom_toolchain="{}:riscv_gcc"'.format(toolchain) if toolchain: self.argsOpt.append(toolchain) diff --git a/scripts/examples/gn_bouffalolab_example.sh b/scripts/examples/gn_bouffalolab_example.sh index 7c40790619fed4..2b3725e0ab12ba 100755 --- a/scripts/examples/gn_bouffalolab_example.sh +++ b/scripts/examples/gn_bouffalolab_example.sh @@ -90,7 +90,7 @@ else baudrate=2000000 optArgs="" - optArgs=custom_toolchain=\"$MATTER_ROOT/examples/platform/bouffalolab/common/toolchain:riscv_gcc\" + optArgs=custom_toolchain=\"$MATTER_ROOT/config/bouffalolab/toolchain:riscv_gcc\" shift shift diff --git a/src/lwip/BUILD.gn b/src/lwip/BUILD.gn index 54f6d44372fc37..22f56ffc310769 100644 --- a/src/lwip/BUILD.gn +++ b/src/lwip/BUILD.gn @@ -107,11 +107,11 @@ if (current_os == "zephyr" || current_os == "mbed") { public_configs += [ "${psoc6_sdk_build_root}:psoc6_sdk_config" ] } } else if (lwip_platform == "bl702_lwip") { - import("//build_overrides/bl702_sdk.gni") + import("${bouffalolab_iot_sdk_build_root}/bl702/bl_iot_sdk.gni") group("lwip") { public_deps = [ ":lwip_buildconfig" ] - public_deps += [ "${bl702_sdk_build_root}:bl702_sdk" ] + public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ] } group("all") { @@ -142,7 +142,7 @@ if (current_os == "zephyr" || current_os == "mbed") { } else if (lwip_platform == "bl602") { group("lwip") { public_deps = [ ":lwip_buildconfig" ] - public_deps += [ "${bl602_sdk_build_root}:bl602_sdk" ] + public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl602:bl_iot_sdk" ] } group("all") { @@ -195,9 +195,9 @@ if (current_os == "zephyr" || current_os == "mbed") { } else if (lwip_platform == "cyw30739") { public_deps += [ "${cyw30739_sdk_build_root}:cyw30739_sdk" ] } else if (lwip_platform == "bl602") { - public_deps += [ "${bl602_sdk_build_root}:bl602_sdk" ] + public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl602:bl602_sdk" ] } else if (lwip_platform == "bl702") { - public_deps += [ "${bl702_sdk_build_root}:bl702_sdk" ] + public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ] } else if (lwip_platform == "mt793x") { public_deps += [ "${mt793x_sdk_build_root}:mt793x_sdk" ] } diff --git a/src/platform/bouffalolab/BL602/BL602Config.cpp b/src/platform/bouffalolab/BL602/BL602Config.cpp index 6f0d93f4b85b89..140b52d5fa0edd 100644 --- a/src/platform/bouffalolab/BL602/BL602Config.cpp +++ b/src/platform/bouffalolab/BL602/BL602Config.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -82,97 +81,69 @@ CHIP_ERROR BL602Config::Init() CHIP_ERROR BL602Config::ReadConfigValue(Key key, bool & val) { CHIP_ERROR err = CHIP_NO_ERROR; - bool tmpVal; - size_t ret, valLen; + size_t valLen = 0; - ret = ef_get_env_blob(key.name, &tmpVal, sizeof(tmpVal), &valLen); - if (ret <= 0) + ef_get_env_blob(key.name, &val, 1, &valLen); + if (0 == valLen) { err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; } - SuccessOrExit(err); - - val = tmpVal; -exit: return err; } CHIP_ERROR BL602Config::ReadConfigValue(Key key, uint32_t & val) { CHIP_ERROR err = CHIP_NO_ERROR; - uint32_t tmpVal; - size_t ret, valLen; + size_t valLen = 0; - ret = ef_get_env_blob(key.name, &tmpVal, sizeof(tmpVal), &valLen); - if (ret <= 0) + ef_get_env_blob(key.name, &val, sizeof(val), &valLen); + if (0 == valLen) { err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; } - SuccessOrExit(err); - val = tmpVal; - -exit: return err; } CHIP_ERROR BL602Config::ReadConfigValue(Key key, uint64_t & val) { CHIP_ERROR err = CHIP_NO_ERROR; - uint64_t tmpVal; - size_t ret, valLen; + size_t valLen = 0; - ret = ef_get_env_blob(key.name, &tmpVal, sizeof(tmpVal), &valLen); - if (ret <= 0) + ef_get_env_blob(key.name, &val, sizeof(val), &valLen); + if (0 == valLen) { err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; } - SuccessOrExit(err); - val = tmpVal; -exit: return err; } CHIP_ERROR BL602Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) { - CHIP_ERROR err = CHIP_NO_ERROR; - char tmpVal[bufSize] = { 0 }; - size_t ret; + CHIP_ERROR err = CHIP_NO_ERROR; - ret = ef_get_env_blob(key.name, tmpVal, sizeof(tmpVal) - 1, NULL); - if ('\0' == tmpVal[0]) + outLen = 0; + ef_get_env_blob(key.name, buf, bufSize, &outLen); + if (0 == outLen) { err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; } - SuccessOrExit(err); - outLen = ret; - Platform::CopyString(buf, outLen, tmpVal); - -exit: return err; } CHIP_ERROR BL602Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) { - CHIP_ERROR err = CHIP_NO_ERROR; - char tmpVal[bufSize] = { 0 }; - size_t ret; - size_t savedLen = 0; + CHIP_ERROR err = CHIP_NO_ERROR; - ret = ef_get_env_blob(key.name, tmpVal, sizeof(tmpVal), &savedLen); - if (0 == savedLen) + ef_get_env_blob(key.name, buf, bufSize, &outLen); + if (0 == outLen) { err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; } - SuccessOrExit(err); - outLen = ret; - memcpy(buf, tmpVal, outLen); - -exit: return err; } diff --git a/src/platform/bouffalolab/BL602/CHIPMem-Platform.cpp b/src/platform/bouffalolab/BL602/CHIPMem-Platform.cpp index 5f1f07f97a6a77..3b9b274941bfb8 100644 --- a/src/platform/bouffalolab/BL602/CHIPMem-Platform.cpp +++ b/src/platform/bouffalolab/BL602/CHIPMem-Platform.cpp @@ -52,10 +52,10 @@ #include #include #include +#include extern "C" { #include -#include }; #if CHIP_CONFIG_MEMORY_MGMT_PLATFORM diff --git a/src/platform/bouffalolab/BL602/ConfigurationManagerImpl.cpp b/src/platform/bouffalolab/BL602/ConfigurationManagerImpl.cpp index f207e295ca882f..5c53153867fbe0 100644 --- a/src/platform/bouffalolab/BL602/ConfigurationManagerImpl.cpp +++ b/src/platform/bouffalolab/BL602/ConfigurationManagerImpl.cpp @@ -32,9 +32,9 @@ #include extern "C" { -#include #include #include +#include } namespace chip { @@ -213,8 +213,6 @@ void ConfigurationManagerImpl::RunConfigUnitTest(void) void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) { - CHIP_ERROR err; - ChipLogProgress(DeviceLayer, "Performing factory reset"); ef_env_set_default(); ChipLogProgress(DeviceLayer, "System restarting"); diff --git a/src/platform/bouffalolab/BL602/ConfigurationManagerImpl.h b/src/platform/bouffalolab/BL602/ConfigurationManagerImpl.h index e4d231711c473d..0183da4e3a007f 100644 --- a/src/platform/bouffalolab/BL602/ConfigurationManagerImpl.h +++ b/src/platform/bouffalolab/BL602/ConfigurationManagerImpl.h @@ -33,7 +33,6 @@ #include #endif -#include #include namespace chip { diff --git a/src/platform/bouffalolab/BL602/ConnectivityManagerImpl.cpp b/src/platform/bouffalolab/BL602/ConnectivityManagerImpl.cpp index 02d296c492abd9..56e3ebf522a36b 100644 --- a/src/platform/bouffalolab/BL602/ConnectivityManagerImpl.cpp +++ b/src/platform/bouffalolab/BL602/ConnectivityManagerImpl.cpp @@ -69,7 +69,7 @@ namespace chip { namespace DeviceLayer { ConnectivityManagerImpl ConnectivityManagerImpl::sInstance; -static ConnectivityManager::WiFiStationState ConnectivityManagerImpl::mWiFiStationState = +ConnectivityManager::WiFiStationState ConnectivityManagerImpl::mWiFiStationState = ConnectivityManager::kWiFiStationState_NotConnected; void ConnectivityManagerImpl::WifiStationStateChange(void) @@ -86,8 +86,6 @@ void ConnectivityManagerImpl::WifiStationStateChange(void) void ConnectivityManagerImpl::DriveStationState() { - -exit: return; } @@ -101,7 +99,7 @@ CHIP_ERROR ConnectivityManagerImpl::_SetWiFiStationMode(WiFiStationMode val) CHIP_ERROR err = CHIP_NO_ERROR; DeviceLayer::SystemLayer().ScheduleWork(DriveStationState, NULL); -exit: + return err; } diff --git a/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp b/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp index e260e750a51493..9c972071a60631 100644 --- a/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp +++ b/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp @@ -30,11 +30,11 @@ #include extern "C" { -#include #include +#include +#include #include -#include -#include +#include #include } @@ -248,7 +248,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBssId(ByteSpan & BssId) CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiSecurityType(uint8_t & securityType) { - int authmode; + // int authmode; // authmode = mgmr_get_security_type(); // securityType = MapAuthModeToSecurityType(authmode); diff --git a/src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp b/src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp index a7036b041b0ea2..dc7aee8708d0f5 100644 --- a/src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp +++ b/src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp @@ -47,7 +47,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t size_t outlen = 0; BL602Config::Key ckey = { key }; - err = BL602Config::ReadConfigValueBin(ckey, value, value_size, outlen); + err = BL602Config::ReadConfigValueBin(ckey, (uint8_t *) value, value_size, outlen); if (CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND == err) { err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; @@ -69,7 +69,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, CHIP_ERROR err = CHIP_NO_ERROR; BL602Config::Key ckey = { key }; - err = BL602Config::WriteConfigValueBin(ckey, value, value_size); + err = BL602Config::WriteConfigValueBin(ckey, (uint8_t *) value, value_size); if (CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND == err) { err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; diff --git a/src/platform/bouffalolab/BL602/Logging.cpp b/src/platform/bouffalolab/BL602/Logging.cpp index 872fd3c65ce1cf..33397bd520f409 100644 --- a/src/platform/bouffalolab/BL602/Logging.cpp +++ b/src/platform/bouffalolab/BL602/Logging.cpp @@ -6,15 +6,7 @@ #include #include - -// #ifdef LOG_LOCAL_LEVEL -// #undef LOG_LOCAL_LEVEL -// #endif -// #define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE - -extern "C" { -#include -} +#include #ifdef PW_RPC_ENABLED #include "PigweedLogger.h" diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp index b99b4d212ae739..7cb2bfaad1cc20 100644 --- a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp +++ b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp @@ -16,14 +16,14 @@ */ #include +#include +#include #include #include #include +#include #include #include -#include -#include -#include #include #include @@ -47,7 +47,7 @@ constexpr char kWiFiCredentialsKeyName[] = "wifi-pass"; constexpr char blWiFiSSIDKeyName[] = "bl-wifi-ssid"; constexpr char blWiFiCredentialsKeyName[] = "bl-wifi-pass"; -static uint8_t WiFiSSIDStr[DeviceLayer::Internal::kMaxWiFiSSIDLength]; +static char WiFiSSIDStr[DeviceLayer::Internal::kMaxWiFiSSIDLength]; static uint8_t scan_type = 0; } // namespace @@ -184,7 +184,7 @@ CHIP_ERROR BLWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, memcpy(passwd, key, keyLen); wifi_interface_t wifi_interface; wifi_interface = wifi_mgmr_sta_enable(); - wifi_mgmr_sta_connect(wifi_interface, wifi_ssid, passwd, NULL, NULL, 0, 0); + wifi_mgmr_sta_connect(&wifi_interface, wifi_ssid, passwd, NULL, NULL, 0, 0); ReturnErrorOnFailure(ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Disabled)); @@ -221,7 +221,6 @@ void BLWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callback { CHIP_ERROR err = CHIP_NO_ERROR; Status networkingStatus = Status::kSuccess; - static int save = 0; VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound); VerifyOrExit(mpConnectCallback == nullptr, networkingStatus = Status::kUnknownError); diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h index 70090297551aa3..fc08f778e8fbff 100644 --- a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h +++ b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h @@ -16,8 +16,8 @@ */ #pragma once +#include #include -#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningWiFiDriver.cpp b/src/platform/bouffalolab/BL602/NetworkCommissioningWiFiDriver.cpp index c9a35fe40194fe..c469c5a90edb01 100644 --- a/src/platform/bouffalolab/BL602/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/bouffalolab/BL602/NetworkCommissioningWiFiDriver.cpp @@ -19,9 +19,9 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp b/src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp index 2d1e0dc8daf955..16fad1b9ffcf5f 100644 --- a/src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp +++ b/src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp @@ -31,14 +31,14 @@ #include #include +#include #include -#include #include #include #include #include -#include +#include #include extern "C" { @@ -165,13 +165,10 @@ static void WifiStaConnected(void) chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus::kConnected)); } } +typedef void (*aos_event_cb)(input_event_t * event, void * private_data); void OnWiFiPlatformEvent(input_event_t * event, void * private_data) { - static char * ssid; - static char * password; - int ret; - switch (event->code) { case CODE_WIFI_ON_INIT_DONE: { @@ -223,7 +220,7 @@ void OnWiFiPlatformEvent(input_event_t * event, void * private_data) CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) { - CHIP_ERROR err; + CHIP_ERROR err = CHIP_NO_ERROR; static uint8_t stack_wifi_init = 0; TaskHandle_t backup_eventLoopTask; @@ -238,7 +235,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) if (1 == stack_wifi_init) { log_error("Wi-Fi already initialized!\r\n"); - return; + return CHIP_NO_ERROR; } hal_wifi_start_firmware_task(); @@ -255,6 +252,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) err = Internal::GenericPlatformManagerImpl_FreeRTOS::_InitChipStack(); SuccessOrExit(err); Internal::GenericPlatformManagerImpl_FreeRTOS::mEventLoopTask = backup_eventLoopTask; + exit: return err; } diff --git a/src/platform/bouffalolab/BL602/PlatformManagerImpl.h b/src/platform/bouffalolab/BL602/PlatformManagerImpl.h index f51556099cf911..861e446f0beec3 100644 --- a/src/platform/bouffalolab/BL602/PlatformManagerImpl.h +++ b/src/platform/bouffalolab/BL602/PlatformManagerImpl.h @@ -24,20 +24,12 @@ #pragma once +#include #include namespace chip { namespace DeviceLayer { -typedef struct -{ - uint32_t time; - uint16_t type; - uint16_t code; - unsigned long value; - unsigned long extra; -} input_event_t; - /** * Concrete implementation of the PlatformManager singleton object for the BL602 platform. */ diff --git a/src/platform/bouffalolab/BL602/args.gni b/src/platform/bouffalolab/BL602/args.gni index 384290911e92e5..0f32696fb1c914 100644 --- a/src/platform/bouffalolab/BL602/args.gni +++ b/src/platform/bouffalolab/BL602/args.gni @@ -16,9 +16,9 @@ import("//build_overrides/bouffalolab_iot_sdk.gni") import("//build_overrides/chip.gni") import("${chip_root}/examples/platform/bouffalolab/bl602/args.gni") -riscv_platform_config = "${bl602_sdk_build_root}/bl602_riscv.gni" +riscv_platform_config = "${bouffalolab_iot_sdk_build_root}/common/rsicv.gni" -mbedtls_target = "${bl602_sdk_build_root}:bl602_sdk" +mbedtls_target = "${bouffalolab_iot_sdk_build_root}/bl602:bl_iot_sdk" chip_device_platform = "bl602" diff --git a/src/platform/bouffalolab/BL602/wifi_mgmr_portable.c b/src/platform/bouffalolab/BL602/wifi_mgmr_portable.c index 244ad2c1074591..c41c3bcc8562cb 100644 --- a/src/platform/bouffalolab/BL602/wifi_mgmr_portable.c +++ b/src/platform/bouffalolab/BL602/wifi_mgmr_portable.c @@ -1,16 +1,10 @@ -#include "wifi_mgmr.h" -#include "wifi_mgmr_api.h" +#include +#include +#include -#include #include #include -BLOG_DECLARE(tcal_power) -BLOG_DECLARE(scan) -#define USER_UNUSED(a) ((void) (a)) - -#define DEBUG_HEADER "[WF][SM] " - int wifi_mgmr_get_bssid(uint8_t * bssid) { int i; @@ -20,7 +14,7 @@ int wifi_mgmr_get_bssid(uint8_t * bssid) bssid[i] = wifiMgmr.wifi_mgmr_stat_info.bssid[i]; } - return; + return 0; } int wifi_mgmr_get_scan_ap_num(void) diff --git a/src/platform/bouffalolab/BL702/BUILD.gn b/src/platform/bouffalolab/BL702/BUILD.gn index 310c721a699d8e..7fde9b5495c34f 100644 --- a/src/platform/bouffalolab/BL702/BUILD.gn +++ b/src/platform/bouffalolab/BL702/BUILD.gn @@ -72,10 +72,10 @@ static_library("BL702") { # needed for MTD/FTD import("//build_overrides/bouffalolab_iot_sdk.gni") - import("${bl702_sdk_build_root}/bl702_sdk.gni") + import("${bouffalolab_iot_sdk_build_root}/bl702/bl_iot_sdk.gni") public_deps += [ - "${bl702_sdk_build_root}:bl702_sdk", - "${bl702_sdk_build_root}:mbedtls", + "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk", + "${bouffalolab_iot_sdk_build_root}/bl702:mbedtls", ] sources += [ diff --git a/src/platform/bouffalolab/BL702/Logging.cpp b/src/platform/bouffalolab/BL702/Logging.cpp index 24193ea434ae28..5bb986d63cb27d 100644 --- a/src/platform/bouffalolab/BL702/Logging.cpp +++ b/src/platform/bouffalolab/BL702/Logging.cpp @@ -14,22 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include #include #include -#include - -extern "C" { -#include -} - #ifdef PW_RPC_ENABLED #include "PigweedLogger.h" #endif +#include +#include +#include + namespace chip { namespace Logging { namespace Platform { diff --git a/src/platform/bouffalolab/BL702/ThreadStackManagerImpl.cpp b/src/platform/bouffalolab/BL702/ThreadStackManagerImpl.cpp index be9d29619aae4f..0fb93c75826058 100644 --- a/src/platform/bouffalolab/BL702/ThreadStackManagerImpl.cpp +++ b/src/platform/bouffalolab/BL702/ThreadStackManagerImpl.cpp @@ -49,8 +49,13 @@ CHIP_ERROR ThreadStackManagerImpl::InitThreadStack(otInstance * otInst) CHIP_ERROR err = CHIP_NO_ERROR; ot_alarmInit(); +#ifdef OT_THREAD_PORT_1_3 + otRadio_opt_t opt; + opt.byte = 0; + ot_radioInit(opt); +#else ot_radioInit(); - +#endif // Initialize the generic implementation base classes. err = GenericThreadStackManagerImpl_FreeRTOS::DoInit(); SuccessOrExit(err); @@ -73,15 +78,18 @@ bool ThreadStackManagerImpl::IsInitialized() using namespace ::chip::DeviceLayer; -ot_system_event_t ot_system_event_var; +ot_system_event_t ot_system_event_var = OT_SYSTEM_EVENT_NONE; void otSysProcessDrivers(otInstance * aInstance) { +#ifdef OT_THREAD_PORT_1_3 + ot_system_event_t sevent = otrGetNotifyEvent(); +#else ot_system_event_t sevent = OT_SYSTEM_EVENT_NONE; - OT_GET_NOTIFY(sevent); +#endif + ot_alarmTask(sevent); - // ot_uartTask(sevent); ot_radioTask(sevent); } @@ -117,3 +125,51 @@ extern "C" void otPlatFree(void * aPtr) { free(aPtr); } + +#ifdef OT_THREAD_PORT_1_3 +extern "C" uint32_t otrEnterCrit(void) +{ + if (xPortIsInsideInterrupt()) + { + return taskENTER_CRITICAL_FROM_ISR(); + } + else + { + taskENTER_CRITICAL(); + return 0; + } +} + +extern "C" void otrExitCrit(uint32_t tag) +{ + if (xPortIsInsideInterrupt()) + { + taskEXIT_CRITICAL_FROM_ISR(tag); + } + else + { + taskEXIT_CRITICAL(); + } +} + +extern "C" ot_system_event_t otrGetNotifyEvent(void) +{ + ot_system_event_t sevent = OT_SYSTEM_EVENT_NONE; + + taskENTER_CRITICAL(); + sevent = ot_system_event_var; + ot_system_event_var = OT_SYSTEM_EVENT_NONE; + taskEXIT_CRITICAL(); + + return sevent; +} + +extern "C" void otrNotifyEvent(ot_system_event_t sevent) +{ + uint32_t tag = otrEnterCrit(); + ot_system_event_var = (ot_system_event_t)(ot_system_event_var | sevent); + otrExitCrit(tag); + + otSysEventSignalPending(); +} +#endif diff --git a/src/platform/bouffalolab/BL702/args.gni b/src/platform/bouffalolab/BL702/args.gni index 77396b3b094c8d..6d7aad914b6a28 100644 --- a/src/platform/bouffalolab/BL702/args.gni +++ b/src/platform/bouffalolab/BL702/args.gni @@ -20,9 +20,9 @@ import("${chip_root}/examples/platform/bouffalolab/bl702/args.gni") chip_device_platform = "bl702" -riscv_platform_config = "${bl702_sdk_build_root}/bl702_riscv.gni" +riscv_platform_config = "${bouffalolab_iot_sdk_build_root}/common/rsicv.gni" -mbedtls_target = "${bl702_sdk_build_root}:mbedtls" +mbedtls_target = "${bouffalolab_iot_sdk_build_root}/bl702:mbedtls" chip_inet_config_enable_ipv4 = false chip_inet_config_enable_tcp_endpoint = false @@ -37,7 +37,8 @@ openthread_core_config_platform_check_file = "bl702-openthread-core-bl-config-check.h" openthread_project_include_dirs = [ "${chip_root}/src/platform/bouffalolab/BL702" ] -openthread_external_platform = "${bl702_sdk_build_root}:bl702_sdk" +openthread_external_platform = + "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" pw_build_LINK_DEPS = [ "$dir_pw_assert:impl", diff --git a/src/platform/bouffalolab/BL702/bl702Config.cpp b/src/platform/bouffalolab/BL702/bl702Config.cpp index d824474b7ad91b..a036a9277afe66 100644 --- a/src/platform/bouffalolab/BL702/bl702Config.cpp +++ b/src/platform/bouffalolab/BL702/bl702Config.cpp @@ -25,7 +25,6 @@ #include #include -// #include #include namespace chip { diff --git a/third_party/bouffalolab/bl602/BUILD.gn b/third_party/bouffalolab/bl602/BUILD.gn index 82413e63efd49c..d358e393114859 100644 --- a/third_party/bouffalolab/bl602/BUILD.gn +++ b/third_party/bouffalolab/bl602/BUILD.gn @@ -13,15 +13,15 @@ # limitations under the License. import("//build_overrides/bouffalolab_iot_sdk.gni") -import("${bl602_sdk_build_root}/bl602_sdk.gni") +import("${bouffalolab_iot_sdk_build_root}/bl602/bl_iot_sdk.gni") declare_args() { - # Build target to use for bl602 SDK. Use this to set global SDK defines. - bl602_sdk_target = "" + # Build target to use for Bouffalo Lab IOT SDK. Use this to set global SDK defines. + bl_iot_sdk_target = "" } -assert(bl602_sdk_target != "", "bl602_sdk_target must be specified") +assert(bl_iot_sdk_target != "", "bl_iot_sdk_target must be specified") -group("bl602_sdk") { - public_deps = [ bl602_sdk_target ] +group("bl_iot_sdk") { + public_deps = [ bl_iot_sdk_target ] } diff --git a/third_party/bouffalolab/bl602/bl602_board.gni b/third_party/bouffalolab/bl602/bl602_board.gni deleted file mode 100644 index 123f6ca46c61e5..00000000000000 --- a/third_party/bouffalolab/bl602/bl602_board.gni +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2021 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. - -declare_args() { - # BL602 board used - bl602_board = "BL-HWC-G1" -} - -if (bl602_board == "") { - # bl602_board = getenv("BL602_BOARD") - bl602_board = "BL-HWC-G1" -} - -assert(bl602_board != "", "bl602_board must be specified") - -board_defines = [] -# bl602_mcu = "" -# enable_fem = true -# board_defines += [ "PAL_RTCC_CLOCK_LFRCO" ] diff --git a/third_party/bouffalolab/bl602/bl602_sdk.gni b/third_party/bouffalolab/bl602/bl602_sdk.gni deleted file mode 100644 index fb8a661ef263ae..00000000000000 --- a/third_party/bouffalolab/bl602/bl602_sdk.gni +++ /dev/null @@ -1,636 +0,0 @@ -# Copyright (c) 2021 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("//args.gni") -import("//build_overrides/bouffalolab_iot_sdk.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/mbedtls.gni") -import("${chip_root}/src/lib/lib.gni") - -import("bl602_board.gni") - -declare_args() { - # Location of the bl602 SDK. - bl602_sdk_root = "${chip_root}/third_party/bouffalolab/repo" -} - -assert(bl602_sdk_root != "", "bl602_sdk_root must be specified") - -# Defines an bl602 SDK build target. -# -# Parameters: -# bl602_sdk_root - The location of the bl602 SDK. -# sources - The sources files to build. -template("bl602_sdk") { - if (defined(invoker.bl602_sdk_root)) { - bl602_sdk_root = invoker.bl602_sdk_root - } - - assert(bl602_sdk_root != "", "bl602_sdk_root must be specified") - - sdk_target_name = target_name - - config("${sdk_target_name}_config") { - include_dirs = [] - libs = [] - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } - - if (defined(invoker.freertos_config)) { - cflags_c = [ - "-include", - rebase_path("${invoker.freertos_config}", root_build_dir), - ] - } - - # Treat these includes as system includes, so warnings in them are not fatal. - _include_dirs = [ - "${bl602_sdk_root}", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/config", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/GCC/RISC-V", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/GCC/RISC-V/chip_specific_extensions/RV32F_float_abi_single", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/panic", - - "${bl602_sdk_root}/components/network/lwip/lwip-port/config", - "${bl602_sdk_root}/components/network/lwip/src/include", - "${bl602_sdk_root}/components/network/lwip/src/include/lwip", - "${bl602_sdk_root}/components/network/lwip/src/include/lwip/apps", - "${bl602_sdk_root}/components/network/lwip/lwip-port", - "${bl602_sdk_root}/components/network/lwip/lwip-port/FreeRTOS", - "${bl602_sdk_root}/components/network/lwip/lwip-port/hook", - "${bl602_sdk_root}/components/network/lwip_mdns", - - #"${bl602_sdk_root}/components/network/lwip_mdns", - - "${bl602_sdk_root}/components/platform/hosal", - "${bl602_sdk_root}/components/platform/hosal/include", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal", - "${bl602_sdk_root}/components/utils/include", - "${bl602_sdk_root}/components/security/blcrypto_suite/priv_inc", - "${bl602_sdk_root}/components/security/blcrypto_suite/inc/blcrypto_suite", - - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Inc", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Device/Bouffalo/BL602/Peripherals", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/RISCV/Device/Bouffalo/BL602/Startup", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/platform_print", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/RISCV/Core/Include", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/soft_crc", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/partition", - - "${bl602_sdk_root}/components/sys/bltime/include", - - "${bl602_sdk_root}/components/stage/easyflash4/inc", - "${bl602_sdk_root}/components/sys/blmtd/include", - "${bl602_sdk_root}/components/stage/blfdt/inc", - - "${bl602_sdk_root}/components/stage/blog", - "${bl602_sdk_root}/components/stage/cli/cli/include", - "${bl602_sdk_root}/components/utils/include", - - "${chip_root}/third_party/mbedtls/repo/include", - - "${bl602_sdk_root}/components/sys/bloop/bloop/include", - "${bl602_sdk_root}/components/sys/bloop/loopset/include", - "${bl602_sdk_root}/components/sys/bloop/looprt/include", - - "${bl602_sdk_root}/components/fs/vfs/include", - "${bl602_sdk_root}/components/stage/yloop/include", - - "${bl602_sdk_root}/components/network/wifi/include", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal", - "${bl602_sdk_root}/components/stage/yloop/include/aos", - "${bl602_sdk_root}/components/stage/yloop/include/aos", - - "${bl602_sdk_root}/components/network/ble/blestack/src/common/include/zephyr", - "${bl602_sdk_root}/components/network/ble/blestack/src/port/include", - "${bl602_sdk_root}/components/network/ble/blestack/src", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/include", - "${bl602_sdk_root}/components/network/ble/blestack/src/include", - "${bl602_sdk_root}/components/network/ble/blestack/src/include/bluetooth", - "${bl602_sdk_root}/components/network/ble/blecontroller/ble_inc", - "${bl602_sdk_root}/components/network/ble/blestack/src/host", - "${bl602_sdk_root}/components/network/ble/blestack/src/include/drivers/bluetooth", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/include/misc", - "${bl602_sdk_root}/components/network/ble/blestack/src/common", - "${bl602_sdk_root}/components/network/ble/blestack/src/bl_hci_wrapper", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/include/tinycrypt", - - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/include", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver", - "${bl602_sdk_root}/components/network/dns_server/include", - "${bl602_sdk_root}/components/network/rfparam_adapter_tmp/rftlv", - - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Inc", - "${bl602_sdk_root}/components/security/blcrypto_suite/inc/blcrypto_suite", - "${bl602_sdk_root}/components/security/blcrypto_suite/inc", - "${bl602_sdk_root}/components/security/blcrypto_suite/priv_inc", - "${bl602_sdk_root}/components/network/wifi/modules/supplicant/src/sae", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/platform_print", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/ring_buffer", - "${bl602_sdk_root}/components/utils/include", - - "${bl602_sdk_root}/components/stage/cli/cli/include/", - "${bl602_sdk_root}/components/sys/blota/include", - "${bl602_sdk_root}/components/utils/include/", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Inc/", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/", - - #bl602 portable - "${chip_root}/third_party/bouffalolab/bl602/portable", - - # rebase add - "${bl602_sdk_root}/components/network/wifi_hosal/include", - "${bl602_sdk_root}/components/os/bl_os_adapter/bl_os_adapter", - "${bl602_sdk_root}/components/os/bl_os_adapter/bl_os_adapter/include", - "${bl602_sdk_root}/components/os/bl_os_adapter/bl_os_adapter/include/bl_os_adapter", - "${bl602_sdk_root}/components/security/wpa_supplicant/include/bl_supplicant", - - # wpa_supplicant - "${bl602_sdk_root}/components/security/wpa_supplicant/port", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/ap", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/common", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/eap_peer", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/rsn_supp", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/utils", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps", - "${bl602_sdk_root}/components/security/wpa_supplicant/test", - "${bl602_sdk_root}/components/security/wpa_supplicant/port/include", - "${bl602_sdk_root}/components/security/wpa_supplicant/src", - "${bl602_sdk_root}/components/security/wpa_supplicant/include", - - "${bl602_sdk_root}/security/wpa_supplicant/src/", - - # hosal - "${bl602_sdk_root}/components/platform/hosal/sec_common", - ] - - # if (bl602_board == "BL-HWC-G1") { - # _include_dirs += [ "${bl602_sdk_root}/hardware/board/config/bl_hwc_g1" ] - # } - - bl_sdk_ver = getenv("BL_SDK_VER") - defines = [ - "MBEDTLS_CONFIG_FILE=\"bl602-chip-mbedtls-config.h\"", - "__STARTUP_CLEAR_BSS", - "HARD_FAULT_LOG_ENABLE", - "RETARGET_VCOM", - "RETARGET_USART0", - "ARCH_RISCV", - "portasmHANDLE_INTERRUPT=interrupt_entry", - - "SYS_APP_TASK_STACK_SIZE=2048", - "SYS_APP_TASK_PRIORITY=28", - "BL_SDK_VER=\"$bl_sdk_ver\"", - - "SYS_BLOG_ENABLE=1", - "SYS_VFS_ENABLE=1", - "SYS_AOS_LOOP_ENABLE=1", - "BL602_USE_HAL_DRIVER=1", - "BL602=BL602", - - "CFG_TXDESC=2", - "CFG_STA_MAX=1", - "CFG_CHIP_BL602", - - # "SYS_AOS_CLI_ENABLE=1", - - # set CONFIG_RENDEZVOUS_MODE to RENDEZVOUS_MODE_BLE (2) - "CONFIG_RENDEZVOUS_MODE=2", - - # bluetooth - "CONFIG_SET_TX_PWR", - "CFG_BLE_ENABLE", - "BFLB_BLE", - "CFG_BLE", - "CFG_SLEEP", - "OPTIMIZE_DATA_EVT_FLOW_FROM_CONTROLLER", - "CFG_BT_RESET", - "CFG_CON=1", - "CFG_BLE_TX_BUFF_DATA=2", - - # "CONFIG_BLE_TX_BUFF_DATA=2", - "CONFIG_BT_PERIPHERAL=1", - "CONFIG_BT_L2CAP_DYNAMIC_CHANNEL", - "CONFIG_BT_GATT_CLIENT", - "CONFIG_BT_CONN=1", - "CONFIG_BT_GATT_DIS_PNP", - "CONFIG_BT_GATT_DIS_SERIAL_NUMBER", - "CONFIG_BT_GATT_DIS_FW_REV", - "CONFIG_BT_GATT_DIS_HW_REV", - "CONFIG_BT_GATT_DIS_SW_REV", - "CONFIG_BT_ECC", - "CONFIG_BT_GATT_DYNAMIC_DB", - "CONFIG_BT_GATT_SERVICE_CHANGED", - "CONFIG_BT_KEYS_OVERWRITE_OLDEST", - "CONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING", - "CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS", - "CONFIG_BT_BONDABLE", - "CONFIG_BT_HCI_VS_EVT_USER", - "CONFIG_BT_ASSERT", - "CONFIG_BT_SETTINGS_CCC_LAZY_LOADING", - "CONFIG_BT_SETTINGS_USE_PRINTK", - "CFG_BLE_STACK_DBG_PRINT", - - #"__FILENAME__=__FILE__", - "__FILENAME__=\"\b\"", - "BL602_LOG_ENABLED=1", - "ENOTSUP=134", - - #dump backtrace - "CONF_ENABLE_FRAME_PTR=1", - "CONF_ENABLE_FUNC_BACKTRACE_ELF=out/bl602-light/chip-bl602-lighting-example.out", - "CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE=128", - - # board defines - "BL_CHIP_NAME=\"BL602\"", - - #include defines - "OS_USING_FREERTOS", - "BL602_MATTER_SUPPORT", - "PBUF_POOL_SIZE=20", - "TD_DIAGNOSIS_STA", - "CONFIG_ENABLE_IPV6_ADDR_CALLBACK", - "CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT", - "CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT", - ] - - defines += board_defines - - libs += [ - "${bl602_sdk_root}/components/network/wifi/lib/libwifi.a", - "${bl602_sdk_root}/components/network/ble/blecontroller_602_m0s1/lib/libblecontroller_602_m0s1.a", - ] - - cflags = [ - "-include", - rebase_path( - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/errno.h", - root_build_dir), - ] - - cflags += [ - "-Wno-maybe-uninitialized", - "-Wno-shadow", - "-Wno-error", - "-fcommon", - "-fno-jump-tables", - ] - - cflags_cc = [ "-fpermissive" ] - - foreach(include_dir, _include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - - cflags += [ "-save-temps=obj" ] - cflags += [ "-Wno-maybe-uninitialized" ] - - if (defined(invoker.defines)) { - defines += invoker.defines - } - } - - source_set(sdk_target_name) { - sources = [ - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_boot2.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_flash.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_wdt.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hosal_gpio.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hosal_ota.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_mfg_flash.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sf_cfg_ext.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sflash_ext.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_timer.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_xip_sflash_ext.c", - "${bl602_sdk_root}/components/stage/cli/cli/cli.c", - "${bl602_sdk_root}/components/stage/easyflash4/src/easyflash.c", - "${bl602_sdk_root}/components/stage/easyflash4/src/ef_env.c", - "${bl602_sdk_root}/components/stage/easyflash4/src/ef_port.c", - "${bl602_sdk_root}/components/stage/easyflash4/src/ef_utils.c", - "${bl602_sdk_root}/components/sys/blmtd/bl_mtd.c", - "${bl602_sdk_root}/components/sys/blota/bl_sys_ota_cli.c", - "${bl602_sdk_root}/components/utils/src/utils_hex.c", - "${bl602_sdk_root}/components/utils/src/utils_hexdump.c", - "${bl602_sdk_root}/components/utils/src/utils_sha256.c", - "${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/oid.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/pkcs5.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/sha256.c", - "${chip_root}/third_party/mbedtls/repo/library/sha512.c", - "${chip_root}/third_party/mbedtls/repo/library/x509_create.c", - "${chip_root}/third_party/mbedtls/repo/library/x509write_csr.c", - ] - - sources += [ - "${bl602_sdk_root}/components/fs/vfs/device/vfs_uart.c", - "${bl602_sdk_root}/components/fs/vfs/src/vfs.c", - "${bl602_sdk_root}/components/fs/vfs/src/vfs_file.c", - "${bl602_sdk_root}/components/fs/vfs/src/vfs_inode.c", - "${bl602_sdk_root}/components/fs/vfs/src/vfs_register.c", - "${bl602_sdk_root}/components/libc/newlibc/stdatomic.c", - "${bl602_sdk_root}/components/libc/newlibc/syscalls.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/bl_hci_wrapper/bl_hci_wrapper.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/atomic_c.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/buf.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/dec.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/log.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/poll.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/common/work_q.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/hci_onchip/hci_driver.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/att.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/bl_host_assist.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/conn.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/crypto.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/gatt.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/hci_core.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/l2cap.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/settings.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/host/uuid.c", - "${bl602_sdk_root}/components/network/ble/blestack/src/port/bl_port.c", - "${bl602_sdk_root}/components/network/dns_server/src/dns_server.c", - "${bl602_sdk_root}/components/network/dns_server/src/web_server.c", - "${bl602_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/ethernetif.c", - "${bl602_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/sys_arch.c", - "${bl602_sdk_root}/components/network/lwip/src/api/api_lib.c", - "${bl602_sdk_root}/components/network/lwip/src/api/api_msg.c", - "${bl602_sdk_root}/components/network/lwip/src/api/err.c", - "${bl602_sdk_root}/components/network/lwip/src/api/if_api.c", - "${bl602_sdk_root}/components/network/lwip/src/api/netbuf.c", - "${bl602_sdk_root}/components/network/lwip/src/api/netdb.c", - "${bl602_sdk_root}/components/network/lwip/src/api/netifapi.c", - "${bl602_sdk_root}/components/network/lwip/src/api/sockets.c", - "${bl602_sdk_root}/components/network/lwip/src/api/tcpip.c", - "${bl602_sdk_root}/components/network/lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c", - "${bl602_sdk_root}/components/network/lwip/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c", - "${bl602_sdk_root}/components/network/lwip/src/core/altcp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/altcp_alloc.c", - "${bl602_sdk_root}/components/network/lwip/src/core/altcp_tcp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/def.c", - "${bl602_sdk_root}/components/network/lwip/src/core/dns.c", - "${bl602_sdk_root}/components/network/lwip/src/core/inet_chksum.c", - "${bl602_sdk_root}/components/network/lwip/src/core/init.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ip.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv4/autoip.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv4/dhcp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv4/etharp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv4/icmp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv4/igmp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv4/ip4.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv4/ip4_addr.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv4/ip4_frag.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/dhcp6.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/ethip6.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/icmp6.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/inet6.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/ip6.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/ip6_addr.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/ip6_frag.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/mld6.c", - "${bl602_sdk_root}/components/network/lwip/src/core/ipv6/nd6.c", - "${bl602_sdk_root}/components/network/lwip/src/core/mem.c", - "${bl602_sdk_root}/components/network/lwip/src/core/memp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/netif.c", - "${bl602_sdk_root}/components/network/lwip/src/core/pbuf.c", - "${bl602_sdk_root}/components/network/lwip/src/core/raw.c", - "${bl602_sdk_root}/components/network/lwip/src/core/stats.c", - "${bl602_sdk_root}/components/network/lwip/src/core/sys.c", - "${bl602_sdk_root}/components/network/lwip/src/core/tcp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/tcp_in.c", - "${bl602_sdk_root}/components/network/lwip/src/core/tcp_out.c", - "${bl602_sdk_root}/components/network/lwip/src/core/timeouts.c", - "${bl602_sdk_root}/components/network/lwip/src/core/udp.c", - "${bl602_sdk_root}/components/network/lwip/src/core/utils.c", - "${bl602_sdk_root}/components/network/lwip/src/netif/bridgeif.c", - "${bl602_sdk_root}/components/network/lwip/src/netif/bridgeif_fdb.c", - "${bl602_sdk_root}/components/network/lwip/src/netif/ethernet.c", - "${bl602_sdk_root}/components/network/lwip/src/netif/lowpan6.c", - "${bl602_sdk_root}/components/network/lwip/src/netif/lowpan6_ble.c", - "${bl602_sdk_root}/components/network/lwip/src/netif/lowpan6_common.c", - "${bl602_sdk_root}/components/network/lwip/src/netif/slipif.c", - "${bl602_sdk_root}/components/network/lwip/src/netif/zepif.c", - "${bl602_sdk_root}/components/network/lwip_dhcpd/dhcp_server_raw.c", - - #"${bl602_sdk_root}/components/network/lwip_mdns/mdns_server.c", - "${bl602_sdk_root}/components/network/sntp/sntp.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_cmds.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_irqs.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_main.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_mod_params.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_msg_rx.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_msg_tx.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_platform.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_rx.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_tx.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_utils.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/ipc_host.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/stateMachine.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_api.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_cli.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_event.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_ext.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_profile.c", - "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_netif.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_chip.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_dma.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_efuse.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_gpio.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_hbn.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_irq.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_pds.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_pm.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_pwm.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_rtc.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_sec.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_sys.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_timer.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_uart.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/bl_wifi.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hal_board.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hal_boot2.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hal_button.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hal_gpio.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hal_hbn.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hal_sys.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hal_wifi.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hosal_dma.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hosal_pwm.c", - "${bl602_sdk_root}/components/platform/hosal/bl602_hal/hosal_uart.c", - "${bl602_sdk_root}/components/platform/hosal/sec_common/bl_sec_sha.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602/evb/src/boot/gcc/start.S", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602/evb/src/debug.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602/evb/src/strntoumax.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/platform_print/platform_device.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_dma.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_ef_ctrl.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_glb.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_hbn.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_mfg_efuse.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_mfg_media.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_pwm.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_romapi.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sec_eng.c", - "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_uart.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/event_groups.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/list.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/misaligned/fp_asm.S", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/misaligned/misaligned_ldst.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/panic/panic_c.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/GCC/RISC-V/port.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/GCC/RISC-V/portASM.S", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/MemMang/heap_5.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/queue.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/stream_buffer.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/tasks.c", - "${bl602_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/timers.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_aes.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_bignum.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_ecp.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_ecp_curves.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_export_fw.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_hacc.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_hacc_glue.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_hacc_secp256r1_mul.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_platform_util.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_porting.c", - "${bl602_sdk_root}/components/stage/blfdt/src/fdt.c", - "${bl602_sdk_root}/components/stage/blfdt/src/fdt_ro.c", - "${bl602_sdk_root}/components/stage/blog/blog.c", - "${bl602_sdk_root}/components/stage/yloop/src/aos_freertos.c", - "${bl602_sdk_root}/components/stage/yloop/src/device.c", - "${bl602_sdk_root}/components/stage/yloop/src/local_event.c", - "${bl602_sdk_root}/components/stage/yloop/src/select.c", - "${bl602_sdk_root}/components/stage/yloop/src/yloop.c", - "${bl602_sdk_root}/components/sys/bloop/bloop/src/bloop_base.c", - "${bl602_sdk_root}/components/sys/bloop/bloop/src/bloop_handler_sys.c", - "${bl602_sdk_root}/components/sys/bloop/looprt/src/looprt.c", - "${bl602_sdk_root}/components/sys/bloop/loopset/src/loopset_led.c", - "${bl602_sdk_root}/components/sys/bltime/bl_sys_time.c", - "${bl602_sdk_root}/components/utils/src/utils_crc.c", - "${bl602_sdk_root}/components/utils/src/utils_dns.c", - "${bl602_sdk_root}/components/utils/src/utils_hmac_sha1_fast.c", - "${bl602_sdk_root}/components/utils/src/utils_list.c", - "${bl602_sdk_root}/components/utils/src/utils_log.c", - "${bl602_sdk_root}/components/utils/src/utils_notifier.c", - "${bl602_sdk_root}/components/utils/src/utils_psk_fast.c", - "${bl602_sdk_root}/components/utils/src/utils_rbtree.c", - - #rebase add - "${bl602_sdk_root}/components/network/rfparam_adapter_tmp/rftlv/phy_rftlv.c", - "${bl602_sdk_root}/components/network/wifi_hosal/port/wifi_hosal_bl602.c", - "${bl602_sdk_root}/components/network/wifi_hosal/wifi_hosal.c", - "${bl602_sdk_root}/components/os/bl_os_adapter/bl_os_adapter/bl_os_hal.c", - "${bl602_sdk_root}/components/platform/hosal/sec_common/bl_sec_aes.c", - "${bl602_sdk_root}/components/platform/hosal/sec_common/bl_sec_pka.c", - "${bl602_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_supplicant_api.c", - "${bl602_sdk_root}/components/utils/src/utils_getopt.c", - "${bl602_sdk_root}/components/utils/src/utils_string.c", - "${bl602_sdk_root}/components/utils/src/utils_tlv_bl.c", - - #bl602 portable - # "${chip_root}/third_party/bouffalolab/bl602/portable/async_log.c", - # "${chip_root}/third_party/bouffalolab/bl602/portable/bfl_main.c", - # "${chip_root}/third_party/bouffalolab/bl602/portable/debug.c", - # "${chip_root}/third_party/bouffalolab/bl602/portable/wifi_mgmr_portable.c", - - #wap_supplicant - "${bl602_sdk_root}/components/security/wpa_supplicant/port/os_bl.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/ap/ap_config.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/ap/wpa_auth_ie.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/ap/wpa_auth_rsn_ccmp_only.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_hostap.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_wpa3.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_wpa_main.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_wpas_glue.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_wps.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/common/sae.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/common/wpa_common.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-cbc.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-internal-bl.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-omac1.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-unwrap.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-wrap.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/crypto_internal-modexp.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/dh_group5.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/dh_groups.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/md5-internal.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/md5.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/rc4.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/sha1-internal.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/sha1-pbkdf2.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/sha1.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/sha256-internal.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/sha256-prf.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/crypto/sha256.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/eap_peer/eap_common.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/rsn_supp/pmksa_cache.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/rsn_supp/wpa.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/rsn_supp/wpa_ie.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/utils/common.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/utils/wpa_debug.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/utils/wpabuf.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps_attr_build.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps_attr_parse.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps_attr_process.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps_common.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps_dev_attr.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps_enrollee.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps_registrar.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/src/wps/wps_validate.c", - "${bl602_sdk_root}/components/security/wpa_supplicant/test/test_crypto-bl.c", - ] - - # } else if (bl_family == "bl706") { - # sources += [ - # ] - # } - - public_deps = [ - # "${segger_rtt_root}:segger_rtt", - # "${segger_rtt_root}:segger_rtt_printf", - # "${segger_rtt_root}:segger_rtt_syscalls", - ] - - if (defined(invoker.sources)) { - sources += invoker.sources - } - - public_configs = [ ":${sdk_target_name}_config" ] - } -} diff --git a/third_party/bouffalolab/bl602/bl_iot_sdk.gni b/third_party/bouffalolab/bl602/bl_iot_sdk.gni new file mode 100644 index 00000000000000..f527f27132f791 --- /dev/null +++ b/third_party/bouffalolab/bl602/bl_iot_sdk.gni @@ -0,0 +1,889 @@ +# Copyright (c) 2021 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("//args.gni") +import("//build_overrides/bouffalolab_iot_sdk.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/mbedtls.gni") +import("${chip_root}/src/lib/lib.gni") + +declare_args() { + bl_iot_sdk_root = "${chip_root}/third_party/bouffalolab/repo" +} + +assert(bl_iot_sdk_root != "", "bl_iot_sdk_root must be specified") + +# Defines an Bouffa Lab IOT SDK build target. +# +# Parameters: +# bl_iot_sdk_root - The location of Bouffalo Lab IOT SDK. +# sources - The sources files to build. +template("bl_iot_sdk") { + sdk_target_name = target_name + + config("${sdk_target_name}_config") { + defines = [ + "__FILENAME__=strrchr(__FILE__,'/')?strrchr(__FILE__,'/')+1:__FILE__", + "ARCH_RISCV", + "BL602=BL602", + "BL602_USE_HAL_DRIVER=1", + + "CFG_CHIP_BL602", + + "MBEDTLS_CONFIG_FILE=\"bl602-chip-mbedtls-config.h\"", + + #dump backtrace + "CONF_ENABLE_FRAME_PTR=1", + "CONF_ENABLE_FUNC_BACKTRACE_ELF=out/bl602-light/chip-bl602-lighting-example.out", + ] + + include_dirs = [ "${chip_root}/third_party/mbedtls/repo/include" ] + if (defined(invoker.include_dirs)) { + include_dirs += invoker.include_dirs + } + + if (defined(invoker.defines)) { + defines += invoker.defines + } + + if (defined(invoker.freertos_config)) { + cflags_c = [ + "-include", + rebase_path("${invoker.freertos_config}", root_build_dir), + ] + } + } + + source_set("${sdk_target_name}_code") { + sources = [ + "${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/oid.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/pkcs5.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/sha256.c", + "${chip_root}/third_party/mbedtls/repo/library/sha512.c", + "${chip_root}/third_party/mbedtls/repo/library/x509_create.c", + "${chip_root}/third_party/mbedtls/repo/library/x509write_csr.c", + ] + configs += [ ":${sdk_target_name}_config_freertos" ] + public_configs = [ ":${sdk_target_name}_config" ] + } + + source_set("${sdk_target_name}_soc") { + defines = [ "BL602_MATTER_SUPPORT" ] + + sources = [ + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602/evb/src/boot/gcc/start.S", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602/evb/src/debug.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602/evb/src/strntoumax.c", + ] + cflags_c = [ "-Wno-format-truncation" ] + } + + config("${sdk_target_name}_config_BSP_Driver") { + include_dirs = [ + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/RISCV/Device/Bouffalo/BL602/Startup", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/RISCV/Core/Include", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Device/Bouffalo/BL602/Peripherals", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Inc", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/platform_print", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/soft_crc", + ] + } + + source_set("${sdk_target_name}_BSP_Driver") { + include_dirs = [ + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/ring_buffer", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/partition", + ] + + sources = [ + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/Common/platform_print/platform_device.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_acomp.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_adc.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_aon.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_common.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_common_ext.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_dac.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_dma.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_ef_ctrl.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_glb.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_hbn.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_i2c.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_ir.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_l1c.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_mfg_efuse.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_mfg_flash.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_mfg_media.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_pds.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_pwm.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_romapi.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sdu.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sec_dbg.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sec_eng.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sf_cfg.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sf_cfg_ext.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sf_ctrl.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sflash.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_sflash_ext.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_spi.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_timer.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_tzc_sec.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_uart.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_xip_sflash.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Src/bl602_xip_sflash_ext.c", + ] + + configs += [ ":${sdk_target_name}_config_freertos" ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_BSP_Driver", + ] + cflags_c = [ + "-Wno-sign-compare", + "-Wno-unused-variable", + ] + } + + config("${sdk_target_name}_config_freertos") { + include_dirs = [ + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/config", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/GCC/RISC-V", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/panic", + ] + } + + source_set("${sdk_target_name}_bl602_freertos") { + defines = [ "portasmHANDLE_INTERRUPT=interrupt_entry" ] + include_dirs = [ "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/GCC/RISC-V/chip_specific_extensions/RV32F_float_abi_single" ] + + sources = [ + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/event_groups.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/list.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/misaligned/fp_asm.S", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/misaligned/misaligned_ldst.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/panic/panic_c.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/GCC/RISC-V/port.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/GCC/RISC-V/portASM.S", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/portable/MemMang/heap_5.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/queue.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/stream_buffer.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/tasks.c", + "${bl_iot_sdk_root}/components/platform/soc/bl602/freertos_riscv_ram/timers.c", + ] + + cflags_c = [ + "-Wno-sign-compare", + "-Wno-old-style-declaration", + ] + + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_freertos", + ] + } + + config("${sdk_target_name}_config_hosal") { + include_dirs = [ + "${bl_iot_sdk_root}/components/platform/hosal/include", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/include", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common", + ] + + cflags_cc = [ "-Wno-literal-suffix" ] + } + + source_set("${sdk_target_name}_hosal") { + sources = [ + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_adc.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_boot2.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_chip.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_cks.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_clocktree.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_dac_audio.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_dma.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_efuse.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_flash.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_gpio.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_gpio_cli.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_hbn.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_i2c.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_ir.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_irq.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_pds.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_pm.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_pwm.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_rtc.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_sec.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_sys.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_sys_cli.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_timer.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_uart.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_wdt.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_wdt_cli.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_wifi.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_board.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_boot2.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_button.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_gpio.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_hbn.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_hbnram.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_hwtimer.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_ir.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_pds.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_sys.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hal_wifi.c", + + # hosal_adc.c is included by the code in wifi module + # "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_adc.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_dac.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_dma.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_efuse.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_flash.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_gpio.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_i2c.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_ota.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_pwm.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_rng.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_rtc.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_spi.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_timer.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_uart.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_wdg.c", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_aes.c", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_common.c", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_pka.c", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_sha.c", + ] + + cflags_c = [ + "-Wno-sign-compare", + "-Wno-shadow", + "-Wno-unused-but-set-variable", + "-Wno-old-style-declaration", + "-Wno-stringop-overflow", + "-Wno-format-truncation", + ] + configs += [ + ":${sdk_target_name}_config_wifi", + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_stage", + ":${sdk_target_name}_config_sys", + ":${sdk_target_name}_config_fs", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_hosal", + ] + } + + config("${sdk_target_name}_config_fs") { + include_dirs = [ "${bl_iot_sdk_root}/components/fs/vfs/include" ] + } + + source_set("${sdk_target_name}_fs") { + sources = [ + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_adc.c", + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_gpio.c", + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_pwm.c", + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_spi.c", + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_uart.c", + "${bl_iot_sdk_root}/components/fs/vfs/src/vfs.c", + "${bl_iot_sdk_root}/components/fs/vfs/src/vfs_file.c", + "${bl_iot_sdk_root}/components/fs/vfs/src/vfs_inode.c", + "${bl_iot_sdk_root}/components/fs/vfs/src/vfs_register.c", + ] + cflags_c = [ + "-Wno-sign-compare", + "-Wno-builtin-declaration-mismatch", + ] + configs += [ + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_stage", + ":${sdk_target_name}_config_fs", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_fs", + ] + } + + source_set("${sdk_target_name}_libc") { + sources = [ + "${bl_iot_sdk_root}/components/libc/newlibc/assert.c", + "${bl_iot_sdk_root}/components/libc/newlibc/stdatomic.c", + "${bl_iot_sdk_root}/components/libc/newlibc/syscalls.c", + ] + cflags_c = [ "-Wno-builtin-declaration-mismatch" ] + configs += [ ":${sdk_target_name}_config_freertos" ] + public_configs = [ ":${sdk_target_name}_config" ] + } + + config("${sdk_target_name}_config_stage") { + include_dirs = [ + "${bl_iot_sdk_root}/components/stage/easyflash4/inc", + "${bl_iot_sdk_root}/components/stage/yloop/include", + "${bl_iot_sdk_root}/components/stage/blog", + "${bl_iot_sdk_root}/components/stage/yloop/include/aos", + "${bl_iot_sdk_root}/components/stage/blfdt/inc", + "${bl_iot_sdk_root}/components/stage/cli/cli/include", + ] + } + + source_set("${sdk_target_name}_stage") { + sources = [ + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_addresses.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_empty_tree.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_overlay.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_ro.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_rw.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_strerror.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_sw.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_wip.c", + "${bl_iot_sdk_root}/components/stage/blog/blog.c", + "${bl_iot_sdk_root}/components/stage/easyflash4/src/easyflash.c", + "${bl_iot_sdk_root}/components/stage/easyflash4/src/ef_env.c", + "${bl_iot_sdk_root}/components/stage/easyflash4/src/ef_port.c", + "${bl_iot_sdk_root}/components/stage/easyflash4/src/ef_utils.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/aos_freertos.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/device.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/local_event.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/select.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/yloop.c", + ] + cflags_c = [ "-Wno-sign-compare" ] + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_freertos", + ":${sdk_target_name}_config_fs", + ":${sdk_target_name}_config_sys", + ":${sdk_target_name}_config_utils", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_stage", + ] + } + + config("${sdk_target_name}_config_sys") { + include_dirs = [ + "${bl_iot_sdk_root}/components/sys/bloop/bloop/include", + "${bl_iot_sdk_root}/components/sys/bloop/looprt/include", + "${bl_iot_sdk_root}/components/sys/bloop/loopset/include", + "${bl_iot_sdk_root}/components/sys/blmtd/include", + ] + } + + source_set("${sdk_target_name}_sys") { + include_dirs = [ "${bl_iot_sdk_root}/components/sys/bltime/include" ] + sources = [ + "${bl_iot_sdk_root}/components/sys/blmtd/bl_mtd.c", + "${bl_iot_sdk_root}/components/sys/bltime/bl_sys_time.c", + ] + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_sys", + ] + } + + config("${sdk_target_name}_config_utils") { + include_dirs = [ "${bl_iot_sdk_root}/components/utils/include/" ] + } + + source_set("${sdk_target_name}_utils") { + sources = [ + "${bl_iot_sdk_root}/components/utils/src/utils_base64.c", + "${bl_iot_sdk_root}/components/utils/src/utils_crc.c", + "${bl_iot_sdk_root}/components/utils/src/utils_dns.c", + "${bl_iot_sdk_root}/components/utils/src/utils_fec.c", + "${bl_iot_sdk_root}/components/utils/src/utils_getopt.c", + "${bl_iot_sdk_root}/components/utils/src/utils_hex.c", + "${bl_iot_sdk_root}/components/utils/src/utils_hexdump.c", + "${bl_iot_sdk_root}/components/utils/src/utils_hmac_sha1_fast.c", + "${bl_iot_sdk_root}/components/utils/src/utils_list.c", + "${bl_iot_sdk_root}/components/utils/src/utils_log.c", + "${bl_iot_sdk_root}/components/utils/src/utils_memp.c", + "${bl_iot_sdk_root}/components/utils/src/utils_notifier.c", + "${bl_iot_sdk_root}/components/utils/src/utils_psk_fast.c", + "${bl_iot_sdk_root}/components/utils/src/utils_rbtree.c", + "${bl_iot_sdk_root}/components/utils/src/utils_sha256.c", + "${bl_iot_sdk_root}/components/utils/src/utils_string.c", + "${bl_iot_sdk_root}/components/utils/src/utils_time.c", + "${bl_iot_sdk_root}/components/utils/src/utils_tlv_bl.c", + ] + + cflags_c = [ + "-Wno-shadow", + "-Wno-sign-compare", + ] + configs += [ + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_utils", + ] + } + + config("${sdk_target_name}_ble_config") { + include_dirs = [ + "${bl_iot_sdk_root}/components/network/ble/blecontroller/ble_inc", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/include", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/include/bluetooth", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/include/drivers/bluetooth", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/include", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/include/zephyr", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/port/include", + "${bl_iot_sdk_root}/components/network/ble/blestack/src", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host", + ] + + defines = [ + "BFLB_BLE", + "CONFIG_SET_TX_PWR", + "CFG_CON=1", + "CFG_BLE", + "CFG_SLEEP", + "CFG_BT_RESET", + "CONFIG_BT_PERIPHERAL=1", + "CFG_BLE_TX_BUFF_DATA=2", + "CONFIG_BT_GATT_DYNAMIC_DB", + "CONFIG_BT_GATT_SERVICE_CHANGED", + "CONFIG_BT_SETTINGS_CCC_LAZY_LOADING", + "CONFIG_BT_KEYS_OVERWRITE_OLDEST", + "CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS", + "CONFIG_BT_BONDABLE", + "CONFIG_BT_ASSERT", + "CFG_BLE_STACK_DBG_PRINT", + ] + + cflags_cc = [ "-Wno-conversion" ] + } + + source_set("${sdk_target_name}_ble") { + defines = [ + "CONFIG_BT_L2CAP_DYNAMIC_CHANNEL", + "CONFIG_BT_GATT_CLIENT", + "CONFIG_BT_CONN=1", + "CONFIG_BT_GATT_DIS_PNP", + "CONFIG_BT_GATT_DIS_SERIAL_NUMBER", + "CONFIG_BT_GATT_DIS_FW_REV", + "CONFIG_BT_GATT_DIS_HW_REV", + "CONFIG_BT_GATT_DIS_SW_REV", + "CONFIG_BT_ECC", + "CONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING", + "CONFIG_BT_HCI_VS_EVT_USER", + "CONFIG_BT_SETTINGS_USE_PRINTK", + ] + + libs = [ "${bl_iot_sdk_root}/components/network/ble/blecontroller_602_m0s1/lib/libblecontroller_602_m0s1.a" ] + + include_dirs = [ + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/bl_hci_wrapper", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/include/tinycrypt", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/include/misc", + ] + + sources = [ + "${bl_iot_sdk_root}/components/network/ble/blestack/src/bl_hci_wrapper/bl_hci_wrapper.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/atomic_c.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/buf.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/dec.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/log.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/poll.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/work_q.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/hci_onchip/hci_driver.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/att.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/bl_host_assist.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/conn.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/crypto.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/gatt.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/hci_core.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/l2cap.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/settings.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/uuid.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/port/bl_port.c", + ] + + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_freertos", + ":${sdk_target_name}_config_utils", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_ble_config", + ] + + cflags_c = [ + "-Wno-sign-compare", + "-Wno-unused-but-set-variable", + "-Wno-misleading-indentation", + "-Wno-format", + "-Wno-format-nonliteral", + "-Wno-format-security", + "-Wno-unused-function", + "-Wno-incompatible-pointer-types", + "-Wno-discarded-qualifiers", + ] + } + + config("${sdk_target_name}_config_blcrypto_suite") { + include_dirs = [ + "${bl_iot_sdk_root}/components/security/blcrypto_suite/inc", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/inc/blcrypto_suite", + ] + } + + source_set("${sdk_target_name}_blcrypto_suite") { + include_dirs = [ + "${bl_iot_sdk_root}/components/security/blcrypto_suite/priv_inc", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/priv_inc", + ] + sources = [ + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_aes.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_bignum.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_ecp.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_ecp_curves.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_export_fw.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_hacc.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_hacc_glue.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_hacc_secp256r1_mul.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_platform_util.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_porting.c", + "${bl_iot_sdk_root}/components/security/blcrypto_suite/src/blcrypto_suite_supplicant_api.c", + ] + + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_blcrypto_suite", + ] + } + + config("${sdk_target_name}_config_wifi") { + defines = [ + "CFG_TXDESC=2", + "CFG_STA_MAX=1", + "BL_CHIP_NAME=\"BL602\"", + "TD_DIAGNOSIS_STA", + "OS_USING_FREERTOS", + ] + include_dirs = [ + "${bl_iot_sdk_root}/components/os/bl_os_adapter/bl_os_adapter/include", + "${bl_iot_sdk_root}/components/os/bl_os_adapter/bl_os_adapter/include/bl_os_adapter", + "${bl_iot_sdk_root}/components/network/wifi/include", + "${bl_iot_sdk_root}/components/network/wifi_hosal/include", + "${bl_iot_sdk_root}/components/network/wifi_manager", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/include", + ] + + cflags_c = [ "-Wno-sign-compare" ] + cflags_cc = [ "-Wno-sign-compare" ] + } + + source_set("${sdk_target_name}_wifi") { + defines = [ "BL602_MATTER_SUPPORT" ] + + include_dirs = [ + "${bl_iot_sdk_root}/components/os/bl_os_adapter/bl_os_adapter", + "${bl_iot_sdk_root}/components/network/dns_server/include", + "${bl_iot_sdk_root}/components/network/dns_server/include", + "${bl_iot_sdk_root}/components/network/rfparam_adapter_tmp/rftlv", + "${bl_iot_sdk_root}/components/network/wifi/modules/supplicant/src/sae", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/include", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/include/bl_supplicant", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/port", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/ap", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/common", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/eap_peer", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/rsn_supp", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/test", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/port/include", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/utils", + ] + + sources = [ "${bl_iot_sdk_root}/components/os/bl_os_adapter/bl_os_adapter/bl_os_hal.c" ] + + sources += [ + "${bl_iot_sdk_root}/components/network/rfparam_adapter_tmp/rftlv/phy_rftlv.c", + "${bl_iot_sdk_root}/components/network/wifi_hosal/port/wifi_hosal_bl602.c", + "${bl_iot_sdk_root}/components/network/wifi_hosal/wifi_hosal.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_cmds.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_irqs.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_main.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_mod_params.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_msg_rx.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_msg_tx.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_platform.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_rx.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_tx.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/bl_utils.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/ipc_host.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/stateMachine.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_api.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_cli.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_event.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_ext.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_mgmr_profile.c", + "${bl_iot_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/wifi_netif.c", + + #wap_supplicant + "${bl_iot_sdk_root}/components/network/dns_server/src/dns_server.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/port/os_bl.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/ap/ap_config.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/ap/wpa_auth_ie.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/ap/wpa_auth_rsn_ccmp_only.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_hostap.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_wpa3.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_wpa_main.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_wpas_glue.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/bl_supplicant/bl_wps.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/common/sae.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/common/wpa_common.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-cbc.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-internal-bl.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-omac1.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-unwrap.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/aes-wrap.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/crypto_internal-modexp.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/dh_group5.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/dh_groups.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/md5-internal.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/md5.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/rc4.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/sha1-internal.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/sha1-pbkdf2.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/sha1.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/sha256-internal.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/sha256-prf.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/crypto/sha256.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/eap_peer/eap_common.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/rsn_supp/pmksa_cache.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/rsn_supp/wpa.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/rsn_supp/wpa_ie.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/utils/common.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/utils/wpa_debug.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/utils/wpabuf.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps_attr_build.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps_attr_parse.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps_attr_process.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps_common.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps_dev_attr.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps_enrollee.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps_registrar.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/src/wps/wps_validate.c", + "${bl_iot_sdk_root}/components/security/wpa_supplicant/test/test_crypto-bl.c", + ] + + libs = [ "${bl_iot_sdk_root}/components/network/wifi/lib/libwifi.a" ] + + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_stage", + ":${sdk_target_name}_config_lwip", + ":${sdk_target_name}_config_blcrypto_suite", + ":${sdk_target_name}_config_freertos", + ":${sdk_target_name}_config_utils", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_wifi", + ] + + deps = [ ":${sdk_target_name}_hosal" ] + + cflags_c = [ + "-Wno-unused-function", + "-Wno-shadow", + "-Wno-old-style-declaration", + "-Wno-incompatible-pointer-types", + "-Wno-format-security", + "-Wno-format-nonliteral", + "-Wno-unused-but-set-variable", + "-Wno-unused-variable", + "-fcommon", + ] + } + + config("${sdk_target_name}_config_lwip") { + include_dirs = [ + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/config", + "${bl_iot_sdk_root}/components/network/lwip/src/include", + "${bl_iot_sdk_root}/components/network/lwip/src/include/lwip/apps", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/hook", + ] + + defines = [ + "LWIP_IPV6=1", + "LWIP_IPV4=1", + "LWIP_IPV6_DHCP6=1", + "LWIP_IPV6_SCOPES=0", + "LWIP_AUTOIP=1", + "LWIP_IPV6_MLD=1", + "LWIP_ND6_RDNSS_MAX_DNS_SERVERS=1", + "PBUF_POOL_SIZE=20", + "PBUF_POOL_BUFSIZE=(1280+150)", + "CONFIG_ENABLE_IPV6_ADDR_CALLBACK", + "CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT", + "CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT", + ] + } + + source_set("${sdk_target_name}_lwip") { + sources = [ + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/ethernetif.c", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/sys_arch.c", + ] + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/netif/bridgeif.c", + "${bl_iot_sdk_root}/components/network/lwip/src/netif/bridgeif_fdb.c", + "${bl_iot_sdk_root}/components/network/lwip/src/netif/ethernet.c", + "${bl_iot_sdk_root}/components/network/lwip/src/netif/slipif.c", + "${bl_iot_sdk_root}/components/network/lwip/src/netif/zepif.c", + ] + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/core/def.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/dns.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/inet_chksum.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/init.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ip.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/mem.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/memp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/netif.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/pbuf.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/raw.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/stats.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/sys.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/tcp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/tcp_in.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/tcp_out.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/timeouts.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/udp.c", + ] + + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/autoip.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/dhcp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/etharp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/icmp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/igmp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/ip4.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/ip4_addr.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/ip4_frag.c", + ] + + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/dhcp6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ethip6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/icmp6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/inet6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ip6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ip6_addr.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ip6_frag.c", + + #"${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ip6_route_table.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/mld6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/nd6.c", + ] + + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/api/api_lib.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/api_msg.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/err.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/if_api.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/netbuf.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/netifapi.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/sockets.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/tcpip.c", + ] + sources += + [ "${bl_iot_sdk_root}/components/network/lwip/src/apps/mdns/mdns.c" ] + sources += + [ "${bl_iot_sdk_root}/components/network/lwip_dhcpd/dhcp_server_raw.c" ] + + configs += [ ":${sdk_target_name}_config_freertos" ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_lwip", + ] + } + + group(sdk_target_name) { + public_deps = [ + ":${sdk_target_name}_BSP_Driver", + ":${sdk_target_name}_bl602_freertos", + ":${sdk_target_name}_blcrypto_suite", + ":${sdk_target_name}_ble", + ":${sdk_target_name}_code", + ":${sdk_target_name}_fs", + ":${sdk_target_name}_hosal", + ":${sdk_target_name}_libc", + ":${sdk_target_name}_lwip", + ":${sdk_target_name}_soc", + ":${sdk_target_name}_stage", + ":${sdk_target_name}_sys", + ":${sdk_target_name}_utils", + ":${sdk_target_name}_wifi", + ] + } +} diff --git a/third_party/bouffalolab/bl702/BUILD.gn b/third_party/bouffalolab/bl702/BUILD.gn index 9842ba2b23ec24..3fe15787e3e0c8 100644 --- a/third_party/bouffalolab/bl702/BUILD.gn +++ b/third_party/bouffalolab/bl702/BUILD.gn @@ -14,14 +14,14 @@ import("//build_overrides/bouffalolab_iot_sdk.gni") import("//build_overrides/openthread.gni") -import("${bl702_sdk_build_root}/bl702_sdk.gni") +import("${bouffalolab_iot_sdk_build_root}/bl702/bl_iot_sdk.gni") declare_args() { - # Build target to use for bl702 SDK. Use this to set global SDK defines. - bl702_sdk_target = "" + # Build target to use for Bouffalo Lab IOT SDK. Use this to set global SDK defines. + bl_iot_sdk_target = "" } -assert(bl702_sdk_target != "", "bl702_sdk_target must be specified") +assert(bl_iot_sdk_target != "", "bl_iot_sdk_target must be specified") config("bl702_mbedtls_config") { defines = [ "MBEDTLS_CONFIG_FILE=\"bl702-chip-mbedtls-config.h\"" ] @@ -32,6 +32,6 @@ mbedtls_target("mbedtls") { include_dirs = [ "${chip_root}/src/platform/bouffalolab/BL702" ] } -group("bl702_sdk") { - public_deps = [ bl702_sdk_target ] +group("bl_iot_sdk") { + public_deps = [ bl_iot_sdk_target ] } diff --git a/third_party/bouffalolab/bl702/bl702_executable.gni b/third_party/bouffalolab/bl702/bl702_executable.gni deleted file mode 100644 index e50120b0255f24..00000000000000 --- a/third_party/bouffalolab/bl702/bl702_executable.gni +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (c) 2021 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/build.gni") -import("//build_overrides/chip.gni") - -import("//build_overrides/bouffalolab_iot_sdk.gni") -import("${build_root}/toolchain/flashable_executable.gni") - -template("bl702_executable") { - output_base_name = get_path_info(invoker.output_name, "name") - - objcopy_image_name = output_base_name + ".bin" - objcopy_image_format = "binary" - - objcopy = "riscv64-unknown-elf-objcopy" - if ("linux" == host_os) { - objcopy = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-objcopy" - } else if ("mac" == host_os || "darwin" == host_os) { - objcopy = "${bouffalolab_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-objcopy" - } - - # Copy flashing dependencies to the output directory so that the output - # is collectively self-contained; this allows flashing to work reliably - # even if the build and flashing steps take place on different machines - # or in different containers. - flashing_runtime_target = target_name + ".flashing_runtime" - flashing_script_inputs = [ - "${chip_root}/scripts/flashing/bouffalolab_firmware_utils.py", - "${chip_root}/scripts/flashing/firmware_utils.py", - - "${chip_root}/examples/platform/bouffalolab/bl702/flash_config/partition_cfg_2M.toml", - ] - copy(flashing_runtime_target) { - sources = flashing_script_inputs - outputs = [ "${root_out_dir}/{{source_file_part}}" ] - } - - flashing_script_generator = - "${chip_root}/scripts/flashing/gen_flashing_script.py" - flashing_script_name = output_base_name + ".flash.py" - flashing_options = [ "bouffalolab" ] - flashing_options += [ "--chipname" ] - flashing_options += [ "bl702" ] - flashing_options += [ "--xtal" ] - flashing_options += [ "32M" ] - flashing_options += [ "--pt" ] - flashing_options += - [ rebase_path("partition_cfg_2M.toml", root_out_dir, root_out_dir) ] - flashing_options += [ "--ota" ] - flashing_options += [ "ota_images/" ] - - # set 2000000 baudrate for image download by default - flashing_options += [ "--baudrate" ] - flashing_options += [ "2000000" ] - - flashable_executable(target_name) { - forward_variables_from(invoker, "*") - data_deps = [ ":${flashing_runtime_target}" ] - } -} diff --git a/third_party/bouffalolab/bl702/bl702_sdk.gni b/third_party/bouffalolab/bl702/bl702_sdk.gni deleted file mode 100644 index ebc49817e068e3..00000000000000 --- a/third_party/bouffalolab/bl702/bl702_sdk.gni +++ /dev/null @@ -1,821 +0,0 @@ -# Copyright (c) 2021 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("//args.gni") -import("//build_overrides/bouffalolab_iot_sdk.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/mbedtls.gni") -import("//build_overrides/openthread.gni") -import("${chip_root}/src/lib/lib.gni") -import("bl702_board.gni") - -import("${mbedtls_root}/mbedtls.gni") - -declare_args() { - # Location of the bl702 SDK. - bl702_sdk_root = "${chip_root}/third_party/bouffalolab/repo" - - enable_zigbee = false - - enable_cdc_module = false -} - -assert(bl702_sdk_root != "", "bl702_sdk_root must be specified") - -# Defines an bl702 SDK build target. -# -# Parameters: -# bl702_sdk_root - The location of the bl702 SDK. -# sources - The sources files to build. -template("bl702_sdk") { - sdk_target_name = target_name - - if (defined(invoker.bl702_sdk_root)) { - bl702_sdk_root = invoker.bl702_sdk_root - } - - if (defined(invoker.enable_zigbee)) { - enable_zigbee = invoker.enable_zigbee - } - - if (defined(invoker.enable_cdc_module)) { - enable_cdc_module = invoker.enable_cdc_module - } - - config("${sdk_target_name}_config") { - include_dirs = [] - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } - - defines = [ - "CONFIG_RENDEZVOUS_MODE=2", - "CONFIG_ENABLE_PW_RPC=0", - "__FILENAME__=strrchr(__FILE__,'/')?strrchr(__FILE__,'/')+1:__FILE__", - "OT_FREERTOS_ENABLE=1", - ] - - if (defined(invoker.defines)) { - defines += invoker.defines - } - } - - config("${sdk_target_name}_plat_config") { - _include_dirs = [ - "${bl702_sdk_root}", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/config", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/GCC/RISC-V", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/GCC/RISC-V/chip_specific_extensions/RV32F_float_abi_single", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/panic", - - "${bl702_sdk_root}/components/sys/blmtd/include", - "${bl702_sdk_root}/components/utils/include/", - - "${bl702_sdk_root}/components/stage/yloop/include", - "${bl702_sdk_root}/components/stage/blfdt/inc", - "${bl702_sdk_root}/components/stage/blog/", - "${bl702_sdk_root}/components/stage/cli/cli/include", - "${bl702_sdk_root}/components/stage/coredump/inc", - "${bl702_sdk_root}/components/stage/easyflash4/inc", - - "${bl702_sdk_root}/components/fs/vfs/include", - - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Board", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/risc-v/Core/Include", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/regs", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/startup", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/inc", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/soft_crc", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/misc", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/ring_buffer", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/device", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/list", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/memheap", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Common/platform", - - "${bl702_sdk_root}/components/platform/hosal/bl702_hal", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/include", - "${bl702_sdk_root}/components/platform/hosal/include", - "${bl702_sdk_root}/components/platform/hosal/sec_common", - ] - - defines = [ - "ARCH_RISCV", - "bl706_iot=1", - ] - - defines += board_defines - - cflags = [] - cflags_c = [] - if (defined(invoker.freertos_config)) { - cflags_c += [ - "-include", - rebase_path("${invoker.freertos_config}", root_build_dir), - ] - } - - foreach(include_dir, _include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - - if (defined(invoker.defines)) { - defines += invoker.defines - } - } - - source_set("${sdk_target_name}_drv") { - defines = [ - "BFLB_USE_ROM_DRIVER=1", - "BFLB_USE_HAL_DRIVER=1", - "CFG_USE_XTAL32K=1", - "CFG_BLE_ENABLE=1", - "BL702", - ] - - include_dirs = - [ "${bl702_sdk_root}/components/network/ble/blecontroller/ble_inc/" ] - - sources = [ - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_adc.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_boot2.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_chip.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_cks.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_dma.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_efuse.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_flash.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_gpio.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_hbn.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_irq.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_pds.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_psram.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_pwm.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_rtc.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_sec.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_sys.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_timer.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_uart.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_wdt.c", - - # "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_sec_aes.c", - # "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_sec_sha.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_wireless.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_board.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_boot2.c", - - # "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_tcal.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_button.c", - - # "${bl702_sdk_root}/components/platform/hosal/bl702_hal/bl_emac.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_gpio.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_hbn.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_hwtimer.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_pds.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_sys.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_adc.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_dac.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_dma.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_flash.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_gpio.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_i2c.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_ota.c", - - # "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_spi.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_pwm.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_rng.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_rtc.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_timer.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_uart.c", - "${bl702_sdk_root}/components/platform/hosal/bl702_hal/hosal_wdg.c", - - #"${bl702_sdk_root}/components/platform/hosal/bl702_hal/hal_uart.c", - ] - - sources += [ - "${bl702_sdk_root}/components/platform/hosal/sec_common/bl_sec_aes.c", - "${bl702_sdk_root}/components/platform/hosal/sec_common/bl_sec_pka.c", - - #"${bl702_sdk_root}/components/platform/hosal/sec_common/bl_sec_sha.c", - ] - - libs = [ "${bl702_sdk_root}/components/platform/soc/bl702/bl702_rf/lib/libbl702_rf.a" ] - - cflags_c = [ - "-Wno-unused-variable", - "-Wno-enum-conversion", - "-Wno-sign-compare", - "-Wno-old-style-declaration", - "-Wno-stringop-overflow", - "-Wno-format-truncation", - ] - - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ] - } - - source_set("${sdk_target_name}_app") { - sources = [] - if (defined(invoker.sources)) { - sources += invoker.sources - } - - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ] - } - - source_set("${sdk_target_name}_cdc") { - include_dirs = [ - "${bl702_sdk_root}/components/fs/vfs/include", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Inc", - ] - - defines = [ - "BFLB_USE_ROM_DRIVER=1", - "BFLB_USE_HAL_DRIVER=1", - ] - - sources = [ - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/bl702_hal_pcd.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/bl702_usb_cdc.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usb_device.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_cdc.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_cdc_if.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_conf.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_core.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_ctlreq.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_desc.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_ioreq.c", - ] - - cflags_c = [ "-Wno-sign-compare" ] - - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ] - } - - source_set("${sdk_target_name}_bflb_platform") { - defines = [ - "BFLB_USE_ROM_DRIVER=1", - "BFLB_USE_HAL_DRIVER=1", - ] - - include_dirs = [ "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/hal_drv/inc" ] - - sources = [ - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_acomp.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_adc.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_aon.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_cam.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_clock.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_common.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_dac.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_dma.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_ef_ctrl.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_glb.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_hbn.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_i2c.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_i2s.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_ir.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_l1c.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_mjpeg.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_pds.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_psram.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_pwm.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_qdec.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_romapi.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sec_dbg.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sec_eng.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sf_cfg.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sf_cfg_ext.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sf_ctrl.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sflash.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sflash_ext.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_spi.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_timer.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_uart.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_usb.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_xip_sflash.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_xip_sflash_ext.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/misc/misc.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/ring_buffer/ring_buffer.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/soft_crc/softcrc.c", - ] - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ] - cflags_c = [ - "-Wno-sign-compare", - "-Wno-unused-variable", - ] - } - - source_set("${sdk_target_name}_plat") { - defines = [ - "portasmHANDLE_INTERRUPT=interrupt_entry", - "CFG_CPP_ENABLE=1", - "BL_SDK_VER=\"1.0\"", - "BFLB_USE_ROM_DRIVER=1", - "BFLB_USE_HAL_DRIVER=1", - ] - - sources = [ - "${bl702_sdk_root}/components/libc/newlibc/assert.c", - "${bl702_sdk_root}/components/libc/newlibc/stdatomic.c", - "${bl702_sdk_root}/components/libc/newlibc/syscalls.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702/evb/src/boot/gcc/start.S", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702/evb/src/debug.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702/evb/src/strntoumax.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702/evb/src/vprint.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/event_groups.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/list.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/misaligned/fp_asm.S", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/misaligned/misaligned_ldst.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/panic/panic_c.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/GCC/RISC-V/port.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/GCC/RISC-V/portASM.S", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/MemMang/heap_5.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/MemMang/heap_5_psram.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/queue.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/stream_buffer.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/tasks.c", - "${bl702_sdk_root}/components/platform/soc/bl702/bl702_freertos/timers.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt_addresses.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt_empty_tree.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt_overlay.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt_ro.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt_rw.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt_strerror.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt_sw.c", - "${bl702_sdk_root}/components/stage/blfdt/src/fdt_wip.c", - "${bl702_sdk_root}/components/stage/blog/blog.c", - "${bl702_sdk_root}/components/stage/easyflash4/src/easyflash.c", - "${bl702_sdk_root}/components/stage/easyflash4/src/ef_env.c", - "${bl702_sdk_root}/components/stage/easyflash4/src/ef_port.c", - "${bl702_sdk_root}/components/stage/easyflash4/src/ef_utils.c", - "${bl702_sdk_root}/components/sys/blmtd/bl_mtd.c", - "${bl702_sdk_root}/components/utils/src/utils_list.c", - "${bl702_sdk_root}/components/utils/src/utils_log.c", - "${bl702_sdk_root}/components/utils/src/utils_string.c", - ] - - cflags_c = [ - "-Wno-old-style-declaration", - "-Wno-enum-conversion", - "-Wno-sign-compare", - ] - cflags_c += [ - "-Wno-builtin-declaration-mismatch", - "-Wno-format-truncation", - ] - - sources += [ - "${bl702_sdk_root}/components/fs/vfs/device/vfs_adc.c", - "${bl702_sdk_root}/components/fs/vfs/device/vfs_gpio.c", - "${bl702_sdk_root}/components/fs/vfs/device/vfs_pwm.c", - "${bl702_sdk_root}/components/fs/vfs/device/vfs_spi.c", - "${bl702_sdk_root}/components/fs/vfs/device/vfs_uart.c", - "${bl702_sdk_root}/components/fs/vfs/src/vfs.c", - "${bl702_sdk_root}/components/fs/vfs/src/vfs_file.c", - "${bl702_sdk_root}/components/fs/vfs/src/vfs_inode.c", - "${bl702_sdk_root}/components/fs/vfs/src/vfs_register.c", - "${bl702_sdk_root}/components/stage/yloop/src/aos_freertos.c", - "${bl702_sdk_root}/components/stage/yloop/src/device.c", - "${bl702_sdk_root}/components/stage/yloop/src/local_event.c", - "${bl702_sdk_root}/components/stage/yloop/src/select.c", - "${bl702_sdk_root}/components/stage/yloop/src/yloop.c", - "${bl702_sdk_root}/components/utils/src/utils_base64.c", - "${bl702_sdk_root}/components/utils/src/utils_crc.c", - "${bl702_sdk_root}/components/utils/src/utils_dns.c", - "${bl702_sdk_root}/components/utils/src/utils_fec.c", - "${bl702_sdk_root}/components/utils/src/utils_getopt.c", - "${bl702_sdk_root}/components/utils/src/utils_hex.c", - "${bl702_sdk_root}/components/utils/src/utils_hexdump.c", - "${bl702_sdk_root}/components/utils/src/utils_hmac_sha1_fast.c", - "${bl702_sdk_root}/components/utils/src/utils_memp.c", - "${bl702_sdk_root}/components/utils/src/utils_notifier.c", - "${bl702_sdk_root}/components/utils/src/utils_psk_fast.c", - "${bl702_sdk_root}/components/utils/src/utils_rbtree.c", - "${bl702_sdk_root}/components/utils/src/utils_sha256.c", - "${bl702_sdk_root}/components/utils/src/utils_time.c", - "${bl702_sdk_root}/components/utils/src/utils_tlv_bl.c", - ] - - cflags_c += [ "-Wno-shadow" ] - - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ] - } - - config("${sdk_target_name}_ble_config") { - _include_dirs = [ - "${bl702_sdk_root}/components/network/ble/blestack/src/include", - "${bl702_sdk_root}/components/network/ble/blestack/src", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/include", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/include/misc", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/include/zephyr", - "${bl702_sdk_root}/components/network/ble/blestack/src/port/include", - "${bl702_sdk_root}/components/network/ble/blestack/src/include/bluetooth", - "${bl702_sdk_root}/components/network/ble/blecontroller/ble_inc", - "${bl702_sdk_root}/components/network/ble/blestack/src/include/drivers/bluetooth", - "${bl702_sdk_root}/components/network/ble/blestack/src/host", - ] - - defines = [ - "CONFIG_SET_TX_PWR", - "CFG_BLE_ENABLE", - "BFLB_BLE", - "CFG_BLE", - "CFG_SLEEP", - "OPTIMIZE_DATA_EVT_FLOW_FROM_CONTROLLER", - "CFG_BT_RESET", - "CFG_CON=1", - "CFG_BLE_TX_BUFF_DATA=2", - "CONFIG_BT_PERIPHERAL=1", - "CONFIG_BT_L2CAP_DYNAMIC_CHANNEL", - "CONFIG_BT_GATT_CLIENT", - "CONFIG_BT_CONN=1", - "CONFIG_BT_GATT_DIS_PNP", - "CONFIG_BT_GATT_DIS_SERIAL_NUMBER", - "CONFIG_BT_GATT_DIS_FW_REV", - "CONFIG_BT_GATT_DIS_HW_REV", - "CONFIG_BT_GATT_DIS_SW_REV", - "CONFIG_BT_ECC", - "CONFIG_BT_GATT_DYNAMIC_DB", - "CONFIG_BT_GATT_SERVICE_CHANGED", - "CONFIG_BT_KEYS_OVERWRITE_OLDEST", - "CONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING", - "CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS", - "CONFIG_BT_BONDABLE", - "CONFIG_BT_HCI_VS_EVT_USER", - "CONFIG_BT_ASSERT", - "CONFIG_BT_SETTINGS_CCC_LAZY_LOADING", - "CONFIG_BT_SETTINGS_USE_PRINTK", - "CFG_BLE_STACK_DBG_PRINT", - ] - - cflags = [] - foreach(include_dir, _include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - source_set("${sdk_target_name}_ble") { - defines = [ "BL702=1" ] - - include_dirs = [ - "${bl702_sdk_root}/components/network/ble/blestack/src/include", - "${bl702_sdk_root}/components/network/ble/blecontroller/ble_inc", - "${bl702_sdk_root}/components/network/ble/blestack/src/host", - "${bl702_sdk_root}/components/network/ble/blestack/src/include/drivers/bluetooth", - "${bl702_sdk_root}/components/network/ble/blestack/src/common", - "${bl702_sdk_root}/components/network/ble/blestack/src/bl_hci_wrapper", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/include/tinycrypt", - ] - - sources = [ - "${bl702_sdk_root}/components/network/ble/blestack/src/bl_hci_wrapper/bl_hci_wrapper.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/atomic_c.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/buf.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/dec.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/log.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/poll.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/common/work_q.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/hci_onchip/hci_driver.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/att.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/bl_host_assist.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/conn.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/crypto.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/gatt.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/hci_core.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/l2cap.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/settings.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/host/uuid.c", - "${bl702_sdk_root}/components/network/ble/blestack/src/port/bl_port.c", - ] - - libs = [ "${bl702_sdk_root}/components/network/ble/blecontroller_702_std/lib/libblecontroller_702_std.a" ] - - configs += [ ":${sdk_target_name}_plat_config" ] - public_configs = [ ":${sdk_target_name}_ble_config" ] - - cflags_c = [ - "-Wno-sign-compare", - "-Wno-unused-but-set-variable", - "-Wno-misleading-indentation", - "-Wno-format", - "-Wno-format-nonliteral", - "-Wno-format-security", - "-Wno-unused-function", - "-Wno-incompatible-pointer-types", - "-Wno-discarded-qualifiers", - ] - } - - config("${sdk_target_name}_otport_config") { - _include_dirs = [ - "${chip_root}/platform/bl702", - "${chip_root}/third_party/openthread/repo/src/core", - "${chip_root}/third_party/openthread/repo/examples/platforms", - "${bl702_sdk_root}/components/network/thread/openthread_port/include", - ] - - cflags = [] - foreach(include_dir, _include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - source_set("${sdk_target_name}_otport") { - import("//build_overrides/openthread.gni") - - include_dirs = [ - "${bl702_sdk_root}/components/network/lmac154/include", - "${openthread_root}/examples/platforms/utils/", - "${openthread_root}/examples", - ] - - sources = [ - "${bl702_sdk_root}/components/network/thread/openthread_port/ot_alarm.c", - "${bl702_sdk_root}/components/network/thread/openthread_port/ot_diag.c", - "${bl702_sdk_root}/components/network/thread/openthread_port/ot_entropy.c", - "${bl702_sdk_root}/components/network/thread/openthread_port/ot_logging.c", - "${bl702_sdk_root}/components/network/thread/openthread_port/ot_misc.c", - "${bl702_sdk_root}/components/network/thread/openthread_port/ot_radio.c", - "${bl702_sdk_root}/components/network/thread/openthread_port/ot_settings.c", - "${bl702_sdk_root}/components/network/thread/openthread_port/ot_uart.c", - - # "${bl702_sdk_root}/components/network/thread/openthread_port/ot_system.c", - # "${bl702_sdk_root}/components/network/thread/openthread_port/ot_freertos.c", - # "${bl702_sdk_root}/components/network/thread/openthread_port/ot_memory.c" - ] - - libs = [ "${bl702_sdk_root}/components/network/lmac154/lib/liblmac154.a" ] - - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ":${sdk_target_name}_otport_config", - ] - - public_deps = [ - ":${sdk_target_name}_plat", - "${bl702_sdk_build_root}:mbedtls", - "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", - "${openthread_root}/src/core:libopenthread_core_headers", - ] - } - - config("${sdk_target_name}_lwip_port_config") { - _include_dirs = [ - "${bl702_sdk_root}/components/network/lwip/lwip-port", - "${bl702_sdk_root}/components/network/lwip/lwip-port/config", - "${bl702_sdk_root}/components/stage/virt_net/include", - "${bl702_sdk_root}/components/stage/throughput/bl702/inc", - ] - - defines = [ - "TCPIP_THREAD_PRIO=24", - "CFG_ETHERNET_ENABLE=1", - ] - - cflags = [] - foreach(include_dir, _include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - - cflags += [ - "-Wno-conversion", - "-Wno-unused-function", - ] - } - - source_set("${sdk_target_name}_lwip_port") { - defines = [ - "SPI_WIFI_RXBUFF_IN_PSRAM=1", - "VIRT_NET_SPI_RX_TASK_PRIORITY=25", - ] - - # include_dirs = [ - # "${bl702_sdk_root}/components/network/lwip/lwip-port/arch", - # "${bl702_sdk_root}/components/network/lwip/lwip-port/FreeRTOS", - # "${bl702_sdk_root}/components/stage/throughput" - # ] - - # sources = [ - # "${bl702_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/ethernetif.c", - # "${bl702_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/sys_arch.c" - # ] - - # sources += [ - # "${bl702_sdk_root}/components/stage/throughput/bl702/src/tp_spi_master.c", - # ] - # sources += [ - # "${bl702_sdk_root}/components/stage/virt_net/src/virt_net.c", - # "${bl702_sdk_root}/components/stage/virt_net/src/virt_net_spi.c", - # ] - - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ":${sdk_target_name}_lwip_port_config", - ":${sdk_target_name}_lwip_config", - ] - - cflags = [ "-Wno-sign-compare" ] - } - - config("${sdk_target_name}_lwip_config") { - _include_dirs = [ - "${bl702_sdk_root}/components/network/lwip/src/include", - # "${bl702_sdk_root}/components/network/lwip_mdns", - ] - - defines = [ - "LWIP_IPV6=1", - "LWIP_IPV4=1", - "LWIP_IPV6_DHCP6=1", - "LWIP_IPV6_SCOPES=0", - "PBUF_POOL_SIZE=12", - "PBUF_POOL_BUFSIZE=(1280+150)", - ] - - cflags = [] - foreach(include_dir, _include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - source_set("${sdk_target_name}_lwip") { - sources = [ - "${bl702_sdk_root}/components/network/lwip/src/api/api_lib.c", - "${bl702_sdk_root}/components/network/lwip/src/api/api_msg.c", - "${bl702_sdk_root}/components/network/lwip/src/api/err.c", - "${bl702_sdk_root}/components/network/lwip/src/api/if_api.c", - "${bl702_sdk_root}/components/network/lwip/src/api/netbuf.c", - "${bl702_sdk_root}/components/network/lwip/src/api/netifapi.c", - "${bl702_sdk_root}/components/network/lwip/src/api/sockets.c", - "${bl702_sdk_root}/components/network/lwip/src/api/tcpip.c", - ] - - sources += [ - "${bl702_sdk_root}/components/network/lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c", - "${bl702_sdk_root}/components/network/lwip/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c", - ] - - sources += [ - "${bl702_sdk_root}/components/network/lwip/src/core/def.c", - "${bl702_sdk_root}/components/network/lwip/src/core/dns.c", - "${bl702_sdk_root}/components/network/lwip/src/core/inet_chksum.c", - "${bl702_sdk_root}/components/network/lwip/src/core/init.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ip.c", - "${bl702_sdk_root}/components/network/lwip/src/core/mem.c", - "${bl702_sdk_root}/components/network/lwip/src/core/memp.c", - "${bl702_sdk_root}/components/network/lwip/src/core/netif.c", - "${bl702_sdk_root}/components/network/lwip/src/core/pbuf.c", - "${bl702_sdk_root}/components/network/lwip/src/core/raw.c", - "${bl702_sdk_root}/components/network/lwip/src/core/stats.c", - "${bl702_sdk_root}/components/network/lwip/src/core/sys.c", - "${bl702_sdk_root}/components/network/lwip/src/core/tcp.c", - "${bl702_sdk_root}/components/network/lwip/src/core/tcp_in.c", - "${bl702_sdk_root}/components/network/lwip/src/core/tcp_out.c", - "${bl702_sdk_root}/components/network/lwip/src/core/timeouts.c", - "${bl702_sdk_root}/components/network/lwip/src/core/udp.c", - "${bl702_sdk_root}/components/network/lwip/src/include/lwip/priv/api_msg.h", - "${bl702_sdk_root}/components/network/lwip/src/include/lwip/priv/memp_std.h", - "${bl702_sdk_root}/components/network/lwip/src/include/lwip/priv/nd6_priv.h", - ] - - sources += [ - "${bl702_sdk_root}/components/network/lwip/src/core/ipv4/autoip.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv4/dhcp.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv4/etharp.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv4/icmp.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv4/igmp.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv4/ip4.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv4/ip4_addr.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv4/ip4_frag.c", - ] - - sources += [ - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/dhcp6.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/ethip6.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/icmp6.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/inet6.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/ip6.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/ip6_addr.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/ip6_frag.c", - - #"${bl702_sdk_root}/components/network/lwip/src/core/ipv6/ip6_route_table.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/mld6.c", - "${bl702_sdk_root}/components/network/lwip/src/core/ipv6/nd6.c", - ] - - sources += - [ "${bl702_sdk_root}/components/network/lwip/src/netif/slipif.c" ] - sources += - [ "${bl702_sdk_root}/components/network/lwip/src/netif/bridgeif.c" ] - sources += - [ "${bl702_sdk_root}/components/network/lwip/src/netif/bridgeif_fdb.c" ] - sources += - [ "${bl702_sdk_root}/components/network/lwip/src/netif/ethernet.c" ] - sources += [ "${bl702_sdk_root}/components/network/lwip/src/netif/zepif.c" ] - - sources += - [ "${bl702_sdk_root}/components/network/lwip/src/apps/mdns/mdns.c" ] - - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ":${sdk_target_name}_lwip_port_config", - ":${sdk_target_name}_lwip_config", - ] - } - - config("${sdk_target_name}_zigbee_config") { - _include_dirs = [ - "${bl702_sdk_root}/components/network/zigbee/zbstack/", - "${bl702_sdk_root}/components/network/zigbee/zbstack/include", - "${bl702_sdk_root}/components/network/zigbee/zbstack/include/core", - "${bl702_sdk_root}/components/network/zigbee/zbstack/include/zcl", - "${bl702_sdk_root}/components/network/zigbee/zbcli/", - ] - - defines = [ "CFG_ZIGBEE_TOUCHLINK=1" ] - - cflags = [] - foreach(include_dir, _include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - source_set("${sdk_target_name}_zigbee") { - #sources = [ "${bl702_sdk_root}/components/network/zigbee/zbcli/zb_stack_cli.c" ] - - libs = [ - "${bl702_sdk_root}/components/network/zigbee/zbstack/lib/libzbstack.a", - "${bl702_sdk_root}/components/network/zigbee/zbstack/lib/libzbstackex.a", - ] - - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_plat_config", - ":${sdk_target_name}_zigbee_config", - ] - ldflags = [ "-Wl,--defsym=__LD_CONFIG_FLASH_SIZE=0x100000" ] - cflags = [ - "-Wno-implicit-function-declaration", - "-Wno-incompatible-pointer-types", - "-Wno-unused-variable", - ] - } - - group(sdk_target_name) { - public_deps = [ - ":${sdk_target_name}_bflb_platform", - ":${sdk_target_name}_ble", - ":${sdk_target_name}_drv", - ":${sdk_target_name}_plat", - ] - - if (chip_enable_openthread) { - public_deps += [ ":${sdk_target_name}_otport" ] - } - - if (chip_enable_wifi) { - public_deps += [ ":${sdk_target_name}_lwip_port" ] - public_deps += [ ":${sdk_target_name}_lwip" ] - } - - if (enable_zigbee) { - public_deps += [ ":${sdk_target_name}_zigbee" ] - } - - if (enable_cdc_module) { - public_deps += [ ":${sdk_target_name}_cdc" ] - } - - public_deps += [ ":${sdk_target_name}_app" ] - } -} diff --git a/third_party/bouffalolab/bl702/bl_iot_sdk.gni b/third_party/bouffalolab/bl702/bl_iot_sdk.gni new file mode 100644 index 00000000000000..9e96105373928a --- /dev/null +++ b/third_party/bouffalolab/bl702/bl_iot_sdk.gni @@ -0,0 +1,826 @@ +# Copyright (c) 2021 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("//args.gni") +import("//build_overrides/bouffalolab_iot_sdk.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/mbedtls.gni") +import("//build_overrides/openthread.gni") +import("${chip_root}/src/lib/lib.gni") + +import("${mbedtls_root}/mbedtls.gni") + +declare_args() { + bl_iot_sdk_root = "${chip_root}/third_party/bouffalolab/repo" + + enable_cdc_module = false + + thread_port_1_3 = false +} + +assert(bl_iot_sdk_root != "", "bl_iot_sdk_root must be specified") + +# Defines an Bouffa Lab IOT SDK build target. +# +# Parameters: +# bl_iot_sdk_root - The location of Bouffalo Lab IOT SDK. +# sources - The sources files to build. +template("bl_iot_sdk") { + sdk_target_name = target_name + + if (defined(invoker.enable_zigbee)) { + enable_zigbee = invoker.enable_zigbee + } + + if (defined(invoker.enable_cdc_module)) { + enable_cdc_module = invoker.enable_cdc_module + } + + config("${sdk_target_name}_config") { + defines = [ + "__FILENAME__=strrchr(__FILE__,'/')?strrchr(__FILE__,'/')+1:__FILE__", + "ARCH_RISCV", + "BL702=BL702", + "BFLB_USE_ROM_DRIVER=1", + "BFLB_USE_HAL_DRIVER=1", + ] + + include_dirs = [] + if (defined(invoker.include_dirs)) { + include_dirs += invoker.include_dirs + } + + if (defined(invoker.defines)) { + defines += invoker.defines + } + + if (defined(invoker.freertos_config)) { + cflags_c = [ + "-include", + rebase_path("${invoker.freertos_config}", root_build_dir), + ] + } + } + + config("${sdk_target_name}_config_soc") { + include_dirs = + [ "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_rf/include" ] + } + + source_set("${sdk_target_name}_soc") { + defines = [ "CFG_CPP_ENABLE" ] + + sources = [ + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702/evb/src/boot/gcc/start.S", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702/evb/src/debug.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702/evb/src/strntoumax.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702/evb/src/vprint.c", + ] + + libs = [ "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_rf/lib/libbl702_rf.a" ] + + cflags_c = [ "-Wno-format-truncation" ] + } + + config("${sdk_target_name}_config_BSP_Driver") { + include_dirs = [ + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/inc", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/regs", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/startup", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/risc-v/Core/Include", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/soft_crc", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/MCU_Common/misc", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Common/platform/", + ] + + defines = [ "bl706_iot" ] + } + + source_set("${sdk_target_name}_BSP_Driver") { + sources = [ + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_acomp.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_adc.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_aon.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_cam.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_clock.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_common.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_dac.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_dma.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_ef_ctrl.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_emac.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_glb.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_hbn.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_i2c.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_i2c_gpio_sim.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_i2s.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_ir.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_kys.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_l1c.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_mjpeg.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_pds.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_psram.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_pwm.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_qdec.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_romapi.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sec_dbg.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sec_eng.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sf_cfg.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sf_cfg_ext.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sf_ctrl.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sflash.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_sflash_ext.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_spi.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_timer.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_uart.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_usb.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_xip_sflash.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_std/BSP_Driver/std_drv/src/bl702_xip_sflash_ext.c", + ] + + configs += [ ":${sdk_target_name}_config_freertos" ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_BSP_Driver", + ] + cflags_c = [ + "-Wno-sign-compare", + "-Wno-unused-variable", + ] + } + + config("${sdk_target_name}_config_freertos") { + include_dirs = [ + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/config", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/GCC/RISC-V", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/panic", + ] + } + + source_set("${sdk_target_name}_bl702_freertos") { + defines = [ "portasmHANDLE_INTERRUPT=interrupt_entry" ] + include_dirs = [ "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/GCC/RISC-V/chip_specific_extensions/RV32F_float_abi_single" ] + + sources = [ + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/event_groups.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/list.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/misaligned/fp_asm.S", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/misaligned/misaligned_ldst.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/panic/panic_c.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/GCC/RISC-V/port.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/GCC/RISC-V/portASM.S", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/MemMang/heap_5.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/portable/MemMang/heap_5_psram.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/queue.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/stream_buffer.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/tasks.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_freertos/timers.c", + ] + + cflags_c = [ + "-Wno-sign-compare", + "-Wno-old-style-declaration", + ] + + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_freertos", + ] + } + + source_set("${sdk_target_name}_bl702_usb_cdc") { + include_dirs = [ + "${bl_iot_sdk_root}/components/fs/vfs/include", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Inc", + ] + + sources = [ + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/bl702_hal_pcd.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/bl702_usb_cdc.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usb_device.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_cdc.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_cdc_if.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_conf.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_core.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_ctlreq.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_desc.c", + "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_usb_cdc/Src/usbd_ioreq.c", + ] + + cflags_c = [ "-Wno-sign-compare" ] + + public_configs = [ ":${sdk_target_name}_config" ] + } + + config("${sdk_target_name}_config_hosal") { + include_dirs = [ + "${bl_iot_sdk_root}/components/platform/hosal/include", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/include", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common", + ] + + cflags_cc = [ "-Wno-literal-suffix" ] + } + + source_set("${sdk_target_name}_hosal") { + defines = [ "CFG_USE_XTAL32K=1" ] + + sources = [ + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_adc.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_boot2.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_chip.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_cks.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_dma.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_efuse.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_emac.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_flash.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_gpio.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_hbn.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_ir.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_irq.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_pds.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_psram.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_pwm.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_rtc.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_sec.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_sys.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_timer.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_uart.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_wdt.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_wireless.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_board.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_boot2.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_button.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_gpio.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_hbn.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_hwtimer.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_pds.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_sys.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hal_tcal.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_adc.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_dac.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_dma.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_flash.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_gpio.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_i2c.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_ota.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_pwm.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_rng.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_rtc.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_spi.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_timer.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_uart.c", + "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/hosal_wdg.c", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_aes.c", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_common.c", + "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_pka.c", + + # need update bl_sec_sha.c to fix compile error + # "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_sha.c", + ] + + cflags_c = [ + "-Wno-unused-variable", + "-Wno-sign-compare", + "-Wno-enum-conversion", + "-Wno-old-style-declaration", + "-Wno-stringop-overflow", + "-Wno-format-truncation", + ] + configs += [ + ":${sdk_target_name}_config_soc", + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_stage", + ":${sdk_target_name}_config_sys", + ":${sdk_target_name}_config_fs", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_hosal", + ] + } + + config("${sdk_target_name}_config_fs") { + include_dirs = [ "${bl_iot_sdk_root}/components/fs/vfs/include" ] + } + + source_set("${sdk_target_name}_fs") { + sources = [ + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_adc.c", + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_gpio.c", + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_pwm.c", + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_spi.c", + "${bl_iot_sdk_root}/components/fs/vfs/device/vfs_uart.c", + "${bl_iot_sdk_root}/components/fs/vfs/src/vfs.c", + "${bl_iot_sdk_root}/components/fs/vfs/src/vfs_file.c", + "${bl_iot_sdk_root}/components/fs/vfs/src/vfs_inode.c", + "${bl_iot_sdk_root}/components/fs/vfs/src/vfs_register.c", + ] + cflags_c = [ + "-Wno-sign-compare", + "-Wno-builtin-declaration-mismatch", + ] + configs += [ + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_stage", + ":${sdk_target_name}_config_fs", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_fs", + ] + } + + source_set("${sdk_target_name}_libc") { + sources = [ + "${bl_iot_sdk_root}/components/libc/newlibc/assert.c", + "${bl_iot_sdk_root}/components/libc/newlibc/stdatomic.c", + "${bl_iot_sdk_root}/components/libc/newlibc/syscalls.c", + ] + cflags_c = [ "-Wno-builtin-declaration-mismatch" ] + configs += [ ":${sdk_target_name}_config_freertos" ] + public_configs = [ ":${sdk_target_name}_config" ] + } + + config("${sdk_target_name}_config_stage") { + include_dirs = [ + "${bl_iot_sdk_root}/components/stage/easyflash4/inc", + "${bl_iot_sdk_root}/components/stage/yloop/include", + "${bl_iot_sdk_root}/components/stage/blog", + "${bl_iot_sdk_root}/components/stage/yloop/include/aos", + "${bl_iot_sdk_root}/components/stage/blfdt/inc", + "${bl_iot_sdk_root}/components/stage/cli/cli/include", + ] + } + + source_set("${sdk_target_name}_stage") { + sources = [ + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_addresses.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_empty_tree.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_overlay.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_ro.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_rw.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_strerror.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_sw.c", + "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_wip.c", + "${bl_iot_sdk_root}/components/stage/blog/blog.c", + "${bl_iot_sdk_root}/components/stage/easyflash4/src/easyflash.c", + "${bl_iot_sdk_root}/components/stage/easyflash4/src/ef_env.c", + "${bl_iot_sdk_root}/components/stage/easyflash4/src/ef_port.c", + "${bl_iot_sdk_root}/components/stage/easyflash4/src/ef_utils.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/aos_freertos.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/device.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/local_event.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/select.c", + "${bl_iot_sdk_root}/components/stage/yloop/src/yloop.c", + ] + cflags_c = [ "-Wno-sign-compare" ] + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_freertos", + ":${sdk_target_name}_config_fs", + ":${sdk_target_name}_config_sys", + ":${sdk_target_name}_config_utils", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_stage", + ] + } + + config("${sdk_target_name}_config_sys") { + include_dirs = [ + "${bl_iot_sdk_root}/components/sys/bloop/bloop/include", + "${bl_iot_sdk_root}/components/sys/bloop/looprt/include", + "${bl_iot_sdk_root}/components/sys/bloop/loopset/include", + "${bl_iot_sdk_root}/components/sys/blmtd/include", + ] + } + + source_set("${sdk_target_name}_sys") { + include_dirs = [ "${bl_iot_sdk_root}/components/sys/bltime/include" ] + sources = [ + "${bl_iot_sdk_root}/components/sys/blmtd/bl_mtd.c", + "${bl_iot_sdk_root}/components/sys/bltime/bl_sys_time.c", + ] + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_sys", + ] + } + + config("${sdk_target_name}_config_utils") { + include_dirs = [ "${bl_iot_sdk_root}/components/utils/include/" ] + } + + source_set("${sdk_target_name}_utils") { + sources = [ + "${bl_iot_sdk_root}/components/utils/src/utils_base64.c", + "${bl_iot_sdk_root}/components/utils/src/utils_crc.c", + "${bl_iot_sdk_root}/components/utils/src/utils_dns.c", + "${bl_iot_sdk_root}/components/utils/src/utils_fec.c", + "${bl_iot_sdk_root}/components/utils/src/utils_getopt.c", + "${bl_iot_sdk_root}/components/utils/src/utils_hex.c", + "${bl_iot_sdk_root}/components/utils/src/utils_hexdump.c", + "${bl_iot_sdk_root}/components/utils/src/utils_hmac_sha1_fast.c", + "${bl_iot_sdk_root}/components/utils/src/utils_list.c", + "${bl_iot_sdk_root}/components/utils/src/utils_log.c", + "${bl_iot_sdk_root}/components/utils/src/utils_memp.c", + "${bl_iot_sdk_root}/components/utils/src/utils_notifier.c", + "${bl_iot_sdk_root}/components/utils/src/utils_psk_fast.c", + "${bl_iot_sdk_root}/components/utils/src/utils_rbtree.c", + "${bl_iot_sdk_root}/components/utils/src/utils_sha256.c", + "${bl_iot_sdk_root}/components/utils/src/utils_string.c", + "${bl_iot_sdk_root}/components/utils/src/utils_time.c", + "${bl_iot_sdk_root}/components/utils/src/utils_tlv_bl.c", + ] + + cflags_c = [ + "-Wno-shadow", + "-Wno-sign-compare", + ] + configs += [ + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_utils", + ] + } + + config("${sdk_target_name}_ble_config") { + include_dirs = [ + "${bl_iot_sdk_root}/components/network/ble/blecontroller/ble_inc", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/include", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/include/bluetooth", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/include/drivers/bluetooth", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/include", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/include/zephyr", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/port/include", + "${bl_iot_sdk_root}/components/network/ble/blestack/src", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host", + ] + + defines = [ + "BFLB_BLE", + "CONFIG_SET_TX_PWR", + "CFG_CON=1", + "CFG_BLE", + "CFG_SLEEP", + "CFG_BT_RESET", + "CONFIG_BT_PERIPHERAL=1", + "CFG_BLE_TX_BUFF_DATA=2", + "CONFIG_BT_GATT_DYNAMIC_DB", + "CONFIG_BT_GATT_SERVICE_CHANGED", + "CONFIG_BT_SETTINGS_CCC_LAZY_LOADING", + "CONFIG_BT_KEYS_OVERWRITE_OLDEST", + "CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS", + "CONFIG_BT_BONDABLE", + "CONFIG_BT_ASSERT", + "CFG_BLE_STACK_DBG_PRINT", + ] + + cflags_cc = [ "-Wno-conversion" ] + } + + source_set("${sdk_target_name}_ble") { + defines = [ + "CONFIG_BT_L2CAP_DYNAMIC_CHANNEL", + "CONFIG_BT_GATT_CLIENT", + "CONFIG_BT_CONN=1", + "CONFIG_BT_GATT_DIS_PNP", + "CONFIG_BT_GATT_DIS_SERIAL_NUMBER", + "CONFIG_BT_GATT_DIS_FW_REV", + "CONFIG_BT_GATT_DIS_HW_REV", + "CONFIG_BT_GATT_DIS_SW_REV", + "CONFIG_BT_ECC", + "CONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING", + "CONFIG_BT_HCI_VS_EVT_USER", + "CONFIG_BT_SETTINGS_USE_PRINTK", + ] + + libs = [ "${bl_iot_sdk_root}/components/network/ble/blecontroller_702_std/lib/libblecontroller_702_std.a" ] + + include_dirs = [ + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/bl_hci_wrapper", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/include/tinycrypt", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/include/misc", + ] + + sources = [ + "${bl_iot_sdk_root}/components/network/ble/blestack/src/bl_hci_wrapper/bl_hci_wrapper.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/atomic_c.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/buf.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/dec.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/log.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/poll.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/work_q.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/hci_onchip/hci_driver.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/att.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/bl_host_assist.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/conn.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/crypto.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/gatt.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/hci_core.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/l2cap.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/settings.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/host/uuid.c", + "${bl_iot_sdk_root}/components/network/ble/blestack/src/port/bl_port.c", + ] + + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_freertos", + ":${sdk_target_name}_config_utils", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_ble_config", + ] + + cflags_c = [ + "-Wno-sign-compare", + "-Wno-unused-but-set-variable", + "-Wno-misleading-indentation", + "-Wno-format", + "-Wno-format-nonliteral", + "-Wno-format-security", + "-Wno-unused-function", + "-Wno-incompatible-pointer-types", + "-Wno-discarded-qualifiers", + ] + } + + config("${sdk_target_name}_config_openthread_port") { + defines = [ "OT_FREERTOS_ENABLE=1" ] + if (thread_port_1_3) { + defines += [ "OT_THREAD_PORT_1_3" ] + } + + include_dirs = [ + "${chip_root}/platform/bl702", + "${chip_root}/third_party/openthread/repo/src/core", + "${chip_root}/third_party/openthread/repo/examples/platforms", + "${bl_iot_sdk_root}/components/network/thread/openthread_port/include", + ] + + if (thread_port_1_3) { + include_dirs += [ + "${bl_iot_sdk_root}/components/network/thread/openthread_utils/include", + ] + } + } + + source_set("${sdk_target_name}_openthread") { + import("//build_overrides/openthread.gni") + + include_dirs = [ + "${bl_iot_sdk_root}/components/network/lmac154/include", + "${bl_iot_sdk_root}/components/network/thread/openthread_port", + "${openthread_root}/examples/platforms/utils/", + "${openthread_root}/examples", + ] + + sources = [ + "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_alarm.c", + "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_diag.c", + "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_entropy.c", + "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_logging.c", + "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_misc.c", + "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_radio.c", + "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_settings.c", + ] + + libs = [ "${bl_iot_sdk_root}/components/network/lmac154/lib/liblmac154.a" ] + + if (thread_port_1_3) { + sources += [ "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_linkmetric.c" ] + libs += [ "${bl_iot_sdk_root}/components/network/thread/openthread_utils/lib/libopenthread_utils.a" ] + } + + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_utils", + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_stage", + ":${sdk_target_name}_config_freertos", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_openthread_port", + ] + + public_deps = [ + "${bouffalolab_iot_sdk_build_root}/bl702:mbedtls", + "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", + "${openthread_root}/src/core:libopenthread_core_headers", + ] + } + + config("${sdk_target_name}_config_lwip_port") { + _include_dirs = [ + "${bl_iot_sdk_root}/components/network/lwip/lwip-port", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/config", + "${bl_iot_sdk_root}/components/stage/virt_net/include", + "${bl_iot_sdk_root}/components/stage/throughput/bl702/inc", + ] + + defines = [ + "TCPIP_THREAD_PRIO=24", + "CFG_ETHERNET_ENABLE=1", + ] + + cflags = [] + foreach(include_dir, _include_dirs) { + cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] + } + + cflags += [ + "-Wno-conversion", + "-Wno-unused-function", + ] + } + + source_set("${sdk_target_name}_lwip_port") { + defines = [ + "SPI_WIFI_RXBUFF_IN_PSRAM=1", + "VIRT_NET_SPI_RX_TASK_PRIORITY=25", + ] + + # include_dirs = [ + # "${bl_iot_sdk_root}/components/network/lwip/lwip-port/arch", + # "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS", + # "${bl_iot_sdk_root}/components/stage/throughput" + # ] + + # sources = [ + # "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/ethernetif.c", + # "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/sys_arch.c" + # ] + + # sources += [ + # "${bl_iot_sdk_root}/components/stage/throughput/bl702/src/tp_spi_master.c", + # ] + # sources += [ + # "${bl_iot_sdk_root}/components/stage/virt_net/src/virt_net.c", + # "${bl_iot_sdk_root}/components/stage/virt_net/src/virt_net_spi.c", + # ] + + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_lwip_port", + ":${sdk_target_name}_config_lwip", + ] + + cflags = [ "-Wno-sign-compare" ] + } + + config("${sdk_target_name}_config_lwip") { + include_dirs = [ + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/config", + "${bl_iot_sdk_root}/components/network/lwip/src/include", + "${bl_iot_sdk_root}/components/network/lwip/src/include/lwip/apps", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/hook", + ] + + defines = [ + "LWIP_IPV6=1", + "LWIP_IPV4=1", + "LWIP_IPV6_DHCP6=1", + "LWIP_IPV6_SCOPES=0", + "PBUF_POOL_SIZE=20", + "PBUF_POOL_BUFSIZE=(1280+150)", + ] + } + + source_set("${sdk_target_name}_lwip") { + sources = [ + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/ethernetif.c", + "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/sys_arch.c", + ] + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/netif/bridgeif.c", + "${bl_iot_sdk_root}/components/network/lwip/src/netif/bridgeif_fdb.c", + "${bl_iot_sdk_root}/components/network/lwip/src/netif/ethernet.c", + "${bl_iot_sdk_root}/components/network/lwip/src/netif/slipif.c", + "${bl_iot_sdk_root}/components/network/lwip/src/netif/zepif.c", + ] + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/core/def.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/dns.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/inet_chksum.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/init.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ip.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/mem.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/memp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/netif.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/pbuf.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/raw.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/stats.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/sys.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/tcp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/tcp_in.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/tcp_out.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/timeouts.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/udp.c", + ] + + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/autoip.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/dhcp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/etharp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/icmp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/igmp.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/ip4.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/ip4_addr.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv4/ip4_frag.c", + ] + + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/dhcp6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ethip6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/icmp6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/inet6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ip6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ip6_addr.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ip6_frag.c", + + #"${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/ip6_route_table.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/mld6.c", + "${bl_iot_sdk_root}/components/network/lwip/src/core/ipv6/nd6.c", + ] + + sources += [ + "${bl_iot_sdk_root}/components/network/lwip/src/api/api_lib.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/api_msg.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/err.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/if_api.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/netbuf.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/netifapi.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/sockets.c", + "${bl_iot_sdk_root}/components/network/lwip/src/api/tcpip.c", + ] + sources += + [ "${bl_iot_sdk_root}/components/network/lwip/src/apps/mdns/mdns.c" ] + + configs += [ ":${sdk_target_name}_config_freertos" ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_lwip", + ] + } + + group(sdk_target_name) { + public_deps = [ + ":${sdk_target_name}_BSP_Driver", + ":${sdk_target_name}_bl702_freertos", + ":${sdk_target_name}_ble", + ":${sdk_target_name}_fs", + ":${sdk_target_name}_hosal", + ":${sdk_target_name}_libc", + ":${sdk_target_name}_soc", + ":${sdk_target_name}_stage", + ":${sdk_target_name}_sys", + ":${sdk_target_name}_utils", + ] + + if (chip_enable_openthread) { + public_deps += [ ":${sdk_target_name}_openthread" ] + } + + if (chip_enable_wifi) { + public_deps += [ ":${sdk_target_name}_lwip_port" ] + public_deps += [ ":${sdk_target_name}_lwip" ] + } + + if (enable_cdc_module) { + public_deps += [ ":${sdk_target_name}_bl702_usb_cdc" ] + } + } +} diff --git a/third_party/bouffalolab/bl702/bl702_board.gni b/third_party/bouffalolab/common/bouffalolab_board.gni similarity index 78% rename from third_party/bouffalolab/bl702/bl702_board.gni rename to third_party/bouffalolab/common/bouffalolab_board.gni index 5aa17fd891eb73..c21e839dbfe372 100644 --- a/third_party/bouffalolab/bl702/bl702_board.gni +++ b/third_party/bouffalolab/common/bouffalolab_board.gni @@ -13,14 +13,13 @@ # limitations under the License. declare_args() { - # BL602 board used - bl702_board = "BL-IOT-DVK" + bouffalolab_bard = "BL-IOT-DVK" } -if (bl702_board == "") { - bl702_board = "BL-IOT-DVK" +if (bouffalolab_bard == "") { + bouffalolab_bard = "BL-IOT-DVK" } -assert(bl702_board != "", "bl702_board must be specified") +assert(bouffalolab_bard != "", "bouffalolab_bard must be specified") board_defines = [] diff --git a/third_party/bouffalolab/bl602/bl602_executable.gni b/third_party/bouffalolab/common/bouffalolab_executable.gni similarity index 81% rename from third_party/bouffalolab/bl602/bl602_executable.gni rename to third_party/bouffalolab/common/bouffalolab_executable.gni index 5c327b0f913540..54f4c031ee263c 100644 --- a/third_party/bouffalolab/bl602/bl602_executable.gni +++ b/third_party/bouffalolab/common/bouffalolab_executable.gni @@ -18,7 +18,7 @@ import("//build_overrides/chip.gni") import("//build_overrides/bouffalolab_iot_sdk.gni") import("${build_root}/toolchain/flashable_executable.gni") -template("bl602_executable") { +template("bouffalolab_executable") { output_base_name = get_path_info(invoker.output_name, "name") objcopy_image_name = output_base_name + ".bin" @@ -40,9 +40,13 @@ template("bl602_executable") { "${chip_root}/scripts/flashing/bouffalolab_firmware_utils.py", "${chip_root}/scripts/flashing/firmware_utils.py", - "${chip_root}/examples/platform/bouffalolab/bl602/flash_config/partition_cfg_2M.toml", - "${chip_root}/examples/platform/bouffalolab/bl602/flash_config/partition_cfg_4M.toml", + "${chip_root}/examples/platform/bouffalolab/${invoker.bl_plat_name}/flash_config/partition_cfg_2M.toml", ] + + if (invoker.bl_plat_name == "bl602") { + flashing_script_inputs += [ "${chip_root}/examples/platform/bouffalolab/${invoker.bl_plat_name}/flash_config/partition_cfg_4M.toml" ] + } + copy(flashing_runtime_target) { sources = flashing_script_inputs outputs = [ "${root_out_dir}/{{source_file_part}}" ] @@ -53,12 +57,16 @@ template("bl602_executable") { flashing_script_name = output_base_name + ".flash.py" flashing_options = [ "bouffalolab" ] flashing_options += [ "--chipname" ] - flashing_options += [ "bl602" ] + flashing_options += [ "${invoker.bl_plat_name}" ] flashing_options += [ "--xtal" ] - flashing_options += [ "40M" ] - flashing_options += [ "--pt" ] + if (invoker.bl_plat_name == "bl602") { + flashing_options += [ "40M" ] + } else if (invoker.bl_plat_name == "bl702") { + flashing_options += [ "32M" ] + } - if (invoker.board == "BL602-IOT-DVK-3S") { + flashing_options += [ "--pt" ] + if (invoker.board == "BL602-IOT-DVK-3S" || invoker.bl_plat_name == "bl702") { flashing_options += [ rebase_path("partition_cfg_2M.toml", root_out_dir, root_out_dir) ] } else { diff --git a/third_party/bouffalolab/bl602/bl602_riscv.gni b/third_party/bouffalolab/common/rsicv.gni similarity index 96% rename from third_party/bouffalolab/bl602/bl602_riscv.gni rename to third_party/bouffalolab/common/rsicv.gni index 3c72c6fdf06fe9..dc75aaa22232d6 100644 --- a/third_party/bouffalolab/bl602/bl602_riscv.gni +++ b/third_party/bouffalolab/common/rsicv.gni @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("bl602_board.gni") - riscv_arch = "rv32imfc" riscv_abi = "ilp32f" # riscv_cpu = "" diff --git a/third_party/bouffalolab/repo b/third_party/bouffalolab/repo index ae0622d85476ed..abf04dcdc4ce5f 160000 --- a/third_party/bouffalolab/repo +++ b/third_party/bouffalolab/repo @@ -1 +1 @@ -Subproject commit ae0622d85476ed838ebc3efde9743c376bc9f96d +Subproject commit abf04dcdc4ce5f94c57b6150d6ba52a22b700880