Skip to content

Commit

Permalink
[Bouffalolab] Add BL702 Ethernet support (#27620)
Browse files Browse the repository at this point in the history
* Add BL706 ethernet support

* update sdk commit

* fix compile error

* update matter file

* fix restyle

* fix comiple error

* Add BL706 ethernet support

* update sdk commit

* fix compile error

* update matter file

* fix restyle

* fix comiple error

* fix restyle

---------

Co-authored-by: Justin Wood <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 26, 2023
1 parent 6ea4dd0 commit 2871877
Show file tree
Hide file tree
Showing 73 changed files with 1,323 additions and 1,274 deletions.
18 changes: 9 additions & 9 deletions examples/lighting-app/bouffalolab/bl602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ declare_args() {
ota_auto_reboot_delay_seconds = 5

enable_heap_monitoring = false
enable_reset_counter = false

setupPinCode = 20202021
setupDiscriminator = 3840
Expand Down Expand Up @@ -102,25 +103,28 @@ bouffalolab_executable("lighting_app") {
"SYS_AOS_LOOP_ENABLE",
]

if (false == enable_reset_counter) {
defines += [ "BOOT_PIN_RESET=8" ]
}

bl_plat_name = "bl602"
sources = [
"${examples_plat_dir}/route_hook/bl_route_hook.c",
"${examples_plat_dir}/route_hook/bl_route_table.c",
"${examples_plat_common_dir}/route_hook/bl_route_hook.c",
"${examples_plat_common_dir}/route_hook/bl_route_table.c",
]

if ("BL602-IoT-Matter-V1" == board) {
defines += [ "BL602_IoT_Matter_V1" ]
} else if ("BL602-NIGHT-LIGHT" == board) {
defines += [ "BL602_NIGHT_LIGHT" ]
} else if ("BL602-IOT-DVK-3S" == board) {
defines += [ "BL602_IOT_DVK_3S" ]
}

sources += [
"${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp",
"${example_common_dir}/AppTask.cpp",
"${example_common_dir}/ZclCallbacks.cpp",
"${examples_plat_common_dir}/plat/LEDWidget.cpp",
"${examples_plat_common_dir}/plat/OTAConfig.cpp",
"${examples_plat_common_dir}/plat/aos_task.c",
"${examples_plat_common_dir}/plat/demo_pwm.c",
"${examples_plat_common_dir}/plat/main.cpp",
Expand All @@ -140,6 +144,7 @@ bouffalolab_executable("lighting_app") {
include_dirs = [
"${chip_root}/src/platform/bouffalolab/BL602",
"${example_common_dir}",
"${examples_plat_common_dir}/route_hook",
"${examples_plat_common_dir}/plat",
"${examples_plat_dir}",
]
Expand Down Expand Up @@ -208,11 +213,6 @@ bouffalolab_executable("lighting_app") {
defines += [ "HEAP_MONITORING=1" ]
}

if (chip_enable_ota_requestor) {
defines += [ "OTA_ENABLED" ]
sources += [ "${examples_plat_common_dir}/plat/OTAConfig.cpp" ]
}

cflags_c = [ "-Wno-sign-compare" ]
ldscript = "${examples_plat_dir}/ldscripts/flash_rom.ld"

Expand Down
8 changes: 0 additions & 8 deletions examples/lighting-app/bouffalolab/bl602/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
*
* Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -107,13 +106,6 @@
*/
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION 1

/**
* 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
*
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/bouffalolab/bl602/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ 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_ota_requestor = true
chip_detail_logging = false

pw_build_LINK_DEPS = [
Expand Down
7 changes: 0 additions & 7 deletions examples/lighting-app/bouffalolab/bl602/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@
#define LED_G_PIN_PORT 1
#define LED_G_PIN 11

// comment out for last hardware
//#define LED_R_PIN_PORT 0
//#define LED_R_PIN 20
//#define LED_G_PIN 21

#define MAX_PWM_CHANNEL 3

#else
Expand All @@ -64,7 +59,5 @@

#endif

#define LED_BTN_RESET 8

#define CHIP_UART_PIN_RX 7
#define CHIP_UART_PIN_TX 16
65 changes: 41 additions & 24 deletions examples/lighting-app/bouffalolab/bl702/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ declare_args() {
config_cache_size = 8192

enable_heap_monitoring = false
enable_reset_counter = false
enable_cdc_module = false

setupPinCode = 20202021
setupDiscriminator = 3840
Expand All @@ -74,10 +76,13 @@ bl_iot_sdk("sdk") {
"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 (chip_enable_openthread) {
defines += [ "OPENTHREAD_CONFIG_PLATFORM_XTAL_ACCURACY=40" ]
}

if ("BL706C-22" == module_type) {
defines += [ "CFG_PSRAM_DUAL_BANK=1" ]
}
Expand Down Expand Up @@ -117,20 +122,20 @@ bouffalolab_executable("lighting_app") {
"START_ENTRY=bl702_main",
]

if (enable_psram) {
defines += [ "CFG_USE_PSRAM=1" ]
if (false == enable_reset_counter) {
defines += [ "BOOT_PIN_RESET=31" ]
}

if ("BL706C-22" == module_type) {
defines += [ "BOARD_BTN_BOOT_PIN" ]
if (enable_psram) {
defines += [ "CFG_USE_PSRAM=1" ]
}

if ("XT-ZB6-DevKit" == 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" ]
} else if ("BL706-ETH" == board) {
defines += [ "BL706_ETHERNET" ]
}

if (defined(enable_cdc_module) && enable_cdc_module) {
Expand All @@ -141,6 +146,7 @@ bouffalolab_executable("lighting_app") {
"${example_common_dir}/AppTask.cpp",
"${example_common_dir}/ZclCallbacks.cpp",
"${examples_plat_common_dir}/plat/LEDWidget.cpp",
"${examples_plat_common_dir}/plat/OTAConfig.cpp",
"${examples_plat_common_dir}/plat/demo_pwm.c",
"${examples_plat_common_dir}/plat/main.cpp",
"${examples_plat_common_dir}/plat/platform.cpp",
Expand All @@ -153,27 +159,38 @@ bouffalolab_executable("lighting_app") {
"${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" ]
if (chip_enable_openthread) {
deps += [
"${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd",
"${chip_root}/third_party/openthread/repo:libopenthread-ftd",
"${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",
]
}
} 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",
sources += [
"${examples_plat_common_dir}/route_hook/bl_route_hook.c",
"${examples_plat_common_dir}/route_hook/bl_route_table.c",
]
}

include_dirs = [
"${chip_root}/src/platform/bouffalolab/BL702",
"${example_common_dir}",
"${examples_plat_common_dir}/route_hook",
"${examples_plat_common_dir}/plat",
]

Expand Down Expand Up @@ -212,11 +229,16 @@ bouffalolab_executable("lighting_app") {
"${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",
]

if (chip_enable_openthread) {
deps += [
"${chip_root}/examples/common/pigweed:ot_cli_service.nanopb_rpc",
"${chip_root}/examples/common/pigweed:thread_service.nanopb_rpc",
]
}

deps += pw_build_LINK_DEPS

include_dirs += [
Expand All @@ -239,11 +261,6 @@ bouffalolab_executable("lighting_app") {
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.ld"
} else {
Expand Down
8 changes: 0 additions & 8 deletions examples/lighting-app/bouffalolab/bl702/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -101,13 +100,6 @@
#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
*
Expand Down
6 changes: 0 additions & 6 deletions examples/lighting-app/bouffalolab/bl702/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ 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 = "bl702"

chip_enable_ota_requestor = true
chip_detail_logging = false

pw_build_LINK_DEPS = [
Expand Down
19 changes: 0 additions & 19 deletions examples/lighting-app/bouffalolab/bl702/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@

#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

Expand All @@ -75,15 +66,5 @@

#endif

#if defined(BOARD_BTN_BOOT_PIN)
#define LED_BTN_RESET 31
#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
14 changes: 7 additions & 7 deletions examples/lighting-app/bouffalolab/bl702l/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ declare_args() {
config_cache_size = 8192

enable_heap_monitoring = false
enable_reset_counter = false

setupPinCode = 20202021
setupDiscriminator = 3840
Expand Down Expand Up @@ -97,6 +98,7 @@ chip_data_model("bouffalolab-lighting") {
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"
Expand All @@ -108,9 +110,11 @@ bouffalolab_executable("lighting_app") {
"START_ENTRY=bl702_main",
]

defines += [ "CFG_USE_PSRAM=1" ]
if (false == enable_reset_counter) {
defines += [ "BOOT_PIN_RESET=16" ]
}

defines += [ "BOARD_BTN_BOOT_PIN" ]
defines += [ "CFG_USE_PSRAM=1" ]

if ("BL704L" == board) {
defines += [ "XT_ZB6_DevKit" ]
Expand All @@ -124,6 +128,7 @@ bouffalolab_executable("lighting_app") {
"${example_common_dir}/AppTask.cpp",
"${example_common_dir}/ZclCallbacks.cpp",
"${examples_plat_common_dir}/plat/LEDWidget.cpp",
"${examples_plat_common_dir}/plat/OTAConfig.cpp",
"${examples_plat_common_dir}/plat/demo_pwm.c",
"${examples_plat_common_dir}/plat/main.cpp",
"${examples_plat_common_dir}/plat/platform.cpp",
Expand Down Expand Up @@ -222,11 +227,6 @@ bouffalolab_executable("lighting_app") {
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 {
Expand Down
8 changes: 0 additions & 8 deletions examples/lighting-app/bouffalolab/bl702l/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -101,13 +100,6 @@
#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
*
Expand Down
Loading

0 comments on commit 2871877

Please sign in to comment.