Next:
Contents
Contents
Index
SDCC Compiler User Guide
SDCC 2.6.0
$Date: 2006-07-10 14:34:39 -0700 (Mon, 10 Jul 2006) $
$Revision: 4289 $
Contents
1. Introduction
1.1 About SDCC
1.2 Open Source
1.3 Typographic conventions
1.4 Compatibility with previous versions
1.5 System Requirements
1.6 Other Resources
1.7 Wishes for the future
2. Installing SDCC
2.1 Configure Options
2.2 Install paths
2.3 Search Paths
2.4 Building SDCC
2.4.1 Building SDCC on Linux
2.4.2 Building SDCC on OSX 2.x
2.4.3 Cross compiling SDCC on Linux for Windows
2.4.4 Building SDCC on Windows
2.4.5 Building SDCC using Cygwin and Mingw32
2.4.6 Building SDCC Using Microsoft Visual C++ 6.0/NET (MSVC)
2.4.7 Building SDCC Using Borland
2.4.8 Windows Install Using a ZIP Package
2.4.9 Windows Install Using the Setup Program
2.4.10 VPATH feature
2.5 Building the Documentation
2.6 Reading the Documentation
2.7 Testing the SDCC Compiler
2.8 Install Trouble-shooting
2.8.1 If SDCC does not build correctly
2.8.2 What the ''./configure'' does
2.8.3 What the ''make'' does
2.8.4 What the ''make install'' command does.
2.9 Components of SDCC
2.9.1 sdcc - The Compiler
2.9.2 sdcpp - The C-Preprocessor
2.9.3 as
xxxx
, aslink, link-
xxx
- The Assemblers and Linkage Editors
2.9.4 s51 - The Simulator
2.9.5 sdcdb - Source Level Debugger
3. Using SDCC
3.1 Compiling
3.1.1 Single Source File Projects
3.1.2 Projects with Multiple Source Files
3.1.3 Projects with Additional Libraries
3.1.4 Using sdcclib to Create and Manage Libraries
3.2 Command Line Options
3.2.1 Processor Selection Options
3.2.2 Preprocessor Options
3.2.3 Linker Options
3.2.4 MCS51 Options
3.2.5 DS390 / DS400 Options
3.2.6 Z80 Options
3.2.7 Optimization Options
3.2.8 Other Options
3.2.9 Intermediate Dump Options
3.2.10 Redirecting output on Windows Shells
3.3 Environment variables
3.4 Storage Class Language Extensions
3.4.1 MCS51/DS390 Storage Class Language Extensions
3.4.1.1 data / near
3.4.1.2 xdata / far
3.4.1.3 idata
3.4.1.4 pdata
3.4.1.5 code
3.4.1.6 bit
3.4.1.7 sfr / sfr16 / sfr32 / sbit
3.4.1.8 Pointers to MCS51/DS390 specific memory spaces
3.4.1.9 Notes on MCS51 memory layout
3.4.2 Z80/Z180 Storage Class Language Extensions
3.4.2.1 sfr (in/out to 8-bit addresses)
3.4.2.2 banked sfr (in/out to 16-bit addresses)
3.4.2.3 sfr (in0/out0 to 8 bit addresses on Z180/HD64180)
3.4.3 HC08 Storage Class Language Extensions
3.4.3.1 data
3.4.3.2 xdata
3.5 Absolute Addressing
3.6 Parameters & Local Variables
3.7 Overlaying
3.8 Interrupt Service Routines
3.8.1 General Information
3.8.2 MCS51/DS390 Interrupt Service Routines
3.8.3 HC08 Interrupt Service Routines
3.8.4 Z80 Interrupt Service Routines
3.9 Enabling and Disabling Interrupts
3.9.1 Critical Functions and Critical Statements
3.9.2 Enabling and Disabling Interrupts directly
3.9.3 Semaphore locking (mcs51/ds390)
3.10 Functions using private register banks(mcs51/ds390)
3.11 Startup Code
3.11.1 MCS51/DS390 Startup Code
3.11.2 HC08 Startup Code
3.11.3 Z80 Startup Code
3.12 Inline Assembler Code
3.12.1 A Step by Step Introduction
3.12.2 Naked Functions
3.12.3 Use of Labels within Inline Assembler
3.13 Interfacing with Assembler Code
3.13.1 Global Registers used for Parameter Passing
3.13.2 Assembler Routine (non-reentrant)
3.13.3 Assembler Routine (reentrant)
3.14 int (16 bit) and long (32 bit) Support
3.15 Floating Point Support
3.16 Library Routines
3.16.1 Compiler support routines (_gptrget, _mulint etc.)
3.16.2 Stdclib functions (puts, printf, strcat etc.)
3.16.2.1 <stdio.h>
3.16.3 Math functions (sinf, powf, sqrtf etc.)
3.16.3.1 <math.h>
3.16.4 Other libraries
3.17 Memory Models
3.17.1 MCS51 Memory Models
3.17.1.1 Small, Medium and Large
3.17.1.2 External Stack
3.17.2 DS390 Memory Model
3.18 Pragmas
3.19 Defines Created by the Compiler
4. Notes on supported Processors
4.1 MCS51 variants
4.1.1 pdata access by SFR
4.1.2 Other Features available by SFR
4.2 DS400 port
4.3 The Z80 and gbz80 port
4.4 The HC08 port
4.5 The PIC14 port
4.5.1 C code and 14bit PIC code page and RAM banks
4.5.2 Creating a device include file
4.5.3 Interrupt code
4.5.4 Linking and assembling
4.5.5 Command-line options
4.5.6 The library
4.5.6.1 error: missing definition for symbol ''__gptrget1''
4.5.6.2 Processor mismatch in file ''XXX''.
4.5.7 Known bugs
4.5.7.1 initialized data
4.6 The PIC16 port
4.6.1 Global Options
4.6.2 Port Specific Options
4.6.2.1 General Options
4.6.2.2 Optimization Options
4.6.2.3 Linking Options
4.6.2.4 Debugging Options
4.6.3 Enviromental Variables
4.6.4 Preprocessor Macros
4.6.5 Directories
4.6.6 Pragmas
4.6.7 Header Files
4.6.8 Libraries
Building the libraries
4.6.9 Memory Models
4.6.10 Stack
4.6.11 Functions
4.6.12 Function return values
4.6.13 Interrupts
4.6.14 Generic Pointers
4.6.15 PIC16 C Libraries
4.6.15.1 Standard I/O Streams
4.6.15.2 Printing functions
4.6.15.3 Signals
4.6.16 PIC16 Port - Tips
4.6.16.1 Stack size
5. Debugging
5.1 Debugging with SDCDB
5.1.1 Compiling for Debugging
5.1.2 How the Debugger Works
5.1.3 Starting the Debugger SDCDB
5.1.4 SDCDB Command Line Options
5.1.5 SDCDB 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
5.1.6 Interfacing SDCDB with DDD
5.1.7 Interfacing SDCDB with XEmacs
6. TIPS
6.1 Porting code from or to other compilers
6.2 Tools included in the distribution
6.3 Documentation included in the distribution
6.4 Related open source tools
6.5 Related documentation / recommended reading
6.6 Some Questions
7. Support
7.1 Reporting Bugs
7.2 Requesting Features
7.3 Submitting patches
7.4 Getting Help
7.5 ChangeLog
7.6 Subversion Source Code Repository
7.7 Release policy
7.8 Examples
7.9 Quality control
7.10 Use of SDCC in Education
8. SDCC Technical Data
8.1 Optimizations
8.1.1 Sub-expression Elimination
8.1.2 Dead-Code Elimination
8.1.3 Copy-Propagation
8.1.4 Loop Optimizations
8.1.5 Loop Reversing
8.1.6 Algebraic Simplifications
8.1.7 'switch' Statements
8.1.8 Bit-shifting Operations.
8.1.9 Bit-rotation
8.1.10 Nibble and Byte Swapping
8.1.11 Highest Order Bit / Any Order Bit
8.1.12 Higher Order Byte / Higher Order Word
8.1.13 Peephole Optimizer
8.2 ANSI-Compliance
8.3 Cyclomatic Complexity
8.4 Retargetting for other Processors
9. Compiler internals
9.1 The anatomy of the compiler
9.2 A few words about basic block successors, predecessors and dominators
10. Acknowledgments
Alphabetical index
Index
2008-03-03