This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b1a4d858dd24a6e85f24b03b3add986168ac8762 Author: DuoYuWang <[email protected]> AuthorDate: Wed Aug 26 22:04:54 2026 +0800 stm32h7: Use the selected SRAM end for the protected user heap. 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 <[email protected]> --- arch/arm/src/stm32h7/stm32_allocateheap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/src/stm32h7/stm32_allocateheap.c b/arch/arm/src/stm32h7/stm32_allocateheap.c index ab77f78604d..30ae0130057 100644 --- a/arch/arm/src/stm32h7/stm32_allocateheap.c +++ b/arch/arm/src/stm32h7/stm32_allocateheap.c @@ -253,15 +253,15 @@ void up_allocate_heap(void **heap_start, size_t *heap_size) DEBUGASSERT(ubase < (uintptr_t)SRAM_END); /* Adjust that size to account for MPU alignment requirements. - * NOTE that there is an implicit assumption that the SRAM123_END - * is aligned to the MPU requirement. + * NOTE that there is an implicit assumption that SRAM_END is aligned + * to the MPU requirement. */ log2 = (int)mpu_log2regionfloor(usize); DEBUGASSERT((SRAM_END & ((1 << log2) - 1)) == 0); usize = (1 << log2); - ubase = SRAM123_END - usize; + ubase = SRAM_END - usize; /* Return the user-space heap settings */ @@ -320,8 +320,8 @@ void up_allocate_kheap(void **heap_start, size_t *heap_size) DEBUGASSERT(ubase < (uintptr_t)SRAM_END); /* Adjust that size to account for MPU alignment requirements. - * NOTE that there is an implicit assumption that the SRAM123_END - * is aligned to the MPU requirement. + * NOTE that there is an implicit assumption that SRAM_END is aligned + * to the MPU requirement. */ log2 = (int)mpu_log2regionfloor(usize);
