Error during uploading firmware to Printrboard Rev D

Generating function prototypes...
"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/avr/bin/avr-g++" -E -CC -x c++ -w  -g -Wall -ffunction-sections -fdata-sections -fno-exceptions -felide-constructors -std=c++0x -mmcu=at90usb1286 -DTEENSYDUINO=136 -DARDUINO_ARCH_AVR -DARDUINO=10801 -DF_CPU= -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy" "C:\Users\Gaurav\AppData\Local\Temp\arduino_build_522168\sketch\Marlin.ino.cpp" -o "C:\Users\Gaurav\AppData\Local\Temp\arduino_build_522168\preproc\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/wiring.h:33:0,

                 from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/WProgram.h:19,

                 from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/Arduino.h:1,

                 from C:\Users\Gaurav\AppData\Local\Temp\arduino_build_522168\sketch\Marlin.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2110:13: error: operator '==' has no left operand

   #if F_CPU == 16000000L

             ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2112:15: error: operator '==' has no left operand

   #elif F_CPU == 8000000L

               ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2114:15: error: operator '==' has no left operand

   #elif F_CPU == 4000000L

               ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2116:15: error: operator '==' has no left operand

   #elif F_CPU == 2000000L

               ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2121:15: error: operator '==' has no left operand

   #elif F_CPU == 1000000L

               ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2132:4: error: #error "Clock must be 16, 8, 4, 2 or 1 MHz"

   #error "Clock must be 16, 8, 4, 2 or 1 MHz"

    ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2156:13: error: operator '==' has no left operand

   #if F_CPU == 16000000L

             ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2164:15: error: operator '==' has no left operand

   #elif F_CPU == 8000000L

               ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2170:15: error: operator '==' has no left operand

   #elif F_CPU == 4000000L

               ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2174:15: error: operator '==' has no left operand

   #elif F_CPU == 2000000L

               ^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2180:15: error: operator '==' has no left operand

   #elif F_CPU == 1000000L

               ^

exit status 1
Error compiling for board [BootloaderCDC]Teensylu/Printrboard.

Great, this is actually progress. From the error messages I was able to easily find the the problem. Please try replacing the Teensy boards.txt with the attached file, as you did before.

boards.txt (48 KB)

Wow!!....Its working now. No errors generated.

Thanks a lot pert for your great support............

Now, my next step is to install rev D & feed this code. Once I am done I will let you know how my printer is working.

If you don't mind, may I know what exactly was the issue?

So glad to hear! Teensyduino is set up a bit different than normal boards.txt files so I was working blind but luckily that error message made it easy.

The original problem was the file was at least 3 years old and the Arduino IDE and Teensyduino along with it has changed during that time so that it became not backwards compatible with the old boards.txt. At the time the original file was written the name of the tools used in compilation were hardcoded into platform.txt. As new Teensy boards were added it was necessary to instead set these tool names in boards.txt so that different boards could use different tools. Because the original modified boards.txt didn't define the tool name you ended up with the error:

exec: "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/": file does not exist

As you can see, that is only a path, there is no file name because it wasn't defined. From the Teensy platform.txt file:

compiler.path={runtime.hardware.path}/../tools/
recipe.preproc.macros="{compiler.path}{build.toolchain}{build.command.g++}" -E -CC -x c++ -w {compiler.cpp.flags} {build.flags.common} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} {includes} "{source_file}" -o "{preprocessed_file_path}"

So as you can see from the error, only compiler.path was defined, build.toolchain and build.command.g++ were not.

So I had to add the definitions for the tool names to the "[BootloaderCDC]Teensylu/Printrboard" board definition. In the case above it was:

cdcteensylu.build.toolchain=avr/bin/
cdcteensylu.build.command.g++=avr-g++

As you can see from the second output you posted Arduino was then able to know that g++ tool path and name was avr/bin/avr-g++:

"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/avr/bin/avr-g++" -E -CC -x c++ -w  -g -Wall -ffunction-sections -fdata-sections -fno-exceptions -felide-constructors -std=c++0x -mmcu=at90usb1286 -DTEENSYDUINO=136 -DARDUINO_ARCH_AVR -DARDUINO=10801 -DF_CPU= -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy" "C:\Users\Gaurav\AppData\Local\Temp\arduino_build_522168\sketch\mesh_bed_leveling.cpp" -o "nul"

There were actually more tools that needed to be defined, this was just the first one in the build process because it's the preprocessor so the first build never got past that point due to the error.

The second error that you encountered was caused by Teensyduino changing the property name build.f_cpu to build.fcpu at some time in the last few years. I have no clue why they would have done that, f_cpu is the standard name used by every other hardware package. So that caused the macro F_CPU to not have the correct value. Teensy's platform.txt passes the flag to every compile step:

-DF_CPU={build.fcpu}

This macro is used to know what the clock speed of the microcontroller is. Luckily the compiler gave us a very helpful error message that made it clear to me something had gone wrong with that definition:

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy/core_pins.h:2110:13: error: operator '==' has no left operand

   #if F_CPU == 16000000L

what it's saying is that that statement was being interpreted as:

#if == 16000000L

Which of course is not valid code. So to fix it I only had to change the line in boards.txt:

cdcteensylu.build.f_cpu=16000000L

to:

cdcteensylu.build.fcpu=16000000L

I was excited to read this as this is the exact problem Ive been having today, I copied Pert's "boards.txt"
to the correct folder but now I have the error -

pins.h:1354: error: #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.

#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.

what did I miss?

Khera:
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.

what did I miss?

It sounds like a configuration problem with Marlin. It's expecting you to be using an ATmega2560 or ATmega1280 based board but I'm guessing that is not the case. The microcontroller specified by the "[BootloaderCDC]Teensylu/Printrboard" Tools -> Board menu selection is AT90usb1286. I'm not a Marlin expert but I know you have to have all the settings in Configuration.h and Configuration_adv.h correct for your printer.