同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
This section describes how to create, compile, burn, and run the first program, and finally print Hello OHOS! on the develop board.
Create a directory and the program source code.
Create the applications/sample/camera/apps/src/helloworld.c directory and file whose code is shown in the following example. You can customize the content to be printed. For example, you can change OHOS to World. You can use either C or C++ to develop a program.
#include <stdio.h>
int main(int argc, char **argv)
{
printf("\n************************************************\n");
printf("\n\t\tHello OHOS!\n");
printf("\n************************************************\n\n");
return 0;
}
Create a build file.
Create the applications/sample/camera/apps/BUILD.gn file. The file content is as follows:
import("//build/lite/config/component/lite_component.gni")
lite_component("hello-OHOS") {
features = [ ":helloworld" ]
}
executable("helloworld") {
output_name = "helloworld"
sources = [ "src/helloworld.c" ]
include_dirs = []
defines = []
cflags_c = []
ldflags = []
}
Add a new component.
Add the configuration of the hello_world_app component to the build/lite/components/applications.json file. The sample code below shows some configurations defined in the applications.json file, and the code between ##start## and ##end## is the new configuration (Delete the rows where ##start## and ##end## are located after the configurations are added.)
{
"components": [
{
"component": "camera_sample_communication",
"description": "Communication related samples.",
"optional": "true",
"dirs": [
"applications/sample/camera/communication"
],
"targets": [
"//applications/sample/camera/communication:sample"
],
"rom": "",
"ram": "",
"output": [],
"adapted_kernel": [ "liteos_a" ],
"features": [],
"deps": {
"components": [],
"third_party": []
}
},
##start##
{
"component": "hello_world_app",
"description": "Communication related samples.",
"optional": "true",
"dirs": [
"applications/sample/camera/apps"
],
"targets": [
"//applications/sample/camera/apps:hello-OHOS"
],
"rom": "",
"ram": "",
"output": [],
"adapted_kernel": [ "liteos_a" ],
"features": [],
"deps": {
"components": [],
"third_party": []
}
},
##end##
{
"component": "camera_sample_app",
"description": "Camera related samples.",
"optional": "true",
"dirs": [
"applications/sample/camera/launcher",
"applications/sample/camera/cameraApp",
"applications/sample/camera/setting",
"applications/sample/camera/gallery",
"applications/sample/camera/media"
],
Modify the board configuration file.
Add the hello_world_app component to the vendor/hisilicon/hispark_taurus/config.json file. The sample code below shows the configurations of the applications subsystem, and the code between ##start## and ##end## is the new configuration (Delete the rows where ##start## and ##end## are located after the configurations are added.)
{
"subsystem": "applications",
"components": [
{ "component": "camera_sample_app", "features":[] },
{ "component": "camera_sample_ai", "features":[] },
##start##
{ "component": "hello_world_app", "features":[] },
##end##
{ "component": "camera_screensaver_app", "features":[] }
]
},
If the Linux environment is installed using Docker, perform the building by referring to Using Docker to Prepare the Build Environment. If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation:
hb set (Set the building path.)
. (Select the current path.)
Select ipcamera_hispark_taurus@hisilicon and press Enter.
hb build -f (Start building.)
The result files are generated in the out/hispark_taurus/ipcamera_hispark_taurus directory.
NOTICE: The U-boot file of the Hi3516D V300 development board can be obtained from the following path: device/hisilicon/hispark_taurus/sdk_liteos/uboot/out/boot/u-boot-hi3516dv300.bin
The Hi3516 development board allows you to burn flash memory over the USB port, serial port, or network port. The following uses the network port burning as an example.
Connect the PC and the target development board through the power port, serial port, and network port. In this section, the Hi3516DV300 is used as an example. For details, please refer to Introduction to the Hi3516 Development Board.
Open Device Manager, then check and record the serial port number corresponding to the development board.
NOTE: If the serial port number is not displayed correctly, follow the steps described in Installing the Serial Port Driver on the Hi3516 or Hi3518 Series Development Boards.
Open DevEco Device Tool and go to Projects > Settings.
On the Partition Configuration tab page, modify the settings. In general cases, you can leave the fields at their default settings.
On the hi3516dv300 tab page, configure the programming options.
Check and set the IP address of the network adapter connected to the development board. For details, see Setting the IP Address of the Network Port for Programming on Hi3516.
Set the IP address of the network port for programming:
When you finish modifying, click Save in the upper right corner.
Open the project file and go to > PROJECT TASKS > hi3516dv300 > Upload to start programming.
When the following message is displayed, power off the development board and then power it on.
Start programming. When the following message is displayed, it indicates that the programming is successful.
Connect to a serial port.
NOTICE: If the connection fails, rectify the fault by referring to FAQs.
(Mandatory when the board is started for the first time) Modify the bootcmd and bootargs parameters of U-boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset.
NOTICE: The default waiting time in the U-boot is 2s. You can press Enter to interrupt the waiting and run the reset command to restart the system after "hisilicon" is displayed.
Table 1 Parameters of the U-boot
NOTICE: go 0x80000000 (optional) indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press Enter in the countdown phase of the U-boot startup to interrupt the automatic startup.
Run the reset command and press Enter to restart the board. After the board is restarted, OHOS is displayed when you press Enter.
In the root directory, run the ./bin/helloworld command to operate the demo program. The compilation result is shown in the following example.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。