Fix rules in src/makefile.
[clinton/Smoothieware.git] / src / makefile
1 PROJECT=main
2 BUILD_DIR=../build
3 DEVICES=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.
9 BUILD_TYPE=Checked
10
11 # Set to 1 to allow MRI debug monitor to take full control of UART0 and use it
12 # as a dedicated debug channel. If you are using the USB based serial port for
13 # the console then this should cause you no problems. Set MRI_BREAK_ON_INIT to
14 # 0 if you don't want to break into GDB at startup.
15 ENABLE_DEBUG_MONITOR?=0
16
17 ifeq "$(ENABLE_DEBUG_MONITOR)" "1"
18 # Can add MRI_UART_BAUD=115200 to next line if GDB fails to connect to MRI.
19 # Tends to happen on some Linux distros but not Windows and OS X.
20 MRI_UART=MRI_UART_0
21 MRI_BREAK_ON_INIT=1
22 MRI_SEMIHOST_STDIO=1
23 else
24 MRI_UART=MRI_UART_0 MRI_UART_SHARE
25 MRI_BREAK_ON_INIT=0
26 MRI_SEMIHOST_STDIO=0
27 endif
28
29 include $(BUILD_DIR)/build.mk
30
31 CONSOLE?=/dev/arduino_A900K10V
32
33 .PHONY: debug-store flash upload debug console dfu
34
35 debug-store: ../LPC1768/$(PROJECT).elf
36 cp ../LPC1768/$(PROJECT).elf ../LPC1768/$(PROJECT)_lastupload.elf
37
38 flash: ../LPC1768/$(PROJECT).hex debug-store
39 lpc21isp $< $(CONSOLE) 115200 12000
40
41 dfu: ../LPC1768/$(PROJECT).bin
42 dfu-util -D $< -R
43
44 upload: ../LPC1768/$(PROJECT).bin debug-store
45 dfu-util -d 1d50:6015 -D $<
46
47 debug: ../LPC1768/$(PROJECT)_lastupload.elf
48 arm-none-eabi-gdb $< -ex "set target-charset ASCII" -ex "set remotelogfile mri.log" -ex "target remote $(CONSOLE)"
49
50 console:
51 stty raw ignbrk -echo 2000000 < $(CONSOLE)
52 ( cat <&3 & cat >&3 ; kill %% ) 3<>$(CONSOLE)