1 / 19

ECT 358

ECT 358. Lecture 30 MicroBlaze EDK Debugging. Forget yourself for others and others will not forget you!. Therefore all things whatsoever ye would that men should do to you, do ye even so to them: for this is the law and the prophets. Matthew 7:12. MicroBlaze Debugging.

penney
Télécharger la présentation

ECT 358

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECT 358 Lecture 30 MicroBlaze EDK Debugging

  2. Forget yourself for others and others will not forget you! Therefore all things whatsoever ye would that men should do to you, do ye even so to them: for this is the law and the prophets. Matthew 7:12

  3. MicroBlaze Debugging A significant percentage of the design cycle of complex processor systems is spent in debugging and verification. This includes debugging of software running on processors and verification of on-chip bus transactions and hardware logic.

  4. MicroBlaze Debugging MicroBlaze is a soft processor implemented using FPGA logic and is configurable according to your requirements. One of the configurable options is the debug mode. You can use the hardware debug logic in MicroBlaze for better control over the processor resources and advanced debug features. Alternatively, you can debug programs using XMDStub (a ROM monitor) over a UART (JTAG-based or RS232-based) and trade-off control and features for debug logic area.

  5. Hardware Debugging Microprocessor Debug Module (MDM) is the core that facilitates the use of JTAG for debugging one or more MicroBlaze processors. The MDM core instantiates the FPGA primitive named BSCAN_VIRTEX[2] to connect the FPGA’s JTAG port to the MicroBlaze debug ports. Only a single MDM core can be instantiated in a system and that core can in turn connect to multiple MicroBlaze processors. When you use the BSB to create a MicroBlaze system, the MicroBlaze-MDM connection is automatically setup when you select Use On-chip Debug Logic as the debug option.

  6. MHS Snippet Changes BEGIN microblaze PARAMETER INSTANCE = microblaze_0 PARAMETER HW_VER = 4.00.a PARAMETER C_DEBUG_ENABLED = 1 PARAMETER C_NUMBER_OF_PC_BRK = 2 PARAMETER C_NUMBER_OF_RD_ADDR_BRK = 1 PARAMETER C_NUMBER_OF_WR_ADDR_BRK = 1 BUS_INTERFACE DOPB = mb_opb BUS_INTERFACE IOPB = mb_opb BUS_INTERFACE DLMB = dlmb BUS_INTERFACE ILMB = ilmb PORT CLK = sys_clk_s PORT DBG_CAPTURE = DBG_CAPTURE_s PORT DBG_CLK = DBG_CLK_s PORT DBG_REG_EN = DBG_REG_EN_s PORT DBG_TDI = DBG_TDI_s PORT DBG_TDO = DBG_TDO_s PORT DBG_UPDATE = DBG_UPDATE_s END

  7. MHS Snippet Changes BEGIN opb_mdm PARAMETER INSTANCE = debug_module PARAMETER HW_VER = 2.00.a PARAMETER C_MB_DBG_PORTS = 1 PARAMETER C_USE_UART = 1 PARAMETER C_UART_WIDTH = 8 PARAMETER C_BASEADDR = 0x80002000 PARAMETER C_HIGHADDR = 0x800020ff BUS_INTERFACE SOPB = mb_opb PORT OPB_Clk = sys_clk_s PORT DBG_CAPTURE_0 = DBG_CAPTURE_s PORT DBG_CLK_0 = DBG_CLK_s PORT DBG_REG_EN_0 = DBG_REG_EN_s PORT DBG_TDI_0 = DBG_TDI_s PORT DBG_TDO_0 = DBG_TDO_s PORT DBG_UPDATE_0 = DBG_UPDATE_s END

  8. Software Setup Once the FPGA is configured with a bitstream containing the previous debug setup, you can use XMD to connect to the MicroBlaze processor and debug programs using GDB. 1. Specify XMD Debug Options a. In XPS, select Options ->XMD -> Debug Options. b. Select Hardware as the connection type. 2. Start XMD and connect to the MicroBlaze processor (via MDM). 3. In XPS, select Tools ->XMD. This launches XMD with the xmd -xmp <system.xmp> -opt etc/xmd_microblaze_0.opt option. Now XMD is connected to the MicroBlaze processor and has started a GDB server port 1234 for source-level debugging using the GDB console. 4. Start the STDIN/OUT terminal in XMD. In the XMD shell, type terminal. This opens a terminal shell. 5. Start the GDB (mb-gdb) console. In XPS, select Tools Software Debugger or type mb-gdb. 6. Connect GDB to XMD’s GDB server TCP port 1234 and debug the program locally (hostname=localhost) or remotely (hostname = IP addr).

  9. ROM Debugging MicroBlaze programs can also be debugged using a ROM monitor program called XMDStub. In this case, the hardware debug logic in MicroBlaze need not be enabled - parameter C_DEBUG_ENABLED can be set to “0” or false. Also, the C_MB_DBG_PORTS parameter on the MDM core can be set to “0” to reduce logic usage.

  10. MHS Snippet Changes BEGIN microblaze PARAMETER INSTANCE = microblaze_0 PARAMETER HW_VER = 3.00.a PARAMETER C_DEBUG_ENABLED = 0 BUS_INTERFACE DOPB = mb_opb BUS_INTERFACE IOPB = mb_opb BUS_INTERFACE DLMB = dlmb BUS_INTERFACE ILMB = ilmb PORT CLK = sys_clk_s END

  11. MHS Snippet Changes BEGIN opb_mdm PARAMETER INSTANCE = debug_module PARAMETER HW_VER = 2.00.a PARAMETER C_MB_DBG_PORTS = 0 PARAMETER C_USE_UART = 1 PARAMETER C_UART_WIDTH = 8 PARAMETER C_BASEADDR = 0x80002000 PARAMETER C_HIGHADDR = 0x800020ff BUS_INTERFACE SOPB = mb_opb PORT OPB_Clk = sys_clk_s END

  12. MSS Snippet Changes BEGIN PROCESSOR PARAMETER DRIVER_NAME = cpu PARAMETER DRIVER_VER = 1.00.a PARAMETER HW_INSTANCE = microblaze_0 PARAMETER COMPILER = mb-gcc PARAMETER ARCHIVER = mb-ar PARAMETER XMDSTUB_PERIPHERAL = debug_module END

  13. Connecting For XMDStub-based debugging, you must connect to the MicroBlaze processor from XMD using the connect mb stub -comm jtag command. Connecting GDB to XMD is similar to the hardware-based debugging

  14. Serial Debugging In the absence of a JTAG connection to the FPGA containing the MicroBlaze system, you can also use a standard serial cable to debug programs on MicroBlaze. In this case, you must instantiate the UARTlite peripheral (opb_uartlite) in the EDK design and connect it to the OPB bus. As described above in the Software settings MSS file, the UARTlite peripheral must be chosen as the xmdstub_peripheral. In XMD, use the connect stub - comm serial command.

  15. Multi-Processor Debugging XMD enables debugging multiple heterogeneous processors in a system. You can use an XMD terminal to connect to multiple processors or use a separate XMD terminal for each processor. Use GDB for debugging program on processor. In order to debug multiple MicroBlaze processors using a single JTAG cable, use MDM. All of the MicroBlaze processors should be connected to MDM.

  16. MHS Snippet Changes BEGIN microblaze PARAMETER INSTANCE = microblaze_0 PARAMETER HW_VER = 4.00.a PARAMETER C_DEBUG_ENABLED = 1 PARAMETER C_NUMBER_OF_PC_BRK = 2 PARAMETER C_NUMBER_OF_RD_ADDR_BRK = 1 PARAMETER C_NUMBER_OF_WR_ADDR_BRK = 1 BUS_INTERFACE DOPB = mb_opb BUS_INTERFACE IOPB = mb_opb BUS_INTERFACE DLMB = dlmb BUS_INTERFACE ILMB = ilmb PORT CLK = sys_clk_s PORT DBG_CAPTURE = DBG_CAPTURE_s_0 PORT DBG_CLK = DBG_CLK_s_0 PORT DBG_REG_EN = DBG_REG_EN_s_0 PORT DBG_TDI = DBG_TDI_s_0 PORT DBG_TDO = DBG_TDO_s_0 PORT DBG_UPDATE = DBG_UPDATE_s_0 END

  17. MHS Snippet Changes BEGIN opb_mdm PARAMETER INSTANCE = debug_module PARAMETER HW_VER = 2.00.a PARAMETER C_MB_DBG_PORTS = 2 PARAMETER C_USE_UART = 1 PARAMETER C_UART_WIDTH = 8 PARAMETER C_BASEADDR = 0x80002000 PARAMETER C_HIGHADDR = 0x800020ff BUS_INTERFACE SOPB = mb_opb PORT OPB_Clk = sys_clk_s PORT DBG_CAPTURE_0 = DBG_CAPTURE_s_0 PORT DBG_CLK_0 = DBG_CLK_s_0 PORT DBG_REG_EN_0 = DBG_REG_EN_s_0 PORT DBG_TDI_0 = DBG_TDI_s_0 PORT DBG_TDO_0 = DBG_TDO_s_0 PORT DBG_UPDATE_0 = DBG_UPDATE_s_0 PORT DBG_CAPTURE_1 = DBG_CAPTURE_s_1 PORT DBG_CLK_1 = DBG_CLK_s_1 PORT DBG_REG_EN_1 = DBG_REG_EN_s_1 PORT DBG_TDI_1 = DBG_TDI_s_1 PORT DBG_TDO_1 = DBG_TDO_s_1 PORT DBG_UPDATE_1 = DBG_UPDATE_s_1 END

  18. MHS Snippet Changes BEGIN microblaze PARAMETER INSTANCE = microblaze_1 PARAMETER HW_VER = 4.00.a PARAMETER C_DEBUG_ENABLED = 1 PARAMETER C_NUMBER_OF_PC_BRK = 2 PARAMETER C_NUMBER_OF_RD_ADDR_BRK = 1 PARAMETER C_NUMBER_OF_WR_ADDR_BRK = 1 BUS_INTERFACE DOPB = mb_opb BUS_INTERFACE IOPB = mb_opb BUS_INTERFACE DLMB = dlmb BUS_INTERFACE ILMB = ilmb PORT CLK = sys_clk_s PORT DBG_CAPTURE = DBG_CAPTURE_s_1 PORT DBG_CLK = DBG_CLK_s_1 PORT DBG_REG_EN = DBG_REG_EN_s_1 PORT DBG_TDI = DBG_TDI_s_1 PORT DBG_TDO = DBG_TDO_s_1 PORT DBG_UPDATE = DBG_UPDATE_s_1

  19. Software Setup While debugging a multi-processor system, you can connect to a specific processor from XMD/GDB by providing options to the connect command in the XMD console. The option to specify a particular processor from the XMD console is -debugdevice cpunr <processor number>. The exact value for the processor number depends on the order in which the MicroBlaze processors are connected to MDM. For each processor connection, XMD opens a GDB server at different TCP port numbers such as 1234 and 1235. From GDB, connect to the appropriate processor using the different TCP ports.

More Related