From 01fabe6c67e4ca71b932d7acbf9a1ab1e3223326 Mon Sep 17 00:00:00 2001 From: Anthony Merlino Date: Tue, 6 Apr 2021 13:38:25 -0400 Subject: [PATCH] stm32h7: Actually use the AXI SRAM as the main heap as the documentation describes. The comments at the top of the file say this: ``` This will be automatically registered * - AXI SRAM is a 512kb memory area. This will be automatically registered * with the system heap in up_allocate_heap, all the other memory * regions will be registered in arm_addregion(). ``` but the implementation was using SRAM123 instead. Furthermore, arm_addregion then re-adds SRAM123 again. --- arch/arm/src/stm32h7/stm32_allocateheap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/src/stm32h7/stm32_allocateheap.c b/arch/arm/src/stm32h7/stm32_allocateheap.c index 59a7b3d74b2..5ed4373e450 100644 --- a/arch/arm/src/stm32h7/stm32_allocateheap.c +++ b/arch/arm/src/stm32h7/stm32_allocateheap.c @@ -210,10 +210,10 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE; - size_t usize = SRAM123_END - ubase; + size_t usize = SRAM_END - ubase; int log2; - DEBUGASSERT(ubase < (uintptr_t)SRAM123_END); + 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 @@ -221,7 +221,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) */ log2 = (int)mpu_log2regionfloor(usize); - DEBUGASSERT((SRAM123_END & ((1 << log2) - 1)) == 0); + DEBUGASSERT((SRAM_END & ((1 << log2) - 1)) == 0); usize = (1 << log2); ubase = SRAM123_END - usize; @@ -277,10 +277,10 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE; - size_t usize = SRAM123_END - ubase; + size_t usize = SRAM_END - ubase; int log2; - DEBUGASSERT(ubase < (uintptr_t)SRAM123_END); + 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 @@ -288,10 +288,10 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) */ log2 = (int)mpu_log2regionfloor(usize); - DEBUGASSERT((SRAM123_END & ((1 << log2) - 1)) == 0); + DEBUGASSERT((SRAM_END & ((1 << log2) - 1)) == 0); usize = (1 << log2); - ubase = SRAM123_END - usize; + ubase = SRAM_END - usize; /* Return the kernel heap settings (i.e., the part of the heap region * that was not dedicated to the user heap).