From f571814ded411171d91a735d3cdf871aa5bddb34 Mon Sep 17 00:00:00 2001
From: kYc0o <fco.ja.ac@gmail.com>
Date: Tue, 24 Oct 2017 14:24:19 +0200
Subject: [PATCH] boards: add rom boot offset for boards w/bootloader

---
 boards/bluepill/Makefile.include   | 16 ++++++++--------
 boards/opencm904/Makefile.include  |  6 +++---
 boards/spark-core/Makefile.include |  6 +++---
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/boards/bluepill/Makefile.include b/boards/bluepill/Makefile.include
index 394d1257ac..1b9d722416 100644
--- a/boards/bluepill/Makefile.include
+++ b/boards/bluepill/Makefile.include
@@ -15,16 +15,16 @@ include $(RIOTMAKE)/tools/serial.inc.mk
 # 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 ROM_OFFSET ?= 0x2000 # Skip the space needed by the embedded bootloader
+  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 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)"
+  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/boards/opencm904/Makefile.include b/boards/opencm904/Makefile.include
index 18b0b6cffa..c84c2fc89e 100644
--- a/boards/opencm904/Makefile.include
+++ b/boards/opencm904/Makefile.include
@@ -2,9 +2,6 @@
 export CPU = stm32f1
 export CPU_MODEL = stm32f103cb
 
-# custom linkerscript
-export LINKER_SCRIPT = stm32f103cb_opencm904.ld
-
 # custom flasher to use with the bootloader
 export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/robotis-loader.py
 export DEBUGGER =
@@ -19,5 +16,8 @@ export DEBUGGER_FLAGS =
 PORT_LINUX ?= /dev/ttyACM0
 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
 
+# Skip the space needed by the embedded bootloader
+export ROM_OFFSET ?= 0x3000
+
 # setup serial terminal
 include $(RIOTMAKE)/tools/serial.inc.mk
diff --git a/boards/spark-core/Makefile.include b/boards/spark-core/Makefile.include
index b2942cc3f8..98c8cbee6a 100644
--- a/boards/spark-core/Makefile.include
+++ b/boards/spark-core/Makefile.include
@@ -2,9 +2,6 @@
 export CPU = stm32f1
 export CPU_MODEL = stm32f103cb
 
-# the spark-core uses its own custom linkerscript...
-export LINKER_SCRIPT = stm32f103cb_sparkcore.ld
-
 # configure the serial interface
 PORT_LINUX ?= /dev/ttyUSB0
 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
@@ -21,5 +18,8 @@ export FFLAGS = -d 1d50:607f -a 0 -s 0x08005000:leave -D "$(HEXFILE)"
 
 export INCLUDES += -I$(RIOTCPU)/$(CPU)/include/ -I$(RIOTBOARD)/$(BOARD)/include/
 
+# Skip the space needed by the embedded bootloader
+export ROM_OFFSET ?= 0x5000
+
 # this board uses openocd
 include $(RIOTMAKE)/tools/openocd.inc.mk
-- 
GitLab