Click here to learn
about this Sponsor:
Home  |  News  |  Articles  |  Forum

  Home arrow Linux For Devices Articles arrow Existential (embedded Linux) programming

Existential (embedded Linux) programming
By Linux Devices

Rate This Article: Add This Article To:

A man who carries a cat by the tail learns something he can learn in no other way. -- Mark Twain I strongly believe that we learn best by doing, that what you know is a synthesis between what you have studied and what you have accomplished.

While there is no substitue for reading, attending classes and good mentorship, you will never know a field until you undertake a project and grapple with the details.

I had a physics professor, Dr. Reid, who taught "Mathematical Methods for Physics", which was a great class. My favourite part was "complex functional analysis", where we dealt with contour(path) integrals, complex residues and the like (see details). Rather abstract stuff, but it had practical applications.

Dr. Reid had a saying:

The process of learning physics is an active process. The information does not enter the brain through the eyes and ears alone, but rather it takes a slow journey through your fingers and hands, up your arm and into your brain.

In other words you actually need to work the homework problems to understand the material.

Indeed.

You cannot create experience. You must undergo it.
-- Albert Camus

All of this makes me think of programming as an existential process. I cannot, however, claim to have invented the term existential programming (damn!). I don't think anyone agrees on what it really is, but the University of Kansas offers this course. My own interpretation is somewhat broader than this.

The type of programmer you are depends on the types of programs you have written and the programs you are writing now. Choose carefully and seize your destiny.

It Takes a Project

With philosophy and education as my guides it is time to embark on a project to truly learn the ins and outs of embedded programming. It would have been nice if my day job coincided exactly with my programming goals, but it did not. Not quite.

I am not down playing the useful experience I gain from my day job, but the goals here were a little different. The day job is all about embedded programming for the VxWorks operating system -- in my heart of hearts I wanted to do GNU/linux embedded programming. Sitting around wishing and hoping I would do GNU/linux programming would have been foolish.

So once again I made some investments in my future. I decided to teach myself embedded GNU/linux programming by reading books, mailing-lists and by purchasing a small embedded processor board.

My first goal was to boot linux on the board. This proved to be a wonderful journey.

At first this was a little daunting -- where to begin? What board to buy, what GNU/linux distribution to use, what books to read... What to buy and what to build myself? I went to the neighborhood technical bookstore and browsed the shelves looking for interesting books as a starting point. I found two that I highly recommend for different reasons:
  • Embedded Linux: Hardware, Software and Interfacing -- Craig Hollabaugh, 2002. ISBN 0-672-32226-9
  • Linux Device Drivers, 2nd Edition -- Alessandro Rubini & Jonathan Corbet, 2001. ISBN 0-596-00008-1
Let me tell you a little bit about these books:

Embedded Linux is a great hands on book. What I really like about it is that the author leads you through the design and development of a complete system (not just a single computer) that spans three different processor architectures -- PowerPC, ARM and x86. This is great because the different architectures expose different parts of the linux kernel.
I will not bore you with a complete review of the book as a good review is already written here. Craig Hollabaugh also has a nice website that serves as a companion to his book.

It is a really great book. The author covers topics like portability as he shows how to write the same device driver for the three different target architectures. It really helps to see a problem solved in three different ways. Highly recommended.

Also Craig was very responsive to questions I emailed him as I went through booting my board for the first time. Very nice.

Linux Device Drivers, 2nd Edition is also a really great book. First off it is released under the GNU Free Documentation License and is freey available online from O'Reilly. I recommend buying the book as paper is so much easier to read.

It covers writing device drivers for standard 2.4 kernels targeted for the Intel x86 architecture. It does not cover embedded GNU/linux, however it does cover the kernel and device drivers in great detail. A very valuable resource.

Information's pretty thin stuff unless mixed with experience.
-- Clarence Day


After reading most of Craig's book I was ready to purchase a board and get busy. To make my life a little easier I decied to stick to the same processor architecture I used at my day job, the Motorola PowerPC.

I purchased a RPX_Lite from EmbeddedPlanet, which has a blindingly fast (not) 80MHz 823e PowerPC processor with 16MB of RAM. It's pretty cute, a 3 inch square that includes ethernet, USB, serial and a PCMCIA slot. Just right for experimenting. This board is similar to the RPX_Classic that Craig uses in his book.

Next I needed a GNU/linux distrubtion to use with my board. This is not as easy as it sounds and Craig's book leads the way. The first thing you need is a cross-compiler for your board, so that you can build all the executables that your board will need. This includes not only the kernel, but all the supporting GNU software (cp, rm, ls, etc.).

It is a lot of work to build a linux distribution from source. It is much easier to use a pre-built distribution for your board. This is what companies like Lineo, MontaVista and LynuxWorks are selling. See here for a good overview of embedded linux distributions.

Also I hit my first bump in the road when I realized my processor did not have a Floating Point Unit (FPU). Most available GNU/linux distributions for the PowerPC assumed you were running GNU/linux on a MacIntosh, whose processor do have an FPU. Those binaries would not work for me.

It looked like I was going to build everything myself...

Experience is not what happens to you; it is what you do with what happens to you.
-- Aldous Huxley

Until I found the perfect distro for my needs called the "Embedded Linux Development Kit" (ELDK) from DENX Software Engineering in Germany.

The ELDK comes with pre-built binaries for a range of PowerPC processors including my version. This includes the cross-compiling GCC toolchain and hundreds of pre-compiled programs and utilities that come with GNU/linux.

Oh and the ELDK is GPL and available for free download. The price is right.

I must give special thanks to Wolfgang Denk (owner of DENX), who helped me numerous times via email and patiently answered my neophyte questions. Companies selling a commercial product should envy the customer support I recieved from Wolfgang -- above and beyond my expectations. Truly awesome.

Now with the ELDK in hand I was quickly able to configure and build my kernel. I was getting tantalizingly close to my goal of "booting the board". All I wanted to see was the first login prompt from my little board coming to me over a serial connection. I desperately wanted to see the results of "uname -a" as proof that the board was up and running GNU/linux.

Since the board has a limited amount of memory I decided to mount the root filesystem over NFS -- this allowed me to have access to all the programs of the ELDK (100s of megabytes). I had to setup an NFS server and configure the kernel to mount root via NFS.

Once that was completed the moment of truth was at hand:

Linux/PPC load:
Uncompressing Linux...done.
Now booting the kernel
Linux version 2.4.4 (curt@hongkong) (gcc version 2.95.4 ...) ...
Calibrating delay loop... 63.89 BogoMIPS
Memory: 14752k available (904k kernel code, 364k data, 48k init, 0k highmem)
eth0: CPM ENET Version 0.2 on SCC2, 00:10:ec:00:32:d6
VFS: Mounted root (nfs filesystem) readonly.
INIT: version 2.78 booting
Remounting root filesystem in read-write mode:
Mounting proc filesystem: [ OK ]
Configuring kernel parameters: [ OK ]
Activating swap partitions: [ OK ]
Checking filesystems [ OK ]
Mounting local filesystems: [ OK ]
Enabling swap space: [ OK ]
INIT: Entering runlevel: 3

hoho login: root
Last login: Thu Jan 1 00:00:36 on console

hoho:~# uname -a
Linux hoho 2.4.4 #10 Sat Jan 11 14:40:07 PST 2003 ppc unknown

hoho:~# ping www.ucdavis.edu
PING www.ucdavis.edu (169.237.104.199) from 10.0.0.9 : 56(84) bytes of data.
64 bytes from 169.237.104.199: icmp_seq=0 ttl=51 time=79.617 msec
64 bytes from 169.237.104.199: icmp_seq=1 ttl=51 time=69.767 msec

hoho:~# cat /proc/cpuinfo
processor : 0
cpu : 8xx
clock : 64MHz
bus clock : 32MHz
revision : 0.0
bogomips : 64.39
zero pages : total: 0 (0Kb) current: 0 (0Kb) hits: 0/0 (0%)

Sweet! It was working. My first project was complete -- the board booted.

Life must be understood backwards. But it must be lived forward.
-- Soren Kierkegaard

Now that the board booted I need a new goal, something embedded. Fun fun fun.

Cheers, Curt



Resources

Recommended Books . . . Recommended URLs . . .
Copyright Copyright © 2003 by Curt Brune. Verbatim copying and distribution of any and all portions of this article is permitted in any medium, provided this notice is preserved.



About the author:   Curt Brune has been plunking around with computers since 1978 when his father brought home that fatefull Apple ][+. In 1995 with a freshly minted physics degree he entered the computer business writing mapping software for GPS car navigation systems. Riding the wave in 1999 he co-founded WorkSpot, Inc., offering remote linux desktops through a web browser and architechting wireless PalmOS solutions for eBay, AT&T, and Barnes&Noble. Currently Curt hacks embedded system code for a gamma-ray research satelite called GLAST, a joint project between NASA and Stanford University's Linear Accelerator Center.




Discuss Existential (embedded Linux) programming
 
>>> Be the FIRST to comment on this article!
 
 
 
>>> More Linux For Devices Articles Articles          >>> More By Linux Devices
 



FUEL Database on MontaVista Linux
Whether building a mobile handset, a car navigation system, a package tracking device, or a home entertainment console, developers need capable software systems, including an operating system, development tools, and supporting libraries, to gain maximum benefit from their hardware platform and to meet aggressive time-to-market goals.

Breaking New Ground: The Evolution of Linux Clustering
With a platform comprising a complete Linux distribution, enhanced for clustering, and tailored for HPC, Penguin Computing¿s Scyld Software provides the building blocks for organizations from enterprises to workgroups to deploy, manage, and maintain Linux clusters, regardless of their size.

Data Monitoring with NightStar LX
Unlike ordinary debuggers, NightStar LX doesn¿t leave you stranded in the dark. It¿s more than just a debugger, it¿s a whole suite of integrated diagnostic tools designed for time-critical Linux applications to reduce test time, increase productivity and lower costs. You can debug, monitor, analyze and tune with minimal intrusion, so you see real execution behavior. And that¿s positively illuminating.

Virtualizing Service Provider Networks with Vyatta
This paper highlights Vyatta's unique ability to virtualize networking functions using Vyatta's secure routing software in service provider environments.

High Availability Messaging Solution Using AXIGEN, Heartbeat and DRBD
This white paper discusses a high-availability messaging solution relying on the AXIGEN Mail Server, Heartbeat and DRBD. Solution architecture and implementation, as well as benefits of using AXIGEN for this setup are all presented in detail.

Understanding the Financial Benefits of Open Source
Will open source pay off? Open source is becoming standard within enterprises, often because of cost savings. Find out how much of a financial impact it can have on your organization. Get this methodology and calculator now, compliments of JBoss.

Embedded Hardware and OS Technology Empower PC-Based Platforms
The modern embedded computer is the jack of all trades appearing in many forms.

Data Management for Real-Time Distributed Systems
This paper provides an overview of the network-centric computing model, data distribution services, and distributed data management. It then describes how the SkyBoard integration and synchronization service, coupled with an implementation of the OMG¿s Data Distribution Service (DDS) standard, can be used to create an efficient data distribution, storage, and retrieval system.

7 Advantages of D2D Backup
For decades, tape has been the backup medium of choice. But, now, disk-to-disk (D2D) backup is gaining in favor. Learn why you should make the move in this whitepaper.

Got a HOT tip?   please tell us!
Free weekly newsletter
Enter your email...
PLATINUM SPONSORS

 


ADVERTISEMENT


Check out the latest Linux powered...

Mobile phones!

MIDs, UMPCs
& tablets

Mobile devices

Other cool
gadgets

Resource Library

• Unix, Linux Uptime and Reliability Increase: Patch Management Woes Plague Windows Yankee Group survey finds IBM AIX Unix is highest in ...
• Scalable, Fault-Tolerant NAS for Oracle - The Next Generation For several years NAS has been evolving as a storage ...
• Managing Software Intellectual Property in an Open Source World This whitepaper draws on the experiences of the Black Duck ...
• Open Source Security Myths Dispelled Is it risky to trust mission-critical infrastructure to open source ...
• Bringing IT Operations Management to Open Source & Beyond Download this IDC analyst report to learn how open source ...




Most popular stories -- past 90 days:
· Linux boots in 2.97 seconds
· Tiniest Linux system, yet?
· Linux powers "cloud" gaming console
· Report: T-Mobile sells out first 1.5 million G1s
· Open set-top box ships
· E17 adapted to Linux devices, demo'd on Treo650
· Android debuts
· First ALP Linux smartphone?
· Cortex-A8 gaming handheld runs Linux
· Ubuntu announces ARM port


DesktopLinux headlines:
· Simulator runs Android apps on Ubuntu
· Hypervisor rev'd for higher reliability
· Pluggable NAS now supports Linux desktops
· Moblin v2 beta targets netbooks
· Linux-ready netbook touted as "Student rugged"
· USB display technology heading for Linux
· Ubuntu One takes baby step to the cloud
· Game over for Linux netbooks?
· Linux Foundation relaunches Linux web site
· Dell spins lower-cost netbook


Also visit our sister site:


Sign up for LinuxForDevices.com's...

news feed


Or, follow us on Twitter...