## Tenderfoot: Embedded Software and Firmware Specialties

Once upon a time (seven years ago) I answered a question on Stack Overflow. Then Stephane suggested I turn that answer into a blog post. Great idea! This post dives deeper into the original question: “Is it possible to fragment this field (embedded software and firmware) into sub-fields?”

This post represents a detailed and updated response to my original Stack Overflow answer. I hope this post provides guidance and useful information to the “tenderfoots” in the audience....

## Embedded Toolbox: Source Code Whitespace Cleanup

August 5, 2017

In this installment of my "Embedded Toolbox" series, I would like to share with you the free source code cleanup utility called QClean for cleaning whitespace in your source files, header files, makefiles, linker scripts, etc.

You probably wonder why you might need such a utility? In fact, the common thinking is that compilers (C, C++, etc.) ignore whitespace anyway, so why bother? But, as a professional software developer you should not ignore whitespace, because it can cause all sorts...

## Embedded Toolbox: Windows GUI Prototyping Toolkit

In this installment of my "Embedded Toolbox" series, I would like to interest you in the free Windows GUI Toolkit called QWin for prototyping, developing and debugging embedded C or C++ code on Windows.

If you work on devices with non-trivial user interfaces consisting of LCDs (segmented or graphic), buttons, LEDs, etc., QWin could be just the tool for you. It has improved my productivity in such projects dramatically. I personally consider it a gem in my "Embedded...

June 28, 20171 comment

Twenty years ago I read Code Complete by Steve McConnell. And then read it again. And again. And again. Of all the books I have read during my career, I believe this was the book that catapulted me from a young electrical engineer to a young and aspiring embedded software engineer. So to all the ‘tenderfoots’ embarking upon an embedded systems and especially embedded software and firmware career, this entry is for you.

## Embedded Toolbox: Programmer's Calculator

Like any craftsman, I have accumulated quite a few tools during my embedded software development career. Some of them proved to me more useful than others. And these generally useful tools ended up in my Embedded Toolbox. In this blog, I'd like to share some of my tools with you. Today, I'd like to start with my cross-platform Programmer's Calculator called QCalc.

## Tenderfoot: Introduction to Magic (Numbers that is...)

May 10, 20171 comment

Once upon a time, while participating in a source code review, I stumbled across the following C code in a header file:

struct Foo { //various structure fields char string_buffer[45+3]; //buffer requires about 45 bytes };

My right eyebrow raised, I took a note, and continued with the code review, only to later stumble into this line of code in the body of a C function:

char * temp_string_buffer = (char*) malloc(45+3);

Again, I took a note on this function, and continued...

## Donald Knuth Is the Root of All Premature Optimization

TL;DR

The idea, basically, is that even though optimization of computer software to execute faster is a noble goal, with tangible benefits, this costs time and effort up front, and therefore the decision to do so should not be made on whims and intuition, but instead should be made after some kind of analysis to show that it has net...

## Zebras Hate You For No Reason: Why Amdahl's Law is Misleading in a World of Cats (And Maybe in Ours Too)

February 27, 20171 comment

I’ve been wasting far too much of my free time lately on this stupid addicting game called the Kittens Game. It starts so innocently. You are a kitten in a catnip forest. Gather catnip.

And you click on Gather catnip and off you go. Soon you’re hunting unicorns and building Huts and studying Mathematics and Theology and so on. AND IT’S JUST A TEXT GAME! HTML and Javascript, that’s it, no pictures. It’s an example of an

## Favorite Tools: C++11 std::array

February 27, 2017

Many embedded software and firmware projects must be developed to high standards of reliability. To meet these reliability requirements, firmware project teams will consider many design tradeoffs. For example, an engineering team may avoid or outright ban the use of dynamic memory allocation, a feature typically accessed via the C library call "malloc" or the C++ allocator "new". When authoring software under such...

## Vala applications on Embedded Linux: maybe a clever choice [part 1]

December 19, 2016

Vala is a sexy, open source, high level programming language that appeared in 2006, it counts with a modern typing system, is object oriented, compiled and statically typed, it has a almost identical syntax to C# and is maintained by GNOME. The language was created as a power abstraction of the GLib and GTK libraries, two considerably lightweight and powerful libraries written in C, and it is used in projects such as GNOME Clocks, Shotwell, GXml and Elementary OS.

namespace...

## Using the Beaglebone PRU to achieve realtime at low cost

Introduction

I work as an engineer in a synchrotron facility. A few weeks ago, I helped the people in charge of the power supply developments to integrate a realtime control algorithm on a prototype platform: a BeagleBone Black (BBB) running Linux. I had already worked with this board in the past, and I found it very interesting given its excellent resources versus price ratio (around 40 euros). This time, I was impressed by its realtime capabilities. I thought it would be a good idea to...

## Coroutines in one page of C

A coroutine is a function that you can jump back into after returning from it - and it remembers where it was in the code, and all the variables. This is very useful at times.

One use is generating a sequence of values. Here's how you can generate all the x,y pairs in a 2D range in Python:

def iterate(max_x, max_y): for x in range(max_x): for y in range(max_y): yield x,y for x,y in iterate(2,2): print x,y

This prints:

0 0 0 1 1 0 1 1

The yield keyword is like...

## Chebyshev Approximation and How It Can Help You Save Money, Win Friends, and Influence People

Well... maybe that's a stretch. I don't think I can recommend anything to help you win friends. Not my forte.

But I am going to try to convince you why you should know about Chebyshev approximation, which is a technique for figuring out how you can come as close as possible to computing the result of a mathematical function, with a minimal amount of design effort and CPU power. Let's explore two use cases:

• Amy has a low-power 8-bit microcontroller and needs to compute $\sqrt{x}$...

## 10 Software Tools You Should Know

Unless you're designing small analog electronic circuits, it's pretty hard these days to get things done in embedded systems design without the help of computers. I thought I'd share a list of software tools that help me get my job done. Most of these are free or inexpensive. Most of them are also for working with software. If you never have to design, read, or edit any software, then you're one of a few people that won't benefit from reading this.

Disclaimer: the "best" software...

## Using the C language to program the am335x PRU

Introduction

Some weeks ago, I published an article on how we used the PRU to implement a power supply control loop having hard realtime constraints:

//www.embeddedrelated.com/showarticle/586.php

Writing this kind of logic in assembly language is not easy. First the assembly language itself may be difficult to learn depending on your background. Then, fixed and floating point arithmetics require lot of code. While macros help to handle the complexity, they still are error prone as you...

## Important Programming Concepts (Even on Embedded Systems) Part I: Idempotence

There are literally hundreds, if not thousands, of subtle concepts that contribute to high quality software design. Many of them are well-known, and can be found in books or the Internet. I’m going to highlight a few of the ones I think are important and often overlooked.

But first let’s start with a short diversion. I’m going to make a bold statement: unless you’re a novice, there’s at least one thing in computer programming about which you’ve picked up...

## C++ on microcontrollers 1 - introduction, and an output pin class

This blog series is about the use of C++ for modern microcontrollers. My plan is to show the gradual development of a basic I/O library. I will introduce the object-oriented C++ features that are used step by step, to provide a gentle yet practical introduction into C++ for C programmers.  Reader input is very much appreciated, you might even steer me in the direction you find most interesting.

I am lazy. I am also a programmer. Luckily, being a lazy...

## VHDL tutorial - A practical example - part 2 - VHDL coding

May 27, 2011

In part 1 of this series we focused on the hardware design, including some of the VHDL definitions of the I/O characteristics of the CPLD part.  In part 2, we will describe the VHDL logic of the CPLD for this design.

With any design, the first step to gather the requirements for the job at hand.  From part 1 of this article, I have copied two sections that address some of the requirements for the CPLD design.

The data acquisition engine has the...

## Data Hiding in C

Strictly speaking, C is not an object-oriented language. Although it provides some features that fit into the object-oriented paradigm it has never had the full object-oriented focus that its successor C++ offers. C++ introduced some very useful concepts and abilities that I miss when I’m developing in ANSI C. One such concept is protected member variables and functions.

When you declare a class in C++ you can also declare member variables and functions as part of that class. Often, these...

## Embedded Toolbox: Programmer's Calculator

Like any craftsman, I have accumulated quite a few tools during my embedded software development career. Some of them proved to me more useful than others. And these generally useful tools ended up in my Embedded Toolbox. In this blog, I'd like to share some of my tools with you. Today, I'd like to start with my cross-platform Programmer's Calculator called QCalc.