rtos : smp support

Change-Id: I583cddf5e62ed77f108786a085569ab8699ad50d
Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com>
Reviewed-on: http://openocd.zylin.com/344
Tested-by: jenkins
Reviewed-by: Evan Hunter <evan@ozhiker.com>
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
This commit is contained in:
Michel JAOUEN 2012-01-03 16:12:50 +01:00 committed by Øyvind Harboe
parent ff3028ce1b
commit ebac7c963a
4 changed files with 36 additions and 17 deletions

View File

@ -49,6 +49,13 @@ static struct rtos_type *rtos_types[] =
int rtos_thread_packet(struct connection *connection, char *packet, int packet_size); int rtos_thread_packet(struct connection *connection, char *packet, int packet_size);
int rtos_smp_init(struct target *target)
{
if (target->rtos->type->smp_init)
return target->rtos->type->smp_init(target);
return ERROR_TARGET_INIT_FAILED;
}
int rtos_create(Jim_GetOptInfo *goi, struct target * target) int rtos_create(Jim_GetOptInfo *goi, struct target * target)
{ {
@ -440,7 +447,8 @@ int rtos_get_gdb_reg_list(struct connection *connection)
if ((target->rtos != NULL) && if ((target->rtos != NULL) &&
(current_threadid != -1) && (current_threadid != -1) &&
(current_threadid != 0) && (current_threadid != 0) &&
( current_threadid != target->rtos->current_thread ) ) ((current_threadid != target->rtos->current_thread) ||
(target->smp))) /* in smp several current thread are possible */
{ {
char * hex_reg_list; char * hex_reg_list;
target->rtos->type->get_thread_reg_list( target->rtos, current_threadid, &hex_reg_list ); target->rtos->type->get_thread_reg_list( target->rtos, current_threadid, &hex_reg_list );

View File

@ -75,9 +75,11 @@ struct rtos_type
char * name; char * name;
int (*detect_rtos) ( struct target* target ); int (*detect_rtos) ( struct target* target );
int (*create) ( struct target* target ); int (*create) ( struct target* target );
int (*smp_init)(struct target *target);
int (*update_threads) ( struct rtos* rtos ); int (*update_threads) ( struct rtos* rtos );
int (*get_thread_reg_list) ( struct rtos *rtos, int64_t thread_id, char ** hex_reg_list ); int (*get_thread_reg_list) ( struct rtos *rtos, int64_t thread_id, char ** hex_reg_list );
int (*get_symbol_list_to_lookup) (symbol_table_elem_t * symbol_list[] ); int (*get_symbol_list_to_lookup) (symbol_table_elem_t * symbol_list[] );
int (*clean)(struct target *target);
}; };
@ -105,5 +107,6 @@ int rtos_try_next( struct target * target );
int gdb_thread_packet(struct connection *connection, char *packet, int packet_size); int gdb_thread_packet(struct connection *connection, char *packet, int packet_size);
int rtos_get_gdb_reg_list(struct connection *connection); int rtos_get_gdb_reg_list(struct connection *connection);
int rtos_update_threads( struct target *target ); int rtos_update_threads( struct target *target );
int rtos_smp_init(struct target *target);
#endif // RTOS_H #endif // RTOS_H

View File

@ -836,6 +836,11 @@ static int gdb_new_connection(struct connection *connection)
breakpoint_clear_target(gdb_service->target); breakpoint_clear_target(gdb_service->target);
watchpoint_clear_target(gdb_service->target); watchpoint_clear_target(gdb_service->target);
/* clean previous rtos session if supported*/
if ((gdb_service->target->rtos) &&
(gdb_service->target->rtos->type->clean))
gdb_service->target->rtos->type->clean(gdb_service->target);
/* remove the initial ACK from the incoming buffer */ /* remove the initial ACK from the incoming buffer */
if ((retval = gdb_get_char(connection, &initial_ack)) != ERROR_OK) if ((retval = gdb_get_char(connection, &initial_ack)) != ERROR_OK)
return retval; return retval;
@ -2256,6 +2261,7 @@ static int gdb_input_inner(struct connection *connection)
case 'c': case 'c':
case 's': case 's':
{ {
gdb_thread_packet(connection, packet, packet_size);
log_add_callback(gdb_log_callback, connection); log_add_callback(gdb_log_callback, connection);
if (gdb_con->mem_write_error) if (gdb_con->mem_write_error)

View File

@ -5119,10 +5119,11 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
int i; int i;
const char *targetname; const char *targetname;
int retval,len; int retval,len;
struct target *target; struct target *target = (struct target *) NULL;
struct target_list *head, *curr; struct target_list *head, *curr, *new;
curr = (struct target_list *) NULL; curr = (struct target_list *) NULL;
head = (struct target_list *) NULL; head = (struct target_list *) NULL;
new = (struct target_list *) NULL;
retval = 0; retval = 0;
LOG_DEBUG("%d",argc); LOG_DEBUG("%d",argc);
@ -5139,7 +5140,6 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
LOG_DEBUG("%s ",targetname); LOG_DEBUG("%s ",targetname);
if (target) if (target)
{ {
struct target_list *new;
new=malloc(sizeof(struct target_list)); new=malloc(sizeof(struct target_list));
new->target = target; new->target = target;
new->next = (struct target_list*)NULL; new->next = (struct target_list*)NULL;
@ -5165,6 +5165,8 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
target->head = head; target->head = head;
curr = curr->next; curr = curr->next;
} }
if (target->rtos)
retval = rtos_smp_init(head->target);
return retval; return retval;
} }