-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ASR] add ASR582X & ASR595X support (#26361)
* [ASR] add ASR582X & ASR595X support * Restyled * update wordlist * update asr sdk commit id * remove getenv from gni, use --args;remove asr build example script;remove DOGO wordlist;add asr submodule platforms;update copyright time to 2023 * rename ASRUtils to matter_shell to implement shell function; remove ble and ota config * update build_examples.py build support,update README --------- Co-authored-by: weicheng <[email protected]>
- Loading branch information
Showing
96 changed files
with
10,591 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,7 @@ armv | |
ASAN | ||
asdk | ||
AssertionError | ||
ASR | ||
AST | ||
ASYNC | ||
atomics | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2023 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. | ||
|
||
declare_args() { | ||
asr_ic_family = "asr582x" | ||
|
||
# Root directory for ASR SDK build files. | ||
asr_sdk_build_root = "//third_party/connectedhomeip/third_party/asr/asr582x" | ||
|
||
# Root directory for ASR toolchain. | ||
asr_toolchain_root = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright (c) 2023 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/asr.gni") | ||
import("//build_overrides/build.gni") | ||
import("//build_overrides/chip.gni") | ||
|
||
assert(asr_ic_family == "asr582x" || asr_ic_family == "asr595x", | ||
"Unsupported ASR IC: ${asr_ic_family}") | ||
|
||
if (asr_ic_family == "asr582x") { | ||
import("${build_root}/toolchain/arm_gcc/arm_toolchain.gni") | ||
_tool_name_root = "${asr_toolchain_root}arm-none-eabi-" | ||
} | ||
|
||
if (asr_ic_family == "asr595x") { | ||
import("${build_root}/toolchain/riscv_gcc/riscv_toolchain.gni") | ||
_tool_name_root = "${asr_toolchain_root}riscv-asr-elf-" | ||
} | ||
|
||
declare_args() { | ||
asr_ar = _tool_name_root + "ar" | ||
asr_cc = _tool_name_root + "gcc" | ||
asr_cxx = _tool_name_root + "g++" | ||
} | ||
|
||
gcc_toolchain("asrtoolchain") { | ||
ar = asr_ar | ||
cc = asr_cc | ||
cxx = asr_cxx | ||
|
||
toolchain_args = { | ||
current_os = "freertos" | ||
is_clang = false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2023 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. | ||
|
||
declare_args() { | ||
asr_ic_family = "asr582x" | ||
|
||
# Root directory for ASR SDK build files. | ||
asr_sdk_build_root = "//third_party/connectedhomeip/third_party/asr/asr582x" | ||
|
||
# Root directory for ASR toolchain. | ||
asr_toolchain_root = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2023 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 = "arm" | ||
|
||
target_os = "freertos" | ||
|
||
import("//args.gni") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Copyright (c) 2023 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/asr.gni") | ||
import("//build_overrides/build.gni") | ||
import("//build_overrides/chip.gni") | ||
import("${asr_sdk_build_root}/asr_sdk.gni") | ||
import("${build_root}/config/defaults.gni") | ||
import("${chip_root}/src/lib/lib.gni") | ||
import("${chip_root}/src/platform/device.gni") | ||
import("${chip_root}/third_party/asr/asr_executable.gni") | ||
|
||
import("cfg.gni") | ||
|
||
assert(current_os == "freertos") | ||
|
||
asr_project_dir = "${chip_root}/examples/lighting-app/asr" | ||
examples_plat_dir = "${chip_root}/examples/platform/asr" | ||
|
||
declare_args() { | ||
# Dump memory usage at link time. | ||
chip_print_memory_usage = false | ||
} | ||
|
||
asr_sdk_sources("lighting_app_sdk_sources") { | ||
include_dirs = [ | ||
"${chip_root}/src/platform/ASR", | ||
"${asr_project_dir}/include", | ||
"${examples_plat_dir}", | ||
] | ||
|
||
defines = [ | ||
"ASR_LOG_ENABLED=1", | ||
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", | ||
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}", | ||
] | ||
|
||
if (chip_enable_factory_data) { | ||
defines += [ | ||
"CONFIG_ENABLE_ASR_FACTORY_DATA_PROVIDER=1", | ||
"CONFIG_ENABLE_ASR_FACTORY_DEVICE_INFO_PROVIDER=1", | ||
] | ||
} | ||
|
||
if (chip_lwip_ip6_hook) { | ||
defines += [ | ||
"CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT", | ||
"CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT", | ||
] | ||
} | ||
|
||
sources = [ "${asr_project_dir}/include/CHIPProjectConfig.h" ] | ||
|
||
public_configs = [ "${asr_sdk_build_root}:asr_sdk_config" ] | ||
} | ||
|
||
asr_executable("lighting_app") { | ||
include_dirs = [] | ||
defines = [] | ||
output_name = "chip-asr-lighting-example.out" | ||
|
||
sources = [ | ||
"${examples_plat_dir}/CHIPDeviceManager.cpp", | ||
"${examples_plat_dir}/LEDWidget.cpp", | ||
"${examples_plat_dir}/init_Matter.cpp", | ||
"${examples_plat_dir}/init_asrPlatform.cpp", | ||
"${examples_plat_dir}/shell/matter_shell.cpp", | ||
"src/AppTask.cpp", | ||
"src/DeviceCallbacks.cpp", | ||
"src/main.cpp", | ||
] | ||
|
||
if (chip_enable_ota_requestor) { | ||
sources += [ "${examples_plat_dir}/init_OTARequestor.cpp" ] | ||
} | ||
|
||
deps = [ | ||
":lighting_app_sdk_sources", | ||
"${chip_root}/examples/common/QRCode", | ||
"${chip_root}/examples/lighting-app/lighting-common", | ||
"${chip_root}/examples/providers:device_info_provider", | ||
"${chip_root}/src/lib", | ||
"${chip_root}/src/setup_payload", | ||
] | ||
|
||
include_dirs += [ | ||
"include", | ||
"${examples_plat_dir}", | ||
"${asr_project_dir}/include", | ||
"${chip_root}/src/lib", | ||
] | ||
|
||
defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] | ||
|
||
if (chip_build_libshell) { | ||
defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] | ||
sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] | ||
include_dirs += [ "${examples_plat_dir}/shell" ] | ||
} | ||
|
||
if (chip_print_memory_usage) { | ||
ldflags += [ | ||
"-Wl,--print-memory-usage", | ||
"-fstack-usage", | ||
] | ||
} | ||
|
||
output_dir = root_out_dir | ||
} | ||
|
||
group("asr") { | ||
deps = [ ":lighting_app" ] | ||
} | ||
|
||
group("default") { | ||
deps = [ ":asr" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# CHIP ASR Lighting Example | ||
|
||
This example demonstrates the Matter Lighting application on ASR platform. | ||
|
||
--- | ||
|
||
- [CHIP ASR Lighting Example](#chip-asr-lighting-example) | ||
- [Supported Chips](#supported-chips) | ||
- [Building the Example Application](#building-the-example-application) | ||
- [Commissioning](#commissioning) | ||
- [BLE mode](#ble-mode) | ||
- [IP mode](#ip-mode) | ||
- [Cluster Control](#cluster-control) | ||
|
||
--- | ||
|
||
## Supported Chips | ||
|
||
The CHIP demo application is supported on: | ||
|
||
- ASR582X | ||
- ASR595X | ||
|
||
## Building the Example Application | ||
|
||
- [Setup CHIP Environment](../../../docs/guides/BUILDING.md) | ||
|
||
- Setup toolchain for ASR582X,download gcc-arm-none-eabi-9-2019-q4-major,then | ||
export `ASR_TOOLCHAIN_PATH`: | ||
``` | ||
export ASR_TOOLCHAIN_PATH={path-to-toolchain}/gcc-arm-none-eabi-9-2019-q4-major/bin/ | ||
``` | ||
for ASR595X,download asr_riscv_gnu_toolchain_10.2_ubuntu,then export | ||
`ASR_TOOLCHAIN_PATH`: | ||
``` | ||
export ASR_TOOLCHAIN_PATH={path-to-toolchain}/asr_riscv_gnu_toolchain_10.2_ubuntu-16.04/bin/ | ||
``` | ||
- Setup Chip environment | ||
- for ASR582X: | ||
``` | ||
export ASR_BOARD=asr582x | ||
``` | ||
- for ASR595X: | ||
``` | ||
export ASR_BOARD=asr595x | ||
``` | ||
- Building the Application | ||
``` | ||
./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting build | ||
``` | ||
- The output image files are stored in the subdirectories under `out`, the | ||
subdirectory name is the same as the argument specified after the option | ||
`--target` when build the examples. | ||
- After building the application, `DOGO` tool is used to flash it to the | ||
board. | ||
## Commissioning | ||
There are two commissioning modes supported by ASR platform: | ||
### BLE mode | ||
1. Build and Flash | ||
2. The example will run automatically after booting the ASR board. | ||
3. Restore factory settings using command `recovery` | ||
4. Commissioning with | ||
[Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool) | ||
### IP mode | ||
1. Build and Flash | ||
2. The example will run automatically after booting the ASR board. | ||
3. Restore factory settings using command `recovery` | ||
4. Connect to AP using command `wifi_open sta [ssid] [password]` | ||
5. Commissioning with | ||
[Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool) | ||
## Cluster Control | ||
After successful commissioning, use `chip-tool` to control the board | ||
- OnOff Cluster | ||
``` | ||
./chip-tool onoff on <NODE ID> 1 | ||
./chip-tool onoff off <NODE ID> 1 | ||
./chip-tool onoff toggle <NODE ID> 1 | ||
``` | ||
- LevelControl Cluster | ||
``` | ||
./chip-tool levelcontrol move-to-level 128 10 0 0 <NODE ID> 1 | ||
``` | ||
- ColorControl Cluster | ||
``` | ||
./chip-tool colorcontrol move-to-hue-and-saturation 240 100 0 0 0 <NODE ID> 1 | ||
``` |
Oops, something went wrong.