赞
踩
编译命令行工具 HelloWorld,测试编译环境及项目配置
开发硬件环境:树莓派 3B+
根据开发硬件,选择文档标准系统编译构建指导(在这费了半天劲,找错了相关文档)
相对于~/ohos/openharmony 目录
device
├── rpi3
│ ├── rpi3
│ │ ├── hbis
│ │ │ ├── BUILD.gn
│ │ │ ├── src
│ │ │ │── main.c
│ │ ├── BUILD.gn
#include <stdio.h>
int main(int argc, char **argv)
{
printf("\n************************************************\n");
printf("\n\t\tHello HBIS!\n");
printf("\n************************************************\n\n");
return 0;
}
import("//build/ohos.gni")
group("hello-OHOS") {
deps = [
":helloworld",
]
}
ohos_executable("helloworld") {
sources = [ "src/main.c" ]
output_name = "helloworld"
install_enable = true
part_name = "rpi3_products"
}
import("//build/ohos.gni")
print("rpi3_group in")
group("rpi3_group") {
deps = [
"hbis:hello-OHOS",
]
}
...
}
OpenHarmony 树莓派 3B+ helloworld程序
python3 build-rpi3.py build
固件位置生成位置 out/ohos-arm-release/packages/phone/images/firmware.img
使用 Win32DiskImager 进行烧录
连接 rpi,输入指令:helloworld,即可打印输出
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。