Keil Logo

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.

MSpace Description
CODE Program code.
CONST Variables defined with the const keyword.
DATA Variables.
ERAM Program 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)  {
  ...
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.