cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 LwIP and MBEDTLS base code generation.

Authority
Associate II

Hello,

I am working on a project based on FreeRTOS, LwIP + MQTT and MBEDTLS. My current setup is a follows:

  • Hardware: STM32H743XIH6
  • Tools: STM32CubeMX v6.9.1 / STM32H7_HAL v1.11.1
  • Environment:
    • VS Code, Ext (C/C++ Extension Pack, Cortex Debug, Makefile)
    • OpenOCD
    • Make
    • Arm GCC Toolchain v12.3
    • Windows 11

Until now, only LwIP works with FreeRTOS enabled (Ping test OK). However, MBEDTLS have several issues during code generation, compilation. I was unable to find any proper documentation to follow how it should be done. Even inside the HAL example there is nothing related to MBEDTLS.

There are several things I'd like to report and I have several questions related to code generation via CubeMX. First I'll report few things related to code generation for the project. Please do keep in mind that each point shows code generation in stages i.e. (base code with freertos, lwip, mbedtls).

REPORT: CubeMX Code Generation (makefile)

1- It declares a 'static void MPU_Initialize(void)' function but never defines it.

2- Code always fails to compile after code generation due to multiple source file list of 'Drivers/BSP/Components/lan8742/lan8742.c' inside makefile. It always generates twice in a new project and I have to delete it to be able to compile the code.

3- There is a repetitive function call 'MX_MBEDTLS_Init()' inside the main file (twice). I have to always either comment it or delete a line.

4- Code fails to compile due to the '-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>' line inside the makefile. I saw on the forums about a fix for windows platform i.e. to change it to -DMBEDTLS_CONFIG_FILE=\"mbedtls_config.h\" instead. It does compiles but it fails on the ping test. During code generation process of MBEDTLS, it removes the MX_LWIP_Init() function from default task, and I am unable to find where it is called.

5- Another thing to mention is that after applying the definition fix for MBEDTLS config header file no other definition works such as;
- MBEDTLS_PLATFORM_C
- MBEDTLS_THREADING_C
All the definition are disabled for some reason. I cannot find where and how MBEDTLS calls the 'mbedtls_net_connect()'. Since Lwip thread is not running anymore ping test now always fails.

-----------

Now following are my queries:

QUERIES:

1- Is there any proper example available where it is shown how to enable MBEDTLS for H7 platforms?

2- I have currently no idea where to call the MX_LWIP_Init() function, or should it be called by any other function from the mbedtls.

3- Is there a proper fix for -DMBEDTLS_CONFIG_FILE=<mbedtls_config.h> inside makefile. Since it does not allow the code to compile.

 

Note: I am following How do I create a project for STM32H7 with Ethernet and LwIP stack working? thread provided on STM32 Knowledge base for LwIP settings.

 

 

0 REPLIES 0