Embedded systems worst practices?

Uninitialized exception vectors (you know, for the ones that “will never be reached”) Say it with me: Global variables. Especially ones shared between ISRs and tasks (or foreground loops) without protection. Failure to use “volatile” where necessary. Having routines that DisableInterrupts() and then EnableInterrupts() paired up. Got that? Not RestoreInterrupts(), but ENABLE. Yeah, nesting. No … Read more

How do you design a serial command protocol for an embedded system? [closed]

I have some preferences (and pet peeves) from writing software to control media and display devices using RS232. Depending on your hardware, some of these may not apply: I think it’s a good idea to make your protocol more friendly for automation. If you need an interactive interface (command line or other), build it separately … Read more

Looking for an efficient integer square root algorithm for ARM Thumb2

Integer Square Roots by Jack W. Crenshaw could be useful as another reference. The C Snippets Archive also has an integer square root implementation. This one goes beyond just the integer result, and calculates extra fractional (fixed-point) bits of the answer. (Update: unfortunately, the C snippets archive is now defunct. The link points to the … Read more

What is the difference between RTOS and Embedded Linux? [closed]

Linux is a general-purpose OS (GPOS); its application to embedded systems is usually motivated by the availability of device support, file-systems, network connectivity, and UI support. All these things can be available in an RTOS, but often with less broad support, or at additional cost or integration effort. Many RTOS are not full OS in … Read more