memory

Constraining Dynamic Memory Fragmentation

Introduction When developing Embedded Software for memory constrained microcontrollers (typically using Embedded C), the most common constraint is the memory – in particular, RAM is often the most constrained resource. This issue is further exacerbated when using a multithreaded operating system, where many threads are running simultaneously – each allocates some RAM for its stack. This leaves very little memory for static allocation and for doing other tasks. Many projects are also constrained by quality guidelines Read more…

By Bryan Jarmain, ago
code comprehension

Back to Basics Source Code Comprehension

Good Software diagramming is the practice of documenting the essential parts of your source code that are not already clear (such as the underlying structure), or that are hidden by the other details. After having been dissatisfied with any single automated tool, good diagramming turns out to be more of an art form as I go back to basics and discover a combination of common and free tools and techniques that yield very satisfying results.

By Bryan Jarmain, ago
code comprehension

Avoid the abuse of Function Pointers in C

When programming in an environment that discourages the use of function pointers, one may find it difficult not to violate some of the common programming principals. I will be covering one common use of function pointers which is very often better avoided, especially when writing firmware for memory constrained systems such as many types of IoT-based products.

By Bryan Jarmain, ago
Quality

How to Scale C Unit Testing

Unit testing C code generally has some significant challenges when compared to some other languages. The main difficulty is that it can be quite difficult to test the outcome of a function call and how it has interacted with other modules and functions. This is because the state of the module is not always accessed (if not stored), or can be complicated to predict if there is a lot of logic. What can make your code Read more…

By Bryan Jarmain, ago
Code Structure

Refactoring Trend in IDEs, why I think its so Important

I don’t rate myself as much of an expert in IDEs, refactoring, history of programming, or in my ability to observe trends, but I still find these topics fascinating and I have had a bit of experience evaluating different products (mainly relating to C development) and will make an attempt at presenting my viewpoint. This is really just based on my own worm’s eye view of what is going during my few short years of observations, hindsight, past fallacies and many Read more…

By Bryan Jarmain, ago
Code Structure

Scan-depends – a Useful little Script to Visualize C Code Structure

Introduction When writing multi-file C application, or inheriting a project others have worked on, it is always helpful to understand how the code is structured from a file level. Ideally, you want to try to keep module dependencies running in a single direction, limiting reverse dependencies. Keeping the code structure in check can help tremendously in reducing bugs and improving code maintainability. Although there are some brilliant tools for helping you to analyze the structure of your code Read more…

By Bryan Jarmain, ago
Quality

How we got to using Google Test (GTest) for Unit Testing our C Code

When we decided to improve our coding quality by introduced unit testing to our work process in order to test our C code. The concept was new to many of the engineers who programmed in C, and there was a perception amongst some (developers as well as managers) that it makes development slower with all the associated overhead. However, experience told us that without a solid set of scaffolding around the code to ensure code rot and Read more…

By Bryan Jarmain, ago
Quality

Design by Contract (DbC) for Embedded Systems: Best Practices

Introduction Writing bug-free code is something we all strive for, but its almost impossible to meet this lofty goal with nontrivial programs. There are many different tools and techniques that can help to get us a lot closer to this goal [and more quickly] – one should use a combination of these because they are complementary, each one strengthening our code from a different angle. The technique I am going to cover is Design by Contract Read more…

By Bryan Jarmain, ago