1 |
5 |
sergeykhbr |
/** @page debug_python_page Python Frontend
|
2 |
|
|
|
3 |
|
|
@section python_prerequisites Prerequisites
|
4 |
|
|
|
5 |
|
|
Current Debugger version is integrated with Python 2.7 using TCP connection
|
6 |
|
|
and special Python module \c rcp distributed with this bundle. The following
|
7 |
|
|
requirements should be met before start using the python's debug console:
|
8 |
|
|
|
9 |
|
|
\li Debugger binary files built from the provided sources on Windows or Linux
|
10 |
|
|
machines. It is possible to use starting script \c _run_fpga_nogui_uartdbg
|
11 |
|
|
(sh|bat) to load minimal configuration into Debugger without GUI and
|
12 |
|
|
SystemC support. It enables console mode only.
|
13 |
|
|
|
14 |
|
|
\li Installed Python 2.7. To check the installed version:
|
15 |
|
|
|
16 |
|
|
>>> import sys
|
17 |
|
|
>>> sys.version
|
18 |
|
|
|
19 |
|
|
\li FPGA board with loaded image instantiated 2 UARTs modules:
|
20 |
|
|
- \c UART1 is the slave device used for the user's output.
|
21 |
|
|
- \c UART2 is the master device (with DMA) used as the Test Access
|
22 |
|
|
Point (TAP) to the system. Cannot be used for the user's output.
|
23 |
|
|
|
24 |
|
|
@section python_uarttap UART TAP
|
25 |
|
|
|
26 |
|
|
\li Build FPGA image from the provided sources (ML605 or KC705 are supported).
|
27 |
|
|
\li Run FPGA board and load the prepared bit-file.
|
28 |
|
|
|
29 |
|
|
So now your target supports 2 debug interfaces:
|
30 |
|
|
- Debug via Ethernet
|
31 |
|
|
- Debug via UART
|
32 |
|
|
|
33 |
|
|
Actually both this interfaces can be used in the same time.There's no
|
34 |
|
|
limitation on that.
|
35 |
|
|
|
36 |
|
|
Run minimal Debugger configuration with UART TAP support (and disabled
|
37 |
|
|
Ethernet). For this run one of the following starting files depending of
|
38 |
|
|
your OS:
|
39 |
|
|
|
40 |
|
|
# cd $(TOP)/river_demo/debugger/linuxbuild/bin
|
41 |
|
|
# ./_run_fpga_nogui_uartdbg.sh
|
42 |
|
|
|
43 |
|
|
or
|
44 |
|
|
|
45 |
|
|
# cd $(TOP)/river_demo/debugger/win32build/Debug
|
46 |
|
|
# _run_fpga_nogui_uartdbg.bat
|
47 |
|
|
|
48 |
|
|
Both os these scripts is doing the same thing actually. They start debugger
|
49 |
|
|
application and point to the JSON-configuration file
|
50 |
|
|
$(TOP)/river_demo/debugger/targets/fpga_nogui_uartdbg.json
|
51 |
|
|
|
52 |
|
|
Modify this JSON-file accordingly with your Serial Port settings:
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
@latexonly {\includegraphics{../doxygen/pics/uartdbg1.png}} @endlatexonly
|
56 |
|
|
|
57 |
|
|
When debugger was started you should see the following debugger console:
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
@latexonly {\includegraphics{../doxygen/pics/uartdbg2.png}} @endlatexonly
|
61 |
|
|
|
62 |
|
|
Try different console commands to test debugger:
|
63 |
|
|
|
64 |
|
|
# help
|
65 |
|
|
# help read
|
66 |
|
|
# regs
|
67 |
|
|
# status
|
68 |
|
|
# cpi
|
69 |
|
|
etc
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
@latexonly {\includegraphics{../doxygen/pics/uartdbg3.png}} @endlatexonly
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
@warning UART TAP configured with hardcoded Scale Rate computed to give
|
76 |
|
|
port speed 115200 when Bus Frequency is 40 MHz.
|
77 |
|
|
|
78 |
|
|
This simple Debug configuration also includes TCP server to interact with
|
79 |
|
|
the standalone Python scripts. Don't close Debugger console and run Python
|
80 |
|
|
as in the following part of the document.
|
81 |
|
|
|
82 |
|
|
@section python_scripting Python Scripting
|
83 |
|
|
|
84 |
|
|
Just after your Debugger was started you actually is able to control the FPGA
|
85 |
|
|
board via specially implemeted JSON-based interface using TCP transport
|
86 |
|
|
and the standalone frontend.
|
87 |
|
|
|
88 |
|
|
We provide special Python module \b rpc placed in the following folder:
|
89 |
|
|
|
90 |
|
|
# cd $(TOP)/river_demo/debugger/scripts
|
91 |
|
|
|
92 |
|
|
You should be inside of folder \c scripts to import module \rpc otherwise
|
93 |
|
|
you will need to modify sys.path variable.
|
94 |
|
|
|
95 |
|
|
Let's debug our FPGA board from python manually without running automatic
|
96 |
|
|
script. For this, run python's shell from the folder scripts:
|
97 |
|
|
|
98 |
|
|
E:\river_demo\debugger\scripts> python.exe
|
99 |
|
|
|
100 |
|
|
>>> import sys
|
101 |
|
|
>>> sys.version
|
102 |
|
|
>>> import rpc
|
103 |
|
|
>>> t = rpc.Remote()
|
104 |
|
|
>>> t.connect()
|
105 |
|
|
|
106 |
|
|
Try to call different method to debug FPGA board:
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
@latexonly {\includegraphics{../doxygen/pics/uartdbg4.png}} @endlatexonly
|
110 |
|
|
|
111 |
|
|
If you see the similar results then your debugger works properly and you can
|
112 |
|
|
try to run demonstration scripts with annotation placed in folder
|
113 |
|
|
\c scripts. Close current python shell:
|
114 |
|
|
|
115 |
|
|
>>> t.connect()
|
116 |
|
|
>>> exit()
|
117 |
|
|
|
118 |
|
|
Run automatic scripts from the OS console:
|
119 |
|
|
|
120 |
|
|
# python example.py
|
121 |
|
|
|
122 |
|
|
Congratulations! Now you are able to remotely debug your target using scripts.
|
123 |
|
|
*/
|