[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] STM32F107 LwIP Porting v1.3.2 to v1.4.1
From: |
oscargomezf |
Subject: |
[lwip-users] STM32F107 LwIP Porting v1.3.2 to v1.4.1 |
Date: |
Wed, 20 Jan 2016 01:14:13 -0700 (MST) |
Hi,
I'm working in the STM32F107 platform and I had to port LwIP from v1.3.2 to
v1.4.1. I've got it with the great help of Noam Weissman.
I've used the same port files. But I have to make the following changes:
- Add the files: def.c and timers.c
- Add this line to my lwipopts.h: #define NO_SYS_NO_TIMERS 1
- Add this include to my netconf.h file: #include <lwip/tcp_impl.h>
First of all, I tried to check the icmp because as you know there was a bug
in the v1.3.1 and 1.3.2 and the checksum was badly formed in those versions.
In the v1.3.1 and v1.3.1 I had to change the [../src/core/ipv4/icmp.c] file:
This slice of code:
/* adjust the checksum */
if (iecho->chksum >= htons(0xffff - (ICMP_ECHO << 8))) {
iecho->chksum += htons(ICMP_ECHO << 8) + 1;
} else {
iecho->chksum += htons(ICMP_ECHO << 8);
}
for this other:
/* This part of code has been modified by ST's MCD Application Team */
/* To use the Checksum Offload Engine for the putgoing ICMP packets, the
ICMP checksum field should be set to 0, this is required only for Tx ICMP*/
#ifdef CHECKSUM_BY_HARDWARE
iecho->chksum = 0;
#else
/* adjust the checksum */
if (iecho->chksum >= htons(0xffff - (ICMP_ECHO << 8))) {
iecho->chksum += htons(ICMP_ECHO << 8) + 1;
} else {
iecho->chksum += htons(ICMP_ECHO << 8);
}
Right know, it seems to be there are several defines that they've changed.
In particular, the define related to icmp package [file
../src/core/ipv4/icmp.c]:
#if CHECKSUM_GEN_ICMP
/* adjust the checksum */
if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1;
} else {
iecho->chksum += PP_HTONS(ICMP_ECHO << 8);
}
#else /* CHECKSUM_GEN_ICMP */
iecho->chksum = 0;
#endif /* CHECKSUM_GEN_ICMP */
So I have to add a define CHECKSUM_GEN_ICMP in my ../port/lwipopts.h file to
fix the badly formed checksum in the icmp package adding these lines:
#ifdef CHECKSUM_BY_HARDWARE
+ /* CHECKSUM_GEN_ICMP==0: Generate checksums by hardware for outgoing ICMP
packets.*/
+ #define CHECKSUM_GEN_ICMP 0
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP
packets.*/
#define CHECKSUM_GEN_IP 0
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP
packets.*/
#define CHECKSUM_GEN_UDP 0
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP
packets.*/
#define CHECKSUM_GEN_TCP 0
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP
packets.*/
#define CHECKSUM_CHECK_IP 0
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP
packets.*/
#define CHECKSUM_CHECK_UDP 0
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP
packets.*/
#define CHECKSUM_CHECK_TCP 0
#else
+ /* CHECKSUM_GEN_ICMP==1: Generate checksums in software for outgoing IP
packets.*/
+ #define CHECKSUM_GEN_ICMP 1
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP
packets.*/
#define CHECKSUM_GEN_IP 1
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP
packets.*/
#define CHECKSUM_GEN_UDP 1
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP
packets.*/
#define CHECKSUM_GEN_TCP 1
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP
packets.*/
#define CHECKSUM_CHECK_IP 1
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP
packets.*/
#define CHECKSUM_CHECK_UDP 1
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP
packets.*/
#define CHECKSUM_CHECK_TCP 1
#endif
The problem now is I don't know if I have to change more defines, apparently
everything it's working fine but I don't trust.
Does anyone have a lwipopts.h file (for lwip v1.4.1) file for SMT32F107
platform?
Thank you so much. Best regards.
--
View this message in context:
http://lwip.100.n7.nabble.com/STM32F107-LwIP-Porting-v1-3-2-to-v1-4-1-tp25618.html
Sent from the lwip-users mailing list archive at Nabble.com.
- [lwip-users] STM32F107 LwIP Porting v1.3.2 to v1.4.1,
oscargomezf <=