Skip to content

[bsp][esp32-c6] add ESP32-C6-DevKitC-1 support - #11836

Open
cms19859230182-lang wants to merge 9 commits into
RT-Thread:masterfrom
cms19859230182-lang:bsp/esp32c6-devkitc-1
Open

cms19859230182-lang wants to merge 9 commits into
RT-Thread:masterfrom
cms19859230182-lang:bsp/esp32c6-devkitc-1

Conversation

@cms19859230182-lang

@cms19859230182-lang cms19859230182-lang commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

拉取/合并请求描述:(PR description)

为什么提交这份PR (why to submit this PR)

ESP32-C6-DevKitC-1 has no BSP in the mainline tree. The module is ESP32-C6-WROOM-1, RISC-V, revision v0.2, 8MB flash. RT-Thread-packages/esp-idf has not been updated since 2023-11-26 and has no C6 sources, so pkgs --update cannot build this board.

你的解决方案是什么 (what is your solution)

Add bsp/ESP/ESP32_C6. UART0 is GPIO16/GPIO17 on the DevKitC-1 UART USB port (CP210x). The default image enables GPIO, UART0 and ADC.

builtin_imgs/bootloader.bin is an ESP32-C6 bootloader. Do not reuse the ESP32-C3 bootloader. Flash is DIO, 8MB, 80MHz. The application offset is 0x10000.

C6 scons sources are on https://github.com/cms19859230182-lang/esp-idf/tree/bsp/esp32c6-scons (RT-Thread-packages/esp-idf#17). Clone that branch to packages/ESP-IDF-latest.

On this chip, PLIC enable for CPU interrupts 3 and 4 does not stick. The BSP reserves those two lines at startup and clears mideleg before the allocator routes the devices.

Shared driver changes:

  • drv_gpio.c: pin input mode no longer falls through into open-drain.
  • drv_uart.c: C6 UART clock is UART_SCLK_DEFAULT.
  • drv_adc.c: C6 reads ADC1 from the registers. GPIO1 read 2167 on GND and 4095 on 3.3V. There is no calibration, so ground is not 0.
  • I2C, SPI, PWM, Wi-Fi and BLE stay C3-only in menuconfig.

Verified on ESP32-C6-DevKitC-1 with Espressif riscv32-esp-elf GCC 11.2.0:

  • Default image reaches msh. help and version answer. version is 5.3.1.
  • list timer current tick increases. free total 76704, used heap about 68904 free.
  • GPIO1 reads high on 3V3 and low on GND.
  • ADC1 channel 1 (GPIO1): 2167 on GND, 4095 on 3.3V.
  • SPI2 loopback, GPIO7 shorted to GPIO2, sent 0xA5 and read 0xA5000000. That is not a single-byte match, so SPI stays unsupported. The test is not in the default image.
  • With BSP_ENABLE_GDBSTUB on, a store to address 4 prints Entering gdb stub now. GDB stops in main at PC 0x42001c8c, the same value as MEPC. The default image leaves this switch off.

请提供验证的bsp和config (provide the config and bsp)

  • BSP: bsp/ESP/ESP32_C6

  • .config: default is GPIO, UART0 and ADC. I2C, SPI, PWM, Wi-Fi, BLE and GDBStub are off.

  • action:

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用clang-format 源码格式化工具确保格式符合RT-Thread代码规范 This PR has been formatted with clang-format and complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

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.
@github-actions

Copy link
Copy Markdown

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • Use workflow from 保持默认分支(通常为 master)
    Keep the default branch (usually master) in Use workflow from
  • 在 branch 输入框填写 PR 分支 bsp/esp32c6-devkitc-1
    Enter PR branch bsp/esp32c6-devkitc-1 in the branch field
  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将作为独立提交推送至你的分支。
    The formatting changes will be pushed to your branch as a separate commit.

完成后,提交将自动更新至 bsp/esp32c6-devkitc-1 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the bsp/esp32c6-devkitc-1 branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions Bot added BSP BSP: ESP32 BSP related with ESP action github action yml imporve tools labels Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

📌 Code Review Assignment

🏷️ Tag: workflow

Reviewers: @Rbb666 @kurisaW @supperthomas

Changed Files (Click to expand)
  • .github/ALL_BSP_COMPILE.json
  • .github/workflows/manual_trigger_scons_except_STM32_all.yml

📊 Current Review Status (Last Updated: 2026-09-27 17:08 CST)


📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@cms19859230182-lang

Copy link
Copy Markdown
Contributor Author

中秋快乐呀扎人们

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report

hc32f334

  • FLASH: .text +4 B (+0.0%, 99,572 B / 131,072 B, total: 76% used)

renesas-ra2l1

  • FLASH: .text -4 B (-0.0%, 98,252 B / 262,144 B, total: 37% used)

wch-ch32v208w-r0

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().
@github-actions github-actions Bot added the BSP: WCH BSP related with WCH label Sep 24, 2026
@BernardXiong

Copy link
Copy Markdown
Member

中秋快乐呀扎人们

image

@Rbb666
Rbb666 requested a balanced review from Copilot September 26, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cms19859230182-lang

Copy link
Copy Markdown
Contributor Author

@Rbb666 额度没啦,我发的另外一个也是这样

@Rbb666

Rbb666 commented Sep 26, 2026

Copy link
Copy Markdown
Member

@Rbb666 额度没啦,我发的另外一个也是这样

我换个轻量的AI先扫一下

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

portEXIT_CRITICAL(mux); \
} \
})
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) portENTER_CRITICAL_SAFE(mux, timeout)
Comment on lines +3 to +6
double ceil(double i)
{
i = i;
return i;
Comment thread bsp/ESP/ESP32_C6/.config Outdated
Comment on lines +1426 to +1427
# CONFIG_BSP_USING_ADC is not set
# CONFIG_BSP_USING_PWM is not set
Comment thread bsp/ESP/ESP32_C6/SConstruct Outdated
Comment on lines +72 to +73
dest = os.path.join(libraries_path_prefix, 'ESP-IDF-latest')
sc = os.path.join(dest, 'SConscript')
Comment thread bsp/ESP/ESP32_C6/SConstruct Outdated
Comment on lines +83 to +85
subprocess.check_call([
'git', 'clone', '--depth', '1', '--branch', 'bsp/esp32c6-scons',
'https://github.com/cms19859230182-lang/esp-idf.git', tmp,
Comment on lines +40 to +41
config BSP_BOARD_ESP32C6_DEVKITC1
bool "ESP32-C6-DevKitC-1"
Comment on lines +74 to +78
if (!enabled)
{
return RT_EOK;
}

Comment thread bsp/ESP/libraries/drivers/drv_adc.c Outdated
}
esp_rom_delay_us(2);
}
raw_pin = APB_SARADC.saradc_sar1data_status.saradc_apb_saradc1_data & 0xfff;
Comment on lines +709 to +711
#define CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED 1 /* This macro indicates that the target has separate RTC IOMUX hardware feature,
#define CONFIG_SOC_RTCIO_HOLD_SUPPORTED 1
#define CONFIG_SOC_RTCIO_WAKE_SUPPORTED 1
Comment on lines +56 to +60
candidates = [
os.path.join(SDK_ROOT, 'packages', 'CH32V20x-SDK-for-RTT', 'SConscript'),
os.path.join(libraries_path_prefix, 'ch32v20x_sdk-latest', 'SConscript'),
]
for sc in candidates:
Keep the IDF tree on the reviewed commit, and stop the ADC and critical-section paths from reporting success when they did not.
@cms19859230182-lang

Copy link
Copy Markdown
Contributor Author

ok我re完了

Comment thread bsp/ESP/libraries/drivers/board.c Outdated
Comment thread bsp/ESP/libraries/drivers/drv_adc.c
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.
GPIO, UART0 and ADC1 have been read on the DevKitC-1. Radios and the untested buses stay marked unsupported.
GPIO7 shorted to GPIO2 returned 0xA5000000 for a sent 0xA5, so the table does not mark SPI supported.
@cms19859230182-lang

Copy link
Copy Markdown
Contributor Author

ok搞定了,刚刚编码乱掉了

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action github action yml imporve BSP: ESP32 BSP related with ESP BSP: WCH BSP related with WCH BSP tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants