Speed Demon
A colleague wrote firmware that blinks an LED on PA5 and prints a status message via UART. It works correctly: the LED toggles in the right pattern and the UART output is correct. But the code is sluggish. It burns through far too many CPU cycles doing redundant work and wasteful busy-waiting.
Your job: make it faster. Reduce the instruction count below the budget while keeping the program's observable contract intact:
The LED must still toggle on PA5 in the pattern HIGH, LOW, HIGH, LOW (2 blink cycles), and UART must output exactly: BLINK:DONE
That toggle pattern and that exact text are the whole contract the grader checks: anything that does not change them is fair game to streamline or remove. The instruction budget is 30000 instructions, and a second grading pass tightens it to 28000, so treat 28000 as the number to beat. The current code blows past both. Study the code, find where the cycles are going, and bring it under budget.