https://github.com/ambiot/ambz2_matter/blob/main/CHANGELOG.md
Tested on Ubuntu 20.04 and above
Create and enter new directory
mkdir dev
cd dev
To check out AmebaZ2 repository:
git clone --recurse-submodules https://github.com/ambiot/ambz2_matter.git
To check out Matter repository:
git clone --recurse-submodules https://github.com/project-chip/connectedhomeip
Make sure ambz2_matter and connectedhomeip are on the same directory level
dev/
├── ambz2_matter
└── connectedhomeip
> Find more details to setup linux build environment
> https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/BUILDING.md
cd connectedhomeip
source scripts/bootstrap.sh
source scripts/activate.sh
cd ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE
make all_clusters
cd ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE
make light
cd ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE
make switch
cd ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE
make otar
output : ambz2_matter/component/soc/realtek/8710c/misc/bsp/lib/common/GCC
> libCHIP.a
output : ambz2_matter/component/soc/realtek/8710c/misc/bsp/lib/common/GCC
> lib_main.a
cd ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE
make is_matter
make clean_matter_libs
make clean_matter
To use BLE Mesh with Matter, uncomment the following in platform_opts_bt.h
BT_MATTER_MESH_ADAPTER = 1
The generated image is found in ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE/application_is/Debug/bin/flash_is.bin
Method 1:
Method 2 (using image tool and flashing script):
Matter task will auto start after reset the device.
Use standalone chip-tool app(linux) to communicate with the device.
In order to send commands to a device, the device must be commissioned into the Matter network. The configuration state for chip-tool is stored in /tmp/chip_tool_config.ini
; deleting this and other .ini
files in /tmp
can sometimes resolve issues due to stale configuration.
./chip-tool pairing ble-wifi <NODE_ID> <SSID> <PASSWORD> 20202021 3840
./chip-tool pairing ble-wifi 12344321 testssid password 20202021 3840
ATW0, ATW1, ATWC
commands./chip-tool pairing onnetwork <NODE_ID> 20202021
./chip-tool pairing onnetwork 12344321 20202021
Use PA_20 as output, connect a LED to this pin and GND.
Run CHIP-TOOL on-off cluster command ./chip-tool onoff on 12344321 1
Run CHIP-TOOL on-off cluster command ./chip-tool onoff off 12344321 1
Find more detail in chip-tool
cd android-studio/bin
and run ./studio.sh
~/Android/Sdk
.Run the following commands
cd connectedhomeip/
source script/bootstrap.sh
export ANDROID_HOME=~/Android/Sdk
export ANDROID_NDK_HOME={path to android-ndk-r21e}
Target CPU
TARGET_CPU
can have the following values, depending on your smartphone CPU
architecture:
ABI | TARGET_CPU |
---|---|
armeabi-v7a | arm |
arm64-v8a | arm64 |
x86 | x86 |
x86_64 | x64 |
Complete the following steps to prepare the Matter build:
Check out the Matter repository.
Run bootstrap (only required first time)
source scripts/bootstrap.sh
Choose how you want to build the Android CHIPTool. There are two ways: from script, or from source within Android Studio.
This is the simplest option. In the command line, run the following command from the top CHIP directory:
./scripts/build/build_examples.py --target android-arm64-chip-tool build
Note: It has been noticed that this step may fail on the first try, but running the second time will successfully build the apk.
See the table above for other values of TARGET_CPU
.
The debug Android package app-debug.apk
will be generated at
out/android-$TARGET_CPU-chip-tool/outputs/apk/debug/
, and can be installed
with
adb install out/android-$TARGET_CPU-chip-tool/outputs/apk/debug/app-debug.apk
You can use Android Studio to edit the Android CHIPTool app itself and run it
after build_examples.py, but you will not be able to edit Matter Android code
from src/controller/java
, or other Matter C++ code within Android Studio.
This option allows Android Studio to build the core Matter code from source, which allows us to directly edit core Matter code in-IDE.
In the command line, run the following command from the top Matter directory:
TARGET_CPU=arm64 ./scripts/examples/android_app_ide.sh
See the table above for other values of TARGET_CPU
.
Modify the matterSdkSourceBuild
variable to true, matterBuildSrcDir
point
to the appropriate output directory (e.g. ../../../../out/android_arm64
),
and matterSourceBuildAbiFilters
to the desired ABIs in
src/android/CHIPTool/gradle.properties
3) Open the project in Android Studio and run Sync Project with Gradle Files.
4) Use one of the following options to build an Android package:
- Click **Make Project** in Android Studio.
- Run the following command in the command line:
```shell
cd src/android/CHIPTool
./gradlew build
```
The debug Android package app-debug.apk
will be generated at
src/android/CHIPTool/app/build/outputs/apk/debug/
, and can be installed with
adb install src/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk
or
(cd src/android/CHIPTool && ./gradlew installDebug)
Note: The QR code will be provided when booting, for example:
chip[SVR] SetupQRCode: [MT:-24J042C00KA0648G00]
chip[SVR] Copy/paste the below URL in a browser to see the QR Code:
chip[SVR] https://dhrishi.github.io/connectedhomeip/qrcode.html?data=MT%3A-24J042C00KA0648G00
Copy/paste the URL in a browser and a scannable QR code will be displayed.