Skip to main content
_AdamNtrx
Associate III
June 27, 2025
Solved

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

  • June 27, 2025
  • 2 replies
  • 648 views

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.
Best answer by ASEHST

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,

2 replies

ASEHSTBest answer
ST Employee
June 30, 2025

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
June 30, 2025

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?