From 3318979714d954a81b6cedccd22b1f33d8d54503 Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Fri, 13 Jan 2012 22:43:40 -0500 Subject: [PATCH] dfu-util: Add dfu-util install target to Makefile This tool can be used to read/write the interal device flash in an STMF4 MCU via the built-in bootloader. dfu-util can be downloaded and installed using this command: make dfuutil_install The homepage for this tool is at: http://dfu-util.gnumonks.org/ --- Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Makefile b/Makefile index f5f44d3fb..a08d3857c 100644 --- a/Makefile +++ b/Makefile @@ -72,6 +72,7 @@ help: @echo " arm_sdk_install - Install the Code Sourcery ARM gcc toolchain" @echo " openocd_install - Install the OpenOCD JTAG daemon" @echo " stm32flash_install - Install the stm32flash tool for unbricking boards" + @echo " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards" @echo @echo " [Big Hammer]" @echo " all - Generate UAVObjects, build openpilot firmware and gcs" @@ -250,6 +251,38 @@ stm32flash_clean: $(V0) @echo " CLEAN $(STM32FLASH_DIR)" $(V1) [ ! -d "$(STM32FLASH_DIR)" ] || $(RM) -r "$(STM32FLASH_DIR)" +DFUUTIL_DIR := $(TOOLS_DIR)/dfu-util + +.PHONY: dfuutil_install +dfuutil_install: DFUUTIL_URL := http://dfu-util.gnumonks.org/releases/dfu-util-0.5.tar.gz +dfuutil_install: DFUUTIL_FILE := $(notdir $(DFUUTIL_URL)) +dfuutil_install: | $(DL_DIR) $(TOOLS_DIR) +dfuutil_install: dfuutil_clean + # download the source + $(V0) @echo " DOWNLOAD $(DFUUTIL_URL)" + $(V1) wget -N -P "$(DL_DIR)" "$(DFUUTIL_URL)" + + # extract the source + $(V0) @echo " EXTRACT $(DFUUTIL_FILE)" + $(V1) [ ! -d "$(DL_DIR)/dfuutil-build" ] || $(RM) -r "$(DL_DIR)/dfuutil-build" + $(V1) mkdir -p "$(DL_DIR)/dfuutil-build" + $(V1) tar -C $(DL_DIR)/dfuutil-build -xf "$(DL_DIR)/$(DFUUTIL_FILE)" + + # build + $(V0) @echo " BUILD $(DFUUTIL_DIR)" + $(V1) mkdir -p "$(DFUUTIL_DIR)" + $(V1) ( \ + cd $(DL_DIR)/dfuutil-build/dfu-util-0.5 ; \ + ./configure --prefix="$(DFUUTIL_DIR)" ; \ + $(MAKE) ; \ + $(MAKE) install ; \ + ) + +.PHONY: dfuutil_clean +dfuutil_clean: + $(V0) @echo " CLEAN $(DFUUTIL_DIR)" + $(V1) [ ! -d "$(DFUUTIL_DIR)" ] || $(RM) -r "$(DFUUTIL_DIR)" + ############################## # # Set up paths to tools