Memory Requirements

Stack and Heap

Minimum stack size should be 2048 bytes. Minimum heap size depends on configuration. By default 7000 bytes of heap are necessary, but up to 5000 bytes can optionally be placed into bss section when necessary.


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 L2RAM
SECTIONS
{
.pbuffer {
_pbuffer_base = .;
_pbuffer_end = .;
} > PBUFFER_ORG align 128
}


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

/*------------------------------------------------------------------------*/
/* 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 L2RAM
SECTIONS
{
.pbuffer {
_pbuffer_base = .;
_pbuffer_end = .;
} > PBUFFER_ORG align 128
}

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 L2RAM
#define NETSECSLOW SDRAM
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*.a*(.far) } > L2RAM
.fardata:NETLIB { -lnet.a*(.fardata) } > L2RAM
/* .far:FTPLIB { -lftp.a*(.far) } > L2RAM */
/* .far:FTPCLIB { -lftpc.a*(.far) } > L2RAM */
/* .far:HTTPLIB { -lhttp.a*(.far) } > L2RAM */
}
#include "../../../Libs/Netlib/net.cmd"


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

#define NETSECFAST L2RAM
#define NETSECSLOW SDRAM
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*.a*(.far) } > L2RAM
/* .far:FTPLIB { -lftp.a*(.far) } > L2RAM */
/* .far:FTPCLIB { -lftpc.a*(.far) } > L2RAM */
/* .far:HTTPLIB { -lhttp.a*(.far) } > L2RAM */
}




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 L2RAM all common modules linked to internal RAM */
#define COMMONSECTIONS SDRAM /* all common modules linked to external RAM */
SECTIONS
{
/*------------------------------------------------------------------------*/
/* Support functions */
/*------------------------------------------------------------------------*/
.uarttext > COMMONSECTIONS /* UART code */
.cprintftext > COMMONSECTIONS /* CPrintf section */
.commontext > COMMONSECTIONS /* common code */
}


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 10272 bytes
ARP 3552 bytes
Sockets + MEMB + str 14560 bytes
IP 2560 bytes
ICMP 2176 bytes
UDP 2656 bytes
TCP 18112 bytes
DNS 1792 bytes
DHCP 6176 bytes
Stack Size: 2048 bytes
Heap Size:
Adapter/PHY 272 bytes
per UDP/ICMP Socket 508 bytes
per TCP Socket 668 bytes
optional on heap or static
Socket send FIFO 1792 bytes
TCP send seq numbers 5120 bytes
ARP list entries 1200 bytes