Issue with srand() causing exit in STM32H747 Project with FreeRTOS and lwIP
Hello everyone,
I’m encountering an issue with the srand() function in my STM32H747 project, and I would appreciate your insights on what might be causing this problem.
Hardware:
- MCU: STM32H747IIT6
- Custom board
Software setup:
- CubeMX-generated project
- Cube CLT version: 1.17
- Firmware version: 1.12.1
Problem Description
Whenever I call the srand() function, my code immediately ends up in the exit handler.
To troubleshoot, I created a minimal project with no additional middleware (bare minimum setup), and in that setup, the srand() function works without any issues.
However, in my main project where I need both lwIP and FreeRTOS, calling srand() causes an exit. The project was created following this guide:
How to Create a Project for STM32H7 with Ethernet and lwIP Stack.
I made one modification to the guide: instead of using the default OS wrapper, I selected CMSIS_V2.
Currently, I am only using the M7 core.
What I’ve Tried So Far
- Minimal project without lwIP and FreeRTOS -> srand(12345) works fine.
- Project with lwIP and FreeRTOS -> srand(12345) causes an exit.
I’ve attached an image showing the callstack where the issue occurs. I hope this helps in diagnosing the problem.
Here’s a link to my code: GitHub Repository
Does anyone have any ideas on what might be causing this issue? Could it be related to the use of CMSIS_V2, a conflict with FreeRTOS, or possibly a memory issue?
Thank you in advance for your help!
Best regards,
Oskar
