5.8. Regions and Memory Sections

The following regions are defined for MIPS ELF.

RegionContents
ram

.data and .bss sections. In ram-based profiles, also contains .text and other program-like sections.

Note that not all regions are provided in every linker script or profile; see the documentation of the individual linker scripts in Section 5.6, “Supported Boards for MIPS ELF”, above.

Regions documented as "Memory regions" correspond to similarly-named program sections. For example, the linker script assigns the .ram section to the ram region. You can explicitly locate data or code in these sections using section attributes in your source C or C++ code. Section attributes are especially useful on code compiled for boards that include special memory banks, such as a fast on-chip cache memory, in addition to the default ram and/or rom regions. CS3 arranges for additional data-like sections to be initialized in the same way as the default .data section.

As an example to illustrate the attribute syntax, you can put a variable v in the .ram section using:

int v __attribute__ ((section (".ram")));

To declare a function f in this section, use:

int f (void) __attribute__ ((section (".ram"))) {...}

For more information about attribute syntax, see the GCC manual.

Regions documented as "Other regions" do not have a corresponding program section. Typically, these regions correspond to memory-mapped control and I/O registers that cannot be used for general data or program storage. If you need to manipulate data in these regions, you can use the CS3 memory layout facilities declared in cs3.h, as described in Section 5.3, “Memory Layout”.

Memory maps for boards supported by Sourcery G++ Lite for MIPS ELF are documented in the linker scripts in the mips-sde-elf/lib/ subdirectory of your Sourcery G++ installation directory.