cancel
Showing results for 
Search instead for 
Did you mean: 

LWIP Project Settings Compilation Error No HAL No SYS

######
Senior

Hello,

I've been trying to write my own HAL to replace the STM32 HAL and recently I have been trying to write an LwIP interface, with guidance from this forum and the examples provided by ST and other users.

My Individual files compile fine, including my ethernetif.c and lwip.c files.

The included LwIP library files however are throwing errors during compilation (see screenshots). 

Can anyone advise? 

When I compare to a Cube generated project, my IAR is including extra header files, such as bpstruct.h as shown below. I'm wondering if this is a project configuration error, as opposed to a source code error?

Grateful for any comments.

1 ACCEPTED SOLUTION

Accepted Solutions
######
Senior

Update:

After picking through the project I've found removing the inclusion of my version of lwip.h from main.h and then calling it after in main.c has solved the errors.

I must have some sort of "code smell" in my project which is currently undiagnosed. Most of my files point to main.h.

View solution in original post

7 REPLIES 7
LCE
Principal

I somehow remember I once had some of the error messages, like PBUF_*, but I can't remember how I solved this.
Anyway, I'm using STM32CubeIDE only...

But you are definitely missing the lwIP types like u16_t, I would look for these first.

Here's what's included via the project settings:

LCE_0-1716470309439.png

 

######
Senior

Thanks @LCE for the reply.

I've checked those project locations and they are the same as mine. 

I've even taken a cube project and then copied my files in, keeping LWIP files where they are, and then removed the cube files.

These are my include paths from my .ewp file:

$PROJ_DIR$/../Core/Inc
$PROJ_DIR$/../LWIP/App
$PROJ_DIR$/../LWIP/Target
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/system
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/netif/ppp
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/apps/http
$PROJ_DIR$/../Drivers/CMSIS/Device/ST/STM32F4xx/Include
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/lwip
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/lwip/apps
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/lwip/priv
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/lwip/prot
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/netif
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/compat/posix
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/compat/posix/net
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/src/include/compat/stdc
$PROJ_DIR$/../Middlewares/Third_Party/LwIP/system/arch
$PROJ_DIR$/../Drivers/CMSIS/Include

Everyone of the LwIP c files below gives me the errors that I posted above in def_c.png

$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\altcp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\altcp_alloc.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\altcp_tcp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\api_lib.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\api_msg.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\auth.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv4\autoip.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\bridgeif.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\bridgeif_fdb.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\ccp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\chap-md5.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\chap-new.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\chap_ms.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\def.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\demand.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv4\dhcp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\dhcp6.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\dns.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\eap.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\ecp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\err.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv4\etharp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ethernet.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\ethip6.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\eui64.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\apps\http\fs.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\fsm.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\apps\http\httpd.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv4\icmp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\icmp6.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\if_api.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv4\igmp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\inet6.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\inet_chksum.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\init.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ip.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv4\ip4.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv4\ip4_addr.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv4\ip4_frag.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\ip6.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\ip6_addr.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\ip6_frag.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\ipcp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\ipv6cp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\lcp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\lowpan6.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\lowpan6_ble.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\lowpan6_common.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\magic.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\mem.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\memp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\mld6.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\mppe.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\apps\mqtt\mqtt.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\multilink.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\ipv6\nd6.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\netbuf.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\netdb.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\netif.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\netifapi.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\pbuf.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\ppp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\pppapi.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\pppcrypt.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\pppoe.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\pppol2tp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\pppos.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\raw.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\slipif.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\sockets.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\stats.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\sys.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\tcp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\tcp_in.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\tcp_out.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\api\tcpip.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\timeouts.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\core\udp.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\upap.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\utils.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\ppp\vj.c
$PROJ_DIR$\..\Middlewares\Third_Party\LwIP\src\netif\zepif.c

 

Thanks again for the help.

LCE
Principal

Have you checked with the IAR guys?

I don't know if it's of any help, here's what I have in main.c - and I was quite surprised that all this did not work when putting it into main.h as I was used to from my "8-bit compilers".

See line 18 with include lwip.h

/* Includes ------------------------------------------------------------------*/

#include "main.h"

#if(0)
	some "no-C" comments (for better visibility within #if(0) - #endif):
#endif

#if(0)
	- header files must be HERE, otherwise CubeIDE
		compilers do NOT work with the lwIP stuff (WTF?)
#endif

#include "adc.h"
#include "dac.h"
#include "dma.h"
#include "i2c.h"
#include "lwip.h"
#include "sai.h"
#include "i2s.h"
#include "tim.h"
#include "rtc.h"
#include "fdcan.h"
#include "ospi_ram.h"
#include "ospi_flash.h"
#include "flash_int.h"
#include "usart.h"
#include "gpio.h"

#include "uart_processing.h"

#include "spdif_tx.h"
#include "Audio2IP.h"

#include "dhcp_user.h"
#include "http_cgi_ssi.h"

#include "sntp.h"
#include "dns.h"

#include "streaming.h"
#include "tcp_echo.h"

#include "ptpd_dep.h"
#include "ptpd.h"

#include "Def_Audio.h"

#include "vcxo.h"

#include "lwip/apps/lwiperf.h"

######
Senior

It's funny you say that actually... I had something similar with regards headers in header files, but then needing to actually be in the c file. Hence there seems to be duplicate includes in my ethernetif.c

LCE
Principal

Duplicate includes .h all over the place in my sources, but I won't touch it anymore as it is working now. :D

Though it feels something between wrong and embarrassing...

in ethernetif.c :
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* includes */

#include "main.h"
#include "lwip/opt.h"
#include "lwip/mem.h"
#include "lwip/memp.h"
#include "lwip/timeouts.h"
#include "netif/ethernet.h"
#include "netif/etharp.h"
#include "lwip/ethip6.h"
#include "ethernetif.h"
#include <string.h>

#include "dhcp_user.h"

#include "ptpd_dep.h"
#include "ptpd.h"

------------------------------

in ethernetif.h :
#include "main.h"

#include "lwip/err.h"
#include "lwip/netif.h"

#include "Def_Audio.h"
#include "streaming.h"

 

Thanks for replying. I've got exactly the same as you (except dhcp which im not using, and the ptp which i'm not using + your other project dependent headers).

For some reason (compared to the cube) my project is pulling in and trying to process other header files which I don't think are needed. For example i'm not using an RTOS, however it's wanting the cmsis_os features. 

I've done a list of the "extra" headers its including...

bpstruct.h

def.h

dhcp.h

epstruct.h

err.h

mem.h

memp_priv.h

memp_std.h

pbuf.h

stats.h

sys.h

sys_arch.h

 

I've checked my lwipopts.h file and its the same as the cube example. I'm using the same compiler as the cube example. As I say, when I replace my files with the Cube HAL suddenly it tries to process the extra header files above that aren't required.

Thanks again for the help.

######
Senior

Update:

After picking through the project I've found removing the inclusion of my version of lwip.h from main.h and then calling it after in main.c has solved the errors.

I must have some sort of "code smell" in my project which is currently undiagnosed. Most of my files point to main.h.