Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bouffalolab] Update Bouffalo Lab IOT SDK #29885

Merged
merged 5 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions examples/lighting-app/bouffalolab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,33 @@ Mac OS.

## Build CHIP Lighting App example

The following steps take examples for `BL602-IoT-Matter-V1` bl602 board, BL706
develop `XT-ZB6-DevKit` and `BL706DK` bl706 board, and `BL704LDK` BL704L board .
The following steps take examples for `BL602-IoT-Matter-V1` BL602 board,
`BL706DK` BL706 board, and `BL704LDK` BL704L board .

- 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-bl704ldk-light build
./scripts/build/build_examples.py --target bouffalolab-bl706dk-light build
./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-ethernet build
./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-wifi build
./scripts/build/build_examples.py --target bouffalolab-bl704ldk-light build
```

- Build lighting app with UART baudrate 115200

```
./scripts/build/build_examples.py --target bouffalolab-bl602-iot-matter-v1-light-115200 build
./scripts/build/build_examples.py --target bouffalolab-xt-zb6-devkit-light-115200 build
./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-light-115200 build
./scripts/build/build_examples.py --target bouffalolab-bl704ldk-light-light-115200 build
```

- Build lighting app with RPC enabled and UART baudrate 115200.

```
./scripts/build/build_examples.py --target bouffalolab-bl602-iot-matter-v1-light-rpc build
./scripts/build/build_examples.py --target bouffalolab-xt-zb6-devkit-light-rpc build
./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-light-rpc build
./scripts/build/build_examples.py --target bouffalolab-bl704ldk-light-light-rpc build
```

### Build options with build_examples.py
Expand Down Expand Up @@ -165,27 +167,27 @@ develop `XT-ZB6-DevKit` and `BL706DK` bl706 board, and `BL704LDK` BL704L board .
- 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`, `xt-zb6-devkit` and `bl704ldk` without
additional build options
- `bl602-iot-matter-v1`, `bl706dk` and `bl704ldk` without additional
build options

```shell
./out/bouffalolab-bl602-iot-matter-v1-light/chip-bl602-lighting-example.flash.py --port /dev/ttyACM0
./out/bouffalolab-xt-zb6-devkit-light/chip-bl702-lighting-example.flash.py --port /dev/ttyACM0
./out/bouffalolab-bl706dk-light/chip-bl702-lighting-example.flash.py --port /dev/ttyACM0
./out/bouffalolab-bl704ldk-light/chip-bl702l-lighting-example.flash.py --port /dev/ttyACM0
```

- `xt-zb6-devkit` with 115200 baudrate setting
- `bl706dk` with 115200 baudrate setting

```shell
./out/bouffalolab-xt-zb6-devkit-light-115200/chip-bl702-lighting-example.flash.py --port /dev/ttyACM0
./out/bouffalolab-bl706dk-light-115200/chip-bl702-lighting-example.flash.py --port /dev/ttyACM0
```

- To wipe out flash and download image, please append `--erase` to the
above command.

```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-bl706dk-light-115200/chip-bl702-lighting-example.flash.py --port /dev/ttyACM0 --erase
./out/bouffalolab-bl704ldk-light/chip-bl702l-lighting-example.flash.py --port /dev/ttyACM0 --erase
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ extern "C" {
#include <hal_boot2.h>
#if CHIP_DEVICE_LAYER_TARGET_BL602
#include <wifi_mgmr_ext.h>
#elif CHIP_DEVICE_LAYER_TARGET_BL702L
#include <bl_flash.h>
#endif

#if CHIP_DEVICE_LAYER_TARGET_BL702L
Expand Down Expand Up @@ -373,9 +375,10 @@ extern "C" void app_init(void)
bl_sys_early_init();

#if CHIP_DEVICE_LAYER_TARGET_BL702L
bl_flash_init();

rom_freertos_init(256, 400);
rom_hal_init();
rom_lmac154_hook_init();
#endif

hosal_uart_init(&uart_stdio);
Expand Down
6 changes: 2 additions & 4 deletions src/platform/bouffalolab/BL702/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI

#if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET
extern "C" {
#include <eth_bd.h>
}
#include "EthernetInterface.h"
#endif // CHIP_DEVICE_CONFIG_ENABLE_ETHERNET

namespace chip {
Expand All @@ -45,7 +43,7 @@ CHIP_ERROR ConfigurationManagerImpl::GetPrimaryMACAddress(MutableByteSpan buf)
if (buf.size() != ConfigurationManager::kPrimaryMACAddressLength)
return CHIP_ERROR_INVALID_ARGUMENT;

eth_get_mac(buf.data());
memcpy(buf.data(), deviceInterface_getNetif()->hwaddr, ConfigurationManager::kPrimaryMACAddressLength);

return CHIP_NO_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/bouffalolab/BL702/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern "C" {
namespace chip {
namespace DeviceLayer {

extern "C" void bl_rand_stream(unsigned char *, int);
extern "C" int bl_rand_stream(unsigned char *, int);

static int app_entropy_source(void * data, unsigned char * output, size_t len, size_t * olen)
{
Expand Down
2 changes: 1 addition & 1 deletion src/platform/bouffalolab/BL702L/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ 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" int 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)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/bouffalolab/common/SystemPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ struct ChipDeviceEvent;
#define CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE const struct ::chip::DeviceLayer::ChipDeviceEvent *

// #define CHIP_CONFIG_SHA256_CONTEXT_SIZE sizeof(bl_sha_ctx_t)
#define CHIP_CONFIG_SHA256_CONTEXT_SIZE ((1 + 5 + 18 + 16 + 16) * sizeof(unsigned int))
#define CHIP_CONFIG_SHA256_CONTEXT_SIZE ((7 + 1 + 5 + 18 + 16 + 16 + 7) * sizeof(unsigned int))
8 changes: 4 additions & 4 deletions third_party/bouffalolab/bl602/bl_iot_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ template("bl_iot_sdk") {
"${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/hosal_wdg.c",
"${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_aes.c",
"${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_common.c",
"${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_ghash.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",
"${bl_iot_sdk_root}/components/platform/hosal/sec_common/bl_sec_trng.c",
]

cflags_c = [
Expand Down Expand Up @@ -454,6 +456,7 @@ template("bl_iot_sdk") {
cflags_c = [
"-Wno-shadow",
"-Wno-sign-compare",
"-Wno-incompatible-pointer-types",
]
configs += [
":${sdk_target_name}_config_hosal",
Expand Down Expand Up @@ -569,7 +572,6 @@ template("bl_iot_sdk") {
"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",
Expand Down Expand Up @@ -621,7 +623,6 @@ template("bl_iot_sdk") {
"${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",
Expand Down Expand Up @@ -866,14 +867,13 @@ template("bl_iot_sdk") {
"${bl_iot_sdk_root}/components/network/lwip/lwip-port",
"${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS",
"${bl_iot_sdk_root}/components/network/lwip/lwip-port/hook",
"${bl_iot_sdk_root}/components/network/lwip_dhcpd",
]

defines = [ "LWIP_IPV6=1" ]
}

source_set("${sdk_target_name}_lwip") {
include_dirs = [ "${bl_iot_sdk_root}/components/network/lwip_dhcpd" ]

sources = [
"${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/ethernetif.c",
"${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/sys_arch.c",
Expand Down
3 changes: 1 addition & 2 deletions third_party/bouffalolab/bl702/bl_iot_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ template("bl_iot_sdk") {
cflags_c = [
"-Wno-shadow",
"-Wno-sign-compare",
"-Wno-incompatible-pointer-types",
]
configs += [
":${sdk_target_name}_config_hosal",
Expand Down Expand Up @@ -624,7 +625,6 @@ template("bl_iot_sdk") {
"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",
Expand Down Expand Up @@ -676,7 +676,6 @@ template("bl_iot_sdk") {
"${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",
Expand Down
3 changes: 1 addition & 2 deletions third_party/bouffalolab/bl702l/bl_iot_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ template("bl_iot_sdk") {
cflags_c = [
"-Wno-shadow",
"-Wno-sign-compare",
"-Wno-incompatible-pointer-types",
]
configs += [
":${sdk_target_name}_config_bl702l_rom_a0",
Expand Down Expand Up @@ -549,7 +550,6 @@ template("bl_iot_sdk") {
"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",
Expand Down Expand Up @@ -606,7 +606,6 @@ template("bl_iot_sdk") {
"${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",
Expand Down
Loading