Skip to content

Instantly share code, notes, and snippets.

@dhylands
Last active November 10, 2015 19:09
Show Gist options
  • Save dhylands/b6446bd55eb928103719 to your computer and use it in GitHub Desktop.
Save dhylands/b6446bd55eb928103719 to your computer and use it in GitHub Desktop.
GNUmakefile I use for micropython
$(info Executing GNUmakefile)
#BOARD = STM32F7DISC
BOARD = STM32F429DISC
#BOARD = PYBV10
$(info BOARD = $(BOARD))
DFU_UTIL = dfu-util -s :leave
USE_PYDFU = 1
include Makefile
.PHONY: stlink
ifeq ($(BOARD),STM32F429DISC)
stlink: $(BUILD)/firmware.elf
$(ECHO) "Writing flash"
$(Q)$(OBJCOPY) -O binary -j .isr_vector -j .text -j .data $^ $(BUILD)/firmware.bin
$(Q)st-flash --reset write $(BUILD)/firmware.bin 0x08000000
else
stlink: $(BUILD)/firmware.elf
$(ECHO) "Writing flash"
$(Q)$(OBJCOPY) -O binary -j .isr_vector $^ $(BUILD)/firmware0.bin
$(Q)st-flash write $(BUILD)/firmware0.bin 0x08000000
$(Q)$(OBJCOPY) -O binary -j .text -j .data $^ $(BUILD)/firmware1.bin
$(Q)st-flash --reset write $(BUILD)/firmware1.bin 0x08020000
endif
# See http://ncrmnt.org/wp/2013/05/06/stlink-as-a-serial-terminal/ for using
# st-term
show-board:
$(ECHO) "BOARD = ${BOARD}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment