鸿蒙开发进阶(OpenHarmony)Combo解决方案之W800芯片移植

鸿蒙NEXT开发实战往期必看文章:

一分钟了解”纯血版!鸿蒙HarmonyOS Next应用开发!

“非常详细的” 鸿蒙HarmonyOS Next应用开发学习路线!(从零基础入门到精通)

HarmonyOS NEXT应用开发案例实践总结合(持续更新......)

HarmonyOS NEXT应用开发性能优化实践总结(持续更新......)


本方案基于OpenHarmony LiteOS-M内核,使用联盛德W800芯片的润和软件海王星系列Neptune100开发板,进行开发移植。移植架构采用BoardSoC分离方案,支持通过Kconfig图形化配置编译选项,增加玄铁ck804ef架构移植,实现了HDFXTS等子系统及组件的适配。

适配准备

准备ubuntu20.04系统环境,安装csky-abiv2-elf-gcc交叉编译工具链。

编译构建

目录规划

本方案的目录结构使用Board和Soc解耦的思路

芯片适配目录规划为:

device
├── board                                --- 单板厂商目录
│   └── hihope                           --- 单板厂商名字:HiHope
│       └── neptune100                   --- 单板名:Neptune100
└── soc                                  --- SoC厂商目录
    └── winnermicro                      --- SoC厂商名字:联盛德
        └── wm800                        --- SoC Series名:w800系列芯片

产品样例目录规划为:

vendor
└── hihope                               --- 开发产品样例厂商目录,润和软件的产品样例
    ├── neptune_iotlink_demo             --- 产品名字:Neptune100产品样例代码
    └── ...

产品定义

vendor/hihope/neptune_iotlink_demo/config.json文件下,描述了产品使用的内核、单板、子系统等信息。其中,内核、单板型号、单板厂商需提前规划好,是预编译指令hb set关注的。例如:

{
  "product_name": "neptune_iotlink_demo",   --- 产品名
  "ohos_version": "OpenHarmony 3.1",        --- 使用的OS版本
  "type":"mini",                            --- 系统类型: mini
  "version": "3.0",                         --- 系统版本: 3.0
  "device_company": "hihope",               --- 单板厂商:hihope
  "board": "neptune100",                    --- 单板名:neptune100
  "kernel_type": "liteos_m",                --- 内核类型:liteos_m
  "kernel_version": "3.0.0",                --- 内核版本:3.0.0
  "subsystems": []                          --- 子系统
}

填入的信息与规划的目录相对应,其中device_companyboard用于关联出device/board/<device_company>/目录。

单板配置

关联到的目录下,在device/board/hihope/neptune100/liteos_m目录下放置config.gni文件,该配置文件用于描述该单板信息,包括CPU型号、交叉编译工具链及全局编译、链接参数等重要信息:

# Kernel type, e.g. "linux", "liteos_a", "liteos_m".
kernel_type = "liteos_m"

# Kernel version.
kernel_version = "3.0.0"

# Board CPU type, e.g. "cortex-a7", "riscv32".
board_cpu = "ck804ef"

# Board arch, e.g.  "armv7-a", "rv32imac".
board_arch = "ck803"

# Toolchain name used for system compiling.
# E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang,  riscv32-unknown-elf.
# Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toolchain.
board_toolchain = "csky-elfabiv2-gcc"

#use_board_toolchain = true

# The toolchain path installed, it's not mandatory if you have added toolchain path to your ~/.bashrc.
board_toolchain_path = ""

# Compiler prefix.
board_toolchain_prefix = "csky-elfabiv2-"

# Compiler type, "gcc" or "clang".
board_toolchain_type = "gcc"

# config.json parse
if (product_path != "") {
  product_conf = read_file("${product_path}/config.json", "json")
  product_name = product_conf.product_name
  bin_list = product_conf.bin_list
}

# Board related common compile flags.
board_cflags &
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值