Many people have run a Blink program on a microcontroller earlier than. It’s successfully the “Hey, World!” of the embedded house. Nonetheless, few of us have ever considered optimizing our Blink code to be as miniscule as attainable. However that’s exactly what [Rudra Lad] did for this entry into the 2025 One Hertz Problem!
This instance of Blink, delay_blinky_13, is constructed particularly for the STM32F4 Discovery microcontroller improvement board. [Rudra] notes the code is “extremely optimized” and compiles right down to a binary measurement of below 50 bytes. The code doesn’t even use RAM, and it goals to get the blink as near 1 Hz as attainable. Many optimizations have been used to crunch it down as small as attainable. For instance, the usual startup code isn’t used, with all the program as a substitute written within the Reset_Handler to save lots of house. Bit-band can also be used to put in writing to peripheral registers to blink the LED, since this makes use of much less directions than the everyday strategies. In the meantime, with many tweaks to the delay counting routine, [Rudra] was ultimately capable of get the blink frequency to 1.00019 Hz, as measured on a logic analyzer. That’s fairly darn shut!
Whereas it’s uncommon that you’ve got solely 50 bytes of binary house to blink an LED, work like this can be a nice option to flex your coding muscle tissues. Code is on Github for the curious, and in case you’ve labored up your individual spectacular tiny binaries, don’t hesitate to tell us!