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.
void vApplicationTickHook(void)
{
IWDG->KR = 0xAAAA;
}
void vApplicationIdleHook(void)
{
static TickType_t last;
if (xTaskGetTickCount() - last > 1000) {
last = xTaskGetTickCount();
printf("idle ok\n");
vTaskDelay(pdMS_TO_TICKS(10));
}
}
void vApplicationStackOverflowHook(TaskHandle_t t, char *name)
{
printf("stack overflow in %s\n", name);
}What an interviewer expects
- Point to each line you'd stop in a code review.
- Say what actually breaks: the failure mode, not just the rule it violates.
- Fix it, then defend the fix when asked the follow-up.
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.
MedtronicMedical devices · India hiring: MediumRenesasChipmaker · India hiring: MediumTata ElxsiEngineering services · India hiring: HighABBIndustrial · India hiring: MediumAcsia TechnologiesEngineering services · India hiring: MediumAppleConsumer devices · India hiring: LowAptivAutomotive supplier · India hiring: MediumAther EnergyEV OEM · India hiring: Medium
Related challenges
FreeRTOS sensor pipelineRTOS · Hard · 5 bugs · ~8 minSharing SPI between tasksRTOS · Medium · 3 bugs · ~6 minLogging through a queueRTOS · Warm-up · 3 bugs · ~4 minCritical sections and scheduler locksRTOS · Medium · 4 bugs · ~5 minPeriodic control loopRTOS · Medium · 3 bugs · ~5 minNested mutexes under loadRTOS · Hard · 3 bugs · ~8 min
Flag the lines, say what breaks, then fix it and build it with clang in your browser.
Find the bugs