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.
static volatile bool work_pending;
void USART1_IRQHandler(void)
{
rx_push(USART1->RDR);
work_pending = true;
}
void main_loop(void)
{
for (;;) {
if (!work_pending) {
__WFI();
}
work_pending = false;
process_rx();
}
}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.
AppleConsumer devices · India hiring: LowGarminConsumer devices · India hiring: LowSTMicroelectronicsChipmaker · India hiring: MediumAmazon devices (Lab126, Kuiper)Consumer devices · India hiring: MediumAnalog DevicesChipmaker · India hiring: MediumArmChipmaker · India hiring: MediumBoschAutomotive supplier · India hiring: HighDensoAutomotive supplier · India hiring: Medium
Related challenges
Flag the lines, say what breaks, then fix it and build it with clang in your browser.
Find the bugs