Skip to content

[tools][eclipse] Sync assembler include paths - #11762

Open
wdfk-prog wants to merge 1 commit into
RT-Thread:masterfrom
wdfk-prog:fix/eclipse-assembler-include-paths
Open

[tools][eclipse] Sync assembler include paths#11762
wdfk-prog wants to merge 1 commit into
RT-Thread:masterfrom
wdfk-prog:fix/eclipse-assembler-include-paths

Conversation

@wdfk-prog

@wdfk-prog wdfk-prog commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

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

[

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

Eclipse/STM32CubeIDE 工程生成器目前只将 SCons project['CPPPATH'] 同步到 C/C++ Compiler 的 include paths,没有同步到 Assembler 的 include paths。

对于需要通过 C 预处理器处理的汇编源文件(.S),这会造成 SCons 原生构建与生成后的 Eclipse/CDT 工程之间存在配置差异。

例如 Cortex-M4 的 libcpu/arm/cortex-m4/context_gcc.S 包含:

#include <rtconfig.h>

SCons 构建时 BSP 根目录已经通过 CPPPATH 提供给汇编器,因此可以正常找到 rtconfig.h;但通过 scons --target=eclipse 生成 STM32CubeIDE/Eclipse 工程后,相同 include paths 只存在于 Compiler 配置中,Assembler 配置缺失,可能导致:

context_gcc.S: fatal error: rtconfig.h: No such file or directory

本 PR 使生成后的 Assembler 与 Compiler 使用同一组由 SCons project['CPPPATH'] 派生的 include paths,保持 SCons 与 Eclipse/CDT 工程生成结果一致。

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

tools/targets/eclipse.pyHandleToolOption() 中:

  1. 增加对 Eclipse/CDT Assembler include path option 的收集:

    • assembler.include.paths
    • assembler.option.includepaths
  2. 复用当前由 project['CPPPATH'] 生成的 include path 列表,同时更新 Compiler 和 Assembler include paths。

  3. 保留现有的 reset/update 行为:

    • reset=True 时按原有逻辑清理已有配置;
    • reset=False 时只清理由 RT-Thread 工程生成器管理的路径;
    • 不删除用户自行配置的非 RT-Thread include paths。

本次修改仅涉及 tools/targets/eclipse.py,最终 diff 为 +5/-2,不改变 SCons 原生构建行为。

本地验证结果:

  • python3 -m py_compile tools/targets/eclipse.py:通过。
  • 使用两个 STM32F4 Cortex-M4 项目配置执行 scons --target=eclipse:通过。
  • 生成后 Compiler 与 Assembler 的 SCons-managed include path 集合一致。
  • 生成的 Assembler include paths 包含 BSP project root,可解析 rtconfig.h
  • 直接预处理 libcpu/arm/cortex-m4/context_gcc.S 可正确解析 <rtconfig.h>
  • 重复执行 scons --target=eclipse 后生成结果保持一致,验证生成过程幂等。
  • 对最终单文件 diff 执行三轮 full-scope 本地代码审查,未发现 consensus issue、specialized finding 或 optional suggestion。

未在本环境中执行完整 STM32CubeIDE IDE 内构建。

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

  • BSP:

    • External STM32F4 Cortex-M4 BSP: rtt_5axis
    • External STM32F4 Cortex-M4 BSP: rtt_6axis
    • These BSPs are project-local and are not paths in the upstream RT-Thread repository.
  • .config:

    • No additional .config change is required for the Eclipse generator fix.
    • The validation project enables Cortex-M4 RT-Thread configuration and contains preprocessed assembly sources that depend on project include paths.
  • action:

    • Not available. Validation was performed locally; no fork GitHub Actions run is available for this branch.

]

当前拉取/合并请求的状态 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:

@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 分支 fix/eclipse-assembler-include-paths
    Enter PR branch fix/eclipse-assembler-include-paths 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.

完成后,提交将自动更新至 fix/eclipse-assembler-include-paths 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the fix/eclipse-assembler-include-paths 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 the tools label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant