使用命令行工具
AliOS Things 在命令行中使用 aos-cube 工具完成系统编译构建,参数以 app@board
的形式组建出构建目标。
配置环境
您可以尝试一键安装脚本Setup Script for Linux/Mac, 或者按以下命令手动安装依赖的软件包 例:在一台 Ubuntu 16.04 LTS (Xenial Xerus) 64-bit PC 上
sudo apt-get install -y python
sudo apt-get install -y gcc-multilib
sudo apt-get install -y libssl-dev libssl-dev:i386
sudo apt-get install -y libncurses5-dev libncurses5-dev:i386
sudo apt-get install -y libreadline-dev libreadline-dev:i386
sudo apt-get install -y python-pip
sudo apt-get install -y minicom
安装 aos-cube
首先, 用 python 包管理器 pip
来安装 aos-cube
在全局环境,以便于后续使用 AliOS Things Studio 进行开发。
$ pip install setuptools
$ pip install wheel
$ pip install aos-cube
!> 请确认pip
环境是基于 Python 2.7 的。如果遇到权限问题,可能需要 sudo
来执行。
下载代码并编译运行
git clone https://github.com/alibaba/AliOS-Things.git
cd AliOS-Things
aos make helloworld@linuxhost
./out/helloworld@linuxhost/binary/helloworld@linuxhost.elf
效果
可以看见 app_delayed_action
在1秒时启动,每5秒触发一次。
$ ./out/helloworld@linuxhost/binary/helloworld@linuxhost.elf
[ 1.000]<V> AOS [app_delayed_action#9] : app_delayed_action:9 app
[ 6.000]<V> AOS [app_delayed_action#9] : app_delayed_action:9 app
[ 11.000]<V> AOS [app_delayed_action#9] : app_delayed_action:9 app
[ 16.000]<V> AOS [app_delayed_action#9] : app_delayed_action:9 app
Last updated