<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dirk Jan ten Kate on Medium]]></title>
        <description><![CDATA[Stories by Dirk Jan ten Kate on Medium]]></description>
        <link>https://medium.com/@dj.ten.kate?source=rss-89a0b2dbf5f4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KMKYkStbFZ9025HvuzPLzg.jpeg</url>
            <title>Stories by Dirk Jan ten Kate on Medium</title>
            <link>https://medium.com/@dj.ten.kate?source=rss-89a0b2dbf5f4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:37:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dj.ten.kate/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Embedded software 2.0: The wrong reasons to (not) do unittests]]></title>
            <link>https://medium.com/@dj.ten.kate/embedded-software-2-0-the-wrong-reasons-to-not-do-unittests-ad1e89719bdb?source=rss-89a0b2dbf5f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad1e89719bdb</guid>
            <dc:creator><![CDATA[Dirk Jan ten Kate]]></dc:creator>
            <pubDate>Wed, 07 Feb 2024 10:07:30 GMT</pubDate>
            <atom:updated>2024-02-07T10:08:01.497Z</atom:updated>
            <content:encoded><![CDATA[<p>Unittests and embedded software development have a somewhat strange relationship. Where in other software disciplines unittests seem to be part of the development process, in embedded software development it still does not seem to be part of the development process even though the year is already 2024.</p><h3>Mindset</h3><p>This is one of the worst reasons not to do unittests. Some embedded software engineers simply do not make mistakes and write perfect code (including past me). Do I need to point out the wrong reason here? Obviously not. Other embedded software engineers think they do not need to do them because it is very hard to do it on the hardware. The reality here is that it is harder to do it, but only because you need to make assumptions about how the hardware functions. But, in my opinion, still not a valid argument not to do them.</p><h3>Time</h3><p>If working for a client the cost is a very important factor for the client. The client always wants a bargain and asks for a lower cost. To adhere to this question the most common thing teams and organisations try to do is leave out the unittests. Writing code and unittests take time and in the end the client only needs the code. So, why not leave the unittests out? In the end the customer will probably still pay the same amount of money because bugs need to be fixed anyway, some which may even be caused by fixing other bugs. With no unittests there is of course no safety net to prevent introducing new bugs.</p><h3>Metrics</h3><p>In industries like medical or automotive some metrics like branch coverage play an important role in the quality of the software. The problem here is that the branch coverage does not immediately measure of proof the presence or absence of bugs. Still, embedded software engineers are being forced to adhere to a certain percentage of coverage. If due to already aforementioned reason (Mindset) the software engineer does not really want to write the unittests you will get bad tests. These bad tests can even lead to, in extreme cases, tests without any asserts just to reach the percentage of the branch coverage metric.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad1e89719bdb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embedded software 2.0: Abstraction]]></title>
            <link>https://medium.com/@dj.ten.kate/embedded-software-2-0-abstraction-c42cf109eebb?source=rss-89a0b2dbf5f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c42cf109eebb</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[firmware]]></category>
            <category><![CDATA[embedded]]></category>
            <dc:creator><![CDATA[Dirk Jan ten Kate]]></dc:creator>
            <pubDate>Wed, 07 Sep 2022 19:13:33 GMT</pubDate>
            <atom:updated>2022-09-07T19:13:33.318Z</atom:updated>
            <content:encoded><![CDATA[<p>Now, you might think that I’m going to convince to use abstraction in embedded software. No, I’m not, this choice is totally up to you if you use it or not. Instead, I want to focus on the cost of abstraction because there is cost tied to abstraction in any case.</p><p>The cost of abstraction might not directly have impact on a developer because more work is of course more fun! But to a customer or an employer abstraction can be costly because it takes time to put the abstraction in place. And you know what they say: time is money. Now, saving money by leaving out the abstractions obviously leads to tightly coupled design where implementation details are interwoven between software components. Keeping in mind that the complexity of embedded systems are rapidly increasing this might not be the best road to take to design your software.</p><p>On the short term abstractions might be costly but on the long term it might be an investment which pays itself back a so-called ROI (Return-on-investment).</p><p><strong>Global chip shortages</strong></p><p>The insecurity of availability of hardware is a huge problem all of us are struggling with on a daily basis. Long lead times are the talk of the day in the supply chain. This is where abstractions to the hardware can bring a solution to a sudden turn of events in regards to hardware changes. With the right set of abstractions to the hardware a change of crystal (with a different frequency) might be a matter of hours in software changes and a change of a memory chip might only take a couple of days.</p><p><strong>Hardware Abstraction Layer</strong></p><p>Many software engineers use a so-called Hardware Abstraction Layer (HAL), which offers a general interface to middleware but has a specific hardware implementation. Migrating applications from one chip to another would mean that switching out the HAL would be sufficient. Well, in theory, but it still saves time compared to middleware or application which is directly coupled to implementation details of the hardware.</p><p><strong>Maintainability</strong></p><p>As much as we want to create bug-free software it’s unfortunately not a reality. So, we are stuck with the responsibility to solve bugs and it’s not that all bugs happen directly. Oh no, some take even years to occur. Good luck with that if your design is tightly-coupled without abstraction. Having abstractions in place also leads indirectly to a separation of concerns and also leads to better maintainable code. And maintainable code decreases the introduction of new bugs when fixing known bugs.</p><p><strong>Re-usability</strong></p><p>If you are working in a product development company most likely there are multiple projects you are working on. And most likely there are similarities between multiple products, so from a business point of view it makes sense to reuse software components between products. Unfortunately, all products are different so having abstractions into the uncertain factors give you the advantage of reusable software.</p><p>So, the above reasons you can take into consideration when thinking about the cost of abstraction in the short term against the long term. My advice is to always go for the extra mile and put the abstraction in place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c42cf109eebb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embedded systems and the advantage of C++ for driver development]]></title>
            <link>https://medium.com/@dj.ten.kate/embedded-systems-and-the-advantage-of-c-for-driver-development-cb9338afaa84?source=rss-89a0b2dbf5f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb9338afaa84</guid>
            <dc:creator><![CDATA[Dirk Jan ten Kate]]></dc:creator>
            <pubDate>Tue, 10 May 2022 18:45:51 GMT</pubDate>
            <atom:updated>2022-05-10T18:45:51.567Z</atom:updated>
            <content:encoded><![CDATA[<p>C++ use to be absolutely “not done” in the embedded industry back in the old days. Nowadays, the stigma against C++ in the microcontroller programming is changing, also with the help of better optimizing compilers.</p><p>Let me give you some advantages of using C++ for driver development:</p><p>1. Classes, encapsulating functions and data in combination with object instantiation. E.g. creating an object for every UART is much more maintainable than passing around structs in C functions.</p><p>2. Constructors (and destructors), registers and hardware can be initialised in the constructor. During object instantiation it is done “automatically”, there is no necessity for a seperate “XXX_init”-function</p><p>3. References, no more null-pointers! References are “pointers” to objects which need to exist, so it means no joking around with pointers anymore. We even use a reference to the driver peripheral registers.</p><p>4. Scope-based resource management (aka SBRM), we use simple structs to unlock registers in the constructor and lock the registers again in the destructor. During the lifetime of the struct registers which can only be configured in the unlock state are set.</p><p>Bonus: for some drivers it is not even necessary to keep the objects, you can instantiate e.g. a timer driver on the stack. The constructor will set all the registers and when the object goes out of scope the registers still remain set!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb9338afaa84" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>