Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
58 views

I am porting the GetCurrentMicro function in the Arduino Core STM8 to my SDCC code and I noticed the Cosmic C Compiler _asm function allows me to return a result as well as an input in a C var. Is ...
Jonas's user avatar
  • 1,239
1 vote
0 answers
27 views

I'm trying to compile a 51 microcontroller (STC 89C52RC) on the Linux platform using PlatformIO and the sdcc compiler. Currently, I'm attempting to display characters on an LCD1602. The specific ...
Spike Aaron's user avatar
0 votes
1 answer
102 views

I started learning the 51 single-chip microcomputer, but encountered a problem when trying to use the Lcd1602. I referred to a code for an LCD1602 debugging tool written in Keil5 on the Windows ...
Spike Aaron's user avatar
0 votes
1 answer
92 views

It's actually a very simple question so I don't know what else to put as an example: file: gcc.c int a __attribute__((section(".custom_section"))) = 0; int inc_a(void) { return ++a; } ...
Gusteivos gp's user avatar
0 votes
0 answers
173 views

So, I was writing some code for the 8051, and as I needed a delay, I implemented it through a timer (in mode 1): volatile void delay_1ms(void) { TMOD = 0x01; // Set Timer 0 to Mode ...
CHOOISFOX's user avatar
0 votes
1 answer
178 views

I'm trying to generate header file dependencies with SDCC on Windows, the command line is sdcc -c -mmcs51 --model-small --xram-size 0x0100 --xram-loc 0x0100 --code-size 0x2800 -Iinclude/ -oobj/ -...
Charlie Skilbeck's user avatar
0 votes
1 answer
116 views

I'm trying to do my first Makefile for a sdcc C program I start. For now, I get this error: make: *** No rule to make target 'out/main.rel', needed by 'a.bin'. Stop. This is my Makefile: SRC = src/...
user avatar
1 vote
1 answer
263 views

I am currently trying to write startup code in assembly for an STM8 without any vendor libraries. More specifically, I am using an STM8S103f3p6. I am still inexperienced in assembly and with startup ...
Alex's user avatar
  • 69
2 votes
1 answer
568 views

using the SDCC compiler, I am looking to create a z80 file to load into a particular address in ram 0x8000) at a later stage. I have used for example the compiler line: sdcc -mz80 --no-std-crt0 --code-...
eJm's user avatar
  • 147
2 votes
1 answer
154 views

The following code works as expected when compiled with gcc, however when compiled with sdcc (4.2.0) the conditional test (x2 + y2 >= 800) doesn't ever appear to be evaluated as true (as only ...
Mike T.'s user avatar
  • 417
3 votes
2 answers
457 views

I've been mulling over this for the last couple of days, and i cant see what is wrong with my code. Really just looking to assign two memory addresses to two pointers. ROM at 0x0000 and RAM at 0x7000....
eJm's user avatar
  • 147
0 votes
1 answer
246 views

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 ...
Maximilian's user avatar
2 votes
1 answer
446 views

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 ...
Matthew H.'s user avatar
0 votes
1 answer
216 views

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 <stdio.h&...
Adhil's user avatar
  • 1
0 votes
0 answers
530 views

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 ...
Veer Nagda's user avatar
0 votes
1 answer
270 views

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: ...
fang jack's user avatar
3 votes
1 answer
425 views

I'm using SDCC's inline assembly syntax for my project: void delay_ms(uint16_t ms) { _ms = ms; __asm ldw y, __ms ; Load ms counter into y register: 2 cycles 0000$: ...
CTXz's user avatar
  • 876
0 votes
1 answer
1k views

Since sdcc have some limitations, like compiling one file at a time, I've tried hard to write a Makefile to perfect the automation of MCS-51 development, which have some requirements: Source file (.c)...
user avatar
0 votes
1 answer
171 views

I'm using macOS. I have downloaded sdcc for Mac and installed it followed INSTALL.txt inside the downloaded folder (simply copy it to Developer folder), and have Eclipse IDE for Embedded C/C++ ...
Yiming Designer's user avatar
0 votes
0 answers
108 views

I'm using SDCC compiler for a microcontroller. In tunes.c, I declare an integer table: __code unsigned int Beep1[] = {4, 0, 1500, 750, 375}; void PlayTune(unsigned int Addr[]) { /* code */ } In main....
user avatar
0 votes
0 answers
885 views

I have a project with mc96f8316(ABOV), it's a 8051 core. My sdcc has version like this: SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/TININative/ds400/hc08/s08/stm8 3.8.0 #10562 (Linux) published ...
Văn Minh Lý's user avatar
-1 votes
1 answer
491 views

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 = $(...
Văn Minh Lý's user avatar
0 votes
2 answers
1k views

I was trying to understand this code. It was in a tutorial, and I was following along the tutorial, and so I tried this code. I compiled it using sdcc, but it is giving me a syntax error on column 7. ...
Hole's user avatar
  • 46
2 votes
2 answers
2k views

For low-level programming, sometimes it's necessary to say, at a given memory location, this is where my address is. For this post, the example is the PIR1 register in the PIC16F886 and related ...
Omar and Lorraine's user avatar
2 votes
0 answers
249 views

Can I exclude certain addresses inside the code segment in SDCC? For example if my code segment spans from addr. 0x0000 to 0x4000, can I somehow tell the linker/compiler to avoid addr. from 0x2000 to ...
Tomaz Stih's user avatar
0 votes
1 answer
550 views

I write a delay function: void delay(a){ for (int i=a;i>0;i--) for (int j=0; j<200;j++) } But when I compiled this code by sdcc and keil, and run in 8051 chip. The result is that ...
Jack's user avatar
  • 257
0 votes
1 answer
225 views

I'm using SDCC to compile for a STM8 microcontroller. Compiling the following file results in a seemingly unnecessary div instruction - which is very slow on the STM8. char a[1]; char b; void foo() ...
user2248702's user avatar
  • 3,068
0 votes
2 answers
4k views

In an attempt to create a cross-compilation CMake toolchain template with the SDCC compiler, I have come across a very weird issue. As described in this link, if the toolchain.cmake file defines a ...
Mat Gomes's user avatar
  • 444
4 votes
2 answers
361 views

I'm familiar with the C programming language and z80 assembly and I have made a simple z80 "computer" with just the cpu with 32k of ram, 32k of rom, and an 8255 pia for io control. I have ...
Marlon Barbee's user avatar
0 votes
1 answer
192 views

I'm trying to compile some c-code that was originally written for SDCC using GCC to run some unit tests on a host computer. There are some language extensions for SDCC like __xdata or __pdata (for ...
Imael's user avatar
  • 1
0 votes
2 answers
160 views

void on_low_interrupt(void) __interrupt 2; void on_low_interrupt(void) __interrupt 2 { #ifdef CONFIG_ENABLE_I2C i2c_handle_interrupt(); #endif #ifdef CONFIG_ENABLE_SERIAL ...
gfdfda fdaaf's user avatar
-2 votes
1 answer
862 views

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; ...
mkrieger1's user avatar
  • 24.2k
-3 votes
1 answer
2k views

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. ...
bhaggya umayangana salwathura's user avatar
0 votes
1 answer
314 views

I am programming the STM8L051F3 processor for a simple application in which it is only necessary to control all GPIO. The problem is that I can't control the GPIOC pin 0. I just configured the GPIO ...
Ilidam's user avatar
  • 73
3 votes
3 answers
2k views

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 ...
cameroony's user avatar
0 votes
1 answer
1k views

I am developing for the Cypress EZ-USB FX2LP which contains a 8051 core and I use SDCC for compilation. I noticed that I can (sometimes?) omit the __xdata annotation for pointers and my firmware will ...
DurandA's user avatar
  • 1,728
1 vote
1 answer
156 views

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 ...
pi_squared's user avatar
0 votes
1 answer
2k views

I have this code in ThreadCreate(): int tmpPSW = newThID << 3; __asm PUSH A PUSH _tmpPSW __endasm; This results in: ?ASlink-Warning-Undefined Global '_tmpPSW' referenced by module '...
thyu's user avatar
  • 1,832
0 votes
0 answers
660 views

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 ...
dev_eng's user avatar
  • 126
1 vote
0 answers
640 views

Learning SDCC compiler, its Z80 part (sdasz80). In native versions of assembler I use: ld (hl),LOW BUF inc hl ld (hl),HIGH BUF to store 16-bit value BUF in two 8-bit parts (high and low). I can not ...
Anonymous's user avatar
  • 771
0 votes
1 answer
2k views

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,...
Anton's user avatar
  • 675
0 votes
1 answer
775 views

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 ...
G. Putnam's user avatar
  • 1,800
3 votes
4 answers
848 views

SDCC's assembler is derived from ASxxxx where manual describes the .define command here: http://shop-pdp.net/ashtml/asxs02.htm#define Since it's a derivation it's possible not everything works the ...
Jari Komppa's user avatar
3 votes
3 answers
1k views

I've been given a 8051 based board with an embedded in-house operating system. I am using SDCC to create applications above the OS. And malloc is not available so I have to allocate memory statically. ...
cleveraintwise's user avatar
2 votes
1 answer
2k views

(Non-native speaker here, I apologize for the vague title) I am using the compiler suite sdcc (3.7.0) to compile C code for the TI-82 STATS calculator. Its processor is a Z80. The OS provides several ...
kangalio's user avatar
  • 673
3 votes
0 answers
577 views

I've compiled SDCC 3.7.0 on a Raspberry Pi 2. But I'm having diffuculty with the next step: compiling a blink.c with SDCC: sdcc -mpic14 -p16f887 blink.c --use-non-free It just returns "libsdcc.lib: ...
Jayy's user avatar
  • 14.9k
2 votes
0 answers
177 views

I have this code: void GPIO_InitPortPin(uint8* PortControl, uint8 Pin, uint8 PinDir){ *PortControl &= (~(1U << Pin)); *PortControl |= (PinDir << Pin); } If the PortControl ...
Mosaaleb's user avatar
  • 1,109
-1 votes
1 answer
2k views

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 ...
JMA's user avatar
  • 1
1 vote
1 answer
3k views

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 ...
K0ertis's user avatar
  • 131
4 votes
1 answer
1k views

I'm developing a program in C for the Z80 and compiling using SDCC. I can't figure out how to create interrupt handlers for the NMI interrupt that starts at 0x0066 and the IM1 interrupt that starts ...
ajcrm125's user avatar
  • 353