cancel
Showing results for 
Search instead for 
Did you mean: 

Are there any documentations on the code style STM32Cube is written in?

callsignhermit
Associate

Looking through the STM32Cube codebase, I’ve noticed a fairly strange but thoroughly consistent coding style. Indentation size is 2 spaces, using space for indentation; bracing style is more similar to Allman’s style rather than K&R and 1TBS. Naming style is also uniform, using CamelCase for external identifiers such as functions, structure fields, and global variables; along with a bit of Hungarian notation here and there (for example, pTxBuffPtr).

This style is mechanically consistent through STM32Cube firmwares, drivers (LL, HAL, and CMSIS), code generated by STM32CubeMX, and BSP drivers. Even example projects follow suit.

Could STM employees please share with us some documentation or guideline regarding this coding style? Looking for something similar to the Linux Kernel Coding Style and the Google C++ Style Guide. Configurations for formatter tools such as clang-format would also be appreciated.

0 REPLIES 0