diff --git a/tcl/target/at91r40008.cfg b/tcl/target/at91r40008.cfg
index fe755b4d96f6ee45ce4ccbdb354de19de343c108..eb6cabaa2818597d3e266b392712661a174b9b80 100644
--- a/tcl/target/at91r40008.cfg
+++ b/tcl/target/at91r40008.cfg
@@ -45,7 +45,7 @@ $_TARGETNAME configure -event gdb-flash-erase-start {
 
 $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x3C000 -work-area-size 0x4000 -work-area-backup 0
 
-flash bank cfi 0x10000000 0x400000 2 2 0
+flash bank cfi 0x10000000 0x400000 2 2 $_TARGETNAME
 
 # For more information about the configuration files, take a look at:
 # openocd.texi
diff --git a/tcl/target/epc9301.cfg b/tcl/target/epc9301.cfg
index f3fe7eb1c0703428e710d0f1559bf2e87834be72..2b4155fbc61366944d575531a9432eb1049727a6 100644
--- a/tcl/target/epc9301.cfg
+++ b/tcl/target/epc9301.cfg
@@ -28,4 +28,4 @@ target create $_TARGETNAME arm920t -endian $_ENDIAN -chain-position $_TARGETNAME
 
 #flash configuration
 #flash bank <driver> <base> <size> <chip_width> <bus_width> [driver_options ...]
-flash bank cfi 0x60000000 0x1000000 2 2 0
+flash bank cfi 0x60000000 0x1000000 2 2 $_TARGETNAME
diff --git a/tcl/target/lpc1768.cfg b/tcl/target/lpc1768.cfg
index fbf7117cae7f405636225da6397f01267a9da49f..63ec1bb32dcef64ba8b018aeeda2905548c082ee 100644
--- a/tcl/target/lpc1768.cfg
+++ b/tcl/target/lpc1768.cfg
@@ -44,7 +44,7 @@ $_TARGETNAME configure -event reset-init {
 # LPC1768 has 512kB of user-available FLASH (bootloader is located in separate dedicated region).
 # flash bank lpc1700 <base> <size> 0 0 <target#> <variant> <cclk> [calc_checksum]
 
-flash bank lpc2000 0x0 0x80000 0 0 0 lpc1700 12000 calc_checksum
+flash bank lpc2000 0x0 0x80000 0 0 $_TARGETNAME lpc1700 12000 calc_checksum
 
 # 4MHz / 6 = 666kHz, so use 500
 jtag_khz 500
diff --git a/tcl/target/lpc2103.cfg b/tcl/target/lpc2103.cfg
index 899ca2371053865539a1d08d30068359df445fe5..1a880761905ba5aff31c78a98837b5567041c68c 100644
--- a/tcl/target/lpc2103.cfg
+++ b/tcl/target/lpc2103.cfg
@@ -35,4 +35,4 @@ $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-s
 
 # 32kB of internal Flash, core clocked with 12MHz crystal
 # flash bank lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc_checksum]
-flash bank lpc2000 0x0 0x8000 0 0 0 lpc2000_v2 12000 calc_checksum
+flash bank lpc2000 0x0 0x8000 0 0 $_TARGETNAME lpc2000_v2 12000 calc_checksum
diff --git a/tcl/target/lpc2124.cfg b/tcl/target/lpc2124.cfg
index 9430c1b04b2040ee5364b41a2838529c380bdd4c..61d411b5680ca4886d5e8e214fb48923ada25a1f 100644
--- a/tcl/target/lpc2124.cfg
+++ b/tcl/target/lpc2124.cfg
@@ -39,4 +39,4 @@ $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-s
 
 
 #flash bank <driver> <base> <size> <chip_width> <bus_width>
-flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14745 calc_checksum
+flash bank lpc2000 0x0 0x40000 0 0 $_TARGETNAME lpc2000_v1 14745 calc_checksum
diff --git a/tcl/target/lpc2129.cfg b/tcl/target/lpc2129.cfg
index daaa8d560b29085f3f99ae51e0fd65e9c22c476c..5438fc3cd91536f5f99c44f842d1d3a866fdd186 100644
--- a/tcl/target/lpc2129.cfg
+++ b/tcl/target/lpc2129.cfg
@@ -38,4 +38,4 @@ target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAM
 $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 0
 
 #flash bank <driver> <base> <size> <chip_width> <bus_width>
-flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum
+flash bank lpc2000 0x0 0x40000 0 0 $_TARGETNAME lpc2000_v1 14765 calc_checksum
diff --git a/tcl/target/lpc2148.cfg b/tcl/target/lpc2148.cfg
index e70947fe9c319b5d50d63eed72cdad838be373aa..b5023437b188a81163cd33431b8b3cbc8b46629f 100644
--- a/tcl/target/lpc2148.cfg
+++ b/tcl/target/lpc2148.cfg
@@ -52,4 +52,4 @@ $_TARGETNAME configure -event reset-init {
 }
 
 # flash bank lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc_checksum]
-flash bank lpc2000 0x0 0x7d000 0 0 0 lpc2000_v2 14765 calc_checksum
+flash bank lpc2000 0x0 0x7d000 0 0 $_TARGETNAME lpc2000_v2 14765 calc_checksum
diff --git a/tcl/target/lpc2294.cfg b/tcl/target/lpc2294.cfg
index 399b11dfb7bdfa9fbfb2f7c99d8ba34311ab1189..08fbf58190fa383619eded634a71b790dcea7cf3 100644
--- a/tcl/target/lpc2294.cfg
+++ b/tcl/target/lpc2294.cfg
@@ -32,7 +32,7 @@ $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-s
 
 #flash configuration
 #flash bank lpc2000 <base> <size> 0 0 <target#> <variant>
-flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum
+flash bank lpc2000 0x0 0x40000 0 0 $_TARGETNAME lpc2000_v1 14765 calc_checksum
 
 # For more information about the configuration files, take a look at:
 # openocd.texi
diff --git a/tcl/target/lpc2378.cfg b/tcl/target/lpc2378.cfg
index d34ffae66deb648e59f4925cbc7d0158e82c7138..34b9963f93f223a6ac718c6055b85d173ab6da58 100644
--- a/tcl/target/lpc2378.cfg
+++ b/tcl/target/lpc2378.cfg
@@ -43,7 +43,7 @@ $_TARGETNAME configure -event reset-init {
 # LPC2378 has 512kB of FLASH, but upper 8kB are occupied by bootloader.
 # After reset the chip uses its internal 4MHz RC oscillator
 #flash bank lpc2000 <base> <size> 0 0 <target#> <variant>
-flash bank lpc2000 0x0 0x0007D000 0 0 0 lpc2000_v2 4000 calc_checksum
+flash bank lpc2000 0x0 0x0007D000 0 0 $_TARGETNAME lpc2000_v2 4000 calc_checksum
 
 # 4MHz / 6 = 666kHz, so use 500
 jtag_khz 500
diff --git a/tcl/target/lpc2478.cfg b/tcl/target/lpc2478.cfg
index 1d2058b0440afdcd12e51a05093fbcb7f32b50e6..bf33ae0e04a5fa1a6d28b9d8da024ec11a275a2f 100644
--- a/tcl/target/lpc2478.cfg
+++ b/tcl/target/lpc2478.cfg
@@ -43,7 +43,7 @@ $_TARGETNAME configure -event reset-init {
 # LPC2378 has 512kB of FLASH, but upper 8kB are occupied by bootloader.
 # After reset the chip uses its internal 4MHz RC oscillator.
 # flash bank lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum]
-flash bank lpc2000 0x0 0x7D000 0 0 0 lpc2000_v2 12000 calc_checksum
+flash bank lpc2000 0x0 0x7D000 0 0 $_TARGETNAME lpc2000_v2 12000 calc_checksum
 
 # Try to use RCLK, if RCLK is not available use "normal" mode. 4MHz / 6 = 666kHz, so use 500.
 jtag_rclk 500
diff --git a/tcl/target/smdk6410.cfg b/tcl/target/smdk6410.cfg
index 6ce07caedec286c4306c29dcb47a28f0482ba6b8..7f15f8b8769966a48bcbd3144b816abf8228766a 100644
--- a/tcl/target/smdk6410.cfg
+++ b/tcl/target/smdk6410.cfg
@@ -5,4 +5,4 @@
 
 source [find target/samsung_s3c6410.cfg]
 
-flash bank cfi 0x00000000 0x00100000 2 2 0 jedec_probe
\ No newline at end of file
+flash bank cfi 0x00000000 0x00100000 2 2 $_TARGETNAME jedec_probe
diff --git a/tcl/target/stm32.cfg b/tcl/target/stm32.cfg
index a37e73341cb4708297f6bec1eb24109a0b1ced67..b5a86527e704c82d1c829044a4bccf4f22b64234 100644
--- a/tcl/target/stm32.cfg
+++ b/tcl/target/stm32.cfg
@@ -62,7 +62,7 @@ target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNA
 
 $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
 
-flash bank stm32x 0 0 0 0 0
+flash bank stm32x 0 0 0 0 $_TARGETNAME
 
 # For more information about the configuration files, take a look at:
 # openocd.texi
diff --git a/tcl/target/xba_revA3.cfg b/tcl/target/xba_revA3.cfg
index 0595fa1612203305b5c77824db588c722a3f3b5c..e1c88705566da7a3a7e66cc0f30c927a92745667 100644
--- a/tcl/target/xba_revA3.cfg
+++ b/tcl/target/xba_revA3.cfg
@@ -79,7 +79,7 @@ $_TARGETNAME configure -event reset-init {
 $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20010000 -work-area-size 0x8060 -work-area-backup 0
 
 
-flash bank cfi 0x50000000 0x400000 2 2 0
+flash bank cfi 0x50000000 0x400000 2 2 $_TARGETNAME
 
 init
 reset init