You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ya...@apache.org on 2021/03/23 07:39:37 UTC
[incubator-nuttx] 02/02: esp32_allocateheap.c: Adjust the region of
the heap coming from the external memory when a BSS section is allowed to
reside there.
This is an automated email from the ASF dual-hosted git repository.
yamamoto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit fcafacb9a3a872957a0dd9044e943a6370b42782
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Mar 11 15:19:02 2021 +0100
esp32_allocateheap.c: Adjust the region of the heap coming from the
external memory when a BSS section is allowed to reside there.
Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
arch/xtensa/src/common/xtensa_attr.h | 4 +++-
arch/xtensa/src/esp32/esp32_allocateheap.c | 13 +++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/xtensa/src/common/xtensa_attr.h b/arch/xtensa/src/common/xtensa_attr.h
index fa67cbb..9b9e82d 100644
--- a/arch/xtensa/src/common/xtensa_attr.h
+++ b/arch/xtensa/src/common/xtensa_attr.h
@@ -69,10 +69,12 @@
#define RTC_RODATA_ATTR __attribute__((section(".rtc.rodata")))
-/* Forces bss variable into external memory. */
+/* Allow bss variables into external memory. */
#ifdef CONFIG_XTENSA_EXTMEM_BSS
# define EXT_RAM_ATTR __attribute__((section(".extmem.bss")))
+#else
+# define EXT_RAM_ATTR
#endif
#endif /* __ARCH_XTENSA_SRC_COMMON_XTENSA_ATTR_H */
diff --git a/arch/xtensa/src/esp32/esp32_allocateheap.c b/arch/xtensa/src/esp32/esp32_allocateheap.c
index d040771..12502b9 100644
--- a/arch/xtensa/src/esp32/esp32_allocateheap.c
+++ b/arch/xtensa/src/esp32/esp32_allocateheap.c
@@ -148,11 +148,16 @@ void xtensa_add_region(void)
umm_addregion(start, size);
#endif
-#if defined(CONFIG_ESP32_SPIRAM)
- /* Check for any additional memory regions */
-
+#ifdef CONFIG_ESP32_SPIRAM
# if defined(CONFIG_HEAP2_BASE) && defined(CONFIG_HEAP2_SIZE)
- umm_addregion((FAR void *)CONFIG_HEAP2_BASE, CONFIG_HEAP2_SIZE);
+# ifdef CONFIG_XTENSA_EXTMEM_BSS
+ start = (FAR void *)(&_ebss_extmem);
+ size = CONFIG_HEAP2_SIZE - (size_t)(&_ebss_extmem - &_sbss_extmem);
+# else
+ start = (FAR void *)CONFIG_HEAP2_BASE;
+ size = CONFIG_HEAP2_SIZE;
+# endif
+ umm_addregion(start, size);
# endif
#endif
}