[文章]

【HarmonyOS IPC 试用连载 】第二篇 编译及下载演示demo(hello+usb camera)

2021-1-11 17:40:09  180 IPC 试用 hi3518ev300
分享
0
前一篇将开发所用到的软件及硬件环境资料等都准备完毕https://bbs.elecfans.com/jishu_2027807_1_1.html,接下来就演示一下大家都知道的hello OHOS及usb camera。
1、编译程序(ubuntu下编译)
编译官网的源代码,进入到代码目录输入python build.py ipcamera_hi3518ev300,进行编译。
  1. python build.py ipcamera_hi3518ev300
复制代码

大概七八分钟的样子。如果不记得编译命令,输入python build.py
  1. root@ubuntu:/home/swann/HarmonyOS_Code/HarmonyOS_Code# python build.py
  2. usage:
  3.   python build.py ipcamera_hi3516dv300
  4.   python build.py ipcamera_hi3518ev300
  5.   python build.py wifiiot

  6.   Quickstart: https://device.harmonyos.com/cn/docs/start/introduce/oem_start_guide-0000001054913231

  7. positional arguments:
  8.   product               Name of the product

  9. optional arguments:
  10.   -h, --help            show this help message and exit
  11.   -b BUILD_TYPE, --build_type BUILD_TYPE
  12.                         release or debug version.
  13.   -t [TEST [TEST ...]], --test [TEST [TEST ...]]
  14.                         Compile test suit
  15.   -n, --ndk             Compile ndk
  16. Error: product not found.
  17. root@ubuntu:/home/swann/HarmonyOS_Code/HarmonyOS_Code#
复制代码
查看支持哪些编译选项,再进行编译。
编译成功会打印成功的消息,如果不成功,根据错误提示(一定是根据错误提示,进行相应工具的安装接着编译)。我这边根据官网提示一步一步安装的,未出现编译不通过的问题。
  1. [846/854] clang++ obj/foundation/multimedia/frameworks/player_lite/player_control/sink/player_audio_sink.o
  2. [847/854] SOLINK ./libplayer.so
  3. [848/854] STAMP obj/foundation/multimedia/services/media_lite/media_lite.stamp
  4. [849/854] STAMP obj/foundation/multimedia/services/media_lite/media_ndk.stamp
  5. [850/854] LLVM LINK dev_tools/bin/player_sample
  6. [851/854] STAMP obj/applications/sample/camera/media/media_sample.stamp
  7. [852/854] STAMP obj/build/lite/ohos.stamp
  8. [853/854] ACTION //build/lite:gen_rootfs(//build/lite/toolchain:linux_x86_64_clang)
  9. [854/854] STAMP obj/build/lite/gen_rootfs.stamp
  10. ohos ipcamera_hi3518ev300 build success!
复制代码
根据多年的编译经验,编译不通过一般找不到路径的工具导致,缺少某些库等等。
成功后,在源码目录生成out文件,内部有个ipcamera_hi3518ev300目录,生成的文件就在这个文件内部了,如图1所示。
编译成功.png
图1 编译成功界面
我们需要下载的就是OHOS_Image.bin、rootfs.img和useRFs.img以及源码目录下路径vendor\hisi\hi35xx\hi3518ev300\uboot\out\boot里面的uboot就可了。
2、烧录程序(windows10下visual studio code usb烧录)
打开烧录及编辑软件Visual Studio Code软件,点击Deveco Device Tool界面,点击Configure,右侧界面中点击burn,设置烧录模式、串口设置、flash设置以及烧录文件设置,都设置好点击保存。不会的可以去华为官网烧录部分查看https://device.harmonyos.com/cn/docs/start/introduce/oem_camera_start_example-0000001051610926。如图2的烧写步骤界面。
烧录1.jpg
图2-1 烧录步骤
烧录2.png
图2-2烧录步骤
3、烧录过程中遇到的问题
问题1:如图3所示问题,好像缺少什么。
问题1.png
图3 点击burn出现问题
解决办法:网上别人填的坑,我直接搜到了https://blog.csdn.net/qq_34779901/article/details/111823276。
a、打开cmd命令行,输入npm config找到hpmrc的路径
b、打开配置文件hpmrc,将第二行的空格删除掉,保存后重新打开vscode。
坑1.png
问题2:修改文件保存出现问题,如图4所示
坑2.png
图4 保存修改文件问题
解决办法:去修改源码目录文件属性,到源码目录执行
  1. sudo chmod -R 777 *
复制代码
点击Burn后,需要重启2次板子电源,根据紫色打印进行操作,烧录成功。
4、烧录结果展示
a、vscode烧录成功如下
  1. > Executing task: hpm run 'upload' <

  2. Start flash images...

  3. Open serial port: COM3

  4. Please power off and restart the board......
  5. testuboot succeed

  6. sf probe 0;sf erase 0x0 0x100000;
  7. Erasing at 0x100000 -- 100% complete.
  8. SF: 1048576 bytes @ 0x0 Erased: OK
  9. hisilicon # sendHisiliconCmd: isilicon # sf probe 0;sf erase 0x0 0x100000;
  10. Erasing at 0x100000 -- 100% complete.
  11. SF: 1048576 bytes @ 0x0 Erased: OK
  12. hisilicon #
  13. Please power off and restart the board......

  14. sendUSBStartFrame Success
  15. sendUSBHeadFrame Success
  16. sendTailFrame Success
  17. sendUSBHeadFrame Success
  18. sendTailFrame Success
  19. sendUSBHeadFrame Success
  20. sendTailFrame Success


  21. System startup

  22. Uncompress Ok!

  23. U-Boot 2020.01 (Sep 02 2020 - 17:34:02 +0800)hi3518ev300

  24. DRAM:  SPI Nor:  hifmc_ip_ver_check(54): Check Flash Memory Controller v100 ...hifmc_ip_ver_check(60):  Found
  25. hifmc_spi_nor_probe(2070): SPI Nor ID Table Version 1.0
  26. hifmc_spi_nor_probe(2095): SPI Nor(cs 0) ID: 0x20 0x70 0x18
  27. hifmc_init_print(2016): Block:64KB hifmc_init_print(2017): Chip:16MB hifmc_init_print(2018): Name:"XM25QH128A"
  28. hifmc100_spi_nor_probe(145): SPI Nor total size: 16MB
  29. NAND:  0 MiB
  30. Loading Environment from SPI Flash... *** Warning - bad CRC, using default environment

  31. Loading Environment from NAND... *** Warning - readenv() faiLED, using default environment

  32. In:    serial
  33. Out:   serial
  34. Err:   serial
  35. Net:   eth0
  36. Error: eth0 address not set.

  37. start download process.
  38. sendData: � getinfo version
  39. sendCmd Success:
  40. sendData: � getinfo bootmode
  41. sendCmd Success:
  42. version: U-Boot 2020.01
  43. spi
  44. sendData: �
  45. sf probe 0
  46. sendCmd Success:
  47. sendData: �
  48.             getinfo spi
  49. sendCmd Success:
  50. Block:64KB ChisendData: �
  51. sf probe 0
  52. sendCmd Success:
  53. p:16MB*1 sendData: � sf erase 0x0 0x100000
  54. sendCmd Success:

  55. ID:0x20 0x70 0x18
  56. Name:"XM25QH128A"
  57. Erasing at 0x100000 -- sendData: � sf write 0x41000000 0 0x40000
  58. sendCmd Success:
  59. 100% complete.
  60. SF: 1048576 bytes @ 0x0 Erased: OK
  61. device 0 offset 0x0, size 0x40000
  62. Writing at 0x40000 --  75% complete.
  63. Succeed to load and write Uboot to flash
  64. 100% comsendUSBStartFrame Success
  65. plete.
  66. SF: 262144 bytes @ 0x0 Written: OK
  67. sendUSBHeadFrame Success
  68. sendTailFrame Success
  69. sendData: �
  70. sf probe 0
  71. sendCmd Success:
  72. sendData: � sf erase 0x100000 0x600000
  73. sendCmd Success:
  74. Erasing at 0x700000 -- 100% sendData: � %sf write 0x41000000 0x100000 0x3d0000
  75. sendCmd Success:
  76. complete.
  77. SF: 6291456 bytes @ 0x100000 Erased: OK
  78. device 0 offset 0x100000, size 0x3d0000
  79. Writing at 0x4d0000 -- 100% cosendUSBStartFrame Success
  80. mplete.
  81. SF: 399769sendUSBHeadFrame Success
  82. 6 bytes @ 0x100000 Written: OK
  83. sendTailFrame Success
  84. sendData: �
  85. sf probe 0
  86. sendCmd Success:
  87. sendData: � sf erase 0x700000 0x800000
  88. sendCmd Success:
  89. Erasing at 0xf00000 -- 100sendData: � %sf write 0x41000000 0x700000 0x650000
  90. sendCmd Success:
  91. % complete.
  92. SF: 8388608 bytes @ 0x700000 Erased: OK
  93. device 0 offset 0x700000, size 0x650000
  94. Writing at 0xd50000 -- 100sendUSBStartFrame Success
  95. % complete.
  96. SF: 661913sendUSBHeadFrame Success
  97. 6 bytes @ 0x700000 Written: OK
  98. sendTailFrame Success
  99. sendData: �
  100. sf probe 0
  101. sendCmd Success:
  102. sendData: � sf erase 0xf00000 0x100000
  103. sendCmd Success:
  104. Erasing at 0x1000000 -- 10sendData: � $sf write 0x41000000 0xf00000 0x10000
  105. 0% csendCmd Success:
  106. omplete.
  107. SF: 1048576 bytes @ 0xf00000 Erased: OK
  108. device 0 offset 0xf00000, size 0x10000
  109. Writing at 0xf10000 -- 100%
  110. Succeed to load and write images. Please restart the board

  111. reset success!
  112. co
  113. Terminal will be reused by tasks, press any key to close it.
复制代码
b、打开xshell,点击enter如图5输入官网的参数,reset,进入系统执行程序,打印了Hello OHOS!
hello.png
图5 华为鸿蒙测试app
5、自带bin文件烧录
a、用HiTool烧录,打开软件,如图6所示,下载usb camera测试程序。
hitool.png
图6 HiTool工具烧写usb camera程序
b、下载完成,打开电脑上的摄像头成像,就出现图像了。
这些都是有指导手册的。

相关文章

评论

您需要登录后才可以回帖 登录 | 注册

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容图片侵权或者其他问题,请联系本站作侵删。 侵权投诉
发文章