diff options
author | Marc Schink <dev@zapb.de> | 2021-06-07 14:40:30 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2022-03-12 09:48:00 +0000 |
commit | e370e06b724f6e3a0fdd8611a3d461c2cc15735c (patch) | |
tree | 2df1c37487c523c41ec26f9d3f76545ffd160f7c /src/target/startup.tcl | |
parent | 38183dc856fdb7e69c8407911ff16383f4b12247 (diff) | |
download | riscv-openocd-e370e06b724f6e3a0fdd8611a3d461c2cc15735c.zip riscv-openocd-e370e06b724f6e3a0fdd8611a3d461c2cc15735c.tar.gz riscv-openocd-e370e06b724f6e3a0fdd8611a3d461c2cc15735c.tar.bz2 |
target: Deprecate 'array2mem' and 'mem2array''
Replace 'mem2array' and 'array2mem' with a Tcl wrapper that
internally uses 'read_memory' and 'write_memory'.
The target-specific 'mem2array' and 'array2mem' functions
remain for now.
Change-Id: If24c22a76ac72d4c26916a95f7f17902b41b6d9e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/6308
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/target/startup.tcl')
-rw-r--r-- | src/target/startup.tcl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/target/startup.tcl b/src/target/startup.tcl index cd98d68..0e46992 100644 --- a/src/target/startup.tcl +++ b/src/target/startup.tcl @@ -206,6 +206,32 @@ proc init_target_events {} { proc init_board {} { } +proc mem2array {arrayname bitwidth address count {phys ""}} { + echo "DEPRECATED! use 'read_memory' not 'mem2array'" + + upvar $arrayname $arrayname + set $arrayname "" + set i 0 + + foreach elem [read_memory $address $bitwidth $count {*}$phys] { + set ${arrayname}($i) $elem + incr i + } +} + +proc array2mem {arrayname bitwidth address count {phys ""}} { + echo "DEPRECATED! use 'write_memory' not 'array2mem'" + + upvar $arrayname $arrayname + set data "" + + for {set i 0} {$i < $count} {incr i} { + lappend data [expr $${arrayname}($i)] + } + + write_memory $address $bitwidth $data {*}$phys +} + # smp_on/smp_off were already DEPRECATED in v0.11.0 through http://openocd.zylin.com/4615 lappend _telnet_autocomplete_skip "aarch64 smp_on" proc "aarch64 smp_on" {args} { |