PIC32MZ Virtual Address Space

Last modified by Microchip on 2023/11/09 09:01

 

virtual-address-space (1).png

The MIPS32® 4 GB virtual address space is partitioned into five fixed-size segments with traditional names; different things happen according to the virtual memory area an address lies in, as follows:

KUSEG: 0x00000000-0x7FFFFFFF (low 2GB):

These are the addresses permitted in User mode (see Modes of Operation). In machines with a Memory Management Unit (MMU), they will always be mapped. You should not attempt to use these addresses unless the MMU is set up. On PIC32MZ, this region is also cacheable.

KSEG0: 0x80000000-0x9FFFFFFF (512MB) :

These addresses are translated directly into physical addresses by stripping off the MSB and mapping them contiguously into the low 512 MB of physical memory (0x00000000 - 0x1FFFFFFF). Since this is a trivial translation, these addresses are often called unmapped.

KSEG1: 0xA0000000-0xBFFFFFFF (512MB) :

These addresses are mapped into physical addresses by stripping off the leading 3-bits, giving a duplicate mapping into the low 512 MB of physical memory (0x00000000 - 0x1FFFFFFF). But this time, access will not use the cache.

KSEG1 is the only memory region that can be used at reset because the MMU and cache must be configured by the boot code before it can be used. Therefore your boot code must be placed in KSEG1.

KSEG2: 0xC0000000-0xDFFFFFFF (512MB) & KSEG3: 0xE0000000-0xFFFFFFFF (512MB) :

These areas are only accessible in Kernel mode and are translated through the MMU. Don't access it before the MMU is set up. On PIC32MZ devices, KSEG2 is used to map access to external serial and parallel memory interfaces, while KSEG3 contains the debug segment (DSEG), used by a debugger or monitor.