Skip to content

[bsp][nxp] Add industrial ethernet linker scripts for RT1180 - #11959

Closed
nxp-ran wants to merge 11 commits into
RT-Thread:masterfrom
nxp-ran:feature/industrial-ethernet-linkfile
Closed

nxp-ran wants to merge 11 commits into
RT-Thread:masterfrom
nxp-ran:feature/industrial-ethernet-linkfile

Conversation

@nxp-ran

@nxp-ran nxp-ran commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

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

[

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

针对专门开发工业以太网的用户,专门订制了一套CM33+CM7的link file
其中CM33运行在片内ram上,CM7从flash直接XIP

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

新增了2个keil的分散加载文件,和2个iar的分散加载文件:
cm33\board\linker_scripts\MIMXRT1189xxxxx_cm33_ram_industry.scf
cm33\board\linker_scripts\MIMXRT1189xxxxx_cm33_ram_industry.icf
cm7\board\linker_scripts\MIMXRT1189xxxxx_cm7_flexspi_nor_industry.scf
cm7\board\linker_scripts\MIMXRT1189xxxxx_cm7_flexspi_nor_industry.icf

并且在对应的Kconfig和rtconfig.py中添加对这些分散加载文件的支持。

最后,在keil和iar对应的template中增加对应的target。

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

  • BSP:
  • .config:
    CM33:
    CONFIG_BSP_LINKER_SCRIPT_RAM_INDUSTRY=y
    CM7:
    CONFIG_BSP_LINKER_SCRIPT_FLEXSPI_NOR_INDUSTRY=y
  • 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自查

@nxp-ran
nxp-ran requested a review from Rbb666 as a code owner October 30, 2026 11:57
@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 分支 feature/industrial-ethernet-linkfile
    Enter PR branch feature/industrial-ethernet-linkfile 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.

完成后,提交将自动更新至 feature/industrial-ethernet-linkfile 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the feature/industrial-ethernet-linkfile 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: NXP Code related with NXP BSP labels Oct 30, 2026

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

Industrial layouts leave generated Keil targets unbuildable, reference missing GCC linker scripts, and omit CM7 XIP caching when multicore support is disabled.

3 open issues
What changed in this PR

Adds industrial Ethernet memory layouts to the RT1180 EVK BSP, with CM33 running from internal RAM and CM7 executing directly from NOR flash.
为 RT1180 EVK BSP 新增工业以太网内存布局:CM33 在片内 RAM 运行,CM7 从 NOR Flash 直接执行。

Changes / 变更:

  • Adds Keil and IAR linker scripts with separate per-core memory allocations and reserved shared memory. / 新增 Keil 和 IAR 链接脚本,划分双核专用内存并预留共享内存。
  • Connects the layouts to Kconfig, build configuration and IDE targets. / 将新布局接入 Kconfig、构建配置和 IDE 目标。
  • Moves MPU setup before common board initialization and refreshes saved configurations. / 将 MPU 配置提前至通用板级初始化之前,并更新保存的配置。

Paths below are relative to bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/.
以下路径均相对于上述目录。

File Description
cm7/​template.uvprojx Adds Keil industrial XIP target. / 新增 Keil 工业 XIP 目标。
cm7/​template.uvoptx Adds target debug settings. / 新增目标调试设置。
cm7/​template.ewp Adds IAR industrial XIP configuration. / 新增 IAR 工业 XIP 配置。
cm7/​rtconfig.py Maps industrial linker and target names. / 映射工业链接脚本及目标名称。
cm7/​rtconfig.h Refreshes version and generated comments. / 更新版本及生成的注释。
cm7/​board/​linker_scripts/​MIMXRT1189xxxxx_cm7_flexspi_nor_industry.scf Defines Keil CM7 flash/RAM layout. / 定义 Keil CM7 Flash/RAM 布局。
cm7/​board/​linker_scripts/​MIMXRT1189xxxxx_cm7_flexspi_nor_industry.icf Defines IAR CM7 flash/RAM layout. / 定义 IAR CM7 Flash/RAM 布局。
cm7/​board/​Kconfig Exposes industrial XIP choice. / 增加工​​业 XIP 选项。
cm7/​board/​board.c Reorders MPU initialization. / 调整 MPU 初始化顺序。
cm7/​.config Refreshes configuration; new layout remains disabled. / 更新配置,新布局默认未启用。
cm33/​template.uvprojx Adds Keil industrial RAM target. / 新增 Keil 工业 RAM 目标。
cm33/​template.uvoptx Adds target debug settings. / 新增目标调试设置。
cm33/​template.ewp Adds IAR industrial RAM configuration. / 新增 IAR 工业 RAM 配置。
cm33/​template.ewd Adds IAR debugger configuration. / 新增 IAR 调试器配置。
cm33/​rtconfig.py Maps industrial linker and target names. / 映射工业链接脚本及目标名称。
cm33/​rtconfig.h Refreshes version and generated comments. / 更新版本及生成的注释。
cm33/​board/​linker_scripts/​MIMXRT1189xxxxx_cm33_ram_industry.scf Defines Keil CM33 TCM/OCRAM2 layout. / 定义 Keil CM33 TCM/OCRAM2 布局。
cm33/​board/​linker_scripts/​MIMXRT1189xxxxx_cm33_ram_industry.icf Defines IAR CM33 TCM/OCRAM2 layout. / 定义 IAR CM33 TCM/OCRAM2 布局。
cm33/​board/​Kconfig Exposes industrial RAM choice. / 新增工业 RAM 选项。
cm33/​board/​board.c Reorders MPU initialization. / 调整 MPU 初始化顺序。
cm33/​.config Refreshes configuration; new layout remains disabled. / 更新配置,新布局默认未启用。

Review effort: Balanced

'RAM': 'MIMXRT1189xxxxx_cm33_ram',
'FLEXSPI_NOR': 'MIMXRT1189xxxxx_cm33_flexspi_nor',
'FLEXSPI_NOR_HYPERRAM': 'MIMXRT1189xxxxx_cm33_flexspi_nor_hyperram',
'RAM_INDUSTRY': 'MIMXRT1189xxxxx_cm33_ram_industry',
</TargetOption>
</Target>
<Target>
<TargetName>rtthread_ram_industry</TargetName>
Comment on lines +841 to +842
config BSP_LINKER_SCRIPT_FLEXSPI_NOR_INDUSTRY
bool "FlexSPI NOR Flash - Industrial Ethernet (XIP + 512KB OCRAM1 + 96KB OCRAM2 + 32KB shared memory)"
@Rbb666

Rbb666 commented Nov 3, 2026

Copy link
Copy Markdown
Member
  1. 修正 Keil 工程目标的生成逻辑
    调整 tools/targets/keil.py,根据当前配置为对应的工业目标填充源文件分组、头文件路径、宏和链接参数。若保留多个目标,应逐个填充,并保留各自的链接脚本。同步调整自动构建的目标选择,避免始终构建第一个普通目标。

  2. 补齐 CM7 工业 XIP 配置条件
    在 cm7/board/SConscript 中,将新增工业 XIP 选项加入外部 Flash 的判定条件,确保生成 XIP_EXTERNAL_FLASH=1,使启动代码配置对应的 Flash MPU 区域及缓存属性。

  3. 补齐 GCC 链接脚本
    根据已有工业配置的内存布局,补充:

    • MIMXRT1189xxxxx_cm33_ram_industry.ld
    • MIMXRT1189xxxxx_cm7_flexspi_nor_industry.ld

    核对各段地址、大小和共享内存边界与已有脚本一致。若暂不支持 GCC,应在配置阶段明确提示并阻止该组合,避免直到链接阶段才报文件缺失。

修改后建议验证:两个核心的工业目标均能生成并构建;CM7 在默认单核配置下启用了 XIP 宏和 Flash MPU 区域;原有 RAM、NOR 配置仍能正常构建。

@nxp-ran nxp-ran closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BSP: NXP Code related with NXP BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants