Keil™, An ARM® Company

LX51 User's Guide

Class Information

The linker creates special symbols (using no program or data space) that contain address and length information for classes used in an application.

Symbol NameDescription
_class-name_S_1The starting address of the class.
_class-name_B_The code bank in which the class is stored.
_class-name_L_The length of the class in bytes.
_class-name_E_The ending address of the class.
_class-name_T_The target (execution) address of the class.

You may create declarations from external variables to access this information. For example, use the following to get information about the length of the CODE memory class in the measure module:

extern unsigned char _code_L_;

unsigned code_length = (unsigned int) & _code_L_;

The SROM.H header file contains macro definitions that simplify access to memory class information:

#include <srom.h>

SROM_MC(code) // Create external declarations for the CODE Class

unsigned code_size   = SROM_MC_LEN(code);
unsigned code_start  = SROM_MC_SRC(code)1;
unsigned code_end    = SROM_MC_END(code);
unsigned code_target = SROM_MC_TRG(code);

Note

  1. The start address symbols are only valid when a Special ROM class is used (SROM class). Otherwise the target address symbol indicates the start address.