From 88f6851a3dc5786bff76e0e98ffbe0f534c8152f Mon Sep 17 00:00:00 2001 From: Weiwei Guo Date: Tue, 13 Aug 2024 18:09:07 +0800 Subject: [PATCH] arch: common: Add user can specify the nocache location nocache ram is usually used by DMA to transfer data between peripherals and ram. Some chips use isolated nocache ram, which does not necessarily have to be in RAMABLE-REGION. By specifying the zephyr,nocache-ram options, users can specify the region where nocache-ram is located. If the user does not specify it, it defaults to RAMABLE-REGION. Signed-off-by: Weiwei Guo --- arch/common/nocache.ld | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/common/nocache.ld b/arch/common/nocache.ld index a4e500e8b17..24e81cdefcf 100644 --- a/arch/common/nocache.ld +++ b/arch/common/nocache.ld @@ -7,6 +7,12 @@ /* Copied from linker.ld */ +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_nocache_ram), okay) +#define NOCACHE_REGION LINKER_DT_NODE_REGION_NAME_TOKEN(DT_CHOSEN(zephyr_nocache_ram)) +#else +#define NOCACHE_REGION RAMABLE_REGION +#endif + /* Non-cached region of RAM */ SECTION_DATA_PROLOGUE(_NOCACHE_SECTION_NAME,(NOLOAD),) { @@ -27,5 +33,5 @@ SECTION_DATA_PROLOGUE(_NOCACHE_SECTION_NAME,(NOLOAD),) MPU_ALIGN(_nocache_ram_size); #endif _nocache_ram_end = .; -} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) +} GROUP_DATA_LINK_IN(NOCACHE_REGION, NOCACHE_REGION) _nocache_ram_size = _nocache_ram_end - _nocache_ram_start;