[prev in list] [next in list] [prev in thread] [next in thread]
List: openocd-development
Subject: [OpenOCD-devel] [PATCH]: 576714f fix flash bank auto_probe() fail with multiple targets
From: gerrit () openocd ! zylin ! com
Date: 2013-11-22 15:56:30
Message-ID: 20131122155630.1B894242CA () openocd ! zylin ! com
[Download RAW message or body]
This is an automated email from Gerrit.
Sergey A. Borshch (sb-sf@users.sourceforge.net) just uploaded a new patch set to \
Gerrit, which you can find at http://openocd.zylin.com/1813
-- gerrit
commit 576714fa68f42a1512062ce55e22c5e90c2dc239
Author: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Date: Fri Nov 22 17:27:40 2013 +0200
fix flash bank auto_probe() fail with multiple targets
get_flash_bank_by_addr() iterates through all flash banks
trying to auto_probe() every bank, even if bank can belongs to
target other than requested, and this other target can be
in non-halted state, which leads to error message and
operation abort.
Same situation in gdb_new_connection() and gdb_memory_map():
get_flash_bank_by_num() tries to auto_probe() requested bank,
so first get bank by get_flash_bank_by_num_noprobe(), check
if it belongs to current connection's target and skip
get_flash_bank_by_num() (actually autoprobing) if not.
Change-Id: I48b3f93dddcd9283394f14ad2de3248397c75ab3
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c
index cc2ecac..4410d5c 100644
--- a/src/flash/nor/core.c
+++ b/src/flash/nor/core.c
@@ -232,6 +232,9 @@ int get_flash_bank_by_addr(struct target *target,
/* cycle through bank list */
for (c = flash_banks; c; c = c->next) {
+ if (c->target != target)
+ continue;
+
int retval;
retval = c->driver->auto_probe(c);
@@ -240,7 +243,7 @@ int get_flash_bank_by_addr(struct target *target,
return retval;
}
/* check whether address belongs to this flash bank */
- if ((addr >= c->base) && (addr <= c->base + (c->size - 1)) && target == c->target) \
{ + if ((addr >= c->base) && (addr <= c->base + (c->size - 1))) {
*result_bank = c;
return ERROR_OK;
}
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index c49f87c..fac0bf6 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -957,6 +957,9 @@ static int gdb_new_connection(struct connection *connection)
int i;
for (i = 0; i < flash_get_bank_count(); i++) {
struct flash_bank *p;
+ p = get_flash_bank_by_num_noprobe(i);
+ if (p->target != gdb_service->target)
+ continue;
retval = get_flash_bank_by_num(i, &p);
if (retval != ERROR_OK) {
LOG_ERROR("Connect failed. Consider setting up a gdb-attach event for the target \
" \ @@ -1732,14 +1735,16 @@ static int gdb_memory_map(struct connection *connection,
banks = malloc(sizeof(struct flash_bank *)*flash_get_bank_count());
for (i = 0; i < flash_get_bank_count(); i++) {
+ p = get_flash_bank_by_num_noprobe(i);
+ if (p->target != target)
+ continue;
retval = get_flash_bank_by_num(i, &p);
if (retval != ERROR_OK) {
free(banks);
gdb_error(connection, retval);
return retval;
}
- if (p->target == target)
- banks[target_flash_banks++] = p;
+ banks[target_flash_banks++] = p;
}
qsort(banks, target_flash_banks, sizeof(struct flash_bank *),
--
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic