簡介
硬體
下面是Haas100開發闆的簡單介紹, 詳細功能和參數可以參考HaaS100的硬體規格說明。

軟體
HaaS100搭載AliOS Things物聯網作業系統, 點選檢視
AliOS Things簡介。
環境
AliOS Things的開發環境準備, 點選檢視
開發環境安裝快速開始
下載下傳代碼
git clone https://github.com/alibaba/AliOS-Things.git -b dev_3.1.0_haas
對于國内使用者,為避免從github下載下傳速度較慢,可以從gitee上下載下傳。
git clone https://gitee.com/alios-things/AliOS-Things.git -b dev_3.1.0_haas
編譯
進入代碼的頂層目錄如AliOS-Things進行編譯。可以直接編譯application/example/目錄下的demo app,或者自己開發的app。下面以編譯helloworld_demo為例。
aos make helloworld_demo@haas100 -c config
aos make
燒錄
第一次編譯後從代碼頂層目錄拷貝platform/mcu/haas1000/release/write_flash_gui目錄下的所有檔案到windows環境。 後續再編譯可以隻替換write_flash_gui/ota_bin/ota_rtos.bin即可。
準備
給HaaS 100插上電源,在Micro USB口插上usb線并連接配接到燒錄主機。等待燒錄主機發現新插入的usb裝置并識别成序列槽。
如果您的燒錄主機沒有自動識别usb并安裝驅動, 您可以點選這裡 USB轉UART驅動 手動下載下傳對應的版本并安裝。
識别成功後,可以在計算機管理->裝置管理器中發現序列槽裝置。
開始燒錄
在windows環境下進入write_flash_gui目錄,輕按兩下運作haas1000_write_flash_main,出現燒錄軟體的主界面。
點選Port Config 按鈕,出現序列槽配置界面。
點選List按鈕,選擇HaaS100連接配接的序列槽。
選擇後,點選Ok按鈕确認關閉序列槽配置界面,此時主界面如下,燒錄狀态是Closed。
點選Start All 按鈕,進入燒錄狀态,此時燒錄狀态是Idle,等待裝置重新開機。
短按闆子上的重新開機鍵或者插拔電源對闆子上下電,開始燒錄,此時燒錄狀态是Burning,可以看到燒錄的進度。
等待燒錄成功,此時燒錄的狀态的Success,進度是100%。
點選Exit 退出即可。
序列槽列印
使用序列槽工具如Putty/SecureCRT,設定序列槽波特率1500000。
Putty設定
設定序列槽波特率1500000,并關閉Parity 和 Flow control
SecureCRT設定
設定字元編碼為UTF-8,否則列印會亂碼。
啟動log
設定好序列槽後, 重新開機裝置就可以看到AliOS Things的啟動log,和最後hello world的列印了。
1569/main | app_status_indication_set 1
1569/main | platform_init_step1 done, user_init=3, ret=0
1569/main | platform_init_step1 enter temprature cali on signal
1569/main | board_init platform_init_step1 done
1573/main_task | sys_init go
1573/main_task | sys freq calc : 320000000, wifi init 1
1573/main_task | sys_init soc_peripheral_init done
Welcome to AliOS Things
1574/main_task | sys_init aos_components_init done
1574/main_task | mesh has been opened
[Jan 01 00:00:01.482]<I>ULOG-test sys_init aos_components_init done
nano entry here!
hello world! count 0
hello world! count 1
hello world! count 2
hello world! count 3
如何點亮一個LED燈
上面看過了簡單的列印後, 我們做一個簡單的點燈實踐來練練手。
如下簡單修改application/example/helloworld_demo/appdemo.c,增加點燈的代碼。
說明:燈的編号,右邊從上到下分别是0, 1 , 2;左邊從上到下分别是3, 4, 5。 編号0是電源訓示燈,不可修改。
--- a/application/example/helloworld_demo/appdemo.c
+++ b/application/example/helloworld_demo/appdemo.c
@@ -8,6 +8,7 @@
#include "aos/init.h"
#include "board.h"
#include <k_api.h>
+#include "led.h"
int application_start(int argc, char *argv[])
{
@@ -18,6 +19,13 @@ int application_start(int argc, char *argv[])
//fd = board_lcd_create("name");
//board_lcd_write(fd,buffer,len);
+ printf("Light all the led switch of the left.\r\n");
+ /* Sleep 1 second to avoid that led switch on/off while the boad boot up. */
+ aos_msleep(1000);
+ led_switch(3,LED_ON);
+ led_switch(4,LED_ON);
+ led_switch(5,LED_ON);
+
while(1) {
printf("hello world! count %d \r\n", count++);
代碼改完後,參考上面的步驟編譯燒錄,最後啟動闆子就能看到左邊的燈都已經被點亮。
怎麼樣? 用HaaS進行開發是不是很簡單, 遠遠不止這些哦,HaaS已經做了很多簡化開發的工作, 快來動手探索一下吧。