You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xilinx-tcl.cfg 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #
  2. # TCL to allow the Xilinx PS7 Init TCL code to run in OpenOCD.
  3. #
  4. proc mrd { args } {
  5. if {[llength $args] == 0} {
  6. echo "mrd address \[count \[w|h|b\]\]"
  7. echo " Read <count> memory locations starting at <address>. Defaults to one word."
  8. return
  9. }
  10. set addr [lindex $args 0]
  11. set count 1
  12. set bits 32
  13. if {[llength $args] > 1} {
  14. set count [lindex $args 1]
  15. if {[llength $args] > 2} {
  16. switch [lindex $args 2] {
  17. w { set bits 32 }
  18. h { set bits 16 }
  19. b { set bits 8 }
  20. default { set bits 32 }
  21. }
  22. }
  23. }
  24. mem2array x $bits $addr $count
  25. set nibbles [expr {$bits / 4}]
  26. set bytes [expr {$bits / 8}]
  27. set result {}
  28. foreach {idx elmt} $x {
  29. append result [format "%08x: %0*x\n" [expr {$addr + $idx * $bytes}] $nibbles $elmt]
  30. }
  31. return $result
  32. }
  33. proc mwr { args } {
  34. set addr [lindex $args 1]
  35. set data [lindex $args 2]
  36. mww $addr $data
  37. }
  38. proc mask_write { addr mask value } {
  39. set curval "0x[string range [mrd $addr] end-8 end]"
  40. set maskedval [expr {$curval & ~$mask}]
  41. #echo "curval = [format 0x%08x $curval] maskedval = [format 0x%08x $maskedval]"
  42. set writeval(0) [expr {$maskedval | $value}]
  43. #echo " $addr <= [format 0x%08x $writeval(0)] ([format 0x%08x $curval]: [format 0x%08x $mask]/[format 0x%08x $value])"
  44. array2mem writeval 32 $addr 1
  45. }
  46. proc xilinx_ps7_init { } {
  47. poll off
  48. reset init
  49. reset halt
  50. targets zynq.cpu.0
  51. sleep 100
  52. halt
  53. ps7_debug
  54. ps7_init
  55. ps7_post_config
  56. poll on
  57. }