From 9f5cbb7d628cd6ee248dc1c70be11f9b5da89d16 Mon Sep 17 00:00:00 2001 From: Simon Kueppers Date: Sat, 11 Mar 2023 11:54:00 +0100 Subject: [PATCH] Added post-build script to add dfu-suffix to the firmware binary. This removes the error about missing DFU suffix when running dfu-util. --- stm32/aioc-fw/.cproject | 13 ++++++++++--- stm32/aioc-fw/makefile.targets | 13 +++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 stm32/aioc-fw/makefile.targets diff --git a/stm32/aioc-fw/.cproject b/stm32/aioc-fw/.cproject index 84c280b..02ff771 100644 --- a/stm32/aioc-fw/.cproject +++ b/stm32/aioc-fw/.cproject @@ -123,7 +123,7 @@ - + - + + + + + + + + diff --git a/stm32/aioc-fw/makefile.targets b/stm32/aioc-fw/makefile.targets new file mode 100644 index 0000000..ba47e9c --- /dev/null +++ b/stm32/aioc-fw/makefile.targets @@ -0,0 +1,13 @@ +dfu-suffix: $(OBJCOPY_BIN) +ifneq ("$(wildcard /usr/bin/dfu-suffix)","") + dfu-suffix -c $(FILENAME) || dfu-suffix -a $(FILENAME) -p $(PID) -v $(VID) -d $(DID) +else + @echo "Skipping DFU suffix generation, because dfu-suffix tool was not found" +endif + +dfu-util: dfu-suffix +ifneq ("$(wildcard /usr/bin/dfu-util)","") + dfu-util -d $(VID):$(PID) -a 0 -s 0x08000000:leave -D $(FILENAME) +else + @echo "Skipping DFU programming, because dfu-util tool was not found" +endif