[bsp][ESP32_C3] match Windows GNU ld object paths in IRAM globs - #11816
cms19859230182-lang wants to merge 2 commits into
Conversation
Windows GNU ld reports object paths with backslashes, so slash-based input-section and EXCLUDE_FILE globs never matched. Replace those path separators with '?' so both Unix and Windows builds place IRAM code correctly. Comments and generated-from paths are unchanged.
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The new *bt?* glob can unintentionally match non-bt/ inputs (e.g. libbtdm_app.a) and misplace .bss, breaking the _btdm_bss_* region markers.
Review effort: Lite
Findings: None
What changed in this PR
This PR updates the ESP32-C3 BSP linker script to make IRAM/FLASH placement globs work on Windows builds where GNU ld reports object paths with backslashes.
本 PR 修改 ESP32-C3 BSP 的链接脚本,使其在 Windows 下(GNU ld 使用反斜杠路径)也能正确匹配 IRAM/FLASH 放置规则。
Changes:
- Replace slash-only file globs with
?wildcards so patterns match both/and\in object paths.
将仅包含/的文件通配模式替换为?,以同时匹配/与\路径分隔符。 - Apply the same separator-tolerant matching to multiple
EXCLUDE_FILE(...)and section placement rules.
对多个EXCLUDE_FILE(...)与 section 放置规则同步做分隔符兼容。
Review notes / 审查备注:
- The new
*bt?*patterns are overly broad (they can matchlibbtdm_app.aetc.), which can break the intended_bt_*vs_btdm_*BSS region partitioning.
新增的*bt?*过于宽泛(可能匹配到libbtdm_app.a等),会破坏_bt_*与_btdm_*的 BSS 分区边界。 - 🟡 PR Title/PR 标题:
[bsp][ESP32_C3] ...prefix is not fully lowercase; repository checklist requests lowercase prefixes.
🟡 PR 标题前缀未完全小写;仓库检查项要求前缀使用小写格式。
| File | Description |
|---|---|
| bsp/ESP/ESP32_C3/idf_port/ld/sections.ld | Makes linker script file globs separator-agnostic for Windows builds to restore correct IRAM/FLASH placement. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A '?' in *bt?* matches any character, so libbtdm_app.a was included in the bt data and bss regions. Match only a slash or backslash.
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
On Windows, GNU ld reports object files with backslash paths (for example
libcpu\risc-v\common\...o). The ESP32-C3 linker script used slash-only input-section and EXCLUDE_FILE globs such as*riscv/interrupt.*. Those globs never matched, so IRAM text/data were not placed as intended. The resulting firmware then hit an illegal instruction / access fault beforemshon ESP32-C3-DevKitM-1.This was found while building the official
bsp/ESP/ESP32_C3on Windows (Espressif RISC-V GCC 11.2.0 + RT-Thread Env). Linux/macOS paths still use/, so they were not affected.你的解决方案是什么 (what is your solution)
In
bsp/ESP/ESP32_C3/idf_port/ld/sections.ld, replace path separators inside those file globs with?. GNU ld treats?as a single-character wildcard, so it matches both/and\. Header comments and theGenerated from: /home/...path are left unchanged. No.configchange and no chip-revision workaround.Verified: ESP32-C3-DevKitM-1, Windows, official BSP,
mshprompt after this linker-script change. Notes: https://notes.seteiro.xyz/posts/esp32c3-devkitm1-msh/请提供验证的bsp和config (provide the config and bsp)
BSP:
bsp/ESP/ESP32_C3.config: none
action:
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up