arduino / arduino/Arduino

Enhancement: Runtime Error Detect and Alert

Open
#5,682 3 comments 1 reaction 0 assignees View on GitHub
Component: Core feature request
Dominant language
Java
Stars
14.6k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

Some of the types of programming errors that newcomers do could be captured (i.e. detected and displayed).

Several of the core functions and classes use the heap (i.e. function malloc/free) with limited detection of when the heap is exhausted. Often the error is simply passed to the sketch without notice. A good example is String which generates very many questions on the forum. Also the implementation of new and delete do much the same; pass the error situation to the sketch.

Another area of concern is program lockups, i.e. sketch functions that do not return due to poor designed algorithms or hardware/wiring errors. In these cases a simple watchdog could be used to capture and signal the error state. Please see https://github.com/arduino/Arduino/issues/5673.

A possible method of signaling the error situation is to use the board LED (with a rapid blink with/without pause) alternatively print to Serial (if available).

The proposal is 1) detect heap allocation failure (in core functions) and program lockup, 2) alert using LED and/or Serial.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked issue 5673 and the Arduino core's String, new/delete, and other heap-using functions, then consider how a watchdog would detect sketch lockups. Done would require detecting heap allocation failures and lockups and signaling them through the board LED and/or Serial.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.