Skip to content

arch: common: Make nocache region optionally loadable #87826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions arch/common/nocache.ld
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/* Copied from linker.ld */

/* Non-cached region of RAM */
SECTION_DATA_PROLOGUE(_NOCACHE_SECTION_NAME,(NOLOAD),)
SECTION_DATA_PROLOGUE(_NOCACHE_SECTION_NAME,,)
{
#if defined(CONFIG_MMU)
MMU_ALIGN;
Expand All @@ -27,5 +27,6 @@ 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(RAMABLE_REGION, ROMABLE_REGION)
_nocache_ram_size = _nocache_ram_end - _nocache_ram_start;
_nocache_load_start = LOADADDR(_NOCACHE_SECTION_NAME);
1 change: 1 addition & 0 deletions include/zephyr/linker/linker-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ extern char __sg_size[];
extern char _nocache_ram_start[];
extern char _nocache_ram_end[];
extern char _nocache_ram_size[];
extern char _nocache_load_start[];
#endif /* CONFIG_NOCACHE_MEMORY */

/* Memory owned by the kernel. Start and end will be aligned for memory
Expand Down
6 changes: 6 additions & 0 deletions kernel/xip.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ void z_data_copy(void)
z_early_memcpy(&__ramfunc_region_start, &__ramfunc_load_start,
__ramfunc_end - __ramfunc_region_start);
#endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */
#ifdef CONFIG_ARCH_HAS_NOCACHE_MEMORY_SUPPORT
#if CONFIG_NOCACHE_MEMORY
z_early_memcpy(&_nocache_ram_start, &_nocache_load_start,
(uintptr_t) &_nocache_ram_size);
#endif /* CONFIG_NOCACHE_MEMORY */
#endif /* CONFIG_ARCH_HAS_NOCACHE_MEMORY_SUPPORT */
#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ccm))
z_early_memcpy(&__ccm_data_start, &__ccm_data_load_start,
__ccm_data_end - __ccm_data_start);
Expand Down