mps_allocateheap:Modify the heap logic

Summary:
  Due to the modification of 4244610, the heap_size may be used on SRAM1, which can lead to misconfiguration problems for some mps qemu configurations (e.g.MPS3) that use extern DDR as the heap, refer to the previous issue VELAPLATFO-34555.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
chenrun1
2024-08-09 17:40:06 +08:00
committed by Xiang Xiao
parent 23ad93f430
commit 4b7c36554c
+13 -1
View File
@@ -174,7 +174,19 @@ void up_allocate_heap(void **heap_start, size_t *heap_size)
/* Return the heap settings */
*heap_start = (void *)g_idle_topstack;
*heap_size = MPS_SRAM1_START + MPS_SRAM1_SIZE - g_idle_topstack;
if (g_idle_topstack > MPS_SRAM1_START + MPS_SRAM1_SIZE)
{
/* If the range of SRAM1 is exceeded, we think that the extern REGION
* is enabled
*/
*heap_size = PRIMARY_RAM_END - g_idle_topstack;
}
else
{
*heap_size = MPS_SRAM1_START + MPS_SRAM1_SIZE - g_idle_topstack;
}
#endif
}