File
https://github.com/gnea/grbl-Mega/blob/edge/grbl/examples/grblUpload/grblUpload.ino
line 2:
This sketch compiles and uploads Grbl to your 328p-based Arduino!
评论 (2)
#2 – drf5n 于 2022-03-13
That’s designed for UNOs with the 328p
For the Mega on my Mac, I eventually found my way to this avrdude line:
avrdude -c stk500 -P /dev/cu.usbmodem1433401 -C /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -p atmega2560 -D -U flash:w:grbl.hex:i
But you’d need to update the -C config file path and -P /dev/xxxxx for your device. You can learn some details of the upload if you go into Arduino/Preferences and choose verbose output for Compilation and Upload. It will show you the complete paths and exact command used to upload a file to a atmega2560. If you use those hints to adjust the appropriate lines in the Makefile, such as https://github.com/gnea/grbl-Mega/blob/df87b36f48b90930714accf03b411b60d5d948e5/Makefile#L33 and
https://github.com/gnea/grbl-Mega/blob/df87b36f48b90930714accf03b411b60d5d948e5/Makefile#L44
I made those lines in my Makefile lines into:
PORT ?= /dev/cu.usbmodem1433401
PROGRAMMER ?= -c stk500 -C /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -D
AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) -P $(PORT)
you can then compile and flash it all from the command line with:
PORT=/dev/cu.usbmodem1433401 make clean flash
#1 – harshjn 于 2019-04-20
Agreed! There is some problem in the comment probably. In any case, it works with Arduino Mega 2560.