1. 程式人生 > >Grbl v1.1版本的編譯方法

Grbl v1.1版本的編譯方法

Grblv1.1版本的編譯方法wiki翻譯

Grbl v1.1 compile

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平臺

此段忽略