home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / c / gnu_c / docs / intro < prev   
Encoding:
Text File  |  1996-03-15  |  7.2 KB  |  182 lines

  1.                 Introduction to GNU C on the Acorn
  2.  
  3.  
  4. 0.      Introduction
  5.  
  6. This is a short introduction to the GNU C compiler, and assumes that
  7. you have GCC 2.7.2 and DRLink already installed on your computer.
  8. If you do not, details of where to get GCC are at the end of
  9. this article. It is not an introduction to C programming, for that you
  10. will have to get a text book on the language.
  11.  
  12. GCC is a large program that requires approximately 3Mb of disc space, and a
  13. minimum of 3Mb of free RAM, though if you have a 2Mb machine it will run
  14. under !Virtual, but with a few problems (see the !ReadMe file in the
  15. distribution for details).
  16.  
  17. The GCC distribution contains all that is needed for writing C programs,
  18. apart from a linker, but a PD linker called DRLink is freely available.
  19.  
  20.  
  21. 1.      Simple compilations
  22.  
  23. GCC follows the same conventions as Acorn C with C sources held in the
  24. 'c' directory, header files being held in the 'h' directory, and compiled
  25. object being held in the 'o' directory.
  26.  
  27. For simple use, all that is needed is to start up a task window, ensure that
  28. there is 3Mb or so in the wimpslot and to type something like
  29.  
  30.         gcc hello.c
  31.  
  32. This will compile, assemble and link the source 'hello.c' to produce an
  33. executable called '!RunImage', which can be run immediately.
  34.  
  35. It is possible to compile several sources at one go, mixing C sources in
  36. the same program, using a command line of
  37.  
  38.         gcc file1.c file2.c file3.c file4.c
  39.  
  40. Again, this will compile, assemble and link all the sources to produce the
  41. '!RunImage' executable.
  42.  
  43. To compile to the object form, use the -c switch. i.e.
  44.  
  45.         gcc -c file.c
  46.  
  47. will compile and assemble 'file.c' to 'file.o'.
  48.  
  49. 2.      Switches
  50.  
  51. This is a list of the simpler, standard switches for GCC
  52.  
  53. -c              compile and assemble the source to the object file
  54. -S              compile the source to assembler code
  55. -E              preprocess the source file
  56. -o <file>       put the resulting output into <file>
  57. -O              apply some optimisations to the output
  58. -O2             apply full optimisation.
  59. -O3        full optimisation and inline small functions as well.
  60.  
  61. There are some additional ARM specific switches.
  62.  
  63.   * -mapcs, -mapcs-frame
  64.    target for ARM Procedure Call Standard stack frames.
  65.   * -mpoke-function-name
  66.    place the name of the current function before the start of the function
  67.    to allow the post mortem debugger to print a readable backtrace.
  68.    Using it's opposite will reduce code size by about 3.5%.
  69.   * -mfpe
  70.    prevents instruction scheduling of floating point instructions since it
  71.    increases compile time and the benefits acheived make no difference through
  72.    the FPE.
  73.   * -mapcs-32
  74.    target the APCS-32 bit standard. Condition flags are assumed to be corrupted
  75.    by function calls in this mode.
  76.   * -mapcs-stack-check
  77.    provide explicit stack checking on entry to each function which allocates
  78.    temporary variables on the stack.
  79.   * -mapcs-strict
  80.    make the compiler conform strictly to the APCS even in the cases where
  81.    stack frames do not need to be set up.
  82.   * -msoft-float
  83.    cause the compile to assume all floating point instructions are missing
  84.    (and there is no emulator either), therefore generating function calls
  85.    instead.
  86.   * -mhard-float
  87.    the opposite of -msoft-float
  88.   * -mshort-load-bytes, -mno-short-load-words
  89.    if the MMU traps unaligned word accesses, shorts must be loaded
  90.    byte-at-a-time so this flag should be set.
  91.  
  92.   RISC OS specific options
  93.  
  94.   * -munique-areas
  95.    generate each function in its own individual code area giving the linker
  96.    extra chance to remove unused functions from the resulting binary.
  97.   * -mthrowback
  98.    send errors to a text editor capable of receiving 'throwbacks'.
  99.   * -mstubs
  100.    compiles to target SharedCLibrary and tells the linker to link with
  101.    stubs instead of UnixLib.
  102.   * -munixlib
  103.    tell the linker to target UnixLib instead of the SharedCLibrary
  104.   * -mdepend
  105.    Generate the file !Depend which contains a list of all the source
  106.    files that the produced object depend on. This is intended for use
  107.    with amu, which edit the makefile to include these after the
  108.    '# Dynamic Dependencies' line.
  109.  
  110.  
  111. 3.      Obtaining GCC
  112.  
  113. GCC can be obtained from various FTP sites. Prime sites for latest uploads
  114. are:
  115.    Demon Internet Services: ftp://ftp.demon.co.uk/pub/archimedes/
  116.    Hensa/micros: ftp://micros.hensa.ac.uk/micros/arch/riscos/
  117.  
  118. Please note that the ARM backend used to create this RISC OS port is
  119. unavailable to the general public. As well as changing the backend in a
  120. significant way, bugs and patches have been applied to the GCC system
  121. independent sources making it a more involved process for porting. However,
  122. anybody who is interested in the ARM/RISC OS backend for alternate compiler
  123. ports using GCC can request it from me.
  124.  
  125. Main GCC sources can be obtained from the sites described below. Compiler
  126. sources are approximately 7.5Mb compressed, 27Mb uncompressed.
  127.  
  128. DRLink can be obtained from Arcade BBS (0181) 654 2212, 8N1 or
  129. I believe it is on Hensa/micros.
  130.  
  131. 4.    Contacting me
  132.  
  133. I can generally be contacted at <n.a.burrett@mcs.salford.ac.uk> during
  134. University term times and at <nickb@digibank.demon.co.uk> outside
  135. term times.
  136.  
  137. However, if neither of those addresses seem to get a reply, then I can
  138. be contacted through Simon Callan at <gcc@callan.demon.co.uk>.
  139.  
  140.  
  141. [ Most GNU software is packed using the GNU `gzip' compression program.
  142.   Source code is available on most sites distributing GNU software.
  143.  
  144.   For information on how to order GNU software on tape, floppy or cd-rom, or
  145.   printed GNU manuals, check the file etc/ORDERS in the GNU Emacs
  146.   distribution, ftp the file /pub/gnu/GNUinfo/ORDERS on prep, or
  147.   e-mail a request to: gnu@prep.ai.mit.edu 
  148.  
  149.   By ordering your GNU software from the FSF, you help us continue to
  150.   develop more free software.  Media revenues are our primary source of
  151.   support.  Donations to FSF are deductible on US tax returns.
  152.  
  153.   The above software will soon be at these ftp sites as well.
  154.   Please try them before prep.ai.mit.edu as prep is very busy!
  155.  
  156.   thanx -gnu@prep.ai.mit.edu
  157.  
  158.         ASIA: ftp.cs.titech.ac.jp, utsun.s.u-tokyo.ac.jp:/ftpsync/prep,
  159.   cair-archive.kaist.ac.kr:/pub/gnu, ftp.nectec.or.th:/pub/mirrors/gnu
  160.         AUSTRALIA: archie.au:/gnu (archie.oz or archie.oz.au for ACSnet)
  161.         AFRICA: ftp.sun.ac.za:/pub/gnu
  162.         MIDDLE-EAST: ftp.technion.ac.il:/pub/unsupported/gnu
  163.         EUROPE: irisa.irisa.fr:/pub/gnu, ftp.univ-lyon1.fr:pub/gnu,
  164.   ftp.mcc.ac.uk, unix.hensa.ac.uk:/mirrors/uunet/systems/gnu,
  165.   src.doc.ic.ac.uk:/gnu, ftp.ieunet.ie:pub/gnu, ftp.eunet.ch,
  166.   nic.switch.ch:/mirror/gnu, ftp.informatik.rwth-aachen.de:/pub/gnu,
  167.   ftp.informatik.tu-muenchen.de, ftp.win.tue.nl:/pub/gnu, ftp.nl.net,
  168.   ftp.etsimo.uniovi.es:/pub/gnu ftp.funet.fi:/pub/gnu, ftp.denet.dk,
  169.   ftp.stacken.kth.se, isy.liu.se, ftp.luth.se:/pub/unix/gnu,
  170.   ftp.sunet.se:/pub/gnu, archive.eu.net
  171.         SOUTH AMERICA: ftp.inf.utfsm.cl:/pub/gnu, ftp.unicamp.br:/pub/gnu
  172.         WESTERN CANADA: ftp.cs.ubc.ca:/mirror2/gnu
  173.         USA: wuarchive.wustl.edu:/systems/gnu, labrea.stanford.edu,
  174.   ftp.digex.net:/pub/gnu, ftp.kpc.com:/pub/mirror/gnu,
  175.   f.ms.uky.edu:/pub3/gnu,
  176.   jaguar.utah.edu:/gnustuff, ftp.hawaii.edu:/mirrors/gnu,
  177.   uiarchive.cso.uiuc.edu:/pub/gnu, ftp.cs.columbia.edu:/archives/gnu/prep,
  178.   col.hp.com:/mirrors/gnu, gatekeeper.dec.com:/pub/GNU,
  179.   ftp.uu.net:/systems/gnu
  180.  
  181. ]
  182.