CONFIG_KERNEL_VM_BASE

Base virtual address to link the kernel

Type: hex

Help

Define the base virtual memory address for the core kernel.

The kernel expects a mappings for all physical RAM regions starting at this virtual address, with any unused space up to the size denoted by KERNEL_VM_SIZE available for memory mappings. This base address denotes the start of the RAM mapping and may not be the base address of the kernel itself, but the offset of the kernel here will be the same as the offset from the beginning of physical memory where it was loaded.

If there are multiple physical RAM regions which are discontinuous in the physical memory map, they should all be mapped in a continuous virtual region, with bounds defined by KERNEL_RAM_SIZE.

By default, this is the same as the DT_CHOSEN_Z_SRAM physical base SRAM address from DTS, in which case RAM will be identity-mapped. Some architectures may require RAM to be mapped in this way; they may have just one RAM region and doing this makes linking much simpler, as at least when the kernel boots all virtual RAM addresses are the same as their physical address (demand paging at runtime may later modify this for some subset of non-pinned pages).

Otherwise, if RAM isn’t identity-mapped: 1. It is the architecture’s responsibility to transition the instruction pointer to virtual addresses at early boot before entering the kernel at z_cstart(). 2. The underlying architecture may impose constraints on the bounds of the kernel’s address space, such as not overlapping physical RAM regions if RAM is not identity-mapped, or the virtual and physical base addresses being aligned to some common value (which allows double-linking of paging structures to make the instruction pointer transition simpler).

Direct dependencies

MMU

(Includes any dependencies from ifs and menus.)

Default

  • 0x0

Kconfig definition

At <Zephyr>/arch/Kconfig:535

Included via <Zephyr>/Kconfig:8<Zephyr>/Kconfig.zephyr:29

Menu path: (Top) → Enable MMU features

config KERNEL_VM_BASE
    hex "Base virtual address to link the kernel"
    default 0x0
    depends on MMU
    help
      Define the base virtual memory address for the core kernel.

      The kernel expects a mappings for all physical RAM regions starting at
      this virtual address, with any unused space up to the size denoted by
      KERNEL_VM_SIZE available for memory mappings. This base address denotes
      the start of the RAM mapping and may not be the base address of the
      kernel itself, but the offset of the kernel here will be the same as the
      offset from the beginning of physical memory where it was loaded.

      If there are multiple physical RAM regions which are discontinuous in
      the physical memory map, they should all be mapped in a continuous
      virtual region, with bounds defined by KERNEL_RAM_SIZE.

      By default, this is the same as the DT_CHOSEN_Z_SRAM physical base SRAM
      address from DTS, in which case RAM will be identity-mapped. Some
      architectures may require RAM to be mapped in this way; they may have
      just one RAM region and doing this makes linking much simpler, as
      at least when the kernel boots all virtual RAM addresses are the same
      as their physical address (demand paging at runtime may later modify
      this for some subset of non-pinned pages).

      Otherwise, if RAM isn't identity-mapped:
      1. It is the architecture's responsibility to transition the
      instruction pointer to virtual addresses at early boot before
      entering the kernel at z_cstart().
      2. The underlying architecture may impose constraints on the bounds of
      the kernel's address space, such as not overlapping physical RAM
      regions if RAM is not identity-mapped, or the virtual and physical
      base addresses being aligned to some common value (which allows
      double-linking of paging structures to make the instruction pointer
      transition simpler).

(The ‘depends on’ condition includes propagated dependencies from ifs and menus.)