Re: [Openocd-development] [PUSHED 9/8] add flash/nand name support

2009-11-20 Thread Zach Welch
Pushed.  Thanks for helping track this down.  --Z

On Thu, 2009-11-19 at 23:23 -0600, Dean Glazeski wrote:
 I can verify that this patch makes the fake errors go away.
 
 // Dean Glazeski
 
 
 On Thu, Nov 19, 2009 at 8:16 PM, Zach Welch z...@superlucidity.net
 wrote:
 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
 z...@superlucidity.net
  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
  Openocd-development@lists.berlios.de
 
 https://lists.berlios.de/mailman/listinfo/openocd-development
 
 
 
 
 
 
 


___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PUSHED 9/8] add flash/nand name support

2009-11-19 Thread Zach Welch
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
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PUSHED 9/8] add flash/nand name support

2009-11-19 Thread Dean Glazeski
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 z...@superlucidity.net 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
 Openocd-development@lists.berlios.de
 https://lists.berlios.de/mailman/listinfo/openocd-development

___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PUSHED 9/8] add flash/nand name support

2009-11-19 Thread Zach Welch
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 z...@superlucidity.net
 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
 Openocd-development@lists.berlios.de
 https://lists.berlios.de/mailman/listinfo/openocd-development
 
 



From 360c25cf190cbd832028ddf42d4667b924b9efc7 Mon Sep 17 00:00:00 2001
From: Zachary T Welch z...@superlucidity.net
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 z...@superlucidity.net
---
 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
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PUSHED 9/8] add flash/nand name support

2009-11-19 Thread David Brownell
Why is there even a number appended?

Just let whoever defines the name define it however they want,
and insist only that it be unique.

That will get rid of lots of possible errors inthe code...
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PUSHED 9/8] add flash/nand name support

2009-11-19 Thread Zach Welch
On Thu, 2009-11-19 at 19:47 -0700, David Brownell wrote:
 Why is there even a number appended?
 
 Just let whoever defines the name define it however they want,
 and insist only that it be unique.
 
 That will get rid of lots of possible errors inthe code...

Well, the code in question supports '{driver/controller}_name[.num]'
style names (which I added in my original patch).  Arbitrary names (such
as 'foo.flash') came after I added the required member to the
bank/device structures, and I thought to myself: hey, look -- it will
be easy to support both styles.  It remains to be seen if I was right,
or whether it's worth having both.

--Z
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PUSHED 9/8] add flash/nand name support

2009-11-19 Thread Dean Glazeski
I can verify that this patch makes the fake errors go away.

// Dean Glazeski


On Thu, Nov 19, 2009 at 8:16 PM, Zach Welch z...@superlucidity.net wrote:

 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 z...@superlucidity.net
  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
  Openocd-development@lists.berlios.de
  https://lists.berlios.de/mailman/listinfo/openocd-development
 
 




___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development