What you need before you start installation of SDCC ? A C Compiler, not just any C Compiler, gcc to be exact, you can get adventurous and try another compiler , I HAVEN'T tried it. GCC is free , and is available for almost all major platforms, if you are using linux you probably already have it, if you are using Windows 95/NT go to www.cygnus.com and download CYGWIN32 you will need the full development version of their tool (full.exe), follow their instructions for installation (this is also free and is very easy to install), Windows 95/NT users be aware that the compiler runs substantially slower on the Windows platform, I am not sure why.
After you have installed gcc you are ready to build the compiler (sorry no binary distributions yet). SDCC is native to Linux but can be ported to any platform on which GCC is available . Extract the source file package (.zip or .tar.gz) into some directory , which we shall refer to as SDCCDIR from now on.
SDCC relies on this component to do all the memory management, this excellent package is copyrighted by Jans J Boehm(firstname.lastname@example.org) and Alan J Demers but can be used with minimum restrictions. The GC source will be extracted into the directory SDCCDIR/gc.
The preprocessor is extracted into the directory SDCCDIR/cpp, it is a modified version of the GNU preprocessor.
This is retargettable assembler & linkage editor, it was developed by Alan Baldwin, John Hartman created the version for 8051, and I (Sandeep) have some enhancements and bug fixes for it to work properly with the SDCC. This component is extracted into the directory SDCCDIR/asxxxx.
This is the actual compiler, it uses gc and invokes the assembler and linkage editor. All files with the prefix SDCC are part of the compiler and is extracted into the the directory SDCCDIR.
Version 2.1.8 onwards contains s51 a freeware , opensource simulator developed by Daniel Drotos <email@example.com>. The executable is built as part of build process, for more information visit Daniel's website at <http://mazsola.iit.uni-miskolc.hu/~drdani/embedded/s51/>.
SDCDB is the companion source level debugger . The current version of the debugger uses Daniel's Simulator S51, but can be easily changed to use other simulators.
After the package is extracted (Windows 95/NT users start CYGWIN shell), change to the directory where you extracted the package and give the command.
This is a bash shell script, it will compile all the above mentioned components and install the executables into the directory SDCCDIR/bin make sure you add this directory to your PATH environment variable. This script will also compile all the support routines ( library routines ) using SDCC. The support routines are all developed in C and need to be compiled.
The distribution method from Version 2.1.8a has been changed to be conforment with the "autoconf" utility. The source is now distributed as sdcc-<version number>.tar.gz format , instead of the older .zip format. The steps for installation are as follows.
This is usually done by the following command "gunzip -c sdcc-<version number>.tar.gz | tar -xv -"
The configure command has several options the most commonly used option is --prefix=<directory name>, where <directory name> is the final location for the sdcc executables and libraries, (default location is /usr/local). The installation process will create the following directory structure under the <directory name> specified.
bin/ - binary exectables (add to PATH environment variable) share/ sdcc51inc/ - include header files sdcc51lib/ - small/ - Object & Library files for small model library large/ - Object & library files for large model library
will create configure the compiler to be installed in directory /usr/local/bin.
After configuration step issue the command
This will compile the compiler
Will install the compiler and libraries in the appropriate directories.
How to install SDCC from source on a Windows 95 or Windows NT 4 system
This document describes how to install SDCC on a Win 95 or Win NT 4 system.
These instructions probably work for Win 98 as well, but have not been
tested on that platform.
There are lots of little differences between UNIX and the Win32 Cygnus
environment which make porting more difficult than it should be. If
you want the details, please contact me. Otherwise just follow these
1. Install the Cygnus Software
Go to http://sourceware.cygnus.com/cygwin. Cygnus provides a UNIX like
environment for Win 32 systems. Download "full.exe" and install. You
MUST install it on your C drive. "full.exe" contains a shell AND many
common UNIX utilities.
2. Download and Extract the Latest SDCC
The latest version can be found at
It can be uncompressed with winzip.
3. Start a Cygnus Shell
There should be an entry in the Start Menu for Cygnus. Invoke the shell.
This gives you a UNIX like environment. FROM THIS POINT ON, DIRECTORIES
MUST BE SPECIFIED WITH FORWARD SLASHES (/) NOT THE DOS STYLE BACK
SLASHES (\) BECAUSE THIS IS WHAT UNIX EXPECTS. -
ex. "\winnt" would be "/winnt" under the shell.
4. Change Directory to Where SDCC was extracted (referred to as INSTALLDIR)
ex. cd /sdcc218Da. If you extracted to a drive OTHER THAN C, the drive
must be specified as part of the path. For example, if you extracted to
your "g drive", type the following: "cd //g/mydir". You must use "//"
to specify the drive.
5. Make Dirs Which are Automatically Made During the UNIX Installation
From the INSTALLDIR,
mkdir -p bin (not a typo, just "bin")
mkdir -p /bin
mkdir -p /usr/local/bin
mkdir -p /usr/local/share
mkdir -p /usr/local/share/sdcc51lib
mkdir -p /usr/local/share/sdcc51inc
mkdir -p /tmp
(When a path from the root directory is specified WITHOUT a drive, the
drive defaults to c. For example /michael/newuser => c:\michael\newuser)
6. Add Programs to /bin Expected by the Installation Process
- Look at your path: echo $PATH
One of the fields is the diretory with the CYGNUS programs.
- cd to the directory found above. You may have to fiddle with the
case (upper or lower) here because the PATH is SHOWN as all upper
case, but is actually mixed. To help you along, you may type
a letter or 2 followed by the escape key. The shell will fill
out the remaining letters IF THEY describe a unique directory.
If you have problems here, cd one directory and type "ls". "ls"
is the equivalent of "dir/w".
- Copy the following:
cp sh.exe /bin
cp pwd.exe /bin
cp echo.exe /bin
7. Go back to the INSTALLDIR
ex. cd //d/sdcc218Da
8. Run the configure Program
The "./" is important because your current directory is NOT in your path.
Under DOS, your current directory was implicitly always the first entry
in your path.
9. Run make
This process takes quite some time under Win 32.
10. Install the Newly Built Software
This will partially install the software into the /usr/local directories
created in step 5. What it actually doing is copying the .c, .h and
library files to directories under /usr/local/share.
It will NOT be able to install the actual programs (binaries) because
it does not know programs on Win32 systems have ".exe" extensions.
For example, it tries to install sdcc instead of sdcc.exe.
After the automated part is finished, you must manually copy the binaries:
cd bin (This is the bin directory in your INSTALLDIR)
cp * /usr/local/bin
11. Make sure /usr/local/bin is in Your PATH
You may add c:\usr\local\bin to your path however your Win32 system allows. For
example you may add it to the PATH statement in autoexec.bat.
Good luck. If you have any questions send them to me or post them
to the list.