Configuring Memory Options - 2023.1 English

Standalone Library Documentation: BSP and Libraries Document Collection (UG643)

Document ID
UG643
Release Date
2023-05-16
Version
2023.1 English

The lwIP stack provides different kinds of memories. Similarly, when the application uses socket mode, different memory options are used. All the configurable memory options are provided as a separate category. Default values work well unless application tuning is required. The following table describes the memory parameter options.

Attribute Default Type Description
mem_size 131072 Integer Total size of the heap memory available, measured in bytes. For applications which use a lot of memory from heap (using C library malloc or lwIP routine mem_malloc or pbuf_alloc with PBUF_RAM option), this number should be made higher as per the requirements.
memp_n_pbuf 16 Integer The number of memp struct pbufs. If the application sends a lot of data out of ROM (or other static memory), this should be set high.
memp_n_udp_pcb 4 Integer The number of UDP protocol control blocks. One per active UDP connection.
memp_n_tcp_pcb 32 Integer The number of simultaneously active TCP connections.
memp_n_tcp_pcb _listen 8 Integer The number of listening TC connections.
memp_n_tcp_seg 256 Integer The number of simultaneously queued TCP segments.
memp_n_sys_timeout 8 Integer Number of simultaneously active timeouts.
memp_num_netbuf 8 Integer Number of allowed structure instances of type netbufs. Applicable only in socket mode.
memp_num_netconn 16 Integer Number of allowed structure instances of type netconns. Applicable only in socket mode.
memp_num_api_msg 16 Integer Number of allowed structure instances of type api_msg. Applicable only in socket mode.
memp_num_tcpip_msg 64 Integer Number of TCPIP msg structures (socket mode only).
Note: Because Sockets Mode support uses Xilkernel services, the number of semaphores chosen in the Xilkernel configuration must take the value set for the memp_num_netbuf parameter into account. For FreeRTOS BSP there is no setting for the maximum number of semaphores. For FreeRTOS, you can create semaphores as long as memory is available.