diff --git a/conf/Makefile.lpc21 b/conf/Makefile.lpc21 index d69e1fad31..d29c7f2157 100644 --- a/conf/Makefile.lpc21 +++ b/conf/Makefile.lpc21 @@ -50,7 +50,6 @@ OBJCOPY = $(GCC_BIN_PREFIX)-objcopy OBJDUMP = $(GCC_BIN_PREFIX)-objdump NM = $(GCC_BIN_PREFIX)-nm SIZE = $(GCC_BIN_PREFIX)-size -OOCD = $(TOOLCHAIN_DIR)/bin/openocd # # If we can't find the toolchain (in /opt/paparazzi/arm-multilib or ~/sat) then try picking up the compilers from the path @@ -72,7 +71,15 @@ OBJCOPY = $(shell which $(GCC_PREFIX)-objcopy) OBJDUMP = $(shell which $(GCC_PREFIX)-objdump) NM = $(shell which $(GCC_PREFIX)-nm) SIZE = $(shell which $(GCC_PREFIX)-size) -OOCD = $(shell which openocd) +endif + +#first try to find OpenOCD in the path +OOCD = $(shell which openocd) +#if OpenOCD could not be found in the path, try the toolchain dir +ifeq ($(OOCD),) +ifneq ($(TOOLCHAIN),) +OOCD = $(shell if test -e $(TOOLCHAIN_DIR)/bin/openocd ; then echo $(TOOLCHAIN_DIR)/bin/openocd ; else echo "Warning: OpenOCD not found"; fi) +endif endif # Define some other programs and commands. @@ -182,7 +189,6 @@ LPC21IAP = $(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap # --------------------------------------------------------------------------- # Flash-Programming support using openocd -OOCD = openocd OOCD_INTERFACE = arm-usb-ocd OOCD_TARGET = csc diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index 1be84b9e6a..284ac27cdb 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -53,7 +53,6 @@ DMP = $(GCC_BIN_PREFIX)-objdump NM = $(GCC_BIN_PREFIX)-nm SIZE = $(GCC_BIN_PREFIX)-size RM = rm -OOCD = $(TOOLCHAIN_DIR)/bin/openocd # If we can't find the toolchain then try picking up the compilers from the path else @@ -63,10 +62,19 @@ CP = $(shell which arm-none-eabi-objcopy) DMP = $(shell which arm-none-eabi-objdump) NM = $(shell which arm-none-eabi-nm) SIZE = $(shell which arm-none-eabi-size) -OOCD = $(shell which openocd) GCC_LIB_DIR=$(shell dirname `which arm-none-eabi-gcc`)/../arm-none-eabi/lib endif +#first try to find OpenOCD in the path +OOCD = $(shell which openocd) +#if OpenOCD could not be found in the path, try the toolchain dir +ifeq ($(OOCD),) +ifneq ($(TOOLCHAIN),) +OOCD = $(shell if test -e $(TOOLCHAIN_DIR)/bin/openocd ; then echo $(TOOLCHAIN_DIR)/bin/openocd ; else echo "Warning: OpenOCD not found"; fi) +endif +endif + + LOADER=/home/poine/work/stm32/stm32loader-a3c51c26ad6c/stm32loader.py ifndef $(TARGET).OOCD_INTERFACE