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

AI startup Runway’s second annual AI Film Festival showcased movies that incorporated AI tech in some fashion, from backgrounds to animations.

At the AI Film Festival, humanity triumphed over tech

Rachel Coldicutt is the founder of Careful Industries, which researches the social impact technology has on society.

Women in AI: Rachel Coldicutt researches how technology impacts society

SAP Chief Sustainability Officer Sophia Mendelsohn wants to incentivize companies to be green because it’s profitable, not just because it’s right.

SAP’s chief sustainability officer isn’t interested in getting your company to do the right thing

Here’s what one insider said happened in the days leading up to the layoffs.

Tesla’s profitable Supercharger network is in limbo after Musk axed the entire team

StrictlyVC events deliver exclusive insider content from the Silicon Valley & Global VC scene while creating meaningful connections over cocktails and canapés with leading investors, entrepreneurs and executives. And TechCrunch…

Meesho, a leading e-commerce startup in India, has secured $275 million in a new funding round.

Meesho, an Indian social commerce platform with 150M transacting users, raises $275M

Some Indian government websites have allowed scammers to plant advertisements capable of redirecting visitors to online betting platforms. TechCrunch discovered around four dozen “gov.in” website links associated with Indian states,…

Scammers found planting online betting ads on Indian government websites

Around 550 employees across autonomous vehicle company Motional have been laid off, according to information taken from WARN notice filings and sources at the company.  Earlier this week, TechCrunch reported…

Motional cut about 550 employees, around 40%, in recent restructuring, sources say

The deck included some redacted numbers, but there was still enough data to get a good picture.

Pitch Deck Teardown: Cloudsmith’s $15M Series A deck

The company is describing the event as “a chance to demo some ChatGPT and GPT-4 updates.”

OpenAI’s ChatGPT announcement: What we know so far

Unlike ChatGPT, Claude did not become a new App Store hit.

Anthropic’s Claude sees tepid reception on iOS compared with ChatGPT’s debut

Welcome to Startups Weekly — Haje‘s weekly recap of everything you can’t miss from the world of startups. Sign up here to get it in your inbox every Friday. Look,…

Startups Weekly: Trouble in EV land and Peloton is circling the drain

Scarcely five months after its founding, hard tech startup Layup Parts has landed a $9 million round of financing led by Founders Fund to transform composites manufacturing. Lux Capital and Haystack…

Founders Fund leads financing of composites startup Layup Parts

AI startup Anthropic is changing its policies to allow minors to use its generative AI systems — in certain circumstances, at least.  Announced in a post on the company’s official…

Anthropic now lets kids use its AI tech — within limits

Zeekr’s market hype is noteworthy and may indicate that investors see value in the high-quality, low-price offerings of Chinese automakers.

The buzziest EV IPO of the year is a Chinese automaker

Venture capital has been hit hard by souring macroeconomic conditions over the past few years and it’s not yet clear how the market downturn affected VC fund performance. But recent…

VC fund performance is down sharply — but it may have already hit its lowest point

The person who claims to have 49 million Dell customer records told TechCrunch that he brute-forced an online company portal and scraped customer data, including physical addresses, directly from Dell’s…

Threat actor says he scraped 49M Dell customer addresses before the company found out

The social network has announced an updated version of its app that lets you offer feedback about its algorithmic feed so you can better customize it.

Bluesky now lets you personalize main Discover feed using new controls

Microsoft will launch its own mobile game store in July, the company announced at the Bloomberg Technology Summit on Thursday. Xbox president Sarah Bond shared that the company plans to…

Microsoft is launching its mobile game store in July

Smart ring maker Oura is launching two new features focused on heart health, the company announced on Friday. The first claims to help users get an idea of their cardiovascular…

Oura launches two new heart health features

Keeping up with an industry as fast-moving as AI is a tall order. So until an AI can do it for you, here’s a handy roundup of recent stories in the world…

This Week in AI: OpenAI considers allowing AI porn

Garena is quietly developing new India-themed games even though Free Fire, its biggest title, has still not made a comeback to the country.

Garena is quietly making India-themed games even as Free Fire’s relaunch remains doubtful

The U.S.’ NHTSA has opened a fourth investigation into the Fisker Ocean SUV, spurred by multiple claims of “inadvertent Automatic Emergency Braking.”

Fisker Ocean faces fourth federal safety probe

CoreWeave has formally opened an office in London that will serve as its European headquarters and home to two new data centers.

CoreWeave, a $19B AI compute provider, opens European HQ in London with plans for 2 UK data centers

The Series C funding, which brings its total raise to around $95 million, will go toward mass production of the startup’s inaugural products

AI chip startup DEEPX secures $80M Series C at a $529M valuation 

A dust-up between Evolve Bank & Trust, Mercury and Synapse has led TabaPay to abandon its acquisition plans of troubled banking-as-a-service startup Synapse.

Infighting among fintech players has caused TabaPay to ‘pull out’ from buying bankrupt Synapse

The problem is not the media, but the message.

Apple’s ‘Crush’ ad is disgusting

The Twitter for Android client was “a demo app that Google had created and gave to us,” says Particle co-founder and ex-Twitter employee Sara Beykpour.

Google built some of the first social apps for Android, including Twitter and others

WhatsApp is updating its mobile apps for a fresh and more streamlined look, while also introducing a new “darker dark mode,” the company announced on Thursday. The messaging app says…

WhatsApp’s latest update streamlines navigation and adds a ‘darker dark mode’

Plinky lets you solve the problem of saving and organizing links from anywhere with a focus on simplicity and customization.

Plinky is an app for you to collect and organize links easily