Makefile: allow user-specified baud rate for console, ie "make BAUD=115200 console...
[clinton/Smoothieware.git] / src / makefile
CommitLineData
4cff3ded 1PROJECT=main\r
172d42d9
AG
2BUILD_DIR=../build\r
3DEVICES=lpc1768\r
b00f1a6b 4\r
172d42d9
AG
5# BUILD_TYPE can be set to the following values:\r
6# Checked - Optimizations enabled with MRI debug monitor support. (Recommended Type)\r
7# Release - Optimizations enabled.\r
8# Debug - Optimization disabled with MRI debug monitor support.\r
9BUILD_TYPE=Checked\r
b00f1a6b 10\r
383036c1
AG
11# Set to 1 to tag each heap allocation with the caller's return address.\r
12# NOTE: Can't be enabled with latest build as not compatible with newlib nano.\r
13HEAP_TAGS=0\r
14\r
15# Set to 1 configure MPU to disable write buffering and eliminate imprecise bus faults.\r
16WRITE_BUFFER_DISABLE=0\r
17\r
18# Set to non zero value if you want checks to be enabled which reserve a\r
19# specific amount of space for the stack. The heap's growth will be\r
20# constrained to reserve this much space for the stack and the stack won't be\r
21# able to grow larger than this amount.\r
22STACK_SIZE=3072\r
23\r
b00f1a6b
AG
24# Set to 1 to allow MRI debug monitor to take full control of UART0 and use it\r
25# as a dedicated debug channel. If you are using the USB based serial port for\r
26# the console then this should cause you no problems. Set MRI_BREAK_ON_INIT to\r
27# 0 if you don't want to break into GDB at startup.\r
7e7cae44 28ENABLE_DEBUG_MONITOR?=0\r
b00f1a6b
AG
29\r
30ifeq "$(ENABLE_DEBUG_MONITOR)" "1"\r
31# Can add MRI_UART_BAUD=115200 to next line if GDB fails to connect to MRI.\r
32# Tends to happen on some Linux distros but not Windows and OS X.\r
33MRI_UART=MRI_UART_0\r
34MRI_BREAK_ON_INIT=1\r
35MRI_SEMIHOST_STDIO=1\r
36else\r
37MRI_UART=MRI_UART_0 MRI_UART_SHARE\r
6c79da43
AG
38MRI_BREAK_ON_INIT=0\r
39MRI_SEMIHOST_STDIO=0\r
b00f1a6b 40endif\r
4cff3ded 41\r
172d42d9 42include $(BUILD_DIR)/build.mk\r
14d4726b 43\r
172d42d9 44CONSOLE?=/dev/arduino_A900K10V\r
62f57a04 45BAUD?=2000000\r
4cff3ded 46\r
172d42d9 47.PHONY: debug-store flash upload debug console dfu\r
15d0cdbc 48\r
2775d191
AG
49debug-store: ../LPC1768/$(PROJECT).elf\r
50 cp ../LPC1768/$(PROJECT).elf ../LPC1768/$(PROJECT)_lastupload.elf\r
15d0cdbc 51\r
2775d191 52flash: ../LPC1768/$(PROJECT).hex debug-store\r
5cdad772 53 lpc21isp $< $(CONSOLE) 115200 12000\r
a33de4b2 54\r
2775d191 55dfu: ../LPC1768/$(PROJECT).bin\r
172d42d9 56 dfu-util -D $< -R\r
0144b869 57\r
2775d191 58upload: ../LPC1768/$(PROJECT).bin debug-store\r
172d42d9
AG
59 dfu-util -d 1d50:6015 -D $<\r
60\r
2775d191 61debug: ../LPC1768/$(PROJECT)_lastupload.elf\r
14d4726b 62 arm-none-eabi-gdb $< -ex "set target-charset ASCII" -ex "set remotelogfile mri.log" -ex "target remote $(CONSOLE)"\r
0144b869
MM
63\r
64console:\r
62f57a04 65 stty raw ignbrk -echo $(BAUD) < $(CONSOLE)\r
14d4726b 66 ( cat <&3 & cat >&3 ; kill %% ) 3<>$(CONSOLE)\r