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

SpaceX’s massive Starship rocket could take to the skies for the fourth time on June 5, with the primary objective of evaluating the second stage’s reusable heat shield as the…

SpaceX sent Starship to orbit — the next launch will try to bring it back

Eric Lefkofsky knows the public listing rodeo well and is about to enter it for a fourth time. The serial entrepreneur, whose net worth is estimated at nearly $4 billion,…

Billionaire Groupon founder Eric Lefkofsky is back with another IPO: AI health tech Tempus

TechCrunch Disrupt showcases cutting-edge technology and innovation, and this year’s edition will not disappoint. Among thousands of insightful breakout session submissions for this year’s Audience Choice program, five breakout sessions…

You’ve spoken! Meet the Disrupt 2024 breakout session audience choice winners

Check Point is the latest security vendor to fix a vulnerability in its technology, which it sells to companies to protect their networks.

Zero-day flaw in Check Point VPNs is ‘extremely easy’ to exploit

Though Spotify never shared official numbers, it’s likely that Car Thing underperformed or was just not worth continued investment in today’s tighter economic market.

Spotify offers Car Thing refunds as it faces lawsuit over bricking the streaming device

The studies, by researchers at MIT, Ben-Gurion University, Cambridge and Northeastern, were independently conducted but complement each other well.

Misinformation works, and a handful of social ‘supersharers’ sent 80% of it in 2020

Welcome back to TechCrunch Mobility — your central hub for news and insights on the future of transportation. Sign up here for free — just click TechCrunch Mobility! Okay, okay…

Tesla shareholder sweepstakes and EV layoffs hit Lucid and Fisker

In a series of posts on X on Thursday, Paul Graham, the co-founder of startup accelerator Y Combinator, brushed off claims that OpenAI CEO Sam Altman was pressured to resign…

Paul Graham claims Sam Altman wasn’t fired from Y Combinator

In its three-year history, EthonAI has amassed some fairly high-profile customers including Siemens and chocolate-maker Lindt.

AI manufacturing startup funding is on a tear as Switzerland’s EthonAI raises $16.5M

Don’t miss out: TechCrunch Disrupt early-bird pricing ends in 48 hours! The countdown is on! With only 48 hours left, the early-bird pricing for TechCrunch Disrupt 2024 will end on…

Ticktock! 48 hours left to nab your early-bird tickets for Disrupt 2024

Biotech startup Valar Labs has built a tool that accurately predicts certain treatment outcomes, potentially saving precious time for patients.

Valar Labs debuts AI-powered cancer care prediction tool and secures $22M

Archer Aviation is partnering with ride-hailing and parking company Kakao Mobility to bring electric air taxi flights to South Korea starting in 2026, if the company can get its aircraft…

Archer, Kakao Mobility partner to bring electric air taxis to South Korea in 2026

Space startup Basalt Technologies started in a shed behind a Los Angeles dentist’s office, but things have escalated quickly: Soon it will try to “hack” a derelict satellite and install…

Basalt plans to ‘hack’ a defunct satellite to install its space-specific OS

As a teen model, Katrin Kaurov became financially independent at a young age. Aleksandra Medina, whom she met at NYU Abu Dhabi, also learned to manage money early on. The…

Former teen model co-created app Frich to help Gen Z be more realistic about finances

Can AI help you tell your story? That’s the idea behind a startup called Autobiographer, which leverages AI technology to engage users in meaningful conversations about the events in their…

Autobiographer’s app uses AI to help you tell your life story

AI-powered summaries of web pages are a feature that you will find in many AI-centric tools these days. The next step for some of these tools is to prepare detailed…

Perplexity AI’s new feature will turn your searches into shareable pages

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

Battery recycling startups have emerged in Europe in a bid to tap into the next big opportunity in the EV market: battery waste.  Among them is Cylib, a German-based startup…

Cylib wants to own EV battery recycling in Europe

Amazon has received approval from the U.S. Federal Aviation Administration (FAA) to fly its delivery drones longer distances, the company announced on Thursday. Amazon says it can now expand its…

Amazon gets FAA approval to expand US drone deliveries

With Plannin, creators can tell their audience about their latest trip, which hotels they liked and post photos of their travels.

Former Priceline execs debut Plannin, a booking platform that uses travel influencers to help plan trips

Amazon is rolling out its AI voice search feature to Alexa, which lets it answer open-ended questions about content.

Amazon is rolling out AI voice search to Fire TV devices

Redpanda has already integrated Benthos into its own service and has made it the core technology of its new Redpanda Connect service.

Redpanda acquires Benthos to expand its end-to-end streaming data platform

It’s a lofty goal to take on legacy payments infrastructure, however, Forward’s model has an advantage by shifting the economics back to SaaS companies.

Fintech startup Forward grabs $16M to take on Stripe, lead future of integrated payments

Fertility remains a pressing concern around the world — birthrates are down in many countries, and infertility rates (that is, the inability to conceive) are up. Rhea, a Singapore- and…

Rhea reaps $10M more led by Thiel

Microsoft, Meta, Intel, AMD and others have formed a new group to design next-gen interconnects for AI accelerator hardware.

Tech giants form an industry group to help develop next-gen AI chip components

With JioFinance, the Indian tycoon Mukesh Ambani is making his boldest consumer-facing move yet into financial services.

Ambani’s Reliance fires opening salvo in fintech battle, launches JioFinance app

Salespeople live and die by commissions. It’s no surprise, then, that Salesforce paid a premium to buy a platform that simplifies managing commissions.

Filing shows Salesforce paid $419M to buy Spiff in February

YoLa Fresh works with over a thousand retailers across Morocco and records up to $1 million in gross merchandise volume.

YoLa Fresh, a GrubMarket for Morocco, digs up $7M to connect farmers with food sellers

Instagram is expanding the scope of its “Limits” tool specifically for teenagers that would let them restrict unwanted interactions with people.

Instagram now lets teens limit interactions to their ‘Close Friends’ group to combat harassment

Agritech company Iyris helps growers across eleven countries globally increase crop yields, reduce input costs, and extend growing seasons.

Iyris makes fresh produce easier to grow in difficult climates, raises $16M