- add support for new gdb QStartNoAckMode, which disables sending of ack's between remote packets

git-svn-id: svn://svn.berlios.de/openocd/trunk@959 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
ntfreak 2008-08-22 19:58:19 +00:00
parent 8abe4c57fa
commit 9f6857ae0b
2 changed files with 31 additions and 8 deletions

View File

@ -2,7 +2,7 @@
* Copyright (C) 2005 by Dominic Rath * * Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de * * Dominic.Rath@gmx.de *
* * * *
* Copyright (C) 2007,2008 Øyvind Harboe * * Copyright (C) 2007,2008 Øyvind Harboe *
* oyvind.harboe@zylin.com * * oyvind.harboe@zylin.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -339,6 +339,9 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
gdb_write(connection, local_buffer+1, 3); gdb_write(connection, local_buffer+1, 3);
} }
if (gdb_con->noack_mode)
break;
if ((retval = gdb_get_char(connection, &reply)) != ERROR_OK) if ((retval = gdb_get_char(connection, &reply)) != ERROR_OK)
return retval; return retval;
@ -477,7 +480,8 @@ int gdb_get_packet_inner(connection_t *connection, char *buffer, int *len)
i++; i++;
my_checksum += character & 0xff; my_checksum += character & 0xff;
buffer[count++] = (character ^ 0x20) & 0xff; buffer[count++] = (character ^ 0x20) & 0xff;
} else }
else
{ {
my_checksum += character & 0xff; my_checksum += character & 0xff;
buffer[count++] = character & 0xff; buffer[count++] = character & 0xff;
@ -515,7 +519,6 @@ int gdb_get_packet_inner(connection_t *connection, char *buffer, int *len)
my_checksum += character & 0xff; my_checksum += character & 0xff;
buffer[count++] = character & 0xff; buffer[count++] = character & 0xff;
} }
} }
*len = count; *len = count;
@ -530,12 +533,22 @@ int gdb_get_packet_inner(connection_t *connection, char *buffer, int *len)
if (my_checksum == strtoul(checksum, NULL, 16)) if (my_checksum == strtoul(checksum, NULL, 16))
{ {
if (gdb_con->noack_mode)
break;
gdb_write(connection, "+", 1); gdb_write(connection, "+", 1);
break; break;
} }
LOG_WARNING("checksum error, requesting retransmission"); if (!gdb_con->noack_mode)
gdb_write(connection, "-", 1); {
LOG_WARNING("checksum error, requesting retransmission");
gdb_write(connection, "-", 1);
}
else
{
LOG_WARNING("checksum error, no-ack-mode");
break;
}
} }
if (gdb_con->closed) if (gdb_con->closed)
return ERROR_SERVER_REMOTE_CLOSED; return ERROR_SERVER_REMOTE_CLOSED;
@ -664,6 +677,7 @@ int gdb_new_connection(connection_t *connection)
gdb_connection->vflash_image = NULL; gdb_connection->vflash_image = NULL;
gdb_connection->closed = 0; gdb_connection->closed = 0;
gdb_connection->busy = 0; gdb_connection->busy = 0;
gdb_connection->noack_mode = 0;
/* send ACK to GDB for debug request */ /* send ACK to GDB for debug request */
gdb_write(connection, "+", 1); gdb_write(connection, "+", 1);
@ -1459,6 +1473,7 @@ static int compare_bank (const void * a, const void * b)
int gdb_query_packet(connection_t *connection, target_t *target, char *packet, int packet_size) int gdb_query_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{ {
command_context_t *cmd_ctx = connection->cmd_ctx; command_context_t *cmd_ctx = connection->cmd_ctx;
gdb_connection_t *gdb_connection = connection->priv;
if (strstr(packet, "qRcmd,")) if (strstr(packet, "qRcmd,"))
{ {
@ -1536,7 +1551,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
int size = 0; int size = 0;
xml_printf(&retval, &buffer, &pos, &size, xml_printf(&retval, &buffer, &pos, &size,
"PacketSize=%x;qXfer:memory-map:read%c;qXfer:features:read-", "PacketSize=%x;qXfer:memory-map:read%c;qXfer:features:read-;QStartNoAckMode+",
(GDB_BUFFER_SIZE - 1), ((gdb_use_memory_map == 1)&&(flash_get_bank_count()>0)) ? '+' : '-'); (GDB_BUFFER_SIZE - 1), ((gdb_use_memory_map == 1)&&(flash_get_bank_count()>0)) ? '+' : '-');
if (retval != ERROR_OK) if (retval != ERROR_OK)
@ -1696,6 +1711,12 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
free(xml); free(xml);
return ERROR_OK; return ERROR_OK;
} }
else if (strstr(packet, "QStartNoAckMode"))
{
gdb_connection->noack_mode = 1;
gdb_put_packet(connection, "OK", 2);
return ERROR_OK;
}
gdb_put_packet(connection, "", 0); gdb_put_packet(connection, "", 0);
return ERROR_OK; return ERROR_OK;
@ -1917,6 +1938,7 @@ int gdb_input_inner(connection_t *connection)
gdb_put_packet(connection, NULL, 0); gdb_put_packet(connection, NULL, 0);
break; break;
case 'q': case 'q':
case 'Q':
retval = gdb_query_packet(connection, target, packet, packet_size); retval = gdb_query_packet(connection, target, packet, packet_size);
break; break;
case 'g': case 'g':

View File

@ -39,6 +39,7 @@ typedef struct gdb_connection_s
image_t *vflash_image; image_t *vflash_image;
int closed; int closed;
int busy; int busy;
int noack_mode;
} gdb_connection_t; } gdb_connection_t;
typedef struct gdb_service_s typedef struct gdb_service_s