SDCC - Small Device C Compiler

What is SDCC?

SDCC is a retargettable, optimizing ANSI - C compiler that targets the Intel 8051, Maxim 80DS390, Zilog Z80 and the Motorola 68HC08 based MCUs. Work is in progress on supporting the Microchip PIC16 and PIC18 series. SDCC is Free Open Source Software, distributed under GNU General Public License (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 optimizations, 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.


May 31st, 2007: Small Device C Compiler 2.7.0 released.

A new release of SDCC, the portable optimizing compiler for 8051, DS390, Z80, HC08, and PIC microprocessors is now available ( Sources, documentation and binaries compiled for x86 Linux, x86 MS Windows and PPC Mac OS X are available.

SDCC 2.7.0 Feature List:

  • enabled Z80 floating point support
  • ucSim simulator and SDCDB debugger native WIN32 port
  • added gnu readline support to sdcdb
  • removed deprecated pragmas
  • sdcpp preprocessor synchronized with GNU cpp 4.1.2
  • use memory buffers instead of temporary files
  • added --fdollars-in-identifier command line option
  • added --funsigned-char command line option
  • SDCC libraries are --std-c99 compatible
  • added --fverbose-asm command line option
  • Z80 assembler is now case sensitive
  • a default heap is added and automatically initialized
  • initialized variables with an absolute address are allocated and initialized
  • support for inline functions; consider it alpha quality

Numerous feature requests and bug fixes are included as well.

You can download the release from:

What Platforms are Supported?

Linux - x86, Microsoft Windows - x86 and Mac OS x - ppc are the primary, so called "officially supported" platforms.

SDCC compiles natively on Linux and Mac OS X using using gcc. Windows release and snapshot builds are made by cross compiling to mingw32 on a Linux host.

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.

Downloading SDCC

See the Sourceforge download page for the last released version including source and binary packages for Linux - x86, Microsoft Windows - x86 and Mac OS x - ppc.

SDCC is known to compile from the source code also on Linux - x86_64, Linux - Alpha, Linux - IBM Power5, and SUN Solaris - Sparc.

SDCC is always under active development. Please consider downloading one of the snapshot builds 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 Subversion. The following will fetch the latest sources:

svn co sdcc

... will create the sdcc directory in your current directory and place all downloaded code there. You can browse the Subversion repository here.

SourceForge has further documentation on accessing the Subversion repository 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

May 26th, 2007: SDCC 2.7.0 RC3 released.

SDCC 2.7.0 Release Candidate 3 source, doc and binary packages for x86 Linux, 32 bit Windows and ppc Mac OS X are available at: and

May 22nd, 2007: SDCC 2.7.0 RC2 released.

SDCC 2.7.0 Release Candidate 2 source, doc and binary packages for x86 Linux, 32 bit Windows and ppc Mac OS X are available at: and

May 21st, 2007: Circuit Cellar made the Sandeep's article "Anatomy of a Compiler A Retargetable ANSI-C Compiler" publically available

Sandeep's article "Anatomy of a Compiler A Retargetable ANSI-C Compiler", published in Circuit Cellar, issue 121, is now publicly available at:

May 10th, 2007: SDCC 2.7.0 RC1 released.

SDCC 2.7.0 Release Candidate 1 source, doc and binary packages for x86 Linux, 32 bit Windows and ppc Mac OS X are available at: and

Previous News

This site is hosted by Logo Valid XHTML 1.0 Transitional
Valid CSS!


Last updated:
August 21, 2007 01:46:32.