2_4_HaaS_Helloworld|学习笔记

简介: 快速学习2_4_HaaS_Helloworld。

开发者学堂课程【HaaS 物联网应用开发课程2_4_HaaS_Helloworld】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址:https://developer.aliyun.com/learning/course/801/detail/13822


2_4_HaaS_Helloworld

 

内容介绍

下载源代码

目录结构简介

helloword_deom 源代码编译及烧录

helloword_deom 历程演示

helloword_deom 代码修改及演示

 

一、下载源代码

1登录 docker 环境

image.png

2粘贴下面代码,下载源代码:

git clone https://gitee.com/alios-things/AliOS-Thing.git -b

dev_3.1.0haas

image.png

下载源代码后,窗口如下

image.png

3输入ls,在 workspace/experiment 窗口生成 一个名为AliOS-Things 的新目录

image.png

4通过 web 的 ID 打开 AliOS-Things 目录

image.png

5复制路径

/workspace/experiment/AliOS-Things# 在AliOS-Studio web的登录页面上把 folder= 后的路径替换

未替换窗口如下

image.png

替换后窗口如下

image.png

二、目录结构简介

本节课程学习的 helloworld_deom 是在 application 下的 example 中。

helloworld_deom 目录下有 aos.mk 文件,aos.mk 文件有源文件 appdemo.c  和 maintask.c。

appdemo.c 中只有一个 application_start 函数,application_start 是 AliOS-Things 应用程序的入口,类似 linux 中 main 函数。在应用开发时,在 application_start 中呼叫自定义功能的 aipia,呼叫 aipia 之后编译烧录,操作系统启动之后会自动运行 aipia 中的功能。

appdemo.c源文件

image.png

maintask.c中函数 aos_maintask 呼叫 application_start 函数,

在呼叫 application_start 函数之前会呼叫 board_init(); 函数 board_kInit_init(&kinit); 函数 aos_components_init(&kinit); 函数。board_init(); 函数 和 board_kInit_init(&kinit); 函数是用来初始化。aos_components_init(&kinit); 函数是 AliOS-Things 中基础组件的 aipia。

例如文件系统等等都是在 aos_components_init

(&kinit); 函数中初始化的。

 

三、helloword_deom 源代码编译及烧录

1 编译 helloword_deom,在 haaseduk 上编译。

编译完成窗口显示如下

image.png

2点击烧录按钮后,开始下载

image.png

3 通过 clear 查看输出日志

在 (zsh) 中输入 ~ls /dev/ tty.u* 回车,然后输入 ~picocom -b 1500000 导入文件/dev/tty.usbserial-A908XGVV回车。helloword_deom 会每秒钟输出一次 hello world! count 的日志,count 值每次加一。

怎么确定烧录是否正确

第一种:修改输出日志,然后在编译一下,最后烧录一下。

在appdemo.c 中 application_start 函数之中把hello world 修改为 welcome to China!,然后重新编译,编译完成后,点击烧录。

第二种:查看开发版 linux 编译时间。

通过指令 2>&1|tee welcome_to_china.log,然后重启界面。

image.png

相关文章
|
5月前
|
开发工具 C语言 内存技术
ZYNQ_SDK HelloWorld实验
ZYNQ_SDK HelloWorld实验
|
5月前
|
XML 自然语言处理 C++
【Qt 学习笔记】使用两种方式实现helloworld
【Qt 学习笔记】使用两种方式实现helloworld
61 1
|
5月前
|
IDE 测试技术 开发工具
<HarmonyOS第一课>运行Hello World
<HarmonyOS第一课>运行Hello World
63 0
|
小程序 Java 网络安全
[笔记]微信小程序开发《一》环境搭建 以及helloworld
[笔记]微信小程序开发《一》环境搭建 以及helloworld
143 0
|
IDE 开发工具 开发者
ESP8266固件SDK开发初体验-打印helloworld
ESP8266固件SDK开发初体验-打印helloworld
248 0
|
XML 缓存 编解码
Qt开发技术:QtSVG介绍、使用和Demo
Qt开发技术:QtSVG介绍、使用和Demo
Qt开发技术:QtSVG介绍、使用和Demo
|
JavaScript 前端开发 Python
|
安全 Java 开发工具
|
Ubuntu AliOS-Things 物联网
2_3_haas 源代码下载_编译_烧录|学习笔记
快速学习2_3_haas 源代码下载_编译_烧录。
303 0
2_3_haas 源代码下载_编译_烧录|学习笔记
|
IDE 物联网 AliOS-Things
HaaS 开发环境介绍|学习笔记
快速学习 HaaS 开发环境介绍。
385 0
HaaS 开发环境介绍|学习笔记