diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 68864a1bf9b..190d05528fd 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -167,6 +167,22 @@ config LINKER_SORT_BY_ALIGNMENT in decreasing size of symbols. This helps to minimize padding between symbols. +config HAS_SRAM_OFFSET + bool + help + This option is selected by targets that require SRAM_OFFSET. + +config SRAM_OFFSET + hex "Kernel SRAM offset" if HAS_SRAM_OFFSET + default 0 + help + This option specifies the byte offset from the beginning of SRAM + where the kernel begins. Changing this value from zero will affect + the Zephyr image's link, and will decrease the total amount of + SRAM available for use by application code. + + If unsure, leave at the default value 0. + endmenu menu "Compiler Options" diff --git a/arch/Kconfig b/arch/Kconfig index 194eb3591c7..93818d650c7 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -608,7 +608,7 @@ config KERNEL_VM_OFFSET in page tables, the equation: virt = phys + ((KERNEL_VM_BASE + KERNEL_VM_OFFSET) - - SRAM_BASE_ADDRESS) + (SRAM_BASE_ADDRESS + SRAM_OFFSET)) Will be used to convert between physical and virtual addresses for memory that is mapped at boot. diff --git a/arch/x86/include/x86_mmu.h b/arch/x86/include/x86_mmu.h index 02835aa6949..450208d6937 100644 --- a/arch/x86/include/x86_mmu.h +++ b/arch/x86/include/x86_mmu.h @@ -82,7 +82,7 @@ */ #ifdef CONFIG_MMU #define Z_X86_VIRT_OFFSET ((CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_OFFSET) - \ - CONFIG_SRAM_BASE_ADDRESS) + (CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_OFFSET)) #else #define Z_X86_VIRT_OFFSET 0 #endif diff --git a/kernel/include/mmu.h b/kernel/include/mmu.h index 34b77fb9fa7..f568ec4d04d 100644 --- a/kernel/include/mmu.h +++ b/kernel/include/mmu.h @@ -41,7 +41,7 @@ #define Z_KERNEL_VIRT_SIZE (Z_KERNEL_VIRT_END - Z_KERNEL_VIRT_START) #define Z_VM_OFFSET ((CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_OFFSET) - \ - CONFIG_SRAM_BASE_ADDRESS) + (CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_OFFSET)) /* Only applies to boot RAM mappings within the Zephyr image that have never * been remapped or paged out. Never use this unless you know exactly what you