Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb156a3

Browse filesBrowse files
authored
Merge pull request #8 from fpistm/Default_lwipopts.h
Default lwipopts.h to avoid embed it in the core and allow easiest user config
2 parents 629fc8d + 6f517db commit eb156a3
Copy full SHA for eb156a3

File tree

Expand file treeCollapse file tree

4 files changed

+284
-8
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+284
-8
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+16-7Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
1-
# STM32Ethernet
2-
3-
## Ethernet Library for Arduino
1+
# STM32 Ethernet Library for Arduino
42

53
With an STM32 board with Ethernet compatibility, this library allows a STM32
64
board (NUCLEO, DISCOVERY, ...) to connect to the internet.
75

86
This library follows the Ethernet API from Arduino.<br>
97
For more information about it please visit: http://www.arduino.cc/en/Reference/Ethernet
108

11-
## Note
9+
## Dependency
1210

13-
The library is based on LwIP, a Lightweight TCP/IP stack, available here:
11+
This library is based on LwIP, a Lightweight TCP/IP stack, available here:
1412

1513
http://git.savannah.gnu.org/cgit/lwip.git
1614

17-
The LwIP has been ported as Arduino library. The STM32Ethernet library depends
18-
on it.
15+
The LwIP has been ported as Arduino library and is available thanks Arduino Library Manager.
16+
17+
Source: https://github.com/stm32duino/LwIP
18+
19+
## Configuration
20+
21+
The LwIP has several user defined options, which is specified from within the `lwipopts.h` file.
22+
23+
This library provides a default user defined options file named `lwipopts_default.h`.
24+
25+
User can provide his own defined options at sketch level by adding his configuration in a file named `STM32lwipopts.h`.
26+
27+
## Note
1928

2029
`EthernetClass::maintain()` in no more required to renew IP address from DHCP.<br>
2130
It is done automatically by the LwIP stack in a background task.

‎library.properties

Copy file name to clipboardExpand all lines: library.properties
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=STM32duino STM32Ethernet
2-
version=1.0.2
2+
version=1.0.3
33
author=Various
44
maintainer=STMicroelectronics
55
sentence=Enables network connection (local and Internet) using the STM32 Board.

‎src/lwipopts.h

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* @file lwipopts.h
3+
* @author Frederic Pillon <frederic.pillon@st.com> for STMicroelectronics.
4+
* @brief Include header file to match Arduino library format
5+
*/
6+
7+
#ifndef _ARDUINO_LWIPOPTS_H
8+
#define _ARDUINO_LWIPOPTS_H
9+
10+
/* LwIP specific configuration options. */
11+
#if __has_include("STM32lwipopts.h")
12+
#include "STM32lwipopts.h"
13+
#else
14+
#include "lwipopts_default.h"
15+
#endif
16+
17+
#endif /* _ARDUINO_LWIPOPTS_H */
18+

‎src/lwipopts_default.h

Copy file name to clipboard
+249Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
/**
2+
******************************************************************************
3+
* @file lwipopts_default.h
4+
* @author MCD Application Team
5+
* @brief lwIP Options Configuration.
6+
******************************************************************************
7+
* @attention
8+
*
9+
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
10+
* All rights reserved.</center></h2>
11+
*
12+
* Redistribution and use in source and binary forms, with or without
13+
* modification, are permitted, provided that the following conditions are met:
14+
*
15+
* 1. Redistribution of source code must retain the above copyright notice,
16+
* this list of conditions and the following disclaimer.
17+
* 2. Redistributions in binary form must reproduce the above copyright notice,
18+
* this list of conditions and the following disclaimer in the documentation
19+
* and/or other materials provided with the distribution.
20+
* 3. Neither the name of STMicroelectronics nor the names of other
21+
* contributors to this software may be used to endorse or promote products
22+
* derived from this software without specific written permission.
23+
* 4. This software, including modifications and/or derivative works of this
24+
* software, must execute solely and exclusively on microcontroller or
25+
* microprocessor devices manufactured by or for STMicroelectronics.
26+
* 5. Redistribution and use of this software other than as permitted under
27+
* this license is void and will automatically terminate your rights under
28+
* this license.
29+
*
30+
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
31+
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
32+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
33+
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
34+
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
35+
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
36+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
38+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
41+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42+
*
43+
******************************************************************************
44+
*/
45+
#ifndef __LWIPOPTS_H__
46+
#define __LWIPOPTS_H__
47+
48+
/**
49+
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
50+
* use lwIP facilities.
51+
*/
52+
#define NO_SYS 1
53+
54+
/**
55+
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
56+
* critical regions during buffer allocation, deallocation and memory
57+
* allocation and deallocation.
58+
*/
59+
#define SYS_LIGHTWEIGHT_PROT 0
60+
61+
/* ---------- Memory options ---------- */
62+
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
63+
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
64+
byte alignment -> define MEM_ALIGNMENT to 2. */
65+
#define MEM_ALIGNMENT 4
66+
67+
/* MEM_SIZE: the size of the heap memory. If the application will send
68+
a lot of data that needs to be copied, this should be set high. */
69+
#define MEM_SIZE (10*1024)
70+
71+
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
72+
sends a lot of data out of ROM (or other static memory), this
73+
should be set high. */
74+
#define MEMP_NUM_PBUF 10
75+
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
76+
per active UDP "connection". */
77+
#define MEMP_NUM_UDP_PCB 6
78+
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
79+
connections. */
80+
#define MEMP_NUM_TCP_PCB 10
81+
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
82+
connections. */
83+
#define MEMP_NUM_TCP_PCB_LISTEN 6
84+
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
85+
segments. */
86+
#define MEMP_NUM_TCP_SEG 8
87+
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
88+
timeouts. */
89+
#define MEMP_NUM_SYS_TIMEOUT 10
90+
91+
92+
/* ---------- Pbuf options ---------- */
93+
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
94+
#define PBUF_POOL_SIZE 8
95+
96+
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
97+
#define PBUF_POOL_BUFSIZE 1524
98+
99+
100+
/* ---------- TCP options ---------- */
101+
#define LWIP_TCP 1
102+
#define TCP_TTL 255
103+
104+
/* Controls if TCP should queue segments that arrive out of
105+
order. Define to 0 if your device is low on memory. */
106+
#define TCP_QUEUE_OOSEQ 0
107+
108+
/* TCP Maximum segment size. */
109+
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
110+
111+
/* TCP sender buffer space (bytes). */
112+
#define TCP_SND_BUF (4*TCP_MSS)
113+
114+
/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
115+
as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
116+
117+
#define TCP_SND_QUEUELEN (2* TCP_SND_BUF/TCP_MSS)
118+
119+
/* TCP receive window. */
120+
#define TCP_WND (2*TCP_MSS)
121+
122+
123+
/* ---------- ICMP options ---------- */
124+
#define LWIP_ICMP 1
125+
126+
127+
/* ---------- DHCP options ---------- */
128+
#define LWIP_DHCP 1
129+
130+
/* ---------- DNS options ---------- */
131+
#define LWIP_DNS 1
132+
133+
134+
/* ---------- UDP options ---------- */
135+
#define LWIP_UDP 1
136+
#define UDP_TTL 255
137+
138+
139+
/* ---------- Statistics options ---------- */
140+
#define LWIP_STATS 0
141+
142+
/* ---------- link callback options ---------- */
143+
/* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
144+
* whenever the link changes (i.e., link down)
145+
*/
146+
#define LWIP_NETIF_LINK_CALLBACK 1
147+
148+
/*
149+
--------------------------------------
150+
---------- Checksum options ----------
151+
--------------------------------------
152+
*/
153+
154+
/*
155+
The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
156+
- To use this feature let the following define uncommented.
157+
- To disable it and process by CPU comment the the checksum.
158+
*/
159+
#define CHECKSUM_BY_HARDWARE
160+
161+
162+
#ifdef CHECKSUM_BY_HARDWARE
163+
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
164+
#define CHECKSUM_GEN_IP 0
165+
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
166+
#define CHECKSUM_GEN_UDP 0
167+
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
168+
#define CHECKSUM_GEN_TCP 0
169+
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
170+
#define CHECKSUM_CHECK_IP 0
171+
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
172+
#define CHECKSUM_CHECK_UDP 0
173+
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
174+
#define CHECKSUM_CHECK_TCP 0
175+
/* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
176+
#define CHECKSUM_GEN_ICMP 0
177+
#else
178+
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
179+
#define CHECKSUM_GEN_IP 1
180+
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
181+
#define CHECKSUM_GEN_UDP 1
182+
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
183+
#define CHECKSUM_GEN_TCP 1
184+
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
185+
#define CHECKSUM_CHECK_IP 1
186+
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
187+
#define CHECKSUM_CHECK_UDP 1
188+
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
189+
#define CHECKSUM_CHECK_TCP 1
190+
/* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
191+
#define CHECKSUM_GEN_ICMP 1
192+
#endif
193+
194+
195+
/*
196+
----------------------------------------------
197+
---------- Sequential layer options ----------
198+
----------------------------------------------
199+
*/
200+
/**
201+
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
202+
*/
203+
#define LWIP_NETCONN 0
204+
205+
/*
206+
------------------------------------
207+
---------- Socket options ----------
208+
------------------------------------
209+
*/
210+
/**
211+
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
212+
*/
213+
#define LWIP_SOCKET 0
214+
215+
/*
216+
------------------------------------
217+
---------- httpd options ----------
218+
------------------------------------
219+
*/
220+
221+
/** Set this to 1 to support CGI */
222+
#define LWIP_HTTPD_CGI 1
223+
224+
/** Set this to 1 to support SSI (Server-Side-Includes) */
225+
#define LWIP_HTTPD_SSI 1
226+
227+
/** Set this to 1 to include "fsdata_custom.c" instead of "fsdata.c" for the
228+
* file system (to prevent changing the file included in CVS) */
229+
#define HTTPD_USE_CUSTOM_FSDATA 1
230+
231+
/*
232+
------------------------------------
233+
---------- Custom options ----------
234+
------------------------------------
235+
*/
236+
237+
/** Enables the Ethernet peripheral in RMII mode. If not defined, MII mode will
238+
be enabled. Pin mapping must be configured for the selected mode
239+
(see PinMap_Ethernet in PeripheralPins.c). */
240+
#define ETHERNET_RMII_MODE_CONFIGURATION 1
241+
242+
/** Uncomment this line to use the ethernet input in interrupt mode.
243+
* NOTE: LwIP stack documentation recommends to use the polling mode without
244+
* an operating system. */
245+
//#define ETH_INPUT_USE_IT 1
246+
247+
#endif /* __LWIPOPTS_H__ */
248+
249+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.