4 Star 4 Fork 0

AliOS Things / dev_tool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0
AliOS Things开发环境一键安装和使用说明

开发环境介绍

本文所述的AliOS Things开发环境包含2部分:

  • 在宿主机(即你正在使用的电脑)上运行的脚本,可以从gitee下载,详见下文的“下载一键安装工具”章节。目录结构如下所示:

    dev_tool
    ├── dev_tool_linux.sh         # 一键安装脚本,Ubuntu版本
    ├── dev_tool_osx.sh           # 一键安装脚本,MacOS版本
    ├── dev_tool_win.bat          # 一键安装脚本,Win10版本
    ├── README.md                 # 说明文档
    ├── pic                       # 说明文档中使用的图片
    ├── aos_burn_tool             # aos烧录工具,目前仅支持haas100
    └── utilities                 # 其它脚本和工具
  • docker容器,由上述的一键安装脚本安装。容器安装启动后,用户可以使用宿主机上的浏览器以HTTP方式连接容器,查看docker容器内的代码,也可以编辑、编译代码和烧录固件。安装好的docker容器,包含以下内容:

    ├──ubuntu 20.04               #容器系统			
    ├──sshd                       #远程连接服务工具
    ├──aos-cube                   #AliOS Things的集成开发工具
    ├──dev_3.1.0_haas             #AliOS Things的dev_3.1.0_haas分支源代码
    └──code-server               #网页版的Visual Studio Code   
  • 逻辑框图如下图所示。

  • 演示视频

安装

下载一键安装工具

一键安装

进入dev_tool目录cd dev_tool,根据电脑的系统,执行相应的脚本:

MacOS: bash ./dev_tool_osx.sh -i

Ubuntu: bash ./dev_tool_linux.sh -i

Win10: .\dev_tool_win.bat -i

安装脚本将完成以下工作,整个安装过程大概需要5~30分钟,取决于系统配置和网速,安装过程中,需要用户输入密码

  • 安装docker软件及其依赖的工具
  • 下载包含AliOS Things开发工具的docker镜像rtos:v0.1
  • 使用rtos:v0.1创建一个docker容器,并下载AliOS Things的dev_3.1.0_haas分支源代码至容器中的/workspace/AliOS-Things目录
  • 在docker容器中安装code-server及AliOS Studio,作为AliOS Things开发的Web IDE

若安装失败,可再次执行该命令重新安装。

Win系统注意事项

  • 如果从Docker官网下载Docker安装文件很慢,可使用命令.\dev_tool_win.bat -m 代替.\dev_tool_win.bat -i。该命令将从阿里云镜像站点下载安装文件并安装。使用此命令可能会下载到非最新版本的镜像。
  • 一些额外的人工操作,请根据下图提示选择

出现提示Installing Docker Desktop,请确保选择Enable Hyper-V Windows FeatureInstall required Windows components for WSL2,然后点击“OK”按钮开始安装docker。

安装完成以后,点击“Close and Restart”按钮,重启电脑。重启电脑完成之后,需要再次输入“一键安装”的命令,继续安装

image-20210101131638434

出现提示类似Python 3.9.1(64-bit) Setup的python安装页面,请确保选择Add Python 3.9 to PATH,然后点击“Install Now”按钮开始安装python。

image-20210101132711436

MacOS系统注意事项

  • Installing Cask docker阶段,会停顿较长时间,请耐心等待
  • 如果从Docker官网下载Docker安装文件很慢,可使用命令bash ./dev_tool_osx.sh -m代替bash ./dev_tool_osx.sh -i。该命令从阿里云镜像站点下载安装文件并安装。使用此命令可能会下载到非最新版本的镜像。
  • 一些额外的人工操作,请根据下图提示选择

出现提示 “Docker”是从互联网下载的App。您确定要打开它吗?,请点击 “打开”按钮

出现提示 "Docker Desktop needs privileged access",请点击“OK”按钮

出现提示“Docker”正在尝试安装新帮助程序工具,请输入密码,并点击“安装帮助程序”按钮

出现提示 “Docker”想要访问“桌面”文件夹中的文件 类似的弹窗,请点击“好”按钮

若直接弹出docker软件的页面,表示用户第一次安装docker,用户只需最小化即可

  • 一键安装视频演示:

    • MacOS版本

    • Ubuntu版本

    • win版本

开发使用

登录code-server

一键安装成功后,将自动打开浏览器,进入到登录code-server页面

密码获取方式

  • 成功登录网页后,系统已自动复制密码到剪切板,只需要在密码框中点击鼠标右键,然后在菜单中选择“粘贴”,点击“SUBMIT”,登录server
  • 在执行“一键安装”脚本的终端窗口,搜索关键字password,如下图所示password:<password>,复制密码

​ 建议用户尽快修改密码。修改密码方式如下:

​ MacOS: bash ./dev_tool_osx.sh -p

​ Ubuntu: bash ./dev_tool_linux.sh -p

​ Win10: .\dev_tool_win.bat -p

配置和编译

使用预装在code-server上的AliOS Studio插件,选择app和board,然后点左下角的“√”号编译。

  • 点击左下角的框helloworld@developerkit,在随后的弹窗中选择app helloworld_demo

  • 选择开发板型号haas100

  • 点击下面的“√”号,进行编译

  • 编译成功后,在out/helloworld_demo@haas100/binary目录下可以看到生成的elf文件和bin文件

烧录固件

  • 点击下方状态栏中的⚡️标志

  • 根据提示选择相应的串口,即可进行烧录。串口配置信息将保存在代码根目录下的.aos_config_burn文件中。若后续串口有变化,可删除该文件后,再烧录。

  • 切回到原先的终端中可查看烧录的详细日志。如果日志中出现Please reboot the board manually.或者听到每秒钟1声beep,请按复位键手动复位开发板

  • 烧录成功后的提示信息如下图所示

  • 如果烧录过程中提示Communicated with host pc is failed. Please start flash programmer in host pc.,则需要使用下文所述的“再次打开docker”,该命令会在后台启动一个烧录监控程序;然后再重新烧录。

再次打开docker

安装成功后,docker容器将在后台运行。如果下次重新开机后,可使用-s参数,运行安装脚本,重新打开docker。

MacOS: bash ./dev_tool_osx.sh -s

Ubuntu: bash ./dev_tool_linux.sh -s

Win10: .\dev_tool_win.bat -s

SSH连接

对于不习惯使用Web IDE的开发人员,也可以通过ssh方式连接docker,进入容器内部查看代码,编译版本,烧录固件。

  • 使用命令docker ps -a查看docker是否处于运行状态,如下图所示:

    STATUS:运行状态,UP正常启动状态,其他状态表示容器运转不正常,参考“再次打开docker”章节中所述的方法重新打开

    PORTS:端口映射状态,容器中22端口对应宿主机64028端口

  • 使用SSH方式连接:

    • 方式1:命令行ssh -p <port> root@127.0.0.1,其中port为宿主机端口号,如下图所示

    • 方式2:vscode+ssh remote插件,若已经在宿主机(即用户正在使用的电脑)上安装了vscode和ssh remote插件,请修改~/.ssh/config文件中,增加如下4行,配置完成后,通过ssh code-server登录容器。
    Host code-server
    		User root
    		HostName 127.0.0.1
    		Port 64028 #请根据docker ps命令查找22对应的端口号填写

删除docker镜像

删除AliOS Things的docker镜像rtos:v0.1及其相应的容器,请执行如下命令

MacOS: bash ./dev_tool_osx.sh -r

Ubuntu: bash ./dev_tool_linux.sh -r

Win10: .\dev_tool_win.bat -r

卸载docker工具

MacOS: bash ./dev_tool_osx.sh -u

Ubuntu: bash ./dev_tool_linux.sh -u

Win10: .\dev_tool_win.bat -u

注意:该命令将删除宿主机上所有docker镜像,请谨慎使用。

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

AliOS Things开发环境 安装和使用脚本 展开 收起
Python 等 5 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/alios-things/dev_tool.git
git@gitee.com:alios-things/dev_tool.git
alios-things
dev_tool
dev_tool
master

搜索帮助

14c37bed 8189591 565d56ea 8189591