HUAWEI DevEco Device Tool(以下简称DevEco Device Tool)是HarmonyOS面向智能设备开发者提供的一站式集成开发环境,支持HarmonyOS的组件按需定制,支持代码编辑、烧录和调试等功能,支持C/C++语言,以插件的形式部署在Visual Studio Code上。该工具具有以下特点:

DevEco Device Tool以Visual Studio Code插件形式提供,体积小巧。 支持代码查找、代码高亮、代码自动补齐、代码输入提示、代码检查等,开发者可以轻松、高效编码。 支持ARM架构的Hi3516/Hi3518系列和RISC-V架构的Hi3861系列开发板,提供一键式的烧录和调试GUI界面。 支持单步调试能力和查看内存、变量、调用栈、寄存器、汇编等调试信息。

前序: 这里研究harmonyos驱动层面部分,涉及C/C++。之前尝试了一些华为鸿蒙应该是直播里面北向应用的开发,这里研究harmonyos 驱动应用相关,对应直播里面的南向驱动层面的开发,这部分上手程度目前还是比较难的,从实验结果来看,windows环境安装上还是有问题的,期待后续更新,应该有配套更新应该能解决。

1.下载HUAWEI DevEco Device Tool(Beta) IDE(插件)

这里下载的IDE,实质华为鸿蒙将其IDE作为Visual Studio Code里面的插件进行开发。

鸿蒙中implements在类中如何使用 鸿蒙的ide_Code

2.安装HUAWEI DevEco Device Tool(Beta) IDE插件

打开VSCode点击Extensions

鸿蒙中implements在类中如何使用 鸿蒙的ide_PowerShell_02

选择Install from VSIX...

鸿蒙中implements在类中如何使用 鸿蒙的ide_华为鸿蒙ide_03

安装成功后提示:

鸿蒙中implements在类中如何使用 鸿蒙的ide_PowerShell_04

自动提示还需要安装HPM(此处需要提前安装node.js):

鸿蒙中implements在类中如何使用 鸿蒙的ide_Code_05

(要是安装后提示:

'hpm' 不是内部或外部命令,也不是可运行的程序

或批处理文件。

查看下系统环境变量里面指向hpm所在位置

3.创建驱动项目:

点击Welcome中的Create Project

鸿蒙中implements在类中如何使用 鸿蒙的ide_华为鸿蒙ide_06

填写项目名称,保存路径,和模板 此处选择的模板是自带的helloworld

鸿蒙中implements在类中如何使用 鸿蒙的ide_PowerShell_07

4.点击create

鸿蒙中implements在类中如何使用 鸿蒙的ide_PowerShell_08

右下角提示安装C/C++扩展,点击安装就行。

输出需要安装的工具情况:

Info: Ready: d:\harmonyos\projects\DeviceProjects\myfristproject
Tool Auto-install Installed Location
harmonyeabi Yes No
mtd-utils-tool Yes No
mingw Yes No
python No No
openocd Yes No
gcc-arm-none-eabi Yes No
Please open config page to select path or click "Tools" statusbar button to install auto tools

点击build

鸿蒙中implements在类中如何使用 鸿蒙的ide_Visual_09

提示:

> Executing task in folder myfristproject: hpm run 'build' <

hpm : 无法加载文件 D:\nodejs\npm\hpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 abou

t_Execution_Policies。

所在位置 行:1 字符: 1

+ hpm run 'build'
+ ~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command hpm run 'build'" terminated with exit code: 1.

看是权限不足,查了下百度,设置方法如下:

VSCode要以管理员模式启动

切换到命令行进行如下:(set-ExecutionPolicy RemoteSigned)

Windows PowerShell

版权所有 (C) Microsoft Corporation。保留所有权利。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

PS D:\harmonyos\projects\DeviceProjects\myfristproject> set-ExecutionPolicy RemoteSigned

即可。 (此处helloworld 最后没有成功,卡在hpm工具链没有安装成功,看到已经有反馈问题的,目前看windows下编译可能还是有点问题,此处 TODO:后续有新的内容,反馈在此文章中更新

PS D:\harmonyos\src\code-1.0> hpm install @huawei/deveco_openocd
Requesting: https://hpm.harmonyos.com/registry/api/bundles/@huawei/deveco_openocd
Installation error: Unresolved dependency '@huawei/deveco_openocd' in the repository.
Check error details by "C:\Users\ \.hpm\log\debug\debug.2020-09-13-20-09-14.log"

鸿蒙中implements在类中如何使用 鸿蒙的ide_Visual_10

)

下一节,将Hi3861 wlan开发代码demo代码放到linux下,IDE暂时还是纯粹的做编码工作,使用windows下的docker环境进行编译。