This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new f826e05 arch/xtensa/esp32: Remove the QEMU special case when
initializing the heap.
f826e05 is described below
commit f826e053ae7621ec14788ce8f0eda2a2a20049fb
Author: Abdelatif Guettouche <[email protected]>
AuthorDate: Wed Dec 1 12:01:16 2021 +0100
arch/xtensa/esp32: Remove the QEMU special case when initializing the
heap.
QEMU had a different ROM image that used the regions of PRO CPU for both
CPUs. This was causing crashes when running SMP mode as the heap was
being corrupted when the APP CPU starts.
QEMU is now loading the same image as the hardware chip and thus this
special case doesn't exist anymore.
Signed-off-by: Abdelatif Guettouche <[email protected]>
---
arch/xtensa/include/esp32/memory_layout.h | 16 +---------------
arch/xtensa/src/esp32/esp32_allocateheap.c | 9 +--------
2 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/arch/xtensa/include/esp32/memory_layout.h
b/arch/xtensa/include/esp32/memory_layout.h
index 2bfd5a8..5d25843 100644
--- a/arch/xtensa/include/esp32/memory_layout.h
+++ b/arch/xtensa/include/esp32/memory_layout.h
@@ -112,23 +112,9 @@
*
* When an internal heap is enabled this region starts at an offset equal to
* the size of the internal heap.
- *
- * The QEMU bootloader image is slightly different than the chip's one.
- * The ROM on PRO and APP CPUs uses different regions for static data.
- * In QEMU, however, we load only one ROM binary, taken from the PRO CPU,
- * and it is used by both CPUs. So, in QEMU, if we allocate PRO CPUs region
- * early, it will be clobbered once the APP CPU starts.
- * We can delay the allocation to when everything has started through the
- * board_late_initiliaze hook, as is done for the APP data, however this
- * should be fixed from QEMU side. The following macros, then, just skip
- * PRO CPU's regions when a QEMU image generation is enabled with SMP.
*/
-#if defined(CONFIG_ESP32_QEMU_IMAGE) && defined(CONFIG_SMP)
-# define HEAP_REGION2_START 0x3ffe7e40
-#else
-# define HEAP_REGION2_START 0x3ffe0450
-#endif
+#define HEAP_REGION2_START 0x3ffe0450
#ifdef CONFIG_SMP
# define HEAP_REGION2_END 0x3ffe3f10
diff --git a/arch/xtensa/src/esp32/esp32_allocateheap.c
b/arch/xtensa/src/esp32/esp32_allocateheap.c
index 7757512..5a7b32e 100644
--- a/arch/xtensa/src/esp32/esp32_allocateheap.c
+++ b/arch/xtensa/src/esp32/esp32_allocateheap.c
@@ -116,12 +116,6 @@ void xtensa_add_region(void)
start = (void *)(HEAP_REGION2_START + XTENSA_IMEM_REGION_SIZE);
size = (size_t)(uintptr_t)&_eheap - (size_t)start;
umm_addregion(start, size);
-
-#else
-#ifdef CONFIG_ESP32_QEMU_IMAGE
- start = (void *)HEAP_REGION2_START;
- size = (size_t)(uintptr_t)&_eheap - (size_t)start;
- umm_addregion(start, size);
#else
start = (void *)HEAP_REGION2_START;
size = (size_t)(HEAP_REGION2_END - HEAP_REGION2_START);
@@ -131,9 +125,8 @@ void xtensa_add_region(void)
size = (size_t)(uintptr_t)&_eheap - (size_t)start;
umm_addregion(start, size);
#endif
-#endif
-#if !defined(CONFIG_ESP32_QEMU_IMAGE) && !defined(CONFIG_ESP32_BLE)
+#ifndef CONFIG_ESP32_BLE
start = (void *)HEAP_REGION0_START;
size = (size_t)(HEAP_REGION0_END - HEAP_REGION0_START);
umm_addregion(start, size);