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
0 answers

I2C is not able to start

I am using stm8s controller and SDCC compiler. I am interfacing SD130S7 I2C based RTC with controller. I am facing a problem during communication. I think the problem is I2C itself is not started. I am using a development board for STM8S103. I…
dev_eng
  • 126
  • 1
  • 12
0
votes
1 answer

STM8 TIM1 (or TIM2) - one 5s tick after external interrupt event

I'm trying to implement this logic in STM8S103F3: 1) Controller wait for external interurpts on GPIOC (high by default) after initialization. 2.1) external interrupt triggered: if PIN5 of GPIOC is low, turn test led on, and start timer for 5s. 2.2)…
Anton
  • 575
  • 2
  • 7
  • 27
0
votes
1 answer

SDCC / GBDK, Passing array of structs to function

I am attempting to pass a pair of arrays of structures to a function in C. I must use the SDCC compiler as I am compiling for Gameboy using GBDK. When I pass the array of structures I get an error as shown below, however, if I take the function…
G. Putnam
  • 1,262
  • 5
  • 10
0
votes
1 answer

Compiling string literals in ASM for SDCC/LCC

I'm trying to write string literals in ASM for GBDK's LCC. I can write each individual character and the compiler is working fine. .D_LINE = 0x0A ;; Works .db "G", "I", "A", "N", "L", "U", "C", "A", #.D_LINE However, when I try and combine the…
bashaus
  • 1,614
  • 1
  • 17
  • 33
0
votes
0 answers

How to write on a terminal using java programming

I am using SDCC to design a compiler IDE (Using SDCC we can compile codes for 8051 and PIC controller). To compile a a code written for 8051 we use the command sdcc --debug filename.c and to enter the debugger we use the command sdcdb filename.cdb.…
Vimala
  • 1
  • 2
0
votes
1 answer

Installation of a specific version from svn repository

I am trying to install a specific revision (9092) of SDCC (on Ubuntu of course), when I run the following command, I get this error: svn: E000110: Unable to connect to a repository at URL 'svn://svn.code.sf.net/p/sdcc/code/trunk/sdcc' svn: E000110:…
DarthSpeedious
  • 965
  • 1
  • 13
  • 25
0
votes
1 answer

Including a static library in a GBDK C project (GBExtended)

I want to use the GBExtended library in my game but I am having difficulty understanding how I would include the library. I can see that the GBExtended library (at least from the loderunner example source) contains the directories includes/, lib/…
bashaus
  • 1,614
  • 1
  • 17
  • 33
0
votes
1 answer

sdcc Makefile for 8051 microcontrollers

Hey is there anybody who works with SDCC to make projects for 8051 microcontroller series on Macbook. If yes then can you please post the working make file, specially the part which loads the program in the device. I am confused what to write…
Mayukh Sarkar
  • 2,289
  • 1
  • 14
  • 38
0
votes
3 answers

Why does using a structure in C program cause Link error

I am writing a C program for a 8051 architecture chip and the SDCC compiler. I have a structure called FilterStructure; my code looks like this... #define NAME_SIZE 8 typedef struct { char Name[NAME_SIZE]; } FilterStructure; void ReadFilterName(U8…
PICyourBrain
  • 9,976
  • 26
  • 91
  • 136
0
votes
3 answers

What is wrong with this arithmetic when using SDCC (Little Endian) Compiler?

I am very new at C programming and I am working on a firmware application for my MCU. This method was working fine when I was using the KEIL compiler (Big Endian) but when I switched to the SDCC compiler (Little Endian) it is not working properly.…
PICyourBrain
  • 9,976
  • 26
  • 91
  • 136
0
votes
1 answer

Reconfigure timer during timer interrupt interrupt 8051

I'm using SDCC compiler. What I'm trying to achieve is to reconfigure Timer0 in Mode 2 auto-reload, during its own interrupt handler. Here is the C code: void reconf(void) __interrupt(1){ TR0=0; TH0=0xC0; TL0=0xC0; TR0=1; } Here…
0
votes
1 answer

Eclipse: Edit code parser

I am using a plugin for Eclipse (The Eclipse plugin of SDCC). This works fine (so far) but the problem is the inline assembly.. it is pretty annoying that the parser marks this code as syntax error and furthermore that it marks symbols which are…
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
0
votes
0 answers

8051: timer is not activating interrupt subroutine when UART interrupt enabled

I am able to use interrupts generated by the timer and by the UART the way I expect to be able to use them when they are used individually (that is, the timer is able to activate the interrupt subroutine when it is used on its own, and the UART is…
Michael Kossin
  • 342
  • 3
  • 14
0
votes
1 answer

SDCC/C51: Redefine SDCC symbols

I want to compile a program under the SDCC that I used to compile under C51.. // Somewhere in a header file for C51: sfr TCON = 0xA8; // C51 syntax // somewhere in a .c-file #pragma asm mov TCON, #0 #pragma endasm This will be translated…
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
0
votes
2 answers

C51 C compiler inline assembly to SDCC inline assembly

I'm not very into assembly but for a project I have to modify a few lines of assembly code for the C51 C compiler to the SDCC. This is code for C51 setb T1Run setb T0Run setb IDLE jnb T0Full, $ Which, compiled with SDCC…
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378