Re: [Openocd-development] two questions

2009-09-17 Thread Øyvind Harboe
On Thu, Sep 17, 2009 at 12:05 PM, Alexei Babich a.bab...@rez.ru wrote:
 I don't like to see such dependencies added for no good reason.
 OK, I thought so.

 Do you really need that complicated option handling?
 Well, look, I want to handle such options with the following parameters:
 1. hwecc{no,1bit,4bit,8bit} (last two only for imx35, but still not sure)
 2. cs{0,1,2,3} (only for imx35)
 3. pagesize{512,2048,4096} (force override pin/fuse captured values, last one 
 only for imx35)
 4. buswidth{8,16} (force override pin/fuse captured values)

 Too many lines of code with strcmp(). Ugly.
 Maybe, openocd already has some subsystem parsing options (may be, JIM? But I 
 do not know how to use it) ?
 I looked into the source of several (not all) drivers - did not find anything.

I'm hoping Duane will step in here and help out :-)


-- 
Øyvind Harboe
Embedded software and hardware consulting services
http://www.zylin.com
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] two questions

2009-09-17 Thread David Brownell
On Thursday 17 September 2009, Alexei Babich wrote:
 1. hwecc{no,1bit,4bit,8bit} (last two only for imx35, but still not sure)
 2. cs{0,1,2,3} (only for imx35)
 3. pagesize{512,2048,4096} (force override pin/fuse captured values, last one 
 only for imx35)
 4. buswidth{8,16} (force override pin/fuse captured values)

Other NAND drivers just have parameters to the nand device
registration call for all of those ... except #3, since the
device characteristics are retrieved from the actual NAND
chip found at the relevant address.

The option parsing code will be small; a lot less involved
than supporting multiple hardware ECC modes, for example!

Re hweccno ... simplify things, and don't.  Just have the
NAND driver always implement hardware ECC, if its page I/O
calls are used.  Use the generic NAND code to trigger no
ECC or soft ECC (a 1bit flavor) modes.


 2. Is OpenOCD interacts correctly with MLC NAND-flash chips with
 large (4096 bytes) pages? 

Should.  It's not like they're any different from SLC except
that they can't be erased very much, right?


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


Re: [Openocd-development] two questions

2009-09-17 Thread Duane Ellis
Øyvind Harboe wrote:
 I'm hoping Duane will step in here and help out :-)
   

Item 1:

It sounds like you want options from from the dos/unix command line in 
a batch file format.  Why don't you _dynamically_ create the 
configuration file:openocd.cfg - with your command line parameters 
inside it. You could for example - create a perl script - that (a) 
parses your command line options, (b) creates an openocd.cfg file then 
(c) executes openocd with the -f CONFIGFILENAME option pointing at 
your temporary 'openocd.cfg' file.

At this point, you have openocd commands - and 'getopt' is out of the 
questions.

Item 2: -

If you want to use JIM based commands ... {and I don't think it is what 
you want}

{Historical note: When OpenOCD was written 'JIM-TCL' did not exist, some 
commands are JIM commands, some commands are old-school}
This item talks about JIM commands.

For examples of how to do JIM options  commands,  take a look at the 
file: target.c - look for the   function that impliments  the target 
command. Also - search around the code for a common (local) variable 
name goi - stands for Get Option Info - it is a bit ugly (I wrote 
it) i was trying to make it easier to create common option handling 
sequences in some common way. [Jim.c  - by default - does everything 
'in-line' ]

There are options/methods to handle  Enumerations - Options with 
numbers, etc.

Another file too look at would be the jtag.c file - where the taps are 
created.

Item 3: - Old School Commands

Best choice, since you are looking at NAND stuff is look at how the 
${SRC}/flash/nand.c commands are handled

Also - I believe David has done quite a bit of work with the Nand code.

Or look at the other FOOBAR_nand.c files

=Duane

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


Re: [Openocd-development] two questions

2009-09-17 Thread Alexei Babich
Hi, Duane.

 It sounds like you want options from from the dos/unix command line in 
 a batch file format.
Thank you for your detailed letter. As I understand English is not always good, 
I'm still going to study the letter carefully :) But now, not to waste time, 
let me clarify:
we are talking about C-code inside the driver imx3 * _nand, which takes a 
string from the config file: nand probe bla-bla [options].
These options, in the form of char *cmd, char **args, int argc, must be 
analyzed. Comparing [many] variants with constant templates is ugly. I am 
looking for a good way, which can be used in C-code.
Are we talking about the same?
If yes, then say yes, please.

 For examples of how to do JIM options  commands,  take a look at the file: 
 target.c - look for the  
 function that impliments  the target command.

 Item 3: - Old School Commands
OK, thanks.
Sounds good.

-- 
Regards,
Alexei Babich, circuit design engineer, Rezonans plc., Chelyabinsk, Russia
http://www.rez.ru
Jabber ID: imp...@jabber.ru
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] two questions

2009-09-17 Thread Duane Ellis
Alexei Babich wrote:
 Hi, Duane.

   
 It sounds like you want options from from the dos/unix command line in 
 a batch file format.
 
 Thank you for your detailed letter. As I understand English is not always 
 good, I'm still going to study the letter carefully :) But now, not to waste 
 time, let me clarify:
 we are talking about C-code inside the driver imx3 * _nand, which takes a 
 string from the config file: nand probe bla-bla [options].
 These options, in the form of char *cmd, char **args, int argc, must be 
 analyzed. Comparing [many] variants with constant templates is ugly. I am 
 looking for a good way, which can be used in C-code.
 Are we talking about the same?
 If yes, then say yes, please.
   

Yes.

The char *cmd, char **args, int argc - is old-style command.

Today there is *NO* getopt style feature inside of OpenOCD source code 
to help old-style commands.

There *is* for (new) JIM-TCL commands, but *NOT* for old-style commands.

For old-style commands - what does exist is parse_ulong() - and 
parse_llong() functions and many other parse functions.
Look at the end of command.h

-Duane



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