cancel
Showing results for 
Search instead for 
Did you mean: 

Inconsistant code generation in STM32CubeMX when using FATFS and FreeRTOS middlewares

ABENA.1
Associate

The prototype of the generated function by STM32CubeMx when using FATFS is:

int32_t MX_FATFS_Process(void)

This cannot be used with FreeRTOS as a task entry function since it has the wrong return and argument type.

The function prototype should be :

void MX_FATFS_Process(void *argument)

So that it could be accepted while creating FATFS task:

  FatFsTaskHandle = osThreadNew(MX_FATFS_Process, NULL, &FatFsTask_attributes);

In the example project provided in STM32Cube MCU Package for STM32L5 series, the function prototype is correct. The code generated by STM32CubeMX does not match this example.

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @ABENA.1​ ,

Unfortunately we cannot accept this request, it is not possible to change the prototype of MX_FATFS_Process to void.

Since the beginning, the functions prototype was declared as int32_t and it was not targeted to be used by FreeRTOS threads. The prototype was changed to void in the FW examples for FreeRTOS use.

The recommended way to define FreeRTOS tasks is by adding them to FreeRTOS configuration using CubeMX (for example void StartTaskxx(void *argument) ).

The FatFS task can be created while configuring FreeRTOS. It can be named StartTaskFatFS and you can copy or use the code of MX_FATFS_Process given in the example in the generated void StartTaskFatFS(void *argument).

I hope this helps 😊

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.

View solution in original post

3 REPLIES 3
Sara BEN HADJ YAHYA
ST Employee

Hello @ABENA.1​ ,

Thanks for having reported,

I submitted your request internally for further check, I will keep you posted.

Internal ticket number: 128982(This is an internal tracking number and is not accessible or usable by customers).

Sara.

Sara BEN HADJ YAHYA
ST Employee

Hello @ABENA.1​ ,

Unfortunately we cannot accept this request, it is not possible to change the prototype of MX_FATFS_Process to void.

Since the beginning, the functions prototype was declared as int32_t and it was not targeted to be used by FreeRTOS threads. The prototype was changed to void in the FW examples for FreeRTOS use.

The recommended way to define FreeRTOS tasks is by adding them to FreeRTOS configuration using CubeMX (for example void StartTaskxx(void *argument) ).

The FatFS task can be created while configuring FreeRTOS. It can be named StartTaskFatFS and you can copy or use the code of MX_FATFS_Process given in the example in the generated void StartTaskFatFS(void *argument).

I hope this helps 😊

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.

ABENA.1
Associate

Thanks @Sara BEN HADJ YAHYA​