Skip to main content
Associate III
November 9, 2025
Solved

Where to define the USE_FULL_ASSERT ?

  • November 9, 2025
  • 1 reply
  • 172 views

Colleagues, I’ve got a nitpick question.

Where’s the best place to define USE_FULL_ASSERT ? It can be defined as a preprocessor symbol. Or, it can be #defined in the stm32xxx_hal_conf.h file. Or, is there a setting in the .ioc file?

The stm32g4xx_hal_conf.h which STM32cubeIDE had generated for me has this block:

/**
 * @brief Uncomment the line below to expanse the "assert_param" macro in the
 * HAL drivers code
 */
/* #define USE_FULL_ASSERT 1U */

But it’s not in the the USER CODE block. I’m concerned that the automatic code generator would restore the #define USE_FULL_ASSERT back to the commented out line next time it re-generates stm32g4xx_hal_conf.h .

Best regards,
- Nick

Best answer by TDK

If you want to use the CubeMX way, enable it within the IOC file here in Project Manager.

TDK_0-1762657069906.png

After regenerating code, it will get defined (uncommented) in the stm32g4xx_hal_conf.h file.

1 reply

TDK
TDKBest answer
Super User
November 9, 2025

If you want to use the CubeMX way, enable it within the IOC file here in Project Manager.

TDK_0-1762657069906.png

After regenerating code, it will get defined (uncommented) in the stm32g4xx_hal_conf.h file.

"If you feel a post has answered your question, please click ""Accept as Solution""."