value = 32 kB = 0x8000 on PIC32MX250F128B)īMXDUDBA (R/W) = defines User data RAM segment base address (max. Only lower 16-bits are used.The upper 16-bits are presumed to be =0x8000 for kernel program RAM segment 0 and 0xA000 for kernel program RAM segment 1 (max. MEMORY MATRIX CONTROL REGISTERS DESCTIPTIONS:īMXCON (R/W) = configuration register that defines arbtration mode (0,1,2) and enables various memory exceptions that occure, if a memory access is outside defined memory segments boundaries.īMXDKPBA (R/W) = defines base address for kernel RAM program segment.
See the PIC32MX2X0 programming guide on the functions usage details.Ī full programming example will be provided soon. It must be within kernel program RAM segment (ex. Look for the main function 32-bit start-up address. The easiest way to do this is to use a disassembly function from the programming environment. The executable code entry point must be determined. You may also set BMXCON register to 0x41 (arbitration mode 1 - default) or 0x40 (arbitration mode 0, if DMA controller is not used) to avoid memory exceptions. MemoryWrite (register_address as UInt32, new_value as UInt32) as Integer The resulting *.HEX file must read to PIC32MX250F128B kernel program RAM segment with:
A configuration file must produce an executable code (abosolute or relative) that can run in the kernel RAM program segment. C compilers for PIC32 microcontrollers support linker configuration files.
The next consideration is on how to build a program code to run from PIC32MX250F128B RAM. This configuration is perfectly ok for the most of the PIC32 projects, because all the firmware code is executed in kernel mode. This will cause the rest of the RAM to be treated as kernel 0 and 1 program memory.īMXDKPBA = 10 * 1024 bytes = 10 kB = 0x2800 -> kernel 0 and 1 data RAM = 10 kB, followed by kernel 0 and 1 program RAM = 22 kBīMXDUDBA = BMXDUPBA = 32 kB = 0x8000 -> user data RAM and user program RAM are not defined The simplest option is to set BMXDKPBA to the data RAM segment size and BMXDUDBA and BMXDUPBA registers to 32 kB, which is the size of PIC32MX250F128B RAM. However at least BMXDKPBA, BMXDUDBA and BMXDUPBA registers must be propetly set to allow code execution from PIC32 RAM. This means that that flash RAM is used for kernel 0 and 1 program segments and the whole RAM is used for kernel 0 and kernel 1 data segments. PIC32 micrcontrollers have five memory management registers: BMXCON, BMXDKPBA, BMXDUDBA, BMXDUPBA, BMXPUPBA, BMXDRMSZ, BNXPFMSZ and BMXBOOTSZ.īMXDKPBA, BMXDUDBA, BMXDUPBA and BMXPUPBA registers default to zero (0).