The Small Device C Compiler (SDCC) is a free optimizing standard C compiler targeting various 8-bit architectures. At FOSDEM 2015, I gave talk about SDCC. This guest blog is a quick summary of what has happened since up to the release of SDCC 3.6.0.
Standard compliance has improved. We got C11 generic expressions, and the wide character constants and string literals introduced in C95 and C11. Now all mandatory features introduced in C11 are supported in SDCC. However, support for assigning, passing and returning struct
and union
is still missing. And variable declarations are still restricted to where C90 allows them. The default language dialect has been changed to --std-sdcc11
. Many of the target architectures can do unsigned comparisons more efficiently than signed ones. Casting from unsigned variables is also cheaper than casting from signed ones. To better exploit this, SDCC changed the default for char
from signed to unsigned.
SDCC documentation used to be written with mostly the MCS-51 in mind. Now it is much clearer what applies to which backends. As usual, bugs reported by users resulted in various bugfixes. In particular, the new operating system makes heavy use of some previously less-used features. This resulted in quite some bugs being found and fixed for the Z80 backend and long long
data types.
The standard library got support for some wide character handling functions and for atoll()
. Memory management (malloc()
and friends) has been rewritten to reduce the memory overhead to 2 bytes per allocation.
In the long term, the z80 Development kit (z88dk) want to replace their own Small-C-based compiler by SDCC. To support this, SDCC added support for the __z88dk_fastcall
and __z88dk_callee
calling conventions.
SDCC 3.4.0 two years ago was the first SDCC release with STM8 support. There were many bugfixes and improvements in this backend. SDCC now generates the necessary code to work around the STM8 division hardware bug. It can now emit ELF/DWARF, which allows debugging of applications built with SDCC from within STVD. Compared to other compilers targeting the STM8, we see a mixed picture: SDCC 3.6.0 tends to generate slower and bigger code, but it is ahead in standard compliance. The other compilers are Windows only, while SDCC works under a variety of operating systems. Only SDCC is free.
Since 2008, Dr. Philipp Klaus Krause is one of the maintainers of SDCC. He recently completed his PhD on “Graph Decomposition in Routing and Compilers” at Goethe-Universität Frankfurt. He is continuing his research into applications of graph decompositions in compiler optimizations.