這篇文章不僅僅針對(duì)于AliOS things的開(kāi)發(fā),也同時(shí)推薦給經(jīng)常需要在linux下編譯東西,但是辦公上又離不開(kāi)windows的同學(xué).
以往我們要在windows平臺(tái)上進(jìn)行l(wèi)inux編譯,我們一般會(huì)采用,以下的一些解決方案
1.安裝vmware或者vbox之類(lèi)的虛擬機(jī)
2.Docker和1方案類(lèi)似
3.Cygwin和MinGW的模擬環(huán)境
這些方案雖然都能解決問(wèn)題,但是開(kāi)發(fā)體驗(yàn)我認(rèn)為不是太友好,如需要配置網(wǎng)絡(luò)環(huán)境,資源文件共享,分配資源等設(shè)置,尤其是與宿主系統(tǒng)的交互
因此我推薦windows子系統(tǒng)的方案來(lái)解決此類(lèi)問(wèn)題
Linx環(huán)境準(zhǔn)備
第1步:
開(kāi)啟系統(tǒng)子系統(tǒng)


第2步:


第3步:
啟動(dòng)后設(shè)置密碼,看到熟悉的命令行界面了:

但重點(diǎn)是在這:
你可以在你windows任意文件夾內(nèi),按住shift+右鍵來(lái)調(diào)出shell,然后執(zhí)行l(wèi)inux命令,非常便利,執(zhí)行l(wèi)inux命令就和執(zhí)行cmd命令沒(méi)有任何區(qū)別


解決系統(tǒng)問(wèn)題后,接下來(lái)配置Alios thing環(huán)境
編譯HelloWorld
老規(guī)矩,linux下更新源
vi /etc/apt/sources.list
寫(xiě)入以下阿里源
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse?
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse?
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse?
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse?
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse?
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse?
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse?
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse?
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse?
deb http://archive.canonical.com/ubuntu/ xenial partner?deb http://extras.ubuntu.com/ubuntu/ xenial main
更新
sudo apt-get update
第1步:
安裝python等環(huán)境工具
sudo apt install python
sudo apt install python-pip
配置pip源
mkdir ~/.pip && vi ~/.pip/pip.conf
[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/
更新
pip install --upgrade pip
安裝aos相關(guān)工具
pip install setuptools
pip install wheel
pip install aos-cube
ps:如果工具安裝不上,請(qǐng)給相應(yīng)路徑授權(quán)后再安裝
安裝成功后,輸入aos可以輸出如下結(jié)果

第2步:
從git獲取Alios代碼(大小200+M)
地址:https://github.com/alibaba/AliOS-Things
或者:https://gitee.com/alios-things/AliOS-Things? (下載快)
解壓,或者clone到本地

我以我手頭esp8266的mcu為例
aos make helloworld@esp8266

編譯完成后,輸出目錄下找到編譯好的東西

第3步:
燒錄固件以8266為例子
先去官網(wǎng)下載燒錄工具
https://www.espressif.com/zh-hans/support/download/other-tools
選擇圖中相應(yīng)的文件,進(jìn)行燒錄

燒錄完成后,用串口工具設(shè)定波特率為?921600 ,后可以看到輸出日志