Source organisation


The supplied source structure holds the following directories:

--------------------------------------------------------
Directory     |Description                              
--------------------------------------------------------
stdh          |Contains the ANSI header files (which    
              |should require no change in              
              |retargetting). These files are also built
              |into armcc.                              
--------------------------------------------------------
util          |Contains the source of the makemake      
              |utility written in classic C.            
--------------------------------------------------------
semi          |Contains targetting code for the         
              |semi-hosted C Library which targets the  
              |debug monitor supported by:the           
              |ARMulator;ARM  Platform Independent      
              |Evaluation (PIE) card for the ARM60;     
              |together with SunOS-hosted make          
              |definitions and library build            
              |options.(The library is called           
              |semi-hosted because many functions such  
              |as file I/O are implemented on the host  
              |computer via the host's C library).In    
              |principle, a targetting of the library   
              |requires both a target directory and a   
              |host directory; however, where there is  
              |only one hosting, it is convenient to    
              |amalgamate the two directories.          
--------------------------------------------------------
riscos        |Contains targetting code for Acorn's RISC
              |OS operating system for its ARM-based    
              |Archimedes computers, together with      
              |SunOS-hosted make information.           
--------------------------------------------------------
fpe340        |Contains object code of the Floating     
              |Point Emulator (for which source code is 
              |not provided).and at the top level:      
--------------------------------------------------------
*.c, *.h, *.s |Contain target-independent source code.  
--------------------------------------------------------

The target-independent code is mostly grouped into one file per section of the ANSI library (though with exceptions: stdlib is implemented partly in alloc.c and partly in stdlib.c), with use of conditional compilation or assembly to enable construction of a fine-grain library (approximately one object file per function). The ARMulator-targetted code is grouped similarly.

The first stage in constructing a makefile for a targetting of the library uses the utility program makemake. This allows description of library variants in a host-independent manner and permits building the library on a host which severely limits the number of files in a directory.

The makemake utility takes as input the files makedefs from the host directory and sources and options from the target directory (see below for a description of their content), and produces as output a makefile called Makefile in the host directory (often, the host directory and the target directory will be the same).

The arguments to makemake are the name of the host directory and, if distinct, the name of the target directory.

In order to retarget the library, at least the following files must be provided:

makedefs (in the host directory)

Host-dependent definitions of tools, paths, options etc. to include in the constructed Makefile for the library. Use the file makedefs from the semi directory as a template.

options (in the target directory)

Library variant selection (a number of lines, each of the form option_name = value). See Variant selection. Use the file options from the semi directory as a template.

sources (in the target directory)

List of objects to include in the target library, and sources from which they are to be constructed. Each line (other than those controlling variant selection) has one of the forms:

Where object_name lacks the .o extension. Variant selection involves lines of the form:

with the obvious significance. Expression primaries are option_name = value and option_name != value, and expression operators are && and || (of equal precedence, note). Use the file sources from the semi subdirectory as a template, modifying it as needed.

hostsys.h (in the target directory)

Defines the functions which must be supplied for a full re-targetting of the library, and also defines certain target-dependent values required by target-independent code. Use the file hostsys.h from the semi subdirectory as a template, changing the values in it appropriately (see Retargetting the library and Details of target-dependent code).

config.h (in the target directory)

Contains the hardware description. The version of this file in the semi directory will suffice for a little-endian ARM with mixed-endian doubles; a big-endian ARM needs BYTESEX_ODD defined (and BYTESEX_EVEN not). Truly little-endian floating-point values are not supported by the floating-point emulator.

Of course, the files containing the target-specific implementation code are also provided in the target directory.