KISS Data Aquisition and Control System
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.

189 lines
9.3 KiB

  1. Prudebug Version 0.25
  2. (C) Copyright 2011, 2013 by Arctica Technologies
  3. Written by Steven Anderson
  4. Prudebug is a very small program that was initially intended to be 100-200 lines of code to start/stop the PRU and load a binary in the PRU.
  5. As I worked through my PRU development project I added several addition features (some I needed for debugging the project, and a few just
  6. because they seemed nice). After completing the PRU coding project this program sat unused for about a year before I decided that maybe
  7. someone else out there needed a PRU debugger. After all, if you need a hard realtime process and you're using Linux, a PRU is an easy
  8. way to go.
  9. THIS PROGRAM HAS VERY LIMITED TESTING - USE AT YOUR OWN RISK.
  10. I did test the features that I used, but there are many features I didn't need for my project. I attempted a couple quick tests with the
  11. unused features, but it would be very easy to miss something. For example, I only used PRU0 for my coding, so very little testing was done
  12. with PRU1. I'm sure the user interface has bugs but I haven't hit them yet....it's easy to miss issues when you know how it's supposed
  13. to work. As I continue to add code, I'll try to do a more complete job of testing, but I will continue to use feedback for locating most
  14. bugs.
  15. RELEASE NOTES for prudebug
  16. ---------------------------------------------------------------------
  17. Version 0.24
  18. Improvements:
  19. Added support for UIO PRUSS driver
  20. Moved to dynamic processor selection - user can pick a processor on the command line
  21. Fixed watchpoints and breakpoints to support different values on different PRUs
  22. Version 0.25
  23. Bug fixes provided by Shoji Suzuki
  24. Correction to the QBA instruction decode
  25. Fix backspace code for terminals using 0x7f
  26. Corrected issue with writing numbers greater than 0x7fffffff to PRU memory with the wr command
  27. BUGS
  28. ---------------------------------------------------------------------
  29. Please let me know if you find any bugs or you have comments on prudebug (steve.anderson@arcticatechnologies.com). You can also log a bug
  30. on the SourceForge page. I will try to fix bugs as time permits.
  31. No known bugs at the time of v0.25 release
  32. USE WITH PRUSS v2
  33. ---------------------------------------------------------------------
  34. prudebug should work fine with the PRUSSv2. It does not support any new features of the PRUSSv2, but I will try to add some as
  35. time permits. I have done some testing on both the AM1707 (PRUSSv1) and AM3358 (PRUSSv2) processors.
  36. CONTRIBUTORS
  37. ---------------------------------------------------------------------
  38. Christian Joly - bug fixes, and modifications to make prudebug work with PRUSSv2.
  39. Shoji Suzuki - bug fixes for v0.25
  40. INSTALLATION
  41. ---------------------------------------------------------------------
  42. To build just run make in the source code directory (make sure you have the correct cross-compiler in place and in the path -
  43. arm-none-linux-gnueabi-gcc). The binary is called prudebug.
  44. USAGE
  45. ---------------------------------------------------------------------
  46. Usage: prudebug [-a pruss-address] [-u] [-m] [-p processor]
  47. -a - pruss-address is the memory address of the PRU in ARM memory space
  48. -u - force the use of UIO to map PRU memory space
  49. -m - force the use of /dev/mem to map PRU memory space
  50. if neither the -u or -m options are used then it will try the UIO first
  51. -p - select processor to use (sets the PRU memory locations)
  52. AM1707 - AM1707
  53. AM335X - AM335x
  54. Generally the -a option should not be used. If it is used, then prudebug will use the -a address for the PRU base with
  55. the selected processor as the various PRU subsystem offsets. -u and -m control the way the PRU base address is mapped for
  56. program access (either the /dev/mem or /dev/uio* device). If -u or -m are selected then it will only used the selected
  57. method or fail. If neither the -u or -m are selected then prudebug will try to use the UIO device driver, and if that fails
  58. then it will use /dev/mem. The -p option allows you to select the processor. If your processor is not listed then determine
  59. if one of the listed processors has compatible PRU (same base address and PRU subsystem offsets). If not, you'll need to
  60. modify prudbg.c and prudbg.h (see remarks near the beginning of prudbg.c). If you do add to the list of processors, please
  61. send me the diff so I can add it into future releases.
  62. COMMAND HELP
  63. I would like to spend a little time writing up a command document, but in the meantime the following will have to do.
  64. The command line takes the command 'help' to provide a detailed help, and 'hb' for a brief help. Listed below is both.
  65. PRU0> hb
  66. Command help
  67. BR [breakpoint_number [address]] - View or set an instruction breakpoint
  68. D memory_location_wa [length] - Raw dump of PRU data memory (32-bit word offset from beginning of full PRU memory block - all PRUs)
  69. DD memory_location_wa [length] - Dump data memory (32-bit word offset from beginning of PRU data memory)
  70. DI memory_location_wa [length] - Dump instruction memory (32-bit word offset from beginning of PRU instruction memory)
  71. DIS memory_location_wa [length] - Disassemble instruction memory (32-bit word offset from beginning of PRU instruction memory)
  72. G - Start processor execution of instructions (at current IP)
  73. GSS - Start processor execution using automatic single stepping - this allows running a program with breakpoints
  74. HALT - Halt the processor
  75. L memory_location_iwa file_name - Load program file into instruction memory
  76. PRU pru_number - Set the active PRU where pru_number ranges from 0 to 1
  77. Q - Quit the debugger and return to shell prompt.
  78. R - Display the current PRU registers.
  79. RESET - Reset the current PRU
  80. SS - Single step the current instruction.
  81. WA [watch_num [address [value]]] - Clear or set a watch point
  82. WR memory_location_wa value1 [value2 [value3 ...]] - Write a 32-bit value to a raw (offset from beginning of full PRU memory block)
  83. WRD memory_location_wa value1 [value2 [value3 ...]] - Write a 32-bit value to PRU data memory for current PRU
  84. WRI memory_location_wa value1 [value2 [value3 ...]] - Write a 32-bit value to PRU instruction memory for current PRU
  85. PRU0> help
  86. Command help
  87. Commands are case insensitive
  88. Address and numeric values can be dec (ex 12), hex (ex 0xC), or octal (ex 014)
  89. Memory addresses can be wa=32-bit word address, ba=byte address. Suffix of i=instruction or d=data memory
  90. Return without a command will rerun a previous d, dd, or di command while displaying the next block
  91. BR [breakpoint_number [address]]
  92. View or set an instruction breakpoint
  93. 'b' by itself will display current breakpoints
  94. breakpoint_number is the breakpoint reference and ranges from 0 to 4
  95. address is the instruction word address that the processor should stop at (instruction is not executed)
  96. if no address is provided, then the breakpoint is cleared
  97. D memory_location_wa [length]
  98. Raw dump of PRU data memory (32-bit word offset from beginning of full PRU memory block - all PRUs)
  99. DD memory_location_wa [length]
  100. Dump data memory (32-bit word offset from beginning of PRU data memory)
  101. DI memory_location_wa [length]
  102. Dump instruction memory (32-bit word offset from beginning of PRU instruction memory)
  103. DIS memory_location_wa [length]
  104. Disassemble instruction memory (32-bit word offset from beginning of PRU instruction memory)
  105. G
  106. Start processor execution of instructions (at current IP)
  107. GSS
  108. Start processor execution using automatic single stepping - this allows running a program with breakpoints
  109. HALT
  110. Halt the processor
  111. L memory_location_iwa file_name
  112. Load program file into instruction memory at 32-bit word address provided (offset from beginning of instruction memory
  113. PRU pru_number
  114. Set the active PRU where pru_number ranges from 0 to 1
  115. Some debugger commands do action on active PRU (such as halt and reset)
  116. Q
  117. Quit the debugger and return to shell prompt.
  118. R
  119. Display the current PRU registers.
  120. RESET
  121. Reset the current PRU
  122. SS
  123. Single step the current instruction.
  124. WA [watch_num [address [value]]]
  125. Clear or set a watch point
  126. format 1: wa - print watch point list
  127. format 2: wa watch_num - clear watch point watch_num
  128. format 3: wa watch_num address - set a watch point (watch_num) so any change at that word address
  129. in data memory will be printed during program execution with gss command
  130. format 4: wa watch_num address value - set a watch point (watch_num) so that the program (run with gss) will
  131. be halted when the memory location equals the value
  132. NOTE: for watchpoints to work, you must use gss command to run the program
  133. WR memory_location_wa value1 [value2 [value3 ...]]
  134. Write a 32-bit value to a raw (offset from beginning of full PRU memory block - all PRUs)
  135. memory_location is a 32-bit word index from the beginning of the PRU subsystem memory block
  136. WRD memory_location_wa value1 [value2 [value3 ...]]
  137. Write a 32-bit value to PRU data memory (32-bit word offset from beginning of PRU data memory)
  138. WRI memory_location_wa value1 [value2 [value3 ...]]
  139. Write a 32-bit value to PRU instruction memory (32-bit word offset from beginning of PRU instruction memory)
  140. A brief version of help is available with the command hb