Questions tagged [sdcc]

SDCC is a retargettable, optimizing ANSI - C 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) and Zilog Z80 based MCUs (Z80, Z180, GBZ80, Rabbit 2000/3000, and Rabbit 3000A). Work is in progress on supporting the Microchip PIC16 and PIC18 targets. It can be retargeted for other microprocessors.

SDCC is a retargettable, optimizing ANSI - C 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) and Zilog Z80 based MCUs (Z80, Z180, GBZ80, Rabbit 2000/3000, and Rabbit 3000A). Work is in progress on supporting the Microchip PIC16 and PIC18 targets. It can be retargeted for other microprocessors.

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

  • 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), float (4 byte IEEE) and _Bool/bool; Basic (no integer constants) support for long long (64 bit, 8 bytes) data types for the z80, z180, r2k, r3ka, gbz80, hc08 and s08 targets. 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 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.

100 questions
1
vote
1 answer

`_naked`: Trying to compile legacy 8051 (FX2) code with SDCC, newer version stumbles

I have legacy code for an embedded 8051 core (in a cypress FX2) that used to compile with other versions of SDCC. However, current SDCC doesn't know the _naked qualifier: delay.c:27: syntax error: token -> '_naked' ; column 21 as triggered…
Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
1
vote
1 answer

Problem using SDCC in a Makefile during the link step

The Small Device C Compiler (SDCC) will produce a ihx (Intel Hex) file even if there are undefined reference errors during the link step. This behavior causes problems when using SDCC in a Makefile because if you set the ihx file to be your make…
David Grayson
  • 84,103
  • 24
  • 152
  • 189
1
vote
1 answer

NRF24L01+ cannot receive when CRC enabled

I have two STM8s105 MCUs and two NRF24L01+ modules. Set one as sender: CONFIG: 0x3A EN_AA: 0x00 EN_RXADDR: 0x03 SETUP_AW: 0x03 SETUP_RETR: 0x00 RF_CH: 0x00 RF_SETUP: 0x07 STATUS: 0x2E OBSERVE_TX: 0x00 CD: 0x00 RX_ADDR_P0: 0xCC 0xCC 0xCC…
Arthur
  • 11
  • 1
1
vote
1 answer

SDCC integer comparison unexpected behavior

I'm trying to get started on a project using a PIC18F24J10. Attempting to use SDCC for this. At this point I've reduced my code to simply trying to nail down what is happening, as I've been seeing bizarre behavior for a while now and can't really…
Aglandiir
  • 31
  • 2
1
vote
0 answers

QProcess stops communication after entering a specific command

What am I trying to do? I'm trying to build a Python Qt Gui that will allow me to easily run/debug embedded programs for microcontrollers. As a compiler I'm using sdcc. Sdcc also contains an emulator. In the code, I start a child QProcess that will…
maarten
  • 336
  • 2
  • 10
1
vote
1 answer

Can't compile simple code with SDCC for pic on debian

I'm trying to compile the following code with SDCC, in Debian using only VIM and a Makefile: void main(void) { } Yes, that simple, it's not working yet. I'm using a Makefile like this : # GNU/Linux specific Make directives. # Declare tools. SHELL…
Electropepper
  • 11
  • 1
  • 7
1
vote
1 answer

strange Behavior of sdcc compiler for 8051

I previously used Keil for programming 8051 microcontrollers. For some reason I have to code in SDCC, but today I am facing very strange behavior in Compiler. I am using Code blocks IDE 12.11 and SDCC 3.4 version. I am compiling this simple piece…
Abdul Rehman
  • 2,224
  • 25
  • 30
1
vote
1 answer

doxygen a variable is recognized as function

In my current project I'm trying to generate documentation with doxygen. However I have a problem with a variable. Somehow doxygen recognizes the variable as a function. The code: __xdata __at (0x0F00) volatile static unsigned char Programmed; /*!<…
user2986756
  • 89
  • 1
  • 9
1
vote
1 answer

compiler warning on SDCC: pointer target lost const qualifier

i am getting a compiler warning, here's the code: uint8 executeSpecialCommand(const char *string) { char *parameters; parameters = strtok(string, "="); if (parameters) { usbSendf("\nProcessing Parameters..."); …
jelipito
  • 171
  • 2
  • 2
  • 12
1
vote
2 answers

Eclipse 4.2.1 SDCC plugin can't create MCS51 project

I'm running Eclipse 4.2.1 on 64-bit Windows 7. I have the Eclipse CDT plugin installed and can make C/C++ projects. I have sdcc installed (get a response on CL with sdcc --version). I have downloaded this version of the…
akimai
  • 31
  • 1
  • 5
1
vote
1 answer

Using SDCC in Visual Studio 2010?

Is there a way to use the Visual Studio 2010 IDE with the Small Device C Compiler (SDCC)? I would like to compile using SDCC within Visual Studio.
Kelly
  • 63
  • 6
0
votes
1 answer

SDCC produces elf output with sections of NULL type

I am using SDCC to produce an ELF file. I then convert this ELF file to a binary file. Sadly the output is not as expected. The output is not positioned correctly and there are strange zero length sections in the elf. The Questions(s) How do I get…
Maximilian
  • 76
  • 5
0
votes
1 answer

sdcc compiler wrong machine code generation

the sdcc compiler generate a unexpected instruction output after compilation, I rechecked this code in ChatGPT, at the source level all is fine to my knowledge. this is the code: #include #include // Variable and…
Adhil
  • 1
  • 2
0
votes
0 answers

MCU 8051 IDE with SDCC stuck at compiling

I am a student and have been instructed by the college to use MCU 8051 IDE with SDCC for learning microcontroller programming. I installed this software successfully on many HP devices in college but when I am trying to use it on my home Dell…
0
votes
1 answer

SDCC compile warning 88: cast of LITERAL value to 'generic' pointer

I got Warning at code "CT_PD->bank = PDbank", Warning happens as long as "CT_PD->...", I have no idea to solve it. Can anyone know what to do? warning message:: warning 88: cast of LITERAL value to 'generic' pointer from type 'const-int literal' to…
fang jack
  • 83
  • 1
  • 9