* .version, sdcc.spec, doc/sdccman.lyx, doc/INSTALL.txt:
[fw/sdcc] / doc / sdccman.lyx
index b1fda93241659cfbef99da6e732c5df89a86be72..c5c99e6c7d59a6b16856b734e1773e67432c496a 100644 (file)
@@ -55,6 +55,7 @@
 \tracking_changes false
 \output_changes false
 \author "" 
+\author "" 
 \end_header
 
 \begin_body
@@ -93,7 +94,7 @@ Architecture specific stuff (like memory models, code examples) should maybe
 \end_layout
 
 \begin_layout Standard
-into seperate sections/chapters/appendices (it is hard to document PIC or
+into separate sections/chapters/appendices (it is hard to document PIC or
  Z80 in 
 \end_layout
 
@@ -113,13 +114,13 @@ SDCC Compiler User Guide
 \begin_layout Date
 
 \size normal
-SDCC 2.8.5
+SDCC 2.9.0
 \size footnotesize
 
 \newline
-$Date: 2008-11-16#
+$Date::            
 \newline
-$Revision: 5272$
+$Revision$
 \end_layout
 
 \begin_layout Standard
@@ -4244,7 +4245,7 @@ Unpack the file using a command like:
  
 \family sans
 \series bold
-"tar -xvzf sdcc-src-yyyymmdd-rrrr.tar.bz2
+"tar -xvjf sdcc-src-yyyymmdd-rrrr.tar.bz2
 \begin_inset Quotes srd
 \end_inset
 
@@ -4983,13 +4984,28 @@ cd ~\InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
 # cd $HOME
 \end_layout
 
 \begin_layout Standard
 
 \family typewriter
-tar -xzf sdcc.src.tar.gz\InsetSpace ~
+tar -xjf sdcc-src-yyyymmdd-rrrr.tar.bz2\InsetSpace ~
 # extract source to directory sdcc
 \end_layout
 
@@ -5005,6 +5021,21 @@ mkdir sdcc.build\InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
 # put output in sdcc.build
 \end_layout
 
@@ -5025,6 +5056,21 @@ cd sdcc.build
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
 # configure is doing all the magic!
 \end_layout
 
@@ -7073,14 +7119,92 @@ name "-\\/-debug"
  file as well.
  The library files created with sdcclib are plain text files, so they can
  be viewed with a text editor.
- It is not recomended to modify a library file created with sdcclib using
- a text editor, as there are file indexes numbers located accross the file
+ It is not recommended to modify a library file created with sdcclib using
+ a text editor, as there are file indexes numbers located across the file
  used by the linker to quickly locate the required module to link.
  Once a .rel file (as well as a .adb file) is added to a library using sdcclib,
  it can be safely deleted, since all the information required for linking
  is embedded in the library file itself.
  Library files created using sdcclib are used as described in the preceding
  sections.
+\end_layout
+
+\begin_layout Subsection
+Using ar to Create and Manage Libraries
+\begin_inset LatexCommand index
+name "ar"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Support for ar format libraries was introduced in sdcc 2.9.0.
+ Ar is a standard archive managing utility on unices (Linux, Mac OS X, several
+ unix flavors) so it is not included in the sdcc package.
+\series bold
+
+\newline
+
+\newline
+
+\series default
+For Windows platform you can find ar utility in GNU binutils package included
+ in several projects: Cygwin at 
+\begin_inset LatexCommand url
+target "http://www.cygwin.com/"
+
+\end_inset
+
+, MinGW at 
+\begin_inset LatexCommand url
+target "http://www.mingw.org/"
+
+\end_inset
+
+.
+\series bold
+
+\newline
+
+\newline
+
+\series default
+Both the GNU and BSD ar format variants are suppurated by asxxxx linkers.
+ Ar doesn't understand the asxxxx object file format, so there is a special
+ version of ranlib distributed with sdcc, called asranlib, which produces
+ the ar symbol lookup table.
+\series bold
+
+\newline
+
+\newline
+
+\series default
+To create a library containing asxxxx object files, you should use the following
+ sequence:
+\series bold
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+ar -Sq <library name>.lib <list of .rel files>
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+asranlib <library name>.lib
+\end_layout
+
+\begin_layout Standard
 \begin_inset VSpace bigskip
 \end_inset
 
@@ -7688,16 +7812,16 @@ name "sdcpp (preprocessor)"
 \end_inset
 
 .
- SDCC uses an adapted version of the preprocessor 
-\emph on
-cpp
-\emph default
- of the GNU Compiler Collection
+ SDCC uses an adapted version of the GNU Compiler Collection
 \begin_inset LatexCommand index
 name "gcc (GNU Compiler Collection)"
 
 \end_inset
 
+ preprocessor 
+\emph on
+cpp
+\emph default
  (
 \emph on
 gcc
@@ -7708,11 +7832,11 @@ target "http://gcc.gnu.org/"
 
 \end_inset
 
-), if you need more dedicated options please refer to the GCC\InsetSpace ~
-4.1.1\InsetSpace ~
+).
+ If you need more dedicated options please refer to the GCC\InsetSpace ~
 CPP\InsetSpace ~
-Manual
- at 
+Manual at
 \begin_inset LatexCommand htmlurl
 target "http://www.gnu.org/software/gcc/onlinedocs/"
 
@@ -7774,7 +7898,7 @@ name "-\\/-lib-path <path>"
 
 
 \begin_inset LatexCommand index
-name "-L -\\/-lib-path"
+name "-L <path>"
 
 \end_inset
 
@@ -10058,6 +10182,41 @@ name "Options other"
 \begin_layout List
 \labelwidthstring 00.00.0000
 
+\series bold
+-v\InsetSpace ~
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-version
+\begin_inset LatexCommand index
+name "-\\/-version"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "-v"
+
+\end_inset
+
+
+\series default
+ displays the sdcc version.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
 \series bold
 -c\InsetSpace ~
 -
@@ -10081,7 +10240,7 @@ name "-\\/-compile-only"
 
 
 \begin_inset LatexCommand index
-name "-c -\\/-compile-only"
+name "-c"
 
 \end_inset
 
@@ -14700,7 +14859,7 @@ name "Storage class"
 
 \end_inset
 
- is specified for a local variable, it will NOT be overlayed.
+ is specified for a local variable, it will NOT be overlaid.
 \end_layout
 
 \begin_layout Standard
@@ -14751,7 +14910,7 @@ name "Division"
 
 \end_inset
 
- will NOT be overlayed since these are implemented using external functions,
+ will NOT be overlaid since these are implemented using external functions,
  e.g.:
 \end_layout
 
@@ -14832,7 +14991,7 @@ nooverlay was
  from an interrupt service routine.
  The #pragma\InsetSpace ~
 nooverlay ensures that the parameters and local variables for
- the function are NOT overlayed.
+ the function are NOT overlaid.
 \begin_inset VSpace bigskip
 \end_inset
 
@@ -15977,7 +16136,7 @@ EA = EA_SAVE;
 \end_layout
 
 \begin_layout Standard
-On other architectures which have seperate opcodes for enabling and disabling
+On other architectures which have separate opcodes for enabling and disabling
  interrupts you might want to make use of defines with inline assembly
 \begin_inset LatexCommand index
 name "Assembler routines"
@@ -17439,7 +17598,7 @@ target "http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/lib/mcs51/
 
  crtstart.asm
 \emph default
- and when linking your project explicitely specify 
+ and when linking your project explicitly specify 
 \emph on
 crtstart.rel
 \emph default
@@ -20999,8 +21158,26 @@ name "printf()"
 \family typewriter
 printf_large.c
 \family default
- does not support float (except on ds390).
- To enable this recompile it with the option 
+ does not support float
+\begin_inset LatexCommand index
+name "Floating point support"
+
+\end_inset
+
+ (except on ds390), only <NO FLOAT>
+\begin_inset LatexCommand index
+name "<NO FLOAT>"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "printf floating point support"
+
+\end_inset
+
+ will be printed instead of the value.
+ To enable floating point output, recompile it with the option 
 \emph on
 -
 \begin_inset ERT
@@ -21028,7 +21205,7 @@ name "USE\\_FLOATS"
 \emph on
 -
 \begin_inset ERT
-status collapsed
+status open
 
 \begin_layout Standard
 
@@ -21048,6 +21225,13 @@ name "-\\/-model-large"
 
 \emph default
  for the mcs51 port, since this uses a lot of memory.
+ To enable float support for the pic16 targets, see 
+\begin_inset LatexCommand ref
+reference "sub:pic16Libraries"
+
+\end_inset
+
+.
 \end_layout
 
 \begin_layout Standard
@@ -21150,7 +21334,7 @@ mcs51
 \begin_layout Standard
 printf
 \begin_inset LatexCommand index
-name "printf"
+name "printf()"
 
 \end_inset
 
@@ -22296,7 +22480,7 @@ name "heap (malloc)"
 \begin_layout Verse
 
 \family typewriter
-sdcc -c _heap.c -D HEAD_SIZE=2048
+sdcc -c _heap.c -D HEAP_SIZE=2048
 \end_layout
 
 \begin_layout Standard
@@ -23117,7 +23301,7 @@ name "interrupt vector table"
  manually, or when there is a secondary, manually defined interrupt vector
  table (e.g.
  for the autovector feature of the Cypress EZ-USB FX2).
- More elegantly this can be achieved by obmitting the optional interrupt
+ More elegantly this can be achieved by omitting the optional interrupt
  number after the interrupt keyword, see section 
 \begin_inset LatexCommand ref
 reference "sub:Interrupt-Service-Routines"
@@ -23501,8 +23685,8 @@ name "\\#pragma preproc\\_asm"
 
  (+ | -) - switch _asm _endasm block preprocessing on / off.
  Default is on.
- You use this prama to define multilines of assembly code.
- This will prevent the preprocessor from changing the formating required
+ You use this pragma to define multilines of assembly code.
+ This will prevent the preprocessor from changing the formatting required
  by assembly code.
  Below is an example on how to use this pragma.
 \end_layout
@@ -24704,7 +24888,7 @@ Normally all functions you write end up in
 
 \begin_layout Standard
 Functions that need to be in a switched bank must be put in a named segment.
- The name can be mostly anything upto eight characters (e.g.
+ The name can be mostly anything up to eight characters (e.g.
  BANK1).
  To do this you either use -
 \begin_inset ERT
@@ -25040,8 +25224,8 @@ Make local functions static, as non static functions require code page selection
 \newline
 Due to the way sdcc handles functions, place called functions prior
  to calling functions in the file wherever possible: Otherwise sdcc will
- insert unneccessary pagesel directives around the call, believing that
the called function is externally defined.
+ insert unnecessary pagesel directives around the call, believing that the
+ called function is externally defined.
 \end_layout
 
 \begin_layout Enumerate
@@ -25479,7 +25663,7 @@ device/lib/pic/Makefile.in
 device/lib/pic/Makefile
 \family default
  to reflect your device.
- This might even improve performance for smaller devices as unneccesary
+ This might even improve performance for smaller devices as unnecessary
  BANKSELs might be removed.
 \end_layout
 
@@ -25561,31 +25745,45 @@ name "PIC"
 \end_layout
 
 \begin_layout Standard
-18F: 2220, 2221, 2320, 2321, 2331, 2410, 2420, 2423, 2431, 2450, 2455, 2480,
- 24j10
+18F: 2220, 2221, 2320, 2321, 2331, 23k20
+\end_layout
+
+\begin_layout Standard
+18F: 2410, 2420, 2423, 2431, 2450, 2455, 2480, 24j10, 24k20
 \end_layout
 
 \begin_layout Standard
-18F: (2510,) 2515, 2520, 2523, 2525, 2550, 2580, 2585, 25j10, 2610, 2620,
- 2680, 2682, 2685
+18F: 2510, 2515, 2520, 2523, 2525, 2550, 2580, 2585, 25j10, 25k20
 \end_layout
 
 \begin_layout Standard
-18F: 4220, 4221, 4320, 4321, 4331, 4410, 4420, 4423, 4431, 4450, 4455, 4480,
- 44j10
+18F: 2610, 2620, 2680, 2682, 2685
 \end_layout
 
 \begin_layout Standard
-18F: 4510, 4515, 4520, 4523, 4525, 4550, 4580, 4585, 45j10, 4610, 4620,
- 4680, 4682, 4685
+18F: 4220, 4221, 4320, 4321, 4331, 43k20
 \end_layout
 
 \begin_layout Standard
-18F: 6520, 6585, 6620, 6680, 66j60, 66j65, 6720, 67j60
+18F: 4410, 4420, 4423, 4431, 4450, 4455, 4480, 44j10, 44k20
 \end_layout
 
 \begin_layout Standard
-18F: 8520, 8585, 8620, 8680, 86j60, 86j65, 8720, 87j60
+18F: 4510, 4515, 4520, 4523, 4525, 4550, 4580, 4585, 45j10, 45k20
+\end_layout
+
+\begin_layout Standard
+18F: 4610, 4620, 4680, 4682, 4685, 46k20
+\end_layout
+
+\begin_layout Standard
+18F: 6520, 6585, 65j50, 6620, 6680, 66j50, 66j55, 66j60, 66j65, 6720, 67j50,
+ 67j60
+\end_layout
+
+\begin_layout Standard
+18F: 8520, 8585, 85j50, 8620, 8680, 86j50, 86j55, 86j60, 86j65, 8720, 87j50,
+ 87j60
 \end_layout
 
 \begin_layout Standard
@@ -25719,7 +25917,7 @@ status collapsed
 
 \end_inset
 
--pstack-model=[model] Used in conjuction with the command above.
+-pstack-model=[model] Used in conjunction with the command above.
  Defines the stack model to be used, valid stack models are:
 \end_layout
 
@@ -26172,11 +26370,11 @@ status collapsed
 \end_layout
 
 \begin_layout Subsection
-Enviroment Variables
+Environment Variables
 \end_layout
 
 \begin_layout Standard
-There is a number of enviromental variables that can be used when running
+There is a number of environmental variables that can be used when running
  SDCC to enable certain optimizations or force a specific program behaviour.
  these variables are primarily for debugging purposes so they can be enabled/dis
 abled at will.
@@ -27002,7 +27200,7 @@ libdebug
 
 \begin_layout Standard
 \noindent
-This feature allows for linking with specific libraries withoug having to
+This feature allows for linking with specific libraries without having to
  explicit name them in the command line.
  Note that the 
 \noun on
@@ -27253,9 +27451,19 @@ Building the libraries
 Before using SDCC/pic16 there are some libraries that need to be compiled.
  This process is done automatically if gputils are found at SDCC's compile
  time.
- Should you require to rebuild the pic16 libraries manually, these are the
- steps required to do so under Linux or Mac OS X (cygwin might work as well,
- but is untested):
+ Should you require to rebuild the pic16 libraries manually (e.g.
+ in order to enable output of float values
+\begin_inset LatexCommand index
+name "Floating point support"
+
+\end_inset
+
+ via 
+\family typewriter
+printf()
+\family default
+, see below), these are the steps required to do so under Linux or Mac OS
+ X (cygwin might work as well, but is untested):
 \end_layout
 
 \begin_layout LyX-Code
@@ -27294,6 +27502,66 @@ cd device/include
 su -c 'make install'     # install the headers, you need the root password
 \end_layout
 
+\begin_layout Subsubsection*
+Output of float values via printf()
+\end_layout
+
+\begin_layout Standard
+The library is normally built without support for displaying float values,
+ only <NO FLOAT>
+\begin_inset LatexCommand index
+name "<NO FLOAT>"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "printf floating point support"
+
+\end_inset
+
+ will appear instead of the value.
+ To change this, rebuild the library as stated above, but call 
+\family typewriter
+./configure.gnu --enable-floats 
+\family default
+instead of just 
+\family typewriter
+./configure.gnu
+\family default
+.
+ Also make sure that at least 
+\family typewriter
+libc/stdio/vfprintf.c
+\family default
+ is actually recompiled, e.g.
+ by 
+\family typewriter
+touch
+\family default
+ing it after the 
+\family typewriter
+configure
+\family default
+ run or deleting its 
+\family typewriter
+.o
+\family default
+ file.
+\end_layout
+
+\begin_layout Standard
+The more common appraoch of compiling 
+\family typewriter
+vfprintf.c
+\family default
+ manually with 
+\family typewriter
+-DUSE_FLOATS=1
+\family default
+ should also work, but is untested.
+\end_layout
+
 \begin_layout Subsection
 Adding New Devices to the Port
 \end_layout
@@ -28272,7 +28540,7 @@ instruction at the
 \emph on
 Interrupt Vector Address
 \emph default
- which points at the genetated ISR.
+ which points at the generated ISR.
  This single GOTO instruction is part of an automatically generated 
 \emph on
 interrupt entry point
@@ -28290,7 +28558,7 @@ not
  Address of the specific interrupt.
  This is not a problem for the LOW priority interrupts, but it is a problem
  for the RESET and the HIGH priority interrupts because code may be written
- at the next interrupt's vector address and cause undeterminate program
+ at the next interrupt's vector address and cause indeterminate program
  behaviour if that interrupt is raised.
 \begin_inset Foot
 status open
@@ -29209,7 +29477,7 @@ For sprintf and vsprintf
 buf
 \emph default
  should normally be a data pointer where the resulting string will be placed.
- No range checking is done so the user should allocate the necessery buffer.
+ No range checking is done so the user should allocate the necessary buffer.
  For fprintf and vfprintf 
 \emph on
 fp
@@ -29268,7 +29536,7 @@ signal name
 \begin_inset Text
 
 \begin_layout Standard
-descritpion
+description
 \end_layout
 
 \end_inset
@@ -30778,9 +31046,9 @@ ddd -debugger "sdcdb -cpu 8032 ddd_example"
 status open
 
 \begin_layout Standard
-Check that the double quotes or an apostroph within the command line survive
+Check that the double quotes or an apostrophe within the command line survive
  the LyX tool chain.
- Previously the apostrophs got slanted in the PDF output so a cut and paste
+ Previously the apostrophes got slanted in the PDF output so a cut and paste
  did not work.
 \end_layout
 
@@ -31935,7 +32203,7 @@ reference "sub:Common-interrupt-pitfall-volatile"
 \end_layout
 
 \begin_layout Itemize
-check that the compilers are not told to supress warnings.
+check that the compilers are not told to suppress warnings.
 \end_layout
 
 \begin_layout Itemize
@@ -35147,13 +35415,13 @@ make your students aware about the pros and cons of open source software
 \end_layout
 
 \begin_layout Enumerate
-give back to the public as you are probably at least partially publically
+give back to the public as you are probably at least partially publicly
  funded
 \end_layout
 
 \begin_layout Enumerate
-give students a chance to publically prove their skills and to possibly
see a world wide impact
+give students a chance to publicly prove their skills and to possibly see
+ a world wide impact
 \end_layout
 
 \begin_layout Standard
@@ -38341,7 +38609,7 @@ name "sub:ANSI-Compliance"
 \end_layout
 
 \begin_layout Standard
-The latest publically available version of the standard 
+The latest publicly available version of the standard 
 \emph on
 ISO/IEC 9899 - Programming languages - C
 \emph default