【HarmonyOS IPC 试用连载 】第4章 HiSpark IPC Camera应用开发 - HarmonyOS技术社区 - 电子技术论坛 - 广受欢迎的专业电子论坛
分享 收藏 返回

[文章]

【HarmonyOS IPC 试用连载 】第4章 HiSpark IPC Camera应用开发

开发环境:
开发系统:Ubuntu 20.04
开发板:HiSparkIPCCamera(Hi3518)

4.1新建工程及配置
1.新建工程及源码
1) 新建目录
  1. $ mkdir hello
在applications/sample/hello中新建src目录以及helloworld.c文件,代码如下所示。
  1. #include

  2. int main(int argc, char **argv)
  3. {
  4.     printf("n");
  5.     printf("ntHello OHOS!n");
  6.     printf("n");

  7.     return 0;
  8. }

2) 新建编译组织文件
新建applications/sample/hello/BUILD.gn文件,内容如下所示:
  1. import("//build/lite/config/component/lite_component.gni")
  2. lite_component("hello-OHOS"){
  3. features = [ ":helloworld" ]
  4. }
  5. executable("helloworld"){
  6. output_name = "helloworld"
  7. sources = [ "src/helloworld.c" ]
  8. }
新建的工程目录如下:
  1. $ tree
20220414-4-t1.png

2.添加新组件
修改文件build/lite/components/applications.json,添加组件hello_world_app的配置。
  1.     {
  2.       "component":"hello_world_app",
  3.       "description": "helloworld samples.",
  4.       "optional": "true",
  5.       "dirs": [
  6.         "applications/sample/hello"
  7.       ],
  8.       "targets": [
  9.         "//applications/sample/hello:hello-OHOS"
  10.       ],
  11.       "rom": "",
  12.       "ram": "",
  13.       "output": [],
  14.       "adapted_kernel": ["liteos_a" ],
  15.       "features": [],
  16.       "deps": {
  17.         "components": [],
  18.         "third_party": []
  19.       }
  20.     }

20220414-4-t2.png

3.修改单板配置文件
修改文件vendor/hisilicon/hispark_aries/config.json,新增hello_world_app组件的条目。
  1. {
  2.      "subsystem":"applications",
  3.       "components": [
  4.        { "component":"hello_world_app", "features":[] }
  5. }

20220414-4-t3.png
4.2编译下载验证
接下来就可以编译了。
  1. $ hb set
20220414-4-t4.png

全编译。
  1. $ hb build -f
20220414-4-t5.png

在bin文件就会有helloworld应用。
20220414-4-t6.png
和以前一样,拷贝ohos_image.bin, rootfs_jffs2.img, userfs_jffs2.img三个文件是。
然后把固件下载到板子中。
20220414-4-t7.png

烧写成功后,运行bin目录下的helloworld。
20220414-4-t8.png

接下来就可以根据该实例开发自己的应用了。

回帖(1)

一只卷卷

2022-5-13 17:21:57

更多回帖

×
发帖