Unknown error that doesn't appear when verifying on Arduino IDE

I tried to verify a marlin 1.1.8 firmware in Arduino Create and i got this error.
I then tried to verify the exact same sketch on the Arduino IDE and didn't get any errors.
Is there a reason this happens only on the Arduino Create? If necessary I don't mind uploading the sketch. Below is the error message

./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -build-path /tmp/849544824/build -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -libraries /tmp/849544824/pinned -libraries /tmp/849544824/custom -fqbn arduino:avr:mega:cpu=atmega2560 -build-cache /tmp -logger humantags -verbose=false /tmp/849544824/Tornado

In file included from /tmp/849544824/build/sketch/MarlinConfig.h:26:0,

from /tmp/849544824/build/sketch/Sd2Card.cpp:29:

/tmp/849544824/build/sketch/Sd2Card.h:100:39: error: pasting "/* SPI Master In Slave Out pin*/" and "_DDR" does not give a valid preprocessing token

#define SPI_MISO_PIN MISO_PIN // SPI Master In Slave Out pin

^

/tmp/849544824/build/sketch/fastio.h:94:35: note: in definition of macro '_SET_INPUT'

#define _SET_INPUT(IO) do {DIO ## IO ## _DDR &= ~_BV(DIO ## IO ## _PIN); } while (0)

^

/tmp/849544824/build/sketch/Sd2Card.cpp:316:3: note: in expansion of macro 'SET_INPUT'

SET_INPUT(SPI_MISO_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.cpp:316:13: note: in expansion of macro 'SPI_MISO_PIN'

SET_INPUT(SPI_MISO_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.h:100:39: error: pasting "/* SPI Master In Slave Out pin*/" and "_PIN" does not give a valid preprocessing token

#define SPI_MISO_PIN MISO_PIN // SPI Master In Slave Out pin

^

/tmp/849544824/build/sketch/fastio.h:94:61: note: in definition of macro '_SET_INPUT'

#define _SET_INPUT(IO) do {DIO ## IO ## _DDR &= ~_BV(DIO ## IO ## _PIN); } while (0)

^

/tmp/849544824/build/sketch/Sd2Card.cpp:316:3: note: in expansion of macro 'SET_INPUT'

SET_INPUT(SPI_MISO_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.cpp:316:13: note: in expansion of macro 'SPI_MISO_PIN'

SET_INPUT(SPI_MISO_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.h:99:39: error: pasting "/* SPI Master Out Slave In pin*/" and "_DDR" does not give a valid preprocessing token

#define SPI_MOSI_PIN MOSI_PIN // SPI Master Out Slave In pin

^

/tmp/849544824/build/sketch/fastio.h:95:36: note: in definition of macro '_SET_OUTPUT'

#define _SET_OUTPUT(IO) do {DIO ## IO ## _DDR |= _BV(DIO ## IO ## _PIN); } while (0)

^

/tmp/849544824/build/sketch/Sd2Card.cpp:317:3: note: in expansion of macro 'SET_OUTPUT'

SET_OUTPUT(SPI_MOSI_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.cpp:317:14: note: in expansion of macro 'SPI_MOSI_PIN'

SET_OUTPUT(SPI_MOSI_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.h:99:39: error: pasting "/* SPI Master Out Slave In pin*/" and "_PIN" does not give a valid preprocessing token

#define SPI_MOSI_PIN MOSI_PIN // SPI Master Out Slave In pin

^

/tmp/849544824/build/sketch/fastio.h:95:61: note: in definition of macro '_SET_OUTPUT'

#define _SET_OUTPUT(IO) do {DIO ## IO ## _DDR |= _BV(DIO ## IO ## _PIN); } while (0)

^

/tmp/849544824/build/sketch/Sd2Card.cpp:317:3: note: in expansion of macro 'SET_OUTPUT'

SET_OUTPUT(SPI_MOSI_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.cpp:317:14: note: in expansion of macro 'SPI_MOSI_PIN'

SET_OUTPUT(SPI_MOSI_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.h:101:39: error: pasting "/* SPI Clock pin*/" and "_DDR" does not give a valid preprocessing token

#define SPI_SCK_PIN SCK_PIN // SPI Clock pin

^

/tmp/849544824/build/sketch/fastio.h:95:36: note: in definition of macro '_SET_OUTPUT'

#define _SET_OUTPUT(IO) do {DIO ## IO ## _DDR |= _BV(DIO ## IO ## _PIN); } while (0)

^

/tmp/849544824/build/sketch/Sd2Card.cpp:318:3: note: in expansion of macro 'SET_OUTPUT'

SET_OUTPUT(SPI_SCK_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.cpp:318:14: note: in expansion of macro 'SPI_SCK_PIN'

SET_OUTPUT(SPI_SCK_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.h:101:39: error: pasting "/* SPI Clock pin*/" and "_PIN" does not give a valid preprocessing token

#define SPI_SCK_PIN SCK_PIN // SPI Clock pin

^

/tmp/849544824/build/sketch/fastio.h:95:61: note: in definition of macro '_SET_OUTPUT'

#define _SET_OUTPUT(IO) do {DIO ## IO ## _DDR |= _BV(DIO ## IO ## _PIN); } while (0)

^

/tmp/849544824/build/sketch/Sd2Card.cpp:318:3: note: in expansion of macro 'SET_OUTPUT'

SET_OUTPUT(SPI_SCK_PIN);

^

/tmp/849544824/build/sketch/Sd2Card.cpp:318:14: note: in expansion of macro 'SPI_SCK_PIN'

SET_OUTPUT(SPI_SCK_PIN);

^

exit status 1

I can't reproduce the error. Have you made any modifications to the configuration of Marlin or is it the unmodified 1.1.8 code just as it's downloaded from:

pert:
I can't reproduce the error. Have you made any modifications to the configuration of Marlin or is it the unmodified 1.1.8 code just as it's downloaded from:
Release 1.1.8 · MarlinFirmware/Marlin · GitHub

I think it's modded slightly. I've attached the sketch in this post

Tornado.zip (985 KB)

Ok, now I can reproduce the error. The reason why it fails in the Arduino Web Editor is because it uses a brand new sketch preprocessing tool named arduino-preprocessor that is still in beta development stage and has some bugs. That tool is not used in any of the release versions of the Arduino IDE. It is used in the beta build of the Arduino IDE and the same error occurs when I compile that program with the beta IDE build.

I don't know why they decided it would be a good idea to make all the users of the Arduino Web Editor unknowing beta testers.

pert:
Ok, now I can reproduce the error. The reason why it fails in the Arduino Web Editor is because it uses a brand new sketch preprocessing tool named arduino-preprocessor that is still in beta development stage and has some bugs. That tool is not used in any of the release versions of the Arduino IDE. It is used in the beta build of the Arduino IDE and the same error occurs when I compile that program with the beta IDE build.

I don't know why they decided it would be a good idea to make all the users of the Arduino Web Editor unknowing beta testers.

Seriously??? Is there any way to turn off 'beta mode'

yeowjoon99:
Is there any way to turn off 'beta mode'

Use the standard Arduino IDE if you want control over the software you're using. arduino-preprocessor will eventually make its way into an Arduino IDE production release but only after it is in a more stable state and even then you always have the option of installing any previous version of the IDE if the current release has issues.

pert:
Use the standard Arduino IDE if you want control over the software you're using. arduino-preprocessor will eventually make its way into an Arduino IDE production release but only after it is in a more stable state and even then you always have the option of installing any previous version of the IDE if the current release has issues.

Sadly i'm unable to use the Arduino IDE because i need it on my chromebook

I investigated the problem and found the fix was pretty easy. You only need to change lines 99-101 of Sd2Card.h from:

  #define SPI_MOSI_PIN MOSI_PIN       // SPI Master Out Slave In pin
  #define SPI_MISO_PIN MISO_PIN       // SPI Master In Slave Out pin
  #define SPI_SCK_PIN SCK_PIN         // SPI Clock pin

to:

  // SPI Master Out Slave In pin
  #define SPI_MOSI_PIN MOSI_PIN
  // SPI Master In Slave Out pin
  #define SPI_MISO_PIN MISO_PIN       
  // SPI Clock pin
  #define SPI_SCK_PIN SCK_PIN

It turns out this is caused by a bug I reported 4 months ago:

Where did you download the Tornado firmware from? I found the manufacturer's download page:

but when I try to download I get a 0 byte file. While investigating your problem I hit another bug in the beta version of the Arduino AVR Boards toolchain. Don't worry, that bug shouldn't affect you but I want to report it to the Arduino developers and I'd rather point them to the official download of the firmware instead the copy you posted here.

Oh i downloaded it from the Tevo Tornado Owners group on facebook. Someone edited the latest version of marlin to suit the tevo tornado.
And man i can't thank you enough for spending your time to read the error and go through the pages of code.
I'll definitely read up on the bug you reported in your link so that i might be able to avoid the same issues in the future as i'll be using arduino create more frequently now :smiley:

yeowjoon99:
Oh i downloaded it from the Tevo Tornado Owners group on facebook.

Argh. I hate closed Facebook groups. So this is not the official firmware. That makes it a bit less attractive to me as a demonstration of the bug. I had previously encountered this bug when compiling my own code but it's really messy so I wanted to use some more mainstream code to use as a demonstration in my bug report so I don't get the "well look at this code, no wonder" sort of reaction. So I was excited to encounter the same bug when compiling the Tornado firmware.

yeowjoon99:
I'll definitely read up on the bug you reported in your link so that i might be able to avoid the same issues in the future as i'll be using arduino create more frequently now :smiley:

It's pretty interesting. The original error in that issue report bears no resemblance to the one you encountered but luckily one of the Arduino developers dug into the issue a bit and determined it was caused by inline comments after a macro definition. I noticed your error was also due to a comment and so that was the clue I needed to resolve it by simply putting those comments on their own line instead of having them inline with the macro definition. There are a lot of other inline comments so it is possible you might encounter the same sort of error if you modify the Marlin configuration. At least the fix is pretty easy once you understand the problem.