本帖最后由 HonestQiao 于 2022-7-3 22:33 编辑
我的日常工作环境是macos,涂鸦得开发环境,需要在Linux下面搭建。我尝试了安装arm交叉编译环境,但最终编译的时候,还是会出错,最终决定使用docker环境。
docker的基础安装,网上得文章很多,这里就不详细说明了。
在启动对应的docker环境前,先下载对应的开发文件。我使用的开发板是BK7231n,所以下载下面的代码:
git clone --recursive https://github.com/tuya/tuya-iotos-embeded-sdk-wifi-ble-bk7231n.git
下载后,启动docker服务,就可以开始编译环境的搭建了。
首先是启动一个debian容器,作为基础环境:
cd tuya-iotos-embeded-sdk-wifi-ble-bk7231n
docker run -it --name tuya -v "$(pwd):/home/bk7231n" debian /bin/bash
这个容器启动后,就会自动把开发文件目录加载到/home/kb7231n:
然后,就可以开始环境的建立了。
先进行apt更新源得切换,因为国内访问debian默认apt源速度不快,我选择使用清华源。
apt update
apt install apt-transport-https ca-certificates nano sudo
然后,使用nano将/etc/apt/source.list的原有内容注释掉,并添加新的:
nano /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20211220T000000Z bullseye main
# deb http://deb.debian.org/debian bullseye main
# deb http://snapshot.debian.org/archive/debian-security/20211220T000000Z bullseye-security main
# deb http://security.debian.org/debian-security bullseye-security main
# deb http://snapshot.debian.org/archive/debian/20211220T000000Z bullseye-updates main
# deb http://deb.debian.org/debian bullseye-updates main
# 注释上面原有的,添加下面新增的:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
设置完成后,再来一次更新即可:
apt update
apt upgrade
apt update
下面,开始编译相关依赖包的安装:
apt install -y net-tools build-essential wget git python libc6-i386
apt install -y gcc-arm-none-eabi unzip
ln -s /usr/bin/arm-none-eabi-gcc /usr/local/bin/arm-none-eabi-gcc
安装完成,就能编译了:
cd /home/bk7231n
sh build_app.sh apps/tuya_demo_template/ tuya_demo_template 1.0.0
执行编译过程中,会自动 下载:bk7231n_0.0.21.zip,并完成编译过程。
编译成功,最后会显示如下得信息: