Zilog EZ80F916 User Manual
Page 88

UM014423-0607
Using the Integrated Development Environment
ZiLOG Developer Studio II
eZ80Acclaim!
®
User Manual
68
To reduce overall code size by selecting this check box, the following conditions are nec-
essary:
•
All calls to
printf()
and
sprintf()
must use string literals, rather than
char*
variables, as parameters. For example, the following code allows the compiler to
reduce the code size:
printf ("Timer will be reset in %d seconds", reset_time);
But code like the following results in larger code:
char * timerWarningMessage;
...
sprintf (timerWarningMessage, reset_time);
•
The functions
vprintf()
and
vsprintf()
cannot be used, even if the format string
is a string literal.
If the Generate Printfs Inline check box is selected and these conditions are not met, the
compiler warns you that the code size cannot be reduced. In this case, the compiler gener-
ates correct code, and the execution is significantly faster than with normal
printf
calls.
However, there is a net increase in code size because the generated inline calls to lower
level functions require more space with no compensating savings from removing the top-
level functions.
In addition, an application that makes over 100 separate calls of
printf
or
sprintf
might result in larger code size with the Generate Printfs Inline check box selected
because of the cumulative effect of all the inline calls. The compiler cannot warn about
this situation. If in doubt, simply compile the application both ways and compare the
resulting code sizes.
The Generate Printfs Inline check box is selected by default.
Distinct Code Segment for Each Module
For most applications, the code segment for each module compiled by the eZ80Acclaim!
compiler is named CODE. Later, in the linker step of the build process, the linker gathers
all these small CODE segments into a single large CODE segment and then places that
segment in the appropriate address space, thus ensuring that all the executable code is kept
in a single contiguous block within a single address space. However, some users might
need a more complex configuration in which particular code modules are put in different
address spaces.
Such users can select the Distinct Code Segment for Each Module check box to accom-
plish this purpose. When this check box is selected, the code segment for every module
receives a distinct name; for example, the code segment generated for the
myModule.c
module is given the name
myModule_TEXT
. You can then add linker directives to the
linker command file to place selected modules in the appropriate address spaces. This
check box is deselected by default. Because you only need to select this check box if your