January 04, 2003

Back To School – Part II

The first six months were rough -- so much new information. While most of the computing terms were familar so many electronics terms left me in the dark. I had heard of programming concepts like spin-lock, semaphore, ISR, inter-locked linked list ... but I had never used them, therefore I really did not know them.

SRAM, DRAM, SDRAM -- Do you know the difference? I didn't and everybody else did. Processor data cache lines, memory subsystems (what is a single beat read anyway?), LVDS drivers, pull-up resistor, bias voltage, tri-state logic, BSP, VHDL. It was like hearing a foreign language in a bad dream -- you recognized the words, but you have no idea what they mean and everyone around you nods knowingly.

On top of all the electronics terms were all the physics, mathematics and statistics terms. What's a Poisson distribution? A chi-square? Probalistic histogram? Hmmm, college calculus class was over 10 years ago ....

So I began re-educating myself. I found a couple of handy technical dictionaries on the web:

How did that last one sneak in there? It's a good one to have anyway.

These links helped hide some of my ignorance, but honestly when the conversation was 30,000 ft over my head I just asked questions. The answers were always forthcoming -- no funny looks.

Another area were I thought I knew something, but realized quickly that I didn't, is C compilers. I had programmed a lot and written dozens of C programs, but I never gave much thought to the compiler (or the linker for that matter). One piece of advice for life in the embedded world:

Know Thy Compiler and Toolchain

Never before had the destinctin between operating system and architecture mattered. Now I understood that you can have differenet operating systems on the same hardware architecture (e.g. linux and Windoze running on i386 hardware) and you can have the same operating system running on different architectures (like linux running on i386 and on PowerPC).

In our project the data acquisition system software runs the VxWorks operating system for the PowerPC architecture (our computers are 3U CompactPCI single board computers based on the Motorola PowerPC microprocessor). I in no way endorse VxWorks as a hard real time operating system (RTOS). The company behind VxWorks, WindRiver, is the Microsoft of the embedded OS world. I will not say another word about VxWorks -- it is the hand I was delt.

If you are just starting out look seriously into running linux on your embedded system. If you have "hard real time" requirements consider using the real time extentions to linux. Linux on the small devices is here to stay.

Motorola, on the other hand, is great. They give away (as in free) tons of documentation about their processors. They will even mail you printed manuals for their processors, for free. Very useful. Try their document search.

In our work we cross compile the programs for the embedded system. Briefly cross compiling is when you run the compile/link stage on one OS (e.g. Solaris), but the resulting binary is for a different OS/Architecture (VxWorks on PowerPC). For a more detailed treatment of cross-compiling for the PowerPC using the GNU Compiler Collection see here.

Also read up on GCC in general, particularly the sections about GNU extentions to C and C++. Some of these are quite useful.

In our testing we try to exercise our code as much as possible before downloading it to the embedded processors. To this end we cross-compile our code for three different platforms:


  • VxWorks on PowerPC -- the real system
  • Solaris on UltraSPARC -- development system
  • Linux on i386 -- development system

While we cannot debug everything on the development system (some tests must run on the real embedded system), we can flush out many compile time bugs by pushing our code through three seperate compile/link stages. Sometimes different compilers for different architectures catch different bugs and warnings.

I could write an entire article about the compile/link process we use -- but I won't do that here, unless people are interested. I find it interesting.

The first part of my re-education is well underway. I was getting a good handle on my tools. It is very important that a craftsman understand the benefits and limitations of his tools.

Now I needed a project to work on ...

Posted by curt at January 4, 2003 08:51 PM | TrackBack
Comments

Hmmm..now what the hell is is the difference between SRAM, DRAM, and SDRAM. You know.., i can swear on god that i *did* study those things in my college, probably in "Computer Architecture" or some such course.

I remember reading a complete tutorial on spin-locks more than 3 years ago. But i don't really remember now what it is.

I also remember clearly now, the first week in my college(somewhere in southern india) where i was doing my undergrad in comp sci., some of us approached a senior and asked him something about academics(i don't remember what it was we asked him, but i remember his response.., which was.."To know something truly well, don't just go about reading it. First think of a problem which involves that, try to think of a solution to the problem, or atleast what kind of things should be involved in such a solution, then get the book and read it and solve the original problem".

Seven and half years after he told me this, i realize how invaluable the advise would have been, if i only had followed it. Seven of years of reading and re-reading, i finally now know i don't really know anything until i *work* on it, until i do it to "scratch my own itch".

I hope its not too late, But i have already begun my re-education, this time i will do it the way it needs to be done.

I admire your courage in publishing your stories. Please keep them coming. Its a comforting feeling that somebody else has already taken this path.

Posted by: Danny on January 5, 2003 09:25 AM

Craig:

> I could write an entire article about
> the compile/link process we use -- but
> I won't do that here, unless people
> are interested. I find it interesting.

I too find it interesting and would like to read about your process.

Would you please write it up and post it when you have a chance?

Thanks,
Pat

Posted by: Pat Connery on January 12, 2003 06:03 AM
Post a comment