1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/boards/common/stm32f103c8/Makefile.include
Marian Buschsieweke 82ea9a02de
boards: Enable STM32F103C8 flash hack via env var
The STM32F103C8 secretly comes with 128KiB flash instead of 64KiB. Still, only
64KiB of it are tested and guaranteed to work. However, most of the times the
whole 128KiB flash works just fine. In the BluePill documentation this fact is
already documented and by using

    $ make BOARD=bluepill CPU_MODEL=stm32f103cb

the whole 128 KiB can be used by RIOT. When using this hack routinely, it easier
to use environment variables instead. But allowing to overwrite CPU_MODEL via
environment variables seems to be a bad thing, as it is easy to forget to clear
that environment variable when changing the BOARD variable.

This commit introduces the new STM32F103C8_FLASH_HACK variable, which unlocks
the 128KiB FLASH when set to "1". The BluePill documentation has been updated
accordingly.
2018-11-05 14:19:21 +01:00

46 lines
1.4 KiB
Makefile

## the cpu to build for
export CPU = stm32f1
STM32F103C8_FLASH_HACK ?= 0
ifneq ($(STM32F103C8_FLASH_HACK),0)
export CPU_MODEL = stm32f103cb
else
export CPU_MODEL = stm32f103c8
endif
INCLUDES += -I$(RIOTBOARD)/common/stm32f103c8/include
# define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk
# 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 ROM_OFFSET ?= 0x2000 # Skip the space needed by the embedded bootloader
export FLASHER = dfu-util
export DEBUGGER = # no debugger
export RESET = # dfu-util has no support for resetting the device
HEXFILE = $(BINFILE)
export FFLAGS = -d 1eaf:0003 -a 2 -D "$(HEXFILE)"
# for older bootloader versions use this:
#export FFLAGS = -d 1d50:6017 -s 0x08002000:leave -D "$(HEXFILE)"
else
# this board uses openocd by default
export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2
# call a 'reset halt' command before starting the debugger
# it is required as `connect_assert_srst` is set
export OPENOCD_DBG_START_CMD = -c 'reset halt'
include $(RIOTMAKE)/tools/openocd.inc.mk
endif