-#LyX 1.2 created this file. For more info see http://www.lyx.org/
-\lyxformat 220
+#LyX 1.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 221
\textclass article
\begin_preamble
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
+\date{}
\end_preamble
\language english
\inputencoding default
\spacing single
\papersize Default
\paperpackage a4
-\use_geometry 0
+\use_geometry 1
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
+\leftmargin 30mm
+\topmargin 10mm
+\rightmargin 25mm
+\bottommargin 15mm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\layout Comment
Please note: double dashed longoptions (e.g.
- --version) need three dashes in this document to be visable in html and
- pdf output.
+ --version) are written this way: -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-
+\layout Comment
+
+Two resp.
+ three consecutive dashes simply result in a long resp.
+ extra long dash.
\layout Title
SDCC Compiler User Guide
\layout Standard
+\align center
+2003-05-28
+\layout Standard
\begin_inset LatexCommand \tableofcontents{}
Sandeep Dutta
\series default
designed for 8 bit Microprocessors.
- The current version targets Intel MCS51 based Microprocessors(8051,8052,
- etc), Zilog Z80 based MCUs, and the Dallas DS80C390 variant.
+ The current version targets Intel MCS51 based Microprocessors (8031, 8032,
+ 8051, 8052
+\begin_inset LatexCommand \index{8031, 8032, 8051, 8052 CPU}
+
+\end_inset
+
+, etc), Zilog Z80 based MCUs, and the Dallas DS80C390 variant.
It can be retargetted for other microprocessors, support for PIC, AVR and
186 is under development.
The entire source code for the compiler is distributed under GPL.
\newline
\newline
-SDCC also provides an option (--cyclomatic) to report the relative complexity
- of a function.
+SDCC also provides an option (-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-cyclomatic) to report the relative complexity of a function.
These functions can then be further optimized, or hand coded in assembly
if needed.
\end_inset
+.
\series bold
+
+\series default
+\emph on
+Please note: the compiler will probably always be some steps ahead of this
+ documentation
+\series bold
+\emph default
+
+\begin_inset LatexCommand \index{Status of documentation}
+
+\end_inset
+
+
+\begin_inset Foot
+collapsed false
+
+\layout Standard
+
+Obviously this has pros and cons
+\end_inset
+
.
\layout Subsection
\newline
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License
-\begin_inset LatexCommand \index{GNU General Public License}
-
-\end_inset
-
-
-\begin_inset LatexCommand \index{GPL}
+\begin_inset LatexCommand \index{GNU General Public License, GPL}
\end_inset
as published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE.
+ ANY WARRANTY; without even the implied warranty
+\begin_inset LatexCommand \index{warranty}
+
+\end_inset
+
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, 59 Temple
\layout Subsection
Typographic conventions
+\begin_inset LatexCommand \index{Typographic conventions}
+
+\end_inset
+
+
\layout Standard
Throughout this manual, we will use the following convention.
This version has numerous bug fixes compared with the previous version.
But we also introduced some incompatibilities with older versions.
Not just for the fun of it, but to make the compiler more stable, efficient
- and ANSI compliant.
+ and ANSI compliant
+\begin_inset LatexCommand \index{ANSI-compliance}
+
+\end_inset
+
+.
\newline
will push a as an int and as a char resp.
\layout Itemize
-option ---regextend has been removed
+option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-regextend has been removed
\layout Itemize
-option ---noregparms has been removed
+option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noregparms has been removed
\layout Itemize
-option ---stack-after-data has been removed
+option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-after-data has been removed
\layout Standard
their own documentation and can be found in the source distribution.
If you want the latest unreleased software, the complete source package
is available directly by anonymous CVS on cvs.sdcc.sourceforge.net.
+\layout Comment
+
+ANSI C reference / related tools / recommended reading / compiler building:
+ Muchnik?
\layout Subsection
Wishes for the future
char KernelFunction3(char p) at 0x340;
\newline
+\layout Standard
+
+
+\family typewriter
+code banking
+\begin_inset LatexCommand \index{code banking (not supported)}
+
+\end_inset
+
+ support for mcs51
\newline
\family default
-If you can think of some more, please send them to the list.
+If you can think of some more, please see the chapter 9 about filing feature
+ requests
+\begin_inset LatexCommand \index{Requesting features}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Feature requests}
+
+\end_inset
+
+.
\newline
\layout Section
-
+\pagebreak_top
Installation
\begin_inset LatexCommand \index{Installation}
\layout Subsection
Configure Options
-\begin_inset LatexCommand \index{Configure Options}
+\begin_inset LatexCommand \index{Options SDCC configuration}
\end_inset
\layout List
\labelwidthstring 00.00.0000
----prefix see tabel below
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-prefix see tabel below
\layout List
\labelwidthstring 00.00.0000
----exec_prefix see tabel below
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-exec_prefix see tabel below
\layout List
\labelwidthstring 00.00.0000
----bindir see tabel below
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-bindir see tabel below
\layout List
\labelwidthstring 00.00.0000
----datadir see tabel below
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-datadir see tabel below
\layout List
\labelwidthstring 00.00.0000
\layout List
\labelwidthstring 00.00.0000
----disable-mcs51-port Excludes the Intel mcs51 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-mcs51-port Excludes the Intel mcs51 port
\layout List
\labelwidthstring 00.00.0000
----disable-gbz80-port Excludes the Gameboy gbz80 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-gbz80-port Excludes the Gameboy gbz80 port
\layout List
\labelwidthstring 00.00.0000
----disable-z80-port Excludes the z80 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-z80-port Excludes the z80 port
\layout List
\labelwidthstring 00.00.0000
----disable-avr-port Excludes the AVR port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-avr-port Excludes the AVR port
\layout List
\labelwidthstring 00.00.0000
----disable-ds390-port Excludes the DS390 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-ds390-port Excludes the DS390 port
\layout List
\labelwidthstring 00.00.0000
----disable-pic-port Excludes the PIC port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-pic-port Excludes the PIC port
\layout List
\labelwidthstring 00.00.0000
----disable-xa51-port Excludes the XA51 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-xa51-port Excludes the XA51 port
\layout List
\labelwidthstring 00.00.0000
----disable-ucsim Disables configuring and building of ucsim
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-ucsim Disables configuring and building of ucsim
\layout List
\labelwidthstring 00.00.0000
----disable-device-lib-build Disables automatically building device libraries
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-device-lib-build Disables automatically building device libraries
\layout List
\labelwidthstring 00.00.0000
----disable-packihx Disables building packihx
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-packihx Disables building packihx
\layout List
\labelwidthstring 00.00.0000
----enable-libgc Use the Bohem memory allocator.
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-enable-libgc Use the Bohem memory allocator.
Lower runtime footprint.
\layout Standard
Furthermore the environment variables CC, CFLAGS, ...
the tools and their arguments can be influenced.
- Please see `configure ---help` and the man/info pages of `configure` for
- details.
+ Please see `configure -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-help` and the man/info pages of `configure` for details.
\newline
\newline
\begin_inset Tabular
<lyxtabular version="3" rows="8" columns="3">
<features>
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features>
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
./configure
\layout LyX-Code
-./configure ---prefix=
+./configure --prefix=
\begin_inset Quotes srd
\end_inset
\begin_inset Quotes srd
\end_inset
- ---datadir=
+ --datadir=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
-./configure ---disable-avr-port ---disable-xa51-port
+./configure --disable-avr-port --disable-xa51-port
\layout Standard
To crosscompile on linux for Mingw32 (see also 'sdcc/support/scripts/sdcc_mingw3
\layout LyX-Code
- ---prefix=
+ --prefix=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
- ---datadir=
+ --datadir=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
- ---disable-device-lib-build
+ --disable-device-lib-build
\backslash
\layout LyX-Code
- ---disable-ucsim
+ --disable-ucsim
\backslash
\layout LyX-Code
- ---host=i586-mingw32msvc ---build=unknown-unknown-linux-gnu
+ --host=i586-mingw32msvc --build=unknown-unknown-linux-gnu
\layout Standard
To
\layout LyX-Code
- ---prefix=
+ --prefix=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
- ---datadir=
+ --datadir=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
- ---disable-ucsim
+ --disable-ucsim
\layout Standard
'configure' is quite slow on Cygwin (at least on windows before Win2000/XP).
- The option '--C' turns on caching, which gives a little bit extra speed.
+ The option '-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-C' turns on caching, which gives a little bit extra speed.
However if options are changed, it can be necessary to delete the config.cache
file.
\layout Subsection
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
<lyxtabular version="3" rows="2" columns="3">
<features>
<column alignment="block" valignment="top" leftline="true" width="1.6in">
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Subsection
Search Paths
-\begin_inset LatexCommand \index{Search Paths}
+\begin_inset LatexCommand \index{Search path}
\end_inset
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features>
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" width="0in">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
<features>
<column alignment="block" valignment="top" leftline="true" width="1.5in">
<column alignment="block" valignment="top" leftline="true" width="1.5in">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
----I dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-I dir
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\layout Standard
----I dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-I dir
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\layout Standard
----I dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-I dir
\end_inset
</cell>
</row>
\newline
\newline
- The option ---nostdinc disables the last two search paths.
+ The option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nostdinc disables the last two search paths.
\newline
\newline
\begin_inset Quotes sld
\end_inset
----L dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-L dir
\begin_inset Quotes srd
\end_inset
<lyxtabular version="3" rows="6" columns="3">
<features>
<column alignment="block" valignment="top" leftline="true" width="1.7in">
-<column alignment="left" valignment="top" leftline="true" width="1.2in">
+<column alignment="block" valignment="top" leftline="true" width="1.2in">
<column alignment="block" valignment="top" leftline="true" rightline="true" width="1.2in">
<row topline="true" bottomline="true">
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\layout Standard
----L dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-L dir
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\layout Standard
----L dir
-\end_inset
-</cell>
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-L dir
+\end_inset
+</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
----L dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-L dir
\end_inset
</cell>
</row>
\SpecialChar ~
\newline
-The option ---nostdlib disables the last two search paths.
+The option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nostdlib disables the last two search paths.
\layout Subsection
Building SDCC
Type
\family sans
\series bold
-"sdcc ---version"
+"sdcc -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-version"
\begin_inset LatexCommand \index{version}
\end_inset
\layout Subsection
Install Trouble-shooting
-\begin_inset LatexCommand \index{Install Trouble-shooting}
+\begin_inset LatexCommand \index{Install trouble-shooting}
\end_inset
the assembler and linkage editor.
\layout Subsubsection
-sdcpp - The C-Preprocessor
+sdcpp
+\begin_inset LatexCommand \index{sdcpp}
+
+\end_inset
+
+ - The C-Preprocessor
\layout Standard
The preprocessor is a modified version of the GNU preprocessor.
\layout Subsubsection
s51 - The Simulator
-\begin_inset LatexCommand \index{s51 - The Simulator}
+\begin_inset LatexCommand \index{s51}
\end_inset
XA51 family.
\layout Subsubsection
-sdcdb - Source Level Debugger
-\layout Standard
-
+sdcdb
+\begin_inset LatexCommand \index{sdcdb}
-\family typewriter
-\shape italic
-<todo: is this thing still alive?>
-\newline
+\end_inset
-\newline
+ - Source Level Debugger
+\layout Standard
-\family default
-\shape default
Sdcdb is the companion source level debugger.
The current version of the debugger uses Daniel's Simulator S51, but can
be easily changed to use other simulators.
\layout Section
-
+\pagebreak_top
Using SDCC
\layout Subsection
\series default
This will compile, assemble and link your source file.
Output files are as follows
-\newline
+\layout Itemize
-\newline
sourcefile.asm
\begin_inset LatexCommand \index{.asm}
\end_inset
- - Assembler source file created by the compiler
-\newline
+ - Assembler source
+\begin_inset LatexCommand \index{Assembler source}
+
+\end_inset
+
+ file created by the compiler
+\layout Itemize
+
sourcefile.lst
\begin_inset LatexCommand \index{.lst}
\end_inset
- - Assembler listing file created by the Assembler
-\newline
+ - Assembler listing
+\begin_inset LatexCommand \index{Assembler listing}
+
+\end_inset
+
+ file created by the Assembler
+\layout Itemize
+
sourcefile.rst
\begin_inset LatexCommand \index{.rst}
\end_inset
- - Assembler listing file updated with linkedit information, created by
- linkage editor
-\newline
+ - Assembler listing
+\begin_inset LatexCommand \index{Assembler listing}
+
+\end_inset
+
+ file updated with linkedit information, created by linkage editor
+\layout Itemize
+
sourcefile.sym
\begin_inset LatexCommand \index{.sym}
\end_inset
- - symbol listing for the sourcefile, created by the assembler
-\newline
+ - symbol listing
+\begin_inset LatexCommand \index{Symbol listing}
+
+\end_inset
+
+ for the sourcefile, created by the assembler
+\layout Itemize
+
sourcefile.rel
\begin_inset LatexCommand \index{.rel}
\end_inset
- - Object file created by the assembler, input to Linkage editor
-\newline
+ - Object file
+\begin_inset LatexCommand \index{Object file}
+
+\end_inset
+
+ created by the assembler, input to Linkage editor
+\layout Itemize
+
sourcefile.map
\begin_inset LatexCommand \index{.map}
\end_inset
- - The memory map for the load module, created by the Linker
-\newline
+ - The memory map
+\begin_inset LatexCommand \index{Memory map}
+
+\end_inset
+
+ for the load module, created by the Linker
+\layout Itemize
+
sourcefile.mem
\begin_inset LatexCommand \index{.mem}
\end_inset
- - A file with a summary of the memory ussage
-\newline
+ - A file with a summary of the memory usage
+\layout Itemize
+
sourcefile.ihx
\begin_inset LatexCommand \index{.ihx}
\end_inset
- - The load module in Intel hex format (you can select the Motorola S19
- format with ---out-fmt-s19)
-\newline
+ - 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
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-out-fmt-s19
+\begin_inset LatexCommand \index{-\/-out-fmt-s19}
+
+\end_inset
+
+.
+ If you need another format you might want to use objdump
+\begin_inset LatexCommand \index{objdump}
+
+\end_inset
+
+ or srecord
+\begin_inset LatexCommand \index{srecord}
+
+\end_inset
+
+)
+\layout Itemize
+
sourcefile.adb
\begin_inset LatexCommand \index{.adb}
\end_inset
- An intermediate file containing debug information needed to create the
- .cdb file (with ---debug)
-\newline
+ .cdb file (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug
+\begin_inset LatexCommand \index{-\/-debug}
+
+\end_inset
+
+)
+\layout Itemize
+
sourcefile.cdb
\begin_inset LatexCommand \index{.cdb}
\end_inset
- - An optional file (with ---debug) containing debug information
-\newline
+ - An optional file (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug) containing debug information
+\layout Itemize
+
sourcefile.
- (no extension)
\begin_inset LatexCommand \index{. (no extension)}
\end_inset
- An optional AOMF51 file containing debug information (with ---debug)
-\newline
+ An optional AOMF51 file containing debug information (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug)
+\layout Itemize
+
sourcefile.dump*
\begin_inset LatexCommand \index{.dump*}
\end_inset
- - Dump file to debug the compiler it self (with ---dumpall) (see section
-
+ - Dump file to debug the compiler it self (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpall) (see section
\begin_inset Quotes sld
\end_inset
\emph on
main()
\emph default
- function and link the files together with the following command:
+ function and link
+\begin_inset LatexCommand \index{Linker}
+
+\end_inset
+
+ the files together with the following command:
\newline
\newline
\family default
\series default
+\begin_inset LatexCommand \index{.rel}
+
+\end_inset
+
+
\newline
\newline
\layout Subsubsection
Processor Selection Options
-\begin_inset LatexCommand \index{Processor Selection Options}
+\begin_inset LatexCommand \index{Options processor selection}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Processor selection options}
\end_inset
\series default
- Generate code for the MCS51 (8051) family of processors.
+ Generate code for the MCS51
+\begin_inset LatexCommand \index{MCS51}
+
+\end_inset
+
+ family of processors.
This is the default processor target.
\layout List
\labelwidthstring 00.00.0000
\series default
- Generate code for the DS80C390 processor.
+ Generate code for the DS80C390
+\begin_inset LatexCommand \index{DS80C390}
+
+\end_inset
+
+ processor.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-mds400
+\begin_inset LatexCommand \index{-mds400}
+
+\end_inset
+
+
+\series default
+ Generate code for the DS80C400
+\begin_inset LatexCommand \index{DS80C400}
+
+\end_inset
+
+ processor.
\layout List
\labelwidthstring 00.00.0000
\series default
- Generate code for the Z80 family of processors.
+ Generate code for the Z80
+\begin_inset LatexCommand \index{Z80}
+
+\end_inset
+
+ family of processors.
\layout List
\labelwidthstring 00.00.0000
\series default
- Generate code for the GameBoy Z80 processor.
+ Generate code for the GameBoy Z80
+\begin_inset LatexCommand \index{GameBoy Z80}
+
+\end_inset
+
+ processor.
\layout List
\labelwidthstring 00.00.0000
\series default
- Generate code for the Atmel AVR processor (In development, not complete).
+ Generate code for the Atmel AVR
+\begin_inset LatexCommand \index{AVR}
+
+\end_inset
+
+ processor (In development, not complete).
+ AVR users should probably have a look at avr-gcc
+\begin_inset LatexCommand \url[FIXME: official URL?]{ http://savannah.nongnu.org/download/avr-libc/snapshots/}
+
+\end_inset
+
+.
+\layout Comment
+
+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.
\layout List
\labelwidthstring 00.00.0000
\series default
- Generate code for the PIC 14-bit processors (In development, not complete).
+ Generate code for the PIC 14
+\begin_inset LatexCommand \index{PIC14}
+
+\end_inset
+
+-bit processors (In development, not complete).
+\layout Comment
+
+p16f627 p16f628 p16f84 p16f873 p16f877?
\layout List
\labelwidthstring 00.00.0000
\series bold
-mtlcs900h
\series default
- Generate code for the Toshiba TLCS-900H processor (In development, not
- complete).
+ Generate code for the Toshiba TLCS-900H
+\begin_inset LatexCommand \index{TLCS-900H}
+
+\end_inset
+
+ processor (In development, not complete).
\layout List
\labelwidthstring 00.00.0000
\series default
- Generate code for the Philips XA51 processor (In development, not complete).
+ Generate code for the Philips XA51
+\begin_inset LatexCommand \index{XA51}
+
+\end_inset
+
+ processor (In development, not complete).
\layout Subsubsection
Preprocessor Options
-\begin_inset LatexCommand \index{Options Preprocessor}
+\begin_inset LatexCommand \index{Options preprocessor}
\end_inset
-\begin_inset LatexCommand \index{Preprocessor Options}
+\begin_inset LatexCommand \index{Preprocessor options}
\end_inset
\layout Subsubsection
Linker Options
-\begin_inset LatexCommand \index{Options Linker}
+\begin_inset LatexCommand \index{Options linker}
\end_inset
-\begin_inset LatexCommand \index{Linker Options}
+\begin_inset LatexCommand \index{Linker options}
\end_inset
\series bold
-L\SpecialChar ~
----lib-path
-\begin_inset LatexCommand \index{-L ---lib-path}
+-
+\series default
+
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+
+\series bold
+-lib-path
+\begin_inset LatexCommand \index{-\/-lib-path}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{-L -\/-lib-path}
\end_inset
\series default
\bar default
<absolute path to additional libraries> This option is passed to the linkage
- editor's additional libraries search path.
+ 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.
\series bold
----xram-loc
-\series default
+-
+\begin_inset ERT
+status Collapsed
-\begin_inset LatexCommand \index{---xram-loc}
+\layout Standard
+\backslash
+/
\end_inset
-<Value> The start location of the external ram, default value is 0.
- The value entered can be in Hexadecimal or Decimal format, e.g.: ---xram-loc
- 0x8000 or ---xram-loc 32768.
-\layout List
-\labelwidthstring 00.00.0000
-
-
-\series bold
----code-loc
+-xram-loc
\series default
-\begin_inset LatexCommand \index{---code-loc}
+\begin_inset LatexCommand \index{-\/-xram-loc}
\end_inset
-<Value> The start location of the code segment, default value 0.
- Note when this option is used the interrupt vector table is also relocated
- to the given address.
- The value entered can be in Hexadecimal or Decimal format, e.g.: ---code-loc
- 0x8000 or ---code-loc 32768.
-\layout List
-\labelwidthstring 00.00.0000
+<Value> The start location of the external ram
+\begin_inset LatexCommand \index{xdata}
+\end_inset
-\series bold
----stack-loc
-\series default
+, default value is 0.
+ The value entered can be in Hexadecimal or Decimal format, e.g.: -
+\begin_inset ERT
+status Collapsed
-\begin_inset LatexCommand \index{---stack-loc}
+\layout Standard
+\backslash
+/
\end_inset
-<Value> By default the stack 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.
- ---stack-loc 0x20 or ---stack-loc 32.
- Since the sp register is incremented before a push or call, the initial
+-xram-loc 0x8000 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xram-loc 32768.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-code-loc
+\series default
+
+\begin_inset LatexCommand \index{-\/-code-loc}
+
+\end_inset
+
+<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 is also relocated
+ to the given address.
+ The value entered can be in Hexadecimal or Decimal format, e.g.: -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-code-loc 0x8000 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-code-loc 32768.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-loc
+\series default
+
+\begin_inset LatexCommand \index{-\/-stack-loc}
+
+\end_inset
+
+<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
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-loc 0x20 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\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
\series bold
----data-loc
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc
\series default
-\begin_inset LatexCommand \index{---data-loc}
+\begin_inset LatexCommand \index{-\/-data-loc}
+
+\end_inset
+
+<Value> The start location of the internal ram data
+\begin_inset LatexCommand \index{data}
\end_inset
-<Value> The start location of the internal ram data segment.
+ segment.
The value entered can be in Hexadecimal or Decimal format, eg.
- ---data-loc 0x20 or ---data-loc 32.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc 0x20 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\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 ---data-loc is not used, to location 0x10.)
+ data segment will be set, if -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc is not used, to location 0x10.)
\layout List
\labelwidthstring 00.00.0000
\series bold
----idata-loc
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-idata-loc
\series default
-\begin_inset LatexCommand \index{---idata-loc}
+\begin_inset LatexCommand \index{-\/-idata-loc}
+
+\end_inset
+
+<Value> The start location of the indirectly addressable internal ram
+\begin_inset LatexCommand \index{idata}
\end_inset
-<Value> The start location of the indirectly addressable internal ram, default
- value is 0x80.
+, default value is 0x80.
The value entered can be in Hexadecimal or Decimal format, eg.
- ---idata-loc 0x88 or ---idata-loc 136.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-idata-loc 0x88 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-idata-loc 136.
\layout List
\labelwidthstring 00.00.0000
\series bold
----out-fmt-ihx
-\begin_inset LatexCommand \index{---out-fmt-ihx}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-out-fmt-ihx
+\begin_inset LatexCommand \index{-\/-out-fmt-ihx}
\end_inset
\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).
\layout List
\labelwidthstring 00.00.0000
\series bold
----out-fmt-s19
-\begin_inset LatexCommand \index{---out-fmt-s19}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-out-fmt-s19
+\begin_inset LatexCommand \index{-\/-out-fmt-s19}
\end_inset
\series default
\bar default
-The linker output (final object code) is in Motorola S19 format.
+The linker output (final object code) is in Motorola S19 format
+\begin_inset LatexCommand \index{Motorola S19 format}
+
+\end_inset
+
+.
\layout Subsubsection
MCS51 Options
\end_inset
-\begin_inset LatexCommand \index{MCS51 Options}
+\begin_inset LatexCommand \index{MCS51 options}
\end_inset
\series bold
----model-large
-\begin_inset LatexCommand \index{---model-large}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-large
+\begin_inset LatexCommand \index{-\/-model-large}
\end_inset
\series bold
----model-small
-\begin_inset LatexCommand \index{---model-small}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-small
+\begin_inset LatexCommand \index{-\/-model-small}
\end_inset
\end_inset
-\begin_inset LatexCommand \index{DS390 Options}
+\begin_inset LatexCommand \index{DS390 options}
\end_inset
\series bold
----model-flat24
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-flat24
\series default
-\begin_inset LatexCommand \index{---model-flat24}
+\begin_inset LatexCommand \index{-\/-model-flat24}
\end_inset
\series bold
----stack-10bit
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-10bit
\series default
-\begin_inset LatexCommand \index{--stack-10bit}
+\begin_inset LatexCommand \index{-\/-stack-10bit}
\end_inset
any re-entrant functions compiled with this option.
In principle, this should work with the
\emph on
----stack-auto
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\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
----xstack
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\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
----model-flat24 option
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-flat24 option
\emph default
).
\layout Subsubsection
Optimization Options
-\begin_inset LatexCommand \index{Options Optimization}
+\begin_inset LatexCommand \index{Options optimization}
\end_inset
-\begin_inset LatexCommand \index{Optimization Options}
+\begin_inset LatexCommand \index{Optimization options}
\end_inset
\series bold
----nogcse
-\begin_inset LatexCommand \index{---nogcse}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nogcse
+\begin_inset LatexCommand \index{-\/-nogcse}
\end_inset
A warning message will be generated when this happens and the compiler
will indicate the number of extra bytes it allocated.
It recommended that this option NOT be used, #pragma\SpecialChar ~
-NOGCSE can be used
- to turn off global subexpression elimination for a given function only.
+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.
\layout List
\labelwidthstring 00.00.0000
\series bold
----noinvariant
-\begin_inset LatexCommand \index{---noinvariant}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noinvariant
+\begin_inset LatexCommand \index{-\/-noinvariant}
\end_inset
explained for the previous option.
For more details of loop optimizations performed see section Loop Invariants.It
recommended that this option NOT be used, #pragma\SpecialChar ~
-NOINVARIANT can be used
- to turn off invariant optimizations for a given function only.
+NOINVARIANT
+\begin_inset LatexCommand \index{\#pragma NOINVARIANT}
+
+\end_inset
+
+ can be used to turn off invariant optimizations for a given function only.
\layout List
\labelwidthstring 00.00.0000
\series bold
----noinduction
-\begin_inset LatexCommand \index{---noinduction}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noinduction
+\begin_inset LatexCommand \index{-\/-noinduction}
\end_inset
Will not do loop induction optimizations, see section strength reduction
for more details.It is recommended that this option is NOT used, #pragma\SpecialChar ~
NOINDUCT
-ION can be used to turn off induction optimizations for a given function
- only.
+ION
+\begin_inset LatexCommand \index{\#pragma NOINDUCTION}
+
+\end_inset
+
+ can be used to turn off induction optimizations for a given function only.
\layout List
\labelwidthstring 00.00.0000
\series bold
----nojtbound
-\begin_inset LatexCommand \index{---nojtbound}
+-
+\begin_inset ERT
+status Collapsed
-\end_inset
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nojtbound
+\begin_inset LatexCommand \index{-\/-nojtbound}
+
+\end_inset
\size large
\series default
\size default
\bar default
- Will not generate boundary condition check when switch statements are implement
-ed using jump-tables.
+ Will not generate boundary condition check when switch statements
+\begin_inset LatexCommand \index{switch statement}
+
+\end_inset
+
+ are implemented using jump-tables.
See section Switch Statements for more details.
It is recommended that this option is NOT used, #pragma\SpecialChar ~
-NOJTBOUND can be
- used to turn off boundary checking for jump tables for a given function
+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.
\layout List
\labelwidthstring 00.00.0000
\series bold
----noloopreverse
-\begin_inset LatexCommand \index{---noloopreverse}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noloopreverse
+\begin_inset LatexCommand \index{-\/-noloopreverse}
\end_inset
\size large
\size default
-Will not do loop reversal optimization.
+Will not do loop reversal
+\begin_inset LatexCommand \index{Loop reversing}
+
+\end_inset
+
+optimization.
\layout List
\labelwidthstring 00.00.0000
----
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-
\series bold
nolabelopt
\series default
-\begin_inset LatexCommand \index{---nolabelopt }
+\begin_inset LatexCommand \index{-\/-nolabelopt }
\end_inset
\series bold
----no-xinit-opt
-\begin_inset LatexCommand \index{---no-xinit-opt}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-no-xinit-opt
+\begin_inset LatexCommand \index{-\/-no-xinit-opt}
\end_inset
\end_inset
-\begin_inset LatexCommand \index{Other Options}
-
-\end_inset
-
-
\layout List
\labelwidthstring 00.00.0000
\series bold
-c\SpecialChar ~
----compile-only
-\begin_inset LatexCommand \index{---compile-only}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-compile-only
+\begin_inset LatexCommand \index{-\/-compile-only}
\end_inset
-\begin_inset LatexCommand \index{-c ---compile-only}
+\begin_inset LatexCommand \index{-c -\/-compile-only}
\end_inset
\series bold
---c1mode
-\begin_inset LatexCommand \index{--c1mode}
+-
+\series default
+
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+
+\series bold
+-c1mode
+\begin_inset LatexCommand \index{-\/-c1mode}
\end_inset
\series bold
----stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
\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.
+ the parameters and local variables will be allocated on the stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset
+
+.
see section Parameters and Local Variables for more details.
If this option is used all source files in the project should be compiled
with this option.
\series bold
----xstack
-\begin_inset LatexCommand \index{---xstack}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack
+\begin_inset LatexCommand \index{-\/-xstack}
\end_inset
\series bold
----callee-saves
-\begin_inset LatexCommand \index{---callee-saves}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-callee-saves
+\begin_inset LatexCommand \index{-\/-callee-saves}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{function prologue}
\end_inset
reduce code & improve run time performance of the generated code.
In the future the compiler (with interprocedural 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 _muluint..., if this
+ 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 ---callee-saves option string.
+ should be compiled with the same -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-callee-saves option string.
Also see #pragma\SpecialChar ~
CALLEE-SAVES
\begin_inset LatexCommand \index{\#pragma CALLEE-SAVES}
\series bold
----debug
-\begin_inset LatexCommand \index{---debug}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug
+\begin_inset LatexCommand \index{-\/-debug}
\end_inset
\series bold
----peep-file
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-file
\series default
-\begin_inset LatexCommand \index{---peep-file}
+\begin_inset LatexCommand \index{-\/-peep-file}
\end_inset
\series bold
----int-long-reent
-\begin_inset LatexCommand \index{---int-long-reent}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-int-long-reent
+\begin_inset LatexCommand \index{-\/-int-long-reent}
\end_inset
\series bold
----cyclomatic
-\begin_inset LatexCommand \index{---cyclomatic}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-cyclomatic
+\begin_inset LatexCommand \index{-\/-cyclomatic}
\end_inset
graph of the function, and most importantly the
\emph on
cyclomatic complexity
-\begin_inset LatexCommand \index{cyclomatic complexity}
+\begin_inset LatexCommand \index{Cyclomatic complexity}
\end_inset
\series bold
----float-reent
-\begin_inset LatexCommand \index{---float-reent}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-float-reent
+\begin_inset LatexCommand \index{-\/-float-reent}
\end_inset
\series default
\bar default
Floating point library is compiled as reentrant
-\begin_inset LatexCommand \index{ reentrant}
+\begin_inset LatexCommand \index{reentrant}
\end_inset
\series bold
----nooverlay
-\begin_inset LatexCommand \index{---nooverlay}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nooverlay
+\begin_inset LatexCommand \index{-\/-nooverlay}
\end_inset
\series bold
----main-return
-\begin_inset LatexCommand \index{---main-return}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-main-return
+\begin_inset LatexCommand \index{-\/-main-return}
\end_inset
\series bold
----no-peep
-\begin_inset LatexCommand \index{---no-peep}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-no-peep
+\begin_inset LatexCommand \index{-\/-no-peep}
\end_inset
\series bold
----peep-asm
-\begin_inset LatexCommand \index{---peep-asm}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-asm
+\begin_inset LatexCommand \index{-\/-peep-asm}
\end_inset
\series bold
----iram-size
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-iram-size
\series default
<Value>
-\begin_inset LatexCommand \index{---iram-size<Value>}
+\begin_inset LatexCommand \index{-\/-iram-size<Value>}
\end_inset
\series bold
----xram-size
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xram-size
\series default
<Value>
-\begin_inset LatexCommand \index{---xram-size<Value>}
+\begin_inset LatexCommand \index{-\/-xram-size<Value>}
\end_inset
\series bold
----code-size
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-code-size
\series default
<Value>
-\begin_inset LatexCommand \index{---code-size<Value>}
+\begin_inset LatexCommand \index{-\/-code-size<Value>}
\end_inset
\series bold
----nostdincl
-\begin_inset LatexCommand \index{---nostdincl}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nostdincl
+\begin_inset LatexCommand \index{-\/-nostdincl}
\end_inset
\series bold
----nostdlib
-\begin_inset LatexCommand \index{---nostdlib}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nostdlib
+\begin_inset LatexCommand \index{-\/-nostdlib}
\end_inset
\series default
- This will prevent the compiler from passing on the default library path
- to the linker.
+ This will prevent the compiler from passing on the default library
+\begin_inset LatexCommand \index{Libraries}
+
+\end_inset
+
+ path to the linker.
\layout List
\labelwidthstring 00.00.0000
\series bold
----verbose
-\begin_inset LatexCommand \index{---verbose}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-verbose
+\begin_inset LatexCommand \index{-\/-verbose}
\end_inset
\series bold
----no-c-code-in-asm
-\begin_inset LatexCommand \index{---no-c-code-in-asm}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-no-c-code-in-asm
+\begin_inset LatexCommand \index{-\/-no-c-code-in-asm}
\end_inset
\series bold
----i-code-in-asm
-\begin_inset LatexCommand \index{---i-code-in-asm}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-i-code-in-asm
+\begin_inset LatexCommand \index{-\/-i-code-in-asm}
\end_inset
\series bold
----less-pedantic
-\begin_inset LatexCommand \index{---less-pedantic}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-less-pedantic
+\begin_inset LatexCommand \index{-\/-less-pedantic}
\end_inset
\series bold
----print-search-dirs
-\begin_inset LatexCommand \index{---print-search-dirs}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-print-search-dirs
+\begin_inset LatexCommand \index{-\/-print-search-dirs}
\end_inset
\layout Subsubsection
Intermediate Dump Options
-\begin_inset LatexCommand \index{Options Intermediate Dump}
+\begin_inset LatexCommand \index{Options intermediate dump}
\end_inset
-\begin_inset LatexCommand \index{Intermediate Dump Options}
+\begin_inset LatexCommand \index{Intermediate dump options}
\end_inset
\series bold
----dumpraw
-\begin_inset LatexCommand \index{---dumpraw}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpraw
+\begin_inset LatexCommand \index{-\/-dumpraw}
\end_inset
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}
+\begin_inset LatexCommand \index{Basic blocks}
\end_inset
\series bold
----dumpgcse
-\begin_inset LatexCommand \index{---dumpgcse}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpgcse
+\begin_inset LatexCommand \index{-\/-dumpgcse}
\end_inset
\series default
Will create a dump of iCode's, after global subexpression elimination
-\begin_inset LatexCommand \index{global subexpression elimination}
+\begin_inset LatexCommand \index{Global subexpression elimination}
\end_inset
\series bold
----dumpdeadcode
-\begin_inset LatexCommand \index{---dumpdeadcode}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpdeadcode
+\begin_inset LatexCommand \index{-\/-dumpdeadcode}
\end_inset
\series default
Will create a dump of iCode's, after deadcode elimination
-\begin_inset LatexCommand \index{deadcode elimination}
+\begin_inset LatexCommand \index{Dead-code elimination}
\end_inset
\series bold
----dumploop
-\begin_inset LatexCommand \index{---dumploop}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumploop
+\begin_inset LatexCommand \index{-\/-dumploop}
\end_inset
\size default
Will create a dump of iCode's, after loop optimizations
-\begin_inset LatexCommand \index{loop optimizations}
+\begin_inset LatexCommand \index{Loop optimization}
\end_inset
\series bold
----dumprange
-\begin_inset LatexCommand \index{---dumprange}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumprange
+\begin_inset LatexCommand \index{-\/-dumprange}
\end_inset
\size default
Will create a dump of iCode's, after live range analysis
-\begin_inset LatexCommand \index{live range analysis}
+\begin_inset LatexCommand \index{Live range analysis}
\end_inset
\series bold
----dumlrange
-\begin_inset LatexCommand \index{---dumlrange}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumlrange
+\begin_inset LatexCommand \index{-\/-dumlrange}
\end_inset
\series default
Will dump the life ranges
-\begin_inset LatexCommand \index{life ranges}
+\begin_inset LatexCommand \index{Live range analysis}
\end_inset
\series bold
----dumpregassign
-\begin_inset LatexCommand \index{---dumpregassign}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpregassign
+\begin_inset LatexCommand \index{-\/-dumpregassign}
\end_inset
\series default
\bar default
Will create a dump of iCode's, after register assignment
-\begin_inset LatexCommand \index{register assignment}
+\begin_inset LatexCommand \index{Register assignment}
\end_inset
\series bold
----dumplrange
-\begin_inset LatexCommand \index{---dumplrange}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumplrange
+\begin_inset LatexCommand \index{-\/-dumplrange}
\end_inset
\series bold
----dumpall
-\begin_inset LatexCommand \index{---dumpall}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpall
+\begin_inset LatexCommand \index{-\/-dumpall}
\end_inset
\series default
SDCC installs a signal handler
-\begin_inset LatexCommand \index{ signal handler}
+\begin_inset LatexCommand \index{signal handler}
\end_inset
\layout Subsection
MCS51/DS390 Storage Class
-\begin_inset LatexCommand \index{Storage Class}
+\begin_inset LatexCommand \index{Storage class}
\end_inset
sfr at 0x80 P0; /* special function register P0 at location 0x80 */
\newline
sbit at 0xd7 CY; /* CY (Carry Flag
+\begin_inset LatexCommand \index{Flags}
+
+\end_inset
+
+
\begin_inset LatexCommand \index{Carry flag}
\end_inset
SDCC allows (via language extensions) pointers to explicitly point to any
of the memory spaces
-\begin_inset LatexCommand \index{memory spaces}
+\begin_inset LatexCommand \index{Memory model}
\end_inset
generic
\emph default
pointers.
- These are useful for developing reusable library routines.
+ These are useful for developing reusable library
+\begin_inset LatexCommand \index{Libraries}
+
+\end_inset
+
+ routines.
Explicitly specifying the pointer type will generate the most efficient
code.
\layout Subsection
\end_inset
& Local Variables
-\begin_inset LatexCommand \index{Local Variables}
+\begin_inset LatexCommand \index{Local variable}
\end_inset
\emph default
so by default functions are non-reentrant
-\begin_inset LatexCommand \index{non-reentrant}
+\begin_inset LatexCommand \index{reentrant}
\end_inset
either by using the
\emph on
- ---stack-auto
-\begin_inset LatexCommand \index{--stack-auto}
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
\emph default
keyword or the
\emph on
- ---stack-auto
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
\emph default
option should be used sparingly.
Note that the reentrant keyword just means that the parameters & local
\newline
Local variables can be assigned storage classes and absolute
-\begin_inset LatexCommand \index{absolute}
+\begin_inset LatexCommand \index{Absolute addressing}
\end_inset
in internal ram.
When compiled with
\emph on
----stack-auto
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
\emph default
or when a function is declared as
\emph on
\layout Standard
-For non-reentrant functions SDCC will try to reduce internal ram space usage
- by overlaying parameters and local variables of a function (if possible).
+For non-reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+ functions SDCC will try to reduce internal ram space usage by overlaying
+ parameters and local variables of a function (if possible).
Parameters and local variables of a function will be allocated to an overlayabl
e segment if the function has
\emph on
no other function calls and the function is non-reentrant and the memory
model
-\begin_inset LatexCommand \index{memory model}
+\begin_inset LatexCommand \index{Memory model}
\end_inset
is small.
\emph default
- If an explicit storage class is specified for a local variable, it will
- NOT be overlayed.
+ If an explicit storage class
+\begin_inset LatexCommand \index{Storage class}
+
+\end_inset
+
+ is specified for a local variable, it will NOT be overlayed.
\layout Standard
Note that the compiler (not the linkage editor) makes the decision for overlayin
Parameters and Local variables of functions that contain 16 or 32 bit multiplica
tion
-\begin_inset LatexCommand \index{multiplication}
+\begin_inset LatexCommand \index{Multiplication}
\end_inset
or division
-\begin_inset LatexCommand \index{division}
+\begin_inset LatexCommand \index{Division}
\end_inset
\layout Subsection
Interrupt Service Routines
-\begin_inset LatexCommand \index{Interrupt Service Routines}
-
-\end_inset
-
-
\layout Standard
SDCC allows interrupt service routines to be coded in C, with some extended
\end_inset
if it is not reentrant.
- A special note here, int (16 bit) and long (32 bit) integer division, multiplic
-ation & modulus operations are implemented using external support routines
- developed in ANSI-C, if an interrupt service routine needs to do any of
- these operations then the support routines (as mentioned in a following
- section) will have to be recompiled using the
+ A special note here, int (16 bit) and long (32 bit) integer division
+\begin_inset LatexCommand \index{Division}
+
+\end_inset
+
+, multiplication
+\begin_inset LatexCommand \index{Multiplication}
+
+\end_inset
+
+ & modulus
+\begin_inset LatexCommand \index{Modulus}
+
+\end_inset
+
+ operations are implemented using external support routines developed in
+ ANSI-C, if an interrupt service routine needs to do any of these operations
+ then the support routines (as mentioned in a following section) will have
+ to be recompiled using the
\emph on
- ---stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
\emph default
option and the source file will need to be compiled using the
\emph on
----int-long-ren
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-int-long-ren
\emph default
t
-\begin_inset LatexCommand \index{---int-long-rent}
+\begin_inset LatexCommand \index{-\/-int-long-rent}
\end_inset
Interrupt Numbers and the corresponding address & descriptions for the Standard
8051 are listed below.
- SDCC will automatically adjust the interrupt vector table
-\begin_inset LatexCommand \index{ interrupt vector table}
-
-\end_inset
-
- to the maximum interrupt number specified.
+ SDCC will automatically adjust the interrupt vector table to the maximum
+ interrupt number specified.
\newline
\layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="6" columns="3">
<features>
-<column alignment="center" valignment="top" leftline="true" width="0in">
-<column alignment="center" valignment="top" leftline="true" width="0in">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" width="0in">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="0in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Subsection
Naked Functions
-\begin_inset LatexCommand \index{Naked Functions}
+\begin_inset LatexCommand \index{Naked functions}
\end_inset
\SpecialChar ~
\SpecialChar ~
_asm
+\begin_inset LatexCommand \index{\_asm}
+
+\end_inset
+
+
\newline
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-_endasm;
+_endasm
+\begin_inset LatexCommand \index{\_endasm}
+
+\end_inset
+
+;
\newline
}
\family default
\layout Subsection
Functions using private banks
-\begin_inset LatexCommand \index{banks}
+\begin_inset LatexCommand \index{bank}
\end_inset
\layout Subsection
Absolute Addressing
-\begin_inset LatexCommand \index{Absolute Addressing}
+\begin_inset LatexCommand \index{Absolute addressing}
\end_inset
\layout Subsection
Startup Code
-\begin_inset LatexCommand \index{Startup Code}
+\begin_inset LatexCommand \index{Startup code}
\end_inset
\series default
at the start of the CODE area.
- This routine is in the runtime library.
+ This routine is in the runtime library
+\begin_inset LatexCommand \index{Runtime library}
+
+\end_inset
+
+.
By default this routine returns 0, if this routine returns a non-zero value,
the static & global variable initialization will be skipped and the function
main will be invoked Other wise static & global variables will be initialized
\layout Subsection
Inline Assembler Code
-\begin_inset LatexCommand \index{Inline Assembler Code}
+\begin_inset LatexCommand \index{Assembler routines}
\end_inset
be placed in a separate line (as the example shows).
When the
\emph on
----peep-asm
-\begin_inset LatexCommand \index{--peep-asm}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-asm
+\begin_inset LatexCommand \index{-\/-peep-asm}
\end_inset
\newline
\newline
-_mulsint.c - signed 16 bit multiplication (calls _muluint)
-\newline
-_muluint.c - unsigned 16 bit multiplication
+_mulint.c - 16 bit multiplication
\newline
_divsint.c - signed 16 bit division (calls _divuint)
\newline
\newline
_moduint.c - unsigned 16 bit modulus
\newline
-_mulslong.c - signed 32 bit multiplication (calls _mululong)
-\newline
-_mululong.c - unsigned32 bit multiplication
+_mullong.c - 32 bit multiplication
\newline
_divslong.c - signed 32 division (calls _divulong)
\newline
\end_inset
-
-\begin_inset LatexCommand \index{non-reentrant}
-
-\end_inset
-
, interrupt
\begin_inset LatexCommand \index{interrupt}
If this is unavoidable then the above routines will need to be compiled
with the
\emph on
----stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
\emph default
option, after which the source program will have to be compiled with
\emph on
----int-long-rent
-\begin_inset LatexCommand \index{---int-long-rent}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-int-long-rent
+\begin_inset LatexCommand \index{-\/-int-long-rent}
\end_inset
\layout Subsection
Floating Point Support
-\begin_inset LatexCommand \index{Floating Point Support}
+\begin_inset LatexCommand \index{Floating point support}
\end_inset
\layout Subsection
MCS51 Memory Models
-\begin_inset LatexCommand \index{Memory Models}
+\begin_inset LatexCommand \index{Memory model}
\end_inset
-\begin_inset LatexCommand \index{MCS51 Memory Models}
+\begin_inset LatexCommand \index{MCS51 memory}
\end_inset
When the large model is used all variables declared without a storage class
will be allocated into the external ram, this includes all parameters and
- local variables (for non-reentrant functions).
+ local variables (for non-reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+ functions).
When the small model is used variables without storage class are allocated
in the internal ram.
\layout Standard
Judicious usage of the processor specific storage classes
-\begin_inset LatexCommand \index{storage classes}
+\begin_inset LatexCommand \index{Storage class}
\end_inset
\layout Subsection
DS390 Memory Models
-\begin_inset LatexCommand \index{Memory Models}
+\begin_inset LatexCommand \index{Memory model}
\end_inset
-\begin_inset LatexCommand \index{DS390 Memory Models}
+\begin_inset LatexCommand \index{DS390 memory model}
\end_inset
\layout Standard
The only model supported is Flat 24
-\begin_inset LatexCommand \index{Flat 24}
+\begin_inset LatexCommand \index{Flat 24 (memory model)}
\end_inset
tinibios
\emph default
-\begin_inset LatexCommand \index{tinibios}
+\begin_inset LatexCommand \index{Tinibios (DS390)}
\end_inset
\newline
Like the
\emph on
----model-large
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-large
\emph default
option, variables will by default be placed into the XDATA segment.
\newline
Segments may be placed anywhere in the 4 meg address space using the usual
- ---*-loc options.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-*-loc options.
Note that if any segments are located above 64K, the -r flag must be passed
to the linker to generate the proper segment relocations, and the Intel
HEX output format must be used.
\layout Subsection
Defines Created by the Compiler
-\begin_inset LatexCommand \index{Defines Created by the Compiler}
+\begin_inset LatexCommand \index{Defines created by the compiler}
\end_inset
- this symbol is defined when
\emph on
----stack-auto
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
\emph default
option is used.
\layout Itemize
- when
\emph on
----model-small
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-small
\emph default
is used.
\layout Itemize
- when
\emph on
----model-large
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-large
\emph default
is used.
\layout Itemize
- when
\emph on
----xstack
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack
\emph default
option is used.
\layout Itemize
\emph default
is used
\layout Section
-
+\pagebreak_top
SDCC Technical Data
\layout Subsection
\layout Subsubsection
Sub-expression Elimination
-\begin_inset LatexCommand \index{Sub-expression Elimination}
+\begin_inset LatexCommand \index{Subexpression elimination}
\end_inset
\layout Subsubsection
Dead-Code Elimination
-\begin_inset LatexCommand \index{Dead-Code Elimination}
+\begin_inset LatexCommand \index{Dead-code elimination}
\end_inset
\layout Subsubsection
Copy-Propagation
-\begin_inset LatexCommand \index{Copy-Propagation}
+\begin_inset LatexCommand \index{Copy propagation}
\end_inset
\layout Subsubsection
Loop Optimizations
-\begin_inset LatexCommand \index{Loop Optimizations}
+\begin_inset LatexCommand \index{Loop optimization}
\end_inset
variables and the register allocator tries to keep the induction variables
in registers for the duration of the loop.
Because of this preference of the register allocator
-\begin_inset LatexCommand \index{Register allocator}
+\begin_inset LatexCommand \index{Register allocation}
\end_inset
The compiler will generate a warning message when it is forced to allocate
extra space either on the stack or data space.
If this extra space allocation is undesirable then induction optimization
- can be eliminated either for the entire source file (with ---noinduction
- option) or for a given function only using #pragma\SpecialChar ~
+ can be eliminated either for the entire source file (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noinduction option) or for a given function only using #pragma\SpecialChar ~
NOINDUCTION
\begin_inset LatexCommand \index{\#pragma NOINDUCTION}
\newline
Strength Reduction
-\begin_inset LatexCommand \index{Strength Reduction}
+\begin_inset LatexCommand \index{Strength reduction}
\end_inset
\newline
The more expensive multiplication
-\begin_inset LatexCommand \index{multiplication}
+\begin_inset LatexCommand \index{Multiplication}
\end_inset
\layout Subsubsection
Loop Reversing
-\begin_inset LatexCommand \index{Loop Reversing}
+\begin_inset LatexCommand \index{Loop reversing}
\end_inset
\newline
Note the subexpressions
-\begin_inset LatexCommand \index{subexpressions}
+\begin_inset LatexCommand \index{Subexpression}
\end_inset
\layout Subsubsection
'switch' Statements
-\begin_inset LatexCommand \index{switch Statements}
+\begin_inset LatexCommand \index{switch statement}
\end_inset
\layout Subsubsection
Bit-shifting Operations
-\begin_inset LatexCommand \index{Bit-shifting Operations}
+\begin_inset LatexCommand \index{Bit shifting}
\end_inset
\layout Subsubsection
Bit-rotation
-\begin_inset LatexCommand \index{Bit-rotation}
+\begin_inset LatexCommand \index{Bit rotation}
\end_inset
A default set of rules are compiled into the compiler, additional rules
may be added with the
\emph on
----peep-file
-\begin_inset LatexCommand \index{---peep-file}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-file
+\begin_inset LatexCommand \index{-\/-peep-file}
\end_inset
\newline
\newline
-The above rule will change the following assembly sequence:
+The above rule will change the following assembly
+\begin_inset LatexCommand \index{Assembler routines}
+
+\end_inset
+
+ sequence:
\newline
\newline
\newline
Other special case optimizations may be added by the user (via
\emph on
----peep-file option
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-file option
\emph default
).
E.g.
have some better means.
If you are looking at this file, you will also see the default rules that
are compiled into the compiler, you can add your own rules in the default
- set there if you get tired of specifying the ---peep-file option.
+ set there if you get tired of specifying the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-file option.
\layout Subsection
Pragmas
\end_inset
NONE | {acc[,b[,dpl[,dph]]] - The exclude pragma disables generation of
- pair of push/pop instruction in ISR function (using interrupt keyword).
+ pair of push/pop
+\begin_inset LatexCommand \index{push/pop}
+
+\end_inset
+
+ instruction in ISR function (using interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset
+
+ keyword).
The directive should be placed immediately before the ISR function definition
and it affects ALL ISR functions following it.
To enable the normal register saving for ISR functions use #pragma\SpecialChar ~
EXCLUDE\SpecialChar ~
-none.
+none
+\begin_inset LatexCommand \index{\#pragma EXCLUDE}
+
+\end_inset
+
+.
\layout Itemize
NOIV
\end_inset
- function1[,function2[,function3...]] - The compiler by default uses a caller
- saves convention for register saving across function calls, however this
+
+\begin_inset LatexCommand \index{function prologue}
+
+\end_inset
+
+ function1[,function2[,function3...]] - The compiler by default uses a caller
+ saves convention for register saving across function calls, however this
can cause unneccessary register pushing & popping when calling small functions
from larger functions.
This option can be used to switch off the register saving convention for
reduce code & improve run time performance of the generated code.
In the future the compiler (with interprocedural analysis) may be able
to determine the appropriate scheme to use for each function call.
- If ---callee-saves command line option is used, the function names specified
+ If -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-callee-saves command line option is used, the function names specified
in #pragma\SpecialChar ~
-CALLEE-SAVES is appended to the list of functions specified in
- the command line.
+CALLEE-SAVES
+\begin_inset LatexCommand \index{\#pragma CALLEE-SAVES}
+
+\end_inset
+
+ is appended to the list of functions specified in the command line.
\layout Standard
The pragma's are intended to be used to turn-off certain optimizations which
changing options for a function.
\layout Subsection
-
+Library Routines
\emph on
-<pending: this is messy and incomplete>
+ <pending: this is messy and incomplete>
\emph default
- Library Routines
+
\layout Enumerate
Compiler support routines (_gptrget, _mulint etc)
\layout Enumerate
Math functions (sin, pow, sqrt etc)
+\layout Comment
+
+license statements for the libraries are missing
\layout Subsection
Interfacing with Assembly Routines
-\begin_inset LatexCommand \index{Assembly Routines}
+\begin_inset LatexCommand \index{Assembler routines}
\end_inset
\layout Subsubsection
Global Registers used for Parameter Passing
-\begin_inset LatexCommand \index{Parameter Passing}
+\begin_inset LatexCommand \index{Parameter passing}
\end_inset
The compiler always uses the global registers
\emph on
-DPL
-\begin_inset LatexCommand \index{DPL}
-
-\end_inset
-
-,DPH
-\begin_inset LatexCommand \index{DPH}
-
-\end_inset
-
-
-\begin_inset LatexCommand \index{DPTR}
+DPL, DPH
+\begin_inset LatexCommand \index{DPTR, DPH, DPL}
\end_inset
-,B
-\begin_inset LatexCommand \index{B}
+, B
+\begin_inset LatexCommand \index{B (register)}
\end_inset
\emph default
to pass the first parameter to a routine.
The second parameter onwards is either allocated on the stack (for reentrant
- routines or if ---stack-auto is used) or in the internal / external ram
- (depending on the memory model).
+ routines or if -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto is used) or in the internal / external ram (depending on the
+ memory model).
\layout Subsubsection
-Assembler Routine(non-reentrant)
-\begin_inset LatexCommand \index{Assembler Routine(non-reentrant)}
+Assembler Routine(non-reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+)
+\begin_inset LatexCommand \index{Assembler routines (non-reentrant)}
\end_inset
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-mov a,dpl
+mov a,dpl
\newline
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-add a,_asm_func_PARM_2
+add a,_asm_func_PARM_2
\newline
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-mov dpl,#0x00
+mov dpl
+\begin_inset LatexCommand \index{DPTR, DPH, DPL}
+
+\end_inset
+
+,#0x00
\newline
\SpecialChar ~
\SpecialChar ~
sdcc cfunc.c asmfunc.rel
\layout Subsubsection
-Assembler Routine(reentrant)
-\begin_inset LatexCommand \index{Assembler Routine(reentrant)}
+Assembler Routine(reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+)
+\begin_inset LatexCommand \index{Assembler routines (reentrant)}
\end_inset
\layout Subsection
External Stack
-\begin_inset LatexCommand \index{External Stack}
+\begin_inset LatexCommand \index{stack}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{External stack}
\end_inset
The external stack is located at the start of the external ram segment,
and is 256 bytes in size.
- When ---xstack option is used to compile the program, the parameters and
- local variables of all reentrant functions are allocated in this area.
+ When -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack option is used to compile the program, the parameters and local
+ variables of all reentrant functions are allocated in this area.
This option is provided for programs with large stack space requirements.
- When used with the ---stack-auto option, all parameters and local variables
- are allocated on the external stack (note support libraries will need to
- be recompiled with the same options).
+ When used with the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto option, all parameters and local variables are allocated on
+ the external stack (note support libraries will need to be recompiled with
+ the same options).
\layout Standard
The compiler outputs the higher order address byte of the external ram segment
\layout Subsection
ANSI-Compliance
-\begin_inset LatexCommand \index{ANSI-Compliance}
+\begin_inset LatexCommand \index{ANSI-compliance}
\end_inset
}
\layout Itemize
-'long long' (64 bit integers) not supported.
+'long long
+\begin_inset LatexCommand \index{long long (not supported)}
+
+\end_inset
+
+' (64 bit integers
+\begin_inset LatexCommand \index{int (64 bit) (not supported)}
+
+\end_inset
+
+) not supported.
\layout Itemize
-'double' precision floating point not supported.
+'double
+\begin_inset LatexCommand \index{double (not supported)}
+
+\end_inset
+
+' precision floating point
+\begin_inset LatexCommand \index{Floating point support}
+
+\end_inset
+
+not supported.
\layout Itemize
No support for setjmp and longjmp (for now).
\layout Itemize
-Old K&R style function declarations are NOT allowed.
+Old K&R style
+\begin_inset LatexCommand \index{K\&R style}
+
+\end_inset
+
+ function declarations are NOT allowed.
\newline
\family typewriter
\layout Subsection
Cyclomatic Complexity
-\begin_inset LatexCommand \index{Cyclomatic Complexity}
+\begin_inset LatexCommand \index{Cyclomatic complexity}
\end_inset
complexity of the function, it does however provide a good starting point
for which functions you might look at for further optimization.
\layout Section
-
+\pagebreak_top
TIPS
\layout Standard
\layout Standard
The amount of stack being used is affected by the use of the "internal stack"
- to save registers before a subroutine call is made (---stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+ to save registers before a subroutine call is made (-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
If you detect that the stack is over writing you data, then the following
can be done.
- ---xstack will cause an external stack to be used for saving registers
- and (if ---stack-auto is being used) storing parameters and local variables.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack will cause an external stack to be used for saving registers and
+ (if -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto is being used) storing parameters and local variables.
However this will produce more code which will be slower to execute.
\layout Standard
----stack-loc
-\begin_inset LatexCommand \index{---stack-loc}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-loc
+\begin_inset LatexCommand \index{-\/-stack-loc}
\end_inset
the stack.
\layout Standard
----stack-after-data
-\begin_inset LatexCommand \index{---stack-after-data}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc
+\begin_inset LatexCommand \index{-\/-data-loc}
+
+\end_inset
+
+ allows you to specify the start address of the near data.
+ This could be used to move the "near data" further away from the stack
+ giving it more room to grow.
+ This will only work if no bit variables are being used and the stack can
+ grow to use the bit variable space.
+\newline
+
+\newline
+Conclusion.
+\newline
+
+\newline
+If you find that the stack is over writing your bit variables or "near data"
+ then the approach which best utilised the internal memory is to position
+ the "near data" after the last bank of used registers or, if you use bit
+ variables, after the last bit variable by using the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc, e.g.
+ if two register banks are being used and no bit variables, -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc 16.
+\layout Standard
+
+If bit variables are being used, another method would be to try and squeeze
+ the data area in the unused register banks if it will fit, and start the
+ stack after the last bit variable.
+\layout Subsection
+
+Tools
+\begin_inset LatexCommand \index{Tools}
+
+\end_inset
+
+ included in the distribution
+\layout Standard
+
+
+\begin_inset Tabular
+<lyxtabular version="3" rows="9" columns="3">
+<features>
+<column alignment="center" valignment="top" leftline="true" width="0pt">
+<column alignment="center" valignment="top" leftline="true" width="0pt">
+<column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Name
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Purpose
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Directory
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+uCsim
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Simulator for various architectures
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+sdcc/sim/ucsim
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+keil2sdcc.pl
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+header file conversion
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+sdcc/support/scripts
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+mh2h.c
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+header file conversion
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+sdcc/support/scripts
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+as-gbz80
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Assembler
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+as-z80
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Assembler
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+asx8051
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Assembler
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+sdcdb
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Simulator
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\layout Subsection
+
+Related open source tools
+\begin_inset LatexCommand \index{Related tools}
+
+\end_inset
+
+
+\layout Standard
+
+
+\begin_inset Tabular
+<lyxtabular version="3" rows="5" columns="3">
+<features>
+<column alignment="center" valignment="top" leftline="true" width="0pt">
+<column alignment="center" valignment="top" leftline="true" width="0pt">
+<column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Name
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Purpose
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Where to get
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+gpsim
+\begin_inset LatexCommand \index{gpsim}
+
+\end_inset
+
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+PIC simulator
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\begin_inset LatexCommand \url{http://www.dattalo.com/gnupic/gpsim.html}
+
+\end_inset
+
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+srecord
+\begin_inset LatexCommand \index{srecord}
+
+\end_inset
+
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Object file conversion, checksumming, ...
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\begin_inset LatexCommand \url{http://srecord.sourceforge.net/}
+
+\end_inset
+
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+objdump
+\begin_inset LatexCommand \index{objdump}
+
+\end_inset
+
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Object file conversion
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Part of binutils (should be there anyway)
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+ddd
+\begin_inset LatexCommand \index{ddd}
+
+\end_inset
+
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Debugger, serves nicely as GUI to sdcdb
+\begin_inset LatexCommand \index{sdcdb}
+
+\end_inset
+
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\begin_inset LatexCommand \url{http://www.gnu.org/software/ddd/}
+
+\end_inset
+
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\layout Subsection
+
+Related documentation / recommended reading
+\layout Standard
+
+
+\begin_inset Tabular
+<lyxtabular version="3" rows="4" columns="3">
+<features>
+<column alignment="center" valignment="top" leftline="true" width="0pt">
+<column alignment="center" valignment="top" leftline="true" width="0pt">
+<column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Name
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Subject
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Where to get
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Compiler architecture
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+bookstore
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+test_suite_spec.pdf
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+sdcc regression test
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+sdcc/doc
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+cdbfileformat.pd
+\family default
+\series default
+\shape default
+\size default
+\emph default
+\bar default
+\noun default
+\color default
+f
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+sdcc internal documentation
\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
-, similar to the ---stack-loc, but it automatically places the stack after
- the end of the "near data".
- Again this could waste any spare register space.
\layout Standard
----data-loc
-\begin_inset LatexCommand \index{---data-loc}
-
+sdcc/doc
\end_inset
+</cell>
+</row>
+</lyxtabular>
- allows you to specify the start address of the near data.
- This could be used to move the "near data" further away from the stack
- giving it more room to grow.
- This will only work if no bit variables are being used and the stack can
- grow to use the bit variable space.
-\newline
-
-\newline
-Conclusion.
-\newline
+\end_inset
-\newline
-If you find that the stack is over writing your bit variables or "near data"
- then the approach which best utilised the internal memory is to position
- the "near data" after the last bank of used registers or, if you use bit
- variables, after the last bit variable by using the ---data-loc, e.g.
- if two register banks are being used and no bit variables, ---data-loc
- 16, and use the ---stack-after-data option.
-\layout Standard
-If bit variables are being used, another method would be to try and squeeze
- the data area in the unused register banks if it will fit, and start the
- stack after the last bit variable.
\layout Section
-
+\pagebreak_top
Retargetting for other MCUs.
\layout Standard
The intermediate code generation assumes the target machine has unlimited
number of registers, and designates them with the name iTemp.
The compiler can be made to dump a human readable form of the code generated
- by using the ---dumpraw option.
+ by using the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpraw option.
\layout Itemize
This phase does the bulk of the standard optimizations and is also MCU independe
This phase determines the live-ranges; by live range I mean those iTemp
variables defined by the compiler that still survive after all the optimization
s.
- Live range analysis is essential for register allocation, since these computati
-on determines which of these iTemps will be assigned to registers, and for
- how long.
+ Live range analysis
+\begin_inset LatexCommand \index{Live range analysis}
+
+\end_inset
+
+ is essential for register allocation, since these computation determines
+ which of these iTemps will be assigned to registers, and for how long.
\layout Itemize
Phase five is register allocation.
\layout Section
\pagebreak_top
SDCDB
-\begin_inset LatexCommand \index{SDCDB}
+\begin_inset LatexCommand \index{sdcdb}
\end_inset
SDCC is distributed with a source level debugger.
The debugger uses a command line interface, the command repertoire of the
- debugger has been kept as close to gdb (the GNU debugger) as possible.
+ debugger has been kept as close to gdb
+\begin_inset LatexCommand \index{gdb}
+
+\end_inset
+
+ (the GNU debugger) as possible.
The configuration and build process is part of the standard compiler installati
on, which also builds and installs the debugger in the target directory
specified during configuration.
How the Debugger Works
\layout Standard
-When the ---debug option is specified the compiler generates extra symbol
- information some of which are put into the the assembler source and some
- are put into the .adb file.
+When the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug option is specified the compiler generates extra symbol information
+ some of which are put into the the assembler source and some are put into
+ the .adb file.
Then the linker creates the .cdb file from the individual .adb files with
the address information for the symbols.
The debugger reads the symbolic information generated by the compiler &
foo.cdb - the debugger symbol information file.
\layout Itemize
-foo.ihx - the intel hex format object file.
+foo.ihx - the intel hex format
+\begin_inset LatexCommand \index{Intel hex format}
+
+\end_inset
+
+ object file.
\layout Subsection
Command Line Options.
\layout Itemize
----directory=<source file directory> this option can used to specify the
- directory search list.
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-directory=<source file directory> this option can used to specify the directory
+ search list.
The debugger will look into the directory list specified for source, cdb
& ihx files.
The items in the directory list must be separated by ':', e.g.
if the source files can be in the directories /home/src1 and /home/src2,
- the ---directory option should be ---directory=/home/src1:/home/src2.
+ the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-directory option should be -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-directory=/home/src1:/home/src2.
Note there can be no spaces in the option.
\layout Itemize
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
---------
+--------
\newline
;;
\newline
\newline
\layout Section
-\pagebreak_top
+
Other Processors
\layout Subsection
One bad side effect of using IX as the base pointer is that a functions
stack frame is limited to 127 bytes - this will be fixed in a later version.
\layout Section
-
+\pagebreak_top
Support
\begin_inset LatexCommand \index{Support}
You can help by reporting the bugs and helping other SDCC users.
There are lots of ways to contribute, and we encourage you to take part
in making SDCC a great software package.
+
+\layout Standard
+
+The SDCC project is hosted on the sdcc sourceforge site at
+\begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/sdcc}
+
+\end_inset
+
+.
+ You'll find the complete set of mailing lists
+\begin_inset LatexCommand \index{Mailing list}
+
+\end_inset
+
+, forums, bug reporting system, patch submission
+\begin_inset LatexCommand \index{Patch submission}
+
+\end_inset
+
+ system, download
+\begin_inset LatexCommand \index{download}
+
+\end_inset
+
+ area and cvs code repository
+\begin_inset LatexCommand \index{cvs code repository}
+
+\end_inset
+
+ there.
\layout Subsection
Reporting Bugs
\end_inset
-\begin_inset LatexCommand \index{Reporting Bugs}
+\begin_inset LatexCommand \index{Reporting bugs}
\end_inset
\layout Standard
-Send an email to the mailing list at 'user-sdcc@sdcc.sourceforge.net' or 'devel-sd
-cc@sdcc.sourceforge.net'.
- Bugs will be fixed ASAP.
+The recommended way of reporting bugs is using the infrastructure of the
+ sourceforge site.
+ You can follow the status of bug reports there and have an overview about
+ the known bugs.
+\layout Standard
+
+Bug reports are automatically forwarded to the developer mailing list and
+ will be fixed ASAP.
When reporting a bug, it is very useful to include a small test program
which reproduces the problem.
If you can isolate the problem by looking at the generated assembly code,
this can be very helpful.
- Compiling your program with the ---dumpall option can sometimes be useful
- in locating optimization problems.
+ Compiling your program with the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpall
+\begin_inset LatexCommand \index{-\/-dumpall}
+
+\end_inset
+
+ option can sometimes be useful in locating optimization problems.
+\layout Standard
+
+Please have a short check that you are using a recent version of SDCC and
+ the bug is not yet known.
+ This is the link for reporting bugs:
+\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=100599}
+
+\end_inset
+
+.
+\layout Subsection
+
+Requesting Features
+\begin_inset LatexCommand \index{Feature request}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Requesting features}
+
+\end_inset
+
+
+\layout Standard
+
+Like bug reports feature requests are forwarded to the developer mailing
+ list.
+ This is the link for requesting features:
+\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=350599}
+
+\end_inset
+
+.
+\layout Subsection
+
+Getting Help
+\layout Standard
+
+These links should take you directly to the
+\begin_inset LatexCommand \url[Mailing lists]{http://sourceforge.net/mail/?group_id=599}
+
+\end_inset
+
+
+\begin_inset Foot
+collapsed false
+
+\layout Standard
+
+Traffic on sdcc-devel and sdcc-user is about 100 mails/month each not counting
+ automated messages (mid 2003)
+\end_inset
+
+ and the
+\begin_inset LatexCommand \url[Forums]{http://sourceforge.net/forum/?group_id=599}
+
+\end_inset
+
+, lists and forums are archived so if you are lucky someone already had
+ a similar problem.
+\layout Subsection
+
+Changelog
+\begin_inset LatexCommand \index{Changelog}
+
+\end_inset
+
+
+\layout Standard
+
+You can follow the status of the cvs version
+\begin_inset LatexCommand \index{version}
+
+\end_inset
+
+ of SDCC by watching the file
+\begin_inset LatexCommand \htmlurl[ChangeLog]{http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/sdcc/sdcc/ChangeLog?rev=HEAD&content-type=text/plain}
+
+\end_inset
+
+ in the cvs-repository.
+\layout Subsection
+
+Release policy
+\begin_inset LatexCommand \index{Release policy}
+
+\end_inset
+
+
+\layout Standard
+
+Historically there often were long delays between official releases and
+ the sourceforge download area tends to get not updated at all.
+ Current excuses might refer to problems with live range analysis, but if
+ this is fixed, the next problem rising is that another excuse will have
+ to be found.
+ Kidding aside, we have to get better there!
+\layout Subsection
+
+Examples
+\begin_inset LatexCommand \index{Examples}
+
+\end_inset
+
+
+\layout Standard
+
+You'll find some small examples in the directory sdcc/device/examples/
+\layout Comment
+
+Maybe we should include some links to real world applications.
+ Preferrably pointer to pointers (one for each architecture) so this stays
+ manageable here?
+\layout Subsection
+
+Quality control
+\begin_inset LatexCommand \index{Quality control}
+
+\end_inset
+
+
+\layout Standard
+
+The compiler is passed through nightly compile and build checks.
+ The so called
+\shape italic
+regression tests
+\shape default
+
+\begin_inset LatexCommand \index{Regression test}
+
+\end_inset
+
+ check that SDCC itself compiles flawlessly on several platforms and checks
+ the quality of the code generated by SDCC by running the code through simulator
+s.
+ There is a separate document
+\shape italic
+test_suite.pdf
+\begin_inset LatexCommand \index{Test suite}
+
+\end_inset
+
+
+\shape default
+ about this.
+\layout Standard
+
+You'll find the test code in the directory
+\shape italic
+sdcc/support/regression
+\shape default
+.
+ You can run these tests manually by running
+\family sans
+make
+\family default
+ in this directory (or f.e.
+
+\family sans
+make test-mcs51
+\family default
+ if you don't want to run the complete tests).
+ The test code might also be interesting if you want to look for examples
+\begin_inset LatexCommand \index{Examples}
+
+\end_inset
+
+ checking corner cases of SDCC or if you plan to submit patches
+\begin_inset LatexCommand \index{Patch submission}
+
+\end_inset
+
+.
+\layout Standard
+
+The pic port uses a different set of regression tests, you'll find them
+ in the directory
+\shape italic
+sdcc/src/regression
+\shape default
+.
\layout Section
\pagebreak_top
Compiler internals
+\begin_inset LatexCommand \index{Compiler internals}
+
+\end_inset
+
+
\layout Subsection
The anatomy of the compiler
\shape italic
This is an excerpt from an atricle published in Circuit Cellar MagaZine
in august 2000.
- It's a little outdated (the compiler is much more efficient now and user/devell
-oper friendly), but pretty well exposes the guts of it all.
+ It's a little outdated (the compiler is much more efficient now and user/develo
+per friendly), but pretty well exposes the guts of it all.
\shape default
\newline
\layout Standard
Parsing the input source file and creating an AST (Annotated Syntax Tree
-\begin_inset LatexCommand \index{Annotated Syntax Tree}
+\begin_inset LatexCommand \index{Annotated syntax tree}
\end_inset
\layout Paragraph*
Register Allocation
-\begin_inset LatexCommand \index{Register Allocation}
+\begin_inset LatexCommand \index{Register allocation}
\end_inset
\layout Paragraph*
ICode Example
-\begin_inset LatexCommand \index{ICode Example}
+\begin_inset LatexCommand \index{iCode}
\end_inset
\newline
15.\SpecialChar ~
\SpecialChar ~
-for (i = 0, j = 10 ; i < 10 ; i++, j---) {
+for (i = 0, j = 10 ; i < 10 ; i++, j--) {
\newline
16.\SpecialChar ~
\SpecialChar ~
generated temporary b) user defined variable c) a constant value.
Note that local variables and parameters are replaced by compiler generated
temporaries.
- Live ranges are computed only for temporaries (i.e.
+ Live ranges
+\begin_inset LatexCommand \index{Live range analysis}
+
+\end_inset
+
+ are computed only for temporaries (i.e.
live ranges are not computed for global variables).
- Registers are allocated for temporaries only.
+ Registers
+\begin_inset LatexCommand \index{Register allocation}
+
+\end_inset
+
+ are allocated for temporaries only.
Operands are formatted in the following manner:
\newline
the temporary is used only for a conditional jump the code generation makes
use of this information to optimize a compare and jump ICode.
\newline
-There are several loop optimizations performed by the compiler.
+There are several loop optimizations
+\begin_inset LatexCommand \index{Loop optimization}
+
+\end_inset
+
+ performed by the compiler.
It can detect induction variables iTemp21(i) and iTemp23(j).
- Also note the compiler does selective strength reduction, i.e.
+ Also note the compiler does selective strength reduction
+\begin_inset LatexCommand \index{Strength reduction}
+
+\end_inset
+
+, i.e.
the multiplication of an induction variable in line 18 (gint = j * 3) is
changed to addition, a new temporary iTemp17 is allocated and assigned
a initial value, a constant 3 is then added for each iteration of the loop.
- The compiler does not change the multiplication in line 17 however since
- the processor does support an 8 * 8 bit multiplication.
+ The compiler does not change the multiplication
+\begin_inset LatexCommand \index{Multiplication}
+
+\end_inset
+
+ in line 17 however since the processor does support an 8 * 8 bit multiplication.
\newline
-Note the dead code elimination optimization eliminated the dead assignments
- in line 7 & 8 to I and sum respectively.
+Note the dead code elimination
+\begin_inset LatexCommand \index{Dead-code elimination}
+
+\end_inset
+
+ optimization eliminated the dead assignments in line 7 & 8 to I and sum
+ respectively.
\newline
\layout Standard
A few words about basic block successors, predecessors and dominators
\layout Standard
-Successors are basic blocks that might execute after this basic block.
+Successors are basic blocks
+\begin_inset LatexCommand \index{Basic blocks}
+
+\end_inset
+
+ that might execute after this basic block.
\newline
Predecessors are basic blocks that might execute before reaching this basic
block.
This document was initially written by Sandeep Dutta
\layout Standard
-All product names mentioned herein may be trademarks of their respective
- companies.
+All product names mentioned herein may be trademarks
+\begin_inset LatexCommand \index{Trademarks}
+
+\end_inset
+
+ of their respective companies.
\layout Section