SimonLiu的ESP8266与AliOS Things 学习教程系列之十:AliOS Things 2.1.0之helloworld

版权声明:本文为博主(SimonLiu)原创文章,未经博主允许不得转载。 https://blog.csdn.net/toopoo/article/details/88563534

欢迎加入交流群: ESP8266 AliOS Things 群 号: 107723112
系列文章目录:
SimonLiu的ESP8266与AliOS Things 学习教程系列目录

由于AliOS Things 2.1.0的新特性,项目编译方式和配置和以前不太一样,所以SimonLiu重新写一遍helloworld的教程,顺便把uart打印的设置也重新写一下。

截至2019.3.14日:

  1. 首先底部工具栏编译按钮所编译的项目,仍然以工具栏选择的项目和目标平台为准。与配置文件无关。
  2. aos make menuconfig生成的配置文件是AliOS Things主目录下的.config文件,运行aos make命令编译的项目以配置文件.config中的设置为准,与工具栏的项目和目标平台选择无关。此命令不一定能在项目文件夹内运行,此时退回上一级目录即可。终端窗口最小为19行80列。
  3. 本文目标:
  • 编译helloword@esp8266项目
  • 打印输出到UART1,波特率74880

3.1 升级aos-cube0.3.1版本
升级:pip install --upgrade aos-cube
查看版本: aos --version

3.2 打开app/example/helloworld/helloworld.c

3.3 添加头文件
#include "driver/uart.h"

3.4 application_start()添加如下内容

    uart_config_t uartConfig;
    uartConfig.baud_rate = 74880; 
    uart_dev_t uart;
    uart.port = 1; 
    uart.config = uartConfig;
    hal_uart_init(&uart);

3.5 终端运行

aos make helloworld@esp8266 -c config
aos make && aos upload

猜你喜欢

转载自blog.csdn.net/toopoo/article/details/88563534