⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdccman.txt

📁 很少见的源码公开的msc51和z80的c编译器。
💻 TXT
📖 第 1 页 / 共 5 页
字号:
SDCC Compiler User GuideTable of ContentsIntroduction    About SDCC    Open Source    Typographic conventions    Compatibility with previous versions    System Requirements    Other Resources    Wishes for the futureInstallation    Linux/Unix Installation    Windows Installation        Windows Install Using a Binary Package        Windows Install Using Cygwin    Testing out the SDCC Compiler    Install Trouble-shooting        SDCC cannot find libraries or header files.        SDCC does not compile correctly.        What the ./configure does        What the make does.        What the make install command does.    Additional Information for Windows Users        Getting started with Cygwin        Running SDCC as Native Compiled Executables    SDCC on Other Platforms    Advanced Install Options    Components of SDCC        sdcc - The Compiler        sdcpp (C-Preprocessor)        asx8051, as-z80, as-gbz80, aslink, link-z80, link-gbz80 (The Assemblers and Linkage Editors)        s51 - Simulator        sdcdb - Source Level DebuggerUsing SDCC    Compiling        Single Source File Projects        Projects with Multiple Source Files        Projects with Additional Libraries    Command Line Options        Processor Selection Options        Preprocessor Options        Linker Options        MCS51 Options        DS390 Options        Optimization Options        Other Options        Intermediate Dump Options    MCS51/DS390 Storage Class Language Extensions        xdata        data        idata        bit        sfr / sbit    Pointers    Parameters & Local Variables    Overlaying    Interrupt Service Routines    Critical Functions    Naked Functions    Functions using private banks    Absolute Addressing    Startup Code    Inline Assembler Code    int(16 bit) and long (32 bit) Support    Floating Point Support    MCS51 Memory Models    DS390 Memory Models    Defines Created by the CompilerSDCC Technical Data    Optimizations        Sub-expression Elimination        Dead-Code Elimination        Copy-Propagation        Loop Optimizations        Loop Reversing        Algebraic Simplifications        'switch' Statements        Bit-shifting Operations.        Bit-rotation        Highest Order Bit        Peep-hole Optimizer    Pragmas    <pending: this is messy and incomplete> Library Routines    Interfacing with Assembly Routines        Global Registers used for Parameter Passing        Assembler Routine(non-reentrant)        Assembler Routine(reentrant)    External Stack    ANSI-Compliance    Cyclomatic ComplexityTIPS    Notes on MCS51 memory layoutRetargetting for other MCUs.SDCDB - Source Level Debugger    Compiling for Debugging    How the Debugger Works    Starting the Debugger    Command Line Options.    Debugger Commands.        break [line | file:line | function | file:function]        clear [line | file:line | function | file:function ]        continue        finish        delete [n]        info [break | stack | frame | registers ]        step        next        run        ptype variable         print variable        file filename        frame        set srcmode        ! simulator command        quit.    Interfacing with XEmacs.Other Processors    The Z80 and gbz80 portSupport    Reporting BugsAcknowledgments Introduction About SDCCSDCC is a Freeware, retargettable, optimizing ANSI-C compilerby Sandeep Dutta designed for 8 bit Microprocessors. Thecurrent version targets Intel MCS51 based Microprocessors(8051,8052,etc), Zilog Z80 based MCUs, and the Dallas DS80C390 variant.It can be retargetted for other microprocessors, supportfor PIC, AVR and 186 is under development. The entire sourcecode for the compiler is distributed under GPL. SDCC usesASXXXX & ASLINK, a Freeware, retargettable assembler & linker.SDCC has extensive language extensions suitable for utilizingvarious microcontrollers and underlying hardware effectively.In addition to the MCU specific optimizations SDCC also doesa host of standard optimizations like: global sub expression elimination,  loop optimizations (loop invariant, strength reduction  of induction variables and loop reversing),  constant folding & propagation,  copy propagation,  dead code elimination  jumptables for switch statements.For the back-end SDCC uses a global register allocation schemewhich should be well suited for other 8 bit MCUs. The peep hole optimizer uses a rule based substitution mechanismwhich is MCU independent. Supported data-types are: char (8 bits, 1 byte),  short and int (16 bits, 2 bytes),  long (32 bit, 4 bytes) float (4 byte IEEE). The compiler also allows inline assembler code to be embeddedanywhere in a function. In addition, routines developedin assembly can also be called.SDCC also provides an option (--cyclomatic) to report therelative complexity of a function. These functions can thenbe further optimized, or hand coded in assembly if needed.SDCC also comes with a companion source level debugger SDCDB,the debugger currently uses ucSim a freeware simulator for8051 and other micro-controllers. The latest version can be downloaded from [http://sdcc.sourceforge.net/]. Open SourceAll packages used in this compiler system are opensourceand freeware; source code for all the sub-packages (asxxxxassembler/linker, pre-processor) is distributed with thepackage. This documentation is maintained using a freewareword processor (LyX). This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version2, or (at your option) any later version. This program isdistributed in the hope that it will be useful, but WITHOUTANY WARRANTY; without even the implied warranty of MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE. See the GNU GeneralPublic License for more details. You should have receiveda copy of the GNU General Public License along with thisprogram; if not, write to the Free Software Foundation,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.In other words, you are welcome to use, share and improvethis program. You are forbidden to forbid anyone else touse, share and improve what you give them. Help stamp outsoftware-hoarding!  Typographic conventionsThroughout this manual, we will use the following convention.Commands you have to type in are printed in "sans serif".Code samples are printed in typewriter font. Interestingitems and new terms are printed in italicised type. Compatibility with previous versionsThis version has numerous bug fixes compared with the previousversion. But we also introduced some incompatibilities witholder versions. Not just for the fun of it, but to makethe compiler more stable, efficient and ANSI compliant.  short is now equivalent to int (16 bits), it used to be  equivalent to char (8 bits) the default directory where include, library and documention  files are stored is no in /usr/local/share char type parameters to vararg functions are casted to  int unless explicitly casted, e.g.:     char a=3;    printf ("%d %c\n", a, (char)a);   will push a as an int and as a char resp. option --regextend has been removed option --noreparms has been removed<pending: more incompatibilities?> System RequirementsWhat do you need before you start installation of SDCC? Acomputer, and a desire to compute. The preferred methodof installation is to compile SDCC from source using GNUgcc and make. For Windows some pre-compiled binary distributionsare available for your convenience. You should have someexperience with command line tools and compiler use. Other ResourcesThe SDCC home page at [http://sdcc.sourceforge.net/]is a great place to find distribution sets. You can alsofind links to the user mailing lists that offer help ordiscuss SDCC with other SDCC users. Web links to other SDCCrelated sites can also be found here. This document canbe found in the DOC directory of the source package as atext or HTML file. Some of the other tools (simulator andassembler) included with SDCC contain their own documentationand can be found in the source distribution. If you wantthe latest unreleased software, the complete source packageis available directly by anonymous CVS on cvs.sdcc.sourceforge.net. Wishes for the futureThere are (and always will be) some things that could bedone. Here are some I can think of:sdcc -c --model-large -o large _atoi.c (where large couldbe a different basename or a directory)char KernelFunction3(char p) at 0x340;If you can think of some more, please send them to the list.<pending: And then of course a proper index-table> Installation Linux/Unix Installation Download the source package, it will be named something  like sdcc-2.x.x.tgz. Bring up a command line terminal, such as xterm. Unpack the file using a command like: "tar -xzf sdcc-2.x.x.tgz",  this will create a sub-directory called sdcc with all  of the sources. Change directory into the main SDCC directory, for example  type: "cd sdcc". Type "./configure". This configures the package for compilation  on your system. Type "make". All of the source packages will compile, this  can take a while. Type "make install" as root. This copies the binary executables,  the include files, the libraries and the documentation  to the install directories. Windows Installation<pending: is this complete? where is borland, mingw>For installation under Windows you first need to pick betweena pre-compiled binary package, or installing the sourcepackage along with the Cygwin package. The binary packageis the quickest to install, while the Cygwin package includesall of the open source power tools used to compile the completeSDCC source package in the Windows environment. If you arenot familiar with the Unix command line environment, youmay want to read the section on additional information forWindows users prior to your initial installation. Windows Install Using a Binary Package Download the binary package and unpack it using your favorite  unpacking tool (gunzip, WinZip, etc). This should unpack  to a group of sub-directories. An example directory structure  after unpacking is: c:\usr\local\bin for the executables,  c:\usr\local\share\sdcc\include and c:\usr\local\share\sdcc\lib  for the include and libraries. Adjust your environment PATH to include the location of  the bin directory. For example, make a setsdcc.bat file  with the following: set PATH=c:\usr\local\bin;%PATH% When you compile with sdcc, you may need to specify the  location of the lib and include folders. For example,  sdcc -I c:\usr\local\share\sdcc\include -L c:\usr\local\share\sdcc\lib\small  test.c Windows Install Using Cygwin Download and install the cygwin package from the redhat  site[http://sources.redhat.com/cygwin/]. Currently,  this involved downloading a small install program which  then automates downloading and installing selected parts  of the package (a large 80M byte sized dowload for the  whole thing).  Bring up a Unix/Bash command line terminal from the Cygwin  menu. Follow the instructions in the preceding Linux/Unix installation  section. Testing out the SDCC CompilerThe first thing you should do after installing your SDCCcompiler is to see if it runs. Type "sdcc --version" atthe prompt, and the program should run and tell you theversion. If it doesn't run, or gives a message about notfinding sdcc program, then you need to check over your installation.Make sure that the sdcc bin directory is in your executablesearch path defined by the PATH environment setting (seethe Trouble-shooting section for suggestions). Make surethat the sdcc program is in the bin folder, if not perhapssomething did not install correctly.SDCC binaries are commonly installed in a directory arrangementlike this:+--------------------------------+-------------------------------------------+| /usr/local/bin                 | Holds executables(sdcc, s51, aslink, ...) |+--------------------------------+-------------------------------------------++--------------------------------+-------------------------------------------+| /usr/local/share/sdcc/lib      | Holds common C libraries                  |+--------------------------------+-------------------------------------------+| /usr/local/share/sdcc/include  | Holds common C header files               |

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -