diff options
author | Paul Fertser <fercerpav@gmail.com> | 2014-05-15 22:17:13 +0400 |
---|---|---|
committer | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2014-06-01 17:36:41 +0000 |
commit | 9744a2fa20ad64baef19243bcc984bc5f5f8fcc3 (patch) | |
tree | cc9b2f14801d57b5afb21dcc8eab2b8e24d56d41 /src/target | |
parent | fb5e099af83a17821e6962b6e632582cb5033a66 (diff) |
src/target: select the last created target as current
Configuration commands assume the last created target is the one they
should be applied to. An example of this is sourcing an stm32f1.cfg
several times to access several microcontrollers on the same JTAG chain
where cortex_m reset_config should apply to the target that was just
created, not to the first one.
This fixes http://sourceforge.net/p/openocd/tickets/71/ .
Change-Id: I1ca41cc05fe5f36c4bc62dde4614da1405754fd8
Reported-by: Michael Eischer <mieischer@users.sf.net>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2142
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/target.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/target/target.c b/src/target/target.c index 4d277c69..87b3d1cb 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -5104,6 +5104,7 @@ static int target_create(Jim_GetOptInfo *goi) target = calloc(1, sizeof(struct target)); /* set target number */ target->target_number = new_target_number(); + cmd_ctx->current_target = target->target_number; /* allocate memory for each unique target type */ target->type = calloc(1, sizeof(struct target_type)); |