EmbeddedRelated.com

Handling Translations in an Embedded Project

Mattia Maldini October 13, 20234 comments

A brief walkthrough on how to handle human language translations in a low level C application. Some options are listed, each with advantages and disadvantages laid out.


There are 10 kinds of people in the world

Colin Walls September 27, 2023

It is useful, in embedded software, to be able to specify values in binary. The C language lacks this facility. In this blog we look at how to fix that.


Embedded Developers, Ditch Your IDEs – Here’s Why!

Amar Mahmutbegovic September 25, 20231 comment

Ditching your Integrated Development Environment (IDE) temporarily can be a transformative learning experience in embedded development. This post invites you to explore the underpinnings of IDEs by delving into alternative tools and processes like Makefile, CMake, Vim, GDB, and OpenOCD. Understanding these tools can demystify the background operations of IDEs, revealing the intricacies of compiling, linking, and debugging. This journey into the “under the hood” aspects of development is not just about learning new tools, but also about gaining a deeper appreciation for the convenience and efficiency that IDEs provide. By stepping out of your comfort zone and experimenting with these alternatives, you can sharpen your skills, enhance your knowledge, and possibly discover a more tailored and streamlined development experience. Whether you're a novice or a seasoned developer, this exploration promises insights and revelations that can elevate your embedded development journey.


New book on Elliptic Curve Cryptography

Mike August 30, 20234 comments

New book on Elliptic Curve Cryptography now online. Deep discount for early purchase. Will really appreciate comments on how to improve the book because physical printing won't happen for a few more months. Check it out here: http://mng.bz/D9NA


Getting Started With Zephyr: Devicetree Bindings

Mohammed Billoo August 16, 2023

This blog post shines some light on how devicetrees are used in The Zephyr Project. Specifically, we understand the mechanisms that enable us to use nodes in the devicetree in the C source files. We use a sample provided in the Zephyr repository itself and work our way through portions of the Zephyr codebase to get insight into the mechanisms that make this possible.


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


Why Should Unit Tests Feel Like Simulations?

Amar Mahmutbegovic July 23, 2023

Unit tests are designed to test units of software, but what exactly is a unit of software? It can be a function or a method, a class, or even an entire module. 

If you're just starting with unit testing, chances are you're testing the implementation of a function or a method. Consequently, if the implementation changes, you must update your tests as well, which can render the entire process pointless. This is often the case with small pieces of code, particularly in embedded development,...


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.


Bellegram, a wireless DIY doorbell that sends you a Telegram message

Sergio R Caprile July 9, 2023

A wireless button that uses the M5 STAMP PICO and Mongoose to send a Telegram message when pressed. The code is written in C


C to C++: 3 Proven Techniques for Embedded Systems Transformation

Jacob Beningo February 7, 20234 comments

For 50 years, the C programming language has dominated the embedded software industry. Even today, more than 80% of embedded projects are using C; however, over the last few years, many teams have begun transitioning from C to C++. C++ offers embedded developers a robust, modern set of tools that can be used to write flexible, scalable, and reusable applications. As embedded applications become more complex and connected, teams need a more modern language to help them deal with the software...


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.


C to C++: Templates and Generics – Supercharging Type Flexibility

Jacob Beningo March 24, 20242 comments

"C to C++: Templates and Generics – Supercharging Type Flexibility" illuminates the rigidity of C when managing multiple types and the confusion of code replication or macro complexity. In contrast, C++ offers templates, acting as type-agnostic blueprints for classes and functions, which allows for the creation of versatile and reusable code without redundancy. By using templates, developers can define operations like add once and apply them to any data type, simplifying codebases significantly. Generics further this concept, enabling a single code structure to handle diverse data types efficiently—a boon for embedded systems where operations must be performed on varying data, yet code efficiency is critical due to resource limitations. The blog walks through practical applications, showcasing how templates streamline processes and ensure type safety with static_assert, all while weighing the pros and cons of their use in embedded software, advocating for careful practice to harness their full potential.


A Beginner's Guide to Embedded Systems

Manasi Rajan December 6, 2022

I was in my Junior year of college when I first learned about embedded systems. Sure, I’d heard about this mystical world of sensors and IoT, the same way I’d heard about thermonuclear astrophysics; But, the phrase “embedded systems” didn’t really mean anything to me. This, here, is a guide for people like teenage me. We’re going to learn what an embedded system actually is, and why working on embedded software is the coolest thing you could ever do!

What's an embedded...

Simple C++ State Machine Engine

Massimiliano Pagani March 14, 2024

When implementing state machines in your project it is an advantage to rely on a tried and tested state machine engine. This component is reused for every kind of application and helps the developer focus on the domain part of the software. In this article, the design process that turns a custom C++ code into a finite-state machine engine is fully described with motivations and tradeoffs for each iteration.


Lightweight C++ Error-Codes Handling

Massimiliano Pagani November 16, 20232 comments

The traditional C++ approach to error handling tends to distinguish the happy path from the unhappy path. This makes handling errors hard (or at least boring) to write and hard to read. In this post, I present a technique based on chaining operations that merges the happy and the unhappy paths. Thanks to C++ template and inlining the proposed technique is lightweight and can be used proficiently for embedded software.


Working with Strings in Embedded C++

Niall Cooling June 1, 20233 comments

This article discusses the use of strings in embedded systems. It explains how the need for and use of strings in embedded systems has changed with the advent of cheaper, full graphic displays and the growth of the ‘Internet of Things’ (IoT). The article also covers character literals, C-Strings and string literals, and the difference in memory models between them. It also highlights the safety and security issues that arise from using strings in embedded systems. Finally, it explains how C++11 introduced a Raw string literal type that is useful for storing file paths or regular expressions.


The volatile keyword

Colin Walls April 1, 20245 comments

Although the C keyword volatile is very useful in embedded applications, care is needed to use it correctly and vigilance is required to ensure its correct implementation by compilers.


Why Should Unit Tests Feel Like Simulations?

Amar Mahmutbegovic July 23, 2023

Unit tests are designed to test units of software, but what exactly is a unit of software? It can be a function or a method, a class, or even an entire module. 

If you're just starting with unit testing, chances are you're testing the implementation of a function or a method. Consequently, if the implementation changes, you must update your tests as well, which can render the entire process pointless. This is often the case with small pieces of code, particularly in embedded development,...


Getting Started With Zephyr: Devicetree Bindings

Mohammed Billoo August 16, 2023

This blog post shines some light on how devicetrees are used in The Zephyr Project. Specifically, we understand the mechanisms that enable us to use nodes in the devicetree in the C source files. We use a sample provided in the Zephyr repository itself and work our way through portions of the Zephyr codebase to get insight into the mechanisms that make this possible.