Skip to main content
Associate III
January 23, 2026
Solved

CMAKE project generates unsuppressable macro redefine

  • January 23, 2026
  • 1 reply
  • 261 views

I am using cubemx to generate a CMAKE project for a NUCLEO_144 based board (NUCLEO_H563).

Project generation creates a cmake/stm32cubemx/CmakeLists.txt file that generates a macro define "USE_NUCLEO_144".

it also auto creates a stm32h5xx_nucleo_conf.h file that also creates the same define:

 
/** @defgroup STM32H5XX_NUCLEO_CONFIG_Exported_Constants Exported Constants
  * @{
  */
/* Nucleo pin and part number defines */
#define USE_NUCLEO_144
/* #define USE_NUCLEO_64 */
 
This creates a duplicate redefinition warning upon build in many places as this header is included throughout my project in many places.
This is extremely annoying.
I can suppress the warning by adding:
 
#if !defined (USE_NUCLEO_144)
#define USE_NUCLEO_144
#endif /* USE_NUCLEO_144 */
 
to the stm32h5xx_nucleo_conf.h file
but of course, this change gets wiped out upon next cubemx code regeneration.
 
It would be so helpful if this guard was included if whatever mechanism you use to generate the _conf.h file.
 
 
 
 
 
 
 
Best answer by Souhaib MAZHOUD

Hello @dvescovi 

Issue is fixed in the latest STM32CubeMX release 6.17.0 available here.

KR, Souhaib

1 reply

Technical Moderator
January 26, 2026

Hello @dvescovi 

Thanks for highlighting this issue,

Our team are aware about this issue, and it will be fixed in the upcoming releases of STM32CubeMX (Ticket 222934 This is an internal tracking number and is not accessible or usable by customers.)

KR, Souhaib

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Souhaib MAZHOUDBest answer
Technical Moderator
February 25, 2026

Hello @dvescovi 

Issue is fixed in the latest STM32CubeMX release 6.17.0 available here.

KR, Souhaib

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.