成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Openharmony 設(shè)備開發(fā)之helloworld (L2)

系統(tǒng) OpenHarmony
本篇分別從介紹子系統(tǒng)添加,介紹靜態(tài)庫編譯,介紹動態(tài)庫編譯,介紹動態(tài)庫和靜態(tài)庫的調(diào)用四個方面入門了解設(shè)備開發(fā)。

??想了解更多內(nèi)容,請?jiān)L問:??

??51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)??

??https://harmonyos.51cto.com??

一、簡介

  1. 介紹子系統(tǒng)添加
  2. 介紹靜態(tài)庫編譯
  3. 介紹動態(tài)庫編譯
  4. 介紹動態(tài)庫和靜態(tài)庫的調(diào)用

入門了解設(shè)備開發(fā):

partA/feature1編譯的靜態(tài)庫,

partB/module編譯的是動態(tài)庫

partA/feature2可執(zhí)行程序中調(diào)用動態(tài)庫和靜態(tài)庫

二、代碼添加編譯

2.1 子系統(tǒng)添加

配置文件:build/subsystem_config.json

,
"sub_example": {
"project": "hmf/test",
"path": "test/example",
"name": "sub_example",
"dir": "test"
}

如果自己想自定義目錄,test為測試代碼放在目錄路徑。

2.2 子模塊添加

配置文件:productdefine/common/products/Hi3516DV300.json

{
"product_name": "Hi3516DV300",
"product_company": "hisilicon",
"product_device": "hi3516dv300",
"version": "2.0",
"type": "standard",
"product_build_path": "device/hisilicon/build",
"parts":{

"sub_example:partB":{},
"sub_example:partA":{}
}
}

2.3 模塊partA/feature1

目錄結(jié)構(gòu)

編譯配置文件:test\example\partA\feature1\BUILD.gn

import("http://build/ohos.gni")

config("helloworld1_lib_config") {
include_dirs = [ "include" ]
}
ohos_static_library("libhelloworl1_lib") {
output_extension = "a"
sources = [
"include/helloworld1.h",
"src/helloworld1.c"
]
public_configs = [ ":helloworld1_lib_config" ]
part_name = "partA"
}

其中ohos_static_library標(biāo)準(zhǔn)系統(tǒng)是ninja生成靜態(tài)庫的關(guān)鍵。

2.4 模塊partB/module

目錄結(jié)構(gòu)

配置文件test\example\partB\module\BUILD.gn

import("http://build/ohos.gni")

config("module_lib_config") {
include_dirs = [ "include" ]
}

ohos_shared_library("module_lib") {
sources = [
"http://test/example/partB/module/include/module.h",
"http://test/example/partB/module/src/module.c"
]
public_configs = [ ":module_lib_config" ]
part_name = "partB"
subsystem_name = "sub_example"
}

其中ohos_shared_library標(biāo)準(zhǔn)系統(tǒng)是ninja生成動態(tài)庫的關(guān)鍵。

2.5 動態(tài)庫和靜態(tài)庫調(diào)用模塊partA/feature2

目錄結(jié)構(gòu)

編譯配置:test\example\partA\feature2\BUILD.gn

import("http://build/ohos.gni")

ohos_executable("helloworld2_bin") {
sources = [
"src/helloworld2.c"
]
include_dirs = [
"include",
"http://test/example/partB/module/include"
]
deps = [ # 組件內(nèi)模塊依賴
"../feature1:libhelloworl1_lib",
#"http://test/example/partB/module:module_lib",
"../feature3:feature3_etc",
]
external_deps = [ "partB:module_lib", ] # 跨組件的依賴,格式為“組件名:模塊名”
install_enable = true # 可執(zhí)行程序缺省不安裝,需要安裝時需要指定
part_name = "partA"
subsystem_name = "sub_example"
}

調(diào)用的C代碼:test\example\partA\feature2\src\helloworld2.c

#include "helloworld1.h" // 模塊partA/feature1
#include "module.h" // 模塊partB/module
#include <stdio.h>

void helloworld2(void)
{
printf("[demo] hello world 2222\n");
helloworld1(); // partA/feature1
module(); // partB/module
}

int main()
{
helloworld2();
return 0;
}

2.6 編譯配置test\example\ohos.build

配置中的inner_kits是test\example\partA\feature2\BUILD.gn跨組件依賴配置的關(guān)鍵。

{
"subsystem": "sub_example",
"parts": {
"partB": {
"module_list": [
"http://test/example/partB/module:module_lib"
],
"inner_kits": [
{
"type": "so",
"name": "http://test/example/partB/module:module_lib",
"header": {
"header_files": [
"module.h"
],
"header_base": "http://test/example/partB/module/include"
}
}
],
"system_kits": [],
"test_list": []
},
"partA": {
"module_list": [
"http://test/example/partA/feature1:libhelloworl1_lib",
"http://test/example/partA/feature2:helloworld2_bin"
],
"inner_kits": [],
"system_kits": [],
"test_list": []
}
}
}

三、編譯測試運(yùn)行

3.1 編譯:

./build.sh --product-name Hi3516DV300 --ccache --build-target helloworld2_bin

編譯成功后,可以把編譯好的helloworld2_bin和libmodule_lib.z.so用hdc_std.exe發(fā)送到Hi3516DV300開發(fā)板中去運(yùn)行,在串口終端上輸出調(diào)用結(jié)果。

3.2 修改系統(tǒng)權(quán)限,目錄能讀能寫:

mount -o remount,rw /

3.3 發(fā)送文件到開發(fā)板:

hdc_std.exe file send Z:\L2\out\ohos-arm-release\sub_example\partB\libmodule_lib.z.so /system/lib
//開發(fā)板目錄/data/test為自建目錄,沒有的話,先創(chuàng)建。
hdc_std.exe file send Z:\L2\out\ohos-arm-release\sub_example\partA\helloworld2_bin /data/test

3.3 修改成可執(zhí)行權(quán)后:

chmod 0711 /data/test/helloworld2_bin

3.4 運(yùn)行:

/data/test/helloworld2_bin

 

文檔中的代碼沒有完全展示,下載??【源代碼】??

重點(diǎn)關(guān)注目錄:example\partB\module,example\partA\feature1,example\partA\feature2

代碼庫中的源碼相對于文檔中的代碼有少許調(diào)整,基本結(jié)構(gòu)不變.

??想了解更多內(nèi)容,請?jiān)L問:??

??51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)??

??https://harmonyos.51cto.com??

責(zé)任編輯:jianghua 來源: 鴻蒙社區(qū)
相關(guān)推薦

2022-02-17 16:47:40

OpenharmonIPC通信鴻蒙

2022-06-22 09:14:23

事件打點(diǎn)HiSysEvent

2022-02-15 14:06:36

OpenHarmon操作系統(tǒng)鴻蒙

2022-07-04 16:41:16

IPC通信HiTrace

2022-07-14 19:03:33

IPC服務(wù)鴻蒙

2022-04-06 11:27:05

harmonyeTS 開發(fā)NAPI開發(fā)

2022-02-17 17:52:00

openharmon項(xiàng)目開發(fā)鴻蒙

2014-07-30 16:43:49

Android

2022-09-07 15:35:49

設(shè)備開發(fā)鴻蒙

2015-01-20 13:19:52

OpenStack網(wǎng)絡(luò)層數(shù)據(jù)鏈路層

2021-10-20 19:14:30

緩存CacheCPU

2022-03-21 15:42:36

智能家居物聯(lián)網(wǎng)MQTT

2022-07-29 14:29:24

設(shè)備開發(fā)鴻蒙

2022-10-24 14:54:29

LWIP協(xié)議鴻蒙

2022-01-06 16:16:21

鴻蒙HarmonyOS應(yīng)用

2022-06-14 15:07:04

IPC客戶端服務(wù)端

2022-09-06 15:25:22

Wifi設(shè)備開發(fā)

2020-11-10 11:58:17

鴻蒙應(yīng)用開發(fā)

2022-02-14 13:52:04

OpenHarmor系統(tǒng)鴻蒙

2023-02-20 08:00:00

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 日韩精品成人免费观看视频 | 日本小电影在线 | 三级视频在线观看电影 | 久久精品国产一区老色匹 | 激情五月激情综合网 | 久久美国| 欧美日韩精品久久久免费观看 | 国产精品久久久久久亚洲调教 | 亚洲成人一区二区 | 国产精品免费一区二区三区四区 | 国产高潮av | 密桃av| 日本精品视频一区二区 | 久久99精品久久久久久国产越南 | 一二三四在线视频观看社区 | 国产高清视频在线观看播放 | 国产精品日日做人人爱 | 一区视频在线播放 | 91在线成人| 久久久久国产精品免费免费搜索 | 日韩a v在线免费观看 | 黑人精品欧美一区二区蜜桃 | 欧美一级片在线播放 | 久久影音先锋 | 在线免费观看视频你懂的 | www.天天操.com | 国产精品污污视频 | 中国一级特黄真人毛片免费观看 | 爱综合| 国产区视频在线观看 | 亚洲精品视频一区 | 免费特黄视频 | 免费看黄色国产 | 91精品国产91久久久久久密臀 | 国产久 | 成人精品毛片国产亚洲av十九禁 | 国产h视频 | 九九色综合 | 在线成人精品视频 | 国产一区三区在线 | 91在线播|