5.3 Default Linker Classes

The linker uses classes to represent memory ranges in which psects can be linked.

Classes are defined by linker options (see 6.1.1 A: Define Linker Class Option). The assembler driver passes a default set of such options to the linker, based on the selected target device. The names of linker classes are case sensitive.

Psects are typically allocated free memory from the class they are associated with. The association is made using the class flag with the PSECT directive (see 4.9.47.3 Class Flag). Alternatively, a psect can be explicitly placed into the memory associated with a class using a linker option (see 6.1.19 P: Position Psect).

Classes can represent a single memory range, or multiple ranges. Even if two ranges are contiguous, the address where one range ends and the other begins, forms a boundary, and psects placed in the class can never cross such boundaries. You can create classes that cover the same addresses, but which are divided into different ranges and have different boundaries. This allows you to accommodate psects whose contents makes assumptions about where it or the data it accesses would be located in memory. Memory allocated from one class will also be reserved from other classes that specify the same memory addresses.

To the linker, there is no significance to a class name or the memory it defines.

Memory can be removed from these classes if using the -mreserve option (see 3.4.22 Reserve Option), or when subtracting memory ranges using the -mram and -mrom options (see 3.4.21 Ram Option and 3.4.23 Rom Option).

Other than reserve memory from classes, never change or remove address boundaries specified by a class.