AnsweredAssumed Answered

CubeMX tool generates dubious declaration for periph init.

Question asked by boks.ewout.001 on Sep 27, 2015
Latest reply on Oct 11, 2015 by STM32Cube-T

when I generate code for the STM32L0 in CubeMX, my compiler discovers the following problem:

~/projecten/SunnaBat/software/Controller/toepassing/cube/SunnaBat/Src/adc.c:149:47: error: declaration of 'hadc' shadows a global declaration [-Werror=shadow]
 void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
~/projecten/SunnaBat/software/Controller/toepassing/cube/SunnaBat/Src/adc.c:45:19: note: shadowed declaration is here
 ADC_HandleTypeDef hadc;

Same deal with other peripherals like IDWG or I2C.

The generated software has a local variable named exactly the same as a global variable! This is a recipe for confusion or worse.

My compiler is arm-none-eabi-g++ (I won't use gcc, since most of my code is c++)

Has anybody found a way to make the tool generate proper function variable names? I can change them by hand but every time I re-generate from the tool I lose my changes and I need to do it all again.

Perhaps ST could test the code with a c++ compiler, they are much more strict on typechecking and names than a c compiler.


Ewout Boks