Skip to content

Commit

Permalink
[BEKEN] add beken platform file (#21824)
Browse files Browse the repository at this point in the history
* [BEKEN] add beken platform file

* add beken platform src file
* support examples/lighting-app
* add beken config file

* [BEKEN] change the return type of InitClock_RealTime() and update some
comments.

* [BEKEN] del obsolete interface

* del obsolete interface
* fix copyright headers (2020 -> 2022) in all files

Co-authored-by: Tao Yang <[email protected]>
Co-authored-by: cenfang <[email protected]>
  • Loading branch information
3 people authored Aug 15, 2022
1 parent bed001a commit 0528a42
Show file tree
Hide file tree
Showing 50 changed files with 6,962 additions and 4 deletions.
28 changes: 28 additions & 0 deletions config/beken/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2022 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 = "risc-v"
target_os = "freertos"

import("//args.gni")
}
28 changes: 28 additions & 0 deletions config/beken/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2022 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.

# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

#import("${chip_root}/build/chip/tests.gni")

group("beken") {
deps = [ "${chip_root}/src/lib" ]
}
group("default") {
deps = [ ":beken" ]
}
38 changes: 38 additions & 0 deletions config/beken/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2022 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.

# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

chip_device_platform = "beken"

chip_project_config_include = ""
chip_system_project_config_include = ""
chip_ble_project_config_include = ""

mbedtls_target = "//mbedtls:mbedtls"
lwip_platform = "external"

chip_build_tests = false

chip_inet_config_enable_tcp_endpoint = true
chip_inet_config_enable_udp_endpoint = true

chip_config_network_layer_ble = true
chip_config_memory_management = "platform"
chip_enable_additional_data_advertising = true
chip_enable_rotating_device_id = true
chip_enable_ota_requestor = true

custom_toolchain = "//third_party/connectedhomeip/config/beken/toolchain:beken"
1 change: 1 addition & 0 deletions config/beken/build
1 change: 1 addition & 0 deletions config/beken/build_overrides
22 changes: 22 additions & 0 deletions config/beken/mbedtls/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2022 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.

# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

import("//build_overrides/chip.gni")

# Ameba has its own mbedtls, so nothing to do, just provide a target
group("mbedtls") {
}
1 change: 1 addition & 0 deletions config/beken/third_party/connectedhomeip
36 changes: 36 additions & 0 deletions config/beken/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2022 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")
import("//build_overrides/chip.gni")

#import("${build_root}/toolchain/arm_gcc/arm_toolchain.gni")
import("${build_root}/toolchain/gcc_toolchain.gni")
declare_args() {
beken_ar = ""
beken_cc = ""
beken_cxx = ""
}

gcc_toolchain("beken") {
ar = beken_ar
cc = beken_cc
cxx = beken_cxx

toolchain_args = {
current_os = "freertos"
is_clang = false
import("${chip_root}/src/platform/Beken/args.gni")
}
}
85 changes: 85 additions & 0 deletions examples/lighting-app/beken/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Matter BEKEN Lighting Example

This example demonstrates the Matter Lighting application on BEKEN platforms.

---

- [Matter BEKEN Lighting Example](#matter-BEKEN-lighting-example)
- [Supported Devices](#supported-devices)
- [Building the Example Application](#building-the-example-application)
- [Commissioning over BLE using chip-tool](#commissioning-over-ble-using-chip-tool)

---

## Supported Devices

The demo application is intended to work on following categories of BEKEN
devices:

- BK7235 EVB

## Building the Example Application

Building the example application requires the use of the BEKEN ARMINO IoT
Development Framework ([BK-ARMINO](https://github.com/zhengyaohan/armino)).

- Setting up the build environment, recommended with Ubuntu 20.04 LTS

Armino sdk download

$ cd ~
$ git clone [email protected]:zhengyaohan/armino.git
$ git checkout matter

Toolchain
[download](http://dl.bekencorp.com/tools/toolchain/risc-v_20220418.tar.gz)
and install, the toolchain should be installed to "/opt/risc-v"

$ sudo tar xvzf {abs-path-to-download}/risc-v_20220418.tar.gz -C /opt
$ sudo mv /opt/risc-v_20220418 /opt/risc-v
$ sudo chown -R $USER:$USER /opt/risc-v


Software dependency install

$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install build-essential cmake python3 python3-pip doxygen ninja-build libc6:i386 libstdc++6:i386 libncurses5-dev lib32z1 -y
$ sudo pip3 install sphinx_rtd_theme future breathe blockdiag sphinxcontrib-seqdiag sphinxcontrib-actdiag sphinxcontrib-nwdiag sphinxcontrib.blockdiag
$ sudo ln -s /usr/bin/python3 /usr/bin/python

To activate connectedhomeip files.

$ cd {abs-path-to-connectedhomeip}
$ source ./scripts/bootstrap.sh
$ source ./scripts/activate.sh

Link connectedhomeip into ARMINO.

$ cd {abs-path-to-ARMINO}
$ ln -sfv {abs-path-to-connectedhomeip} components/matter/

- build project matter,and flash image file

$ cd {abs-path-to-ARMINO}
$ make bk7235 PROJECT=matter

the output bin file is {abs-path-to-ARMINO}/build/matter/bk7235/all-app.bin.
you can use
[WINDOWS BEKEN FLASH WRITE TOOL](http://dl.bekencorp.com:8192/tools/flash/BEKEN_WRITER_EN_V2.6.28_20220326.zip)
to flash the demo application onto the device.

## Commissioning over BLE using chip-tool

- Please build the standalone chip-tool as described [here](../../chip-tool)
- Commissioning the WiFi Lighting devices

$ ./out/debug/chip-tool pairing ble-wifi 12345 <ssid> <passphrase> 20202021 3840

## Cluster Control

After successful commissioning, use the OnOff cluster command to control the
OnOff attribute. This allows you to toggle a parameter implemented by the device
to be On or Off.

$ ./out/debug/chip-tool onoff on 12345 1
Loading

0 comments on commit 0528a42

Please sign in to comment.