Compiling Grbl - romain145/grbl GitHub Wiki

This wiki is intended to provide various instructions on how to compile grbl. Once compiled, you should have a brand new .hex file to flash to your Arduino. Please feel free to contribute more up-to-date or alternative methods.

For Mac OS X:

Last updated: 2012-01-29 by chamnit. (Tested on OS X 10.7, 10.6, 10.4 and the Arduino IDE r22,v1.0)

Thanks to the great people working on the Arduino IDE, just about everything you need to compile grbl is included in their software package.

The trickiest part is setting up the environment path for the compilers included in the Arduino software. To do this, you'll need to first locate where they are. Depending on where you place your Arduino.app software, this will usually be located in /Applications/Arduino.app for most people. The complete path is then: /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin

To add the compiler path: Open the Terminal.app in /Applications/Utilities.

Then type: nano ~/.bashrc to edit your shell config file.

Now add this line at the end of the file: export PATH=$PATH:/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin or whatever your path happens to be.

Press Crtl-X to exit and select Yes to save the file. Now you have added the compiler path. You will need to close the current working window and re-open a new one for the path to be loaded correctly.

To compile: Once your paths are setup, all you will need to do is go to your grbl directory and type make. (To clear all of the old compilation files from a previous build, type make clean first.) This should call avr-gcc, begin compiling grbl, and create a brand new firmware file called grbl.hex that may then be flashed to your Arduino.

For Windows:

Last updated: 2012-01-28 by txjammer. (Tested on Win Xp and the Arduino IDE r23)

You can use the Arduino platform as well since it comes with "win-avr" avrgcc.

You must add the paths the the executable's like make.exe and avrdude.exe to windows environment variables. Right click my computer on the start menu and click Properties. Go to the Advanced tab and on the bottom there will be a button that says environment variables. Under system variables there will be a Variable with the name "Path". Click edit and add the paths to the executable's eg, C:\arduino-00xx\hardware\tools\avr\bin;C:\arduino-00xx\hardware\tools\avr\avr\bin;C:\arduino-00xx\hardware\tools\avr\utils\bin Do not erase your previous paths just add the new ones. Once this is done you can compile the source.

Click start, in the run box, type cmd or find the command prompt, usually in start -> programs -> accessories.

Change your path to the grbl path.

cd C:\gbrlpath

type

make clean make grbl.hex

If all goes well grbl.hex should be created and you can upload to your atmega328p using avrdude.

Ruby is optional, but if you don't edit the Makefile you will need to download ruby and in the installation settings add the path to environment variables again. Then you can compile the full source with flash calculation. If you don't want to install ruby, edit the Makefile everything after ruby (on line 84 only).

For Linux:

Last updated: 2012-03-02 by speters. (Tested on ???)

Make sure you have the prerequisite libraries installed: avr-gcc and arduino (sudo aptitude install arduino)

At a terminal prompt, change directories to where the grbl source code located. Then type the following to compile and build the firmware:

make clean
make grbl.hex

For Ubuntu:

The following has been tested on Ubuntu 11.10 and an Arduino Uno. It will compile grbl from source code and flash it to your Arduino. It should in theory work with other flavours of debian too.

On a brand new ubuntu box, the install process goes like this:

  1. install the avr build tools by running:
sudo apt-get install gcc-avr avrdude avr-libc
  1. Compile the GRBL source code and create the firmware file:
wget https://github.com/downloads/bubbapizza/grbl/grbl-0.7.tar.gz
tar zxvf grbl-0.7.tar.gz
cd grbl-0.7
./configure
make
  1. To flash the firmware to your Arduino Uno, plug the arduino in using the USB cable and run the following command:
make install

Thats it, the firmware should now be installed on your arduino.

Other references:

  • DANK (Last updated 2/2011)