初稿于2022-03-09,记录matter调试的过程和坑
未完待续
ot-rcp build
-
安装SimplicityStudio_v5
-
下载SDK
-
创建ot-rcp-mg21-usbstick工程
-
添加LED模块
-
修改代码->开机开灯
-
添加头文件路径
-
修改ld文件的memory划分
-
编译工程
-
使用commander工具生成可下载的gbl文件
fw_upgrade_utility build
-
安装开发环境
sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev \ libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \ python3-pip unzip libgirepository1.0-dev libcairo2-dev cmake git
-
解压缩usbstick_fw_upgrade_util_v0.2.tar.bz2
-
在源码目录fw_upgrade_util创建git
cd fw_upgrade_util && git init
-
把源码上传到本地git
git add . && git commit -m "Add source code"
第3第4步是防止第6步的时候生成的CMakeFiles/fw_upgrade.dirflags.make中,GIT_SHA1出现乱码导致编译错误。
-
创建build目录
rm -rf build && mkdir build
-
cmake初始化
cd build && cmake ..
-
编译
cmake --build .
-
安装
sudo cmake --install .
-
更新ld环境
sudo ldconfig
这步是防止fw_upgrade_utility找不到动态库libfw_upgrade.so
otbr build
-
链接openthread到ot-br-posix
cd ~/SimplicityStudio/SDKs/gecko_sdk cd util/third_party/ot-br-posix cd third_party/openthread ln -s ../../../openthread repo
-
运行bootstrap
cd ~/SimplicityStudio/SDKs/gecko_sdk cd util/third_party/ot-br-posix chmod +x script/* sudo ./script/bootstrap
-
运行setup
cd ~/SimplicityStudio/SDKs/gecko_sdk cd util/third_party/ot-br-posix sudo INFRA_NAME=wlp3s0 ./script/setup
INFRA_NAME的值设置为本地的网卡,可以用ifconfig查看。
ifconfig wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.131 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::a01:c1e8:fc6e:da8b prefixlen 64 scopeid 0x20<link> ether 18:47:3d:1b:18:5d txqueuelen 1000 (以太网) RX packets 585438 bytes 274825781 (274.8 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 241366 bytes 61419349 (61.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
-
修改/etc/default/otbr-agent
# Default settings for otbr-agent. This file is sourced by systemd # Options to pass to otbr-agent OTBR_AGENT_OPTS="-I wpan0 -B wlp3s0 spinel+hdlc+uart:///dev/ttyUSB0?uart-baudrate=115200"
其中 -B参数是上一步的INFRA_NAME参数,uart口根据本地情况修改串口号。
-
开启otbr服务
sudo systemctl start otbr-agent.service
可以通过syslog查看服务开启log
tail -f /var/log/syslog
-
检测host 和 RCP通讯
sudo ot-ctl state
if connection good, it will print:
disabled Doneif connection failed, it will print:
connect session failed: No such file or directoryCheck the ot-br-posix version using ot-ctl CLI command: e.g.
sudo ot-ctl version OPENTHREAD/9f9e63a2-dirty; POSIX; Dec 23 2021 13:57:23 DoneCheck the ot-rcp firmware version using ot-ctl CLI command, e.g.
sudo ot-ctl rcp version SL-OPENTHREAD/2.0.0.0_GitHub-9dedd1869; EFR32; Dec 22 2021 14:57:18 Done
-
停止otbr服务(选做)
sudo systemctl stop otbr-agent.service
chip_tool build
-
下载源码
git clone --recurse-submodules git@github.com:project-chip/connectedhomeip.git
-
安装必要工具
sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev \ libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \ python3-pip unzip libgirepository1.0-dev libcairo2-dev
-
打开编译环境
source scripts/activate.sh
如果提示环境没有更新,可运行
source scripts/bootstrap.sh
-
编译
source scripts/activate.sh gn gen out/host ninja -C out/host
-
编译成功后,在out/host/可以找到chip_tool工具