Steffen Ronalter

On Embedded Software, Engineering, Linux – and Coffee.

  • Bash Job Control

    When working on the command line, you may sometimes find yourself in a situation where you’d like to start a new program while another long-running process (e.g. an editor) is blocking the current terminal. In the course of this article we are going to find out how to achieve quick context switching in such a case, without the need for opening up an entirely fresh terminal window.

    (Reading time: 3 minutes)
  • Introduction To Readline

    When developing command line applications, you will most certainly want to have bash-like line-editing features. For that, an excellent choice is the GNU readline library. We will see in this article how to use its features from out own programs in order to provide a user experience similar to that of many free software projects out there.

    (Reading time: 4 minutes)
  • Non-Interactive Text Editing in Vim

    The Vim text editor has its roots in the traditional line-based editors of the early days. Due to that heritage, it supports a set of impressively powerful Ex commands that act on individual lines. In this article, we will see how to create a script composed of these commands and execute it from the shell.

    (Reading time: 3 minutes)
  • Vim Errorformat Challenge

    The Vim text editor provides built-in support for parsing compiler output. It has quite a broad understanding of the concept of a compiler though: You can call just any command and let the editor parse its output. For this to work correctly, format strings need to be specified, matching the expected format of compiler warnings and errors. This article is meant as a challenge for you, the reader. Does that sound interesting? Read on!

    (Reading time: 7 minutes)
  • Discovering Refactoring Needs

    This article is about creating a plot of complexity over change rate for a given set of source code files. According to an idea I’ve seen on twitter last week, this might help us finding spots in the code that have an influence on how well a project goes. Here I’d like to show you a quick demonstration of that idea.

    (Reading time: 3 minutes)
  • Maintaining A Clean History In Centralized Git Workflows

    Git is a powerful tool for versioning (not only) source code files. It is decentralized by design but also works perfectly for setups that rely on a central server. By using a standard pull/push workflow though, the central history can grow complex pretty fast. In this article we will look at a simple centralized git approach and try to come up with a solution for keeping the history clean and easy to understand.

    (Reading time: 9 minutes)
  • Linux Shebang Insights

    In Linux, you can execute an interpreted script file in exactly the same way as you would execute a compiled binary: by setting the ‘executable’ attribute and just run it. A special sequence of characters at the beginning of the script makes this possible. In this article we will explore how this – pretty elegant – way of script execution works and which components of the Linux system are involved.

    (Reading time: 5 minutes)
  • The Shell And The Whitespace

    When writing conditionals in shell scripts, have you ever wondered whether that whitespace right after the opening bracket is really necessary for the expression to evaluate correctly? You might be surprised by the answer we’ll discover in the course of this short article.

    (Reading time: 5 minutes)
  • What Makes A Unit Of Code Falsifiable

    In his recent book about Software Architecture, Robert C. Martin a.k.a. Uncle Bob describes programming as a discipline of science, rather than mathematics. In one of the first chapters of the book he talks about Structured Programming and how it enables us to produce – according to the scientific method – falsifiable, i.e. testable units of code.

    (Reading time: 5 minutes)
  • Thoughts on Python from a C++ developer’s viewpoint: Style

    This article is about Python style. Compared to the C++ world, there are pretty rigid conventions implemented in the language itself as well as in the Python ecosystem. That makes this topic kind of surprising and worth writing some lines about.

    (Reading time: 3 minutes)
  • Thoughts on Python from a C++ developer’s viewpoint: Interfaces

    In this episode I‘d like to highlight yet another Python fact I find particularly surprising. This article is about the design tool in Software Engineering: interfaces.

    (Reading time: 3 minutes)
  • Thoughts on Python from a C++ developer's viewpoint: Inside the interpreter

    In this second article of the series on Python we're going to cover some really great features of the interactive interpreter. We'll see that a full-fledged debugger may not even be necessary to get serious work done in Python.

    (Reading time: 3 minutes)
  • Thoughts on Python from a C++ developer's viewpoint: Class members

    In this series of articles I will present some random things I've noticed when I started studying the Python programming language a while ago. I'm actually not very experienced in the language yet, as I don't get in touch with it that often. But I think if you also do your programming mainly in C++ and tend to use Python now and then, this might be for you.

    (Reading time: 3 minutes)
  • Test-driven 7-Segment Decoder

    This article is about creating a 7-segment display decoder in software. While this is probably considered a rather trivial task, it will serve as a good example for the discipline of Test-Driven Development (TDD). The motivation for a test-driven approach in this case is simple: being able to refactor later without the need to debug on hardware.

    (Reading time: 10 minutes)
  • The bash debugger: an example

    Sometimes you may find yourself in a situation where you need to actually debug a shell script you're currently writing. Especially in the initial phase of development, features like single-stepping feel quite handy.

    I this article we are going to look at two situations where the bash debugger (bashdb) is a great tool for shell scripting. I will also show you one bashdb feature I find really surprising.

    (Reading time: 3 minutes)
  • AVR sleep mode for fun and profit (part 2)

    In the first part of this article we managed to put the AVR into power-down mode and were thereby able to lower the current consumption in idle mode to 0.0 mA. While this is great compared to the 22 mA before any optimization, there is no way to wake up the controller yet to do some actual work. This is what we're going to do in this episode.

    (Reading time: 4 minutes)
  • AVR sleep mode for fun and profit

    Today's blog article is about how to optimize the power consumption of an AVR microcontroller running on batteries.

    We're going to explore one of the ATmega32's sleep modes and how it affects power consumption. We will eventually reach a state where it actually makes sense to power the device from batteries. Besides sleeping, the microcontroller should do some work for us, requested by a single button press.

    (Reading time: 5 minutes)
  • TDD - Should I mock or should I not?

    Today I'm going to share an observation I made recently, related to Test-Driven Development (TDD).

    (Reading time: 4 minutes)
  • Test-driving the MCP2515 CAN Controller (Part 3): Taking a look at the SPI bus

    In this episode of the series we are going to focus a bit more on the target hardware. The driver code created during the previous two episodes is going to be compiled for the target microcontroller and programmed into flash memory. While it's only the reset functionality of the MCP2515 we can verify right now, I think it's a step into the right direction.

    (Reading time: 5 minutes)
  • Passing heavy C++ objects by value

    Big objects are traditionally passed to methods by reference. Some weeks ago I talked to a colleague about that and decided to investigate a bit further. As a result of my research I must admit that, starting with C++11, things have indeed changed. Depending on what happens inside the body of the called method, passing by value may be actually more efficient.

    (Reading time: 5 minutes)
  • Pulling a decent single Espresso shot from the Gaggia Classic

    Pulling one single Espresso from the Gaggia Classic? Where is the challenge here? As this was the first thing I tried to accomplish right after I got my home Espresso machine some months ago, I can confirm it's unfortunately not that easy as it seems. „Pulling singles is more difficult than pulling doubles.“ That’s what they tell you, and that's what I experienced as well.

    (Reading time: 4 minutes)
  • Background make execution in Vim 8

    Version 8 of the Vim text editor introduced a great new feature for executing processes asynchronously. In this article I'm going to show you a plugin that makes use of these async jobs and how I utilize them to build a C++ project in the background.

    (Reading time: 3 minutes)
  • Test-driving the MCP2515 CAN Controller (Part 2)

    It turns out the device driver design established previously has a serious drawback. While the SpiDriver interface enables unit testing, the cost of polymorphism has to be paid also in production code. In this article you are going to see how high that cost is, i.e. how much extra code the compiler actually generates for providing virtual methods. We will also introduce one possible solution to overcome that additional cost.

    (Reading time: 6 minutes)
  • Test-driving the MCP2515 CAN Controller (Part 1)

    So you are pretty much into Test-Driven Development (TDD)? You love to practice it on your development machine but think it might be quite a hassle when it comes to writing code for small microcontrollers?

    In this blog article we are going to take a journey to Embedded TDD using the MCP2515 Controller Area Network (CAN) controller as an example. We will begin to write a device driver for that particular controller without even having any working hardware at hand....

    (Reading time: 11 minutes)

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

subscribe via RSS