cancel
Showing results for 
Search instead for 
Did you mean: 

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

_AdamNtrx
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
ASEHST
ST Employee

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".

View solution in original post

2 REPLIES 2
ASEHST
ST Employee

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".

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?