summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-03-09 01:04:26 +0700
committerhathach <[email protected]>2019-03-09 01:04:26 +0700
commit0ff7d609f0268d4abcec9c6ba2f3e24104a3fd96 (patch)
tree2d6ece0939636373e39070b5d68ce6d473c79888
parent57d069981fb3b2e18d282ecfb72ecbf2093bdebd (diff)
add flash target for stm32 board using stm32cubeprogammger cli
-rw-r--r--examples/device/cdc_msc_hid/Makefile4
-rw-r--r--hw/bsp/stm32f407g_disc1/board.mk7
2 files changed, 10 insertions, 1 deletions
diff --git a/examples/device/cdc_msc_hid/Makefile b/examples/device/cdc_msc_hid/Makefile
index 5d968e85c..a8430b4af 100644
--- a/examples/device/cdc_msc_hid/Makefile
+++ b/examples/device/cdc_msc_hid/Makefile
@@ -95,6 +95,8 @@ SRC_S := $(SRC_S:.S=.s)
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=.o))
+# Set all as default goal
+.DEFAULT_GOAL := all
all: $(BUILD)/$(BOARD)-firmware.bin size
OBJ_DIRS = $(sort $(dir $(OBJ)))
@@ -108,7 +110,7 @@ $(BUILD)/$(BOARD)-firmware.elf: $(OBJ)
$(BUILD)/$(BOARD)-firmware.bin: $(BUILD)/$(BOARD)-firmware.elf
@echo CREATE $@
- $(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@
+ @$(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@
# We set vpath to point to the top of the tree so that the source files
# can be located. By following this scheme, it allows a single build rule
diff --git a/hw/bsp/stm32f407g_disc1/board.mk b/hw/bsp/stm32f407g_disc1/board.mk
index bc8396723..0fc35cee7 100644
--- a/hw/bsp/stm32f407g_disc1/board.mk
+++ b/hw/bsp/stm32f407g_disc1/board.mk
@@ -25,3 +25,10 @@ INC += \
VENDOR = st
CHIP_FAMILY = stm32f4
+
+# Path to STM32 Cube Programmer CLI
+STM32Prog = STM32_Programmer_CLI
+
+# flash target to download
+flash: $(BUILD)/$(BOARD)-firmware.elf
+ $(STM32Prog) --connect port=swd --write $< --go