is a multi-platform, multi-target C cross compiler that was
originally written by Sandeep Dutta and has been further improved by
a number of
SDCC is a retargetable, 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, retargetable 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.
The SDCC package
components include the sdcc compiler, the sdcpp C preprocessor,
assemblers and linkers for the supported target processors,
a simulator for the 8051 processor, the sdcdb source debugger
and the packihx Intel hex file packing tool.
Version 2.8.0 of SDCC was
on March 30, 2008, it includes the following changes:
added predefined preprocessor macro SDCC_REVISION holding SDCC's subversion revision number
added preprocessor macros SDCC_PARMS_IN_BANK1, SDCC_FLOAT_REENT and SDCC_INT_LONG_REENT
sdcpp synchronized with GNU cpp 4.2.3
multiple infiles for sdcclib
added option --acall-ajmp: replaces lcall/ljmp with acall/ajmp
added support for many PIC devices
sdcc executables on Mac OS X are built as universal binaries,
so that they can run on both ppc and i386 Mac OS X
added --Werror command line option
Windows installer enhancements
generation of cdb debug info for as-z80 and link-z80
generation of cdb debug info for variables in pdata for mcs51
Tail call optimization for functions that take no parameters on Z80
Improved multiplication of unsigned chars on Z80
ISO/IEC 9899 standard compliant integer promotion of integer function arguments
if --std-cXX is defined in command line
Numerous feature requests and bug fixes are included as well.
downloaded SDCC 2.8.0 as a .tar.bz2 file onto a machine running
Ubuntu 7.04 "Feisty Fawn".
The file was uncompressed, and untared. The configure script
was run and one package dependency issue was resolved by installing
The second run of configure worked, as did the make
and make install steps.
Running sdcc -v produced the expected result:
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.8.0 #5117 (Apr 1 2008) (UNIX).
test cases were compiled and assembled using the default MCS51 target,
then using the -mz80 switch to produce output for a
Z80 processor. All of the tests seemed to work, and produced
readable Intel Hex files that appear to be suitable for movement
to a development platform. Your author recognized
the hex C30001 at the beginning of the code as a Z80 jump instruction,
activate the wayback machine.
This may be a long way from developing a working embedded application
on real hardware using SDCC, it does show that the system builds
and is stable enough to consider using as a development platform.
microprocessors have been around since the
late 1970s, newer versions are still being produced.
PIC microcontroller family and the Atmel
family are currently very popular microcontroller platforms.
The AVR is the processor used in the recently
open hardware microprocessor design, although that uses a
different development system.
SDCC allows microprocessor applications to be written in C,
and that greatly expands the range of problems that can be
solved by small embedded machines. The field of C cross-compilers
has traditionally been dominated by proprietary Windows-based
software. SDCC allows one to develop embedded microprocessor
designs using open-source software under Linux.
to post comments)