Forums

Scripting tools under Windows

Started by Alf February 7, 2008
Hi guys,
	Like a lot of you I develop devices that need to be programmed, 
configured and tested in a production environment, often in conjunction 
with firmware test functions on the embedded device.  Much of this is 
accomplished from Windows PCs using serial and parallel ports and 
usually involves running small utility programs.  Naturally I want to 
script these procedures to require the minimum amount of human 
intervention, both for efficiencey and repeatability.

	So what scripting tools are you guys using out there?
	
	Years ago, I used QuickBasic to quickly knock up this sort of script, 
usually 1/2 an hour at most, a nice set of serial and parallel port 
manipulation tools and easy to run little external apps (e.g. a bin2hex 
utility).  Of course QuickBasic is not compatible with modern Microsoft 
OS's.

	My preference is for a simple language that does not have to produce 
robust shrink-wrap code, isn't bloated with GUI stuff, has serial comms 
with control over handshake lines, can control parallel port lines, can 
send data to other apps and receive data from them, read and write files 
and interact with the user via a console, and can be batched.  It should 
be capable of being modified by Windows programmers, embedded 
programmers, hardware engineers and production techs without too much of 
a learning curve - kind of leaves out huge APIs and frameworks.

	Some of the tools used around various places I interface with include:

Python: 	A different language every week, can't do anything on its own 
but needs a bunch of libraries - and there's 32 different varieties of 
each.  It's also a different language every fortnight.

C# / .Net:	Like Python, has way to rich an API but makes the simplest 
things seem difficult - e.g getting unbuffered bytes from a serial port.

Labview:	Really well suited to the task, but difficult for Labview 
newbies to get to grips with, and damned expensive.

Your ideas would be appreciated.

Cheers,
alf


	
	
On Thu, 07 Feb 2008 21:47:05 +1100, Alf
<alfkatz@ieee.removetheobvious.org> wrote:

>My preference is for a simple language that does not have to produce >robust shrink-wrap code, isn't bloated with GUI stuff, has serial comms >with control over handshake lines, can control parallel port lines, can >send data to other apps and receive data from them, read and write files >and interact with the user via a console, and can be batched. It should >be capable of being modified by Windows programmers, embedded >programmers, hardware engineers and production techs without too much of >a learning curve - kind of leaves out huge APIs and frameworks.
Sounds like Forth to me. Apart from being a Forth vendor, we eat our own dog food and do all this stuff easily. The commercial Forth vendors provide free evaluation systems which can do everything except make turnkey apps. There is also a range of public domain and GPL systems. Our product, VFX Forth for Windows, can be run in console mode or GUI mode and understands redirection. Forth is not a fashionable language, but it sure works for us and many others who want to connect PCs to the real world. Stephen -- Stephen Pelc, stephenXXX@mpeforth.com MicroProcessor Engineering Ltd - More Real, Less Time 133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web: http://www.mpeforth.com - free VFX Forth downloads
Alf wrote:
> Hi guys, > Like a lot of you I develop devices that need to be programmed, > configured and tested in a production environment, often in conjunction > with firmware test functions on the embedded device. Much of this is > accomplished from Windows PCs using serial and parallel ports and > usually involves running small utility programs. Naturally I want to > script these procedures to require the minimum amount of human > intervention, both for efficiencey and repeatability. > > So what scripting tools are you guys using out there? > > Years ago, I used QuickBasic to quickly knock up this sort of > script, usually 1/2 an hour at most, a nice set of serial and parallel > port manipulation tools and easy to run little external apps (e.g. a > bin2hex utility). Of course QuickBasic is not compatible with modern > Microsoft OS's. > > My preference is for a simple language that does not have to produce > robust shrink-wrap code, isn't bloated with GUI stuff, has serial comms > with control over handshake lines, can control parallel port lines, can > send data to other apps and receive data from them, read and write files > and interact with the user via a console, and can be batched. It should > be capable of being modified by Windows programmers, embedded > programmers, hardware engineers and production techs without too much of > a learning curve - kind of leaves out huge APIs and frameworks. > > Some of the tools used around various places I interface with include: > > Python: A different language every week, can't do anything on its > own but needs a bunch of libraries - and there's 32 different varieties > of each. It's also a different language every fortnight. >
I've read a fair number of different descriptions of different languages over the years, but I've never seen anything as totally inaccurate as that! Python adds language features over *years*, not weeks - and it does so with a very structured and safe system of deprecating old features (when absolutely necessary) and gradually introducing new ones. The "bunch of libraries" is *included* in the Python system. When you install Python, there are a large number of library modules installed at the time. Installing new ones (such as pyserial and pyparallel, for serial and parallel port access, or pywin32 for windows api wrappers) is simple, and the libraries are automatically integrated. Additional libraries are available for a vast number of different purposes. The only potential risk for using Python for this sort of thing is that it might be *too* powerful. But if you are needing something beyond a simple batch file, and beyond bash (and "expect") scripting, then it would definitely be my first recommendation. Python is regularly used for small scripts as well as for major applications. tcl/tk would be another alternative to consider if you have some sort of snake allergy.
> C# / .Net: Like Python, has way to rich an API but makes the simplest > things seem difficult - e.g getting unbuffered bytes from a serial port. >
That's not scripting, that's software development, and needs serious development software and trained programmers.
> Labview: Really well suited to the task, but difficult for Labview > newbies to get to grips with, and damned expensive. > > Your ideas would be appreciated. >
First, consider plain bat files - there's a lot of automation possibilities there, for very little effort. Next step up is bash scripting - it's a lot more powerful than bat files. Combine it with "expect" to automate command-line programs. If that's not enough, Python is the way to go. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65107 http://pexpect.sourceforge.net/
Stephen Pelc wrote:
> On Thu, 07 Feb 2008 21:47:05 +1100, Alf > <alfkatz@ieee.removetheobvious.org> wrote: > >> My preference is for a simple language that does not have to produce >> robust shrink-wrap code, isn't bloated with GUI stuff, has serial comms >> with control over handshake lines, can control parallel port lines, can >> send data to other apps and receive data from them, read and write files >> and interact with the user via a console, and can be batched. It should >> be capable of being modified by Windows programmers, embedded >> programmers, hardware engineers and production techs without too much of >> a learning curve - kind of leaves out huge APIs and frameworks. > > Sounds like Forth to me. Apart from being a Forth vendor, we eat our > own dog food and do all this stuff easily. The commercial Forth
Forth is actually a lot like dog food - when you first try it, it's horrible and repulsive. But if you can deal with the philosophy change and get used to it, your meals are very quick and very cheap, and can be made from a wide variety of easily obtained ingredients! (Forth is a language I would like to be good at, but have never found the time.)
> vendors provide free evaluation systems which can do everything except > make turnkey apps. There is also a range of public domain and GPL > systems. Our product, VFX Forth for Windows, can be run in console > mode or GUI mode and understands redirection. > > Forth is not a fashionable language, but it sure works for us and > many others who want to connect PCs to the real world. > > Stephen > >
On Thu, 07 Feb 2008 21:47:05 +1100, Alf
<alfkatz@ieee.removetheobvious.org> wrote:

>Hi guys, > Like a lot of you I develop devices that need to be programmed, >configured and tested in a production environment, often in conjunction >with firmware test functions on the embedded device. Much of this is >accomplished from Windows PCs using serial and parallel ports and >usually involves running small utility programs. Naturally I want to >script these procedures to require the minimum amount of human >intervention, both for efficiencey and repeatability. > > So what scripting tools are you guys using out there?
Perl. But for the kind of production testing you describe, an ancient (in internet years) copy of Borland C++ Builder 5 along with the com port component from <http://www.winsoft.sk/comport.htm> makes this kind of thing very easy. A nice set of graphing tools is included in the base BCB package for live trend plots, etc. Hook that up with USB-enabled interfaces (with API libraries) from folks like <http://www.measurementcomputing.com>, CAN interfaces from <http://www.phytec.com/products/can/pc-can-interfaces/peakusb.html>, and GPIB connectivity with <http://www.sparkfun.com/commerce/product_info.php?products_id=549> and you're rockin'! I also have MS Visual Studio 2005 but use it only under duress. -- Rich Webb Norfolk, VA
On Feb 7, 5:47=A0am, Alf <alfk...@ieee.removetheobvious.org> wrote:

> =A0 =A0 =A0 =A0 Years ago, I used QuickBasic to quickly knock up this sort=
of script,
> usually 1/2 an hour at most, a nice set of serial and parallel port
When you are writing non-shippable lab code, your principal constraint is ease of use. Therefore your #1 selection criteria should be "similarity to stuff you've done before". If BASIC is your cup of tea, then perhaps you're best served by using VB, though it's not really BASIC of the kind we used to know and love. Microsoft makes a free version (Visual Studio Express) available. I tend to write this kind of code in C and use either Linux or Cygwin depending on what the code actually needs to do. Really, the Windows API for serial ports is not unreasonably complicated.
Rich Webb wrote:

> > But for the kind of production testing you describe, an ancient (in > internet years) copy of Borland C++ Builder 5 along with the com port > component from <http://www.winsoft.sk/comport.htm> makes this kind of > thing very easy. A nice set of graphing tools is included in the base > BCB package for live trend plots, etc.
Turbo Power Async (http://sourceforge.net/projects/tpapro/) does a good job and it's free. It also supports a lot of TCP/IP stuff as well. While you're about it, if you can stand Pascal, try Lazarus (http://www.lazarus.freepascal.org/index.php); it's a good Delphi clone with cross- platform (Windows, Linux, WinCE) capabilities. And it's free. For the port output, TVicPort is useful: http://www.entechtaiwan.com/dev/port/index.shtm.
> Like a lot of you I develop devices that need to be programmed, configured > and tested in a production environment, often in conjunction with firmware > test functions on the embedded device. Much of this is accomplished from > Windows PCs using serial and parallel ports and usually involves running > small utility programs. Naturally I want to script these procedures to > require the minimum amount of human intervention, both for efficiencey and > repeatability. > > So what scripting tools are you guys using out there?
My impulsive response to your question would be Perl because it meets most of your requirements. Then I thought about it a little. Where I work, what's important is that works reliably, it's quick to build, and it's low maintenance. There are many high quality software systems or combinations of those systems that will meet your needs. My thoughtful response would be a series of questions to you: What are your programming strengths? And those of your successors? How much money do you want to spend? What tools do you have on hand right now? I would think the answer would be found not primarily on based on technical merit but rather based on your personal preferences, strengths, and what tools you have within easy reach. There are so many arguably good ways to go. JJS
"Alf" <alfkatz@ieee.removetheobvious.org> wrote in message 
news:47aae192$0$5200$afc38c87@news.optusnet.com.au...
> Hi guys, > Like a lot of you I develop devices that need to be programmed, configured > and tested in a production environment, often in conjunction with firmware > test functions on the embedded device. Much of this is accomplished from > Windows PCs using serial and parallel ports and usually involves running > small utility programs. Naturally I want to script these procedures to > require the minimum amount of human intervention, both for efficiencey and > repeatability. > > So what scripting tools are you guys using out there?
Tcl works fine. Try comp.lang.tcl with your specific application. You can get distributions from www.activestate.com, among other places. It is open source, and you can add commands to the interpreter and make your own custom executable if you want to add in things most efficiently done in C. -- David T. Ashley (dta@e3ft.com) http://www.e3ft.com (Consulting Home Page) http://www.dtashley.com (Personal Home Page) http://gpl.e3ft.com (GPL Publications and Projects)
On Feb 7, 2:47 am, Alf <alfk...@ieee.removetheobvious.org> wrote:
> Hi guys, > Like a lot of you I develop devices that need to be programmed, > configured and tested in a production environment, often in conjunction > with firmware test functions on the embedded device.
Yes, we need to test and program many of them.
> Much of this is accomplished from Windows PCs
No, we don't.
> using serial and parallel ports and
No, we don't.
> usually involves running small utility programs. Naturally I want to > script these procedures to require the minimum amount of human > intervention, both for efficiencey and repeatability. > > So what scripting tools are you guys using out there?
One connector and One button. Basically, we have an embedded tester/programer connected to the target's Jtag/Spi ports. With the push of a button, it boundary-scans for open and short traces. Program the device and turn on either a Red or Green Led. We don't really need to see anything else. We can test and program them in 10 seconds.