URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/or_debug_proxy
- from Rev 47 to Rev 79
- ↔ Reverse comparison
Rev 47 → Rev 79
/includes/or_debug_proxy.h
61,7 → 61,7
|
// This one is defined sometimes in the makefile, so check first |
#ifndef DEBUG_GDB |
#define DEBUG_GDB 0 // GDB RSP Debugging output enabled |
#define DEBUG_GDB 0 // GDB RSP Debugging output enabled |
#endif |
|
#ifndef DEBUG_GDB_DUMP_DATA |
/src/usb_functions.c
54,6 → 54,7
// Date Version Description |
//------------------------------------------------------------------------ |
// 081101 First revision jb |
// 100408 Fixed up retries jb |
|
#include <assert.h> |
#include <stdio.h> |
89,6 → 90,9
/* Crc of current read or written data. */ |
uint32_t crc_r, crc_w = 0; |
|
/* Number of retries for a command */ |
uint32_t retries; |
|
/* Generates new crc, sending in new bit input_bit */ |
uint32_t crc_calc(uint32_t crc, uint32_t input_bit) { |
uint32_t d = (input_bit) ? 0xfffffff : 0x0000000; |
519,7 → 523,7
FTC_STATUS Status = FTC_SUCCESS; |
WriteDataByteBuffer WriteDataBuffer; |
ReadDataByteBuffer ReadDataBuffer; |
|
retries = 0; |
try_again: |
usb_dbg_set_chain(dbg_chain); |
if (DEBUG_CMDS) printf("\n"); |
612,16 → 616,16
|
//printf("%x %x %x\n", status, crc_read, crc_generated); |
/* CRCs must match, otherwise retry */ |
uint32_t tries = 0; |
//uint32_t tries = 0; |
if (crc_read != crc_generated) { |
tries++; |
if (tries < 2) |
retries++; |
if (retries < 2) |
{ |
if (DEBUG_USB_DRVR_FUNCS) |
printf("usb_functions - usb_dbg_command - CRC fail. Going again\n"); |
goto try_again; |
} |
else if (tries < 8) |
else if (retries < 8) |
{ |
reset_tap(); |
goto try_again; |
629,15 → 633,14
else return DBG_ERR_CRC; |
} |
/* we should read expected status value, otherwise retry */ |
tries = 0; |
if (status != 0) { |
if (tries < 2) |
if (retries < 2) |
{ |
if (DEBUG_USB_DRVR_FUNCS) |
printf("usb_functions - usb_dbg_command - bad status (%d). Going again\n",status); |
goto try_again; |
} |
else if (tries < 8) |
else if (retries < 8) |
{ |
reset_tap(); |
goto try_again; |
659,7 → 662,7
FTC_STATUS Status = FTC_SUCCESS; |
WriteDataByteBuffer WriteDataBuffer; |
ReadDataByteBuffer ReadDataBuffer; |
|
retries = 0; |
try_again: |
usb_dbg_set_chain(dbg_chain); |
if (DEBUG_CMDS) printf("\n"); |
739,16 → 742,15
|
/* CRCs must match, otherwise retry */ |
//printf("%x %x %x\n", status, crc_read, crc_generated); |
uint32_t tries = 0; |
if (crc_read != crc_generated) { |
tries++; |
if (tries < 2) |
retries++; |
if (retries < 2) |
{ |
if (DEBUG_USB_DRVR_FUNCS) |
printf("usb_functions - usb_dbg_ctrl - CRC fail. Going again\n"); |
goto try_again; |
} |
else if (tries < 8) |
else if (retries < 8) |
{ |
reset_tap(); |
goto try_again; |
756,15 → 758,15
else return DBG_ERR_CRC; |
} |
/* we should read expected status value, otherwise retry */ |
tries = 0; |
retries = 0; |
if (status != 0) { |
if (tries < 2) |
if (retries < 2) |
{ |
if (DEBUG_USB_DRVR_FUNCS) |
printf("usb_functions - usb_dbg_ctrl - bad status (%d). Going again\n",status); |
goto try_again; |
} |
else if (tries < 8) |
else if (retries < 8) |
{ |
reset_tap(); |
goto try_again; |
787,8 → 789,8
FTC_STATUS Status = FTC_SUCCESS; |
WriteDataByteBuffer WriteDataBuffer; |
ReadDataByteBuffer ReadDataBuffer; |
|
|
retries = 0; |
|
try_again: |
usb_dbg_set_chain(dbg_chain); |
if (DEBUG_CMDS) printf("\n"); |
877,32 → 879,31
|
/* CRCs must match, otherwise retry */ |
//printf("%x %x %x\n", status, crc_generated, crc_read); |
uint32_t tries = 0; |
if (crc_read != crc_generated) { |
tries++; |
if (tries < 2) |
retries++; |
if (retries < 2) |
{ |
if (DEBUG_USB_DRVR_FUNCS) |
printf("usb_functions - usb_dbg_ctrl_read - CRC fail. Going again\n"); |
goto try_again; |
} |
else if (tries < 8) |
else if (retries < 8) |
{ |
reset_tap(); |
goto try_again; |
} |
else return DBG_ERR_CRC; |
} |
} |
/* we should read expected status value, otherwise retry */ |
tries = 0; |
retries = 0; |
if (status != 0) { |
if (tries < 2) |
if (retries < 2) |
{ |
if (DEBUG_USB_DRVR_FUNCS) |
printf("usb_functions - usb_dbg_ctrl_read - bad status (%d). Going again\n",status); |
goto try_again; |
} |
else if (tries < 8) |
else if (retries < 8) |
{ |
reset_tap(); |
goto try_again; |
921,9 → 922,8
int usb_dbg_go(unsigned char *data, uint16_t len, uint32_t read) { |
uint32_t status, crc_generated, crc_read; |
int i,j; |
int tries = 0; |
uint8_t data_byte; |
|
retries = 0; |
// JTAG driver things |
FTC_STATUS Status = FTC_SUCCESS; |
WriteDataByteBuffer WriteDataBuffer; |
1077,10 → 1077,10
//printf("%x %x %x\n", status, crc_read, crc_generated); |
|
if (crc_read != crc_generated) { |
tries++; |
if (tries < 8) |
retries++; |
if (retries < 8) |
{ |
if (DEBUG_USB_DRVR_FUNCS) printf("usb_functions - usb_dbg_go - CRC fail (%d) try %d. Going again\n",status, tries); |
if (DEBUG_USB_DRVR_FUNCS) printf("usb_functions - usb_dbg_go - CRC fail (%d) try %d. Going again\n",status, retries); |
reset_tap() ; |
goto try_again; |
} |
1090,10 → 1090,10
//tries = 0; |
/* we should read expected status value, otherwise retry */ |
if (status != 0) { |
tries++; |
if (tries < 8) |
retries++; |
if (retries < 8) |
{ |
if (DEBUG_USB_DRVR_FUNCS) printf("usb_functions - usb_dbg_go - bad status (%d) try %d. Going again\n",status, tries); |
if (DEBUG_USB_DRVR_FUNCS) printf("usb_functions - usb_dbg_go - bad status (%d) try %d. Going again\n",status, retries); |
reset_tap(); |
goto try_again; |
|
/src/gdb.c
436,10 → 436,12
if ((TARGET_SIGNAL_TRAP == rsp.sigval) && (NULL != mp_hash_lookup (BP_MEMORY, temp_uint32))) |
{ |
if (stallState != STALLED) |
// This is a quick fix for a strange situation seen in some of the simulators where |
// the sw bp would be detected, but the stalled state variable wasn't updated correctly |
// indicating that last time it checked, it wasn't set but the processor has now hit the |
// breakpoint. So run rsp_check_for_exception() to bring everything up to date. |
// This is a quick fix for a strange situation seen in some of |
// the simulators where the sw bp would be detected, but the |
// stalled state variable wasn't updated correctly indicating |
// that last time it checked, it wasn't set but the processor |
// had hit the breakpoint. So run rsp_check_for_exception() to |
// bring everything up to date. |
rsp_check_for_exception(); |
|
if(DEBUG_GDB) printf("Software breakpoint hit at 0x%08x. Rolling back NPC to this instruction\n", temp_uint32); |
742,20 → 744,18
#else |
/* Otherwise, use the old way of doing it */ |
flags = 1; |
ioctl(fd, FIOBIO, &flags); |
ioctl(rsp.client_fd, FIOBIO, &flags); |
#endif |
|
/* Set socket to be non-blocking. |
|
|
/* Set socket to be non-blocking */ |
|
/* We do this because when we're given a continue, or step |
instruction,command we set the processor stall off, then instnatly check |
We do this because when we're given a continue, or step |
instruction,command we set the processor stall off, then instantly check |
if it's stopped. If it hasn't then we drop through and wait for input |
from GDB. Obviously this will cause problems when it will stop after we |
do the check. So now, rsp_peek() has been implemented to simply check if |
there's an incoming command from GDB (only interested in interrupt |
commands), otherwise it returns back to and poll the processor's PPC and |
do the check. So now, rsp_peek() been implemented to simply check if |
there's an incoming command from GDB (although, mainly interested in |
int. commands), otherwise it returns back to poll the processor's |
stall bit. It can only do this if the socket is non-blocking. |
|
At first test, simply adding this line appeared to give no problems with |
764,6 → 764,7
back a EWOULDBLOCK error, as was looked to be the case in the previous |
GDB handling code) -- Julius |
*/ |
|
if (ioctl(rsp.client_fd, FIONBIO, (char *)&optval) > 0 ) |
{ |
perror("ioctl() failed"); |
3672,9 → 3673,9
reset_or1k (void) |
{ |
|
err = dbg_cpu0_write_ctrl(0, 0x02); /* reset or1k */ |
//err = dbg_cpu0_write_ctrl(0, 0x02); /* reset or1k */ |
|
if(err > 0 && DEBUG_GDB)printf("Error %d in reset_or1k()\n", err); |
//if(err > 0 && DEBUG_GDB)printf("Error %d in reset_or1k()\n", err); |
|
} /* reset_or1k () */ |
|