libretto / RelayMCU

13 stars 10 forks source link

Type mismatch? #1

Open tilator opened 6 years ago

tilator commented 6 years ago

Hello,

Compiling in Linux (64-bit) gives this error:

sdcc: Generating code... relay.c:54: error 47: indirections to different types assignment
from type 'const-char [3] code' to type 'char fixed'

What should be changed?

libretto commented 6 years ago

Which version of sdcc do You use? Could You give me output of sdcc -v?

libretto commented 6 years ago

I compiled this code under sdcc version 3.5 In elder version of sdcc had a problem with such type of string initializer constants. If You replace string #54 with char a[] = { 'U','P' }; It must works in Your compiler too...

libretto commented 6 years ago

just added this fixup to master branch

tilator commented 6 years ago

Hi,

I did try to compile it with two different Linuxes. Both did give same error.

One sdcc version is:

SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.3.0 #8604 (Dec 30 2013) (Linux)

I try it again now.

tilator commented 6 years ago

It seems to compile now having only one warning:

relay.c:173: warning 158: overflow in implicit constant conversion

The compiled hex seems to work too.

Thanks.

libretto commented 6 years ago

Yes, I know about this warning. It because TL0 is byte but BAUD is a word. On value assignment, high byte is ignored by default. So the behaviour of code is right. But maybe I will fix up this warning later by adding some byte operation in this line.