在嵌入式开发中,许多工程师已经习惯在Linux下进行开发。为了让这部分开发者能更快上手RVB2601开发板,本期内容我们将分享如何快速在Linux中搭建RVB2601开发环境。同时,本文还记录了作者iysheng在环境搭建过程中遇到的问题及解决方法,希望可以为大家提供经验借鉴。
01 前言
RVB2601是一款基于E906的RISC-V生态芯片,最高主频220MHz,RV32IMACX指令集。
参考资料
- T-Head-DebugServer-linux:
https://occ.t-head.cn/community/download?spm=a2cl5.25411629.0.0.3bfc180fYjhz3F&id=616215132330000384
02 搭建流程
最开始按照【RVB2601资源下载】下载的 sdk,根据 sdk 中的readme,执行发现编译的时候出现各种错误:
- 宏未定义
- 数据类型未定义
- 缺少头文件等
通过提交工单,了解到了正确的编译方法:
可能初次安装的时候会碰到product命令找不到的现象,根据《yoctools安装后无法找到product工具》:https://yoc.docs.t-head.cn/yocbook/FAQ.html,可以这样做:
sudo pip install --no-binary=yoctools yoctools
然后编译就正常了。
Build Solution by scons: Reading SConscript files ... [[1;33mWARNING[0m] /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 [INFO] Create bin files [2022-05-10 09:09:45] [40;32mStart to sign images with key:def_otp[0m ---------------------------------------------------------------- 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 ----------------------------------------------------------------
03 程序烧录
通过工单解决了这个问题,可以通过make flash可以完成程序下载。
工单网址:https://occ.t-head.cn/people/workorder-submit
程序烧录,需要使用Linux 版本的T-Head-DebugServer,目前最新版本的Linux 端的T-Head-DebugServer是T-Head-DebugServer-linux-x86_64-V5.14.2-20220415.sh.tar.gz,下载执行该脚本的安装,就会在 Linux 端安装上DebugServerConsole。
上述工具的安装方法:
▸ sudo ./T-Head-DebugServer-linux-x86_64-V5.14.2-20220415.sh -iDo you agree to install the DebugServer? [yes/no]:yesSet full installing path:This software will be installed to the path: (/usr/bin)? [yes/no/cancel]:yesInstalling ...Done!You can use command "DebugServerConsole" to start DebugServerConsole!(NOTE: The full path of 'DebugServerConsole.elf' is: /usr/bin/T-HEAD_DebugServer)
接下来准备烧录程序:
- 首先运行DebugServerConsole
- 在工程目录即solutions/ch2601_helloworld下执行make flash或者make flashall烧录部分镜像或者全部镜像
但是开始发现程序没有正常运行,通过不断麻烦平头哥小二咨询,最后发现是跳帽管脚跳的不对导致的。
具体体现在:
我拿到板子的时候,debug口连接的是w800,导致下载程序观察串口打印没有发生变化,通过修改debug链接到RVB2601就可以正常看到打印信息了。
至此,Linux端对RVB2601开发和烧录的环境就搭建好了。
04 下期预告
关于Linux下RVB2601开发环境的搭建就先介绍到这里,下期我们将分享上传RVB2601数据到飞燕平台以及下载飞燕平台数据到RVB2601的详细教程。欢迎大家持续关注应用实战系列内容。