HeapCrash / Challenges / End-of-line test firmware

End-of-line test firmware

End-of-line test firmware runs on each board before shipping, built as a release build. It reported a 100 % pass rate for a month. Then field returns turned up boards with dead external flash and sleep current five times too high, all of which had 'passed'. When a board is missing its radio module, the station hangs and the operator has to power-cycle it.

The code

Embedded C for Cortex-M. It compiles. There are 3 real bugs in it: the kind that pass a bench test and fail in the field.

#include <assert.h>

bool eol_test(void)
{
    assert(flash_selftest());
    radio_send_cmd("AT");
    while (!radio_reply_ready()) { }
    if (!radio_reply_is("OK")) return false;
    uint32_t sleep_ua = measure_sleep_current_ua();
    if (sleep_ua >= 2 || sleep_ua <= 15) return true;
    return false;
}

What an interviewer expects

The bugs, reference fixes and the follow-up question are in the practice app, after you've tried it.

Companies that test this

Matched on the skills each company's embedded roles emphasise.

Related challenges

Flag the lines, say what breaks, then fix it and build it with clang in your browser.

Find the bugs