home *** CD-ROM | disk | FTP | other *** search
- Introduction to GNU C on the Acorn
-
-
- 0. Introduction
-
- This is a short introduction to the GNU C compiler, and assumes that
- you have GCC 2.7.2 and DRLink already installed on your computer.
- If you do not, details of where to get GCC are at the end of
- this article. It is not an introduction to C programming, for that you
- will have to get a text book on the language.
-
- GCC is a large program that requires approximately 3Mb of disc space, and a
- minimum of 3Mb of free RAM, though if you have a 2Mb machine it will run
- under !Virtual, but with a few problems (see the !ReadMe file in the
- distribution for details).
-
- The GCC distribution contains all that is needed for writing C programs,
- apart from a linker, but a PD linker called DRLink is freely available.
-
-
- 1. Simple compilations
-
- GCC follows the same conventions as Acorn C with C sources held in the
- 'c' directory, header files being held in the 'h' directory, and compiled
- object being held in the 'o' directory.
-
- For simple use, all that is needed is to start up a task window, ensure that
- there is 3Mb or so in the wimpslot and to type something like
-
- gcc hello.c
-
- This will compile, assemble and link the source 'hello.c' to produce an
- executable called '!RunImage', which can be run immediately.
-
- It is possible to compile several sources at one go, mixing C sources in
- the same program, using a command line of
-
- gcc file1.c file2.c file3.c file4.c
-
- Again, this will compile, assemble and link all the sources to produce the
- '!RunImage' executable.
-
- To compile to the object form, use the -c switch. i.e.
-
- gcc -c file.c
-
- will compile and assemble 'file.c' to 'file.o'.
-
- 2. Switches
-
- This is a list of the simpler, standard switches for GCC
-
- -c compile and assemble the source to the object file
- -S compile the source to assembler code
- -E preprocess the source file
- -o <file> put the resulting output into <file>
- -O apply some optimisations to the output
- -O2 apply full optimisation.
- -O3 full optimisation and inline small functions as well.
-
- There are some additional ARM specific switches.
-
- * -mapcs, -mapcs-frame
- target for ARM Procedure Call Standard stack frames.
- * -mpoke-function-name
- place the name of the current function before the start of the function
- to allow the post mortem debugger to print a readable backtrace.
- Using it's opposite will reduce code size by about 3.5%.
- * -mfpe
- prevents instruction scheduling of floating point instructions since it
- increases compile time and the benefits acheived make no difference through
- the FPE.
- * -mapcs-32
- target the APCS-32 bit standard. Condition flags are assumed to be corrupted
- by function calls in this mode.
- * -mapcs-stack-check
- provide explicit stack checking on entry to each function which allocates
- temporary variables on the stack.
- * -mapcs-strict
- make the compiler conform strictly to the APCS even in the cases where
- stack frames do not need to be set up.
- * -msoft-float
- cause the compile to assume all floating point instructions are missing
- (and there is no emulator either), therefore generating function calls
- instead.
- * -mhard-float
- the opposite of -msoft-float
- * -mshort-load-bytes, -mno-short-load-words
- if the MMU traps unaligned word accesses, shorts must be loaded
- byte-at-a-time so this flag should be set.
-
- RISC OS specific options
-
- * -munique-areas
- generate each function in its own individual code area giving the linker
- extra chance to remove unused functions from the resulting binary.
- * -mthrowback
- send errors to a text editor capable of receiving 'throwbacks'.
- * -mstubs
- compiles to target SharedCLibrary and tells the linker to link with
- stubs instead of UnixLib.
- * -munixlib
- tell the linker to target UnixLib instead of the SharedCLibrary
- * -mdepend
- Generate the file !Depend which contains a list of all the source
- files that the produced object depend on. This is intended for use
- with amu, which edit the makefile to include these after the
- '# Dynamic Dependencies' line.
-
-
- 3. Obtaining GCC
-
- GCC can be obtained from various FTP sites. Prime sites for latest uploads
- are:
- Demon Internet Services: ftp://ftp.demon.co.uk/pub/archimedes/
- Hensa/micros: ftp://micros.hensa.ac.uk/micros/arch/riscos/
-
- Please note that the ARM backend used to create this RISC OS port is
- unavailable to the general public. As well as changing the backend in a
- significant way, bugs and patches have been applied to the GCC system
- independent sources making it a more involved process for porting. However,
- anybody who is interested in the ARM/RISC OS backend for alternate compiler
- ports using GCC can request it from me.
-
- Main GCC sources can be obtained from the sites described below. Compiler
- sources are approximately 7.5Mb compressed, 27Mb uncompressed.
-
- DRLink can be obtained from Arcade BBS (0181) 654 2212, 8N1 or
- I believe it is on Hensa/micros.
-
- 4. Contacting me
-
- I can generally be contacted at <n.a.burrett@mcs.salford.ac.uk> during
- University term times and at <nickb@digibank.demon.co.uk> outside
- term times.
-
- However, if neither of those addresses seem to get a reply, then I can
- be contacted through Simon Callan at <gcc@callan.demon.co.uk>.
-
-
- [ Most GNU software is packed using the GNU `gzip' compression program.
- Source code is available on most sites distributing GNU software.
-
- For information on how to order GNU software on tape, floppy or cd-rom, or
- printed GNU manuals, check the file etc/ORDERS in the GNU Emacs
- distribution, ftp the file /pub/gnu/GNUinfo/ORDERS on prep, or
- e-mail a request to: gnu@prep.ai.mit.edu
-
- By ordering your GNU software from the FSF, you help us continue to
- develop more free software. Media revenues are our primary source of
- support. Donations to FSF are deductible on US tax returns.
-
- The above software will soon be at these ftp sites as well.
- Please try them before prep.ai.mit.edu as prep is very busy!
-
- thanx -gnu@prep.ai.mit.edu
-
- ASIA: ftp.cs.titech.ac.jp, utsun.s.u-tokyo.ac.jp:/ftpsync/prep,
- cair-archive.kaist.ac.kr:/pub/gnu, ftp.nectec.or.th:/pub/mirrors/gnu
- AUSTRALIA: archie.au:/gnu (archie.oz or archie.oz.au for ACSnet)
- AFRICA: ftp.sun.ac.za:/pub/gnu
- MIDDLE-EAST: ftp.technion.ac.il:/pub/unsupported/gnu
- EUROPE: irisa.irisa.fr:/pub/gnu, ftp.univ-lyon1.fr:pub/gnu,
- ftp.mcc.ac.uk, unix.hensa.ac.uk:/mirrors/uunet/systems/gnu,
- src.doc.ic.ac.uk:/gnu, ftp.ieunet.ie:pub/gnu, ftp.eunet.ch,
- nic.switch.ch:/mirror/gnu, ftp.informatik.rwth-aachen.de:/pub/gnu,
- ftp.informatik.tu-muenchen.de, ftp.win.tue.nl:/pub/gnu, ftp.nl.net,
- ftp.etsimo.uniovi.es:/pub/gnu ftp.funet.fi:/pub/gnu, ftp.denet.dk,
- ftp.stacken.kth.se, isy.liu.se, ftp.luth.se:/pub/unix/gnu,
- ftp.sunet.se:/pub/gnu, archive.eu.net
- SOUTH AMERICA: ftp.inf.utfsm.cl:/pub/gnu, ftp.unicamp.br:/pub/gnu
- WESTERN CANADA: ftp.cs.ubc.ca:/mirror2/gnu
- USA: wuarchive.wustl.edu:/systems/gnu, labrea.stanford.edu,
- ftp.digex.net:/pub/gnu, ftp.kpc.com:/pub/mirror/gnu,
- f.ms.uky.edu:/pub3/gnu,
- jaguar.utah.edu:/gnustuff, ftp.hawaii.edu:/mirrors/gnu,
- uiarchive.cso.uiuc.edu:/pub/gnu, ftp.cs.columbia.edu:/archives/gnu/prep,
- col.hp.com:/mirrors/gnu, gatekeeper.dec.com:/pub/GNU,
- ftp.uu.net:/systems/gnu
-
- ]
-