2021-08-03
2021-08-03 本文已影响0人
刘正道
AliOS Things源码下载及使用
git介绍及使用
[图片上传失败...(image-b91a01-1627968833143)]
通过git下载Alios Things最新源码
参考阿里云获取源码
[获取源码](https://help.aliyun.com/document_detail/161040.html?spm=a2c4g.11186623.6.547.4c5e37e2EO3Tuk)
[图片上传失败...(image-87deae-1627968833143)]
下载源码
- cd当前用户目录
lzd@ubuntu:~$ cd ~
- 下载源码
lzd@ubuntu:~$ git clone https://gitee.com/alios-things/AliOS-Things.git
[图片上传失败...(image-ffdaf3-1627968833143)]
- 查看源码
lzd@ubuntu:~$ ls
AliOS-Things Desktop Documents Downloads examples.desktop Music Pictures Public Templates Videos
编译Alios Things
配置编译
- cd到Alios Things目录下,aos make distclean清除编译配置
zd@ubuntu:~/AliOS-Things/out/helloworld_demo@linuxhost/binary$ aos make distclean
aos-cube version: 0.5.11
Cleaning...
Done
[图片上传失败...(image-e6604d-1627968833143)]
- 进行aos make menuconfig
lzd@ubuntu:~$ cd AliOS-Things/
lzd@ubuntu:~/AliOS-Things$ ls
application build components core include LICENSE NOTICE platform projects README.md README-zh.md test
lzd@ubuntu:~/AliOS-Things$ aos make menuconfig
aos-cube version: 0.5.11
kconfig tools missing, start download ...
https://gitee.com/alios-things/kconfig-frontends-linux.git -> .//build/kconfig/Linux64/
Cloning into './/build/kconfig/Linux64'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 7 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
Checking connectivity... done.
platform/board/stm32f103rb-nucleo/Config.in:3:warning: defaults for choice values not supported
platform/board/esp8266/Config.in:3:warning: defaults for choice values not supported
platform/board/mk3072/Config.in:3:warning: defaults for choice values not supported
application/example/example_legacy/uai_demo/uai_kws_demo/Config.in:15:warning: defaults for choice values not supported
application/example/example_legacy/uai_demo/uai_cifar10_demo/Config.in:15:warning: defaults for choice values not supported
configuration written to .config
- 配置例程为helloworld_demo
[图片上传失败...(image-670602-1627968833143)]
-
配置目标板为Linuxhost
[图片上传失败...(image-4d6109-1627968833143)]
-
编译
aos make
- 编译报错
[图片上传失败...(image-f2c98-1627968833143)]
- 解决编译报错
lzd@ubuntu:~/AliOS-Things$ sudo apt-get install g++-multilib
[图片上传失败...(image-324d5e-1627968833143)]
- 执行程序
lzd@ubuntu:~/AliOS-Things$ cd out/
lzd@ubuntu:~/AliOS-Things/out$ ls
config helloworld_demo@linuxhost
lzd@ubuntu:~/AliOS-Things/out$ cd helloworld_demo@linuxhost/
lzd@ubuntu:~/AliOS-Things/out/helloworld_demo@linuxhost$ cd binary/
lzd@ubuntu:~/AliOS-Things/out/helloworld_demo@linuxhost/binary$ ls
helloworld_demo@linuxhost.bin helloworld_demo@linuxhost.map helloworld_demo@linuxhost_ota.bin.xz readme.txt
helloworld_demo@linuxhost.elf helloworld_demo@linuxhost_map.csv helloworld_demo@linuxhost.stripped.elf
helloworld_demo@linuxhost.hex helloworld_demo@linuxhost_ota.bin link.opts
lzd@ubuntu:~/AliOS-Things/out/helloworld_demo@linuxhost/binary$ ./helloworld_demo@linuxhost.elf
[图片上传失败...(image-97ade-1627968833143)]
配置环境变量
$ cd ~
$ vi .bashrc
# 文件末尾添加环境变量,指向AliOS Things源码目录,并保存退出
export AOS_SDK_PATH=/home/user/AliOS-Things # user 是我们自己ubuntu的用户名称
# 使配置立即生效
$ source .bashrc
$ echo $AOS_SDK_PATH
# 打印如下内容,证明环境变量配置成功
/home/lzd/AliOS-Things
[图片上传失败...(image-5530ea-1627968833143)]