target: drop deprecated code for mem2array and array2mem
Commit e370e06b72 ("target: Deprecate 'array2mem' and
'mem2array''") has already replaced the deprecated root versions
of commands mem2array and array2mem with TCL proc's that use
'read_memory' and 'write_memory'. It has left the deprecated code
of the target's version of the commands because the effort to code
the TCL replacement was not considered valuable.
To drop the last jim_handler commands, I consider much easier and
less error-prone to code them in TCL instead of converting the
deprecated code to COMMAND_HANDLER.
Drop the code in target.c and extend the TCL proc's.
While there, add the TCL procs to _telnet_autocomplete_skip.
Change-Id: I97d2370d8af479434ddf5af68541f90913982bc0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8052
Tested-by: jenkins
This commit is contained in:
@@ -219,31 +219,44 @@ proc init_target_events {} {
|
||||
proc init_board {} {
|
||||
}
|
||||
|
||||
proc mem2array {arrayname bitwidth address count {phys ""}} {
|
||||
echo "DEPRECATED! use 'read_memory' not 'mem2array'"
|
||||
lappend _telnet_autocomplete_skip _post_init_target_array_mem
|
||||
proc _post_init_target_array_mem {} {
|
||||
set targets [target names]
|
||||
lappend targets ""
|
||||
|
||||
upvar $arrayname $arrayname
|
||||
set $arrayname ""
|
||||
set i 0
|
||||
foreach t $targets {
|
||||
if {$t != ""} {
|
||||
set t "$t "
|
||||
}
|
||||
eval [format {lappend ::_telnet_autocomplete_skip "%smem2array"} $t]
|
||||
eval [format {proc {%smem2array} {arrayname bitwidth address count {phys ""}} {
|
||||
echo "DEPRECATED! use 'read_memory' not 'mem2array'"
|
||||
|
||||
foreach elem [read_memory $address $bitwidth $count {*}$phys] {
|
||||
set ${arrayname}($i) $elem
|
||||
incr i
|
||||
upvar $arrayname $arrayname
|
||||
set $arrayname ""
|
||||
set i 0
|
||||
|
||||
foreach elem [%sread_memory $address $bitwidth $count {*}$phys] {
|
||||
set ${arrayname}($i) $elem
|
||||
incr i
|
||||
}
|
||||
}} $t $t]
|
||||
eval [format {lappend ::_telnet_autocomplete_skip "%sarray2mem"} $t]
|
||||
eval [format {proc {%sarray2mem} {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)]
|
||||
}
|
||||
|
||||
%swrite_memory $address $bitwidth $data {*}$phys
|
||||
}} $t $t]
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
lappend post_init_commands _post_init_target_array_mem
|
||||
|
||||
# smp_on/smp_off were already DEPRECATED in v0.11.0 through http://openocd.zylin.com/4615
|
||||
lappend _telnet_autocomplete_skip "aarch64 smp_on"
|
||||
|
||||
Reference in New Issue
Block a user