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

linguini pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new e6c982892b1 imxrt: make DTCM heap size configurable
e6c982892b1 is described below

commit e6c982892b1942903715c773f51e6630ace1e8a8
Author: Peter van der Perk <[email protected]>
AuthorDate: Wed Oct 29 15:07:38 2025 +0100

    imxrt: make DTCM heap size configurable
    
    By default, the full configured DTCM region is assigned to the heap for
    dynamic allocation. In scenarios requiring deterministic memory regions
    for static buffers or control structures, you can reduce the heap
    allocation to reserve part of DTCM for manual/static use.
    This kconfig symbol allows to limit the size.
    
    Signed-off-by: Peter van der Perk <[email protected]>
---
 arch/arm/src/imxrt/Kconfig              | 12 +++++++++++-
 arch/arm/src/imxrt/imxrt_allocateheap.c |  2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/imxrt/Kconfig b/arch/arm/src/imxrt/Kconfig
index 44807a062ee..22396545ef8 100644
--- a/arch/arm/src/imxrt/Kconfig
+++ b/arch/arm/src/imxrt/Kconfig
@@ -2633,7 +2633,17 @@ config IMXRT_DTCM_HEAP
        bool "Add DTCM to heap"
        depends on IMXRT_DTCM > 0
        ---help---
-               Select to add the entire DTCM to the heap
+               Select to add the DTCM to the heap
+
+config IMXRT_DTCM_HEAP_SIZE
+       int "DTCM heap Size in K"
+       depends on IMXRT_DTCM_HEAP
+       default IMXRT_DTCM
+       ---help---
+               By default, the full configured DTCM region is assigned to the 
heap for
+               dynamic allocation. In scenarios requiring deterministic memory 
regions
+               for static buffers or control structures, you can reduce the 
heap
+               allocation to reserve part of DTCM for manual/static use.
 
 config IMXRT_BOOTLOADER_HEAP
        bool "Add ROM bootloader 40Kib RAM to heap"
diff --git a/arch/arm/src/imxrt/imxrt_allocateheap.c 
b/arch/arm/src/imxrt/imxrt_allocateheap.c
index 307bf4fba62..8ae3c9a7263 100644
--- a/arch/arm/src/imxrt/imxrt_allocateheap.c
+++ b/arch/arm/src/imxrt/imxrt_allocateheap.c
@@ -203,7 +203,7 @@ extern  const uint32_t  _ram_size[];  /* See linker script 
*/
 #  define IMXRT_OCRAM_ASSIGNED 1
 #elif defined(CONFIG_IMXRT_DTCM_HEAP) && !defined(IMXRT_DCTM_ASSIGNED)
 #  define REGION1_RAM_START    IMXRT_DTCM_BASE
-#  define REGION1_RAM_SIZE     CONFIG_DTCM_USED
+#  define REGION1_RAM_SIZE     (CONFIG_IMXRT_DTCM_HEAP_SIZE * 1024)
 #  define IMXRT_DCTM_ASSIGNED 1
 #elif defined(CONFIG_IMXRT_SDRAM_HEAP) && !defined(IMXRT_SDRAM_ASSIGNED)
 #  define REGION1_RAM_START    (CONFIG_IMXRT_SDRAM_START + 
CONFIG_IMXRT_SDRAM_HEAPOFFSET)

Reply via email to