S5U1C17001C ManUal
EPSOn
7-15
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
7 liBrary
7
Library
7.3.3 Declaring and initializing global Variables
The ANSI library functions reference the global variables listed in Table 7.3.3.1. These variables have been
defined in the
libstdio.a
library. Include "
\include\libstdio.h
" in the C source program and call the
_init_lib()
function to initialize the variables before calling a library function.
For how to initialize the ANSI library using
libstdio.a
, refer to the sample file "
\gnu17\sample\
S1C17common\simulator\simulatedIO
".
Table 7.3.3.1 Global variables required of declaration
global variable
initial setting
related header file/function
FILE _iob[FOP1];
FOPEN_MAX=3
, defined in
stdio.h
File structure data for standard
input/output streams
_iob[
N
]._flg = _UGETN;
_iob[
N
]._buf = 0;
_iob[
N
]._fd =
N
;
(
N
=0–2)
_iob[0]
: Input data for
stdin
_iob[1]
: Output data for
stdout
_iob[2]
: Output data for
stderr
stdio.h
,
smcvals.h
fgets
,
fread
,
fscanf
,
getc
,
getchar
,
gets
,
scanf
,
ungetc
,
perror
,
fprintf
,
fputs
,
fwrite
,
printf
,
putc
,
putchar
,
puts
,
vfprintf
,
vprintf
FILE *stdin;
Pointer to standard input/output file
structure data
_iob[0]
stdin = &_iob[0];
stdio.h
fgets
,
fread
,
fscanf
,
getc
,
getchar
,
gets
,
scanf
,
ungetc
FILE *stdout;
Pointer to standard input/output file
structure data
_iob[1]
stdout = &_iob[1];
stdio.h
fprintf
,
fputs
,
fwrite
,
printf
,
putc
,
putchar
,
puts
,
vfprintf
,
vprintf
FILE *stderr;
Pointer to standard input/output file
structure data
iob[2]
stderr = &_iob[2];
stdio.h
fprintf
,
fputs
,
fwrite
,
printf
,
perror
,
putc
,
putchar
,
puts
,
vfprintf
,
vprintf
int errno;
Variable to store error number
errno = 0;
errno.h
perror, fprintf, printf, sprintf, vprintf,
vfprintf, fscanf, scanf, sscanf
atof
,
atoi
,
calloc
,
div
,
ldiv
,
malloc
,
realloc
,
str-
tod
,
strtol
,
strtoul
acos
,
asin
,
atan2
,
ceil
,
cos
,
cosh
,
exp
,
fabs
,
floor
,
fmod
,
frexp
,
ldexp
,
log
,
log10
,
modf
,
pow
,
sin
,
sinh
,
sqrt
,
tan
unsigned int seed;
Variable to store seed of random
number
seed = 1;
stdlib.h
rand
,
srand
time_t gm_sec;
Elapsed time of timer function in
seconds from 0:00:00 on January 1,
1970
gm_sec = -1;
time.h
time
Among the global variables referenced by the ANSI library functions, those that are used by each function (
mal-
loc
,
calloc
,
realloc
, and
free
) are initialized using the initialization function shown below. This function is
defined in
stdlib.h
.
int ansi_InitMalloc(unsigned long START_ADDRESS, unsigned long END_ADDRESS);
For the
START_ADDRESS
and
END_ADDRESS
, set the start and end addresses of the memory used, respectively.
These addresses are adjusted to the 4-byte boundaries within the function.
The following global variables are initialized. These variables are defined in
stdlib.h
.
unsigned char *ansi_ucStartAlloc;
Pointer to indicate the start address of the heap area
unsigned char *ansi_ucEndAlloc;
Pointer to indicate the end address of the heap area
unsigned char *ansi_ucNxtAlcP;
Address pointer to indicate the beginning of the next new area mapped
unsigned char *ansi_ucTblPtr;
Address pointer to indicate the beginning of the next management area
mapped
unsigned long ansi_ulRow;
Line pointer to indicate the next management area mapped
Each time storage is reserved for a heap area, eight-byte heap area management data is written from the ending
address (
ansi_ucEndAlloc
) toward the beginning address. Be careful to avoid rewriting areas specified as heap
areas by the
ansi_InitMalloc()
function by a stack pointer, etc.
* The
libstdio.a
library does not contain the
ansi_InitMalloc()
function. Be aware that it must be
called from the user routine before calling
malloc()
or a similar function. (A heap area cannot be allocated if
the
ansi_InitMalloc()
function is not called.)
Содержание S5U1C17001C
Страница 6: ......
Страница 17: ...1 General S5U1C17001C Manual 1 General ...
Страница 18: ......
Страница 21: ...1 2 Install S5U1C17001C Manual 2 Installation ...
Страница 22: ......
Страница 29: ...3 SoftDev S5U1C17001C Manual 3 Software Development Procedures ...
Страница 30: ......
Страница 103: ...4 SrcFiles S5U1C17001C Manual 4 Source files ...
Страница 104: ......
Страница 121: ...5 IDE S5U1C17001C Manual 5 gnU17 iDE ...
Страница 122: ......
Страница 365: ...6 Compiler S5U1C17001C Manual 6 C Compiler ...
Страница 366: ......
Страница 385: ...7 Library S5U1C17001C Manual 7 library ...
Страница 386: ......
Страница 404: ...7 18 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 7 liBrary THIS PAGE IS BLANK ...
Страница 405: ...8 Assemblr S5U1C17001C Manual 8 assembler ...
Страница 406: ......
Страница 438: ...8 32 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 8 aSSEMBlEr THIS PAGE IS BLANK ...
Страница 439: ...9 Linker S5U1C17001C Manual 9 linker ...
Страница 440: ......
Страница 448: ...9 8 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 9 linkEr THIS PAGE IS BLANK ...
Страница 449: ...10 Debugger S5U1C17001C Manual 10 Debugger ...
Страница 450: ......
Страница 625: ...10 174 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 10 DEBUggEr THIS PAGE IS BLANK ...
Страница 626: ...11 Tools S5U1C17001C Manual 11 Other Tools ...
Страница 627: ......
Страница 695: ...11 68 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 11 OTHEr TOOlS THIS PAGE IS BLANK ...
Страница 696: ...S1C17 Family C Compiler Package Quick Reference Reference ...