谷动谷力

标题: 【RISC-V 生态软件系列】Waft基础教学一:搭建Waft运行环境 [打印本页]

作者: 鸣涧    时间: 2022-3-9 21:30
标题: 【RISC-V 生态软件系列】Waft基础教学一:搭建Waft运行环境
【RISC-V 生态软件系列】Waft基础教学一:搭建Waft运行环境


本文旨在帮助开发者搭建平头哥上的waft运行环境

调试接口说明


该type-c usb口支持adb通道,支持adb命令(push、shell)


该type-c usb口是串口通道,安装ch340驱动后,搞开发的这个应该都有, 可以使用串口工具(如SecureCRT,Putyy)登入调试。

驱动下载连接:https://sparks.gogo.co.nz/ch340.html
串口参数设置:

更新waft容器


Waft引擎也在持续迭代开发中,板子系统自带的waft容器固件相对较老,可以通过下载链接获取Waft容器固件,链接如下:
https://occ.t-head.cn/vendor/detail/download?spm=a2cl5.14293893.0.0.9ecd707aKGYdRr&id=3978884137347461120&vendorId=3895463451199475712&module=3#sticky
下载waft固件包,解压后,按如下说明push到开发板



推送方式参考adb或者scp的使用方法。

WIFI连接
waft的运行、更新均需要依赖网络,所以需要在开发板上配置好wifi网络:

方法一
更新完waft容器后,运行如下命令:
waft_app /waftapps/app_wifi.wasm
点击wifi信号位置进入wifi连接设置界面,搜索wifi、输入密码连接即可。


方法二


方法一直接修改wpa_supplicant的配置文件,增加如下内容到/etc/wifi/wpa_supplicant.conf文件中,直接用vi编辑,vi /etc/wifi/wpa_supplicant.conf
ctrl_interface=/etc/wifi/socketsctrl_interface_group=0disable_scan_offload=1update_config=1network={        ssid="YourSSID"        psk="YourPassword"}
YourSSID替换成自己的wifi网络名,YourPassword改为自己的密码。

方法三


方法二使用wpa_cli工具,熟悉的用户可以选择这种方式
记住返回的数字,这个是网络配置序号,后续要用到,假如返回的是“1”,后面以“1”为举例。

注意:无线网络名需要用一个单引号加一个双引号包含住。

wpa_cli -iwlan0 set_network 1 psk '"YourPassword"'
注意:密码需要用一个单引号加一个双引号包含住。
wpa_cli -iwlan0 enable_network 1wpa_cli -iwlan0 save_config
用于下次开机自动重连
wpa_cli -iwlan0 status
有COMPLETED字段表示ok
freq=2437ssid=xxxxxxid=0mode=stationpairwise_cipher=CCMPgroup_cipher=CCMPkey_mgmt=WPA2-PSKwpa_state=COMPLETEDip_address=172.16.0.167address=94:f7:f9:9a:40:68uuid=53f24614-85b0-5e32-b3d1-9bac85a5958cudhcpc -iwlan0



开发环境搭建


MacOS, Linux,(Windows支持中)

vscode安装
vscode安装请自行下载安装

脚手架安装


输入命令npm i waft-cli -g
  1. sun@sun-ubuntu:~$ npm i waft-cli -g
  2. ^[^A[..................] - fetchMetadata: sill resolveWithNewModule waft-devtoolnpm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
  3. npm WARN deprecated @types/ora@3.2.0: This is a stub types definition. ora provides its own type definitions, so you do not need this installed.
  4. npm WARN deprecated @types/stylelint@14.0.0: This is a stub types definition. stylelint provides its own type definitions, so you do not need this installed.
  5. npm WARN deprecated @types/colors@1.2.1: This is a stub types definition. colors provides its own type definitions, so you don't need this installed.
  6. npm WARN deprecated loadsh@0.0.4: This is a typosquat on the popular Lodash package. This is not maintained nor is the original Lodash package.
  7. npm WARN deprecated @types/table@6.3.2: This is a stub types definition. table provides its own type definitions, so you do not need this installed.
  8. [   ...............] - fetchMetadata: sill resolveWithNewModule callsites[   .npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
  9. npm WARN deprecated har-validator@5.1.5: this library is no longer supported
  10. /opt/node-v14.15.4-linux-x64/bin/waft -> /opt/node-v14.15.4-linux-x64/lib/node_modules/waft-cli/bin/waft

  11. > core-js-pure@3.21.1 postinstall /opt/node-v14.15.4-linux-x64/lib/node_modules/waft-cli/node_modules/core-js-pure
  12. > node -e "try{require('./postinstall')}catch(e){}"

  13. Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

  14. The project needs your help! Please consider supporting of core-js:
  15. > https://opencollective.com/core-js
  16. > https://patreon.com/zloirock
  17. > https://paypal.me/zloirock
  18. > bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz

  19. Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

  20. + waft-cli@0.7.18
  21. added 886 packages from 513 contributors in 1642.959s
复制代码
这样就安装好了,安装过程有点长


如果有权限问题,加上sudo ,sudo npm i waft-cli -g。

创建项目


通过waft脚手架初始化项目,会引导您进行项目命名等,您将得到一个新project
[code]sun@sun-ubuntu:~$ mkdir waft
sun@sun-ubuntu:~$ cd waft
sun@sun-ubuntu:~/waft$ waft init
? What's project name? hello_waft
? Which template package to from? waft-hello-world

1637925444338-81727b4b-7b83-484c-b61a-24fcc0aad2e0.png (120.6 KB, 下载次数: 300)

1637925444338-81727b4b-7b83-484c-b61a-24fcc0aad2e0.png

1637931367391-b0a1c6e5-61c9-4542-b049-21d33eab65a2.png (635.29 KB, 下载次数: 307)

1637931367391-b0a1c6e5-61c9-4542-b049-21d33eab65a2.png

1637934380564-359947db-1723-4903-ba03-db491b615de6.png (79.7 KB, 下载次数: 315)

1637934380564-359947db-1723-4903-ba03-db491b615de6.png

index.png (216.62 KB, 下载次数: 300)

index.png

作者: 鸣涧    时间: 2022-3-9 23:40
退出调试模式
o exit, press Ctrl+C again or Ctrl+D or type .exit
作者: 鸣涧    时间: 2022-3-14 01:53

https://occ-oss-prod.oss-cn-hang ... c74959bf3803b61.mp4






欢迎光临 谷动谷力 (http://bbs.sunsili.com/) Powered by Discuz! X3.2