AnsweredAssumed Answered

CubeMX 4.19 LwIP build broken

Question asked by john doe on Feb 16, 2017
Latest reply on Jul 4, 2017 by E. A.

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

Outcomes