Skip to content

fix: change stack alignment from 4 to 8 bytes for all STM32 targets#11530

Open
finnyoun9 wants to merge 1 commit into
RT-Thread:masterfrom
finnyoun9:fix/stm32-stack-align-8
Open

fix: change stack alignment from 4 to 8 bytes for all STM32 targets#11530
finnyoun9 wants to merge 1 commit into
RT-Thread:masterfrom
finnyoun9:fix/stm32-stack-align-8

Conversation

@finnyoun9

Copy link
Copy Markdown

Summary

Fixes stack alignment issue for STM32 targets (Issue #7527).

The .stack section in STM32 linker scripts was aligned to 4 bytes, causing issues with 8-byte types (e.g. double) being passed via variadic functions. This PR changes ALIGN(4) to ALIGN(8) in the .stack section for all affected STM32 BSPs.

Closes #7527

Changes

  • Changed ALIGN(4) to ALIGN(8) in .stack section of 13 STM32 linker scripts
  • Does NOT affect .text or .bss sections (they remain at ALIGN(4) — correct for 4-byte instructions/data)

Affected files

  • bsp/stm32/libraries/templates/stm32f2xx/board/linker_scripts/link.lds
  • bsp/stm32/libraries/templates/stm32l1xx/board/linker_scripts/link.lds
  • bsp/stm32/libraries/templates/stm32mp1xx/board/linker_scripts/link.lds
  • bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds
  • bsp/stm32/stm32f410-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32h743-openmv-h7plus/board/linker_scripts/link.lds
  • bsp/stm32/stm32h743-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32l433-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32l4r9-st-eval/board/linker_scripts/link.lds
  • bsp/stm32/stm32u585-iot02a/board/linker_scripts/link.lds

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@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

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:fix/stm32-stack-align-8
  • 设置PR number为 \ Set the PR number to:11530
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 fix/stm32-stack-align-8 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the fix/stm32-stack-align-8 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: STM32 BSP related with ST/STM32 BSP labels Jun 28, 2026
@github-actions

Copy link
Copy Markdown

📌 Code Review Assignment

🏷️ Tag: bsp_stm32

Reviewers: @Liang1795 @hamburger-os @wdfk-prog

Changed Files (Click to expand)
  • bsp/stm32/libraries/templates/stm32f2xx/board/linker_scripts/link.lds
  • bsp/stm32/libraries/templates/stm32l1xx/board/linker_scripts/link.lds
  • bsp/stm32/libraries/templates/stm32mp1xx/board/linker_scripts/link.lds
  • bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds
  • bsp/stm32/stm32f410-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32h743-openmv-h7plus/board/linker_scripts/link.lds
  • bsp/stm32/stm32h743-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32l433-st-nucleo/board/linker_scripts/link.lds
  • bsp/stm32/stm32l4r9-st-eval/board/linker_scripts/link.lds
  • bsp/stm32/stm32u585-iot02a/board/linker_scripts/link.lds

🏷️ Tag: bsp_stm32h743-st-nucleo

Reviewers: @LittleGreyG

Changed Files (Click to expand)
  • bsp/stm32/stm32h743-st-nucleo/board/linker_scripts/link.lds

📊 Current Review Status (Last Updated: 2026-06-28 21:43 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.

@LittleGreyG

Copy link
Copy Markdown
Contributor

对于h7来说可提高浮点算法性能。建议修改。

@wdfk-prog

Copy link
Copy Markdown
Contributor

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

Labels

BSP: STM32 BSP related with ST/STM32 BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in linker script for all stm32 targets

4 participants