English
Language : 

CC78K0S Datasheet, PDF (316/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 11 EXTENDED FUNCTIONS
(3) How to use the saddr area
Usage of saddr Area
sreg/_ _sreg
(1) Usage with sreg declaration
FUNCTION
• The external variables and in-function static variables (called sreg variables) declared with the keyword sreg
or _ _sreg are automatically allocated to the saddr area [FE20H to FED7H] (normal model) and [FE20H to
FEEFH] (static model) with relocatability. When those variables exceed the area shown above, a compile
error occurs.
• The sreg variables are treated in the same manner as the ordinary variables in the C source.
• Each bit of sreg variables of char, short, int, and long type become boolean type variables automatically.
• sreg variables declared without an initial value take 0 as the initial value.
• The area that can be referenced by the sreg variables declared in the assembler source is the saddr area
[FE20H to FEFFH]. The area [FED8H to FEFFH] (normal model) and [FEF0H to FEFFH] (static model) are
used by compiler, so care must be taken (refer to Table 11-2 Utilization of Memory Space).
EFFECT
• Instructions to the saddr area are generally shorter in code length than those to memory. This helps shorten
object code and also improves program execution speed.
USAGE
• Declare variables with the keywords sreg and _ _sreg inside a module and a function which defines the
variables. Only variables with a static storage class specifier can become sreg variables inside a function.
sreg type-name variable-name / sreg static type-name variable-name
_ _sreg type-name variable-name / _ _sreg static type-name variable-name
• Declare the following variables inside a module that refers to sreg external variables. They can be described
inside a function as well.
extern sreg type-name variable-name / extern _ _sreg type-name variable-name
316
User’s Manual U14872EJ1V0UM