11.5.1 Declare a New Memory Space

This is very similar to declaring a new memory space for PMP access.

The XC-DSC toolsuite requires information about each external memory. In order for DSC device linker to be able to properly assign memory, information about the size of memory available and, optionally the origin of the memory, needs to be provided.

The external memory space was introduced in section Differences Between MPLAB® XC-DSC and C Standard. This attribute serves two purposes: declaring extended memory spaces and assigning C variable declarations to external memory (this will be covered in the next subsection).

Declaring an extended memory requires providing the size of the memory. You may optionally specify an origin for this memory; if none is specified 0x0000 will be assumed.

extern int external_memory

__attribute__((space(external(size(1024)))));

Above an external memory of size 1024 bytes is defined. This memory can be uniquely identified by its given name of external_memory.