ArduPilot / ArduPilot/SiK

conflict with previous declaration of 'putchar'

Open
#57 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
343
Forks
245
PR merge metrics
No merged PRs in 30d

Description

Unable to build with sdcc 3.9.0:

```
CC radio/golay.c
CC radio/serial.c
radio/serial.c:541: error 98: conflict with previous declaration of 'putchar' for attribute 'type' at /usr/bin/../share/sdcc/include/stdio.h:86
from type 'int function ( int fixed) fixed'
to type 'void function ( unsigned-char fixed) __reentrant fixed'
make[1]: *** [include/rules.mk:135: obj/rfd900a/radio~rfd900a/serial.rel] Error 1
make[1]: Leaving directory '/home/paulk/botlink/SiK/Firmware'
make: *** [Makefile:95: install~radio~rfd900a] Error 2
```

I changed the signature in serial.c to
```
int
putchar(int c) __reentrant
```

and it's working fine for me. But I suspect there's a more correct fix.

I found [what looks like the same issue](https://sourceforge.net/p/sdcc/mailman/message/12702250/) on the sdcc mailing list from 2007, but the PUTCHAR definition doesn't exist, so the reply there was unhelpful.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in radio/serial.c around line 541 and compare its putchar declaration with the declaration in the SDCC stdio.h path shown by the compiler. Reproduce the install~radio~rfd900a build with SDCC 3.9.0, then confirm the corrected declaration removes the conflict and the target builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.