-#LyX 1.4.5 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
+#LyX 1.5.7 created this file. For more info see http://www.lyx.org/
+\lyxformat 276
\begin_document
\begin_header
\textclass book
\end_preamble
\language english
\inputencoding default
-\fontscheme pslatex
+\font_roman times
+\font_sans helvet
+\font_typewriter courier
+\font_default_family default
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
\graphics default
\paperfontsize default
\spacing single
\papersize letterpaper
\use_geometry true
\use_amsmath 1
+\use_esint 0
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\papersides 1
\paperpagestyle fancy
\tracking_changes false
-\output_changes true
+\output_changes false
+\author ""
+\author ""
\end_header
\begin_body
\end_layout
\begin_layout Standard
-into seperate sections/chapters/appendices (it is hard to document PIC or
+into separate sections/chapters/appendices (it is hard to document PIC or
Z80 in
\end_layout
\begin_layout Date
\size normal
-SDCC 2.8.4
+SDCC 2.9.1
\size footnotesize
\newline
-$Date:: $
+$Date:: $
\newline
$Revision$
\end_layout
\end_layout
\begin_layout Standard
-\begin_inset LatexCommand \tableofcontents{}
+\begin_inset LatexCommand tableofcontents
\end_inset
designed for 8 bit Microprocessors.
The current version targets Intel MCS51 based Microprocessors (8031, 8032,
8051, 8052
-\begin_inset LatexCommand \index{8031, 8032, 8051, 8052, mcs51 CPU}
+\begin_inset LatexCommand index
+name "8031, 8032, 8051, 8052, mcs51 CPU"
\end_inset
Atmel AVR is under development.
The entire source code for the compiler is distributed under GPL.
SDCC uses ASXXXX
-\begin_inset LatexCommand \index{asXXXX (as-gbz80, as-hc08, asx8051, as-z80)}
+\begin_inset LatexCommand index
+name "asXXXX (as-gbz80, as-hc08, asx8051, as-z80)"
\end_inset
& ASLINK
-\begin_inset LatexCommand \index{aslink}
+\begin_inset LatexCommand index
+name "aslink"
\end_inset
-, an open source retargetable assembler & linker.
+, an free open source retargetable assembler & linker.
SDCC has extensive language extensions suitable for utilizing various microcont
rollers and underlying hardware effectively.
\newline
The latest SDCC version can be downloaded from
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/snap.php}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/snap.php"
\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}
+\begin_inset LatexCommand index
+name "Status of documentation"
\end_inset
\begin_layout Standard
All packages used in this compiler system are
\emph on
-open source
-\emph default
- and
-\emph on
-freeware
+free open source
\emph default
; source code for all the sub-packages (pre-processor, assemblers, linkers
etc.) is distributed with the package.
\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, GPL}
+\begin_inset LatexCommand index
+name "GNU General Public License, GPL"
\end_inset
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
-\begin_inset LatexCommand \index{warranty}
+\begin_inset LatexCommand index
+name "warranty"
\end_inset
\begin_layout Section
Typographic conventions
-\begin_inset LatexCommand \index{Typographic conventions}
+\begin_inset LatexCommand index
+name "Typographic conventions"
\end_inset
\begin_layout Section
Compatibility
-\begin_inset LatexCommand \label{sec:Compatibility-with-previous}
+\begin_inset LatexCommand label
+name "sec:Compatibility-with-previous"
\end_inset
with previous versions
-\begin_inset LatexCommand \index{Compatibility with previous versions}
+\begin_inset LatexCommand index
+name "Compatibility with previous versions"
\end_inset
But we also sometimes introduce some incompatibilities with older versions.
Not just for the fun of it, but to make the compiler more stable, efficient
and ANSI compliant
-\begin_inset LatexCommand \index{ANSI-compliance}
+\begin_inset LatexCommand index
+name "ANSI-compliance"
\end_inset
(see section
-\begin_inset LatexCommand \ref{sub:ANSI-Compliance}
+\begin_inset LatexCommand ref
+reference "sub:ANSI-Compliance"
\end_inset
\end_inset
-short-is-8bits commandline option (see
-\begin_inset LatexCommand \vref{lyx:--short-is-8bits}
+\begin_inset LatexCommand vref
+reference "lyx:--short-is-8bits"
\end_inset
\begin_layout Itemize
char type parameters to vararg
-\begin_inset LatexCommand \index{vararg, va\_arg}
+\begin_inset LatexCommand index
+name "vararg, va\\_arg"
\end_inset
\end_inset
-std-c89
-\begin_inset LatexCommand \index{-\/-std-c89}
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
\end_inset
-
+
\series default
-and
+ and
\series bold
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-std-c99
-\begin_inset LatexCommand \index{-\/-std-c99}
+\begin_inset LatexCommand index
+name "-\\/-std-c99"
\end_inset
\family default
\newline
- will push a as an int and as a char resp if
+ will push a as an int and as a char resp if
\series bold
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-std-c89
-\begin_inset LatexCommand \index{-\/-std-c89}
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
\end_inset
-
+
\series default
-and
+ and
\series bold
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-std-c99
-\begin_inset LatexCommand \index{-\/-std-c99}
+\begin_inset LatexCommand index
+name "-\\/-std-c99"
\end_inset
\series default
command line options are not defined,
\newline
- will push a as two ints if
+ will push a as two ints if
\series bold
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-std-c89
-\begin_inset LatexCommand \index{-\/-std-c89}
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
\end_inset
-
+
\series default
-or
+ or
\series bold
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-std-c99
-\begin_inset LatexCommand \index{-\/-std-c99}
+\begin_inset LatexCommand index
+name "-\\/-std-c99"
\end_inset
\begin_layout Itemize
bit
-\begin_inset LatexCommand \index{bit}
+\begin_inset LatexCommand index
+name "bit"
\end_inset
and sbit
-\begin_inset LatexCommand \index{sbit}
+\begin_inset LatexCommand index
+name "sbit"
\end_inset
-\begin_inset LatexCommand \index{\_\_sbit}
+\begin_inset LatexCommand index
+name "\\_\\_sbit"
\end_inset
types now consistently behave like the C99 _Bool type with respect to type
conversion
-\begin_inset LatexCommand \index{type conversion}
+\begin_inset LatexCommand index
+name "type conversion"
\end_inset
-\begin_inset LatexCommand \index{type promotion}
+\begin_inset LatexCommand index
+name "type promotion"
\end_inset
.
The most common incompatibility resulting from this change is related to
bit toggling
-\begin_inset LatexCommand \index{Bit toggling}
+\begin_inset LatexCommand index
+name "Bit toggling"
\end_inset
\InsetSpace ~
\InsetSpace ~
b = ~
-\begin_inset LatexCommand \index{\~\/ Operator}
+\begin_inset LatexCommand index
+name "\\~\\/ Operator"
\end_inset
\end_layout
\begin_layout Itemize
-in older versions, the preprocessor was always called with -std=c99 regardless
- of the --std-xxx setting.
+in older versions, the preprocessor was always called with
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-c99
+\begin_inset LatexCommand index
+name "-\\/-std-c99"
+
+\end_inset
+
+
+\series default
+ regardless of the
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-xxx
+\series default
+ setting.
This is no longer true, and can cause compilation failures on code built
- with --std-c89 but using c99 preprocessor features, such as one-line (//)
- comments
+ with
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-c89
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
+
+\end_inset
+
+
+\series default
+ but using c99 preprocessor features, such as one-line (//) comments
\end_layout
\begin_layout Itemize
g the library.
\end_layout
+\begin_layout Itemize
+in versions older then 2.8.5 the unnamed bitfield structure members participated
+ in initialization, which is not conforming with ISO/IEC 9899:1999 standard
+ (see section Section 6.7.8 Initialization, clause 9)
+\newline
+
+\newline
+Old behavior, before
+ version 2.8.5:
+\family typewriter
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+struct {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+int a : 2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+char\InsetSpace ~
+ : 2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+int b : 2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+} s = {1, 2, 3};
+\family default
+
+\newline
+
+\family typewriter
+/* s.a = 1, s.b = 3 */
+\family default
+
+\newline
+
+\newline
+New behavior:
+\family typewriter
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+struct {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+int a : 2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+char\InsetSpace ~
+ : 2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+int b : 2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+} s = {1, 2};
+\family default
+
+\newline
+
+\family typewriter
+/* s.a = 1, s.b = 2 */
+\end_layout
+
\begin_layout Section
System Requirements
\end_layout
\begin_layout Standard
The SDCC home page at
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/"
\end_inset
This document can be found in the DOC directory of the source package as
a text or HTML file.
A pdf version of this document is available at
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/sdccman.pdf}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/sdccman.pdf"
\end_inset
\family typewriter
better code banking
-\begin_inset LatexCommand \index{code banking (limited support)}
+\begin_inset LatexCommand index
+name "code banking (limited support)"
\end_inset
\family default
If you can think of some more, please see the section
-\begin_inset LatexCommand \ref{sub:Requesting-Features}
+\begin_inset LatexCommand ref
+reference "sub:Requesting-Features"
\end_inset
about filing feature requests
-\begin_inset LatexCommand \index{Requesting features}
+\begin_inset LatexCommand index
+name "Requesting features"
\end_inset
-\begin_inset LatexCommand \index{Feature request}
+\begin_inset LatexCommand index
+name "Feature request"
\end_inset
\begin_layout Chapter
Installing SDCC
-\begin_inset LatexCommand \index{Installation}
+\begin_inset LatexCommand index
+name "Installation"
\end_inset
\begin_layout Standard
For most users it is sufficient to skip to either section
-\begin_inset LatexCommand \ref{sub:Building-SDCC-on-Linux}
+\begin_inset LatexCommand ref
+reference "sub:Building-SDCC-on-Linux"
\end_inset
(Unix) or section
-\begin_inset LatexCommand \ref{sub:Windows-Install}
+\begin_inset LatexCommand ref
+reference "sub:Windows-Install"
\end_inset
\begin_layout Section
Configure Options
-\begin_inset LatexCommand \index{Options SDCC configuration}
+\begin_inset LatexCommand index
+name "Options SDCC configuration"
\end_inset
\begin_layout Section
Install paths
-\begin_inset LatexCommand \label{sub:Install-paths}
+\begin_inset LatexCommand label
+name "sub:Install-paths"
\end_inset
-\begin_inset LatexCommand \index{Install paths}
+\begin_inset LatexCommand index
+name "Install paths"
\end_inset
\newline
Moreove
r the install path can be changed by defining DESTDIR
-\begin_inset LatexCommand \index{DESTDIR}
+\begin_inset LatexCommand index
+name "DESTDIR"
\end_inset
\begin_layout Section
Search Paths
-\begin_inset LatexCommand \label{sub:Search-Paths}
+\begin_inset LatexCommand label
+name "sub:Search-Paths"
\end_inset
-\begin_inset LatexCommand \index{Search path}
+\begin_inset LatexCommand index
+name "Search path"
\end_inset
\begin_layout Section
Building SDCC
-\begin_inset LatexCommand \index{Building SDCC}
+\begin_inset LatexCommand index
+name "Building SDCC"
\end_inset
\begin_layout Subsection
Building SDCC on Linux
-\begin_inset LatexCommand \label{sub:Building-SDCC-on-Linux}
+\begin_inset LatexCommand label
+name "sub:Building-SDCC-on-Linux"
\end_inset
bz2
\series default
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/snap.php}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/snap.php"
\end_inset
\begin_layout Enumerate
\series medium
-Unpack the file using a command like:
+Unpack the file using a command like:
+\series default
+
\family sans
\series bold
-"tar -xvzf sdcc-src-yyyymmdd-rrrr.tar.bz2
+"tar -xvjf sdcc-src-yyyymmdd-rrrr.tar.bz2
\begin_inset Quotes srd
\end_inset
\begin_layout Enumerate
\series medium
-Type
+Type
+\series default
+
\family sans
\series bold
"./configure
\begin_layout Enumerate
\series medium
-Type
+Type
+\series default
+
\family sans
\series bold
"make
\begin_layout Enumerate
\series medium
-Type
+Type
+\series default
+
\family sans
\series bold
"make install"
This copies the binary executables, the include files, the libraries and
the documentation to the install directories.
Proceed with section
-\begin_inset LatexCommand \ref{sec:Testing-the-SDCC}
+\begin_inset LatexCommand ref
+reference "sec:Testing-the-SDCC"
\end_inset
\newline
In order to install
Cygwin on Windows download setup.exe from
-\begin_inset LatexCommand \url[www.cygwin.com]{http://www.cygwin.com/}
+\begin_inset LatexCommand url
+name "www.cygwin.com"
+target "http://www.cygwin.com/"
\end_inset
And use an editor which can handle LF-only line endings.
Make sure not to commit files with windows line endings.
The tabulator spacing
-\begin_inset LatexCommand \index{tabulator spacing (8 columns)}
+\begin_inset LatexCommand index
+name "tabulator spacing (8 columns)"
\end_inset
Download the source package
\series default
either from the SDCC Subversion repository or from the
-\begin_inset LatexCommand \url[snapshot builds]{http://sdcc.sourceforge.net/snap.php}
+\begin_inset LatexCommand url
+name "snapshot builds"
+target "http://sdcc.sourceforge.net/snap.php"
\end_inset
In order to build SDCC with MSVC
you need win32 executables of bison.exe, flex.exe, and gawk.exe.
One good place to get them is
-\begin_inset LatexCommand \url[here]{http://unxutils.sourceforge.net}
+\begin_inset LatexCommand url
+name "here"
+target "http://unxutils.sourceforge.net"
\end_inset
\newline
Download the file UnxUtils
-\begin_inset LatexCommand \index{UnxUtils}
+\begin_inset LatexCommand index
+name "UnxUtils"
\end_inset
\begin_layout Enumerate
Download the binary zip package from
-\begin_inset LatexCommand \url{http://sdcc.sf.net/snap.php}
+\begin_inset LatexCommand url
+target "http://sdcc.sf.net/snap.php"
\end_inset
\begin_layout Subsection
Windows Install Using the Setup Program
-\begin_inset LatexCommand \label{sub:Windows-Install}
+\begin_inset LatexCommand label
+name "sub:Windows-Install"
\end_inset
for an official release from
\newline
-\begin_inset LatexCommand \url{http://sf.net/project/showfiles.php?group_id=599}
+\begin_inset LatexCommand url
+target "http://sf.net/project/showfiles.php?group_id=599"
\end_inset
sdcc-yyyymmdd-xxxx-setup.exe
\emph default
from
-\begin_inset LatexCommand \url{http://sdcc.sf.net/snap.php}
+\begin_inset LatexCommand url
+target "http://sdcc.sf.net/snap.php"
\end_inset
\begin_layout Subsection
VPATH
-\begin_inset LatexCommand \index{VPATH}
+\begin_inset LatexCommand index
+name "VPATH"
\end_inset
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
# cd $HOME
\end_layout
\begin_layout Standard
\family typewriter
-tar -xzf sdcc.src.tar.gz\InsetSpace ~
+tar -xjf sdcc-src-yyyymmdd-rrrr.tar.bz2\InsetSpace ~
# extract source to directory sdcc
\end_layout
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
# put output in sdcc.build
\end_layout
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
# configure is doing all the magic!
\end_layout
You're invited to make changes and additions to this manual (sdcc/doc/sdccman.ly
x).
Using LyX
-\begin_inset LatexCommand \url{http://www.lyx.org}
+\begin_inset LatexCommand url
+target "http://www.lyx.org"
\end_inset
as editor is straightforward.
Prebuilt documentation in html and pdf format is available from
-\begin_inset LatexCommand \url{http://sdcc.sf.net/snap.php}
+\begin_inset LatexCommand url
+target "http://sdcc.sf.net/snap.php"
\end_inset
\begin_layout Section
Reading the Documentation
-\begin_inset LatexCommand \index{Documentation}
+\begin_inset LatexCommand index
+name "Documentation"
\end_inset
\newline
You'll find the pdf version
-\begin_inset LatexCommand \index{PDF version of this document}
+\begin_inset LatexCommand index
+name "PDF version of this document"
\end_inset
at
-\begin_inset LatexCommand \url{http://sdcc.sf.net/doc/sdccman.pdf}
+\begin_inset LatexCommand url
+target "http://sdcc.sf.net/doc/sdccman.pdf"
\end_inset
\newline
A html version
-\begin_inset LatexCommand \index{HTML version of this document}
+\begin_inset LatexCommand index
+name "HTML version of this document"
\end_inset
should be online at
-\begin_inset LatexCommand \url{http://sdcc.sf.net/doc/sdccman.html/index.html}
+\begin_inset LatexCommand url
+target "http://sdcc.sf.net/doc/sdccman.html/index.html"
\end_inset
It tries to document SDCC for several processor architectures in one document
(commercially these probably would be separate documents/products).
This document
-\begin_inset LatexCommand \index{Status of documentation}
+\begin_inset LatexCommand index
+name "Status of documentation"
\end_inset
Don't let this distract you.
If there f.e.
was a reference like
-\begin_inset LatexCommand \url{http://www.opencores.org}
+\begin_inset LatexCommand url
+target "http://www.opencores.org"
\end_inset
a
\emph default
rray
-\begin_inset LatexCommand \index{FPGA (field programmable gate array)}
+\begin_inset LatexCommand index
+name "FPGA (field programmable gate array)"
\end_inset
\end_inset
or
-\begin_inset LatexCommand \url{http://sf.net/projects/fpgac}
+\begin_inset LatexCommand url
+target "http://sf.net/projects/fpgac"
\end_inset
-\begin_inset LatexCommand \index{FpgaC ((subset of) C to FPGA compiler)}
+\begin_inset LatexCommand index
+name "FpgaC ((subset of) C to FPGA compiler)"
\end_inset
\begin_layout Section
Testing the SDCC Compiler
-\begin_inset LatexCommand \label{sec:Testing-the-SDCC}
+\begin_inset LatexCommand label
+name "sec:Testing-the-SDCC"
\end_inset
\end_inset
-version"
-\begin_inset LatexCommand \index{version}
+\begin_inset LatexCommand index
+name "version"
\end_inset
Make sure that the sdcc bin directory is in your executable search path
defined by the PATH environment setting (
\series medium
-see
+see
\series default
-section
-\begin_inset LatexCommand \ref{sub:Install-Trouble-shooting}
+ section
+\begin_inset LatexCommand ref
+reference "sub:Install-Trouble-shooting"
\end_inset
\newline
\series medium
-SDCC
+SDCC
\series default
-is commonly installed as described in section
+ is commonly installed as described in section
\begin_inset Quotes sld
\end_inset
\series medium
Make sure the compiler works on a very simple example.
- Type in the following test.c program using your favorite
+ Type in the following test.c program using your favorite
\series default
-ASCII
+ ASCII
\series medium
editor:
\end_layout
\begin_layout Standard
\series medium
-Compile this using the following command:
+Compile this using the following command:
+\series default
+
\family sans
\series bold
"sdcc -c test.c".
\series medium
The next step is to try it with the linker.
- Type in
+ Type in
+\series default
+
\family sans
\series bold
"sdcc test.c
\series medium
(no test.ihx, and the linker generates warnings), then the problem is most
- likely that
+ likely that
\series default
-SDCC
+ SDCC
\series medium
- cannot find the
+cannot find the
\series default
-/
+ /
\series medium
usr/local/share/sdcc/lib directory
\series default
\series medium
-(see
+(see
\series default
-section
-\begin_inset LatexCommand \ref{sub:Install-Trouble-shooting}
+ section
+\begin_inset LatexCommand ref
+reference "sub:Install-Trouble-shooting"
\end_inset
\newline
\series medium
-The final test is to ensure
+The final test is to ensure
\series default
-SDCC
+ SDCC
\series medium
- can use the
+can use the
\series default
-standard
+ standard
\series medium
- header files and libraries.
+header files and libraries.
Edit test.c and change it to the following:
\end_layout
\begin_layout Standard
\series medium
-Compile this by typing
+Compile this by typing
+\series default
+
\family sans
\series bold
"sdcc test.c"
.
This should generate a test.ihx output file, and it should give no warnings
such as not finding the string.h file.
- If it cannot find the string.h file, then the problem is that
+ If it cannot find the string.h file, then the problem is that
\series default
-SDCC
+ SDCC
\series medium
- cannot find the /usr/local/share/sdcc/include directory
+cannot find the /usr/local/share/sdcc/include directory
\series default
\series medium
-(see the
+(see the
\series default
-section
-\begin_inset LatexCommand \ref{sub:Install-Trouble-shooting}
+ section
+\begin_inset LatexCommand ref
+reference "sub:Install-Trouble-shooting"
\end_inset
-print-search-dirs
\series default
-\begin_inset LatexCommand \index{-\/-print-search-dirs}
+\begin_inset LatexCommand index
+name "-\\/-print-search-dirs"
\end_inset
\begin_layout Section
Install Trouble-shooting
-\begin_inset LatexCommand \label{sub:Install-Trouble-shooting}
+\begin_inset LatexCommand label
+name "sub:Install-Trouble-shooting"
\end_inset
-\begin_inset LatexCommand \index{Install trouble-shooting}
+\begin_inset LatexCommand index
+name "Install trouble-shooting"
\end_inset
This will install the compiler, other executables libraries and include
files into the appropriate directories.
See sections
-\begin_inset LatexCommand \ref{sub:Install-paths}
+\begin_inset LatexCommand ref
+reference "sub:Install-paths"
\end_inset
,\InsetSpace ~
-\begin_inset LatexCommand \ref{sub:Search-Paths}
+\begin_inset LatexCommand ref
+reference "sub:Search-Paths"
\end_inset
\begin_layout Itemize
as-z80
\series bold
-,
+,
\series default
-as-gbz80 - The Z80 and GameBoy Z80 assemblers.
+ as-gbz80 - The Z80 and GameBoy Z80 assemblers.
\end_layout
\begin_layout Itemize
\begin_layout Itemize
link-z80
\series bold
-,
+,
\series default
-link-gbz80 - The Z80 and GameBoy Z80 linkers.
+ link-gbz80 - The Z80 and GameBoy Z80 linkers.
\end_layout
\begin_layout Itemize
\begin_layout Standard
The preprocessor
-\begin_inset LatexCommand \index{sdcpp (preprocessor)}
+\begin_inset LatexCommand index
+name "sdcpp (preprocessor)"
\end_inset
is a modified version of the GNU cpp
-\begin_inset LatexCommand \index{cpp|see{sdcpp}}
+\begin_inset LatexCommand index
+name "cpp|see{sdcpp}"
\end_inset
preprocessor
-\begin_inset LatexCommand \url{http://gcc.gnu.org/}
+\begin_inset LatexCommand url
+target "http://gcc.gnu.org/"
\end_inset
\begin_layout Standard
S51
-\begin_inset LatexCommand \index{s51}
+\begin_inset LatexCommand index
+name "s51"
\end_inset
is a free open source simulator developed by Daniel Drotos.
The simulator is built as part of the build process.
For more information visit Daniel's web site at:
-\begin_inset LatexCommand \url{http://mazsola.iit.uni-miskolc.hu/~drdani/embedded/s51}
+\begin_inset LatexCommand url
+target "http://mazsola.iit.uni-miskolc.hu/~drdani/embedded/s51"
\end_inset
\begin_layout Standard
SDCDB
-\begin_inset LatexCommand \index{SDCDB (debugger)}
+\begin_inset LatexCommand index
+name "SDCDB (debugger)"
\end_inset
is the companion source level debugger.
More about SDCDB in section
-\begin_inset LatexCommand \ref{cha:Debugging-with-SDCDB}
+\begin_inset LatexCommand ref
+reference "cha:Debugging-with-SDCDB"
\end_inset
.
The current version of the debugger uses Daniel's Simulator S51
-\begin_inset LatexCommand \index{s51}
+\begin_inset LatexCommand index
+name "s51"
\end_inset
\begin_layout Itemize
sourcefile.asm
-\begin_inset LatexCommand \index{<file>.asm}
+\begin_inset LatexCommand index
+name "<file>.asm"
\end_inset
- Assembler source
-\begin_inset LatexCommand \index{Assembler source}
+\begin_inset LatexCommand index
+name "Assembler source"
\end_inset
\begin_layout Itemize
sourcefile.lst
-\begin_inset LatexCommand \index{<file>.lst}
+\begin_inset LatexCommand index
+name "<file>.lst"
\end_inset
- Assembler listing
-\begin_inset LatexCommand \index{Assembler listing}
+\begin_inset LatexCommand index
+name "Assembler listing"
\end_inset
\begin_layout Itemize
sourcefile.rst
-\begin_inset LatexCommand \index{<file>.rst}
+\begin_inset LatexCommand index
+name "<file>.rst"
\end_inset
- Assembler listing
-\begin_inset LatexCommand \index{Assembler listing}
+\begin_inset LatexCommand index
+name "Assembler listing"
\end_inset
\begin_layout Itemize
sourcefile.sym
-\begin_inset LatexCommand \index{<file>.sym}
+\begin_inset LatexCommand index
+name "<file>.sym"
\end_inset
- symbol listing
-\begin_inset LatexCommand \index{Symbol listing}
+\begin_inset LatexCommand index
+name "Symbol listing"
\end_inset
\begin_layout Itemize
sourcefile.rel
-\begin_inset LatexCommand \index{<file>.rel}
+\begin_inset LatexCommand index
+name "<file>.rel"
\end_inset
or sourcefile.o
-\begin_inset LatexCommand \index{<file>.o}
+\begin_inset LatexCommand index
+name "<file>.o"
\end_inset
- Object file
-\begin_inset LatexCommand \index{Object file}
+\begin_inset LatexCommand index
+name "Object file"
\end_inset
\begin_layout Itemize
sourcefile.map
-\begin_inset LatexCommand \index{<file>.map}
+\begin_inset LatexCommand index
+name "<file>.map"
\end_inset
- The memory map
-\begin_inset LatexCommand \index{Memory map}
+\begin_inset LatexCommand index
+name "Memory map"
\end_inset
\begin_layout Itemize
sourcefile.mem
-\begin_inset LatexCommand \index{<file>.mem}
+\begin_inset LatexCommand index
+name "<file>.mem"
\end_inset
\begin_layout Itemize
sourcefile.ihx
-\begin_inset LatexCommand \index{<file>.ihx}
+\begin_inset LatexCommand index
+name "<file>.ihx"
\end_inset
- The load module in Intel hex format
-\begin_inset LatexCommand \index{Intel hex format}
+\begin_inset LatexCommand index
+name "Intel hex format"
\end_inset
(you can select the Motorola S19 format
-\begin_inset LatexCommand \index{Motorola S19 format}
+\begin_inset LatexCommand index
+name "Motorola S19 format"
\end_inset
\end_inset
-out-fmt-s19
-\begin_inset LatexCommand \index{-\/-out-fmt-s19}
+\begin_inset LatexCommand index
+name "-\\/-out-fmt-s19"
\end_inset
\family default
\shape default
-\begin_inset LatexCommand \index{objdump (tool)}
+\begin_inset LatexCommand index
+name "objdump (tool)"
\end_inset
- or
+ or
\family sans
\shape italic
- srecord
+srecord
\family default
\shape default
-\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+\begin_inset LatexCommand index
+name "srecord (bin, hex, ... tool)"
\end_inset
\end_inset
- see also section
-\begin_inset LatexCommand \vref{sub:Postprocessing-the-Intel}
+\begin_inset LatexCommand vref
+reference "sub:Postprocessing-the-Intel"
\end_inset
).
Both formats are documented in the documentation of srecord
-\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+\begin_inset LatexCommand index
+name "srecord (bin, hex, ... tool)"
\end_inset
\begin_layout Itemize
sourcefile.adb
-\begin_inset LatexCommand \index{<file>.adb}
+\begin_inset LatexCommand index
+name "<file>.adb"
\end_inset
\end_inset
-debug
-\begin_inset LatexCommand \index{-\/-debug}
+\begin_inset LatexCommand index
+name "-\\/-debug"
\end_inset
\begin_layout Itemize
sourcefile.cdb
-\begin_inset LatexCommand \index{<file>.cdb}
+\begin_inset LatexCommand index
+name "<file>.cdb"
\end_inset
\begin_layout Itemize
sourcefile.
- (no extension)
-\begin_inset LatexCommand \index{<file> (no extension)}
+\begin_inset LatexCommand index
+name "<file> (no extension)"
\end_inset
An optional AOMF or AOMF51
-\begin_inset LatexCommand \index{AOMF, AOMF51}
+\begin_inset LatexCommand index
+name "AOMF, AOMF51"
\end_inset
-\begin_inset LatexCommand \label{OMF file}
+\begin_inset LatexCommand label
+name "OMF file"
\end_inset
\end_inset
-debug).
- The (Intel)
+ The (Intel)
\emph on
- a
+a
\emph default
bsolute
\emph on
\emph default
ormat is a subformat of the OMF51 format and is commonly used by third party
tools (debuggers
-\begin_inset LatexCommand \index{Debugger}
+\begin_inset LatexCommand index
+name "Debugger"
\end_inset
\begin_layout Itemize
sourcefile.dump*
-\begin_inset LatexCommand \index{<file>.dump*}
+\begin_inset LatexCommand index
+name "<file>.dump*"
\end_inset
\end_inset
-dumpall) (see section
-\begin_inset LatexCommand \ref{sub:Intermediate-Dump-Options}
+\begin_inset LatexCommand ref
+reference "sub:Intermediate-Dump-Options"
\end_inset
\InsetSpace ~
and section
-\begin_inset LatexCommand \ref{sub:The-anatomy-of}
+\begin_inset LatexCommand ref
+reference "sub:The-anatomy-of"
\end_inset
\begin_layout Subsection
Postprocessing the Intel Hex
-\begin_inset LatexCommand \index{Intel hex format}
+\begin_inset LatexCommand index
+name "Intel hex format"
\end_inset
file
-\begin_inset LatexCommand \label{sub:Postprocessing-the-Intel}
+\begin_inset LatexCommand label
+name "sub:Postprocessing-the-Intel"
\end_inset
\begin_layout Standard
In most cases this won't be needed but the Intel Hex file
-\begin_inset LatexCommand \index{<file>.ihx}
+\begin_inset LatexCommand index
+name "<file>.ihx"
\end_inset
packihx
\family default
-\begin_inset LatexCommand \index{packihx (tool)}
+\begin_inset LatexCommand index
+name "packihx (tool)"
\end_inset
\newline
\newline
-
+
\family sans
\series bold
- packihx sourcefile.ihx >sourcefile.hex
+packihx sourcefile.ihx >sourcefile.hex
\family default
\series default
\newline
\newline
-The separately available
+The separately available
\emph on
- srecord
+srecord
\emph default
-\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+\begin_inset LatexCommand index
+name "srecord (bin, hex, ... tool)"
\end_inset
package additionally allows to set undefined locations to a predefined
value, to insert checksums
-\begin_inset LatexCommand \index{checksum}
+\begin_inset LatexCommand index
+name "checksum"
\end_inset
\begin_layout Standard
the command backfills
-\begin_inset LatexCommand \index{backfill unused memory}
+\begin_inset LatexCommand index
+name "backfill unused memory"
\end_inset
\family default
\series default
The srecord package is available at
-\begin_inset LatexCommand \url{http://sf.net/projects/srecord}
+\begin_inset LatexCommand url
+target "http://sf.net/projects/srecord"
\end_inset
main()
\emph default
function and link
-\begin_inset LatexCommand \index{Linker}
+\begin_inset LatexCommand index
+name "Linker"
\end_inset
\family default
\series default
-\begin_inset LatexCommand \index{<file>.rel}
+\begin_inset LatexCommand index
+name "<file>.rel"
\end_inset
\newline
Alternatively,
\emph on
-foomain.c
+foomain.c
\emph default
-can be separately compiled as well:
+ can be separately compiled as well:
\family sans
\series bold
\emph on
main()
\emph default
- function
-\emph on
-
-\emph default
+ function
\noun on
must
\noun default
file specified in the command line, since the linkage editor processes
file in the order they are presented to it.
The linker is invoked from SDCC using a script file with extension .lnk
-\begin_inset LatexCommand \index{<file>.lnk}
+\begin_inset LatexCommand index
+name "<file>.lnk"
\end_inset
\begin_layout Subsection
Projects with Additional Libraries
-\begin_inset LatexCommand \index{Libraries}
+\begin_inset LatexCommand index
+name "Libraries"
\end_inset
for how to create a
\emph on
.lib
-\begin_inset LatexCommand \index{<file>.lib}
+\begin_inset LatexCommand index
+name "<file>.lib"
\end_inset
\emph on
foomain.c
\emph default
- and a library
+ and a library
\emph on
- foolib.lib
+foolib.lib
\emph default
in the directory
\emph on
\family default
\series default
-Note here that
+Note here that
\emph on
- mylib
+mylib
\emph default
must be an absolute path name.
\newline
The most efficient way to use libraries is
to keep separate modules in separate source files.
The lib file now should name all the modules.rel
-\begin_inset LatexCommand \index{<file>.rel}
+\begin_inset LatexCommand index
+name "<file>.rel"
\end_inset
\begin_layout Subsection
Using sdcclib to Create and Manage Libraries
-\begin_inset LatexCommand \index{sdcclib}
+\begin_inset LatexCommand index
+name "sdcclib"
\end_inset
\family sans
\series bold
sdcclib -?
-\begin_inset LatexCommand \index{sdcclib}
+\begin_inset LatexCommand index
+name "sdcclib"
\end_inset
sdcclib libint.lib _divsint.rel
\family default
-\begin_inset LatexCommand \index{sdcclib}
+\begin_inset LatexCommand index
+name "sdcclib"
\end_inset
sdcclib -s libint.lib
\family default
-\begin_inset LatexCommand \index{sdcclib}
+\begin_inset LatexCommand index
+name "sdcclib"
\end_inset
\end_inset
-debug
-\begin_inset LatexCommand \index{-\/-debug}
+\begin_inset LatexCommand index
+name "-\\/-debug"
\end_inset
file as well.
The library files created with sdcclib are plain text files, so they can
be viewed with a text editor.
- It is not recomended to modify a library file created with sdcclib using
- a text editor, as there are file indexes numbers located accross the file
+ It is not recommended to modify a library file created with sdcclib using
+ a text editor, as there are file indexes numbers located across the file
used by the linker to quickly locate the required module to link.
Once a .rel file (as well as a .adb file) is added to a library using sdcclib,
it can be safely deleted, since all the information required for linking
is embedded in the library file itself.
Library files created using sdcclib are used as described in the preceding
sections.
+\end_layout
+
+\begin_layout Subsection
+Using ar to Create and Manage Libraries
+\begin_inset LatexCommand index
+name "ar"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Support for ar format libraries was introduced in sdcc 2.9.0.
+ Ar is a standard archive managing utility on unices (Linux, Mac OS X, several
+ unix flavors) so it is not included in the sdcc package.
+\series bold
+
+\newline
+
+\newline
+
+\series default
+For Windows platform you can find ar utility in GNU binutils package included
+ in several projects: Cygwin at
+\begin_inset LatexCommand url
+target "http://www.cygwin.com/"
+
+\end_inset
+
+, MinGW at
+\begin_inset LatexCommand url
+target "http://www.mingw.org/"
+
+\end_inset
+
+.
+\series bold
+
+\newline
+
+\newline
+
+\series default
+Both the GNU and BSD ar format variants are suppurated by asxxxx linkers.
+ Ar doesn't understand the asxxxx object file format, so there is a special
+ version of ranlib distributed with sdcc, called asranlib, which produces
+ the ar symbol lookup table.
+\series bold
+
+\newline
+
+\newline
+
+\series default
+To create a library containing asxxxx object files, you should use the following
+ sequence:
+\series bold
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+ar -Sq <library name>.lib <list of .rel files>
+\end_layout
+
+\begin_layout Standard
+
+\family sans
+\series bold
+asranlib <library name>.lib
+\end_layout
+
+\begin_layout Standard
\begin_inset VSpace bigskip
\end_inset
\begin_layout Section
Command Line Options
-\begin_inset LatexCommand \index{Command Line Options}
+\begin_inset LatexCommand index
+name "Command Line Options"
\end_inset
-\begin_inset LatexCommand \label{sec:Command-Line-Options}
+\begin_inset LatexCommand label
+name "sec:Command-Line-Options"
\end_inset
\begin_layout Subsection
Processor Selection Options
-\begin_inset LatexCommand \index{Options processor selection}
+\begin_inset LatexCommand index
+name "Options processor selection"
\end_inset
-\begin_inset LatexCommand \index{Processor selection options}
+\begin_inset LatexCommand index
+name "Processor selection options"
\end_inset
\series bold
-mmcs51
-\begin_inset LatexCommand \index{-mmcs51}
+\begin_inset LatexCommand index
+name "-mmcs51"
\end_inset
\series default
Generate code for the Intel MCS51
-\begin_inset LatexCommand \index{MCS51}
+\begin_inset LatexCommand index
+name "MCS51"
\end_inset
\series bold
-mds390
-\begin_inset LatexCommand \index{-mds390}
+\begin_inset LatexCommand index
+name "-mds390"
\end_inset
\series default
Generate code for the Dallas DS80C390
-\begin_inset LatexCommand \index{DS80C390}
+\begin_inset LatexCommand index
+name "DS80C390"
\end_inset
\series bold
-mds400
-\begin_inset LatexCommand \index{-mds400}
+\begin_inset LatexCommand index
+name "-mds400"
\end_inset
\series default
Generate code for the Dallas DS80C400
-\begin_inset LatexCommand \index{DS80C400}
+\begin_inset LatexCommand index
+name "DS80C400"
\end_inset
\series bold
-mhc08
-\begin_inset LatexCommand \index{-mhc08}
+\begin_inset LatexCommand index
+name "-mhc08"
\end_inset
\series default
Generate code for the Freescale/Motorola HC08
-\begin_inset LatexCommand \index{HC08}
+\begin_inset LatexCommand index
+name "HC08"
\end_inset
\series bold
-mz80
-\begin_inset LatexCommand \index{-mz80}
+\begin_inset LatexCommand index
+name "-mz80"
\end_inset
\series default
Generate code for the Zilog Z80
-\begin_inset LatexCommand \index{Z80}
+\begin_inset LatexCommand index
+name "Z80"
\end_inset
\series bold
-mgbz80
-\begin_inset LatexCommand \index{-mgbz80}
+\begin_inset LatexCommand index
+name "-mgbz80"
\end_inset
\series default
Generate code for the GameBoy Z80
-\begin_inset LatexCommand \index{gbz80 (GameBoy Z80)}
+\begin_inset LatexCommand index
+name "gbz80 (GameBoy Z80)"
\end_inset
\series bold
-mavr
-\begin_inset LatexCommand \index{-mavr}
+\begin_inset LatexCommand index
+name "-mavr"
\end_inset
\series default
Generate code for the Atmel AVR
-\begin_inset LatexCommand \index{AVR}
+\begin_inset LatexCommand index
+name "AVR"
\end_inset
processor (Not maintained, not complete).
AVR users should probably have a look at winavr
-\begin_inset LatexCommand \url{http://sourceforge.net/projects/winavr}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/winavr"
\end_inset
or
-\begin_inset LatexCommand \url{http://www.avrfreaks.net/index.php?name=PNphpBB2&file=index}
+\begin_inset LatexCommand url
+target "http://www.avrfreaks.net/index.php?name=PNphpBB2&file=index"
\end_inset
\series bold
-mpic14
-\begin_inset LatexCommand \index{-mpic14}
+\begin_inset LatexCommand index
+name "-mpic14"
\end_inset
\series default
Generate code for the Microchip PIC 14
-\begin_inset LatexCommand \index{PIC14}
+\begin_inset LatexCommand index
+name "PIC14"
\end_inset
\series bold
-mpic16
-\begin_inset LatexCommand \index{-mpic16}
+\begin_inset LatexCommand index
+name "-mpic16"
\end_inset
\series default
Generate code for the Microchip PIC 16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
-mtlcs900h
\series default
Generate code for the Toshiba TLCS-900H
-\begin_inset LatexCommand \index{TLCS-900H}
+\begin_inset LatexCommand index
+name "TLCS-900H"
\end_inset
\series bold
-mxa51
-\begin_inset LatexCommand \index{-mxa51}
+\begin_inset LatexCommand index
+name "-mxa51"
\end_inset
\series default
Generate code for the Phillips XA51
-\begin_inset LatexCommand \index{XA51}
+\begin_inset LatexCommand index
+name "XA51"
\end_inset
\begin_layout Subsection
Preprocessor Options
-\begin_inset LatexCommand \index{Options preprocessor}
+\begin_inset LatexCommand index
+name "Options preprocessor"
\end_inset
-\begin_inset LatexCommand \index{Preprocessor options}
+\begin_inset LatexCommand index
+name "Preprocessor options"
\end_inset
-\begin_inset LatexCommand \index{sdcpp (preprocessor)}
+\begin_inset LatexCommand index
+name "sdcpp (preprocessor)"
\end_inset
\series bold
-I<path>
-\begin_inset LatexCommand \index{-I<path>}
+\begin_inset LatexCommand index
+name "-I<path>"
\end_inset
\series bold
-D<macro[=value]>
-\begin_inset LatexCommand \index{-D<macro[=value]>}
+\begin_inset LatexCommand index
+name "-D<macro[=value]>"
\end_inset
\series bold
-M
-\begin_inset LatexCommand \index{-M}
+\begin_inset LatexCommand index
+name "-M"
\end_inset
The list of rules is printed on standard output instead of the preprocessed
C program.
`-M' implies `-E
-\begin_inset LatexCommand \index{-E}
+\begin_inset LatexCommand index
+name "-E"
\end_inset
\series bold
-C
-\begin_inset LatexCommand \index{-C}
+\begin_inset LatexCommand index
+name "-C"
\end_inset
\series bold
-MM
-\begin_inset LatexCommand \index{-MM}
+\begin_inset LatexCommand index
+name "-MM"
\end_inset
+\series default
\size large
-\bar under
-\series default
\size default
-\bar default
Like `-M' but the output mentions only the user header files included with
`#include
\begin_inset Quotes eld
\series bold
-Aquestion(answer)
-\begin_inset LatexCommand \index{-Aquestion(answer)}
+\begin_inset LatexCommand index
+name "-Aquestion(answer)"
\end_inset
\series bold
-Umacro
-\begin_inset LatexCommand \index{-Umacro}
+\begin_inset LatexCommand index
+name "-Umacro"
\end_inset
\series bold
-dM
-\begin_inset LatexCommand \index{-dM}
+\begin_inset LatexCommand index
+name "-dM"
\end_inset
\series bold
-dD
-\begin_inset LatexCommand \index{-dD}
+\begin_inset LatexCommand index
+name "-dD"
\end_inset
\series bold
-dN
-\begin_inset LatexCommand \index{-dN}
+\begin_inset LatexCommand index
+name "-dN"
\end_inset
+\series default
\size large
-\bar under
-\series default
\size default
-\bar default
Like `-dD' except that the macro arguments and contents are omitted.
Only `#define name' is included in the output.
\end_layout
\series bold
-pedantic-parse-number
-\begin_inset LatexCommand \index{pedantic}
+\begin_inset LatexCommand index
+name "pedantic"
\end_inset
-\begin_inset LatexCommand \index{-pedantic-parse-number}
+\begin_inset LatexCommand index
+name "-pedantic-parse-number"
\end_inset
\size large
\bar under
-\begin_inset LatexCommand \label{lyx:-pedantic-parse-number}
+\begin_inset LatexCommand label
+name "lyx:-pedantic-parse-number"
\end_inset
-
+
\series default
-\size default
\bar default
+
+\size default
Pedantic parse numbers so that situations like 0xfe-LO_B(3) are parsed properly
and the macro LO_B(3) gets expanded.
See also #pragma pedantic_parse_number
-\begin_inset LatexCommand \vpageref{ite:pedantic_parse_number}
+\begin_inset LatexCommand vpageref
+reference "ite:pedantic_parse_number"
\end_inset
in section
-\begin_inset LatexCommand \ref{sec:Pragmas}
+\begin_inset LatexCommand ref
+reference "sec:Pragmas"
\end_inset
preprocessorOption[,preprocessorOption]
\series default
-\begin_inset LatexCommand \index{-Wp preprocessorOption[,preprocessorOption]}
+\begin_inset LatexCommand index
+name "-Wp preprocessorOption[,preprocessorOption]"
\end_inset
sdcpp
\family default
-\begin_inset LatexCommand \index{sdcpp (preprocessor)}
+\begin_inset LatexCommand index
+name "sdcpp (preprocessor)"
\end_inset
.
- SDCC uses an adapted version of the preprocessor
-\emph on
-cpp
-\emph default
- of the GNU Compiler Collection
-\begin_inset LatexCommand \index{gcc (GNU Compiler Collection)}
+ SDCC uses an adapted version of the GNU Compiler Collection
+\begin_inset LatexCommand index
+name "gcc (GNU Compiler Collection)"
\end_inset
+ preprocessor
+\emph on
+cpp
+\emph default
(
\emph on
gcc
\emph default
-\begin_inset LatexCommand \url{http://gcc.gnu.org/}
+\begin_inset LatexCommand url
+target "http://gcc.gnu.org/"
\end_inset
-), if you need more dedicated options please refer to the GCC\InsetSpace ~
-4.1.1\InsetSpace ~
+).
+ If you need more dedicated options please refer to the GCC\InsetSpace ~
CPP\InsetSpace ~
-Manual
- at
-\begin_inset LatexCommand \htmlurl{http://www.gnu.org/software/gcc/onlinedocs/}
+Manual at
+
+\begin_inset LatexCommand htmlurl
+target "http://www.gnu.org/software/gcc/onlinedocs/"
\end_inset
\begin_layout Subsection
Linker Options
-\begin_inset LatexCommand \index{Options linker}
+\begin_inset LatexCommand index
+name "Options linker"
\end_inset
-\begin_inset LatexCommand \index{Linker options}
+\begin_inset LatexCommand index
+name "Linker options"
\end_inset
\series bold
-lib-path
-\begin_inset LatexCommand \index{-\/-lib-path <path>}
+\begin_inset LatexCommand index
+name "-\\/-lib-path <path>"
\end_inset
-\begin_inset LatexCommand \index{-L -\/-lib-path}
+\begin_inset LatexCommand index
+name "-L <path>"
\end_inset
\InsetSpace ~
<absolute path to additional libraries> This option is passed to the linkage
editor's additional libraries
-\begin_inset LatexCommand \index{Libraries}
+\begin_inset LatexCommand index
+name "Libraries"
\end_inset
-xram-loc
\series default
-\begin_inset LatexCommand \index{-\/-xram-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-xram-loc <Value>"
\end_inset
\InsetSpace ~
<Value> The start location of the external ram
-\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "xdata (mcs51, ds390 storage class)"
\end_inset
-code-loc
\series default
-\begin_inset LatexCommand \index{-\/-code-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-code-loc <Value>"
\end_inset
\InsetSpace ~
<Value> The start location of the code
-\begin_inset LatexCommand \index{code}
+\begin_inset LatexCommand index
+name "code"
\end_inset
segment, default value 0.
Note when this option is used the interrupt vector table
-\begin_inset LatexCommand \index{interrupt vector table}
+\begin_inset LatexCommand index
+name "interrupt vector table"
\end_inset
-stack-loc
\series default
-\begin_inset LatexCommand \index{-\/-stack-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-stack-loc <Value>"
\end_inset
\InsetSpace ~
<Value> By default the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
\series default
\InsetSpace ~
-\begin_inset LatexCommand \index{-\/-pack-iram}
+\begin_inset LatexCommand index
+name "-\\/-pack-iram"
\end_inset
\series default
\InsetSpace ~
-\begin_inset LatexCommand \index{-\/-no-pack-iram}
+\begin_inset LatexCommand index
+name "-\\/-no-pack-iram"
\end_inset
-xstack-loc
\series default
-\begin_inset LatexCommand \index{-\/-xstack-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-xstack-loc <Value>"
\end_inset
\InsetSpace ~
<Value> By default the external stack
-\begin_inset LatexCommand \index{xstack}
+\begin_inset LatexCommand index
+name "xstack"
\end_inset
is placed after the pdata
-\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "pdata (mcs51, ds390 storage class)"
\end_inset
-data-loc
\series default
-\begin_inset LatexCommand \index{-\/-data-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-data-loc <Value>"
\end_inset
\InsetSpace ~
<Value> The start location of the internal ram data
-\begin_inset LatexCommand \index{data (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "data (mcs51, ds390 storage class)"
\end_inset
-idata-loc
\series default
-\begin_inset LatexCommand \index{-\/-idata-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-idata-loc <Value>"
\end_inset
\InsetSpace ~
<Value> The start location of the indirectly addressable internal ram
-\begin_inset LatexCommand \index{idata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "idata (mcs51, ds390 storage class)"
\end_inset
\series default
\InsetSpace ~
<Value> The start location of the bit
-\begin_inset LatexCommand \index{bit}
+\begin_inset LatexCommand index
+name "bit"
\end_inset
\end_inset
-out-fmt-ihx
-\begin_inset LatexCommand \index{-\/-out-fmt-ihx}
+\begin_inset LatexCommand index
+name "-\\/-out-fmt-ihx"
\end_inset
-
-\bar under
\series default
-\bar default
The linker output (final object code) is in Intel Hex format.
-\begin_inset LatexCommand \index{Intel hex format}
+\begin_inset LatexCommand index
+name "Intel hex format"
\end_inset
This is the default option.
The format itself is documented in the documentation of srecord
-\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+\begin_inset LatexCommand index
+name "srecord (bin, hex, ... tool)"
\end_inset
\end_inset
-out-fmt-s19
-\begin_inset LatexCommand \index{-\/-out-fmt-s19}
+\begin_inset LatexCommand index
+name "-\\/-out-fmt-s19"
\end_inset
-
-\bar under
\series default
-\bar default
The linker output (final object code) is in Motorola S19 format
-\begin_inset LatexCommand \index{Motorola S19 format}
+\begin_inset LatexCommand index
+name "Motorola S19 format"
\end_inset
\end_inset
-out-fmt-elf
-\begin_inset LatexCommand \index{-\/-out-fmt-s19}
+\begin_inset LatexCommand index
+name "-\\/-out-fmt-s19"
\end_inset
-\begin_inset LatexCommand \index{HC08!Options!-\/-out-fmt-elf}
+\begin_inset LatexCommand index
+name "HC08!Options!-\\/-out-fmt-elf"
\end_inset
-
-\bar under
\series default
-\bar default
The linker output (final object code) is in ELF format
-\begin_inset LatexCommand \index{ELF format}
+\begin_inset LatexCommand index
+name "ELF format"
\end_inset
.
(Currently only supported for the HC08
-\begin_inset LatexCommand \index{HC08}
+\begin_inset LatexCommand index
+name "HC08"
\end_inset
linkOption[,linkOption]
\series default
-\begin_inset LatexCommand \index{-Wl linkOption[,linkOption]}
+\begin_inset LatexCommand index
+name "-Wl linkOption[,linkOption]"
\end_inset
-\begin_inset LatexCommand \label{lyx:-Wl option}
+\begin_inset LatexCommand label
+name "lyx:-Wl option"
\end_inset
Either use the double quotes around this option or use no space (e.g.
-Wl-bCSEG=0x1000).
See also #pragma constseg and #pragma codeseg in section
-\begin_inset LatexCommand \ref{sec:Pragmas}
+\begin_inset LatexCommand ref
+reference "sec:Pragmas"
\end_inset
\begin_layout Subsection
MCS51 Options
-\begin_inset LatexCommand \index{Options MCS51}
+\begin_inset LatexCommand index
+name "Options MCS51"
\end_inset
-\begin_inset LatexCommand \index{MCS51 options}
+\begin_inset LatexCommand index
+name "MCS51 options"
\end_inset
\end_inset
-model-small
-\begin_inset LatexCommand \index{-\/-model-small}
+\begin_inset LatexCommand index
+name "-\\/-model-small"
\end_inset
\series default
\size large
-\emph on
\size default
-\emph default
Generate code for Small Model programs, see section Memory Models for more
details.
This is the default model.
\end_inset
-model-medium
-\begin_inset LatexCommand \index{-\/-model-medium}
+\begin_inset LatexCommand index
+name "-\\/-model-medium"
\end_inset
\end_inset
-model-large
-\begin_inset LatexCommand \index{-\/-model-large}
+\begin_inset LatexCommand index
+name "-\\/-model-large"
\end_inset
\end_inset
-xstack
-\begin_inset LatexCommand \index{-\/-xstack}
+\begin_inset LatexCommand index
+name "-\\/-xstack"
\end_inset
\series default
Uses a pseudo stack in the pdata
-\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "pdata (mcs51, ds390 storage class)"
\end_inset
area (usually the first 256 bytes in the external ram) for allocating variables
and passing parameters.
See section
-\begin_inset LatexCommand \ref{sub:External-Stack}
+\begin_inset LatexCommand ref
+reference "sub:External-Stack"
\end_inset
\series default
\InsetSpace ~
<Value>
-\begin_inset LatexCommand \index{-\/-iram-size <Value>}
+\begin_inset LatexCommand index
+name "-\\/-iram-size <Value>"
\end_inset
\series default
\InsetSpace ~
<Value>
-\begin_inset LatexCommand \index{-\/-xram-size <Value>}
+\begin_inset LatexCommand index
+name "-\\/-xram-size <Value>"
\end_inset
\series default
\InsetSpace ~
<Value>
-\begin_inset LatexCommand \index{-\/-code-size <Value>}
+\begin_inset LatexCommand index
+name "-\\/-code-size <Value>"
\end_inset
\series default
\InsetSpace ~
<Value>
-\begin_inset LatexCommand \index{-\/-stack-size <Value>}
+\begin_inset LatexCommand index
+name "-\\/-stack-size <Value>"
\end_inset
\series default
\InsetSpace ~
-\begin_inset LatexCommand \index{-\/-pack-iram}
+\begin_inset LatexCommand index
+name "-\\/-pack-iram"
\end_inset
\series default
\InsetSpace ~
-\begin_inset LatexCommand \index{-\/-no-pack-iram}
+\begin_inset LatexCommand index
+name "-\\/-no-pack-iram"
\end_inset
\series default
\InsetSpace ~
-\begin_inset LatexCommand \index{-\/-acall-ajmp}
+\begin_inset LatexCommand index
+name "-\\/-acall-ajmp"
\end_inset
\begin_layout Subsection
DS390 / DS400 Options
-\begin_inset LatexCommand \index{Options DS390}
+\begin_inset LatexCommand index
+name "Options DS390"
\end_inset
-\begin_inset LatexCommand \index{DS390}
+\begin_inset LatexCommand index
+name "DS390"
\end_inset
-model-flat24
\series default
-\begin_inset LatexCommand \index{DS390!Options!-\/-model-flat24}
+\begin_inset LatexCommand index
+name "DS390!Options!-\\/-model-flat24"
\end_inset
\size large
-\emph on
\size default
-\emph default
Generate 24-bit flat mode code.
This is the one and only that the ds390 code generator supports right now
and is default when using
\end_inset
-protect-sp-update
-\begin_inset LatexCommand \index{DS390!Options!-\/-protect-sp-update}
+\begin_inset LatexCommand index
+name "DS390!Options!-\\/-protect-sp-update"
\end_inset
-stack-10bit
\series default
-\begin_inset LatexCommand \index{DS390!Options!-\/-stack-10bit}
+\begin_inset LatexCommand index
+name "DS390!Options!-\\/-stack-10bit"
\end_inset
\end_inset
-stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
\end_inset
\end_inset
-xstack
-\begin_inset LatexCommand \index{-\/-xstack}
+\begin_inset LatexCommand index
+name "-\\/-xstack"
\end_inset
\end_inset
-stack-probe
-\begin_inset LatexCommand \index{DS390!Options!-\/-stack-probe}
+\begin_inset LatexCommand index
+name "DS390!Options!-\\/-stack-probe"
\end_inset
\end_inset
-tini-libid
-\begin_inset LatexCommand \index{DS390!Options!-\/-tini-libid}
+\begin_inset LatexCommand index
+name "DS390!Options!-\\/-tini-libid"
\end_inset
\end_inset
-use-accelerator
-\begin_inset LatexCommand \index{DS390!Options!-\/-use-accelerator}
+\begin_inset LatexCommand index
+name "DS390!Options!-\\/-use-accelerator"
\end_inset
\begin_layout Subsection
Z80 Options
-\begin_inset LatexCommand \index{Options Z80}
+\begin_inset LatexCommand index
+name "Options Z80"
\end_inset
-\begin_inset LatexCommand \index{Z80}
+\begin_inset LatexCommand index
+name "Z80"
\end_inset
-callee-saves-bc
\series default
-\begin_inset LatexCommand \index{Z80!Options!-\/-callee-saves-bc}
+\begin_inset LatexCommand index
+name "Z80!Options!-\\/-callee-saves-bc"
\end_inset
\size large
-\emph on
\size default
-\emph default
Force a called function to always save BC.
\end_layout
-no-std-crt0
\series default
-\begin_inset LatexCommand \index{Z80!Options!-\/-no-std-crt0}
+\begin_inset LatexCommand index
+name "Z80!Options!-\\/-no-std-crt0"
\end_inset
-portmode=
\series default
<Value>
-\begin_inset LatexCommand \index{Z80!Options!-\/-portmode=<Value>}
+\begin_inset LatexCommand index
+name "Z80!Options!-\\/-portmode=<Value>"
\end_inset
-asm=
\series default
<Value>
-\begin_inset LatexCommand \index{Z80!Options!-\/-asm=<Value>}
+\begin_inset LatexCommand index
+name "Z80!Options!-\\/-asm=<Value>"
\end_inset
\series default
\InsetSpace ~
<Value>
-\begin_inset LatexCommand \index{Z80!Options!-\/-codeseg <Value>}
+\begin_inset LatexCommand index
+name "Z80!Options!-\\/-codeseg <Value>"
\end_inset
\series default
\InsetSpace ~
<Value>
-\begin_inset LatexCommand \index{Z80!Options!-\/-constseg <Value>}
+\begin_inset LatexCommand index
+name "Z80!Options!-\\/-constseg <Value>"
\end_inset
\begin_layout Subsection
GBZ80 Options
-\begin_inset LatexCommand \index{Options GBZ80}
+\begin_inset LatexCommand index
+name "Options GBZ80"
\end_inset
-\begin_inset LatexCommand \index{GBZ80}
+\begin_inset LatexCommand index
+name "GBZ80"
\end_inset
-callee-saves-bc
\series default
-\begin_inset LatexCommand \index{GBZ80!Options!-\/-callee-saves-bc}
+\begin_inset LatexCommand index
+name "GBZ80!Options!-\\/-callee-saves-bc"
\end_inset
\size large
-\emph on
\size default
-\emph default
Force a called function to always save BC.
\end_layout
-no-std-crt0
\series default
-\begin_inset LatexCommand \index{Z80!Options!-\/-no-std-crt0}
+\begin_inset LatexCommand index
+name "Z80!Options!-\\/-no-std-crt0"
\end_inset
\series default
\InsetSpace ~
<Num>
-\begin_inset LatexCommand \index{GBZ80!Options!-bo <Num>}
+\begin_inset LatexCommand index
+name "GBZ80!Options!-bo <Num>"
\end_inset
\series default
\InsetSpace ~
<Num>
-\begin_inset LatexCommand \index{GBZ80!Options!-ba <Num>}
+\begin_inset LatexCommand index
+name "GBZ80!Options!-ba <Num>"
\end_inset
\series default
\InsetSpace ~
<Value>
-\begin_inset LatexCommand \index{GBZ80!Options!-\/-codeseg <Value>}
+\begin_inset LatexCommand index
+name "GBZ80!Options!-\\/-codeseg <Value>"
\end_inset
\series default
\InsetSpace ~
<Value>
-\begin_inset LatexCommand \index{GBZ80!Options!-\/-constseg <Value>}
+\begin_inset LatexCommand index
+name "GBZ80!Options!-\\/-constseg <Value>"
\end_inset
\begin_layout Subsection
Optimization Options
-\begin_inset LatexCommand \index{Options optimization}
+\begin_inset LatexCommand index
+name "Options optimization"
\end_inset
-\begin_inset LatexCommand \index{Optimization options}
+\begin_inset LatexCommand index
+name "Optimization options"
\end_inset
\end_inset
-nogcse
-\begin_inset LatexCommand \index{-\/-nogcse}
+\begin_inset LatexCommand index
+name "-\\/-nogcse"
\end_inset
loc
\emph default
ations, sloc
-\begin_inset LatexCommand \index{sloc (spill location)}
+\begin_inset LatexCommand index
+name "sloc (spill location)"
\end_inset
will indicate the number of extra bytes it allocated.
It is recommended that this option NOT be used, #pragma\InsetSpace ~
nogcse
-\begin_inset LatexCommand \index{\#pragma nogcse}
+\begin_inset LatexCommand index
+name "\\#pragma nogcse"
\end_inset
can be used to turn off global subexpression elimination
-\begin_inset LatexCommand \index{Subexpression elimination}
+\begin_inset LatexCommand index
+name "Subexpression elimination"
\end_inset
\end_inset
-noinvariant
-\begin_inset LatexCommand \index{-\/-noinvariant}
+\begin_inset LatexCommand index
+name "-\\/-noinvariant"
\end_inset
explained for the previous option.
For more details of loop optimizations performed see Loop Invariants in
section
-\begin_inset LatexCommand \ref{sub:Loop-Optimizations}
+\begin_inset LatexCommand ref
+reference "sub:Loop-Optimizations"
\end_inset
.
It is recommended that this option NOT be used, #pragma\InsetSpace ~
noinvariant
-\begin_inset LatexCommand \index{\#pragma noinvariant}
+\begin_inset LatexCommand index
+name "\\#pragma noinvariant"
\end_inset
\end_inset
-noinduction
-\begin_inset LatexCommand \index{-\/-noinduction}
+\begin_inset LatexCommand index
+name "-\\/-noinduction"
\end_inset
for more details.
It is recommended that this option is NOT used, #pragma\InsetSpace ~
noinduction
-\begin_inset LatexCommand \index{\#pragma noinduction}
+\begin_inset LatexCommand index
+name "\\#pragma noinduction"
\end_inset
\end_inset
-nojtbound
-\begin_inset LatexCommand \index{-\/-nojtbound}
+\begin_inset LatexCommand index
+name "-\\/-nojtbound"
\end_inset
\size large
-\bar under
\series default
\size default
-\bar default
Will not generate boundary condition check when switch statements
-\begin_inset LatexCommand \index{switch statement}
+\begin_inset LatexCommand index
+name "switch statement"
\end_inset
are implemented using jump-tables.
See section
-\begin_inset LatexCommand \ref{sub:'switch'-Statements}
+\begin_inset LatexCommand ref
+reference "sub:'switch'-Statements"
\end_inset
Switch Statements for more details.
It is recommended that this option is NOT used, #pragma\InsetSpace ~
nojtbound
-\begin_inset LatexCommand \index{\#pragma nojtbound}
+\begin_inset LatexCommand index
+name "\\#pragma nojtbound"
\end_inset
\end_inset
-noloopreverse
-\begin_inset LatexCommand \index{-\/-noloopreverse}
+\begin_inset LatexCommand index
+name "-\\/-noloopreverse"
\end_inset
\size default
Will not do loop reversal
-\begin_inset LatexCommand \index{Loop reversing}
+\begin_inset LatexCommand index
+name "Loop reversing"
\end_inset
nolabelopt
\series default
-\begin_inset LatexCommand \index{-\/-nolabelopt }
+\begin_inset LatexCommand index
+name "-\\/-nolabelopt "
\end_inset
\end_inset
-no-xinit-opt
-\begin_inset LatexCommand \index{-\/-no-xinit-opt}
+\begin_inset LatexCommand index
+name "-\\/-no-xinit-opt"
\end_inset
\series default
Will not memcpy initialized data from code space into xdata space.
This saves a few bytes in code space if you don't have initialized data
-\begin_inset LatexCommand \index{Variable initialization}
+\begin_inset LatexCommand index
+name "Variable initialization"
\end_inset
\end_inset
-nooverlay
-\begin_inset LatexCommand \index{-\/-nooverlay}
+\begin_inset LatexCommand index
+name "-\\/-nooverlay"
\end_inset
\end_inset
-no-peep
-\begin_inset LatexCommand \index{-\/-no-peep}
+\begin_inset LatexCommand index
+name "-\\/-no-peep"
\end_inset
-peep-file
\series default
-\begin_inset LatexCommand \index{-\/-peep-file}
+\begin_inset LatexCommand index
+name "-\\/-peep-file"
\end_inset
<filename> This option can be used to use additional rules to be used by
the peep hole optimizer.
See section
-\begin_inset LatexCommand \ref{sub:Peephole-Optimizer}
+\begin_inset LatexCommand ref
+reference "sub:Peephole-Optimizer"
\end_inset
\end_inset
-peep-asm
-\begin_inset LatexCommand \index{-\/-peep-asm}
+\begin_inset LatexCommand index
+name "-\\/-peep-asm"
\end_inset
Pass the inline assembler code through the peep hole optimizer.
This can cause unexpected changes to inline assembler code, please go through
the peephole optimizer
-\begin_inset LatexCommand \index{Peephole optimizer}
+\begin_inset LatexCommand index
+name "Peephole optimizer"
\end_inset
\end_inset
-opt-code-speed
-\begin_inset LatexCommand \index{-\/-opt-code-speed}
+\begin_inset LatexCommand index
+name "-\\/-opt-code-speed"
\end_inset
\end_inset
-opt-code-size
-\begin_inset LatexCommand \index{-\/-opt-code-size}
+\begin_inset LatexCommand index
+name "-\\/-opt-code-size"
\end_inset
\begin_layout Subsection
Other Options
-\begin_inset LatexCommand \index{Options other}
+\begin_inset LatexCommand index
+name "Options other"
\end_inset
\begin_layout List
\labelwidthstring 00.00.0000
+\series bold
+-v\InsetSpace ~
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-version
+\begin_inset LatexCommand index
+name "-\\/-version"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "-v"
+
+\end_inset
+
+
+\series default
+ displays the sdcc version.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
\series bold
-c\InsetSpace ~
-
\end_inset
-compile-only
-\begin_inset LatexCommand \index{-\/-compile-only}
+\begin_inset LatexCommand index
+name "-\\/-compile-only"
\end_inset
-\begin_inset LatexCommand \index{-c -\/-compile-only}
+\begin_inset LatexCommand index
+name "-c"
\end_inset
\series bold
-c1mode
-\begin_inset LatexCommand \index{-\/-c1mode}
+\begin_inset LatexCommand index
+name "-\\/-c1mode"
\end_inset
\series bold
-E
-\begin_inset LatexCommand \index{-E}
+\begin_inset LatexCommand index
+name "-E"
\end_inset
\series bold
-o\InsetSpace ~
<path/file>
-\begin_inset LatexCommand \index{-o <path/file>}
+\begin_inset LatexCommand index
+name "-o <path/file>"
\end_inset
-
+
\series default
-The output path where everything will be placed or the file name used for
+ The output path where everything will be placed or the file name used for
all generated output files.
If the parameter is a path, it must have a trailing slash (or backslash
for the Windows binaries) to be recognized as a path.
-
-\emph on
-
-\emph default
-Note for Windows users: if the path contains spaces, it should be surrounded
+ Note for Windows users: if the path contains spaces, it should be surrounded
by quotes.
The trailing backslash should be doubled in order to prevent escaping the
final quote, for example:
\end_inset
-stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
\end_inset
\series default
\size large
-\emph on
\size default
-\emph default
All functions in the source file will be compiled as
\emph on
reentrant
\emph default
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
, i.e.
the parameters and local variables will be allocated on the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
.
See section
-\begin_inset LatexCommand \ref{sec:Parameters-and-Local-Variables}
+\begin_inset LatexCommand ref
+reference "sec:Parameters-and-Local-Variables"
\end_inset
\end_inset
-callee-saves
-\begin_inset LatexCommand \index{-\/-callee-saves}
+\begin_inset LatexCommand index
+name "-\\/-callee-saves"
\end_inset
-\begin_inset LatexCommand \label{lyx:--callee-saves-function1[,function2][,function3]...}
+\begin_inset LatexCommand label
+name "lyx:--callee-saves-function1[,function2][,function3]..."
\end_inset
code will be generated at the entry and exit (function prologue
\series bold
-\begin_inset LatexCommand \index{function prologue}
+\begin_inset LatexCommand index
+name "function prologue"
\end_inset
and epilogue
\series bold
-\begin_inset LatexCommand \index{function epilogue}
+\begin_inset LatexCommand index
+name "function epilogue"
\end_inset
-callee-saves option string.
Also see #pragma\InsetSpace ~
callee_saves
-\begin_inset LatexCommand \index{\#pragma callee\_saves}
+\begin_inset LatexCommand index
+name "\\#pragma callee\\_saves"
\end_inset
-\begin_inset LatexCommand \vpageref{ite:callee_saves-function1[,function2[,function3...]]--}
+\begin_inset LatexCommand vpageref
+reference "ite:callee_saves-function1[,function2[,function3...]]--"
\end_inset
\end_inset
-all-callee-saves
-\begin_inset LatexCommand \index{-\/-all-callee-saves}
+\begin_inset LatexCommand index
+name "-\\/-all-callee-saves"
\end_inset
-
-\series default
-Function of
-\series bold
-
+
\series default
--
+ Function of -
\begin_inset ERT
status collapsed
\end_inset
-debug
-\begin_inset LatexCommand \index{-\/-debug}
+\begin_inset LatexCommand index
+name "-\\/-debug"
\end_inset
-
-\bar under
\series default
-\bar default
When this option is used the compiler will generate debug information.
The debug information collected in a file with .cdb extension can be used
with the SDCDB.
For more information see documentation for SDCDB.
Another file with no extension contains debug information in AOMF or AOMF51
-\begin_inset LatexCommand \index{AOMF, AOMF51}
+\begin_inset LatexCommand index
+name "AOMF, AOMF51"
\end_inset
\series bold
-S
-\begin_inset LatexCommand \index{-S}
+\begin_inset LatexCommand index
+name "-S"
\end_inset
+\series default
\size large
-\bar under
-\series default
\size default
-\bar default
Stop after the stage of compilation proper; do not assemble.
The output is an assembler code file for the input file specified.
\end_layout
\end_inset
-int-long-reent
-\begin_inset LatexCommand \index{-\/-int-long-reent}
+\begin_inset LatexCommand index
+name "-\\/-int-long-reent"
\end_inset
\end_inset
-cyclomatic
-\begin_inset LatexCommand \index{-\/-cyclomatic}
+\begin_inset LatexCommand index
+name "-\\/-cyclomatic"
\end_inset
-
-\bar under
\series default
-\bar default
This option will cause the compiler to generate an information message for
each function in the source file.
The message contains some
graph of the function, and most importantly the
\emph on
cyclomatic complexity
-\begin_inset LatexCommand \index{Cyclomatic complexity}
+\begin_inset LatexCommand index
+name "Cyclomatic complexity"
\end_inset
\end_inset
-float-reent
-\begin_inset LatexCommand \index{-\/-float-reent}
+\begin_inset LatexCommand index
+name "-\\/-float-reent"
\end_inset
\series default
Floating point library is compiled as reentrant
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
\end_inset
-funsigned-char
-\begin_inset LatexCommand \index{-\/-funsigned-char}
+\begin_inset LatexCommand index
+name "-\\/-funsigned-char"
\end_inset
\series default
- The default signedness for every type is
+ The default signedness for every type is
\family typewriter
- signed
+signed
\family default
.
- In some embedded environments the default signedness of
+ In some embedded environments the default signedness of
\family typewriter
- char
+char
\family default
- is
+ is
\family typewriter
- unsigned
+unsigned
\family default
.
To set the signess for characters to unsigned, use the option -
\end_inset
-main-return
-\begin_inset LatexCommand \index{-\/-main-return}
+\begin_inset LatexCommand index
+name "-\\/-main-return"
\end_inset
This option results in slightly smaller code and saves two bytes of stack
space.
The return from the 'main'
-\begin_inset LatexCommand \index{main return}
+\begin_inset LatexCommand index
+name "main return"
\end_inset
\end_inset
-nostdinc
-\begin_inset LatexCommand \index{-\/-nostdinc}
+\begin_inset LatexCommand index
+name "-\\/-nostdinc"
\end_inset
\end_inset
-nostdlib
-\begin_inset LatexCommand \index{-\/-nostdlib}
+\begin_inset LatexCommand index
+name "-\\/-nostdlib"
\end_inset
\series default
This will prevent the compiler from passing on the default library
-\begin_inset LatexCommand \index{Libraries}
+\begin_inset LatexCommand index
+name "Libraries"
\end_inset
\end_inset
-verbose
-\begin_inset LatexCommand \index{-\/-verbose}
+\begin_inset LatexCommand index
+name "-\\/-verbose"
\end_inset
\series bold
-V
-\begin_inset LatexCommand \index{-V}
+\begin_inset LatexCommand index
+name "-V"
\end_inset
\end_inset
-no-c-code-in-asm
-\begin_inset LatexCommand \index{-\/-no-c-code-in-asm}
+\begin_inset LatexCommand index
+name "-\\/-no-c-code-in-asm"
\end_inset
\end_inset
-fverbose-asm
-\begin_inset LatexCommand \index{-\/-no-gen-comments}
+\begin_inset LatexCommand index
+name "-\\/-no-gen-comments"
\end_inset
\end_inset
-no-peep-comments
-\begin_inset LatexCommand \index{-\/-no-peep-comments}
+\begin_inset LatexCommand index
+name "-\\/-no-peep-comments"
\end_inset
\end_inset
-i-code-in-asm
-\begin_inset LatexCommand \index{-\/-i-code-in-asm}
+\begin_inset LatexCommand index
+name "-\\/-i-code-in-asm"
\end_inset
\end_inset
-less-pedantic
-\begin_inset LatexCommand \index{pedantic}
+\begin_inset LatexCommand index
+name "pedantic"
\end_inset
-\begin_inset LatexCommand \index{-\/-less-pedantic}
+\begin_inset LatexCommand index
+name "-\\/-less-pedantic"
\end_inset
\series default
-\begin_inset LatexCommand \label{lyx:--less-pedantic}
+\begin_inset LatexCommand label
+name "lyx:--less-pedantic"
\end_inset
Disable some of the more pedantic warnings
-\begin_inset LatexCommand \index{Warnings}
+\begin_inset LatexCommand index
+name "Warnings"
\end_inset
.
For more details, see the less_pedantic pragma
-\begin_inset LatexCommand \vpageref{ite:less_pedantic}
+\begin_inset LatexCommand vpageref
+reference "ite:less_pedantic"
\end_inset
-disable-warning\InsetSpace ~
<nnnn>
-\begin_inset LatexCommand \index{-\/-disable-warning}
+\begin_inset LatexCommand index
+name "-\\/-disable-warning"
\end_inset
\end_inset
-Werror
-\begin_inset LatexCommand \index{-\/-Werror}
+\begin_inset LatexCommand index
+name "-\\/-Werror"
\end_inset
\end_inset
-print-search-dirs
-\begin_inset LatexCommand \index{-\/-print-search-dirs}
+\begin_inset LatexCommand index
+name "-\\/-print-search-dirs"
\end_inset
\end_inset
-vc
-\begin_inset LatexCommand \index{-\/-vc}
+\begin_inset LatexCommand index
+name "-\\/-vc"
\end_inset
\series default
Display errors and warnings using MSVC style, so you can use SDCC with
the visual studio IDE
-\begin_inset LatexCommand \index{IDE}
+\begin_inset LatexCommand index
+name "IDE"
\end_inset
.
With SDCC both offering a GCC-like (the default) and a MSVC-like
-\begin_inset LatexCommand \index{MSVC output style}
+\begin_inset LatexCommand index
+name "MSVC output style"
\end_inset
\end_inset
-use-stdout
-\begin_inset LatexCommand \index{-\/-use-stdout}
+\begin_inset LatexCommand index
+name "-\\/-use-stdout"
\end_inset
asmOption[,asmOption]
\series default
-\begin_inset LatexCommand \index{-Wa asmOption[,asmOption]}
+\begin_inset LatexCommand index
+name "-Wa asmOption[,asmOption]"
\end_inset
...
Pass the asmOption to the assembler
-\begin_inset LatexCommand \index{Options assembler}
+\begin_inset LatexCommand index
+name "Options assembler"
\end_inset
-\begin_inset LatexCommand \index{Assembler options}
+\begin_inset LatexCommand index
+name "Assembler options"
\end_inset
\end_inset
-std-sdcc89
-\begin_inset LatexCommand \index{-\/-std-sdcc89}
+\begin_inset LatexCommand index
+name "-\\/-std-sdcc89"
\end_inset
\end_inset
-std-c89
-\begin_inset LatexCommand \index{-\/-std-c89}
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
\end_inset
\end_inset
-std-sdcc99
-\begin_inset LatexCommand \index{-\/-std-sdcc99}
+\begin_inset LatexCommand index
+name "-\\/-std-sdcc99"
\end_inset
\end_inset
-std-c99
-\begin_inset LatexCommand \index{-\/-std-sdcc99}
+\begin_inset LatexCommand index
+name "-\\/-std-sdcc99"
\end_inset
-codeseg
\series default
-\begin_inset LatexCommand \index{-\/-codeseg <Value>}
+\begin_inset LatexCommand index
+name "-\\/-codeseg <Value>"
\end_inset
-\begin_inset LatexCommand \label{lyx:-codeseg}
+\begin_inset LatexCommand label
+name "lyx:-codeseg"
\end_inset
\InsetSpace ~
<Name> The name to be used for the code
-\begin_inset LatexCommand \index{code}
+\begin_inset LatexCommand index
+name "code"
\end_inset
-constseg
\series default
-\begin_inset LatexCommand \index{-\/-constseg <Value>}
+\begin_inset LatexCommand index
+name "-\\/-constseg <Value>"
\end_inset
\InsetSpace ~
<Name> The name to be used for the const
-\begin_inset LatexCommand \index{const}
+\begin_inset LatexCommand index
+name "const"
\end_inset
\end_inset
-fdollars-in-identifiers
-\begin_inset LatexCommand \index{-\/-fdollars-in-identifiers}
+\begin_inset LatexCommand index
+name "-\\/-fdollars-in-identifiers"
\end_inset
-more-pedantic
\series default
-\begin_inset LatexCommand \index{-\/-more-pedantic}
+\begin_inset LatexCommand index
+name "-\\/-more-pedantic"
\end_inset
-\begin_inset LatexCommand \index{pedantic}
+\begin_inset LatexCommand index
+name "pedantic"
\end_inset
\emph default
warnings you can use a separate tool dedicated to syntax checking like
splint
-\begin_inset LatexCommand \label{lyx:more-pedantic-SPLINT}
+\begin_inset LatexCommand label
+name "lyx:more-pedantic-SPLINT"
\end_inset
-\begin_inset LatexCommand \index{lint (syntax checking tool)}
+\begin_inset LatexCommand index
+name "lint (syntax checking tool)"
\end_inset
-\begin_inset LatexCommand \url{http://www.splint.org}
+\begin_inset LatexCommand url
+target "http://www.splint.org"
\end_inset
lint.h
\family default
-\begin_inset LatexCommand \index{splint (syntax checking tool)}
+\begin_inset LatexCommand index
+name "splint (syntax checking tool)"
\end_inset
\newline
Splint has an excellent on line manual at
-\begin_inset LatexCommand \url{http://www.splint.org/manual/}
+\begin_inset LatexCommand url
+target "http://www.splint.org/manual/"
\end_inset
-short-is-8bits
\series default
-\begin_inset LatexCommand \index{-\/-short-is-8bits}
+\begin_inset LatexCommand index
+name "-\\/-short-is-8bits"
\end_inset
-\begin_inset LatexCommand \label{lyx:--short-is-8bits}
+\begin_inset LatexCommand label
+name "lyx:--short-is-8bits"
\end_inset
Treat short as 8-bit (for backward compatibility with older versions of
compiler - see section
-\begin_inset LatexCommand \ref{sec:Compatibility-with-previous}
+\begin_inset LatexCommand ref
+reference "sec:Compatibility-with-previous"
\end_inset
\begin_layout Subsection
Intermediate Dump Options
-\begin_inset LatexCommand \label{sub:Intermediate-Dump-Options}
+\begin_inset LatexCommand label
+name "sub:Intermediate-Dump-Options"
\end_inset
-\begin_inset LatexCommand \index{Options intermediate dump}
+\begin_inset LatexCommand index
+name "Options intermediate dump"
\end_inset
-\begin_inset LatexCommand \index{Intermediate dump options}
+\begin_inset LatexCommand index
+name "Intermediate dump options"
\end_inset
The following options are provided for the purpose of retargetting and debugging
the compiler.
They provide a means to dump the intermediate code (iCode
-\begin_inset LatexCommand \index{iCode}
+\begin_inset LatexCommand index
+name "iCode"
\end_inset
) generated by the compiler in human readable form at various stages of
the compilation process.
More on iCodes see chapter
-\begin_inset LatexCommand \ref{sub:The-anatomy-of}
+\begin_inset LatexCommand ref
+reference "sub:The-anatomy-of"
\end_inset
\end_inset
-dumpraw
-\begin_inset LatexCommand \index{-\/-dumpraw}
+\begin_inset LatexCommand index
+name "-\\/-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
+name "Basic blocks"
\end_inset
\end_inset
-dumpgcse
-\begin_inset LatexCommand \index{-\/-dumpgcse}
+\begin_inset LatexCommand index
+name "-\\/-dumpgcse"
\end_inset
\series default
Will create a dump of iCodes, after global subexpression elimination
-\begin_inset LatexCommand \index{Global subexpression elimination}
+\begin_inset LatexCommand index
+name "Global subexpression elimination"
\end_inset
\end_inset
-dumpdeadcode
-\begin_inset LatexCommand \index{-\/-dumpdeadcode}
+\begin_inset LatexCommand index
+name "-\\/-dumpdeadcode"
\end_inset
\series default
Will create a dump of iCodes, after deadcode elimination
-\begin_inset LatexCommand \index{Dead-code elimination}
+\begin_inset LatexCommand index
+name "Dead-code elimination"
\end_inset
\end_inset
-dumploop
-\begin_inset LatexCommand \index{-\/-dumploop}
+\begin_inset LatexCommand index
+name "-\\/-dumploop"
\end_inset
\size default
Will create a dump of iCodes, after loop optimizations
-\begin_inset LatexCommand \index{Loop optimization}
+\begin_inset LatexCommand index
+name "Loop optimization"
\end_inset
\end_inset
-dumprange
-\begin_inset LatexCommand \index{-\/-dumprange}
+\begin_inset LatexCommand index
+name "-\\/-dumprange"
\end_inset
\size default
Will create a dump of iCodes, after live range analysis
-\begin_inset LatexCommand \index{Live range analysis}
+\begin_inset LatexCommand index
+name "Live range analysis"
\end_inset
\end_inset
-dumlrange
-\begin_inset LatexCommand \index{-\/-dumlrange}
+\begin_inset LatexCommand index
+name "-\\/-dumlrange"
\end_inset
\series default
Will dump the life ranges
-\begin_inset LatexCommand \index{Live range analysis}
+\begin_inset LatexCommand index
+name "Live range analysis"
\end_inset
\end_inset
-dumpregassign
-\begin_inset LatexCommand \index{-\/-dumpregassign}
+\begin_inset LatexCommand index
+name "-\\/-dumpregassign"
\end_inset
-
-\bar under
\series default
-\bar default
Will create a dump of iCodes, after register assignment
-\begin_inset LatexCommand \index{Register assignment}
+\begin_inset LatexCommand index
+name "Register assignment"
\end_inset
\end_inset
-dumplrange
-\begin_inset LatexCommand \index{-\/-dumplrange}
+\begin_inset LatexCommand index
+name "-\\/-dumplrange"
\end_inset
\end_inset
-dumpall
-\begin_inset LatexCommand \index{-\/-dumpall}
+\begin_inset LatexCommand index
+name "-\\/-dumpall"
\end_inset
\size large
-\bar under
\series default
\size default
-\bar default
Will cause all the above mentioned dumps to be created.
\end_layout
-
\series default
use-stdout
-\begin_inset LatexCommand \index{-\/-use-stdout}
+\begin_inset LatexCommand index
+name "-\\/-use-stdout"
\end_inset
\emph default
-vc
-\begin_inset LatexCommand \index{-\/-vc}
+\begin_inset LatexCommand index
+name "-\\/-vc"
\end_inset
\begin_layout Section
Environment variables
-\begin_inset LatexCommand \index{Environment variables}
+\begin_inset LatexCommand index
+name "Environment variables"
\end_inset
\series bold
SDCC_LEAVE_SIGNALS
-\begin_inset LatexCommand \index{SDCC\_LEAVE\_SIGNALS}
+\begin_inset LatexCommand index
+name "SDCC\\_LEAVE\\_SIGNALS"
\end_inset
\series default
SDCC installs a signal handler
-\begin_inset LatexCommand \index{signal handler}
+\begin_inset LatexCommand index
+name "signal handler"
\end_inset
TMP,\InsetSpace ~
TEMP,\InsetSpace ~
TMPDIR
-\begin_inset LatexCommand \index{TMP, TEMP, TMPDIR}
+\begin_inset LatexCommand index
+name "TMP, TEMP, TMPDIR"
\end_inset
\series bold
SDCC_HOME
-\begin_inset LatexCommand \index{SDCC\_HOME}
+\begin_inset LatexCommand index
+name "SDCC\\_HOME"
\end_inset
\series default
Path, see section
-\begin_inset LatexCommand \ref{sub:Install-paths}
+\begin_inset LatexCommand ref
+reference "sub:Install-paths"
\end_inset
\series bold
SDCC_INCLUDE
-\begin_inset LatexCommand \index{SDCC\_INCLUDE}
+\begin_inset LatexCommand index
+name "SDCC\\_INCLUDE"
\end_inset
\series default
Path, see section
-\begin_inset LatexCommand \ref{sub:Search-Paths}
+\begin_inset LatexCommand ref
+reference "sub:Search-Paths"
\end_inset
\series bold
SDCC_LIB
-\begin_inset LatexCommand \index{SDCC\_LIB}
+\begin_inset LatexCommand index
+name "SDCC\\_LIB"
\end_inset
\series default
Path, see section
-\begin_inset LatexCommand \ref{sub:Search-Paths}
+\begin_inset LatexCommand ref
+reference "sub:Search-Paths"
\end_inset
\begin_layout Subsection
MCS51/DS390 Storage Class
-\begin_inset LatexCommand \index{Storage class}
+\begin_inset LatexCommand index
+name "Storage class"
\end_inset
\begin_layout Subsubsection
data
-\begin_inset LatexCommand \index{data (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "data (mcs51, ds390 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_data (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_data (mcs51, ds390 storage class)"
\end_inset
/ near
-\begin_inset LatexCommand \index{near (storage class)}
+\begin_inset LatexCommand index
+name "near (storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_near (storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_near (storage class)"
\end_inset
\begin_layout Subsubsection
xdata
-\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "xdata (mcs51, ds390 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_xdata (mcs51, ds390 storage class)"
\end_inset
/ far
-\begin_inset LatexCommand \index{far (storage class)}
+\begin_inset LatexCommand index
+name "far (storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_far (storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_far (storage class)"
\end_inset
\begin_layout Subsubsection
idata
-\begin_inset LatexCommand \index{idata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "idata (mcs51, ds390 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_idata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_idata (mcs51, ds390 storage class)"
\end_inset
The original 8051 had 128 byte idata memory, nowadays most devices have
256 byte idata memory.
The stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
\begin_layout Subsubsection
pdata
-\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "pdata (mcs51, ds390 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_pdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_pdata (mcs51, ds390 storage class)"
\end_inset
The following example writes 0x01 to the pdata variable.
Please note, pdata access physically accesses xdata memory.
The high byte of the address is determined by port P2
-\begin_inset LatexCommand \index{P2 (mcs51 sfr)}
+\begin_inset LatexCommand index
+name "P2 (mcs51 sfr)"
\end_inset
(or in case of some 8051 variants by a separate Special Function Register,
see section
-\begin_inset LatexCommand \ref{sub:MCS51-variants}
+\begin_inset LatexCommand ref
+reference "sub:MCS51-variants"
\end_inset
\end_inset
-xstack
-\begin_inset LatexCommand \index{-\/-xstack}
+\begin_inset LatexCommand index
+name "-\\/-xstack"
\end_inset
\begin_layout Subsubsection
code
-\begin_inset LatexCommand \index{code}
+\begin_inset LatexCommand index
+name "code"
\end_inset
-\begin_inset LatexCommand \index{\_\_code}
+\begin_inset LatexCommand index
+name "\\_\\_code"
\end_inset
\begin_layout Subsubsection
bit
-\begin_inset LatexCommand \index{bit}
+\begin_inset LatexCommand index
+name "bit"
\end_inset
-\begin_inset LatexCommand \index{\_\_bit}
+\begin_inset LatexCommand index
+name "\\_\\_bit"
\end_inset
\newline
Apart from this 8051 specific storage class most architectures support
ANSI-C bitfields
-\begin_inset LatexCommand \index{bitfields}
+\begin_inset LatexCommand index
+name "bitfields"
\end_inset
\begin_layout Subsubsection
sfr
-\begin_inset LatexCommand \index{sfr}
+\begin_inset LatexCommand index
+name "sfr"
\end_inset
-\begin_inset LatexCommand \index{\_\_sfr}
+\begin_inset LatexCommand index
+name "\\_\\_sfr"
\end_inset
/ sfr16
-\begin_inset LatexCommand \index{sfr16}
+\begin_inset LatexCommand index
+name "sfr16"
\end_inset
-\begin_inset LatexCommand \index{\_\_sfr16}
+\begin_inset LatexCommand index
+name "\\_\\_sfr16"
\end_inset
/ sfr32
-\begin_inset LatexCommand \index{sfr32}
+\begin_inset LatexCommand index
+name "sfr32"
\end_inset
-\begin_inset LatexCommand \index{\_\_sfr32}
+\begin_inset LatexCommand index
+name "\\_\\_sfr32"
\end_inset
/ sbit
-\begin_inset LatexCommand \index{\_\_sbit}
+\begin_inset LatexCommand index
+name "\\_\\_sbit"
\end_inset
-\begin_inset LatexCommand \index{sbit}
+\begin_inset LatexCommand index
+name "sbit"
\end_inset
\begin_layout Standard
Like the bit keyword,
\emph on
-sfr / sfr16 / sfr32 / sbit
+sfr / sfr16 / sfr32 / sbit
\emph default
-signify both a data-type and storage class, they are used to describe the
+ signify both a data-type and storage class, they are used to describe the
\emph on
s
\family typewriter
__sfr __at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
-\begin_inset LatexCommand \index{\_\_at}
+\begin_inset LatexCommand index
+name "\\_\\_at"
\end_inset
\newline
__sbit __at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
-\begin_inset LatexCommand \index{\_\_at}
+\begin_inset LatexCommand index
+name "\\_\\_at"
\end_inset
(0xd7) CY;\InsetSpace ~
/* CY (Carry Flag
-\begin_inset LatexCommand \index{Flags}
+\begin_inset LatexCommand index
+name "Flags"
\end_inset
-\begin_inset LatexCommand \index{Carry flag}
+\begin_inset LatexCommand index
+name "Carry flag"
\end_inset
\begin_layout Standard
Special function registers which are located on an address dividable by
- 8 are bit-addressable, an
+ 8 are bit-addressable, an
\emph on
- sbit
+sbit
\emph default
addresses a specific bit within these sfr.
\newline
then the sfr / sfr16 / sfr32 / sbit Storage Class extensions will most
likely be
\emph on
-not
+not
\emph default
-compatible.
+ compatible.
Specifically the syntax
\family typewriter
\InsetSpace ~
\end_inset
.
-
+
\family default
+
+\series bold
Nevertheless it is possible to write header files
-\begin_inset LatexCommand \index{Header files}
+\begin_inset LatexCommand index
+name "Header files"
\end_inset
-\begin_inset LatexCommand \index{Include files}
+\begin_inset LatexCommand index
+name "Include files"
\end_inset
which can be shared among different compilers (see section
-\begin_inset LatexCommand \ref{sec:Porting-code-to-other-compilers}
+\begin_inset LatexCommand ref
+reference "sec:Porting-code-to-other-compilers"
\end_inset
\begin_layout Subsubsection
Pointers
-\begin_inset LatexCommand \index{Pointer}
+\begin_inset LatexCommand index
+name "Pointer"
\end_inset
\begin_layout Standard
SDCC allows (via language extensions) pointers to explicitly point to any
of the memory spaces
-\begin_inset LatexCommand \index{Memory model}
+\begin_inset LatexCommand index
+name "Memory model"
\end_inset
\newline
/*
the following is a function pointer
-\begin_inset LatexCommand \index{function pointer}
+\begin_inset LatexCommand index
+name "function pointer"
\end_inset
\emph default
pointers.
These are useful for developing reusable library
-\begin_inset LatexCommand \index{Libraries}
+\begin_inset LatexCommand index
+name "Libraries"
\end_inset
routines.
Explicitly specifying the pointer
-\begin_inset LatexCommand \index{pointer}
+\begin_inset LatexCommand index
+name "pointer"
\end_inset
\begin_layout Subsubsection
Notes on MCS51 memory
-\begin_inset LatexCommand \index{MCS51 memory}
+\begin_inset LatexCommand index
+name "MCS51 memory"
\end_inset
\newline
- Bytes 20-2F - 16 bytes to hold
128 bit
-\begin_inset LatexCommand \index{bit}
+\begin_inset LatexCommand index
+name "bit"
\end_inset
idata
\emph default
-\begin_inset LatexCommand \index{idata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "idata (mcs51, ds390 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_idata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_idata (mcs51, ds390 storage class)"
\end_inset
xdata
\emph default
-\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "xdata (mcs51, ds390 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_xdata (mcs51, ds390 storage class)"
\end_inset
data
\emph default
-\begin_inset LatexCommand \index{data (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "data (mcs51, ds390 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_data (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_data (mcs51, ds390 storage class)"
\end_inset
memory has to be activated before using it (you can probably find this
information on the datasheet of the microcontroller your are using, see
also section
-\begin_inset LatexCommand \ref{sub:Startup-Code}
+\begin_inset LatexCommand ref
+reference "sub:Startup-Code"
\end_inset
\begin_layout Standard
Normally SDCC will only use the first bank
-\begin_inset LatexCommand \index{register bank (mcs51, ds390)}
+\begin_inset LatexCommand index
+name "register bank (mcs51, ds390)"
\end_inset
\emph on
-\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
+\begin_inset LatexCommand index
+name "using (mcs51, ds390 register bank)"
\end_inset
-\begin_inset LatexCommand \index{\_\_using (mcs51, ds390 register bank)}
+\begin_inset LatexCommand index
+name "\\_\\_using (mcs51, ds390 register bank)"
\end_inset
\emph default
) should be used for example in interrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
-\begin_inset LatexCommand \index{\_\_interrupt}
+\begin_inset LatexCommand index
+name "\\_\\_interrupt"
\end_inset
variables, it will position the base of the internal stack at address 20
(0x14).
This implies that as the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
\end_inset
-data-loc
-\begin_inset LatexCommand \index{-\/-data-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-data-loc <Value>"
\end_inset
\end_inset
-iram-size
-\begin_inset LatexCommand \index{-\/-iram-size <Value>}
+\begin_inset LatexCommand index
+name "-\\/-iram-size <Value>"
\end_inset
\end_inset
-stack-loc
-\begin_inset LatexCommand \index{-\/-stack-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-stack-loc <Value>"
\end_inset
\end_inset
-xdata-loc
-\begin_inset LatexCommand \index{-\/-xdata-loc<Value>}
+\begin_inset LatexCommand index
+name "-\\/-xdata-loc<Value>"
\end_inset
\end_inset
-xram-size
-\begin_inset LatexCommand \index{-\/-xram-size <Value>}
+\begin_inset LatexCommand index
+name "-\\/-xram-size <Value>"
\end_inset
\end_inset
-code-loc
-\begin_inset LatexCommand \index{-\/-code-loc <Value>}
+\begin_inset LatexCommand index
+name "-\\/-code-loc <Value>"
\end_inset
\end_inset
-code-size
-\begin_inset LatexCommand \index{-\/-code-size <Value>}
+\begin_inset LatexCommand index
+name "-\\/-code-size <Value>"
\end_inset
\begin_layout Standard
The linker generates two files with memory allocation information.
The first, with extension .map
-\begin_inset LatexCommand \index{<file>.map}
+\begin_inset LatexCommand index
+name "<file>.map"
\end_inset
shows all the variables and segments.
The second with extension .mem
-\begin_inset LatexCommand \index{<file>.mem}
+\begin_inset LatexCommand index
+name "<file>.mem"
\end_inset
\begin_layout Subsection
Z80/Z180 Storage Class
-\begin_inset LatexCommand \index{Z80!Storage class}
+\begin_inset LatexCommand index
+name "Z80!Storage class"
\end_inset
\begin_layout Subsubsection
sfr
-\begin_inset LatexCommand \index{sfr}
+\begin_inset LatexCommand index
+name "sfr"
\end_inset
-\begin_inset LatexCommand \index{\_\_sfr}
+\begin_inset LatexCommand index
+name "\\_\\_sfr"
\end_inset
\begin_layout Standard
The Z80
-\begin_inset LatexCommand \index{Z80}
+\begin_inset LatexCommand index
+name "Z80"
\end_inset
\emph default
utput memory.
I/O memory
-\begin_inset LatexCommand \index{I/O memory (Z80, Z180)}
+\begin_inset LatexCommand index
+name "I/O memory (Z80, Z180)"
\end_inset
-\begin_inset LatexCommand \index{Z80!I/O memory}
+\begin_inset LatexCommand index
+name "Z80!I/O memory"
\end_inset
-\begin_inset LatexCommand \index{Z180!I/O memory}
+\begin_inset LatexCommand index
+name "Z180!I/O memory"
\end_inset
\begin_layout Subsubsection
banked sfr
-\begin_inset LatexCommand \index{sfr}
+\begin_inset LatexCommand index
+name "sfr"
\end_inset
-\begin_inset LatexCommand \index{\_\_sfr}
+\begin_inset LatexCommand index
+name "\\_\\_sfr"
\end_inset
\family typewriter
sfr banked at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
-\begin_inset LatexCommand \index{\_\_at}
+\begin_inset LatexCommand index
+name "\\_\\_at"
\end_inset
\begin_layout Subsubsection
sfr
-\begin_inset LatexCommand \index{sfr}
+\begin_inset LatexCommand index
+name "sfr"
\end_inset
-\begin_inset LatexCommand \index{\_\_sfr}
+\begin_inset LatexCommand index
+name "\\_\\_sfr"
\end_inset
(in0/out0 to 8 bit addresses on Z180
-\begin_inset LatexCommand \index{Z180}
+\begin_inset LatexCommand index
+name "Z180"
\end_inset
/HD64180
-\begin_inset LatexCommand \index{HD64180 (see Z180)}
+\begin_inset LatexCommand index
+name "HD64180 (see Z180)"
\end_inset
\end_inset
-portmode
-\begin_inset LatexCommand \index{Z180!Options!-\/-portmode}
+\begin_inset LatexCommand index
+name "Z180!Options!-\\/-portmode"
\end_inset
=180 (80) and a compiler #pragma\InsetSpace ~
portmode
-\begin_inset LatexCommand \index{Z180!Pragmas!\#pragma portmode}
+\begin_inset LatexCommand index
+name "Z180!Pragmas!\\#pragma portmode"
\end_inset
\begin_layout Subsection
HC08 Storage Class
-\begin_inset LatexCommand \index{HC08!Storage class}
+\begin_inset LatexCommand index
+name "HC08!Storage class"
\end_inset
\begin_layout Subsubsection
data
-\begin_inset LatexCommand \index{data (hc08 storage class)}
+\begin_inset LatexCommand index
+name "data (hc08 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_data (hc08 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_data (hc08 storage class)"
\end_inset
The data storage class declares a variable that resides in the first 256
bytes of memory (the direct page).
The HC08
-\begin_inset LatexCommand \index{HC08}
+\begin_inset LatexCommand index
+name "HC08"
\end_inset
\begin_layout Subsubsection
xdata
-\begin_inset LatexCommand \index{xdata (hc08 storage class)}
+\begin_inset LatexCommand index
+name "xdata (hc08 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_xdata (hc08 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_xdata (hc08 storage class)"
\end_inset
\begin_layout Section
Other SDCC language extensions
-\begin_inset LatexCommand \index{Other SDCC language extensions}
+\begin_inset LatexCommand index
+name "Other SDCC language extensions"
\end_inset
\begin_layout Section
Absolute Addressing
-\begin_inset LatexCommand \index{Absolute addressing}
+\begin_inset LatexCommand index
+name "Absolute addressing"
\end_inset
Data items can be assigned an absolute address with the
\emph on
at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
-\begin_inset LatexCommand \index{\_\_at}
+\begin_inset LatexCommand index
+name "\\_\\_at"
\end_inset
\family typewriter
xdata
-\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "xdata (mcs51, ds390 storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_xdata (mcs51, ds390 storage class)"
\end_inset
at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
-\begin_inset LatexCommand \index{\_\_at}
+\begin_inset LatexCommand index
+name "\\_\\_at"
\end_inset
Thus it is left to the programmer to make sure there are no overlaps with
other variables that are declared without the absolute address.
The assembler listing file (.lst
-\begin_inset LatexCommand \index{<file>.lst}
+\begin_inset LatexCommand index
+name "<file>.lst"
\end_inset
) and the linker output files (.rst
-\begin_inset LatexCommand \index{<file>.rst}
+\begin_inset LatexCommand index
+name "<file>.rst"
\end_inset
) and (.map
-\begin_inset LatexCommand \index{<file>.map}
+\begin_inset LatexCommand index
+name "<file>.map"
\end_inset
\begin_layout Standard
If however you provide an initializer
-\begin_inset LatexCommand \index{Variable initialization}
+\begin_inset LatexCommand index
+name "Variable initialization"
\end_inset
\family typewriter
volatile
-\begin_inset LatexCommand \index{volatile}
+\begin_inset LatexCommand index
+name "volatile"
\end_inset
__xdata
-\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "xdata (mcs51, ds390 storage class)"
\end_inset
__at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
\family typewriter
\size footnotesize
-\begin_inset LatexCommand \index{Aligned array}
+\begin_inset LatexCommand index
+name "Aligned array"
\end_inset
\family default
\size default
starts at a block (256 byte) boundary
-\begin_inset LatexCommand \index{block boundary}
+\begin_inset LatexCommand index
+name "block boundary"
\end_inset
(section
-\begin_inset LatexCommand \ref{sub:A-Step-by Assembler Introduction}
+\begin_inset LatexCommand ref
+reference "sub:A-Step-by Assembler Introduction"
\end_inset
\family typewriter
__bit
-\begin_inset LatexCommand \index{bit}
+\begin_inset LatexCommand index
+name "bit"
\end_inset
__at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
\family typewriter
extern volatile
-\begin_inset LatexCommand \index{volatile}
+\begin_inset LatexCommand index
+name "volatile"
\end_inset
\family typewriter
__bit __at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
-\begin_inset LatexCommand \index{\_\_at}
+\begin_inset LatexCommand index
+name "\\_\\_at"
\end_inset
I/O port 1, bit 1 */
\newline
__bit
-\begin_inset LatexCommand \index{bit}
+\begin_inset LatexCommand index
+name "bit"
\end_inset
\begin_layout Section
Parameters
-\begin_inset LatexCommand \index{Parameters}
+\begin_inset LatexCommand index
+name "Parameters"
\end_inset
-\begin_inset LatexCommand \index{function parameter}
+\begin_inset LatexCommand index
+name "function parameter"
\end_inset
& Local Variables
-\begin_inset LatexCommand \index{local variables}
+\begin_inset LatexCommand index
+name "local variables"
\end_inset
-\begin_inset LatexCommand \label{sec:Parameters-and-Local-Variables}
+\begin_inset LatexCommand label
+name "sec:Parameters-and-Local-Variables"
\end_inset
This in fact makes them similar to
\emph on
static
-\begin_inset LatexCommand \index{static}
+\begin_inset LatexCommand index
+name "static"
\end_inset
\emph default
so by default functions are non-reentrant
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
\newline
They can be placed on the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
- by using the
+ by using the
\emph on
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
\end_inset
stackauto
\emph default
-\begin_inset LatexCommand \index{\#pragma stackauto}
+\begin_inset LatexCommand index
+name "\\#pragma stackauto"
\end_inset
or by using the
\emph on
reentrant
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
\begin_layout Standard
Since stack space on 8051 is limited, the
\emph on
-reentrant
+reentrant
\emph default
-keyword or the
+ keyword or the
\emph on
- -
+-
\begin_inset ERT
status collapsed
does not
\emph default
mean that the function is register bank
-\begin_inset LatexCommand \index{register bank (mcs51, ds390)}
+\begin_inset LatexCommand index
+name "register bank (mcs51, ds390)"
\end_inset
\newline
Local variables
-\begin_inset LatexCommand \index{local variables}
+\begin_inset LatexCommand index
+name "local variables"
\end_inset
can be assigned storage classes and absolute
-\begin_inset LatexCommand \index{Absolute addressing}
+\begin_inset LatexCommand index
+name "Absolute addressing"
\end_inset
\InsetSpace ~
\InsetSpace ~
__data __at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
\emph on
bvar
\emph default
- in bit addressable space and
+ in bit addressable space and
\emph on
- j
+j
\emph default
in internal ram.
When compiled with
\begin_layout Standard
Parameters
-\begin_inset LatexCommand \index{function parameter}
+\begin_inset LatexCommand index
+name "function parameter"
\end_inset
however are not allowed any storage class
-\begin_inset LatexCommand \index{Storage class}
+\begin_inset LatexCommand index
+name "Storage class"
\end_inset
non-static local bit variables are supported.
Efficient use is limited to 8 semi-bitregisters in bit space.
They are pushed and popped to stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
\begin_layout Section
Overlaying
-\begin_inset LatexCommand \label{sub:Overlaying}
+\begin_inset LatexCommand label
+name "sub:Overlaying"
\end_inset
-\begin_inset LatexCommand \index{Overlaying}
+\begin_inset LatexCommand index
+name "Overlaying"
\end_inset
\begin_layout Standard
For non-reentrant
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "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
-\begin_inset LatexCommand \index{local variables}
+\begin_inset LatexCommand index
+name "local variables"
\end_inset
\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
+name "Memory model"
\end_inset
\emph default
If an explicit storage class
-\begin_inset LatexCommand \index{Storage class}
+\begin_inset LatexCommand index
+name "Storage class"
\end_inset
- is specified for a local variable, it will NOT be overlayed.
+ is specified for a local variable, it will NOT be overlaid.
\end_layout
\begin_layout Standard
should be preceded by a #pragma\InsetSpace ~
nooverlay
-\begin_inset LatexCommand \index{\#pragma nooverlay}
+\begin_inset LatexCommand index
+name "\\#pragma nooverlay"
\end_inset
\begin_layout Standard
Parameters and local variables of functions that contain 16 or 32 bit multiplica
tion
-\begin_inset LatexCommand \index{Multiplication}
+\begin_inset LatexCommand index
+name "Multiplication"
\end_inset
or division
-\begin_inset LatexCommand \index{Division}
+\begin_inset LatexCommand index
+name "Division"
\end_inset
- will NOT be overlayed since these are implemented using external functions,
+ will NOT be overlaid since these are implemented using external functions,
e.g.:
\end_layout
#pragma save
\newline
#pragma nooverlay
-\begin_inset LatexCommand \index{\#pragma nooverlay}
+\begin_inset LatexCommand index
+name "\\#pragma nooverlay"
\end_inset
\newline
void
some_isr () __interrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
from an interrupt service routine.
The #pragma\InsetSpace ~
nooverlay ensures that the parameters and local variables for
- the function are NOT overlayed.
+ the function are NOT overlaid.
\begin_inset VSpace bigskip
\end_inset
\begin_layout Section
Interrupt Service Routines
-\begin_inset LatexCommand \label{sub:Interrupt-Service-Routines}
+\begin_inset LatexCommand label
+name "sub:Interrupt-Service-Routines"
\end_inset
The optional number following the
\emph on
interrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
-\begin_inset LatexCommand \index{\_\_interrupt}
+\begin_inset LatexCommand index
+name "\\_\\_interrupt"
\end_inset
keyword is the interrupt number this routine will service.
When present, the compiler will insert a call to this routine in the interrupt
vector table
-\begin_inset LatexCommand \index{interrupt vector table}
+\begin_inset LatexCommand index
+name "interrupt vector table"
\end_inset
The optional (8051 specific) keyword
\emph on
using
-\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
+\begin_inset LatexCommand index
+name "using (mcs51, ds390 register bank)"
\end_inset
-\begin_inset LatexCommand \index{\_\_using (mcs51, ds390 register bank)}
+\begin_inset LatexCommand index
+name "\\_\\_using (mcs51, ds390 register bank)"
\end_inset
\end_layout
\begin_layout Subsubsection
-\begin_inset LatexCommand \label{sub:Common-interrupt-pitfall-volatile}
+\begin_inset LatexCommand label
+name "sub:Common-interrupt-pitfall-volatile"
\end_inset
volatile
\emph default
-\begin_inset LatexCommand \index{volatile}
+\begin_inset LatexCommand index
+name "volatile"
\end_inset
.
See
-\begin_inset LatexCommand \url{http://en.wikipedia.org/wiki/Volatile_variable}
+\begin_inset LatexCommand url
+target "http://en.wikipedia.org/wiki/Volatile_variable"
\end_inset
\end_layout
\begin_layout Subsubsection
-\begin_inset LatexCommand \label{sub:Common-interrupt-pitfall-non-atomic}
+\begin_inset LatexCommand label
+name "sub:Common-interrupt-pitfall-non-atomic"
\end_inset
If the access to these variables is not
\emph on
atomic
-\begin_inset LatexCommand \index{atomic}
+\begin_inset LatexCommand index
+name "atomic"
\end_inset
\end_layout
\begin_layout Subsubsection
-\begin_inset LatexCommand \label{sub:Common-interrupt-pitfall-stack-overflow}
+\begin_inset LatexCommand label
+name "sub:Common-interrupt-pitfall-stack-overflow"
\end_inset
\begin_layout Standard
The return address and the registers used in the interrupt service routine
are saved on the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
stack overflow
\emph default
-\begin_inset LatexCommand \index{stack overflow}
+\begin_inset LatexCommand index
+name "stack overflow"
\end_inset
\end_layout
\begin_layout Subsubsection
-\begin_inset LatexCommand \label{sub:Common-interrupt-pitfall-non-reentrant}
+\begin_inset LatexCommand label
+name "sub:Common-interrupt-pitfall-non-reentrant"
\end_inset
\begin_layout Standard
A special note here, int (16 bit) and long (32 bit) integer division
-\begin_inset LatexCommand \index{Division}
+\begin_inset LatexCommand index
+name "Division"
\end_inset
, multiplication
-\begin_inset LatexCommand \index{Multiplication}
+\begin_inset LatexCommand index
+name "Multiplication"
\end_inset
& modulus
-\begin_inset LatexCommand \index{Modulus}
+\begin_inset LatexCommand index
+name "Modulus"
\end_inset
and floating-point
-\begin_inset LatexCommand \index{Floating point support}
+\begin_inset LatexCommand index
+name "Floating point support"
\end_inset
operations are implemented using external support routines.
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
+ be recompiled using the
\emph on
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
\end_inset
-int-long-reent
\emph default
-\begin_inset LatexCommand \index{-\/-int-long-reent}
+\begin_inset LatexCommand index
+name "-\\/-int-long-reent"
\end_inset
\newline
Note, the type promotion
-\begin_inset LatexCommand \index{type promotion}
+\begin_inset LatexCommand index
+name "type promotion"
\end_inset
See f.e.
the cast
\family typewriter
+\series bold
(unsigned char)(tail-1)
\family default
- within the if clause in section
-\begin_inset LatexCommand \ref{sub:A-Step-by Assembler Introduction}
+\series default
+
+\series bold
+within the if clause in section
+\begin_inset LatexCommand ref
+reference "sub:A-Step-by Assembler Introduction"
\end_inset
Note that when some function is called from an interrupt service routine
it should be preceded by a #pragma\InsetSpace ~
nooverlay
-\begin_inset LatexCommand \index{\#pragma nooverlay}
+\begin_inset LatexCommand index
+name "\\#pragma nooverlay"
\end_inset
while the interrupt service routine might be active.
They also must not be called from low priority interrupt service routines
while a high priority interrupt service routine might be active.
- You could use semaphores or make the function
+ You could use semaphores or make the function
\emph on
- critical
+critical
\emph default
if all parameters are passed in registers.
\newline
Also see section
-\begin_inset LatexCommand \ref{sub:Overlaying}
+\begin_inset LatexCommand ref
+reference "sub:Overlaying"
\end_inset
\InsetSpace ~
about Overlaying and section
-\begin_inset LatexCommand \ref{sub:Functions-using-private-banks}
+\begin_inset LatexCommand ref
+reference "sub:Functions-using-private-banks"
\end_inset
\begin_layout Standard
Interrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
numbers and the corresponding address & descriptions for the Standard 8051/8052
are listed below.
SDCC will automatically adjust the
-\begin_inset LatexCommand \index{interrupt vector table}
+\begin_inset LatexCommand index
+name "interrupt vector table"
\end_inset
If the interrupt service routine is defined without
\emph on
using
-\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
+\begin_inset LatexCommand index
+name "using (mcs51, ds390 register bank)"
\end_inset
-\begin_inset LatexCommand \index{\_\_using (mcs51, ds390 register bank)}
+\begin_inset LatexCommand index
+name "\\_\\_using (mcs51, ds390 register bank)"
\end_inset
& psw are saved and restored, if such an interrupt service routine calls
another function (using another register bank) then the entire register
bank of the called function will be saved on the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
\begin_layout Subsection
HC08
-\begin_inset LatexCommand \index{HC08}
+\begin_inset LatexCommand index
+name "HC08"
\end_inset
\begin_layout Standard
Since the number of interrupts
-\begin_inset LatexCommand \index{HC08!interrupt}
+\begin_inset LatexCommand index
+name "HC08!interrupt"
\end_inset
2 will use the interrupt vector at 0xfffa, and so on.
However, interrupt 0 (the reset vector at 0xfffe) is not redefinable in
this way; instead see section
-\begin_inset LatexCommand \ref{sub:Startup-Code}
+\begin_inset LatexCommand ref
+reference "sub:Startup-Code"
\end_inset
\begin_layout Standard
The Z80
-\begin_inset LatexCommand \index{Z80}
+\begin_inset LatexCommand index
+name "Z80"
\end_inset
uses several different methods for determining the correct interrupt
-\begin_inset LatexCommand \index{Z80!interrupt}
+\begin_inset LatexCommand index
+name "Z80!interrupt"
\end_inset
\emph default
.
SDCC will generate code to disable all interrupts
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
upon entry to a critical function and restore the interrupt enable to the
previous state before returning.
Nesting critical functions will need one additional byte on the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
\family typewriter
int foo () __critical
-\begin_inset LatexCommand \index{critical}
+\begin_inset LatexCommand index
+name "critical"
\end_inset
-\begin_inset LatexCommand \index{\_\_critical}
+\begin_inset LatexCommand index
+name "\\_\\_critical"
\end_inset
\begin_layout Standard
Interrupts
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
\end_layout
\begin_layout Standard
-On other architectures which have seperate opcodes for enabling and disabling
+On other architectures which have separate opcodes for enabling and disabling
interrupts you might want to make use of defines with inline assembly
-\begin_inset LatexCommand \index{Assembler routines}
+\begin_inset LatexCommand index
+name "Assembler routines"
\end_inset
(HC08
-\begin_inset LatexCommand \index{HC08!interrupt}
+\begin_inset LatexCommand index
+name "HC08!interrupt"
\end_inset
\family typewriter
#define CLI _asm
-\begin_inset LatexCommand \index{\_asm}
+\begin_inset LatexCommand index
+name "\\_asm"
\end_inset
cli\InsetSpace ~
\InsetSpace ~
_endasm
-\begin_inset LatexCommand \index{\_endasm}
+\begin_inset LatexCommand index
+name "\\_endasm"
\end_inset
a timer or serial interrupt by manipulating an
\emph on
interrupt mask
-\begin_inset LatexCommand \index{interrupt mask}
+\begin_inset LatexCommand index
+name "interrupt mask"
\end_inset
interrupt latency
\emph default
-\begin_inset LatexCommand \index{interrupt latency}
+\begin_inset LatexCommand index
+name "interrupt latency"
\end_inset
interrupt jitter
\emph default
-\begin_inset LatexCommand \index{interrupt jitter}
+\begin_inset LatexCommand index
+name "interrupt jitter"
\end_inset
interrupt priorities
\emph default
-\begin_inset LatexCommand \index{interrupt priority}
+\begin_inset LatexCommand index
+name "interrupt priority"
\end_inset
be implemented by manipulating the interrupt mask and reenabling interrupts
within the interrupt routine.
Check there is sufficient space on the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
\begin_layout Subsection
Semaphore
-\begin_inset LatexCommand \index{semaphore}
+\begin_inset LatexCommand index
+name "semaphore"
\end_inset
\begin_layout Standard
Some architectures (mcs51/ds390) have an atomic
-\begin_inset LatexCommand \index{atomic}
+\begin_inset LatexCommand index
+name "atomic"
\end_inset
- bit test and
-\emph on
-
-\emph default
-clear
-\emph on
-
-\emph default
-instruction.
+ bit test and clear instruction.
These type of instructions are typically used in preemptive multitasking
systems, where a routine f.e.
claims the use of a data structure ('acquires a lock
-\begin_inset LatexCommand \index{lock}
+\begin_inset LatexCommand index
+name "lock"
\end_inset
The instruction may also be used if interrupt and non-interrupt code have
to compete for a resource.
With the atomic bit test and clear instruction interrupts
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
\family typewriter
volatile
-\begin_inset LatexCommand \index{volatile}
+\begin_inset LatexCommand index
+name "volatile"
\end_inset
\begin_layout Standard
Note, mcs51 and ds390 support only an atomic
-\begin_inset LatexCommand \index{atomic}
+\begin_inset LatexCommand index
+name "atomic"
\end_inset
\begin_layout Section
Functions using private register banks
-\begin_inset LatexCommand \label{sub:Functions-using-private-banks}
+\begin_inset LatexCommand label
+name "sub:Functions-using-private-banks"
\end_inset
SDCC supports this feature with the
\emph on
using
-\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
+\begin_inset LatexCommand index
+name "using (mcs51, ds390 register bank)"
\end_inset
-\begin_inset LatexCommand \index{\_\_using (mcs51, ds390 register bank)}
+\begin_inset LatexCommand index
+name "\\_\\_using (mcs51, ds390 register bank)"
\end_inset
\emph default
attribute (which tells the compiler to use a register bank
-\begin_inset LatexCommand \index{register bank (mcs51, ds390)}
+\begin_inset LatexCommand index
+name "register bank (mcs51, ds390)"
\end_inset
It should only be applied to
\emph on
interrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
\newline
\emph on
-(pending: Note, nowadays the
+(pending: Note, nowadays the
\emph default
-using
+ using
\emph on
- attribute has an effect on
+attribute has an effect on
\emph default
\emph on
-the generated code for a
+the generated code for a
\emph default
-non-interrupt
+ non-interrupt
\emph on
- function
+function
\emph default
.
\emph on
function using a non-zero bank will assume that it can trash that register
bank, and will not save it.
Since high-priority interrupts
-\begin_inset LatexCommand \index{interrupts}
+\begin_inset LatexCommand index
+name "interrupts"
\end_inset
-\begin_inset LatexCommand \index{interrupt priority}
+\begin_inset LatexCommand index
+name "interrupt priority"
\end_inset
\begin_layout Section
Startup Code
-\begin_inset LatexCommand \label{sub:Startup-Code}
+\begin_inset LatexCommand label
+name "sub:Startup-Code"
\end_inset
-\begin_inset LatexCommand \index{Startup code}
+\begin_inset LatexCommand index
+name "Startup code"
\end_inset
\begin_layout Standard
The compiler triggers the linker to link certain initialization modules
from the runtime library
-\begin_inset LatexCommand \index{Runtime library}
+\begin_inset LatexCommand index
+name "Runtime library"
\end_inset
One of these modules (crtstart.asm) contains a call to the C routine
\emph on
_sdcc_external_startup()
-\begin_inset LatexCommand \index{\_sdcc\_external\_startup()}
+\begin_inset LatexCommand index
+name "\\_sdcc\\_external\\_startup()"
\end_inset
-\series bold
\emph default
-
-\series default
-at the start of the CODE area.
+ at the start of the CODE area.
This routine is also in the runtime library
-\begin_inset LatexCommand \index{Runtime library}
+\begin_inset LatexCommand index
+name "Runtime library"
\end_inset
routine to your program to override the default if you need to setup hardware
or perform some other critical operation prior to static & global variable
initialization
-\begin_inset LatexCommand \index{Variable initialization}
+\begin_inset LatexCommand index
+name "Variable initialization"
\end_inset
.
On some mcs51 variants xdata
-\begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "xdata (mcs51, ds390 storage class)"
\end_inset
memory has to be explicitly enabled before it can be accessed or if the
watchdog
-\begin_inset LatexCommand \index{watchdog}
+\begin_inset LatexCommand index
+name "watchdog"
\end_inset
\end_inset
-iram-size
-\begin_inset LatexCommand \index{-\/-iram-size <Value>}
+\begin_inset LatexCommand index
+name "-\\/-iram-size <Value>"
\end_inset
opt
\emph default
-\begin_inset LatexCommand \index{-\/-no-xinit-opt}
+\begin_inset LatexCommand index
+name "-\\/-no-xinit-opt"
\end_inset
-main-return
\emph default
-\begin_inset LatexCommand \index{-\/-main-return}
+\begin_inset LatexCommand index
+name "-\\/-main-return"
\end_inset
and section
-\begin_inset LatexCommand \ref{sub:MCS51-variants}
+\begin_inset LatexCommand ref
+reference "sub:MCS51-variants"
\end_inset
\emph default
(f.e.
from
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/device/lib/mcs51/crtstart.asm}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/device/lib/mcs51/crtstart.asm"
\end_inset
\end_inset
are the assembler options used in
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/lib/mcs51/Makefile.in?view=markup }
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/lib/mcs51/Makefile.in?view=markup "
\end_inset
crtstart.asm
\emph default
- and when linking your project explicitely specify
+ and when linking your project explicitly specify
\emph on
crtstart.rel
\emph default
\begin_layout Standard
The HC08
-\begin_inset LatexCommand \index{HC08}
+\begin_inset LatexCommand index
+name "HC08"
\end_inset
\begin_layout Standard
On the Z80
-\begin_inset LatexCommand \index{Z80}
+\begin_inset LatexCommand index
+name "Z80"
\end_inset
-no-std-crt0
\emph default
-\begin_inset LatexCommand \index{-\/-no-std-crt0}
+\begin_inset LatexCommand index
+name "-\\/-no-std-crt0"
\end_inset
\begin_layout Section
Inline Assembler Code
-\begin_inset LatexCommand \index{Assembler routines}
+\begin_inset LatexCommand index
+name "Assembler routines"
\end_inset
\begin_layout Subsection
A Step by Step Introduction
-\begin_inset LatexCommand \label{sub:A-Step-by Assembler Introduction}
+\begin_inset LatexCommand label
+name "sub:A-Step-by Assembler Introduction"
\end_inset
\family typewriter
\size footnotesize
unsigned char __far
-\begin_inset LatexCommand \index{far (storage class)}
+\begin_inset LatexCommand index
+name "far (storage class)"
\end_inset
-\begin_inset LatexCommand \index{\_\_far (storage class)}
+\begin_inset LatexCommand index
+name "\\_\\_far (storage class)"
\end_inset
__at
-\begin_inset LatexCommand \index{at}
+\begin_inset LatexCommand index
+name "at"
\end_inset
-\begin_inset LatexCommand \index{\_\_at}
+\begin_inset LatexCommand index
+name "\\_\\_at"
\end_inset
(0x7f00) buf[0x100];
-\begin_inset LatexCommand \index{Aligned array}
+\begin_inset LatexCommand index
+name "Aligned array"
\end_inset
\InsetSpace ~
\InsetSpace ~
/* if interrupts
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
\InsetSpace ~
\InsetSpace ~
section
-\begin_inset LatexCommand \ref{sub:Common-interrupt-pitfall-volatile}
+\begin_inset LatexCommand ref
+reference "sub:Common-interrupt-pitfall-volatile"
\end_inset
about
+\family default
+
+\family typewriter
\series bold
- volatile
+volatile
+\family default
\series default
- */
+
+\family typewriter
+*/
\newline
\newline
\InsetSpace ~
if( head != (unsigned char)(tail-1)
)\InsetSpace ~
-/* cast
+/* cast
+\family default
+
+\family typewriter
\series bold
needed
+\family default
\series default
- to avoid promotion
-\begin_inset LatexCommand \index{promotion to signed int}
+
+\family typewriter
+to avoid promotion
+\begin_inset LatexCommand index
+name "promotion to signed int"
\end_inset
-\begin_inset LatexCommand \index{type promotion}
+\begin_inset LatexCommand index
+name "type promotion"
\end_inset
\InsetSpace ~
\InsetSpace ~
_asm
-\begin_inset LatexCommand \index{\_asm}
+\begin_inset LatexCommand index
+name "\\_asm"
\end_inset
-\begin_inset LatexCommand \index{\_\_asm}
+\begin_inset LatexCommand index
+name "\\_\\_asm"
\end_inset
r2,dpl
\newline
;buffer.c if( head != (unsigned char)(tail-1) ) \InsetSpace ~
-/* cast
+/* cast
+\family default
+
+\family typewriter
\series bold
needed
+\family default
\series default
- to avoid promotion
-\begin_inset LatexCommand \index{promotion to signed int}
+
+\family typewriter
+to avoid promotion
+\begin_inset LatexCommand index
+name "promotion to signed int"
\end_inset
-\begin_inset LatexCommand \index{type promotion}
+\begin_inset LatexCommand index
+name "type promotion"
\end_inset
\newline
;buffer.c buf[ head++ ] = c; /* access to a 256 byte aligned array */
-\begin_inset LatexCommand \index{Aligned array}
+\begin_inset LatexCommand index
+name "Aligned array"
\end_inset
\InsetSpace ~
\InsetSpace ~
_endasm
-\begin_inset LatexCommand \index{\_endasm}
+\begin_inset LatexCommand index
+name "\\_endasm"
\end_inset
-\begin_inset LatexCommand \index{\_\_endasm}
+\begin_inset LatexCommand index
+name "\\_\\_endasm"
\end_inset
\InsetSpace ~
\InsetSpace ~
_asm
-\begin_inset LatexCommand \index{\_asm}
+\begin_inset LatexCommand index
+name "\\_asm"
\end_inset
-\begin_inset LatexCommand \index{\_\_asm}
+\begin_inset LatexCommand index
+name "\\_\\_asm"
\end_inset
\InsetSpace ~
\InsetSpace ~
_endasm
-\begin_inset LatexCommand \index{\_endasm}
+\begin_inset LatexCommand index
+name "\\_endasm"
\end_inset
-\begin_inset LatexCommand \index{\_\_endasm}
+\begin_inset LatexCommand index
+name "\\_\\_endasm"
\end_inset
, this includes any assembler directives and comment lines.
The assembler does not like some characters like ':' or ''' in comments.
You'll find an 100+ pages assembler manual in sdcc/as/doc/asxhtm.html
-\begin_inset LatexCommand \index{asXXXX (as-gbz80, as-hc08, asx8051, as-z80)}
+\begin_inset LatexCommand index
+name "asXXXX (as-gbz80, as-hc08, asx8051, as-z80)"
\end_inset
-\begin_inset LatexCommand \index{Assembler documentation}
+\begin_inset LatexCommand index
+name "Assembler documentation"
\end_inset
or online at
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html"
\end_inset
The compiler does not do any validation of the code within the
\family typewriter
_asm
-\begin_inset LatexCommand \index{\_asm}
+\begin_inset LatexCommand index
+name "\\_asm"
\end_inset
-\begin_inset LatexCommand \index{\_\_asm}
+\begin_inset LatexCommand index
+name "\\_\\_asm"
\end_inset
_endasm
\size footnotesize
-\begin_inset LatexCommand \index{\_endasm}
+\begin_inset LatexCommand index
+name "\\_endasm"
\end_inset
-\begin_inset LatexCommand \index{\_\_endasm}
+\begin_inset LatexCommand index
+name "\\_\\_endasm"
\end_inset
keyword pair.
Specifically it will not know which registers are used and thus register
pushing/popping
-\begin_inset LatexCommand \index{push/pop}
+\begin_inset LatexCommand index
+name "push/pop"
\end_inset
-
\emph on
peep-asm
-\begin_inset LatexCommand \index{-\/-peep-asm}
+\begin_inset LatexCommand index
+name "-\\/-peep-asm"
\end_inset
\emph default
command line option is used, the inline assembler code will be passed through
the peephole optimizer
-\begin_inset LatexCommand \index{Peephole optimizer}
+\begin_inset LatexCommand index
+name "Peephole optimizer"
\end_inset
\begin_layout Subsection
Naked Functions
-\begin_inset LatexCommand \label{sub:Naked-Functions}
+\begin_inset LatexCommand label
+name "sub:Naked-Functions"
\end_inset
-\begin_inset LatexCommand \index{Naked functions}
+\begin_inset LatexCommand index
+name "Naked functions"
\end_inset
A special keyword may be associated with a function declaring it as
\emph on
_naked
-\begin_inset LatexCommand \index{\_naked}
+\begin_inset LatexCommand index
+name "\\_naked"
\end_inset
-\begin_inset LatexCommand \index{\_\_naked}
+\begin_inset LatexCommand index
+name "\\_\\_naked"
\end_inset
.
-
+
\emph default
-The
+ The
\emph on
_naked
\emph default
function modifier attribute prevents the compiler from generating prologue
-\begin_inset LatexCommand \index{function prologue}
+\begin_inset LatexCommand index
+name "function prologue"
\end_inset
and epilogue
-\begin_inset LatexCommand \index{function epilogue}
+\begin_inset LatexCommand index
+name "function epilogue"
\end_inset
\family typewriter
volatile
-\begin_inset LatexCommand \index{volatile}
+\begin_inset LatexCommand index
+name "volatile"
\end_inset
\newline
void simpleInterrupt(void) __interrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
-\begin_inset LatexCommand \index{\_\_interrupt}
+\begin_inset LatexCommand index
+name "\\_\\_interrupt"
\end_inset
\InsetSpace ~
\InsetSpace ~
_asm
-\begin_inset LatexCommand \index{\_asm}
+\begin_inset LatexCommand index
+name "\\_asm"
\end_inset
-\begin_inset LatexCommand \index{\_\_asm}
+\begin_inset LatexCommand index
+name "\\_\\_asm"
\end_inset
\InsetSpace ~
\InsetSpace ~
_endasm
-\begin_inset LatexCommand \index{\_endasm}
+\begin_inset LatexCommand index
+name "\\_endasm"
\end_inset
-\begin_inset LatexCommand \index{\_\_endasm}
+\begin_inset LatexCommand index
+name "\\_\\_endasm"
\end_inset
\begin_layout Verse
\family typewriter
-Note, this is an
+Note, this is an
+\family default
+
+\family typewriter
\emph on
outdated
+\family default
\emph default
- example, recent versions of SDCC generate
+
+\family typewriter
+example, recent versions of SDCC generate
\newline
-the
+the
+\family default
+
+\family typewriter
\emph on
same
+\family default
\emph default
- code for simpleInterrupt() and nakedInterrupt()!
+
+\family typewriter
+code for simpleInterrupt() and nakedInterrupt()!
\newline
\newline
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
-pu
-sh\InsetSpace ~
+pus
+h\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
\begin_layout Standard
The related directive #pragma exclude
-\begin_inset LatexCommand \index{\#pragma exclude}
+\begin_inset LatexCommand index
+name "\\#pragma exclude"
\end_inset
allows a more fine grained control over pushing & popping
-\begin_inset LatexCommand \index{push/pop}
+\begin_inset LatexCommand index
+name "push/pop"
\end_inset
\family typewriter
_asm
-\begin_inset LatexCommand \index{\_asm}
+\begin_inset LatexCommand index
+name "\\_asm"
\end_inset
-\begin_inset LatexCommand \index{\_\_asm}
+\begin_inset LatexCommand index
+name "\\_\\_asm"
\end_inset
b,00001$
\newline
_endasm
-\begin_inset LatexCommand \index{\_endasm}
+\begin_inset LatexCommand index
+name "\\_endasm"
\end_inset
-\begin_inset LatexCommand \index{\_\_endasm}
+\begin_inset LatexCommand index
+name "\\_\\_endasm"
\end_inset
\begin_layout Standard
Inline assembler code cannot reference any C-labels, however it can reference
labels
-\begin_inset LatexCommand \index{Labels}
+\begin_inset LatexCommand index
+name "Labels"
\end_inset
\InsetSpace ~
\InsetSpace ~
_endasm
-\begin_inset LatexCommand \index{\_endasm}
+\begin_inset LatexCommand index
+name "\\_endasm"
\end_inset
-\begin_inset LatexCommand \index{\_\_endasm}
+\begin_inset LatexCommand index
+name "\\_\\_endasm"
\end_inset
\begin_layout Section
Interfacing with Assembler Code
-\begin_inset LatexCommand \index{Assembler routines}
+\begin_inset LatexCommand index
+name "Assembler routines"
\end_inset
\begin_layout Subsection
Global Registers used for Parameter Passing
-\begin_inset LatexCommand \index{Parameter passing}
+\begin_inset LatexCommand index
+name "Parameter passing"
\end_inset
The compiler always uses the global registers
\emph on
DPL, DPH
-\begin_inset LatexCommand \index{DPTR, DPH, DPL}
+\begin_inset LatexCommand index
+name "DPTR, DPH, DPL"
\end_inset
-\begin_inset LatexCommand \index{DPTR}
+\begin_inset LatexCommand index
+name "DPTR"
\end_inset
, B
-\begin_inset LatexCommand \index{B (mcs51, ds390 register)}
+\begin_inset LatexCommand index
+name "B (mcs51, ds390 register)"
\end_inset
-
+
\emph default
-and
+ and
\emph on
- ACC
-\begin_inset LatexCommand \index{ACC (mcs51, ds390 register)}
+ACC
+\begin_inset LatexCommand index
+name "ACC (mcs51, ds390 register)"
\end_inset
\emph default
to pass the first (non-bit) parameter to a function, and also to pass the
return value
-\begin_inset LatexCommand \index{return value}
+\begin_inset LatexCommand index
+name "return value"
\end_inset
\emph on
DPL
\emph default
-,
+,
\emph on
- B
+B
\emph default
and
\emph on
\emph default
.
Generic pointers
-\begin_inset LatexCommand \index{generic pointer}
+\begin_inset LatexCommand index
+name "generic pointer"
\end_inset
\begin_layout Standard
Functions (with two or more parameters or bit parameters) that are called
through function pointers
-\begin_inset LatexCommand \index{function pointers}
+\begin_inset LatexCommand index
+name "function pointers"
\end_inset
_naked
\family default
-\begin_inset LatexCommand \index{naked}
+\begin_inset LatexCommand index
+name "naked"
\end_inset
\end_inset
-callee-saves
-\begin_inset LatexCommand \index{-\/-callee-saves}
+\begin_inset LatexCommand index
+name "-\\/-callee-saves"
\end_inset
\begin_layout Standard
In the following example
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
-\begin_inset LatexCommand \index{Assembler routines (non-reentrant)}
+\begin_inset LatexCommand index
+name "Assembler routines (non-reentrant)"
\end_inset
the function c_func calls an assembler routine asm_func, which takes two
parameters
-\begin_inset LatexCommand \index{function parameter}
+\begin_inset LatexCommand index
+name "function parameter"
\end_inset
\InsetSpace ~
\InsetSpace ~
dph
-\begin_inset LatexCommand \index{DPTR, DPH, DPL}
+\begin_inset LatexCommand index
+name "DPTR, DPH, DPL"
\end_inset
\begin_layout Standard
In this case
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
-\begin_inset LatexCommand \index{Assembler routines (reentrant)}
+\begin_inset LatexCommand index
+name "Assembler routines (reentrant)"
\end_inset
the second parameter
-\begin_inset LatexCommand \index{function parameter}
+\begin_inset LatexCommand index
+name "function parameter"
\end_inset
\begin_layout Section
int (16 bit)
-\begin_inset LatexCommand \index{int (16 bit)}
+\begin_inset LatexCommand index
+name "int (16 bit)"
\end_inset
and long (32 bit)
-\begin_inset LatexCommand \index{long (32 bit)}
+\begin_inset LatexCommand index
+name "long (32 bit)"
\end_inset
non-reentrant
\emph default
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
, interrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
\end_inset
-stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
\end_inset
\end_inset
-int-long-reent
-\begin_inset LatexCommand \index{-\/-int-long-reent}
+\begin_inset LatexCommand index
+name "-\\/-int-long-reent"
\end_inset
\begin_layout Section
Floating Point Support
-\begin_inset LatexCommand \index{Floating point support}
+\begin_inset LatexCommand index
+name "Floating point support"
\end_inset
\begin_layout Section
Library Routines
-\begin_inset LatexCommand \index{Libraries}
+\begin_inset LatexCommand index
+name "Libraries"
\end_inset
\end_layout
\begin_layout Standard
-\begin_inset LatexCommand \index{<stdio.h>}
+\begin_inset LatexCommand index
+name "<stdio.h>"
\end_inset
As usual on embedded systems you have to provide your own
\family typewriter
getchar()
-\begin_inset LatexCommand \index{getchar()}
+\begin_inset LatexCommand index
+name "getchar()"
\end_inset
-
+
\family default
-and
+ and
\family typewriter
putchar()
-\begin_inset LatexCommand \index{putchar()}
+\begin_inset LatexCommand index
+name "putchar()"
\end_inset
\end_layout
\begin_layout Standard
-The default
+The default
\family typewriter
- printf()
-\begin_inset LatexCommand \index{printf()}
+printf()
+\begin_inset LatexCommand index
+name "printf()"
\end_inset
\family default
- implementation in
+ implementation in
\family typewriter
- printf_large.c
+printf_large.c
\family default
- does not support float (except on ds390).
- To enable this recompile it with the option
+ does not support float
+\begin_inset LatexCommand index
+name "Floating point support"
+
+\end_inset
+
+ (except on ds390), only <NO FLOAT>
+\begin_inset LatexCommand index
+name "<NO FLOAT>"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "printf floating point support"
+
+\end_inset
+
+ will be printed instead of the value.
+ To enable floating point output, recompile it with the option
\emph on
-
\begin_inset ERT
\end_inset
DUSE_FLOATS=1
-\begin_inset LatexCommand \index{USE\_FLOATS}
+\begin_inset LatexCommand index
+name "USE\\_FLOATS"
\end_inset
\emph default
on the command line.
- Use
+ Use
\emph on
- -
+-
\begin_inset ERT
-status collapsed
+status open
\begin_layout Standard
\end_inset
-model-large
-\begin_inset LatexCommand \index{-\/-model-large}
+\begin_inset LatexCommand index
+name "-\\/-model-large"
\end_inset
\emph default
for the mcs51 port, since this uses a lot of memory.
+ To enable float support for the pic16 targets, see
+\begin_inset LatexCommand ref
+reference "sub:pic16Libraries"
+
+\end_inset
+
+.
\end_layout
\begin_layout Standard
If you're short on code memory you might want to use
\family typewriter
printf_small()
-\begin_inset LatexCommand \index{printf\_small()}
+\begin_inset LatexCommand index
+name "printf\\_small()"
\end_inset
\emph on
instead
\emph default
- of
+ of
\family typewriter
- printf().
+printf().
\family default
For the mcs51 there additionally are assembly versions
\family typewriter
printf_tiny()
-\begin_inset LatexCommand \index{printf\_tiny() (mcs51)}
+\begin_inset LatexCommand index
+name "printf\\_tiny() (mcs51)"
\end_inset
(subset of printf using less than 270 bytes) and
\family typewriter
printf_fast()
-\begin_inset LatexCommand \index{printf\_fast() (mcs51)}
+\begin_inset LatexCommand index
+name "printf\\_fast() (mcs51)"
\end_inset
-
+
\family default
-and
+ and
\family typewriter
- printf_fast_f()
-\begin_inset LatexCommand \index{printf\_fast\_f() (mcs51)}
+printf_fast_f()
+\begin_inset LatexCommand index
+name "printf\\_fast\\_f() (mcs51)"
\end_inset
\begin_layout Standard
printf
-\begin_inset LatexCommand \index{printf}
+\begin_inset LatexCommand index
+name "printf()"
\end_inset
\begin_layout Standard
float format
-\begin_inset LatexCommand \index{Floating point support}
+\begin_inset LatexCommand index
+name "Floating point support"
\end_inset
\begin_layout Subsubsection
<malloc.h>
-\begin_inset LatexCommand \index{malloc.h}
+\begin_inset LatexCommand index
+name "malloc.h"
\end_inset
\begin_layout Standard
As of SDCC 2.6.2 you no longer need to call an initialization routine before
using dynamic memory allocation
-\begin_inset LatexCommand \index{dynamic memory allocation (malloc)}
+\begin_inset LatexCommand index
+name "dynamic memory allocation (malloc)"
\end_inset
and a default heap
-\begin_inset LatexCommand \index{heap (malloc)}
+\begin_inset LatexCommand index
+name "heap (malloc)"
\end_inset
\begin_layout Verse
\family typewriter
-sdcc -c _heap.c -D HEAD_SIZE=2048
+sdcc -c _heap.c -D HEAP_SIZE=2048
\end_layout
\begin_layout Standard
\begin_layout Standard
Libraries
-\begin_inset LatexCommand \index{Libraries}
+\begin_inset LatexCommand index
+name "Libraries"
\end_inset
included in SDCC should have a license at least as liberal as the GNU Lesser
General Public License
-\begin_inset LatexCommand \index{GNU Lesser General Public License, LGPL}
+\begin_inset LatexCommand index
+name "GNU Lesser General Public License, LGPL"
\end_inset
C, CAN, Ethernet, Profibus, Modbus, USB, SPI, JTAG ...), Media (IDE, Memory
cards, eeprom, flash...), En-/Decryption, Remote debugging, Realtime kernel,
Keyboard, LCD, RTC, FPGA, PID then the sdcc-user mailing list
-\begin_inset LatexCommand \url{http://sourceforge.net/mail/?group_id=599}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/mail/?group_id=599"
\end_inset
\begin_layout Subsection
MCS51 Memory Models
-\begin_inset LatexCommand \index{Memory model}
+\begin_inset LatexCommand index
+name "Memory model"
\end_inset
-\begin_inset LatexCommand \index{MCS51 memory model}
+\begin_inset LatexCommand index
+name "MCS51 memory model"
\end_inset
When the medium or 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
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
\begin_layout Standard
Judicious usage of the processor specific storage classes
-\begin_inset LatexCommand \index{Storage class}
+\begin_inset LatexCommand index
+name "Storage class"
\end_inset
\begin_layout Subsubsection
External Stack
-\begin_inset LatexCommand \label{sub:External-Stack}
+\begin_inset LatexCommand label
+name "sub:External-Stack"
\end_inset
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
-\begin_inset LatexCommand \index{External stack (mcs51)}
+\begin_inset LatexCommand index
+name "External stack (mcs51)"
\end_inset
\end_inset
-xstack option
-\begin_inset LatexCommand \index{-\/-xstack}
+\begin_inset LatexCommand index
+name "-\\/-xstack"
\end_inset
) is located in pdata
-\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "pdata (mcs51, ds390 storage class)"
\end_inset
-xstack option is used to compile the program, the parameters and local
variables
-\begin_inset LatexCommand \index{local variables}
+\begin_inset LatexCommand index
+name "local variables"
\end_inset
\end_inset
-stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
\end_inset
\begin_layout Standard
The compiler outputs the higher order address byte of the external ram segment
into port P2
-\begin_inset LatexCommand \index{P2 (mcs51 sfr)}
+\begin_inset LatexCommand index
+name "P2 (mcs51 sfr)"
\end_inset
(see also section
-\begin_inset LatexCommand \ref{sub:MCS51-variants}
+\begin_inset LatexCommand ref
+reference "sub:MCS51-variants"
\end_inset
\begin_layout Subsection
DS390 Memory Model
-\begin_inset LatexCommand \index{Memory model}
+\begin_inset LatexCommand index
+name "Memory model"
\end_inset
-\begin_inset LatexCommand \index{DS390 memory model}
+\begin_inset LatexCommand index
+name "DS390 memory model"
\end_inset
\begin_layout Standard
The only model supported is Flat 24
-\begin_inset LatexCommand \index{Flat 24 (DS390 memory model)}
+\begin_inset LatexCommand index
+name "Flat 24 (DS390 memory model)"
\end_inset
tinibios
\emph default
-\begin_inset LatexCommand \index{Tinibios (DS390)}
+\begin_inset LatexCommand index
+name "Tinibios (DS390)"
\end_inset
\begin_layout Section
Pragmas
-\begin_inset LatexCommand \label{sec:Pragmas}
+\begin_inset LatexCommand label
+name "sec:Pragmas"
\end_inset
-\begin_inset LatexCommand \index{Pragmas}
+\begin_inset LatexCommand index
+name "Pragmas"
\end_inset
Pragmas are used to turn on and/or off certain compiler options.
Some of them are closely related to corresponding command-line options
(see section
-\begin_inset LatexCommand \vref{sec:Command-Line-Options}
+\begin_inset LatexCommand vref
+reference "sec:Command-Line-Options"
\end_inset
save
\series default
-\begin_inset LatexCommand \index{\#pragma save}
+\begin_inset LatexCommand index
+name "\\#pragma save"
\end_inset
restore
\series default
-\begin_inset LatexCommand \index{\#pragma restore}
+\begin_inset LatexCommand index
+name "\\#pragma restore"
\end_inset
callee_saves
\series default
-\begin_inset LatexCommand \index{\#pragma callee\_saves}
+\begin_inset LatexCommand index
+name "\\#pragma callee\\_saves"
\end_inset
-\begin_inset LatexCommand \index{function prologue}
+\begin_inset LatexCommand index
+name "function prologue"
\end_inset
function1[,function2[,function3...]]
-\begin_inset LatexCommand \label{ite:callee_saves-function1[,function2[,function3...]]--}
+\begin_inset LatexCommand label
+name "ite:callee_saves-function1[,function2[,function3...]]--"
\end_inset
- The compiler by default uses a caller saves convention for register saving
across function calls, however this can cause unnecessary register pushing
and popping
-\begin_inset LatexCommand \index{push/pop}
+\begin_inset LatexCommand index
+name "push/pop"
\end_inset
\end_inset
-callee-saves command line option is used (see page
-\begin_inset LatexCommand \vpageref{lyx:--callee-saves-function1[,function2][,function3]...}
+\begin_inset LatexCommand vpageref
+reference "lyx:--callee-saves-function1[,function2][,function3]..."
\end_inset
), the function names specified in #pragma\InsetSpace ~
callee_saves
-\begin_inset LatexCommand \index{\#pragma callee\_saves}
+\begin_inset LatexCommand index
+name "\\#pragma callee\\_saves"
\end_inset
exclude
\series default
-\begin_inset LatexCommand \index{\#pragma exclude}
+\begin_inset LatexCommand index
+name "\\#pragma exclude"
\end_inset
none | {acc[,b[,dpl[,dph]]] - The exclude pragma disables the generation
of pairs of push/pop
-\begin_inset LatexCommand \index{push/pop}
+\begin_inset LatexCommand index
+name "push/pop"
\end_inset
I
\emph default
nterrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
To enable the normal register saving for ISR functions use #pragma\InsetSpace ~
exclude\InsetSpace ~
none
-\begin_inset LatexCommand \index{\#pragma exclude}
+\begin_inset LatexCommand index
+name "\\#pragma exclude"
\end_inset
.
See also the related keyword _naked
-\begin_inset LatexCommand \index{\_naked}
+\begin_inset LatexCommand index
+name "\\_naked"
\end_inset
-\begin_inset LatexCommand \index{\_\_naked}
+\begin_inset LatexCommand index
+name "\\_\\_naked"
\end_inset
less_pedantic
\series default
-\begin_inset LatexCommand \index{pedantic}
+\begin_inset LatexCommand index
+name "pedantic"
\end_inset
-\begin_inset LatexCommand \index{\#pragma less\_pedantic}
+\begin_inset LatexCommand index
+name "\\#pragma less\\_pedantic"
\end_inset
-\begin_inset LatexCommand \label{ite:less_pedantic}
+\begin_inset LatexCommand label
+name "ite:less_pedantic"
\end_inset
\end_inset
-less-pedantic
-\begin_inset LatexCommand \vpageref{lyx:--less-pedantic}
+\begin_inset LatexCommand vpageref
+reference "lyx:--less-pedantic"
\end_inset
disable_warning
\series default
<nnnn>
-\begin_inset LatexCommand \index{\#pragma disable\_warning}
+\begin_inset LatexCommand index
+name "\\#pragma disable\\_warning"
\end_inset
nogcse
\series default
-\begin_inset LatexCommand \index{\#pragma nogcse}
+\begin_inset LatexCommand index
+name "\\#pragma nogcse"
\end_inset
noinduction
\series default
-\begin_inset LatexCommand \index{\#pragma noinduction}
+\begin_inset LatexCommand index
+name "\\#pragma noinduction"
\end_inset
noinvariant
\series default
-\begin_inset LatexCommand \index{\#pragma noinvariant}
+\begin_inset LatexCommand index
+name "\\#pragma noinvariant"
\end_inset
- will not do loop invariant optimizations.
For more details see Loop Invariants in section
-\begin_inset LatexCommand \ref{sub:Loop-Optimizations}
+\begin_inset LatexCommand ref
+reference "sub:Loop-Optimizations"
\end_inset
noiv
\series default
-\begin_inset LatexCommand \index{\#pragma noiv}
+\begin_inset LatexCommand index
+name "\\#pragma noiv"
\end_inset
- Do not generate interrupt
-\begin_inset LatexCommand \index{interrupt}
+\begin_inset LatexCommand index
+name "interrupt"
\end_inset
vector table
-\begin_inset LatexCommand \index{interrupt vector table}
+\begin_inset LatexCommand index
+name "interrupt vector table"
\end_inset
manually, or when there is a secondary, manually defined interrupt vector
table (e.g.
for the autovector feature of the Cypress EZ-USB FX2).
- More elegantly this can be achieved by obmitting the optional interrupt
+ More elegantly this can be achieved by omitting the optional interrupt
number after the interrupt keyword, see section
-\begin_inset LatexCommand \ref{sub:Interrupt-Service-Routines}
+\begin_inset LatexCommand ref
+reference "sub:Interrupt-Service-Routines"
\end_inset
nojtbound
\series default
-\begin_inset LatexCommand \index{\#pragma nojtbound}
+\begin_inset LatexCommand index
+name "\\#pragma nojtbound"
\end_inset
- will not generate code for boundary value checking, when switch statements
are turned into jump-tables (dangerous).
For more details see section
-\begin_inset LatexCommand \ref{sub:'switch'-Statements}
+\begin_inset LatexCommand ref
+reference "sub:'switch'-Statements"
\end_inset
noloopreverse
\series default
-\begin_inset LatexCommand \index{\#pragma noloopreverse}
+\begin_inset LatexCommand index
+name "\\#pragma noloopreverse"
\end_inset
nooverlay
\series default
-\begin_inset LatexCommand \index{\#pragma nooverlay}
+\begin_inset LatexCommand index
+name "\\#pragma nooverlay"
\end_inset
stackauto
\series default
-\begin_inset LatexCommand \index{\#pragma stackauto}
+\begin_inset LatexCommand index
+name "\\#pragma stackauto"
\end_inset
\end_inset
-stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
\end_inset
and section
-\begin_inset LatexCommand \ref{sec:Parameters-and-Local-Variables}
+\begin_inset LatexCommand ref
+reference "sec:Parameters-and-Local-Variables"
\end_inset
opt_code_speed
\series default
-\begin_inset LatexCommand \index{\#pragma opt\_code\_speed}
+\begin_inset LatexCommand index
+name "\\#pragma opt\\_code\\_speed"
\end_inset
opt_code_size
\series default
-\begin_inset LatexCommand \index{\#pragma opt\_code\_size}
+\begin_inset LatexCommand index
+name "\\#pragma opt\\_code\\_size"
\end_inset
opt_code_balanced
\series default
-\begin_inset LatexCommand \index{\#pragma opt\_code\_balanced}
+\begin_inset LatexCommand index
+name "\\#pragma opt\\_code\\_balanced"
\end_inset
std_sdcc89
\series default
-\begin_inset LatexCommand \index{\#pragma std\_sdcc89}
+\begin_inset LatexCommand index
+name "\\#pragma std\\_sdcc89"
\end_inset
std_c89
\series default
-\begin_inset LatexCommand \index{\#pragma std\_c89}
+\begin_inset LatexCommand index
+name "\\#pragma std\\_c89"
\end_inset
std_sdcc99
\series default
-\begin_inset LatexCommand \index{\#pragma std\_sdcc99}
+\begin_inset LatexCommand index
+name "\\#pragma std\\_sdcc99"
\end_inset
std_c99
\series default
-\begin_inset LatexCommand \index{\#pragma std\_c99}
+\begin_inset LatexCommand index
+name "\\#pragma std\\_c99"
\end_inset
codeseg
\series default
<name>
-\begin_inset LatexCommand \index{\#pragma codeseg}
+\begin_inset LatexCommand index
+name "\\#pragma codeseg"
\end_inset
constseg
\series default
<name>
-\begin_inset LatexCommand \index{\#pragma constseg}
+\begin_inset LatexCommand index
+name "\\#pragma constseg"
\end_inset
\begin_layout Standard
The preprocessor SDCPP
-\begin_inset LatexCommand \index{sdcpp (preprocessor)}
+\begin_inset LatexCommand index
+name "sdcpp (preprocessor)"
\end_inset
pedantic_parse_number
\series default
-\begin_inset LatexCommand \index{pedantic}
+\begin_inset LatexCommand index
+name "pedantic"
\end_inset
-\begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number}
+\begin_inset LatexCommand index
+name "\\#pragma pedantic\\_parse\\_number"
\end_inset
(+ | -)
-\begin_inset LatexCommand \label{ite:pedantic_parse_number}
+\begin_inset LatexCommand label
+name "ite:pedantic_parse_number"
\end_inset
\end_inset
-pedantic-parse-number command line option
-\begin_inset LatexCommand \vpageref{lyx:-pedantic-parse-number}
+\begin_inset LatexCommand vpageref
+reference "lyx:-pedantic-parse-number"
\end_inset
\newline
Below is an example on how to use this pragma.
-
+
\emph on
- Note: this functionality is not in conformance with standard!
+Note: this functionality is not in conformance with standard!
\end_layout
\begin_layout Verse
\family typewriter
#pragma pedantic_parse_number +
-\begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number}
+\begin_inset LatexCommand index
+name "\\#pragma pedantic\\_parse\\_number"
\end_inset
preproc_asm
\series default
-\begin_inset LatexCommand \index{\#pragma preproc\_asm}
+\begin_inset LatexCommand index
+name "\\#pragma preproc\\_asm"
\end_inset
(+ | -) - switch _asm _endasm block preprocessing on / off.
Default is on.
- You use this prama to define multilines of assembly code.
- This will prevent the preprocessor from changing the formating required
+ You use this pragma to define multilines of assembly code.
+ This will prevent the preprocessor from changing the formatting required
by assembly code.
Below is an example on how to use this pragma.
\end_layout
\family typewriter
#pragma preproc_asm -
-\begin_inset LatexCommand \index{\#pragma preproc\_asm}
+\begin_inset LatexCommand index
+name "\\#pragma preproc\\_asm"
\end_inset
sdcc_hash
\series default
-\begin_inset LatexCommand \index{\#pragma sdcc\_hash}
+\begin_inset LatexCommand index
+name "\\#pragma sdcc\\_hash"
\end_inset
#pragma preproc_asm +
\newline
#pragma sdcc_hash +
-\begin_inset LatexCommand \index{\#pragma sdcc\_hash}
+\begin_inset LatexCommand index
+name "\\#pragma sdcc\\_hash"
\end_inset
\family typewriter
#pragma save
-\begin_inset LatexCommand \index{\#pragma save}
+\begin_inset LatexCommand index
+name "\\#pragma save"
\end_inset
/* save the current settings */
\newline
#pragma nogcse
-\begin_inset LatexCommand \index{\#pragma nogcse}
+\begin_inset LatexCommand index
+name "\\#pragma nogcse"
\end_inset
/* turnoff global subexpression elimination */
\newline
#pragma noinduction
-\begin_inset LatexCommand \index{\#pragma noinduction}
+\begin_inset LatexCommand index
+name "\\#pragma noinduction"
\end_inset
}
\newline
#pragma restore
-\begin_inset LatexCommand \index{\#pragma restore}
+\begin_inset LatexCommand index
+name "\\#pragma restore"
\end_inset
\begin_layout Standard
The compiler creates the following #defines
-\begin_inset LatexCommand \index{\#defines}
+\begin_inset LatexCommand index
+name "\\#defines"
\end_inset
-\begin_inset LatexCommand \index{Defines created by the compiler}
+\begin_inset LatexCommand index
+name "Defines created by the compiler"
\end_inset
\begin_layout Standard
SDCC
-\begin_inset LatexCommand \index{SDCC}
+\begin_inset LatexCommand index
+name "SDCC"
\end_inset
\begin_layout Standard
SDCC_mcs51
-\begin_inset LatexCommand \index{SDCC\_mcs51}
+\begin_inset LatexCommand index
+name "SDCC\\_mcs51"
\end_inset
or SDCC_ds390
-\begin_inset LatexCommand \index{SDCC\_ds390}
+\begin_inset LatexCommand index
+name "SDCC\\_ds390"
\end_inset
or SDCC_z80
-\begin_inset LatexCommand \index{SDCC\_z80}
+\begin_inset LatexCommand index
+name "SDCC\\_z80"
\end_inset
\begin_layout Standard
__mcs51
-\begin_inset LatexCommand \index{\_\_mcs51}
+\begin_inset LatexCommand index
+name "\\_\\_mcs51"
\end_inset
, __ds390
-\begin_inset LatexCommand \index{\_\_ds390}
+\begin_inset LatexCommand index
+name "\\_\\_ds390"
\end_inset
, __hc08
-\begin_inset LatexCommand \index{\_\_hc08}
+\begin_inset LatexCommand index
+name "\\_\\_hc08"
\end_inset
, __z80
-\begin_inset LatexCommand \index{\_\_z80}
+\begin_inset LatexCommand index
+name "\\_\\_z80"
\end_inset
\begin_layout Standard
SDCC_STACK_AUTO
-\begin_inset LatexCommand \index{SDCC\_STACK\_AUTO}
+\begin_inset LatexCommand index
+name "SDCC\\_STACK\\_AUTO"
\end_inset
\begin_layout Standard
SDCC_MODEL_SMALL
-\begin_inset LatexCommand \index{SDCC\_MODEL\_SMALL}
+\begin_inset LatexCommand index
+name "SDCC\\_MODEL\\_SMALL"
\end_inset
\begin_layout Standard
SDCC_MODEL_MEDIUM
-\begin_inset LatexCommand \index{SDCC\_MODEL\_MEDIUM}
+\begin_inset LatexCommand index
+name "SDCC\\_MODEL\\_MEDIUM"
\end_inset
\begin_layout Standard
SDCC_MODEL_LARGE
-\begin_inset LatexCommand \index{SDCC\_MODEL\_LARGE}
+\begin_inset LatexCommand index
+name "SDCC\\_MODEL\\_LARGE"
\end_inset
\begin_layout Standard
SDCC_USE_XSTACK
-\begin_inset LatexCommand \index{SDCC\_USE\_XSTACK}
+\begin_inset LatexCommand index
+name "SDCC\\_USE\\_XSTACK"
\end_inset
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
+\begin_layout Standard
+SDCC_CHAR_UNSIGNED
+\begin_inset LatexCommand index
+name "SDCC\\_CHAR\\_UNSIGNED"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+when
+\emph on
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-funsigned-char
+\emph default
+ option is used
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
\begin_layout Standard
SDCC_STACK_TENBIT
-\begin_inset LatexCommand \index{SDCC\_STACK\_TENBIT}
+\begin_inset LatexCommand index
+name "SDCC\\_STACK\\_TENBIT"
\end_inset
\begin_layout Standard
SDCC_MODEL_FLAT24
-\begin_inset LatexCommand \index{SDCC\_MODEL\_FLAT24}
+\begin_inset LatexCommand index
+name "SDCC\\_MODEL\\_FLAT24"
\end_inset
\begin_layout Standard
SDCC_REVISION
-\begin_inset LatexCommand \index{SDCC\_REVISION}
+\begin_inset LatexCommand index
+name "SDCC\\_REVISION"
\end_inset
\begin_layout Standard
SDCC_PARMS_IN_BANK1
-\begin_inset LatexCommand \index{SDCC\_PARMS\_IN\_BANK1}
+\begin_inset LatexCommand index
+name "SDCC\\_PARMS\\_IN\\_BANK1"
\end_inset
\begin_layout Standard
SDCC_FLOAT_REENT
-\begin_inset LatexCommand \index{SDCC\_MODEL\_FLAT24}
+\begin_inset LatexCommand index
+name "SDCC\\_MODEL\\_FLAT24"
\end_inset
\begin_layout Standard
SDCC_INT_LONG_REENT
-\begin_inset LatexCommand \index{SDCC\_INT\_LONG\_REENT}
+\begin_inset LatexCommand index
+name "SDCC\\_INT\\_LONG\\_REENT"
\end_inset
\begin_layout Section
MCS51 variants
-\begin_inset LatexCommand \label{sub:MCS51-variants}
+\begin_inset LatexCommand label
+name "sub:MCS51-variants"
\end_inset
-\begin_inset LatexCommand \index{MCS51 variants}
+\begin_inset LatexCommand index
+name "MCS51 variants"
\end_inset
\begin_layout Standard
With the upcome of devices with internal xdata and flash memory devices
using port P2
-\begin_inset LatexCommand \index{P2 (mcs51 sfr)}
+\begin_inset LatexCommand index
+name "P2 (mcs51 sfr)"
\end_inset
as dedicated I/O port is becoming more popular.
Switching the high byte for pdata
-\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+\begin_inset LatexCommand index
+name "pdata (mcs51, ds390 storage class)"
\end_inset
access which was formerly done by port P2 is then achieved by a Special
Function Register
-\begin_inset LatexCommand \index{sfr}
+\begin_inset LatexCommand index
+name "sfr"
\end_inset
should define an sfr with the name _XPAGE
\family typewriter
-\begin_inset LatexCommand \index{\_XPAGE (mcs51)}
+\begin_inset LatexCommand index
+name "\\_XPAGE (mcs51)"
\end_inset
\begin_layout Standard
For more exotic implementations further customizations may be needed.
See section
-\begin_inset LatexCommand \ref{sub:Startup-Code}
+\begin_inset LatexCommand ref
+reference "sub:Startup-Code"
\end_inset
\begin_layout Standard
Some MCS51 variants offer features like Double DPTR
-\begin_inset LatexCommand \index{DPTR}
+\begin_inset LatexCommand index
+name "DPTR"
\end_inset
\begin_layout Standard
Bankswitching
-\begin_inset LatexCommand \index{Bankswitching}
+\begin_inset LatexCommand index
+name "Bankswitching"
\end_inset
(a.k.a.
code banking
-\begin_inset LatexCommand \index{code banking}
+\begin_inset LatexCommand index
+name "code banking"
\end_inset
banked
\emph default
-\begin_inset LatexCommand \index{banked}
+\begin_inset LatexCommand index
+name "banked"
\end_inset
\begin_layout Standard
Functions that need to be in a switched bank must be put in a named segment.
- The name can be mostly anything upto eight characters (e.g.
+ The name can be mostly anything up to eight characters (e.g.
BANK1).
To do this you either use -
\begin_inset ERT
\end_inset
-codeseg BANK1 (See
-\begin_inset LatexCommand \ref{lyx:-codeseg}
+\begin_inset LatexCommand ref
+reference "lyx:-codeseg"
\end_inset
) on the command line when compiling or #pragma codeseg BANK1 (See
-\begin_inset LatexCommand \ref{sec:Pragmas}
+\begin_inset LatexCommand ref
+reference "sec:Pragmas"
\end_inset
to put your segments.
To do this you use the following command line option to SDCC: -Wl-b BANK1=0x180
00 (See
-\begin_inset LatexCommand \ref{lyx:-Wl option}
+\begin_inset LatexCommand ref
+reference "lyx:-Wl option"
\end_inset
\begin_layout Standard
The DS80C400
-\begin_inset LatexCommand \index{DS80C400}
+\begin_inset LatexCommand index
+name "DS80C400"
\end_inset
-\begin_inset LatexCommand \index{DS400}
+\begin_inset LatexCommand index
+name "DS400"
\end_inset
at
\size footnotesize
-\begin_inset LatexCommand \url{ftp://ftp.dalsemi.com/pub/tini/ds80c400/c_libraries/sdcc/index.html}
+\begin_inset LatexCommand url
+target "ftp://ftp.dalsemi.com/pub/tini/ds80c400/c_libraries/sdcc/index.html"
\end_inset
\begin_layout Standard
SDCC can target both the Zilog Z80
-\begin_inset LatexCommand \index{Z80}
+\begin_inset LatexCommand index
+name "Z80"
\end_inset
and the Nintendo Gameboy's Z80-like gbz80
-\begin_inset LatexCommand \index{gbz80 (GameBoy Z80)}
+\begin_inset LatexCommand index
+name "gbz80 (GameBoy Z80)"
\end_inset
The Z80 port is passed through the same
\emph on
regressions tests
-\begin_inset LatexCommand \index{Regression test}
+\begin_inset LatexCommand index
+name "Regression test"
\end_inset
\emph default
(see section
-\begin_inset LatexCommand \ref{sec:Quality-control}
+\begin_inset LatexCommand ref
+reference "sec:Quality-control"
\end_inset
As always, the code is the authoritative reference - see z80/ralloc.c and
z80/gen.c.
The stack
-\begin_inset LatexCommand \index{Z80!stack}
+\begin_inset LatexCommand index
+name "Z80!stack"
\end_inset
IX is used as the base pointer, HL and IY are used as a temporary registers,
and BC and DE are available for holding variables.
Return values
-\begin_inset LatexCommand \index{Z80!return value}
+\begin_inset LatexCommand index
+name "Z80!return value"
\end_inset
\begin_layout Standard
The port to the Freescale/Motorola HC08
-\begin_inset LatexCommand \index{HC08}
+\begin_inset LatexCommand index
+name "HC08"
\end_inset
\begin_layout Standard
The HC08 port passes the regression test suite (see section
-\begin_inset LatexCommand \ref{sec:Quality-control}
+\begin_inset LatexCommand ref
+reference "sec:Quality-control"
\end_inset
\begin_layout Section
The PIC14
-\begin_inset LatexCommand \index{PIC14}
+\begin_inset LatexCommand index
+name "PIC14"
\end_inset
\begin_layout Standard
The PIC14 port adds support for Microchip
-\begin_inset LatexCommand \index{Microchip}
+\begin_inset LatexCommand index
+name "Microchip"
\end_inset
\end_inset
PIC
-\begin_inset LatexCommand \index{PIC14}
+\begin_inset LatexCommand index
+name "PIC14"
\end_inset
\begin_layout Subsection
PIC Code Pages
-\begin_inset LatexCommand \index{code page (pic14)}
+\begin_inset LatexCommand index
+name "code page (pic14)"
\end_inset
and Memory Banks
-\begin_inset LatexCommand \index{Memory bank (pic14)}
+\begin_inset LatexCommand index
+name "Memory bank (pic14)"
\end_inset
\newline
Due to the way sdcc handles functions, place called functions prior
to calling functions in the file wherever possible: Otherwise sdcc will
- insert unneccessary pagesel directives around the call, believing that
- the called function is externally defined.
+ insert unnecessary pagesel directives around the call, believing that the
+ called function is externally defined.
\end_layout
\begin_layout Enumerate
\begin_layout Standard
For the interrupt function, use the keyword `__interrupt'
-\begin_inset LatexCommand \index{PIC14!interrupt}
+\begin_inset LatexCommand index
+name "PIC14!interrupt"
\end_inset
\begin_layout Standard
For assembling you can use either GPUTILS'
-\begin_inset LatexCommand \index{gputils (pic tools)}
+\begin_inset LatexCommand index
+name "gputils (pic tools)"
\end_inset
gpasm.exe or MPLAB's mpasmwin.exe.
GPUTILS are available from
-\begin_inset LatexCommand \url{http://sourceforge.net/projects/gputils}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/gputils"
\end_inset
\end_layout
\begin_layout Standard
-Please note that indentations within a
+Please note that indentations within a
\family typewriter
- Makefile
+Makefile
\family default
have to be done with a tabulator character.
\end_layout
\end_inset
-debug-xtra
-\begin_inset LatexCommand \index{PIC14!Options!-\/-debug-extra}
+\begin_inset LatexCommand index
+name "PIC14!Options!-\\/-debug-extra"
\end_inset
\end_inset
-no-pcode-opt
-\begin_inset LatexCommand \index{PIC14!Options!-\/-no-pcode-opt}
+\begin_inset LatexCommand index
+name "PIC14!Options!-\\/-no-pcode-opt"
\end_inset
\end_inset
-stack-loc
-\begin_inset LatexCommand \index{PIC14!Options!-\/-stack-loc}
+\begin_inset LatexCommand index
+name "PIC14!Options!-\\/-stack-loc"
\end_inset
\end_inset
-stack-size
-\begin_inset LatexCommand \index{PIC14!Options!-\/-stack-size}
+\begin_inset LatexCommand index
+name "PIC14!Options!-\\/-stack-size"
\end_inset
\end_inset
bit PIC
-\begin_inset LatexCommand \index{PIC14}
+\begin_inset LatexCommand index
+name "PIC14"
\end_inset
device/lib/pic/Makefile
\family default
to reflect your device.
- This might even improve performance for smaller devices as unneccesary
+ This might even improve performance for smaller devices as unnecessary
BANKSELs might be removed.
\end_layout
\begin_layout Section
The PIC16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
\begin_layout Standard
The PIC16 port adds support for Microchip
-\begin_inset LatexCommand \index{Microchip}
+\begin_inset LatexCommand index
+name "Microchip"
\end_inset
\end_inset
PIC
-\begin_inset LatexCommand \index{PIC}
+\begin_inset LatexCommand index
+name "PIC"
\end_inset
\end_layout
\begin_layout Standard
-18F: 2220, 2221, 2320, 2321, 2331, 2410, 2420, 2423, 2431, 2450, 2455, 2480,
- 24j10
+18F: 2220, 2221, 2320, 2321, 2331, 23k20
\end_layout
\begin_layout Standard
-18F: (2510,) 2515, 2520, 2523, 2525, 2550, 2580, 2585, 25j10, 2610, 2620,
- 2680, 2682, 2685
+18F: 2410, 2420, 2423, 2431, 2450, 2455, 2480, 24j10, 24k20
\end_layout
\begin_layout Standard
-18F: 4220, 4221, 4320, 4321, 4331, 4410, 4420, 4423, 4431, 4450, 4455, 4480,
- 44j10
+18F: 2510, 2515, 2520, 2523, 2525, 2550, 2580, 2585, 25j10, 25k20
\end_layout
\begin_layout Standard
-18F: 4510, 4515, 4520, 4523, 4525, 4550, 4580, 4585, 45j10, 4610, 4620,
- 4680, 4682, 4685
+18F: 2610, 2620, 2680, 2682, 2685
\end_layout
\begin_layout Standard
-18F: 6520, 6585, 6620, 6680, 66j60, 66j65, 6720, 67j60
+18F: 4220, 4221, 4320, 4321, 4331, 43k20
\end_layout
\begin_layout Standard
-18F: 8520, 8585, 8620, 8680, 86j60, 86j65, 8720, 87j60
+18F: 4410, 4420, 4423, 4431, 4450, 4455, 4480, 44j10, 44k20
+\end_layout
+
+\begin_layout Standard
+18F: 4510, 4515, 4520, 4523, 4525, 4550, 4580, 4585, 45j10, 45k20
+\end_layout
+
+\begin_layout Standard
+18F: 4610, 4620, 4680, 4682, 4685, 46k20
+\end_layout
+
+\begin_layout Standard
+18F: 6520, 6585, 65j50, 6620, 6680, 66j50, 66j55, 66j60, 66j65, 6720, 67j50,
+ 67j60
+\end_layout
+
+\begin_layout Standard
+18F: 8520, 8585, 85j50, 8620, 8680, 86j50, 86j55, 86j60, 86j65, 8720, 87j50,
+ 87j60
\end_layout
\begin_layout Standard
\end_inset
-callee-saves
-\begin_inset LatexCommand \index{PIC16!Options!-\/-callee-saves}
+\begin_inset LatexCommand index
+name "PIC16!Options!-\\/-callee-saves"
\end_inset
\end_inset
-fommit-frame-pointer
-\begin_inset LatexCommand \index{PIC16!Options!-\/-fommit-frame-pointer}
+\begin_inset LatexCommand index
+name "PIC16!Options!-\\/-fommit-frame-pointer"
\end_inset
\begin_layout Subsection
Port Specific Options
-\begin_inset LatexCommand \index{Options PIC16}
+\begin_inset LatexCommand index
+name "Options PIC16"
\end_inset
\end_inset
--pstack-model=[model] Used in conjuction with the command above.
+-pstack-model=[model] Used in conjunction with the command above.
Defines the stack model to be used, valid stack models are:
\end_layout
\end_inset
-mplab-comp MPLAB
-\begin_inset LatexCommand \index{PIC16!MPLAB}
+\begin_inset LatexCommand index
+name "PIC16!MPLAB"
\end_inset
\end_inset
-debug
-\begin_inset LatexCommand \index{-\/-debug}
+\begin_inset LatexCommand index
+name "-\\/-debug"
\end_inset
\end_layout
\begin_layout Subsection
-Enviroment Variables
+Environment Variables
\end_layout
\begin_layout Standard
-There is a number of enviromental variables that can be used when running
+There is a number of environmental variables that can be used when running
SDCC to enable certain optimizations or force a specific program behaviour.
these variables are primarily for debugging purposes so they can be enabled/dis
abled at will.
\begin_layout Standard
PIC16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
\begin_layout Standard
PIC16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
\begin_layout Subsection
Pragmas
-\begin_inset LatexCommand \label{sub:PIC16_Pragmas}
+\begin_inset LatexCommand label
+name "sub:PIC16_Pragmas"
\end_inset
\begin_layout Standard
The PIC16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
\begin_layout Description
stack
-\begin_inset LatexCommand \index{PIC16!Pragmas!\#pragma stack}
+\begin_inset LatexCommand index
+name "PIC16!Pragmas!\\#pragma stack"
\end_inset
\begin_layout Description
code
-\begin_inset LatexCommand \index{PIC16!Pragmas!\#pragma code}
+\begin_inset LatexCommand index
+name "PIC16!Pragmas!\\#pragma code"
\end_inset
\begin_layout Standard
\noindent
-This feature allows for linking with specific libraries withoug having to
+This feature allows for linking with specific libraries without having to
explicit name them in the command line.
Note that the
\noun on
\begin_layout Subsection
Header Files
-\begin_inset LatexCommand \label{sub:PIC16_Header-Files}
+\begin_inset LatexCommand label
+name "sub:PIC16_Header-Files"
\end_inset
\begin_layout Standard
There is one main header file
-\begin_inset LatexCommand \index{PIC16!Header files}
+\begin_inset LatexCommand index
+name "PIC16!Header files"
\end_inset
that can be included to the source files using the pic16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
\begin_layout Subsection
Libraries
-\begin_inset LatexCommand \label{sub:pic16Libraries}
+\begin_inset LatexCommand label
+name "sub:pic16Libraries"
\end_inset
\begin_layout Standard
The libraries
-\begin_inset LatexCommand \index{PIC16!Libraries}
+\begin_inset LatexCommand index
+name "PIC16!Libraries"
\end_inset
that PIC16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
\begin_layout Standard
\noindent
Libraries are created with gplib which is part of the gputils package
-\begin_inset LatexCommand \url{http://sourceforge.net/projects/gputils}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/gputils"
\end_inset
Before using SDCC/pic16 there are some libraries that need to be compiled.
This process is done automatically if gputils are found at SDCC's compile
time.
- Should you require to rebuild the pic16 libraries manually, these are the
- steps required to do so under Linux or Mac OS X (cygwin might work as well,
- but is untested):
+ Should you require to rebuild the pic16 libraries manually (e.g.
+ in order to enable output of float values
+\begin_inset LatexCommand index
+name "Floating point support"
+
+\end_inset
+
+ via
+\family typewriter
+printf()
+\family default
+, see below), these are the steps required to do so under Linux or Mac OS
+ X (cygwin might work as well, but is untested):
\end_layout
\begin_layout LyX-Code
su -c 'make install' # install the headers, you need the root password
\end_layout
+\begin_layout Subsubsection*
+Output of float values via printf()
+\end_layout
+
+\begin_layout Standard
+The library is normally built without support for displaying float values,
+ only <NO FLOAT>
+\begin_inset LatexCommand index
+name "<NO FLOAT>"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "printf floating point support"
+
+\end_inset
+
+ will appear instead of the value.
+ To change this, rebuild the library as stated above, but call
+\family typewriter
+./configure.gnu --enable-floats
+\family default
+instead of just
+\family typewriter
+./configure.gnu
+\family default
+.
+ Also make sure that at least
+\family typewriter
+libc/stdio/vfprintf.c
+\family default
+ is actually recompiled, e.g.
+ by
+\family typewriter
+touch
+\family default
+ing it after the
+\family typewriter
+configure
+\family default
+ run or deleting its
+\family typewriter
+.o
+\family default
+ file.
+\end_layout
+
+\begin_layout Standard
+The more common appraoch of compiling
+\family typewriter
+vfprintf.c
+\family default
+ manually with
+\family typewriter
+-DUSE_FLOATS=1
+\family default
+ should also work, but is untested.
+\end_layout
+
\begin_layout Subsection
Adding New Devices to the Port
\end_layout
\begin_layout Standard
-\family typewriter
\backslash
\begin_layout Enumerate
Recompile the pic16 libraries as described in
-\begin_inset LatexCommand \ref{sub:pic16Libraries}
+\begin_inset LatexCommand ref
+reference "sub:pic16Libraries"
\end_inset
\begin_layout Standard
The standard device libraries (see
-\begin_inset LatexCommand \ref{sub:PIC16_Header-Files}
+\begin_inset LatexCommand ref
+reference "sub:PIC16_Header-Files"
\end_inset
\begin_layout Standard
The stack
-\begin_inset LatexCommand \index{PIC16!stack}
+\begin_inset LatexCommand index
+name "PIC16!stack"
\end_inset
\begin_layout Standard
In addition to the standard SDCC function keywords, PIC16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
\begin_layout Description
wparam
-\begin_inset LatexCommand \index{PIC16!wparam}
+\begin_inset LatexCommand index
+name "PIC16!wparam"
\end_inset
\begin_layout Description
shadowregs
-\begin_inset LatexCommand \index{PIC16!shadowregs}
+\begin_inset LatexCommand index
+name "PIC16!shadowregs"
\end_inset
\begin_layout Standard
An interrupt
-\begin_inset LatexCommand \index{PIC16!interrupt}
+\begin_inset LatexCommand index
+name "PIC16!interrupt"
\end_inset
\emph on
Interrupt Vector Address
\emph default
- which points at the genetated ISR.
+ which points at the generated ISR.
This single GOTO instruction is part of an automatically generated
\emph on
interrupt entry point
Address of the specific interrupt.
This is not a problem for the LOW priority interrupts, but it is a problem
for the RESET and the HIGH priority interrupts because code may be written
- at the next interrupt's vector address and cause undeterminate program
+ at the next interrupt's vector address and cause indeterminate program
behaviour if that interrupt is raised.
\begin_inset Foot
status open
\begin_layout Standard
When entering an interrupt, currently the PIC16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
The FILE type is actually a generic pointer which defines one more type
of generic pointers, the
\emph on
-stream
+stream
\emph default
-pointer.
+ pointer.
This new type has the format:
\end_layout
\begin_layout Standard
In order to increase performance
\emph on
-putchar
+putchar
\emph default
-is declared in stdio.h as having its parameter in WREG (it has the wparam
+ is declared in stdio.h as having its parameter in WREG (it has the wparam
keyword).
In stdio.h exists the macro PUTCHAR(arg) that defines the putchar function
in a user-friendly way.
\begin_layout Standard
For sprintf and vsprintf
\emph on
-buf
+buf
\emph default
-should normally be a data pointer where the resulting string will be placed.
- No range checking is done so the user should allocate the necessery buffer.
+ should normally be a data pointer where the resulting string will be placed.
+ No range checking is done so the user should allocate the necessary buffer.
For fprintf and vfprintf
\emph on
fp
\begin_inset Text
\begin_layout Standard
-descritpion
+description
\end_layout
\end_inset
\labelwidthstring 00.00.0000
\series medium
-SIGHANDLER(handler)
+SIGHANDLER(handler)
\series default
-this declares the function prototype for the
+ this declares the function prototype for the
\emph on
handler
\emph default
\begin_layout Standard
The default stack
-\begin_inset LatexCommand \index{PIC16!stack}
+\begin_inset LatexCommand index
+name "PIC16!stack"
\end_inset
\begin_layout Standard
The PIC16 port currently passes most but not all of the tests in SDCC's
regression test
-\begin_inset LatexCommand \index{Regression test (PIC16)}
+\begin_inset LatexCommand index
+name "Regression test (PIC16)"
\end_inset
suite (see section
-\begin_inset LatexCommand \ref{sec:Quality-control}
+\begin_inset LatexCommand ref
+reference "sec:Quality-control"
\end_inset
\begin_layout Itemize
run a syntax-checking tool like splint
-\begin_inset LatexCommand \index{splint (syntax checking tool)}
+\begin_inset LatexCommand index
+name "splint (syntax checking tool)"
\end_inset
-\begin_inset LatexCommand \index{lint (syntax checking tool)}
+\begin_inset LatexCommand index
+name "lint (syntax checking tool)"
\end_inset
\end_inset
-more-pedantic
-\begin_inset LatexCommand \ref{lyx:more-pedantic-SPLINT}
+\begin_inset LatexCommand ref
+reference "lyx:more-pedantic-SPLINT"
\end_inset
\end_inset
-more-pedantic
-\begin_inset LatexCommand \ref{lyx:more-pedantic-SPLINT}
+\begin_inset LatexCommand ref
+reference "lyx:more-pedantic-SPLINT"
\end_inset
\begin_layout Itemize
there is a separate section about SDCDB (section
-\begin_inset LatexCommand \ref{cha:Debugging-with-SDCDB}
+\begin_inset LatexCommand ref
+reference "cha:Debugging-with-SDCDB"
\end_inset
\end_layout
\begin_layout Itemize
-or (8051 specific) use a freeware/commercial simulator which interfaces
+or (8051 specific) use a free open source/commercial simulator which interfaces
to the AOMF
-\begin_inset LatexCommand \index{AOMF, AOMF51}
+\begin_inset LatexCommand index
+name "AOMF, AOMF51"
\end_inset
file (see
-\begin_inset LatexCommand \ref{OMF file}
+\begin_inset LatexCommand ref
+reference "OMF file"
\end_inset
a program and read/write memory locations.
For the 8051 good examples of monitors are paulmon and cmon51 (see section
-\begin_inset LatexCommand \ref{sec:Related-open-source-tools}
+\begin_inset LatexCommand ref
+reference "sec:Related-open-source-tools"
\end_inset
digital oscilloscope
\emph default
-\begin_inset LatexCommand \index{Oscilloscope}
+\begin_inset LatexCommand index
+name "Oscilloscope"
\end_inset
e
\emph default
mulator
-\begin_inset LatexCommand \index{ICE (in circuit emulator)}
+\begin_inset LatexCommand index
+name "ICE (in circuit emulator)"
\end_inset
\emph default
doesn't affect runtime behaviour until a breakpoint is hit.
For the mcs51 most hardware debuggers use the AOMF
-\begin_inset LatexCommand \index{AOMF, AOMF51}
+\begin_inset LatexCommand index
+name "AOMF, AOMF51"
\end_inset
file (see
-\begin_inset LatexCommand \ref{OMF file}
+\begin_inset LatexCommand ref
+reference "OMF file"
\end_inset
\begin_layout Section
Debugging with SDCDB
-\begin_inset LatexCommand \label{cha:Debugging-with-SDCDB}
+\begin_inset LatexCommand label
+name "cha:Debugging-with-SDCDB"
\end_inset
-\begin_inset LatexCommand \index{SDCDB (debugger)}
+\begin_inset LatexCommand index
+name "SDCDB (debugger)"
\end_inset
\begin_layout Standard
SDCC is distributed with a source level debugger
-\begin_inset LatexCommand \index{Debugger}
+\begin_inset LatexCommand index
+name "Debugger"
\end_inset
.
The debugger uses a command line interface, the command repertoire of the
debugger has been kept as close to gdb
-\begin_inset LatexCommand \index{gdb}
+\begin_inset LatexCommand index
+name "gdb"
\end_inset
\end_inset
-debug
-\begin_inset LatexCommand \index{-\/-debug}
+\begin_inset LatexCommand index
+name "-\\/-debug"
\end_inset
be generated.
The compiler generates a .adb file for each of these files.
The linker creates the .cdb
-\begin_inset LatexCommand \index{<file>.cdb}
+\begin_inset LatexCommand index
+name "<file>.cdb"
\end_inset
file from the .adb
-\begin_inset LatexCommand \index{<file>.adb}
+\begin_inset LatexCommand index
+name "<file>.adb"
\end_inset
newcdb
\emph default
at
-\begin_inset LatexCommand \url{http://ec2drv.sf.net/}
+\begin_inset LatexCommand url
+target "http://ec2drv.sf.net/"
\end_inset
\begin_layout Itemize
foo.ihx - the Intel hex format
-\begin_inset LatexCommand \index{Intel hex format}
+\begin_inset LatexCommand index
+name "Intel hex format"
\end_inset
raphics File
\size footnotesize
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/doc/figures/ddd_example.png}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/doc/figures/ddd_example.png"
\end_inset
\size default
shows a screenshot of a debugging session with DDD
-\begin_inset LatexCommand \index{DDD (debugger)}
+\begin_inset LatexCommand index
+name "DDD (debugger)"
\end_inset
status open
\begin_layout Standard
-Check that the double quotes or an apostroph within the command line survive
+Check that the double quotes or an apostrophe within the command line survive
the LyX tool chain.
- Previously the apostrophs got slanted in the PDF output so a cut and paste
+ Previously the apostrophes got slanted in the PDF output so a cut and paste
did not work.
\end_layout
\begin_layout Subsection
Interfacing SDCDB with XEmacs
-\begin_inset LatexCommand \index{XEmacs}
+\begin_inset LatexCommand index
+name "XEmacs"
\end_inset
-\begin_inset LatexCommand \index{Emacs}
+\begin_inset LatexCommand index
+name "Emacs"
\end_inset
\newline
\family typewriter
-(load-file sdcdbsrc.el)
+(load-file sdcdbsrc.el)
\family default
-
+
\newline
\newline
use an 'unsigned char' instead of a 'short' or 'int'.
Please note, that ANSI C requires both signed and unsigned chars to be
promoted to 'signed int'
-\begin_inset LatexCommand \index{promotion to signed int}
+\begin_inset LatexCommand index
+name "promotion to signed int"
\end_inset
before doing any operation.
This promotion
-\begin_inset LatexCommand \index{type promotion}
+\begin_inset LatexCommand index
+name "type promotion"
\end_inset
-\begin_inset LatexCommand \label{type promotion}
+\begin_inset LatexCommand label
+name "type promotion"
\end_inset
\begin_layout Itemize
Declare the variables to be local
-\begin_inset LatexCommand \index{local variables}
+\begin_inset LatexCommand index
+name "local variables"
\end_inset
\begin_layout Section
Porting code from or to other compilers
-\begin_inset LatexCommand \label{sec:Porting-code-to-other-compilers}
+\begin_inset LatexCommand label
+name "sec:Porting-code-to-other-compilers"
\end_inset
\begin_layout Itemize
check the device specific header files
-\begin_inset LatexCommand \index{Header files}
+\begin_inset LatexCommand index
+name "Header files"
\end_inset
-\begin_inset LatexCommand \index{Include files}
+\begin_inset LatexCommand index
+name "Include files"
\end_inset
for compiler specific syntax.
Eventually include the file <compiler.h
-\begin_inset LatexCommand \index{compiler.h (include file)}
+\begin_inset LatexCommand index
+name "compiler.h (include file)"
\end_inset
>
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/compiler.h?view=markup}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/compiler.h?view=markup"
\end_inset
to allow using common header files.
(see f.e.
cc2510fx.h
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/cc2510fx.h?view=markup}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/cc2510fx.h?view=markup"
\end_inset
versions of the same compiler might also use more clever optimizations
this is good idea anyway).
See section
-\begin_inset LatexCommand \ref{sub:Common-interrupt-pitfall-volatile}
+\begin_inset LatexCommand ref
+reference "sub:Common-interrupt-pitfall-volatile"
\end_inset
\end_layout
\begin_layout Itemize
-check that the compilers are not told to supress warnings.
+check that the compilers are not told to suppress warnings.
\end_layout
\begin_layout Itemize
more often than other compilers.
Eventually insert explicit casts to
\family typewriter
-(char)
+(char)
\family default
-or
+ or
\family typewriter
- (unsigned char)
+(unsigned char)
\family default
.
Also check that the ~\InsetSpace ~
operator
-\begin_inset LatexCommand \index{\~\/ Operator}
+\begin_inset LatexCommand index
+name "\\~\\/ Operator"
\end_inset
is not used on
\family typewriter
bit
-\begin_inset LatexCommand \index{bit}
+\begin_inset LatexCommand index
+name "bit"
\end_inset
variables, use the !\InsetSpace ~
operator instead.
See sections
-\begin_inset LatexCommand \ref{type promotion}
+\begin_inset LatexCommand ref
+reference "type promotion"
\end_inset
and
-\begin_inset LatexCommand \ref{sec:Compatibility-with-previous}
+\begin_inset LatexCommand ref
+reference "sec:Compatibility-with-previous"
\end_inset
\begin_layout Itemize
check for differences in printf parameters (some compilers push (va_arg
-\begin_inset LatexCommand \index{vararg, va\_arg}
+\begin_inset LatexCommand index
+name "vararg, va\\_arg"
\end_inset
\family default
.
See section
-\begin_inset LatexCommand \ref{sec:Compatibility-with-previous}
+\begin_inset LatexCommand ref
+reference "sec:Compatibility-with-previous"
\end_inset
\begin_layout Itemize
check the resulting memory map
-\begin_inset LatexCommand \index{Memory map}
+\begin_inset LatexCommand index
+name "Memory map"
\end_inset
\begin_layout Section
Tools
-\begin_inset LatexCommand \index{Tools}
+\begin_inset LatexCommand index
+name "Tools"
\end_inset
\begin_layout Standard
uCsim
-\begin_inset LatexCommand \index{uCsim}
+\begin_inset LatexCommand index
+name "uCsim"
\end_inset
\begin_layout Standard
header file
-\begin_inset LatexCommand \index{Header files}
+\begin_inset LatexCommand index
+name "Header files"
\end_inset
-\begin_inset LatexCommand \index{Include files}
+\begin_inset LatexCommand index
+name "Include files"
\end_inset
\begin_layout Standard
Intel Hex packer
-\begin_inset LatexCommand \index{packihx (tool)}
+\begin_inset LatexCommand index
+name "packihx (tool)"
\end_inset
\begin_layout Section
Documentation
-\begin_inset LatexCommand \index{Documentation}
+\begin_inset LatexCommand index
+name "Documentation"
\end_inset
\begin_inset Text
\begin_layout Standard
-You're reading it right now
+You're reading it right now
\emph on
- \InsetSpace ~
+\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
\newline
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/sdccman.pdf}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/sdccman.pdf"
\end_inset
\begin_inset Text
\begin_layout Standard
-sdcc/Changelog
+sdcc/Changelog
\emph on
- \InsetSpace ~
+\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
\newline
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/ChangeLog}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/ChangeLog"
\end_inset
\begin_layout Standard
ASXXXX
-\begin_inset LatexCommand \index{asXXXX (as-gbz80, as-hc08, asx8051, as-z80)}
+\begin_inset LatexCommand index
+name "asXXXX (as-gbz80, as-hc08, asx8051, as-z80)"
\end_inset
-\begin_inset LatexCommand \index{Assembler documentation}
+\begin_inset LatexCommand index
+name "Assembler documentation"
\end_inset
Assemblers and
\newline
ASLINK
-\begin_inset LatexCommand \index{aslink}
+\begin_inset LatexCommand index
+name "aslink"
\end_inset
-\begin_inset LatexCommand \index{Linker documentation}
+\begin_inset LatexCommand index
+name "Linker documentation"
\end_inset
\newline
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html"
\end_inset
\begin_layout Standard
SDCC regression test
-\begin_inset LatexCommand \index{Regression test}
+\begin_inset LatexCommand index
+name "Regression test"
\end_inset
\newline
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/test_suite_spec.pdf}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/test_suite_spec.pdf"
\end_inset
\newline
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/doc/}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/doc/"
\end_inset
\begin_layout Standard
Notes on debugging with SDCDB
-\begin_inset LatexCommand \index{SDCDB (debugger)}
+\begin_inset LatexCommand index
+name "SDCDB (debugger)"
\end_inset
:
\newline
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/debugger/README}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/debugger/README"
\end_inset
\begin_layout Standard
uCsim
-\begin_inset LatexCommand \index{uCsim}
+\begin_inset LatexCommand index
+name "uCsim"
\end_inset
\newline
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/sim/ucsim/doc/index.html}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/sim/ucsim/doc/index.html"
\end_inset
\begin_layout Standard
Temporary notes on the pic16
-\begin_inset LatexCommand \index{PIC16}
+\begin_inset LatexCommand index
+name "PIC16"
\end_inset
\emph default
-\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/src/pic16/NOTES}
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/src/pic16/NOTES"
\end_inset
\emph default
\bar default
\noun default
-f
+f
\emph on
- \InsetSpace ~
+\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
\newline
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/cdbfileformat.pdf}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/cdbfileformat.pdf"
\end_inset
\begin_layout Section
Related open source tools
-\begin_inset LatexCommand \label{sec:Related-open-source-tools}
+\begin_inset LatexCommand label
+name "sec:Related-open-source-tools"
\end_inset
-\begin_inset LatexCommand \index{Related tools}
+\begin_inset LatexCommand index
+name "Related tools"
\end_inset
\begin_layout Standard
gpsim
-\begin_inset LatexCommand \index{gpsim (pic simulator)}
+\begin_inset LatexCommand index
+name "gpsim (pic simulator)"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.dattalo.com/gnupic/gpsim.html}
+\begin_inset LatexCommand url
+target "http://www.dattalo.com/gnupic/gpsim.html"
\end_inset
\begin_layout Standard
gputils
-\begin_inset LatexCommand \index{gputils (pic tools)}
+\begin_inset LatexCommand index
+name "gputils (pic tools)"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://sourceforge.net/projects/gputils}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/gputils"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://freshmeat.net/projects/flp5/}
+\begin_inset LatexCommand url
+target "http://freshmeat.net/projects/flp5/"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://sourceforge.net/projects/ec2drv}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/ec2drv"
\end_inset
\begin_layout Standard
indent
-\begin_inset LatexCommand \index{indent (source formatting tool)}
+\begin_inset LatexCommand index
+name "indent (source formatting tool)"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://directory.fsf.org/GNU/indent.html}
+\begin_inset LatexCommand url
+target "http://directory.fsf.org/GNU/indent.html"
\end_inset
\begin_layout Standard
srecord
-\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
+\begin_inset LatexCommand index
+name "srecord (bin, hex, ... tool)"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://sourceforge.net/projects/srecord}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/srecord"
\end_inset
\begin_layout Standard
objdump
-\begin_inset LatexCommand \index{objdump (tool)}
+\begin_inset LatexCommand index
+name "objdump (tool)"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://sourceforge.net/projects/cmon51}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/cmon51"
\end_inset
\begin_layout Standard
doxygen
-\begin_inset LatexCommand \index{doxygen (source documentation tool)}
+\begin_inset LatexCommand index
+name "doxygen (source documentation tool)"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.doxygen.org}
+\begin_inset LatexCommand url
+target "http://www.doxygen.org"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.kdevelop.org}
+\begin_inset LatexCommand url
+target "http://www.kdevelop.org"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.pjrc.com/tech/8051/paulmon2.html}
+\begin_inset LatexCommand url
+target "http://www.pjrc.com/tech/8051/paulmon2.html"
\end_inset
\begin_layout Standard
splint
-\begin_inset LatexCommand \index{splint (syntax checking tool)}
+\begin_inset LatexCommand index
+name "splint (syntax checking tool)"
\end_inset
\begin_layout Standard
Statically checks c sources (see
-\begin_inset LatexCommand \ref{lyx:more-pedantic-SPLINT}
+\begin_inset LatexCommand ref
+reference "lyx:more-pedantic-SPLINT"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.splint.org}
+\begin_inset LatexCommand url
+target "http://www.splint.org"
\end_inset
\begin_layout Standard
ddd
-\begin_inset LatexCommand \index{DDD (debugger)}
+\begin_inset LatexCommand index
+name "DDD (debugger)"
\end_inset
\begin_layout Standard
Debugger, serves nicely as GUI to SDCDB
-\begin_inset LatexCommand \index{SDCDB (debugger)}
+\begin_inset LatexCommand index
+name "SDCDB (debugger)"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.gnu.org/software/ddd/}
+\begin_inset LatexCommand url
+target "http://www.gnu.org/software/ddd/"
\end_inset
\begin_layout Standard
d52
-\begin_inset LatexCommand \index{d52}
+\begin_inset LatexCommand index
+name "d52"
\end_inset
-\begin_inset LatexCommand \index{d52 (disassembler)}
+\begin_inset LatexCommand index
+name "d52 (disassembler)"
\end_inset
\begin_layout Standard
Disassembler, can count instruction cycles
-\begin_inset LatexCommand \index{instruction cycles (count)}
+\begin_inset LatexCommand index
+name "instruction cycles (count)"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.8052.com/users/disasm/}
+\begin_inset LatexCommand url
+target "http://www.8052.com/users/disasm/"
\end_inset
\begin_layout Standard
cmake
-\begin_inset LatexCommand \index{cmake}
+\begin_inset LatexCommand index
+name "cmake"
\end_inset
\begin_layout Standard
Cross platform build system, generates Makefiles
-\begin_inset LatexCommand \index{Makefile}
+\begin_inset LatexCommand index
+name "Makefile"
\end_inset
and project workspaces
-\begin_inset LatexCommand \index{project workspace}
+\begin_inset LatexCommand index
+name "project workspace"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.cmake.org}
+\begin_inset LatexCommand url
+target "http://www.cmake.org"
\end_inset
\InsetSpace ~
\InsetSpace ~
and a dedicated wiki entry:
-\begin_inset LatexCommand \url{http://www.cmake.org/Wiki/CmakeSdcc}
+\begin_inset LatexCommand url
+target "http://www.cmake.org/Wiki/CmakeSdcc"
\end_inset
\begin_layout Standard
C Reference Card
-\begin_inset LatexCommand \index{C Reference card}
+\begin_inset LatexCommand index
+name "C Reference card"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://refcards.com/refcards/c/index.html}
+\begin_inset LatexCommand url
+target "http://refcards.com/refcards/c/index.html"
\end_inset
\begin_layout Standard
C-FAQ
-\begin_inset LatexCommand \index{C FAQ}
+\begin_inset LatexCommand index
+name "C FAQ"
\end_inset
\begin_inset Text
\begin_layout Standard
-\begin_inset LatexCommand \url{http://www.c-faq.com}
+\begin_inset LatexCommand url
+target "http://www.c-faq.com"
\end_inset
\begin_layout Standard
\size footnotesize
-\begin_inset LatexCommand \url{http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899}
+\begin_inset LatexCommand url
+target "http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899"
\end_inset
\begin_layout Standard
\size footnotesize
-\begin_inset LatexCommand \url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1021.pdf}
+\begin_inset LatexCommand url
+target "http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1021.pdf"
\end_inset
\begin_layout Standard
SDCC makes no claims about the completeness of this list and about up-to-datenes
s or correctness of the application notes
-\begin_inset LatexCommand \index{Application notes}
+\begin_inset LatexCommand index
+name "Application notes"
\end_inset
\size footnotesize
Using the SDCC Compiler for the DS80C400
-\begin_inset LatexCommand \index{DS80C400}
+\begin_inset LatexCommand index
+name "DS80C400"
\end_inset
\begin_layout Standard
\size footnotesize
-\begin_inset LatexCommand \url{http://pdfserv.maxim-ic.com/en/an/AN3346.pdf}
+\begin_inset LatexCommand url
+target "http://pdfserv.maxim-ic.com/en/an/AN3346.pdf"
\end_inset
\size footnotesize
Using the Free SDCC C Compiler to Develop Firmware for the DS89C420/430/440/450
-\begin_inset LatexCommand \index{DS89C4x0}
+\begin_inset LatexCommand index
+name "DS89C4x0"
\end_inset
\begin_layout Standard
\size footnotesize
-\begin_inset LatexCommand \url{http://pdfserv.maxim-ic.com/en/an/AN3477.pdf}
+\begin_inset LatexCommand url
+target "http://pdfserv.maxim-ic.com/en/an/AN3477.pdf"
\end_inset
\size footnotesize
Integrating SDCC 8051 Tools Into The Silicon Labs IDE
-\begin_inset LatexCommand \index{IDE}
+\begin_inset LatexCommand index
+name "IDE"
\end_inset
\begin_layout Standard
\size footnotesize
-\begin_inset LatexCommand \url{http://www.silabs.com/public/documents/tpub_doc/anote/Microcontrollers/en/an198.pdf}
+\begin_inset LatexCommand url
+target "http://www.silabs.com/public/documents/tpub_doc/anote/Microcontrollers/en/an198.pdf"
\end_inset
\begin_layout Standard
\size footnotesize
-\begin_inset LatexCommand \url{http://www.ramtron.com/doc/Products/Microcontroller/Support_Tools.asp}
+\begin_inset LatexCommand url
+target "http://www.ramtron.com/doc/Products/Microcontroller/Support_Tools.asp"
\end_inset
\begin_layout Standard
\size footnotesize
-\begin_inset LatexCommand \url{http://www.ramtron.com/doc/Products/Microcontroller/Support_Tools.asp}
+\begin_inset LatexCommand url
+target "http://www.ramtron.com/doc/Products/Microcontroller/Support_Tools.asp"
\end_inset
\begin_layout Standard
\size footnotesize
-\begin_inset LatexCommand \url{http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=sbaa109&fileType=pdf}
+\begin_inset LatexCommand url
+target "http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=sbaa109&fileType=pdf"
\end_inset
\begin_layout Chapter
Support
-\begin_inset LatexCommand \index{Support}
+\begin_inset LatexCommand index
+name "Support"
\end_inset
\begin_layout Standard
The SDCC project is hosted on the SDCC sourceforge site at
-\begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/sdcc}
+\begin_inset LatexCommand htmlurl
+target "http://sourceforge.net/projects/sdcc"
\end_inset
.
You'll find the complete set of mailing lists
-\begin_inset LatexCommand \index{Mailing list(s)}
+\begin_inset LatexCommand index
+name "Mailing list(s)"
\end_inset
, forums, bug reporting system, patch submission
-\begin_inset LatexCommand \index{Patch submission}
+\begin_inset LatexCommand index
+name "Patch submission"
\end_inset
system, download
-\begin_inset LatexCommand \index{download}
+\begin_inset LatexCommand index
+name "download"
\end_inset
area and Subversion code repository
-\begin_inset LatexCommand \index{Subversion code repository}
+\begin_inset LatexCommand index
+name "Subversion code repository"
\end_inset
\begin_layout Section
Reporting Bugs
-\begin_inset LatexCommand \index{Bug reporting}
+\begin_inset LatexCommand index
+name "Bug reporting"
\end_inset
-\begin_inset LatexCommand \index{Reporting bugs}
+\begin_inset LatexCommand index
+name "Reporting bugs"
\end_inset
\end_inset
-dumpall
-\begin_inset LatexCommand \index{-\/-dumpall}
+\begin_inset LatexCommand index
+name "-\\/-dumpall"
\end_inset
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}
+\begin_inset LatexCommand htmlurl
+target "http://sourceforge.net/tracker/?group_id=599&atid=100599"
\end_inset
.
With SDCC on average having more than 200 downloads
-\begin_inset LatexCommand \index{download}
+\begin_inset LatexCommand index
+name "download"
\end_inset
\begin_layout Section
Requesting Features
-\begin_inset LatexCommand \label{sub:Requesting-Features}
+\begin_inset LatexCommand label
+name "sub:Requesting-Features"
\end_inset
-\begin_inset LatexCommand \index{Feature request}
+\begin_inset LatexCommand index
+name "Feature request"
\end_inset
-\begin_inset LatexCommand \index{Requesting features}
+\begin_inset LatexCommand index
+name "Requesting features"
\end_inset
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}
+\begin_inset LatexCommand htmlurl
+target "http://sourceforge.net/tracker/?group_id=599&atid=350599"
\end_inset
Like bug reports contributed patches are forwarded to the developer mailing
list.
This is the link for submitting patches
-\begin_inset LatexCommand \index{Patch submission}
+\begin_inset LatexCommand index
+name "Patch submission"
\end_inset
:
-\begin_inset LatexCommand \url{http://sourceforge.net/tracker/?group_id=599&atid=300599}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/tracker/?group_id=599&atid=300599"
\end_inset
\end_inset
-\series default
-
\family default
-will do.
+\series default
+ will do.
\end_layout
\begin_layout Section
\begin_layout Standard
These links should take you directly to the
-\begin_inset LatexCommand \url[Mailing lists]{http://sourceforge.net/mail/?group_id=599}
+\begin_inset LatexCommand url
+name "Mailing lists"
+target "http://sourceforge.net/mail/?group_id=599"
\end_inset
\end_inset
and the
-\begin_inset LatexCommand \url[Forums]{http://sourceforge.net/forum/?group_id=599}
+\begin_inset LatexCommand url
+name "Forums"
+target "http://sourceforge.net/forum/?group_id=599"
\end_inset
, lists
-\begin_inset LatexCommand \index{Mailing list(s)}
+\begin_inset LatexCommand index
+name "Mailing list(s)"
\end_inset
\begin_layout Standard
You can follow the status of the Subversion version
-\begin_inset LatexCommand \index{version}
+\begin_inset LatexCommand index
+name "version"
\end_inset
of SDCC by watching the Changelog
-\begin_inset LatexCommand \index{Changelog}
+\begin_inset LatexCommand index
+name "Changelog"
\end_inset
in the Subversion repository
\size footnotesize
-\begin_inset LatexCommand \htmlurl{http://sdcc.svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog}
+\begin_inset LatexCommand htmlurl
+target "http://sdcc.svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog"
\end_inset
\series default
or the filenames of the snapshot versions of SDCC include date and its
Subversion
-\begin_inset LatexCommand \index{Subversion code repository}
+\begin_inset LatexCommand index
+name "Subversion code repository"
\end_inset
number.
Subversion allows to download the source of recent or previous versions
-\begin_inset LatexCommand \url{http://sourceforge.net/svn/?group_id=599}
+\begin_inset LatexCommand url
+target "http://sourceforge.net/svn/?group_id=599"
\end_inset
there.
SDCC versions starting from 1999 up to now are available (currently the
versions prior to the conversion from cvs
-\begin_inset LatexCommand \index{cvs|see{Subversion}}
+\begin_inset LatexCommand index
+name "cvs|see{Subversion}"
\end_inset
\begin_layout Section
Release policy
-\begin_inset LatexCommand \index{Release policy}
+\begin_inset LatexCommand index
+name "Release policy"
\end_inset
excuse has to be found.
Kidding aside, we have to get better there! On the other hand there are
daily snapshots available at
-\begin_inset LatexCommand \htmlurl[snap]{http://sdcc.sourceforge.net/snap.php}
+\begin_inset LatexCommand htmlurl
+name "snap"
+target "http://sdcc.sourceforge.net/snap.php"
\end_inset
, and you can always build the very last version (hopefully with many bugs
fixed, and features added) from the source code available at
-\begin_inset LatexCommand \htmlurl[Source]{http://sdcc.sourceforge.net/snap.php#Source}
+\begin_inset LatexCommand htmlurl
+name "Source"
+target "http://sdcc.sourceforge.net/snap.php#Source"
\end_inset
.
The SDCC Wiki
-\begin_inset LatexCommand \index{wiki}
+\begin_inset LatexCommand index
+name "wiki"
\end_inset
-\begin_inset LatexCommand \index{SDCC Wiki}
+\begin_inset LatexCommand index
+name "SDCC Wiki"
\end_inset
at
-\begin_inset LatexCommand \url{http://sdcc.wiki.sourceforge.net/}
+\begin_inset LatexCommand url
+target "http://sdcc.wiki.sourceforge.net/"
\end_inset
\begin_layout Section
Examples
-\begin_inset LatexCommand \index{Examples}
+\begin_inset LatexCommand index
+name "Examples"
\end_inset
You'll find some small examples in the directory
\emph on
sdcc/device/examples/.
-
+
\emph default
-More examples and libraries are available at
+ More examples and libraries are available at
\emph on
- The SDCC Open Knowledge Resource
-\begin_inset LatexCommand \url{http://sdccokr.dl9sec.de/}
+The SDCC Open Knowledge Resource
+\begin_inset LatexCommand url
+target "http://sdccokr.dl9sec.de/"
\end_inset
-
+
\emph default
-web site or at
-\begin_inset LatexCommand \url{http://www.pjrc.com/tech/8051/}
+ web site or at
+\begin_inset LatexCommand url
+target "http://www.pjrc.com/tech/8051/"
\end_inset
\begin_layout Section
Quality control
-\begin_inset LatexCommand \label{sec:Quality-control}
+\begin_inset LatexCommand label
+name "sec:Quality-control"
\end_inset
-\begin_inset LatexCommand \index{Quality control}
+\begin_inset LatexCommand index
+name "Quality control"
\end_inset
regression tests
\shape default
-\begin_inset LatexCommand \index{Regression test}
+\begin_inset LatexCommand index
+name "Regression test"
\end_inset
more than 500 test cases which include more than 4500 tests.
The results of these tests are published daily on SDCC's snapshot page
(click on the red or green symbols on the right side of
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/snap.php}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/snap.php"
\end_inset
There is a separate document
\shape italic
test_suite.pdf
-\begin_inset LatexCommand \index{Test suite}
+\begin_inset LatexCommand index
+name "Test suite"
\end_inset
\shape default
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/test_suite_spec.pdf}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/test_suite_spec.pdf"
\end_inset
\series 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}
+\begin_inset LatexCommand index
+name "Examples"
\end_inset
checking corner cases of SDCC or if you plan to submit patches
-\begin_inset LatexCommand \index{Patch submission}
+\begin_inset LatexCommand index
+name "Patch submission"
\end_inset
\begin_layout Standard
The PIC14 port uses a different set of regression tests
-\begin_inset LatexCommand \index{Regression test (PIC14)}
+\begin_inset LatexCommand index
+name "Regression test (PIC14)"
\end_inset
have a curriculum that can be extended for years.
Then you could use an fpga board as target and your curriculum will seamlessly
extend from logic synthesis (
-\begin_inset LatexCommand \url[http://www.opencores.org]{opencores.org}
+\begin_inset LatexCommand url
+name "http://www.opencores.org"
+target "opencores.org"
\end_inset
,
-\begin_inset LatexCommand \url[Oregano]{http://www.oregano.at/ip/ip01.htm}
+\begin_inset LatexCommand url
+name "Oregano"
+target "http://www.oregano.at/ip/ip01.htm"
\end_inset
), over assembly programming, to C to FPGA compilers (
-\begin_inset LatexCommand \url[FPGAC]{http://sf.net/projects/fpgac}
+\begin_inset LatexCommand url
+name "FPGAC"
+target "http://sf.net/projects/fpgac"
\end_inset
be able to insert excursions about skills like using a revision control
system, submitting/applying patches, using a type-setting (as opposed to
word-processing) engine LyX/LaTeX, using
-\begin_inset LatexCommand \url[SourceForge]{http://www.sf.net}
+\begin_inset LatexCommand url
+name "SourceForge"
+target "http://www.sf.net"
\end_inset
, following some
-\begin_inset LatexCommand \url[netiquette]{http://en.wikipedia.org/wiki/Netiquette}
+\begin_inset LatexCommand url
+name "netiquette"
+target "http://en.wikipedia.org/wiki/Netiquette"
\end_inset
, understanding BSD/LGPL/GPL/Proprietary licensing, growth models of Open
Source Software, CPU simulation, compiler regression tests
-\begin_inset LatexCommand \index{Regression test}
+\begin_inset LatexCommand index
+name "Regression test"
\end_inset
\newline
And if there should be a shortage of ideas then you can always point students
to the ever-growing feature request list
-\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=350599}
+\begin_inset LatexCommand htmlurl
+target "http://sourceforge.net/tracker/?group_id=599&atid=350599"
\end_inset
\emph default
choice (among them Alpha, i386, i386_64, Mac OS X, Mips, Sparc, Windows
and eventually
-\begin_inset LatexCommand \url[OLPC]{http://www.laptop.org}
+\begin_inset LatexCommand url
+name "OLPC"
+target "http://www.laptop.org"
\end_inset
\end_layout
\begin_layout Enumerate
-give back to the public as you are probably at least partially publically
+give back to the public as you are probably at least partially publicly
funded
\end_layout
\begin_layout Enumerate
-give students a chance to publically prove their skills and to possibly
- see a world wide impact
+give students a chance to publicly prove their skills and to possibly see
+ a world wide impact
\end_layout
\begin_layout Standard
\begin_layout Section
Optimizations
-\begin_inset LatexCommand \index{Optimizations}
+\begin_inset LatexCommand index
+name "Optimizations"
\end_inset
\begin_layout Subsection
Sub-expression Elimination
-\begin_inset LatexCommand \index{Subexpression elimination}
+\begin_inset LatexCommand index
+name "Subexpression elimination"
\end_inset
\begin_layout Subsection
Dead-Code Elimination
-\begin_inset LatexCommand \index{Dead-code elimination}
+\begin_inset LatexCommand index
+name "Dead-code elimination"
\end_inset
\begin_layout Subsection
Copy-Propagation
-\begin_inset LatexCommand \index{Copy propagation}
+\begin_inset LatexCommand index
+name "Copy propagation"
\end_inset
\begin_layout Subsection
Loop Optimizations
-\begin_inset LatexCommand \index{Loop optimization}
+\begin_inset LatexCommand index
+name "Loop optimization"
\end_inset
-\begin_inset LatexCommand \label{sub:Loop-Optimizations}
+\begin_inset LatexCommand label
+name "sub:Loop-Optimizations"
\end_inset
\emph on
loop invariant
\emph default
- lifting and
+ lifting and
\emph on
- strength reduction
+strength reduction
\emph default
of loop induction variables.
In addition to the strength reduction the optimizer marks the induction
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 allocation}
+\begin_inset LatexCommand index
+name "Register allocation"
\end_inset
, loop induction optimization causes an increase in register pressure, which
may cause unwanted spilling of other temporary variables into the stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand index
+name "stack"
\end_inset
-noinduction option) or for a given function only using #pragma\InsetSpace ~
noinduction
-\begin_inset LatexCommand \index{\#pragma noinduction}
+\begin_inset LatexCommand index
+name "\\#pragma noinduction"
\end_inset
\newline
Strength Reduction
-\begin_inset LatexCommand \index{Strength reduction}
+\begin_inset LatexCommand index
+name "Strength reduction"
\end_inset
\begin_layout Standard
The more expensive multiplication
-\begin_inset LatexCommand \index{Multiplication}
+\begin_inset LatexCommand index
+name "Multiplication"
\end_inset
\begin_layout Subsection
Loop Reversing
-\begin_inset LatexCommand \index{Loop reversing}
+\begin_inset LatexCommand index
+name "Loop reversing"
\end_inset
\begin_layout Standard
Note the subexpressions
-\begin_inset LatexCommand \index{Subexpression}
+\begin_inset LatexCommand index
+name "Subexpression"
\end_inset
\begin_layout Subsection
'switch' Statements
-\begin_inset LatexCommand \label{sub:'switch'-Statements}
+\begin_inset LatexCommand label
+name "sub:'switch'-Statements"
\end_inset
-\begin_inset LatexCommand \index{switch statement}
+\begin_inset LatexCommand index
+name "switch statement"
\end_inset
\begin_layout Standard
SDCC can optimize switch statements to jump tables
-\begin_inset LatexCommand \index{jump tables}
+\begin_inset LatexCommand index
+name "jump tables"
\end_inset
\begin_layout Standard
The pragma nojtbound
-\begin_inset LatexCommand \index{\#pragma nojtbound}
+\begin_inset LatexCommand index
+name "\\#pragma nojtbound"
\end_inset
aries.
It has no effect if a default label is supplied.
Use of this pragma is dangerous: if the switch
-\begin_inset LatexCommand \index{switch statement}
+\begin_inset LatexCommand index
+name "switch statement"
\end_inset
\begin_layout Subsection
Bit-shifting Operations
-\begin_inset LatexCommand \index{Bit shifting}
+\begin_inset LatexCommand index
+name "Bit shifting"
\end_inset
\begin_layout Subsection
Bit-rotation
-\begin_inset LatexCommand \index{Bit rotation}
+\begin_inset LatexCommand index
+name "Bit rotation"
\end_inset
\begin_layout Standard
A special case of the bit-shift operation is bit rotation
-\begin_inset LatexCommand \index{rotating bits}
+\begin_inset LatexCommand index
+name "rotating bits"
\end_inset
...
\newline
-i = ((i << 1) | (i >> 7));
+i = ((i << 1) | (i >> 7));
\family default
-
+
\newline
\family typewriter
\begin_layout Standard
Other special cases of the bit-shift operations are nibble or byte swapping
-\begin_inset LatexCommand \index{swapping nibbles/bytes}
+\begin_inset LatexCommand index
+name "swapping nibbles/bytes"
\end_inset
...
\newline
-i = ((i << 4) | (i >> 4));
+i = ((i << 4) | (i >> 4));
\family default
-
+
\newline
\family typewriter
\begin_layout Standard
and generates a swap instruction for the nibble swapping
-\begin_inset LatexCommand \index{Nibble swapping}
+\begin_inset LatexCommand index
+name "Nibble swapping"
\end_inset
or move instructions for the byte swapping
-\begin_inset LatexCommand \index{Byte swapping}
+\begin_inset LatexCommand index
+name "Byte swapping"
\end_inset
dptr
\emph default
-\begin_inset LatexCommand \index{DPTR}
+\begin_inset LatexCommand index
+name "DPTR"
\end_inset
--datapointer
-\emph on
-
-\emph default
-so little-endian is the more efficient byte order.
+-datapointer so little-endian is the more efficient byte order.
\end_layout
\end_inset
-\begin_inset LatexCommand \index{little-endian}
+\begin_inset LatexCommand index
+name "little-endian"
\end_inset
-\begin_inset LatexCommand \index{Endianness}
+\begin_inset LatexCommand index
+name "Endianness"
\end_inset
\begin_layout Subsection
Highest Order Bit
-\begin_inset LatexCommand \index{Highest Order Bit}
+\begin_inset LatexCommand index
+name "Highest Order Bit"
\end_inset
/ Any Order Bit
-\begin_inset LatexCommand \index{Any Order Bit}
+\begin_inset LatexCommand index
+name "Any Order Bit"
\end_inset
\begin_layout Subsection
Higher Order Byte
-\begin_inset LatexCommand \index{Higher Order Byte}
+\begin_inset LatexCommand index
+name "Higher Order Byte"
\end_inset
/ Higher Order Word
-\begin_inset LatexCommand \index{Higher Order Word}
+\begin_inset LatexCommand index
+name "Higher Order Word"
\end_inset
\begin_layout Subsection
Peephole Optimizer
-\begin_inset LatexCommand \label{sub:Peephole-Optimizer}
+\begin_inset LatexCommand label
+name "sub:Peephole-Optimizer"
\end_inset
-\begin_inset LatexCommand \index{Peephole optimizer}
+\begin_inset LatexCommand index
+name "Peephole optimizer"
\end_inset
\end_inset
-peep-file
-\begin_inset LatexCommand \index{-\/-peep-file}
+\begin_inset LatexCommand index
+name "-\\/-peep-file"
\end_inset
\begin_layout Standard
The above rule will change the following assembly
-\begin_inset LatexCommand \index{Assembler routines}
+\begin_inset LatexCommand index
+name "Assembler routines"
\end_inset
).
E.g.
some variants of the 8051 MCU
-\begin_inset LatexCommand \index{MCS51 variants}
+\begin_inset LatexCommand index
+name "MCS51 variants"
\end_inset
\emph default
-acall-ajmp
-\begin_inset LatexCommand \index{-\/-acall-ajmp}
+\begin_inset LatexCommand index
+name "-\\/-acall-ajmp"
\end_inset
Currently implemented are
\emph on
labelInRange, labelRefCount, labelIsReturnOnly, operandsNotSame, xramMovcOption,
- 24bitMode, portIsDS390, 24bitModeAndPortDS390
+ 24bitMode, portIsDS390, 24bitModeAndPortDS390
\emph default
-and
+ and
\emph on
- notVolatile
+notVolatile
\emph default
.
\end_layout
\begin_layout Section
ANSI-Compliance
-\begin_inset LatexCommand \index{ANSI-compliance}
+\begin_inset LatexCommand index
+name "ANSI-compliance"
\end_inset
-\begin_inset LatexCommand \label{sub:ANSI-Compliance}
+\begin_inset LatexCommand label
+name "sub:ANSI-Compliance"
\end_inset
\end_layout
\begin_layout Standard
-The latest publically available version of the standard
+The latest publicly available version of the standard
\emph on
ISO/IEC 9899 - Programming languages - C
\emph default
should be available at:
-\begin_inset LatexCommand \url{http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899}
+\begin_inset LatexCommand url
+target "http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899"
\end_inset
\begin_layout Itemize
functions are not reentrant
-\begin_inset LatexCommand \index{reentrant}
+\begin_inset LatexCommand index
+name "reentrant"
\end_inset
\end_inset
-stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
\end_inset
\begin_layout Itemize
structures
-\begin_inset LatexCommand \index{struct}
+\begin_inset LatexCommand index
+name "struct"
\end_inset
and unions
-\begin_inset LatexCommand \index{union}
+\begin_inset LatexCommand index
+name "union"
\end_inset
cannot be assigned values directly, cannot be passed as function parameters
or assigned to each other and cannot be a return value
-\begin_inset LatexCommand \index{return value}
+\begin_inset LatexCommand index
+name "return value"
\end_inset
\series bold
struct
+\family default
\series default
- s foo1 (
+
+\family typewriter
+s foo1 (
\series bold
struct
+\family default
\series default
- s parms) /* invalid in SDCC although allowed in ANSI */
+
+\family typewriter
+s parms) /* invalid in SDCC although allowed in ANSI */
\newline
{
\newline
\end_deeper
\begin_layout Itemize
'long long
-\begin_inset LatexCommand \index{long long (not supported)}
+\begin_inset LatexCommand index
+name "long long (not supported)"
\end_inset
' (64 bit integers
-\begin_inset LatexCommand \index{int (64 bit) (not supported)}
+\begin_inset LatexCommand index
+name "int (64 bit) (not supported)"
\end_inset
\begin_layout Itemize
'double
-\begin_inset LatexCommand \index{double (not supported)}
+\begin_inset LatexCommand index
+name "double (not supported)"
\end_inset
' precision floating point
-\begin_inset LatexCommand \index{Floating point support}
+\begin_inset LatexCommand index
+name "Floating point support"
\end_inset
\begin_layout Itemize
Old K&R style
-\begin_inset LatexCommand \index{K\&R style}
+\begin_inset LatexCommand index
+name "K\\&R style"
\end_inset
for (
\series bold
int
+\family default
\series default
- i=0; i<10; i++) /* is invalid in SDCC although allowed in C99 */
+
+\family typewriter
+i=0; i<10; i++) /* is invalid in SDCC although allowed in C99 */
\end_layout
\end_deeper
\family typewriter
\series bold
inline
-\begin_inset LatexCommand \index{inline (not supported)}
+\begin_inset LatexCommand index
+name "inline (not supported)"
\end_inset
+\family default
\series default
- int increment (int a) { return a+1; } /* inlines the increment without
- function call overhead */
+
+\family typewriter
+int increment (int a) { return a+1; } /* inlines the increment without function
+ call overhead */
\newline
-int *
+int *
+\family default
+
+\family typewriter
\series bold
restrict
-\begin_inset LatexCommand \index{inline (not supported)}
+\begin_inset LatexCommand index
+name "inline (not supported)"
\end_inset
+\family default
\series default
- p; /* accepted but ignored */
+
+\family typewriter
+p; /* accepted but ignored */
\end_layout
\end_deeper
\end_inset
-std-c89
-\begin_inset LatexCommand \index{-\/-std-c89}
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
\end_inset
-
+
\series default
-or
+ or
\series bold
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-std-c99
-\begin_inset LatexCommand \index{-\/-std-c99}
+\begin_inset LatexCommand index
+name "-\\/-std-c99"
\end_inset
'_naked'.
Compliant equivalents of these keywords are always available in a form
that begin with two underscores
-\begin_inset LatexCommand \index{\_\_ (prefix for extended keywords)}
+\begin_inset LatexCommand index
+name "\\_\\_ (prefix for extended keywords)"
\end_inset
\begin_layout Itemize
Integer promotion of variable arguments is not performed if the argument
- is explicitly taypecasted unless the
+ is explicitly taypecasted unless the
\series bold
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-std-c89
-\begin_inset LatexCommand \index{-\/-std-c89}
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
\end_inset
-
+
\series default
-or
+ or
\series bold
- -
+-
\begin_inset ERT
status collapsed
\end_inset
-std-c99
-\begin_inset LatexCommand \index{-\/-std-c99}
+\begin_inset LatexCommand index
+name "-\\/-std-c99"
\end_inset
\end_deeper
\begin_layout Section
Cyclomatic Complexity
-\begin_inset LatexCommand \index{Cyclomatic complexity}
+\begin_inset LatexCommand index
+name "Cyclomatic complexity"
\end_inset
variables defined by the compiler that still survive after all the optimization
s.
Live range analysis
-\begin_inset LatexCommand \index{Live range analysis}
+\begin_inset LatexCommand index
+name "Live range analysis"
\end_inset
\begin_layout Standard
More information is available on SDCC Wiki
-\begin_inset LatexCommand \index{wiki}
+\begin_inset LatexCommand index
+name "wiki"
\end_inset
(preliminary link
-\begin_inset LatexCommand \url{http://sdcc.wiki.sourceforge.net/SDCC+internals+and+porting}
+\begin_inset LatexCommand url
+target "http://sdcc.wiki.sourceforge.net/SDCC+internals+and+porting"
\end_inset
) and in the thread
-\begin_inset LatexCommand \url{http://sf.net/mailarchive/message.php?msg_id=13954144}
+\begin_inset LatexCommand url
+target "http://sf.net/mailarchive/message.php?msg_id=13954144"
\end_inset
\begin_layout Chapter
Compiler internals
-\begin_inset LatexCommand \index{Compiler internals}
+\begin_inset LatexCommand index
+name "Compiler internals"
\end_inset
\begin_layout Section
The anatomy of the compiler
-\begin_inset LatexCommand \label{sub:The-anatomy-of}
+\begin_inset LatexCommand label
+name "sub:The-anatomy-of"
\end_inset
\shape italic
This is an excerpt from an article published in Circuit Cellar Magazine
- in
+ in
+\shape default
+
\series bold
+\shape italic
August 2000
\series default
.
\begin_layout Paragraph*
Parsing
-\begin_inset LatexCommand \index{Parsing}
+\begin_inset LatexCommand index
+name "Parsing"
\end_inset
\begin_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
+name "Annotated syntax tree"
\end_inset
\begin_layout Paragraph*
Generating iCode
-\begin_inset LatexCommand \index{iCode}
+\begin_inset LatexCommand index
+name "iCode"
\end_inset
\begin_layout Paragraph*
Optimizations
-\begin_inset LatexCommand \index{Optimizations}
+\begin_inset LatexCommand index
+name "Optimizations"
\end_inset
\begin_layout Paragraph*
Live range analysis
-\begin_inset LatexCommand \index{Live range analysis}
+\begin_inset LatexCommand index
+name "Live range analysis"
\end_inset
\begin_layout Paragraph*
Register Allocation
-\begin_inset LatexCommand \index{Register allocation}
+\begin_inset LatexCommand index
+name "Register allocation"
\end_inset
\begin_layout Standard
Figure II gives a table of iCode
-\begin_inset LatexCommand \index{iCode}
+\begin_inset LatexCommand index
+name "iCode"
\end_inset
iCode
\series default
-\begin_inset LatexCommand \index{iCode}
+\begin_inset LatexCommand index
+name "iCode"
\end_inset
\shape slanted
\size footnotesize
see f.e.
+
+\shape default
\family typewriter
+\shape slanted
gen51Code()
\family default
- in
+\shape default
+
+\shape slanted
+in
+\shape default
+
\family typewriter
+\shape slanted
src/mcs51/gen.c
\end_layout
\begin_layout Paragraph*
ICode Example
-\begin_inset LatexCommand \index{iCode}
+\begin_inset LatexCommand index
+name "iCode"
\end_inset
Note that local variables and parameters are replaced by compiler generated
temporaries.
Live ranges
-\begin_inset LatexCommand \index{Live range analysis}
+\begin_inset LatexCommand index
+name "Live range analysis"
\end_inset
are computed only for temporaries (i.e.
live ranges are not computed for global variables).
Registers
-\begin_inset LatexCommand \index{Register allocation}
+\begin_inset LatexCommand index
+name "Register allocation"
\end_inset
\newline
There are several
loop optimizations
-\begin_inset LatexCommand \index{Loop optimization}
+\begin_inset LatexCommand index
+name "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
-\begin_inset LatexCommand \index{Strength reduction}
+\begin_inset LatexCommand index
+name "Strength reduction"
\end_inset
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
-\begin_inset LatexCommand \index{Multiplication}
+\begin_inset LatexCommand index
+name "Multiplication"
\end_inset
\newline
Note the dead code elimination
-\begin_inset LatexCommand \index{Dead-code elimination}
+\begin_inset LatexCommand index
+name "Dead-code elimination"
\end_inset
\begin_layout Standard
Successors are basic blocks
-\begin_inset LatexCommand \index{Basic blocks}
+\begin_inset LatexCommand index
+name "Basic blocks"
\end_inset
\end_layout
\begin_layout Standard
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/#Who}
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/#Who"
\end_inset
\emph on
Thanks to Sourceforge
-\begin_inset LatexCommand \url{http://www.sf.net}
+\begin_inset LatexCommand url
+target "http://www.sf.net"
\end_inset
\begin_layout Standard
All product names mentioned herein may be trademarks
-\begin_inset LatexCommand \index{Trademarks}
+\begin_inset LatexCommand index
+name "Trademarks"
\end_inset
\end_layout
\begin_layout Standard
-\begin_inset LatexCommand \printindex{}
+\begin_inset LatexCommand printindex
\end_inset