kernel: add CONFIG_SRAM_OFFSET
This adds a new kconfig CONFIG_SRAM_OFFSET to specify the offset from beginning of SRAM where the kernel begins. On x86 and PC compatible platforms, the first 1MB of RAM is reserved and Zephyr should not link anything there. However, this 1MB still needs to be mapped by the MMU to access various platform related information. CONFIG_SRAM_OFFSET serves similar function as CONFIG_KERNEL_VM_OFFSET and is needed for proper phys/virt address translations. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
ec21c0b92f
commit
ece9cad858
|
@ -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"
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue