libretto / RelayMCU

13 stars 10 forks source link

Compile is Failing under Debian 11 #3

Open sandro-byte32 opened 3 years ago

sandro-byte32 commented 3 years ago

When is want to compile i get errors.

sdcc version:

sdcc -v 
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ez80_z80/ds390/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.0.0 #11528 (Linux)

published under GNU General Public License (GPL)

Compiling error:

sudo sdcc -mmcs51 --iram-size 128 --xram-size 0 --code-size 4096 --nooverlay --noinduction --verbose --debug -V --std-sdcc89 --model-small "relay.c"

sdcc: Calling preprocessor...

sdcc: sdcpp -nostdinc -Wall -std=c89 -obj-ext=.rel -D__SDCC_NOOVERLAY -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCC=4_0_0 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=0 -D__SDCC_VERSION_PATCH=0 -DSDCC=400 -D__SDCC_REVISION=11528 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem /usr/bin/../share/sdcc/include/mcs51 -isystem /usr/share/sdcc/include/mcs51 -isystem /usr/bin/../share/sdcc/include -isystem /usr/share/sdcc/include  relay.c 

+ /usr/bin/sdcpp -nostdinc -Wall -std=c89 -obj-ext=.rel -D__SDCC_NOOVERLAY -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCC=4_0_0 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=0 -D__SDCC_VERSION_PATCH=0 -DSDCC=400 -D__SDCC_REVISION=11528 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem /usr/bin/../share/sdcc/include/mcs51 -isystem /usr/share/sdcc/include/mcs51 -isystem /usr/bin/../share/sdcc/include -isystem /usr/share/sdcc/include  relay.c 

sdcc: Generating code...

relay.c:41: syntax error: token -> '/' ; column 1

relay.c:156: syntax error: token -> '/' ; column 15

relay.c:158: error 1: Syntax error, declaration ignored at 'PT0'

relay.c:159: error 1: Syntax error, declaration ignored at 'ET0'

How to fix that?

libretto commented 3 years ago

So there are probably two ways to fix:

a) Use --std_sdcc99 instead of --stdcc89 in command line As in example sdcc -mmcs51 --iram-size 128 --xram-size 0 --code-size 4096 --nooverlay --noinduction --verbose --debug -V --std_sdcc99 --model-small "relay.c" b) change all one line comments from style: optional code ; // a comment to style : optional code ; /* a comment */

sandro-byte32 commented 3 years ago

Can you maybe explain this behavior.

Can't find anything on google about these terms.

libretto commented 3 years ago

So the problem is in code is from one line comments I see it from Your errors. So first way is - edit comments and change // comment to / comment /.

Next I read this doc to find the reason: http://sdcc.sourceforge.net/doc/sdccman.pdf And found some notice about one line comment (//') and --std_sdcc89 flag... There also was some info about --std_sdcc99 and seems it works...