An Introduction to Embedded Linux Development, Part 4
This is the last part of our four-article series on beginning embedded Linux development. Our intent was to provide an introduction to the typical embedded Linux infrastructure so that a programmer familiar with working in a desktop environment also might become productive in an embedded environment. It should be stressed that reading this series does not mean the participant now is an embedded systems programmer; rather, we wanted to make the embedded environment more familiar. The desktop programmer should be able to work productively in the embedded environment, working on projects not much different than before. To gain deep familiarity with the hardware, which is the hallmark of the embedded systems programmer, is a much bigger step. Hopefully, though, this series might encourage some to embark on that journey.
We continue with the particular SBC that we used in Part 1, Part 2 and Part 3, the LBox from Engineering Technologies Canada Ltd. (Engtech). Despite the use of a specific SBC here, much of the material has broader application and should be useful generally for using the Background Debug Mode (BDM) with Motorola microcontrollers.
By the end of Part 2 of this series, we had the LBox up and running, ready to use for application development. In Part 3, we looked at
the memory organization and filesystem layout
replacing the kernel and root filesystem
replacing the JFFS2 filesystem
replacing the bootloader
Several of the netflash/reboot iterations discussed in Part 3 can leave the LBox in a non-functional state, if the transferred files are not correct. In particular, if the Linux image is bad, netflash is not available to access the workstation's tftp server. If the colilo binary is bad, we can't even start the boot process. To recover, we need an extra piece of hardware and some software components. They exploit the Background Debug Mode (BDM) provided in various Motorola processors, including the Coldfire family. In this article, we discuss the following topics:
BDM support installation
the GDB initialization file (.gdbinit)
using the BDM device
To restore a non-functional LBox, we must purchase another piece of hardware, the Coldfire Shielded BDM Interface, which has a small printed circuit board allowing it to connect to the LBox. The BDM Interface is available for $149 from P&E Microcomputer Systems, Inc. It connects by way of a parallel port cable from the workstation host to the LBox. It comes in a 3.3- and a 5.0-volt version. It also is available as a pass-through item from Engtech, the LBox vendor. The small printed circuit board is available from Engtech as well. It is quite inexpensive, with final prices dependent on quantity ordered. One of these setups then can be used as needed in support of multiple LBoxes, so the cost is amortized easily.
The BDM and appropriate support circuitry allows one to access the CPU, whatever the status of the bootloader. Hence, one can reconstruct the LBox from any state. The BDM allows you to load and start a kernel from memory, regardless of the whether the bootloader or kernel are working or even installed on the LBox device. The BDM package consists of two software components, a driver module for the hardware and a modified GDB program. The modified GDB program uses the BDM hardware driver to connect to the LBox.
With the LBox, Engtech provides a CD, which we used earlier in this series. If you haven't copied that CD to your workstation, do so now. We are going to use it now to install BDM support on the workstation. At the top level of the CD directory hierarchy we find the BDM directory. Carefully carry out the instructions in the file BDM_INSTALL within the BDM directory. We found no glitches in these instructions; they are quite explicit and trouble-free.
The next step in getting BDM support working is to load the BDM interface driver on your workstation. The driver is included among the utilities installed with the LBox toolchain. Because the interface to the LBox is by way of the parallel port, it is important to remove competing drivers (using rmmod, such as the driver modules lp or parport_pc, if they are installed. In order to install the BDM driver, type modprobe bdm on your workstation, as root. This loads the modules with a warning that the kernel has been tainted. This occurs because the module source hasn't specified the license, for example, MODULE_LICENSE("GPL"). This is not an issue here, so we continue.
To check that the driver is loaded, run the lsmod command. You should see the BDM module listed among other modules in the output. We might, for example, see something like:
bdm 24680 0 (unused)
|Designing Electronics with Linux||May 22, 2013|
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
- RSS Feeds
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Designing Electronics with Linux
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Validate an E-Mail Address with PHP, the Right Way
- What's the tweeting protocol?
- Kernel Problem
8 hours 26 min ago
- BASH script to log IPs on public web server
12 hours 54 min ago
16 hours 29 min ago
- Reply to comment | Linux Journal
17 hours 2 min ago
- All the articles you talked
19 hours 25 min ago
- All the articles you talked
19 hours 28 min ago
- All the articles you talked
19 hours 30 min ago
23 hours 54 min ago
- Keeping track of IP address
1 day 1 hour ago
- Roll your own dynamic dns
1 day 6 hours ago