221/317
8 - C Language and the C Compiler
8 C LANGUAGE AND THE C COMPILER
The C language has been introduced in the chapter “P rogramming a Microcontroller”. The
present chapter relates specifically to the HICROSS C Compiler for the ST7.
The software tools introduced in the previous chapters are supplied by STMicroelectronics.
They allow you to write and debug an application in assembler. Except for the emulator and
the EPROM programmer, that are pieces of hardware and that must be purchased from STMi-
croelectronics, the set of software tools is freely distributed. Anyone is free to write a program
using these tools.
The HICROSS development tools, that include all the software tools from the C Compiler to
the linker and the debugger (but not the emulator), must be purchased separately, either
through STMicroelectronics or directly at their manufacturer's, HIWARE AG, Basel, Switzer-
land.
The HICROSS development chain is compatible with the STMicroelectronics emulator for the
ST7, but the file formats between the C Compiler, the Assembler, the Linker and the software
accessories (librarian, decoder, simulator, EPROM burner) are not compatible with those of
the STMicroelectronics Software Tools. Thus, if a project has part of it written in C, the parts
that are written in assembler must be written in the HICROSS dialect and assembled using the
HICROSS assembler. It is not possible to reuse source files or object files from the STMicro-
electronics Software Tools in a project using the HICROSS development chain.
8.1 C LANGUAGE EXTENSIONS FOR MICROCONTROLLERS
The C language, formerly designed for mainframes, has been extended for the use in the mi-
crocontroller environment. These extensions come from two sources:
The ANSI standard for C language, that recognizes the properties of ROM, RAM and Input-
Output indirectly though the
const
and
volatile
data type modifiers, for example.
Special implementations
by
manufacturers, to handle
specific
features
for each
microcontroller. An example is the addition of
far
and
near
modifiers for pointers and
#pragma
pseudo-statements for declaring interrupt service routines.
The first type of extensions are standardized. This means that they are uniform from one com-
piler to another. The second type, on the contrary, is specific to a compiler, and can be very
different for each one. This leads to extra work if the development chain product must be
changed while a project is under development.
Several compilers exist on the market for the ST7. They have different features that vary in
terms of completeness or power. In some cases, the lack of a specific feature is sufficient to
reject one compler in favour of another. Y ou may have to compare the features of several