项目编译
选择项目
TuyaOpen 中,可编译项目可在 apps
、example
中进行选择。
这里以 switch_demo
为例。首先,进入项目目录。
cd apps/tuya_cloud/switch_demo
配置项目
使用命令 tos.py config choice
对项目进行配置。
该命令会提供已经验证过的配置选项,您可根据自己的硬件设备进行选择。
❯ tos.py config choice
[INFO]: Running tos.py ...
[INFO]: Fullclean success.
--------------------
1. LN882H.config
2. EWT103-W15.config
3. Ubuntu.config
4. ESP32-C3.config
5. ESP32-S3.config
6. ESP32.config
7. T3.config
8. T5AI.config
9. T2.config
10. BK7231X.config
--------------------
Input "q" to exit.
Choice config file:
这里以涂鸦 T5 系列开发板为例,需要选择 T5AI.config
。
编译产物
编译项目,使用命令 tos.py build
。
❯ tos.py build
...
[INFO]: ******************************
[INFO]: /xxx/TuyaOpen/apps/tuya_cloud/switch_demo/.build/bin/switch_demo_QIO_1.0.0.bin
[INFO]: ******************************
[INFO]: ******* Build Success ********
[INFO]: ******************************
清理产物
清理编译缓存,使用命令 tos.py clean
或 tos.py clean -f
(深度清理)。
❯ tos.py clean -f
[INFO]: Running tos.py ...
[INFO]: Fullclean success.
常见问题
在Windows环境中编译缓慢
现象是每个文件的编译速度可能长达3s左右,有时甚至会卡在某个文件。
解决办法:
-
可通过
Ctrl + Shift + Esc
打开任务管理器,查看CPU的进程,找到MSPCManagerService
进程,并关闭; -
如果上述方法仍不见效,可将整个
TuyaOpen
目录放在非系统盘(如D盘)下,并将目录添加到Windows安中心-病毒和防护
设置中的排除项
中。