git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3005
4a8a32a2-be11-0410-ad9d-
d568d2c75423
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\begin_preamble
\usepackage[
pdftitle={SDCC Compiler User Guide},
pdfauthor={SDCC development team},
pdfsubject={installation, user manual},
pdfkeywords={8032, 8051, ansi, c, compiler, CPU, DS390,
\begin_preamble
\usepackage[
pdftitle={SDCC Compiler User Guide},
pdfauthor={SDCC development team},
pdfsubject={installation, user manual},
pdfkeywords={8032, 8051, ansi, c, compiler, CPU, DS390,
- embedded, GPL, manual, mcs51, PIC, small, Z80},
+ embedded, GPL, HC08, manual, mcs51, PIC, Z80},
colorlinks=true,
linkcolor=blue] {hyperref}
\date{}
colorlinks=true,
linkcolor=blue] {hyperref}
\date{}
\layout Title
SDCC Compiler User Guide
\layout Title
SDCC Compiler User Guide
-\layout Comment
-
-The strings enclosed in $ are automatically updated by cvs:
-\layout Standard
-\align center
-\size footnotesize
-$Date$
-\layout Standard
-\align center
+\layout Comment
+
+The above strings enclosed in $ are automatically updated by cvs
-\layout Section
-\pagebreak_top
About SDCC
\layout Standard
About SDCC
\layout Standard
designed for 8 bit Microprocessors.
The current version targets Intel MCS51 based Microprocessors (8031, 8032,
8051, 8052
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 CPU}
+\begin_inset LatexCommand \index{8031, 8032, 8051, 8052, mcs51 CPU}
-, etc), Dallas DS80C390 variants, Motorola HC08 and Zilog Z80 based MCUs
- .
+, etc.), Dallas DS80C390 variants, Motorola HC08 and Zilog Z80 based MCUs.
It can be retargetted for other microprocessors, support for Microchip
PIC, Atmel AVR is under development.
The entire source code for the compiler is distributed under GPL.
It can be retargetted for other microprocessors, support for Microchip
PIC, Atmel AVR is under development.
The entire source code for the compiler is distributed under GPL.
Open Source
\layout Standard
Open Source
\layout Standard
You are forbidden to forbid anyone else to use, share and improve what
you give them.
Help stamp out software-hoarding!
You are forbidden to forbid anyone else to use, share and improve what
you give them.
Help stamp out software-hoarding!
Typographic conventions
\begin_inset LatexCommand \index{Typographic conventions}
Typographic conventions
\begin_inset LatexCommand \index{Typographic conventions}
Interesting items and new terms are printed in
\emph on
italic.
Interesting items and new terms are printed in
\emph on
italic.
Compatibility with previous versions
\layout Standard
Compatibility with previous versions
\layout Standard
\emph on
<pending: more incompatibilities?>
\emph on
<pending: more incompatibilities?>
System Requirements
\layout Standard
System Requirements
\layout Standard
For Windows some pre-compiled binary distributions are available for your
convenience.
You should have some experience with command line tools and compiler use.
For Windows some pre-compiled binary distributions are available for your
convenience.
You should have some experience with command line tools and compiler use.
Other Resources
\layout Standard
Other Resources
\layout Standard
their own documentation and can be found in the source distribution.
If you want the latest unreleased software, the complete source package
is available directly by anonymous CVS on cvs.sdcc.sourceforge.net.
their own documentation and can be found in the source distribution.
If you want the latest unreleased software, the complete source package
is available directly by anonymous CVS on cvs.sdcc.sourceforge.net.
Wishes for the future
\layout Standard
Wishes for the future
\layout Standard
-\layout Section
-\pagebreak_top
Installing SDCC
\begin_inset LatexCommand \index{Installation}
Installing SDCC
\begin_inset LatexCommand \index{Installation}
.
More detailled instructions follow below.
.
More detailled instructions follow below.
Configure Options
\begin_inset LatexCommand \index{Options SDCC configuration}
Configure Options
\begin_inset LatexCommand \index{Options SDCC configuration}
-C' turns on caching, which gives a little bit extra speed.
However if options are changed, it can be necessary to delete the config.cache
file.
-C' turns on caching, which gives a little bit extra speed.
However if options are changed, it can be necessary to delete the config.cache
file.
Install paths
\begin_inset LatexCommand \label{sub:Install-paths}
Install paths
\begin_inset LatexCommand \label{sub:Install-paths}
\layout Standard
Of course this doesn't change the search paths compiled into the binaries.
\layout Standard
Of course this doesn't change the search paths compiled into the binaries.
Search Paths
\begin_inset LatexCommand \label{sub:Search-Paths}
Search Paths
\begin_inset LatexCommand \label{sub:Search-Paths}
\end_inset
-nostdlib disables the last two search paths.
\end_inset
-nostdlib disables the last two search paths.
Building SDCC
\begin_inset LatexCommand \index{Building SDCC}
Building SDCC
\begin_inset LatexCommand \index{Building SDCC}
Building SDCC on Linux
\begin_inset LatexCommand \label{sub:Building-SDCC-on-Linux}
Building SDCC on Linux
\begin_inset LatexCommand \label{sub:Building-SDCC-on-Linux}
\series default
This copies the binary executables, the include files, the libraries and
the documentation to the install directories.
\series default
This copies the binary executables, the include files, the libraries and
the documentation to the install directories.
Building SDCC on OSX 2.x
\layout Standard
Building SDCC on OSX 2.x
\layout Standard
\layout LyX-Code
./configure CC=gcc2 CXX=g++2
\layout LyX-Code
./configure CC=gcc2 CXX=g++2
Cross compiling SDCC on Linux for Windows
\layout Standard
With the Mingw32 gcc cross compiler it's easy to compile SDCC for Win32.
See section 'Configure Options'.
Cross compiling SDCC on Linux for Windows
\layout Standard
With the Mingw32 gcc cross compiler it's easy to compile SDCC for Win32.
See section 'Configure Options'.
Building SDCC on Windows
\layout Standard
Building SDCC on Windows
\layout Standard
With the exception of Cygwin the SDCC binaries uCsim and sdcdb can't be
built on Windows.
They use Unix-sockets, which are not available on Win32.
With the exception of Cygwin the SDCC binaries uCsim and sdcdb can't be
built on Windows.
They use Unix-sockets, which are not available on Win32.
Building SDCC using Cygwin and Mingw32
\layout Standard
Building SDCC using Cygwin and Mingw32
\layout Standard
And use an editor which can handle LF-only line endings.
Make sure not to commit files with windows line endings.
The tabulator spacing used in the project is 8.
And use an editor which can handle LF-only line endings.
Make sure not to commit files with windows line endings.
The tabulator spacing used in the project is 8.
Building SDCC Using Microsoft Visual C++ 6.0/NET (MSVC)
\layout Standard
Building SDCC Using Microsoft Visual C++ 6.0/NET (MSVC)
\layout Standard
bin_vc to sdcc
\backslash
bin, and you can compile using SDCC.
bin_vc to sdcc
\backslash
bin, and you can compile using SDCC.
Building SDCC Using Borland
\layout Enumerate
Building SDCC Using Borland
\layout Enumerate
\family default
\series default
from the sdcc directory.
\family default
\series default
from the sdcc directory.
Windows Install Using a Binary Package
\begin_inset LatexCommand \label{sub:Windows-Install}
Windows Install Using a Binary Package
\begin_inset LatexCommand \label{sub:Windows-Install}
Adjust your environment variable PATH to include the location of the bin
directory or start sdcc using the full path.
Adjust your environment variable PATH to include the location of the bin
directory or start sdcc using the full path.
Building the Documentation
\layout Standard
Building the Documentation
\layout Standard
there.
If you want to avoid installing the tools you will have some success with
a bootable Knoppix CD
there.
If you want to avoid installing the tools you will have some success with
a bootable Knoppix CD
-\begin_inset LatexCommand \url{http://www.knopper.net}
+\begin_inset LatexCommand \url{http://www.knoppix.net}
Reading the Documentation
\layout Standard
Reading the Documentation
\layout Standard
There are still lots of typos and there are more different writing styles
than pictures.
There are still lots of typos and there are more different writing styles
than pictures.
Testing the SDCC Compiler
\layout Standard
Testing the SDCC Compiler
\layout Standard
\end_inset
to find exactly where SDCC is looking for the include and lib files.
\end_inset
to find exactly where SDCC is looking for the include and lib files.
Install Trouble-shooting
\begin_inset LatexCommand \label{sub:Install-Trouble-shooting}
Install Trouble-shooting
\begin_inset LatexCommand \label{sub:Install-Trouble-shooting}
SDCC does not build correctly.
\layout Standard
SDCC does not build correctly.
\layout Standard
If anything goes wrong, you can review the log files to locate the problem.
Or a relevant part of this can be attached to an email that could be helpful
when requesting help from the mailing list.
If anything goes wrong, you can review the log files to locate the problem.
Or a relevant part of this can be attached to an email that could be helpful
when requesting help from the mailing list.
What the
\begin_inset Quotes sld
What the
\begin_inset Quotes sld
to ensure the source package compiles on your system.
It will take a few minutes to run, and will compile a few tests to determine
what compiler features are installed.
to ensure the source package compiles on your system.
It will take a few minutes to run, and will compile a few tests to determine
what compiler features are installed.
What the
\begin_inset Quotes sld
What the
\begin_inset Quotes sld
This runs the GNU make tool, which automatically compiles all the source
packages into the final installed binary executables.
This runs the GNU make tool, which automatically compiles all the source
packages into the final installed binary executables.
What the
\begin_inset Quotes sld
What the
\begin_inset Quotes sld
about install and search paths.
\newline
On most systems you will need super-user privileges to do this.
about install and search paths.
\newline
On most systems you will need super-user privileges to do this.
Components of SDCC
\layout Standard
Components of SDCC
\layout Standard
As development for other processors proceeds, this list will expand to include
executables to support processors like AVR, PIC, etc.
As development for other processors proceeds, this list will expand to include
executables to support processors like AVR, PIC, etc.
sdcc - The Compiler
\layout Standard
This is the actual compiler, it in turn uses the c-preprocessor and invokes
the assembler and linkage editor.
sdcc - The Compiler
\layout Standard
This is the actual compiler, it in turn uses the c-preprocessor and invokes
the assembler and linkage editor.
sdcpp
\begin_inset LatexCommand \index{sdcpp}
sdcpp
\begin_inset LatexCommand \index{sdcpp}
The preprocessor is a modified version of the GNU preprocessor.
The C preprocessor is used to pull in #include sources, process #ifdef
statements, #defines and so on.
The preprocessor is a modified version of the GNU preprocessor.
The C preprocessor is used to pull in #include sources, process #ifdef
statements, #defines and so on.
asx8051, as-z80, as-gbz80, aslink, link-z80, link-gbz80 - The Assemblers
and Linkage Editors
asx8051, as-z80, as-gbz80, aslink, link-z80, link-gbz80 - The Assemblers
and Linkage Editors
Baldwin.
John Hartman created the version for 8051, and I (Sandeep) have made some
enhancements and bug fixes for it to work properly with SDCC.
Baldwin.
John Hartman created the version for 8051, and I (Sandeep) have made some
enhancements and bug fixes for it to work properly with SDCC.
s51 - The Simulator
\begin_inset LatexCommand \index{s51}
s51 - The Simulator
\begin_inset LatexCommand \index{s51}
.
It currently supports the core mcs51, the Dallas DS80C390 and the Phillips
XA51 family.
.
It currently supports the core mcs51, the Dallas DS80C390 and the Phillips
XA51 family.
sdcdb
\begin_inset LatexCommand \index{sdcdb}
sdcdb
\begin_inset LatexCommand \index{sdcdb}
\end_inset
, but can be easily changed to use other simulators.
\end_inset
, but can be easily changed to use other simulators.
-\layout Section
-\pagebreak_top
Single Source File Projects
\layout Standard
Single Source File Projects
\layout Standard
\layout Itemize
sourcefile.asm
\layout Itemize
sourcefile.asm
-\begin_inset LatexCommand \index{.asm}
+\begin_inset LatexCommand \index{<file>.asm}
\layout Itemize
sourcefile.lst
\layout Itemize
sourcefile.lst
-\begin_inset LatexCommand \index{.lst}
+\begin_inset LatexCommand \index{<file>.lst}
\layout Itemize
sourcefile.rst
\layout Itemize
sourcefile.rst
-\begin_inset LatexCommand \index{.rst}
+\begin_inset LatexCommand \index{<file>.rst}
\layout Itemize
sourcefile.sym
\layout Itemize
sourcefile.sym
-\begin_inset LatexCommand \index{.sym}
+\begin_inset LatexCommand \index{<file>.sym}
\layout Itemize
sourcefile.rel
\layout Itemize
sourcefile.rel
-\begin_inset LatexCommand \index{.rel}
+\begin_inset LatexCommand \index{<file>.rel}
\layout Itemize
sourcefile.map
\layout Itemize
sourcefile.map
-\begin_inset LatexCommand \index{.map}
+\begin_inset LatexCommand \index{<file>.map}
\layout Itemize
sourcefile.mem
\layout Itemize
sourcefile.mem
-\begin_inset LatexCommand \index{.mem}
+\begin_inset LatexCommand \index{<file>.mem}
\layout Itemize
sourcefile.ihx
\layout Itemize
sourcefile.ihx
-\begin_inset LatexCommand \index{.ihx}
+\begin_inset LatexCommand \index{<file>.ihx}
\layout Itemize
sourcefile.cdb
\layout Itemize
sourcefile.cdb
-\begin_inset LatexCommand \index{.cdb}
+\begin_inset LatexCommand \index{<file>.cdb}
sourcefile.
- (no extension)
sourcefile.
- (no extension)
-\begin_inset LatexCommand \index{. (no extension)}
+\begin_inset LatexCommand \index{<file> (no extension)}
\layout Itemize
sourcefile.dump*
\layout Itemize
sourcefile.dump*
-\begin_inset LatexCommand \index{.dump*}
+\begin_inset LatexCommand \index{<file>.dump*}
Projects with Multiple Source Files
\layout Standard
Projects with Multiple Source Files
\layout Standard
.
You can view this file to troubleshoot linking problems such as those arising
from missing libraries.
.
You can view this file to troubleshoot linking problems such as those arising
from missing libraries.
Projects with Additional Libraries
\begin_inset LatexCommand \index{Libraries}
Projects with Additional Libraries
\begin_inset LatexCommand \index{Libraries}
libsdcc.lib
\emph default
in the directory <installdir>/share/lib/small.
libsdcc.lib
\emph default
in the directory <installdir>/share/lib/small.
Command Line Options
\begin_inset LatexCommand \index{Command Line Options}
Command Line Options
\begin_inset LatexCommand \index{Command Line Options}
Processor Selection Options
\begin_inset LatexCommand \index{Options processor selection}
Processor Selection Options
\begin_inset LatexCommand \index{Options processor selection}
\series default
Generate code for the GameBoy Z80
\series default
Generate code for the GameBoy Z80
-\begin_inset LatexCommand \index{GameBoy Z80}
+\begin_inset LatexCommand \index{gbz80 (GameBoy Z80)}
\end_inset
processor (In development, not complete).
\end_inset
processor (In development, not complete).
Preprocessor Options
\begin_inset LatexCommand \index{Options preprocessor}
Preprocessor Options
\begin_inset LatexCommand \index{Options preprocessor}
\bar default
Like `-dD' except that the macro arguments and contents are omitted.
Only `#define name' is included in the output.
\bar default
Like `-dD' except that the macro arguments and contents are omitted.
Only `#define name' is included in the output.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-Wp\SpecialChar ~
+preprocessorOption[,preprocessorOption]
+\series default
+
+\begin_inset LatexCommand \index{-Wp preprocessorOption[,preprocessorOption]}
+
+\end_inset
+
+...
+ Pass the preprocessorOption to the preprocessor.
+\layout Subsection
Linker Options
\begin_inset LatexCommand \index{Options linker}
Linker Options
\begin_inset LatexCommand \index{Options linker}
-\begin_inset LatexCommand \index{-\/-lib-path}
+\begin_inset LatexCommand \index{-\/-lib-path <path>}
<absolute path to additional libraries> This option is passed to the linkage
editor's additional libraries
\begin_inset LatexCommand \index{Libraries}
<absolute path to additional libraries> This option is passed to the linkage
editor's additional libraries
\begin_inset LatexCommand \index{Libraries}
-xram-loc
\series default
-xram-loc
\series default
-\begin_inset LatexCommand \index{-\/-xram-loc}
+\begin_inset LatexCommand \index{-\/-xram-loc <Value>}
<Value> The start location of the external ram
\begin_inset LatexCommand \index{xdata}
<Value> The start location of the external ram
\begin_inset LatexCommand \index{xdata}
-code-loc
\series default
-code-loc
\series default
-\begin_inset LatexCommand \index{-\/-code-loc}
+\begin_inset LatexCommand \index{-\/-code-loc <Value>}
<Value> The start location of the code
\begin_inset LatexCommand \index{code}
<Value> The start location of the code
\begin_inset LatexCommand \index{code}
-stack-loc
\series default
-stack-loc
\series default
-\begin_inset LatexCommand \index{-\/-stack-loc}
+\begin_inset LatexCommand \index{-\/-stack-loc <Value>}
<Value> By default the stack
\begin_inset LatexCommand \index{stack}
<Value> By default the stack
\begin_inset LatexCommand \index{stack}
-data-loc
\series default
-data-loc
\series default
-\begin_inset LatexCommand \index{-\/-data-loc}
+\begin_inset LatexCommand \index{-\/-data-loc <Value>}
<Value> The start location of the internal ram data
\begin_inset LatexCommand \index{data}
<Value> The start location of the internal ram data
\begin_inset LatexCommand \index{data}
-idata-loc
\series default
-idata-loc
\series default
-\begin_inset LatexCommand \index{-\/-idata-loc}
+\begin_inset LatexCommand \index{-\/-idata-loc <Value>}
<Value> The start location of the indirectly addressable internal ram
\begin_inset LatexCommand \index{idata}
\end_inset
<Value> The start location of the indirectly addressable internal ram
\begin_inset LatexCommand \index{idata}
\end_inset
-, default value is 0x80.
+ of the 8051, default value is 0x80.
The value entered can be in Hexadecimal or Decimal format, eg.
-
\begin_inset ERT
The value entered can be in Hexadecimal or Decimal format, eg.
-
\begin_inset ERT
\labelwidthstring 00.00.0000
\labelwidthstring 00.00.0000
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-bit-loc
+\series default
+\SpecialChar ~
+<Value> The start location of the bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset
+
+ addressable internal ram of the 8051.
+ This is
+\emph on
+not
+\emph default
+ implemented yet.
+ Instead an option can be passed directly to the linker: -Wl\SpecialChar ~
+-bBSEG=<Value>.
+\layout List
+\labelwidthstring 00.00.0000
+
+
\series bold
-
\begin_inset ERT
\series bold
-
\begin_inset ERT
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-Wl\SpecialChar ~
+linkOption[,linkOption]
+\series default
+
+\begin_inset LatexCommand \index{-Wl linkOption[,linkOption]}
+
+\end_inset
+
+...
+ Pass the linkOption to the linker.
+\layout Subsection
MCS51 Options
\begin_inset LatexCommand \index{Options MCS51}
MCS51 Options
\begin_inset LatexCommand \index{Options MCS51}
-iram-size
\series default
-iram-size
\series default
-\begin_inset LatexCommand \index{-\/-iram-size<Value>}
+\begin_inset LatexCommand \index{-\/-iram-size <Value>}
-xram-size
\series default
-xram-size
\series default
-\begin_inset LatexCommand \index{-\/-xram-size<Value>}
+\begin_inset LatexCommand \index{-\/-xram-size <Value>}
-code-size
\series default
-code-size
\series default
-\begin_inset LatexCommand \index{-\/-data-loc}
+\begin_inset LatexCommand \index{-\/-code-size <Value>}
\end_inset
Causes the linker to check if the code memory usage is within limits of
the given value.
\end_inset
Causes the linker to check if the code memory usage is within limits of
the given value.
DS390 Options
\begin_inset LatexCommand \index{Options DS390}
DS390 Options
\begin_inset LatexCommand \index{Options DS390}
-model-flat24 option
\emph default
).
-model-flat24 option
\emph default
).
Z80 Options
\begin_inset LatexCommand \index{Options Z80}
Z80 Options
\begin_inset LatexCommand \index{Options Z80}
When linking, skip the standard crt0.o object file.
You must provide your own crt0.o for your system when linking.
When linking, skip the standard crt0.o object file.
You must provide your own crt0.o for your system when linking.
Optimization Options
\begin_inset LatexCommand \index{Options optimization}
Optimization Options
\begin_inset LatexCommand \index{Options optimization}
\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.
\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.
Other Options
\begin_inset LatexCommand \index{Options other}
Other Options
\begin_inset LatexCommand \index{Options other}
\labelwidthstring 00.00.0000
\labelwidthstring 00.00.0000
-\series bold
--Wa_asmOption[,asmOption]
-\series default
-
-\begin_inset LatexCommand \index{-Wa\_asmOption[,asmOption]}
-
-\end_inset
-
-...
- Pass the asmOption to the assembler.
-\layout List
-\labelwidthstring 00.00.0000
-
-
-\series bold
--Wl_linkOption[,linkOption]
-\series default
-
-\begin_inset LatexCommand \index{-Wl\_linkOption[,linkOption]}
-
-\end_inset
-
-...
- Pass the linkOption to the linker.
-\layout List
-\labelwidthstring 00.00.0000
-
-
\series bold
-
\begin_inset ERT
\series bold
-
\begin_inset ERT
<filename> This option can be used to use additional rules to be used by
the peep hole optimizer.
See section
<filename> This option can be used to use additional rules to be used by
the peep hole optimizer.
See section
- Disable peep-hole optimization.
+ Disable peep-hole optimization.
\layout List
\labelwidthstring 00.00.0000
\layout List
\labelwidthstring 00.00.0000
\series default
Send errors and warnings to stdout instead of stderr.
\series default
Send errors and warnings to stdout instead of stderr.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-Wa\SpecialChar ~
+asmOption[,asmOption]
+\series default
+
+\begin_inset LatexCommand \index{-Wa asmOption[,asmOption]}
+
+\end_inset
+
+...
+ Pass the asmOption to the assembler.
+\layout Subsection
Intermediate Dump Options
\begin_inset LatexCommand \label{sub:Intermediate-Dump-Options}
Intermediate Dump Options
\begin_inset LatexCommand \label{sub:Intermediate-Dump-Options}
\size default
\bar default
Will cause all the above mentioned dumps to be created.
\size default
\bar default
Will cause all the above mentioned dumps to be created.
Redirecting output on Windows Shells
\layout Standard
Redirecting output on Windows Shells
\layout Standard
\series bold
\emph default
-model-large -c $(InputPath)
\series bold
\emph default
-model-large -c $(InputPath)
Environment variables
\begin_inset LatexCommand \index{Environment variables}
Environment variables
\begin_inset LatexCommand \index{Environment variables}
There are some more environment variables recognized by SDCC, but these
are solely used for debugging purposes.
They can change or disappear very quickly, and will never be documented.
There are some more environment variables recognized by SDCC, but these
are solely used for debugging purposes.
They can change or disappear very quickly, and will never be documented.
MCS51/DS390 Storage Class
\begin_inset LatexCommand \index{Storage class}
MCS51/DS390 Storage Class
\begin_inset LatexCommand \index{Storage class}
In addition to the ANSI storage classes SDCC allows the following MCS51
specific storage classes.
In addition to the ANSI storage classes SDCC allows the following MCS51
specific storage classes.
data
\begin_inset LatexCommand \index{data}
data
\begin_inset LatexCommand \index{data}
mov\SpecialChar ~
\SpecialChar ~
_test_data,#0x01
mov\SpecialChar ~
\SpecialChar ~
_test_data,#0x01
xdata
\begin_inset LatexCommand \index{xdata}
xdata
\begin_inset LatexCommand \index{xdata}
\SpecialChar ~
movx\SpecialChar ~
@dptr,a
\SpecialChar ~
movx\SpecialChar ~
@dptr,a
idata
\begin_inset LatexCommand \index{idata}
idata
\begin_inset LatexCommand \index{idata}
mov\SpecialChar ~
\SpecialChar ~
@r0,#0x01
mov\SpecialChar ~
\SpecialChar ~
@r0,#0x01
pdata
\begin_inset LatexCommand \index{pdata}
pdata
\begin_inset LatexCommand \index{pdata}
code
\begin_inset LatexCommand \index{code}
code
\begin_inset LatexCommand \index{code}
\SpecialChar ~
\SpecialChar ~
movc a,@a+dptr
\SpecialChar ~
\SpecialChar ~
movc a,@a+dptr
bit
\begin_inset LatexCommand \index{bit}
bit
\begin_inset LatexCommand \index{bit}
\SpecialChar ~
setb\SpecialChar ~
_test_bit
\SpecialChar ~
setb\SpecialChar ~
_test_bit
+\layout Standard
+
+Apart from this 8051 specific storage class most architectures support ANSI-C
+ bitfields
+\begin_inset LatexCommand \index{bitfields}
+
+\end_inset
+
+
+\begin_inset Foot
+collapsed false
+
+\layout Standard
+
+Not really meant as examples, but nevertheless showing what bitfields are
+ about: device/include/mc68hc908qy.h and support/regression/tests/bitfields.c
+\end_inset
+
+.
+\layout Subsection
sfr
\begin_inset LatexCommand \index{sfr}
sfr
\begin_inset LatexCommand \index{sfr}
Pointers
\begin_inset LatexCommand \index{Pointers}
Pointers
\begin_inset LatexCommand \index{Pointers}
routines.
Explicitly specifying the pointer type will generate the most efficient
code.
routines.
Explicitly specifying the pointer type will generate the most efficient
code.
Absolute Addressing
\begin_inset LatexCommand \index{Absolute addressing}
Absolute Addressing
\begin_inset LatexCommand \index{Absolute addressing}
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
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{.lst}
+\begin_inset LatexCommand \index{<file>.lst}
\end_inset
) and the linker output files (.rst
\end_inset
) and the linker output files (.rst
-\begin_inset LatexCommand \index{.rst}
+\begin_inset LatexCommand \index{<file>.rst}
-\begin_inset LatexCommand \index{.map}
+\begin_inset LatexCommand \index{<file>.map}
\SpecialChar ~
/* I/O port 1, bit 1 */
\newline
\SpecialChar ~
/* I/O port 1, bit 1 */
\newline
+bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset
+
+ CPOL;\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
for example in a library.
This is somehow similar to sbit, but only one absolute address has to be
specified in the whole project.
for example in a library.
This is somehow similar to sbit, but only one absolute address has to be
specified in the whole project.
Parameters
\begin_inset LatexCommand \index{Parameters}
Parameters
\begin_inset LatexCommand \index{Parameters}
+\end_inset
+
+
+\begin_inset LatexCommand \index{function parameter}
+
\end_inset
& Local Variables
\end_inset
& Local Variables
this should only be done for static variables.
\layout Standard
this should only be done for static variables.
\layout Standard
-Parameters however are not allowed any storage class, (storage classes for
- parameters will be ignored), their allocation is governed by the memory
- model in use, and the reentrancy options.
-\layout Subsection
+Parameters
+\begin_inset LatexCommand \index{function parameter}
+
+\end_inset
+
+ however are not allowed any storage class
+\begin_inset LatexCommand \index{storage class}
+
+\end_inset
+
+, (storage classes for parameters will be ignored), their allocation is
+ governed by the memory model in use, and the reentrancy options.
+\layout Section
Overlaying
\begin_inset LatexCommand \label{sub:Overlaying}
Overlaying
\begin_inset LatexCommand \label{sub:Overlaying}
The #pragma\SpecialChar ~
NOOVERLAY ensures that the parameters and local variables for
the function are NOT overlayed.
The #pragma\SpecialChar ~
NOOVERLAY ensures that the parameters and local variables for
the function are NOT overlayed.
Interrupt Service Routines
\begin_inset LatexCommand \label{sub:Interrupt-Service-Routines}
Interrupt Service Routines
\begin_inset LatexCommand \label{sub:Interrupt-Service-Routines}
-t
-\begin_inset LatexCommand \index{-\/-int-long-rent}
+
+\begin_inset LatexCommand \index{-\/-int-long-reent}
\SpecialChar ~
about Functions using private banks.
\SpecialChar ~
about Functions using private banks.
Enabling and Disabling Interrupts
Enabling and Disabling Interrupts
Critical Functions and Critical Statements
\layout Standard
Critical Functions and Critical Statements
\layout Standard
\layout Standard
More than one statement could have been included in the block.
\layout Standard
More than one statement could have been included in the block.
Enabling and Disabling Interrupts directly
\layout Standard
Enabling and Disabling Interrupts directly
\layout Standard
\end_inset
(the difference between the shortest and the longest interrupt latency).
\end_inset
(the difference between the shortest and the longest interrupt latency).
+ These really are something different, f.e.
+ a serial interrupt has to be served before its buffer overruns so it cares
+ for the maximum interrupt latency, whereas it does not care about jitter.
+ On a loudspeaker driven via a digital to analog converter which is fed
+ by an interrupt a latency of a few milliseconds might be tolerable, whereas
+ a much smaller jitter will be very audible.
\layout Standard
You can reenable interrupts within an interrupt routine and on some architecture
\layout Standard
You can reenable interrupts within an interrupt routine and on some architecture
within the interrupt routine.
Don't add complexity unless you have to.
within the interrupt routine.
Don't add complexity unless you have to.
Functions using private banks
\begin_inset LatexCommand \label{sub:Functions-using-private-banks}
Functions using private banks
\begin_inset LatexCommand \label{sub:Functions-using-private-banks}
It is very inefficient to call a function using a different, non-zero bank
from an ISR.
It is very inefficient to call a function using a different, non-zero bank
from an ISR.
Startup Code
\begin_inset LatexCommand \label{sub:Startup-Code}
Startup Code
\begin_inset LatexCommand \label{sub:Startup-Code}
MCS51/DS390 Startup Code
\layout Standard
MCS51/DS390 Startup Code
\layout Standard
\SpecialChar ~
about MCS51-variants.
\SpecialChar ~
about MCS51-variants.
+\layout Subsection
+
+HC08 Startup Code
+\layout Standard
+
+The HC08 startup code follows the same scheme as the MCS51 startup code.
+\layout Subsection
Z80 Startup Code
\layout Standard
Z80 Startup Code
\layout Standard
and provide your own crt0.o.
and provide your own crt0.o.
Inline Assembler Code
\begin_inset LatexCommand \index{Assembler routines}
Inline Assembler Code
\begin_inset LatexCommand \index{Assembler routines}
A Step by Step Introduction
\layout Standard
A Step by Step Introduction
\layout Standard
SDCCpeeph.def
\emph default
carefully before using this option.
SDCCpeeph.def
\emph default
carefully before using this option.
Naked Functions
\begin_inset LatexCommand \label{sub:Naked-Functions}
Naked Functions
\begin_inset LatexCommand \label{sub:Naked-Functions}
While there is nothing preventing you from writing C code inside a _naked
function, there are many ways to shoot yourself in the foot doing this,
and it is recommended that you stick to inline assembler.
While there is nothing preventing you from writing C code inside a _naked
function, there are many ways to shoot yourself in the foot doing this,
and it is recommended that you stick to inline assembler.
Use of Labels within Inline Assembler
\layout Standard
Use of Labels within Inline Assembler
\layout Standard
assembly within the scope of the function.
The same goes the other way, ie.
labels defines in inline assembly can not be accessed by C statements.
assembly within the scope of the function.
The same goes the other way, ie.
labels defines in inline assembly can not be accessed by C statements.
Interfacing with Assembler Code
\begin_inset LatexCommand \index{Assembler routines}
Interfacing with Assembler Code
\begin_inset LatexCommand \index{Assembler routines}
Global Registers used for Parameter Passing
\begin_inset LatexCommand \index{Parameter passing}
Global Registers used for Parameter Passing
\begin_inset LatexCommand \index{Parameter passing}
+
+\begin_inset LatexCommand \index{DPTR}
+
+\end_inset
+
, B
\begin_inset LatexCommand \index{B (register)}
, B
\begin_inset LatexCommand \index{B (register)}
-stack-auto is used) or in data / xdata memory (depending on the memory
model).
-stack-auto is used) or in data / xdata memory (depending on the memory
model).
Assembler Routine(non-reentrant
\begin_inset LatexCommand \index{reentrant}
Assembler Routine(non-reentrant
\begin_inset LatexCommand \index{reentrant}
\layout Standard
In the following example the function c_func calls an assembler routine
\layout Standard
In the following example the function c_func calls an assembler routine
- asm_func, which takes two parameters.
+ asm_func, which takes two parameters
+\begin_inset LatexCommand \index{function parameter}
+
+\end_inset
+
+.
-Note here that the return values are placed in 'dpl' - One byte return value,
- 'dpl' LSB & 'dph' MSB for two byte values.
+Note here that the return values
+\begin_inset LatexCommand \index{return value}
+
+\end_inset
+
+ are placed in 'dpl' - One byte return value, 'dpl' LSB & 'dph' MSB for
+ two byte values.
'dpl', 'dph' and 'b' for three byte values (generic pointers) and 'dpl','dph','
b' & 'acc' for four byte values.
\layout Standard
'dpl', 'dph' and 'b' for three byte values (generic pointers) and 'dpl','dph','
b' & 'acc' for four byte values.
\layout Standard
\family sans
\series bold
sdcc cfunc.c asmfunc.rel
\family sans
\series bold
sdcc cfunc.c asmfunc.rel
Assembler Routine(reentrant
\begin_inset LatexCommand \index{reentrant}
Assembler Routine(reentrant
\begin_inset LatexCommand \index{reentrant}
-In this case the second parameter onwards will be passed on the stack, the
- parameters are pushed from right to left i.e.
+In this case the second parameter
+\begin_inset LatexCommand \index{function parameter}
+
+\end_inset
+
+ onwards will be passed on the stack, the parameters are pushed from right
+ to left i.e.
after the call the left most parameter will be on the top of the stack.
Here is an example:
\layout Verse
after the call the left most parameter will be on the top of the stack.
Here is an example:
\layout Verse
entry & exit linkage required for the assembler code, _bp is the stack
frame pointer and is used to compute the offset into the stack for parameters
and local variables.
entry & exit linkage required for the assembler code, _bp is the stack
frame pointer and is used to compute the offset into the stack for parameters
and local variables.
int (16 bit)
\begin_inset LatexCommand \index{int (16 bit)}
int (16 bit)
\begin_inset LatexCommand \index{int (16 bit)}
--int-long-rent
-\begin_inset LatexCommand \index{-\/-int-long-rent}
+-int-long-reent
+\begin_inset LatexCommand \index{-\/-int-long-reent}
Notice that you don't have to call this routines directly.
The compiler will use them automatically every time an integer operation
is required.
Notice that you don't have to call this routines directly.
The compiler will use them automatically every time an integer operation
is required.
Floating Point Support
\begin_inset LatexCommand \index{Floating point support}
Floating Point Support
\begin_inset LatexCommand \index{Floating point support}
Also notice that you don't have to call this routines directly.
The compiler will use them automatically every time a floating point operation
is required.
Also notice that you don't have to call this routines directly.
The compiler will use them automatically every time a floating point operation
is required.
MCS51 Memory Models
\begin_inset LatexCommand \index{Memory model}
MCS51 Memory Models
\begin_inset LatexCommand \index{Memory model}
Several optimizations are disabled when the program is compiled using the
large model, it is therefore strongly recommended that the small model
be used unless absolutely required.
Several optimizations are disabled when the program is compiled using the
large model, it is therefore strongly recommended that the small model
be used unless absolutely required.
DS390 Memory Models
\begin_inset LatexCommand \index{Memory model}
DS390 Memory Models
\begin_inset LatexCommand \index{Memory model}
\emph default
on the SDCC command line.
However, currently the linker can not handle code segments > 64k.
\emph default
on the SDCC command line.
However, currently the linker can not handle code segments > 64k.
Pragmas
\begin_inset LatexCommand \index{Pragmas}
Pragmas
\begin_inset LatexCommand \index{Pragmas}
The compiler will generate a warning message when extra space is allocated.
It is strongly recommended that the SAVE and RESTORE pragma's be used when
changing options for a function.
The compiler will generate a warning message when extra space is allocated.
It is strongly recommended that the SAVE and RESTORE pragma's be used when
changing options for a function.
Defines Created by the Compiler
\begin_inset LatexCommand \index{Defines created by the compiler}
Defines Created by the Compiler
\begin_inset LatexCommand \index{Defines created by the compiler}
\begin_inset LatexCommand \index{\_\_ds390}
\end_inset
\begin_inset LatexCommand \index{\_\_ds390}
\end_inset
+, __hc08
+\begin_inset LatexCommand \index{\_\_hc08}
+
+\end_inset
+
+, __z80
\begin_inset LatexCommand \index{\_\_z80}
\end_inset
\begin_inset LatexCommand \index{\_\_z80}
\end_inset
-\layout Section
-\pagebreak_top
Debugging with SDCDB
\begin_inset LatexCommand \index{sdcdb}
Debugging with SDCDB
\begin_inset LatexCommand \index{sdcdb}
The debugger allows you debug BOTH at the C source and at the ASM source
level.
Sdcdb is available on Unix platforms only.
The debugger allows you debug BOTH at the C source and at the ASM source
level.
Sdcdb is available on Unix platforms only.
Compiling for Debugging
\layout Standard
Compiling for Debugging
\layout Standard
The complier generates a .adb file for each of these files.
The linker creates the .cdb file from the .adb files and the address information.
This .cdb is used by the debugger.
The complier generates a .adb file for each of these files.
The linker creates the .cdb file from the .adb files and the address information.
This .cdb is used by the debugger.
How the Debugger Works
\layout Standard
How the Debugger Works
\layout Standard
execution is controlled by the debugger.
When a command is issued for the debugger, it translates it into appropriate
commands for the simulator.
execution is controlled by the debugger.
When a command is issued for the debugger, it translates it into appropriate
commands for the simulator.
Starting the Debugger
\layout Standard
Starting the Debugger
\layout Standard
Command Line Options.
\layout Itemize
Command Line Options.
\layout Itemize
\layout Itemize
-S <serial in,out> passed to simulator see the simulator docs for details.
\layout Itemize
-S <serial in,out> passed to simulator see the simulator docs for details.
Debugger Commands.
\layout Standard
Debugger Commands.
\layout Standard
"Watch me now.
Iam going Down.
My name is Bobby Brown"
"Watch me now.
Iam going Down.
My name is Bobby Brown"
Interfacing with XEmacs
\begin_inset LatexCommand \index{XEmacs}
Interfacing with XEmacs
\begin_inset LatexCommand \index{XEmacs}
\pagebreak_top
TIPS
\layout Standard
\pagebreak_top
TIPS
\layout Standard
\end_inset
for the code generation.
\end_inset
for the code generation.
Notes on MCS51 memory
\begin_inset LatexCommand \index{MCS51 memory}
Notes on MCS51 memory
\begin_inset LatexCommand \index{MCS51 memory}
xdata
\emph default
memory has to be activated before using it (you can probably find this
xdata
\emph default
memory has to be activated before using it (you can probably find this
- information on the datasheet of the microcontroller your are using).
+ information on the datasheet of the microcontroller your are using, see
+ also section
+\begin_inset LatexCommand \ref{sub:Startup-Code}
+
+\end_inset
+
+\SpecialChar ~
+Startup-Code).
\layout Standard
Normally SDCC will only use the first bank
\layout Standard
Normally SDCC will only use the first bank
allocation, take a look at either the .map or .mem files to find out what
the problem is.
The .mem file may even suggest a solution to the problem.
allocation, take a look at either the .map or .mem files to find out what
the problem is.
The .mem file may even suggest a solution to the problem.
Tools
\begin_inset LatexCommand \index{Tools}
Tools
\begin_inset LatexCommand \index{Tools}
Related open source tools
\begin_inset LatexCommand \index{Related tools}
Related open source tools
\begin_inset LatexCommand \index{Related tools}
Related documentation / recommended reading
\layout Standard
Related documentation / recommended reading
\layout Standard
\pagebreak_top
Support
\begin_inset LatexCommand \index{Support}
\pagebreak_top
Support
\begin_inset LatexCommand \index{Support}
-\begin_inset LatexCommand \index{Bugs}
+\begin_inset LatexCommand \index{Bug reporting}
Requesting Features
\begin_inset LatexCommand \label{sub:Requesting-Features}
Requesting Features
\begin_inset LatexCommand \label{sub:Requesting-Features}
Getting Help
\layout Standard
Getting Help
\layout Standard
, lists and forums are archived so if you are lucky someone already had
a similar problem.
, lists and forums are archived so if you are lucky someone already had
a similar problem.
ChangeLog
\begin_inset LatexCommand \index{Changelog}
ChangeLog
\begin_inset LatexCommand \index{Changelog}
\end_inset
in the cvs-repository.
\end_inset
in the cvs-repository.
Release policy
\begin_inset LatexCommand \index{Release policy}
Release policy
\begin_inset LatexCommand \index{Release policy}
Examples
\begin_inset LatexCommand \index{Examples}
Examples
\begin_inset LatexCommand \index{Examples}
Maybe we should include some links to real world applications.
Preferably pointer to pointers (one for each architecture) so this stays
manageable here?
Maybe we should include some links to real world applications.
Preferably pointer to pointers (one for each architecture) so this stays
manageable here?
Quality control
\begin_inset LatexCommand \index{Quality control}
Quality control
\begin_inset LatexCommand \index{Quality control}
sdcc/src/regression
\shape default
.
sdcc/src/regression
\shape default
.
\pagebreak_top
SDCC Technical Data
\pagebreak_top
SDCC Technical Data
Optimizations
\begin_inset LatexCommand \index{Optimizations}
Optimizations
\begin_inset LatexCommand \index{Optimizations}
SDCC performs a host of standard optimizations in addition to some MCU specific
optimizations.
SDCC performs a host of standard optimizations in addition to some MCU specific
optimizations.
Sub-expression Elimination
\begin_inset LatexCommand \index{Subexpression elimination}
Sub-expression Elimination
\begin_inset LatexCommand \index{Subexpression elimination}
\layout Standard
The compiler will try to keep these temporary variables in registers.
\layout Standard
The compiler will try to keep these temporary variables in registers.
Dead-Code Elimination
\begin_inset LatexCommand \index{Dead-code elimination}
Dead-Code Elimination
\begin_inset LatexCommand \index{Dead-code elimination}
Copy-Propagation
\begin_inset LatexCommand \index{Copy propagation}
Copy-Propagation
\begin_inset LatexCommand \index{Copy propagation}
Note: the dead stores created by this copy propagation will be eliminated
by dead-code elimination.
Note: the dead stores created by this copy propagation will be eliminated
by dead-code elimination.
Loop Optimizations
\begin_inset LatexCommand \index{Loop optimization}
Loop Optimizations
\begin_inset LatexCommand \index{Loop optimization}
\end_inset
is changed to a less expensive addition.
\end_inset
is changed to a less expensive addition.
Loop Reversing
\begin_inset LatexCommand \index{Loop reversing}
Loop Reversing
\begin_inset LatexCommand \index{Loop reversing}
\layout Itemize
There are NO switch statements in the loop.
\layout Itemize
There are NO switch statements in the loop.
Algebraic Simplifications
\layout Standard
Algebraic Simplifications
\layout Standard
given above are generally introduced by macro expansions or as a result
of copy/constant propagation.
given above are generally introduced by macro expansions or as a result
of copy/constant propagation.
'switch' Statements
\begin_inset LatexCommand \label{sub:'switch'-Statements}
'switch' Statements
\begin_inset LatexCommand \label{sub:'switch'-Statements}
It has no effect if a default label is supplied.
Use of this pragma is dangerous: if the switch argument is not matched
by a case statement the processor will happily jump into Nirvana.
It has no effect if a default label is supplied.
Use of this pragma is dangerous: if the switch argument is not matched
by a case statement the processor will happily jump into Nirvana.
Bit-shifting Operations
\begin_inset LatexCommand \index{Bit shifting}
Bit-shifting Operations
\begin_inset LatexCommand \index{Bit shifting}
mov\SpecialChar ~
\SpecialChar ~
_i,a
mov\SpecialChar ~
\SpecialChar ~
_i,a
Bit-rotation
\begin_inset LatexCommand \index{Bit rotation}
Bit-rotation
\begin_inset LatexCommand \index{Bit rotation}
\family typewriter
i = ((i >> 7) | (i << 1)); /* left-bit rotation */
\family typewriter
i = ((i >> 7) | (i << 1)); /* left-bit rotation */
Nibble and Byte Swapping
\layout Standard
Nibble and Byte Swapping
\layout Standard
format (i.e.
lowest order first).
format (i.e.
lowest order first).
Highest Order Bit
\begin_inset LatexCommand \index{Highest Order Bit}
Highest Order Bit
\begin_inset LatexCommand \index{Highest Order Bit}
\layout Standard
will still be recognized.
\layout Standard
will still be recognized.
Peephole Optimizer
\begin_inset LatexCommand \label{sub:Peephole-Optimizer}
Peephole Optimizer
\begin_inset LatexCommand \label{sub:Peephole-Optimizer}
\end_inset
-peep-file option.
\end_inset
-peep-file option.
Library Routines
\emph on
Library Routines
\emph on
Programmers coding for embedded systems are not especially famous for being
enthusiastic, so don't expect a big hurray but as the mailing list is searchabl
e these references are very valuable.
Programmers coding for embedded systems are not especially famous for being
enthusiastic, so don't expect a big hurray but as the mailing list is searchabl
e these references are very valuable.
External Stack
\begin_inset LatexCommand \label{sub:External-Stack}
External Stack
\begin_inset LatexCommand \label{sub:External-Stack}
The compiler outputs the higher order address byte of the external ram segment
into PORT P2, therefore when using the External Stack option, this port
MAY NOT be used by the application program.
The compiler outputs the higher order address byte of the external ram segment
into PORT P2, therefore when using the External Stack option, this port
MAY NOT be used by the application program.
ANSI-Compliance
\begin_inset LatexCommand \index{ANSI-compliance}
ANSI-Compliance
\begin_inset LatexCommand \index{ANSI-compliance}
Deviations from the compliance:
\layout Itemize
Deviations from the compliance:
\layout Itemize
-functions are not always reentrant.
+functions are not always reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+.
\layout Itemize
structures cannot be assigned values directly, cannot be passed as function
\layout Itemize
structures cannot be assigned values directly, cannot be passed as function
not supported.
\layout Itemize
not supported.
\layout Itemize
-No support for setjmp and longjmp (for now).
+No support for setjmp
+\begin_inset LatexCommand \index{setjmp (not supported)}
+
+\end_inset
+
+ and longjmp
+\begin_inset LatexCommand \index{longjmp (not supported)}
+
+\end_inset
+
+ (for now).
\layout Itemize
Old K&R style
\layout Itemize
Old K&R style
\newline
(*foo)(); /* ANSI standard allows calls to be made like 'foo()' */
\end_deeper
\newline
(*foo)(); /* ANSI standard allows calls to be made like 'foo()' */
\end_deeper
Cyclomatic Complexity
\begin_inset LatexCommand \index{Cyclomatic complexity}
Cyclomatic Complexity
\begin_inset LatexCommand \index{Cyclomatic complexity}
The complexity level is by no means an absolute measure of the algorithmic
complexity of the function, it does however provide a good starting point
for which functions you might look at for further optimization.
The complexity level is by no means an absolute measure of the algorithmic
complexity of the function, it does however provide a good starting point
for which functions you might look at for further optimization.
MCS51 variants
\begin_inset LatexCommand \label{sub:MCS51-variants}
MCS51 variants
\begin_inset LatexCommand \label{sub:MCS51-variants}
These are currently not used for the MCS51 port.
If you absolutely need them you can fall back to inline assembly or submit
a patch to SDCC.
These are currently not used for the MCS51 port.
If you absolutely need them you can fall back to inline assembly or submit
a patch to SDCC.
The Z80 and gbz80 port
\layout Standard
The Z80 and gbz80 port
\layout Standard
\end_inset
and the Nintendo Gameboy's Z80-like gbz80
\end_inset
and the Nintendo Gameboy's Z80-like gbz80
-\begin_inset LatexCommand \index{GameBoy Z80}
+\begin_inset LatexCommand \index{gbz80 (GameBoy Z80)}
As always, the code is the authoritative reference - see z80/ralloc.c and
z80/gen.c.
As always, the code is the authoritative reference - see z80/ralloc.c and
z80/gen.c.
- The stack frame is similar to that generated by the IAR Z80 compiler.
+ The stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset
+
+ frame is similar to that generated by the IAR Z80 compiler.
IX is used as the base pointer, HL is used as a temporary register, and
BC and DE are available for holding variables.
IY is currently unused.
IX is used as the base pointer, HL is used as a temporary register, and
BC and DE are available for holding variables.
IY is currently unused.
- Return values are stored in HL.
+ Return values
+\begin_inset LatexCommand \index{return value}
+
+\end_inset
+
+ are stored in HL.
One bad side effect of using IX as the base pointer is that a functions
stack frame is limited to 127 bytes - this will be fixed in a later version.
One bad side effect of using IX as the base pointer is that a functions
stack frame is limited to 127 bytes - this will be fixed in a later version.
The HC08 port
\layout Standard
The HC08 port
\layout Standard
\end_inset
family has been added in October 2003, thank you Erik!
\end_inset
family has been added in October 2003, thank you Erik!
Retargetting for other MCUs.
\layout Standard
Retargetting for other MCUs.
\layout Standard
As mentioned in the optimization section the peep-hole optimizer is rule
based system, which can reprogrammed for other MCUs.
As mentioned in the optimization section the peep-hole optimizer is rule
based system, which can reprogrammed for other MCUs.
-\layout Section
-\pagebreak_top
Compiler internals
\begin_inset LatexCommand \index{Compiler internals}
\end_inset
Compiler internals
\begin_inset LatexCommand \index{Compiler internals}
\end_inset
The anatomy of the compiler
\begin_inset LatexCommand \label{sub:The-anatomy-of}
The anatomy of the compiler
\begin_inset LatexCommand \label{sub:The-anatomy-of}
A few words about basic block successors, predecessors and dominators
\layout Standard
A few words about basic block successors, predecessors and dominators
\layout Standard
c) domVect of [BB4] = BB1 ...
here we are not sure if BB2 or BB3 was executed but we are SURE that BB1
was executed.
c) domVect of [BB4] = BB1 ...
here we are not sure if BB2 or BB3 was executed but we are SURE that BB1
was executed.
Acknowledgments
\layout Standard
Acknowledgments
\layout Standard
of their respective companies.
of their respective companies.
Alphabetical index
\layout Standard
Alphabetical index
\layout Standard