Skip to content

Commit

Permalink
Merge pull request #140 from mcamposv/master
Browse files Browse the repository at this point in the history
use st-flash from path if exists and add option --flash=128k
  • Loading branch information
juribeparada authored Apr 17, 2021
2 parents 5cbaf98 + 3fee6b4 commit 436cebb
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,20 @@ else
MDDIRS=mkdir $@

ifeq ($(shell uname -s),Linux)
ST_FLASH_ON_PATH=$(shell which st-flash)
ST_FLASH_IS_ON_PATH=$(.SHELLSTATUS)
ifeq ($(shell uname -m),x86_64)
DFU_RST=./$(F1_LIB_PATH)/utils/linux64/upload-reset
DFU_UTIL=./$(F1_LIB_PATH)/utils/linux64/dfu-util
ST_FLASH=./$(F1_LIB_PATH)/utils/linux64/st-flash
DFU_RST=./$(F1_LIB_PATH)/utils/linux64/upload-reset
DFU_UTIL=./$(F1_LIB_PATH)/utils/linux64/dfu-util
ifeq ($(ST_FLASH_IS_ON_PATH),0)
ST_FLASH=$(ST_FLASH_ON_PATH)
ST_FLASH_OPTS=--flash=128k
else
ST_FLASH=./$(F1_LIB_PATH)/utils/linux64/st-flash
ST_FLASH_OPTS=
endif
STM32FLASH=./$(F1_LIB_PATH)/utils/linux64/stm32flash
else ifeq ($(shell uname -m),armv7l)
DFU_RST=./$(F1_LIB_PATH)/utils/rpi32/upload-reset
Expand All @@ -128,7 +138,13 @@ else
else
DFU_RST=./$(F1_LIB_PATH)/utils/linux/upload-reset
DFU_UTIL=./$(F1_LIB_PATH)/utils/linux/dfu-util
ST_FLASH=./$(F1_LIB_PATH)/utils/linux/st-flash
ifeq ($(ST_FLASH_IS_ON_PATH),0)
ST_FLASH=$(ST_FLASH_ON_PATH)
ST_FLASH_OPTS=--flash=128k
else
ST_FLASH=./$(F1_LIB_PATH)/utils/linux/st-flash
ST_FLASH_OPTS=
endif
STM32FLASH=./$(F1_LIB_PATH)/utils/linux/stm32flash
endif
endif
Expand Down Expand Up @@ -405,20 +421,20 @@ clean:
$(RM) GitVersion.h

stlink:
$(ST_FLASH) write bin/$(BINBIN_F1) 0x8000000
$(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1) 0x8000000

stlink-nobl:
$(ST_FLASH) write bin/$(BINBIN_F1NOBL) 0x8000000
$(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1NOBL) 0x8000000

stlink-bl:
$(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin 0x8000000
$(ST_FLASH) $(ST_FLASH_OPTS) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin 0x8000000
sleep 3
$(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000
$(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1BL) 0x8002000

stlink-bl-old:
$(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin 0x8000000
$(ST_FLASH) $(ST_FLASH_OPTS) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin 0x8000000
sleep 3
$(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000
$(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1BL) 0x8002000

serial:
$(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 $(devser)
Expand Down

0 comments on commit 436cebb

Please sign in to comment.