From: Martin L. <le...@di...> - 2007-12-26 20:51:07
Attachments:
test_condit.c
|
Hi All. I have the following problem with some autogenerated code (from nesC in my TinyOS port to 8051*). It seems that a fairly obscure "= ? :" causes problems with sdcc. The statement returns a bunch of warnings and fails in the assembler with the following error: sdcc -mmcs51 test_condit.c test_condit.c:15: warning 94: comparison is always false due to limited range of data type test_condit.c:15: warning 94: comparison is always false due to limited range of data type test_condit.c:15: warning 94: comparison is always false due to limited range of data type test_condit.c:15: warning 94: comparison is always false due to limited range of data type test_condit.c:15: warning 94: comparison is always false due to limited range of data type test_condit.c:15: warning 94: comparison is always false due to limited range of data type ?ASxxxx-Error-<o> in line 136 of test_condit.asm <o> .org in REL area or directive / mnemonic error ... Is the statement a valid C statement? * Again, check out the following if you are interested: http://www.tinyos8051wg.net -- Regards Martin Leopold. Dept. of Computer Science, University of Copenhagen http://www.diku.dk/~leopold |
From: Frieder F. <fri...@we...> - 2007-12-28 09:05:43
|
Hi Martin, Martin Leopold schrieb: > problems with sdcc. The statement returns a bunch of warnings and fails > in the assembler with the following error: > > sdcc -mmcs51 test_condit.c > test_condit.c:15: warning 94: comparison is always false due to limited > range of data type > test_condit.c:15: warning 94: comparison is always false due to limited > range of data type > test_condit.c:15: warning 94: comparison is always false due to limited > range of data type > test_condit.c:15: warning 94: comparison is always false due to limited > range of data type > test_condit.c:15: warning 94: comparison is always false due to limited > range of data type > test_condit.c:15: warning 94: comparison is always false due to limited > range of data type > ?ASxxxx-Error-<o> in line 136 of test_condit.asm > <o> .org in REL area or directive / mnemonic error > > ... The assembler seems to choke on the extra long line in the test_condit.asm file: ; test_condit.c:15: U0GCR = 230400 == 2400 ? 6 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 4800 ? 7 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 9600 ? 8 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 14400 ? 8 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 19200 ? 9 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 28800 ? 9 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 38400 ? 10 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 57600 ? 10 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 76800 ? 11 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 115200 ? 11 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 153600 ? 12 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 230400 ? 12 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == As a workaround you can compile test_condit.c if you tell SDCC to not include the C-source in the asssembler file: sdcc --no-c-code-in-asm test_condit.c Another workaround would be to first run "indent" over test_condit.c so some line-feeds are inserted: indent test_condit.c sdcc test_condit.c It's nice you bombard SDCC with autogenerated code (nesC), this problem would not likely have been detected with human-written code:) Greetings, Frieder |
From: Martin L. <le...@di...> - 2007-12-28 10:45:12
|
Hi Frieder. On fre, 2007-12-28 at 10:05 +0100, Frieder Ferlemann wrote: > The assembler seems to choke on the extra long line in the test_condit.asm file: > ... > As a workaround you can compile test_condit.c if you tell SDCC > to not include the C-source in the asssembler file: > > sdcc --no-c-code-in-asm test_condit.c Ahh, I see. No human is going to read the asm, so that will suffice in my case. > It's nice you bombard SDCC with autogenerated code (nesC), > this problem would not likely have been detected with > human-written code:) My thoughts exactly, I would love for SDCC to compile my TinyOS port, if possible. If SDCC can benefit, well that's an added bonus. -- Regards Martin Leopold. Dept. of Computer Science, University of Copenhagen |
From: Borut R. <bor...@si...> - 2007-12-28 19:38:40
|
Fixed in svn revision #4984. Frieder, thanks for your for discovering the cause! Borut Frieder Ferlemann wrote: > Hi Martin, > > Martin Leopold schrieb: > >> problems with sdcc. The statement returns a bunch of warnings and fails >> in the assembler with the following error: >> >> sdcc -mmcs51 test_condit.c >> test_condit.c:15: warning 94: comparison is always false due to limited >> range of data type >> test_condit.c:15: warning 94: comparison is always false due to limited >> range of data type >> test_condit.c:15: warning 94: comparison is always false due to limited >> range of data type >> test_condit.c:15: warning 94: comparison is always false due to limited >> range of data type >> test_condit.c:15: warning 94: comparison is always false due to limited >> range of data type >> test_condit.c:15: warning 94: comparison is always false due to limited >> range of data type >> ?ASxxxx-Error-<o> in line 136 of test_condit.asm >> <o> .org in REL area or directive / mnemonic error >> >> ... >> > > The assembler seems to choke on the extra long line in the test_condit.asm file: > > ; test_condit.c:15: U0GCR = 230400 == 2400 ? 6 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 4800 ? 7 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 9600 ? 8 + ((CLKCON & (1 << > CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 14400 ? 8 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 19200 ? 9 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 28800 ? 9 + ((CLKCON & (1 << > CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 38400 ? 10 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 57600 ? 10 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 76800 ? 11 + ((CLKCON & (1 << > CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 115200 ? 11 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 153600 ? 12 + ((CLKCON & (1 << CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == 230400 ? 12 + ((CLKCON & (1 << > CC2430_CLKCON_OSC)) >> CC2430_CLKCON_OSC) : 230400 == > > > > As a workaround you can compile test_condit.c if you tell SDCC > to not include the C-source in the asssembler file: > > sdcc --no-c-code-in-asm test_condit.c > > Another workaround would be to first run "indent" over test_condit.c > so some line-feeds are inserted: > > indent test_condit.c > sdcc test_condit.c > > It's nice you bombard SDCC with autogenerated code (nesC), > this problem would not likely have been detected with > human-written code:) > > Greetings, > Frieder > |