[Bouffalolab] Add Bouffalo Lab BL704L support (#27386)

* add bl704l files

* add workflow for bl704l

* fix workflow error

* update image build script

* correct workflow

* fix restyle

* restore lighting-app-wifi.matter
diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml
index a22eb4c..62fb197 100644
--- a/.github/workflows/examples-bouffalolab.yaml
+++ b/.github/workflows/examples-bouffalolab.yaml
@@ -95,6 +95,24 @@
       - name: Clean out build output
         run: rm -rf ./out
 
+      - name: Build example BL702L Lighting App
+        timeout-minutes: 30
+        run: |
+          ./scripts/run_in_build_env.sh \
+            "./scripts/build/build_examples.py \
+              --target bouffalolab-bl704l-dvk-light \
+              build \
+              --copy-artifacts-to out/artifacts \
+            "
+      - name: Prepare some bloat report from the previous builds
+        run: |
+          .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
+              bl702l bl702l lighting-app \
+              out/artifacts/bouffalolab-bl704l-dvk-light/chip-bl702l-lighting-example.out \
+              /tmp/bloat_reports/
+      - name: Clean out build output
+        run: rm -rf ./out
+
       - name: Uploading Size Reports
         uses: ./.github/actions/upload-size-reports
         if: ${{ !env.ACT }}
diff --git a/examples/lighting-app/bouffalolab/README.md b/examples/lighting-app/bouffalolab/README.md
index 3ce3cb4..a7f7867 100644
--- a/examples/lighting-app/bouffalolab/README.md
+++ b/examples/lighting-app/bouffalolab/README.md
@@ -11,6 +11,7 @@
 -   `BL602-NIGHT-LIGHT`
 -   `XT-ZB6-DevKit`
 -   `BL706-NIGHT-LIGHT`
+-   `BL704L-DVK`
 
 > Warning: Changing the PID may cause compilation problems, we recommend leaving
 > it as the default while using this example.
@@ -71,14 +72,15 @@
 
 ## Build CHIP Lighting App example
 
-The following steps take examples for BL602 develop board `BL602-IoT-Matter-V1`
-and BL706 develop board `XT-ZB6-DevKit`.
+The following steps take examples for BL602 develop board `BL602-IoT-Matter-V1`,
+BL706 develop board `XT-ZB6-DevKit` and BL704L DVK board `BL704L-DVK`
 
 -   Build lighting app with UART baudrate 2000000
 
     ```
     ./scripts/build/build_examples.py --target bouffalolab-bl602-iot-matter-v1-light build
     ./scripts/build/build_examples.py --target bouffalolab-xt-zb6-devkit-light build
+    ./scripts/build/build_examples.py --target bouffalolab-bl704l-dvk-light build
     ```
 
 -   Build lighting app with UART baudrate 115200
@@ -124,10 +126,12 @@
     -   Type following command for image download. Please set serial port
         accordingly, here we use /dev/ttyACM0 as a serial port example.
 
-        -   `bl602-iot-matter-v1` without additional build options
+        -   `bl602-iot-matter-v1` and `bl704l-dvk` without additional build
+            options
 
             ```shell
             ./out/bouffalolab-bl602-iot-matter-v1-light/chip-bl602-lighting-example.flash.py --port /dev/ttyACM0
+            ./out/bouffalolab-bl704l-dvk-light/chip-bl702l-lighting-example.flash.py --port /dev/ttyACM0
             ```
 
         -   `xt-zb6-devkit` with 115200 baudrate setting
@@ -142,6 +146,7 @@
             ```shell
             ./out/bouffalolab-bl602-iot-matter-v1-light/chip-bl602-lighting-example.flash.py --port /dev/ttyACM0 --erase
             ./out/bouffalolab-xt-zb6-devkit-light-115200/chip-bl702-lighting-example.flash.py --port /dev/ttyACM0 --erase
+            ./out/bouffalolab-bl704l-dvk-light/chip-bl702l-lighting-example.flash.py --port /dev/ttyACM0 --erase
             ```
 
             > Note, better to append --erase option to download image for BL602
diff --git a/examples/lighting-app/bouffalolab/bl702l/.gn b/examples/lighting-app/bouffalolab/bl702l/.gn
new file mode 100644
index 0000000..970ade0
--- /dev/null
+++ b/examples/lighting-app/bouffalolab/bl702l/.gn
@@ -0,0 +1,30 @@
+# Copyright (c) 2020 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/build.gni")
+
+# The location of the build configuration file.
+buildconfig = "${build_root}/config/BUILDCONFIG.gn"
+
+# CHIP uses angle bracket includes.
+check_system_includes = true
+
+default_args = {
+  target_cpu = "riscv"
+  target_os = "freertos"
+
+  chip_openthread_ftd = true
+
+  import("//args.gni")
+}
diff --git a/examples/lighting-app/bouffalolab/bl702l/BUILD.gn b/examples/lighting-app/bouffalolab/bl702l/BUILD.gn
new file mode 100644
index 0000000..db0209f
--- /dev/null
+++ b/examples/lighting-app/bouffalolab/bl702l/BUILD.gn
@@ -0,0 +1,261 @@
+# Copyright (c) 2020 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/bouffalolab_iot_sdk.gni")
+import("//build_overrides/build.gni")
+import("//build_overrides/chip.gni")
+
+import("${bouffalolab_iot_sdk_build_root}/bl702l/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")
+
+import("${chip_root}/src/app/chip_data_model.gni")
+
+if (chip_enable_pw_rpc) {
+  import("//build_overrides/pigweed.gni")
+  import("$dir_pw_build/target_types.gni")
+}
+
+assert(current_os == "freertos")
+
+example_common_dir = "${chip_root}/examples/lighting-app/bouffalolab/common"
+example_dir = "${chip_root}/examples/lighting-app/bouffalolab/bl702l"
+examples_plat_common_dir = "${chip_root}/examples/platform/bouffalolab/common"
+examples_plat_dir = "${chip_root}/examples/platform/bouffalolab/bl702l"
+
+declare_args() {
+  # Dump memory usage at link time.
+  chip_print_memory_usage = true
+
+  # OTA periodic query timeout in seconds
+  ota_periodic_query_timeout_seconds = 86400
+
+  # reboot delay in seconds to apply new OTA image
+  ota_auto_reboot_delay_seconds = 5
+
+  config_cache_size = 8192
+
+  enable_heap_monitoring = false
+
+  setupPinCode = 20202021
+  setupDiscriminator = 3840
+
+  board = "BL704L-EVB"
+  module_type = "BL704L"
+  enable_psram = true
+  baudrate = 2000000
+}
+
+bl_iot_sdk("sdk") {
+  include_dirs = [
+    "${chip_root}/src/platform/bouffalolab/BL702L",
+    "${example_dir}",
+    "${example_common_dir}",
+  ]
+
+  freertos_config = "${examples_plat_dir}/FreeRTOSConfig.h"
+
+  defines = [
+    "INCLUDE_xSemaphoreGetMutexHolder=1",
+    "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
+    "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
+    "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_seconds}",
+    "OTA_AUTO_REBOOT_DELAY=${ota_auto_reboot_delay_seconds}",
+    "OPENTHREAD_CONFIG_PLATFORM_XTAL_ACCURACY=40",
+    "PRINT_DEBUG=0",
+  ]
+
+  if (enable_psram) {
+    defines += [ "CFG_USE_PSRAM=1" ]
+  }
+
+  if (chip_enable_pw_rpc) {
+    include_dirs += [ "${examples_plat_common_dir}/rpc" ]
+    defines += [ "PW_RPC_ENABLED=1" ]
+    defines += [ "DISABLE_PRINT=1" ]
+  } else if (chip_build_libshell) {
+    include_dirs += [ "${examples_plat_common_dir}/plat" ]
+  }
+}
+
+chip_data_model("bouffalolab-lighting") {
+  zap_file = "${example_dir}/../data_model/lighting-app-thread.zap"
+
+  zap_pregenerated_dir = "${chip_root}/zzz_generated/lighting-app/zap-generated"
+  is_server = true
+}
+bouffalolab_executable("lighting_app") {
+  output_name = "chip-bl702l-lighting-example.out"
+  bl_plat_name = "bl702l"
+
+  defines = [
+    "APP_TASK_STACK_SIZE=2044",
+    "CHIP_UART_BAUDRATE=${baudrate}",
+    "BL702L_ENABLE",
+    "START_ENTRY=bl702_main",
+  ]
+
+  defines += [ "CFG_USE_PSRAM=1" ]
+
+  defines += [ "BOARD_BTN_BOOT_PIN" ]
+
+  if ("BL704L" == board) {
+    defines += [ "XT_ZB6_DevKit" ]
+  } else if ("BL706-NIGHT-LIGHT" == board) {
+    defines += [ "BL706_NIGHT_LIGHT" ]
+  } else if ("BL702-IoT-DVK" == board || "BL706-IoT-DVK" == board) {
+    defines += [ "BL706_IOT_DVK" ]
+  }
+
+  sources = [
+    "${example_common_dir}/AppTask.cpp",
+    "${example_common_dir}/ZclCallbacks.cpp",
+    "${examples_plat_common_dir}/plat/LEDWidget.cpp",
+    "${examples_plat_common_dir}/plat/demo_pwm.c",
+    "${examples_plat_common_dir}/plat/main.cpp",
+    "${examples_plat_common_dir}/plat/platform.cpp",
+    "${examples_plat_common_dir}/plat/uart.c",
+  ]
+
+  deps = [
+    ":bouffalolab-lighting",
+    ":sdk",
+    "${chip_root}/examples/providers:device_info_provider",
+    "${chip_root}/src/lib",
+    "${chip_root}/src/setup_payload",
+    "${chip_root}/third_party/openthread/platforms:libopenthread-platform",
+    "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
+  ]
+
+  if (chip_openthread_ftd) {
+    defines += [ "CHIP_DEVICE_CONFIG_THREAD_FTD=1" ]
+    deps += [
+      "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd",
+      "${chip_root}/third_party/openthread/repo:libopenthread-ftd",
+    ]
+  } else {
+    defines += [ "CHIP_DEVICE_CONFIG_THREAD_FTD=0" ]
+    deps += [
+      "${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd",
+      "${chip_root}/third_party/openthread/repo:libopenthread-mtd",
+    ]
+  }
+
+  include_dirs = [
+    "${chip_root}/src/platform/bouffalolab/BL702L",
+    "${example_common_dir}",
+    "${examples_plat_common_dir}/plat",
+  ]
+
+  if (chip_enable_pw_rpc) {
+    defines += [
+      "PW_RPC_ENABLED=1",
+      "PW_RPC_ATTRIBUTE_SERVICE=1",
+      "PW_RPC_BUTTON_SERVICE=1",
+      "PW_RPC_DESCRIPTOR_SERVICE=1",
+      "PW_RPC_DEVICE_SERVICE=1",
+      "PW_RPC_LIGHTING_SERVICE=1",
+
+      "PW_RPC_OTCLI_SERVICE=1",
+      "PW_RPC_THREAD_SERVICE=1",
+
+      #"PW_RPC_TRACING_SERVICE=1",
+    ]
+
+    sources += [
+      "${chip_root}/examples/common/pigweed/RpcService.cpp",
+      "${chip_root}/examples/common/pigweed/bouffalolab/PigweedLoggerMutex.cpp",
+      "${examples_plat_common_dir}/rpc/PigweedLogger.cpp",
+      "${examples_plat_common_dir}/rpc/Rpc.cpp",
+    ]
+
+    deps += [
+      "$dir_pw_hdlc:rpc_channel_output",
+      "$dir_pw_stream:sys_io_stream",
+
+      #"$dir_pw_trace",
+      #"$dir_pw_trace_tokenized",
+      #"$dir_pw_trace_tokenized:trace_rpc_service",
+      "${chip_root}/config/bouffalolab/common/lib/pw_rpc:pw_rpc",
+      "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:ot_cli_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:thread_service.nanopb_rpc",
+      "${examples_plat_common_dir}/rpc/pw_sys_io:pw_sys_io",
+    ]
+
+    deps += pw_build_LINK_DEPS
+
+    include_dirs += [
+      "${chip_root}/examples/common",
+      "${chip_root}/examples/common/pigweed/bouffalolab",
+    ]
+  } else if (chip_build_libshell) {
+    defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ]
+
+    deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ]
+
+    include_dirs += [
+      "${chip_root}/src/lib/shell",
+      "${chip_root}/examples/shell/shell_common/include",
+    ]
+  }
+
+  if (enable_heap_monitoring) {
+    sources += [ "${examples_plat_common_dir}/plat/MemMonitoring.cpp" ]
+    defines += [ "HEAP_MONITORING=1" ]
+  }
+
+  if (chip_enable_ota_requestor) {
+    defines += [ "OTA_ENABLED" ]
+    sources += [ "${examples_plat_common_dir}/plat/OTAConfig.cpp" ]
+  }
+
+  if (enable_psram) {
+    ldscript = "${examples_plat_dir}/ldscripts/psram_flash_rom.ld"
+  } else {
+    ldscript = "${examples_plat_dir}/ldscripts/flash_rom.ld"
+  }
+
+  inputs = [ ldscript ]
+
+  ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
+  cflags_c = [
+    "-Wno-unused-variable",
+    "-Wno-old-style-declaration",
+  ]
+  cflags = [ "-Wno-unused-variable" ]
+  if (chip_print_memory_usage) {
+    ldflags += [
+      "-Wl,--print-memory-usage",
+      "-Wl,--defsym=__CACHE_SIZE=${config_cache_size}",
+      "-fstack-usage",
+    ]
+  }
+
+  output_dir = root_out_dir
+}
+
+group("bl702l") {
+  deps = [ ":lighting_app" ]
+}
+
+group("default") {
+  deps = [ ":bl702l" ]
+}
diff --git a/examples/lighting-app/bouffalolab/bl702l/CHIPProjectConfig.h b/examples/lighting-app/bouffalolab/bl702l/CHIPProjectConfig.h
new file mode 100644
index 0000000..1a357d1
--- /dev/null
+++ b/examples/lighting-app/bouffalolab/bl702l/CHIPProjectConfig.h
@@ -0,0 +1,135 @@
+/*
+ *
+ *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2019 Google LLC.
+ *    All rights reserved.
+ *
+ *    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.
+ */
+
+/**
+ *    @file
+ *          Example project configuration file for CHIP.
+ *
+ *          This is a place to put application or project-specific overrides
+ *          to the default configuration values for general CHIP features.
+ *
+ */
+
+#pragma once
+
+/**
+ * CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY
+ *
+ * Enables the use of a hard-coded default Chip device id and credentials if no device id
+ * is found in Chip NV storage.
+ *
+ * This option is for testing only and should be disabled in production releases.
+ */
+#define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 34
+
+// Use a default pairing code if one hasn't been provisioned in flash.
+#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
+#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
+#endif
+
+#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR
+#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
+#endif
+
+// For convenience, Chip Security Test Mode can be enabled and the
+// requirement for authentication in various protocols can be disabled.
+//
+//    WARNING: These options make it possible to circumvent basic Chip security functionality,
+//    including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS.
+//
+#define CHIP_CONFIG_SECURITY_TEST_MODE 0
+#define CHIP_CONFIG_REQUIRE_AUTH 1
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID
+ *
+ * 0x130D: Chip's Vendor Id.
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
+ *
+ * 0x8005: example lighting app
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8005
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
+ *
+ * The product revision number assigned to device or product by the device vendor.  This
+ * number is scoped to the device product id, and typically corresponds to a revision of the
+ * physical device, a change to its packaging, and/or a change to its marketing presentation.
+ * This value is generally *not* incremented for device software revisions.
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION 1
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
+ *
+ * A string identifying the software version running on the device.
+ * CHIP service currently expects the software version to be in the format
+ * {MAJOR_VERSION}.0d{MINOR_VERSION}
+ */
+#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
+#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA"
+#endif
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
+ *
+ * A uint32_t identifying the software version running on the device.
+ */
+/* The SoftwareVersion attribute of the Basic cluster. */
+#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
+#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0001
+#endif
+
+/**
+ * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
+ *
+ * Enable support for Chip-over-BLE (CHIPoBLE).
+ */
+#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1
+
+/**
+ * CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER
+ *
+ * Enables the use of a hard-coded default serial number if none
+ * is found in Chip NV storage.
+ */
+#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"
+
+/**
+ * CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
+ *
+ * Enable recording UTC timestamps.
+ */
+#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1
+
+/**
+ * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
+ *
+ * A size, in bytes, of the individual debug event logging buffer.
+ */
+#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
+
+#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1
+
+#define CHIP_BLE_DEVICE_NAME "MatterLight"
diff --git a/examples/lighting-app/bouffalolab/bl702l/args.gni b/examples/lighting-app/bouffalolab/bl702l/args.gni
new file mode 100644
index 0000000..a897d37
--- /dev/null
+++ b/examples/lighting-app/bouffalolab/bl702l/args.gni
@@ -0,0 +1,37 @@
+# Copyright (c) 2020 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/chip.gni")
+import("//build_overrides/pigweed.gni")
+import("${chip_root}/config/standalone/args.gni")
+import("${chip_root}/src/platform/bouffalolab/BL702L/args.gni")
+
+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"
+pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex"
+
+chip_enable_ble = true
+chip_enable_openthread = true
+chip_enable_wifi = false
+lwip_platform = "bl702l"
+
+chip_enable_ota_requestor = true
+chip_detail_logging = false
+
+pw_build_LINK_DEPS = [
+  "$dir_pw_assert:impl",
+  "$dir_pw_log:impl",
+]
diff --git a/examples/lighting-app/bouffalolab/bl702l/board.h b/examples/lighting-app/bouffalolab/bl702l/board.h
new file mode 100644
index 0000000..5bfcc54
--- /dev/null
+++ b/examples/lighting-app/bouffalolab/bl702l/board.h
@@ -0,0 +1,89 @@
+/*

+ *  Copyright (c) 2018, The OpenThread Authors.

+ *  All rights reserved.

+ *

+ *  Redistribution and use in source and binary forms, with or without

+ *  modification, are permitted provided that the following conditions are met:

+ *  1. Redistributions of source code must retain the above copyright

+ *     notice, this list of conditions and the following disclaimer.

+ *  2. Redistributions in binary form must reproduce the above copyright

+ *     notice, this list of conditions and the following disclaimer in the

+ *     documentation and/or other materials provided with the distribution.

+ *  3. Neither the name of the copyright holder nor the

+ *     names of its contributors may be used to endorse or promote products

+ *     derived from this software without specific prior written permission.

+ *

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE

+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE

+ *  POSSIBILITY OF SUCH DAMAGE.

+ */

+

+/**

+ * @file

+ *   This file includes dev borad compile-time configuration constants for BL702L.

+ *

+ */

+

+#pragma once

+

+#define CHIP_UART_PORT 0

+#define CHIP_UART_RX_BUFFSIZE 256

+

+#ifdef BL706_NIGHT_LIGHT

+

+#define LED_B_PIN_PORT 2

+#define LED_B_PIN 12

+

+#define LED_R_PIN_PORT 0

+#define LED_R_PIN 10

+

+#define LED_G_PIN_PORT 1

+#define LED_G_PIN 16

+

+#define MAX_PWM_CHANNEL 3

+

+#elif defined(XT_ZB6_DevKit)

+

+// #define LED_B_PIN_PORT 3

+// #define LED_B_PIN 18

+

+// #define LED_R_PIN_PORT 4

+// #define LED_R_PIN 19

+

+// #define LED_G_PIN_PORT 0

+// #define LED_G_PIN 20

+

+#define LED_PIN_PORT 3

+#define LED_PIN 18

+

+#define MAX_PWM_CHANNEL 1

+

+#else

+

+#define LED_PIN_PORT 2

+#define LED_PIN 22

+

+#define MAX_PWM_CHANNEL 1

+

+#endif

+

+#if defined(BOARD_BTN_BOOT_PIN)

+#define LED_BTN_RESET 16

+#endif

+

+#define SPI_WIFI_MISO_PIN 4

+#define SPI_WIFI_MOSI_PIN 5

+#define SPI_WIFI_CLK_PIN 3

+#define SPI_WIFI_CS_PIN 6

+#define SPI_WIFI_IRQ_PIN 10

+

+#define CHIP_UART_PIN_RX 15

+#define CHIP_UART_PIN_TX 14

diff --git a/examples/lighting-app/bouffalolab/bl702l/build_overrides b/examples/lighting-app/bouffalolab/bl702l/build_overrides
new file mode 120000
index 0000000..995884e
--- /dev/null
+++ b/examples/lighting-app/bouffalolab/bl702l/build_overrides
@@ -0,0 +1 @@
+../../../build_overrides
\ No newline at end of file
diff --git a/examples/lighting-app/bouffalolab/bl702l/third_party/connectedhomeip b/examples/lighting-app/bouffalolab/bl702l/third_party/connectedhomeip
new file mode 120000
index 0000000..5930783
--- /dev/null
+++ b/examples/lighting-app/bouffalolab/bl702l/third_party/connectedhomeip
@@ -0,0 +1 @@
+../../../../..
\ No newline at end of file
diff --git a/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni
new file mode 100644
index 0000000..81aacad
--- /dev/null
+++ b/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni
@@ -0,0 +1,27 @@
+# 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.
+
+# add this gni as import in your build args to use pigweed in the example
+# 'import("//with_pw_rpc.gni")'
+
+import("//build_overrides/chip.gni")
+import("//build_overrides/pigweed.gni")
+import("${chip_root}/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni")
+import("${chip_root}/examples/platform/bouffalolab/bl702l/args.gni")
+
+chip_enable_pw_rpc = true
+chip_build_pw_trace_lib = false
+
+cpp_standard = "gnu++17"
+#pw_trace_BACKEND = "$dir_pw_trace_tokenized"
diff --git a/examples/lighting-app/bouffalolab/common/AppTask.cpp b/examples/lighting-app/bouffalolab/common/AppTask.cpp
index 3e7171d..28d8e83 100644
--- a/examples/lighting-app/bouffalolab/common/AppTask.cpp
+++ b/examples/lighting-app/bouffalolab/common/AppTask.cpp
@@ -506,15 +506,22 @@
     uint32_t presstime;
     if (ButtonPressed())
     {
+#ifdef BL702L_ENABLE
+        bl_set_gpio_intmod(gpio_key.port, HOSAL_IRQ_TRIG_NEG_LEVEL);
+#else
         bl_set_gpio_intmod(gpio_key.port, 1, HOSAL_IRQ_TRIG_NEG_LEVEL);
+#endif
 
         GetAppTask().mButtonPressedTime = chip::System::SystemClock().GetMonotonicMilliseconds64().count();
         GetAppTask().PostEvent(APP_EVENT_BTN_FACTORY_RESET_PRESS);
     }
     else
     {
+#ifdef BL702L_ENABLE
+        bl_set_gpio_intmod(gpio_key.port, HOSAL_IRQ_TRIG_POS_PULSE);
+#else
         bl_set_gpio_intmod(gpio_key.port, 1, HOSAL_IRQ_TRIG_POS_PULSE);
-
+#endif
         if (GetAppTask().mButtonPressedTime)
         {
             presstime = chip::System::SystemClock().GetMonotonicMilliseconds64().count() - GetAppTask().mButtonPressedTime;
diff --git a/examples/platform/bouffalolab/bl702/ldscripts/psram_flash.ld b/examples/platform/bouffalolab/bl702/ldscripts/psram_flash.ld
index e432a4d..c31a453 100644
--- a/examples/platform/bouffalolab/bl702/ldscripts/psram_flash.ld
+++ b/examples/platform/bouffalolab/bl702/ldscripts/psram_flash.ld
@@ -275,8 +275,6 @@
     . = ALIGN(8);
     /* KEEP(*shell_common.globals.cpp.o(.bss.*))               */
 
-    PROVIDE ( __psram_bss_init_end = . );
-    
     . = ALIGN(8);
     KEEP(*lwip.memp.c.o(.bss.lwip_PBUF_POOL))
     . = ALIGN(8);
@@ -285,8 +283,10 @@
     . = ALIGN(8);
     KEEP(*virt_net_spi.c.o(.bss.tx_buffer))
 
-    *(.wifi_ram*)
+    PROVIDE ( __psram_bss_init_end = . );
     . = ALIGN(16);
+
+    *(.wifi_ram*)
   } >psram
 
   . = ALIGN(8);
diff --git a/examples/platform/bouffalolab/bl702l/BUILD.gn b/examples/platform/bouffalolab/bl702l/BUILD.gn
new file mode 100644
index 0000000..45f01b7
--- /dev/null
+++ b/examples/platform/bouffalolab/bl702l/BUILD.gn
@@ -0,0 +1,22 @@
+# 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/bouffalolab_iot_sdk.gni")
+import("//build_overrides/chip.gni")
+
+import("${bouffalolab_iot_sdk_build_root}/bl702l/bl_iot_sdk.gni")
+
+config("chip_examples_project_config") {
+  include_dirs = [ "project_include" ]
+}
diff --git a/examples/platform/bouffalolab/bl702l/FreeRTOSConfig.h b/examples/platform/bouffalolab/bl702l/FreeRTOSConfig.h
new file mode 100644
index 0000000..a131725
--- /dev/null
+++ b/examples/platform/bouffalolab/bl702l/FreeRTOSConfig.h
@@ -0,0 +1,192 @@
+/*
+    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
+    All rights reserved
+
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
+
+    ***************************************************************************
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<
+    >>!   obliged to provide the source code for proprietary components     !<<
+    >>!   outside of the FreeRTOS kernel.                                   !<<
+    ***************************************************************************
+
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following
+    link: http://www.freertos.org/a00114.html
+
+    ***************************************************************************
+     *                                                                       *
+     *    FreeRTOS provides completely free yet professionally developed,    *
+     *    robust, strictly quality controlled, supported, and cross          *
+     *    platform software that is more than just the market leader, it     *
+     *    is the industry's de facto standard.                               *
+     *                                                                       *
+     *    Help yourself get started quickly while simultaneously helping     *
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *
+     *    tutorial book, reference manual, or both:                          *
+     *    http://www.FreeRTOS.org/Documentation                              *
+     *                                                                       *
+    ***************************************************************************
+
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading
+    the FAQ page "My application does not run, what could be wrong?".  Have you
+    defined configASSERT()?
+
+    http://www.FreeRTOS.org/support - In return for receiving this top quality
+    embedded software for free we request you assist our global community by
+    participating in the support forum.
+
+    http://www.FreeRTOS.org/training - Investing in training allows your team to
+    be as productive as possible as early as possible.  Now you can receive
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
+    Ltd, and the world's leading authority on the world's leading RTOS.
+
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.
+
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
+
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS
+    licenses offer ticketed support, indemnification and commercial middleware.
+
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety
+    engineered and independently SIL3 certified version for use in safety and
+    mission critical applications that require provable dependability.
+
+    1 tab == 4 spaces!
+*/
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+#include "platform.h"
+
+/*-----------------------------------------------------------
+ * Application specific definitions.
+ *
+ * These definitions should be adjusted for your particular hardware and
+ * application requirements.
+ *
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
+ *
+ * See http://www.freertos.org/a00110.html.
+ *----------------------------------------------------------*/
+
+#define configSUPPORT_STATIC_ALLOCATION 1
+
+#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 1
+#define configUSE_TICKLESS_IDLE 1
+#define configCPU_CLOCK_HZ (2000000) /*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) 256) /* 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 definitions. */
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1)
+#define configTIMER_QUEUE_LENGTH 4
+#define configTIMER_TASK_STACK_DEPTH (400)
+
+/* Task priorities.  Allow these to be overridden. */
+#ifndef uartPRIMARY_PRIORITY
+#define uartPRIMARY_PRIORITY (configMAX_PRIORITIES - 3)
+#endif
+
+/* Set the following definitions to 1 to include the API function, or zero
+to exclude the API function. */
+#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_uxTaskGetStackHighWaterMark 1
+#define INCLUDE_xTaskGetIdleTaskHandle 1
+#define INCLUDE_xTaskGetHandle 1
+
+/* Normal assert() semantics without relying on the provision of an assert.h
+header file. */
+#ifdef __cplusplus
+extern "C" void (*vAssertCalled)(void);
+#else
+extern void (*vAssertCalled)(void);
+#endif
+#define configASSERT(x)                                                                                                            \
+    if ((x) == 0)                                                                                                                  \
+    vAssertCalled()
+
+/* 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
+
+#if (configUSE_TICKLESS_IDLE != 0)
+#include "portmacro.h"
+#ifdef __cplusplus
+extern "C" void (*vApplicationSleep)(TickType_t xExpectedIdleTime);
+#else
+extern void (*vApplicationSleep)(TickType_t xExpectedIdleTime);
+#endif
+#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) vApplicationSleep(xExpectedIdleTime)
+#endif
+
+#endif /* FREERTOS_CONFIG_H */
diff --git a/examples/platform/bouffalolab/bl702l/args.gni b/examples/platform/bouffalolab/bl702l/args.gni
new file mode 100644
index 0000000..bbab38b
--- /dev/null
+++ b/examples/platform/bouffalolab/bl702l/args.gni
@@ -0,0 +1,21 @@
+# 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/chip.gni")
+
+chip_ble_project_config_include = "<CHIPProjectConfig.h>"
+chip_device_project_config_include = "<CHIPProjectConfig.h>"
+chip_project_config_include = "<CHIPProjectConfig.h>"
+chip_inet_project_config_include = "<CHIPProjectConfig.h>"
+chip_system_project_config_include = "<CHIPProjectConfig.h>"
diff --git a/examples/platform/bouffalolab/bl702l/flash_config/partition_cfg_2M.toml b/examples/platform/bouffalolab/bl702l/flash_config/partition_cfg_2M.toml
new file mode 100644
index 0000000..f6a22de
--- /dev/null
+++ b/examples/platform/bouffalolab/bl702l/flash_config/partition_cfg_2M.toml
@@ -0,0 +1,70 @@
+[pt_table]

+#partition table is 4K in size

+address0 = 0x1000

+address1 = 0x2000

+

+[[pt_entry]]

+type = 0

+name = "FW"

+device = 0

+address0 = 0x3000

+size0 = 0x12b000

+address1 = 0x12e000

+size1 = 0xC9000

+# compressed image must set len,normal image can left it to 0

+len = 0

+activeindex = 0

+age = 0

+

+[[pt_entry]]

+type = 1

+name = "mfg"

+device = 0

+address0 = 0x12A000

+size0 = 0xC9000

+address1 = 0

+size1 = 0

+# compressed image must set len,normal image can left it to 0

+len = 0

+activeindex = 0

+age = 0

+

+[[pt_entry]]

+type = 2

+name = "PSM"

+device = 0

+address0 = 0x1F7000

+size0 = 0x4000

+address1 = 0

+size1 = 0

+# compressed image must set len,normal image can left it to 0

+len = 0

+activeindex = 0

+age = 0

+

+[[pt_entry]]

+type = 3

+name = "media"

+device = 0

+address0 = 0x1FB000

+size0 = 0x4000

+address1 = 0

+size1 = 0

+# compressed image must set len,normal image can left it to 0

+len = 0

+activeindex = 0

+age = 0

+

+[[pt_entry]]

+type = 4

+name = "factory"

+device = 0

+address0 = 0x1FF000

+size0 = 0x1000

+address1 = 0

+size1 = 0

+# compressed image must set len,normal image can left it to 0

+len = 0

+activeindex = 0

+age = 0

+

diff --git a/examples/platform/bouffalolab/bl702l/ldscripts/flash_rom.ld b/examples/platform/bouffalolab/bl702l/ldscripts/flash_rom.ld
new file mode 100644
index 0000000..00aee1c
--- /dev/null
+++ b/examples/platform/bouffalolab/bl702l/ldscripts/flash_rom.ld
@@ -0,0 +1,225 @@
+OUTPUT_ARCH( "riscv" )
+
+ENTRY( bl702_start )
+
+__EM_SIZE = DEFINED(btble_controller_init) ? 16K : 0K;
+__CACHE_SIZE = DEFINED(__CACHE_SIZE) ? __CACHE_SIZE : 16K;
+
+MEMORY
+{
+  flash  (rxai!w) : ORIGIN = 0x23000000, LENGTH = (2M)
+  tcm_ocram (wxa) : ORIGIN = 0x4201C000 + __CACHE_SIZE, LENGTH = (16K - __CACHE_SIZE + 80K - __EM_SIZE)
+  hbnram    (wxa) : ORIGIN = 0x40010000, LENGTH = (4K)
+}
+
+SECTIONS
+{
+  __stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
+  BOOT2_PT_ADDR = 0x4202e094;
+
+  .init :
+  {
+    KEEP (*(SORT_NONE(.init)))
+  } >flash
+
+  .text :
+  {
+    *(.text.unlikely .text.unlikely.*)
+    *(.text.startup .text.startup.*)
+    *(.text .text.*)
+    *(.gnu.linkonce.t.*)
+  } >flash
+
+  .rodata :
+  {
+    *(.rdata)
+    *(.rodata .rodata.*)
+    *(.sdata2.*)
+    *(.gcc_except_table.*)
+
+    /* static cli cmds */
+    . = ALIGN(4);
+    _bl_static_cli_cmds_start = .;
+    KEEP(*(.static_cli_cmds))
+    *(.static_cli_cmds)
+    _bl_static_cli_cmds_end = .;
+
+    /* static blog code1 */
+    . = ALIGN(4);
+    _bl_static_blogcomponent_code_start = .;
+    KEEP(SORT(*)(.static_blogcomponent_code*))
+    *(.static_blogcomponent_code*)
+    _bl_static_blogcomponent_code_end = .;
+
+    /* static blog code2 */
+    . = ALIGN(4);
+    _bl_static_blogfile_code_start = .;
+    KEEP(SORT(*)(.static_blogfile_code*))
+    *(.static_blogfile_code*)
+    _bl_static_blogfile_code_end = .;
+
+    /* static blog code3 */
+    . = ALIGN(4);
+    _bl_static_blogpri_code_start = .;
+    KEEP(SORT(*)(.static_blogpri_code*))
+    *(.static_blogpri_code*)
+    _bl_static_blogpri_code_end = .;
+
+    *(.gnu.linkonce.r.*)
+  } >flash
+
+  .init_array :
+  {
+    __init_array_start = .;
+    KEEP(*(.init_array))
+    __init_array_end = .;
+  } >flash
+
+  .hbn : ALIGN(4)
+  {
+    PROVIDE( _hbn_load = LOADADDR(.hbn) );
+    PROVIDE( _hbn_run = ADDR(.hbn) );
+    PROVIDE( _hbn_run_end = ADDR(.hbn) + SIZEOF(.hbn) );
+
+    *(.hbn_code.*)
+    *(.hbn_data)
+    *(.retention)
+  } >hbnram AT >flash
+
+  .hbn_noinit (NOLOAD) :
+  {
+    *(.hbn_noinit)
+    *(.retention_noinit)
+  } >hbnram
+
+  .rsvd (NOLOAD) :
+  {
+    *(.rsvd_data)
+    *(.ble_rsvd_mem)
+  } >hbnram
+
+  .tcmcode : ALIGN(4)
+  {
+    PROVIDE( _tcm_load = LOADADDR(.tcmcode) );
+    PROVIDE( _tcm_run = ADDR(.tcmcode) );
+    PROVIDE( _tcm_run_end = ADDR(.tcmcode) + SIZEOF(.tcmcode) );
+
+    *(.tcm_code.*)
+    *(.tcm_const.*)
+    *(.sclock_rlt_code.*)
+    *(.sclock_rlt_const.*)
+  } >tcm_ocram AT >flash
+
+  .romdata : ALIGN(16)
+  {
+    PROVIDE( _rom_data_run = . );
+    PROVIDE( __global_pointer$ = . + 0x800 );
+    . = . + 0xc98;
+  } >tcm_ocram
+
+  .data : ALIGN(4)
+  {
+    PROVIDE( _data_load = LOADADDR(.data) );
+    PROVIDE( _data_run = ADDR(.data) );
+    PROVIDE( _data_run_end = ADDR(.data) + SIZEOF(.data) );
+
+    *(.pds_code.*)
+    *(.data .data.*)
+    *(.gnu.linkonce.d.*)
+
+    . = ALIGN(8);
+    *(.sdata .sdata.*)
+    *(.gnu.linkonce.s.*)
+
+    . = ALIGN(8);
+    *(.srodata.cst16)
+    *(.srodata.cst8)
+    *(.srodata.cst4)
+    *(.srodata.cst2)
+    *(.srodata .srodata.*)
+    
+    . = ALIGN(8);
+    *(._k_queue.static.*)
+    *(._k_sem.static.*)
+    *(._k_mutex.static.*)
+    _bt_gatt_service_static_list_start = .;
+    KEEP(*(SORT_BY_NAME("._bt_gatt_service_static.static.*")))
+    _bt_gatt_service_static_list_end = .;
+    _bt_l2cap_fixed_chan_list_start = .;
+    KEEP(*(SORT_BY_NAME("._bt_l2cap_fixed_chan.static.*")))
+    _bt_l2cap_fixed_chan_list_end = .;
+  } >tcm_ocram AT >flash
+
+  .boot2 (NOLOAD) :
+  {
+    PROVIDE ( __boot2_pt_addr_start = . );
+    *(.bss.boot2_partition_table)
+    PROVIDE ( __boot2_pt_addr_end   = . );
+
+    PROVIDE ( __boot2_flashCfg_start = . );
+    *(.bss.boot2_flashCfg)
+    PROVIDE ( __boot2_flashCfg_end = . );
+  } >tcm_ocram
+
+  .bss (NOLOAD) :
+  {
+    PROVIDE( __bss_start = ADDR(.bss) );
+    PROVIDE( __bss_end = ADDR(.bss) + SIZEOF(.bss) );
+
+    *(.sbss*)
+    *(.gnu.linkonce.sb.*)
+    *(.bss .bss.*)
+    *(.gnu.linkonce.b.*)
+    *(COMMON)
+  } >tcm_ocram
+
+  .stack (NOLOAD) : ALIGN(8)
+  {
+    PROVIDE ( _sp_base = . );
+    . = . + __stack_size;
+    PROVIDE( _sp_main = . );
+    __freertos_irq_stack_top = .;
+  } >tcm_ocram
+
+  . = ALIGN(8);
+  PROVIDE( _heap_start = . );
+  PROVIDE( _heap_size = ORIGIN(tcm_ocram) + LENGTH(tcm_ocram) - _heap_start );
+
+  PROVIDE( _heap2_start = 0 );
+  PROVIDE( _heap2_size = 0 );
+
+
+  /* cli */
+  PROVIDE( _ld_bl_static_cli_cmds_start = _bl_static_cli_cmds_start );
+  PROVIDE( _ld_bl_static_cli_cmds_end   = _bl_static_cli_cmds_end );
+
+  /* blog */
+  PROVIDE( _ld_bl_static_blogcomponent_code_start = _bl_static_blogcomponent_code_start );
+  PROVIDE( _ld_bl_static_blogcomponent_code_end   = _bl_static_blogcomponent_code_end );
+  PROVIDE( _ld_bl_static_blogfile_code_start = _bl_static_blogfile_code_start );
+  PROVIDE( _ld_bl_static_blogfile_code_end   = _bl_static_blogfile_code_end );
+  PROVIDE( _ld_bl_static_blogpri_code_start = _bl_static_blogpri_code_start );
+  PROVIDE( _ld_bl_static_blogpri_code_end   = _bl_static_blogpri_code_end );
+
+  /* ram information */
+  PROVIDE( _ld_ram_size0 = LENGTH(flash) );
+  PROVIDE( _ld_ram_addr0 = ORIGIN(flash) );
+  PROVIDE( _ld_ram_size1 = LENGTH(tcm_ocram) );
+  PROVIDE( _ld_ram_addr1 = ORIGIN(tcm_ocram) );
+  PROVIDE( _ld_ram_size2 = LENGTH(hbnram) );
+  PROVIDE( _ld_ram_addr2 = ORIGIN(hbnram) );
+  PROVIDE( _ld_ram_size3 = SIZEOF(.stack) );
+  PROVIDE( _ld_ram_addr3 = ADDR(.stack) );
+
+  /* BOOT2 parameter */
+  PROVIDE ( __boot2_pt_addr_src = BOOT2_PT_ADDR );
+
+  /* EM size */
+  PROVIDE(__LD_CONFIG_EM_SEL = __EM_SIZE);
+
+  /* rom driver */
+  INCLUDE ../../third_party/bouffalolab/repo/components/platform/soc/bl702l/bl702l/evb/ld/romdriver.ld
+
+  /* rom data & code */
+  INCLUDE ../..//third_party/bouffalolab/repo/components/platform/soc/bl702l/bl702l/evb/ld/rom_map.ld
+}
diff --git a/examples/platform/bouffalolab/bl702l/ldscripts/psram_flash_rom.ld b/examples/platform/bouffalolab/bl702l/ldscripts/psram_flash_rom.ld
new file mode 100644
index 0000000..6dce5b3
--- /dev/null
+++ b/examples/platform/bouffalolab/bl702l/ldscripts/psram_flash_rom.ld
@@ -0,0 +1,323 @@
+OUTPUT_ARCH( "riscv" )
+
+ENTRY( bl702_start )
+
+__EM_SIZE = DEFINED(btble_controller_init) ? 16K : 0K;
+__CACHE_SIZE = DEFINED(__CACHE_SIZE) ? __CACHE_SIZE : 16K;
+
+MEMORY
+{
+  flash  (rxai!w) : ORIGIN = 0x23000000, LENGTH = (2M)
+  tcm_ocram (wxa) : ORIGIN = 0x4201C000 + __CACHE_SIZE, LENGTH = (16K - __CACHE_SIZE + 80K - __EM_SIZE)
+  hbnram    (wxa) : ORIGIN = 0x40010000, LENGTH = (4K)
+  psram     (wxa) : ORIGIN = 0x26000000, LENGTH = (2M)
+}
+
+SECTIONS
+{
+  __stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
+  BOOT2_PT_ADDR = 0x4202e094;
+
+  .init :
+  {
+    KEEP (*(SORT_NONE(.init)))
+  } >flash
+
+  .text :
+  {
+    *(.text.unlikely .text.unlikely.*)
+    *(.text.startup .text.startup.*)
+    *(.text .text.*)
+    *(.gnu.linkonce.t.*)
+  } >flash
+
+  .rodata :
+  {
+    *(.rdata)
+    *(.rodata .rodata.*)
+    *(.sdata2.*)
+    *(.gcc_except_table.*)
+
+    /* static cli cmds */
+    . = ALIGN(4);
+    _bl_static_cli_cmds_start = .;
+    KEEP(*(.static_cli_cmds))
+    *(.static_cli_cmds)
+    _bl_static_cli_cmds_end = .;
+
+    /* static blog code1 */
+    . = ALIGN(4);
+    _bl_static_blogcomponent_code_start = .;
+    KEEP(SORT(*)(.static_blogcomponent_code*))
+    *(.static_blogcomponent_code*)
+    _bl_static_blogcomponent_code_end = .;
+
+    /* static blog code2 */
+    . = ALIGN(4);
+    _bl_static_blogfile_code_start = .;
+    KEEP(SORT(*)(.static_blogfile_code*))
+    *(.static_blogfile_code*)
+    _bl_static_blogfile_code_end = .;
+
+    /* static blog code3 */
+    . = ALIGN(4);
+    _bl_static_blogpri_code_start = .;
+    KEEP(SORT(*)(.static_blogpri_code*))
+    *(.static_blogpri_code*)
+    _bl_static_blogpri_code_end = .;
+
+    *(.gnu.linkonce.r.*)
+  } >flash
+
+  .init_array :
+  {
+    __init_array_start = .;
+    KEEP(*(.init_array))
+    __init_array_end = .;
+  } >flash
+
+  .hbn : ALIGN(4)
+  {
+    PROVIDE( _hbn_load = LOADADDR(.hbn) );
+    PROVIDE( _hbn_run = ADDR(.hbn) );
+    PROVIDE( _hbn_run_end = ADDR(.hbn) + SIZEOF(.hbn) );
+
+    *(.hbn_code.*)
+    *(.hbn_data)
+    *(.retention)
+  } >hbnram AT >flash
+
+  .hbn_noinit (NOLOAD) :
+  {
+    *(.hbn_noinit)
+    *(.retention_noinit)
+  } >hbnram
+
+  .rsvd (NOLOAD) :
+  {
+    *(.rsvd_data)
+    *(.ble_rsvd_mem)
+  } >hbnram
+
+  .tcmcode : ALIGN(4)
+  {
+    PROVIDE( _tcm_load = LOADADDR(.tcmcode) );
+    PROVIDE( _tcm_run = ADDR(.tcmcode) );
+    PROVIDE( _tcm_run_end = ADDR(.tcmcode) + SIZEOF(.tcmcode) );
+
+    *(.tcm_code.*)
+    *(.tcm_const.*)
+    *(.sclock_rlt_code.*)
+    *(.sclock_rlt_const.*)
+  } >tcm_ocram AT >flash
+
+  .romdata : ALIGN(16)
+  {
+    PROVIDE( _rom_data_run = . );
+    PROVIDE( __global_pointer$ = . + 0x800 );
+    . = . + 0xc98;
+  } >tcm_ocram
+
+  .data : ALIGN(4)
+  {
+    PROVIDE( _data_load = LOADADDR(.data) );
+    PROVIDE( _data_run = ADDR(.data) );
+    PROVIDE( _data_run_end = ADDR(.data) + SIZEOF(.data) );
+
+    *(.pds_code.*)
+    *(.data .data.*)
+    *(.gnu.linkonce.d.*)
+
+    . = ALIGN(8);
+    *(.sdata .sdata.*)
+    *(.gnu.linkonce.s.*)
+
+    . = ALIGN(8);
+    *(.srodata.cst16)
+    *(.srodata.cst8)
+    *(.srodata.cst4)
+    *(.srodata.cst2)
+    *(.srodata .srodata.*)
+    
+    . = ALIGN(8);
+    *(._k_queue.static.*)
+    *(._k_sem.static.*)
+    *(._k_mutex.static.*)
+    _bt_gatt_service_static_list_start = .;
+    KEEP(*(SORT_BY_NAME("._bt_gatt_service_static.static.*")))
+    _bt_gatt_service_static_list_end = .;
+    _bt_l2cap_fixed_chan_list_start = .;
+    KEEP(*(SORT_BY_NAME("._bt_l2cap_fixed_chan.static.*")))
+    _bt_l2cap_fixed_chan_list_end = .;
+  } >tcm_ocram AT >flash
+
+  .boot2 (NOLOAD) :
+  {
+    PROVIDE ( __boot2_pt_addr_start = . );
+    *(.bss.boot2_partition_table)
+    PROVIDE ( __boot2_pt_addr_end   = . );
+
+    PROVIDE ( __boot2_flashCfg_start = . );
+    *(.bss.boot2_flashCfg)
+    PROVIDE ( __boot2_flashCfg_end = . );
+  } >hbnram
+
+  .bss_psram (NOLOAD) :
+  {
+    PROVIDE( __bss_psram_start = ADDR(.bss_psram) );
+    PROVIDE( __bss_psram_end = ADDR(.bss_psram) + SIZEOF(.bss_psram) );
+
+    PROVIDE ( __psram_bss_init_start = . );
+    /** put the bss data in psram between __psram_bss_init_start and __psram_bss_init_end will bet reset to 0 after psram init*/
+    . = ALIGN(8);
+    KEEP(*lighting-common.*.cpp.o(.bss.*ttributeData*))
+    . = ALIGN(8);
+    KEEP(*lighting-common.*.cpp.o(.bss.*bindingTable*))
+    . = ALIGN(8);
+    KEEP(*lighting-common.*.cpp.o(.bss.appResponseData*))
+    . = ALIGN(8);
+    KEEP(*lighting-common.*.cpp.o(.bss.*NetworkCommissioning*))
+    
+    . = ALIGN(8);
+    KEEP(*dnssd.Advertiser_ImplMinimalMdns.cpp.o(.bss.*gAdvertiser*))
+    . = ALIGN(8);
+    KEEP(*dnssd.MinimalMdnsServer.cpp.o(.bss.*GlobalMinimalMdnsServer*_instance))
+    . = ALIGN(8);
+    KEEP(*dnssd.Resolver_ImplMinimalMdns.cpp.o(.bss.*gResolver*))
+
+    /*. = ALIGN(8);*/
+    /*KEEP(*libCHIPAppServer.Server.cpp.o(.bss.*sServer*))*/
+
+    . = ALIGN(8);
+    KEEP(*bridge-common.*.cpp.o(.bss.*))
+    /* . = ALIGN(8); */
+    /* # KEEP(*bridge-common.*.cpp.o(.bss.*bindingTable*)) */
+    /* # . = ALIGN(8); */
+    /* # KEEP(*bridge-common.*.cpp.o(.bss.appResponseData*)) */
+    /* # . = ALIGN(8); */
+    /* # KEEP(*bridge-common.*.cpp.o(.bss.*NetworkCommissioning*)) */
+
+    . = ALIGN(8);
+    KEEP(*libopenthread-cli-*.cli.cpp.o(.bss.*sInterpreterRaw*))
+
+    . = ALIGN(8);
+    KEEP(*libopenthread-cli-*.cli_dataset.cpp.o(.bss.*sDataset*))
+
+    . = ALIGN(8);
+    KEEP(*libopenthread-ftd.instance.cpp.o(.bss.*gInstanceRaw*))
+
+    . = ALIGN(8);
+    KEEP(*commands.Dns.cpp.o(.bss.*))
+
+    . = ALIGN(8);
+    KEEP(*commands.BLE.cpp.o(.bss.*))
+
+    . = ALIGN(8);
+    KEEP(*commands.Device.cpp.o(.bss.*))
+
+    . = ALIGN(8);
+    KEEP(*commands.Base64.cpp.o(.bss.*))
+
+    . = ALIGN(8);
+    KEEP(*commands.Base64.cpp.o(.bss.*))
+
+    . = ALIGN(8);
+    KEEP(*shell_core.Engine.cpp.o(.bss.*theEngineRoot*)) 
+
+    . = ALIGN(8);
+    KEEP(*sdk_openthread_port.ot_radio.c.o(.bss.otRadio_buffPool)) 
+
+    . = ALIGN(8);
+    KEEP(*BL702L.PlatformManagerImpl.cpp.o(.bss._ZN4chip11DeviceLayer19PlatformManagerImpl9sInstanceE)) 
+
+    . = ALIGN(8);
+    KEEP(*BL702L.ThreadStackManagerImpl.cpp.o(.bss._ZN4chip11DeviceLayer22ThreadStackManagerImpl9sInstanceE)) 
+
+    . = ALIGN(8);
+    KEEP(*libCHIPAppServer.Server.cpp.o(.bss._ZN4chip6Server7sServerE)) 
+
+    . = ALIGN(8);
+    KEEP(*libaccess.ExampleAccessControlDelegate.cpp.o(.bss.*)) 
+
+    . = ALIGN(8);
+    KEEP(*libTransportLayer.SessionManager.cpp.o(.bss.*)) 
+
+    . = ALIGN(8);
+    KEEP(*lwip.memp.c.o(.bss.*))
+    . = ALIGN(8);
+    KEEP(*sdk_lwip.dns.c.o(.bss.dns_table))
+
+    . = ALIGN(8);
+    KEEP(*virt_net_spi.c.o(.bss.tx_buffer))
+  
+    PROVIDE ( __psram_bss_init_end = . );
+    . = ALIGN(16);
+
+    *(.wifi_ram*)
+  } > psram
+
+  . = ALIGN(8);
+  PROVIDE( _heap3_start = . );
+  PROVIDE( _heap3_size = ORIGIN(psram) + LENGTH(psram) - _heap3_start );
+
+  .bss (NOLOAD) :
+  {
+    PROVIDE( __bss_start = ADDR(.bss) );
+    PROVIDE( __bss_end = ADDR(.bss) + SIZEOF(.bss) );
+
+    *(.sbss*)
+    *(.gnu.linkonce.sb.*)
+    *(.bss .bss.*)
+    *(.gnu.linkonce.b.*)
+    *(COMMON)
+  } >tcm_ocram
+
+  .stack (NOLOAD) : ALIGN(8)
+  {
+    PROVIDE ( _sp_base = . );
+    . = . + __stack_size;
+    PROVIDE( _sp_main = . );
+    __freertos_irq_stack_top = .;
+  } >tcm_ocram
+
+  . = ALIGN(8);
+  PROVIDE( _heap_start = . );
+  PROVIDE( _heap_size = ORIGIN(tcm_ocram) + LENGTH(tcm_ocram) - _heap_start );
+
+  PROVIDE( _heap2_start = 0 );
+  PROVIDE( _heap2_size = 0 );
+
+  /* cli */
+  PROVIDE( _ld_bl_static_cli_cmds_start = _bl_static_cli_cmds_start );
+  PROVIDE( _ld_bl_static_cli_cmds_end   = _bl_static_cli_cmds_end );
+
+  /* blog */
+  PROVIDE( _ld_bl_static_blogcomponent_code_start = _bl_static_blogcomponent_code_start );
+  PROVIDE( _ld_bl_static_blogcomponent_code_end   = _bl_static_blogcomponent_code_end );
+  PROVIDE( _ld_bl_static_blogfile_code_start = _bl_static_blogfile_code_start );
+  PROVIDE( _ld_bl_static_blogfile_code_end   = _bl_static_blogfile_code_end );
+  PROVIDE( _ld_bl_static_blogpri_code_start = _bl_static_blogpri_code_start );
+  PROVIDE( _ld_bl_static_blogpri_code_end   = _bl_static_blogpri_code_end );
+
+  /* ram information */
+  PROVIDE( _ld_ram_size0 = LENGTH(flash) );
+  PROVIDE( _ld_ram_addr0 = ORIGIN(flash) );
+  PROVIDE( _ld_ram_size1 = LENGTH(tcm_ocram) );
+  PROVIDE( _ld_ram_addr1 = ORIGIN(tcm_ocram) );
+  PROVIDE( _ld_ram_size2 = LENGTH(hbnram) );
+  PROVIDE( _ld_ram_addr2 = ORIGIN(hbnram) );
+  PROVIDE( _ld_ram_size3 = SIZEOF(.stack) );
+  PROVIDE( _ld_ram_addr3 = ADDR(.stack) );
+
+  /* BOOT2 parameter */
+  PROVIDE ( __boot2_pt_addr_src = BOOT2_PT_ADDR );
+
+  /* EM size */
+  PROVIDE(__LD_CONFIG_EM_SEL = __EM_SIZE);
+
+  /* rom driver */
+  INCLUDE ../../third_party/bouffalolab/repo/components/platform/soc/bl702l/bl702l/evb/ld/romdriver.ld
+
+  /* rom data & code */
+  INCLUDE ../../third_party/bouffalolab/repo/components/platform/soc/bl702l/bl702l/evb/ld/rom_map.ld
+}
diff --git a/examples/platform/bouffalolab/common/plat/main.cpp b/examples/platform/bouffalolab/common/plat/main.cpp
index 1766ae1..abf7ef6 100644
--- a/examples/platform/bouffalolab/common/plat/main.cpp
+++ b/examples/platform/bouffalolab/common/plat/main.cpp
@@ -38,9 +38,11 @@
 #ifdef BL702_ENABLE
 #include <bl702_glb.h>
 #include <bl702_hbn.h>
+#elif BL702L_ENABLE
+#include <bl702l_glb.h>
+#include <bl702l_hbn.h>
 #elif defined(BL602_ENABLE)
 #include <wifi_mgmr_ext.h>
-
 #endif
 #include <bl_irq.h>
 #include <bl_rtc.h>
@@ -55,6 +57,12 @@
 
 #include <hosal_uart.h>
 
+#ifdef BL702L_ENABLE
+#include <rom_freertos_ext.h>
+#include <rom_hal_ext.h>
+#include <rom_lmac154_ext.h>
+#endif
+
 #include "board.h"
 }
 
@@ -98,6 +106,8 @@
     return 0;
 }
 
+#ifndef BL702L_ENABLE
+
 extern "C" void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName)
 {
     ChipLogProgress(NotSpecified, "Stack Overflow checked. Stack name %s", pcTaskName);
@@ -181,8 +191,7 @@
 
 void vApplicationSleep(TickType_t xExpectedIdleTime) {}
 
-extern "C" void user_vAssertCalled(void) __attribute__((weak, alias("vAssertCalled")));
-void vAssertCalled(void)
+extern "C" void vAssertCalled(void)
 {
     void * ra = (void *) __builtin_return_address(0);
 
@@ -191,6 +200,47 @@
     while (true)
         ;
 }
+#endif
+
+#ifdef BL702L_ENABLE
+extern "C" void __attribute__((weak)) user_vAssertCalled(void)
+{
+    void * ra = (void *) __builtin_return_address(0);
+
+    taskDISABLE_INTERRUPTS();
+    ChipLogProgress(NotSpecified, "vAssertCalled, ra= %p", ra);
+    while (true)
+        ;
+}
+
+extern "C" void __attribute__((weak)) user_vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName)
+{
+    puts("Stack Overflow checked\r\n");
+    if (pcTaskName)
+    {
+        printf("Stack name %s\r\n", pcTaskName);
+    }
+    while (1)
+    {
+        /*empty here*/
+    }
+}
+
+extern "C" void __attribute__((weak)) user_vApplicationMallocFailedHook(void)
+{
+    printf("Memory Allocate Failed. Current left size is %d bytes\r\n", xPortGetFreeHeapSize());
+#if defined(CFG_USE_PSRAM)
+    printf("Current psram left size is %d bytes\r\n", xPortGetFreeHeapSizePsram());
+#endif
+    while (1)
+    {
+        /*empty here*/
+    }
+}
+
+#else
+extern "C" void user_vAssertCalled(void) __attribute__((weak, alias("vAssertCalled")));
+#endif
 
 // ================================================================================
 // Main Code
@@ -211,6 +261,11 @@
     { &_heap_start, (size_t) &_heap_size }, // set on runtime
     { NULL, 0 }                             /* Terminates the array. */
 };
+#elif defined(BL702L_ENABLE)
+static constexpr HeapRegion_t xHeapRegions[] = {
+    { &_heap_start, (size_t) &_heap_size }, // set on runtime
+    { NULL, 0 }                             /* Terminates the array. */
+};
 #endif
 
 #ifdef CFG_USE_PSRAM
@@ -275,12 +330,53 @@
 }
 #endif
 
+#ifdef BL702L_ENABLE
+void exception_entry_app(uint32_t mcause, uint32_t mepc, uint32_t mtval, uintptr_t * regs, uintptr_t * tasksp)
+{
+    static const char dbg_str[] = "Exception Entry--->>>\r\n mcause %08lx, mepc %08lx, mtval %08lx\r\n";
+
+    printf(dbg_str, mcause, mepc, mtval);
+
+    while (1)
+    {
+        /*dead loop now*/
+    }
+}
+#endif
+
 extern "C" void setup_heap()
 {
+    bl_sys_init();
+
 #ifdef BL702_ENABLE
     bl_sys_em_config();
+#elif defined(BL702L_ENABLE)
+    bl_sys_em_config();
+
+    // Initialize rom data
+    extern uint8_t _rom_data_run;
+    extern uint8_t _rom_data_load;
+    extern uint8_t _rom_data_size;
+    memcpy((void *) &_rom_data_run, (void *) &_rom_data_load, (size_t) &_rom_data_size);
 #endif
+
     vPortDefineHeapRegions(xHeapRegions);
+
+    bl_sys_early_init();
+
+#ifdef BL702L_ENABLE
+    rom_freertos_init(256, 400);
+    rom_hal_init();
+    rom_lmac154_hook_init();
+
+    exception_entry_ptr = exception_entry_app;
+#endif
+
+#ifdef CFG_USE_PSRAM
+    bl_psram_init();
+    do_psram_test();
+    vPortDefineHeapRegionsPsram(xPsramHeapRegions);
+#endif
 }
 
 extern "C" size_t get_heap_size(void)
@@ -290,41 +386,34 @@
 
 extern "C" void app_init(void)
 {
-    bl_sys_init();
-
-    bl_sys_early_init();
-
     hosal_uart_init(&uart_stdio);
 
     ChipLogProgress(NotSpecified, "==================================================");
     ChipLogProgress(NotSpecified, "bouffalolab chip-lighting-example, built at " __DATE__ " " __TIME__);
     ChipLogProgress(NotSpecified, "==================================================");
 
-    blog_init();
-    bl_irq_init();
-    bl_sec_init();
-#ifdef BL702_ENABLE
-    bl_timer_init();
-#endif
 #ifdef CFG_USE_PSRAM
-    bl_psram_init();
-    do_psram_test();
+    ChipLogProgress(NotSpecified, "Heap %u@[%p:%p], %u@[%p:%p]", (unsigned int) &_heap_size, &_heap_start,
+                    &_heap_start + (unsigned int) &_heap_size, (unsigned int) &_heap3_size, &_heap3_start,
+                    &_heap3_start + (unsigned int) &_heap3_size);
+#else
+    ChipLogProgress(NotSpecified, "Heap %u@[%p:%p]", (unsigned int) &_heap_size, &_heap_start,
+                    &_heap_start + (unsigned int) &_heap_size);
 #endif
 
-    // bl_rtc_init();
+    blog_init();
+    bl_irq_init();
+    bl_rtc_init();
+    bl_sec_init();
+#if defined(BL702_ENABLE)
+    bl_timer_init();
+#endif
+
     hal_boot2_init();
 
     /* board config is set after system is init*/
     hal_board_cfg(0);
-    //    hosal_dma_init();
 
-#ifdef CFG_USE_PSRAM
-    vPortDefineHeapRegionsPsram(xPsramHeapRegions);
-    ChipLogProgress(NotSpecified, "Heap %u@%p, %u@%p", (unsigned int) &_heap_size, &_heap_start, (unsigned int) &_heap3_size,
-                    &_heap3_start);
-#else
-    ChipLogProgress(NotSpecified, "Heap %u@%p", (unsigned int) &_heap_size, &_heap_start);
-#endif
 #ifdef BL602_ENABLE
     wifi_td_diagnosis_init();
 #endif
diff --git a/integrations/cloudbuild/build-all.yaml b/integrations/cloudbuild/build-all.yaml
index f22cefe..df2bc35 100644
--- a/integrations/cloudbuild/build-all.yaml
+++ b/integrations/cloudbuild/build-all.yaml
@@ -35,6 +35,7 @@
               --target android-arm64-tv-server
               --target android-x64-chip-tool
               --target bouffalolab-bl602-iot-matter-v1-light
+              --target bouffalolab-bl704l-dvk-light
               --target bouffalolab-xt-zb6-devkit-light-rpc
               --target cc13x2x7_26x2x7-lighting
               --target cc13x2x7_26x2x7-lock-mtd
diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py
index 43eed69..4fc6145 100755
--- a/scripts/build/build/targets.py
+++ b/scripts/build/build/targets.py
@@ -584,18 +584,13 @@
 
     # Boards
     target.AppendFixedTargets([
-        TargetPart('BL602-IoT-Matter-V1',
-                   board=BouffalolabBoard.BL602_IoT_Matter_V1, module_type="BL602"),
-        TargetPart('BL602-IOT-DVK-3S',
-                   board=BouffalolabBoard.BL602_IOT_DVK_3S, module_type="BL602"),
-        TargetPart('BL602-NIGHT-LIGHT',
-                   board=BouffalolabBoard.BL602_NIGHT_LIGHT, module_type="BL602"),
-        TargetPart('XT-ZB6-DevKit', board=BouffalolabBoard.XT_ZB6_DevKit,
-                   module_type="BL706C-22"),
-        TargetPart('BL706-IoT-DVK', board=BouffalolabBoard.BL706_IoT_DVK,
-                   module_type="BL706C-22"),
-        TargetPart('BL706-NIGHT-LIGHT',
-                   board=BouffalolabBoard.BL706_NIGHT_LIGHT, module_type="BL706C-22"),
+        TargetPart('BL602-IoT-Matter-V1', board=BouffalolabBoard.BL602_IoT_Matter_V1, module_type="BL602"),
+        TargetPart('BL602-IOT-DVK-3S', board=BouffalolabBoard.BL602_IOT_DVK_3S, module_type="BL602"),
+        TargetPart('BL602-NIGHT-LIGHT', board=BouffalolabBoard.BL602_NIGHT_LIGHT, module_type="BL602"),
+        TargetPart('XT-ZB6-DevKit', board=BouffalolabBoard.XT_ZB6_DevKit, module_type="BL706C-22"),
+        TargetPart('BL706-IoT-DVK', board=BouffalolabBoard.BL706_IoT_DVK, module_type="BL706C-22"),
+        TargetPart('BL706-NIGHT-LIGHT', board=BouffalolabBoard.BL706_NIGHT_LIGHT, module_type="BL706C-22"),
+        TargetPart('BL704L-DVK', board=BouffalolabBoard.BL704L_DVK, module_type="BL704L"),
     ])
 
     # Apps
diff --git a/scripts/build/builders/bouffalolab.py b/scripts/build/builders/bouffalolab.py
index cf4f091..51529e5 100644
--- a/scripts/build/builders/bouffalolab.py
+++ b/scripts/build/builders/bouffalolab.py
@@ -49,6 +49,7 @@
     XT_ZB6_DevKit = auto()
     BL706_IoT_DVK = auto()
     BL706_NIGHT_LIGHT = auto()
+    BL704L_DVK = auto()
 
     def GnArgName(self):
         if self == BouffalolabBoard.BL602_IoT_Matter_V1:
@@ -63,6 +64,8 @@
             return 'BL706-IoT-DVK'
         elif self == BouffalolabBoard.BL706_NIGHT_LIGHT:
             return 'BL706-NIGHT-LIGHT'
+        elif self == BouffalolabBoard.BL704L_DVK:
+            return 'BL704L-DVK'
         else:
             raise Exception('Unknown board #: %r' % self)
 
@@ -81,7 +84,15 @@
                  enable_cdc: bool = False
                  ):
 
-        bouffalo_chip = "bl702" if "BL70" in module_type else "bl602"
+        if 'BL602' == module_type:
+            bouffalo_chip = 'bl602'
+        elif 'BL704L' == module_type:
+            bouffalo_chip = 'bl702l'
+        elif "BL70" in module_type:
+            bouffalo_chip = 'bl702'
+        else:
+            raise Exception("module_type %s is not supported" % module_type)
+
         super(BouffalolabBuilder, self).__init__(
             root=os.path.join(root, 'examples',
                               app.ExampleName(), 'bouffalolab', bouffalo_chip),
@@ -159,9 +170,12 @@
         if not os.path.isfile(ota_images_firmware):
             return
 
-        os.system("python " + ota_images_flash_tool + " --build")
+        os.system("python " + ota_images_flash_tool + " --build > /dev/null")
 
         if not os.path.isfile(ota_images_image):
             return
 
         os.system("cp " + ota_images_image + " " + ota_images_dev_image)
+
+        logging.info("PostBuild:")
+        logging.info("Bouffalo Lab OTA format image: " + self.app.AppNamePrefix(self.chip_name) + ".bin.xz.hash is generated.")
diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt
index 5ef536a..b3e88f5 100644
--- a/scripts/build/testdata/all_targets_linux_x64.txt
+++ b/scripts/build/testdata/all_targets_linux_x64.txt
@@ -1,7 +1,7 @@
 ameba-amebad-{all-clusters,all-clusters-minimal,light,light-switch,pigweed}
 asr-{asr582x,asr595x}-{all-clusters,all-clusters-minimal,lighting,light-switch,lock,bridge,temperature-measurement,thermostat,ota-requestor}[-ota][-shell][-no_logging][-factory][-rotating_id]
 android-{arm,arm64,x86,x64,androidstudio-arm,androidstudio-arm64,androidstudio-x86,androidstudio-x64}-{chip-tool,chip-test,tv-server,tv-casting-app,java-matter-controller}[-no-debug]
-bouffalolab-{bl602-iot-matter-v1,bl602-iot-dvk-3s,bl602-night-light,xt-zb6-devkit,bl706-iot-dvk,bl706-night-light}-light[-shell][-115200][-rpc][-cdc]
+bouffalolab-{bl602-iot-matter-v1,bl602-iot-dvk-3s,bl602-night-light,xt-zb6-devkit,bl706-iot-dvk,bl706-night-light,bl704l-dvk}-light[-shell][-115200][-rpc][-cdc]
 cc32xx-lock
 ti-cc13x2x7_26x2x7-{lighting,lock,pump,pump-controller}[-mtd]
 ti-cc13x4_26x4-{all-clusters,lighting,lock,pump,pump-controller}[-mtd][-ftd]
diff --git a/src/lib/shell/BUILD.gn b/src/lib/shell/BUILD.gn
index 20e87d0..4382eb8 100644
--- a/src/lib/shell/BUILD.gn
+++ b/src/lib/shell/BUILD.gn
@@ -82,12 +82,9 @@
       "MainLoopDefault.cpp",
       "streamer_qpg.cpp",
     ]
-  } else if (chip_device_platform == "bl602") {
-    sources += [
-      "MainLoopDefault.cpp",
-      "streamer_bouffalolab.cpp",
-    ]
-  } else if (chip_device_platform == "bl702") {
+  } else if (chip_device_platform == "bl602" ||
+             chip_device_platform == "bl702" ||
+             chip_device_platform == "bl702l") {
     sources += [
       "MainLoopDefault.cpp",
       "streamer_bouffalolab.cpp",
diff --git a/src/lwip/BUILD.gn b/src/lwip/BUILD.gn
index be41fd4..60eb4d2 100644
--- a/src/lwip/BUILD.gn
+++ b/src/lwip/BUILD.gn
@@ -34,8 +34,8 @@
            lwip_platform == "qpg" || lwip_platform == "mbed" ||
            lwip_platform == "psoc6" || lwip_platform == "cyw30739" ||
            lwip_platform == "bl602" || lwip_platform == "mw320" ||
-           lwip_platform == "bl702" || lwip_platform == "mt793x" ||
-           lwip_platform == "asr",
+           lwip_platform == "bl702" || lwip_platform == "bl702l" ||
+           lwip_platform == "mt793x" || lwip_platform == "asr",
        "Unsupported lwIP platform: ${lwip_platform}")
 
 if (lwip_platform != "external") {
@@ -64,6 +64,8 @@
   import("//build_overrides/bouffalolab_iot_sdk.gni")
 } else if (lwip_platform == "bl702") {
   import("//build_overrides/bouffalolab_iot_sdk.gni")
+} else if (lwip_platform == "bl702l") {
+  import("//build_overrides/bouffalolab_iot_sdk.gni")
 } else if (lwip_platform == "mw320") {
   import("//build_overrides/mw320_sdk.gni")
 } else if (lwip_platform == "mt793x") {
@@ -120,6 +122,17 @@
   group("all") {
     deps = [ ":lwip" ]
   }
+} else if (lwip_platform == "bl702l_lwip") {
+  import("${bouffalolab_iot_sdk_build_root}/bl702l/bl_iot_sdk.gni")
+
+  group("lwip") {
+    public_deps = [ ":lwip_buildconfig" ]
+    public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]
+  }
+
+  group("all") {
+    deps = [ ":lwip" ]
+  }
 } else if (lwip_platform == "qpg") {
   config("lwip_config") {
     include_dirs = [ "freertos" ]
@@ -208,9 +221,11 @@
     } else if (lwip_platform == "cyw30739") {
       public_deps += [ "${cyw30739_sdk_build_root}:cyw30739_sdk" ]
     } else if (lwip_platform == "bl602") {
-      public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl602:bl602_sdk" ]
+      public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]
     } else if (lwip_platform == "bl702") {
       public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ]
+    } else if (lwip_platform == "bl702l") {
+      public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]
     } else if (lwip_platform == "mt793x") {
       public_deps += [ "${mt793x_sdk_build_root}:mt793x_sdk" ]
     }
diff --git a/src/lwip/bl702l/arch/cc.h b/src/lwip/bl702l/arch/cc.h
new file mode 100644
index 0000000..082afd8
--- /dev/null
+++ b/src/lwip/bl702l/arch/cc.h
@@ -0,0 +1,90 @@
+/*
+ *
+ *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2019 Nest Labs, Inc.
+ *
+ *   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.
+ *
+ */
+
+#ifndef CHIP_LWIP_FREERTOS_ARCH_CC_H
+#define CHIP_LWIP_FREERTOS_ARCH_CC_H
+
+#include <assert.h>
+#include <errno.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+#if CHIP_CONFIG_MEMORY_MGMT_MALLOC
+#include <malloc.h>
+#endif
+
+#if __cplusplus
+extern "C" {
+#endif
+
+#ifndef LWIP_NOASSERT
+#ifdef DEBUG
+#define LWIP_PLATFORM_ASSERT(MSG) assert(MSG);
+#else
+#define LWIP_PLATFORM_ASSERT(MSG)
+#endif
+#else
+#define LWIP_PLATFORM_ASSERT(message)
+#endif
+
+#ifndef BYTE_ORDER
+#if defined(__LITTLE_ENDIAN__)
+#define BYTE_ORDER LITTLE_ENDIAN
+#elif defined(__BIG_ENDIAN__)
+#define BYTE_ORDER BIG_ENDIAN
+#elif defined(__BYTE_ORDER__)
+#define BYTE_ORDER __BYTE_ORDER__
+#endif
+#endif // BYTE_ORDER
+
+#define PACK_STRUCT_STRUCT __attribute__((__packed__))
+#define PACK_STRUCT_FIELD(x) x
+
+extern void LwIPLog(const char * fmt, ...);
+#define LWIP_PLATFORM_DIAG(x)                                                                                                      \
+    do                                                                                                                             \
+    {                                                                                                                              \
+        LwIPLog x;                                                                                                                 \
+    } while (0)
+
+// Place LwIP pools into their own subsections of .bss to make it easier to see
+// their sizes in the linker map file.
+extern uint8_t __attribute__((section(".bss.lwip_ND6_QUEUE"))) memp_memory_ND6_QUEUE_base[];
+extern uint8_t __attribute__((section(".bss.lwip_IP6_REASSDATA"))) memp_memory_IP6_REASSDATA_base[];
+extern uint8_t __attribute__((section(".bss.lwip_RAW_PCB"))) memp_memory_RAW_PCB_base[];
+extern uint8_t __attribute__((section(".bss.lwip_TCP_SEG"))) memp_memory_TCP_SEG_base[];
+extern uint8_t __attribute__((section(".bss.lwip_PBUF_POOL"))) memp_memory_PBUF_POOL_base[];
+extern uint8_t __attribute__((section(".bss.lwip_FRAG_PBUF"))) memp_memory_FRAG_PBUF_base[];
+extern uint8_t __attribute__((section(".bss.lwip_PBUF"))) memp_memory_PBUF_base[];
+extern uint8_t __attribute__((section(".bss.lwip_TCP_PCB_LISTEN"))) memp_memory_TCP_PCB_LISTEN_base[];
+extern uint8_t __attribute__((section(".bss.lwip_REASSDATA"))) memp_memory_REASSDATA_base[];
+extern uint8_t __attribute__((section(".bss.lwip_UDP_PCB"))) memp_memory_UDP_PCB_base[];
+extern uint8_t __attribute__((section(".bss.lwip_MLD6_GROUP"))) memp_memory_MLD6_GROUP_base[];
+extern uint8_t __attribute__((section(".bss.lwip_IGMP_GROUP"))) memp_memory_IGMP_GROUP_base[];
+extern uint8_t __attribute__((section(".bss.lwip_TCP_PCB"))) memp_memory_TCP_PCB_base[];
+extern uint8_t __attribute__((section(".bss.lwip_SYS_TIMEOUT"))) memp_memory_SYS_TIMEOUT_base[];
+
+#if __cplusplus
+}
+#endif
+
+#endif /* CHIP_LWIP_FREERTOS_ARCH_CC_H */
diff --git a/src/lwip/bl702l/arch/perf.h b/src/lwip/bl702l/arch/perf.h
new file mode 100644
index 0000000..2094d64
--- /dev/null
+++ b/src/lwip/bl702l/arch/perf.h
@@ -0,0 +1,26 @@
+/*
+ *
+ *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2019 Nest Labs, Inc.
+ *
+ *   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.
+ *
+ */
+
+#ifndef CHIP_LWIP_FREERTOS_ARCH_PERF_H
+#define CHIP_LWIP_FREERTOS_ARCH_PERF_H
+
+#define PERF_START
+#define PERF_STOP(s)
+
+#endif /* CHIP_LWIP_FREERTOS_ARCH_PERF_H */
diff --git a/src/lwip/bl702l/lwipopts.h b/src/lwip/bl702l/lwipopts.h
new file mode 100644
index 0000000..645ccf7
--- /dev/null
+++ b/src/lwip/bl702l/lwipopts.h
@@ -0,0 +1,160 @@
+/*
+ *
+ *    Copyright (c) 2020-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.
+ */
+
+#ifndef __LWIPOPTS_H__
+#define __LWIPOPTS_H__
+
+#if CHIP_HAVE_CONFIG_H
+#include <lwip/lwip_buildconfig.h>
+#endif
+
+#include <stdlib.h>
+
+#define NO_SYS 0
+#define MEM_ALIGNMENT (4)
+#define MEMP_NUM_TCP_SEG (TCP_SND_QUEUELEN + 1)
+#define LWIP_TIMEVAL_PRIVATE (0)
+#define MEM_LIBC_MALLOC (0)
+#define LWIP_COMPAT_MUTEX (0)
+#define SYS_LIGHTWEIGHT_PROT (1)
+#define LWIP_AUTOIP (0)
+#define LWIP_DHCP_AUTOIP_COOP (0)
+#define LWIP_SOCKET_SET_ERRNO 0
+#define IP_REASS_MAX_PBUFS 0
+#define IP_REASSEMBLY 0
+#define MEMP_NUM_REASSDATA 0
+#define LWIP_SO_RCVTIMEO 0
+#define SO_REUSE (1)
+#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS (1)
+#define LWIP_STATS (0)
+#define LWIP_TCPIP_CORE_LOCKING 1
+#define TCP_QUEUE_OOSEQ 0
+#define ARP_QUEUEING (0)
+
+#define LWIP_SOCKET 0
+
+#define LWIP_RAW 1
+#define MEMP_NUM_RAW_PCB 5
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
+#define LWIP_TCP 1
+#else
+#define LWIP_TCP 0
+#define MEMP_NUM_TCP_PCB 0
+#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
+
+// TODO: verify count
+#define MEMP_NUM_UDP_PCB (7)
+
+#define LWIP_HAVE_LOOPIF (0)
+
+// TODO: not sure why this is disabled
+#define LWIP_NETIF_LOOPBACK (0)
+
+#define MEMP_NUM_NETCONN (0)
+
+#define LWIP_IPV4 0
+#define LWIP_IPV6 1
+#define LWIP_ARP (0)
+#define LWIP_DNS (0)
+#define LWIP_ICMP (0)
+#define LWIP_IGMP (0)
+#define LWIP_DHCP (0)
+#define LWIP_IPV6_REASS (0)
+#define LWIP_IPV6_DHCP6 0
+#define LWIP_IPV6_AUTOCONFIG (0)
+#define LWIP_IPV6_ROUTER_SUPPORT 0
+#define LWIP_ND6_LISTEN_RA 0
+
+#define LWIP_ND6_NUM_NEIGHBORS (0)
+#define LWIP_ND6_NUM_DESTINATIONS (0)
+#define LWIP_ND6_NUM_PREFIXES (0)
+#define LWIP_ND6_NUM_ROUTERS (0)
+#define LWIP_ND6_MAX_MULTICAST_SOLICIT (0)
+#define LWIP_ND6_MAX_UNICAST_SOLICIT (0)
+#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT (0)
+#define LWIP_ND6_TCP_REACHABILITY_HINTS (0)
+
+#define MEMP_SEPARATE_POOLS (1)
+#define LWIP_PBUF_FROM_CUSTOM_POOLS (0)
+#define MEMP_USE_CUSTOM_POOLS (0)
+#define PBUF_POOL_SIZE (10)
+#define PBUF_POOL_BUFSIZE (1280 + 150)
+#define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL)
+#define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE)
+
+#define TCP_MSS (1152)
+#define TCP_SND_BUF (2 * TCP_MSS)
+#define TCP_LISTEN_BACKLOG (1)
+
+#define ETH_PAD_SIZE (0)
+#define SUB_ETHERNET_HEADER_SPACE (0)
+#define PBUF_LINK_HLEN (0)
+
+#define TCPIP_THREAD_STACKSIZE (2048)
+#define TCPIP_THREAD_PRIO (29)
+
+#define NETIF_MAX_HWADDR_LEN 8U
+
+#define LWIP_IPV6_NUM_ADDRESSES 5
+
+#define LWIP_IPV6_ND 0
+#define LWIP_ND6_QUEUEING 0
+
+#define LWIP_MULTICAST_PING 0
+
+#define TCPIP_MBOX_SIZE 6
+#define DEFAULT_RAW_RECVMBOX_SIZE 6
+#define DEFAULT_UDP_RECVMBOX_SIZE 6
+#define DEFAULT_TCP_RECVMBOX_SIZE 6
+
+// TODO: make LWIP_DEBUG conditional on build type
+
+#define MEMP_OVERFLOW_CHECK (0)
+#define MEMP_SANITY_CHECK (0)
+#define MEM_DEBUG (LWIP_DBG_OFF)
+#define MEMP_DEBUG (LWIP_DBG_OFF)
+#define PBUF_DEBUG (LWIP_DBG_OFF)
+#define API_LIB_DEBUG (LWIP_DBG_OFF)
+#define API_MSG_DEBUG (LWIP_DBG_OFF)
+#define TCPIP_DEBUG (LWIP_DBG_OFF)
+#define NETIF_DEBUG (LWIP_DBG_OFF)
+#define SOCKETS_DEBUG (LWIP_DBG_OFF)
+#define DEMO_DEBUG (LWIP_DBG_OFF)
+#define DHCP_DEBUG (LWIP_DBG_OFF)
+#define AUTOIP_DEBUG (LWIP_DBG_OFF)
+#define ETHARP_DEBUG (LWIP_DBG_OFF)
+#define IP_DEBUG (LWIP_DBG_OFF)
+#define IP_REASS_DEBUG (LWIP_DBG_OFF)
+#define IP6_DEBUG (LWIP_DBG_OFF)
+#define RAW_DEBUG (LWIP_DBG_OFF)
+#define ICMP_DEBUG (LWIP_DBG_OFF)
+#define UDP_DEBUG (LWIP_DBG_OFF)
+#define TCP_DEBUG (LWIP_DBG_OFF)
+#define TCP_INPUT_DEBUG (LWIP_DBG_OFF)
+#define TCP_OUTPUT_DEBUG (LWIP_DBG_OFF)
+#define TCP_RTO_DEBUG (LWIP_DBG_OFF)
+#define TCP_CWND_DEBUG (LWIP_DBG_OFF)
+#define TCP_WND_DEBUG (LWIP_DBG_OFF)
+#define TCP_FR_DEBUG (LWIP_DBG_OFF)
+#define TCP_QLEN_DEBUG (LWIP_DBG_OFF)
+#define TCP_RST_DEBUG (LWIP_DBG_OFF)
+#define PPP_DEBUG (LWIP_DBG_OFF)
+
+#define LWIP_DBG_TYPES_ON                                                                                                          \
+    (LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */
+
+#endif /* __LWIPOPTS_H__ */
diff --git a/src/lwip/bl702l/lwippools.h b/src/lwip/bl702l/lwippools.h
new file mode 100644
index 0000000..4370485
--- /dev/null
+++ b/src/lwip/bl702l/lwippools.h
@@ -0,0 +1,16 @@
+/*
+ *
+ *    Copyright (c) 2020-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.
+ */
diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn
index 3374493..e0bfc11 100644
--- a/src/platform/BUILD.gn
+++ b/src/platform/BUILD.gn
@@ -247,6 +247,12 @@
         "CHIP_DEVICE_LAYER_TARGET=bouffalolab/common",
         "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}",
       ]
+    } else if (chip_device_platform == "bl702l") {
+      defines += [
+        "CHIP_DEVICE_LAYER_TARGET_BL702L=1",
+        "CHIP_DEVICE_LAYER_TARGET=bouffalolab/common",
+        "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}",
+      ]
     } else if (chip_device_platform == "fake") {
       defines += [
         "CHIP_DEVICE_LAYER_TARGET_FAKE=1",
@@ -488,6 +494,8 @@
       _platform_target = "bouffalolab/BL602"
     } else if (chip_device_platform == "bl702") {
       _platform_target = "bouffalolab/BL702"
+    } else if (chip_device_platform == "bl702l") {
+      _platform_target = "bouffalolab/BL702L"
     } else if (chip_device_platform == "fake") {
       _platform_target = "fake"
     } else if (chip_device_platform == "cyw30739") {
diff --git a/src/platform/bouffalolab/BL702/PlatformManagerImpl.cpp b/src/platform/bouffalolab/BL702/PlatformManagerImpl.cpp
index b195abc..51fe963 100644
--- a/src/platform/bouffalolab/BL702/PlatformManagerImpl.cpp
+++ b/src/platform/bouffalolab/BL702/PlatformManagerImpl.cpp
@@ -36,8 +36,6 @@
 
 extern "C" void bl_rand_stream(unsigned char *, int);
 
-PlatformManagerImpl PlatformManagerImpl::sInstance;
-
 static int app_entropy_source(void * data, unsigned char * output, size_t len, size_t * olen)
 {
     bl_rand_stream(output, len);
@@ -87,29 +85,6 @@
 exit:
     return err;
 }
-void PlatformManagerImpl::_Shutdown()
-{
-    uint64_t upTime = 0;
 
-    if (GetDiagnosticDataProvider().GetUpTime(upTime) == CHIP_NO_ERROR)
-    {
-        uint32_t totalOperationalHours = 0;
-
-        if (ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours) == CHIP_NO_ERROR)
-        {
-            ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + static_cast<uint32_t>(upTime / 3600));
-        }
-        else
-        {
-            ChipLogError(DeviceLayer, "Failed to get total operational hours of the Node");
-        }
-    }
-    else
-    {
-        ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
-    }
-
-    Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
-}
 } // namespace DeviceLayer
 } // namespace chip
diff --git a/src/platform/bouffalolab/BL702L/BUILD.gn b/src/platform/bouffalolab/BL702L/BUILD.gn
new file mode 100644
index 0000000..23f6002
--- /dev/null
+++ b/src/platform/bouffalolab/BL702L/BUILD.gn
@@ -0,0 +1,88 @@
+# Copyright (c) 2022 Project CHIP Authors
+# All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/chip.gni")
+
+import("${chip_root}/src/platform/device.gni")
+
+assert(chip_device_platform == "bl702l")
+
+if (chip_enable_openthread) {
+  import("//build_overrides/openthread.gni")
+}
+
+static_library("BL702L") {
+  sources = [
+    "DiagnosticDataProviderImpl.cpp",
+    "PlatformManagerImpl.cpp",
+  ]
+
+  common_sources = [
+    "../../FreeRTOS/SystemTimeSupport.cpp",
+    "../../SingletonConfigurationManager.cpp",
+    "../common/BLConfig.cpp",
+    "../common/ConfigurationManagerImpl.cpp",
+    "../common/ConnectivityManagerImpl.cpp",
+    "../common/DiagnosticDataProviderImpl.cpp",
+    "../common/KeyValueStoreManagerImpl.cpp",
+    "../common/Logging.cpp",
+    "../common/PlatformManagerImpl.cpp",
+
+    # "${chip_root}/src/credentials/CHIPCert.h",
+    # "${chip_root}/src/credentials/DeviceAttestationCredsProvider.h",
+
+    # "../common/FactoryDataProvider.cpp",
+    # "../common/FactoryDataProvider.h",
+  ]
+
+  if (chip_enable_ota_requestor) {
+    sources += [
+      "../common/OTAImageProcessorImpl.cpp",
+      "../common/OTAImageProcessorImpl.h",
+    ]
+  }
+
+  if (chip_enable_ble) {
+    sources += [
+      "../common/BLEManagerImpl.cpp",
+      "../common/BLEManagerImpl.h",
+    ]
+  }
+  sources += common_sources
+
+  if (chip_enable_openthread) {
+    # needed for MTD/FTD
+
+    import("//build_overrides/bouffalolab_iot_sdk.gni")
+    import("${bouffalolab_iot_sdk_build_root}/bl702l/bl_iot_sdk.gni")
+    deps = [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]
+
+    sources += [
+      "../../OpenThread/OpenThreadUtils.cpp",
+      "ThreadStackManagerImpl.cpp",
+    ]
+
+    if (chip_mdns == "platform") {
+      sources += [
+        "../../OpenThread/DnssdImpl.cpp",
+        "../../OpenThread/OpenThreadDnssdImpl.cpp",
+        "../../OpenThread/OpenThreadDnssdImpl.h",
+      ]
+      deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
+    }
+  }
+
+  public_deps = [ "${chip_root}/src/platform:platform_base" ]
+}
diff --git a/src/platform/bouffalolab/BL702L/DiagnosticDataProviderImpl.cpp b/src/platform/bouffalolab/BL702L/DiagnosticDataProviderImpl.cpp
new file mode 100644
index 0000000..c23abe0
--- /dev/null
+++ b/src/platform/bouffalolab/BL702L/DiagnosticDataProviderImpl.cpp
@@ -0,0 +1,94 @@
+/*
+ *    Copyright (c) 2022 Project CHIP Authors
+ *    All rights reserved.
+ *
+ *    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.
+ */
+
+#include <platform/ConnectivityManager.h>
+#include <platform/internal/CHIPDeviceLayerInternal.h>
+
+#include <platform/DiagnosticDataProvider.h>
+#include <platform/bouffalolab/common/DiagnosticDataProviderImpl.h>
+
+#include "FreeRTOS.h"
+#include <lwip/tcpip.h>
+
+using namespace ::chip::app::Clusters::GeneralDiagnostics;
+
+namespace chip {
+namespace DeviceLayer {
+
+CHIP_ERROR DiagnosticDataProviderImpl::GetBootReason(BootReasonType & bootReason)
+{
+    // BL_RST_REASON_E bootCause = bl_sys_rstinfo_get();
+
+    // if (BL_RST_POR == bootCause)
+    // {
+    //     bootReason = BootReasonType::kPowerOnReboot;
+    // }
+    // else if (BL_RST_BOR == bootCause)
+    // {
+    //     bootReason = BootReasonType::kBrownOutReset;
+    // }
+    // else if (BL_RST_WDT == bootCause)
+    // {
+    //     bootReason = BootReasonType::kHardwareWatchdogReset;
+    // }
+    // else if (BL_RST_SOFTWARE == bootCause)
+    // {
+    //     bootReason = BootReasonType::kSoftwareReset;
+    // }
+    // else
+    // {
+    //     bootReason = BootReasonType::kUnspecified;
+    // }
+    return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** netifpp)
+{
+    NetworkInterface * ifp = new NetworkInterface();
+
+#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
+
+    const char * threadNetworkName = otThreadGetNetworkName(ThreadStackMgrImpl().OTInstance());
+    ifp->name                      = Span<const char>(threadNetworkName, strlen(threadNetworkName));
+    ifp->isOperational             = true;
+    ifp->offPremiseServicesReachableIPv4.SetNull();
+    ifp->offPremiseServicesReachableIPv6.SetNull();
+    ifp->type = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_THREAD;
+    uint8_t macBuffer[ConfigurationManager::kPrimaryMACAddressLength];
+    ConfigurationMgr().GetPrimary802154MACAddress(macBuffer);
+    ifp->hardwareAddress = ByteSpan(macBuffer, ConfigurationManager::kPrimaryMACAddressLength);
+
+#else
+    /* TODO */
+#endif
+
+    *netifpp = ifp;
+    return CHIP_NO_ERROR;
+}
+
+void DiagnosticDataProviderImpl::ReleaseNetworkInterfaces(NetworkInterface * netifp)
+{
+    while (netifp)
+    {
+        NetworkInterface * del = netifp;
+        netifp                 = netifp->Next;
+        delete del;
+    }
+}
+
+} // namespace DeviceLayer
+} // namespace chip
diff --git a/src/platform/bouffalolab/BL702L/PlatformManagerImpl.cpp b/src/platform/bouffalolab/BL702L/PlatformManagerImpl.cpp
new file mode 100644
index 0000000..fa88202
--- /dev/null
+++ b/src/platform/bouffalolab/BL702L/PlatformManagerImpl.cpp
@@ -0,0 +1,97 @@
+/*
+ *    Copyright (c) 2022 Project CHIP Authors
+ *    All rights reserved.
+ *
+ *    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.
+ */
+
+/* this file behaves like a config.h, comes first */
+#include <platform/internal/CHIPDeviceLayerInternal.h>
+
+#include <crypto/CHIPCryptoPAL.h>
+#include <platform/FreeRTOS/SystemTimeSupport.h>
+#include <platform/PlatformManager.h>
+#include <platform/bouffalolab/common/DiagnosticDataProviderImpl.h>
+#include <platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp>
+
+#include <lwip/tcpip.h>
+
+extern "C" {
+#include <bl_sec.h>
+#include <openthread_port.h>
+#include <ot_utils_ext.h>
+}
+
+namespace chip {
+namespace DeviceLayer {
+
+extern "C" void (*ot_otrNotifyEvent_ptr)(ot_system_event_t sevent);
+extern "C" void bl_rand_stream(unsigned char *, int);
+extern "C" void otrNotifyEvent(ot_system_event_t sevent);
+
+static int app_entropy_source(void * data, unsigned char * output, size_t len, size_t * olen)
+{
+    bl_rand_stream(output, len);
+    if (olen)
+    {
+        *olen = len;
+    }
+
+    return 0;
+}
+
+CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
+{
+    CHIP_ERROR err;
+    TaskHandle_t backup_eventLoopTask;
+
+    // Initialize the configuration system.
+    err = Internal::BLConfig::Init();
+    SuccessOrExit(err);
+
+    otRadio_opt_t opt;
+
+    opt.byte            = 0;
+    opt.bf.isCoexEnable = true;
+
+    ot_utils_init();
+    ot_otrNotifyEvent_ptr = otrNotifyEvent;
+
+    ot_alarmInit();
+    ot_radioInit(opt);
+
+    ReturnErrorOnFailure(System::Clock::InitClock_RealTime());
+
+    SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance());
+    SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance());
+
+    // Initialize LwIP.
+    tcpip_init(NULL, NULL);
+
+    err = chip::Crypto::add_entropy_source(app_entropy_source, NULL, 16);
+    SuccessOrExit(err);
+
+    // Call _InitChipStack() on the generic implementation base class
+    // to finish the initialization process.
+    /** weiyin, backup mEventLoopTask which is reset in _InitChipStack */
+    backup_eventLoopTask = Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::mEventLoopTask;
+    err                  = Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_InitChipStack();
+    SuccessOrExit(err);
+    Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::mEventLoopTask = backup_eventLoopTask;
+
+exit:
+    return err;
+}
+
+} // namespace DeviceLayer
+} // namespace chip
diff --git a/src/platform/bouffalolab/BL702L/ThreadStackManagerImpl.cpp b/src/platform/bouffalolab/BL702L/ThreadStackManagerImpl.cpp
new file mode 100644
index 0000000..7b9b879
--- /dev/null
+++ b/src/platform/bouffalolab/BL702L/ThreadStackManagerImpl.cpp
@@ -0,0 +1,140 @@
+/*
+ *    Copyright (c) 2022 Project CHIP Authors
+ *    All rights reserved.
+ *
+ *    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.
+ */
+
+#include <platform/internal/CHIPDeviceLayerInternal.h>
+
+#include <platform/FreeRTOS/GenericThreadStackManagerImpl_FreeRTOS.hpp>
+#include <platform/OpenThread/GenericThreadStackManagerImpl_OpenThread_LwIP.cpp>
+
+#include <platform/OpenThread/OpenThreadUtils.h>
+#include <platform/ThreadStackManager.h>
+
+#include <openthread/platform/entropy.h>
+
+#include <lib/support/CHIPPlatformMemory.h>
+
+#include <mbedtls/platform.h>
+
+#include <openthread_port.h>
+#include <utils_list.h>
+
+extern "C" {
+#include <ot_utils_ext.h>
+}
+
+namespace chip {
+namespace DeviceLayer {
+
+using namespace ::chip::DeviceLayer::Internal;
+
+ThreadStackManagerImpl ThreadStackManagerImpl::sInstance;
+extern "C" void (*ot_otrNotifyEvent_ptr)(ot_system_event_t sevent);
+
+CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack(void)
+{
+    return InitThreadStack(NULL);
+}
+
+CHIP_ERROR ThreadStackManagerImpl::InitThreadStack(otInstance * otInst)
+{
+    CHIP_ERROR err = CHIP_NO_ERROR;
+
+    // Initialize the generic implementation base classes.
+    err = GenericThreadStackManagerImpl_FreeRTOS<ThreadStackManagerImpl>::DoInit();
+    SuccessOrExit(err);
+    err = GenericThreadStackManagerImpl_OpenThread_LwIP<ThreadStackManagerImpl>::DoInit(otInst);
+    SuccessOrExit(err);
+
+    mbedtls_platform_set_calloc_free(pvPortCalloc, vPortFree);
+
+exit:
+    return err;
+}
+
+bool ThreadStackManagerImpl::IsInitialized()
+{
+    return sInstance.mThreadStackLock != NULL;
+}
+
+} // namespace DeviceLayer
+} // namespace chip
+
+using namespace ::chip::DeviceLayer;
+
+ot_system_event_t ot_system_event_var = OT_SYSTEM_EVENT_NONE;
+
+void otSysProcessDrivers(otInstance * aInstance)
+{
+    ot_system_event_t sevent = otrGetNotifyEvent();
+
+    ot_alarmTask(sevent);
+    ot_radioTask(sevent);
+}
+
+extern "C" void otTaskletsSignalPending(otInstance * p_instance)
+{
+    otSysEventSignalPending();
+}
+
+extern "C" void otSysEventSignalPending(void)
+{
+    if (xPortIsInsideInterrupt())
+    {
+        BaseType_t yieldRequired = ThreadStackMgrImpl().SignalThreadActivityPendingFromISR();
+        portYIELD_FROM_ISR(yieldRequired);
+    }
+    else
+    {
+        ThreadStackMgrImpl().SignalThreadActivityPending();
+    }
+}
+
+extern "C" otInstance * otrGetInstance()
+{
+    return ThreadStackMgrImpl().OTInstance();
+}
+
+extern "C" void * otPlatCAlloc(size_t aNum, size_t aSize)
+{
+    return calloc(aNum, aSize);
+}
+
+extern "C" void otPlatFree(void * aPtr)
+{
+    free(aPtr);
+}
+
+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();
+}
diff --git a/src/platform/bouffalolab/BL702L/args.gni b/src/platform/bouffalolab/BL702L/args.gni
new file mode 100644
index 0000000..07903ca
--- /dev/null
+++ b/src/platform/bouffalolab/BL702L/args.gni
@@ -0,0 +1,39 @@
+# Copyright (c) 2020 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/bouffalolab_iot_sdk.gni")
+import("//build_overrides/chip.gni")
+import("//build_overrides/mbedtls.gni")
+import("//build_overrides/pigweed.gni")
+import("${chip_root}/examples/platform/bouffalolab/bl702l/args.gni")
+
+chip_device_platform = "bl702l"
+
+riscv_platform_config = "${bouffalolab_iot_sdk_build_root}/common/rsicv.gni"
+
+mbedtls_target = "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk"
+
+chip_inet_config_enable_ipv4 = false
+chip_inet_config_enable_tcp_endpoint = false
+
+chip_build_tests = false
+
+openthread_external_mbedtls = mbedtls_target
+openthread_project_core_config_file = "bl702l-openthread-core-bl-config.h"
+openthread_core_config_platform_check_file =
+    "bl702l-openthread-core-bl-config-check.h"
+openthread_project_include_dirs =
+    [ "${chip_root}/src/platform/bouffalolab/BL702L" ]
+openthread_external_platform =
+    "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk"
diff --git a/src/platform/bouffalolab/BL702L/bl702l-chip-mbedtls-config.h b/src/platform/bouffalolab/BL702L/bl702l-chip-mbedtls-config.h
new file mode 100644
index 0000000..c8a7d8c
--- /dev/null
+++ b/src/platform/bouffalolab/BL702L/bl702l-chip-mbedtls-config.h
@@ -0,0 +1,135 @@
+/*

+ *  Copyright (c) 2018, The OpenThread Authors.

+ *  All rights reserved.

+ *

+ *  Redistribution and use in source and binary forms, with or without

+ *  modification, are permitted provided that the following conditions are met:

+ *  1. Redistributions of source code must retain the above copyright

+ *     notice, this list of conditions and the following disclaimer.

+ *  2. Redistributions in binary form must reproduce the above copyright

+ *     notice, this list of conditions and the following disclaimer in the

+ *     documentation and/or other materials provided with the distribution.

+ *  3. Neither the name of the copyright holder nor the

+ *     names of its contributors may be used to endorse or promote products

+ *     derived from this software without specific prior written permission.

+ *

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE

+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE

+ *  POSSIBILITY OF SUCH DAMAGE.

+ */

+

+// Spans multiple lines to avoid being processed by unifdef

+#ifndef MBEDTLS_CONFIG_H

+#define MBEDTLS_CONFIG_H

+

+// #include "openthread-core-config.h"

+

+#include <stdio.h>

+#include <stdlib.h>

+

+// #include <openthread/config.h>

+// #include <openthread/platform/logging.h>

+// #include <openthread/platform/memory.h>

+

+#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf

+

+#define MBEDTLS_AES_C

+#define MBEDTLS_AES_ROM_TABLES

+#define MBEDTLS_ASN1_PARSE_C

+#define MBEDTLS_ASN1_WRITE_C

+#define MBEDTLS_BIGNUM_C

+#define MBEDTLS_CCM_C

+#define MBEDTLS_CIPHER_C

+#define MBEDTLS_CMAC_C

+#define MBEDTLS_CTR_DRBG_C

+#define MBEDTLS_ECJPAKE_C

+#define MBEDTLS_ECP_C

+#define MBEDTLS_ECP_DP_SECP256R1_ENABLED

+#define MBEDTLS_ECP_NIST_OPTIM

+#define MBEDTLS_ENTROPY_C

+#define MBEDTLS_HAVE_ASM

+#define MBEDTLS_HMAC_DRBG_C

+#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED

+#define MBEDTLS_MD_C

+#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES

+#define MBEDTLS_NO_PLATFORM_ENTROPY

+#define MBEDTLS_PK_C

+#define MBEDTLS_PK_PARSE_C

+#define MBEDTLS_PLATFORM_C

+#define MBEDTLS_PLATFORM_MEMORY

+#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS

+#define MBEDTLS_SHA256_C

+#define MBEDTLS_SHA256_SMALLER

+#define MBEDTLS_SSL_CLI_C

+#define MBEDTLS_SSL_DTLS_ANTI_REPLAY

+#define MBEDTLS_SSL_DTLS_HELLO_VERIFY

+#define MBEDTLS_SSL_EXPORT_KEYS

+#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH

+#define MBEDTLS_SSL_PROTO_TLS1_2

+#define MBEDTLS_SSL_PROTO_DTLS

+#define MBEDTLS_SSL_TLS_C

+

+#define MBEDTLS_SSL_COOKIE_C

+#define MBEDTLS_SSL_SRV_C

+

+#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED

+#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED

+

+#define MBEDTLS_BASE64_C

+#define MBEDTLS_ECDH_C

+#define MBEDTLS_ECDSA_C

+#define MBEDTLS_OID_C

+#define MBEDTLS_PEM_PARSE_C

+#define MBEDTLS_X509_USE_C

+#define MBEDTLS_X509_CRT_PARSE_C

+

+#define MBEDTLS_BASE64_C

+#define MBEDTLS_ECDH_C

+#define MBEDTLS_ECDSA_C

+#define MBEDTLS_ECDSA_DETERMINISTIC

+#define MBEDTLS_OID_C

+#define MBEDTLS_PEM_PARSE_C

+#define MBEDTLS_PK_WRITE_C

+

+#define MBEDTLS_MPI_WINDOW_SIZE 1       /**< Maximum windows size used. */

+#define MBEDTLS_MPI_MAX_SIZE 32         /**< Maximum number of bytes for usable MPIs. */

+#define MBEDTLS_ECP_MAX_BITS 256        /**< Maximum bit size of groups */

+#define MBEDTLS_ECP_WINDOW_SIZE 2       /**< Maximum window size used */

+#define MBEDTLS_ECP_FIXED_POINT_OPTIM 0 /**< Enable fixed-point speed-up */

+#define MBEDTLS_ENTROPY_MAX_SOURCES 1   /**< Maximum number of sources supported */

+

+#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be undefined */

+#define MBEDTLS_PLATFORM_STD_FREE free     /**< Default free to use, can be undefined */

+

+#define MBEDTLS_SSL_MAX_CONTENT_LEN 900 /**< Maxium fragment length in bytes */

+

+#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8

+

+#define MBEDTLS_X509_CSR_WRITE_C

+#define MBEDTLS_X509_CREATE_C

+#define MBEDTLS_HKDF_C

+#define MBEDTLS_PKCS5_C

+

+#define MBEDTLS_ENTROPY_HARDWARE_ALT

+

+#define MBEDTLS_SHA1_ALT

+#define MBEDTLS_SHA256_ALT

+#define MBEDTLS_AES_ALT

+#define MBEDTLS_ECP_ALT

+

+// Spans multiple lines to avoid being processed by unifdef

+#if defined(MBEDTLS_USER_CONFIG_FILE)

+#include MBEDTLS_USER_CONFIG_FILE

+#endif

+

+#include "mbedtls/check_config.h"

+

+#endif /* MBEDTLS_CONFIG_H */

diff --git a/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config-check.h b/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config-check.h
new file mode 100644
index 0000000..8c15b61
--- /dev/null
+++ b/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config-check.h
@@ -0,0 +1,36 @@
+/*
+ *  Copyright (c) 2019, The OpenThread Authors.
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *  3. Neither the name of the copyright holder nor the
+ *     names of its contributors may be used to endorse or promote products
+ *     derived from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OPENTHREAD_CORE_CONFIG_CHECK_H_
+#define OPENTHREAD_CORE_CONFIG_CHECK_H_
+
+#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
+#error "Platform doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
+#endif
+
+#endif /* OPENTHREAD_CORE_CONFIG_CHECK_H_ */
diff --git a/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config.h b/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config.h
new file mode 100644
index 0000000..e25197c
--- /dev/null
+++ b/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config.h
@@ -0,0 +1,80 @@
+/*
+ *  Copyright (c) 2016, The OpenThread Authors.
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *  3. Neither the name of the copyright holder nor the
+ *     names of its contributors may be used to endorse or promote products
+ *     derived from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OPENTHREAD_CORE_BL702_CONFIG_H_
+#define OPENTHREAD_CORE_BL702_CONFIG_H_
+
+/**
+ * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
+ *
+ * Define to 1 to enable NCP HDLC support.
+ *
+ */
+#ifndef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
+#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 0
+#endif
+
+/**
+ * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
+ *
+ * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
+ *
+ * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
+ *
+ */
+#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0
+
+#ifndef LMAC154_RADIO_RECEIVE_SENSITIVITY
+#define LMAC154_RADIO_RECEIVE_SENSITIVITY -103
+#endif
+
+#ifndef OPENTHREAD_CONFIG_PLATFORM_XTAL_ACCURACY
+#define OPENTHREAD_CONFIG_PLATFORM_XTAL_ACCURACY 40
+#endif
+
+#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 0
+#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
+#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 0
+#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 1
+#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE 1
+#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 1
+#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1
+
+#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
+#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
+#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
+#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
+#define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1
+
+#define OPENTHREAD_ENABLE_VENDOR_EXTENSION 0
+// #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0
+#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 0
+// #define OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE 0
+#define OPENTHREAD_CONFIG_TCP_ENABLE 0
+
+#endif // OPENTHREAD_CORE_BL702_CONFIG_H_
diff --git a/src/platform/bouffalolab/common/BLEManagerImpl.cpp b/src/platform/bouffalolab/common/BLEManagerImpl.cpp
index ff26daf..29c00c2 100644
--- a/src/platform/bouffalolab/common/BLEManagerImpl.cpp
+++ b/src/platform/bouffalolab/common/BLEManagerImpl.cpp
@@ -32,7 +32,11 @@
 #endif
 
 extern "C" {
+#ifdef BL702L
+#include <btble_lib_api.h>
+#else
 #include <ble_lib_api.h>
+#endif
 }
 
 #include <bluetooth/addr.h>
@@ -121,8 +125,11 @@
     memset(mSubscribedConns, 0, sizeof(mSubscribedConns));
 
     ReturnErrorOnFailure(InitRandomStaticAddress());
-
+#ifdef BL702L
+    btble_controller_init(configMAX_PRIORITIES - 1);
+#else
     ble_controller_init(configMAX_PRIORITIES - 1);
+#endif
     hci_driver_init();
     bt_enable(NULL);
 
diff --git a/src/platform/bouffalolab/common/BLEManagerImpl.h b/src/platform/bouffalolab/common/BLEManagerImpl.h
index 0f9ff76..394da27 100644
--- a/src/platform/bouffalolab/common/BLEManagerImpl.h
+++ b/src/platform/bouffalolab/common/BLEManagerImpl.h
@@ -32,7 +32,7 @@
 using namespace chip::Ble;
 
 /**
- * Concrete implementation of the BLEManager singleton object for the BL702 platform.
+ * Concrete implementation of the BLEManager singleton object for the Bouffalo Lab platform.
  */
 class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePlatformDelegate, private BleApplicationDelegate
 {
@@ -159,7 +159,7 @@
  * Returns the platform-specific implementation of the BLEManager singleton object.
  *
  * Internal components can use this to gain access to features of the BLEManager
- * that are specific to the BL702 platform.
+ * that are specific to the Bouffalo Lab platform.
  */
 inline BLEManagerImpl & BLEMgrImpl(void)
 {
diff --git a/src/platform/bouffalolab/common/ConfigurationManagerImpl.h b/src/platform/bouffalolab/common/ConfigurationManagerImpl.h
index 1d69d58..0427551 100644
--- a/src/platform/bouffalolab/common/ConfigurationManagerImpl.h
+++ b/src/platform/bouffalolab/common/ConfigurationManagerImpl.h
@@ -25,7 +25,7 @@
 namespace DeviceLayer {
 
 /**
- * Concrete implementation of the ConfigurationManager singleton object for the bl702 platform.
+ * Concrete implementation of the ConfigurationManager singleton object for the Bouffalo Lab platform.
  */
 class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl<Internal::BLConfig>
 {
diff --git a/src/platform/bouffalolab/common/PlatformManagerImpl.h b/src/platform/bouffalolab/common/PlatformManagerImpl.h
index 448bc06..6acc7bf 100644
--- a/src/platform/bouffalolab/common/PlatformManagerImpl.h
+++ b/src/platform/bouffalolab/common/PlatformManagerImpl.h
@@ -27,7 +27,7 @@
 namespace DeviceLayer {
 
 /**
- * Concrete implementation of the PlatformManager singleton object for the BL602 platform.
+ * Concrete implementation of the PlatformManager singleton object for the Bouffalo Lab platform.
  */
 class PlatformManagerImpl final : public PlatformManager, public Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>
 {
diff --git a/src/platform/bouffalolab/common/ThreadStackManagerImpl.h b/src/platform/bouffalolab/common/ThreadStackManagerImpl.h
index 61a9b72..dc69f27 100644
--- a/src/platform/bouffalolab/common/ThreadStackManagerImpl.h
+++ b/src/platform/bouffalolab/common/ThreadStackManagerImpl.h
@@ -37,7 +37,7 @@
 class ThreadStackManagerImpl;
 
 /**
- * Concrete implementation of the ThreadStackManager singleton object for BL702 platforms
+ * Concrete implementation of the ThreadStackManager singleton object for Bouffalo Lab platforms
  * using the Bouffalolab SDK and the OpenThread stack.
  */
 class ThreadStackManagerImpl final : public ThreadStackManager,
@@ -103,7 +103,7 @@
  * Returns the platform-specific implementation of the ThreadStackManager singleton object.
  *
  * Chip applications can use this to gain access to features of the ThreadStackManager
- * that are specific to BL702 platforms.
+ * that are specific to Bouffalo Lab platforms.
  */
 inline ThreadStackManagerImpl & ThreadStackMgrImpl(void)
 {
diff --git a/src/platform/device.gni b/src/platform/device.gni
index b22e309..d740663 100644
--- a/src/platform/device.gni
+++ b/src/platform/device.gni
@@ -111,7 +111,8 @@
   }
 }
 
-if (chip_device_platform == "bl702" && chip_enable_openthread) {
+if ((chip_device_platform == "bl702" || chip_device_platform == "bl702l") &&
+    chip_enable_openthread) {
   chip_mdns = "platform"
 } else if (chip_device_platform == "bl702" && chip_enable_wifi) {
   chip_mdns = "minimal"
@@ -156,6 +157,8 @@
   _chip_device_layer = "bouffalolab/common"
 } else if (chip_device_platform == "bl702") {
   _chip_device_layer = "bouffalolab/common"
+} else if (chip_device_platform == "bl702l") {
+  _chip_device_layer = "bouffalolab/common"
 } else if (chip_device_platform == "cyw30739") {
   _chip_device_layer = "Infineon/CYW30739"
 } else if (chip_device_platform == "webos") {
@@ -236,9 +239,10 @@
         chip_device_platform == "telink" || chip_device_platform == "mbed" ||
         chip_device_platform == "psoc6" || chip_device_platform == "android" ||
         chip_device_platform == "ameba" || chip_device_platform == "cyw30739" ||
-        chip_device_platform == "webos" || chip_device_platform == "bl602" ||
-        chip_device_platform == "mw320" || chip_device_platform == "zephyr" ||
-        chip_device_platform == "beken" || chip_device_platform == "bl702" ||
-        chip_device_platform == "mt793x" || chip_device_platform == "SiWx917" ||
+        chip_device_platform == "webos" || chip_device_platform == "mw320" ||
+        chip_device_platform == "zephyr" || chip_device_platform == "beken" ||
+        chip_device_platform == "bl602" || chip_device_platform == "bl702" ||
+        chip_device_platform == "bl702l" || chip_device_platform == "mt793x" ||
+        chip_device_platform == "SiWx917" ||
         chip_device_platform == "openiotsdk" || chip_device_platform == "asr",
     "Please select a valid value for chip_device_platform")
diff --git a/third_party/bouffalolab/bl702l/BUILD.gn b/third_party/bouffalolab/bl702l/BUILD.gn
new file mode 100644
index 0000000..24f60f5
--- /dev/null
+++ b/third_party/bouffalolab/bl702l/BUILD.gn
@@ -0,0 +1,28 @@
+# Copyright (c) 2020 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/bouffalolab_iot_sdk.gni")
+import("//build_overrides/openthread.gni")
+import("${bouffalolab_iot_sdk_build_root}/bl702l/bl_iot_sdk.gni")
+
+declare_args() {
+  # Build target to use for Bouffalo Lab IOT SDK. Use this to set global SDK defines.
+  bl_iot_sdk_target = ""
+}
+
+assert(bl_iot_sdk_target != "", "bl_iot_sdk_target must be specified")
+
+group("bl_iot_sdk") {
+  public_deps = [ bl_iot_sdk_target ]
+}
diff --git a/third_party/bouffalolab/bl702l/bl_iot_sdk.gni b/third_party/bouffalolab/bl702l/bl_iot_sdk.gni
new file mode 100644
index 0000000..9362f2d
--- /dev/null
+++ b/third_party/bouffalolab/bl702l/bl_iot_sdk.gni
@@ -0,0 +1,694 @@
+# 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"
+}
+
+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",
+      "BL702L=BL702L",
+      "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
+    }
+
+    cflags_c = [
+      "-include",
+      rebase_path("${invoker.freertos_config}", root_build_dir),
+    ]
+    cflags_cc = [
+      "-include",
+      rebase_path("${invoker.freertos_config}", root_build_dir),
+    ]
+  }
+
+  config("${sdk_target_name}_config_soc") {
+    include_dirs = [
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rf/include",
+    ]
+  }
+
+  source_set("${sdk_target_name}_soc") {
+    defines = [
+      "CFG_CPP_ENABLE",
+      "CFG_USE_ROM_CODE",
+      "SYS_APP_TASK_STACK_SIZE=1024",
+      "SYS_APP_TASK_PRIORITY=15",
+    ]
+
+    include_dirs = [
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rf/include",
+    ]
+
+    sources = [
+      #      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l/bfl_main.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l/evb/src/boot/gcc/start.S",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l/evb/src/debug.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l/evb/src/strntoumax.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l/evb/src/vprint.c",
+    ]
+
+    libs = [ "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rf/lib/libbl702l_rf.a" ]
+
+    cflags_c = [
+      "-Wno-format-truncation",
+      "-Wno-unused-variable",
+    ]
+
+    configs += [
+      ":${sdk_target_name}_config",
+      ":${sdk_target_name}_config_BSP_Driver",
+      ":${sdk_target_name}_config_bl702l_rom_a0",
+      ":${sdk_target_name}_config_hosal",
+      ":${sdk_target_name}_config_fs",
+      ":${sdk_target_name}_config_stage",
+      ":${sdk_target_name}_config_utils",
+    ]
+  }
+
+  config("${sdk_target_name}_config_BSP_Driver") {
+    include_dirs = [
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/inc",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/regs",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/startup",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/risc-v/Core/Include/",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/MCU_Common/soft_crc",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/MCU_Common/misc",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Common/platform",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rf/api/",
+    ]
+  }
+
+  config("${sdk_target_name}_config_bl702l_rom_a0") {
+    include_dirs = [
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rom_a0/bl702l_rom_ext/include/rom_ext",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rom_a0/bl702l_rom_ext/include/rom_freertos",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rom_a0/bl702l_rom_ext/include/rom_freertos/config",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rom_a0/bl702l_rom_ext/include/rom_freertos/panic",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rom_a0/bl702l_rom_ext/include/rom_freertos/portable/GCC/RISC-V",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rom_a0/bl702l_rom_ext/include/rom_lmac154/include",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/inc",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/startup",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/MCU_Common/misc",
+    ]
+  }
+
+  source_set("${sdk_target_name}_bl702l_rom_a0") {
+    defines = [ "portasmHANDLE_INTERRUPT=interrupt_entry" ]
+
+    include_dirs = [ "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/regs" ]
+
+    libs = [ "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_rom_a0/bl702l_rom_ext/lib/libbl702l_rom_ext.a" ]
+
+    sources = [
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_acomp.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_adc.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_auadc.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_cks.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_dma.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_i2c.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_pwm.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_pwm_sc.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_sec_dbg.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_sec_eng.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_spi.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/BSP_Driver/std_drv/src/bl702l_tzc_sec.c",
+      "${bl_iot_sdk_root}/components/platform/soc/bl702l/bl702l_std/MCU_Common/ring_buffer/ring_buffer.c",
+    ]
+
+    public_configs = [
+      ":${sdk_target_name}_config",
+      ":${sdk_target_name}_config_bl702l_rom_a0",
+    ]
+  }
+
+  config("${sdk_target_name}_config_hosal") {
+    include_dirs = [
+      "${bl_iot_sdk_root}/components/platform/hosal/include",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/include",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_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/bl702l_hal/bl_adc.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_boot2.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_chip.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_dma.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_efuse.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_flash.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_gpio.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_hbn.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_ir.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_irq.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_kys.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_psram.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_psram_sp.S",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_pwm.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_rtc.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_sec.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_sys.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_timer.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_uart.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_wdt.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_wireless.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hal_board.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hal_boot2.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hal_button.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hal_gpio.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hal_hbn.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hal_hwtimer.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hal_sys.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hal_tcal.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_adc.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_dma.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_flash.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_gpio.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_i2c.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_ota.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_pwm.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_rng.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_rtc.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_spi.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_timer.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_uart.c",
+      "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/hosal_wdg.c",
+    ]
+
+    sources += [
+      "${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_aes.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-unused-variable",
+      "-Wno-sign-compare",
+      "-Wno-enum-conversion",
+      "-Wno-old-style-declaration",
+      "-Wno-stringop-overflow",
+      "-Wno-format-truncation",
+
+      "-Wno-shadow",
+    ]
+    configs += [
+      ":${sdk_target_name}_config_soc",
+      ":${sdk_target_name}_config_BSP_Driver",
+      ":${sdk_target_name}_config_bl702l_rom_a0",
+      ":${sdk_target_name}_config_stage",
+      ":${sdk_target_name}_config_sys",
+      ":${sdk_target_name}_config_fs",
+      ":${sdk_target_name}_config_utils",
+    ]
+    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_bl702l_rom_a0",
+      ":${sdk_target_name}_config_hosal",
+      ":${sdk_target_name}_config_stage",
+      ":${sdk_target_name}_config_fs",
+      ":${sdk_target_name}_config_utils",
+    ]
+    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",
+    ]
+    configs += [ ":${sdk_target_name}_config_bl702l_rom_a0" ]
+    cflags_c = [ "-Wno-builtin-declaration-mismatch" ]
+    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_bl702l_rom_a0",
+      ":${sdk_target_name}_config_BSP_Driver",
+      ":${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" ]
+    configs += [
+      ":${sdk_target_name}_config_BSP_Driver",
+      ":${sdk_target_name}_config_bl702l_rom_a0",
+      ":${sdk_target_name}_config_hosal",
+      ":${sdk_target_name}_config_utils",
+    ]
+    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_bl702l_rom_a0",
+      ":${sdk_target_name}_config_hosal",
+      ":${sdk_target_name}_config_utils",
+    ]
+    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/btblecontroller/btble_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",
+      "CONFIG_CHIP_NAME = BL702L",
+    ]
+
+    cflags_cc = [ "-Wno-conversion" ]
+  }
+
+  source_set("${sdk_target_name}_ble") {
+    defines = [
+      "CONFIG_BUILD_BLE_ROM_CODE=1",
+      "CONFIG_BLE_PDS=1",
+      "CONFIG_BT_CONN=1",
+      "CONFIG_BLE_TX_BUFF_DATA=2",
+      "CONFIG_BLE_ACT_MAX=5",
+      "CONFIG_BT_ALLROLES=1",
+      "CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=1",
+      "CONFIG_DISABLE_BT_HOST_PRIVACY=1",
+      "CONFIG_DISABLE_CONTROLLER_BLE_PRIVACY=1",
+      "CONFIG_DISABLE_BLE_CONTROLLER_TEST_MODE=1",
+      "CONFIG_EM_SIZE=8",
+      "CONFIG_LONG_RANG=0",
+      "CONFIG_PHY_UPDATE=0",
+      "CONFIG_CLK_ACC=0 ",
+      "CONFIG_LE_PING=0",
+      "CONFIG_CHIP_NAME=BL702L",
+    ]
+
+    libs = [ "${bl_iot_sdk_root}/components/network/ble/btblecontroller_702l_m1s1p/lib/libbtblecontroller_702l_m1s1p.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/dummy.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/tinycrypt/source/aes_decrypt.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/aes_encrypt.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/cbc_mode.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ccm_mode.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/cmac_mode.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ctr_mode.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ctr_prng.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ecc.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ecc_dh.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ecc_dsa.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ecc_platform_specific.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/hmac.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/hmac_prng.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/sha256.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/utils.c",
+      "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/utils.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_bl702l_rom_a0",
+      ":${sdk_target_name}_config_hosal",
+      ":${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",
+      "-Wno-address-of-packed-member",
+
+      "-Wno-type-limits",
+      "-Wno-shadow",
+      "-Wno-unused-variable",
+    ]
+  }
+
+  config("${sdk_target_name}_config_openthread_port") {
+    include_dirs = [
+      "${chip_root}/platform/bl702l",
+      "${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",
+      "${bl_iot_sdk_root}/components/network/thread/openthread_utils/include",
+    ]
+  }
+
+  source_set("${sdk_target_name}_openthread_port") {
+    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_linkmetric.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",
+
+      #      "${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_extern.cpp",
+    ]
+
+    libs = [ "${bl_iot_sdk_root}/components/network/thread/openthread_utils_bl702l/lib/libopenthread_utils_bl702l.a" ]
+
+    configs += [
+      ":${sdk_target_name}_config_BSP_Driver",
+      ":${sdk_target_name}_config_bl702l_rom_a0",
+      ":${sdk_target_name}_config_utils",
+      ":${sdk_target_name}_config_hosal",
+      ":${sdk_target_name}_config_stage",
+    ]
+    public_configs = [
+      ":${sdk_target_name}_config",
+      ":${sdk_target_name}_config_openthread_port",
+    ]
+
+    public_deps = [
+      "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
+      "${openthread_root}/src/core:libopenthread_core_headers",
+    ]
+  }
+  config("${sdk_target_name}_config_mbedtls") {
+    include_dirs = [
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/include",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port",
+      "${chip_root}/src/platform/bouffalolab/BL702L",
+    ]
+
+    defines = [ "MBEDTLS_CONFIG_FILE=\"bl702l-chip-mbedtls-config.h\"" ]
+  }
+
+  source_set("${sdk_target_name}_mbedtls") {
+    include_dirs =
+        [ "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library" ]
+
+    sources = [
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/aes_alt.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/bignum_hw.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/ecp_alt.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/ecp_curves_alt.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/hw_common.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/hw_common.h",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/sha1_alt.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/sha256_alt.c",
+    ]
+
+    sources += [
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/bignum_ext.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_entropy_poll.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/mbedtls_port_mem.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/net_sockets.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/pkparse.c",
+    ]
+
+    sources += [
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/aes.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/asn1parse.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/asn1write.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/base64.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/bignum.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ccm.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cipher.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cipher_wrap.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cmac.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/constant_time.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ctr_drbg.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecdh.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecdsa.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecp.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecp_curves.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/entropy.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/hkdf.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/hmac_drbg.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/md.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/oid.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pem.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pk.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pk_wrap.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pkcs5.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pkwrite.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/platform.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/platform_util.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/sha256.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/sha512.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509_create.c",
+      "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509write_csr.c",
+    ]
+
+    cflags_c = [
+      "-Wno-sign-compare",
+      "-Wno-implicit-function-declaration",
+    ]
+    configs += [
+      ":${sdk_target_name}_config_BSP_Driver",
+      ":${sdk_target_name}_config_hosal",
+      ":${sdk_target_name}_config_bl702l_rom_a0",
+    ]
+    public_configs = [
+      ":${sdk_target_name}_config",
+      ":${sdk_target_name}_config_mbedtls",
+    ]
+  }
+
+  group(sdk_target_name) {
+    public_deps = [
+      ":${sdk_target_name}_bl702l_rom_a0",
+      ":${sdk_target_name}_ble",
+      ":${sdk_target_name}_fs",
+      ":${sdk_target_name}_hosal",
+      ":${sdk_target_name}_libc",
+      ":${sdk_target_name}_mbedtls",
+      ":${sdk_target_name}_soc",
+      ":${sdk_target_name}_stage",
+      ":${sdk_target_name}_sys",
+      ":${sdk_target_name}_utils",
+    ]
+    public_configs = [ ":${sdk_target_name}_config_BSP_Driver" ]
+    if (chip_enable_openthread) {
+      public_deps += [ ":${sdk_target_name}_openthread_port" ]
+    }
+  }
+}
diff --git a/third_party/bouffalolab/common/bouffalolab_executable.gni b/third_party/bouffalolab/common/bouffalolab_executable.gni
index 54f4c03..6e0684e 100644
--- a/third_party/bouffalolab/common/bouffalolab_executable.gni
+++ b/third_party/bouffalolab/common/bouffalolab_executable.gni
@@ -63,10 +63,13 @@
     flashing_options += [ "40M" ]
   } else if (invoker.bl_plat_name == "bl702") {
     flashing_options += [ "32M" ]
+  } else if (invoker.bl_plat_name == "bl702l") {
+    flashing_options += [ "32M" ]
   }
 
   flashing_options += [ "--pt" ]
-  if (invoker.board == "BL602-IOT-DVK-3S" || invoker.bl_plat_name == "bl702") {
+  if (invoker.board == "BL602-IOT-DVK-3S" || invoker.bl_plat_name == "bl702" ||
+      invoker.bl_plat_name == "bl702l") {
     flashing_options +=
         [ rebase_path("partition_cfg_2M.toml", root_out_dir, root_out_dir) ]
   } else {