This is quite surprising, a simple demo project using LL library for blinking LEDs, has this line of code:
That's readable I suppose and I traced through the definitions and found there are various macros that do bit shifting and so on. But when examining the generated code, I was surprised to see an ARM branch and link br instruction to some address, I went to that address and see a huge block of code generated from those bitshifts.
Building in release mode seems to more or less generate the same chunk of code but it does inline it and condense it:
Using a bitfield typedef generates this:

The code generated for the LL function is:

This seems to show that this technique of using lots of nested macros to manipulate and set register bits, does carry some overhead.
Code:
LL_GPIO_SetPinMode(GPIOD, LL_GPIO_PIN_12, LL_GPIO_MODE_OUTPUT);
Building in release mode seems to more or less generate the same chunk of code but it does inline it and condense it:
Using a bitfield typedef generates this:

The code generated for the LL function is:

This seems to show that this technique of using lots of nested macros to manipulate and set register bits, does carry some overhead.
Last edited:


