AnsweredAssumed Answered

Problems with LWIP port in ksdk v2.2

Question asked by Andrew Parlane on May 1, 2017
Latest reply on Jun 22, 2017 by Andrew Parlane

I've had to make some changes to get LWIP building in my project. I think these issues are in LWIP port and not on my end.

 

  1. My project is C++ whereas LWIP and the port are C. ethernetif.h is missing the extern "C" wrapper. Meaning netif_add(..., ethernetif_init, ...); fails as it can't find the symbol ethernetif_init.
  2. lwipopts.h is in the port folder. This should be a project specific file and not included in the port. I could set up the include directory lists to make sure it includes the custom file first if it exists, but that kind of seems nasty and prone to weird bugs. If you want to add an example file, it should be lwipopts.h.example or something, so it doesn't get  used by default.
  3. There's a compile issue with both port/cc.h and src/include/lwip/arch.h defining basic types like u8_t. You can fix this by defining LWIP_NO_STDINT_H as per the comment in arch.h.

/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
* the stdint.h header. This cannot be \#defined in lwipopts.h since
* this is not an option of lwIP itself, but an option of the lwIP port
* to your system.
* Additionally, this header is meant to be \#included in lwipopts.h
* (you may need to declare function prototypes in there).
*/

This specifically states that it should be defined in cc.h and not in lwipopts.h Yet it is defined in your default lwipopts.h and not in cc.h. Also it's designed for if there isn't a stdint.h which there is by default.

 

I'm not sure how to fix this one. The easy but maybe not entirely correct version is to define LWIP_NO_STDINT_H in cc.h. It would be better if we could not define the basic types in cc.h and just use the arch.h version, but this messes up the u32_t lwip_rand(void) signiture in sys_arch.h and I'm not all too sure how to fix that.

 

If these issues could be patched in the next KSDK version, that'd be great.

 

Thanks,

Andrew Parlane

Outcomes