Line 125... |
Line 125... |
|
|
// Parse through the input, check what we've been given
|
// Parse through the input, check what we've been given
|
|
|
while ( argv[inp_arg] != NULL )
|
while ( argv[inp_arg] != NULL )
|
{
|
{
|
if(strcmp(argv[inp_arg], "-j") == 0)
|
if(strcmp(argv[inp_arg], "-r") == 0)
|
{
|
|
gdb_protocol = GDB_PROTOCOL_JTAG;
|
|
endpoint_target = ENDPOINT_TARGET_USB;
|
|
}
|
|
else if(strcmp(argv[inp_arg], "-r") == 0)
|
|
{
|
{
|
gdb_protocol = GDB_PROTOCOL_RSP;
|
gdb_protocol = GDB_PROTOCOL_RSP;
|
endpoint_target = ENDPOINT_TARGET_USB;
|
endpoint_target = ENDPOINT_TARGET_USB;
|
}
|
}
|
else if(strcmp(argv[inp_arg], "-v") == 0)
|
else if(strcmp(argv[inp_arg], "-v") == 0)
|
Line 191... |
Line 186... |
vpi_dbg_test(); // Perform some tests
|
vpi_dbg_test(); // Perform some tests
|
}
|
}
|
#endif
|
#endif
|
|
|
/* We have a connection to the target system. Now establish server connection. */
|
/* We have a connection to the target system. Now establish server connection. */
|
if(gdb_protocol == GDB_PROTOCOL_JTAG)
|
if(gdb_protocol == GDB_PROTOCOL_RSP)
|
{ // Connect to JTAG server
|
|
if((server_fd = GetServerSocket("or1ksim","tcp", serverPort))) {
|
|
// printf("JTAG Proxy server started on port %d\n", serverPort);
|
|
printf("Remote JTAG proxy server started on port %d\n", serverPort);
|
|
printf("Note: The OpenRISC remote JTAG protocol is now DEPRECATED. Please use GDB version 6.8 or later.\n");
|
|
printf("Press CTRL+c to exit.\n");
|
|
} else {
|
|
// fprintf(stderr,"Cannot start JTAG Proxy server on port %d\n", serverPort);
|
|
fprintf(stderr,"Cannot start Proxy server on port %d\n", serverPort);
|
|
exit(-1);
|
|
}
|
|
|
|
/* Do endless loop of checking and handle GDB requests. Ctrl-c exits. */
|
|
// HandleServerSocket(true);
|
|
HandleServerSocket();
|
|
return 0;
|
|
}
|
|
else if(gdb_protocol == GDB_PROTOCOL_RSP)
|
|
{ // Connect to RSP server
|
{ // Connect to RSP server
|
/* RSP always starts stalled as though we have just reset the processor. */
|
/* RSP always starts stalled as though we have just reset the processor. */
|
// rsp_exception (EXCEPT_TRAP);
|
// rsp_exception (EXCEPT_TRAP);
|
handle_rsp ();
|
handle_rsp ();
|
// if((server_fd = GetServerSocket("or1ksim","tcp", serverPort))) {
|
// if((server_fd = GetServerSocket("or1ksim","tcp", serverPort))) {
|
Line 319... |
Line 296... |
if (endpoint_target == ENDPOINT_TARGET_VPI) return vpi_dbg_wb_read32(adr, data);
|
if (endpoint_target == ENDPOINT_TARGET_VPI) return vpi_dbg_wb_read32(adr, data);
|
#endif
|
#endif
|
return DBG_ERR_INVALID_ENDPOINT;
|
return DBG_ERR_INVALID_ENDPOINT;
|
}
|
}
|
|
|
|
/* write a word to wishbone */
|
|
int dbg_wb_write8(uint32_t adr, uint8_t data) {
|
|
#ifdef USB_ENDPOINT_ENABLED
|
|
if (endpoint_target == ENDPOINT_TARGET_USB) return usb_dbg_wb_write8( adr, data);
|
|
#endif
|
|
return DBG_ERR_INVALID_ENDPOINT;
|
|
}
|
|
|
/* write a word to wishbone */
|
/* write a word to wishbone */
|
int dbg_wb_write32(uint32_t adr, uint32_t data) {
|
int dbg_wb_write32(uint32_t adr, uint32_t data) {
|
#ifdef USB_ENDPOINT_ENABLED
|
#ifdef USB_ENDPOINT_ENABLED
|
if (endpoint_target == ENDPOINT_TARGET_USB) return usb_dbg_wb_write32( adr, data);
|
if (endpoint_target == ENDPOINT_TARGET_USB) return usb_dbg_wb_write32( adr, data);
|