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

With the release of iOS 18 later this year, Apple may again borrow ideas third-party apps. This time it’s Arc that could be among those affected.

Is Apple planning to ‘sherlock’ Arc?

TechCrunch Disrupt 2024 will be in San Francisco on October 28–30, and we’re already excited! This is the startup world’s main event, and it’s where you’ll find the knowledge, tools…

Meet Visa, Mercury, Artisan, Golub Capital and more at TC Disrupt 2024

Featured Article

The women in AI making a difference

As a part of a multi-part series, TechCrunch is highlighting women innovators — from academics to policymakers —in the field of AI.

2 hours ago
The women in AI making a difference

U.S. Rep. Elissa Slotkin will introduce a bill to Congress that would limit or ban the introduction of connected vehicles built by Chinese companies if found to pose a threat…

Chinese EVs – and their connected tech – are the next target of US lawmakers

Ifeel is being offered as part of an employer’s or insurance provider’s healthcare coverage.

Mental health insurance platform ifeel  raises a $20 million Series B

Instead of opening the user’s actual browser or a WebView, Custom Tabs let users remain in their app while browsing.

Google Chrome becomes a ‘picture-in-picture’ app

Sanil Chawla remembers the meetings he had with countless artists in college. Those creatives were looking for one thing: sustainable economic infrastructure that could help them scale rather than drown…

Creator fintech Slingshot raises $2.2M

A startup called Firefly that’s tackling the thorny and growing issue of cloud asset management with an “infrastructure as code” solution has raised $23 million in funding. That comes on…

Firefly forges on after co-founder murdered by Hamas

Mistral, the French AI startup backed by Microsoft and valued at $6 billion, has released its first generative AI model for coding, dubbed Codestral. Like other code-generating models, Codestral is…

Mistral releases Codestral, its first generative AI model for code

Pinterest announced today that it is evolving its Creator Inclusion Fund to now be called the Pinterest Inclusion Fund. Pinterest teamed up with Shopify’s Build Black and Build Native programs…

Pinterest expands its Creator Fund to allow founders

Cadillac may seem a bit too traditional to hang its driving cap on EVs. And yet, that hasn’t stopped the GM brand from rolling out — or at least showing…

Cadillac’s new Optiq EV is designed to hook young hipsters

Alex Taub, a longtime founder with multiple exits under his belt, believes it’s time to disrupt the meme industry. “I have this big thesis that meme tech is going to…

This founder says meme tech is the next big thing

Lux, the startup behind popular pro photography app Halide and others, is venturing into video with its latest app launch. On Wednesday, the company announced Kino, a new video capture app…

Kino is a new iPhone app for videographers from the makers of Halide

DevOps startup Harness has shown itself to be an ambitious company, building a broad platform of services while also dabbling in M&A when it made sense to fill in functionality.…

Harness snags Split.io as it goes all in on feature flags and experiments

Microsoft’s Copilot, a generative AI-powered tool that can generate text as well as answer specific questions, is now available as an in-app chatbot on Telegram, the instant messaging app.  Currently…

Microsoft’s Copilot is now on Telegram

HBO’s new documentary, “MoviePass, MovieCrash,” tells a story that many of us know about: how MoviePass, the subscription-based movie ticketing startup, was a catastrophic failure. After a series of mishaps…

MoviePass co-founders speak their truth in HBO’s new documentary 

The watch features a variety of different 3D games, unlocking more play time the more kids move.

Fitbit’s new kid smartwatch is a little Wiimote, a little Tamagotchi

In the video, a crowd is roaring at a packed summer music festival. As a beat starts playing over the speakers, the performer finally walks onstage: It’s the Joker. Clad…

Discord has become an unlikely center for the generative AI boom

After the Wirecard scandal, Germany’s financial regulator BaFin started to look more closely at young fintech startups that wanted to grow at a rapid pace — it’s better to be…

Germany’s financial regulator ends anti-money laundering cap on N26 signups after $10M fine

Among other things, this includes the ability to trace code from source to binary packages across both platforms, single sign-on support and unified project structures.

JFrog and GitHub team up to closely integrate their source code and binary platforms

The company’s public fund disbursement and e-commerce platform makes accepting school tuition and enabling educational enrichment more accessible. 

Tech startup Odyssey goes on journey to help states implement school choice programs

A new startup called Kinnect aims to help people privately save generational memories, traditions, recipes and more. The company’s app, launched this month, lets people create invite-only spaces where they…

Kinnect’s new app aims to help families record and store generational memories

Spotify has hiked its premium subscription in France by an eye-watering €0.13, in response to a new music-streaming tax.

Spotify hikes subscription price in France by 1.2% to match new music-streaming tax

The European Union has taken the wraps off the structure of the new AI Office, the ecosystem-building and oversight body that’s being established under the bloc’s AI Act. The risk-based…

With the EU AI Act incoming this summer, the bloc lays out its plan for AI governance

Solutions by Text, a company that gives people a way to pay their bills and apply for loans via text messaging, has secured $110 million in new growth funding. Edison…

Bootstrapped for over a decade, this Dallas company just secured $110M to help people pay bills by text

Owners of small- and medium-sized businesses check their bank balances daily to make financial decisions. But it’s entrepreneur Yoseph West’s assertion that there’s typically information and functions missing from bank…

Relay raises $32.2 million to help smaller businesses manage their cash flow

When other firms were investing and raising eye-popping sums, Clean Energy Ventures took a different approach. It appears to be paying off.

How Clean Energy Ventures avoided the pandemic bubble and raised a $305M fund

PwC, the management consulting giant, will become OpenAI’s biggest customer to date, covering 100,000 users.

OpenAI signs 100K PwC workers to ChatGPT’s enterprise tier as PwC becomes its first resale partner

Tech enthusiasts and entrepreneurs, the clock is ticking! With just 72 hours remaining until the early-bird ticket deadline for TechCrunch Disrupt 2024, now is the time to secure your spot…

72 hours left of the Disrupt early-bird sale

Avendus, the top investment bank for venture deals in India, confirmed on Wednesday it is looking to raise up to $350 million for its new private equity fund.  The new…

Avendus, India’s top venture adviser, confirms it’s looking to raise a $350M fund