Firmware Update - September 7, 2010
In this issue:
-- Free CRC Implementation Code in C and C++
-- Free Embedded C Coding Standard Book
-- Free Fast Accurate Memory Test Suite in C
-- Free Binary Literal Macros in C

Firmware Update is a free newsletter by embedded software expert Michael Barr. It is Copyright 2010 by Netrino, LLC, but may be reprinted for non-commercial purposes. Please forward it to colleagues who may benefit from the information.

Free CRC Implementation Code in C and C++
Cyclic redundancy codes (CRCs) are among the best checksums available to detect and/or correct errors in communications transmissions. Unfortunately, the modulo-2 arithmetic used to compute CRCs doesn't map easily into software. Writing CRC code yourself is not easy and is definitely a waste of time when you can use free code instead.

Back in 1999, I developed and published an efficient high-level language implementation of the popular CRC-16, CRC-32, and CRC-CCITT checksums. I subsequently wrote a popular three-part article about checksums and CRCs for Embedded Systems Programming magazine. You can still find these articles, as well as the C and C++ source code in the public domain.

Steal this code...

Free Embedded C Coding Standard Book
Coding Standard Book Cover It is cheaper and easier to prevent bugs from creeping into embedded software than it is to find and kill them once they have entered. A key strategy in the fight against bugs is to write code in which the compiler, linker, or a static analysis tool can automatically detect bugs--before the code is even downloaded to ROM. Netrino's Embedded C Coding Standard book teaches simple practical rules you can follow to keep bugs out of embedded software.

Everyone who attends the October 18-22 public session of the Embedded Software Boot Camp receives a free copy of my coding standard book. In addition, you'll learn:

  • More than 50 practical tips for reducing bugs in embedded software (including all of the ten most common firmware flaws),
  • How to decide if an RTOS is a good fit to your application,
  • How to architect embedded software properly from the start, and
  • How to write portable device drivers and interrupt handlers entirely in C.
The week-long workshop consists of lectures and half a dozen small programming exercises plus one large capstone project. All hands-on projects target an ARM processor using the IAR Embedded Workbench compiler and J-Link debugger tools. The multithreaded exercises use Micrium's popular MicroC/OS-II RTOS, for which C source code is provided.

Register early to save 25%...

Free Fast Accurate Memory Test Suite in C
One piece of software that nearly every firmware developer must write at some point in his career is a memory test. Often, once the prototype hardware is ready, the board's designer would like some reassurance that he has wired the address and data lines correctly, and that the various memory chips are working properly. Even if that's not the case, it is desirable to test any onboard RAM at least as often as the system is reset. It is up to the embedded software developer, then, to figure out what can go wrong and design a suite of tests that will uncover potential problems.

At first glance, writing a memory test may seem like a fairly simple endeavor. However, as you look at the problem more closely you will realize that it can be difficult to detect subtle memory problems with a simple test. In fact, as a result of programmer na´vetÚ, many embedded systems include memory tests that would detect only the most catastrophic memory failures. Incredibly, some of these may not even notice that the memory chips have been removed from the board!

So why not save yourself a headache and steal the C source code that I developed in my Master's thesis work in way back in 1997. This code has been used by me in many products, as well as by thousands of your firmware engineer peers.

Also steal this code...

Free Binary Literal Macros in C
A couple of years ago, Netrino engineer Dan Smith was writing stepper motor control firmware that interfaced to lots of registers with binary fields and sub-fields. After fiddling around with error-prone "off by 1 bit shift" masking and conversion from binary to hexadecimal literals in C, he happened across a useful post on a forum.

In a nutshell, the "binary literal" technique is based on a set of C preprocessor macros named B8(), B16(), and B32(). No error-prone conversion to hexadecimal necessary and no figuring out which bits belong to which nibbles. And for efficiency, all the math is done at compile-time.

Steal this code too...

Quick Links...
  • Free Embedded Industry News
  • Free Embedded Book Recommendations
  • Free Embedded Systems Glossary
  • Free Embedded Gurus Blog Network

  • Contact Us...
    phone: 866.78.EMBED
    Email Marketing by