Thursday, March 23, 2017

Standard is better...

Code size wise, using only the Standard Libraries, you get an advantage of around 3Kb in size, compared with the HAL Libraries. Disadvantages? You lose the fast prototyping features (and the sense of security) offered by the STM32CubeMX.

Well, that is not a problem for the advanced programmer, but I, as a beginner, I will work with HAL Libraries a little longer - the microcontroller I work with, has a lot of unknowns to me. I rewrote the Blink application using Standard Libraries and compared the code after the compilation. The sources are in the github repository.

Made with Standard Libraries:

Made with HAL Libraries:

The application is simple, it blinks a LED at three different speeds, which can be changed pressing the user button, where an interrupt is generated. Anyone knows the Arduino sketch, "BlinkWithoutDelay", an even simpler application. I compiled that in Mapple IDE for Cortex-M3 microcontroller, and is good to know that it is even bigger :P (almost double than with HAL Libraries)