SDCC - Small Device C Compiler

What is SDCC ?

SDCC is a Freeware, retargettable, optimizing ANSI - C compiler that targets the Intel 8051, Maxim 80DS390 and the Zilog Z80 based MCUs. Work is in progress on supporting the Motorola 68HC08 as well as Microchip PIC14 and PIC16 series. The entire source code for the compiler is distributed under GPL.

Some of the features include:

  • ASXXXX and ASLINK, a Freeware, retargettable assembler and linker.
  • extensive MCU specific language extensions, allowing effective use of the underlying hardware.
  • a host of standard optimizations such as global sub expression elimination, loop optimizations (loop invariant, strength reduction of induction variables and loop reversing ), constant folding and propagation, copy propagation, dead code elimination and jump tables for 'switch' statements.
  • MCU specific optimisations, including a global register allocator.
  • adaptable MCU specific backend that should be well suited for other 8 bit MCUs
  • independent rule based peep hole optimizer.
  • a full range of data types: char (8 bits, 1 byte), short (16 bits, 2 bytes), int (16 bits, 2 bytes), long (32 bit, 4 bytes) and float (4 byte IEEE).
  • the ability to add inline assembler code anywhere in a function.
  • the ability to report on the complexity of a function to help decide what should be re-written in assembler.
  • a good selection of automated regression tests.

SDCC also comes with the source level debugger SDCDB, using the current version of Daniel's s51 simulator.

SDCC was written by Sandeep Dutta and released under a GPL license. Since its initial release there have been numerous bug fixes and improvements. As of December 1999, the code was moved to SourceForge where all the "users turned developers" can access the same source tree. SDCC is constantly being updated with all the users' and developers' input.

AVR and gbz80 ports are no longer maintained.


February 25rd: SDCC 2.4.0 released.

What Platforms are Supported ?

Linux and Microsoft Windows are the primary targets, although SDCC is regularly compiled on the Sourceforge Compile Farm which includes Mac OS X, Alpha, Sparc, and AMD Opteron machines.

SDCC will compile natively on Linux using using gcc. Windows 9x/NT/2000/XP users are recommended to use Cygwin ( or may try the unsupported Borland C compiler or Microsoft Visual C++ build scripts. The nightly builds are made by cross compiling using mingw32 from a Linux host.

Downloading SDCC

SDCC 2.4.0 was released on February 25rd, 2004.

See the Sourceforge download page for the last released version including source and binary packages for Linux/x86, Mac OS X, and Windows.

SDCC is always under active development. Please consider downloading one of the nightly snapshots if you have run across a bug, or if the above release is more than two months old.

Debian packages (many thanks to Aurelien Jarno):

RPM packages (thanks to Mandrake, Conectiva and PLD Linux distributions):

The latest development source code can be accessed using CVS. The following will fetch the latest sources:
cvs login
The password is empty and pressing [ENTER] will get you in.
cvs -z3 co sdcc
... will create the sdcc directory in your current directory and place all downloaded code there. You can browse CVS here .

SourceForge has further documentation on accessing CVS here.

Before reporting a bug, please check your SDCC version and build date using the -v option, and be sure to include the full version string in your bug report. For example:

sdcc/bin > sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic14/TININative/xa51 2.3.8 (Feb 10 2004) (UNIX)

Support for SDCC

SDCC and the included support packages come with fair amounts of documentation and examples. When they aren't enough, you can find help in the places listed below. Here is a short check list of tips to greatly improve your chances of obtaining a helpful response.

  1. Attach the code you are compiling with SDCC. It should compile "out of the box". Snippets must compile and must include any required header files, etc. Incomplete information will hamper your chance of a timely response.
  2. Specify the exact command you use to run SDCC, or attach your Makefile.
  3. Specify the SDCC version (type "sdcc -v"), your platform and operating system.
  4. Provide an exact copy of any error message or incorrect output.

Please attempt to include these 4 important parts, as applicable, in all requests for support or when reporting any problems or bugs with SDCC. Though this will make your message lengthy, it will greatly improve your chance that SDCC users and developers will be able to help you. Some SDCC developers are frustrated by bug reports without code provided that they can use to reproduce and ultimately fix the problem, so please be sure to provide sample code if you are reporting a bug!

Who is SDCC ?

SDCC has had help from a number of external sources, including:

Past news

September 29, 2001 - Version 2.3.0 released

Version 2.3.0 is now available. This is the first official release in some time, and includes many bug fixes and significantly improved Z80 support.

July 11, 2001 - Winbin updates

Recently, Karl Bongers has put together a beta for win32 using pre-built cygwin and Borland bins. You can download it here. Remember this is a beta build and will change from time to time. Updates will be posted in the Download section as they become available. There will be a link in the Download section for this and all future builds. Please *DO NOT* email Karl directly with problems. Any questions or fixes you have can be directed to the mailing list, see the link in the Support section below.

If you run a win32 box I recommend installing Karl's build, if only for the ease of install. If you are a native Linux user, use the CVS tree. Completely remove the old source dir and do a fresh checkout.

As always, there is lots going on in CVS. There are a LOT of changes to the documentation. This has been and always will be a short side of OSS, SDCC included. The developers have added a lot of new command line switches and made changes to the old ones. The mcs51 header files have been removed and replaced with a common one. RTFM and then ask questions. The Z80 port has been updated as well. Scott has fallen off the face of the earth and has not been heard from for a while ;-) We'll hear of his adventures when he returns. Meanwhile the PIC port has remained static. Michael has been working on an automated build for SDCC. If you download the source files, this should help tremendously.

There are a few bugs left that are keeping the developers from releasing v2.2.2. This has been said now for a long time now. You just can't rush quality ;-) An official release should happen in the next few months.

Special thanks to Johan Knol for keeping the ball rolling while everyone is working their paying jobs.

April 24, 2001 - Notes

There has been a lot of updates to v2.2.2 CVS lately. v2.2.1 is comparatively old and we recommend you download a binary build from the OKR or update your sources from CVS. Mitja Kukovec has sent the mailing list some short instructions on installing Cygwin on a Win32 box, the link to the text is in the SUPPORT section.

February 20, 2001 - Pic Port

Scott has been making great strides on the pic port. There are a lot of issues with bringing his work into other branches of SDCC, so you will not see all of the features of his port in the avr and mcs51 trees. Scott has been working on generating intermediate 'pcode' that will be used for code optimizations and linker features. This is a major step and there are bound to be problems... on the cutting edge you might get cut every once in a while. This has not been implemented in any of the other trees, but if he pulls this off, you will see better and more flexible code come out of SDCC. We think it's just a matter of time ;-) Tip-o-the-hat to Scott.

Sandeep's daytime job keeps him from doing as much as he would like, but he pops in from time to time with fixes and other contributions. Everyone involved with the project has been very active lately, we are a lot closer to an official 2.2.2 release. As always, the above can be had from cvs. It would be a good idea to do a fresh check-out from cvs rather than an update as a LOT of things have changed. Binary builds from recent cvs sources can be downloaded from the OKR .

January 25, 2001 -- SDCC v2.2.2 is still in CVS

Due to numerous additions to SDCC to support the Dallas DS'390, Version 2.2.2 has been delayed until more bugs are squashed. Kevin and Johan are working on them all the time ;-) Lots of help from the user and development mailing lists too.

Some (if not all) of SDCC users will be glad to know that Scott Dattalo has been porting SDCC to the 14bit versions of the Microchip PIC controller. His port is still in its early stages and needs a lot of work but it does compile programs. His code has been committed to cvs on sourceforge and is included when you update your cvs directories.

SDCC v2.2.1 is out!!! Check it out in the download section

This is a milestone release for the development group.
New stuff includes:

  • bug fixes (always bug fixes)
  • better support for the Dallas '390, flat memory model is a lot better than before, not perfect.
  • changes to the assembler
  • better documentation
  • faster compile times
  • and more...

There are more new command line switches to SDCC.. PAY ATTENTION! Read the documentation!

There have been additions to the SDCC developer team, we would like to welcome

Kevin Vigor and Johan Knol
And now... Scott Dattalo

Previous News

The 8051 Web Ring webring icon Links and More!

This Site Hosted by



Last updated: Friday, May 30, 2003