[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.
User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [INFO] lwIP version 2.0

Postby Giovanni » Sun Oct 08, 2017 2:22 pm

I modified the demo STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB to use the lwIP httpd server for testing.

Giovanni

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

Re: [INFO] lwIP version 2.0

Postby Giovanni » Sun Oct 08, 2017 5:22 pm

OK, back to reality...

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.

This before even writing one line of code, enthusiasm evaporated quickly :)

The positive note is that they introduced a .mk file for everything, very similar to those used in ChibiOS.

Giovanni

steved
Posts: 823
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: [INFO] lwIP version 2.0

Postby steved » Mon Oct 09, 2017 9:48 am

This might have been another reason I decided to not use the lwip web server.

Will obviously depend on the application, but there are a number of reasons why a different solution might be better:
  • It might be desirable to mix files from a ROM-based file system and memory card. In this case the ideal solution is probably something which maps both to the standard C file calls (not difficult)
  • It will usually be necessary to embed the current value of some variables into the displayed web page. While this can be done using SSI, my perception (based on code inspection, rather than tests) is that this can be slow. And at least one implementation I came across was buggy
  • Some level of security may be required - probably simple digest authorisation will suffice, but it's not supported (SSL is another ballgame, which I've avoided so far)
  • If it's required to set values, the POST interface needs to be supported

The lwip server is fine for a basic proof of concept, but IMO its not very useful for the reasons above.

Digressing slightly, there are a number of alternative web servers out there, which generally assume a POSIX or *nix-style interface, and C-style file access functions. So shims to support these within Chibi could be useful. (A sockets-based network interface is also required, which lwip supports)

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

Re: [INFO] lwIP version 2.0

Postby Giovanni » Mon Oct 09, 2017 1:08 pm

The socket interface would add significant overhead over callback API, of course it depends on requirements. I think it is possible to make a mix of ROM files and dynamic files looking at the code.

Probably would be worth spend some time creating a lean solution, even more simple than the lwIP one. I would like to have CGI-like threads that output on a stream and take POST data from the same stream..

Anyway, it is good enough for the demos after patching those issues. I still need to replace all the lwipopts.h files in demos, those are from 1.4.1.

Giovanni

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

Re: [INFO] lwIP version 2.0

Postby Giovanni » Mon Oct 09, 2017 7:30 pm

I added a new configuration file to the demo and... it stopped working :)

I am missing some required setting that was present in the old file...

Giovanni

steved
Posts: 823
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: [INFO] lwIP version 2.0

Postby steved » Tue Oct 10, 2017 8:05 am

If its any help, here's the config file I'm currently using. Might give a clue.
Attachments
lwipopts.zip
(21.13 KiB) Downloaded 219 times

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

Re: [INFO] lwIP version 2.0

Postby Giovanni » Tue Oct 10, 2017 1:45 pm

It helped.

For some reason it does not work with LWIP_TCPIP_CORE_LOCKING=0, it used to work in 1.4.1, I wish to know why...

Giovanni

steved
Posts: 823
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: [INFO] lwIP version 2.0

Postby steved » Tue Oct 10, 2017 5:01 pm

I've just run a quick test on my project with LWIP_TCPIP_CORE_LOCKING=0, and it works for me. This is using lwIP 2.0.2, with the interface as submitted some time ago - haven't looked to see how that ended up! Running on a Nucleo-F429.

Bear in mind that I am using solely TCP/IP comms over the lwIP sockets interface - I've got my own comms handlers and web server. Part of the test just done sends a poll to the Nucleo, and gets a modified response - I can do just short of 1000 transactions/second, which I suspect is saturating the network.

I'll try and have a better look, and update lwIP, but probably not until next week.

steved
Posts: 823
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: [INFO] lwIP version 2.0

Postby steved » Wed Oct 11, 2017 11:02 am

Updated to use lwip 2.0.3 and the lwip bindings from trunk.

Still using Chibi 17.6.0, so had to change the mailbox calls in sys_arch.c

All works regardless of the value of LWIP_TCPIP_CORE_LOCKING

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

Re: [INFO] lwIP version 2.0

Postby Giovanni » Wed Oct 11, 2017 2:29 pm

Strange, have you tried the new "multi" demo or your own application?

Giovanni


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 12 guests