
123
Chapter 2 Applications Programming
then the trapware can make use of the coprocessor to achieve faster instruction
emulation. This is generally five times faster than software based emulation. Keep-
ing the presence of the Am29027 coprocessor hidden in operating system support
trapware, enables application programs to be easily moved between systems with
and without a coprocessor.
However, an additional (about two times) speed–up can be achieved by applica-
tion programs talking to the Am29027 coprocessor directly, rather than via trapware.
When the High C 29K compiler is used with the “–29027” or “–f027” switches, inline
code is produced for floating–point operations which directly access the coprocessor.
Unfortunately the compiled code can not be run on a system which has no coproces-
sor. The ANSI standard C support libraries also support inline Am29027 coprocessor
access with the libs*7.lib library. When instructed to produce direct coprocessor ac-
cess code, the compiler also instructs the linker to use this library in place of the stan-
dard library, libs*0.lib.
The Am29050 processor supports integer multiply directly in hardware rather
than via trapware. It also supports integer divide via converting operands to floating–
point before dividing and converting back to integer. The High C 29K compiler per-
forms integer multiply and divide by using transparent helper routines (see section
3.7); this is faster than the trapware method used by the GNU compiler. When the
High C 29K compiler is used with the “–29050” switch, and the GNU compiler with
the “–m29050” switch, code optimized for the use for an Am29050 processor is
used. This code may not run on other 29K family members, as the Am29050 proces-
sor has some additional instructions (see sections 3.1.6 and 3.1.7).
2.5
C LANGUAGE INTERRUPT HANDLERS
Embedded application code developers typically have to deal with interrupts
from peripheral devices requiring attention. As with general code development there
is a desire to deal with interrupts using C language code rather than assembly lan-
guage code. Compared to CISC type processors, which generally do not have a regis-
ter stack, this is a little more difficult to achieve with the 29K family. In addition, 29K
processors do not have microcode to automatically save their interrupted context.
The interrupt architecture of a 29K processor is very flexible and is dealt with in de-
tail in Chapter 4. This section presents two useful techniques enabling C language
code to be used for interrupts supported by a HIF conforming operating system.
The characteristics of the C handler function are important in determining the
steps which must be taken before the handler can execute. It is desirable that the C
handler run in Freeze mode because this will reduce the overhead costs. These costs
are incurred because interrupts may occur at times when the processor is operating in
a condition not suitable for immediately commencing interrupt processing. Most of
these overheads are concerned with register stack support and are described in detail
in section 4.4. This section deals with establishing an interrupt handler which can run