mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
* [bsp][esp32-c6] add ESP32-C6-DevKitC-1 support Add bsp/ESP/ESP32_C6. Default image is GPIO, UART0 and ADC. The C6 IDF sources are not in RT-Thread-packages/esp-idf yet. * [bsp][esp32-c6] fix CI format, C6 package and CH32V203 D6 build clang-format the files the format check rejected. Fetch the C6 scons branch when the downloaded ESP-IDF package has no C6 target. Patch the CH32V20x SDK under libraries so a D6 build no longer calls Exit(). * [bsp][esp32-c6] fetch mbedtls and stop pkgs from pulling the C6 branch * [bsp][esp32-c6] rebuild CI against the package branch tip * [bsp][esp32-c6] rebuild CI against the strict-mode package tip * [bsp][esp32-c6] fix the reviewed ADC, math and package pin bugs Keep the IDF tree on the reviewed commit, and stop the ADC and critical-section paths from reporting success when they did not. * [bsp][esp32-c6] reserve stuck interrupt lines and lock ADC CPU lines 3 and 4 never latch an enable, so copying the handler left the non-IRAM mask on the old line. Reserve those lines and let the allocator write the mask and the route together. The C6 oneshot registers are shared, so one mutex covers enable and convert. * [bsp][esp32-c6] list the peripherals this board actually runs GPIO, UART0 and ADC1 have been read on the DevKitC-1. Radios and the untested buses stay marked unsupported. * [bsp][esp32-c6] keep SPI unsupported after the loopback mismatch GPIO7 shorted to GPIO2 returned 0xA5000000 for a sent 0xA5, so the table does not mark SPI supported. --------- Co-authored-by: seteiro <276597748+cms19859230182-lang@users.noreply.github.com>
ESP32-C6-DevKitC-1 BSP 说明
1 开发板简介
ESP32-C6-DevKitC-1 是乐鑫推出的一款基于 RISC-V 内核的开发板,模组为 ESP32-C6-WROOM-1。本板读到的芯片 revision 是 v0.2。
基本特性:
- MCU:ESP32-C6,主频 160MHz,Flash 8MB
- 晶振:40MHz
- USB:2 个 Type-C。标着 UART 的口是 CP210x,接到 UART0(TX GPIO16,RX GPIO17)
- 不用 WCH-Link
更多信息请访问 ESP32-C6-DevKitC-1
外设支持
本 BSP 目前对外设的支持情况如下:
| 片上外设 | 支持情况 | 备注 |
|---|---|---|
| GPIO | 支持 | GPIO1 作输入。接 3V3 为 high,接 GND 为 low |
| UART | 支持 | UART0,TX GPIO16,RX GPIO17。115200,能进 msh |
| ADC | 支持 | ADC1 通道 1(GPIO1)。接地 2167,接 3V3 为 4095,没有校准 |
| GDBStub | 支持 | 打开 BSP_ENABLE_GDBSTUB 后,出错会停进 stub。默认关闭 |
| I2C | 待支持 | |
| SPI | 待支持 | GPIO7 接到 GPIO2,发出 0xA5,收回 0xA5000000,对不上一字节 |
| PWM | 待支持 | |
| Wi-Fi | 待支持 | |
| BLE | 待支持 | |
| 802.15.4 | 待支持 |
IO 在板级支持包中的映射情况
| IO | 板级包中的定义 |
|---|---|
| GPIO16 | UART0_TX |
| GPIO17 | UART0_RX |
| GPIO1 | 已测输入,兼 ADC1 通道 1 |
2 编译说明
板级包支持 RISC-V GCC 开发环境,以下是具体版本信息:
| IDE/编译器 | 已测试版本 |
|---|---|
| GCC | Espressif riscv32-esp-elf GCC 11.2.0 |
3 使用说明
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果。
3.1 使用 Env 编译 BSP
- 下载 riscv32-esp-elf GCC 11.2.0(Windows)。Linux 用同版本的
linux-amd64包。 - 下载 Env 工具 最新版本
- 将 esp-idf 提交
4fa003074a73774369d38123749fe64b7b4acbd3(bsp/esp32c6-scons)放到packages/ESP-IDF-latest。官方RT-Thread-packages/esp-idf里还没有这些 C6 源码,pkgs --update下到的包编不过。SConstruct 发现包里没有 C6 时,拉取的也是这一次提交,不跟分支尖走。 - 在当前 BSP 目录下执行
scons --exec-path=工具链的bin目录 - 编译完成之后会生成 rtthread.bin 文件。默认打开 GPIO、UART0 和 ADC。
3.2 硬件连接
串口用板上标着 UART 的 USB 口。不用杜邦线,也不用 WCH-Link。
3.3 下载
bootloader 和分区表在 builtin_imgs。bootloader 必须是这份 ESP32-C6 的,不能用 ESP32-C3 的。
esptool.py --chip esp32c6 -p COMx -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 8MB --flash_freq 80m 0x0 builtin_imgs/bootloader.bin 0x8000 builtin_imgs/partition-table.bin 0x10000 rtthread.bin
3.4 运行结果
在终端工具里打开串口(115200-8-1-N),先打开串口再复位,可以看到 RT-Thread 的输出信息和 msh >。help、version 有回应。
GDB 默认关闭。要在出错后停住,打开 BSP_ENABLE_GDBSTUB 再烧录,然后用本目录的 esp32c6.gdb。