[libcpu][cortex-m7]Canonical alignment#11250
Open
wdfk-prog wants to merge 1 commit intoRT-Thread:masterfrom
Open
[libcpu][cortex-m7]Canonical alignment#11250wdfk-prog wants to merge 1 commit intoRT-Thread:masterfrom
wdfk-prog wants to merge 1 commit intoRT-Thread:masterfrom
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
为什么提交这份PR (why to submit this PR)
当前 Cortex-M7 cache 操作实现中,在 I-Cache 和 D-Cache 地址对齐时使用了手工位运算写法:
虽然该实现本身是正确的,但这种写法可读性较弱,也不够统一。
RT-Thread 已经提供了通用的地址对齐辅助宏
RT_ALIGN_DOWN(),继续保留手工位运算会增加风格不一致和维护成本。因此,提交此 PR,将 cache 操作中的地址向下对齐逻辑统一替换为公共宏实现,提升代码可读性和一致性。
你的解决方案是什么 (what is your solution)
本 PR 做了以下调整:
在
rt_hw_cpu_icache_ops()中,将:RT_ALIGN_DOWN((rt_uint32_t)addr, L1CACHE_LINESIZE_BYTE)在
rt_hw_cpu_dcache_ops()中,将:RT_ALIGN_DOWN((rt_uint32_t)addr, L1CACHE_LINESIZE_BYTE)保持后续
size_byte的计算方式和 cache 操作流程不变,确保行为逻辑一致;同步更新文件头版权年份。
通过以上调整,代码语义更加直观,也更符合 RT-Thread 中通用对齐宏的使用习惯,便于后续维护。
请提供验证的bsp和config (provide the config and bsp)
BSP:
bsp/stm32/stm32h750-artpi.config:
action: