From b3285e878f1781ed874819e303006e89f1f4748f Mon Sep 17 00:00:00 2001 From: wyhong Date: Wed, 30 Nov 2022 13:58:32 +0800 Subject: [PATCH 1/9] Update sdk repo --- .gitmodules | 8 +++----- third_party/bouffalolab/repo | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index 5a60849e011130..d18dd8a77c1316 100644 --- a/.gitmodules +++ b/.gitmodules @@ -268,11 +268,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 @@ -288,3 +283,6 @@ url = https://github.com/matter-mtk/genio-matter-lwip.git branch = main platforms = genio +[submodule "bouffalolab_sdk"] + path = third_party/bouffalolab/repo + url = https://github.com/bouffalolab/bl_iot_sdk_tiny.git diff --git a/third_party/bouffalolab/repo b/third_party/bouffalolab/repo index dc526317d2903c..ae0622d85476ed 160000 --- a/third_party/bouffalolab/repo +++ b/third_party/bouffalolab/repo @@ -1 +1 @@ -Subproject commit dc526317d2903c4d3a8466226983ce34dc8f23d1 +Subproject commit ae0622d85476ed838ebc3efde9743c376bc9f96d From ce3095a177c4a8f5dec5d68a4054aa43b3166a2c 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 2/9] [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 | 4 ++-- .gitmodules | 2 +- build_overrides/bouffalolab_iot_sdk.gni | 3 +-- examples/build_overrides/bouffalolab_iot_sdk.gni | 3 +-- examples/lighting-app/bouffalolab/README.md | 0 examples/lighting-app/bouffalolab/bl602/BUILD.gn | 7 ++++--- examples/lighting-app/bouffalolab/bl702/BUILD.gn | 4 +++- .../bouffalolab/common/toolchain/riscv_toolchain.gni | 4 ++-- scripts/build/builders/bouffalolab.py | 2 ++ scripts/examples/gn_bouffalolab_example.sh | 2 ++ third_party/bouffalolab/bl602/bl602_executable.gni | 6 ++---- third_party/bouffalolab/bl702/bl702_executable.gni | 6 ++---- 12 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 examples/lighting-app/bouffalolab/README.md diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 4f32c97aaf424e..ce291036cdfe1a 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:latest + 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 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 d18dd8a77c1316..31757f80ad4ad0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -62,7 +62,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 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 new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index a00a5a47503269..a12fbf88c9f127 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -35,14 +35,15 @@ 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 + + baudrate = 115200 } show_qr_code = false diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index 1101a90630c0d4..ef5b48858f4b4f 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -38,9 +38,11 @@ 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 board = "BL706-IoT-DVK" 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 b391251093653f..eafd4b080bf9de 100644 --- a/scripts/build/builders/bouffalolab.py +++ b/scripts/build/builders/bouffalolab.py @@ -88,6 +88,8 @@ def __init__(self, if enable_rpcs: self.argsOpt.append('import("//with_pw_rpc.gni")') + 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 f04307607ba30b..dafae9fa1f0c73 100755 --- a/scripts/examples/gn_bouffalolab_example.sh +++ b/scripts/examples/gn_bouffalolab_example.sh @@ -140,6 +140,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 8f775f6292ccbc..71c2bc6b8283b5 100644 --- a/third_party/bouffalolab/bl602/bl602_executable.gni +++ b/third_party/bouffalolab/bl602/bl602_executable.gni @@ -25,11 +25,9 @@ template("bl602_executable") { objcopy_image_format = "binary" 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 7fa34fa759a46a..b18348f372613e 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 From cf5c445e241edd5960f1757cbeb5cf70cb753433 Mon Sep 17 00:00:00 2001 From: wyhong Date: Wed, 30 Nov 2022 14:55:09 +0800 Subject: [PATCH 3/9] update build flow --- .github/workflows/examples-bl602.yaml | 4 ++-- .gitmodules | 9 ++++++--- examples/lighting-app/bouffalolab/bl602/BUILD.gn | 5 +++-- examples/lighting-app/bouffalolab/bl702/BUILD.gn | 4 +--- scripts/build/builders/bl602.py | 2 ++ scripts/examples/gn_bl602_example.sh | 3 ++- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/examples-bl602.yaml b/.github/workflows/examples-bl602.yaml index 56166d9e667756..a150203124e78e 100644 --- a/.github/workflows/examples-bl602.yaml +++ b/.github/workflows/examples-bl602.yaml @@ -31,7 +31,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:latest + 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 }} diff --git a/.gitmodules b/.gitmodules index 31757f80ad4ad0..cc98c5312bedfb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -62,7 +62,7 @@ path = third_party/freertos/repo url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git branch = V10.3.1-kernel-only - platforms = ameba,cc13x2_26x2,bouffalolab,efr32,esp32,k32w0,infineon,qpg + platforms = ameba,cc13x2_26x2,bl602,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 @@ -284,5 +284,8 @@ branch = main platforms = genio [submodule "bouffalolab_sdk"] - path = third_party/bouffalolab/repo - url = https://github.com/bouffalolab/bl_iot_sdk_tiny.git + path = third_party/bouffalolab/repo + url = https://github.com/bouffalolab/bl_iot_sdk_tiny.git + branch = master + platforms = bouffalolab,bl602 + diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index a12fbf88c9f127..62f0246e31bb7a 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -35,9 +35,10 @@ declare_args() { # Dump memory usage at link time. chip_print_memory_usage = true - # OTA periodic query timeout in seconds - ota_periodic_query_timeout = 86400 + # PIN code for PASE session establishment. + setupPinCode = 20202021 + # Monitor & log memory usage at runtime. enable_heap_monitoring = false # OTA periodic query timeout in seconds diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index ef5b48858f4b4f..1101a90630c0d4 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -38,11 +38,9 @@ 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 board = "BL706-IoT-DVK" diff --git a/scripts/build/builders/bl602.py b/scripts/build/builders/bl602.py index f8fd4cacf32a5f..1b1f54846009f8 100644 --- a/scripts/build/builders/bl602.py +++ b/scripts/build/builders/bl602.py @@ -73,6 +73,8 @@ def __init__(self, self.app = app self.board = board + self.argsOpt.append('bouffalolab_sdk_root="%s"' % os.environ['BOUFFALOLAB_SDK_ROOT']) + def GnBuildArgs(self): return self.argsOpt + ['bl602_board="%s"' % self.board.GnArgName()] diff --git a/scripts/examples/gn_bl602_example.sh b/scripts/examples/gn_bl602_example.sh index 9ae95a0a960d2d..93caa123a0d88a 100755 --- a/scripts/examples/gn_bl602_example.sh +++ b/scripts/examples/gn_bl602_example.sh @@ -60,6 +60,7 @@ for arg; do esac done -gn gen --fail-on-unused-args --root="$EXAMPLE_DIR" "$OUTPUT_DIR" --args="${GN_ARGS[*]} custom_toolchain=\"$MATTER_ROOT/examples/platform/bouffalolab/common/toolchain:riscv_gcc\"" + +gn gen --fail-on-unused-args --root="$EXAMPLE_DIR" "$OUTPUT_DIR" --args="${GN_ARGS[*]} bouffalolab_sdk_root=\"$BOUFFALOLAB_SDK_ROOT\" custom_toolchain=\"$MATTER_ROOT/examples/platform/bouffalolab/common/toolchain:riscv_gcc\"" ninja -C "$OUTPUT_DIR" "${NINJA_ARGS[@]}" From 24fcf9ac2a533d14e0ad9c43e75ea4ad320f1ff6 Mon Sep 17 00:00:00 2001 From: wyhong Date: Wed, 30 Nov 2022 13:37:23 +0800 Subject: [PATCH 4/9] Update sdk repo for local link address duplicate --- .../bouffalolab/BL602/lwip_default_hooks.h | 17 +++++++++++++++++ third_party/bouffalolab/bl602/bl602_sdk.gni | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 src/platform/bouffalolab/BL602/lwip_default_hooks.h diff --git a/src/platform/bouffalolab/BL602/lwip_default_hooks.h b/src/platform/bouffalolab/BL602/lwip_default_hooks.h new file mode 100644 index 00000000000000..715806b5d4a0d0 --- /dev/null +++ b/src/platform/bouffalolab/BL602/lwip_default_hooks.h @@ -0,0 +1,17 @@ +#ifndef _LWIP_DEFAULT_HOOKS_H_ +#define _LWIP_DEFAULT_HOOKS_H_ +#include "lwip/arch.h" +#include "lwip/err.h" +#include "lwip/ip_addr.h" + +#ifdef CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT +extern struct netif * lwip_hook_ip6_route(const ip6_addr_t * src, const ip6_addr_t * dest); +#define LWIP_HOOK_IP6_ROUTE lwip_hook_ip6_route +#endif + +#ifdef CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT +extern const ip6_addr_t * lwip_hook_nd6_get_gw(struct netif * netif, const ip6_addr_t * dest); +#define LWIP_HOOK_ND6_GET_GW lwip_hook_nd6_get_gw +#endif + +#endif /* _LWIP_DEFAULT_HOOKS_H_ */ \ No newline at end of file diff --git a/third_party/bouffalolab/bl602/bl602_sdk.gni b/third_party/bouffalolab/bl602/bl602_sdk.gni index 5c9c2b370eb39d..afbd85304a50d9 100644 --- a/third_party/bouffalolab/bl602/bl602_sdk.gni +++ b/third_party/bouffalolab/bl602/bl602_sdk.gni @@ -121,6 +121,7 @@ template("bl602_sdk") { "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver/include", "${bl602_sdk_root}/components/network/wifi_manager/bl60x_wifi_driver", "${bl602_sdk_root}/components/network/dns_server/include", + "${bl602_sdk_root}/components/network/rfparam_adapter_tmp/rftlv", "${bl602_sdk_root}/components/platform/soc/bl602/bl602_std/bl602_std/StdDriver/Inc", "${bl602_sdk_root}/components/security/blcrypto_suite/inc/blcrypto_suite", @@ -251,6 +252,7 @@ template("bl602_sdk") { #include defines "OS_USING_FREERTOS", "BL602_MATTER_SUPPORT", + "PBUF_POOL_SIZE=20", "TD_DIAGNOSIS_STA", "CONFIG_ENABLE_IPV6_ADDR_CALLBACK", "CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT", @@ -330,6 +332,7 @@ template("bl602_sdk") { "${bl602_sdk_root}/components/stage/easyflash4/src/ef_utils.c", "${bl602_sdk_root}/components/sys/blmtd/bl_mtd.c", "${bl602_sdk_root}/components/sys/blota/bl_sys_ota_cli.c", + "${bl602_sdk_root}/components/utils/src/utils_hex.c", "${bl602_sdk_root}/components/utils/src/utils_hexdump.c", "${bl602_sdk_root}/components/utils/src/utils_sha256.c", "${chip_root}/third_party/mbedtls/repo/library/aes.c", @@ -557,6 +560,7 @@ template("bl602_sdk") { "${bl602_sdk_root}/components/utils/src/utils_rbtree.c", #rebase add + "${bl602_sdk_root}/components/network/rfparam_adapter_tmp/rftlv/phy_rftlv.c", "${bl602_sdk_root}/components/network/wifi_hosal/port/wifi_hosal_bl602.c", "${bl602_sdk_root}/components/network/wifi_hosal/wifi_hosal.c", "${bl602_sdk_root}/components/os/bl_os_adapter/bl_os_adapter/bl_os_hal.c", From d9bbdbbef8ce1eccf7e81eda98688d112dce26ea Mon Sep 17 00:00:00 2001 From: wyhong Date: Wed, 30 Nov 2022 15:52:36 +0800 Subject: [PATCH 5/9] add 2m uart log print --- .github/workflows/examples-bl602.yaml | 2 +- examples/lighting-app/bouffalolab/bl602/BUILD.gn | 4 +++- examples/lighting-app/bouffalolab/bl602/src/AppTask.cpp | 2 -- scripts/build/build/targets.py | 3 ++- scripts/build/builders/bl602.py | 6 ++++-- scripts/build/testdata/all_targets_except_host.txt | 1 + scripts/build/testdata/build_all_except_host.txt | 5 ++++- scripts/build/testdata/glob_star_targets_except_host.txt | 1 + third_party/bouffalolab/bl602/portable/bfl_main.c | 2 +- 9 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/examples-bl602.yaml b/.github/workflows/examples-bl602.yaml index a150203124e78e..59e6a44b499ab5 100644 --- a/.github/workflows/examples-bl602.yaml +++ b/.github/workflows/examples-bl602.yaml @@ -44,7 +44,7 @@ jobs: attempt_limit: 3 attempt_delay: 2000 - name: Checkout submodules - run: scripts/checkout_submodules.py --shallow --platform bouffalolab --recursive + run: scripts/checkout_submodules.py --shallow --platform bl602 --recursive - name: Set up environment for size reports if: ${{ !env.ACT }} diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index 62f0246e31bb7a..b5820d2d99845e 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -70,8 +70,8 @@ bl602_sdk("sdk") { "CONFIG_PSM_EASYFLASH_SIZE=16384", "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", "OTA_PERIODIC_QUERY_TIMEOUT=${ota_periodic_query_timeout}", + "UART_BAUDRATE=${baudrate}", ] - if (chip_enable_pw_rpc) { defines += [ "PW_RPC_ENABLED" ] } @@ -115,6 +115,8 @@ bl602_executable("lighting_app") { defines = [ "BOARD_ID=1" ] } + defines += [ "UART_BAUDRATE=${baudrate}" ] + if (show_qr_code) { sources += [ "${examples_plat_dir}/display/lcd.c" ] diff --git a/examples/lighting-app/bouffalolab/bl602/src/AppTask.cpp b/examples/lighting-app/bouffalolab/bl602/src/AppTask.cpp index cd865f515b85e4..4e8f886c5d7698 100644 --- a/examples/lighting-app/bouffalolab/bl602/src/AppTask.cpp +++ b/examples/lighting-app/bouffalolab/bl602/src/AppTask.cpp @@ -168,8 +168,6 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err; log_info("App Task entered\r\n"); - log_async_init(); - enable_async_log(); err = sWiFiNetworkCommissioningInstance.Init(); if (CHIP_NO_ERROR != err) diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 99be77b3ad7c3c..cf3cc478bab55c 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -618,7 +618,8 @@ def TizenTargets(): def Bl602Targets(): target = Target('bl602', Bl602Builder) - yield target.Extend('light', board=Bl602Board.BL602BOARD, app=Bl602App.LIGHT) + yield target.Extend('light', board=Bl602Board.BL602BOARD, app=Bl602App.LIGHT, baudrate=115200) + yield target.Extend('light-2m-uart', board=Bl602Board.BL602BOARD, app=Bl602App.LIGHT, baudrate=2000000) def BouffalolabTargets(): diff --git a/scripts/build/builders/bl602.py b/scripts/build/builders/bl602.py index 1b1f54846009f8..c6211b6a192758 100644 --- a/scripts/build/builders/bl602.py +++ b/scripts/build/builders/bl602.py @@ -57,7 +57,8 @@ def __init__(self, root, runner, app: Bl602App = Bl602App.LIGHT, - board: Bl602Board = Bl602Board.BL602BOARD): + board: Bl602Board = Bl602Board.BL602BOARD, + baudrate=115200): super(Bl602Builder, self).__init__( root=os.path.join(root, 'examples', app.ExampleName(), 'bouffalolab', 'bl602'), @@ -72,11 +73,12 @@ def __init__(self, self.app = app self.board = board + self.baudrate = baudrate self.argsOpt.append('bouffalolab_sdk_root="%s"' % os.environ['BOUFFALOLAB_SDK_ROOT']) def GnBuildArgs(self): - return self.argsOpt + ['bl602_board="%s"' % self.board.GnArgName()] + return self.argsOpt + ['bl602_board="%s"' % self.board.GnArgName()] + ['baudrate=%d' % self.baudrate] def build_outputs(self): items = { diff --git a/scripts/build/testdata/all_targets_except_host.txt b/scripts/build/testdata/all_targets_except_host.txt index 039d833eb36fcf..5f0ace02087a71 100644 --- a/scripts/build/testdata/all_targets_except_host.txt +++ b/scripts/build/testdata/all_targets_except_host.txt @@ -18,6 +18,7 @@ android-x64-tv-server android-x86-chip-tool android-x86-tv-server bl602-light +bl602-light-2m-uart bouffalolab-BL706-IoT-DVK-light bouffalolab-BL706-IoT-DVK-light-rpc bouffalolab-BL706-NIGHT-LIGHT-light diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index 401f68cedf0f17..58425d96df3d60 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -149,7 +149,10 @@ gn gen --check --fail-on-unused-args {out}/android-x86-tv-server '--args=target_ bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null' # Generating bl602-light -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl602 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" bl602_board="BL-HWC-G1"' {out}/bl602-light +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl602 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" bl602_board="BL-HWC-G1" baudrate="115200"' {out}/bl602-light + +# Generating bl602-light-2m-uart +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl602 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" bl602_board="BL-HWC-G1" baudrate="2000000"' {out}/bl602-light-2m-uart # Generating bouffalolab-BL706-IoT-DVK-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl702 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" board="BL706-IoT-DVK" module_type="BL706C-22"' {out}/bouffalolab-BL706-IoT-DVK-light diff --git a/scripts/build/testdata/glob_star_targets_except_host.txt b/scripts/build/testdata/glob_star_targets_except_host.txt index c5db6a27cb177c..51dec0a388eebf 100644 --- a/scripts/build/testdata/glob_star_targets_except_host.txt +++ b/scripts/build/testdata/glob_star_targets_except_host.txt @@ -18,6 +18,7 @@ android-x64-tv-server android-x86-chip-tool android-x86-tv-server bl602-light +bl602-light-2m-uart bouffalolab-BL706-IoT-DVK-light bouffalolab-BL706-IoT-DVK-light-rpc bouffalolab-BL706-NIGHT-LIGHT-light diff --git a/third_party/bouffalolab/bl602/portable/bfl_main.c b/third_party/bouffalolab/bl602/portable/bfl_main.c index 9bb2f4c9ed986f..48be367c1de810 100644 --- a/third_party/bouffalolab/bl602/portable/bfl_main.c +++ b/third_party/bouffalolab/bl602/portable/bfl_main.c @@ -35,7 +35,7 @@ #include #endif -HOSAL_UART_DEV_DECL(uart_stdio, 0, 16, 7, 115200); +HOSAL_UART_DEV_DECL(uart_stdio, 0, 16, 7, UART_BAUDRATE); extern uint8_t _heap_start; extern uint8_t _heap_size; // @suppress("Type cannot be resolved") From da8c0afcbbee22cb5d3596e9731f4daf7d6be547 Mon Sep 17 00:00:00 2001 From: wyhong Date: Wed, 30 Nov 2022 17:00:12 +0800 Subject: [PATCH 6/9] Update readme.md for toolchain installation --- examples/lighting-app/bouffalolab/README.md | 0 .../lighting-app/bouffalolab/bl602/README.md | 16 ++++++++++++++++ .../lighting-app/bouffalolab/bl702/README.md | 15 +++++++++++++++ 3 files changed, 31 insertions(+) delete mode 100644 examples/lighting-app/bouffalolab/README.md diff --git a/examples/lighting-app/bouffalolab/README.md b/examples/lighting-app/bouffalolab/README.md deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/examples/lighting-app/bouffalolab/bl602/README.md b/examples/lighting-app/bouffalolab/bl602/README.md index 1c66c73ecc5c83..d1eca72d0890a1 100644 --- a/examples/lighting-app/bouffalolab/bl602/README.md +++ b/examples/lighting-app/bouffalolab/bl602/README.md @@ -31,6 +31,22 @@ The steps in this document were validated on Ubuntu 18.04 and 20.04. source ./scripts/activate.sh ``` +- 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 the image and flash the board - Build the diff --git a/examples/lighting-app/bouffalolab/bl702/README.md b/examples/lighting-app/bouffalolab/bl702/README.md index f02b1b84758f86..ac753d97d77115 100644 --- a/examples/lighting-app/bouffalolab/bl702/README.md +++ b/examples/lighting-app/bouffalolab/bl702/README.md @@ -31,6 +31,21 @@ following boards: ```shell source scripts/activate.sh ``` +- 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 BL702 Lighting App example From a576b3efb24f3ed055b10d7be7d81139d0417c4a Mon Sep 17 00:00:00 2001 From: wyhong Date: Wed, 30 Nov 2022 17:13:22 +0800 Subject: [PATCH 7/9] Fix restyle --- scripts/examples/gn_bl602_example.sh | 1 - src/platform/bouffalolab/BL602/lwip_default_hooks.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/examples/gn_bl602_example.sh b/scripts/examples/gn_bl602_example.sh index 93caa123a0d88a..11aae92984498a 100755 --- a/scripts/examples/gn_bl602_example.sh +++ b/scripts/examples/gn_bl602_example.sh @@ -60,7 +60,6 @@ for arg; do esac done - gn gen --fail-on-unused-args --root="$EXAMPLE_DIR" "$OUTPUT_DIR" --args="${GN_ARGS[*]} bouffalolab_sdk_root=\"$BOUFFALOLAB_SDK_ROOT\" custom_toolchain=\"$MATTER_ROOT/examples/platform/bouffalolab/common/toolchain:riscv_gcc\"" ninja -C "$OUTPUT_DIR" "${NINJA_ARGS[@]}" diff --git a/src/platform/bouffalolab/BL602/lwip_default_hooks.h b/src/platform/bouffalolab/BL602/lwip_default_hooks.h index 715806b5d4a0d0..3c1d1d186c8836 100644 --- a/src/platform/bouffalolab/BL602/lwip_default_hooks.h +++ b/src/platform/bouffalolab/BL602/lwip_default_hooks.h @@ -14,4 +14,4 @@ extern const ip6_addr_t * lwip_hook_nd6_get_gw(struct netif * netif, const ip6_a #define LWIP_HOOK_ND6_GET_GW lwip_hook_nd6_get_gw #endif -#endif /* _LWIP_DEFAULT_HOOKS_H_ */ \ No newline at end of file +#endif /* _LWIP_DEFAULT_HOOKS_H_ */ From fad749b6023845904a6b3fc61aedf5ba75315d78 Mon Sep 17 00:00:00 2001 From: wyhong Date: Wed, 30 Nov 2022 19:44:50 +0800 Subject: [PATCH 8/9] update unit intergration test --- scripts/build/test.py | 1 + scripts/build/testdata/build_all_except_host.txt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/scripts/build/test.py b/scripts/build/test.py index 056d34166a40ef..37861aa2798c0a 100644 --- a/scripts/build/test.py +++ b/scripts/build/test.py @@ -47,6 +47,7 @@ def build_actual_output(root: str, out: str, args: List[str]) -> List[str]: 'NXP_K32W0_SDK_ROOT': 'TEST_NXP_K32W0_SDK_ROOT', 'IMX_SDK_ROOT': 'IMX_SDK_ROOT', 'TI_SYSCONFIG_ROOT': 'TEST_TI_SYSCONFIG_ROOT', + 'BOUFFALOLAB_SDK_ROOT': 'TEST_BOUFFALOLAB_SDK_ROOT', }) retval = subprocess.run([ diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index 58425d96df3d60..1f38cdc6536921 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -1580,6 +1580,9 @@ cp {out}/android-x86-tv-server/lib/TvApp.jar {root}/examples/tv-app/android/App/ # Building bl602-light ninja -C {out}/bl602-light +# Building bl602-light-2m-uart +ninja -C {out}/bl602-light-2m-uart + # Building bouffalolab-BL706-IoT-DVK-light ninja -C {out}/bouffalolab-BL706-IoT-DVK-light From c66321e642c5645a74df846d776a60f61f9e0b2a Mon Sep 17 00:00:00 2001 From: wyhong Date: Wed, 30 Nov 2022 20:10:17 +0800 Subject: [PATCH 9/9] fix unit intergration test --- scripts/build/testdata/build_all_except_host.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index 1f38cdc6536921..0a6f07f064b817 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -149,19 +149,19 @@ gn gen --check --fail-on-unused-args {out}/android-x86-tv-server '--args=target_ bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null' # Generating bl602-light -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl602 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" bl602_board="BL-HWC-G1" baudrate="115200"' {out}/bl602-light +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl602 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" bouffalolab_sdk_root="TEST_BOUFFALOLAB_SDK_ROOT" bl602_board="BL-HWC-G1" baudrate=115200' {out}/bl602-light # Generating bl602-light-2m-uart -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl602 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" bl602_board="BL-HWC-G1" baudrate="2000000"' {out}/bl602-light-2m-uart +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl602 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" bouffalolab_sdk_root="TEST_BOUFFALOLAB_SDK_ROOT" bl602_board="BL-HWC-G1" baudrate=2000000' {out}/bl602-light-2m-uart # Generating bouffalolab-BL706-IoT-DVK-light -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl702 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" board="BL706-IoT-DVK" module_type="BL706C-22"' {out}/bouffalolab-BL706-IoT-DVK-light +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl702 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" board="BL706-IoT-DVK" module_type="BL706C-22" bouffalolab_sdk_root="TEST_BOUFFALOLAB_SDK_ROOT"' {out}/bouffalolab-BL706-IoT-DVK-light # Generating bouffalolab-BL706-IoT-DVK-light-rpc -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl702 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" board="BL706-IoT-DVK" module_type="BL706C-22" import("//with_pw_rpc.gni")' {out}/bouffalolab-BL706-IoT-DVK-light-rpc +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl702 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" board="BL706-IoT-DVK" module_type="BL706C-22" import("//with_pw_rpc.gni") bouffalolab_sdk_root="TEST_BOUFFALOLAB_SDK_ROOT"' {out}/bouffalolab-BL706-IoT-DVK-light-rpc # Generating bouffalolab-BL706-NIGHT-LIGHT-light -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl702 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" board="BL706-NIGHT-LIGHT" module_type="BL702"' {out}/bouffalolab-BL706-NIGHT-LIGHT-light +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/bouffalolab/bl702 '--args=custom_toolchain="{root}/../../examples/platform/bouffalolab/common/toolchain:riscv_gcc" board="BL706-NIGHT-LIGHT" module_type="BL702" bouffalolab_sdk_root="TEST_BOUFFALOLAB_SDK_ROOT"' {out}/bouffalolab-BL706-NIGHT-LIGHT-light # Generating cc13x2x7_26x2x7-all-clusters gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/cc13x2x7_26x2x7 '--args=ti_sysconfig_root="TEST_TI_SYSCONFIG_ROOT"' {out}/cc13x2x7_26x2x7-all-clusters