This is an automated email from Gerrit. Antonio Borneo ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4587
-- gerrit commit 6452c0bcad199d486c86274fa49dcb91f11ec8db Author: Antonio Borneo <[email protected]> Date: Mon Jul 2 11:00:29 2018 +0200 tcl: mem_helper: add "phys" variants of mrw and mmw On targets with MMU, the existing commands mrw and mmw only deal with virtual memory addresses. Add wrappers for mrw and mmw that provide both physical and virtual addressing, while mimic the well established syntax of the commands mdw and mww: mrw [phys] address mmw [phys] address setbits clearbits Wrappers are backward compatible with former implementation Change-Id: I8ff31098d2d59c40cc9f9622955ebe1424cc69b5 Signed-off-by: Antonio Borneo <[email protected]> diff --git a/tcl/mem_helper.tcl b/tcl/mem_helper.tcl index 86ad00f..be297d3 100644 --- a/tcl/mem_helper.tcl +++ b/tcl/mem_helper.tcl @@ -1,13 +1,30 @@ # Helper for common memory read/modify/write procedures -# mrw: "memory read word", returns value of $reg -proc mrw {reg} { +# helpers for mrw +proc mrw_virt {reg} { set value "" mem2array value 32 $reg 1 return $value(0) } -add_usage_text mrw "address" +proc mrw_phys {reg} { + set value "" + mem2array value 32 $reg 1 phys + return $value(0) +} + +# mrw: "memory read word", returns value of word in memory +proc mrw {a {b ""}} { + if {$b eq ""} { + return [mrw_virt $a]; + } + if {$a eq "phys"} { + return [mrw_phys $b]; + } + return -code error "wrong args: should be \" mrw \[phys\] address\"" +} + +add_usage_text mrw "\[phys\] address" add_help_text mrw "Returns value of word in memory." proc mrb {reg} { @@ -19,13 +36,31 @@ proc mrb {reg} { add_usage_text mrb "address" add_help_text mrb "Returns value of byte in memory." -# mmw: "memory modify word", updates value of $reg -# $reg <== ((value & ~$clearbits) | $setbits) -proc mmw {reg setbits clearbits} { - set old [mrw $reg] +# helpers for mmw +proc mmw_virt {reg setbits clearbits} { + set old [mrw_virt $reg] set new [expr ($old & ~$clearbits) | $setbits] mww $reg $new } -add_usage_text mmw "address setbits clearbits" +proc mmw_phys {reg setbits clearbits} { + set old [mrw_phys $reg] + set new [expr ($old & ~$clearbits) | $setbits] + mww phys $reg $new +} + +# mmw: "memory modify word", updates value of word in memory +# $reg <== ((value & ~$clearbits) | $setbits) +proc mmw {a b c {d ""}} { + if {$d eq ""} { + mmw_virt $a $b $c + return ""; + } + if {$a eq "phys"} { + return [mmw_phys $b $c $d] + } + return -code error "wrong args: should be \" mmw \[phys\] address setbits clearbits\"" +} + +add_usage_text mmw "\[phys\] address setbits clearbits" add_help_text mmw "Modify word in memory. new_val = (old_val & ~clearbits) | setbits;" -- ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
