Merge pull request #1334 from CapnBry/z-grid-dest
[clinton/Smoothieware.git] / src / makefile
CommitLineData
df930a5f
JM
1PROJECT=main
2BUILD_DIR=../build
3DEVICES=lpc1768
4
5# BUILD_TYPE can be set to the following values:
6# Checked - Optimizations enabled with MRI debug monitor support. (Recommended Type)
7# Release - Optimizations enabled.
8# Debug - Optimization disabled with MRI debug monitor support.
9BUILD_TYPE=Checked
10
11# Set to 1 to tag each heap allocation with the caller's return address.
12# NOTE: Can't be enabled with latest build as not compatible with newlib nano.
13HEAP_TAGS=0
14
15# Set to 1 configure MPU to disable write buffering and eliminate imprecise bus faults.
16WRITE_BUFFER_DISABLE=0
17
18# Set to non zero value if you want checks to be enabled which reserve a
19# specific amount of space for the stack. The heap's growth will be
20# constrained to reserve this much space for the stack and the stack won't be
21# able to grow larger than this amount.
22STACK_SIZE=3072
23
24# Set to 1 to allow MRI debug monitor to take full control of UART0 and use it
25# as a dedicated debug channel. If you are using the USB based serial port for
26# the console then this should cause you no problems. Set MRI_BREAK_ON_INIT to
27# 0 if you don't want to break into GDB at startup.
28ENABLE_DEBUG_MONITOR?=0
29
2ee2ad19
JM
30# this is the default UART baud rate used if it is not set in config
31# it is also the baud rate used to report any errors found while parsing the config file
32DEFAULT_SERIAL_BAUD_RATE?=9600
33
df930a5f
JM
34ifeq "$(ENABLE_DEBUG_MONITOR)" "1"
35# Can add MRI_UART_BAUD=115200 to next line if GDB fails to connect to MRI.
36# Tends to happen on some Linux distros but not Windows and OS X.
37MRI_UART=MRI_UART_0
38MRI_BREAK_ON_INIT=1
39MRI_SEMIHOST_STDIO=1
40else
41MRI_UART=MRI_UART_0 MRI_UART_SHARE
42MRI_BREAK_ON_INIT=0
43MRI_SEMIHOST_STDIO=0
44endif
45
a3be54e3 46# generate a git version string
df930a5f
JM
47ifneq "$(OS)" "Windows_NT"
48DEFINES += -D__GITVERSIONSTRING__=\"$(shell ./generate-version.sh)\"
49else
4bcd0840 50DEFINES += -D__GITVERSIONSTRING__=\"$(shell generate-version.bat)\"
df930a5f
JM
51endif
52
2ee2ad19
JM
53# use c++11 features for the checksums and set default baud rate for serial uart
54DEFINES += -DCHECKSUM_USE_CPP -DDEFAULT_SERIAL_BAUD_RATE=$(DEFAULT_SERIAL_BAUD_RATE)
85eabc50 55
3b1acdaa
JM
56ifneq "$(STEPTICKER_DEBUG_PIN)" ""
57# Set a Pin here that toggles on end of move
58DEFINES += -DSTEPTICKER_DEBUG_PIN=$(STEPTICKER_DEBUG_PIN)
59endif
9e089978 60
c8ef3271 61# include an optional default set of excludes
df930a5f 62# add any modules that you do not want included in the build
df930a5f 63# e.g for a CNC machine
e8a9ba27 64#export EXCLUDE_MODULES = tools/laser tools/temperaturecontrol tools/extruder
c8ef3271 65-include default_excludes.mk
df930a5f 66
e8a9ba27
JM
67# override any default excludes by setting NODEFAULTEXCLUDES=1
68ifneq "$(NODEFAULTEXCLUDES)" "1"
69# if nothing set in the default_excludes.mk file then handle some default excludes for different builds
70
71ifeq "$(EXCLUDE_MODULES)" ""
72
73ifeq "$(CNC)" "1"
74# CNC build excludes these
b5bd71f8 75export EXCLUDE_MODULES = tools/filamentdetector tools/scaracal tools/temperaturecontrol tools/temperatureswitch tools/extruder
e8a9ba27
JM
76else
77# 3D build excludes these
78export EXCLUDE_MODULES = tools/drillingcycles tools/spindle
79endif
80
81endif
82endif
83
89b1a6eb
JM
84ifneq "$(INCLUDE_MODULE)" ""
85export EXCLUDED_MODULES = $(filter-out $(INCLUDE_MODULE),$(EXCLUDE_MODULES))
86else
87export EXCLUDED_MODULES = $(EXCLUDE_MODULES)
88endif
89
e8a9ba27
JM
90ifneq "$(EXCLUDED_MODULES)" ""
91$(info **NOTE** Excluding modules $(EXCLUDED_MODULES))
92endif
93
37b7b898
JM
94ifneq "$(AXIS)" ""
95DEFINES += -DMAX_ROBOT_ACTUATORS=$(AXIS)
96endif
89b1a6eb 97
492cadb7
JM
98# define the number of primary (cartesian) axis must be >= MAX_ROBOT_ACTUATORS
99ifneq "$(PAXIS)" ""
100DEFINES += -DN_PRIMARY_AXIS=$(PAXIS)
101endif
102
df930a5f
JM
103# set to not compile in any network support
104#export NONETWORK = 1
105
106include $(BUILD_DIR)/build.mk
107
108CONSOLE?=/dev/arduino
fd12e310 109BAUD?=9600
df930a5f 110
f4a3b32d
DR
111ifneq "$(OS)" "Windows_NT"
112COPY=cp
113else
114COPY=copy
115endif
df930a5f 116
f4a3b32d 117.PHONY: debug-store flash upload debug console dfu
e8a9ba27
JM
118print-% : ; @echo $* = $($*)
119
df930a5f 120debug-store: ../LPC1768/$(PROJECT).elf
f4a3b32d 121 cd .. && cd LPC1768 && $(COPY) $(PROJECT).elf $(PROJECT)_lastupload.elf
df930a5f
JM
122
123flash: ../LPC1768/$(PROJECT).hex debug-store
124 lpc21isp $< $(CONSOLE) 115200 12000
125
126dfu: ../LPC1768/$(PROJECT).bin
127 dfu-util -D $< -R
128
129upload: ../LPC1768/$(PROJECT).bin debug-store
130 dfu-util -R -d 1d50:6015 -D $<
131
132debug: ../LPC1768/$(PROJECT)_lastupload.elf
133 arm-none-eabi-gdb $< -ex "set target-charset ASCII" -ex "set remotelogfile mri.log" -ex "target remote $(CONSOLE)"
134
135console:
136 stty raw ignbrk -echo $(BAUD) < $(CONSOLE)
137 ( cat <&3 & cat >&3 ; kill %% ) 3<>$(CONSOLE)