English
Language : 

CC78K4 Datasheet, PDF (301/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler 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 (sreg variables) declared with the keyword sreg or
_ _sreg are automatically allocated to saddr2 [XFD20H to XFDFFH] area with relocatability (X: 0 or F by
specifying location). When those variables exceed the area shown above, a compilation 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 becomes a boolean type variable automatically.
• sreg variables declared without an initial value take 0 as the initial value.
• The area of sreg variables declared in the assembler source that can be referenced is the saddr2 area
[XFD20H to XFDFFH]. When the -QR option is specified, however, the compiler may use up to 32 MB of
saddr2 area, so care must be taken (refer to Table 11-3 Utilization of Memory Space).
EFFECT
• Instructions to the saddr2 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 that defines the
variables. Only a variable with a static storage class specifier can become a sreg variable 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
User’s Manual U15556EJ1V0UM
301