We're hiring!

We're actively seeking developers & designers for our new Detroit location. Learn more

Implementing Advanced Math Functions

Almost every standard library (in almost every programming language) comes with a set of advanced math functions (sin(), cos(), sqrt(), arctan(), etc…). However, (very) occasionally you need an implementation of these functions more closely tuned to your use case. How does one go about implementing these functions? This post attempts to explain how!

Posted in Embedded Software | Tagged , , , , | 7 Comments

Simple Fixed Point Math

I recently needed to implement a simple fixed point math library, and found that there were few good online resources on how to implement one and that many of the simple free implementations had subtle errors. I decided to distil out a few details I would have liked to have had when I started.

Posted in Design & Development, Embedded Software | Tagged , | 2 Comments

How to write good requirements

Requirements are pretty ubiquitous in the embedded world. They are used to define tasks, help coordinate large development efforts, and to communicate the behavior of the desired end product between the developers and the customer. When done right, requirements can be very useful. Unfortunately, if you spend much time working in the embedded world you…

Read More »

Posted in Embedded Software | Tagged , , | 16 Comments

Using CMock when C is oversensitive

CMock is an extremely useful tool that can make testing C programs nearly painless. Employing CMock is usually straightforward, but here are a few common sticking points and ways to work around them:

Posted in Design & Development, Embedded Software, Testing, Tools | Tagged , , , , , | Leave a comment

C Tips and Tricks Part II

Why you really should put const on the right side of your uint32_t In my last installment of this series, I mentioned how C types “read” from right to left, and that const/volatile types are easier to read if you keep the const/volatiles on the right side of the types that they modify. I stopped…

Read More »

Posted in Embedded Software | 1 Comment

C Tips and Tricks Part I

C is a finicky language that takes some extra care to avoid shooting yourself in the foot. This is part I in a series covering some tips, best practices and common pitfalls when working with C. This post focuses on how to construct constant and volatile pointers, and how to avoid a common pitfall when…

Read More »

Posted in Embedded Software, Languages | Tagged | 3 Comments

Code Parsimony and the Perils of Over Abstraction

“Make things as simple as possible, but not simpler.” – Common (but good) misquote of Einstein. The more I code, and especially the more I work on other peoples code, the more I think that simplicity is one of the most critical aspects of quality software. By simplicity I mean conceptual simplicity. That the code is easy…

Read More »

Posted in Design & Development, Embedded Software | Leave a comment

How to write a compiler in an afternoon

The tools for compiler construction have gotten so good that building a JIT or native code compiler for a custom language can be written in just a few hours.  I’ve implemented an example compiler in about 220 lines of Haskell. It has a fair amount of commentary so it shouldn’t be too hard to follow. The toy…

Read More »

Posted in Languages, Tools | 2 Comments

Needed: A better language for embedded systems programming

The C programming language is currently the accepted industry standard for embedded programming. Occasionally you’ll get C++ or Ada, but the vast majority of work in the field is C. For applications that don’t require interfacing directly with hardware, developers have, for the most part, abandoned C in favor of languages that are more expressive and less error prone. However, C…

Read More »

Posted in Embedded Software, Languages | 9 Comments