+\newline
+
+\newline
+(As a side effect, you get a bunch of Unix utilities that
+ could be useful, such as diff and patch.)
+\end_layout
+
+\begin_layout Enumerate
+A more compact way:
+\newline
+
+\newline
+This one avoids extracting a bunch of files you may not
+ use, but requires some extra work:
+\newline
+
+\newline
+a) Create a directory were to put the
+ tools needed, or use a directory already present.
+ Say for example 'C:
+\backslash
+util'.
+\newline
+
+\newline
+b) Extract 'bison.exe', 'bison.hairy', 'bison.simple', 'flex.exe', and
+ gawk.exe to such directory WITHOUT preserving the original paths.
+ (If you are using WinZip make certain that 'Use folder names' is not selected)
+\newline
+
+\newline
+c
+) Rename bison.exe to '_bison.exe'.
+\newline
+
+\newline
+d) Create a batch file 'bison.bat' in 'C:
+\backslash
+util
+\backslash
+' and add these lines:
+\newline
+\InsetSpace ~
+\InsetSpace ~
+set BISON_SIMPLE=C:
+\backslash
+util
+\backslash
+bison.simple
+\newline
+\InsetSpace ~
+\InsetSpace ~
+set BISON_HAIRY=C:
+\backslash
+util
+\backslash
+bison.hairy
+\newline
+\InsetSpace ~
+\InsetSpace ~
+_bison %1 %2 %3 %4 %5 %6 %7 %8 %9
+\newline
+
+\newline
+Steps 'c' and 'd' are needed
+ because bison requires by default that the files 'bison.simple' and 'bison.hairy'
+ reside in some weird Unix directory, '/usr/local/share/' I think.
+ So it is necessary to tell bison where those files are located if they
+ are not in such directory.
+ That is the function of the environment variables BISON_SIMPLE and BISON_HAIRY.
+\newline
+
+\newline
+e
+) In the Visual C++ IDE click Tools, Options, select the Directory tab,
+ in 'Show directories for:' select 'Executable files', and in the directories
+ window add a new path: 'c:
+\backslash
+util', click ok.
+ Note that you can use any other path instead of 'c:
+\backslash
+util', even the path where the Visual C++ tools are, probably: 'C:
+\backslash
+Program Files
+\backslash
+Microsoft Visual Studio
+\backslash
+Common
+\backslash
+Tools'.
+ So you don't have to execute step 'e' :)
+\end_layout
+
+\begin_layout Standard
+That is it.
+ Open 'sdcc.dsw' in Visual Studio, click 'build all', when it finishes copy
+ the executables from sdcc
+\backslash
+bin_vc to sdcc
+\backslash
+bin, and you can compile using SDCC.
+\end_layout
+
+\begin_layout Subsection
+Building SDCC Using Borland
+\end_layout
+
+\begin_layout Enumerate
+From the sdcc directory, run the command "make -f Makefile.bcc".
+ This should regenerate all the .exe files in the bin directory except for
+ SDCDB and ucSim.
+\end_layout
+
+\begin_layout Enumerate
+If you modify any source files and need to rebuild, be aware that the dependenci
+es may not be correctly calculated.
+ The safest option is to delete all .obj files and run the build again.
+ From a Cygwin BASH prompt, this can easily be done with the command (be
+ sure you are in the sdcc directory):
+\newline
+
+\newline
+
+\family sans
+\series bold
+find .
+
+\backslash
+( -name '*.obj' -o -name '*.lib' -o -name '*.rul'
+\backslash
+) -print -exec rm {}
+\backslash
+;
+\family default
+\series default
+
+\newline
+
+\newline
+or on Windows NT/2000/XP from the command prompt with the command:
+\newline
+
+\family sans
+\series bold
+
+\newline
+del /s *.obj *.lib *.rul
+\family default
+\series default
+ from the sdcc directory.
+\end_layout
+
+\begin_layout Subsection
+Windows Install Using a ZIP Package
+\end_layout
+
+\begin_layout Enumerate
+Download the binary zip package from
+\begin_inset LatexCommand \url{http://sdcc.sf.net/snap.php}
+
+\end_inset
+
+ and unpack it using your favorite unpacking tool (gunzip, WinZip, etc).
+ This should unpack to a group of sub-directories.
+ An example directory structure after unpacking the mingw32 package is:
+ c:
+\backslash
+sdcc
+\backslash
+bin for the executables, c:
+\backslash
+sdcc
+\backslash
+include and c:
+\backslash
+sdcc
+\backslash
+lib for the include and libraries.
+\end_layout
+
+\begin_layout Enumerate
+Adjust your environment variable PATH to include the location of the bin
+ directory or start sdcc using the full path.
+\end_layout
+
+\begin_layout Subsection
+Windows Install Using the Setup Program
+\begin_inset LatexCommand \label{sub:Windows-Install}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Download the setup program
+\emph on
+sdcc-x.y.z-setup.exe
+\emph default
+ for an official release from
+\newline
+
+\begin_inset LatexCommand \url{http://sf.net/project/showfiles.php?group_id=599}
+
+\end_inset
+
+ or a setup program for one of the snapshots
+\emph on
+sdcc-yyyymmdd-xxxx-setup.exe
+\emph default
+ from
+\begin_inset LatexCommand \url{http://sdcc.sf.net/snap.php}
+
+\end_inset
+
+ and execute it.
+ A windows typical installer will guide you through the installation process.
+\end_layout
+
+\begin_layout Subsection
+VPATH
+\begin_inset LatexCommand \index{VPATH}
+
+\end_inset
+
+ feature
+\end_layout
+
+\begin_layout Standard
+SDCC supports the VPATH feature provided by configure and make.
+ It allows to separate the source and build trees.
+ Here's an example:
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+cd ~\InsetSpace ~
+\InsetSpace ~
+\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 ~
+# extract source to directory sdcc
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+mkdir sdcc.build\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+# put output in sdcc.build
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+cd sdcc.build
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+../sdcc/configure\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+# configure is doing all the magic!
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+make
+\end_layout
+
+\begin_layout Standard
+\noindent
+That's it!
+\series bold
+configure
+\series default
+ will create the directory tree will all the necessary Makefiles in ~/sdcc.build.
+ It automagically computes the variables srcdir, top_srcdir and top_buildir
+ for each directory.
+ After running
+\series bold
+make
+\series default
+ the generated files will be in ~/sdcc.build, while the source files stay
+ in ~/sdcc.
+\newline
+This is not only usefull for building different binaries, e.g.
+ when cross compiling.
+ It also gives you a much better overview in the source tree when all the
+ generated files are not scattered between the source files.
+ And the best thing is: if you want to change a file you can leave the original
+ file untouched in the source directory.
+ Simply copy it to the build directory, edit it, enter `make clean', `rm
+ Makefile.dep' and `make'.
+
+\series bold
+make
+\series default
+ will do the rest for you!
+\end_layout
+
+\begin_layout Section
+Building the Documentation
+\end_layout
+
+\begin_layout Standard
+Add -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-enable-doc to the configure arguments to build the documentation together
+ with all the other stuff.
+ You will need several tools (LyX, LaTeX, LaTeX2HTML, pdflatex, dvipdf,
+ dvips and makeindex) to get the job done.
+ Another possibility is to change to the doc directory and to type
+\family sans
+\series bold
+
+\begin_inset Quotes srd
+\end_inset
+
+make
+\begin_inset Quotes srd
+\end_inset
+
+
+\family default
+\series default
+ there.
+ You're invited to make changes and additions to this manual (sdcc/doc/sdccman.ly
+x).
+ Using LyX
+\begin_inset LatexCommand \url{http://www.lyx.org}
+
+\end_inset
+
+ as editor is straightforward.
+ Prebuilt documentation in html and pdf format is available from
+\begin_inset LatexCommand \url{http://sdcc.sf.net/snap.php}
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Section
+Reading the Documentation
+\begin_inset LatexCommand \index{Documentation}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Currently reading the document in pdf format is recommended, as for unknown
+ reason the hyperlinks are working there whereas in the html version they
+ are not
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+If you should know why please drop us a note
+\end_layout
+
+\end_inset
+
+.
+
+\newline
+You'll find the pdf version
+\begin_inset LatexCommand \index{PDF version of this document}
+
+\end_inset
+
+ at
+\begin_inset LatexCommand \url{http://sdcc.sf.net/doc/sdccman.pdf}
+
+\end_inset
+
+.
+
+\newline
+A html version
+\begin_inset LatexCommand \index{HTML version of this document}
+
+\end_inset
+
+ should be online at
+\begin_inset LatexCommand \url{http://sdcc.sf.net/doc/sdccman.html/index.html}
+
+\end_inset
+
+.
+\newline
+This documentation is in some aspects different from a commercial documentation:
+
+\end_layout
+
+\begin_layout Itemize
+It tries to document SDCC for several processor architectures in one document
+ (commercially these probably would be separate documents/products).
+ This document
+\begin_inset LatexCommand \index{Status of documentation}
+
+\end_inset
+
+ currently matches SDCC for mcs51 and DS390 best and does give too few informati
+on about f.e.
+ Z80, PIC14, PIC16 and HC08.
+\end_layout
+
+\begin_layout Itemize
+There are many references pointing away from this documentation.
+ Don't let this distract you.
+ If there f.e.
+ was a reference like
+\begin_inset LatexCommand \url{http://www.opencores.org}
+
+\end_inset
+
+ together with a statement
+\begin_inset Quotes sld
+\end_inset
+
+some processors which are targetted by SDCC can be implemented in a
+\emph on
+f
+\emph default
+ield
+\emph on
+p
+\emph default
+rogrammable
+\emph on
+g
+\emph default
+ate
+\emph on
+a
+\emph default
+rray
+\begin_inset LatexCommand \index{FPGA (field programmable gate array)}
+
+\end_inset
+
+
+\begin_inset Quotes srd
+\end_inset
+
+ or
+\begin_inset LatexCommand \url{http://sf.net/projects/fpgac}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{FpgaC ((subset of) C to FPGA compiler)}
+
+\end_inset
+
+
+\begin_inset Quotes sld
+\end_inset
+
+have you ever heard of an open source compiler that compiles a subset of
+ C for an FPGA?
+\begin_inset Quotes srd
+\end_inset
+
+ we expect you to have a quick look there and come back.
+ If you read this you are on the right track.
+\end_layout
+
+\begin_layout Itemize
+Some sections attribute more space to problems, restrictions and warnings
+ than to the solution.
+\end_layout
+
+\begin_layout Itemize
+The installation section and the section about the debugger is intimidating.
+\end_layout
+
+\begin_layout Itemize
+There are still lots of typos and there are more different writing styles
+ than pictures.
+\end_layout
+
+\begin_layout Section
+Testing the SDCC Compiler
+\begin_inset LatexCommand \label{sec:Testing-the-SDCC}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The first thing you should do after installing your SDCC compiler is to
+ see if it runs.
+ Type
+\family sans
+\series bold
+"sdcc -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-version"
+\begin_inset LatexCommand \index{version}
+
+\end_inset
+
+
+\family default
+\series default
+ at the prompt, and the program should run and output its version like:
+
+\newline
+
+\family typewriter
+SDCC : mcs51/z80/avr/ds390/pic16/pic14/ds400/hc08 2.5.6 #4169 (May 8 2006)
+ (UNIX)
+\end_layout
+
+\begin_layout Standard
+If it doesn't run, or gives a message about not finding sdcc program, then
+ you need to check over your installation.
+ Make sure that the sdcc bin directory is in your executable search path
+ defined by the PATH environment setting (
+\series medium
+see
+\series default
+section
+\begin_inset LatexCommand \ref{sub:Install-Trouble-shooting}
+
+\end_inset
+
+\InsetSpace ~
+
+\series medium
+Install trouble-shooting for suggestions
+\series default
+).
+ Make sure that the sdcc program is in the bin folder, if not perhaps something
+ did not install correctly.
+\newline
+
+\newline
+
+\series medium
+SDCC
+\series default
+is commonly installed as described in section
+\begin_inset Quotes sld
+\end_inset
+
+Install and search paths
+\begin_inset Quotes srd
+\end_inset
+
+.
+\newline
+
+\newline
+
+\series medium
+Make sure the compiler works on a very simple example.
+ Type in the following test.c program using your favorite
+\series default
+ASCII
+\series medium
+editor:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+char test;
+\newline
+
+\newline
+void main(void) {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+test=0;
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+
+\series medium
+Compile this using the following command:
+\family sans
+\series bold
+"sdcc -c test.c".
+
+\family default
+\series default
+
+\series medium
+If all goes well, the compiler will generate a test.asm and test.rel file.
+ Congratulations, you've just compiled your first program with SDCC.
+ We used the -c option to tell SDCC not to link the generated code, just
+ to keep things simple for this step.
+\series default
+
+\newline
+
+\newline
+
+\series medium
+The next step is to try it with the linker.
+ Type in
+\family sans
+\series bold
+"sdcc test.c
+\family default
+\series default
+"
+\series medium
+.
+ If all goes well the compiler will link with the libraries and produce
+ a test.ihx output file.
+ If this step fails
+\series default
+
+\series medium
+(no test.ihx, and the linker generates warnings), then the problem is most
+ likely that
+\series default
+SDCC
+\series medium
+ cannot find the
+\series default
+/
+\series medium
+usr/local/share/sdcc/lib directory
+\series default
+
+\series medium
+(see
+\series default
+section
+\begin_inset LatexCommand \ref{sub:Install-Trouble-shooting}
+
+\end_inset
+
+\InsetSpace ~
+
+\series medium
+Install trouble-shooting for suggestions).
+\series default
+
+\newline
+
+\newline
+
+\series medium
+The final test is to ensure
+\series default
+SDCC
+\series medium
+ can use the
+\series default
+standard
+\series medium
+ header files and libraries.
+ Edit test.c and change it to the following:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+#include <string.h>
+\newline
+
+\newline
+char str1[10];
+\newline
+
+\newline
+void main(void) {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+strcpy(str1, "testing");
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+
+\series medium
+Compile this by typing
+\family sans
+\series bold
+"sdcc test.c"
+\family default
+\series medium
+.
+ This should generate a test.ihx output file, and it should give no warnings
+ such as not finding the string.h file.
+ If it cannot find the string.h file, then the problem is that
+\series default
+SDCC
+\series medium
+ cannot find the /usr/local/share/sdcc/include directory
+\series default
+
+\series medium
+(see the
+\series default
+section
+\begin_inset LatexCommand \ref{sub:Install-Trouble-shooting}
+
+\end_inset
+
+\InsetSpace ~
+
+\series medium
+Install trouble-shooting section for suggestions).
+
+\series default
+ Use option
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-print-search-dirs
+\series default
+
+\begin_inset LatexCommand \index{-\/-print-search-dirs}
+
+\end_inset
+
+ to find exactly where SDCC is looking for the include and lib files.
+\end_layout
+
+\begin_layout Section
+Install Trouble-shooting
+\begin_inset LatexCommand \label{sub:Install-Trouble-shooting}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Install trouble-shooting}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+If SDCC does not build correctly
+\end_layout
+
+\begin_layout Standard
+A thing to try is starting from scratch by unpacking the .tgz source package
+ again in an empty directory.
+ Configure it like:
+\newline
+
+\newline
+
+\family sans
+\series bold
+./configure 2>&1 | tee configure.log
+\family default
+\series default
+
+\newline
+
+\newline
+and build it like:
+\newline
+
+\newline
+
+\family sans
+\series bold
+make 2>&1 | tee make.log
+\family default
+\series default
+
+\newline
+
+\newline
+If anything goes wrong, you can review the log files to locate the problem.
+ Or a relevant part of this can be attached to an email that could be helpful
+ when requesting help from the mailing list.
+\end_layout
+
+\begin_layout Subsection
+What the
+\begin_inset Quotes sld
+\end_inset
+
+./configure
+\begin_inset Quotes srd
+\end_inset
+
+ does
+\end_layout
+
+\begin_layout Standard
+The
+\begin_inset Quotes sld
+\end_inset
+
+./configure
+\begin_inset Quotes srd
+\end_inset
+
+ command is a script that analyzes your system and performs some configuration
+ to ensure the source package compiles on your system.
+ It will take a few minutes to run, and will compile a few tests to determine
+ what compiler features are installed.
+\end_layout
+
+\begin_layout Subsection
+What the
+\begin_inset Quotes sld
+\end_inset
+
+make
+\begin_inset Quotes srd
+\end_inset
+
+ does
+\end_layout
+
+\begin_layout Standard
+This runs the GNU make tool, which automatically compiles all the source
+ packages into the final installed binary executables.
+\end_layout
+
+\begin_layout Subsection
+What the
+\begin_inset Quotes sld
+\end_inset
+
+make install
+\begin_inset Quotes erd
+\end_inset
+
+ command does.
+\end_layout
+
+\begin_layout Standard
+This will install the compiler, other executables libraries and include
+ files into the appropriate directories.
+ See sections
+\begin_inset LatexCommand \ref{sub:Install-paths}
+
+\end_inset
+
+,\InsetSpace ~
+
+\begin_inset LatexCommand \ref{sub:Search-Paths}
+
+\end_inset
+
+\InsetSpace ~
+about install and search paths.
+\newline
+On most systems you will need super-user privilege
+s to do this.
+\end_layout
+
+\begin_layout Section
+Components of SDCC
+\end_layout
+
+\begin_layout Standard
+SDCC is not just a compiler, but a collection of tools by various developers.
+ These include linkers, assemblers, simulators and other components.
+ Here is a summary of some of the components.
+ Note that the included simulator and assembler have separate documentation
+ which you can find in the source package in their respective directories.
+ As SDCC grows to include support for other processors, other packages from
+ various developers are included and may have their own sets of documentation.
+\newline
+
+\newline
+You
+ might want to look at the files which are installed in <installdir>.
+ At the time of this writing, we find the following programs for gcc-builds:
+\newline
+
+
+\newline
+In <installdir>/bin:
+\end_layout
+
+\begin_layout Itemize
+sdcc - The compiler.
+\end_layout
+
+\begin_layout Itemize
+sdcpp - The C preprocessor.
+\end_layout
+
+\begin_layout Itemize
+asx8051 - The assembler for 8051 type processors.
+\end_layout
+
+\begin_layout Itemize
+as-z80
+\series bold
+,
+\series default
+as-gbz80 - The Z80 and GameBoy Z80 assemblers.
+\end_layout
+
+\begin_layout Itemize
+aslink -The linker for 8051 type processors.
+\end_layout
+
+\begin_layout Itemize
+link-z80
+\series bold
+,
+\series default
+link-gbz80 - The Z80 and GameBoy Z80 linkers.
+\end_layout
+
+\begin_layout Itemize
+s51 - The ucSim 8051 simulator.
+\end_layout
+
+\begin_layout Itemize
+sdcdb - The source debugger.
+\end_layout
+
+\begin_layout Itemize
+packihx - A tool to pack (compress) Intel hex files.
+\end_layout
+
+\begin_layout Standard
+In <installdir>/share/sdcc/include
+\end_layout
+
+\begin_layout Itemize
+the include files
+\end_layout
+
+\begin_layout Standard
+In <installdir>/share/sdcc/lib
+\end_layout
+
+\begin_layout Itemize
+the subdirs src and small, large, z80, gbz80 and ds390 with the precompiled
+ relocatables.
+\end_layout
+
+\begin_layout Standard
+In <installdir>/share/sdcc/doc
+\end_layout
+
+\begin_layout Itemize
+the documentation
+\end_layout
+
+\begin_layout Standard
+As development for other processors proceeds, this list will expand to include
+ executables to support processors like AVR, PIC, etc.
+\end_layout
+
+\begin_layout Subsection
+sdcc - The Compiler
+\end_layout
+
+\begin_layout Standard
+This is the actual compiler, it in turn uses the c-preprocessor and invokes
+ the assembler and linkage editor.
+\end_layout
+
+\begin_layout Subsection
+sdcpp - The C-Preprocessor
+\end_layout
+
+\begin_layout Standard
+The preprocessor
+\begin_inset LatexCommand \index{sdcpp (preprocessor)}
+
+\end_inset
+
+ is a modified version of the GNU cpp
+\begin_inset LatexCommand \index{cpp|see{sdcpp}}
+
+\end_inset
+
+ preprocessor
+\begin_inset LatexCommand \url{http://gcc.gnu.org/}
+
+\end_inset
+
+.
+ The C preprocessor is used to pull in #include sources, process #ifdef
+ statements, #defines and so on.
+\end_layout
+
+\begin_layout Subsection
+as
+\emph on
+xxxx
+\emph default
+, aslink, link-
+\emph on
+xxx
+\emph default
+ - The Assemblers and Linkage Editors
+\end_layout
+
+\begin_layout Standard
+This is retargettable assembler & linkage editor, it was developed by Alan
+ Baldwin.
+ John Hartman created the version for 8051, and I (Sandeep) have made some
+ enhancements and bug fixes for it to work properly with SDCC.
+\end_layout
+
+\begin_layout Subsection
+s51 - The Simulator
+\end_layout
+
+\begin_layout Standard
+S51
+\begin_inset LatexCommand \index{s51}
+
+\end_inset
+
+ is a free open source simulator developed by Daniel Drotos.
+ The simulator is built as part of the build process.
+ For more information visit Daniel's web site at:
+\begin_inset LatexCommand \url{http://mazsola.iit.uni-miskolc.hu/~drdani/embedded/s51}
+
+\end_inset
+
+.
+ It currently supports the core mcs51, the Dallas DS80C390 and the Phillips
+ XA51 family.
+\end_layout
+
+\begin_layout Subsection
+sdcdb - Source Level Debugger
+\end_layout
+
+\begin_layout Standard
+SDCDB
+\begin_inset LatexCommand \index{SDCDB (debugger)}
+
+\end_inset
+
+ is the companion source level debugger.
+ More about SDCDB in section
+\begin_inset LatexCommand \ref{cha:Debugging-with-SDCDB}
+
+\end_inset
+
+.
+ The current version of the debugger uses Daniel's Simulator S51
+\begin_inset LatexCommand \index{s51}
+
+\end_inset
+
+, but can be easily changed to use other simulators.
+\end_layout
+
+\begin_layout Chapter
+Using SDCC
+\end_layout
+
+\begin_layout Section
+Compiling
+\end_layout
+
+\begin_layout Subsection
+Single Source File Projects
+\end_layout
+
+\begin_layout Standard
+For single source file 8051 projects the process is very simple.
+ Compile your programs with the following command
+\family sans
+\series bold
+"sdcc sourcefile.c".
+
+\family default
+\series default
+ This will compile, assemble and link your source file.
+ Output files are as follows:
+\end_layout
+
+\begin_layout Itemize
+sourcefile.asm
+\begin_inset LatexCommand \index{<file>.asm}
+
+\end_inset
+
+ - Assembler source
+\begin_inset LatexCommand \index{Assembler source}
+
+\end_inset
+
+ file created by the compiler
+\end_layout
+
+\begin_layout Itemize
+sourcefile.lst
+\begin_inset LatexCommand \index{<file>.lst}
+
+\end_inset
+
+ - Assembler listing
+\begin_inset LatexCommand \index{Assembler listing}
+
+\end_inset
+
+ file created by the Assembler
+\end_layout
+
+\begin_layout Itemize
+sourcefile.rst
+\begin_inset LatexCommand \index{<file>.rst}
+
+\end_inset
+
+ - Assembler listing
+\begin_inset LatexCommand \index{Assembler listing}
+
+\end_inset
+
+ file updated with linkedit information, created by linkage editor
+\end_layout
+
+\begin_layout Itemize
+sourcefile.sym
+\begin_inset LatexCommand \index{<file>.sym}
+
+\end_inset
+
+ - symbol listing
+\begin_inset LatexCommand \index{Symbol listing}
+
+\end_inset
+
+ for the sourcefile, created by the assembler
+\end_layout
+
+\begin_layout Itemize
+sourcefile.rel
+\begin_inset LatexCommand \index{<file>.rel}
+
+\end_inset
+
+ or sourcefile.o
+\begin_inset LatexCommand \index{<file>.o}
+
+\end_inset
+
+ - Object file
+\begin_inset LatexCommand \index{Object file}
+
+\end_inset
+
+ created by the assembler, input to Linkage editor
+\end_layout
+
+\begin_layout Itemize
+sourcefile.map
+\begin_inset LatexCommand \index{<file>.map}
+
+\end_inset
+
+ - The memory map
+\begin_inset LatexCommand \index{Memory map}
+
+\end_inset
+
+ for the load module, created by the Linker
+\end_layout
+
+\begin_layout Itemize
+sourcefile.mem
+\begin_inset LatexCommand \index{<file>.mem}
+
+\end_inset
+
+ - A file with a summary of the memory usage
+\end_layout
+
+\begin_layout Itemize
+sourcefile.ihx
+\begin_inset LatexCommand \index{<file>.ihx}
+
+\end_inset
+
+ - The load module in Intel hex format
+\begin_inset LatexCommand \index{Intel hex format}
+
+\end_inset
+
+ (you can select the Motorola S19 format
+\begin_inset LatexCommand \index{Motorola S19 format}
+
+\end_inset
+
+ with -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-out-fmt-s19
+\begin_inset LatexCommand \index{-\/-out-fmt-s19}
+
+\end_inset
+
+.
+ If you need another format you might want to use
+\family sans
+\shape italic
+objdump
+\family default
+\shape default
+
+\begin_inset LatexCommand \index{objdump (tool)}
+
+\end_inset
+
+ or
+\family sans
+\shape italic
+ srecord
+\family default
+\shape default
+
+\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+
+\end_inset
+
+
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+hyperlinks needed
+\end_layout
+
+\end_inset
+
+ - see also section
+\begin_inset LatexCommand \vref{sub:Postprocessing-the-Intel}
+
+\end_inset
+
+).
+ Both formats are documented in the documentation of srecord
+\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+sourcefile.adb
+\begin_inset LatexCommand \index{<file>.adb}
+
+\end_inset
+
+ - An intermediate file containing debug information needed to create the
+ .cdb file (with -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-debug
+\begin_inset LatexCommand \index{-\/-debug}
+
+\end_inset
+
+)
+\end_layout
+
+\begin_layout Itemize
+sourcefile.cdb
+\begin_inset LatexCommand \index{<file>.cdb}
+
+\end_inset
+
+ - An optional file (with -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-debug) containing debug information.
+ The format is documented in cdbfileformat.pdf
+\end_layout
+
+\begin_layout Itemize
+sourcefile.
+ - (no extension)
+\begin_inset LatexCommand \index{<file> (no extension)}
+
+\end_inset
+
+ An optional AOMF or AOMF51
+\begin_inset LatexCommand \index{AOMF, AOMF51}
+
+\end_inset
+
+
+\begin_inset LatexCommand \label{OMF file}
+
+\end_inset
+
+file containing debug information (generated with option -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-debug).
+ The (Intel)
+\emph on
+ a
+\emph default
+bsolute
+\emph on
+o
+\emph default
+bject
+\emph on
+m
+\emph default
+odule
+\emph on
+f
+\emph default
+ormat is a subformat of the OMF51 format and is commonly used by third party
+ tools (debuggers
+\begin_inset LatexCommand \index{Debugger}
+
+\end_inset
+
+, simulators, emulators).
+\end_layout
+
+\begin_layout Itemize
+sourcefile.dump*
+\begin_inset LatexCommand \index{<file>.dump*}
+
+\end_inset
+
+ - Dump file to debug the compiler it self (generated with option -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumpall) (see section
+\begin_inset LatexCommand \ref{sub:Intermediate-Dump-Options}
+
+\end_inset
+
+\InsetSpace ~
+ and section
+\begin_inset LatexCommand \ref{sub:The-anatomy-of}
+
+\end_inset
+
+\InsetSpace ~
+
+\begin_inset Quotes sld
+\end_inset
+
+Anatomy of the compiler
+\begin_inset Quotes srd
+\end_inset
+
+).
+\end_layout
+
+\begin_layout Subsection
+Postprocessing the Intel Hex
+\begin_inset LatexCommand \index{Intel hex format}
+
+\end_inset
+
+ file
+\begin_inset LatexCommand \label{sub:Postprocessing-the-Intel}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+In most cases this won't be needed but the Intel Hex file
+\begin_inset LatexCommand \index{<file>.ihx}
+
+\end_inset
+
+ which is generated by SDCC might include lines of varying length and the
+ addresses within the file are not guaranteed to be strictly ascending.
+ If your toolchain or a bootloader does not like this you can use the tool
+
+\family typewriter
+packihx
+\family default
+
+\begin_inset LatexCommand \index{packihx (tool)}
+
+\end_inset
+
+ which is part of the SDCC distribution:
+\newline
+
+\newline
+
+\family sans
+\series bold
+ packihx sourcefile.ihx >sourcefile.hex
+\family default
+\series default
+
+\newline
+
+\newline
+The separately available
+\emph on
+ srecord
+\emph default
+
+\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+
+\end_inset
+
+ package additionally allows to set undefined locations to a predefined
+ value, to insert checksums
+\begin_inset LatexCommand \index{checksum}
+
+\end_inset
+
+ of various flavours (crc, add, xor) and to perform other manipulations
+ (convert, split, crop, offset, ...).
+
+\newline
+
+\newline
+
+\family sans
+\series bold
+srec_cat\InsetSpace ~
+\InsetSpace ~
+sourcefile.ihx -intel\InsetSpace ~
+\InsetSpace ~
+-o sourcefile.hex -intel
+\newline
+
+\newline
+
+\family default
+\series default
+An example for a more complex command line
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+the command backfills
+\begin_inset LatexCommand \index{backfill unused memory}
+
+\end_inset
+
+ unused memory with 0x12 and the overall 16 bit sum of the complete 64 kByte
+ block is zero.
+ If the program counter on an mcs51 runs wild the backfill pattern 0x12
+ will be interpreted as an
+\family typewriter
+lcall
+\family default
+ to address
+\family typewriter
+0x1212
+\family default
+ (where an emergency routine could sit).
+\end_layout
+
+\end_inset
+
+ could look like:
+\newline
+
+\newline
+
+\family sans
+\series bold
+\size footnotesize
+srec_cat\InsetSpace ~
+sourcefile.ihx -intel\InsetSpace ~
+\InsetSpace ~
+-fill 0x12 0x0000 0xfffe\InsetSpace ~
+-little-endian-checksum-nega
+tive 0xfffe 0x02 0x02\InsetSpace ~
+\InsetSpace ~
+-o sourcefile.hex -intel
+\size default
+
+\newline
+
+\newline
+
+\family default
+\series default
+The srecord package is available at
+\begin_inset LatexCommand \url{http://sf.net/projects/srecord}
+
+\end_inset
+
+ .
+\end_layout
+
+\begin_layout Subsection
+Projects with Multiple Source Files
+\end_layout
+
+\begin_layout Standard
+SDCC can compile only ONE file at a time.
+ Let us for example assume that you have a project containing the following
+ files:
+\newline
+
+\newline
+foo1.c (contains some functions)
+\newline
+foo2.c (contains some more functions)
+\newline
+foomai
+n.c (contains more functions and the function main)
+\newline
+
+\size footnotesize
+
+\newline
+
+\size default
+The first two files will need to be compiled separately with the commands:
+\size footnotesize
+
+\size default
+
+\newline
+
+\newline
+
+\family sans
+\series bold
+sdcc\InsetSpace ~
+-c\InsetSpace ~
+foo1.c
+\family default
+\series default
+\size footnotesize
+
+\newline
+
+\family sans
+\series bold
+\size default
+sdcc\InsetSpace ~
+-c\InsetSpace ~
+foo2.c
+\family default
+\series default
+
+\newline
+
+\newline
+Then compile the source file containing the
+\emph on
+main()
+\emph default
+ function and link
+\begin_inset LatexCommand \index{Linker}
+
+\end_inset
+
+ the files together with the following command:
+\newline
+
+\newline
+
+\family sans
+\series bold
+sdcc\InsetSpace ~
+foomain.c\InsetSpace ~
+foo1.rel\InsetSpace ~
+foo2.rel
+\family default
+\series default
+
+\begin_inset LatexCommand \index{<file>.rel}
+
+\end_inset
+
+
+\newline
+
+\newline
+Alternatively,
+\emph on
+foomain.c
+\emph default
+can be separately compiled as well:
+\family sans
+\series bold
+
+\newline
+
+\newline
+sdcc\InsetSpace ~
+-c\InsetSpace ~
+foomain.c
+\newline
+sdcc foomain.rel foo1.rel foo2.rel
+\newline
+
+\newline
+
+\family default
+\series default
+The file containing the
+\emph on
+main()
+\emph default
+ function
+\emph on
+
+\emph default
+\noun on
+must
+\noun default
+ be the
+\noun on
+first
+\noun default
+ file specified in the command line, since the linkage editor processes
+ file in the order they are presented to it.
+ The linker is invoked from SDCC using a script file with extension .lnk
+\begin_inset LatexCommand \index{<file>.lnk}
+
+\end_inset
+
+.
+ You can view this file to troubleshoot linking problems such as those arising
+ from missing libraries.
+\end_layout
+
+\begin_layout Subsection
+Projects with Additional Libraries
+\begin_inset LatexCommand \index{Libraries}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Some reusable routines may be compiled into a library, see the documentation
+ for the assembler and linkage editor (which are in <installdir>/share/sdcc/doc)
+ for how to create a
+\emph on
+.lib
+\begin_inset LatexCommand \index{<file>.lib}
+
+\end_inset
+
+
+\emph default
+ library file.
+ Libraries created in this manner can be included in the command line.
+ Make sure you include the -L <library-path> option to tell the linker where
+ to look for these files if they are not in the current directory.
+ Here is an example, assuming you have the source file
+\emph on
+foomain.c
+\emph default
+ and a library
+\emph on
+ foolib.lib
+\emph default
+ in the directory
+\emph on
+mylib
+\emph default
+ (if that is not the same as your current project):
+\newline
+
+\newline
+
+\family sans
+\series bold
+sdcc foomain.c foolib.lib -L mylib
+\newline
+
+\newline
+
+\family default
+\series default
+Note here that
+\emph on
+ mylib
+\emph default
+ must be an absolute path name.
+\newline
+
+\newline
+The most efficient way to use libraries is
+ to keep separate modules in separate source files.
+ The lib file now should name all the modules.rel
+\begin_inset LatexCommand \index{<file>.rel}
+
+\end_inset
+
+ files.
+ For an example see the standard library file
+\emph on
+libsdcc.lib
+\emph default
+ in the directory <installdir>/share/lib/small.
+\end_layout
+
+\begin_layout Subsection
+Using sdcclib to Create and Manage Libraries
+\begin_inset LatexCommand \index{sdcclib}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Alternatively, instead of having a .rel file for each entry on the library
+ file as described in the preceding section, sdcclib can be used to embed
+ all the modules belonging to such library in the library file itself.
+ This results in a larger library file, but it greatly reduces the number
+ of disk files accessed by the linker.
+ Additionally, the packed library file contains an index of all include
+ modules and symbols that significantly speeds up the linking process.
+ To display a list of options supported by sdcclib type:
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib -?
+\begin_inset LatexCommand \index{sdcclib}
+
+\end_inset
+
+
+\newline
+
+\newline
+
+\family default
+\series default
+To create a new library file, start by compiling all the required modules.
+ For example:
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcc -c _divsint.c
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcc -c _divuint.c
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcc -c _modsint.c
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcc -c _moduint.c
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcc -c _mulint.c
+\newline
+
+\end_layout
+
+\begin_layout Standard
+This will create files _divsint.rel, _divuint.rel, _modsint.rel, _moduint.rel,
+ and _mulint.rel.
+ The next step is to add the .rel files to the library file:
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib libint.lib _divsint.rel
+\family default
+
+\begin_inset LatexCommand \index{sdcclib}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib libint.lib _divuint.rel
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib libint.lib _modsint.rel
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib libint.lib _moduint.rel
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib libint.lib _mulint.rel
+\family default
+\series default
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+Or, if you preffer:
+\family sans
+\series bold
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib libint.lib _divsint.rel _divuint.rel _modsint.rel _moduint.rel _mulint.rel
+\family default
+\series default
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+If the file already exists in the library, it will be replaced.
+ If a list of .rel files is available, you can tell sdcclib to add those
+ files to a library.
+ For example, if the file 'myliblist.txt' contains
+\family sans
+\series bold
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+_divsint.rel
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+_divuint.rel
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+_modsint.rel
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+_moduint.rel
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+_mulint.rel
+\family default
+\series default
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+Use
+\family sans
+\series bold
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib -l libint.lib myliblist.txt
+\family default
+\series default
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+Additionally, you can instruct sdcclib to compiles the files before adding
+ them to the library.
+ This is achieved using the environment variables SDCCLIB_CC and/or SDCCLIB_AS.
+ For example:
+\family sans
+\series bold
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+set SDCCLIB_CC=sdcc -c
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+sdcclib -l libint.lib myliblist.txt
+\family default
+\series default
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+To see what modules and symbols are included in the library, options -s
+ and -m are available.
+ For example:
+\newline
+
+\newline
+
+\family sans
+\series bold
+sdcclib -s libint.lib
+\family default
+
+\begin_inset LatexCommand \index{sdcclib}
+
+\end_inset
+
+
+\newline
+
+\family typewriter
+\series default
+_divsint.rel:
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__divsint_a_1_1
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__divsint_PARM_2
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__divsint
+\newline
+_divuint.rel:
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__divuint_a_1_1
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__divuint_PARM_2
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__divuint_reste_1_1
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__divuint_count_1_1
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__divuint
+\newline
+_modsint.rel:
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__modsint_a_1_1
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__modsint_PARM_2
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__modsint
+\newline
+_moduint.rel:
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__moduint_a_1_1
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__moduint_PARM_2
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__moduint_count_1_1
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__moduint
+\newline
+_mulint.rel:
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__mulint_PARM_2
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+__mulint
+\family default
+\series bold
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+If the source files are compiled using -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-debug
+\begin_inset LatexCommand \index{-\/-debug}
+
+\end_inset
+
+, the corresponding debug information file .adb will be include in the library
+ 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
+ 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.
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Command Line Options
+\begin_inset LatexCommand \index{Command Line Options}
+
+\end_inset
+
+
+\begin_inset LatexCommand \label{sec:Command-Line-Options}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Processor Selection Options
+\begin_inset LatexCommand \index{Options processor selection}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Processor selection options}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mmcs51
+\begin_inset LatexCommand \index{-mmcs51}
+
+\end_inset
+
+
+\series default
+ Generate code for the Intel MCS51
+\begin_inset LatexCommand \index{MCS51}
+
+\end_inset
+
+ family of processors.
+ This is the default processor target.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mds390
+\begin_inset LatexCommand \index{-mds390}
+
+\end_inset
+
+
+\series default
+ Generate code for the Dallas DS80C390
+\begin_inset LatexCommand \index{DS80C390}
+
+\end_inset
+
+ processor.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mds400
+\begin_inset LatexCommand \index{-mds400}
+
+\end_inset
+
+
+\series default
+ Generate code for the Dallas DS80C400
+\begin_inset LatexCommand \index{DS80C400}
+
+\end_inset
+
+ processor.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mhc08
+\begin_inset LatexCommand \index{-mhc08}
+
+\end_inset
+
+
+\series default
+ Generate code for the Freescale/Motorola HC08
+\begin_inset LatexCommand \index{HC08}
+
+\end_inset
+
+ family of processors.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mz80
+\begin_inset LatexCommand \index{-mz80}
+
+\end_inset
+
+
+\series default
+ Generate code for the Zilog Z80
+\begin_inset LatexCommand \index{Z80}
+
+\end_inset
+
+ family of processors.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mgbz80
+\begin_inset LatexCommand \index{-mgbz80}
+
+\end_inset
+
+
+\series default
+ Generate code for the GameBoy Z80
+\begin_inset LatexCommand \index{gbz80 (GameBoy Z80)}
+
+\end_inset
+
+ processor (Not actively maintained).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mavr
+\begin_inset LatexCommand \index{-mavr}
+
+\end_inset
+
+
+\series default
+ Generate code for the Atmel AVR
+\begin_inset LatexCommand \index{AVR}
+
+\end_inset
+
+ processor (Not maintained, not complete).
+ AVR users should probably have a look at winavr
+\begin_inset LatexCommand \url{http://sourceforge.net/projects/winavr}
+
+\end_inset
+
+ or
+\begin_inset LatexCommand \url{http://www.avrfreaks.net/index.php?name=PNphpBB2&file=index}
+
+\end_inset
+
+, which is based on AVR-port of the gcc compiler.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+I think it is fair to direct users there for now.
+ Open source is also about avoiding unnecessary work .
+ But I didn't find the 'official' link.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mpic14
+\begin_inset LatexCommand \index{-mpic14}
+
+\end_inset
+
+
+\series default
+ Generate code for the Microchip PIC 14
+\begin_inset LatexCommand \index{PIC14}
+
+\end_inset
+
+-bit processors (p16f84 and variants.
+ In development, not complete).
+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+p16f627 p16f628 p16f84 p16f873 p16f877?
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mpic16
+\begin_inset LatexCommand \index{-mpic16}
+
+\end_inset
+
+
+\series default
+ Generate code for the Microchip PIC 16
+\begin_inset LatexCommand \index{PIC16}
+
+\end_inset
+
+-bit processors (p18f452 and variants.
+ In development, not complete).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mtlcs900h
+\series default
+ Generate code for the Toshiba TLCS-900H
+\begin_inset LatexCommand \index{TLCS-900H}
+
+\end_inset
+
+ processor (Not maintained, not complete).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-mxa51
+\begin_inset LatexCommand \index{-mxa51}
+
+\end_inset
+
+
+\series default
+ Generate code for the Phillips XA51
+\begin_inset LatexCommand \index{XA51}
+
+\end_inset
+
+ processor (Not maintained, not complete).
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Preprocessor Options
+\begin_inset LatexCommand \index{Options preprocessor}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Preprocessor options}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{sdcpp (preprocessor)}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-I<path>
+\begin_inset LatexCommand \index{-I<path>}
+
+\end_inset
+
+
+\series default
+ The additional location where the preprocessor will look for <..h> or
+\begin_inset Quotes eld
+\end_inset
+
+..h
+\begin_inset Quotes erd
+\end_inset
+
+ files.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-D<macro[=value]>
+\begin_inset LatexCommand \index{-D<macro[=value]>}
+
+\end_inset
+
+
+\series default
+ Command line definition of macros.
+ Passed to the preprocessor.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-M
+\begin_inset LatexCommand \index{-M}
+
+\end_inset
+
+
+\series default
+ Tell the preprocessor to output a rule suitable for make describing the
+ dependencies of each object file.
+ For each source file, the preprocessor outputs one make-rule whose target
+ is the object file name for that source file and whose dependencies are
+ all the files `#include'd in it.
+ This rule may be a single line or may be continued with `
+\backslash
+'-newline if it is long.
+ The list of rules is printed on standard output instead of the preprocessed
+ C program.
+ `-M' implies `-E
+\begin_inset LatexCommand \index{-E}
+
+\end_inset
+
+'.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-C
+\begin_inset LatexCommand \index{-C}
+
+\end_inset
+
+
+\series default
+ Tell the preprocessor not to discard comments.
+ Used with the `-E' option.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-MM
+\begin_inset LatexCommand \index{-MM}
+
+\end_inset
+
+
+\size large
+\bar under
+
+\series default
+\size default
+\bar default
+Like `-M' but the output mentions only the user header files included with
+ `#include
+\begin_inset Quotes eld
+\end_inset
+
+file"'.
+ System header files included with `#include <file>' are omitted.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-Aquestion(answer)
+\begin_inset LatexCommand \index{-Aquestion(answer)}
+
+\end_inset
+
+
+\series default
+ Assert the answer answer for question, in case it is tested with a preprocessor
+ conditional such as `#if #question(answer)'.
+ `-A-' disables the standard assertions that normally describe the target
+ machine.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-Umacro
+\begin_inset LatexCommand \index{-Umacro}
+
+\end_inset
+
+
+\series default
+ Undefine macro macro.
+ `-U' options are evaluated after all `-D' options, but before any `-include'
+ and `-imacros' options.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-dM
+\begin_inset LatexCommand \index{-dM}
+
+\end_inset
+
+
+\series default
+ Tell the preprocessor to output only a list of the macro definitions that
+ are in effect at the end of preprocessing.
+ Used with the `-E' option.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-dD
+\begin_inset LatexCommand \index{-dD}
+
+\end_inset
+
+
+\series default
+ Tell the preprocessor to pass all macro definitions into the output, in
+ their proper sequence in the rest of the output.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-dN
+\begin_inset LatexCommand \index{-dN}
+
+\end_inset
+
+
+\size large
+\bar under
+
+\series default
+\size default
+\bar default
+Like `-dD' except that the macro arguments and contents are omitted.
+ Only `#define name' is included in the output.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-pedantic-parse-number
+\begin_inset LatexCommand \index{pedantic}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{-pedantic-parse-number}
+
+\end_inset
+
+
+\size large
+\bar under
+
+\begin_inset LatexCommand \label{lyx:-pedantic-parse-number}
+
+\end_inset
+
+
+\series default
+\size default
+\bar default
+Pedantic parse numbers so that situations like 0xfe-LO_B(3) are parsed properly
+ and the macro LO_B(3) gets expanded.
+ See also #pragma pedantic_parse_number
+\begin_inset LatexCommand \vpageref{ite:pedantic_parse_number}
+
+\end_inset
+
+ in section
+\begin_inset LatexCommand \ref{sec:Pragmas}
+
+\end_inset
+
+
+\emph on
+Note: this functionality is not in conformance with C99 standard!
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-Wp\InsetSpace ~
+preprocessorOption[,preprocessorOption]
+\series default
+
+\begin_inset LatexCommand \index{-Wp preprocessorOption[,preprocessorOption]}
+
+\end_inset
+
+...
+ Pass the preprocessorOption to the preprocessor
+\family typewriter
+sdcpp
+\family default
+
+\begin_inset LatexCommand \index{sdcpp (preprocessor)}
+
+\end_inset
+
+.
+ SDCC uses an adapted version of the preprocessor
+\emph on
+cpp
+\emph default
+ of the GNU Compiler Collection
+\begin_inset LatexCommand \index{gcc (GNU Compiler Collection)}
+
+\end_inset
+
+ (
+\emph on
+gcc
+\emph default
+
+\begin_inset LatexCommand \url{http://gcc.gnu.org/}
+
+\end_inset
+
+), if you need more dedicated options please refer to the GCC\InsetSpace ~
+4.1.1\InsetSpace ~
+CPP\InsetSpace ~
+Manual
+ at
+\begin_inset LatexCommand \htmlurl{http://www.gnu.org/software/gcc/onlinedocs/}
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Linker Options
+\begin_inset LatexCommand \index{Options linker}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Linker options}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-L\InsetSpace ~
+-
+\series default
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series bold
+-lib-path
+\begin_inset LatexCommand \index{-\/-lib-path <path>}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{-L -\/-lib-path}
+
+\end_inset
+
+
+\series default
+\InsetSpace ~
+<absolute path to additional libraries> This option is passed to the linkage
+ editor's additional libraries
+\begin_inset LatexCommand \index{Libraries}
+
+\end_inset
+
+ search path.
+ The path name must be absolute.
+ Additional library files may be specified in the command line.
+ See section Compiling programs for more details.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xram-loc
+\series default
+
+\begin_inset LatexCommand \index{-\/-xram-loc <Value>}
+
+\end_inset
+
+\InsetSpace ~
+<Value> The start location of the external ram
+\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+, default value is 0.
+ The value entered can be in Hexadecimal or Decimal format, e.g.: -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xram-loc 0x8000 or -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xram-loc 32768.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-code-loc
+\series default
+
+\begin_inset LatexCommand \index{-\/-code-loc <Value>}
+
+\end_inset
+
+\InsetSpace ~
+<Value> The start location of the code
+\begin_inset LatexCommand \index{code}
+
+\end_inset
+
+ segment, default value 0.
+ Note when this option is used the interrupt vector table
+\begin_inset LatexCommand \index{interrupt vector table}
+
+\end_inset
+
+ is also relocated to the given address.
+ The value entered can be in Hexadecimal or Decimal format, e.g.: -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-code-loc 0x8000 or -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-code-loc 32768.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-loc
+\series default
+
+\begin_inset LatexCommand \index{-\/-stack-loc <Value>}
+
+\end_inset
+
+\InsetSpace ~
+<Value> By default the stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset
+
+ is placed after the data segment.
+ Using this option the stack can be placed anywhere in the internal memory
+ space of the 8051.
+ The value entered can be in Hexadecimal or Decimal format, e.g.
+ -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-loc 0x20 or -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-loc 32.
+ Since the sp register is incremented before a push or call, the initial
+ sp will be set to one byte prior the provided value.
+ The provided value should not overlap any other memory areas such as used
+ register banks or the data segment and with enough space for the current
+ application.
+ The
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-pack-iram
+\series default
+\InsetSpace ~
+
+\begin_inset LatexCommand \index{-\/-pack-iram}
+
+\end_inset
+
+ option (which is now a default setting) will override this setting, so
+ you should also specify the
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-no-pack-iram
+\series default
+\InsetSpace ~
+
+\begin_inset LatexCommand \index{-\/-no-pack-iram}
+
+\end_inset
+
+ option if you need to manually place the stack.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xstack-loc
+\series default
+
+\begin_inset LatexCommand \index{-\/-xstack-loc <Value>}
+
+\end_inset
+
+\InsetSpace ~
+<Value> By default the external stack
+\begin_inset LatexCommand \index{xstack}
+
+\end_inset
+
+ is placed after the pdata
+\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+ segment.
+ Using this option the xstack can be placed anywhere in the external memory
+ space of the 8051.
+ The value entered can be in Hexadecimal or Decimal format, e.g.
+ -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xstack-loc 0x8000 or -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-loc 32768.
+ The provided value should not overlap any other memory areas such as the
+ pdata or xdata segment and with enough space for the current application.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-data-loc
+\series default
+
+\begin_inset LatexCommand \index{-\/-data-loc <Value>}
+
+\end_inset
+
+\InsetSpace ~
+<Value> The start location of the internal ram data
+\begin_inset LatexCommand \index{data (mcs51, ds390 storage class)}
+
+\end_inset
+
+ segment.
+ The value entered can be in Hexadecimal or Decimal format, eg.
+ -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-data-loc 0x20 or -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-data-loc 32.
+ (By default, the start location of the internal ram data segment is set
+ as low as possible in memory, taking into account the used register banks
+ and the bit segment at address 0x20.
+ For example if register banks 0 and 1 are used without bit variables, the
+ data segment will be set, if -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-data-loc is not used, to location 0x10.)
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-idata-loc
+\series default
+
+\begin_inset LatexCommand \index{-\/-idata-loc <Value>}
+
+\end_inset
+
+\InsetSpace ~
+<Value> The start location of the indirectly addressable internal ram
+\begin_inset LatexCommand \index{idata (mcs51, ds390 storage class)}
+
+\end_inset
+
+ of the 8051, default value is 0x80.
+ The value entered can be in Hexadecimal or Decimal format, eg.
+ -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-idata-loc 0x88 or -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-idata-loc 136.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-bit-loc
+\series default
+\InsetSpace ~
+<Value> The start location of the bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset
+
+ addressable internal ram of the 8051.
+ This is
+\emph on
+not
+\emph default
+ implemented yet.
+ Instead an option can be passed directly to the linker: -Wl\InsetSpace ~
+-bBSEG=<Value>.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-out-fmt-ihx
+\begin_inset LatexCommand \index{-\/-out-fmt-ihx}
+
+\end_inset
+
+
+\bar under
+
+\series default
+\bar default
+The linker output (final object code) is in Intel Hex format.
+\begin_inset LatexCommand \index{Intel hex format}
+
+\end_inset
+
+ This is the default option.
+ The format itself is documented in the documentation of srecord
+\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-out-fmt-s19
+\begin_inset LatexCommand \index{-\/-out-fmt-s19}
+
+\end_inset
+
+
+\bar under
+
+\series default
+\bar default
+The linker output (final object code) is in Motorola S19 format
+\begin_inset LatexCommand \index{Motorola S19 format}
+
+\end_inset
+
+.
+ The format itself is documented in the documentation of srecord.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-out-fmt-elf
+\begin_inset LatexCommand \index{-\/-out-fmt-s19}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{HC08!Options!-\/-out-fmt-elf}
+
+\end_inset
+
+
+\bar under
+
+\series default
+\bar default
+The linker output (final object code) is in ELF format
+\begin_inset LatexCommand \index{ELF format}
+
+\end_inset
+
+.
+ (Currently only supported for the HC08
+\begin_inset LatexCommand \index{HC08}
+
+\end_inset
+
+ processors)
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-Wl\InsetSpace ~
+linkOption[,linkOption]
+\series default
+
+\begin_inset LatexCommand \index{-Wl linkOption[,linkOption]}
+
+\end_inset
+
+...
+ Pass the linkOption to the linker.
+ If a bootloader is used an option like
+\begin_inset Quotes sld
+\end_inset
+
+-Wl\InsetSpace ~
+-bCSEG=0x1000
+\begin_inset Quotes srd
+\end_inset
+
+ would be typical to set the start of the code segment.
+ See also #pragma constseg and #pragma codeseg in section
+\begin_inset LatexCommand \ref{sec:Pragmas}
+
+\end_inset
+
+ .
+ File sdcc/as/doc/asxhtm.html has more on linker options.
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+MCS51 Options
+\begin_inset LatexCommand \index{Options MCS51}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{MCS51 options}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-model-small
+\begin_inset LatexCommand \index{-\/-model-small}
+
+\end_inset
+
+
+\series default
+\size large
+\emph on
+
+\size default
+\emph default
+Generate code for Small Model programs, see section Memory Models for more
+ details.
+ This is the default model.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-model-medium
+\begin_inset LatexCommand \index{-\/-model-medium}
+
+\end_inset
+
+
+\series default
+ Generate code for Medium model programs, see section Memory Models for
+ more details.
+ If this option is used all source files in the project have to be compiled
+ with this option.
+ It must also be used when invoking the linker.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-model-large
+\begin_inset LatexCommand \index{-\/-model-large}
+
+\end_inset
+
+
+\series default
+ Generate code for Large model programs, see section Memory Models for more
+ details.
+ If this option is used all source files in the project have to be compiled
+ with this option.
+ It must also be used when invoking the linker.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xstack
+\begin_inset LatexCommand \index{-\/-xstack}
+
+\end_inset
+
+
+\series default
+ Uses a pseudo stack in the pdata
+\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+ area (usually the first 256 bytes in the external ram) for allocating variables
+ and passing parameters.
+ See section
+\begin_inset LatexCommand \ref{sub:External-Stack}
+
+\end_inset
+
+\InsetSpace ~
+ External Stack for more details.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-iram-size
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{-\/-iram-size <Value>}
+
+\end_inset
+
+ Causes the linker to check if the internal ram usage is within limits of
+ the given value.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xram-size
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{-\/-xram-size <Value>}
+
+\end_inset
+
+ Causes the linker to check if the external ram usage is within limits of
+ the given value.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-code-size
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{-\/-code-size <Value>}
+
+\end_inset
+
+ Causes the linker to check if the code memory usage is within limits of
+ the given value.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-size
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{-\/-stack-size <Value>}
+
+\end_inset
+
+ Causes the linker to check if there is at minimum <Value> bytes for stack.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-pack-iram
+\series default
+\InsetSpace ~
+
+\begin_inset LatexCommand \index{-\/-pack-iram}
+
+\end_inset
+
+ Causes the linker to use unused register banks for data variables and pack
+ data, idata and stack together.
+ This is the default now.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-no-pack-iram
+\series default
+\InsetSpace ~
+
+\begin_inset LatexCommand \index{-\/-no-pack-iram}
+
+\end_inset
+
+ Causes the linker to use old style for allocating memory areas.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-acall-ajmp
+\series default
+\InsetSpace ~
+
+\begin_inset LatexCommand \index{-\/-acall-ajmp}
+
+\end_inset
+
+ Replaces the three byte instructions lcall/ljmp with the two byte instructions
+ acall/ajmp.
+ Only use this option if your code is in the same 2k block of memory.
+ You may need to use this option for some 8051 derivatives which lack the
+ lcall/ljmp instructions..
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+DS390 / DS400 Options
+\begin_inset LatexCommand \index{Options DS390}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{DS390}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-model-flat24
+\series default
+
+\begin_inset LatexCommand \index{DS390!Options!-\/-model-flat24}
+
+\end_inset
+
+
+\size large
+\emph on
+
+\size default
+\emph default
+Generate 24-bit flat mode code.
+ This is the one and only that the ds390 code generator supports right now
+ and is default when using
+\emph on
+-mds390
+\emph default
+.
+ See section Memory Models for more details.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-protect-sp-update
+\begin_inset LatexCommand \index{DS390!Options!-\/-protect-sp-update}
+
+\end_inset
+
+
+\series default
+ disable interrupts during ESP:SP updates.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-10bit
+\series default
+
+\begin_inset LatexCommand \index{DS390!Options!-\/-stack-10bit}
+
+\end_inset
+
+ Generate code for the 10 bit stack mode of the Dallas DS80C390 part.
+ This is the one and only that the ds390 code generator supports right now
+ and is default when using
+\emph on
+-mds390
+\emph default
+.
+ In this mode, the stack is located in the lower 1K of the internal RAM,
+ which is mapped to 0x400000.
+ Note that the support is incomplete, since it still uses a single byte
+ as the stack pointer.
+ This means that only the lower 256 bytes of the potential 1K stack space
+ will actually be used.
+ However, this does allow you to reclaim the precious 256 bytes of low RAM
+ for use for the DATA and IDATA segments.
+ The compiler will not generate any code to put the processor into 10 bit
+ stack mode.
+ It is important to ensure that the processor is in this mode before calling
+ any re-entrant functions compiled with this option.
+ In principle, this should work with the
+\emph on
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
+
+\end_inset
+
+
+\emph default
+ option, but that has not been tested.
+ It is incompatible with the
+\emph on
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xstack
+\begin_inset LatexCommand \index{-\/-xstack}
+
+\end_inset
+
+
+\emph default
+ option.
+ It also only makes sense if the processor is in 24 bit contiguous addressing
+ mode (see the
+\emph on
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-model-flat24 option
+\emph default
+).
+\series bold
+
+\begin_inset Note Note
+status collapsed
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-8-bit - switches off the 10-bit mode
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-probe
+\begin_inset LatexCommand \index{DS390!Options!-\/-stack-probe}
+
+\end_inset
+
+
+\series default
+ insert call to function __stack_probe at each function prologue.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-tini-libid
+\begin_inset LatexCommand \index{DS390!Options!-\/-tini-libid}
+
+\end_inset
+
+
+\series default
+ <nnnn> LibraryID used in -mTININative.
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-use-accelerator
+\begin_inset LatexCommand \index{DS390!Options!-\/-use-accelerator}
+
+\end_inset
+
+
+\series default
+ generate code for DS390 Arithmetic Accelerator.
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Z80 Options
+\begin_inset LatexCommand \index{Options Z80}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Z80}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-callee-saves-bc
+\series default
+
+\begin_inset LatexCommand \index{Z80!Options!-\/-callee-saves-bc}
+
+\end_inset
+
+
+\size large
+\emph on
+
+\size default
+\emph default
+Force a called function to always save BC.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-no-std-crt0
+\series default
+
+\begin_inset LatexCommand \index{Z80!Options!-\/-no-std-crt0}
+
+\end_inset
+
+ When linking, skip the standard crt0.o object file.
+ You must provide your own crt0.o for your system when linking.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-portmode=
+\series default
+<Value>
+\begin_inset LatexCommand \index{Z80!Options!-\/-portmode=<Value>}
+
+\end_inset
+
+ Determinate PORT I/O mode (<Value> is z80 or z180).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-asm=
+\series default
+<Value>
+\begin_inset LatexCommand \index{Z80!Options!-\/-asm=<Value>}
+
+\end_inset
+
+ Define assembler name (<Value> is rgbds, asxxxx, isas or z80asm).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-codeseg
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{Z80!Options!-\/-codeseg <Value>}
+
+\end_inset
+
+ Use <Value> for the code segment name.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-constseg
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{Z80!Options!-\/-constseg <Value>}
+
+\end_inset
+
+ Use <Value> for the const segment name.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+GBZ80 Options
+\begin_inset LatexCommand \index{Options GBZ80}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{GBZ80}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-callee-saves-bc
+\series default
+
+\begin_inset LatexCommand \index{GBZ80!Options!-\/-callee-saves-bc}
+
+\end_inset
+
+
+\size large
+\emph on
+
+\size default
+\emph default
+Force a called function to always save BC.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-bo
+\series default
+\InsetSpace ~
+<Num>
+\begin_inset LatexCommand \index{GBZ80!Options!-bo <Num>}
+
+\end_inset
+
+ Use code bank <Num>.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-ba
+\series default
+\InsetSpace ~
+<Num>
+\begin_inset LatexCommand \index{GBZ80!Options!-ba <Num>}
+
+\end_inset
+
+ Use data bank <Num>.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-codeseg
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{GBZ80!Options!-\/-codeseg <Value>}
+
+\end_inset
+
+ Use <Value> for the code segment name.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-constseg
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{GBZ80!Options!-\/-constseg <Value>}
+
+\end_inset
+
+ Use <Value> for the const segment name.
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Optimization Options
+\begin_inset LatexCommand \index{Options optimization}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Optimization options}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-nogcse
+\begin_inset LatexCommand \index{-\/-nogcse}
+
+\end_inset
+
+
+\series default
+ Will not do global subexpression elimination, this option may be used when
+ the compiler creates undesirably large stack/data spaces to store compiler
+ temporaries (
+\emph on
+s
+\emph default
+pill
+\emph on
+loc
+\emph default
+ations, sloc
+\begin_inset LatexCommand \index{sloc (spill location)}
+
+\end_inset
+
+).
+ A warning message will be generated when this happens and the compiler
+ will indicate the number of extra bytes it allocated.
+ It is recommended that this option NOT be used, #pragma\InsetSpace ~
+nogcse
+\begin_inset LatexCommand \index{\#pragma nogcse}
+
+\end_inset
+
+ can be used to turn off global subexpression elimination
+\begin_inset LatexCommand \index{Subexpression elimination}
+
+\end_inset
+
+ for a given function only.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-noinvariant
+\begin_inset LatexCommand \index{-\/-noinvariant}
+
+\end_inset
+
+
+\series default
+ Will not do loop invariant optimizations, this may be turned off for reasons
+ explained for the previous option.
+ For more details of loop optimizations performed see Loop Invariants in
+ section
+\begin_inset LatexCommand \ref{sub:Loop-Optimizations}
+
+\end_inset
+
+.
+ It is recommended that this option NOT be used, #pragma\InsetSpace ~
+noinvariant
+\begin_inset LatexCommand \index{\#pragma noinvariant}
+
+\end_inset
+
+ can be used to turn off invariant optimizations for a given function only.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-noinduction
+\begin_inset LatexCommand \index{-\/-noinduction}
+
+\end_inset
+
+
+\series default
+ Will not do loop induction optimizations, see section strength reduction
+ for more details.
+ It is recommended that this option is NOT used, #pragma\InsetSpace ~
+noinduction
+\begin_inset LatexCommand \index{\#pragma noinduction}
+
+\end_inset
+
+ can be used to turn off induction optimizations for a given function only.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-nojtbound
+\begin_inset LatexCommand \index{-\/-nojtbound}
+
+\end_inset
+
+
+\size large
+\bar under
+
+\series default
+\size default
+\bar default
+ Will not generate boundary condition check when switch statements
+\begin_inset LatexCommand \index{switch statement}
+
+\end_inset
+
+ are implemented using jump-tables.
+ See section
+\begin_inset LatexCommand \ref{sub:'switch'-Statements}
+
+\end_inset
+
+\InsetSpace ~
+Switch Statements for more details.
+ It is recommended that this option is NOT used, #pragma\InsetSpace ~
+nojtbound
+\begin_inset LatexCommand \index{\#pragma nojtbound}
+
+\end_inset
+
+ can be used to turn off boundary checking for jump tables for a given function
+ only.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-noloopreverse
+\begin_inset LatexCommand \index{-\/-noloopreverse}
+
+\end_inset
+
+
+\series default
+\size large
+
+\size default
+Will not do loop reversal
+\begin_inset LatexCommand \index{Loop reversing}
+
+\end_inset
+
+optimization.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-
+\series bold
+nolabelopt
+\series default
+
+\begin_inset LatexCommand \index{-\/-nolabelopt }
+
+\end_inset
+
+Will not optimize labels (makes the dumpfiles more readable).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-no-xinit-opt
+\begin_inset LatexCommand \index{-\/-no-xinit-opt}
+
+\end_inset
+
+
+\series default
+ Will not memcpy initialized data from code space into xdata space.
+ This saves a few bytes in code space if you don't have initialized data
+\begin_inset LatexCommand \index{Variable initialization}
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-nooverlay
+\begin_inset LatexCommand \index{-\/-nooverlay}
+
+\end_inset
+
+
+\series default
+ The compiler will not overlay parameters and local variables of any function,
+ see section Parameters and local variables for more details.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-no-peep
+\begin_inset LatexCommand \index{-\/-no-peep}
+
+\end_inset
+
+
+\series default
+ Disable peep-hole optimization with built-in rules.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-peep-file
+\series default
+
+\begin_inset LatexCommand \index{-\/-peep-file}
+
+\end_inset
+
+\InsetSpace ~
+<filename> This option can be used to use additional rules to be used by
+ the peep hole optimizer.
+ See section
+\begin_inset LatexCommand \ref{sub:Peephole-Optimizer}
+
+\end_inset
+
+\InsetSpace ~
+Peep Hole optimizations for details on how to write these rules.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-peep-asm
+\begin_inset LatexCommand \index{-\/-peep-asm}
+
+\end_inset
+
+
+\series default
+ Pass the inline assembler code through the peep hole optimizer.
+ This can cause unexpected changes to inline assembler code, please go through
+ the peephole optimizer
+\begin_inset LatexCommand \index{Peephole optimizer}
+
+\end_inset
+
+ rules defined in the source file tree '<target>/peeph.def' before using
+ this option.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-opt-code-speed
+\begin_inset LatexCommand \index{-\/-opt-code-speed}
+
+\end_inset
+
+
+\series default
+ The compiler will optimize code generation towards fast code, possibly
+ at the expense of code size.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-opt-code-size
+\begin_inset LatexCommand \index{-\/-opt-code-size}
+
+\end_inset
+
+
+\series default
+ The compiler will optimize code generation towards compact code, possibly
+ at the expense of code speed.
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Other Options
+\begin_inset LatexCommand \index{Options other}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-c\InsetSpace ~
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-compile-only
+\begin_inset LatexCommand \index{-\/-compile-only}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{-c -\/-compile-only}
+
+\end_inset
+
+
+\series default
+ will compile and assemble the source, but will not call the linkage editor.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\series default
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series bold
+-c1mode
+\begin_inset LatexCommand \index{-\/-c1mode}
+
+\end_inset
+
+
+\series default
+ reads the preprocessed source from standard input and compiles it.
+ The file name for the assembler output must be specified using the -o option.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-E
+\begin_inset LatexCommand \index{-E}
+
+\end_inset
+
+
+\series default
+ Run only the C preprocessor.
+ Preprocess all the C source files specified and output the results to standard
+ output.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-o\InsetSpace ~
+<path/file>
+\begin_inset LatexCommand \index{-o <path/file>}
+
+\end_inset
+
+
+\series default
+The output path where everything will be placed or the file name used for
+ all generated output files.
+ If the parameter is a path, it must have a trailing slash (or backslash
+ for the Windows binaries) to be recognized as a path.
+
+\emph on
+
+\emph default
+Note for Windows users: if the path contains spaces, it should be surrounded
+ by quotes.
+ The trailing backslash should be doubled in order to prevent escaping the
+ final quote, for example:
+\emph on
+-o
+\begin_inset Quotes sld
+\end_inset
+
+F:
+\backslash
+Projects
+\backslash
+test3
+\backslash
+output 1
+\backslash
+
+\backslash
+
+\begin_inset Quotes srd
+\end_inset
+
+
+\emph default
+ or put after the final quote, for example:
+\emph on
+-o
+\begin_inset Quotes sld
+\end_inset
+
+F:
+\backslash
+Projects
+\backslash
+test3
+\backslash
+output 1
+\begin_inset Quotes srd
+\end_inset
+
+
+\backslash
+
+\emph default
+.
+ The path using slashes for directory delimiters can be used too, for example:
+
+\emph on
+-o
+\begin_inset Quotes sld
+\end_inset
+
+F:/Projects/test3/output 1/
+\begin_inset Quotes srd
+\end_inset
+
+
+\emph default
+.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
+
+\end_inset
+
+
+\series default
+\size large
+\emph on
+
+\size default
+\emph default
+All functions in the source file will be compiled as
+\emph on
+reentrant
+\emph default
+
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+, i.e.
+ the parameters and local variables will be allocated on the stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset
+
+.
+ See section
+\begin_inset LatexCommand \ref{sec:Parameters-and-Local-Variables}
+
+\end_inset
+
+ Parameters and Local Variables for more details.
+ If this option is used all source files in the project should be compiled
+ with this option.
+ It automatically implies -
+\series bold
+
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series default
+-int-long-reent and -
+\series bold
+
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series default
+-float-reent.
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-callee-saves
+\begin_inset LatexCommand \index{-\/-callee-saves}
+
+\end_inset
+
+
+\begin_inset LatexCommand \label{lyx:--callee-saves-function1[,function2][,function3]...}
+
+\end_inset
+
+function1[,function2][,function3]....
+
+\series default
+ The compiler by default uses a caller saves convention for register saving
+ across function calls, however this can cause unnecessary register pushing
+ and popping when calling small functions from larger functions.
+ This option can be used to switch the register saving convention for the
+ function names specified.
+ The compiler will not save registers when calling these functions, no extra
+ code will be generated at the entry and exit (function prologue
+\series bold
+
+\begin_inset LatexCommand \index{function prologue}
+
+\end_inset
+
+
+\series default
+ and epilogue
+\series bold
+
+\begin_inset LatexCommand \index{function epilogue}
+
+\end_inset
+
+
+\series default
+) for these functions to save and restore the registers used by these functions,
+ this can SUBSTANTIALLY reduce code and improve run time performance of
+ the generated code.
+ In the future the compiler (with inter procedural analysis) will be able
+ to determine the appropriate scheme to use for each function call.
+ DO NOT use this option for built-in functions such as _mulint..., if this
+ option is used for a library function the appropriate library function
+ needs to be recompiled with the same option.
+ If the project consists of multiple source files then all the source file
+ should be compiled with the same -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-callee-saves option string.
+ Also see #pragma\InsetSpace ~
+callee_saves
+\begin_inset LatexCommand \index{\#pragma callee\_saves}
+
+\end_inset
+
+
+\begin_inset LatexCommand \vpageref{ite:callee_saves-function1[,function2[,function3...]]--}
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-all-callee-saves
+\begin_inset LatexCommand \index{-\/-all-callee-saves}
+
+\end_inset
+
+
+\series default
+Function of
+\series bold
+
+\series default
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-callee-saves will be applied to all functions by default.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-debug
+\begin_inset LatexCommand \index{-\/-debug}
+
+\end_inset
+
+
+\bar under
+
+\series default
+\bar default
+When this option is used the compiler will generate debug information.
+ The debug information collected in a file with .cdb extension can be used
+ with the SDCDB.
+ For more information see documentation for SDCDB.
+ Another file with no extension contains debug information in AOMF or AOMF51
+\begin_inset LatexCommand \index{AOMF, AOMF51}
+
+\end_inset
+
+ format which is commonly used by third party tools.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-S
+\begin_inset LatexCommand \index{-S}
+
+\end_inset
+
+
+\size large
+\bar under
+
+\series default
+\size default
+\bar default
+Stop after the stage of compilation proper; do not assemble.
+ The output is an assembler code file for the input file specified.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-int-long-reent
+\begin_inset LatexCommand \index{-\/-int-long-reent}
+
+\end_inset
+
+
+\series default
+ Integer (16 bit) and long (32 bit) libraries have been compiled as reentrant.
+ Note by default these libraries are compiled as non-reentrant.
+ See section Installation for more details.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-cyclomatic
+\begin_inset LatexCommand \index{-\/-cyclomatic}
+
+\end_inset
+
+
+\bar under
+
+\series default
+\bar default
+This option will cause the compiler to generate an information message for
+ each function in the source file.
+ The message contains some
+\emph on
+important
+\emph default
+ information about the function.
+ The number of edges and nodes the compiler detected in the control flow
+ graph of the function, and most importantly the
+\emph on
+cyclomatic complexity
+\begin_inset LatexCommand \index{Cyclomatic complexity}
+
+\end_inset
+
+
+\emph default
+ see section on Cyclomatic Complexity for more details.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-float-reent
+\begin_inset LatexCommand \index{-\/-float-reent}
+
+\end_inset
+
+
+\series default
+ Floating point library is compiled as reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+.
+ See section Installation for more details.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-funsigned-char
+\begin_inset LatexCommand \index{-\/-funsigned-char}
+
+\end_inset
+
+
+\series default
+ The default signedness for every type is
+\family typewriter
+ signed
+\family default
+.
+ In some embedded environments the default signedness of
+\family typewriter
+ char
+\family default
+ is
+\family typewriter
+ unsigned
+\family default
+.
+ To set the signess for characters to unsigned, use the option -
+\series bold
+
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series default
+-funsigned-char.
+ If this option is set and no signedness keyword (unsigned/signed) is given,
+ a char will be signed.
+ All other types are unaffected.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-main-return
+\begin_inset LatexCommand \index{-\/-main-return}
+
+\end_inset
+
+
+\series default
+ This option can be used if the code generated is called by a monitor program
+ or if the main routine includes an endless loop.
+ This option results in slightly smaller code and saves two bytes of stack
+ space.
+ The return from the 'main'
+\begin_inset LatexCommand \index{main return}
+
+\end_inset
+
+ function will return to the function calling main.
+ The default setting is to lock up i.e.
+ generate a '
+\family typewriter
+sjmp .
+\family default
+'.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-nostdinc
+\begin_inset LatexCommand \index{-\/-nostdinc}
+
+\end_inset
+
+
+\series default
+ This will prevent the compiler from passing on the default include path
+ to the preprocessor.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-nostdlib
+\begin_inset LatexCommand \index{-\/-nostdlib}
+
+\end_inset
+
+
+\series default
+ This will prevent the compiler from passing on the default library
+\begin_inset LatexCommand \index{Libraries}
+
+\end_inset
+
+ path to the linker.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-verbose
+\begin_inset LatexCommand \index{-\/-verbose}
+
+\end_inset
+
+
+\series default
+ Shows the various actions the compiler is performing.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-V
+\begin_inset LatexCommand \index{-V}
+
+\end_inset
+
+
+\series default
+ Shows the actual commands the compiler is executing.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-no-c-code-in-asm
+\begin_inset LatexCommand \index{-\/-no-c-code-in-asm}
+
+\end_inset
+
+
+\series default
+ Hides your ugly and inefficient c-code from the asm file, so you can always
+ blame the compiler :)
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-fverbose-asm
+\begin_inset LatexCommand \index{-\/-no-gen-comments}
+
+\end_inset
+
+
+\series default
+ Include code generator and peep-hole comments in the generated asm files.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-no-peep-comments
+\begin_inset LatexCommand \index{-\/-no-peep-comments}
+
+\end_inset
+
+
+\series default
+ Don't include peep-hole comments in the generated asm files even if -
+\series bold
+
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series default
+-fverbose-asm option is specified.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-i-code-in-asm
+\begin_inset LatexCommand \index{-\/-i-code-in-asm}
+
+\end_inset
+
+
+\series default
+ Include i-codes in the asm file.
+ Sounds like noise but is most helpful for debugging the compiler itself.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-less-pedantic
+\begin_inset LatexCommand \index{pedantic}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{-\/-less-pedantic}
+
+\end_inset
+
+
+\series default
+
+\begin_inset LatexCommand \label{lyx:--less-pedantic}
+
+\end_inset
+
+ Disable some of the more pedantic warnings
+\begin_inset LatexCommand \index{Warnings}
+
+\end_inset
+
+.
+ For more details, see the less_pedantic pragma
+\begin_inset LatexCommand \vpageref{ite:less_pedantic}
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-disable-warning\InsetSpace ~
+<nnnn>
+\begin_inset LatexCommand \index{-\/-disable-warning}
+
+\end_inset
+
+
+\series default
+ Disable specific warning with number <nnnn>.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-Werror
+\begin_inset LatexCommand \index{-\/-Werror}
+
+\end_inset
+
+
+\series default
+ Treat all warnings as errors.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-print-search-dirs
+\begin_inset LatexCommand \index{-\/-print-search-dirs}
+
+\end_inset
+
+
+\series default
+ Display the directories in the compiler's search path
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-vc
+\begin_inset LatexCommand \index{-\/-vc}
+
+\end_inset
+
+
+\series default
+ Display errors and warnings using MSVC style, so you can use SDCC with
+ the visual studio IDE
+\begin_inset LatexCommand \index{IDE}
+
+\end_inset
+
+.
+ With SDCC both offering a GCC-like (the default) and a MSVC-like
+\begin_inset LatexCommand \index{MSVC output style}
+
+\end_inset
+
+ output style, integration into most programming editors should be straightforwa
+rd.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-use-stdout
+\begin_inset LatexCommand \index{-\/-use-stdout}
+
+\end_inset
+
+
+\series default
+ Send errors and warnings to stdout instead of stderr.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-Wa\InsetSpace ~
+asmOption[,asmOption]
+\series default
+
+\begin_inset LatexCommand \index{-Wa asmOption[,asmOption]}
+
+\end_inset
+
+...
+ Pass the asmOption to the assembler
+\begin_inset LatexCommand \index{Options assembler}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Assembler options}
+
+\end_inset
+
+.
+ See file sdcc/as/doc/asxhtm.html for assembler options.cd
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-sdcc89
+\begin_inset LatexCommand \index{-\/-std-sdcc89}
+
+\end_inset
+
+
+\series default
+ Generally follow the C89 standard, but allow SDCC features that conflict
+ with the standard (default).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-c89
+\begin_inset LatexCommand \index{-\/-std-c89}
+
+\end_inset
+
+
+\series default
+ Follow the C89 standard and disable SDCC features that conflict with the
+ standard.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-sdcc99
+\begin_inset LatexCommand \index{-\/-std-sdcc99}
+
+\end_inset
+
+
+\series default
+ Generally follow the C99 standard, but allow SDCC features that conflict
+ with the standard (incomplete support).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-c99
+\begin_inset LatexCommand \index{-\/-std-sdcc99}
+
+\end_inset
+
+
+\series default
+ Follow the C99 standard and disable SDCC features that conflict with the
+ standard (incomplete support).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-codeseg
+\series default
+
+\begin_inset LatexCommand \index{-\/-codeseg <Value>}
+
+\end_inset
+
+\InsetSpace ~
+<Name> The name to be used for the code
+\begin_inset LatexCommand \index{code}
+
+\end_inset
+
+ segment, default CSEG.
+ This is useful if you need to tell the compiler to put the code in a special
+ segment so you can later on tell the linker to put this segment in a special
+ place in memory.
+ Can be used for instance when using bank switching to put the code in a
+ bank.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-constseg
+\series default
+
+\begin_inset LatexCommand \index{-\/-constseg <Value>}
+
+\end_inset
+
+\InsetSpace ~
+<Name> The name to be used for the const
+\begin_inset LatexCommand \index{const}
+
+\end_inset
+
+ segment, default CONST.
+ This is useful if you need to tell the compiler to put the const data in
+ a special segment so you can later on tell the linker to put this segment
+ in a special place in memory.
+ Can be used for instance when using bank switching to put the const data
+ in a bank.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-fdollars-in-identifiers
+\begin_inset LatexCommand \index{-\/-fdollars-in-identifiers}
+
+\end_inset
+
+
+\series default
+ Permit '$' as an identifier character.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-more-pedantic
+\series default
+
+\begin_inset LatexCommand \index{-\/-more-pedantic}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{pedantic}
+
+\end_inset
+
+ Actually this is
+\series bold
+\emph on
+not
+\series default
+\emph default
+ a SDCC compiler option but if you want
+\emph on
+more
+\emph default
+ warnings you can use a separate tool dedicated to syntax checking like
+ splint
+\begin_inset LatexCommand \label{lyx:more-pedantic-SPLINT}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{lint (syntax checking tool)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \url{http://www.splint.org}
+
+\end_inset
+
+.
+ To make your source files parseable by splint you will have to include
+
+\family sans
+lint.h
+\family default
+
+\begin_inset LatexCommand \index{splint (syntax checking tool)}
+
+\end_inset
+
+ in your source file and add brackets around extended keywords (like
+\family sans
+
+\begin_inset Quotes sld
+\end_inset
+
+__at\InsetSpace ~
+
+\series bold
+(
+\series default
+0xab
+\series bold
+)
+\series default
+
+\begin_inset Quotes srd
+\end_inset
+
+
+\family default
+ and
+\family sans
+
+\begin_inset Quotes sld
+\end_inset
+
+__interrupt\InsetSpace ~
+(2)
+\begin_inset Quotes srd
+\end_inset
+
+
+\family default
+).
+
+\newline
+Splint has an excellent on line manual at
+\begin_inset LatexCommand \url{http://www.splint.org/manual/}
+
+\end_inset
+
+ and it's capabilities go beyond pure syntax checking.
+ You'll need to tell splint the location of SDCC's include files so a typical
+ command line could look like this:
+\newline
+
+\family sans
+splint\InsetSpace ~
+-I\InsetSpace ~
+/usr/local/share/sdcc/include/mcs51/\InsetSpace ~
+\InsetSpace ~
+myprogram.c
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-short-is-8bits
+\series default
+
+\begin_inset LatexCommand \index{-\/-short-is-8bits}
+
+\end_inset
+
+
+\begin_inset LatexCommand \label{lyx:--short-is-8bits}
+
+\end_inset
+
+ Treat short as 8-bit (for backward compatibility with older versions of
+ compiler - see section
+\begin_inset LatexCommand \ref{sec:Compatibility-with-previous}
+
+\end_inset
+
+)
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Intermediate Dump Options
+\begin_inset LatexCommand \label{sub:Intermediate-Dump-Options}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Options intermediate dump}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Intermediate dump options}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The following options are provided for the purpose of retargetting and debugging
+ the compiler.
+ They provide a means to dump the intermediate code (iCode
+\begin_inset LatexCommand \index{iCode}
+
+\end_inset
+
+) generated by the compiler in human readable form at various stages of
+ the compilation process.
+ More on iCodes see chapter
+\begin_inset LatexCommand \ref{sub:The-anatomy-of}
+
+\end_inset
+
+
+\begin_inset Quotes srd
+\end_inset
+
+The anatomy of the compiler
+\begin_inset Quotes srd
+\end_inset
+
+.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumpraw
+\begin_inset LatexCommand \index{-\/-dumpraw}
+
+\end_inset
+
+
+\series default
+ This option will cause the compiler to dump the intermediate code into
+ a file of named
+\emph on
+<source filename>.dumpraw
+\emph default
+ just after the intermediate code has been generated for a function, i.e.
+ before any optimizations are done.
+ The basic blocks
+\begin_inset LatexCommand \index{Basic blocks}
+
+\end_inset
+
+ at this stage ordered in the depth first number, so they may not be in
+ sequence of execution.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumpgcse
+\begin_inset LatexCommand \index{-\/-dumpgcse}
+
+\end_inset
+
+
+\series default
+ Will create a dump of iCodes, after global subexpression elimination
+\begin_inset LatexCommand \index{Global subexpression elimination}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumpgcse.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumpdeadcode
+\begin_inset LatexCommand \index{-\/-dumpdeadcode}
+
+\end_inset
+
+
+\series default
+ Will create a dump of iCodes, after deadcode elimination
+\begin_inset LatexCommand \index{Dead-code elimination}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumpdeadcode.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumploop
+\begin_inset LatexCommand \index{-\/-dumploop}
+
+\end_inset
+
+
+\series default
+\size large
+
+\size default
+Will create a dump of iCodes, after loop optimizations
+\begin_inset LatexCommand \index{Loop optimization}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumploop.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumprange
+\begin_inset LatexCommand \index{-\/-dumprange}
+
+\end_inset
+
+
+\series default
+\size large
+
+\size default
+Will create a dump of iCodes, after live range analysis
+\begin_inset LatexCommand \index{Live range analysis}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumprange.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumlrange
+\begin_inset LatexCommand \index{-\/-dumlrange}
+
+\end_inset
+
+
+\series default
+ Will dump the life ranges
+\begin_inset LatexCommand \index{Live range analysis}
+
+\end_inset
+
+ for all symbols.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumpregassign
+\begin_inset LatexCommand \index{-\/-dumpregassign}
+
+\end_inset
+
+
+\bar under
+
+\series default
+\bar default
+Will create a dump of iCodes, after register assignment
+\begin_inset LatexCommand \index{Register assignment}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumprassgn.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumplrange
+\begin_inset LatexCommand \index{-\/-dumplrange}
+
+\end_inset
+
+
+\series default
+ Will create a dump of the live ranges of iTemp's
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumpall
+\begin_inset LatexCommand \index{-\/-dumpall}
+
+\end_inset
+
+
+\size large
+\bar under
+
+\series default
+\size default
+\bar default
+Will cause all the above mentioned dumps to be created.
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Redirecting output on Windows Shells
+\end_layout
+
+\begin_layout Standard
+By default SDCC writes its error messages to
+\begin_inset Quotes sld
+\end_inset
+
+standard error
+\begin_inset Quotes srd
+\end_inset
+
+.
+ To force all messages to
+\begin_inset Quotes sld
+\end_inset
+
+standard output
+\begin_inset Quotes srd
+\end_inset
+
+ use
+\series bold
+-
+\series default
+\emph on
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series bold
+\emph default
+-
+\series default
+use-stdout
+\begin_inset LatexCommand \index{-\/-use-stdout}
+
+\end_inset
+
+.
+ Additionally, if you happen to have visual studio installed in your windows
+ machine, you can use it to compile your sources using a custom build and
+ the SDCC -
+\emph on
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\emph default
+-vc
+\begin_inset LatexCommand \index{-\/-vc}
+
+\end_inset
+
+ option.
+ Something like this should work:
+\newline
+
+\newline
+
+\series bold
+c:
+\backslash
+sdcc
+\backslash
+bin
+\backslash
+sdcc.exe -
+\series default
+\emph on
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series bold
+\emph default
+-vc -
+\series default
+\emph on
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\series bold
+\emph default
+-model-large -c $(InputPath)
+\series default
+
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Environment variables
+\begin_inset LatexCommand \index{Environment variables}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+SDCC recognizes the following environment variables:
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+SDCC_LEAVE_SIGNALS
+\begin_inset LatexCommand \index{SDCC\_LEAVE\_SIGNALS}
+
+\end_inset
+
+
+\series default
+ SDCC installs a signal handler
+\begin_inset LatexCommand \index{signal handler}
+
+\end_inset
+
+ to be able to delete temporary files after an user break (^C) or an exception.
+ If this environment variable is set, SDCC won't install the signal handler
+ in order to be able to debug SDCC.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+TMP,\InsetSpace ~
+TEMP,\InsetSpace ~
+TMPDIR
+\begin_inset LatexCommand \index{TMP, TEMP, TMPDIR}
+
+\end_inset
+
+
+\series default
+ Path, where temporary files will be created.
+ The order of the variables is the search order.
+ In a standard *nix environment these variables are not set, and there's
+ no need to set them.
+ On Windows it's recommended to set one of them.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+SDCC_HOME
+\begin_inset LatexCommand \index{SDCC\_HOME}
+
+\end_inset
+
+
+\series default
+ Path, see section
+\begin_inset LatexCommand \ref{sub:Install-paths}
+
+\end_inset
+
+\InsetSpace ~
+
+\begin_inset Quotes sld
+\end_inset
+
+ Install Paths
+\begin_inset Quotes srd
+\end_inset
+
+.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+SDCC_INCLUDE
+\begin_inset LatexCommand \index{SDCC\_INCLUDE}
+
+\end_inset
+
+
+\series default
+ Path, see section
+\begin_inset LatexCommand \ref{sub:Search-Paths}
+
+\end_inset
+
+\InsetSpace ~
+
+\begin_inset Quotes sld
+\end_inset
+
+Search Paths
+\begin_inset Quotes srd
+\end_inset
+
+.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+SDCC_LIB
+\begin_inset LatexCommand \index{SDCC\_LIB}
+
+\end_inset
+
+
+\series default
+ Path, see section
+\begin_inset LatexCommand \ref{sub:Search-Paths}
+
+\end_inset
+
+\InsetSpace ~
+
+\begin_inset Quotes sld
+\end_inset
+
+Search Paths
+\begin_inset Quotes srd
+\end_inset
+
+..
+\end_layout
+
+\begin_layout Standard
+There are some more environment variables recognized by SDCC, but these
+ are solely used for debugging purposes.
+ They can change or disappear very quickly, and will never be documented.
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Storage Class Language Extensions
+\end_layout
+
+\begin_layout Subsection
+MCS51/DS390 Storage Class
+\begin_inset LatexCommand \index{Storage class}
+
+\end_inset
+
+ Language Extensions
+\end_layout
+
+\begin_layout Standard
+In addition to the ANSI storage classes SDCC allows the following MCS51
+ specific storage classes:
+\end_layout
+
+\begin_layout Subsubsection
+data
+\begin_inset LatexCommand \index{data (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_data (mcs51, ds390 storage class)}
+
+\end_inset
+
+ / near
+\begin_inset LatexCommand \index{near (storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_near (storage class)}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This is the
+\series bold
+default
+\series default
+ storage class for the Small Memory model (
+\emph on
+data
+\emph default
+ and
+\emph on
+near
+\emph default
+ or the more ANSI-C compliant forms
+\emph on
+__data
+\emph default
+ and
+\emph on
+__near
+\emph default
+ can be used synonymously).
+ Variables declared with this storage class will be allocated in the directly
+ addressable portion of the internal RAM of a 8051, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__data unsigned char test_data;
+\end_layout
+
+\begin_layout Standard
+Writing 0x01 to this variable generates the assembly code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+75*00 01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov\InsetSpace ~
+\InsetSpace ~
+_test_data,#0x01
+\end_layout
+
+\begin_layout Subsubsection
+xdata
+\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_xdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+ / far
+\begin_inset LatexCommand \index{far (storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_far (storage class)}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Variables declared with this storage class will be placed in the external
+ RAM.
+ This is the
+\series bold
+default
+\series default
+ storage class for the Large Memory model, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__xdata unsigned char test_xdata;
+\end_layout
+
+\begin_layout Standard
+Writing 0x01 to this variable generates the assembly code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+90s00r00\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov\InsetSpace ~
+\InsetSpace ~
+dptr,#_test_xdata
+\newline
+74\InsetSpace ~
+01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov\InsetSpace ~
+\InsetSpace ~
+a,#0x01
+\newline
+F0\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+movx\InsetSpace ~
+@dptr,a
+\end_layout
+
+\begin_layout Subsubsection
+idata
+\begin_inset LatexCommand \index{idata (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_idata (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Variables declared with this storage class will be allocated into the indirectly
+ addressable portion of the internal ram of a 8051, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__idata unsigned char test_idata;
+\end_layout
+
+\begin_layout Standard
+Writing 0x01 to this variable generates the assembly code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+78r00\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov\InsetSpace ~
+\InsetSpace ~
+r0,#_test_idata
+\newline
+76\InsetSpace ~
+01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov\InsetSpace ~
+\InsetSpace ~
+@r0,#0x01
+\end_layout
+
+\begin_layout Standard
+Please note, the first 128 byte of idata physically access the same RAM
+ as the data memory.
+ The original 8051 had 128 byte idata memory, nowadays most devices have
+ 256 byte idata memory.
+ The stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset
+
+ is located in idata memory.
+\end_layout
+
+\begin_layout Subsubsection
+pdata
+\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_pdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Paged xdata access is just as straightforward as using the other addressing
+ modes of a 8051.
+ It is typically located at the start of xdata and has a maximum size of
+ 256 bytes.
+ The following example writes 0x01 to the pdata variable.
+ Please note, pdata access physically accesses xdata memory.
+ The high byte of the address is determined by port P2
+\begin_inset LatexCommand \index{P2 (mcs51 sfr)}
+
+\end_inset
+
+(or in case of some 8051 variants by a separate Special Function Register,
+ see section
+\begin_inset LatexCommand \ref{sub:MCS51-variants}
+
+\end_inset
+
+).
+ This is the
+\series bold
+default
+\series default
+ storage class for the Medium Memory model, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__pdata unsigned char test_pdata;
+\end_layout
+
+\begin_layout Standard
+Writing 0x01 to this variable generates the assembly code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+78r00\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov r0,#_test_pdata
+\newline
+74 01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov a,#0x01
+\newline
+F2\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+movx @r0,a
+\end_layout
+
+\begin_layout Standard
+If the -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xstack
+\begin_inset LatexCommand \index{-\/-xstack}
+
+\end_inset
+
+ option is used the pdata memory area is followed by the xstack memory area
+ and the sum of their sizes is limited to 256 bytes.
+\end_layout
+
+\begin_layout Subsubsection
+code
+\begin_inset LatexCommand \index{code}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_code}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+'Variables' declared with this storage class will be placed in the code
+ memory:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__code unsigned char test_code;
+\end_layout
+
+\begin_layout Standard
+Read access to this variable generates the assembly code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+90s00r6F\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov dptr,#_test_code
+\newline
+E4\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+clr a
+\newline
+93\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+movc a,@a+dptr
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+char
+\family default
+ indexed arrays of characters in code memory can be accessed efficiently:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__code char test_array[] = {'c','h','e','a','p'};
+\end_layout
+
+\begin_layout Standard
+Read access to this array using an 8-bit unsigned index generates the assembly
+ code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+E5*00\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov a,_index
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+90s00r41\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov dptr,#_test_array
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+93\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+movc a,@a+dptr
+\end_layout
+
+\begin_layout Subsubsection
+bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_bit}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This is a data-type and a storage class specifier.
+ When a variable is declared as a bit, it is allocated into the bit addressable
+ memory of 8051, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__bit test_bit;
+\end_layout
+
+\begin_layout Standard
+Writing 1 to this variable generates the assembly code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+D2*00\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+setb\InsetSpace ~
+_test_bit
+\end_layout
+
+\begin_layout Standard
+The bit addressable memory consists of 128 bits which are located from 0x20
+ to 0x2f in data memory.
+
+\newline
+Apart from this 8051 specific storage class most architectures support
+ ANSI-C bitfields
+\begin_inset LatexCommand \index{bitfields}
+
+\end_inset
+
+
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+Not really meant as examples, but nevertheless showing what bitfields are
+ about: device/include/mc68hc908qy.h and support/regression/tests/bitfields.c
+\end_layout
+
+\end_inset
+
+.
+ In accordance with ISO/IEC 9899 bits and bitfields without an explicit
+ signed modifier are implemented as unsigned.
+\end_layout
+
+\begin_layout Subsubsection
+sfr
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_sfr}
+
+\end_inset
+
+ / sfr16
+\begin_inset LatexCommand \index{sfr16}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_sfr16}
+
+\end_inset
+
+ / sfr32
+\begin_inset LatexCommand \index{sfr32}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_sfr32}
+
+\end_inset
+
+ / sbit
+\begin_inset LatexCommand \index{\_\_sbit}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{sbit}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Like the bit keyword,
+\emph on
+sfr / sfr16 / sfr32 / sbit
+\emph default
+signify both a data-type and storage class, they are used to describe the
+
+\emph on
+s
+\emph default
+pecial
+\emph on
+f
+\emph default
+unction
+\emph on
+r
+\emph default
+egisters and
+\emph on
+s
+\emph default
+pecial
+\emph on
+bit
+\emph default
+ variables of a 8051, eg:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__sfr __at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_at}
+
+\end_inset
+
+ (0x80) P0;\InsetSpace ~
+ /* special function register P0 at location 0x80 */
+\newline
+
+\newline
+/* 16 bit
+ special function register combination for timer 0
+\newline
+\InsetSpace ~
+\InsetSpace ~
+ with the high byte at
+ location 0x8C and the low byte at location 0x8A */
+\newline
+__sfr16 __at (0x8C8A)
+ TMR0;
+\newline
+
+\newline
+__sbit __at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_at}
+
+\end_inset
+
+ (0xd7) CY;\InsetSpace ~
+ /* CY (Carry Flag
+\begin_inset LatexCommand \index{Flags}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Carry flag}
+
+\end_inset
+
+) */
+\end_layout
+
+\begin_layout Standard
+Special function registers which are located on an address dividable by
+ 8 are bit-addressable, an
+\emph on
+ sbit
+\emph default
+ addresses a specific bit within these sfr.
+\newline
+16 Bit and 32 bit special function
+ register combinations which require a certain access order are better not
+ declared using
+\emph on
+sfr16
+\emph default
+ or
+\emph on
+sfr32.
+
+\emph default
+ Allthough SDCC usually accesses them Least Significant Byte (LSB) first,
+ this is not guaranteed.
+\newline
+
+\end_layout
+
+\begin_layout Standard
+Please note, if you use a header file which was written for another compiler
+ then the sfr / sfr16 / sfr32 / sbit Storage Class extensions will most
+ likely be
+\emph on
+not
+\emph default
+compatible.
+ Specifically the syntax
+\family typewriter
+\InsetSpace ~
+sfr P0 = 0x80;\InsetSpace ~
+
+\family default
+ is compiled
+\emph on
+without warning
+\emph default
+ by SDCC to an assignment of 0x80 to a variable called P0
+\family typewriter
+
+\begin_inset Marginal
+status collapsed
+
+\begin_layout Standard
+
+\series bold
+\InsetSpace ~
+!
+\end_layout
+
+\end_inset
+
+.
+
+\family default
+Nevertheless it is possible to write header files
+\begin_inset LatexCommand \index{Header files}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Include files}
+
+\end_inset
+
+ which can be shared among different compilers (see section
+\begin_inset LatexCommand \ref{sec:Porting-code-to-other-compilers}
+
+\end_inset
+
+).
+
+\end_layout
+
+\begin_layout Subsubsection
+Pointers
+\begin_inset LatexCommand \index{Pointer}
+
+\end_inset
+
+ to MCS51/DS390 specific memory spaces
+\end_layout
+
+\begin_layout Standard
+SDCC allows (via language extensions) pointers to explicitly point to any
+ of the memory spaces
+\begin_inset LatexCommand \index{Memory model}
+
+\end_inset
+
+ of the 8051.
+ In addition to the explicit pointers, the compiler uses (by default) generic
+ pointers which can be used to point to any of the memory spaces.
+\newline
+
+\newline
+Pointer
+ declaration examples:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+/* pointer physically in internal ram pointing to object in external ram
+ */
+\newline
+__xdata unsigned char * __data p;
+\newline
+
+\newline
+/* pointer physically in external ram
+ pointing to object in internal ram */
+\newline
+__data unsigned char * __xdata p;
+\newline
+
+\newline
+/*
+ pointer physically in code rom pointing to data in xdata space */
+\newline
+__xdata
+ unsigned char * __code p;
+\newline
+
+\newline
+/* pointer physically in code space pointing to
+ data in code space */
+\newline
+__code unsigned char * __code p;
+\newline
+
+\newline
+/* generic pointer
+ physically located in xdata space */
+\newline
+unsigned char * __xdata p;
+\newline
+
+\newline
+/* generic
+ pointer physically located in default memory space */
+\newline
+unsigned char * p;
+\newline
+
+\newline
+/*
+ the following is a function pointer
+\begin_inset LatexCommand \index{function pointer}
+
+\end_inset
+
+ physically located in data space */
+\newline
+char (* __data fp)(void);
+\end_layout
+
+\begin_layout Standard
+Well you get the idea.
+
+\newline
+
+\newline
+All unqualified pointers are treated as 3-byte (4-byte for the ds390)
+\emph on
+generic
+\emph default
+ pointers.
+
+\size small
+
+\newline
+
+\newline
+
+\size default
+The highest order byte of the
+\emph on
+generic
+\emph default
+ pointers contains the data space information.
+ Assembler support routines are called whenever data is stored or retrieved
+ using
+\emph on
+generic
+\emph default
+ pointers.
+ These are useful for developing reusable library
+\begin_inset LatexCommand \index{Libraries}
+
+\end_inset
+
+ routines.
+ Explicitly specifying the pointer
+\begin_inset LatexCommand \index{pointer}
+
+\end_inset
+
+ type will generate the most efficient code.
+\end_layout
+
+\begin_layout Subsubsection
+Notes on MCS51 memory
+\begin_inset LatexCommand \index{MCS51 memory}
+
+\end_inset
+
+ layout
+\end_layout
+
+\begin_layout Standard
+The 8051 family of microcontrollers have a minimum of 128 bytes of internal
+ RAM memory which is structured as follows:
+\newline
+
+\newline
+- Bytes 00-1F - 32 bytes to hold
+ up to 4 banks of the registers R0 to R7,
+\newline
+- Bytes 20-2F - 16 bytes to hold
+ 128 bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset
+
+ variables and,
+\newline
+- Bytes 30-7F - 80 bytes for general purpose use.
+\newline
+
+\end_layout
+
+\begin_layout Standard
+Additionally some members of the MCS51 family may have up to 128 bytes of
+ additional, indirectly addressable, internal RAM memory (
+\emph on
+idata
+\emph default
+
+\begin_inset LatexCommand \index{idata (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_idata (mcs51, ds390 storage class)}
+
+\end_inset
+
+).
+ Furthermore, some chips may have some built in external memory (
+\emph on
+xdata
+\emph default
+
+\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_xdata (mcs51, ds390 storage class)}
+
+\end_inset
+
+) which should not be confused with the internal, directly addressable RAM
+ memory (
+\emph on
+data
+\emph default
+
+\begin_inset LatexCommand \index{data (mcs51, ds390 storage class)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_data (mcs51, ds390 storage class)}
+
+\end_inset
+
+).
+ Sometimes this built in
+\emph on
+xdata
+\emph default
+ memory has to be activated before using it (you can probably find this
+ information on the datasheet of the microcontroller your are using, see
+ also section
+\begin_inset LatexCommand \ref{sub:Startup-Code}
+
+\end_inset
+
+\InsetSpace ~
+Startup-Code).
+\end_layout
+
+\begin_layout Standard
+Normally SDCC will only use the first bank
+\begin_inset LatexCommand \index{register bank (mcs51, ds390)}
+
+\end_inset
+
+ of registers (register bank 0), but it is possible to specify that other
+ banks of registers (keyword
+\emph on
+using
+\emph default
+
+\emph on
+
+\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_using (mcs51, ds390 register bank)}
+
+\end_inset
+
+
+\emph default
+) should be used for example in interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_interrupt}
+
+\end_inset
+
+ routines.
+ By default, the compiler will place the stack after the last byte of allocated
+ memory for variables.
+ For example, if the first 2 banks of registers are used, and only four
+ bytes are used for
+\emph on
+data
+\emph default
+ variables, it will position the base of the internal stack at address 20
+ (0x14).
+ This implies that as the stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset
+
+ grows, it will use up the remaining register banks, and the 16 bytes used
+ by the 128 bit variables, and 80 bytes for general purpose use.
+ If any bit variables are used, the data variables will be placed in unused
+ register banks and after the byte holding the last bit variable.
+ For example, if register banks 0 and 1 are used, and there are 9 bit variables
+ (two bytes used),
+\emph on
+data
+\emph default
+ variables will be placed starting from address 0x10 to 0x20 and continue
+ at address 0x22.
+ You can also use -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-data-loc
+\begin_inset LatexCommand \index{-\/-data-loc <Value>}
+
+\end_inset
+
+ to specify the start address of the
+\emph on
+data
+\emph default
+ and -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-iram-size
+\begin_inset LatexCommand \index{-\/-iram-size <Value>}
+
+\end_inset
+
+ to specify the size of the total internal RAM (
+\emph on
+data
+\emph default
++
+\emph on
+idata
+\emph default
+).
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+By default the 8051 linker will place the stack after the last byte of (i)data
+ variables.
+ Option -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-loc
+\begin_inset LatexCommand \index{-\/-stack-loc <Value>}
+
+\end_inset
+
+ allows you to specify the start of the stack, i.e.
+ you could start it after any data in the general purpose area.
+ If your microcontroller has additional indirectly addressable internal
+ RAM (
+\emph on
+idata
+\emph default
+) you can place the stack on it.
+ You may also need to use -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xdata-loc
+\begin_inset LatexCommand \index{-\/-xdata-loc<Value>}
+
+\end_inset
+
+ to set the start address of the external RAM (
+\emph on
+xdata
+\emph default
+) and -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-xram-size
+\begin_inset LatexCommand \index{-\/-xram-size <Value>}
+
+\end_inset
+
+ to specify its size.
+ Same goes for the code memory, using -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-code-loc
+\begin_inset LatexCommand \index{-\/-code-loc <Value>}
+
+\end_inset
+
+ and -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-code-size
+\begin_inset LatexCommand \index{-\/-code-size <Value>}
+
+\end_inset
+
+.
+ If in doubt, don't specify any options and see if the resulting memory
+ layout is appropriate, then you can adjust it.
+\end_layout
+
+\begin_layout Standard
+The linker generates two files with memory allocation information.
+ The first, with extension .map
+\begin_inset LatexCommand \index{<file>.map}
+
+\end_inset
+
+ shows all the variables and segments.
+ The second with extension .mem
+\begin_inset LatexCommand \index{<file>.mem}
+
+\end_inset
+
+ shows the final memory layout.
+ The linker will complain either if memory segments overlap, there is not
+ enough memory, or there is not enough space for stack.
+ If you get any linking warnings and/or errors related to stack or segments
+ allocation, take a look at either the .map or .mem files to find out what
+ the problem is.
+ The .mem file may even suggest a solution to the problem.
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Z80/Z180 Storage Class
+\begin_inset LatexCommand \index{Z80!Storage class}
+
+\end_inset
+
+ Language Extensions
+\end_layout
+
+\begin_layout Subsubsection
+sfr
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_sfr}
+
+\end_inset
+
+ (in/out to 8-bit addresses)
+\end_layout
+
+\begin_layout Standard
+The Z80
+\begin_inset LatexCommand \index{Z80}
+
+\end_inset
+
+ family has separate address spaces for memory and
+\emph on
+i
+\emph default
+nput/
+\emph on
+o
+\emph default
+utput memory.
+ I/O memory
+\begin_inset LatexCommand \index{I/O memory (Z80, Z180)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Z80!I/O memory}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Z180!I/O memory}
+
+\end_inset
+
+ is accessed with special instructions, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+sfr at 0x78 IoPort;\InsetSpace ~
+\InsetSpace ~
+/* define a var in I/O space at 78h called IoPort */
+
+\end_layout
+
+\begin_layout Standard
+Writing 0x01 to this variable generates the assembly code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+3E 01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ld a,#0x01
+\newline
+D3 78\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+out (_IoPort),a
+\end_layout
+
+\begin_layout Subsubsection
+banked sfr
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_sfr}
+
+\end_inset
+
+ (in/out to 16-bit addresses)
+\end_layout
+
+\begin_layout Standard
+The keyword
+\emph on
+banked
+\emph default
+ is used to support 16 bit addresses in I/O memory e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+sfr banked at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_at}
+
+\end_inset
+
+ 0x123 IoPort;
+\end_layout
+
+\begin_layout Standard
+Writing 0x01 to this variable generates the assembly code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+01 23 01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ld bc,#_IoPort
+\newline
+3E 01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ld a,#0x01
+\newline
+ED 79\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+out (c),a
+\end_layout
+
+\begin_layout Subsubsection
+sfr
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset