HDC Debugging
HDC (OpenHarmony Device Connector) is a command-line tool provided for developers to connect and debug devices. This tool must support deployment on Windows/Linux/Mac and other systems to perform connection, debugging, and communication with OpenHarmony devices (or emulators).
In short, HDC is a command-line tool provided by OpenHarmony for developers to debug hardware and applications, used for interaction between the PC and the development board. It is suitable for OpenHarmony application, hardware development, and testing personnel, and is an essential, entry-level tool for every developer.
3.1 Environment Preparation
This document uses a Windows 11 PC and the RK development board as an example.
3.1.1 Install USB Driver
Baidu Netdisk link: ShiMetaPi Companion Netdisk Materials - Baidu Netdisk, extraction code: smcc
DriverAssitant is the USB driver that ships with the RK development board.
- Extract the Rockchip USB driver compressed package (DriverAssitant_v5.1.1) from the materials package.

Note:
Driver path: ShiMetaPi Companion Netdisk Materials>02-Software Tools>Rockchip>RKTools>windows>DriverAssitant_v5.1.1.zip
After extracting the compressed package, click driver install (DriverInstall.exe) in the folder.
Check in Device Manager whether the driver was installed successfully. If successful, it will appear as shown below, displaying "HDC Device".

3.1.2 HDC Tool Download
- Download the HDC tool from the materials package. The files contained in the HDC folder are shown below.

This document places the above two files under the D:\tools\HDC path.

Note:
Tool path: ShiMetaPi Companion Netdisk Materials>02-Software Tools>Rockchip>OpenHarmony>HDC Tool
- HDC path environment configuration:
The HDC PATH environment configuration is shown in the figure: My Computer, right-click and choose Properties, select "Advanced System Settings -> Environment Settings -> Double-click PATH in System Environment Variables -> New and enter "D:\tools\HDC" -> click OK all the way.



Note:
The path in the environment variable should be the path where HDC exists on your own PC; do not include Chinese characters.
3.3 Connect the Device
- The M4-R1's USB-OTG is already in device mode by default.
- Connect the PC to the device's OTG port with a USB cable.
- Open a command-line tool on the PC and type
hdc list target. If the connection is successful, the device will be printed out as follows:
hdc list targets
d6290343394135353110d2d800002b00- Type
hdc shellto enter the terminal.

3.4 Common Commands
The following focuses on some commonly used HDC commands; others can be found via search engines on your own.
- Query device
hdc list targets- remount
hdc shell mount -o remount,rw /- Launch APP
hdc shell aa start -a MainAbility -b com.example.sampledemo- Reboot
hdc shell reboot- Install APP
hdc install -r path.hap- Copy a PC file to the device
hdc file send "D:\D-backup\temp_work\xxx.hap" data/xxx.hap- Copy a device file to the PC (capture log)
hdc file recv /data/log ./openharmony_log- Query application information
bm dump -n com.example.mydemo |grep system3.5 bm Tool
Bundle Manager (package management tool, abbreviated bm) is a tool that implements functions such as application installation, uninstallation, update, and query. bm provides developers with basic application-package debugging capabilities, such as installing applications, uninstalling applications, and querying installation package information.
For a detailed introduction, see the official document: bm tool - OpenAtom OpenHarmony
3.6 aa Tool
Ability assistant (Ability assistant, abbreviated aa) is a tool that implements the launch function of applications and test cases. It provides developers with basic application debugging and testing capabilities, such as launching application components, forcibly stopping processes, and printing application-component-related information.
For a detailed introduction, see the official document: aa tool - OpenAtom OpenHarmony
