[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: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [INFO] lwIP version 2.0

Post by Giovanni »

I think it should be standard, it is part of printf if I remember well.

Giovanni
User avatar
quanghgx
Posts: 6
Joined: Sun Nov 20, 2016 5:02 pm
Has thanked: 1 time
Been thanked: 2 times

Re: [INFO] lwIP version 2.0

Post by quanghgx »

Dear Giovanni and Marco,

I have been using (play, more precisely) ChibiOS for almost two years now. Our production wireless sensor nodes (more than 20 thousands) that already running on the field are either using proprietary RTOS (OpenAT from Sierra Wireless) or powerful enough to running Linux (in-house custom build).

* I already done. (I'm switching job, so I have plenty of time in between):
    Using ChibiOS_16.1.5,
    Integrate with LWIP 2.0, with PPP plugin.
    Integrate with SIMCOM 900A,
    Integrate with Paho embedded C client.
Hardware working so far: SMT32 Discovery, SIM 900A module (or PPPD from Linux in-case someone don't have GPRS modem around, both working nicely).

* I did make heavily refactoring on LWIP for:
    Using C++ compiler with ChibiOS CPP Wrapper.
    Simplifying configuration that I think never going to be used with PPP plugin on MCU.
I'm trying to reduce memory usage and flash size to fit into another in-house board with Quectel M95 and SMT32F103RCT6.

So:
* I did wait sometime for Macro to publish his work, but thinking that maybe he only testing with Ethernet IF. And I want to contribute the testing (demo) for PPP IF. I don't might to using ChibiOS in trunk (actually ported back to 16.1.5 release, couple of changing in thread structure), and off the self LWIP with minimal patch. I can make C copy too, if it is requested.
* I hope this can contribute something back, and improving my understanding of ChibiOS with your help along the way in finalizing this LWIP integration and PPP demo project.

Thank you for your huge amount of work you already done!
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [INFO] lwIP version 2.0

Post by Giovanni »

Hi,

Good to know you already got it working this will help for sure, I hope you can coordinate with Marco into definition of next lwIP package in ChibiOS.

About lwIP, why an heavy refactoring? are there problems? I would like to include the code as much unmodified as possible or upgrades would be difficult.

Giovanni
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: [INFO] lwIP version 2.0

Post by Marco »

Hi quanghgx,

Good to hear you have a working example for PPP with LwIP 2.0.0. I never used PPP and as you already guessed i only tested the Ethernet interface. I think it would be nice to also have the PPP interface working so i'm looking forward to your work :)

Like Giovanni mentioned it would be best to have no changes to the LwIP sources, only if there is no other way.

Marco
User avatar
quanghgx
Posts: 6
Joined: Sun Nov 20, 2016 5:02 pm
Has thanked: 1 time
Been thanked: 2 times

Re: [INFO] lwIP version 2.0

Post by quanghgx »

Yes, so I will post a LWIP 2.0-PPP integration demo with as least modified LWIP as possible. Please help me to finalize it. Let me couple of days for preparing from my current personal private repository in bitbucket.

The main reasons for modifying LWIP are:
    To study lwip inside and understanding its multiple options: My begin with LWIP are Adam's paper. And the older (without heavily MACROrized) LWIP source-code, up-to version 0.5.3 are much more simpler and easier to follow along with the paper. Luckily, without above burden for beginner like me, the core architect and API layer of LWIP 2.0 are not changing much from Adam's paper.
    Try reduce overall RAM and Flash usage to fit-into STM32F103RCT6 MCU.
Not so a reason, my team come from embedded Linux with C++, so I want it to be easier for them when introducing ChibiOS and LWIP. ChibiOS CPP wrapper is excellent, and its threading APIs are familiar with Linux system programmer. But the main reason maybe some goodies that We are so used to, like function overload, and private properties/methods, null_ptr, something just simple like that (not exception, new/delete, STD library ..).

Thank you Mr.Giovanni and Mr.Macro.
User avatar
quanghgx
Posts: 6
Joined: Sun Nov 20, 2016 5:02 pm
Has thanked: 1 time
Been thanked: 2 times

Re: [INFO] lwIP version 2.0

Post by quanghgx »

Here is the "modified lwip" one: https://bitbucket.org/quanghgx/eip_stm32f407_lwip_cpp
(I've just set it to become public repository, I don't have any ideal about license, just make it compatible with chibios and lwip as 1st priority).

I am still working on "unmodified" (or at least as possible) version.
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: [INFO] lwIP version 2.0

Post by Marco »

Hi quanghgx,

Thank you for sharing your work so far. I will try to have a look at it tonight or tomorrow.

Marco
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: [INFO] lwIP version 2.0

Post by Marco »

To start, attached is a patch for the 16-bit formatters for chprintf. I separated it from the other LwIP related changes in that patch. It partly solves #788.

Marco
Attachments
chprintf.zip
Adds 16-bit formatters for chprintf
(746 Bytes) Downloaded 507 times
User avatar
quanghgx
Posts: 6
Joined: Sun Nov 20, 2016 5:02 pm
Has thanked: 1 time
Been thanked: 2 times

Re: [INFO] lwIP version 2.0

Post by quanghgx »

Dear Marco.

* Here is the unmodified LWIP 2.0 version with PPPOS plugin.
https://bitbucket.org/quanghgx/rt-stm32 ... y-lwip-ppp
Internal lwip folder is just for convenient by now. This did help when study LWIP source-code. I will moving this to os/ext as ChibiOS established arrangement and using .mk file for Makefile part of LWIP.

* Todo list:
    Using your chprintf for LWIP_DEBUG macro.
    Detail of LWIP option set analysis for a typical GPRS modem with PPPOS in MCU case.
    Make workable version with PPPD (from linux or virtual machine), in case user don't have a GPRS modem.

Thank you!
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: [INFO] lwIP version 2.0

Post by Marco »

Hi quanghgx,

Thanks for the update! I had a quick look at it and i think i understand how you use the pppos api. This inspired me for an idea to change the current lwip bindings. We can create netif driver modules for ethernet, pppos, pppoe and possibly more. I already have the ethernet version working here since it is very much the same as the existing one. For the pppos netif your work is really usefull. I will try to create a pppos netif driver this weekend. The nice thing about the pppos netif would be that you can choose between the SerialDriver or Serial over USB driver as interface.

@Giovanni,
I diddn't test the chprintf patch i posted before. It seems to work for the 16-bit formatters but I found the patch is missing the 8bit type support like %hhu, %hhd and %hhx, do you want me to add those too?

I added a patch which implements the LWIP_PLATFORM_DIAG macro when LWIP_DEBUG is defined. See the attachment. To enable LwIP debug output define the LWIP_DEBUG macro and configure the debug options in lwipopts.h. Also make sure you include the streams.mk in your makefile. Before starting LwIP you should start the SerialDriver used in LWIP_PLATFORM_DIAG.

Marco
Post Reply