lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Compilation error encountered when using memory pool (


From: yanhc519
Subject: Re: [lwip-users] Compilation error encountered when using memory pool (MEM USE POOLS=1)
Date: Wed, 1 Jul 2020 22:38:56 +0800

Hi Simon,

Thanks for your explanation. I know the C preprocessor mechanism. I just want to find which line of code exactly make this define and may be defined as follows to generate MEMP_POOL_256 for LWIP_MALLOC_MEMPOOL(20, 256):

#define LWIP_MALLOC_MEMPOOL(num, size)    MEMP_POOL_##size

However, I searched memp.h, memp_priv.h, memp_std.h, and cannot find the exact line of definition code.

Regards,
York
On 7/1/2020 21:05goldsimon@gmx.de<goldsimon@gmx.de> wrote:
Hi York,

Please stay on the list next time.

Am 01.07.2020 um 14:55 schrieb yanhc519:
Thanks Simon. Your suggestion solved my issue.
However, I am wondering where defines the MEMP_POOL_256 macro. I tried
and cannot find the definition.
Could you give me a hint?

Call it "preprocessor magic". The parts in memp.h and memp_priv.h with
"MEMP_POOL_##size" (and similar) give you the required defines.

Regards,
Simon


Thanks again,
York

On 7/1/2020 20:23,goldsimon@gmx.de<goldsimon@gmx.de>
<mailto:goldsimon@gmx.de> wrote:

Am 01.07.2020 um 12:34 schrieb yanhc519 via lwip-users:

Hi all,

I want to use the memory pool in lwip. I define the following
macros to
1 to enable memory pool.
#define MEM_USE_POOLS1
#define MEMP_USE_CUSTOM_POOLS1
Also, I add a lwippool.h file to my project and define the
following:


You probably mean "lwippools.h" (note the s)?

#ifndef __LWIPPOOLS_H__
#define __LWIPPOOLS_H__


This file is special in that it is included multiple times with the
defines set to work differently each time. So you need to leave out the
include guard.

Regards,
Simon


LWIP_MALLOC_MEMPOOL_START
LWIP_MALLOC_MEMPOOL(20, 256)
LWIP_MALLOC_MEMPOOL_END

#endif /* __LWIPPOOLS_H__ */

However, when I compiled the project in MDK, an error encountered as
following:
..\..\..\..\Utilities\Third_Party\lwip-2.1.0\src\include\lwip/priv/memp_priv.h(89):
error:  #29: expected an _expression_.

memp_priv.h(89) is as following:
typedef enum {
    /* Get the first (via:
       MEMP_POOL_HELPER_START = ((u8_t) 1*MEMP_POOL_A +
0*MEMP_POOL_B +
0*MEMP_POOL_C + 0)*/
    MEMP_POOL_HELPER_FIRST = ((u8_t)
#define LWIP_MEMPOOL(name,num,size,desc)
#define LWIP_MALLOC_MEMPOOL_START 1
#define LWIP_MALLOC_MEMPOOL(num, size) * MEMP_POOL_##size + 0
#define LWIP_MALLOC_MEMPOOL_END
#include "lwip/priv/memp_std.h"
    ) ,

After preprocessing, the enumeration will be look like as this:
typedef enum {
    MEMP_POOL_HELPER_FIRST = ((u8_t)
1
 * MEMP_POOL_256 + 0
    ) ,

Since there is no definition of MEMP_POOL_256, so the compiler
reports
an error. 

Am I right? Is there anything I missing? How can I solve the issue?

Thanks,

York

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

[Prev in Thread] Current Thread [Next in Thread]