cancel
Showing results for 
Search instead for 
Did you mean: 

LwIP UDP Define has no reference

andy b
Senior
Posted on June 22, 2017 at 17:28

Hello fellow Ethernet explorers

I am currently trying to make a UDP connection between a stm32f4 discovery board and a pc.I have already made an example work and I am now trying to replicate the result but with a program made from scratch.When trying to build, the IDE tells me that the define ''MEMP_UDP_PCB'' is unknown.The error appears twice in the udp.c file.I have tried searching other reference in my project and have found none.Does anyone know what value should this be defined to? It's used in  udp_new() and udp_remove() functions more specifically it's used for:

pcb = (struct udp_pcb*)memp_malloc(MEMP_UDP_PCB)

and :

memp_free(

MEMP_UDP_PCB,pcb

Any help is much appreciated.

-Andy

#lwip #ethernet
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on June 22, 2017 at 17:43

The enum symbols individual memory pools are generated by the preprocessor, see [lwip]\src\include\lwip\memp.h

/* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */

typedef enum {

#define LWIP_MEMPOOL(name,num,size,desc)  MEMP_##name,

#include 'lwip/memp_std.h'

  MEMP_MAX

} memp_t;

JW

View solution in original post

4 REPLIES 4
Posted on June 22, 2017 at 17:43

The enum symbols individual memory pools are generated by the preprocessor, see [lwip]\src\include\lwip\memp.h

/* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */

typedef enum {

#define LWIP_MEMPOOL(name,num,size,desc)  MEMP_##name,

#include 'lwip/memp_std.h'

  MEMP_MAX

} memp_t;

JW

Posted on June 22, 2017 at 18:01

Hi

What weird is that this project has been generated using the Cube MX so why does this have no definition associated to it ? Thanks for your response but I still dont know what I should put as a define value.

-Andy
Posted on June 22, 2017 at 18:42

You are not supposed to define MEMP_UDP_PCB explicitly - it's defined as an enum constant by preprocessor 'magic' in the enum I showed you above (and in the header it includes, look it up). It should be enough to have LWIP_UDP defined as 1 (well, nonzero) in lwipopts.h, i.e. the user-defined lwip-options header.

I don't and won't use Cube/MX so I won't/can't comment on that.

I also don't know your toolchain/IDE and I don't know which component of it told you it is missing. If it's an over smart editor which can't find the definition for you to jump to it, it's just an annoyance and you can ignore it. If it's the compiler, then there's something wrong in the order of files inclusion, best to be solved by looking at the preprocessed output of udp.c (again I can't tell you how to do that as it's toolchain-dependent).

JW

Posted on June 22, 2017 at 19:10

Hi

Again thanks for the response.

Im using Systeme Workbench as an IDE (just a pimped version of eclipse for stm32's) 

I've started a new project from scratch and the error has not reoccured .Probably because eclipse really doesnt like it when you rename a project.I had no choice to rename mine because apparently the debugger hates it when you have a space in the name of your project.That probably messed up the project preference / preprocessing.Tried clean the project but that did nothing.Well just had started so restarting on a new project is no biggie.

-Andy