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

SDCC valid device list is missing devices

I'm rebuilding a sdcc compiler after a mishap with my old system. I had been able to build on a pic18F4410, but my new setup does not include that in its valid device list. The device list it is calling valid looks very small. sdcc --use-non-free…
Aglandiir
  • 31
  • 2
2
votes
3 answers

Simple C programs returns too many parameters error

So I'm just starting to learn C, and after setting up CodeBlocks with the SmallDevice C compiler I began working on some of the programs in the book I'm learning through. it keeps returning this error. Here is the code: #include int…
Justc25
  • 23
  • 4
2
votes
1 answer

Error 98:Conflict with previous definition of x for attribute 'type'

I am getting this compile error using SDCC and programming an old 8051. I am trying to make 1wire search command work. I got my hands on an OneWire library that I started modifying for my hardware/software and now I am stuck behind this…
s3v3ns
  • 198
  • 1
  • 17
2
votes
4 answers

How do you control what your C compiler Optimizes?

I am writing the firmware for an embedded device in C using the Silicon Labs IDE and the SDCC compiler. The device architecture is based on the 8051 family. The function in question is shown below. The function is used to set the ports on my MCU to…
PICyourBrain
  • 9,976
  • 26
  • 91
  • 136
2
votes
1 answer

Copy a structure to a member of another structure

I'm on SDCC 3.4 and this is a MIDI project for a musical instrument, and it's a couple of days I'm struggling with this... something that I even find somehow difficult to explain, so here I try to make a better example. Basically, I am scanning for…
Mark Miles
  • 706
  • 8
  • 20
2
votes
3 answers

sdcc not accepting code

I have an issue with SDCC. My code (which I am attempting to port from another compiler) uses structs with flexible array members. However, when I try to compile the following code: /** header of string list */ typedef struct { int nCount; …
George Hilliard
  • 15,402
  • 9
  • 58
  • 96
2
votes
1 answer

SDCC compiler switch statement, what is ack: section for?

I saw the following code in CCTL (~line 330) https://github.com/jobytaffey/cctl/blob/master/cctl/main.c switch(page) { // ... ack: cons_putc(0); } What is the ack: section for? It looks like same as default: to me. I can't find it in…
Misha M
  • 10,979
  • 17
  • 53
  • 65
2
votes
1 answer

Function not being executed at all or doesn't execute properly

i'm working on an embedded C program, where the killnoise function is not executed even if it is called and the program always reach it, but when i chek the values at the output of this function i just discover that nothig happened: void KillNoise(…
Tarik Mokafih
  • 1,247
  • 7
  • 19
  • 38
1
vote
1 answer

Binary Injection into ELF File

I have an ELF file generated through the SDCC compiler using the —out-fmt-elf and —debug options. I need to inject data into the actual binary (this will be loaded to an STM8 microcontroller). Doing this with a hex file is easy, as I can just…
Matthew H.
  • 113
  • 1
  • 9
1
vote
1 answer

Is it possible to know PCL‘s value before an interrupt is caught in PIC16/18?

I want to know what was the last instruction being executed in the program line just before an interrupt has been caught. It seems that reading the microcontroller stack is not possible.
user1598585
1
vote
4 answers

Eclipse with SDCC plug in - always has an error of java.lang.NullPointerException

I had installed latest Eclipse IDE with C/C++, installed SDCC and put the net.souurceforge.eclipsesdcc.1.0.0 plugin into the Eclipse Plugins & Features folder. When startup Eclipse, start to create a project using MC51 family (SDCC) with SDCC Tools…
Martin
  • 11
  • 1
  • 3
1
vote
3 answers

Floating point numbers and the effect on 8-bit microcontrollers memory

I am currently working on a project that includes bare-metal programming on an stm-8 micro-controller using the SDCC compiler in linux. The memory in the chip is quite low so I'm trying to keep things really lean. I have gotten by with using 8-bit…
cameroony
  • 67
  • 1
  • 10
1
vote
0 answers

can SDCC override operators?

I've been trying to use SDCC to compile extremely lightweight C programs to run on a TI83 calculator (yes, you can do that). Being an old calculator, it doesn't have much RAM to store the program, and the processor is extremely slow. I wrote code…
pi_squared
  • 91
  • 6
1
vote
1 answer

Problems interfacing an hd44780-based LCD with a P89LPC9351-based microcontroller

I can't manage to get my LCD to initialize, am i doing something wrong? Any help appreciated! #include #include #include #define XTAL 7373000L #define BAUD 115600L #define LCD_data P2 …
Jota
  • 234
  • 2
  • 11
1
vote
1 answer

Interrupt STM8s issue with SDCC compiler

I want to use interrupts on the SMT8S003K3 (STM8SVL-DISCOVERY) and somehow it does not get recognized when I use the interrupt on a other file where my main() is located. I made two tests: - first I modified this code to Standard Peripheral…
K0ertis
  • 121
  • 1
  • 9