联盛德 HLK-W806 (一): Ubuntu20.04下的开发环境配置, 编译和烧录说明

目录

介绍

W806是32位MCU, 1MB flash, 288K内存, MCU部分是T-HEAD 800 系列的XT-E804

  • XT-E804 是平头哥(被阿里收购前的中天微电子)的MCU, 属于T-HEAD 800 系列
  • T-HEAD 500, 600 和 800 系列属于 CSKY 架构(与RISC-V接近)
    • T-HEAD 500 和 600 系列基于 CSKY V1
    • T-HEAD 800 系列基于 CSKY V2
  • 联盛德和合宙的部分芯片型号, MCU部分是一样的
    • 合宙Air101, XT-E804的QFN32封装
    • 联盛德W800, XT-E804加上自研的2.4G无线部分, QFN32封装
    • 联盛德W806, 合宙Air103, XT-E804的QFN56封装
    • 联盛德W801, XT-E804加上自研的2.4G无线部分, QFN56封装

关于CSKY架构

CSKY架构在2018年底被合并入Kernel. 关于这个架构, Bergmann的评论:

In commenting on C-SKY, Arnd Bergmann commented that C-SKY might end up being the last new CPU architecture added to the kernel... He rightfully points out that most vendors now not part of the ARM/x86/POWER bandwagon are pursuing RISC-V based designs, which is already part of the mainline kernel. For low-power devices ARM and RISC-V are likely the future and with those architectures there isn't much of an advantage for hardware vendors to pursue their own architectures from scratch. On the high performance computing front, nothing is expected to unseat x86_64 and POWER anytime soon... If any new CPU targets are added to the Linux kernel in the coming years, it's likely to be some virtual target. One more general comment: I think this may well be the last new CPU architecture we ever add to the kernel. Both nds32 and c-sky are made by companies that also work on risc-v, and generally speaking risc-v seems to be killing off any of the minor licensable instruction set projects, just like ARM has mostly killed off the custom vendor-specific instruction sets already. If we add another architecture in the future, it may instead be something like the LLVM bitcode or WebAssembly, who knows?

另一个评论:

While there isn't anything preventing new architectures from being introduced, the general trend is that fewer and fewer architectures are being developed. x86, ARM, and now RISC-V are fulfilling more and more use cases. It's much cheaper to tweak an existing processor or platform than to invent your own from nothing. With RISC-V, this becomes even more the case since there are no royalties involved. MIPS also went open source recently, which is popular in routers and embedded devices. AFAIK, C-SKY doesn't exist for technical reasons, it only exists because the Chinese wanted their own architecture.

W806芯片参数

封装

  • QFN56, 6mm x 6mm, pin间距0.35mm

MCU 特性

  • 集成 32 位 XT804 处理器,工作频率 240MHz,内置 DSP、浮点运算单元与安全引擎
  • 内置 1MB Flash,288KB RAM
  • 集成 PSRAM 接口,支持最高 64MB 外置 PSRAM 存储器
  • 集成 6 路 UART 高速接口
  • 集成 4 路 16 比特 ADC,最高采样率 1KHz
  • 集成 1 个高速 SPI 接口(从接口),支持最高 50MHz
  • 集成一个主/从 SPI 接口
  • 集成 1 个 SDIO_HOST 接口,支持 SDIO2.0、SDHC、MMC4.2
  • 集成 1 个 SDIO_DEVICE,支持 SDIO2.0,最高吞吐率 200Mbps
  • 集成 1 个 I2C 控制器
  • 集成 GPIO 控制器,最多支持 44 个 GPIO
  • 集成 5 路 PWM 接口
  • 集成 1 路 Duplex I2S 控制器
  • 集成 LCD 控制器,支持 4x32 接口
  • 集成 1 个 7816 接口
  • 集成 15 个 Touch Sensor

供电

  • 3.3V 单电源供电
  • 支持工作、睡眠、待机、关机工作模式
  • 待机功耗小于 10uA

关于W806和Air103

W806和Air103实质上是同一款芯片, 从pin脚定义可以看到是pin-pin对应的. 在合宙的WIKI上也注明了"本芯片与联盛德w806可互换".

HLK-W806 开发板

这个板子在淘宝上的实际售价差不多在8 RMB, 加上一些商家优惠, 可以真正做到低于0.99 USD, 这个价格的32位MCU, 性价比完胜STC的那些8位MCU了.

正面

背面

参数

  • MCU – WinnerMicro W806 32-bit XT804 MCU
  • 2x24排针
  • Debugging – CH340 via micro USB port
  • Misc – Reset and Boot buttons
  • Power Supply – 5V via micro USB port
  • 尺寸65 x 26 mm

使用

下载

安装

上面下载的tar.gz文件外层路径用的是./目录, 建议放到一个单独的目录中解压, 或者指定解压目录解压目录, 参考命令如下

mkdir csky-elfabiv2-tools-x86_64-minilibc-20210423
tar xvf csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz  -C csky-elfabiv2-tools-x86_64-minilibc-20210423/

移动到/opt下, 目录可以自己定, 设置权限禁止普通用户修改

cd /opt/toolchains/
sudo mv ~/Download/csky-elfabiv2-tools-x86_64-minilibc-20210423/ .
sudo chown -R root:root csky-elfabiv2-tools-x86_64-minilibc-20210423/

不需要添加系统路径

编译

导出此项目

git clone https://github.com/IOsetting/wm-sdk-w806.git

运行menuconfig, 配置工具路径

cd wm-sdk-w806
make menuconfig

在menuconfig界面中, Toolchain Configuration -> 第二个toolchain path, 将刚才的路径填进去, 需要完整路径, 带最后的斜杆, 例如

/opt/toolchains/csky-elfabiv2-tools-x86_64-minilibc-20210423/bin/

其他不用动, Save后退出menuconfig

执行编译

make

写入开发板

首先通过dmesg,lsusb, ls /dev/tty*等命令确定自己开发板在系统中对应的USB端口, 例如ttyUSB0.

运行menuconfig, 配置端口名称

cd wm-sdk-w806
make menuconfig

在menuconfig界面中, Download Configuration -> download port, 填入开发板在你的系统中对应的USB端口, 例如ttyUSB0, 注意这里只需要填纯端口名, 不需要用完整的路径. 可以调高波特率加快下载,只支持115200, 460800, 921600, 1000000, 2000000, Save后退出menuconfig

执行烧录

make flash

根据输出的提示, 按一下reset键就会开始下载. 如果前一次写入的固件已经开启了USE_UART0_AUTO_DL则不需要按键, 会自动开始下载

enerate compressed image completed.
build finished!
connecting serial...
serial connected.
wait serial sync.........         <----- 这里按下reset
please manually reset the device. <----- 或者这里
....
serial sync sucess.
mac CC-CC-CC-CC-CC-CC.
start download.
0% [###] 100%
download completed.
reset command has been sent.

下载完成后, 下载工具会发送复位指令, 复位成功后程序会自动开始执行. 如果自动复位失败, 则需要按一下Reset键手工复位.

更多下载选项

显示串口列表

make list

烧录并打开串口监视器

make run

只打开串口监视器

make monitor

问题

如果出现can not open serial make: *** [tools/w806/rules.mk:158: flash] Error 255错误, 检查一下是否有其他串口软件占用了这个端口, 如果有需要先关闭

参考

posted on 2021-11-10 18:25  Milton  阅读(6963)  评论(0编辑  收藏  举报

导航