prtzl / stm32

Base project for STM32 with a bunch of ways to build on all platforms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to Call Flash with JLink or STLink in CMake?

breakersun opened this issue · comments

Found the flash-st and flash-jlink target in makefile are quite handy for daily jobs.

stm32/Makefile

Lines 55 to 67 in 79d6508

flash-st: build
st-flash --reset write $(FIRMWARE) 0x08000000
$(BUILD_DIR)/jlink-script:
touch $@
@echo device $(DEVICE) > $@
@echo si 1 >> $@
@echo speed 4000 >> $@
@echo loadfile $(FIRMWARE),0x08000000 >> $@
@echo -e "r\ng\nqc" >> $@
flash-jlink: build | $(BUILD_DIR)/jlink-script
JLinkExe -commanderScript $(BUILD_DIR)/jlink-script

So I was wondering, how can we achieve the same thing in CMake process?