Ethernet for Nucleo and Disco board STM32F746 works with gcc and arm. IAC is untested

Dependents:   STM32F746_iothub_client_sample_mqtt DISCO-F746NG_Ethernet Nucleo_F746ZG_Ethernet thethingsiO-DISCO_F746NG-mqtt ... more

Committer:
DieterGraef
Date:
Sun Jun 19 16:23:40 2016 +0000
Revision:
0:d26c1b55cfca
Ethernet Library for Nucleo stm32f746ZG and Disco stm32f746NG  works under arm and gcc environment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:d26c1b55cfca 1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DieterGraef 0:d26c1b55cfca 2 // Copyright (c) Microsoft Corporation. All rights reserved.
DieterGraef 0:d26c1b55cfca 3 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DieterGraef 0:d26c1b55cfca 4
DieterGraef 0:d26c1b55cfca 5 #ifndef _DRIVERS_NETWORK_DEFINES_LWIP_H_
DieterGraef 0:d26c1b55cfca 6 #define _DRIVERS_NETWORK_DEFINES_LWIP_H_ 1
DieterGraef 0:d26c1b55cfca 7
DieterGraef 0:d26c1b55cfca 8 /* Pick min, default or max configuration based on platform */
DieterGraef 0:d26c1b55cfca 9 #include <lwip_selector.h>
DieterGraef 0:d26c1b55cfca 10
DieterGraef 0:d26c1b55cfca 11 #if !defined(NETWORK_MEMORY_PROFILE_LWIP__small) && !defined(NETWORK_MEMORY_PROFILE_LWIP__medium) && !defined(NETWORK_MEMORY_PROFILE_LWIP__large) && !defined(NETWORK_MEMORY_PROFILE_LWIP__custom)
DieterGraef 0:d26c1b55cfca 12 #error You must define a NETWORK_MEMORY_PROFILE_LWIP_xxx for this platform
DieterGraef 0:d26c1b55cfca 13 #endif
DieterGraef 0:d26c1b55cfca 14
DieterGraef 0:d26c1b55cfca 15 #define TCPIP_LWIP 1
DieterGraef 0:d26c1b55cfca 16
DieterGraef 0:d26c1b55cfca 17 /* min, default, max configuration for lwIP. Values have initially
DieterGraef 0:d26c1b55cfca 18 been taken from lwiopts.small.h, lwipopts.h and lwipopts.big.h */
DieterGraef 0:d26c1b55cfca 19
DieterGraef 0:d26c1b55cfca 20 /* MEM_SIZE: the size of the heap memory. If the application will send
DieterGraef 0:d26c1b55cfca 21 a lot of data that needs to be copied, this should be set high. */
DieterGraef 0:d26c1b55cfca 22 #define MEM_SIZE__min (16*1024)
DieterGraef 0:d26c1b55cfca 23 #define MEM_SIZE__default (64*1024)
DieterGraef 0:d26c1b55cfca 24 #define MEM_SIZE__max (1024*1024) // TODO - this seems a bit extreme
DieterGraef 0:d26c1b55cfca 25
DieterGraef 0:d26c1b55cfca 26 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
DieterGraef 0:d26c1b55cfca 27 sends a lot of data out of ROM (or other static memory), this
DieterGraef 0:d26c1b55cfca 28 should be set high. */
DieterGraef 0:d26c1b55cfca 29 #define MEMP_NUM_PBUF__min 16
DieterGraef 0:d26c1b55cfca 30 #define MEMP_NUM_PBUF__default 32
DieterGraef 0:d26c1b55cfca 31 #define MEMP_NUM_PBUF__max 32
DieterGraef 0:d26c1b55cfca 32
DieterGraef 0:d26c1b55cfca 33 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
DieterGraef 0:d26c1b55cfca 34 per active UDP "connection". */
DieterGraef 0:d26c1b55cfca 35 #define MEMP_NUM_UDP_PCB__min 6
DieterGraef 0:d26c1b55cfca 36 #define MEMP_NUM_UDP_PCB__default 8
DieterGraef 0:d26c1b55cfca 37 #define MEMP_NUM_UDP_PCB__max 16
DieterGraef 0:d26c1b55cfca 38
DieterGraef 0:d26c1b55cfca 39 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
DieterGraef 0:d26c1b55cfca 40 connections. */
DieterGraef 0:d26c1b55cfca 41 #define MEMP_NUM_TCP_PCB__min 8
DieterGraef 0:d26c1b55cfca 42 #define MEMP_NUM_TCP_PCB__default 16
DieterGraef 0:d26c1b55cfca 43 #define MEMP_NUM_TCP_PCB__max 32
DieterGraef 0:d26c1b55cfca 44
DieterGraef 0:d26c1b55cfca 45 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
DieterGraef 0:d26c1b55cfca 46 connections. */
DieterGraef 0:d26c1b55cfca 47 #define MEMP_NUM_TCP_PCB_LISTEN__min 4
DieterGraef 0:d26c1b55cfca 48 #define MEMP_NUM_TCP_PCB_LISTEN__default 8
DieterGraef 0:d26c1b55cfca 49 #define MEMP_NUM_TCP_PCB_LISTEN__max 12
DieterGraef 0:d26c1b55cfca 50
DieterGraef 0:d26c1b55cfca 51 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
DieterGraef 0:d26c1b55cfca 52 segments. */
DieterGraef 0:d26c1b55cfca 53 #define MEMP_NUM_TCP_SEG__min 32
DieterGraef 0:d26c1b55cfca 54 #define MEMP_NUM_TCP_SEG__default 64
DieterGraef 0:d26c1b55cfca 55 #define MEMP_NUM_TCP_SEG__max 128
DieterGraef 0:d26c1b55cfca 56
DieterGraef 0:d26c1b55cfca 57 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
DieterGraef 0:d26c1b55cfca 58 timeouts. */
DieterGraef 0:d26c1b55cfca 59 #define MEMP_NUM_SYS_TIMEOUT__min 8 // set to 3 in lwiopts.small.h but didn't compile
DieterGraef 0:d26c1b55cfca 60 #define MEMP_NUM_SYS_TIMEOUT__default 12
DieterGraef 0:d26c1b55cfca 61 #define MEMP_NUM_SYS_TIMEOUT__max 16
DieterGraef 0:d26c1b55cfca 62
DieterGraef 0:d26c1b55cfca 63 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
DieterGraef 0:d26c1b55cfca 64 #define MEMP_NUM_NETBUF__min 8
DieterGraef 0:d26c1b55cfca 65 #define MEMP_NUM_NETBUF__default 16
DieterGraef 0:d26c1b55cfca 66 #define MEMP_NUM_NETBUF__max 32
DieterGraef 0:d26c1b55cfca 67
DieterGraef 0:d26c1b55cfca 68 /* MEMP_NUM_NETCONN: the number of struct netconns. */
DieterGraef 0:d26c1b55cfca 69 #define MEMP_NUM_NETCONN__min 10
DieterGraef 0:d26c1b55cfca 70 #define MEMP_NUM_NETCONN__default 20
DieterGraef 0:d26c1b55cfca 71 #define MEMP_NUM_NETCONN__max 40
DieterGraef 0:d26c1b55cfca 72
DieterGraef 0:d26c1b55cfca 73 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
DieterGraef 0:d26c1b55cfca 74 #define PBUF_POOL_SIZE__min 40
DieterGraef 0:d26c1b55cfca 75 #define PBUF_POOL_SIZE__default 128
DieterGraef 0:d26c1b55cfca 76 #define PBUF_POOL_SIZE__max 256
DieterGraef 0:d26c1b55cfca 77
DieterGraef 0:d26c1b55cfca 78 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
DieterGraef 0:d26c1b55cfca 79 #define PBUF_POOL_BUFSIZE__min 512
DieterGraef 0:d26c1b55cfca 80 #define PBUF_POOL_BUFSIZE__default 1024
DieterGraef 0:d26c1b55cfca 81 #define PBUF_POOL_BUFSIZE__max 2048
DieterGraef 0:d26c1b55cfca 82
DieterGraef 0:d26c1b55cfca 83 /* TCP Maximum segment size. */
DieterGraef 0:d26c1b55cfca 84 #define TCP_MSS__min 536
DieterGraef 0:d26c1b55cfca 85 #define TCP_MSS__default 1460
DieterGraef 0:d26c1b55cfca 86 #define TCP_MSS__max 1460
DieterGraef 0:d26c1b55cfca 87
DieterGraef 0:d26c1b55cfca 88 /* TCP sender buffer space (bytes). */
DieterGraef 0:d26c1b55cfca 89 #define TCP_SND_BUF__min (2*TCP_MSS)
DieterGraef 0:d26c1b55cfca 90 #define TCP_SND_BUF__default (4*TCP_MSS)
DieterGraef 0:d26c1b55cfca 91 #define TCP_SND_BUF__max (8*TCP_MSS)
DieterGraef 0:d26c1b55cfca 92
DieterGraef 0:d26c1b55cfca 93 /* TCP sender buffer space (pbufs). This must be at least = 2 *
DieterGraef 0:d26c1b55cfca 94 TCP_SND_BUF/TCP_MSS for things to work. */
DieterGraef 0:d26c1b55cfca 95 #define TCP_SND_QUEUELEN__min ((2*TCP_SND_BUF)/TCP_MSS)
DieterGraef 0:d26c1b55cfca 96 #define TCP_SND_QUEUELEN__default ((4*TCP_SND_BUF)/TCP_MSS)
DieterGraef 0:d26c1b55cfca 97 #define TCP_SND_QUEUELEN__max ((8*TCP_SND_BUF)/TCP_MSS)
DieterGraef 0:d26c1b55cfca 98
DieterGraef 0:d26c1b55cfca 99 /* TCP receive window. */
DieterGraef 0:d26c1b55cfca 100 #define TCP_WND__min (2*1024)
DieterGraef 0:d26c1b55cfca 101 #define TCP_WND__default (8*1024)
DieterGraef 0:d26c1b55cfca 102 #define TCP_WND__max (32*1024)
DieterGraef 0:d26c1b55cfca 103
DieterGraef 0:d26c1b55cfca 104 /* TCP writable space (bytes). This must be less than or equal
DieterGraef 0:d26c1b55cfca 105 to TCP_SND_BUF. It is the amount of space which must be
DieterGraef 0:d26c1b55cfca 106 available in the tcp snd_buf for select to return writable */
DieterGraef 0:d26c1b55cfca 107 #define TCP_SNDLOWAT__min (TCP_SND_BUF/2)
DieterGraef 0:d26c1b55cfca 108 #define TCP_SNDLOWAT__default (TCP_SND_BUF/2)
DieterGraef 0:d26c1b55cfca 109 #define TCP_SNDLOWAT__max (TCP_SND_BUF/32)
DieterGraef 0:d26c1b55cfca 110
DieterGraef 0:d26c1b55cfca 111
DieterGraef 0:d26c1b55cfca 112 //--// RAM Profiles
DieterGraef 0:d26c1b55cfca 113
DieterGraef 0:d26c1b55cfca 114 #ifdef NETWORK_MEMORY_PROFILE_LWIP__small
DieterGraef 0:d26c1b55cfca 115 #define PLATFORM_DEPENDENT__MEM_SIZE MEM_SIZE__min
DieterGraef 0:d26c1b55cfca 116 #define PLATFORM_DEPENDENT__MEMP_NUM_PBUF MEMP_NUM_PBUF__min
DieterGraef 0:d26c1b55cfca 117 #define PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__min
DieterGraef 0:d26c1b55cfca 118 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__min
DieterGraef 0:d26c1b55cfca 119 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__min
DieterGraef 0:d26c1b55cfca 120 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__min
DieterGraef 0:d26c1b55cfca 121 #define PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__min
DieterGraef 0:d26c1b55cfca 122 #define PLATFORM_DEPENDENT__MEMP_NUM_NETBUF MEMP_NUM_NETBUF__min
DieterGraef 0:d26c1b55cfca 123 #define PLATFORM_DEPENDENT__MEMP_NUM_NETCONN MEMP_NUM_NETCONN__min
DieterGraef 0:d26c1b55cfca 124 #define PLATFORM_DEPENDENT__PBUF_POOL_SIZE PBUF_POOL_SIZE__min
DieterGraef 0:d26c1b55cfca 125 #define PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__min
DieterGraef 0:d26c1b55cfca 126 #define PLATFORM_DEPENDENT__TCP_MSS TCP_MSS__min
DieterGraef 0:d26c1b55cfca 127 #define PLATFORM_DEPENDENT__TCP_SND_BUF TCP_SND_BUF__min
DieterGraef 0:d26c1b55cfca 128 #define PLATFORM_DEPENDENT__TCP_SND_QUEUELEN TCP_SND_QUEUELEN__min
DieterGraef 0:d26c1b55cfca 129 #define PLATFORM_DEPENDENT__TCP_WND TCP_WND__min
DieterGraef 0:d26c1b55cfca 130 #define PLATFORM_DEPENDENT__TCP_SNDLOWAT TCP_SNDLOWAT__min
DieterGraef 0:d26c1b55cfca 131 #endif
DieterGraef 0:d26c1b55cfca 132
DieterGraef 0:d26c1b55cfca 133 #ifdef NETWORK_MEMORY_PROFILE_LWIP__medium
DieterGraef 0:d26c1b55cfca 134 #define PLATFORM_DEPENDENT__MEM_SIZE MEM_SIZE__default
DieterGraef 0:d26c1b55cfca 135 #define PLATFORM_DEPENDENT__MEMP_NUM_PBUF MEMP_NUM_PBUF__default
DieterGraef 0:d26c1b55cfca 136 #define PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__default
DieterGraef 0:d26c1b55cfca 137 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__default
DieterGraef 0:d26c1b55cfca 138 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__default
DieterGraef 0:d26c1b55cfca 139 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__default
DieterGraef 0:d26c1b55cfca 140 #define PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__default
DieterGraef 0:d26c1b55cfca 141 #define PLATFORM_DEPENDENT__MEMP_NUM_NETBUF MEMP_NUM_NETBUF__default
DieterGraef 0:d26c1b55cfca 142 #define PLATFORM_DEPENDENT__MEMP_NUM_NETCONN MEMP_NUM_NETCONN__default
DieterGraef 0:d26c1b55cfca 143 #define PLATFORM_DEPENDENT__PBUF_POOL_SIZE PBUF_POOL_SIZE__default
DieterGraef 0:d26c1b55cfca 144 #define PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__default
DieterGraef 0:d26c1b55cfca 145 #define PLATFORM_DEPENDENT__TCP_MSS TCP_MSS__default
DieterGraef 0:d26c1b55cfca 146 #define PLATFORM_DEPENDENT__TCP_SND_BUF TCP_SND_BUF__default
DieterGraef 0:d26c1b55cfca 147 #define PLATFORM_DEPENDENT__TCP_SND_QUEUELEN TCP_SND_QUEUELEN__default
DieterGraef 0:d26c1b55cfca 148 #define PLATFORM_DEPENDENT__TCP_WND TCP_WND__default
DieterGraef 0:d26c1b55cfca 149 #define PLATFORM_DEPENDENT__TCP_SNDLOWAT TCP_SNDLOWAT__default
DieterGraef 0:d26c1b55cfca 150 #endif
DieterGraef 0:d26c1b55cfca 151
DieterGraef 0:d26c1b55cfca 152 #ifdef NETWORK_MEMORY_PROFILE_LWIP__large
DieterGraef 0:d26c1b55cfca 153 #define PLATFORM_DEPENDENT__MEM_SIZE MEM_SIZE__max
DieterGraef 0:d26c1b55cfca 154 #define PLATFORM_DEPENDENT__MEMP_NUM_PBUF MEMP_NUM_PBUF__max
DieterGraef 0:d26c1b55cfca 155 #define PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__max
DieterGraef 0:d26c1b55cfca 156 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__max
DieterGraef 0:d26c1b55cfca 157 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__max
DieterGraef 0:d26c1b55cfca 158 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__max
DieterGraef 0:d26c1b55cfca 159 #define PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__max
DieterGraef 0:d26c1b55cfca 160 #define PLATFORM_DEPENDENT__MEMP_NUM_NETBUF MEMP_NUM_NETBUF__max
DieterGraef 0:d26c1b55cfca 161 #define PLATFORM_DEPENDENT__MEMP_NUM_NETCONN MEMP_NUM_NETCONN__max
DieterGraef 0:d26c1b55cfca 162 #define PLATFORM_DEPENDENT__PBUF_POOL_SIZE PBUF_POOL_SIZE__max
DieterGraef 0:d26c1b55cfca 163 #define PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__max
DieterGraef 0:d26c1b55cfca 164 #define PLATFORM_DEPENDENT__TCP_MSS TCP_MSS__max
DieterGraef 0:d26c1b55cfca 165 #define PLATFORM_DEPENDENT__TCP_SND_BUF TCP_SND_BUF__max
DieterGraef 0:d26c1b55cfca 166 #define PLATFORM_DEPENDENT__TCP_SND_QUEUELEN TCP_SND_QUEUELEN__max
DieterGraef 0:d26c1b55cfca 167 #define PLATFORM_DEPENDENT__TCP_WND TCP_WND__max
DieterGraef 0:d26c1b55cfca 168 #define PLATFORM_DEPENDENT__TCP_SNDLOWAT TCP_SNDLOWAT__max
DieterGraef 0:d26c1b55cfca 169 #endif
DieterGraef 0:d26c1b55cfca 170
DieterGraef 0:d26c1b55cfca 171 #ifdef NETWORK_MEMORY_PROFILE_LWIP__custom
DieterGraef 0:d26c1b55cfca 172 #define PLATFORM_DEPENDENT__MEM_SIZE MEM_SIZE__custom
DieterGraef 0:d26c1b55cfca 173 #define PLATFORM_DEPENDENT__MEMP_NUM_PBUF MEMP_NUM_PBUF__custom
DieterGraef 0:d26c1b55cfca 174 #define PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__custom
DieterGraef 0:d26c1b55cfca 175 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__custom
DieterGraef 0:d26c1b55cfca 176 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__custom
DieterGraef 0:d26c1b55cfca 177 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__custom
DieterGraef 0:d26c1b55cfca 178 #define PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__custom
DieterGraef 0:d26c1b55cfca 179 #define PLATFORM_DEPENDENT__MEMP_NUM_NETBUF MEMP_NUM_NETBUF__custom
DieterGraef 0:d26c1b55cfca 180 #define PLATFORM_DEPENDENT__MEMP_NUM_NETCONN MEMP_NUM_NETCONN__custom
DieterGraef 0:d26c1b55cfca 181 #define PLATFORM_DEPENDENT__PBUF_POOL_SIZE PBUF_POOL_SIZE__custom
DieterGraef 0:d26c1b55cfca 182 #define PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__custom
DieterGraef 0:d26c1b55cfca 183 #define PLATFORM_DEPENDENT__TCP_MSS TCP_MSS__custom
DieterGraef 0:d26c1b55cfca 184 #define PLATFORM_DEPENDENT__TCP_SND_BUF TCP_SND_BUF__custom
DieterGraef 0:d26c1b55cfca 185 #define PLATFORM_DEPENDENT__TCP_SND_QUEUELEN TCP_SND_QUEUELEN__custom
DieterGraef 0:d26c1b55cfca 186 #define PLATFORM_DEPENDENT__TCP_WND TCP_WND__custom
DieterGraef 0:d26c1b55cfca 187 #define PLATFORM_DEPENDENT__TCP_SNDLOWAT TCP_SNDLOWAT__custom
DieterGraef 0:d26c1b55cfca 188 #endif
DieterGraef 0:d26c1b55cfca 189
DieterGraef 0:d26c1b55cfca 190 #define PLATFORM_DEPENDENT__SOCKETS_MAX_COUNT (PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB + PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB)
DieterGraef 0:d26c1b55cfca 191
DieterGraef 0:d26c1b55cfca 192 #endif // _DRIVERS_NETWORK_DEFINES_LWIP_H_
DieterGraef 0:d26c1b55cfca 193