Embedded Muse 122 Copyright 2006 TGG January 10, 2006


You may redistribute this newsletter for noncommercial purposes. For commercial use contact jack@ganssle.com.

EDITOR: Jack Ganssle, jack@ganssle.com

CONTENTS:
- Editor’s Notes
- Rounding
- More on Tools
- Testing
- Jobs!
- Joke for the Week
- About The Embedded Muse


Editor’s Notes


TV chef Emeril is always “kicking things up a notch” by adding garlic and other zestiness to his recipes. How are your firm’s engineering recipes? Want to kick up your development processes by more than a notch? I can present my Better Firmware Faster class at your facility. See https://www.ganssle.com/classes.htm .


Mark Misiewicz wrote in response to my comments on computing in the olden days: “If somebody is talking about history of computers, I think that the name of Dr. Zuse should be mentioned. see: http://www.epemag.com/zuse/ .”

A fascinating site. In Germany Dr. Zuse is a well-known computer pioneer. No visit to Munich is complete without a pilgrimage to the Deutsches Museum, which exhibits two of his many machines.


Rounding


It’s such a prosaic subject; it’s one we rarely think about while programming in C or C++. Compilers offer the magic of floating point so seamlessly that we forget the tradeoffs made in the runtime package.

Rounding. A hard-to-believe urban legend suggests one or more high-tech crooks defrauded banks by depositing rounding errors in their own accounts.

Rounding. Get it wrong and mysterious errors slowly accumulate. If rounding is a real concern often developers use BCD math, especially for financial transactions.

Do your apps round down? Round up? Truncate? Round ceiling?

Here’s an interesting paper about 15 different rounding approaches: http://www.pldesignline.com/howto/showArticle.jhtml;?articleID=175801189 , by Clive Maxfield. There’s more in this book “The Definitive Guide to How Computers Do Math,” an excellent introduction to, well, more than one imagines about computing. I’m planning to review it soon.

A more technical paper that tells more than most of us want to know about floating point, rounding, and the IEEE-754 standard is “What every computer scientist Should Know About Floating Point,” available at http://docs.sun.com/source/806-3568/ncg_goldberg.html .


More on Tools


The tools discussion has prompted a lot of interesting email from readers. Koushik writes about project management tools: “I found a tool called OpenWorkbench that claims to do that and more at http://www.openworkbench.org/. This tool is open-source and is hence free. Specifically, the feature listing at http://www.openworkbench.org/index.php?option=com_content&task=view&id=3&Itemid=6 mentions PERT charts etc. I have scarcely begun evaluating it and so far it seems pretty good.”

Several other readers mentioned Openworkbench, too.

Dennis J. Murray contributed: “In your latest email, you mentioned a reader needing a cheap/free project planner tool. He specifically mentioned PERT charts, although I personally prefer Gantt charts (minor issue). If he CAN find it in his heart to use Gantt charts and can run Linux, there's a FREE project management tool which I use and like called Imendio PLANNER. The homepage is available at http://developer.imendio.com/wiki/Planner .”

Frequent contributor Paul Bennett said: “I thought I would look around for a Linux one as well. I found this: http://www.sharedplan.com/linuxproject.html .Seems quite reasonable from reading the manual. “

Allen Paul sent this link: http://www.guysoftware.com/planbee.htm .

Finally, Don Peterson wrote: “I'd like to pass on some tips about useful tools I've found. Of course, everyone has their own list, but it's always worthwhile to occasionally go out and seek new ones. I'm a big fan and user of open source tools, not just because they're free, but because the popular ones tend to be actively maintained -- they fix bugs and add features.

“My favorite file diff tool is vimdiff, which is an invocation of the vim editor using the -d option. I'm a command line weenie, so I still use GNU diff a lot too. For comparing directories and files, doing merges, and editing, the free WinMerge program is nice (http://winmerge.sourceforge.net/ ); its only disadvantage is that it only runs on Windows. I haven't looked at their source, but I believe it's in C++. Perhaps we could encourage some volunteers to help them rewrite the thing using wxWidgets, which means it would be portable to platforms besides Windows.

“If you use vi and its clones (especially vim), you should be aware of exuberant ctags (http://ctags.sourceforge.net/ ), as it makes navigation in source files much easier. Use it e.g. to tag all the symbols in all the include files in /usr/include (when I'm on Linux, I have a cron job recreate this file every night).

“I wrote a binary file comparison tool bd.c years ago because I frequently had to compare firmware builds and figure out if they differed, in spite of embedded date/time stamps and CRCs. It's not a GUI tool, but it gets the job done. You can get it at http://www.gdssw.com/tools/ .

“Here's an open source web authoring tool that's simple to set up and use: http://www.nvu.com/ .

“The people at Adobe have forgotten the simple roots that their Acrobat reader used to have. Now if you want to read PDF files, you have to download 17 MB of junk. Forget that -- get Foxit reader, a fast PDF viewer. They didn't screw up the scroll wheel support like Adobe did. http://www.foxitsoftware.com/pdf/rd_intro.php .

”If you need a database, the open source MySQL (http://www.mysql.com/ ) could be a good choice for you. On Windows, it hooks up easily with an ODBC driver and lets you connect to its databases with the Open Office programs.

“If you're interested in getting off the Microsoft upgrade-every-few-years treadmill, take a look at Open Office (http://www.openoffice.org/ ). I used MS Word for 20 years, so it took a bit of effort on my part to switch over, since I had numerous macros that helped me in my work. However, I've become _very_ attached to Open Office and how it works -- so much so that I rarely use MS Office anymore. The main program I use is Writer, which looks a bit like MS Word. To be objective, be warned that OO Writer crashes more frequently than Word does. However, to its credit, there was only one time where I lost any work (its recovery process works very well). On the other hand, I've had MS Word absolutely trash some documents to where they were unrecoverable -- and this resulted in a lot of lost work. Even with the crashes, OO is (in my opinion) a better tool than Word.

“Years ago I had an idea for a hierarchically organized information manager. I then found a number of them on the web (Leo, TreePad, KeyNote). I tried them and settled on KeyNote (http://www.tranglos.com/free/keynote.html ). It's a Windows only program. It's simple and easy to use. Now you've got a place to stick all those tidbits of knowledge. It may not be maintained anymore, but the current version is working fine for me.

“For Windows, check out http://www.sysinternals.com/SystemInformationUtilities.html -- especially Process Explorer. It's a nice replacement for Windows' Task Manager.

“We all have to keep track of lots of logins and passwords these days. I like to use KeePass (http://keepass.sourceforge.net/ ) for this. Another good tool is Password Safe (http://passwordsafe.sourceforge.net/ ), but I like KeePass just a little better.

“If you're a UNIX person who has to use a Windows computer, all your favorite and familiar tools can be gotten by installing cygwin (http://www.cygwin.com/ ). If you want to distribute apps under cygwin, the licensing fees are substantial. Instead, get the MinGW compiler (http://www.mingw.org/ ) and you can build native Windows apps and distribute them without any fees. Use wxWidgets (http://www.wxwidgets.org/ ) and you can build C++ cross-platform GUI apps.”


Testing


Much as I’d hate doing desktop development, who doesn’t envy the controlled environment Linux/Windows developers have? It’s relatively easy to construct automated tests that exercise great swaths of the code.

The embedded world is very different. We need someone to push buttons and watch displays. It’s tough to automate this, so our tests are all-too-often not up to snuff.

Simulators have gotten pretty good. But it’s expensive (sometimes frightening so) and tedious to create simulations of your custom peripherals.

Nancy Van Schooenderwoert of Agile Rules wrote about their new test framework (offered as open source code) which looks pretty cool. Agile Rules is one of the few embedded companies rigorously practicing eXtreme Programming, and they always have an interesting take on development approaches.

In her email (which follows) she refers to Test Driven Development, an increasingly popular approach that, well, sort of gives me the willies. In the pure form advocated by Kent Beck and others TDD appears to be a sort of glorified hacking that eschews much design.

But the idea behind TDD - that of creating extensive tests in parallel with the real code - is brilliant, and is possibly the most important idea to come from the eXtreme Programming folks. Many developers wisely adopt a version of TDD that's less extreme than Mr. Beck's version with great results.

Fairness warning: I found Beck's "Test Driven Development: By Example" to be scary (my review is here: https://www.ganssle.com/books/books3.htm#tdd ). But the reviews on Amazon are pretty positive so maybe I'm just wrong.

Here’s Nancy’s email about their framework: “Agile Rules is pleased to announce C Automated Testing System (CATS) and its associated test runner (Catsrunner). This unit testing framework provides developers of C-based systems, including embedded systems, the capability to use the popular Test Driven Development (TDD) software development approach.

“TDD is gaining widespread appeal because it has a proven track record of simultaneously reducing time to market and significantly increasing software quality. Unfortunately, until now, availability of TDD tools had only benefited those developers who use languages that provide object oriented support and reflection, such as C# and Java. This has left a significant developer base, including a majority of embedded developers, on the outside looking in.

“CATS supports embedded cross-platform development by working in conjunction with hardware abstraction layers. Illustrations of this are included with the download. CATS also comes with a thin wrapper around arm-elf-gdb's host/target communication functions. A reference implementation for the ARM-7 CPU core is provided. CATS and Catsrunner support the agile embedded techniques described in the paper "Taming the Embedded Tiger: Agile Test Techniques for Embedded Software" (get it here- http://www.agilerules.com/publications.phtml ), which was presented by Agile Rules at the Agile Development Conference in 2004.

“CATS and Catsrunner are available as an Open Source tool for Unix and Linux environments.

“To download CATS, go to http://www.agilerules.com/projects/catsrunner/index.phtml The link to the download is near the bottom of the page. Happy developing!”


Jobs!


Joke for the Week


A definition:

Recursive: adj. see Recursive