Tools ease Linux development
David Marsh, Contributing Technical Editor- April 1, 2001
|A version of this article ran in the June-July 2001 issue of
Test & Measurement World. Download the pdf.
Linux has entered the mainstream as an operating system (OS) used in engineering applications, and like any evolving OS, it has spawned its share of development tools. Many of these tools exist as shareware or freeware, but you have to know where to look for them. These tools can help you do real work under Linux and ease your transition from Windows to Linux.
Linux suppliers typically offer inexpensive “basic” packages with minimal support software and more expensive “professional” packages that include hundreds of applications and utilities. Seasoned Linux users refer to any package that contains Linux as a “distribution.” Don’t let the cry of “more is better” seduce you into buying a package that provides more tools than you’ll need. And don’t automatically load lots of software just to have it available on your computer. Start with the fewest number of programs you need and load others as you need them.
For professional use, pick a Linux distribution that enjoys widespread support from commercial developers. Red Hat’s Linux has become the de facto industry standard, although Linux software developed for one distribution should run with others. (Here’s a tip for potential Linux users: Try Caldera’s OpenLinux. It installs from Windows and includes tools to bridge the Linux/Windows divide. Other distributions may not offer that flexibility.)
|Figure 1. A typical Linux desktop, such as this GUI from KDE, looks and operates a lot like Windows.|
You can choose between alternative Linux desktop environments that also provide tool and library support that’s tailored to the specific environment. Today, the free Gnome and the KDE Linux desktops (Figure 1 ) have virtually replaced the generic X-Windows GUI. Gnome and KDE come with alternative applications and utilities, so for maximum flexibility, install them both. You can select one or the other at log-on to the Linux OS. Both the Gnome and KDE Web sites offer large software repositories that include development and scientific tools (See “Sources of development tools, utilities, and information” for the Web addresses of companies mentioned in this article.).
To take advantage of information on the Web, you must have an Internet connection. Setting up Linux networking involves manipulating text files in many directories. Navigating the network-setup maze proves far easier when using graphical setup tools; Linux distributions typically include system-specific configuration and administration software such as Linuxconf and Webmin.
When you have an Internet connection, you can download tools including Linuxconf’s NT2Linux tool that ports NT environment settings to Linux. This tool helps reconfigure an NT-based network into a Linux-based network.
Or, you may want to set up Samba, a popular tool that makes it easy for Linux and Windows PCs to communicate. Samba fools Windows into thinking your Linux machine is an NT server. If your Linux distribution doesn’t include Samba, you can download the program for free.
You also may want Swat, a graphical front-end that configures Samba local-area networking. Always check your Linux supplier’s Web site first for system utilities, such as Swat and Samba, in case the supplier provides optimizations of such software specific to its distribution of Linux.
Development tools included
Development tools that accompany distributions include the GNU (GNU’s Not Unix) compiler/debugger suite and numerous editors. The GNU tools run with varying capabilities on most processors and under most operating systems, including Windows. The Windows tools exist as Cygwin versions of the original GNU tools. GNU supports languages such as C, C++, and Perl. Perl, in particular, provides useful cross-platform facilities.
Editors such as Emacs and its graphical derivative, XEmacs, provide a programming environment for Linux, Unix, or Windows. Free integrated development environments (IDEs) include Gnome’s gIDE and KDE’s KDevelop suite, both of which support C and C++. KDevelop also supports Qt, which is Troll Tech’s GUI development toolkit for C++ that runs on Linux and on most versions of Unix and Windows. Qt includes application-programming-interface (API) class libraries and extensions for Internet Explorer, Netscape, OpenGL, and Xt/Motif. The GUI development tools find use in applications such as controlling instruments from a Web browser (Ref. 1).
You can also download the Cygnus Source-Navigator IDE and its Insight GUI for GNU’s GDB debugger. These packages made up Cygnus’ commercial Code Fusion product, which Red Hat turned into open-source products after it acquired Cygnus. Commercial IDEs include Metrowerks CodeWarrior ($125) for Red Hat and SuSE Linux distributions. Always check the library and environment an IDE works with; for example, KDevelop is optimized for KDE’s user-interface, although it also works with the generic X-Windows library.
Learn to like C
If you’re not a C fan, you may learn to like it by using EiC (embedded/extensible interactive C). EiC is an open-source C that runs under Linux. It compiles C statements into intermediate code you can run much like a Basic interpreter. You can run the code interactively or as a script file. The interactive mode lets you include headers, define constants and variables, execute immediate statements, and check results interactively. Those capabilities ease the tasks of learning C and prototyping code. The script-file mode provides almost every C capability in a scripting language, together with Common-Gateway-Interface (CGI) compatibility, almost a must for Web-based applications. CGI is a protocol that provides the interface between HTML client requests and server actions such as calling a script to load a program segment or to access a database.
|Figure 2. The Linux version of LabView provides most of the functions in its Windows counterpart, although it lacks ActiveX capabilities. The software provides HTML to present information to Web browsers.|
If you’re working on a data-acquisition project running under Linux, you’ll be pleased to know Microstar Laboratories, National Instruments, and United Electronic Industries (UEI) now bundle Linux device-driver software with their hardware. UEI provides free PowerDAQ tools that port the company’s data-acquisition boards from Windows to Linux. National Instruments offers a Linux port of its LabView software (Figure 2). But you can’t expect 100% cross-platform compatibility for OS-dependent features. Specifically, ActiveX capabilities don’t exist under Linux, so LabView’s 3-D graphing and automated report-generator facilities are restricted to the Windows version. NI compensates by providing HTML report-generation tools in its Linux version of LabView.
You can use Linux as an operating system for cross-development tools, too. If you plan to build test systems that rely on an embedded processor, you can download GNU cross-compilers that produce code for many types of microprocessors. And you can get a free real-time operating system (RTOS), courtesy of US taxpayers. RTEMS is an RTOS originally developed for the US Army Missile Command by On-Line Applications Research Corp. The company offers the RTEMS open-source code and documentation on its Web site. You can build the RTOS for your application using the standard GNU autoconf utility and standard GNU tools.
Commercial embedded-system tools include Red Hat’s EDK (embedded development kit) for x86 and PowerPC targets (starting at $200) and the LynuxWorks Blue Cat RTOS adaptation of Red Hat Linux ($299). If you’re familiar with Microsoft Visual C++, you’ll feel right at home using LynuxWorks VisualLynux to develop Blue Cat Linux applications under Windows.
You may need a license
Even though many Linux development tools cost little or nothing, remember to inspect the license conditions for any software you install. Licenses for commercial products generally spell out what you can and can’t do with the software. In some cases, you can freely distribute code you develop using the tools. Other cases may require a license of some sort. Some licenses for freeware stipulate only nonprofit use. If you’re working on a commercial application, you may have to buy a version of the freeware software or license it from the owner for commercial use.
In any case, a freeware version will let you determine the software’s applicability before you worry about a license. Even when freeware doesn’t require a license, in most cases it comes with no support, although you can often get help through Internet forums and discussion groups.—David Marsh
Debugging gets difficult
Compared with debugging using Windows development tools, debugging Linux frustrates many developers. Worse, the standard GNU GDB debugger is next to useless for troubleshooting device-driver, embedded, or Linux-kernel code. The debugger works with application code, not with kernel-level code. Usually, investigating deeply embedded code in drivers or in the kernel requires “instrumenting” the target code by placing small code segments at critical execution points. These code fragments provide the debugger with information about the state of software and hardware at specific points in a program. This technique requires additional code compilation steps to include the “instrumentation” code. Running the added instrumented code affects real-time performance.
But the LynuxWorks SpyKer tool traces kernel and user-application events without requiring code instrumentation or special code libraries. The tool collects and displays time-stamped events in the OS’s kernel, libraries, and application code. The event data can help you understand what’s going on so you can locate performance bottlenecks. SpyKer ($1999) works with embedded Linux RTOSs and standard Linux and is available for the initial release of LynuxWorks’ flagship LynxOS.
Explain what you did
As you develop your application, you’ll need to document your work and distribute documents throughout your organization. Open-source business applications exist for the Gnome and KDE desktops, but currently they cannot easily exchange data with Windows applications. You can obtain Windows import/export capabilities in Corel, WordPerfect Office 2000 (standard, $99; deluxe, $149); Sun StarOffice 5.2 ($39.95 with CD-ROM and documentation, free to download); and VistaSource Applixware Office 5.0 ($50). I use StarOffice and find that files transfer virtually seamlessly between the Linux and Windows applications. StarOffice also includes a desktop environment and a Web browser that you might prefer when you get fed up with Netscape. Also, check out the free Opera Web browser now available in a beta version for Linux. Opera is fast, easy to customize, and in my experience, more stable than many other browsers.
When you use Linux as your OS, you still may need to run Windows 95/98 programs from your Linux desktop. If so, try VMware, a program that places a virtual Windows PC on your computer and gives a PC full file-system and peripheral access to each OS. You pay a performance penalty when using a virtual PC, but the functionality is intact: The virtual environment even supports multiple concurrent network connections. You can download VMware Express ($79) or buy it in a shrink-wrapped package ($99).
Finally, don’t forget to back up your work: Even Linux machines fail. I use PowerQuest’s Drive Image ($69.95) to back up Linux and Windows partitions. (I also use the company’s PartitionMagic to manage partitions in both OSs). You can boot Drive Image from a DOS floppy, back up your partitions, and then boot Windows to transfer the backup data to another PC or CD-ROM.
Support for CD-ROM creation is patchy in Linux, but the free X-CD-Roast package promises to change this situation. Currently at version 0.98, X-CD-Roast binary code supports LinuxPPC, Red Hat, and SuSE distributions; you can compile source code for other Linux distributions.
If you favor tape over CD-ROMs, you can use tape drives with backup software such as Enhanced Software Technologies’ BRU and Knox Software’s Arkeia. Both commercial products operate with multiple computers (prices start at $300). You can download a freeware version of Arkeia to support a backup server and two client machines. T&MW
1. Rowe, Martin, “Control Instruments With a Web Browser,”Test & Measurement World, September 2000. p. 30.
For more information
For more information
Ivchenko, Alex, “Get Those Boards Talking Under Linux, Part 1,”Test & Measurement World , May 2000. p. 36.
Ivchenko, Alex, “Get Those Boards Talking Under Linux, Part 2,”Test & Measurement World , June 2000. p. 47.
Marsh, David, “The Ins and Outs of Linux Kernel Device Drivers,”Test & Measurement World , October 15, 2000. p. 24.
Marsh, David, “Linux Applications Cruise with New Drivers,”Test & Measurement World , April 15, 2000. p. 6.
Marsh, David, “Linux: A Worthy OS for Real Applications,”Test & Measurement World , October 15, 1998. p. 18.
David Marshis a freelance writer with more than 20 years experience in the electronics industry. He designs and develops systems for motorsports including F1, CART, and GT sportscar projects. He also works as a contributing editor for EDN magazine. E-mail: email@example.com.
|Sources of development tools, utilities, and information|
Cross-compilers for embedded processors
Electronics engineering resources
Links to Linux applications
Links to Linux development tools
Linux distributions updates
www.lwn.net (Look under “Distributions”)
Freeware and shareware
Cygnus Source Navigator
Cygwin tools & Cygnus GNU-WIN32
Embedded/Extensible C (EiC)
Linuxconf and NT2Linux
Online Applications Research Corp.’s RTEMS RTOS
Opera Web browser
Samba and Swat networking
Webmin admin/config tool
X-CD-Roast CD-ROM utility
XEmacs graphical editor
Enhanced Software Technologies (EST)
LinuxPPC (Linux for the Power PC)
Red Hat and Cygnus
United Electronic Industries (UEI)