[INFO] lwIP version 2.0 Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
steved
Posts: 536
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 3 times
Been thanked: 54 times

Re: [INFO] lwIP version 2.0

Postby steved » Wed Oct 11, 2017 3:16 pm

This is my own application. Possibly the fact that I'm using sockets throughout masks an interfacing problem at the direct-to-lwIP level.
Marginally different board also - F429.

I'll try and dig out one of the boards supported by the demo and try that sometime.

User avatar
Giovanni
Site Admin
Posts: 11158
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 392 times
Been thanked: 324 times
Contact:

Re: [INFO] lwIP version 2.0

Postby Giovanni » Wed Oct 11, 2017 3:25 pm

Thanks, I want to bring the whole thing to 17.6.x if it is stable enough.

Giovanni

rasm
Posts: 11
Joined: Thu Aug 24, 2017 6:35 pm
Has thanked: 4 times
Been thanked: 3 times

Re: [INFO] lwIP version 2.0

Postby rasm » Fri Oct 13, 2017 3:15 pm

Hi,

When I submitted the patches I didn't use lwIP's embedded HTTP server for the demos because I thought that the existing code was more helpful for a beginner starting ChibiOS/lwIP development.

I attach a patch that should fix the LWIP_TCPIP_CORE_LOCKING issue. I've tested this patch with the Olimex E407 board and the demo works regardless of the LWIP_TCPIP_CORE_LOCKING value.
Attachments
0001-Made-lwIP-demos-work-regardless-of-LWIP_TCPIP_CORE_L.zip
(985 Bytes) Downloaded 31 times

steved
Posts: 536
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 3 times
Been thanked: 54 times

Re: [INFO] lwIP version 2.0

Postby steved » Fri Oct 13, 2017 6:18 pm

Interesting that I had quite unconsciously defined all these values in my own lwipopts.h file, so wouldn't have seen any problem!

A couple of differences between the two configuration files:
1. I found:
#define TCPIP_THREAD_STACKSIZE 550
was sufficient.
2. I've actually used higher thread priorities ATM:
This was a conscious change; whether it actually matters I'm not sure; will try and reducing this at some point.

Code: Select all

#define TCPIP_THREAD_PRIO               (NORMALPRIO + 2)    /* Increased from LOWPRIO + 1 */
#define LWIP_THREAD_PRIORITY            (NORMALPRIO + 1)    /* Increased from LOWPRIO */

I think I read somewhere (a long time ago) that the TCPIP thread needs a higher priority than the worker thread; not sure whether this is important.

User avatar
Giovanni
Site Admin
Posts: 11158
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 392 times
Been thanked: 324 times
Contact:

Re: [INFO] lwIP version 2.0

Postby Giovanni » Sun Oct 15, 2017 1:28 pm

Changes committed, I also changed the relative priorities as suggested by steved but still based on LOWPRIO.

The settings in static_lwipopts.h can be overridden from lwipopts.h so it can be changed.

Giovanni

steved
Posts: 536
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 3 times
Been thanked: 54 times

Re: [INFO] lwIP version 2.0

Postby steved » Wed Nov 15, 2017 9:55 pm

These changes also fix bug #824 (line 58 on in cc.h)

And probably bug #729 - the change as suggested in the bug tracker has been implemented (lwipthread.c line 365)

User avatar
Giovanni
Site Admin
Posts: 11158
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 392 times
Been thanked: 324 times
Contact:

Re: [INFO] lwIP version 2.0

Postby Giovanni » Thu Nov 30, 2017 10:55 am

Thanks marked those as closed.

Giovanni

Lucas
Posts: 1
Joined: Mon Jan 01, 2018 3:54 pm

Re: [INFO] lwIP version 2.0

Postby Lucas » Mon Jan 01, 2018 4:24 pm

Hi!
I'm a beginner in lwip. The RT-STM32-LWIP-FATFS-USB demo works perfect at STM32F746 discovery.
(latest version 17.6.3, LWIP 2.0.3)

I have implemented MQTT app with official instructions (http://www.nongnu.org/lwip/2_0_x/group__mqtt.html)

But I have issue witch memp_malloc as shown in attachment.
It returns NULL.

Have you implemented official MQTT app with success? Where should I look for a solution?

Thank you a lot.
Attachments
chsys.png

User avatar
Giovanni
Site Admin
Posts: 11158
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 392 times
Been thanked: 324 times
Contact:

Re: [INFO] lwIP version 2.0

Postby Giovanni » Mon Jan 01, 2018 6:32 pm

Hi,

Sorry, never used that, it could be a memory leak, for some reason elements are not returned to the pool.

Giovanni

ych
Posts: 27
Joined: Tue Mar 03, 2015 11:38 pm
Has thanked: 3 times
Been thanked: 6 times

Re: [INFO] lwIP version 2.0

Postby ych » Tue Mar 13, 2018 11:07 am

Giovanni wrote:I wanted to have httpd_opts.h in the application directory and I discovered:

1) httpd_opts.h is placed together with other headers, OK... let's rename it so it will find my copy.
2) httpd.c includes "lwip/apps/httpd.h" which includes "httpd_opts.h" (without path).
3) fs.c includes "lwip/apps/httpd_opts.h" (with path).

So you need to have both "./ext/lwip/src/include" (empty dir) and "./ext/lwip/src/include/lwip/apps" in your search path AND you cannot relocate the file. At very least I need to edit the inclusion in fs.c and rename httpd_opts.h in something else.


After advanced configuration of httpd application (custom file system, SSI, etc.), I found that if you want to have httpd_opts.h in the application directory then it is not enough to patch fs.c. You also need to patch fsdata.h and httpd.h:

Code: Select all

diff --git a/ext/lwip/src/apps/httpd/fsdata.h b/ext/lwip/src/apps/httpd/fsdata.h
index c004a3f..fc52fe0 100644
--- a/ext/lwip/src/apps/httpd/fsdata.h
+++ b/ext/lwip/src/apps/httpd/fsdata.h
@@ -32,7 +32,9 @@
 #ifndef LWIP_FSDATA_H
 #define LWIP_FSDATA_H
 
-#include "lwip/apps/httpd_opts.h"
+/* CHIBIOS FIX */
+//#include "lwip/apps/httpd_opts.h"
+#include "httpd_opts.h"
 #include "lwip/apps/fs.h"
 
 struct fsdata_file {
diff --git a/ext/lwip/src/include/lwip/apps/httpd.h b/ext/lwip/src/include/lwip/apps/httpd.h
index 57831dd..1ab58d2 100644
--- a/ext/lwip/src/include/lwip/apps/httpd.h
+++ b/ext/lwip/src/include/lwip/apps/httpd.h
@@ -41,7 +41,9 @@
 #ifndef LWIP_HDR_APPS_HTTPD_H
 #define LWIP_HDR_APPS_HTTPD_H
 
-#include "httpd_opts.h"
+/* CHIBIOS FIX */
+//#include "httpd_opts.h"
+#include <httpd_opts.h>
 #include "lwip/err.h"
 #include "lwip/pbuf.h"


But it seems dirty patches.

Why do we need to have exactly httpd_opts.h in the application directory?

When httpd_opts.h include lwip/opt.h, and lwip/opt.h include lwipopts.h, which already in the application directory.

So for me, it will be much cleaner to put necessary redefinitions of default defines for httpd just in lwipopts.h (as it seems was planned by developers of lwip). Or if someone wants to have httpd configuration in the separate file then just create some lwiphttpdopts.h and include it from lwipopts.h. Such implementation allows to remove ChibiOS specific path of fs.c.


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 3 guests