【xr806开发板使用】连接wifi例程实现

##开发环境
win10 + WSL
##1、环境配置
参考:https://aijishu.com/a/1060000000287513

首先下载安装wsl 和ubuntu
https://docs.microsoft.com/zh-cn/windows/wsl/install

(1)安装repo:

创建repo安装目录:

mkdir ~/bin

下载repo:

wget https://storage.googleapis.com/git-repo-downloads/repo -P ~/bin/

改变执行权限:

chmod a+x ~/bin/repo

设置环境变量:

 nano ~/.bashrc //ctrl+o,再enter保存;ctrl+x退出

复制到最前面

 export PATH=~/bin:$PATH
 export REPO_URL=http://mirrors.tuna.tsinghua.edu.cn/git/git-repo/

然后更新环境变量

source ~/.bashrc

重启shell。

(2)下载系统:

安装python

sudo apt-get update
sudo apt install python3-pip
sudo apt-get install python3.8
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1//升级python

下载OpenHarmony_1.0.1_release仓库

repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify

下载代码

repo sync -c

继续下载剩余的大容量二进制文件

repo forall -c 'git lfs pull'

(3)下载xr806源码
1.从临时仓库:https://gitee.com/moldy-potato-chips/devboard_device_allwinner_xr806下载device仓内容,放到device路径下。

cd device

https://gitee.com/moldy-potato-chips/devboard_device_allwinn er_xr806

2.从临时仓库:https://gitee.com/moldy-potato-chips/devboard_vendor_allwinner_xr806下载vendor仓内容,放到device路径下。

cd vendor

https://gitee.com/moldy-potato-chips/devboard_vendor_allwinn er_xr806

到这里,device文件夹下有一个devboard_device_allwinner_xr806文件夹,这个文件夹实际应该是xradio,我们要把devboard_device_allwinner_xr806重命名为xradio。

cd --
cd device
mv devboard_device_allwinner_xr806 xradio

同理

cd --
cd vendor
mv devboard_vendor_allwinner_xr806 xradio

(4)设置编译工具链

cd --
mkdir ~/tools
cd tools
wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2

下载完成后,解压

tar jxvf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2

(5)搭建编译环境
安装hb:

python3 -m pip install --user ohos-build

下载LLVM:参考:https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-package-environment.md#https://gitee.com/link?target=https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar
解压LLVM安装包至~/llvm路径下。

tar -xvf llvm.tar -C ~/

文档中给的是tar -zxvf llvm.tar -C ~/我的报错了。

设置环境变量

nano ~/.bashrc

复制

export PATH=~/.local/bin:$PATH
export PATH=~/llvm/bin:$PATH

然后更新环境变量

source ~/.bashrc

执行"hb -h",界面打印以下信息即表示安装成功:
在这里插入图片描述

(6)工程配置
到这应该不会出现错误,按步骤执行就好了

sudo apt install libncurses5-dev
cd device/xradio/xr806/xr_skylark/
cp project/demo/audio_demo/gcc/defconfig .config
make menuconfig
make build_clean
make lib -j

按照官方教程完成hb set,就可以编译了。
##2、wifi例程
参考:https://aijishu.com/a/1060000000288355用VScode连接ubuntu。
(1)首先在ohosdemo文件夹下新建一个wlan文件夹,然后把wlan_demo中的所有子文件都复制过来
在这里插入图片描述

(2)更改wlan文件夹下的build.gn
在这里插入图片描述

(3)更改ohosdemo文件夹下的build.gn
在这里插入图片描述

其余的注释掉。
(4)然后打开wlan下的test_case.c更改一下内容。分别为xr806连接的wifi,和它开启的热点。
在这里插入图片描述

(5)CTRL+s 保存,然后hb build -f编译。这里可能会出现错误

参考:https://gitee.com/moldy-potato-chips/devboard_device_allwinner_xr806/blob/master/xr806/doc/1–系统下载与编译.md#常见错误排查
替换这两个文件
在这里插入图片描述

成功连接wifi:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值