beautypg.com

Zilog ZUSBOPTS User Manual

Page 86

background image

Menu Bar

UM017105-0511

58

Zilog Developer Studio II – ZNEO™
User Manual

small fraction of applications benefit from deselecting the

Use Register Variables

check-

box.

The

Use Register Variables

checkbox interacts with the

Limit Optimizations for Easier

Debugging

checkbox on the C page (see the

Limit Optimizations for Easier Debugging

section on page 52). When the

Limit Optimizations for Easier Debugging

checkbox is

selected, register variables are not used because they can cause confusion when debug-
ging. The

Use Register Variables

checkbox is disabled (grayed out) when the

Limit

Optimizations for Easier Debugging

checkbox is selected. If the

Limit Optimizations

for Easier Debugging

checkbox is later deselected (even in a later ZDS II session), the

Use Register Variables

checkbox returns to the setting it had before the

Limit Optimiza-

tions for Easier Debugging

checkbox was selected.


Using register variables can complicate debugging in at least two ways. One way is that
register variables are more likely to be optimized away by the compiler. If variables you
want to observe while debugging are being optimized away, you can usually prevent this
by any of the following actions:

Select the

Limit Optimizations for Easier Debugging

checkbox (see

Limit Optimi-

zations for Easier Debugging

on page 52)

Deselect the

Use Register Variables

checkbox

Rewrite your code so that the variables in question become global rather than local

The other way in which register variables can lead to confusing behavior when debugging
is when the same register is used to store different variables or temporary results at differ-
ent times in the execution of your code. Because the debugger is not always aware of these
multiple uses, sometimes a value for a register variable might be shown in the Watch win-
dow that is not actually related to that variable at all.

Generate Printfs Inline.

Normally, a call to

printf()

or

sprintf()

parses the format

string at run time to generate the required output. When the

Generate Printfs Inline

checkbox is selected, the format string is parsed at compile time, and direct inline calls to
the lower level helper functions are generated. This results in significantly smaller overall
code size because the top-level routines to parse a format string are not linked into the
project, and only those lower level routines that are actually used are linked in, rather than
every routine that could be used by a call to

printf

. The code size of each routine that

calls

printf()

or

sprintf()

is slightly larger than if the

Generate Printfs Inline

checkbox is deselected, but this is more than offset by the significant reduction in the size
of library functions that are linked to your application.

To reduce overall code size by selecting this checkbox, the following conditions are neces-
sary:

Notes:

This manual is related to the following products: