cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Freertos semaphore not initialised correctly by CubeMX

MarcosOrzari
Associate

A new question moved from this post.

I have the opposite issue with STM32CubeIDe v1.18 / MX v6.14.0, I want my semaphore initial state to be depleted, but that is not applied to my code:

MarcosOrzari_0-1741352328612.png

 

 

  /* creation of DebugUartStringReadySem */
  DebugUartStringReadySemHandle = osSemaphoreNew(1, 1, &DebugUartStringReadySem_attributes);

 

 

My .ioc file seems ok:

 

 

rtos.0.binarySems.0=allocationType,Dynamic;controlBlockName,NULL;initialState,Depleted;name,DebugUartStringReadySem

 

 

 

4 REPLIES 4
dmarks-ls
Associate III

Hi Marcos,

Random user here... I'm able to reproduce your error.  I have a starter project for TouchGFX on the STM32U5 using FreeRTOS, so I added two semaphores, one that starts available, one that starts depleted.

binary_semaphores.png

Here's the code that CubeMX generated:

void MX_FREERTOS_Init(void) {
  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* USER CODE BEGIN RTOS_MUTEX */
  /* add mutexes, ... */
  /* USER CODE END RTOS_MUTEX */
  /* creation of sem_available */
  sem_availableHandle = osSemaphoreNew(1, 1, &sem_available_attributes);

  /* creation of sem_depleted */
  sem_depletedHandle = osSemaphoreNew(1, 1, &sem_depleted_attributes);

Clearly, that's not correct.  ST, please verify and correct this issue.  (I'm using CubeIDE 1.18.0, CubeMX 6.14.0, STM32Cube FW_U5 v1.7.0.)

Dana M.

Souhaib MAZHOUD
ST Employee

Hello @MarcosOrzari 

Thank you for posting!

Could you provide the name of the MCU where you encountered the issue?

KR,

Souhaib

Sure, it's the STM32U585VITx.

Hello @MarcosOrzari 

This issue has been fixed in the MCU part numbers supporting native FREERTOS such as H7RS, F1, etc. However, it still exists in other MCU part numbers that do not support natively FREERTOS. It will be fixed in the coming revisions of X-Cube-FREERTOS.

KR,

Souhaib