cancel
Showing results for 
Search instead for 
Did you mean: 

I am using STM32CubeMX to config FreeRTOS. I couldn't find where to define configASSERT(). Can anyone help with this?

Crane
Associate III
 
1 ACCEPTED SOLUTION

Accepted Solutions
TThan
Associate III

Hi Crane,

when you generate a project with STM32CubeMX that uses FreeRTOS the definition of the configASSERT() macro is placed in between "USER_CODE" comments in the generated Inc/FreeRTOSConfig.h file:

/* USER CODE BEGIN 1 */
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
/* USER CODE END 1 */

That is a strong hint that this definition is not managed by STM32CubeMX but may and can be changed by the user.

So simply change the definition later in the generated file. It will not be overwritten on later re-generations since it is protected by the "USER_CODE_..." comments.

Regards

Thomas

View solution in original post

2 REPLIES 2
TThan
Associate III

Hi Crane,

when you generate a project with STM32CubeMX that uses FreeRTOS the definition of the configASSERT() macro is placed in between "USER_CODE" comments in the generated Inc/FreeRTOSConfig.h file:

/* USER CODE BEGIN 1 */
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
/* USER CODE END 1 */

That is a strong hint that this definition is not managed by STM32CubeMX but may and can be changed by the user.

So simply change the definition later in the generated file. It will not be overwritten on later re-generations since it is protected by the "USER_CODE_..." comments.

Regards

Thomas

Crane
Associate III

Got it. Thanks a lot Tthan!