stm32h7: Fix Protected user SRAM placement and attributes. - #19983
Merged
xiaoxiang781216 merged 2 commits intoAug 28, 2026
Conversation
13022591351
requested review from
davids5,
gustavonihei,
jerpelea,
pkarashchenko and
raiden00pl
as code owners
August 27, 2026 08:49
5 tasks
xiaoxiang781216
approved these changes
Aug 27, 2026
Contributor
|
ci was fixed, please rebase your change to the last master. @13022591351 |
up_allocate_heap() calculates the available user heap from SRAM_END but previously placed the aligned region relative to SRAM123_END. That mixes the selected primary SRAM with a fixed D2 SRAM boundary and leaves SRAM123_END undefined for dual-core M7 and M4 configurations. Place the user heap relative to SRAM_END so its size, MPU alignment, and location all refer to the SRAM region selected by the chip configuration. Tested by building and booting a Protected image on an STM32H7 PX4 FMUv6C. Assisted-by: Codex:GPT-5 Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
The generic ARMv7-M user SRAM helper marks memory shareable. STM32H7 Protected user data and heaps can reside in cacheable AXI or D2 SRAM, where userspace synchronization needs LDREX/STREX to use the CPU-local exclusive monitor. Map protected user SRAM as Normal, cacheable, and non-shareable. Dual-core RPTUN SRAM remains unaffected because it is mapped separately with explicit shareable attributes. Tested by booting a Protected image and running user and kernel work-queue stress tests on an STM32H7 PX4 FMUv6C. Assisted-by: Codex:GPT-5 Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
13022591351
force-pushed
the
fix/stm32h7-protected-memory
branch
from
August 27, 2026 11:10
0ad0903 to
a475478
Compare
Contributor
Author
|
@xiaoxiang781216 Rebased onto the latest |
acassis
approved these changes
Aug 27, 2026
xiaoxiang781216
approved these changes
Aug 27, 2026
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.
Summary
SRAM_END,which represents the primary SRAM selected for the active M7/M4 chip
configuration.
SRAM123_ENDplacement that is inconsistent with heapsizing and is undefined for dual-core M7 and M4 configurations.
non-shareable so LDREX/STREX synchronization uses the CPU-local exclusive
monitor on STM32H7.
with explicit shareable attributes.
Impact
attributes.
are unchanged. Dual-core shared RPTUN SRAM keeps its existing mapping.
document the mapping and dual-core exception.
remain
P:RW/U:RW; only the SRAM memory attributes change.selected by the board/chip configuration instead of a fixed D2 boundary.
Testing
Build host:
Target:
850805d70c88b0d63d4364d7110ce5363d2448eetesting/ostest: Exercise custom work queues. nuttx-apps#3759 as the workload. Those PRs are test dependencies,
not code dependencies of this change.
Build output:
Runtime stress results:
The tests repeatedly exercised pthread creation, mutex/semaphore atomics,
multi-worker queues, synchronous cancellation, and queue teardown. All runs
completed without assertion, fault, residual worker, or cumulative Kmem/Umem
growth. The board cold-booted into NSH and remained stable.
Validation:
PR verification Self-Check