The CLASSES directive allows you to specify an address range (range) for a class (class-name). This directive is used to define the memory layout of your application program or target hardware. The LX51 Linker uses the following default class settings if no explicit class ranges are specified: | Class | Address Range |
|---|
| BIT | I:000020h.0-I:00002Fh.7 | | CODE | C:000000h-C:00FFFFh | | CONST | C:000000h-C:00FFFFh | | DATA | D:000000h-D:00007Fh | | ECODE | C:000000h-C:FFFFFFh | | HCONST | C:000000h-C:FFFFFFh | | HDATA | X:000000h-X:FFFFFFh | | IDATA | I:000000h-I:0000FFh | | SROM | C:000000h-C:00FFFFh | | XDATA | X:000000h-X:00FFFFh |
Note - The address ranges used are listed in the linker MAP file in the Memory Classes section. You should check this section of the MAP file to verify that the linker assumptions about the memory in your hardware matches your physical system. Refer to Listing (MAP) File for more information.
Specifying the Memory Range for a ClassThe CLASSES directive is typically specified as follows to define an address range for a memory class:
CLASSES (class-name (range« , ... ») « , ... »)
Where | class-name | is the name of the class. | | range | is the address range to assign to the class. All segments within a class are located and must fit within this range. |
Note - You may specify multiple ranges for a memory class.
Specifying Addresses for OFFS SegmentsThe CLASSES directive allows you to modify the absolute addresses of segments with the OFFS relocation type. Refer to SEGMENT definitions in the Ax51 Assembler User's Guide for information on how to create these kinds of segments. This form of the CLASSES directive is specified as follows:
CLASSES (class-name ($offset, range))
Where | class-name | is the name of the class. | | offset | is the first address in the range. This will be the address of the segment with an OFFS of 0000h. | | range | is the address range to assign to the OFFS segments. |
Typically, only the segments for the reset and interrupt vectors are defined using the OFFS relocation type. This form of the CLASSES directive allows you to quickly relocate these vectors to a new address range. This is useful when you use MON51 or FlashMON51 installed at address 0000h to debug. Specifying Special ROM (SROM) ClassesYou may specify memory classes which execute from one location (usually RAM) but which are stored in a different location (usually ROM). The application program must copy the program code from ROM to RAM before execution. This form of the CLASSES directive is specified as follows:
CLASSES (class-name (execute-range)[])
Where | class-name | is the name of the class. | | execute-range | is the execution address range for the class. | | [] | empty brackets specify that the contents of the class are stored in the SROM memory class. |
Refer to Special ROM Handling for more information about using the SROM memory class. |