EmbeddedRelated.com

Massimiliano Pagani (@maxpagani)

Max started coding back in the 80s when computers were laughably slow, never had enough RAM, and used tape recorders as storage memory. Since then, he never stopped writing bugs and other features. He worked in the video game industry, had some exposure to server and service development, got fascinated by functional programming, and spent several years writing firmware and embedded software. When he is struck by something he reckons interesting, and has enough spare time, he writes on his blog at https://www.maxpagani.org/.

Finite State Machines (FSM) in Embedded Systems (Part 4) - Let 'em talk

Massimiliano Pagani May 22, 20244 comments

No state machine is an island. State machines do not exist in a vacuum, they need to "talk" to their environment and each other to share information and provide synchronization to perform the system functions. In this conclusive article, you will find what kind of problems and which critical areas you need to pay attention to when designing a concurrent system. Although the focus is on state machines, the consideration applies to every system that involves more than one execution thread.


Finite State Machines (FSM) in Embedded Systems (Part 3) - Unuglify C++ FSM with DSL

Massimiliano Pagani May 7, 2024

Domain Specific Languages (DSL) are an effective way to avoid boilerplate or repetitive code. Using DSLs lets the programmer focus on the problem domain, rather than the mechanisms used to solve it. Here I show how to design and implement a DSL using the C++ preprocessor, using the FSM library, and the examples I presented in my previous articles.


C++ Assertion? Well Yes, But Actually No.

Massimiliano Pagani April 8, 2024

Assertions are a double-edged sword - on one side you enforce program correctness catching bugs close to their origin, on the other your application is subject to run-time error, like any interpreted language. This article explores what C++ can offer to get the advantages of assertions, without risking the crashes by moving contract checking at compile time.


Finite State Machines (FSM) in Embedded Systems (Part 2) - 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.


Finite State Machines (FSM) in Embedded Systems (Part 1) - There's a State in This Machine!

Massimiliano Pagani February 5, 20244 comments

An introduction to state machines and their implementation. Working from an intuitive definition of the state machine concept, we will start with a straightforward implementation then we evolve it into a more robust and engineered solution.


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.


Indeed this cannot be a general strategy for dynamic memory management. What I am suggesting is to leverage the pattern of allocation/deallocation of your objects,...
Can you elaborate this part what did you meant by "domain knowledge"?The idea is that a general allocator must work with any order of allocation/deallocations and...
@lgacnik97Possibly a general approach to memory management either shares the same issues new/delete (or malloc/free) have or requires a very large pool from where...
Hi, there are already great replies, I would like to add that - the problem with dynamic memory (in general, but more relevant for resource-constrained systems),...

Use this form to contact maxpagani

Before you can contact a member of the *Related Sites:

  • You must be logged in (register here)
  • You must confirm you email address