Memory Requirements

Stack and Heap

Minimum stack size should be 2048 bytes, minimum heap size should be at least 2048 bytes.


EMAC Packet Buffer

The on-chip EMAC requires a packet buffer to be located in internal memory. Use the following instructions in your linker command file to map the packet buffer internally:

Definition in application linker command file App.cmd:

/*------------------------------------------------------------------------*/
/* define receive packet buffer size for EMAC DMA */
/* this buffer is divided into chunks of 0x600 bytes */
/* for best performance the maximum of 32 chunks should be used */
/* 32 x 0x600 == 0x0c000 */
/*------------------------------------------------------------------------*/
#define PBUFFER_SIZE 0x0c000
#define PBUFFER_ORG IRAM


packet buffer assignment in netlib linker command file \Libs\Netlib\net.cmd by using previous definition:

SECTIONS
{
.pbuffer {
_pbuffer_base = .;
_pbuffer_end = .;
} > PBUFFER_ORG /* must be located in internal memory section */
}

All other memories (buffers, etc.) are user-defined and application specific and may be allocated statically or dynamically.


netlib Code Section

The net.lib library uses two special code sections:

  • .nettextfast
  • .nettextslow

Performance critical functions are located in .nettextfast and should be mapped to fastest memory in the linker command file. .nettextslow can be linked to slower memory without noticeable performance penalties.


netlib .far Section

Also all .far sections should be located in internal memory to avoid cache coherence problems.


Example linker command instructions

Example linker command file: Refer to Example Linker Command File

Definition in application linker command file App.cmd:

#define NETSECFAST IRAM
#define NETSECSLOW SDRAM
#include "../../../Libs/Netlib/net.cmd"


Memory assignment in netlib linker command file \Libs\Netlib\net.cmd by using previous definition:

SECTIONS
{
.nettextfast > NETSECFAST /* fast netlib code */
.nettextslow > NETSECSLOW /* slow netlib code */
/* link .far section of additional libraries into internal RAM if required */
.far:NETLIB { -lnet.lib(.far) } > IRAM
/* .far:FTPLIB { -lftp.lib(.far) } > IRAM */
/* .far:FTPLIB { -lftpc.lib(.far) } > IRAM */
/* .far:FTPLIB { -lhttp.lib(.far) } > IRAM */
}




Common Modules Code Section

The Common Support Modules included with the Support SW can also be linked to external memory, since no time-critical function is defined within these modules. Use the following linker instruction to link these modules to external memory:


Definition in application linker command file App.cmd:

/* #define COMMONSECTIONS IRAM all common modules linked to internal RAM */
#define COMMONSECTIONS SDRAM /* all common modules linked to external RAM */
#include "../../../Common/CommonSections.cmd"


Memory assignment in linker command file \Common\CommonSections.cmd by using previous definition:

SECTIONS
{
/*------------------------------------------------------------------------*/
/* Support functions */
/*------------------------------------------------------------------------*/
.uarttext > COMMONSECTIONS /* UART code */
.cprintftext > COMMONSECTIONS /* CPrintf section */
.commontext > COMMONSECTIONS /* common code */
}




Code and Data Size

Required Code and Data size depends on used protocols and sockets:

Code Size:
Adapter + MAC + PHY 11392 bytes
ARP 3840 bytes
Sockets 15520 bytes
IP 2176 bytes
ICMP 3264 bytes
UDP 3200 bytes
TCP 15776 bytes
DNS 2848 bytes
DHCP 5696 bytes
Stack Size: 2048 bytes
Heap Size:
Adapter/PHY 228 bytes
per UDP/ICMP Socket 496 bytes
per TCP Socket 604 bytes
Static RAM:
ARP Cache 2444 bytes
TCP sequence number cache 4650 bytes