SDCC
- SDCC Compiler User Guide
- SDCC ASxxxx Assemblers and SDCC ASLINK Relocating Linker
- Installing SDCC on UBUNTU
- Small Device C Compiler (SDCC)
- How to Run an INSTALL.sh Script on Linux in 4 Easy Steps
Install on UbuntuEdit
*sdcc-src-20250923-15690.tar.bz2 *sudo apt install bzip2 *bzip2 -dv -f -k sdcc*.bz2 // tar -xjf ../sdcc-2.7.0-i386-unknown-linux2.5.tar.bz2 - (mark the "-xjf" instead of "xzf", x: eXtract files, j: bzip2, z: gZip, f: archive File name follows) *sdcc-src-20250923-15690.tar *tar -xvf sdcc*.tar *cd sdcc *sudo cp -r * /usr/local *cd /usr/local *sudo apt-get update *sudo apt-get upgrade *sudo apt-get install g++ *sudo apt-get install flex *sudo apt-get install libboost-graph-dev *sudo apt-get install bison *sudo apt-get install gputils *sudo apt-get install zlib1g-dev // configure: error: zlib library not found (zlib.h). *sudo ./configure --disable-dependency-tracking *sudo apt update *sudo apt install build-essential *sudo make *sdcc --version //SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/r800/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502/mos65c02/f8/f8l TD- 0.0.0 #15664 (Linux) published under GNU General Public License (GPL) *sudo make install
sdcc-src-20251006-15696.tar.bz2 ~$ sudo apt update && sudo apt install build-essential ~$ sudo apt-get install flex ~$ sudo apt-get install libboost-graph-dev ~$ sudo apt-get install bison ~$ cd ~/Downloads ~$ mkdir tmp ~$ cp sdcc* tmp ~$ cd tmp ~$ tar -xjf sdcc* $ cd /usr/local $ sudo mkdir sdcc $ cd ~/Downloads/tmp/sdcc $ sudo cp -r * /usr/local/sdcc $ cd /usr/local/sdcc $ sudo ./configure $ sudo apt-get install zlib1g-dev $ sudo ./configure $ sudo ./configure --disable-pic14-port --disable-pic16-port $ sudo make $ sudo make install $ sdcc --version SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/r800/ds390/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502/mos65c02/f8/f8l TD- 0.0.0 #15696 (Linux) published under GNU General Public License (GPL)
refsEdit
ForumEdit
- Small Device C Compiler (SDCC) Small Device C Compiler (SDCC) Discussion
- SDCC - Small Device C Compiler
ExampleEdit
TutorialEdit
- Paul's 8051 Tools, Projects and Free Code
- Example Code Moved to Rev 5 Section
- Example Code To Use The LCD Display
- 8051 Software Tools Overview
- LED Blink Program Using The AS31 Assembler
- Example Code To Use The LCD Display
- Tutorials for 8051-derivatives development using free software
WebsitesEdit
- SDCC - Small Device C Compiler Wiki
- MCU programming software, hardware and HAL libraries
- Small Device C Compiler (SDCC) Small Device C Compiler (SDCC) Support
- SDCC Compiler User Guide
- SDCC ASxxxx Assemblers and SDCC ASLINK Relocating Linker
- SDCC - Small Device C Compiler - sourceforge.net
DownloadsEdit
- SDCC - Snapshot Builds
- Get the "ASxxxx Cross Assemblers"
- Question about ASM library in SDCC
- Download SDCC 8051 Development System
DocumentsEdit
- File:AP0806510 XC800 Migration Keil 2 SDCC.pdf
- File:SDCC Compiler User Guide.pdf
- File:SDCC ASxxxx Assemblers.pdf
VMware + SDCC + stcgalEdit
- VMware
- How to Install Pip on Ubuntu
- How To Install sdcc on Ubuntu 20.04
- stcgal_github.com
- Installing and Using SDCC on Linux
- Problem installing SDCC on Ubuntu Linux
- configure: error: ./configure failed for device/lib/pic14
- Installing SDCC on UBUNTU
what isEdit
solutionEdit
- warning 158: overflow in implicit constant conversion
- #2733 False "overflow in implicit constant conversion" warning
- warning 158: overflow in implicit constant conversion
- Problem installing SDCC on Ubuntu Linux
- How To View and Update the Linux PATH Environment Variable
- How To Install gputils on Ubuntu 22.04
- How to install latest gputils?
- Installation_stcgal
- Install CH340 Driver on Ubuntu in 3 Easy Steps
- CH341SER_LINUX.ZIP
- SDCC Compiler User Guide
- ./install-sh: no input file specified. - Problem installing SDCC on Ubuntu Linux
- (Sdcc-user) What is the replacement of Keil nop() ?
- Generating a 'NOP' in 'C
LicenseEdit
how toEdit
Keil C51 use sbit to declare special registers and use form like P2^1 to indicate the P2.1 IO pin register.(actually it's a XOR operator), for example: sfr P2 = 0xA0; sbit P2_1 = P2 ^ 1;
SDCC use __sbit to declare special registers and '8051.h' shipped with SDCC prefer P2_1 form. for example: __sfr __at (0xA0) P2; __sbit __at (0xA0+1) P21;
Official STC headers prefer 'P21' form. all headers provided with this repo follow this style name convention.
- SDCC can compile only ONE file at a time.
- How to Install CH340 Drivers
- SDCC - Small Device C Compiler Wiki
- Common Pitfalls when Using SDCC
- The difference between Keil C51 and SDCC
- Using the Free SDCC C Compiler to Develop Firmware for the DS89C430/450 Family of Microcontrollers
- SDCC Install Windows
- SDCC Download
- How To Install PIP In Powershell
- How to download and install Bison (GNU Parser Generator) on Ubuntu Linux
VS CodeEdit
Trouble resolvedEdit
MCS-51Edit
What is SDCC?
SDCC is a retargettable, optimizing Standard C (ANSI C89, ISO C99, ISO C11) 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, z180, gbz80, Rabbit 2000/3000, Rabbit 3000A, TLCS-90), Padauk (pdk14, pdk15) and STMicroelectronics STM8. Work is in progress on supporting the Padauk (pdk13), Microchip PIC16 and PIC18 targets. It 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:
sdas and sdld, a retargettable assembler and linker, based on ASXXXX, written by Alan Baldwin; (GPL).
sdcpp preprocessor, based on GCC cpp; (GPL).
ucsim simulators, originally written by Daniel Drotos; (GPL).
sdcdb source level debugger, originally written by Sandeep Dutta; (GPL).
sdbinutils library archive utilities, including sdar, sdranlib and sdnm, derived from GNU Binutils; (GPL)
SDCC run-time libraries; (GPL+LE). Pic device libraries and header files are derived from Microchip header (.inc) and linker script (.lkr) files. Microchip requires that "The header files should state that they are only to be used with authentic Microchip devices" which makes them incompatible with the GPL.
gcc-test regression tests, derived from gcc-testsuite; (no license explicitely specified, but since it is a part of GCC is probably GPL licensed)
packihx; (public domain)
makebin; (zlib/libpng License)
sdcc C compiler, originally written by Sandeep Dutta; (GPL). Some of the features include:
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), long long (64 bit, 8 bytes), float (4 byte IEEE) and _Bool/bool.
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 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. News
Jan 30th, 2020: SDCC 4.0.0 released.
A new release of SDCC, the portable optimizing compiler for 8051, DS390, Z80, Z180, Rabbit 2000, GBZ80, eZ80, TLCS-90, HC08, STM8, Padauk and PIC microprocessors is now available (http://sdcc.sourceforge.net). Sources, documentation and binaries for GNU/Linux amd64, Windows amd64, macOS amd64 and Windows x86 are available.
SDCC 4.0.0 New Feature List:
The pdk15 backend now passes the regression tests (both with and without --stack-auto), and is thus considered stable. New in-development pdk13 backend for Padauk µC with 13-bit wide program memory. C2X memccpy(), strdup(), strndup(). Better tail call optimization. Many fixes in the pic14 backend. C2X u8 character constants. C2X bool, static_assert, alignof, alignas. C2X attributes on statements. C2X attribute declarations. Support for extended ASCII characters in sdas, sdld. Compiler support for UCNs and non-ASCII utf8 in identifiers.
Numerous other new features and bug fixes are included as well.
You can download the release from: https://sourceforge.net/projects/sdcc/files/ What Platforms are Supported?
Linux - x86, Microsoft Windows - x86, Microsoft Windows - x86_64 and Mac OS X are the primary, so called "officially supported" platforms.
SDCC compiles natively on Linux and Mac OS X using gcc. Windows release and snapshot builds are made by cross compiling to mingw32 on a Linux host.
Windows 9x/NT/2000/XP/Vista/7/8 users are recommended to use Cygwin (http://sources.redhat.com/cygwin/) or may try the unsupported 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, Microsoft Windows - x86_64 and Mac OS X - ppc and i386.
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.
SDCC is known to compile from the source code also on the following platforms:
Linux - x86_64 Linux - Alpha Linux - IBM Power5 NetBSD - i386 NetBSD - Sparc64 FreeBSD - i386 SUN Solaris - i386 SUN Solaris - Sparc Rasbian (Debian for Raspberry Pi) - ARMv6 Debian - ARMv7-a
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)