Skip to content

[bsp][esp32] adapt C3/C6 to ESP-IDF v6.1 and bump RISC-V toolchain to gcc 15.2 - #11870

Open
cms19859230182-lang wants to merge 3 commits into
RT-Thread:masterfrom
cms19859230182-lang:bsp/esp-idf-v6.1
Open

cms19859230182-lang wants to merge 3 commits into
RT-Thread:masterfrom
cms19859230182-lang:bsp/esp-idf-v6.1

Conversation

@cms19859230182-lang

Copy link
Copy Markdown
Contributor

背景

配合 esp-idf #18(包内 ESP-IDF 升到 v6.1 + scons 适配),主仓 BSP / CI 需要同步改动,否则 C3/C6 的 scons 构建对不上 6.1。

本 PR 不包含 FreeRTOS-Wrapper 改动(见 FreeRTOS-Wrapper #46,另行处理)。

做了什么

  1. ESP32-C3:适配 ESP-IDF v6.1(portmacro.h FreeRTOS V11 兼容声明、sections.ld、port.c、main.c、rtconfig.py、ADC/SPI 驱动小改)。
  2. ESP32-C6:适配 ESP-IDF v6.1(同上兼容面 + libraries/drivers 等 BSP 侧文件)。
  3. 工具链:RISC-V 从 gcc 11.2(esp-2022r1)升到 gcc 15.2(esp-15.2.0_20251204),同步改 CI workflow、docker、README、tools/ci/*。

未纳入:ESP32-S3 移植(本地已能链接,另开 PR)。

测试

目标 结果
ESP32-C3 13/13 attachconfig 配置,在 gcc 15.2 + esp-idf #18 包上 全部编译通过
ESP32-C6 默认配置 编译/链接通过
硬件上板 待验证(C3 烧录包已备好,回去插板后再报)

请审阅

请帮忙看一下 C3/C6 对 6.1 的适配面和工具链升级是否合适。上板结果稍后补。

感谢!

@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/esp-idf-v6.1
    Enter PR branch bsp/esp-idf-v6.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/esp-idf-v6.1 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the bsp/esp-idf-v6.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 Oct 16, 2026
@github-actions

Copy link
Copy Markdown

📌 Code Review Assignment

🏷️ Tag: workflow

Reviewers: @Rbb666 @kurisaW @supperthomas

Changed Files (Click to expand)
  • .github/workflows/bsp_buildings.yml
  • .github/workflows/manual_bsp_build.yml
  • .github/workflows/manual_trigger_scons_except_STM32_all.yml
  • .github/workflows/manual_trigger_update_all.yml
  • .github/workflows/membrowse-onboard.yml
  • .github/workflows/membrowse-report.yml

📊 Current Review Status (Last Updated: 2026-10-16 12:48 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.

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.

🟡 Changes recommended

Unresolved build compatibility and driver regressions prevent reliable operation / 尚未解决的构建兼容性及驱动回归问题影响可靠运行。

8 open findings
What changed in this PR

Adapts RT-Thread’s ESP32-C3/C6 BSPs to the companion ESP-IDF v6.1 package and GCC 15.2.
适配配套 ESP-IDF v6.1 软件包及 GCC 15.2 工具链。

Changes / 变更:

  • Updates compatibility headers, linker sections, and compiler settings. / 更新兼容头文件、链接段和编译配置。
  • Adds C6-local drivers and configuration, including ADC API migration. / 添加 C6 本地驱动与配置,并迁移 ADC 接口。
  • Synchronizes toolchain downloads across CI, Docker, and documentation. / 同步 CI、Docker 和文档中的工具链下载配置。
File Description
tools/​ci/​toolchain.sh Updates toolchain URL / 更新工具链地址
tools/​ci/​toolchain_bsp.yml Updates BSP toolchain mapping / 更新 BSP 工具链映射
tools/​ci/​bsp_detail.py Updates toolchain metadata / 更新工具链元数据
bsp/​ESP/​libraries/​drivers/​drv_spi.c Adds explicit FreeRTOS include / 显式包含 FreeRTOS 头文件
bsp/​ESP/​libraries/​drivers/​drv_adc.c Handles attenuation rename / 适配衰减枚举更名
bsp/​ESP/​ESP32_C6/​rtconfig.py Updates compiler and ROM linking / 更新编译器及 ROM 链接配置
bsp/​ESP/​ESP32_C6/​README.md Updates compiler instructions / 更新编译器说明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​sdkconfig.h Adds local IDF configuration / 添加本地 IDF 配置
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​sdkconfig_c6.h Adds C6 configuration / 添加 C6 配置
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​SConscript Selects local drivers and includes / 配置本地驱动及头文件路径
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​Kconfig Adds local configuration options / 添加本地配置选项
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_wifi.h Adds Wi-Fi declarations / 添加 Wi-Fi 声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_wifi.c Adds local Wi-Fi implementation / 添加本地 Wi-Fi 实现
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_uart.h Adds UART declarations / 添加 UART 声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_uart.c Adds local UART implementation / 添加本地 UART 实现
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_timer.h Adds timer declarations / 添加定时器声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_timer.c Adds local timer implementation / 添加本地定时器实现
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_spi.h Adds SPI declarations / 添加 SPI 声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_spi.c Adds local SPI implementation / 添加本地 SPI 实现
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_pwm.h Adds PWM declarations / 添加 PWM 声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_pwm.c Adds local PWM implementation / 添加本地 PWM 实现
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_hw_i2c.h Adds I2C declarations / 添加 I2C 声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_hw_i2c.c Adds local I2C implementation / 添加本地 I2C 实现
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_gpio.h Adds GPIO declarations / 添加 GPIO 声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_gpio.c Adds local GPIO implementation / 添加本地 GPIO 实现
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_adc.h Adds ADC declarations / 添加 ADC 声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​drv_adc.c Migrates C6 to IDF oneshot ADC / 迁移 C6 至 IDF 单次采样接口
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​board.h Adds board declarations / 添加板级声明
bsp/​ESP/​ESP32_C6/​libraries/​drivers/​board.c Adds board initialization and timing / 添加板级初始化与计时实现
bsp/​ESP/​ESP32_C6/​idf_port/​src/​port.c Removes obsolete include / 移除旧头文件引用
bsp/​ESP/​ESP32_C6/​idf_port/​ld/​sections.ld Retains new IDF sections / 保留新增 IDF 链接段
bsp/​ESP/​ESP32_C6/​idf_port/​include/​freertos/​portmacro.h Adds compatibility definitions / 添加兼容定义
bsp/​ESP/​ESP32_C6/​docker/​Dockerfile Installs GCC 15.2 / 安装 GCC 15.2
bsp/​ESP/​ESP32_C3/​rtconfig.py Updates compiler path and flags / 更新编译器路径及参数
bsp/​ESP/​ESP32_C3/​README.md Updates toolchain documentation / 更新工具链文档
bsp/​ESP/​ESP32_C3/​README_ZH.md Updates Chinese instructions / 更新中文说明
bsp/​ESP/​ESP32_C3/​main/​main.c Adds timer API include / 添加定时器接口头文件
bsp/​ESP/​ESP32_C3/​idf_port/​src/​port.c Removes obsolete include / 移除旧头文件引用
bsp/​ESP/​ESP32_C3/​idf_port/​ld/​sections.ld Adds IDF memory sections / 添加 IDF 内存段
bsp/​ESP/​ESP32_C3/​idf_port/​include/​freertos/​portmacro.h Adds compatibility definitions / 添加兼容定义
bsp/​ESP/​ESP32_C3/​docker/​Dockerfile Installs GCC 15.2 / 安装 GCC 15.2
.github/​workflows/​membrowse-report.yml Updates reporting toolchain / 更新报告工作流工具链
.github/​workflows/​membrowse-onboard.yml Updates onboarding toolchain / 更新接入工作流工具链
.github/​workflows/​manual_trigger_update_all.yml Updates toolchain installation / 更新工具链安装
.github/​workflows/​manual_trigger_scons_except_STM32_all.yml Updates SCons CI toolchain / 更新 SCons CI 工具链
.github/​workflows/​manual_bsp_build.yml Updates manual build toolchain / 更新手动构建工具链
.github/​workflows/​bsp_buildings.yml Updates BSP CI toolchain / 更新 BSP CI 工具链

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

} \
})
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) portTRY_ENTER_CRITICAL(mux, timeout)
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) portENTER_CRITICAL_SAFE(mux, timeout)
Comment on lines +13 to +17
#define CONFIG_LIBC_NEWLIB 1
/* new in ESP-IDF v6.1 (components/esp_libc/Kconfig), default 200 */
#define CONFIG_LIBC_ASSERT_BUFFER_SIZE 200
/* ESP-IDF v6.1 split esp_log into V1/V2 variants (components/log/Kconfig). */
#define CONFIG_LOG_VERSION 1
Comment on lines +33 to +34
if GetDepend('BSP_USING_SPI'):
src += ['drv_spi.c']
Comment on lines +155 to +158
adc_oneshot_unit_init_cfg_t init_config = {
.unit_id = _adc->adc_id,
};
ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config, &_adc->handle));
Comment on lines +252 to +259
if (_adc->do_calibration1)
{
ESP_ERROR_CHECK(adc_cali_raw_to_voltage(_adc->cali_handle, adc_raw, value));
}
else
{
*value = adc_raw;
}
Comment on lines +83 to +91
esp_err_t err = spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO);
ESP_ERROR_CHECK(err);

static spi_device_interface_config_t devcfg;
if(configuration->data_width == 8)
{
size_t length; /*/< Total data length, in bits*/
size_t rxlength; /*/< Total data length received, should be not greater than ``length`` in full-duplex mode (0 defaults this to the value of ``length``)*/
}
Comment on lines +135 to +147
switch (configuration->mode)
{
case RT_SPI_MODE_0: /*!< CPOL = 0, CPHA = 0 */
devcfg.mode = 0;
case RT_SPI_MODE_1: /*!< CPOL = 0, CPHA = 1 */
devcfg.mode = 1;
case RT_SPI_MODE_2: /*!< CPOL = 1, CPHA = 0 */
devcfg.mode = 2;
case RT_SPI_MODE_3: /*!< CPOL = 1, CPHA = 1 */
devcfg.mode = 3;
default:
devcfg.mode = 0;
}
spi_device_release_bus(spi);

ESP_ERROR_CHECK(err);
return RT_EOK;

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 tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants