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
0
votes
1 answer

Setting Timer interrupt in 8051, getting stuck

Hi i am trying to set up an overflow timer interrupt on Timer 3 of an 8051. The code is getting stuck in the interrupt routine. i am using the 2511F32 (wixel) Here is the interrupt setting code: { ...... T3CTL |= 0xE0; // set…
jelipito
  • 171
  • 2
  • 2
  • 12
0
votes
1 answer

List management library in C for micro controllers

I am working on a project using a CC2532 which is based on an 8051 core. I am using SDCC as the compiler. I am needing to create a list of strings, and add, remove, append, list elements. Are there any simple open-source/free libraries that are…
jelipito
  • 171
  • 2
  • 2
  • 12
0
votes
3 answers

8051 Controller port bit reading / writing

The idea is to read any bit from a port. Anyway accessing to one known bit is simple, like P0_0 <-- gets bit 0 from port 0 But if i need to access bit y via function? read_bit(__bit y){ return P0_y; // <-- just an idea but its not right…
RassK
  • 515
  • 6
  • 20
0
votes
1 answer

PIC18f4620 Receive usart in SDCC

I'm trying to realize the communication of the PC (linux) with a PIC18F4620 for rs232. The Transmition (PIC -> to PC is fine). However, when I try to pass somenthing from the PC to PIC the PIR1bits.RCIF flag is never set and the interrupt does NOT…
-1
votes
4 answers

How do I get a function to be compiled at address 04 with GPLINK? (For PIC16)

I have a function which is meant to catch all the interrupt calls that will happen, But I cannot get any function to start at address 04. Note: I dont want to use functions that are specific to interrupt types, I dont want the overhead they produce…
user1598585
-1
votes
1 answer

Compiling with SDCC fails with -Wall option

I'm compiling a 8051 project with SDCC but has a problem with Makefile, the following sources: TARGET = test CC = sdcc CFLAGS = -Wall -I. RM = rm -rf SRCS = $(wildcard *.c) RELS = $(patsubst %.c,%.rel,$(SRCS)) $(TARGET).bin:…
-1
votes
1 answer

Syntax error on pointer definition that seems valid (from a working library) SDCC

I'm trying to compile a firmware for Crazyradio PA (but the issue is not specific to it), in which I added a library I needed from Nordic Semiconductor's SDK. The library is initially meant to be compiled under Keil µVision IDE, so I naturally…
JMA
  • 1
  • 2
-1
votes
1 answer

Why does this sentence eliminate the "unreferenced function argument warning"?

in SDCC Compiler User Guide I read the following: void to_buffer( unsigned char c ) { c; // to avoid warning: unreferenced function argument __asm ; save used registers here. ; If we were still using r2,r3 we would have to push them here. ; if( head…
Qiang
  • 3
  • 2
-2
votes
1 answer

How to create packed arrays of bit fields with SDCC?

I have a nested data structure containing arrays of bit fields which I need to compile with SDCC for the MCS-51 target. This is a simplified example: example.c struct data { unsigned char a : 1; unsigned char b : 2; }; struct data…
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
-3
votes
1 answer

MCU 8051 IDE 'Small Device C Compiler' (SDCC) compiler with C language is not compiling

I have a problem with an MCU 8051 IDE simulator. When using the C language it was outputting the message "no sdcc compiler". After I installed the SDCC compiler on my PC, this part worked. But after I wrote a C program and compiled it, this message…
1 2 3 4 5 6
7