Hi
Rev 1547,  Added two commands that just returns values in hex, good for 
scripting.

 >dap baseaddr
 >dap apid

Next I started playing with Tcl scripts that scans the ROM table and 
installed components. This is my first shot at JimTcl in OpenOCD but it  
works quite ok.

< dapinfo.tcl > ============================================
# Implement dap info in Tcl

# get ap id and debugbase
puts "Debug interface ROM table examination"
set debugbase [lindex [split [ocd_dap_baseaddr]] 0]
set apid [lindex [split [ocd_dap_apid]] 0]

puts "AP debugbase $debugbase"
puts "AP id        $apid"

# everything can now be done with memory reads
# Examine ROM table id and memtype
ocd_mem2array romtable_cid 32 [expr ($debugbase&0xFFFFF000) + 0xFF0] 4
ocd_mem2array memtype 32 [expr ($debugbase&0xFFFFF000) + 0xFCC] 1
puts [format "    MEM-AP  memtype  %#010x" $memtype(0)]
puts "    MEM-AP  id  cid\[3\]     cid\[2\]     cid\[1\]     cid\[0\]"
puts [format "                %#010x %#010x %#010x %#010x" 
$romtable_cid(3) $romtable_cid(2) $romtable_cid(1) $romtable_cid(0)]

# Loop over rom table entries
ocd_mem2array romtable 32 [expr $debugbase & 0xFFFFF000] 20
for { set ix 0 } { $romtable($ix) != 0 } { incr ix 1 } {
    set comp_base [expr $romtable($ix)&0xFFFFF000];
    if {$romtable($ix)&0x80000000} {set comp_base [expr $comp_base - 
0x100000000]}
    set comp_base [expr $comp_base + $debugbase&0xFFFFF000];
    puts "Table entry [format "%#08x" $romtable($ix)] component base is 
[format "%#08x" $comp_base]";
    if {$romtable($ix)&0x3!=0} {
        puts "\tValid"
        ocd_mem2array comp_cid 32 [expr $comp_base + 0xFF0] 4
        ocd_mem2array comp_pid 32 [expr $comp_base + 0xFD0] 8
        puts "\tComponent   id  cid\[3\]   cid\[2\]   cid\[1\]   cid\[0\]"
        puts [format "\t                %#010x %#010x %#010x %#010x" 
$comp_cid(3) $comp_cid(2) $comp_cid(1) $comp_cid(0)]
        puts "\tPeripherial id  pid\[4\]   pid\[3\]   pid\[2\]   
pid\[1\]   pid\[0\]"
        puts [format "\t                %#010x %#010x %#010x %#010x 
%#010x" $comp_pid(0) $comp_pid(7) $comp_pid(6) $comp_pid(5) $comp_pid(4) ]
    } {
        puts "\tNot present"   
    }
}

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to