Upload to Uno with Arduino IDE

Discussion about the arduino based g-code interpreter, grbl
Post Reply
scott216
Posts: 228
Joined: Thu Oct 10, 2013 12:35 pm
Location: New Jersey

Upload to Uno with Arduino IDE

Post by scott216 » Sat May 10, 2014 4:08 am

Here's how I uploaded the GRBL code to my Unio using the IDE - not flashing the pre-compiled hex file.
* Downloaded the source code from GitHub and put it into a new grbl directory on my computer.
* Renamed all the .c files to .cpp
* Created a grbl.ino file all it does is call startGrbl() in the setup() function. loop() function is empty
* Renamed main.c to maingrbl.cpp
* Created maingrbl.h. All it does is have the the line int startGrbl(void);
* In maingrbl.cpp I renamed the function main(void) to startGrbl(void).

This compiles in my Arduino IDE (v1.05) and I can upload to the Uno. I haven't tried to use it on my shapeoko yet.

GRBL 0.8c (which is the current release) needs 27,108 bytes based on the way I did it above. The Uno has 32,256 bytes, so there's plenty of room for the program and bootloader. Now, I don't know if my method will work with an Uno that's shipped with GRBL on it already, you may have to install a different bootloader first. I've never done that and don't know much about it.
Shapeoko v2 with DW660
GRBL v0.9i
Location: New Jersey

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Upload to Uno with Arduino IDE

Post by cvoinescu » Sat May 10, 2014 6:13 pm

What's wrong with the author's instructions? All you do is type "make grbl.hex" and you're done.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

scott216
Posts: 228
Joined: Thu Oct 10, 2013 12:35 pm
Location: New Jersey

Re: Upload to Uno with Arduino IDE

Post by scott216 » Sat May 10, 2014 7:13 pm

cvoinescu wrote:What's wrong with the author's instructions? All you do is type "make grbl.hex" and you're done.
I may want to make some changes (probably to 0.9d version) and if I change anything I'll do it in the Arduino IDE environment because I'm comfortable using it. Anytime I make a change I'll compile it to see if I have errors. There's probably lots of ways to do this, but I wanted to do it in an environment I'm already using.
Shapeoko v2 with DW660
GRBL v0.9i
Location: New Jersey

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Upload to Uno with Arduino IDE

Post by cvoinescu » Sat May 10, 2014 11:48 pm

scott216 wrote:[...] if I change anything I'll do it in the Arduino IDE environment because I'm comfortable using it.
That makes perfect sense. I usually try to avoid the Arduino IDE, so it did not occur to me that building from the IDE would be a plus. :)
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

mega-hz
Posts: 14
Joined: Mon May 19, 2014 8:25 am

Re: Upload to Uno with Arduino IDE

Post by mega-hz » Wed May 21, 2014 7:34 am

could you post your .ino file?

mine looks like this, but i doesnt compile...

Code: Select all

#include <D:\Arduino-1.0.5\Arduino Projekte\GRBL_CNC_Controller\maingrbl.h>

void setup()
{

  startGrbl();

}


void loop()
{
}

Error log:

Code: Select all

GRBL_CNC_Controller.cpp.o: In function `setup':
D:\Arduino-1.0.5/GRBL_CNC_Controller.ino:6: undefined reference to `startGrbl()'
limits.cpp.o: In function `__vector_3':
D:\Temp\build419062386041412533.tmp/limits.cpp:84: undefined reference to `sys'
D:\Temp\build419062386041412533.tmp/limits.cpp:85: undefined reference to `sys'
D:\Temp\build419062386041412533.tmp/limits.cpp:87: undefined reference to `sys'
D:\Temp\build419062386041412533.tmp/limits.cpp:87: undefined reference to `sys'
motion_control.cpp.o: In function `mc_reset()':
D:\Temp\build419062386041412533.tmp/motion_control.cpp:280: undefined reference to `sys'
motion_control.cpp.o:D:\Temp\build419062386041412533.tmp/motion_control.cpp:281: more undefined references to `sys' follow

scott216
Posts: 228
Joined: Thu Oct 10, 2013 12:35 pm
Location: New Jersey

Re: Upload to Uno with Arduino IDE

Post by scott216 » Wed May 21, 2014 11:28 am

mega-hz wrote:could you post your .ino file?
You can see all my files on GitHub: https://github.com/Scott216/grbl
.ino is here: https://github.com/Scott216/grbl/blob/master/grbl.ino
Shapeoko v2 with DW660
GRBL v0.9i
Location: New Jersey

mega-hz
Posts: 14
Joined: Mon May 19, 2014 8:25 am

Re: Upload to Uno with Arduino IDE

Post by mega-hz » Wed May 21, 2014 10:26 pm

Thank you very much!
THAT works!

still have a problem with compiling xlcd...
see here:
http://www.shapeoko.com/forum/viewtopic ... 374#p26374

mega-hz
Posts: 14
Joined: Mon May 19, 2014 8:25 am

Re: Upload to Uno with Arduino IDE

Post by mega-hz » Thu May 22, 2014 9:43 pm

Problem is solved now :-)
everything runs well so far!

Thanx to all!

Wolfram

scott216
Posts: 228
Joined: Thu Oct 10, 2013 12:35 pm
Location: New Jersey

Re: Upload to Uno with Arduino IDE

Post by scott216 » Fri May 23, 2014 2:42 am

mega-hz wrote:Problem is solved now :-)
everything runs well so far!
Wolfram
How did you fix your compile problem?
Shapeoko v2 with DW660
GRBL v0.9i
Location: New Jersey

Post Reply