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 2020/11/22 03:38:16 UTC

[incubator-nuttx] branch master updated: stm32h7: Bug where more than CONFIG_MM_REGIONS would be allocated

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 a0112ee  stm32h7: Bug where more than CONFIG_MM_REGIONS would be allocated
a0112ee is described below

commit a0112eee4fd4e079f52e5bbc7ac21e7e73a72826
Author: Brennan Ashton <ba...@brennanashton.com>
AuthorDate: Sat Nov 21 17:52:39 2020 -0800

    stm32h7: Bug where more than CONFIG_MM_REGIONS would be allocated
---
 arch/arm/src/stm32h7/stm32_allocateheap.c                       | 8 +++++++-
 boards/arm/stm32h7/nucleo-h743zi/configs/elf/defconfig          | 2 +-
 boards/arm/stm32h7/nucleo-h743zi/configs/nsh/defconfig          | 2 +-
 boards/arm/stm32h7/nucleo-h743zi/configs/nxlines_oled/defconfig | 2 +-
 boards/arm/stm32h7/nucleo-h743zi/configs/pwm/defconfig          | 2 +-
 boards/arm/stm32h7/stm32h747i-disco/configs/nsh/defconfig       | 2 +-
 6 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/arm/src/stm32h7/stm32_allocateheap.c b/arch/arm/src/stm32h7/stm32_allocateheap.c
index 92ce1ee..36c7d9e 100644
--- a/arch/arm/src/stm32h7/stm32_allocateheap.c
+++ b/arch/arm/src/stm32h7/stm32_allocateheap.c
@@ -345,12 +345,18 @@ static void addregion (uintptr_t start, uint32_t size, const char *desc)
 
 void arm_addregion(void)
 {
-  addregion (SRAM123_START, SRAM123_END - SRAM123_START, "SRAM1,2,3");
+  /* At this point there is already one region allocated for "kernel" heap */
 
   unsigned mm_regions = 1;
 
   if (mm_regions < CONFIG_MM_REGIONS)
     {
+      addregion (SRAM123_START, SRAM123_END - SRAM123_START, "SRAM1,2,3");
+      mm_regions++;
+    }
+
+  if (mm_regions < CONFIG_MM_REGIONS)
+    {
       addregion (SRAM4_START, SRAM4_END - SRAM4_START, "SRAM4");
       mm_regions++;
     }
diff --git a/boards/arm/stm32h7/nucleo-h743zi/configs/elf/defconfig b/boards/arm/stm32h7/nucleo-h743zi/configs/elf/defconfig
index c952cbc..f6f8068 100644
--- a/boards/arm/stm32h7/nucleo-h743zi/configs/elf/defconfig
+++ b/boards/arm/stm32h7/nucleo-h743zi/configs/elf/defconfig
@@ -34,7 +34,7 @@ CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_INTELHEX_BINARY=y
 CONFIG_MAX_TASKS=16
-CONFIG_MM_REGIONS=3
+CONFIG_MM_REGIONS=4
 CONFIG_NFILE_DESCRIPTORS=8
 CONFIG_NSH_ARCHINIT=y
 CONFIG_NSH_BUILTIN_APPS=y
diff --git a/boards/arm/stm32h7/nucleo-h743zi/configs/nsh/defconfig b/boards/arm/stm32h7/nucleo-h743zi/configs/nsh/defconfig
index 17d3987..d0f8855 100644
--- a/boards/arm/stm32h7/nucleo-h743zi/configs/nsh/defconfig
+++ b/boards/arm/stm32h7/nucleo-h743zi/configs/nsh/defconfig
@@ -27,7 +27,7 @@ CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_INTELHEX_BINARY=y
 CONFIG_MAX_TASKS=16
-CONFIG_MM_REGIONS=3
+CONFIG_MM_REGIONS=4
 CONFIG_NFILE_DESCRIPTORS=8
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
diff --git a/boards/arm/stm32h7/nucleo-h743zi/configs/nxlines_oled/defconfig b/boards/arm/stm32h7/nucleo-h743zi/configs/nxlines_oled/defconfig
index 20bdd7a..8c38126 100644
--- a/boards/arm/stm32h7/nucleo-h743zi/configs/nxlines_oled/defconfig
+++ b/boards/arm/stm32h7/nucleo-h743zi/configs/nxlines_oled/defconfig
@@ -39,7 +39,7 @@ CONFIG_LCD_MAXCONTRAST=255
 CONFIG_LCD_SH1106_OLED_132=y
 CONFIG_LCD_SSD1306_I2C=y
 CONFIG_MAX_TASKS=16
-CONFIG_MM_REGIONS=3
+CONFIG_MM_REGIONS=4
 CONFIG_MQ_MAXMSGSIZE=128
 CONFIG_NFILE_DESCRIPTORS=8
 CONFIG_NSH_ARCHINIT=y
diff --git a/boards/arm/stm32h7/nucleo-h743zi/configs/pwm/defconfig b/boards/arm/stm32h7/nucleo-h743zi/configs/pwm/defconfig
index 726f6ec..8a2b5a7 100644
--- a/boards/arm/stm32h7/nucleo-h743zi/configs/pwm/defconfig
+++ b/boards/arm/stm32h7/nucleo-h743zi/configs/pwm/defconfig
@@ -27,7 +27,7 @@ CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_INTELHEX_BINARY=y
 CONFIG_MAX_TASKS=16
-CONFIG_MM_REGIONS=3
+CONFIG_MM_REGIONS=4
 CONFIG_NFILE_DESCRIPTORS=8
 CONFIG_NSH_ARCHINIT=y
 CONFIG_NSH_BUILTIN_APPS=y
diff --git a/boards/arm/stm32h7/stm32h747i-disco/configs/nsh/defconfig b/boards/arm/stm32h7/stm32h747i-disco/configs/nsh/defconfig
index 3263732..cdc9a42 100644
--- a/boards/arm/stm32h7/stm32h747i-disco/configs/nsh/defconfig
+++ b/boards/arm/stm32h7/stm32h747i-disco/configs/nsh/defconfig
@@ -27,7 +27,7 @@ CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_INTELHEX_BINARY=y
 CONFIG_MAX_TASKS=16
-CONFIG_MM_REGIONS=3
+CONFIG_MM_REGIONS=4
 CONFIG_NFILE_DESCRIPTORS=8
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512