diff --git a/boards/bluepill/Makefile.include b/boards/bluepill/Makefile.include index b666f26bc5d4f0928e4b8c6b83497af5a04cafe8..394d1257accfadcc8f87c17ecc16a90b1b54d06c 100644 --- a/boards/bluepill/Makefile.include +++ b/boards/bluepill/Makefile.include @@ -9,5 +9,22 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk -# this board uses openocd +# optionally, use dfu-util to flash via usb +# note: needs a bootloader flashed before, config below is compatible +# with blackmagic_dfu, see https://github.com/blacksphere/blackmagic/ +# To stop bootloader from loading an existing firmware, pull down +# (ground) GPIO B1. +ifeq ($(PROGRAMMER),dfu-util) + export LINKER_SCRIPT = stm32f103c8_bluepill.ld + export BINFILE = $(patsubst %.elf,%.bin,$(ELFFILE)) + + export FLASHER = dfu-util + export DEBUGGER = # no debugger + export RESET = # dfu-util has no support for resetting the device + + export OFLAGS = -O binary + export FFLAGS = -d 1d50:6017 -s 0x08002000:leave -D "$(HEXFILE)" +else +# this board uses openocd by default include $(RIOTMAKE)/tools/openocd.inc.mk +endif diff --git a/cpu/stm32f1/ldscripts/stm32f103c8_bluepill.ld b/cpu/stm32f1/ldscripts/stm32f103c8_bluepill.ld new file mode 100644 index 0000000000000000000000000000000000000000..4181d1d7a2140303ed42db67ec3ef7bed5c9f083 --- /dev/null +++ b/cpu/stm32f1/ldscripts/stm32f103c8_bluepill.ld @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2015 Alexander Melnikov <avmelnikoff@gmail.com> + * 2017 HAW Hamburg + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @addtogroup cpu_stm32f1 + * @{ + * + * @file + * @brief Memory definitions for the STM32F103C8 + * + * @author Alexander Melnikov <avmelnikoff@gmail.com> + * @author Sebastian Meiling <s@mlng.net> + * + * @} + */ + +MEMORY +{ + rom (rx) : ORIGIN = 0x08002000, LENGTH = 64K-0x2000 + ram (xrw) : ORIGIN = 0x20000000, LENGTH = 20K +} + +INCLUDE cortexm_base.ld