beautypg.com

Ansi standard compliance, Freestanding implementation – Zilog Z8F0130 User Manual

Page 279

background image

UM013037-1212

ANSI Standard Compliance

Zilog Developer Studio II – Z8 Encore!

User Manual

255

are required to make a complete executable load file. In this case, those other modules are
the C start-up modules for the large model (

startupl.obj

), the code generator helper

library (

chelpd.lib

), the C run-time library for the large dynamic model with debug

(

crtldd.lib

), the floating-point library (

fpldd.lib

), and the C Serial IO library for

that same configuration (

csioldd.lib

).

An important point to understand in using the linker is that the linker intelligently links in
only those object modules that are necessary to resolve its list of unresolved symbols.
Also, the Zilog version of the C Standard Library is organized so that each module con-
tains only a single function or, in a few cases, a few closely related functions. So, although
the C run-time library contains a very large number of functions from the C Standard
Library, if your application only calls two of those functions, then only those two are
linked into your application (plus any functions that are called by those two functions in
turn). This means it is safe for you to simply link in a large library, such as

crtldd.lib

and

fpldd.lib

in this example. No unnecessary code is linked in, and you avoid the

extra work of painstakingly finding the unresolved symbols and linking only to those spe-
cific functions.

ANSI Standard Compliance

The Zilog Z8 Encore! C-Compiler is a freestanding ANSI C compiler (see the

Freestand-

ing Implementation

section on page 255), complying with the 1989 ISO standard, which is

also known as ANSI Standard X3.159-1989 with some deviations, which are described in
the

Deviations from ANSI C

section on page 256.

Freestanding Implementation

A freestanding implementation of the C language is a concept defined in the ANSI stan-
dard itself, to accommodate the needs of embedded applications that cannot be expected to
provide all of the services of the typical desktop execution environment (which is called a
hosted environment in the terms of the standard). In particular, it is presumed that there are
no file system and no operating system. The use of the standard term freestanding imple-
mentation
means that the compiler must contain, at least, a specific subset of the full ANSI
C features. This subset consists of those basic language features appropriate to embedded
applications. Specifically, the list of required header files and associated library functions
is minimal, namely <

float.h

>, <

limits.h

>, <

stdarg.h

>, and <

stddef.h

>. A free-

standing implementation is allowed to additionally support all or parts of other standard
header files but is not required to. The Z8 Encore! C-Compiler, for example, supports a
number of additional headers from the standard library, as specified in the

Library Files

Not Required for Freestanding Implementation

section on page 258.

A conforming implementation (that is, a compiler) is allowed to provide extensions, as
long as they do not alter the behavior of any program that uses only the standard features
of the language. The Zilog Z8 Encore! C-Compiler uses this concept to provide language