Welcome! Log In Create A New Profile

Advanced

How to compile Marlin source code with arduino1.0.3 and Gen7 2.1?thumbs up

Posted by rodrigueroland 
How to compile Marlin source code with arduino1.0.3 and Gen7 2.1?thumbs up
February 15, 2013 08:52AM
Hello,

I'm trying to compile the source code "Marlin" for my Mendel RepRapPro. I unpacked Arduino 1.0.3 in a folder without space in the path (to be sure). I unpacked Gen7 (2.1) in the hardware folder. I duplicate again this folder in the folder of Marlin. I modified the sketches folder to point to Marlin folder. I selected Gen7 wit Atmega1284P with 16MHz in Tools->Board submenu.

And again and again, I get an error when I tried to compile on Line 119 of MarlinSerial.h:
FORCE_INLINE void print(const String &s)

Here is the complete log:
In file included from cardreader.cpp:1:
/Marlin.h:33:26: error: WProgram.h: No such file or directory
In file included from /Marlin.h:41,
                 from cardreader.cpp:1:
MarlinSerial.h:119: error: expected ',' or '...' before '&' token
MarlinSerial.h:119: error: ISO C++ forbids declaration of 'String' with no type
MarlinSerial.h:138: error: expected ',' or '...' before '&' token
MarlinSerial.h:138: error: ISO C++ forbids declaration of 'String' with no type
/MarlinSerial.h: In member function 'void MarlinSerial::print(int)':
MarlinSerial.h:121: error: 's' was not declared in this scope
In file included from cardreader.cpp:1:
/Marlin.h: In function 'void serialPrintFloat(float)':
Marlin.h:115: error: call of overloaded 'print(int)' is ambiguous
/MarlinSerial.h:119: note: candidates are: void MarlinSerial::print(int)
/MarlinSerial.h:126: note:                 void MarlinSerial::print(const char*) 
/MarlinSerial.h:130: note:                 void MarlinSerial::print(char, int)
/MarlinSerial.h:131: note:                 void MarlinSerial::print(unsigned char, int)
/MarlinSerial.h:132: note:                 void MarlinSerial::print(int, int)
/MarlinSerial.h:133: note:                 void MarlinSerial::print(unsigned int, int)
/MarlinSerial.h:134: note:                 void MarlinSerial::print(long int, int)
/MarlinSerial.h:135: note:                 void MarlinSerial::print(long unsigned int, int)
/MarlinSerial.h:136: note:                 void MarlinSerial::print(double, int)
Marlin.h:118: error: call of overloaded 'print(int)' is ambiguous
/MarlinSerial.h:119: note: candidates are: void MarlinSerial::print(int)
/MarlinSerial.h:126: note:                 void MarlinSerial::print(const char*) 
/MarlinSerial.h:130: note:                 void MarlinSerial::print(char, int)
/MarlinSerial.h:131: note:                 void MarlinSerial::print(unsigned char, int)
/MarlinSerial.h:132: note:                 void MarlinSerial::print(int, int)
/MarlinSerial.h:133: note:                 void MarlinSerial::print(unsigned int, int)
/MarlinSerial.h:134: note:                 void MarlinSerial::print(long int, int)
/MarlinSerial.h:135: note:                 void MarlinSerial::print(long unsigned int, int)
/MarlinSerial.h:136: note:                 void MarlinSerial::print(double, int)
/Marlin.h: At global scope:
Marlin.h:124: error: variable or field 'manage_inactivity' declared void
Marlin.h:124: error: 'byte' was not declared in this scope
cardreader.cpp: In constructor 'CardReader::CardReader()':
cardreader.cpp:29: error: 'millis' was not declared in this scope
cardreader.cpp: In member function 'void CardReader::checkautostart(bool)':
cardreader.cpp:419: error: 'millis' was not declared in this scope
cardreader.cpp: In member function 'void CardReader::fast_xfer(char*)':
cardreader.cpp:538: error: 'boolean' was not declared in this scope
cardreader.cpp:538: error: expected `;' before 'done'
cardreader.cpp:541: error: 'LOW' was not declared in this scope
cardreader.cpp:541: error: 'LOW' was not declared in this scope
cardreader.cpp:542: error: 'LOW' was not declared in this scope
cardreader.cpp:542: error: 'LOW' was not declared in this scope
cardreader.cpp:586: error: 'done' was not declared in this scope

It seems that it doesn't find WProgram.h which is located in Gen7 folder. I modified the makefile:
#For "old" Arduino Mega
#MCU = atmega1280
#For Arduino Mega2560
#MCU = atmega2560
#For Sanguinololu
#MCU = atmega644p 
MCU = atmega1284p
#For Printrboard
#MCU = at90usb1286 


#Arduino install directory
INSTALL_DIR = ../../arduino-1.0.3/

# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
# if you are setting this to something other than 16MHz
F_CPU = 16000000

UPLOAD_RATE = 115200
AVRDUDE_PROGRAMMER = arduino
PORT = /dev/arduino

TARGET = $(notdir $(CURDIR))


############################################################################
# Below here nothing should be changed...

ARDUINO = $(INSTALL_DIR)/hardware/Gen7/arduino/cores/arduino
AVR_TOOLS_PATH = 
SRC =  $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
	$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
	$(ARDUINO)/wiring_pulse.c \
	$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
CXXSRC = $(ARDUINO)/WMath.cpp $(ARDUINO)/WString.cpp\
	$(ARDUINO)/Print.cpp applet/Marlin.cpp MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp stepper.cpp temperature.cpp cardreader.cpp MatrixMath.cpp FPUTransform.cpp z_probe.cpp
	
FORMAT = ihex


Thank you in advance for your help.
Re: How to compile Marlin source code with arduino1.0.3 and Gen7 2.1?thumbs up
February 16, 2013 07:26AM
WProgram.h is gone since Arduino 1.0, accordingly it's no longer part of the Gen7 Arduino IDE Support package. I'd file a bug with Marlin, there should be an #include which works on both, Arduino 0023 and Arduino 1.0+.

Also I see Marlin has sort of its own Arduino library in the Sanguino folder. Not sure what's the role of that.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: How to compile Marlin source code with arduino1.0.3 and Gen7 2.1?thumbs up
March 26, 2013 03:19AM
Hi,

did you get this solved?
I'm having the exact same problem because I'm using ATmega644P
#if ARDUINO >= 100 
  #if defined(__AVR_ATmega644P__) || defined (__AVR_ATmega1284P__)
    #include "WProgram.h"
  #else
    #include "Arduino.h"
  #endif
#else
   #include "WProgram.h"
#endif

I have tried to copy Wprogram.h from sanguino/cores/arduino back to marlin/ root
then I have another bug:

In file included from Marlin.ino:51:
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/variants/gen7/pins_arduino.h:50: error: redefinition of 'const uint8_t A0'
WProgram.h:51: error: 'const uint8_t A0' previously defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/variants/gen7/pins_arduino.h:51: error: redefinition of 'const uint8_t A1'
WProgram.h:52: error: 'const uint8_t A1' previously defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/variants/gen7/pins_arduino.h:52: error: redefinition of 'const uint8_t A2'
WProgram.h:53: error: 'const uint8_t A2' previously defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/variants/gen7/pins_arduino.h:53: error: redefinition of 'const uint8_t A3'
WProgram.h:54: error: 'const uint8_t A3' previously defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/variants/gen7/pins_arduino.h:54: error: redefinition of 'const uint8_t A4'
WProgram.h:55: error: 'const uint8_t A4' previously defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/variants/gen7/pins_arduino.h:55: error: redefinition of 'const uint8_t A5'
WProgram.h:56: error: 'const uint8_t A5' previously defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/variants/gen7/pins_arduino.h:56: error: redefinition of 'const uint8_t A6'
WProgram.h:57: error: 'const uint8_t A6' previously defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/variants/gen7/pins_arduino.h:57: error: redefinition of 'const uint8_t A7'
WProgram.h:58: error: 'const uint8_t A7' previously defined here
In file included from Marlin.ino:154:
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/cores/arduino/Arduino.h:207: error: default argument given for parameter 3 of 'long unsigned int pulseIn(uint8_t, uint8_t, long unsigned int)'
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/cores/arduino/Arduino.h:116: error: after previous specification in 'long unsigned int pulseIn(uint8_t, uint8_t, long unsigned int)'
/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/cores/arduino/Arduino.h:209: error: default argument given for parameter 3 of 'void tone(uint8_t, unsigned int, long unsigned int)'
WProgram.h:24: error: after previous specification in 'void tone(uint8_t, unsigned int, long unsigned int)'

This looks simple, I could probably fix this one at least, but it seems odd that it is not working.
There's been only one commit on https://github.com/reprappro/Marlin since your report, and apparently no report of the problem.

I filed an issue: https://github.com/reprappro/Marlin/issues/2 (can't believe it's number 2 only!)

Edited 1 time(s). Last edit at 03/26/2013 03:20AM by coolnodje.
Re: How to compile Marlin source code with arduino1.0.3 and Gen7 2.1?thumbs up
April 05, 2013 12:58AM
As mentioned in http://code.google.com/p/sanguino/issues/detail?id=27#c1 it compiles if #include WProgram.h is commented out.
It seems unnecessary with Arduino > 1.0 (as mentioned here ).

So why is this still enabled in the latest version of Marlin?

Now, it compiles, but there's an error with Arduino IDE:

Binary sketch size: 78,354 bytes (of a 63,488 byte maximum)

It's probably a setting outside of the Marlin project but I don't know how to configure it.
Re: How to compile Marlin source code with arduino1.0.3 and Gen7 2.1?thumbs up
April 05, 2013 07:07AM
If Marlin compiles to 78k, it simply doesn't fit into an ATmega644(P). The solution would be to reduce the number of features compiled in, like removing display or SD card stuff. Not sure how this is done in Marlin, though.

Another solution is to upgrade to an ATmega1284P, of course. 644, 644P and 1284P are all pin compatible.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: How to compile Marlin source code with arduino1.0.3 and Gen7 2.1?thumbs up
April 07, 2013 11:02PM
hence the name of the chips ... does make sense now!
Could to know 1284PIis all pin comptible, but it's not an easy option for me to replace the chip as it's the soldered version.

It's a little bit awkward that the Marlin is problematic to compile for ATmega644P where it's supposed to be a supported platform...

What about Splinter? How does it compare to Marlin?
I just want to make sure I've a recent firmware, I don't really understand how it'll impact stability and performance of the printer.
Sorry, only registered users may post in this forum.

Click here to login