This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b59d3aadf5855b2d77707a59925fbd5b6e838625 Author: Jukka Laitinen <[email protected]> AuthorDate: Thu Sep 3 15:26:18 2026 +0300 arch/arm/imxrt: Allow placing primary ram into TCM in allocateheap Add support for placing the primary ram into SysTCM on M33 cores or DTCM on M7 Signed-off-by: Jukka Laitinen <[email protected]> --- arch/arm/src/imxrt/Kconfig | 8 ++++++++ arch/arm/src/imxrt/imxrt_allocateheap.c | 15 +++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/imxrt/Kconfig b/arch/arm/src/imxrt/Kconfig index f440e57b667..b6ac401ea65 100644 --- a/arch/arm/src/imxrt/Kconfig +++ b/arch/arm/src/imxrt/Kconfig @@ -2626,6 +2626,7 @@ endchoice # i.MX RT Boot Configuration choice prompt "i.MX RT Primary RAM" + default IMXRT_TCM_PRIMARY if ARCH_CORTEXM33 default IMXRT_OCRAM_PRIMARY ---help--- The primary RAM is the RAM that contains the system BLOB's .data and @@ -2643,6 +2644,13 @@ config IMXRT_SRAM_PRIMARY bool "External SRAM primary" depends on IMXRT_SEMC_SRAM +config IMXRT_TCM_PRIMARY + bool "TCM primary" + ---help--- + Place the primary RAM in the core-local TCM (M7 DTCM or M33 + System TCM, both aliased at IMXRT_DTCM_BASE). The size is taken + from the linker script's _ram_size symbol. + endchoice # i.MX RT Primary RAM menu "i.MX RT Heap Configuration" diff --git a/arch/arm/src/imxrt/imxrt_allocateheap.c b/arch/arm/src/imxrt/imxrt_allocateheap.c index 8ad9ed5a4b9..b6a040cfaf5 100644 --- a/arch/arm/src/imxrt/imxrt_allocateheap.c +++ b/arch/arm/src/imxrt/imxrt_allocateheap.c @@ -159,16 +159,23 @@ # define IMXRT_DTCM 0 #endif -#ifndef IMXRT_OCRAM_SIZE - -extern const uint32_t _ram_size[]; /* See linker script */ +extern const uint32_t _ram_size[]; /* See linker script */ +#ifndef IMXRT_OCRAM_SIZE # define IMXRT_OCRAM_SIZE ((uint32_t)_ram_size) #endif #define FLEXRAM_REMAINING_K ((IMXRT_OCRAM_SIZE / 1024) - (CONFIG_IMXRT_DTCM + CONFIG_IMXRT_DTCM)) -#if defined(CONFIG_IMXRT_OCRAM_PRIMARY) +#if defined(CONFIG_IMXRT_TCM_PRIMARY) +/* Place the primary heap in the core-local TCM. Both cores alias their + * TCM at IMXRT_DTCM_BASE (M7 DTCM in the M7 view, M33 SysTCM in the M33 + * view); the size is picked up from the linker script's _ram_size. + */ + +# define PRIMARY_RAM_START IMXRT_DTCM_BASE +# define PRIMARY_RAM_SIZE ((uint32_t)_ram_size) +#elif defined(CONFIG_IMXRT_OCRAM_PRIMARY) # define PRIMARY_RAM_START _IMXRT_OCRAM_BASE # define PRIMARY_RAM_SIZE IMXRT_OCRAM_SIZE - (CONFIG_ITCM_USED + CONFIG_DTCM_USED) # define IMXRT_OCRAM_ASSIGNED 1
