Category: Programming


Bash Cookbook

Bash Cookbook

I’ve been slowly making my way through O’Reilly’s Bash Cookbook: Solutions and Examples for Bash Users, 2nd edition, by Carl Albing & JP Vossen. It’s a great book but is enormous and not really structured for reading from beginning to end, as much as for referring to to solve a specific problem. I doubt I will ever finish it.  But, there are a lot of great factoids in there!  Last year, I read Packt’s Mastering Embedded Linux Programming, second edition, by Chris Simmonds, as well as Embedded Linux Development Using Yocto Project, second edition, by Alex Gonzalez (both of which I should do reviews on), and picked up a few of the commands I mention below in those books.

I learned Unix shell commands first on a DEC Vax 11-780 starting about 1984 at college, and then more over time using various distros of Linux from maybe 1997 onward. I’ll admit that most of what I know about ‘sh’ and ‘bash’ are from long ago.

View full article »

Linux System ProgrammingRecently I’ve undertaken a period of deep study related to Linux in all its aspects, but especially for embedded programming. While I’ve used Linux off and on professionally and privately for at least 18 years, my knowledge has always been just enough to get by.

View full article »

Rust

Rust Logo

I’ve programmed embedded systems for most of the last 40 years. And of those 40, 30 were using C. (Oh My God…) C is like an old friend to me… but I’m growing restless and uneasy. I’m sorry C, but we’re growing apart. “What have you done for me lately?”

View full article »

I tend to use gcc and gcc-derived tools quite often in my work; examples include the Arduino environment, LPCXpresso, and WinAVR. While not the best compiler in the world performance-wise, it wins hands down when you factor in its portability, ubiquity, and stability — as well as cost.

Sometimes weird stuff happens though. Recently I upgraded my main desktop machine from Windows XP to Windows 7. Since then, I have been unable to run any of the above toolchains successfully. What gives?

Turns out the problem was caused by a recent installation of a gcc toolchain, Ride7, from Raisonance, for the EM Micro 6819 processor family. That’s right, one gcc toolchain killed 3 others!

The solution (at least to make the first 3 work again) was to remove the GCC_EXEC_PREFIX environment variable that Ride7 created. Turns out that is a variable used in older gcc implementations that now causes havoc with newer ones. And Ride7’s gcc is OLD! 2.80! Current gcc versions are in the 4.3 range or higher.

Despite my initial fear that the trouble was Windows 7 itself, it turned out to be a combination of things — I never tried those other tools again after installing Ride7.

Here’s an example of formatting code:

public class Hello {
   public static void main(String[] args) {
      System.out.println("Hello World!");
   }
}