Grbl v1.1版本的编译方法

Grblv1.1版本的编译方法wiki翻译

Grbl v1.1 compile

source website: https://github.com/gnea/grbl/wiki/Compiling-Grbl

 

Via the Arduino IDE (AllPlatforms): Recommended for all users.

通过Adruino IDE的方法(全平台):推荐所有人使用

Thanks to thegreat people working on the Arduino IDE, it has everything you need to compilegrbl included in their software package. This method compiles the Grbl source codeand automatically uploads it to an Arduino. You can't directly flash apre-compiled .hex file through the IDE interface. See our Flashing Grbl to an Arduino wiki page forhow to do this if you only have a .hex file.

感谢那些开发ArduinoIDE的人,它包含了Grbl开发的环境,你需要完成的只要有它的软件包就可以了。这种编译的方法的可以将源代码并自动下载到Arduino上。你不能通过IDE界面直接烧写Hex文件。看我们的Flashing Grbl to an Adruino wiki页面,你可以知道怎么样只是用.hex文件烧写

NOTE: Before starting, delete prior Grbl library installations from theArduino IDE. Otherwise, you'll have compiling issues! On a Mac, Arduinolibraries are located in ~/Documents/Arduino/libraries/. On Windows, it's in MyDocuments\Arduino\libraries. On UBUNTU it's in /usr/share/arduino/librairies

注意:在开始之前,删除你之前按装在Arduino IDE中的Grbl库,否则你会有编译问题,在Mac上,库在~/Documents/Arduino/libraries/.,在windows上,库文件在My Documents\Arduino\libraries.在UBUNTU上,库文件在/usr/share/arduino/librairies

 

  1. Download the Grbl source code.

下载Grbl的源码(先要打开网站,网址在websit)

  • Click on the <>Code Tab                   

点击该目录

  • Click the button on the Grbl home page. 

点击这个按钮

  • Click the Download ZIP                  

点击压缩包

  • Unzip the download and you'll have a folder called grbl-XXX, where XXX is the release version.                                    

解压压缩包,你会得到一个grbl-XXX的文件,其中XXX是版本号

  1. Launch the Arduino IDE

打开Arduino的IDE

  • Make sure you are using the most recent version of the Arduino IDE!

确保你使用的是最新版本的ArduinoIDE

  1. Load the grbl folder into the Arduino IDE as a Library.

加载你的Grbl文件夹到你的Arduino IDE 的库上面

  • Click the Sketch drop-down menu, navigate to Include Library and select Add .ZIP Library. The Add .ZIP Library command supports both a .ZIP file or a folder. In our case, there is no .ZIP file.

点击Sketch下拉菜单,找到Include Libraryà Add .ZIPLibrary, zip库命令支持一个zip文件或一个文件夹。在我们的例子中,没有zip文件(所以你只要选择文件夹就可以了)。

  • You can confirm that the library has been added. Click the Sketch drop-down menu again, navigate to Include Library, then scroll to the bottom of the list where you should see grbl.

为了确认已添加了该库。单击草图下拉菜单再次浏览包括图书馆,然后滚动到下方的列表,你可以查看到库

  • IMPORTANT: Select the grbl folder inside the grbl-XXX folder, which only contains the source files and an example directory.

重要的一点:选择grbl-XXX文件夹中的grbl文件夹,这里面包含了一个源文件和一个实例文件夹

  • If you accidentally select the .zip file or the wrong folder, you will need to navigate to your Arduino library, delete the mistake, and re-do Step 3.

如果你不小心选择ZIP文件或错误的文件夹,您需要导航到你的Arduino库,删除错误,再做3步。

  1. Open the GrblUpload Arduino example.

打开GrblUpload里的Arduino例程

  • Click the File down-down menu, navigate to Examples->Grbl, and select GrblUpload.

单击down下拉菜单,找到Examples->Grbl->GrblUpload

  1. Compile and upload Grbl to your Arduino.

编译并下载Grbl到你的Arduino上面

  • Connect your Arduino Uno to your computer.

连接你的ArduinoUno到你的电脑上

  • Make sure your board is set to the Arduino Uno in the Tool->Board menu and the serial port is selected correctly in Tool->Serial Port.

在菜单Tool->Board和Tool->Serial Port.中检查你板子的型号和端口是否正确

  • Click the Upload, and Grbl should compile and flash to your Arduino! (Flashing with a programmer also works by using the Upload Using Programmer menu command.)

单击下载,Grbl就会编译并且下载到你的Adruino上面去

Compiling GRBL or Advanced Users: Most users are just finewith Grbl's default build, but you can customize Grbl by editing the config.hfile in the Arduino library (not where you downloaded it, it has been copiedinto Arduino Library) folder. This file enables or disables all of Grbl'sadditional compile-time options. There are descriptions in the file thatexplains what they all do. Once edited and saved, just follow the steps aboveto flash your custom Grbl build!

编译Grbl与高级用户:大多数用户都的Grbl都是使用默认配置的,但是您自定义它的配置,这个通过库文件中的config.h可以实现。这个文件中启用或禁用Grbl的所有额外的编译时的选项。文件中有说明它们都做了什么。每次编辑之后都要保存,然后按照之前的操作烧写到Adruino当中去

No fuss! No muss!

不要担心,不要怕麻烦

NOTE: If you arehaving upload issues, try re-burning the Arduino bootloader. If you have aspare Arduino, it's easy!

注意:如果你下载下载出现问题,你可以试着重新烧写板子的bootloader(引导程序),如果你有多余的Adruino板子,那更方便一点

 

The followingmethods are for reference only.

下列方法仅供参考

 

For Mac OS X:              适用于Mac OS X平台

此段忽略

For Windows:               适用于Windows平台

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

你可以使用Arduino的平台也可以使用含有“win-avr”的avrgcc

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

你必须添加可执行文件make.exe和avrdude.exe Windows环境变量的路径。右键单击“开始”菜单上的“计算机”,然后单击“属性”。转到高级选项卡,在底部将有一个按钮,表示环境变量。在系统变量下,将有一个名为“Path”的变量。单击“编辑和添加路径的可执行文件,如C:\arduino-00xx\hardware\tools\avr\bin;C:\arduino-00xx\hardware\tools\avr\avr\bin;C:\arduino-00xx\hardware\tools\avr\utils\bin,不要擦除以前的路径只是添加新路径。完成之后,就可以编译源代码了。

For windows 7 and arduino 1.5.7

适用于windows7下的arduino1.5.7

Add the following paths to your PATH variable -be sure to include ; after each one, except the last in your PATH variableentry.

在每个路径之后添加以下路径-这些必须要包含,除了路径变量条目中的最后一个。

C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\bin\

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\

C:\Program Files(x86)\Arduino\hardware\arduino\sam\system\CMSIS\Examples\cmsis_example\gcc_atmel

C:\Program Files (x86)\Arduino

You will very likely need to restart your computer in order for Windowsto recognize the newly added paths.

为了让Windows识别新添加的路径,您很可能需要重新启动计算机。


Once your path has been updated, you can open a command prompt. To do so:

一旦你的路径更新了,你可以打开命令提示符,然后这样做:

Click start, in the run box, type cmd or find the command prompt in yourstart menu, usually in Start -> Programs -> Accessories.

点击“开始”,在“运行”框中,键入cmd或在“开始”菜单中找到命令提示符,这些在“启动”>“程序”>附件中。

Change your working directory to the directory that contains the grblsource code:

改变你的工作目录,进入包含grbl的源代码目录:

cdC:\grblpath

type

输入

makeclean

This will output something similar to this:

然后会输出下面的内容:

rm -fgrbl.hex main.elf main.o motion_control.o gcode.o spindle_control t_control.oserial.o protocol.o stepper.o eeprom.o settings.o planner.o ts.o limits.oprint.o probe.o report.o system.o main.d motion_control.d spindle_control.dcoolant_control.d serial.d protocol.d stepper.d eepro ngs.d planner.dnuts_bolts.d limits.d print.d probe.d report.d system.d

Type make grbl.hex or simply make

输入makegrbl.hex or simply make

If all goes well grbl.hex should be created and you can upload to youratmega328p using avrdude. For instructions on how to flash your newly compiledgrbl.hex file to your Arduino, see thiswiki entry

如果一切顺利grbl.hex应该被创建,你可以使用avrdude下载到你的atmega328p。对于如何操作你的刚编译的grbl.hex文件到你的Arduino,可以看这个维基条目

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

Ruby是一个选择,但如果你不编辑Makefile文件你需要下载Ruby并且再次安装设置添加的路径的环境变量,然后你可以编译源代码到flash中,如果你不想要安装ruby,编辑makefile移除everythingafter ruby (在第84行).

An alternative is to use Atmel Studio, a customized version of VisualStudio.

另一种选择是使用Atmel Studio,一个订制的Visual Studio

Last update: 2014-07-18 by gerritv (tested on Windows 8.1, 64bit)

  • Install Atmel Studio
  • Install the Create From Makefile Extension (Tools/Extension Manager)
  • run Tools/Create Project From Makefile
  • select the Makefile from your grbl code directory
  • Select Device, use ATmega328p for the Arduino Uno
  • In Projects/Properties, uncheck Use External Makefile
  • Add -DF_CPU=16000000 -mmcu=atmega328p to Project/Properties/Toolchain/AVR Gnu Compiler/Miscellaneous Other Flags

The last 2 steps need to be done for both Debug and Releaseconfigurations

对于调试和发布配置,需要完成最后2个步骤。

Enjoy the benefits of Visual Studio for Atmel/AVR

Atmel/avr的visual stido可以带给你很多的好处

 

For Linux:                     适用于Linux平台

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

请确保你已经安装了以下的库:avr-gcc和arduino

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

在实时终端页面,进入到gebl的源码目录下,输入下面的内容来编译和生成固件

make clean

make grbl.hex

 

For Arch Linux:            适用于ArchLinux平台

此段忽略

For Ubuntu:                  适用于UBUNTU平台

此段忽略

你可能感兴趣的:(GRBL)