HONEY, I SHRUNK THE ARDUINO CORE

Summary of HONEY, I SHRUNK THE ARDUINO CORE


This article discusses ArduinoShrink, a tool developed by NerdRalph to optimize Arduino programs by reducing unnecessary code and improving efficiency. By making Arduino libraries more modular and tweaking registers, ArduinoShrink decreases memory usage and enhances interrupt latency without requiring low-level assembly. Although it requires pin specifics at compile time, it is valuable for memory-critical or timing-sensitive Arduino applications. This approach offers an alternative to switching to lower-level languages, helping maintain high-level language ease while boosting performance.

Parts used in the ArduinoShrink Project:

  • Arduino platform (hardware)
  • Arduino core libraries
  • ArduinoShrink tool/software

High-level programming languages do a great job of making a programmer’s job easier, but these languages often leave a lot of efficiency on the table as a compromise. While a common thought is to move into a lower-level language like assembly to improve on a program’s speed or memory use, there’s often a lot that can be done at the high level before resorting to such extremes. This, of course, is true of the Arduino platform as well, as [NerdRalph] demonstrates by shrinking the size of the Arduino core itself.

Image
[NerdRalph] had noticed that the “blink” example program actually includes over 1 kB of extraneous code, and that more complicated programs include even more cruft. To combat this issue, he created ArduinoShrink, which seeks to make included libraries more modular and self-contained. It modifies some of the default registers and counters to use less memory and improve speed, and is also designed to improve interrupt latency as well by changing when the Arduino would otherwise disable interrupts.

While there are some limits to ArduinoShrink, such as needing to know specifics about the pins at compile time, for anyone writing programs for Arduinos that are memory-intensive or need improvements in timing, this could be a powerful new tool. If you’d prefer to go in the opposite direction to avoid ever having to learn C or assembly, though, you can always stick with running Python on your embedded devices.

Source: HONEY, I SHRUNK THE ARDUINO CORE


About The Author

Image

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top