iysheng 发表于 2022-5-11 17:40

Linux 搭建 RVB2601 开发环境

### Linux 下开发环境搭建

RVB2601 是一款基于 E906 的 RISC-V 生态芯片,最高主频 220MHz,RV32IMACX 指令集

#### 参考资料
* (https://occ.t-head.cn/vendor/detail/index?spm=a2cl5.26076654.0.0.6a8c180fesTplt&id=3886757103532519424&vendorId=3706716635429273600&module=4&key=download#sticky)
* (https://occ.t-head.cn/docs/Chapter2-E5BFABE9809FE4B88AE6898BE68C87E5BC95/YocTools.html#%E5%AE%89%E8%A3%85-yoctools)
* (https://occ.t-head.cn/community/download?id=616215132330000384)

#### 搭建流程

最开始按照 **RVB2601 资源下载** 下载的 sdk,根据 sdk 中的 readme,执行发现编译的时候出现各种错误:
* 宏为定义
* 数据类型未定义
* 缺少头文件等

通过提交工单,了解到了正确的编译方法:
![](https://s3.bmp.ovh/imgs/2022/05/11/7202a8ce08b05fa7.png)

可能初次安装的时候会碰到 ``product 命令找不到的现象``,根据(https://yoc.docs.t-head.cn/yocbook/FAQ.html),可以这样做:
``` bash
sudo pip install --no-binary=yoctools yoctools
```

然后编译就正常了。
``` bash
Build Solution by
scons: Reading SConscript files ...
[ /home/red/Projects/lite_led_controler/offical_helloworld/components/lvgl/src/lv_objx is not exists or not directory.
scons: done reading SConscript files.
scons: Building targets ...
scons: `yoc_sdk/lib/libsdk_chip_ch2601.a' is up to date.
scons: `yoc_sdk/lib/libcsi.a' is up to date.
scons: `yoc_sdk/lib/librhino.a' is up to date.
scons: `yoc_sdk/lib/librhino_arch.a' is up to date.
scons: `yoc_sdk/lib/librhino_pwrmgmt.a' is up to date.
scons: `yoc_sdk/lib/libhal_csi.a' is up to date.
scons: `yoc_sdk/lib/libaos_hal.a' is up to date.
scons: `yoc_sdk/lib/libchip_ch2601.a' is up to date.
scons: `yoc_sdk/lib/libcli.a' is up to date.
scons: `yoc_sdk/lib/libch2601_evb.a' is up to date.
scons: `yoc_sdk/lib/libkv.a' is up to date.
scons: `yoc_sdk/lib/libpartition.a' is up to date.
scons: `yoc_sdk/lib/libsec_crypto.a' is up to date.
scons: `yoc_sdk/lib/libaos.a' is up to date.
scons: `yoc_sdk/lib/libnewlib.a' is up to date.
scons: `yoc_sdk/lib/libdrivers.a' is up to date.
scons: `yoc_sdk/lib/libuservice.a' is up to date.
scons: `yoc_sdk/lib/libdrv_snd_ch2601.a' is up to date.
scons: `yoc_sdk/lib/libulog.a' is up to date.
scons: `yoc_sdk/lib/libminialsa.a' is up to date.
scons: `yoc_sdk/lib/liblvgl.a' is up to date.
scons: `yoc_sdk/lib/libsal.a' is up to date.
scons: `yoc_sdk/lib/libnetmgr.a' is up to date.
scons: `yoc_sdk/lib/libat.a' is up to date.
scons: `yoc_sdk/lib/libdrv_wifi_at_w800.a' is up to date.
scons: `yoc_sdk/lib/libch2601_helloworld.a' is up to date.
scons: `out/ch2601_helloworld/yoc.elf' is up to date.
scons: `yoc.elf' is up to date.
scons: `generated/data/prim' is up to date.
scons: done building targets.
YoC SDK Done
Create bin files
Start to sign images with key:def_otp
----------------------------------------------------------------
                boot, 0, 0, 0x18000000, 0x00010000, 0x18010000, boot
                imtb, 0, 0, 0x18010000, 0x00002000, 0x18012000, imtb
                bmtb, 0, 0, 0x18012000, 0x00001000, 0x18013000, bmtb
                  kv, 0, 0, 0x18013000, 0x00004000, 0x18017000
                prim, 1, 0, 0x18017000, 0x00040000, 0x18057000, prim
                misc, 0, 0, 0x18057000, 0x00029000, 0x18080000
    boot,    48512 bytes
    prim,    72496 bytes
    imtb,   8192 bytes
    bmtb,      192 bytes
----------------------------------------------------------------
```

#### 程序烧录
通过 [工单202205090014](https://occ.t-head.cn/people/my/work-order/details?id=4044173371767267328) 解决了这个问题,可以通过 ``make flash`` 可以完成程序下载。

程序烧录,需要使用 **Linux 版本的 T-Head-DebugServer**,目前最新版本的 Linux 端的 T-Head-DebugServer 是 **T-Head-DebugServer-linux-x86_64-V5.14.2-20220415.sh.tar.gz**,下载执行该脚本的安装,就会在 Linux 端安装上 ``DebugServerConsole``。

上述工具的安装方法:
``` bash
▸ sudo ./T-Head-DebugServer-linux-x86_64-V5.14.2-20220415.sh -i
Do you agree to install the DebugServer? :yes
Set full installing path:
This software will be installed to the path: (/usr/bin)? :yes
Installing ...
Done!
You can use command "DebugServerConsole" to start DebugServerConsole!
(NOTE: The full path of 'DebugServerConsole.elf' is: /usr/bin/T-HEAD_DebugServer)
```

接下来准备烧录程序:
1. 首先运行 ``DebugServerConsole``
2. 在工程目录即 ``solutions/ch2601_helloworld``下执行 ``make flash`` 或者 ``make flashall`` 烧录部分镜像或者全部镜像

![](https://s3.bmp.ovh/imgs/2022/05/11/ddab4198fa27e52b.png)

但是开始发现程序没有正常运行,通过不断麻烦平头哥小二咨询,最后发现是跳帽管脚跳的不对导致的。

具体体现在:
![](https://s3.bmp.ovh/imgs/2022/05/11/2e0b0f2cc1beda6b.png)

我拿到板子的时候,debug 口链接的是 w800,导致下载程序观察串口打印没有发生变化,通过修改 debug 链接到 RVB1062 就可以正常看到打印信息了。

![](https://s3.bmp.ovh/imgs/2022/05/11/8d8c1783ef3c478b.png)

至此,Linux 端对 RVB1062 开发和烧录的环境就搭建好了。

lugl4313820 发表于 2022-5-11 18:57

用这个方法,相比用CDK是不是更加方便一些,谢谢分享。

iysheng 发表于 2022-5-12 08:51

lugl4313820 发表于 2022-5-11 18:57
用这个方法,相比用CDK是不是更加方便一些,谢谢分享。

<p>个人感觉在 Linux 上进行嵌入式开发还是比较方便的。</p>
页: [1]
查看完整版本: Linux 搭建 RVB2601 开发环境