zgba 站群
SDCC – Small Device C Compiler

SDCC – Small Device C Compiler

SDCC is a retargettable, optimizing Standard C (ANSI C89, ISO C99, ISO C11, ISO C23) compiler suite that targets the Intel MCS51 based microprocessors (8031, 8032, 8051, 8052, etc.), Maxim (formerly Dallas) DS80C390 variants, Freescale (formerly Motorola) HC08 based (hc08, s08), Zilog Z80 based MCUs (Z80, Z80N, Z180, SM83, Rabbit 2000, 2000A, 3000A, 4000, SM83, TLCS-90, eZ80, R800), Padauk (pdk14, pdk15), STMicroelectronics STM8, MOS 6502 and WDC 65C02. Work is in progress on supporting the Rabbit 5000, 6000, Padauk pdk13 and the f8 and f8l targets; Microchip PIC16 and PIC18 targets are unmaintained. SDCC can be retargeted for other microprocessors.

SDCC suite is a collection of several components derived from different sources with different FOSS licenses. SDCC compiler suite include:

SDCC was originally 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.

2026-06-22: SDCC 4.6.0 released.

A new release of SDCC, the portable optimizing compiler for STM8, MCS-51, DS390, HC08, S08, Z80, Z180, Rabbit, R800, SM83, eZ80 in Z80 mode, Z80N, TLCS-90, MOS 6502, WDC 65C02, Padauk and PIC microprocessors is now available. (http://sdcc.sourceforge.net). Sources, documentation and binaries for GNU/Linux amd64, Windows x86 and amd64, macOS amd64 are available.

SDCC 4.6.0 New Feature List:

2026-06-14: SDCC 4.6.0 RC2 released.

SDCC 4.6.0 Release Candidate 2 source, doc and binary packages for amd64 GNU/Linux, amd64 Windows, and amd64 macOS are available in corresponding folders at:

          http://sourceforge.net/projects/sdcc/files/.

2026-05-28: SDCC 4.6.0 RC1 released.

SDCC 4.6.0 Release Candidate 1 source, doc and binary packages for amd64 GNU/Linux, amd64 Windows, and amd64 macOS are available in corresponding folders at:

          http://sourceforge.net/projects/sdcc/files/.

2025-10-15: SDCC got funding.

SDCC is primarily developed by unpaid volunteer work; though once in a while there was some outside support, in particular by university employees being allowed to work on SDCC a bit during paid time, and SDCC developers receiving hardware samples from microcontroller vendors. However, sometimes the limitations of this are felt. In particular when I’ve had a few free hours to work on SDCC, started working on a feature or bug, but was not able to finish the work during the time I had, or simply was not able to even fully track down the cause of the bug. And when it took a long time until I could work again on that feature or bug, it took extra time or effort to get into it again. Sometimes I would instead start work on another aspect of SDCC instead. Having funding available for working on SDCC is IMO really helpful in these situations - instead of having to stop work on SDCC to go back to other paid work, I can just keep working on the feature or bug, since this then is paid work. SDCC developers have been applying for funding for SDCC projects, and we are happy to announce that two important such applications succeeded recently.

The NGI0 Commons Fund donates to improve SDCC support for various target hardware, as well as implement machine-independent improvements to make SDCC more competitive vs. non-free compilers. Hardware-specific improvements planned include improving support for Padauk’s popular low-cost microcontrollers, improving support for the Rabbit microcontrollers common in older IoT devices, and improving support for Toshiba TLCS microcontrollers. The focus for machine-independent improvements will be in enhancing support for recent ISO C standards, an optimization to reduce memory usage for local variables, and implementing a link-time optimization to optimize out unused functions and objects. The latter is the one feature most-requested by SDCC users in recent years. This project in done jointly by five SDCC developers.

The Sovereign Tech Fund comissioned work on improving SDCC for safety and security of embedded firmware. We will improve support for aspects of modern C standards and dialects relevant to safety and security, get SDCC ready for post-quantum cryptography, work on mitigations for potential side-channel attacks and improve the reliability of SDCC via extended testing also covering less-commonly used command-line parameter combinations. This project is done by one SDCC developer.

We can imagine all this coming together e.g. when writing firmware for an IoT device based on an eZ80 or Rabbit 4000 SoC. The SDCC user writing this firmware will benefit from the improved support for the target architecture, modern C features for efficiency and convenience, general high level optimizations (all part of the NGI0 Commons project), modern C features relevant for safety and security, to help avoid bugs in the user-written code, efficient side-channel-free code generated for modern cryptography algorithms (all part of the STF project). And thanks to improved testing and fixed compiler bugs, the firmware will compile and work very reliably (depending on the details part of the STF or the NGI0 project).

January 28th, 2025: SDCC 4.5.0 released.

A new release of SDCC, the portable optimizing compiler for STM8, MCS-51, DS390, HC08, S08, Z80, Z180, Rabbit, R800, SM83, eZ80 in Z80 mode, Z80N, TLCS-90, MOS 6502, WDC 65C02, Padauk and PIC microprocessors is now available. (http://sdcc.sourceforge.net). Sources, documentation and binaries for GNU/Linux amd64, Windows x86 and amd64, macOS amd64 are available.

SDCC 4.5.0 New Feature List:

GNU/Linux on amd64, GNU/Linux on x86, Microsoft Windows on amd64, and macOS on amd64 are the primary, so called “officially supported” platforms.

SDCC compiles natively on GNU/Linux and macOS using gcc. Windows release and snapshot builds are made by cross compiling to mingw32 on a Linux host.

SDCC is known to also work on at least GNU/Linux on aarch64, GNU/Linux on ppc64, FreeBSD on aarch64.

Windows users can also try Cygwin (https://www.cygwin.com/) or may try the unsupported Microsoft Visual C++ build scripts.

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

Major Linux distributions take care of SDCC installation packages themselves and you will find SDCC in their repositories. Unfortunately SDCC packages included in Linux disributions are often outdated. In this case users are encouraged to compile the latest official SDCC release or a recent snapshot build by themselves or download the pre-compiled binaries from

          Sourceforge download page.

In addition, SDCC should compile on any modern Unix-like OS; the following are included in automated regression testing, like the release packages:

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.

The latest development source code can be accessed using Subversion. The following will fetch the latest sources:

svn checkout svn://svn.code.sf.net/p/sdcc/code/trunk/sdcc sdcc

… will create the sdcc directory in your current directory and place all downloaded code there. You can browse 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)

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.

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!

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

View original article