arch/xtensa/esp32: Part of the ROM regions in middle of DRAM are not

used, retrieve them as heap.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2021-03-08 09:59:20 +01:00 committed by YAMAMOTO Takashi
parent a68a39c785
commit cba44928d2
7 changed files with 56 additions and 2 deletions

View File

@ -96,3 +96,8 @@
# define ESP32_IMEM_START 0x3ffe7e40
#endif
/* Region of unused ROM App data */
#define HEAP_REGION_ROMAPP_START 0x3ffe4360
#define HEAP_REGION_ROMAPP_END 0x3ffe5230

View File

@ -96,8 +96,15 @@ void xtensa_add_region(void)
{
size_t region2_start = HEAP_REGION2_START + XTENSA_IMEM_REGION_SIZE;
#ifndef CONFIG_SMP
umm_addregion((FAR void *)region2_start,
(size_t)(uintptr_t)&_eheap - region2_start);
#else
umm_addregion((FAR void *)region2_start,
(size_t)HEAP_REGION2_END - region2_start);
umm_addregion((FAR void *)HEAP_REGION3_START,
(size_t)&_eheap - HEAP_REGION3_START);
#endif
#if defined(CONFIG_ESP32_SPIRAM)
/* Check for any additional memory regions */

View File

@ -28,7 +28,7 @@ CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_MAX_TASKS=16
CONFIG_MM_REGIONS=2
CONFIG_MM_REGIONS=3
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y

View File

@ -41,7 +41,7 @@ CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=128
CONFIG_MM_REGIONS=2
CONFIG_MM_REGIONS=3
CONFIG_NAME_MAX=48
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDEVICES=y

View File

@ -27,7 +27,9 @@
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/mm/mm.h>
#include <arch/board/board.h>
#include <arch/esp32/memory_layout.h>
#include "esp32-devkitc.h"
@ -78,5 +80,17 @@ void board_late_initialize(void)
/* Perform board-specific initialization */
esp32_bringup();
#ifdef CONFIG_SMP
/* To avoid corrupting the heap, this region of memory (~3KB) is not
* included until the APP CPU has started.
* So we can't add it with the rest of the regions at xtensa_add_region(),
* that function is called early from up_initialize(). We wait until the
* SMP bringup is complete.
*/
umm_addregion((FAR void *)HEAP_REGION_ROMAPP_START,
(size_t)(HEAP_REGION_ROMAPP_END - HEAP_REGION_ROMAPP_START));
#endif
}
#endif

View File

@ -27,7 +27,9 @@
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/mm/mm.h>
#include <arch/board/board.h>
#include <arch/esp32/memory_layout.h>
#include "esp32-ethernet-kit.h"
@ -78,5 +80,17 @@ void board_late_initialize(void)
/* Perform board-specific initialization */
esp32_bringup();
#ifdef CONFIG_SMP
/* To avoid corrupting the heap, this region of memory (~3KB) is not
* included until the APP CPU has started.
* So we can't add it with the rest of the regions at xtensa_add_region(),
* that function is called early from up_initialize(). We wait until the
* SMP bringup is complete.
*/
umm_addregion((FAR void *)HEAP_REGION_ROMAPP_START,
(size_t)(HEAP_REGION_ROMAPP_END - HEAP_REGION_ROMAPP_START));
#endif
}
#endif

View File

@ -27,7 +27,9 @@
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/mm/mm.h>
#include <arch/board/board.h>
#include <arch/esp32/memory_layout.h>
#include "esp32-wrover-kit.h"
@ -83,5 +85,17 @@ void board_late_initialize(void)
/* Perform board-specific initialization */
esp32_bringup();
#ifdef CONFIG_SMP
/* To avoid corrupting the heap, this region of memory (~3KB) is not
* included until the APP CPU has started.
* So we can't add it with the rest of the regions at xtensa_add_region(),
* that function is called early from up_initialize(). We wait until the
* SMP bringup is complete.
*/
umm_addregion((FAR void *)HEAP_REGION_ROMAPP_START,
(size_t)(HEAP_REGION_ROMAPP_END - HEAP_REGION_ROMAPP_START));
#endif
}
#endif