Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building with MEM_USE_POOLS=1 #11

Open
st0ff3r opened this issue Oct 26, 2018 · 4 comments
Open

building with MEM_USE_POOLS=1 #11

st0ff3r opened this issue Oct 26, 2018 · 4 comments

Comments

@st0ff3r
Copy link

st0ff3r commented Oct 26, 2018

anyone succeed in building with MEM_USE_POOLS=1 to avoid memory fragmentation?

tried to removed attr/DMEM_ATTR parameters in meme_std.h and creating a lwippools.h with:

#if MEM_USE_POOLS
LWIP_MALLOC_MEMPOOL_START
LWIP_MALLOC_MEMPOOL(100, 256)
LWIP_MALLOC_MEMPOOL(50, 512)
LWIP_MALLOC_MEMPOOL(20, 1024)
LWIP_MALLOC_MEMPOOL(20, 1536)
LWIP_MALLOC_MEMPOOL_END
#endif /* MEM_USE_POOLS */

but still get error when compiling:

In file included from lwip/core/memp.c:141:0:
include/lwip/memp_std.h:42:1: error: initializer element is not constant
LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB")
^
include/lwip/memp_std.h:42:1: error: (near initialization for 'memp_num[2]')
lwip/core/memp.c:160:47: error: variably modified 'memp_memory_TCP_PCB_base' at file scope
#define LWIP_MEMPOOL(name,num,size,desc) u8_t memp_memory_ ## name ## _base
^
include/lwip/memp_std.h:42:1: note: in expansion of macro 'LWIP_MEMPOOL'
LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB")
^

think I don't quite understand how the LWIP_MEMPOOL macro stuff works

any clues?

@st0ff3r
Copy link
Author

st0ff3r commented Oct 26, 2018

if I change
#define MEMP_NUM_TCP_PCB ((volatile uint32)0x600011FC)
to
#define MEMP_NUM_TCP_PCB 5
it gets a little bit further.

makes sense because ((volatile uint32)0x600011FC) is not a static value

now the compilation dies at

lwip/netif/etharp.c: In function 'etharp_query':
lwip/netif/etharp.c:1163:20: error: 'MEM_ARP_QUEUE' undeclared (first use in this function)
memp_free(MEM_ARP_QUEUE, old);

@st0ff3r
Copy link
Author

st0ff3r commented Oct 26, 2018

in lwip/netif/etharp.c line 116
memp_free(MEM_ARP_QUEUE, old);

needs to be

memp_free(MEMP_ARP_QUEUE, old);

@st0ff3r
Copy link
Author

st0ff3r commented Oct 26, 2018

ld: address 0x4000e118 of build/app.out section .bss' is not within region dram0_0_seg'
ld: address 0x4000e118 of build/app.out section .bss' is not within region dram0_0_seg'
liblwip_open.a(dns.o): In function dns_parse_name': dns.c:(.irom0.text+0x54): undefined reference to os_zalloc'
dns.c:(.irom0.text+0x58): undefined reference to `os_free'

can see from my linker map that memp is eating up the RAM:

.bss 0x000000003fff0c40 0x1b34c liblwip_open.a(memp.o)

any suggestions?

@martin-ger
Copy link
Owner

No real idea - sorry. As the code is actually from the esp-open-sdk I assume, that never anybody has tried to compile this with this option for the ESP.

I would read the last error: .bbs not within dram as: too much RAM allocated for static variables (buffers)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants