自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Openharmony - 3516應(yīng)用調(diào)用到驅(qū)動(dòng)嘗試

系統(tǒng) OpenHarmony
ipcamera_hispark_taurus(代碼版本openharmony3.1 liteos-a), 編譯myapptest調(diào)用驅(qū)動(dòng)GPIO_TEST。從配置、編譯,燒錄到運(yùn)行。

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

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

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

一、簡(jiǎn)介

ipcamera_hispark_taurus(代碼版本openharmony3.1 liteos-a), 編譯myapptest調(diào)用驅(qū)動(dòng)GPIO_TEST。從配置、編譯,燒錄到運(yùn)行。

1.下載openharmony 3.1代碼。

2.添加myapp子系統(tǒng)。

3.編譯燒錄。

4.運(yùn)行。

二、代碼下載

代碼下載參考:openharmony 3.1。

三、添加myapp子系統(tǒng)

子系統(tǒng)配置:

添加:build\lite\components\myapp.json。

{
"components": [
{
"component": "myapptest",
"description": "myapptest",
"optional": "false",
"dirs": [
"myapp"
],
"targets": [
"http://myapp:myapp"
],
"rom": "",
"ram": "",
"output": [
],
"adapted_kernel": [
"liteos_a",
"liteos_m"
],
"features": [],
"deps": {
"third_party": [
"bounds_checking_function"
],
"components": []
}
}
]
}

編譯配置:

在vendor\hisilicon\hispark_taurus\config.json中添加:

 {
"subsystem": "myapp",
"components": [
{ "component": "myapp", "features":[] }
]
}

修改驅(qū)動(dòng)日志輸出:

修改文件:drivers\framework\test\unittest\platform\common\gpio_driver_test.c。

static int32_t GpioTestDispatch(struct HdfDeviceIoClient *client, int cmd, struct HdfSBuf *data, struct HdfSBuf *reply)
{
// 開始修改----------------
HDF_LOGD("%s: my app test enter!", __func__);
if (cmd == 0) {
const char *readData = HdfSbufReadString(data);
if (readData != NULL) {
HDF_LOGE("%s: read data is %s!", __func__, readData);
}
// 結(jié)束修改--------------
if (reply == NULL) {
HDF_LOGE("%s: reply is null!", __func__);
return HDF_ERR_INVALID_PARAM;
}
if (!HdfSbufWriteBuffer(reply, &g_config, sizeof(g_config))) {
HDF_LOGE("%s: write reply failed", __func__);
return HDF_ERR_IO;
}
} else {
return HDF_ERR_NOT_SUPPORT;
}

return HDF_SUCCESS;
}

myapp代碼目錄添加:

添加在根目錄下,代碼見附件。目錄結(jié)構(gòu)如下圖:

四、編譯燒錄

在代碼根目錄下,執(zhí)行編譯docker環(huán)境:

sudo docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5

docker編譯環(huán)境參考:docker。

編譯:

執(zhí)行下面三條命令:

hb set
.
hb build -f

如果hb set報(bào)錯(cuò)Invalid vendor path,刪除ohos_config.json再執(zhí)行上面的命令。

燒錄:

燒錄使用hitool:

四個(gè)文件中 三個(gè)是編譯生成的,一個(gè)是源代碼目錄中的二進(jìn)制。

源代碼目錄中的二進(jìn)制:device\hisilicon\hispark_taurus\sdk_liteos\uboot\out\boot\u-boot-hi3516dv300.bin。

將二進(jìn)制拷貝到同一的目錄D:\harmony_tool\hispark_taurus中:

添加的Hi3516DV300-emmc.xml內(nèi)容如下:

<?xml version="1.0" encoding="GB2312" ?>
<Partition_Info>
<Part Sel="1" PartitionName="fastboot" FlashType="emmc" FileSystem="none" Start="0" Length="1M" SelectFile="D:\harmony_tool\hispark_taurus\u-boot-hi3516dv300.bin"/>
<Part Sel="1" PartitionName="kernel" FlashType="emmc" FileSystem="none" Start="1M" Length="9M" SelectFile="D:\harmony_tool\hispark_taurus\OHOS_Image.bin"/>
<Part Sel="1" PartitionName="rootfs" FlashType="emmc" FileSystem="none" Start="10M" Length="35M" SelectFile="D:\harmony_tool\hispark_taurus\rootfs_vfat.img"/>
<Part Sel="1" PartitionName="userfs" FlashType="emmc" FileSystem="none" Start="45M" Length="120M" SelectFile="D:\harmony_tool\hispark_taurus\userfs_vfat.img"/>
</Partition_Info>

Length > 文件的大小, 下一條的start = 本條的start + 本條Length。

kernel的開始地址=fastboot的開始地址+fastboot的長(zhǎng)度,即kernel的開始地址=0 + 1M。

燒錄完成,實(shí)際上沒有進(jìn)入系統(tǒng)OHOS #, 需要進(jìn)行啟動(dòng)配置。

啟動(dòng)配置:

每一行是一條命令。

setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800;go 0x80000000;";
setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rw rootaddr=10M rootsize=35M";
setenv bootdelay 3
saveenv
print
reset

rootaddr的值是Hi3516DV300-emmc.xml文件中rootfs的開始地址,rootsize的值是rootfs的長(zhǎng)度。

啟動(dòng)配置參考:Hi3516DV300開發(fā)板->運(yùn)行。

執(zhí)行啟動(dòng)配置最后一條命令reset后,進(jìn)入系統(tǒng)。 即進(jìn)入OHOS #。

五、運(yùn)行

執(zhí)行:myapptest。

此文檔是在??HDF驅(qū)動(dòng)框架探路(二):openharmony最新源碼,打通應(yīng)用態(tài)到內(nèi)核態(tài)??的基礎(chǔ)上實(shí)踐。

編譯和啟動(dòng)配置這篇文章可參考。

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

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

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

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

2021-11-09 15:28:41

鴻蒙HarmonyOS應(yīng)用

2021-07-09 14:20:23

鴻蒙HarmonyOS應(yīng)用

2022-04-01 15:18:04

HarmonyHDF 驅(qū)動(dòng)鴻蒙

2021-12-03 09:50:39

鴻蒙HarmonyOS應(yīng)用

2023-08-18 14:28:18

UART異步通信

2022-03-02 16:08:31

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

2022-04-21 11:26:31

鴻蒙操作系統(tǒng)

2022-02-24 16:00:59

Ability鴻蒙JS

2023-02-13 15:54:49

2021-09-07 15:48:28

鴻蒙HarmonyOS應(yīng)用

2023-09-19 15:21:33

RTC鴻蒙

2023-09-06 15:27:22

ADC鴻蒙

2023-09-06 15:31:19

GPIO鴻蒙

2023-09-19 15:14:59

鴻蒙Watchdog

2021-12-29 14:57:47

德勤人工智能AI驅(qū)動(dòng)型企業(yè)

2021-07-21 09:58:50

鴻蒙HarmonyOS應(yīng)用

2023-04-17 16:14:55

靜態(tài)訂閱鴻蒙

2022-03-28 15:40:34

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

2023-03-08 15:55:53

Linux驅(qū)動(dòng)鴻蒙

2023-03-01 14:55:09

點(diǎn)贊
收藏

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