From e6776ae8d1928c03172bc567ac315a22c1a8e26f Mon Sep 17 00:00:00 2001
From: Kaspar Schleiser <kaspar@schleiser.de>
Date: Thu, 16 Aug 2018 16:36:05 +0200
Subject: [PATCH] edbg.inc.mk: allow flashing with an offset in rom

Allow flashing with an offset in ROM from the rom base address.
It reuses `IMAGE_OFFSET` configuration variable name from `openocd.sh`.

This will allow flashing multiple images with different flash operations.
---
 makefiles/tools/edbg.inc.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/makefiles/tools/edbg.inc.mk b/makefiles/tools/edbg.inc.mk
index 589d65a248..12d945a153 100644
--- a/makefiles/tools/edbg.inc.mk
+++ b/makefiles/tools/edbg.inc.mk
@@ -10,6 +10,10 @@ HEXFILE = $(BINFILE)
 ifneq (,$(DEBUG_ADAPTER_ID))
   EDBG_ARGS += --serial $(DEBUG_ADAPTER_ID)
 endif
+
+# Set offset according to IMAGE_OFFSET if it's defined
+EDBG_ARGS += $(addprefix --offset ,$(IMAGE_OFFSET))
+
 FFLAGS ?= $(EDBG_ARGS) -t $(EDBG_DEVICE_TYPE) -b -v -p -f $(HEXFILE)
 
 ifeq ($(RIOT_EDBG),$(FLASHER))
-- 
GitLab