You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/06/06 18:32:34 UTC

[incubator-nuttx] branch master updated: arch/xtensa: Initialize the internal heap early.

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang 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 060df22968 arch/xtensa: Initialize the internal heap early.
060df22968 is described below

commit 060df22968d5523cb3a564fa1c0c4fd047923ceb
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Mon Jun 6 16:39:40 2022 +0200

    arch/xtensa: Initialize the internal heap early.
    
    We might have a situation where an allocation will be requested before
    the call to `up_initialize` is performed.  For the current code, this
    situation is the stack for the CPUs in SMP mode.
    
    Beside this issue, it's natural to have the internal heap initialized
    with the other heaps.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/Kconfig                        | 1 +
 arch/xtensa/src/common/xtensa_initialize.c | 6 ------
 arch/xtensa/src/esp32/esp32_extraheaps.c   | 4 ++++
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 692117aa57..0bd1bcc3bb 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -250,6 +250,7 @@ config XTENSA_INTBACKTRACE
 
 config XTENSA_IMEM_USE_SEPARATE_HEAP
 	bool "Use a separate heap for internal memory"
+	select ARCH_HAVE_EXTRA_HEAPS
 	default n
 	---help---
 		This is a separate internal heap that's used by drivers when certain operations
diff --git a/arch/xtensa/src/common/xtensa_initialize.c b/arch/xtensa/src/common/xtensa_initialize.c
index 32f85d6bdd..d1e9c39de9 100644
--- a/arch/xtensa/src/common/xtensa_initialize.c
+++ b/arch/xtensa/src/common/xtensa_initialize.c
@@ -104,12 +104,6 @@ void up_initialize(void)
   xtensa_pminitialize();
 #endif
 
-  /* Initialize the internal heap */
-
-#ifdef CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP
-  xtensa_imm_initialize();
-#endif
-
 #ifdef CONFIG_ARCH_DMA
   /* Initialize the DMA subsystem if the weak function xtensa_dma_initialize
    * has been brought into the build
diff --git a/arch/xtensa/src/esp32/esp32_extraheaps.c b/arch/xtensa/src/esp32/esp32_extraheaps.c
index 9b0caac957..83af01f465 100644
--- a/arch/xtensa/src/esp32/esp32_extraheaps.c
+++ b/arch/xtensa/src/esp32/esp32_extraheaps.c
@@ -54,6 +54,10 @@
 
 void up_extraheaps_init(void)
 {
+#ifdef CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP
+  xtensa_imm_initialize();
+#endif
+
 #ifdef CONFIG_ESP32_RTC_HEAP
   esp32_rtcheap_initialize();
 #endif