环境
系统:Ubuntu22.04 WSL
WSL中系统安装过程不展开,网上资料很多,可以自行搜索。
修改软件仓库地址,安装git
sudo sed -i 's#http://arhive.ubuntu.com#https://mirrors.ustc.edu.cn#g' /etc/apt/source.list
sudo sed -i 's#http://security.ubuntu.com#https://mirrors.ustc.edu.cn#g' /etc/apt/source.list
sudo apt update
sudo apt install git
下载代码
mkdir openthread && cd openthread
git clone https://github.com/openthread/ot-kw41z.git
cd ot-kw41z
git submodule update --init
初始化开发环境
./script/bootstrap
通过此命令会安装依赖的软件包及相关工具。
编译代码
./script/build
编译完成之后会得到一下日志:
+ ninja
[1/929] cd /home/abc/work/openthread/ot-kw41z/build/op.../work/openthread/ot-kw41z/openthread/etc/cmake/print.cmake
OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1
OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1
OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3
OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=1
OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=1
PACKAGE_NAME=OPENTHREAD
OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1
OPENTHREAD_PLATFORM_CORE_CONFIG_FILE=openthread-core-kw41z-config.h
OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=openthread-core-kw41z-config-check.h
[929/929] Linking CXX executable bin/ot-cli-ftd
+ cd /home/abc/work/openthread/ot-kw41z
在build/bin目录下看下很多bin文件。
~/work/openthread/ot-kw41z$ ls build/bin/
ot-cli-ftd ot-test-dso ot-test-mac-frame ot-test-serial-number
ot-cli-mtd ot-test-ecdsa ot-test-macros ot-test-smart-ptrs
ot-cli-radio ot-test-flash ot-test-meshcop ot-test-spinel
ot-ncp-ftd ot-test-frame-builder ot-test-message ot-test-spinel-buffer
ot-ncp-mtd ot-test-hdlc ot-test-message-queue ot-test-spinel-decoder
ot-rcp ot-test-heap ot-test-mle ot-test-spinel-encoder
ot-test-address-sanitizer ot-test-heap-array ot-test-multicast-listeners-table ot-test-srp-adv-proxy
ot-test-aes ot-test-heap-string ot-test-nat64 ot-test-srp-server
ot-test-array ot-test-hkdf-sha256 ot-test-ndproxy-table ot-test-string
ot-test-binary-search ot-test-hmac-sha256 ot-test-netif ot-test-timer
ot-test-checksum ot-test-ip-address ot-test-network-data ot-test-tlv
ot-test-child ot-test-ip4-header ot-test-network-name ot-test-toolchain
ot-test-child-table ot-test-ip6-header ot-test-pool ot-test-trickle-timer
ot-test-cmd-line-parser ot-test-link-metrics-manager ot-test-power-calibration ot-test-url
ot-test-data ot-test-link-quality ot-test-priority-queue
ot-test-dns ot-test-linked-list ot-test-pskc
ot-test-dns-client ot-test-lowpan ot-test-routing-manager
生产烧录文件:
~/work/openthread/ot-kw41z$ cd build/bin/
~/work/openthread/ot-kw41z/build/bin$ arm-none-eabi-objcopy -O binary ot-cli-ftd ot-cli-ftd.bin
烧录测试
接入开发板,将ot-cli_ftd.bin复制进开发板的虚拟大容量存储盘进行程序烧写
然后通过终端软件打开对应的串口,就可以进行设备控制了。
> version
OPENTHREAD/thread-reference-20230706-380-gb9dcdbca4; KW41Z; Mar 3 2024 13:56:13
Done
>
|