File re-organization. New Makefile.
- Re-organized source code files into a ‘grbl’ directory to lessen one step in compiling Grbl through the Arduino IDE. - Added an ‘examples’ directory with an upload .INO sketch to further simplify compiling and uploading Grbl via the Arduino IDE. - Updated the Makefile with regard to the source code no longer being in the root directory. All files generated by compiling is placed in a separate ‘build’ directory to keep things tidy. The makefile should operate in the same way as it did before.
This commit is contained in:
parent
3b468f602b
commit
b237ad566a
40
Makefile
40
Makefile
@ -1,7 +1,7 @@
|
|||||||
# Part of Grbl
|
# Part of Grbl
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2011 Simen Svale Skogsrud
|
# Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||||
# Copyright (c) 2012 Sungeun K. Jeon
|
# Copyright (c) 2012-2015 Sungeun K. Jeon
|
||||||
#
|
#
|
||||||
# Grbl is free software: you can redistribute it and/or modify
|
# Grbl is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -31,9 +31,11 @@
|
|||||||
DEVICE ?= atmega328p
|
DEVICE ?= atmega328p
|
||||||
CLOCK = 16000000
|
CLOCK = 16000000
|
||||||
PROGRAMMER ?= -c avrisp2 -P usb
|
PROGRAMMER ?= -c avrisp2 -P usb
|
||||||
OBJECTS = main.o motion_control.o gcode.o spindle_control.o coolant_control.o serial.o \
|
SOURCE = main.c motion_control.c gcode.c spindle_control.c coolant_control.c serial.c \
|
||||||
protocol.o stepper.o eeprom.o settings.o planner.o nuts_bolts.o limits.o \
|
protocol.c stepper.c eeprom.c settings.c planner.c nuts_bolts.c limits.c \
|
||||||
print.o probe.o report.o system.o
|
print.c probe.c report.c system.c
|
||||||
|
BUILDDIR = build
|
||||||
|
SOURCEDIR = grbl
|
||||||
# FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m
|
# FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m
|
||||||
FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m
|
FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m
|
||||||
|
|
||||||
@ -42,22 +44,24 @@ FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m
|
|||||||
AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) -B 10 -F
|
AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) -B 10 -F
|
||||||
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections
|
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections
|
||||||
|
|
||||||
|
OBJECTS = $(addprefix $(BUILDDIR)/,$(notdir $(SOURCE:.c=.o)))
|
||||||
|
|
||||||
# symbolic targets:
|
# symbolic targets:
|
||||||
all: grbl.hex
|
all: grbl.hex
|
||||||
|
|
||||||
.c.o:
|
$(BUILDDIR)/%.o: $(SOURCEDIR)/%.c
|
||||||
$(COMPILE) -c $< -o $@
|
$(COMPILE) -c $< -o $@
|
||||||
@$(COMPILE) -MM $< > $*.d
|
@$(COMPILE) -MM $< > $(BUILDDIR)/$*.d
|
||||||
|
|
||||||
.S.o:
|
.S.o:
|
||||||
$(COMPILE) -x assembler-with-cpp -c $< -o $@
|
$(COMPILE) -x assembler-with-cpp -c $< -o $(BUILDDIR)/$@
|
||||||
# "-x assembler-with-cpp" should not be necessary since this is the default
|
# "-x assembler-with-cpp" should not be necessary since this is the default
|
||||||
# file type for the .S (with capital S) extension. However, upper case
|
# file type for the .S (with capital S) extension. However, upper case
|
||||||
# characters are not always preserved on Windows. To ensure WinAVR
|
# characters are not always preserved on Windows. To ensure WinAVR
|
||||||
# compatibility define the file type manually.
|
# compatibility define the file type manually.
|
||||||
|
|
||||||
.c.s:
|
#.c.s:
|
||||||
$(COMPILE) -S $< -o $@
|
$(COMPILE) -S $< -o $(BUILDDIR)/$@
|
||||||
|
|
||||||
flash: all
|
flash: all
|
||||||
$(AVRDUDE) -U flash:w:grbl.hex:i
|
$(AVRDUDE) -U flash:w:grbl.hex:i
|
||||||
@ -73,25 +77,25 @@ load: all
|
|||||||
bootloadHID grbl.hex
|
bootloadHID grbl.hex
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f grbl.hex main.elf $(OBJECTS) $(OBJECTS:.o=.d)
|
rm -f grbl.hex $(BUILDDIR)/*
|
||||||
|
|
||||||
# file targets:
|
# file targets:
|
||||||
main.elf: $(OBJECTS)
|
$(BUILDDIR)/main.elf: $(OBJECTS)
|
||||||
$(COMPILE) -o main.elf $(OBJECTS) -lm -Wl,--gc-sections
|
$(COMPILE) -o $(BUILDDIR)/main.elf $(OBJECTS) -lm -Wl,--gc-sections
|
||||||
|
|
||||||
grbl.hex: main.elf
|
grbl.hex: $(BUILDDIR)/main.elf
|
||||||
rm -f grbl.hex
|
rm -f grbl.hex
|
||||||
avr-objcopy -j .text -j .data -O ihex main.elf grbl.hex
|
avr-objcopy -j .text -j .data -O ihex $(BUILDDIR)/main.elf grbl.hex
|
||||||
avr-size --format=berkeley main.elf
|
avr-size --format=berkeley $(BUILDDIR)/main.elf
|
||||||
# If you have an EEPROM section, you must also create a hex file for the
|
# If you have an EEPROM section, you must also create a hex file for the
|
||||||
# EEPROM and add it to the "flash" target.
|
# EEPROM and add it to the "flash" target.
|
||||||
|
|
||||||
# Targets for code debugging and analysis:
|
# Targets for code debugging and analysis:
|
||||||
disasm: main.elf
|
disasm: main.elf
|
||||||
avr-objdump -d main.elf
|
avr-objdump -d $(BUILDDIR)/main.elf
|
||||||
|
|
||||||
cpp:
|
cpp:
|
||||||
$(COMPILE) -E main.c
|
$(COMPILE) -E $(SOURCEDIR)/main.c
|
||||||
|
|
||||||
# include generated header dependencies
|
# include generated header dependencies
|
||||||
-include $(OBJECTS:.o=.d)
|
-include $(BUILDDIR)/$(OBJECTS:.o=.d)
|
||||||
|
@ -53,6 +53,8 @@ _**Archives:**_
|
|||||||
- **New Grbl SIMULATOR! (by @jgeisler and @ashelly):** A completely independent wrapper of the Grbl main source code that may be compiled as an executable on a computer. No Arduino required. Simply simulates the responses of Grbl as if it was on an Arduino. May be used for many things: checking out how Grbl works, pre-process moves for GUI graphics, debugging of new features, etc. Much left to do, but potentially very powerful, as the dummy AVR variables can be written to output anything you need.
|
- **New Grbl SIMULATOR! (by @jgeisler and @ashelly):** A completely independent wrapper of the Grbl main source code that may be compiled as an executable on a computer. No Arduino required. Simply simulates the responses of Grbl as if it was on an Arduino. May be used for many things: checking out how Grbl works, pre-process moves for GUI graphics, debugging of new features, etc. Much left to do, but potentially very powerful, as the dummy AVR variables can be written to output anything you need.
|
||||||
- **Configurable Real-time Status Reporting:** Users can now customize the type of real-time data Grbl reports back when they issue a '?' status report. This includes data such as: machine position, work position, planner buffer usage, serial RX buffer usage.
|
- **Configurable Real-time Status Reporting:** Users can now customize the type of real-time data Grbl reports back when they issue a '?' status report. This includes data such as: machine position, work position, planner buffer usage, serial RX buffer usage.
|
||||||
- **Updated Homing Routine:** Sets workspace volume in all negative space regardless of limit switch position. Common on pro CNCs. But, the behavior may be changed by a compile-time option though. Now tied directly into the main planner and stepper modules to reduce flash space and allow maximum speeds during seeking.
|
- **Updated Homing Routine:** Sets workspace volume in all negative space regardless of limit switch position. Common on pro CNCs. But, the behavior may be changed by a compile-time option though. Now tied directly into the main planner and stepper modules to reduce flash space and allow maximum speeds during seeking.
|
||||||
|
- **CoreXY Support:** Grbl now supports CoreXY kinematics on an introductory-level. Most functions have been verified to work, but there may be bugs here or there. Please report any problems you find!
|
||||||
|
- **Full Limit and Control Pin Configurability:** Limits and control pins operation can now be interpreted by Grbl however you'd like, with the internal pull-up resistors enabled or disabled, or reading a high or low as a trigger. This should cover all wiring and NO or NC switch scenarios.
|
||||||
- **Optional Limit Pin Sharing:** Limit switches can be combined to share the same pins to free up precious I/O pins for other purposes. When combined, users must adjust the homing cycle mask in config.h to not home the axes on a shared pin at the same time. Don't worry; hard limits and the homing cycle still work just like they did before.
|
- **Optional Limit Pin Sharing:** Limit switches can be combined to share the same pins to free up precious I/O pins for other purposes. When combined, users must adjust the homing cycle mask in config.h to not home the axes on a shared pin at the same time. Don't worry; hard limits and the homing cycle still work just like they did before.
|
||||||
- **Optional Variable Spindle Speed Output:** Available only as a compile-time option through the config.h file. Enables PWM output for 'S' g-code commands. Enabling this feature will swap the Z-limit D11 pin and spindle enable D12 pin to access the hardware PWM on pin D12. The Z-limit pin, now on D12, should work just as it did before.
|
- **Optional Variable Spindle Speed Output:** Available only as a compile-time option through the config.h file. Enables PWM output for 'S' g-code commands. Enabling this feature will swap the Z-limit D11 pin and spindle enable D12 pin to access the hardware PWM on pin D12. The Z-limit pin, now on D12, should work just as it did before.
|
||||||
- **Additional Compile-Time Feature Options:** Line number tracking, real-time feed rate reporting.
|
- **Additional Compile-Time Feature Options:** Line number tracking, real-time feed rate reporting.
|
||||||
@ -68,6 +70,7 @@ List of Supported G-Codes in Grbl v0.9
|
|||||||
- Distance Modes: G90, G91
|
- Distance Modes: G90, G91
|
||||||
- Plane Select Modes: G17, G18, G19
|
- Plane Select Modes: G17, G18, G19
|
||||||
- Tool Length Offset Modes: G43.1, G49
|
- Tool Length Offset Modes: G43.1, G49
|
||||||
|
- Cutter Compensation Modes: G40
|
||||||
- Coordinate System Modes: G54, G55, G56, G57, G58, G59
|
- Coordinate System Modes: G54, G55, G56, G57, G58, G59
|
||||||
- Program Flow: M0, M1, M2, M30*
|
- Program Flow: M0, M1, M2, M30*
|
||||||
- Coolant Control: M7*, M8, M9
|
- Coolant Control: M7*, M8, M9
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
#include <config.h>
|
|
||||||
#include <coolant_control.h>
|
|
||||||
#include <cpu_map.h>
|
|
||||||
#include <defaults.h>
|
|
||||||
#include <eeprom.h>
|
|
||||||
#include <gcode.h>
|
|
||||||
#include <grbl.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <motion_control.h>
|
|
||||||
#include <nuts_bolts.h>
|
|
||||||
#include <planner.h>
|
|
||||||
#include <print.h>
|
|
||||||
#include <probe.h>
|
|
||||||
#include <protocol.h>
|
|
||||||
#include <report.h>
|
|
||||||
#include <serial.h>
|
|
||||||
#include <settings.h>
|
|
||||||
#include <spindle_control.h>
|
|
||||||
#include <stepper.h>
|
|
||||||
#include <system.h>
|
|
||||||
|
|
||||||
#include <src/main.h>
|
|
@ -185,9 +185,10 @@
|
|||||||
// needs to connect a normal-open switch, but if inverted, this means the user should connect a
|
// needs to connect a normal-open switch, but if inverted, this means the user should connect a
|
||||||
// normal-closed switch.
|
// normal-closed switch.
|
||||||
// The following options disable the internal pull-up resistors, sets the pins to a normal-low
|
// The following options disable the internal pull-up resistors, sets the pins to a normal-low
|
||||||
// operation, and switches much be now connect to Vcc instead of ground. This also flips the meaning
|
// operation, and switches must be now connect to Vcc instead of ground. This also flips the meaning
|
||||||
// of the invert pin Grbl setting, where an inverted setting now means the user should connect a
|
// of the invert pin Grbl setting, where an inverted setting now means the user should connect a
|
||||||
// normal-open switch and vice versa.
|
// normal-open switch and vice versa.
|
||||||
|
// NOTE: All pins associated with the feature are disabled, i.e. XYZ limit pins, not individual axes.
|
||||||
// WARNING: When the pull-ups are disabled, this requires additional wiring with pull-down resistors!
|
// WARNING: When the pull-ups are disabled, this requires additional wiring with pull-down resistors!
|
||||||
//#define DISABLE_LIMIT_PIN_PULL_UP
|
//#define DISABLE_LIMIT_PIN_PULL_UP
|
||||||
//#define DISABLE_PROBE_PIN_PULL_UP
|
//#define DISABLE_PROBE_PIN_PULL_UP
|
||||||
@ -202,7 +203,7 @@
|
|||||||
// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
|
// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
|
||||||
// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!
|
// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!
|
||||||
// The hardware PWM output on pin D11 is required for variable spindle output voltages.
|
// The hardware PWM output on pin D11 is required for variable spindle output voltages.
|
||||||
// #define VARIABLE_SPINDLE // Default disabled. Uncomment to enable.
|
#define VARIABLE_SPINDLE // Default disabled. Uncomment to enable.
|
||||||
|
|
||||||
// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed
|
// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed
|
||||||
// "S" g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and
|
// "S" g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and
|
29
grbl/examples/grblUpload/grblUpload.ino
Normal file
29
grbl/examples/grblUpload/grblUpload.ino
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
This sketch compiles and uploads Grbl to your 328p-based Arduino!
|
||||||
|
|
||||||
|
To use:
|
||||||
|
- First make sure you have imported Grbl source code into your Arduino
|
||||||
|
IDE. There are details on our Github website on how to do this.
|
||||||
|
|
||||||
|
- Select your Arduino Board and Serial Port in the Tools drop-down menu.
|
||||||
|
NOTE: Grbl only officially supports 328p-based Arduinos, like the Uno.
|
||||||
|
Using other boards will likely not work!
|
||||||
|
|
||||||
|
- Then just click 'Upload'. That's it!
|
||||||
|
|
||||||
|
For advanced users:
|
||||||
|
If you'd like to see what else Grbl can do, there are some additional
|
||||||
|
options for customization and features you can enable or disable.
|
||||||
|
Navigate your file system to where the Arduino IDE has stored the Grbl
|
||||||
|
source code files, open the 'config.h' file in your favorite text
|
||||||
|
editor. Inside are dozens of feature descriptions and #defines. Simply
|
||||||
|
comment or uncomment the #defines or alter their assigned values, save
|
||||||
|
your changes, and then click 'Upload' here.
|
||||||
|
|
||||||
|
Copyright (c) 2015 Sungeun K. Jeon
|
||||||
|
Released under the MIT-license. See license.txt for details.
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include <grbl.h>
|
||||||
|
|
||||||
|
// Do not alter this file!
|
21
grbl/examples/grblUpload/license.txt
Normal file
21
grbl/examples/grblUpload/license.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Sungeun K. Jeon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
grbl.h - include file
|
grbl.h - main Grbl include file
|
||||||
Part of Grbl v0.9
|
Part of Grbl v0.9
|
||||||
|
|
||||||
Copyright (c) 2015 Sungeun K. Jeon
|
Copyright (c) 2015 Sungeun K. Jeon
|
||||||
@ -18,13 +18,10 @@
|
|||||||
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// NOTE: This is not used by the 'make' compiling method. This is currently only used for
|
|
||||||
// simplifying compiling through the Arduino IDE at the moment. However, it may eventually
|
|
||||||
// turn into a central include file for the overall system.
|
|
||||||
|
|
||||||
#ifndef grbl_h
|
#ifndef grbl_h
|
||||||
#define grbl_h
|
#define grbl_h
|
||||||
|
|
||||||
|
// Grbl versioning system
|
||||||
#define GRBL_VERSION "0.9h"
|
#define GRBL_VERSION "0.9h"
|
||||||
#define GRBL_VERSION_BUILD "20150210"
|
#define GRBL_VERSION_BUILD "20150210"
|
||||||
|
|
||||||
@ -41,7 +38,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
// Define the Grbl system include files.
|
// Define the Grbl system include files. NOTE: Do not alter organization.
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "nuts_bolts.h"
|
#include "nuts_bolts.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
@ -161,14 +161,14 @@ void limits_go_home(uint8_t cycle_mask)
|
|||||||
// Set target location for active axes and setup computation for homing rate.
|
// Set target location for active axes and setup computation for homing rate.
|
||||||
if (bit_istrue(cycle_mask,bit(idx))) {
|
if (bit_istrue(cycle_mask,bit(idx))) {
|
||||||
n_active_axis++;
|
n_active_axis++;
|
||||||
if (!approach) {
|
if (approach) {
|
||||||
// Set target direction based on cycle mask
|
|
||||||
if (bit_istrue(settings.homing_dir_mask,bit(idx))) { target[idx] += max_travel; }
|
|
||||||
else { target[idx] -= max_travel; }
|
|
||||||
} else {
|
|
||||||
// Set target direction based on cycle mask
|
// Set target direction based on cycle mask
|
||||||
if (bit_istrue(settings.homing_dir_mask,bit(idx))) { target[idx] -= max_travel; }
|
if (bit_istrue(settings.homing_dir_mask,bit(idx))) { target[idx] -= max_travel; }
|
||||||
else { target[idx] += max_travel; }
|
else { target[idx] += max_travel; }
|
||||||
|
} else {
|
||||||
|
// Set target direction based on cycle mask
|
||||||
|
if (bit_istrue(settings.homing_dir_mask,bit(idx))) { target[idx] += max_travel; }
|
||||||
|
else { target[idx] -= max_travel; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user