官方文档:https://help.aliyun.com/product/123206.html
为了避免出现问题,我们把 Python3 设置为默认的:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
sudo update-alternatives --set python /usr/bin/python3.7
下载源码:
git clone https://gitee.com/alios-things/AliOS-Things.git -b rel_3.1.0
pip3 install aos-cube
创建项目:
export AOS_SDK_PATH=$PWD/AliOS-Things
# -b 板子类型 -t 模板 项目名称
aos create project -b linuxhost -t helloworld_demo myapp
编译测试(失败):
cd myapp
aos make BUILD_TYPE=debug
解决方案:注意到 AliOS-Things/platform/board/linuxhost/aos.mk
使用了 -m32
参数,因此安装 32 位开发包:
sudo apt install gcc-multilib
运行:
$ out/myapp@linuxhost/binary/myapp@linuxhost.elf
cpu num is 1
Welcome to AliOS Things
nano entry here!
hello world! count 0
hello world! count 1
hello world! count 2
hello world! count 3
hello world! count 4
hello world! count 5
旧版创建项目方法:
cd AliOS-Things
aos make helloworld@linuxhost -c config
aos make
./out/helloworld@linuxhost/binary/helloworld@linuxhost.elf
调试
-exec handle SIG34 nostop noprint
-exec handle SIGUSR1 nostop noprint
-exec handle SIGUSR2 nostop noprint