mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 15:30:08 +08:00
[stm32] add upload rule to use ST-Link on SWD
This commit is contained in:
+11
-5
@@ -231,15 +231,14 @@ $(AOBJ) : $(OBJDIR)/%.o : %.S
|
|||||||
# check which flash mode is configured
|
# check which flash mode is configured
|
||||||
#
|
#
|
||||||
ifeq ($(FLASH_MODE),DFU)
|
ifeq ($(FLASH_MODE),DFU)
|
||||||
|
ifdef DFU_ADDR
|
||||||
|
DFU_ADDR_CMD = --addr=$(DFU_ADDR)
|
||||||
|
endif
|
||||||
#
|
#
|
||||||
# DFU flash mode
|
# DFU flash mode
|
||||||
upload: $(OBJDIR)/$(TARGET).bin
|
upload: $(OBJDIR)/$(TARGET).bin
|
||||||
@echo "Using stm32 mem dfu loader"
|
@echo "Using stm32 mem dfu loader"
|
||||||
ifeq ($(ARCH_L), )
|
$(PYTHON) $(PAPARAZZI_SRC)/sw/tools/dfu/stm32_mem.py $(DFU_ADDR_CMD) $^
|
||||||
$(PYTHON) $(PAPARAZZI_SRC)/sw/tools/dfu/stm32_mem.py $^
|
|
||||||
else ifeq ($(ARCH_L),f4)
|
|
||||||
$(PYTHON) $(PAPARAZZI_SRC)/sw/tools/dfu/stm32_f4_mem.py $^
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# serial flash mode
|
# serial flash mode
|
||||||
@@ -283,6 +282,12 @@ endif
|
|||||||
# SWD flash mode
|
# SWD flash mode
|
||||||
else ifeq ($(FLASH_MODE),SWD)
|
else ifeq ($(FLASH_MODE),SWD)
|
||||||
# only works if BMP_PORT is defined
|
# only works if BMP_PORT is defined
|
||||||
|
ifeq ($(STLINK),y)
|
||||||
|
STLINK_ADDR ?= 0x08000000
|
||||||
|
upload: $(OBJDIR)/$(TARGET).bin
|
||||||
|
@echo "Using ST-LINK with SWD at $(STLINK_ADDR)"
|
||||||
|
$(Q)st-flash write $^ $(STLINK_ADDR)
|
||||||
|
else
|
||||||
BMP_PORT ?= /dev/ttyACM0
|
BMP_PORT ?= /dev/ttyACM0
|
||||||
BMP_UPLOAD_SCRIPT ?= $(PAPARAZZI_SRC)/sw/tools/flash_scripts/bmp_swd_flash.scr
|
BMP_UPLOAD_SCRIPT ?= $(PAPARAZZI_SRC)/sw/tools/flash_scripts/bmp_swd_flash.scr
|
||||||
upload: $(OBJDIR)/$(TARGET).elf
|
upload: $(OBJDIR)/$(TARGET).elf
|
||||||
@@ -294,6 +299,7 @@ upload: $(OBJDIR)/$(TARGET).elf
|
|||||||
-ex 'target extended-remote $(BMP_PORT)' \
|
-ex 'target extended-remote $(BMP_PORT)' \
|
||||||
-x $(BMP_UPLOAD_SCRIPT) \
|
-x $(BMP_UPLOAD_SCRIPT) \
|
||||||
$<
|
$<
|
||||||
|
endif
|
||||||
#
|
#
|
||||||
# no known flash mode
|
# no known flash mode
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ $(TARGET).LDSCRIPT=$(SRC_ARCH)/apogee.ld
|
|||||||
HARD_FLOAT=yes
|
HARD_FLOAT=yes
|
||||||
|
|
||||||
# default flash mode is via usb dfu bootloader
|
# default flash mode is via usb dfu bootloader
|
||||||
# other possibilities: SWD
|
# possibilities: DFU, SWD
|
||||||
FLASH_MODE ?= DFU
|
FLASH_MODE ?= SWD
|
||||||
|
STLINK ?= y
|
||||||
|
|
||||||
#
|
#
|
||||||
# default LED configuration
|
# default LED configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user