SDCC (Small Device C Compiler)
is free open source, retargettable, optimizing ANSI-C compiler by
Sandeep Dutta designed for 8 bit Microprocessors. The current
version targets Intel MCS51 based Microprocessors (8031, 8032, 8051,
8052, etc.), Dallas DS80C390
variants, Freescale (formerly Motorola) HC08 and Zilog Z80 based MCUs
(z80, z180, gbz80, Rabbit 2000/3000).
It can be retargeted for other microprocessors, support for Microchip
PIC is under development. The entire source code for the compiler
is distributed under GPL. SDCC uses a modified version of ASXXXX
& ASLINK, free open source retargetable assembler &
linker. SDCC has extensive language extensions suitable for utilizing
various microcontrollers and underlying hardware effectively.
Warning: Large parts of this manual apply to the mc51 port only.
Further information on the z80, z180, r2k and gbz80 ports and standard
compliance can be found in the sdcc wiki.
In addition to the MCU specific optimizations SDCC also does a host
of standard optimizations like:
type | width | default | signed range | unsigned range |
bool | 1 bit | unsigned | - | 0, 1 |
char | 8 bits, 1 byte | signed | -128, +127 | 0, +255 |
short | 16 bits, 2 bytes | signed | -32.768, +32.767 | 0, +65.535 |
int | 16 bits, 2 bytes | signed | -32.768, +32.767 | 0, +65.535 |
long | 32 bits, 4 bytes | signed | -2.147.483.648, +2.147.483.647 | 0, +4.294.967.295 |
long long1.1 | 64 bits, 8 bytes | signed | ||
float | 4 bytes IEEE 754 | signed | 1.175494351E-38, 3.402823466E+38 | |
pointer | 1, 2, 3 or 4 bytes | generic |