Configure the Windows burning environment

Install Visual Studio Code

Test version

If Visual Studio Code has been installed, open the COMMAND line tool and enter Code –version to check whether the version is 1.45.1 or later. If the version number can be returned normally, environment variables are correctly set.



Log in to the Official website of Visual Studio Code and download the Visual Studio Code package 1.45.1 or later.

After downloading, click on the package to install it. During the installation, select Add to PATH (take effect after restart).

After the installation is complete, restart the computer to make Visual Studio Code’s environment variables take effect.

Installation Node. Js

instructions

If node. js has been installed, open the CLI tool and run the Node -v command to check whether the version is 12.0.0 or later. Add the NODE_PATH variable if the version symbol requires it.

  1. Log in to the official website of Node.js and download the Node.js software package. Select a Windows 64-bit software package of LTS version 12.0.0 or later.

  1. After downloading, click the package to install, check the box in the figure, and automatically install the necessary tools (such as Python, Visual Studio build toolchain).

  2. When node.js is installed, click Finish and a new window will open to automatically install the necessary tools. Please click any key on your keyboard to continue.

The system automatically starts PowerShell and starts to install necessary tools. A message is displayed indicating that Python and Visual Studio build chain are installed successfully.

instructions

If there is a message indicating that Visual Studio update failed during the installation of necessary toolchains, you can skip it without affecting the use.

  1. Choose This COMPUTER > Properties > Advanced System Settings > Advanced > Environment Variables > System Variables, and add the NODE_PATH variable. The value is: C:\Users{userName}\AppData\Roaming\ NPM \node_modules, in which userName must be the actual userName.

  2. Open the CMD command line tool and enter node -v. If the node. js version can be queried, node. js is successfully installed.

Install the JDK

instructions

If JDK is installed, run the Java -version command to check whether the VERSION is 1.8.

Please download and install JDK 1.8 by yourself.

Install the HPM

Before using this method, ensure that Node.js is successfully installed. Before installing the HPM, check the network connection status. If the network cannot access the Internet directly, you need to access the Internet through a proxy server. In this case, you need to set up the NPM agent before installing the HPM.

Open the CLI tool and run the following command to install the HPM.

npm install -g @ohos/hpm-cli

Copy the code

After the installation is complete, run the following command (V in uppercase) to check whether the HPM is successfully installed.

hpm -V

Copy the code

Install the DevEco Device Tool plug-in

If you have installed the DevEco Device Tool plug-in, manually uninstall the DevEco Device Tool plug-in and perform the following steps to install the new version.

  1. Log on to the HarmonysOS device Development portal and click the register button in the upper right corner to register a developer account. If you have a Huawei developer account, click the Login button.

    On the HUAWEI DevEco Device Tool product page, download the DevEco Device Tool installation package.

  2. Open the Visual Studio Code software.

    Install DevEco Device Tool from a local disk.

  3. After the installation is successful, the following figure shows the interface.

  4. The HarmonysOS device is developed using C/C++. Visual Studio Code supports a variety of C/C++ plug-ins. You can install the C/C++ plug-in to implement intelligent Code prompting, Code highlighting, and formatting. Help you more efficient, convenient development of more standard and beautiful code.

In the Visual Studio Code plug-in marketplace, type “C/C++” and click “Install.”

  1. If the online installation fails, click Go to Download Page in the lower right corner to Download the offline plug-in (select cppTools-win32.vsix. In Windows, the installation package is the same for both 64-bit and 32-bit systems). Then install the C/C++ plug-in offline by referring to how to install the DevEco Device Tool plug-in.

Import and configure the project

The source code for

Get the HarmonyOS source code

You can obtain the HarmonyOS source code from HarmonyOS. address

Create a shared folder

mapping

The HarmonyOS source code can only be compiled on A Linux operating system. You can map the project directory in a Linux operating system to a Windows operating system, use the DevEco Device Tool to open it, and then burn and debug it in A Windows operating system. The mapping method is as follows:

On Linux, set the HarmonyOS source folder to a shared folder.

On Windows, right-click this Computer and choose Map Network Drive (Z)



Select an unused drive and set the path to HarmonyOS source code in the format \Linux IP address \ shared folder name, for example: \10.6.25.83\HarmonyOS, and click Finish.

Import the source code

HarmonyOS does not support the source code for Windows. Import the source code from the shared path of the mapped Linux server.

In Visual Studio Code, click the DevEco Device Tool plug-in button icon, and then click the “Import” button.

Select the HarmonyOS source folder for the local mapping and click “Import” to Import the project.

Hiburn the first program

  1. Click Setting->Com Settings in the upper left corner of the interface to enter the interface for Setting serial port parameters. On the interface for Setting serial port parameters, Baud is set to 115200 by default. You can select 921600,2000000, or 3000000 (the value supported by the fastest test). Click “OK” to save;

  2. According to the device manager, select the correct COM port, for example, my development board is COM4. If the serial cable is inserted after opening the program, you can click “Refresh” to Refresh the options of the serial port drop-down box.

  3. Click “Select File” to pop up the dialog box for file selection, and Select the compiled allinone.bin file, which is actually a file merged by multiple bin files

  4. Click Connect to Connect the serial port device. At this time, HiBurn will start the serial port device and try to burn it. Make sure that no other programs are using the serial port device (you may be using the HyperTerminal or serial port Assistant to view serial port logs before burning the serial port device, and make sure that other software has disabled the serial port in use). RESET the device, press the RESET button on the development board; Waiting for output box appears three “= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =”, and above all appear successful, namely that burn success;

  5. After firing, manually click Disconnect to Disconnect the serial port. Otherwise, the message Wait connect Success flag (hisilicon) overtime is displayed.

Application effect

subsequent

Like a little bit of reading.

Or follow the public account.

Writing is not easy, thank you for your support.

This article uses the article synchronization assistant to synchronize