Startups

Simplify debugging to reduce the complexity of embedded system development

Comment

Tangled mess of power leads and chargers
Image Credits: Marcus Lund (opens in a new window) / Getty Images

Nicolas Rabault

Contributor

Nicolas Rabault is co-founder and CEO of Luos, an open source startup that helps users develop scalable edge and embedded distributed software.

The complexity associated with the development of embedded systems is increasing rapidly. For instance, it is estimated that the average complexity of software projects in the automotive industry has increased by 300% over the past decade.

Today, every piece of hardware is driven by software and most hardware is composed of multiple electronic boards running synchronized applications. Devices have more and more features, but adding features means increasing development and debugging complexity. A University of Cambridge report found that developers spend up to 50% of their programming time debugging.

Thankfully, there are practical ways to reduce the complexity of debugging embedded systems. Let’s take a look.

Earlier is better

Bugs will pop up during the entirety of a product’s lifetime: in development, testing and in the field. Resolving a bug later down the road can increase costs by as much as 15 times and lead to user frustration, in addition to creating challenges associated with updating embedded devices that are in production.

However, identifying bugs at the early stages of your product’s development will allow you to track them while prioritizing them by severity. This will allow you to debug before other dependencies and variables are introduced later in the lifecyle, which makes bugs easier and cheaper to resolve.

Manage versioning

To properly replicate a bug, you must be able to have a device in the exact same state it was when the bug first appeared. With embedded devices, there are three distinct variables to look at when issues crop up:

  1. The software version. This is the version of each feature. This applies to the code you build as well as to potential dependencies, such as imported libraries.
  2. The board version. Specifically, the design of the board. Board design changes constantly as components are added/removed or moved around.
  3. Manufacturing. Which assembly line made the board and at what time? A unique serial number is usually used for every card.

When designing your code, anything that references one of these three elements must be made a variable. To manage this versioning granularity, you need a registry. Open source tool PlatformIO is a great way to do this.

Operationalize replicability

Once you can fully define a given device’s state, you must be able to replicate that state on a local device so that you can debug. To do that, you’ll need a script that will pull the required version, compile the right binaries and push them to your product.

Here is a code snippet containing a script I use for one of my projects.

Additionally, when you have a bug, you must find the simplest configuration that lets you reproduce it easily so you can limit the area of code you need to inspect. By managing your features independently, you can easily enable and disable each of them on your code.

The best way to achieve this is to compile every feature as a library, where each feature has an init and loop function — Arduino-style — that can be called from the main file.

Trace everything

Debugging will only be efficient if you have the right information. Traces, which log the low-level event of a program’s execution, are a must here. Both hardware and software features must generate traces for everything they do. Tools like Memfault (open source) or Freedom Robotics can help you get there.

While your device should constantly be generating traces, only when an issue occurs should traces be automatically saved and sent back to you so that you can analyze them. To be able to properly capture as many anomalies as possible, you must anticipate their types.

Anomalies come in different shapes and sizes with embedded devices — it might be a software issue, but it could also be hardware issues such as overheating, water damage or broken components. The sky’s the limit with embedded systems. For example, one of our customers is building articulated arm robots that perform sensitive maintenance operations in nuclear facilities, exposing the hardware to high levels of radiation, which can impact the hardware and software in random ways.

Ensure timeline consistency

Another key component of traces is timing. Because embedded devices are often made of multiple cards that have multiple inputs, such as sensors and user input, and outputs, such as engine and screen, it’s key to track timing so you can reconstruct a timeline of what happened.

The tracking needs to happen at the millisecond-level (sometimes even at the nanosecond-level), and each timing needs to be precisely aligned with other components. Timelines across components can drift because a device can have different microcontroller units (MCUs) that are started at different times, cadenced at different frequencies and have different temperatures.

There are two ways to ensure traces can be timed correctly.

One way is to synchronize time across different cards — to get a coherent timestamp of data across different nodes — by sending specific update messages. Depending on how much the timeline is drifting, you will need to adjust the frequency of those messages. But since this synchronization message needs a predictable latency to guarantee the accuracy of the date, devices generally need to stop every operation in the network to ensure that the latency will always be the same. This can be problematic for some products.

The new way of doing it, pioneered by a paper from the University of California, Berkeley, is to embrace latency and compute timelines based on it. Latency is a sum of delays, so by measuring delays across the product, latency can be calculated and a timeline can be reconstructed.

  • sourceLatency = communicationDate – dataGenerationDate
  • targetLatency = dataConsumingDate – communicationDate
  • networkLatency = propagationTime + IRQraise
  • totalLatency = sourceLatency + targetLatency + networkLatency

The advantage of this method is that it constantly produces consistent results without having to worry about the frequency of synchronization messages and without having to stop every other operation in the network. I’ve written a detailed paper on how to implement this methodology for embedded purposes.

Look for bug trends

Finally, with embedded projects, issues can often come from a specific part or assembly of the implementation. That is why keeping track of your bug history is important, as it allows you to identify trends of problematic areas or a set of devices that have a specific set of versions as quickly as possible.

Tools like Luos (open source) or Freedom Robotics can help you to accurately monitor the events that occur in your embedded system so you can resolve them more easily and quickly.

More TechCrunch

We just announced the breakout session winners last week. Now meet the roundtable sessions that really “rounded” out the competition for this year’s Disrupt 2024 audience choice program. With five…

The votes are in: Meet the Disrupt 2024 audience choice roundtable winners

The malicious attack appears to have involved malware transmitted through TikTok’s DMs.

TikTok acknowledges exploit targeting high-profile accounts

It’s unusual for three major AI providers to all be down at the same time, which could signal a broader infrastructure issues or internet-scale problem.

AI apocalypse? ChatGPT, Claude and Perplexity all went down at the same time

Welcome to TechCrunch Fintech! This week, we’re looking at LoanSnap’s woes, Nubank’s and Monzo’s positive milestones, a plethora of fintech fundraises and more! To get a roundup of TechCrunch’s biggest…

A look at LoanSnap’s troubles and which neobanks are having a moment

Databricks, the analytics and AI giant, has acquired data management company Tabular for an undisclosed sum. (CNBC reports that Databricks payed over $1 billion.) According to Tabular co-founder Ryan Blue,…

Databricks acquires Tabular to build a common data lakehouse standard

ChatGPT, OpenAI’s text-generating AI chatbot, has taken the world by storm. What started as a tool to hyper-charge productivity through writing essays and code with short text prompts has evolved…

ChatGPT: Everything you need to know about the AI-powered chatbot

The next few weeks could be pivotal for Worldcoin, the controversial eyeball-scanning crypto venture co-founded by OpenAI’s Sam Altman, whose operations remain almost entirely shuttered in the European Union following…

Worldcoin faces pivotal EU privacy decision within weeks

OpenAI’s chatbot ChatGPT has been down for several users across the globe for the last few hours.

OpenAI fixes the issue that caused ChatGPT outage for several hours

True Fit, the AI-powered size-and-fit personalization tool, has offered its size recommendation solution to thousands of retailers for nearly 20 years. Now, the company is venturing into the generative AI…

True Fit leverages generative AI to help online shoppers find clothes that fit

Audio streaming service TuneIn is teaming up with Discord to bring free live radio to the platform. This is TuneIn’s first collaboration with a social platform and one that is…

Discord and TuneIn partner to bring live radio to the social platform

The early victors in the AI gold rush are selling the picks and shovels needed to develop and apply artificial intelligence. Just take a look at data-labeling startup Scale AI…

Scale AI founder Alexandr Wang is coming to Disrupt 2024

Try to imagine the number of parts that go into making a rocket engine. Now imagine requesting and comparing quotes for each of those parts, getting approvals to purchase the…

Engineer brothers found Forge to modernize hardware procurement

Raspberry Pi has released a $70 AI extension kit with a neural network inference accelerator that can be used for local inferencing, for the Raspberry Pi 5.

Raspberry Pi partners with Hailo for its AI extension kit

When Stacklet’s founders, Travis Stanfield and Kapil Thangavelu, came out of Capital One in 2020 to launch their startup, most companies weren’t all that concerned with constraining cloud costs. But…

Stacklet sees demand grow as companies take cloud cost control more seriously

Fivetran’s Managed Data Lake Service aims to remove the repetitive work of managing data lakes.

Fivetran launches a managed data lake service

Lance Riedel and Nigel Daley both spent decades in search discovery, but it was while working at Pinterest that they began trying to understand how to use search engines to…

How a couple of former Pinterest search experts caught Biz Stone’s attention

GetWhy helps businesses carry out market studies and extract insights from video-based interviews using AI.

GetWhy, a market research AI platform that extracts insights from video interviews, raises $34.5M

AI-powered virtual physical therapy platform Sword Health has seen its valuation soar 50% to $3 billion.

Sword Health raises $130 million and its valuation soars to $3 billion

Jeffrey Katzenberg and Sujay Jaswa, along with three general partners, manage $1.5 billion in assets today through their Build, Venture and Seed strategies.

WndrCo officially gets into venture capital with fresh $460M across two funds

The startup targets the middle ground between platforms that offer rigid templates, and those that facilitate a full-control approach.

Storyblok raises $80M to add more AI to its ‘headless’ CMS aimed at non-technical people

The startup has been pursuing a ground-up redesign of a well-understood technology.

‘Star Wars’ lasers and waterfalls of molten salt: How Xcimer plans to make fusion power happen

Sékr, a startup that offers a mobile app for outdoor enthusiasts and campers, is launching a new AI tool for planning road trips. The new tool, called Copilot, is available…

Travel app Sékr can plan your next road trip with its new AI tool

Microsoft’s education-focused flavor of its cloud productivity suite, Microsoft 365 Education, is facing investigation in the European Union. Privacy rights non-profit noyb has just lodged two complaints with Austria’s data…

Microsoft hit with EU privacy complaints over schools’ use of 365 Education suite

Since the shock of Russia’s 2022 invasion of Ukraine, solar energy has been having a moment in Europe. Electricity prices have been going up while the investment required to get…

Samara is accelerating the energy transition in Spain one solar panel at a time

Featured Article

DEI backlash: Stay up-to-date on the latest legal and corporate challenges

It’s clear that this year will be a turning point for DEI.

21 hours ago
DEI backlash: Stay up-to-date on the latest legal and corporate challenges

The keynote will be focused on Apple’s software offerings and the developers that power them, including the latest versions of iOS, iPadOS, macOS, tvOS, visionOS and watchOS.

Watch Apple kick off WWDC 2024 right here

Hello and welcome back to TechCrunch Space. Unfortunately, Boeing’s Starliner launch was delayed yet again, this time due to issues with one of the three redundant computers used by United…

TechCrunch Space: China’s victory

The court ruling said that Fearless Fund’s Strivers Grant likely violates the Civil Rights Act of 1866, which bans the use of race in contracts.

An appeals court rules that VC Fearless Fund cannot issue grants to Black women, but the fight continues

Instagram Threads is rolling out the ability for users to signal which sort of posts they wanted to see more or less of by swiping.

You can now customize your For You feed on Threads using swipes

The Japanese billionaire who commissioned SpaceX for a private mission around the moon on a Starship rocket has abruptly canceled the project, citing ongoing uncertainties around when the launch vehicle…

Japanese billionaire pulls plug on private ‘dearMoon’ lunar Starship mission