Line 40... |
Line 40... |
#include <pthread.h>
|
#include <pthread.h>
|
|
|
/* Package includes */
|
/* Package includes */
|
#include "except.h"
|
#include "except.h"
|
#include "spr-defs.h"
|
#include "spr-defs.h"
|
#include "chain_commands.h"
|
#include "dbg_api.h"
|
#include "errcodes.h"
|
#include "errcodes.h"
|
|
|
/* Define to log each packet */
|
/* Define to log each packet */
|
#define RSP_TRACE 0
|
#define RSP_TRACE 0
|
|
|
Line 513... |
Line 513... |
rsp_client_request ();
|
rsp_client_request ();
|
}
|
}
|
else if(POLLIN == (fds[1].revents & POLLIN))
|
else if(POLLIN == (fds[1].revents & POLLIN))
|
{
|
{
|
//fprintf(stderr, "Got pipe event from monitor thread\n");
|
//fprintf(stderr, "Got pipe event from monitor thread\n");
|
read(pipe_fds[0], &bitbucket, 1); // Clear the byte out and discard
|
bitbucket = read(pipe_fds[0], &bitbucket, 1); // Clear the byte out and discard
|
/* If we have an unacknowledged exception and a client is available, tell
|
/* If we have an unacknowledged exception and a client is available, tell
|
GDB. If this exception was a trap due to a memory breakpoint, then
|
GDB. If this exception was a trap due to a memory breakpoint, then
|
adjust the NPC. */
|
adjust the NPC. */
|
if (rsp.client_waiting)
|
if (rsp.client_waiting)
|
{
|
{
|
Line 731... |
Line 731... |
// Send the STALL command to the target
|
// Send the STALL command to the target
|
set_stall_state (1);
|
set_stall_state (1);
|
}
|
}
|
else
|
else
|
{
|
{
|
// *** TODO Send a response to GDB indicating the target is not stalled?
|
// Send a response to GDB indicating the target is not stalled: "Target not stopped"
|
//put_str_packet("O"); // Need to hex-encode warning string
|
put_str_packet("O6154677274656e20746f73206f74707064650a0d"); // Need to hex-encode warning string (I think...)
|
fprintf(stderr, "WARNING: Received GDB command 0x%X (%c) while target running!\n", buf->data[0], buf->data[0]);
|
fprintf(stderr, "WARNING: Received GDB command 0x%X (%c) while target running!\n", buf->data[0], buf->data[0]);
|
}
|
}
|
|
return;
|
}
|
}
|
|
|
switch (buf->data[0])
|
switch (buf->data[0])
|
{
|
{
|
case 0x03:
|
case 0x03:
|
Line 2640... |
Line 2641... |
"supplied. %d will be written\n", len, newlen, minlen);
|
"supplied. %d will be written\n", len, newlen, minlen);
|
len = minlen;
|
len = minlen;
|
}
|
}
|
|
|
/* Write the bytes to memory */
|
/* Write the bytes to memory */
|
errcode = dbg_wb_write_block8(addr, bindat, len);
|
errcode = dbg_wb_write_block8(addr, (uint8_t *) bindat, len);
|
|
|
// We can't really verify if the memory target address exists or not.
|
// We can't really verify if the memory target address exists or not.
|
// Don't write to non-existant memory unless your system wishbone implementation
|
// Don't write to non-existant memory unless your system wishbone implementation
|
// has a hardware bus timeout.
|
// has a hardware bus timeout.
|
if(errcode == APP_ERR_NONE) {
|
if(errcode == APP_ERR_NONE) {
|