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)