cancel
Showing results for 
Search instead for 
Did you mean: 

MX_MBEDTLS_Init called twice at startup

themarcman
Associate II

Why is MX_MBEDTLS_Init called twice at startup when using stm32CubeMx code generation?

1 ACCEPTED SOLUTION

Accepted Solutions
STea
ST Employee

Hello @themarcman ,

The issue was fixed in release 6.12 of CubeMX available on the ST website .

Regards 

In order 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.

View solution in original post

8 REPLIES 8
STea
ST Employee

Hello @themarcman ,

can you specify the version of cubeMX and the version of the cube firmware package (STM32Cube_FW_xx_Vx.xx.x) you are using to try and reproduce this .

BR

In order 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.

Thanks for the reply @STea.

I will get back to you tomorrow morning!

I'm using STM32CubeIDE version 1.14.1 build 20064_20240111_1413

STM32CubeMX version 6.10.0-RC9 build 20231120-2037

Firmware package version : STM32Cube_FW_F4 V1.28.0

I am using an stm32f439ZITx for my application.

 

Thank you!

Hello @themarcman ,

I have tried to reproduce the same issue you are describing but I don't see the function called twice it is called once after code generation. 

STea_0-1713283579069.png

BR

In order 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.

Thank you for the reply @STea!

Sorry I did not specify I am using freeRTOS, in combination with lwip.

@STeaI've reinstalled STM32CubeIDE and started a new branch so that I could reconfigure mbedtls from scratch.

MX_MBEDTLS_Init is still called twice. You can find my project in the 7z attachment.

 

I'm also a bit confused as to why the function is called before FreeRTOS is running.

mbedtls_net_init calls MX_LWIP_Init and this should be called at the start of mbedtls configuration from what I see in examples : https://github.com/Mbed-TLS/mbedtls/blob/development/programs/ssl/ssl_client1.c

However MX_LWIP_Init also creates two threads so it cannot be called before FreeRTOS runs.

osThreadDef(EthLink, ethernet_link_thread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE *2);

and

osThreadCreate (osThread(EthLink), &gnetif);

 

Thank you for your time,

Marc Robison

STea
ST Employee

Hello @themarcman ,

I reported the issue internally.

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

Thank you.

In order 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.
STea
ST Employee

Hello @themarcman ,

The issue was fixed in release 6.12 of CubeMX available on the ST website .

Regards 

In order 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.