EmbeddedRelated.com

Bit-Banged Async Serial Output And Disciplined Engineering

Steve Branam August 3, 2023

This post covers implementing asynchronous serial output directly on a GPIO with bit-banging. This can be a valuable debug tool for getting information out of a system. It also covers disciplined engineering, using the bit-banging module as an example and template you can apply to other projects.


Assembly language is best - except when it isn’t

Colin Walls July 27, 20231 comment

A look at why writing in C often produces more efficient code than hand-written assembly language.


C to C++: 5 Tips for Refactoring C Code into C++

Jacob Beningo July 23, 20235 comments

The article titled "Simple Tips to Refactor C Code into C++: Improve Embedded Development" provides essential guidance for embedded developers transitioning from C to C++. The series covers fundamental details necessary for a seamless transition and emphasizes utilizing C++ as a better C rather than diving into complex language features. The article introduces five practical tips for refactoring C code into C++. Replace #define with constexpr and const: Discouraging the use of #define macros, the article advocates for safer alternatives like constexpr and const to improve type safety, debugging, namespaces, and compile-time computation. Use Namespaces: Demonstrating the benefits of organizing code into separate logical groupings through namespaces, the article explains how namespaces help avoid naming conflicts and improve code readability. Replace C-style Pointers with Smart Pointers and References: Emphasizing the significance of avoiding raw pointers, the article suggests replacing them with C++ smart pointers (unique_ptr, shared_ptr, weak_ptr) and using references


Getting Started With Zephyr: Devicetrees

Mohammed Billoo July 18, 20232 comments

This blog post provides an introduction to the "Devicetree", another unique concept in The Zephyr Project. We learn about the basic syntax of a device tree and how its structure and hierarchy mirror hardware, from the SoC to the final board. We also see how hardware described in a devicetree can be referenced and controlled in the source code of a Zephyr-based application.


NULL pointer protection with ARM Cortex-M MPU

Miro Samek July 16, 2023

This post explains how you can set up the ARM Cortex-M MPU (Memory Protection Unit) to protect thy code from dragons, demons, core dumps, and numberless other foul creatures awaiting thee after thou dereference the NULL pointer.


Getting Started With Zephyr: Kconfig

Mohammed Billoo June 22, 2023

In this blog post, we briefly look at Kconfig, one of the core pieces of the Zephyr infrastructure. Kconfig allows embedded software developers to turn specific subsystems on or off within Zephyr efficiently and control their behavior. We also learn how we can practically use Kconfig to control the features of our application using the two most common mechanisms.


C to C++: Bridging the Gap from C Structures to Classes

Jacob Beningo May 23, 20238 comments

In our last post, C to C++: Proven Techniques for Embedded Systems Transformation, we started to discuss the different ways that C++ can be used to write embedded software. You saw that there is no reason to be overwhelmed by trying to adopt complex topics like metaprogramming out of the gate. An important concept to understand is that you can make the transition gradually into C++ while still receiving the many benefits that C++ has to offer.

One of the first concepts that a C...


The Missing Agile Conversation

Steve Branam May 15, 2023

In this article, we learn about Agile practices and how they use stories as units of development. Stories consist of a brief description, one to a few sentences. They don’t contain details sufficient to allow a developer to implement them. The Agile practice is to defer details as long as possible because conditions may change. When a developer takes on a story to implement, that’s the time for them to perform the work that has been deferred. They do this by having a conversation, a series of specific discussions working closely with the various SME’s (Subject Matter Experts) who have information relevant to the story.


STM32 VS Code Extension Under The Hood

Peter McLaughlin April 21, 2023

VS Code is becoming the "go to" environment for many developers. Increasingly, toolchain providers are publishing VS Code extensions and ST has recently followed suit. Additionally, CMake is significantly growing in popularity, with many projects adopting it for its ease of use and flexibility. This video shows how the STM32 VS Code extension works under the hood and how to get more out of it.

Specifically, we'll review the CMake files generated by the VS Code extension and how to modify...


Getting Started With Zephyr: West Manifest Customization

Mohammed Billoo April 4, 2023
Introduction

The Zephyr Project RTOS (https://zephyrproject.org/), or simply “Zephyr” as it is known colloquially, is an increasingly popular real-time operating system due to its native support for over 450 boards and countless peripherals. When starting with any embedded software project, the first task is to start from a known baseline. This can include cloning a repository from source control, which can be the case with embedded Linux, or downloading a zip file representing a...


Important Programming Concepts (Even on Embedded Systems) Part IV: Singletons

Jason Sachs November 11, 20142 comments

Other articles in this series:

Today’s topic is the singleton. This article is unique (pun intended) in that unlike the others in this series, I tried to figure out a word to use that would be a positive concept to encourage, as an alternative to singletons, but


Delayed printf for real-time logging

Yossi Kreinin October 25, 20133 comments

You often debug by adding a few printfs and looking at the logs. In some real-time/low-level contexts though, you don't have time for text formatting.

You don't want prints to affect timing too much, because then timing-related bugs you're chasing might disappear. And you certainly don't want the system to stop functioning altogether because prints cause it to miss real-time deadlines.

A common alternative to prints is more "raw" logging - an event buffer, where event is a union keeping...


Android for Embedded Devices - 5 Reasons why Android is used in Embedded Devices

Maharajan Veerabahu November 6, 20173 comments

The embedded purists are going to hate me for this. How can you even think of using Android on an embedded system ? It’s after all a mobile phone operating system/software. 

Sigh !! Yes I did not like Android to begin with, as well - for use on an Embedded System. But sometimes I think the market and needs decide what has to be used and what should not be. This is one such thing. Over the past few years, I have learned to love Android as an embedded operating system....


Lazy Properties in Python Using Descriptors

Jason Sachs November 7, 2017

This is a bit of a side tangent from my normal at-least-vaguely-embedded-related articles, but I wanted to share a moment of enlightenment I had recently about descriptors in Python. The easiest way to explain a descriptor is a way to outsource attribute lookup and modification.

Python has a bunch of “magic” methods that are hooks into various object-oriented mechanisms that let you do all sorts of ridiculously clever things. Whether or not they’re a good idea is another...


Ten Little Algorithms, Part 4: Topological Sort

Jason Sachs July 5, 20151 comment

Other articles in this series:

Today we’re going to take a break from my usual focus on signal processing or numerical algorithms, and focus on...


Important Programming Concepts (Even on Embedded Systems) Part II: Immutability

Jason Sachs September 14, 20141 comment

Other articles in this series:

This article will discuss immutability, and some of its variations in the topic of functional programming.

There are a whole series of benefits to using program variables that… well, that aren’t actually variable, but instead are immutable. The impact of...


Coding Step 1 - Hello World and Makefiles

Stephen Friederichs February 10, 20156 comments

Articles in this series:

Step 0 discussed how to install GCC and the make utility with the expectation of writing and compiling your first C program. In this article, I discuss how to use those tools we installed last time. Specifically, how to use GCC to compile a C program and...


From bare-metal to RTOS: 5 Reasons to use an RTOS

Jacob Beningo October 18, 20167 comments

Developers can come up with amazing and convoluted reasons to not use an RTOS. I have heard excuses ranging from they are too expensive (despite open source solutions) all the way to they aren’t efficient and use too much memory. In some circumstances some excuses are justified but there are many reasons why a developer should look to an RTOS to help with their real-time scheduling needs.

From bare-metal to RTOS Quick Links
  • Part 1: 

C Programming Techniques: Function Call Inlining

Fabien Le Mentec April 29, 20137 comments
Introduction

Abstraction is a key to manage software systems as they increase in size and complexity. As shown in a previous post, abstraction requires a developper to clearly define a software interface for both data and functions, and eventually hide the underlying implementation.When using the C language, the interface is often exposed in a header '.h' file, while the implementation is put in one or more  corresponding '.c' files.

First, separating an interface from its...


The CRC Wild Goose Chase: PPP Does What?!?!?!

Jason Sachs October 23, 20142 comments

I got a bad feeling yesterday when I had to include reference information about a 16-bit CRC in a serial protocol document I was writing. And I knew it wasn’t going to end well.

The last time I looked into CRC algorithms was about five years ago. And the time before that… sometime back in 2004 or 2005? It seems like it comes up periodically, like the seventeen-year locust or sunspots or El Niño,...