Another whoops.  The changes to use '$_CHIPNAME.flash' were added after
I wrote that code, and I didn't consider the consequences thoroughly.
The attached patch should fix the issue.  Let me know, and I'll push it.

--Z

On Thu, 2009-11-19 at 18:01 -0600, Dean Glazeski wrote:
> This series seems to make command.c spew errors about "invalid command
> argument".  I traced it back to the parse##type macro or whatver that
> is that is called from flash/common.c in the get_flash_name_index
> function that is called from pretty much every nand * command.  For my
> NAND devices, they don't have an integer after the '.'.  I'm not
> really sure why this is there or how to fix it.
> 
> // Dean Glazeski
> 
> 
> On Thu, Nov 19, 2009 at 5:00 PM, Zach Welch <[email protected]>
> wrote:
>         On Wed, 2009-11-18 at 02:56 -0800, Zachary T Welch wrote:
>         > Hi all,
>         >
>         > This series improves on the patch sent previously to add
>         bank names.
>         > It adds a 'name' field to the flash and nand bank
>         structures.
>         >
>         > This name must be passed as the first argument to the 'flash
>         bank' and
>         > 'nand device' commands, so the last two patches update all
>         scripts to
>         
>         > add 'set FLASHBANK $_CHIPNAME.flash' and use the improved
>         syntax.
>         
>         I have pushed this series.  Anyone with their own script that
>         uses flash
>         or nand bank (most of them!) will notice the breakage.
>         
>         The 'nand device' and 'flash bank' commands now take the
>         desired name as
>         their first argument, which has been updated using the
>         convention above.
>         So,
>         
>          flash bank ...
>         
>         effectively becomes
>         
>          flash bank $_CHIPNAME.flash ....
>         
>         and similarly for the 'nand device' command.  You should now
>         be able to
>         refer to it by this name instead of using its bank number, if
>         you want
>         to update your scripts (or those in the tree). 
>         
>         
>         Cheers,
>         
>         Zach
>         _______________________________________________
>         Openocd-development mailing list
>         [email protected]
>         https://lists.berlios.de/mailman/listinfo/openocd-development
>         
> 



From 360c25cf190cbd832028ddf42d4667b924b9efc7 Mon Sep 17 00:00:00 2001
From: Zachary T Welch <[email protected]>
Date: Thu, 19 Nov 2009 18:11:30 -0800
Subject: [PATCH] fix flash/nand name parsing

Start driver.num check from end, and make sure the numeric part is
actually a number.  Fix problems trying to parse bank names.

Signed-off-by: Zachary T Welch <[email protected]>
---
 src/flash/common.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/flash/common.c b/src/flash/common.c
index 253ed9d..072e691 100644
--- a/src/flash/common.c
+++ b/src/flash/common.c
@@ -25,9 +25,11 @@
 
 unsigned get_flash_name_index(const char *name)
 {
-	const char *index = strchr(name, '.');
+	const char *index = strrchr(name, '.');
 	if (NULL == index)
 		return 0;
+	if (index[1] < '0' || index[1] > '9')
+		return ~0U;
 	unsigned requested;
 	int retval = parse_uint(index + 1, &requested);
 	// detect parsing error by forcing past end of bank list
-- 
1.6.4.4

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to