xtensa/esp32: Warn about unused memory regions.

In case CONFIG_MM_REGIONS doesn't include all the available memory
regions the user will have a warning to increase it.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2021-03-05 11:11:08 +01:00 committed by YAMAMOTO Takashi
parent 5c7d041b91
commit 7fbc350589

View File

@ -96,6 +96,30 @@ void xtensa_add_region(void)
{
void *start;
size_t size;
int availregions;
int nregions = CONFIG_MM_REGIONS - 1;
#ifdef CONFIG_SMP
availregions = 2;
# ifdef CONFIG_BOARD_LATE_INITIALIZE
availregions++;
# else
minfo("A ~3KB heap region can be added to the heap by enabling"
" CONFIG_BOARD_LATE_INITIALIZE\n");
# endif
#else
availregions = 1;
#endif
#ifdef CONFIG_ESP32_SPIRAM
availregions++;
#endif
if (nregions < availregions)
{
mwarn("Some memory regions are left unused!\n");
mwarn("Increase CONFIG_MM_NREGIONS to add them to the heap\n");
}
#ifndef CONFIG_SMP
start = (FAR void *)(HEAP_REGION2_START + XTENSA_IMEM_REGION_SIZE);