Skip to main content
Explorer
March 7, 2024
Solved

Title: Integrating cJSON, mbedTLS, lwIP, and FatFS into an STM32U5 project

  • March 7, 2024
  • 3 replies
  • 7489 views

I'm working on a project with an STM32U5 device (NUCLEO-U5A5ZJ-Q) and I need to integrate cJSON, mbedTLS, lwIP, and FatFS to load and flash a configuration file cacert.pemonto the STM32 device. However, when I searched for mbedtls and lwip in the middleware and software packages, I couldn't find them.

Can anyone provide suggestions or guidance on how to integrate mbedtls, lwIP, and FatFS into my STM32 project? Additionally, I'm curious if there's a cJSON library available for STM32.


https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/NUCLEO-U5A5ZJ-Q
https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Middlewares/Third_Party


https://github.com/STMicroelectronics/STM32CubeH7
https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Middlewares/Third_Party


I've noticed that the STM32H7 series has middleware third-party tools like lwIP and mbedTLS available, but these are not included in the STM32U5 series. Is there a specific reason why these middleware components are absent in the STM32U5 series compared to the H7 series?

Thank you in advance for your help!

    This topic has been closed for replies.
    Best answer by Andrew Neil

    @srikanthpalvai did you not see what @STea wrote:

     

    @STea wrote:

    Hello @srikanthpalvai ,

    Can you please input your new queries in a new thread for better visibility and we can proceed by closing this one .

    BR


    https://community.st.com/t5/stm32-mcus-embedded-software/title-integrating-cjson-mbedtls-lwip-and-fatfs-into-an-stm32u5/m-p/650011/highlight/true#M46183

     

    3 replies

    ST Employee
    March 7, 2024

    Hello @srikanthpalvai ,

    In fact MbedTLS is well supported in the STM32U5 series and it's part of the TFM solution implementation as you can find in the TFM project under TFM_SBSFU_Boot alt_xx.c files which leverage the wrapper layer of MbedTLS to be HW accelerated which are part of The PSA cryptography API that provides access to a set of cryptographic primitives .MbedTLS can be found under STM32CubeU5/Middlewares/Third_Party/mbed-crypto at main · STMicroelectronics/STM32CubeU5 (github.com).

    Regarding the support for  lwIP it is not supported for the U5 series instead you can replace it by the NetXduo from AzureRTOS you can find some examples of Netxduo Under STM32CubeU5/Projects/B-U585I-IOT02A/Applications/NetXDuo at main · STMicroelectronics/STM32CubeU5 (github.com)

    FatFS is replaced by Azure FileX you can find a n example on it's implementation under STM32CubeU5/Projects/B-U585I-IOT02A/Applications/FileX at main · STMicroelectronics/STM32CubeU5 (github.com).

    in the U5 series the Middleware Package is centered on the Azure middleware ecosystem you can read more about it in the Azure official documentation .

    BR

    Explorer
    March 7, 2024

    Thanks for the quick response  @STea 
     STM32CubeU5/Middlewares/Third_Party/mbed-crypto at main · STMicroelectronics/STM32CubeU5 (github.com).
    Would it be sufficient to copy the mbed-crypto directory directly into my project, or are there additional steps I need to follow for proper integration?

     STM32CubeU5/Projects/B-U585I-IOT02A/Applications/NetXDuo at main · STMicroelectronics/STM32CubeU5 (github.com)
    https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Middlewares/ST/netxduo

    How can I integrate the NetXDuo TCP/IP stack into my project after establishing a PPP communication link with the SIM7600 module?


    STM32CubeU5/Projects/B-U585I-IOT02A/Applications/FileX at main · STMicroelectronics/STM32CubeU5 (github.com).
    Here the example is to create the STM.TXT in the run-time 
    /* Create a file called STM32.TXT in the root directory. */
    nor_ospi_status = fx_file_create(&nor_ospi_flash_disk, "STM32.TXT");

    But I have my pre-configured config.ini file and cacert.pem files for mbedlts communication. 
    How can inject them into the stm32 target? Could you please share an example of it?

     Is there any cJSON library available for STM32?

    Super User
    March 7, 2024

    @srikanthpalvai wrote:

     Is there any cJSON library available for STM32?


    Why would it be in any way specific to STM32 ?

    Surely, it's just about parsing text - which isn't going to rely on anything STM32-specific?

    You can simply dump the source into your project:

    AndrewNeil_0-1709819029556.png

    https://github.com/DaveGamble/cJSON 

    Explorer
    March 11, 2024

    @STea 
    Thank you so much for the information.
    Could you please give me some more context below queries as well 

    STM32CubeU5/Projects/B-U585I-IOT02A/Applications/FileX at main · STMicroelectronics/STM32CubeU5 (github.com).
    Here the example is to create the STM.TXT in the run-time 
    /* Create a file called STM32.TXT in the root directory. */
    nor_ospi_status = fx_file_create(&nor_ospi_flash_disk, "STM32.TXT");

    But I have my pre-configured config.ini file and cacert.pem files for mbedlts communication. 
    How can inject them into the stm32 target? Could you please share an example of it?



    How can I integrate the NetXDuo TCP/IP stack into my project after establishing a PPP communication link with the SIM7600 module?



    ST Employee
    March 14, 2024

    Hello @srikanthpalvai ,

    Can you please input your new queries in a new thread for better visibility and we can proceed by closing this one .

    BR

    Explorer
    March 14, 2024

    @STea 

    Question 1:
    I have gone through this example.
    STM32CubeU5/Projects/B-U585I-IOT02A/Applications/FileX at main · STMicroelectronics/STM32CubeU5 (github.com).
    Here the example is to create the STM.TXT in the run-time 
    /* Create a file called STM32.TXT in the root directory. */
    nor_ospi_status = fx_file_create(&nor_ospi_flash_disk, "STM32.TXT");

    But I have my pre-configured config.ini file and cacert.pem files for mbedlts communication. 
    How can inject them into the stm32 target? Could you please share an example of it?


    Question 2:
    How can I integrate the NetXDuo TCP/IP stack into my project after establishing a PPP communication link with the SIM7600 module?

    Explorer
    March 15, 2024

    @STea Above 2 queries are pending 

    Super User
    March 16, 2024

    @srikanthpalvai did you not see what @STea wrote:

     

    @STea wrote:

    Hello @srikanthpalvai ,

    Can you please input your new queries in a new thread for better visibility and we can proceed by closing this one .

    BR


    https://community.st.com/t5/stm32-mcus-embedded-software/title-integrating-cjson-mbedtls-lwip-and-fatfs-into-an-stm32u5/m-p/650011/highlight/true#M46183