Debugging Your Application

When applied to an embedded Linux application, the term debugging cycle refers to the steps necessary to build the software, move it to the workbench machine, boot the workbench machine under the new version, and get the running software to the point where you’re currently developing or debugging. The shorter the debugging cycle, the faster you can develop. In a typical environment, you may end up running through the debugging cycle several dozen times in a given day, so it’s wise to spend some time and money shortening the debugging cycle.

Sometimes debugging cycles can be really short; the best case is when you’re using an interpreted language. You save the code and run the application right away. Other times you may have to do some time-consuming task such as burn the code into a PROM before the debugging cycle is complete.

When developing any embedded application, the most time-consuming activity usually is waiting while the computer creates the boot media, and then waiting again for that media to load on the workbench computer. I’ve found that the best way to shorten this debugging cycle is to use a product such as VMware and run the software on a virtual machine within the development machine. That’s exactly what I did to develop the sample applications for this book. Before using VMware, I had to create floppy disk images and then use the Linux dd command to dump the images out to a floppy drive. After that was done, I would take the floppy out of the development machine and boot the workbench computer from it. The entire cycle took about five minutes, from the time I was done editing source to the time I was running the application, limiting me to about 12 rebuilds an hour. Using VMware, I don’t have to move any media from place to place; the build script takes care of moving the image to the proper place for VMware. I just run the build script and then power up the VMware machine when the image is ready. The whole process takes just under 1½ minutes, allowing me to do more than 40 rebuilds per hour.

Of course, you don’t just rebuild over and over again, but there are distinct advantages to having a quick debugging cycle:

  • Higher productivity

  • Better retention of the programmer’s “working set” of knowledge about a problem

The other advantage to using VMware is that you don’t actually have to get access to more hardware to build another machine. And since the virtual machines can be networked together and to the outside world, they can act very much like the real machine you’re building.

Of course, the VMware machines won’t have access to specialized hardware in your production machine, so they can’t usually be used for the entire development process. But if you start by using this technique and move away from it only when you have to start integrating with the real hardware, you can save a lot of time to market.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.198.49