1 # Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 GCC4MBED_DIR=./gcc4mbed
22 #GCC4MBED_TYPE=Release
25 # Set to 1 to allow MRI debug monitor to take full control of UART0 and use it
26 # as a dedicated debug channel. If you are using the USB based serial port for
27 # the console then this should cause you no problems. Set MRI_BREAK_ON_INIT to
28 # 0 if you don't want to break into GDB at startup.
29 ENABLE_DEBUG_MONITOR?=0
31 ifeq "$(ENABLE_DEBUG_MONITOR)" "1"
32 # Can add MRI_UART_BAUD=115200 to next line if GDB fails to connect to MRI.
33 # Tends to happen on some Linux distros but not Windows and OS X.
38 MRI_UART=MRI_UART_0 MRI_UART_SHARE
45 include ./gcc4mbed/build/gcc4mbed.mk
47 .PHONY: debug-store flash upload debug console
49 debug-store: $(PROJECT).elf
50 cp $(PROJECT).elf $(PROJECT)_lastupload.elf
52 flash: $(PROJECT).hex debug-store
53 lpc21isp $< $(CONSOLE) 115200 12000
55 upload: $(PROJECT).bin debug-store
56 dfu-util -d 1d50:6015 -R -D $<
58 debug: $(PROJECT)_lastupload.elf
59 arm-none-eabi-gdb $< -ex "set target-charset ASCII" -ex "set remotelogfile mri.log" -ex "target remote $(CONSOLE)"
62 stty raw ignbrk -echo 2000000 < $(CONSOLE)
63 ( cat <&3 & cat >&3 ; kill %% ) 3<>$(CONSOLE)