Shop OBEX P1 Docs P2 Docs Learn Events
Weird issue with openspin preprocessor — Parallax Forums

Weird issue with openspin preprocessor

maccamacca Posts: 780
edited 2017-11-04 19:52 in Propeller 1
Hi,

I'm facing a weird issue when using the preprocessor directives with openspin, I don't understand if it is a bug or I'm missing something, hope someone can help.

The following sample code:
CON

    _XINFREQ = 5_000_000
    _CLKMODE = XTAL1 + PLL16X

OBJ

    debug  : "com.serial.terminal"

PUB start | temp

   debug.start(115200)

#ifdef MODE1
    aaa
#else
    bbb
#endif

    waitcnt(CNT + CLKFREQ)

Fails to properly compile the preprocessor directive, no matter how I define it on the command line, it always fails on the bbb statement (should fail on the aaa statement)
openspin -b -u -DMODE1 preproc.spin 
Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2016 Parallax Inc. DBA Parallax Semiconductor.
Version 1.00.80 Compiled on Nov  4 2017 20:31:52
Compiling...
preproc.spin
preproc.spin(18:5) : error : Expected an instruction or variable
Line:
    bbb
Offending Item: bbb

However if I remove the OBJ section, the compiler works as expected:
CON

    _XINFREQ = 5_000_000
    _CLKMODE = XTAL1 + PLL16X

PUB start | temp

   'debug.start(115200)
   waitcnt(CNT + CLKFREQ)

#ifdef MODE1
    aaa
#else
    bbb
#endif

    waitcnt(CNT + CLKFREQ)


openspin -b -u -DMODE1 preproc.spin 
Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2016 Parallax Inc. DBA Parallax Semiconductor.
Version 1.00.80 Compiled on Nov  4 2017 20:31:52
Compiling...
preproc.spin
preproc.spin(12:5) : error : Expected an instruction or variable
Line:
    aaa
Offending Item: aaa

Hope I'm not missing something obvious.
Any hint ?

Comments

Sign In or Register to comment.