ST20–SWC
7/21
2.3.2 Access to the instruction set
ANSI C is a good language for writing embedded applications, since it combines the constructs of
a highlevelprogramming languagewith low level access tothe hardwarethrough assembler inserts.
Tomake the access tosomeof the ST20 instructions even more effective,a number ofspecial library
functions have beendefined which the optimizing compiler canrender as in-linecode. This removes
the overhead of a library call, but it also gives the optimizer more information on what the program
is doing.
Normally, when the optimizer sees a function containing some assembler code, it must make very
conservative assumptions about theeffect the codehas on its surroundings, e.g. on static variables
and parameters. By using the functions defined to access the instructions, the optimizer knows
exactly whatthe effectswill be and can makethe correct assumptions forthe side-effectsof thecode.
The ST20 instructions that can be accessed in this way include block moves, channel input and
output, bit manipulation, CRC computations, semaphores and some scheduling operations.
2.3.3 Run-time overhead reduction
In order to support the full ANSI C language, a significant run-time library is necessary.The toolset
is suppliedwith another library,known as the
reduced library
,which doesnot support file system and
environment requests, which depend on a host.
If some of the other features in ANSI C are not used, thenit may be possible to reducethe overhead
further by modifying the run-time initialization, the source of which is provided.
2.3.4 Assembler inserts
Within the SGS-THOMSON implementation ofthe ANSI C language, assemblercode can be written
at any point to achieve direct access to ST20 instructions for reasons of speed and code size. Full
access is available to the ST20 instruction set and C program variables.
2.3.5 Assembler
If there is no other way to obtain the code required, for example when writing customized bootstrap
mechanisms, then thetoolset contains an assembler as thefinal phase of the compiler.This can be
invoked to assemble user-written code.
2.3.6 Dynamic loading of processes
The toolset can encapsulate the code and data of a process in a file called a
relocatable separately-
compiled unit
or rsc. This form is suitable for it to be loaded byanother application andcalled. A set
of functions is provided for this to be achieved. The rsc can be found either in a file, or already in
memory,or is inputalong achannel. The memory variant allows anrsc to be placed into ROMand
executed if required. For example, if an application wishes to select a device driver to be placed in
on-chip memory,then a number of possible drivers can be placed in ROM and the application can
choose one for the occasion, copy it into low memory and execute it.
2.3.7 Bootstraps
The source code of the standard bootstraps are provided. The user can then write bootstraps that
are tailored to a specific application by using the standard ones as templates.
2.3.8 Memory configuration
An interactive memory configurer tool is supplied for describing a ST20450 memory configuration.
The memory interface of the ST20450 is configurable and must be initialized before the memory can
be accessed. This data is used by the Toolset tools to generate the code to initialize the memory