349 lines
13 KiB
HTML
349 lines
13 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
|
|
<!--Converted with LaTeX2HTML 99.1 release (March 30, 1999)
|
|
original version by: Nikos Drakos, CBLU, University of Leeds
|
|
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
|
|
* with significant contributions from:
|
|
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>SDCC Compiler User Guide</TITLE>
|
|
<META NAME="description" CONTENT="SDCC Compiler User Guide">
|
|
<META NAME="keywords" CONTENT="sdccman">
|
|
<META NAME="resource-type" CONTENT="document">
|
|
<META NAME="distribution" CONTENT="global">
|
|
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="Generator" CONTENT="LaTeX2HTML v99.1 release">
|
|
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
|
|
|
|
<LINK REL="STYLESHEET" HREF="sdccman.css">
|
|
|
|
<LINK REL="next" HREF="node1.html">
|
|
</HEAD>
|
|
|
|
<BODY >
|
|
<!--Navigation Panel-->
|
|
<A NAME="tex2html6"
|
|
HREF="node1.html">
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A>
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif_gr.gif">
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif_gr.gif">
|
|
<A NAME="tex2html2"
|
|
HREF="node1.html">
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A>
|
|
<A NAME="tex2html4"
|
|
HREF="node61.html">
|
|
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A>
|
|
<BR>
|
|
<B> Next:</B> <A NAME="tex2html7"
|
|
HREF="node1.html">Contents</A>
|
|
  <B> <A NAME="tex2html3"
|
|
HREF="node1.html">Contents</A></B>
|
|
  <B> <A NAME="tex2html5"
|
|
HREF="node61.html">Index</A></B>
|
|
<BR>
|
|
<BR>
|
|
<!--End of Navigation Panel-->
|
|
|
|
<P>
|
|
|
|
<P>
|
|
|
|
<H1 ALIGN="CENTER">SDCC Compiler User Guide</H1>
|
|
<BR><HR>
|
|
<!--Table of Child-Links-->
|
|
<A NAME="CHILD_LINKS"></A>
|
|
|
|
<UL>
|
|
<LI><A NAME="tex2html8"
|
|
HREF="node1.html">Contents</A>
|
|
<LI><A NAME="tex2html9"
|
|
HREF="node2.html">1. Introduction</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html10"
|
|
HREF="node3.html">1.1 About SDCC</A>
|
|
<LI><A NAME="tex2html11"
|
|
HREF="node4.html">1.2 Open Source</A>
|
|
<LI><A NAME="tex2html12"
|
|
HREF="node5.html">1.3 Typographic conventions</A>
|
|
<LI><A NAME="tex2html13"
|
|
HREF="node6.html">1.4 Compatibility with previous versions</A>
|
|
<LI><A NAME="tex2html14"
|
|
HREF="node7.html">1.5 System Requirements</A>
|
|
<LI><A NAME="tex2html15"
|
|
HREF="node8.html">1.6 Other Resources</A>
|
|
<LI><A NAME="tex2html16"
|
|
HREF="node9.html">1.7 Wishes for the future</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html17"
|
|
HREF="node10.html">2. Installation</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html18"
|
|
HREF="node11.html">2.1 Linux/Unix Installation</A>
|
|
<LI><A NAME="tex2html19"
|
|
HREF="node12.html">2.2 Windows Installation</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html20"
|
|
HREF="node12.html#SECTION00032100000000000000">2.2.1 Windows Install Using a Binary Package</A>
|
|
<LI><A NAME="tex2html21"
|
|
HREF="node12.html#SECTION00032200000000000000">2.2.2 Windows Install Using Cygwin</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html22"
|
|
HREF="node13.html">2.3 Testing out the SDCC Compiler</A>
|
|
<LI><A NAME="tex2html23"
|
|
HREF="node14.html">2.4 Install Trouble-shooting</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html24"
|
|
HREF="node14.html#SECTION00034100000000000000">2.4.1 SDCC cannot find libraries or header files.</A>
|
|
<LI><A NAME="tex2html25"
|
|
HREF="node14.html#SECTION00034200000000000000">2.4.2 SDCC does not compile correctly.</A>
|
|
<LI><A NAME="tex2html26"
|
|
HREF="node14.html#SECTION00034300000000000000">2.4.3 What the ''./configure'' does</A>
|
|
<LI><A NAME="tex2html27"
|
|
HREF="node14.html#SECTION00034400000000000000">2.4.4 What the ''make'' does.</A>
|
|
<LI><A NAME="tex2html28"
|
|
HREF="node14.html#SECTION00034500000000000000">2.4.5 What the ''make install'' command does.</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html29"
|
|
HREF="node15.html">2.5 Additional Information for Windows Users</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html30"
|
|
HREF="node15.html#SECTION00035100000000000000">2.5.1 Getting started with Cygwin</A>
|
|
<LI><A NAME="tex2html31"
|
|
HREF="node15.html#SECTION00035200000000000000">2.5.2 Running SDCC as Native Compiled Executables</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html32"
|
|
HREF="node16.html">2.6 SDCC on Other Platforms</A>
|
|
<LI><A NAME="tex2html33"
|
|
HREF="node17.html">2.7 Advanced Install Options</A>
|
|
<LI><A NAME="tex2html34"
|
|
HREF="node18.html">2.8 Components of SDCC</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html35"
|
|
HREF="node18.html#SECTION00038100000000000000">2.8.1 sdcc - The Compiler</A>
|
|
<LI><A NAME="tex2html36"
|
|
HREF="node18.html#SECTION00038200000000000000">2.8.2 sdcpp (C-Preprocessor)</A>
|
|
<LI><A NAME="tex2html37"
|
|
HREF="node18.html#SECTION00038300000000000000">2.8.3 asx8051, as-z80, as-gbz80, aslink, link-z80, link-gbz80 (The Assemblers
|
|
and Linkage Editors)</A>
|
|
<LI><A NAME="tex2html38"
|
|
HREF="node18.html#SECTION00038400000000000000">2.8.4 s51 - Simulator</A>
|
|
<LI><A NAME="tex2html39"
|
|
HREF="node18.html#SECTION00038500000000000000">2.8.5 sdcdb - Source Level Debugger</A>
|
|
</UL>
|
|
</UL>
|
|
<LI><A NAME="tex2html40"
|
|
HREF="node19.html">3. Using SDCC</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html41"
|
|
HREF="node20.html">3.1 Compiling</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html42"
|
|
HREF="node20.html#SECTION00041100000000000000">3.1.1 Single Source File Projects</A>
|
|
<LI><A NAME="tex2html43"
|
|
HREF="node20.html#SECTION00041200000000000000">3.1.2 Projects with Multiple Source Files</A>
|
|
<LI><A NAME="tex2html44"
|
|
HREF="node20.html#SECTION00041300000000000000">3.1.3 Projects with Additional Libraries</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html45"
|
|
HREF="node21.html">3.2 Command Line Options</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html46"
|
|
HREF="node21.html#SECTION00042100000000000000">3.2.1 Processor Selection Options</A>
|
|
<LI><A NAME="tex2html47"
|
|
HREF="node21.html#SECTION00042200000000000000">3.2.2 Preprocessor Options</A>
|
|
<LI><A NAME="tex2html48"
|
|
HREF="node21.html#SECTION00042300000000000000">3.2.3 Linker Options</A>
|
|
<LI><A NAME="tex2html49"
|
|
HREF="node21.html#SECTION00042400000000000000">3.2.4 MCS51 Options</A>
|
|
<LI><A NAME="tex2html50"
|
|
HREF="node21.html#SECTION00042500000000000000">3.2.5 DS390 Options</A>
|
|
<LI><A NAME="tex2html51"
|
|
HREF="node21.html#SECTION00042600000000000000">3.2.6 Optimization Options</A>
|
|
<LI><A NAME="tex2html52"
|
|
HREF="node21.html#SECTION00042700000000000000">3.2.7 Other Options</A>
|
|
<LI><A NAME="tex2html53"
|
|
HREF="node21.html#SECTION00042800000000000000">3.2.8 Intermediate Dump Options</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html54"
|
|
HREF="node22.html">3.3 MCS51/DS390 Storage Class Language Extensions</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html55"
|
|
HREF="node22.html#SECTION00043100000000000000">3.3.1 xdata</A>
|
|
<LI><A NAME="tex2html56"
|
|
HREF="node22.html#SECTION00043200000000000000">3.3.2 data</A>
|
|
<LI><A NAME="tex2html57"
|
|
HREF="node22.html#SECTION00043300000000000000">3.3.3 idata</A>
|
|
<LI><A NAME="tex2html58"
|
|
HREF="node22.html#SECTION00043400000000000000">3.3.4 bit</A>
|
|
<LI><A NAME="tex2html59"
|
|
HREF="node22.html#SECTION00043500000000000000">3.3.5 sfr / sbit</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html60"
|
|
HREF="node23.html">3.4 Pointers</A>
|
|
<LI><A NAME="tex2html61"
|
|
HREF="node24.html">3.5 Parameters & Local Variables</A>
|
|
<LI><A NAME="tex2html62"
|
|
HREF="node25.html">3.6 Overlaying</A>
|
|
<LI><A NAME="tex2html63"
|
|
HREF="node26.html">3.7 Interrupt Service Routines</A>
|
|
<LI><A NAME="tex2html64"
|
|
HREF="node27.html">3.8 Critical Functions</A>
|
|
<LI><A NAME="tex2html65"
|
|
HREF="node28.html">3.9 Naked Functions</A>
|
|
<LI><A NAME="tex2html66"
|
|
HREF="node29.html">3.10 Functions using private banks</A>
|
|
<LI><A NAME="tex2html67"
|
|
HREF="node30.html">3.11 Absolute Addressing</A>
|
|
<LI><A NAME="tex2html68"
|
|
HREF="node31.html">3.12 Startup Code</A>
|
|
<LI><A NAME="tex2html69"
|
|
HREF="node32.html">3.13 Inline Assembler Code</A>
|
|
<LI><A NAME="tex2html70"
|
|
HREF="node33.html">3.14 int(16 bit) and long (32 bit) Support</A>
|
|
<LI><A NAME="tex2html71"
|
|
HREF="node34.html">3.15 Floating Point Support</A>
|
|
<LI><A NAME="tex2html72"
|
|
HREF="node35.html">3.16 MCS51 Memory Models</A>
|
|
<LI><A NAME="tex2html73"
|
|
HREF="node36.html">3.17 DS390 Memory Models</A>
|
|
<LI><A NAME="tex2html74"
|
|
HREF="node37.html">3.18 Defines Created by the Compiler</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html75"
|
|
HREF="node38.html">4. SDCC Technical Data</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html76"
|
|
HREF="node39.html">4.1 Optimizations</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html77"
|
|
HREF="node39.html#SECTION00051100000000000000">4.1.1 Sub-expression Elimination</A>
|
|
<LI><A NAME="tex2html78"
|
|
HREF="node39.html#SECTION00051200000000000000">4.1.2 Dead-Code Elimination</A>
|
|
<LI><A NAME="tex2html79"
|
|
HREF="node39.html#SECTION00051300000000000000">4.1.3 Copy-Propagation</A>
|
|
<LI><A NAME="tex2html80"
|
|
HREF="node39.html#SECTION00051400000000000000">4.1.4 Loop Optimizations</A>
|
|
<LI><A NAME="tex2html81"
|
|
HREF="node39.html#SECTION00051500000000000000">4.1.5 Loop Reversing</A>
|
|
<LI><A NAME="tex2html82"
|
|
HREF="node39.html#SECTION00051600000000000000">4.1.6 Algebraic Simplifications</A>
|
|
<LI><A NAME="tex2html83"
|
|
HREF="node39.html#SECTION00051700000000000000">4.1.7 'switch' Statements</A>
|
|
<LI><A NAME="tex2html84"
|
|
HREF="node39.html#SECTION00051800000000000000">4.1.8 Bit-shifting Operations.</A>
|
|
<LI><A NAME="tex2html85"
|
|
HREF="node39.html#SECTION00051900000000000000">4.1.9 Bit-rotation</A>
|
|
<LI><A NAME="tex2html86"
|
|
HREF="node39.html#SECTION000511000000000000000">4.1.10 Highest Order Bit</A>
|
|
<LI><A NAME="tex2html87"
|
|
HREF="node39.html#SECTION000511100000000000000">4.1.11 Peep-hole Optimizer</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html88"
|
|
HREF="node40.html">4.2 Pragmas</A>
|
|
<LI><A NAME="tex2html89"
|
|
HREF="node41.html">4.3 <I><pending: this is messy and incomplete></I> Library Routines</A>
|
|
<LI><A NAME="tex2html90"
|
|
HREF="node42.html">4.4 Interfacing with Assembly Routines</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html91"
|
|
HREF="node42.html#SECTION00054100000000000000">4.4.1 Global Registers used for Parameter Passing</A>
|
|
<LI><A NAME="tex2html92"
|
|
HREF="node42.html#SECTION00054200000000000000">4.4.2 Assembler Routine(non-reentrant)</A>
|
|
<LI><A NAME="tex2html93"
|
|
HREF="node42.html#SECTION00054300000000000000">4.4.3 Assembler Routine(reentrant)</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html94"
|
|
HREF="node43.html">4.5 External Stack</A>
|
|
<LI><A NAME="tex2html95"
|
|
HREF="node44.html">4.6 ANSI-Compliance</A>
|
|
<LI><A NAME="tex2html96"
|
|
HREF="node45.html">4.7 Cyclomatic Complexity</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html97"
|
|
HREF="node46.html">5. TIPS</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html98"
|
|
HREF="node47.html">5.1 Notes on MCS51 memory layout</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html99"
|
|
HREF="node48.html">6. Retargetting for other MCUs.</A>
|
|
<LI><A NAME="tex2html100"
|
|
HREF="node49.html">7. SDCDB - Source Level Debugger</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html101"
|
|
HREF="node50.html">7.1 Compiling for Debugging</A>
|
|
<LI><A NAME="tex2html102"
|
|
HREF="node51.html">7.2 How the Debugger Works</A>
|
|
<LI><A NAME="tex2html103"
|
|
HREF="node52.html">7.3 Starting the Debugger</A>
|
|
<LI><A NAME="tex2html104"
|
|
HREF="node53.html">7.4 Command Line Options.</A>
|
|
<LI><A NAME="tex2html105"
|
|
HREF="node54.html">7.5 Debugger Commands.</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html106"
|
|
HREF="node54.html#SECTION00085100000000000000">7.5.1 break [line | file:line | function | file:function]</A>
|
|
<LI><A NAME="tex2html107"
|
|
HREF="node54.html#SECTION00085200000000000000">7.5.2 clear [line | file:line | function | file:function ]</A>
|
|
<LI><A NAME="tex2html108"
|
|
HREF="node54.html#SECTION00085300000000000000">7.5.3 continue</A>
|
|
<LI><A NAME="tex2html109"
|
|
HREF="node54.html#SECTION00085400000000000000">7.5.4 finish</A>
|
|
<LI><A NAME="tex2html110"
|
|
HREF="node54.html#SECTION00085500000000000000">7.5.5 delete [n]</A>
|
|
<LI><A NAME="tex2html111"
|
|
HREF="node54.html#SECTION00085600000000000000">7.5.6 info [break | stack | frame | registers ]</A>
|
|
<LI><A NAME="tex2html112"
|
|
HREF="node54.html#SECTION00085700000000000000">7.5.7 step</A>
|
|
<LI><A NAME="tex2html113"
|
|
HREF="node54.html#SECTION00085800000000000000">7.5.8 next</A>
|
|
<LI><A NAME="tex2html114"
|
|
HREF="node54.html#SECTION00085900000000000000">7.5.9 run</A>
|
|
<LI><A NAME="tex2html115"
|
|
HREF="node54.html#SECTION000851000000000000000">7.5.10 ptype variable </A>
|
|
<LI><A NAME="tex2html116"
|
|
HREF="node54.html#SECTION000851100000000000000">7.5.11 print variable</A>
|
|
<LI><A NAME="tex2html117"
|
|
HREF="node54.html#SECTION000851200000000000000">7.5.12 file filename</A>
|
|
<LI><A NAME="tex2html118"
|
|
HREF="node54.html#SECTION000851300000000000000">7.5.13 frame</A>
|
|
<LI><A NAME="tex2html119"
|
|
HREF="node54.html#SECTION000851400000000000000">7.5.14 set srcmode</A>
|
|
<LI><A NAME="tex2html120"
|
|
HREF="node54.html#SECTION000851500000000000000">7.5.15 ! simulator command</A>
|
|
<LI><A NAME="tex2html121"
|
|
HREF="node54.html#SECTION000851600000000000000">7.5.16 quit.</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html122"
|
|
HREF="node55.html">7.6 Interfacing with XEmacs.</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html123"
|
|
HREF="node56.html">8. Other Processors</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html124"
|
|
HREF="node57.html">8.1 The Z80 and gbz80 port</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html125"
|
|
HREF="node58.html">9. Support</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html126"
|
|
HREF="node59.html">9.1 Reporting Bugs</A>
|
|
</UL>
|
|
<LI><A NAME="tex2html127"
|
|
HREF="node60.html">10. Acknowledgments</A>
|
|
<LI><A NAME="tex2html128"
|
|
HREF="node61.html">Index</A>
|
|
<LI><A NAME="tex2html129"
|
|
HREF="node62.html">About this document ...</A>
|
|
</UL>
|
|
<!--End of Table of Child-Links-->
|
|
<BR><HR>
|
|
<ADDRESS>
|
|
<I>Johan Knol</I>
|
|
<BR><I>2001-07-13</I>
|
|
</ADDRESS>
|
|
</BODY>
|
|
</HTML>
|