Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 103 -
(2) Segment in which global and static variables are allocated
Global variables and static variables are allocated in each segment
according to the following rule.
Not-initialized variables
When total size of all not-initialized variables of any
source module is small, they are allocated in TS?__BSS
segment. When it is larger than some value, they are
allocated in TS?_FAR_BSS_1.
Initialized variables
Small size variables are allocated in TS?__DATA segment.
Large ones are allocated in TS?_module5_DATA segment. It
is determined by threshold value specified by compile
option /Gt of MS-C that in whether they are allocated.
(3) Default data segment
The default data segment, which is equivalent to DGROUP segment generated
by MS-C, is TS?_DGROUP in C Executor. This segment includes global variables,
static variables and stack area. The size of this segment is 64 KBytes for
each tasks.
+-----------------------+ 0x0000 (offset)
||
| initialized variables |
| constants |
| not-initialized vari- |
| ables |
||
+-----------------------+
| free area |
+-----------------------+
||
||
| stack area |
||
||
+-----------------------+ 0xFFFF
As total size of global/static variables grows, the available stack size
decreases. When many variables are allocated in this segment, stack area may
reach variable area by executing the application program. Then, the
application program can't work correctly. Take care of total size of
variables allocated in TS?_DGROUP segment.
You can check the total size of variables allocated in TS?_DGROUP segment
as follows. Task?.map files are generated for each tasks by executing nmake
command to make application. There is a following section at the end of this
map file.