Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit59d0a61

Browse files
authored
Merge pull request#52 from fprwi6labs/Ethernet_F4
Ethernet f4All provided example tested and ok.
2 parents03fe9fd +cc913eb commit59d0a61

File tree

10 files changed

+383
-17
lines changed

10 files changed

+383
-17
lines changed

‎cores/arduino/chip.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#include"usb_interface.h"
3939
#endif//USBCON
4040

41+
#include"ethernet.h"
42+
4143
/* Define attribute */
4244
#if defined (__GNUC__ )/* GCC CS3 */
4345
#defineWEAK __attribute__ ((weak))

‎cores/arduino/main.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ int main( void )
4747

4848
for (;;)
4949
{
50+
// Define by Ethernet library. It is defined as __weak.
51+
stm32_eth_scheduler();
52+
5053
loop();
5154
if (serialEventRun)serialEventRun();
5255
}

‎cores/arduino/stm32/PeripheralPins.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,8 @@ extern const PinMap PinMap_SPI_SSEL[];
6262
externconstPinMapPinMap_CAN_RD[];
6363
externconstPinMapPinMap_CAN_TD[];
6464

65+
//*** ETHERNET ***
66+
externconstPinMapPinMap_Ethernet[];
67+
6568
#endif
6669

‎cores/arduino/stm32/ethernet.h‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
******************************************************************************
3+
* @file ethernet.h
4+
* @author WI6LABS
5+
* @version V1.0.0
6+
* @date 14-June-2017
7+
* @brief Header for ethernet background task for LwIP stack.
8+
******************************************************************************
9+
* @attention
10+
*
11+
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
12+
*
13+
* Redistribution and use in source and binary forms, with or without modification,
14+
* are permitted provided that the following conditions are met:
15+
* 1. Redistributions 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 its contributors
21+
* may be used to endorse or promote products derived from this software
22+
* without specific prior written permission.
23+
*
24+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
******************************************************************************
36+
*/
37+
38+
/* Define to prevent recursive inclusion -------------------------------------*/
39+
#ifndef__ETHERNET_H
40+
#define__ETHERNET_H
41+
42+
/* Includes ------------------------------------------------------------------*/
43+
#ifdef__cplusplus
44+
extern"C" {
45+
#endif
46+
47+
/* Exported types ------------------------------------------------------------*/
48+
/* Exported constants --------------------------------------------------------*/
49+
/* Exported macro ------------------------------------------------------------*/
50+
/* Exported functions ------------------------------------------------------- */
51+
52+
/* This function is defined by the NativeEthernet library and it is used as
53+
background task inside the main loop. */
54+
__weakvoidstm32_eth_scheduler(void)
55+
{
56+
/* NOTE : This function should not be modified. It is defined in the Ethernet
57+
library.
58+
*/
59+
}
60+
61+
voidstm32_eth_scheduler(void);
62+
63+
#ifdef__cplusplus
64+
}
65+
#endif
66+
67+
#endif/* __ETHERNET_H */
68+
69+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

‎cores/arduino/stm32/pinmap.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,11 @@ void* pinmap_merge_peripheral(void* a, void* b) {
8282
// error("pinmap mis-match");
8383
returnNP;
8484
}
85+
86+
PinNamepin_pinName(constPinMap*map) {
87+
if(map->pin!= (PinName)NC) {
88+
returnmap->pin;
89+
}else {
90+
return (PinName)NC;
91+
}
92+
}

‎cores/arduino/stm32/pinmap.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ typedef struct {
3939
boolpin_in_pinmap(PinNamepin,constPinMap*map);
4040
voidpin_function(PinNamepin,intfunction);
4141

42+
PinNamepin_pinName(constPinMap*map);
43+
4244
void*pinmap_peripheral(PinNamepin,constPinMap*map);
4345
uint32_tpinmap_function(PinNamepin,constPinMap*map);
4446
void*pinmap_find_peripheral(PinNamepin,constPinMap*map);

‎platform.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ version=1.0.0
1010

1111
# STM compile variables
1212
# ----------------------
13-
compiler.stm.extra_include="-I{build.core.path}/avr" "-I{build.core.path}/stm32" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Inc/" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Src/" "-I{build.system.path}/{build.series}/" "-I{build.variant.path}/usb" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src"
13+
compiler.stm.extra_include="-I{build.core.path}/avr" "-I{build.core.path}/stm32" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Inc/" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Src/" "-I{build.system.path}/{build.series}/" "-I{build.variant.path}/usb" "-I{build.variant.path}/Ethernet" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src"
1414

1515
# "-I{build.system.path}/Drivers/BSP/Components" "-I{build.system.path}/Middlewares/Third_Party/FatFs/src" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc"
1616

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp