
95
Chapter 2 Applications Programming
Data held in global registers, unlike procedure activation records, do not survive
procedure calls. The compiler has 25 global registers available for holding temporary
variables. These registers perform a role very similar to the eight–data and eight–ad-
dress general purpose registers of the MC68020. The first 16 of the global registers,
gr96–gr111,
are used for procedure return value passing. Return objects larger than
16 words must use the memory stack to return data (see section 3.3).
An extension to some C compilers has been made (High C
29K
compiler for
one), enabling a calling procedure to assume that some global registers will survive a
procedure call. If the called function is defined before calls are made to it, the compil-
er can determine its register usage. This enables the global register usage of the call-
ing function to be restricted to available registers, and the calling function need only
save in local registers those global registers it knows are used by the by the callee.
2.1.5 Memory Stack
Because the register cache is limited in size, a separate memory stack is used to
hold large local variables (structs or arrays), as well as any incoming parameters be-
yond the 16th parameter. (Note, small structs can still be passed in local registers as
procedure parameters). Register
msp
is the memory stack pointer. (Note, having two
stacks generally requires several operating system support mechanisms not required
by a single stack CISC based system.)
2.2
RUN–TIME HIF ENVIRONMENT
Application programs need to interact with peripheral devices which support
communication and other control functions. Traditionally embedded program devel-
opers have not been well served by the tools available to tackle the related software
development. For example, performing the popular C library service
printf()
, using
a peripheral UART device, may involve developing the
printf()
library code and
then underlying operating system code which controls the communications UART.
One solution to the problem is to purchase a real–time operating system. They are
normally supplied with libraries which support
printf()
and other popular library ser-
vices. In addition, operating systems contain code to perform task context switching
and interrupt handling.
Typically, operating system vendors have their own operating system interface
specification. This means that library code, like
printf()
, which ultimately makes op-
erating system service requests, is not easily ported between different operating sys-
tems. In addition, compiler vendors which typically develop library code for the tar-
get processor for sale along with the compiler, can not be assured of a standard inter-
face to the available operating system services.
AMD wished to relieve this problem and allow library code to be used on any
target 29K platform. In addition AMD wished to ensure a number of services would