cancel
Showing results for 
Search instead for 
Did you mean: 

BUG - STM32F3xx SPL can't be built with STM32F30X defined

philpem
Associate II
Posted on September 06, 2014 at 22:31

Looks like a bug has crept into the v1.1.1 Standard Peripheral Library -- if it's built with STM32F30X #defined (e.g. by specifying -DSTM32F30X on the gcc command line), the build will fail.

Additionally a few devices seem to be specified in one check but not the other. These don't appear to be supported by the SPL, so shouldn't be checked anyway. The culprit is this piece of code in CMSIS/Device/ST/STM32F30x/Include/stm32f30x.c:

/* Uncomment the line below according to the target STM32 device used in your
application 
*/
#if !defined (STM32F303xC) && !defined (STM32F334x8) && !defined (STM32F303x8) && !defined (STM32F301x8) && !defined (STM32F302x8)
/* #define STM32F303xC */
/*!< STM32F303CB, STM32F303CC, STM32F303RB, STM32F303RC, STM32F303VB and STM32F303VC Devices */
#define STM32F334x8 /*!< STM32F334C4, STM32F334C6, STM32F334C8, STM32F334R4, STM32F334R6 and STM32F334R8 Devices */
/* #define STM32F302x8 */
/*!< STM32F302K4, STM32F302K6, STM32F302K8, STM32F302C4, STM32F302C6, STM32F302C8, 
STM32F302R4, STM32F302R6 and STM32F302R8 Devices */
#endif
/* Tip: To avoid modifying this file each time you need to switch between these
devices, you can define the device in your toolchain compiler preprocessor.
*/
/* Old STM32F30X definition, maintained for legacy purpose */
#if defined(STM32F30X) 
#define STM32F303xC
#endif /* STM32F30X */
#if !defined (STM32F303xC) && !defined (STM32F334x8) && !defined (STM32F302x8)
#error ''Please select first the target STM32F30X device used in your application (in stm32f30x.h file)''
#endif

If STM32F30X is defined, then the code will define both STM32F334x8 and STM32F303xC, which is an invalid setup and causes the compile errors. The above code block should be changed to this:

/* Uncomment the line below according to the target STM32 device used in your
application 
*/
/* Old STM32F30X definition, maintained for legacy purpose */
#if defined(STM32F30X) 
#define STM32F303xC
#endif /* STM32F30X */
#if !defined (STM32F303xC) && !defined (STM32F334x8) && !defined (STM32F302x8)
/* #define STM32F303xC */
/*!< STM32F303CB, STM32F303CC, STM32F303RB, STM32F303RC, STM32F303VB and STM32F303VC Devices */
#define STM32F334x8 /*!< STM32F334C4, STM32F334C6, STM32F334C8, STM32F334R4, STM32F334R6 and STM32F334R8 Devices */
/* #define STM32F302x8 */
/*!< STM32F302K4, STM32F302K6, STM32F302K8, STM32F302C4, STM32F302C6, STM32F302C8, 
STM32F302R4, STM32F302R6 and STM32F302R8 Devices */
#endif
/* Tip: To avoid modifying this file each time you need to switch between these
devices, you can define the device in your toolchain compiler preprocessor.
*/
#if !defined (STM32F303xC) && !defined (STM32F334x8) && !defined (STM32F302x8)
#error ''Please select first the target STM32F30X device used in your application (in stm32f30x.h file)''
#endif

Cheers, Phil.
2 REPLIES 2
Posted on October 01, 2014 at 11:09

Hi Phil,

Thank you for bringing this issue to our attention. We’ll pass it along to our development team. Keep an eye out for the next update!

Regard,

Heisenberg.

Posted on October 01, 2014 at 11:10

Hi Phil,

Thank you for bringing this issue to our attention. We’ll pass it along to our development team. Keep an eye out for the next update!

Regard,

Heisenberg.