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

目录

  • 联盛德 HLK-W806 (一): Ubuntu20.04下的开发环境配置, 编译和烧录说明
  • 联盛德 HLK-W806 (二): Win10下的开发环境配置, 编译和烧录说明
  • 联盛德 HLK-W806 (三): 免按键自动下载和复位
  • 联盛德 HLK-W806 (四): 软件SPI和硬件SPI驱动ST7735液晶LCD
  • 联盛德 HLK-W806 (五): W801开发板上手报告

介绍

W806是32位MCU, 1MB flash, 288K内存, 是W800去掉无线部分的版本, 这个芯片背后是T-HEAD 800 系列. 这个月HLK还会上架带无线部分的版本, 型号是W801.
T-HEAD 500, 600 和 800 系列都是基于 CSKY 架构, 其中 T-HEAD 500 和 600 系列基于 CSKY V1, T-HEAD 800 系列基于 CSKY V2. T-HEAD 800 系列的 ABI 是 CSKY ABI V2.

关于W806

题外话, 顺便了解一下. 2006年初的汉芯事件, 其中一个关键人物是这个项目的评审专家组组长严晓浪, 严是中天微的创始人, 而W806呢, 其实就是中天微的XT804内核给联盛德贴牌的产品.

当时这个圈子, 基本上都是从moto-freescale一脉相承, 汉芯虽然是用dsp56800打磨, 但是确实弄到了dsp56800的源代码, 中天微的自定义指令集CSKY v1, v2, 也是moto-freescale m-core的一个分支. 杭州中天微系统有限公司2001年成立, 主要领域是嵌入式CPU和自定义指令集, 前面两代CSKY v1,v2是兼容m-core(moto rce)的定制化指令集, 2015年前后开始与阿里合作, 2018年4月正式被阿里收购, 改名叫平头哥, 同年年底发布的v3转向了开源的risc-v. 联盛德是2017年前后开始参乎进来的, 成为阿里iot伙伴之后也就顺理成章的在中天微的芯片基础上发布产品, 2018年发布了W600系列, 2019年发布了W800系列.

中天微的产品系列是CK61x, CK80x, CK81x系列, CK90x系列, 其中

  • CK61x 属于CSKY v1, 发布时间不详, 和T-HEAD 500,600 是同一个系列
  • CK80x, CK81x 属于CSKY v2, 2011年前后发布, 和T-HEAD 800是同一个系列.
  • CK90x 属于risc-v, 2018年9月发布, 之后发布的新品, 指令集都是基于risc-v

关于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.

HLK-W806 开发板

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

正面
联盛德 HLK-W806 (一): Ubuntu20.04下的开发环境配置, 编译和烧录说明_第1张图片

背面
联盛德 HLK-W806 (一): Ubuntu20.04下的开发环境配置, 编译和烧录说明_第2张图片

参数

  • MCU – WinnerMicro W806 32-bit XT804 MCU
    • 240 MHz
    • 1MB Flash
    • 288KB RAM
    • FPU, DSP, crtypto engine
  • 2x24排针
  • 1x SDIO host with support for SDIO 2.0, SDHC, MMC 4.2
  • 1x SDIO device up to 200 Mbps
  • Up to 6x UART, 1x I2C
  • 1x SPI slave up to 50 MHz, 1x master/slave SPI
  • LCD controller with support for 4×32 interface
  • 1x I2S
  • Up to 4x ADC (16-bit, 1KHz sampling rate)
  • Up to 44x GPIOs, 5x PWM, PWM最高到160KHz, 分辨率比较低只有8bit
  • Up to 15 touch sensors
  • ISO/IEC 7816 smart card interface
  • Reset, Wakeup, 3.3V, and GND signals
  • Debugging – CH340 via micro USB port
  • Misc – Reset and Boot buttons
  • Power Supply – 5V via micro USB port
  • 尺寸65 x 26 mm

使用

下载

  • https://occ.t-head.cn/community/download 下载编译工具
  • 导航->工具->工具链-800系列->(当前是V3.10.29)
  • 根据自己的操作系统, 下载对应版本, 对于Ubuntu20.04, 下载 csky-elfabiv2-tools-x86_64-minilibc-yyyymmdd.tar
  • 如果上面的链接有问题或者无法注册, 可以通过百度盘下载 https://pan.baidu.com/s/1Mp-oHNM3k4Hb8vEybv8pZg code:vw42

安装

上面下载的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错误, 检查一下是否有其他串口软件占用了这个端口, 如果有需要先关闭

参考

  • 相关讨论 https://www.cnx-software.com/2021/11/08/winnermicro-w806-240-mhz-mcu-2-development-board/
  • 资料下载 https://occ.t-head.cn/community/download
  • 资料下载 https://h.hlktech.com/Mobile/download/fdetail/143.html

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