Keil™, An ARM® Company

CARM User's Guide

Discontinued

USERCLASS Compiler Directive

Abbreviation UCL
Arguments (MSpace = user-classname)
Default None.
µVision This directive may not be specified on the command line.
Description 

The USERCLASS directive assigns a user-defined class name (user-classname) to a compiler-generated segment (MSpace). By default, the CARM Compiler uses the following basic class names for segment definitions.

MSpaceDescription
CODEProgram code.
CONSTVariables defined with the const keyword.
DATAVariables.
ERAMProgram code defined with the __ram keyword.

To re-assign an MSpace to the default class, use the USERCLASS directive to assign the MSpace to the default class. For example:

#pragma userclass (DATA = default)

A user_classname may be referenced by the LARM Linker and used to locate all segments within that class to a specific memory section. In µVision, you may enter address ranges for user-defined classes under Options—LA Locate—User classes.

Example 
#pragma userclass (DATA = NVRAM)
// the following variables are stored in the DATA_NVRAM class
int  x1[10];
int  x2[10];

#pragma userclass (DATA = default)
// the following variables are stored in the default class DATA
int  y1[10];
int  y2[10];

#pragma userclass (CODE = APP)
// the following function is stored in the CODE_APP class
void func (void)  {
  ...
}