STMicroelectronics/STM32CubeL4

Use const parameters for initialization functions

PetteriAimonen opened this issue · 3 comments

The initialization functions such as HAL_GPIO_Init and HAL_RCC_OscConfig do not modify the initialization structure given as argument.

The argument should be declared as const:

 HAL_StatusTypeDef HAL_RCC_OscConfig(const RCC_OscInitTypeDef *RCC_OscInitStruct);

Then user code can declare the struct const also, which will cause it to be placed in flash memory, saving RAM memory for other uses.

Duplicate of #15

Hi @PetteriAimonen,

Thank you for having reported. Actually, this topic has been already tackled in issue #15 and we are progressively deploying the use of the const qualifier in our drivers for all firmware. This takes some time to be done.

You can keep on tracking progress on this topic via the above-mentioned issue. Please allow me to close this one. Thank you for your comprehension.

With regards,

So that issue #15 is created in 2020, yet three years later this repository which has several releases since then still doesn't have the fix?