
回复
添加资源
添加资源将有机会获得更多曝光,你也可以直接关联已上传资源 去关联
@toc
ipcamera_hispark_taurus(代码版本openharmony3.1 liteos-a), 编译myapptest调用驱动GPIO_TEST
。从配置、编译,烧录到运行。
1.下载openharmony 3.1代码。
2.添加myapp子系统
3.编译烧录
4.运行
代码下载参考:openharmony 3.1
build\lite\components\myapp.json
{
"components": [
{
"component": "myapptest",
"description": "myapptest",
"optional": "false",
"dirs": [
"myapp"
],
"targets": [
"//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":[] }
]
}
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);
}
// 结束修改--------------
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;
}
附件
。目录结构如下图:sudo docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5
docker编译环境参考:docker
hb set
.
hb build -f
如果hb set
报错Invalid vendor path
,删除ohos_config.json
再执行上面的命令。
device\hisilicon\hispark_taurus\sdk_liteos\uboot\out\boot\u-boot-hi3516dv300.bin
D:\harmony_tool\hispark_taurus
中:Hi3516DV300-emmc.xml
内容如下:<?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的长度,即kernel的开始地址=0 + 1M
OHOS #
, 需要进行启动配置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的长度
。
启动配置参考:Hi3516DV300开发板->运行
reset
后,进入系统。 即进入OHOS #
。执行:myapptest
此文档是在HDF驱动框架探路(二):openharmony最新源码,打通应用态到内核态的基础上实践。
完整添加自定义驱动步骤
参考Openharmony 添加内核驱动(L1)
编译和启动配置这篇文章可参考。