9.10.18 space (space)

Normally, the compiler allocates variables in general data space. The space attribute can be used to direct the compiler to allocate a variable in specific memory spaces. Memory spaces are discussed further in Address Spaces The following arguments to the space attribute are accepted:
  • data – Allocate the variable in general data space. Variables in general data space can be accessed using ordinary C statements. This is the default allocation.
  • xmemory – Allocate the variable in X data space. Variables in X data space can be accessed using ordinary C statements. An example of xmemory space allocation is:
    int x[32] __attribute__ ((space(xmemory)));

    Depending on the device, other attributes may need to be used with space() for xmemory, such as aligned (alignment).

  • ymemory – Allocate the variable in Y data space. Variables in Y data space can be accessed using ordinary C statements. An example of ymemory space allocation is:
    int y[32] __attribute__ ((space(ymemory)));

    Depending on the device, other attributes may need to be used with space() for ymemory, such as aligned (alignment).

  • prog – Allocate the variable in program space in a section designated for executable code. This area of memory can be accessed with normal C statements.
  • external – Allocate the variable in a user defined memory space. For complete details please see the External Memory Access section.