From 1385240683ca71f9d6db4dedea32d70e6cbb851b Mon Sep 17 00:00:00 2001 From: wyhong <30567533+wy-hh@users.noreply.github.com> Date: Wed, 30 Nov 2022 05:02:22 +0800 Subject: [PATCH] [Bouffalolab] Update SDK repo (#23745) * Update sdk repo * Update build scripts and readme * change submodule fetch * update submodule path * update submodule url * update sdk repo * Fix restyle * update comments * Do not try on default SDK path --- .github/workflows/examples-bouffalolab.yaml | 8 ++++---- .gitmodules | 14 +++++++------- build_overrides/bouffalolab_iot_sdk.gni | 3 +-- examples/build_overrides/bouffalolab_iot_sdk.gni | 3 +-- examples/lighting-app/bouffalolab/README.md | 16 ++++++++++++++++ examples/lighting-app/bouffalolab/bl602/BUILD.gn | 12 +++++------- examples/lighting-app/bouffalolab/bl702/BUILD.gn | 11 +++++------ .../common/toolchain/riscv_toolchain.gni | 4 ++-- scripts/build/builders/bouffalolab.py | 2 ++ scripts/examples/gn_bouffalolab_example.sh | 2 ++ .../bouffalolab/bl602/bl602_executable.gni | 6 ++---- .../bouffalolab/bl702/bl702_executable.gni | 6 ++---- third_party/bouffalolab/repo | 2 +- 13 files changed, 50 insertions(+), 39 deletions(-) diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 11539d512f579f..8e137c4738b281 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -31,7 +31,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.6.06 + image: connectedhomeip/chip-build-bouffalolab:0.6.12 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -44,7 +44,7 @@ jobs: attempt_limit: 3 attempt_delay: 2000 - name: Checkout submodules - run: scripts/checkout_submodules.py --shallow --platform bl602 + run: scripts/checkout_submodules.py --shallow --platform bouffalolab --recursive - name: Set up environment for size reports if: ${{ !env.ACT }} @@ -87,7 +87,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.6.06 + image: connectedhomeip/chip-build-bouffalolab:0.6.12 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -100,7 +100,7 @@ jobs: attempt_limit: 3 attempt_delay: 2000 - name: Checkout submodules - run: scripts/checkout_submodules.py --shallow --platform bouffalolab + run: scripts/checkout_submodules.py --shallow --platform bouffalolab --recursive - name: Set up environment for size reports if: ${{ !env.ACT }} diff --git a/.gitmodules b/.gitmodules index a68fbf7fc095da..1d0e33d8b1f0f4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -58,7 +58,7 @@ path = third_party/freertos/repo url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git branch = V10.3.1-kernel-only - platforms = ameba,cc13x2_26x2,bl602,efr32,esp32,k32w0,infineon,qpg + platforms = ameba,cc13x2_26x2,bouffalolab,efr32,esp32,k32w0,infineon,qpg [submodule "simw-top-mini"] path = third_party/simw-top-mini/repo url = https://github.com/NXP/plug-and-trust.git @@ -264,11 +264,6 @@ [submodule "third_party/boringssl/repo/src"] path = third_party/boringssl/repo/src url = https://github.com/google/boringssl.git -[submodule "boufalolab_repo"] - path = third_party/bouffalolab/repo - url = https://github.com/bouffalolab/bl_iot_sdk.git - branch = master - platforms = bouffalolab,bl602 [submodule "third_party/mt793x_sdk/filogic"] path = third_party/mt793x_sdk/filogic url = https://github.com/MediaTek-Labs/genio-matter-bsp.git @@ -293,4 +288,9 @@ path = third_party/open-iot-sdk/storage url = https://git.gitlab.arm.com/iot/open-iot-sdk/storage.git branch = main - platforms = openiotsdk + platforms = openiotsdk +[submodule "bouffalolab_sdk"] + path = third_party/bouffalolab/repo + url = https://github.com/bouffalolab/bl_iot_sdk_tiny.git + branch = main + platforms = bouffalolab diff --git a/build_overrides/bouffalolab_iot_sdk.gni b/build_overrides/bouffalolab_iot_sdk.gni index 165bf5944f16d8..77ab3440927271 100644 --- a/build_overrides/bouffalolab_iot_sdk.gni +++ b/build_overrides/bouffalolab_iot_sdk.gni @@ -19,6 +19,5 @@ declare_args() { # Root directory for bl702 SDK build files. bl702_sdk_build_root = "//third_party/bouffalolab/bl702" - # Root directory of toolchain of Bouffalolab chips - bouffalolab_toolchain = "//third_party/bouffalolab/repo/toolchain/riscv" + bouffalolab_sdk_root = "/opt/bouffalolab_sdk" } diff --git a/examples/build_overrides/bouffalolab_iot_sdk.gni b/examples/build_overrides/bouffalolab_iot_sdk.gni index c11bd8fa0507f7..1eb018a7ef2c85 100644 --- a/examples/build_overrides/bouffalolab_iot_sdk.gni +++ b/examples/build_overrides/bouffalolab_iot_sdk.gni @@ -21,6 +21,5 @@ declare_args() { bl702_sdk_build_root = "//third_party/connectedhomeip/third_party/bouffalolab/bl702" - # Root directory of toolchain of Bouffalolab chips - bouffalolab_toolchain = "/third_party/bouffalolab/repo/toolchain/riscv" + bouffalolab_sdk_root = "/opt/bouffalolab_sdk" } diff --git a/examples/lighting-app/bouffalolab/README.md b/examples/lighting-app/bouffalolab/README.md index efa22fe1aee11c..a68fad7b540a81 100644 --- a/examples/lighting-app/bouffalolab/README.md +++ b/examples/lighting-app/bouffalolab/README.md @@ -53,6 +53,22 @@ Mac OS. > under this environment. If not, please try `scripts/bootstrap.sh` for > matter environment update. +- Setup build environment for `Bouffalo Lab` SoC + + Run `setup.sh` to install `Bouffalo Lab` SDK to /opt/bouffalolab_sdk + + ``` + cd third_party/bouffalolab/repo + sudo bash script/setup.sh + ``` + + Please execute following command export `BOUFFALOLAB_SDK_ROOT` before + building. + + ``` + export BOUFFALOLAB_SDK_ROOT=/opt/bouffalolab_sdk + ``` + ## Build CHIP Lighting App example The following steps take examples for BL602 develop board `BL602-IoT-Matter-V1` diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index b9511c8d4408e9..369b732b02f49b 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -38,17 +38,16 @@ declare_args() { # Dump memory usage at link time. chip_print_memory_usage = true - # PIN code for PASE session establishment. - setupPinCode = 20202021 + # OTA periodic query timeout in seconds + ota_periodic_query_timeout = 86400 - # Monitor & log memory usage at runtime. enable_heap_monitoring = false - # OTA periodic query timeout in seconds - ota_periodic_query_timeout = 86400 + setupPinCode = 20202021 + setupDiscriminator = 3840 board = "BL602-IoT-Matter-V1" - + module_type = "BL602" baudrate = 2000000 } @@ -196,7 +195,6 @@ bl602_executable("lighting_app") { sources += [ "${examples_plat_common_dir}/plat/OTAConfig.cpp" ] } - print(defines) ldscript = "${examples_plat_dir}/ldscripts/flash_rom.ld" ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index 2863fae45dd08c..5872505775bd15 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -38,21 +38,20 @@ declare_args() { # Dump memory usage at link time. chip_print_memory_usage = true + # OTA periodic query timeout in seconds + ota_periodic_query_timeout = 86400 + config_cache_size = 8192 - # Monitor & log memory usage at runtime. enable_heap_monitoring = false - # OTA periodic query timeout in seconds - ota_periodic_query_timeout = 86400 + setupPinCode = 20202021 + setupDiscriminator = 3840 board = "XT-ZB6-DevKit" module_type = "BL706C-22" enable_psram = true baudrate = 2000000 - - setupPinCode = 20202021 - setupDiscriminator = 3840 } bl702_sdk("sdk") { diff --git a/examples/platform/bouffalolab/common/toolchain/riscv_toolchain.gni b/examples/platform/bouffalolab/common/toolchain/riscv_toolchain.gni index d382cb3179ee66..db46fc1a98f4fa 100644 --- a/examples/platform/bouffalolab/common/toolchain/riscv_toolchain.gni +++ b/examples/platform/bouffalolab/common/toolchain/riscv_toolchain.gni @@ -23,9 +23,9 @@ template("riscv_toolchain") { _tool_name_root = "" if ("linux" == host_os) { - _tool_name_root = "${root_build_dir}/../../${bouffalolab_toolchain}/Linux/bin/riscv64-unknown-elf-" + _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-" } else if ("mac" == host_os || "darwin" == host_os) { - _tool_name_root = "${root_build_dir}/../../${bouffalolab_toolchain}/Darwin/bin/riscv64-unknown-elf-" + _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-" } ar = _tool_name_root + "ar" diff --git a/scripts/build/builders/bouffalolab.py b/scripts/build/builders/bouffalolab.py index 00a9315d705928..9c9c8e7eebc285 100644 --- a/scripts/build/builders/bouffalolab.py +++ b/scripts/build/builders/bouffalolab.py @@ -107,6 +107,8 @@ def __init__(self, elif enable_shell: self.argsOpt.append('chip_build_libshell=true') + self.argsOpt.append('bouffalolab_sdk_root="%s"' % os.environ['BOUFFALOLAB_SDK_ROOT']) + def GnBuildArgs(self): return self.argsOpt diff --git a/scripts/examples/gn_bouffalolab_example.sh b/scripts/examples/gn_bouffalolab_example.sh index a719563f38cb03..49182700527744 100755 --- a/scripts/examples/gn_bouffalolab_example.sh +++ b/scripts/examples/gn_bouffalolab_example.sh @@ -141,6 +141,8 @@ else exit 1 fi + optArgs=$optArgs' bouffalolab_sdk_root="'$BOUFFALOLAB_SDK_ROOT'"' + example_dir=$MATTER_ROOT/examples/$example_name/bouffalolab/$bouffalo_chip output_dir=$MATTER_ROOT/$output_folder diff --git a/third_party/bouffalolab/bl602/bl602_executable.gni b/third_party/bouffalolab/bl602/bl602_executable.gni index b2e6ae85485ae4..5c327b0f913540 100644 --- a/third_party/bouffalolab/bl602/bl602_executable.gni +++ b/third_party/bouffalolab/bl602/bl602_executable.gni @@ -26,11 +26,9 @@ template("bl602_executable") { objcopy = "riscv64-unknown-elf-objcopy" if ("linux" == host_os) { - objcopy = - "../../${bouffalolab_toolchain}/Linux/bin/riscv64-unknown-elf-objcopy" + objcopy = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-objcopy" } else if ("mac" == host_os || "darwin" == host_os) { - objcopy = - "../../${bouffalolab_toolchain}/Darwin/bin/riscv64-unknown-elf-objcopy" + objcopy = "${bouffalolab_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-objcopy" } # Copy flashing dependencies to the output directory so that the output diff --git a/third_party/bouffalolab/bl702/bl702_executable.gni b/third_party/bouffalolab/bl702/bl702_executable.gni index 8d72c59b48acf7..e50120b0255f24 100644 --- a/third_party/bouffalolab/bl702/bl702_executable.gni +++ b/third_party/bouffalolab/bl702/bl702_executable.gni @@ -26,11 +26,9 @@ template("bl702_executable") { objcopy = "riscv64-unknown-elf-objcopy" if ("linux" == host_os) { - objcopy = - "../../${bouffalolab_toolchain}/Linux/bin/riscv64-unknown-elf-objcopy" + objcopy = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-objcopy" } else if ("mac" == host_os || "darwin" == host_os) { - objcopy = - "../../${bouffalolab_toolchain}/Darwin/bin/riscv64-unknown-elf-objcopy" + objcopy = "${bouffalolab_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-objcopy" } # Copy flashing dependencies to the output directory so that the output diff --git a/third_party/bouffalolab/repo b/third_party/bouffalolab/repo index dc526317d2903c..2d6f06e8f05dca 160000 --- a/third_party/bouffalolab/repo +++ b/third_party/bouffalolab/repo @@ -1 +1 @@ -Subproject commit dc526317d2903c4d3a8466226983ce34dc8f23d1 +Subproject commit 2d6f06e8f05dca5c24afa342c9c1b867a3ad400e