Skip to main content
_AdamNtrx
Associate III
Jun 27, 2025 12:02 PM UTC
Solved

I-CUBE-wolfMQTT example code uses LwIP's sockets despite not using FreeRTOS.

I added I-CUBE-wolfMQTT and I-CUBE-wolfSSL software packs to my STM32CubeIDE project in CubeMX built into CubeIDE. In CubeMX I set parameters:

  • for wolfSSL:
    • RTOS - Single THreaded (no RTOS / Baremetal)
    • IO interface - LWIP (native API)
  • for wolfMQTT:
    • FREERTOS Support - False
    • IO - LWIP

Despite that, trying to compile project ends up with errors like "'SOL_SOCKET' undeclared (first use in this function)" or "'AF_INET' undeclared (first use in this function)". It is because example code uses sockets from LwIP library which can't be used if FreeRTOS is disabled. Even in lwipopts.h LWIP_SOCKET is defined to 0 and you can't enable it in CubeMX if NO_SYS (OS Awarness) is set to OS Not Used. 

Am I missing something? Did I misconfigure settings in CubeMX or are provided examples just wrong?

This topic has been closed for replies.
ASEHSTBest answer
ST Employee
Jun 30, 2025 9:28 AM UTC

Hello @_AdamNtrx,

Thank you for your report.

The issue arises because the I-CUBE-wolfMQTT examples use BSD sockets via LWIP, which requires FreeRTOS to be enabled (NO_SYS=0) to provide this socket interface.

In your current configuration (NO_SYS=1, FreeRTOS disabled), LWIP does not provide the socket definitions and functions, hence the errors 'SOL_SOCKET' undeclared and 'AF_INET' undeclared.

To resolve this issue, please try to:

  • Enable FreeRTOS in CubeMX (NO_SYS=0) to use the BSD socket interface with LWIP, which matches the configuration expected by the examples.
  • Or adapt the code to use LWIP’s raw API, but this requires specific development since the current examples do not support this mode.

 

With Regards,

"If your question is answered, please close this topic by clicking ""Accept as Solution""."

2 replies

ASEHSTBest answer
ST Employee
Jun 30, 2025 9:28 AM UTC

Hello @_AdamNtrx,

Thank you for your report.

The issue arises because the I-CUBE-wolfMQTT examples use BSD sockets via LWIP, which requires FreeRTOS to be enabled (NO_SYS=0) to provide this socket interface.

In your current configuration (NO_SYS=1, FreeRTOS disabled), LWIP does not provide the socket definitions and functions, hence the errors 'SOL_SOCKET' undeclared and 'AF_INET' undeclared.

To resolve this issue, please try to:

  • Enable FreeRTOS in CubeMX (NO_SYS=0) to use the BSD socket interface with LWIP, which matches the configuration expected by the examples.
  • Or adapt the code to use LWIP’s raw API, but this requires specific development since the current examples do not support this mode.

 

With Regards,

"If your question is answered, please close this topic by clicking ""Accept as Solution""."
_AdamNtrx
_AdamNtrxAuthor
Associate III
Jun 30, 2025 12:49 PM UTC

Thank you for the answer. Do you know by any chance which parts of the code need to be changed to use LwIP's raw API?