cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX 4.19 LwIP build broken

john doe
Lead
Posted on February 16, 2017 at 13:14

arm-none-eabi-gcc -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 -D__weak='__attribute__((weak))' -D__packed='__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F769xx -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Inc' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/system' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Drivers/STM32F7xx_HAL_Driver/Inc' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Drivers/STM32F7xx_HAL_Driver/Inc/Legacy' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/FatFs/src/drivers' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Drivers/CMSIS/Device/ST/STM32F7xx/Include' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/FatFs/src' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/FreeRTOS/Source/include' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/lwip' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/lwip/apps' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/lwip/priv' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/lwip/prot' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/netif' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/netif/ppp' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/netif/ppp/polarssl' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/posix' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/posix/sys' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/system/arch' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Drivers/CMSIS/Include' -I'/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Inc'  -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF'Middlewares/Third_Party/LwIP/src/core/init.d' -MT'Middlewares/Third_Party/LwIP/src/core/init.o' -o 'Middlewares/Third_Party/LwIP/src/core/init.o' '../Middlewares/Third_Party/LwIP/src/core/init.c'

In file included from ../Middlewares/Third_Party/LwIP/src/core/init.c:47:0:

/Users/john/src/stm32/stm32f7xx/sdcard+lcd/sdcard+lcd/Middlewares/Third_Party/LwIP/src/include/lwip/sockets.h:442:8: error: redefinition of 'struct timeval'

so we look in sockets.h and what do we find?

/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided

 * by your system, set this to 0 and include <sys/time.h> in cc.h */

#ifndef LWIP_TIMEVAL_PRIVATE

#define LWIP_TIMEVAL_PRIVATE 1

#endif

#if LWIP_TIMEVAL_PRIVATE

struct timeval {

  long    tv_sec;         /* seconds */

  long    tv_usec;        /* and microseconds */

};

CubeMX puts cc.h in Middlewares/LwIP/system/arch/

setting LWIP_TIMEVAL_PRIVATE to 0 and adding #include <sys/time.h> to cc.h allows LwIP to build

3 REPLIES 3
Imen.D
ST Employee
Posted on February 16, 2017 at 13:55

Hello john doe,

I reported your feedback internally and you can refer to this discussion with same issue

 

https://community.st.com/0D50X00009XkYWsSAN

 . 

Hope this will help you.

Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on July 04, 2017 at 14:10

This issue will be fixed in next STM32CubeMX 4.22.0 release.

TDrzy
Associate II

I have the same error in 5.0.0 revision with STM32F107 :\

In file included from ..\Middlewares\Third_Party\LwIP\src\core\init.c:47:0:
../Middlewares/Third_Party/LwIP/src/include/lwip/sockets.h:442:8: error: redefinition of 'struct timeval'
 struct timeval {
        ^~~~~~~
In file included from c:\program files (x86)\atollic\truestudio for stm32 9.1.0\armtools\arm-atollic-eabi\include\sys\select.h:26:0,
                 from c:\program files (x86)\atollic\truestudio for stm32 9.1.0\armtools\arm-atollic-eabi\include\sys\types.h:68,
                 from c:\program files (x86)\atollic\truestudio for stm32 9.1.0\armtools\arm-atollic-eabi\include\stdio.h:61,
                 from ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h:50,
                 from ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h:45,
                 from ../Inc/stm32f1xx_hal_conf.h:219,
                 from ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h:46,
                 from ../Inc/main.h:61,
                 from ../Inc/lwipopts.h:55,
                 from ../Middlewares/Third_Party/LwIP/src/include/lwip/opt.h:51,
                 from ..\Middlewares\Third_Party\LwIP\src\core\init.c:38:
c:\program files (x86)\atollic\truestudio for stm32 9.1.0\armtools\arm-atollic-eabi\include\sys\_timeval.h:52:8: note: originally defined here
 struct timeval {
        ^~~~~~~