Commit | Line | Data |
---|---|---|
df930a5f JM |
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 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. | |
13 | HEAP_TAGS=0 | |
14 | ||
15 | # Set to 1 configure MPU to disable write buffering and eliminate imprecise bus faults. | |
16 | WRITE_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. | |
22 | STACK_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. | |
28 | ENABLE_DEBUG_MONITOR?=0 | |
29 | ||
30 | ifeq "$(ENABLE_DEBUG_MONITOR)" "1" | |
31 | # Can add MRI_UART_BAUD=115200 to next line if GDB fails to connect to MRI. | |
32 | # Tends to happen on some Linux distros but not Windows and OS X. | |
33 | MRI_UART=MRI_UART_0 | |
34 | MRI_BREAK_ON_INIT=1 | |
35 | MRI_SEMIHOST_STDIO=1 | |
36 | else | |
37 | MRI_UART=MRI_UART_0 MRI_UART_SHARE | |
38 | MRI_BREAK_ON_INIT=0 | |
39 | MRI_SEMIHOST_STDIO=0 | |
40 | endif | |
41 | ||
42 | # generate a git version string, sorry only on linux and mac osx | |
43 | ifneq "$(OS)" "Windows_NT" | |
44 | DEFINES += -D__GITVERSIONSTRING__=\"$(shell ./generate-version.sh)\" | |
45 | else | |
46 | DEFINES += -D__GITVERSIONSTRING__=\"placeholder\" | |
47 | endif | |
48 | ||
85eabc50 JM |
49 | # use c++11 features for the checksums |
50 | DEFINES += -DCHECKSUM_USE_CPP | |
51 | ||
df930a5f JM |
52 | # add any modules that you do not want included in the build |
53 | export EXCLUDED_MODULES = tools/touchprobe | |
54 | # e.g for a CNC machine | |
55 | #export EXCLUDED_MODULES = tools/touchprobe tools/laser tools/temperaturecontrol tools/extruder | |
56 | ||
57 | # set to not compile in any network support | |
58 | #export NONETWORK = 1 | |
59 | ||
60 | include $(BUILD_DIR)/build.mk | |
61 | ||
62 | CONSOLE?=/dev/arduino | |
63 | BAUD?=1000000 | |
64 | ||
65 | .PHONY: debug-store flash upload debug console dfu | |
66 | ||
67 | debug-store: ../LPC1768/$(PROJECT).elf | |
68 | cp ../LPC1768/$(PROJECT).elf ../LPC1768/$(PROJECT)_lastupload.elf | |
69 | ||
70 | flash: ../LPC1768/$(PROJECT).hex debug-store | |
71 | lpc21isp $< $(CONSOLE) 115200 12000 | |
72 | ||
73 | dfu: ../LPC1768/$(PROJECT).bin | |
74 | dfu-util -D $< -R | |
75 | ||
76 | upload: ../LPC1768/$(PROJECT).bin debug-store | |
77 | dfu-util -R -d 1d50:6015 -D $< | |
78 | ||
79 | debug: ../LPC1768/$(PROJECT)_lastupload.elf | |
80 | arm-none-eabi-gdb $< -ex "set target-charset ASCII" -ex "set remotelogfile mri.log" -ex "target remote $(CONSOLE)" | |
81 | ||
82 | console: | |
83 | stty raw ignbrk -echo $(BAUD) < $(CONSOLE) | |
84 | ( cat <&3 & cat >&3 ; kill %% ) 3<>$(CONSOLE) |