23.3.3.5 Memory Regions

This section of the processor definitions linker script provides information about the memory regions that are available on the device.

/**************************************************************

* Memory Regions

*

 * Memory regions without attributes cannot be
        used for
 * orphaned sections. Only sections specifically
        assigned to
 * these regions can be allocated into these
        regions.

**************************************************************/

MEMORY

{

  kseg0_program_mem (rx) : ORIGIN = 0x9D000000,
        LENGTH = 0x8000

kseg0_boot_mem : ORIGIN = 0x9FC00490, LENGTH = 0x970

exception_mem : ORIGIN = 0x9FC01000, LENGTH = 0x1000

kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0x490

debug_exec_mem : ORIGIN = 0xBFC02000, LENGTH = 0xFF0

  config3                : ORIGIN = 0xBFC02FF0, LENGTH =
      0x4
  config2                : ORIGIN = 0xBFC02FF4, LENGTH =
      0x4
  config1                : ORIGIN = 0xBFC02FF8, LENGTH =
      0x4
  config0                : ORIGIN = 0xBFC02FFC, LENGTH =
      0x4

kseg1_data_mem : ORIGIN = 0xA0000000, LENGTH = 0x2000

  sfrs                   : ORIGIN = 0xBF800000, LENGTH =
        0x10000

}

Note: L1 cache devices use kseg1_data_mem.

Eleven memory regions are defined with an associated start address and length:

  • Program memory region (kseg0_program_mem) for application code
  • Boot memory regions (kseg0_boot_mem and kseg1_boot_mem)
  • Exception memory region (exception_mem)
  • Debug executive memory region (debug_exec_mem)
  • Configuration memory regions (config3, config2, config1, and config0)
  • Data memory region (kseg1_data_mem)
  • SFR memory region (sfrs)

The default linker script uses these names to locate sections into the correct regions. Sections which are non-standard become orphaned sections. The attributes of the memory regions are used to locate these orphaned sections. The attributes (rx) specify that read-only sections or executable sections can be located into the program memory regions. Similarly, the attributes (w!x) specify that sections that are not read-only and not executable can be located in the data memory region. Since no attributes are specified for the boot memory region, the configuration memory regions, or the SFR memory region, only specified sections may be located in these regions (that is, orphaned sections may not be located in the boot memory regions, the exception memory region, the configuration memory regions, the debug executive memory region, or the SFR memory region).