aboutsummaryrefslogtreecommitdiff
path: root/tcl
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2015-04-20 02:51:23 +0200
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2016-02-29 19:40:20 +0000
commit43ff5acd45017fd9828cc56f54b929e600956c3b (patch)
treef6642b088a641491ce0c8de96423cb1f45b6f1f2 /tcl
parent13618ab99426b0786d6825e5816a3b082f8aa973 (diff)
downloadriscv-openocd-43ff5acd45017fd9828cc56f54b929e600956c3b.zip
riscv-openocd-43ff5acd45017fd9828cc56f54b929e600956c3b.tar.gz
riscv-openocd-43ff5acd45017fd9828cc56f54b929e600956c3b.tar.bz2
flash: New Spansion FM4 flash driver
The Spansion FM4 family of microcontrollers does not offer a way to identify the chip model nor the flash size, except for Dual Flash vs. regular layout. Therefore the family is passed as argument and wildcard-matched - MB9BFx6x and S6E2CC families are supported. Iterations showed that ... 1) Just doing the flash command sequence from SRAM loader code for each half-word took 20 minutes for an 8 KB block. 2) Doing the busy-wait in the loader merely reduced the time to 19 minutes. 3) Significant performance gains were achieved by looping in loader code rather than in OpenOCD and by maximizing the batch size across sectors, getting us down to ~2 seconds for 8 KB and ~2.5 minutes for 1.1 MB. (Tested with SK-FM4-176L-S6E2CC-ETH v11, CMSIS-DAP v23.) gcc, objcopy -Obinary and bin2char.sh are used for automating the integration of hand-written assembler snippets. Change-Id: I092c81074662534f50b71b91d54eb8e0098fec76 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/2190 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'tcl')
-rw-r--r--tcl/board/spansion_sk-fm4-176l-s6e2cc.cfg1
-rw-r--r--tcl/board/spansion_sk-fm4-u120-9b560.cfg1
-rw-r--r--tcl/target/fm4_mb9bf.cfg3
-rw-r--r--tcl/target/fm4_s6e2cc.cfg4
4 files changed, 9 insertions, 0 deletions
diff --git a/tcl/board/spansion_sk-fm4-176l-s6e2cc.cfg b/tcl/board/spansion_sk-fm4-176l-s6e2cc.cfg
index 4b23146..2855c5d 100644
--- a/tcl/board/spansion_sk-fm4-176l-s6e2cc.cfg
+++ b/tcl/board/spansion_sk-fm4-176l-s6e2cc.cfg
@@ -13,6 +13,7 @@ source [find interface/cmsis-dap.cfg]
# FM4 S6E2CCAJ0A w/ 192 KB SRAM0
#
set CHIPNAME s6e2cc
+set CHIPSERIES S6E2CCAJ0A
set WORKAREASIZE 0x30000
source [find target/fm4_s6e2cc.cfg]
diff --git a/tcl/board/spansion_sk-fm4-u120-9b560.cfg b/tcl/board/spansion_sk-fm4-u120-9b560.cfg
index 64cbade..38ad4a8 100644
--- a/tcl/board/spansion_sk-fm4-u120-9b560.cfg
+++ b/tcl/board/spansion_sk-fm4-u120-9b560.cfg
@@ -11,6 +11,7 @@
# FM4 MB9BF568R w/ 64 KB SRAM0
#
set CHIPNAME mb9bf568
+set CHIPSERIES MB9BF568R
set WORKAREASIZE 0x10000
source [find target/fm4_mb9bf.cfg]
diff --git a/tcl/target/fm4_mb9bf.cfg b/tcl/target/fm4_mb9bf.cfg
index 12a6aee..e53fdc8 100644
--- a/tcl/target/fm4_mb9bf.cfg
+++ b/tcl/target/fm4_mb9bf.cfg
@@ -13,3 +13,6 @@ if { [info exists WORKAREASIZE] } {
$_TARGETNAME configure -work-area-phys [expr 0x20000000 - $_WORKAREASIZE] \
-work-area-size $_WORKAREASIZE -work-area-backup 0
+
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME fm4 0x00000000 0 0 0 $_TARGETNAME $CHIPSERIES
diff --git a/tcl/target/fm4_s6e2cc.cfg b/tcl/target/fm4_s6e2cc.cfg
index 18cc630..60b73b9 100644
--- a/tcl/target/fm4_s6e2cc.cfg
+++ b/tcl/target/fm4_s6e2cc.cfg
@@ -13,3 +13,7 @@ if { [info exists WORKAREASIZE] } {
$_TARGETNAME configure -work-area-phys [expr 0x20000000 - $_WORKAREASIZE] \
-work-area-size $_WORKAREASIZE -work-area-backup 0
+
+set _FLASHNAME $_CHIPNAME.flash
+flash bank ${_FLASHNAME}0 fm4 0x00000000 0 0 0 $_TARGETNAME $CHIPSERIES
+flash bank ${_FLASHNAME}1 fm4 0x00100000 0 0 0 $_TARGETNAME $CHIPSERIES