Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lwIP: Initial import #3551

Merged
merged 7 commits into from
Mar 30, 2016
Merged

lwIP: Initial import #3551

merged 7 commits into from
Mar 30, 2016

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Aug 3, 2015

Imports lwIP for RIOT as a pkg.

Depends on #3549.

Todos:

  • System abstraction layer
  • ng_netdev(2) compatible device driver
  • provide conn connectivity
    • conn_ip
    • conn_udp
    • conn_tcp (optional)
  • provide minimal test application

@miri64 miri64 added Area: network Area: Networking State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: pkg Area: External package ports State: waiting for other PR State: The PR requires another PR to be merged first labels Aug 3, 2015
@miri64 miri64 added this to the Release NEXT MAJOR milestone Aug 3, 2015
@jnohlgard
Copy link
Member

Could you explain how this relates to netdev/netif and gnrc? Would this stack offer the same functionality as some parts of gnrc? Are there any differences in supported features etc?

@miri64
Copy link
Member Author

miri64 commented Aug 3, 2015

I port this stack mainly for comparability in my master thesis (there will follow a few more implementations over the next weeks ;-)). I will port lwIP's driver interface so that it will speak to netdev. As far as I know (but I did not delve deep enough yet to say for sure) the limitations compared to gnrc are:

  • no multi-interface support (that's not true)
  • no 6LoWPAN (yet)
  • less modular

The main advantage might be it's size, but the final verdict will have to wait until I finished my master thesis ;-)

@miri64
Copy link
Member Author

miri64 commented Oct 25, 2015

Ported to and rebased upon new semaphore module

@miri64 miri64 force-pushed the pkg/port/lwip branch 6 times, most recently from f2d9e37 to b0f2873 Compare November 16, 2015 15:01
@miri64 miri64 removed the State: waiting for other PR State: The PR requires another PR to be merged first label Nov 24, 2015
@miri64
Copy link
Member Author

miri64 commented Nov 24, 2015

Rebased to current master

@miri64 miri64 force-pushed the pkg/port/lwip branch 2 times, most recently from 6fbebaf to c0baa12 Compare November 30, 2015 16:32
@miri64
Copy link
Member Author

miri64 commented Nov 30, 2015

Tested with conn_ip and it worked \o/

+#define LWIP_ASSERT(message, assertion) \
+ if(!(assertion)) { \
+ LWIP_PLATFORM_ASSERT(message); \
+ }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this patch required?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the patch message states: it fixes warnings, that would make it impossible to compile without W_ERROR=0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and no, I don't remember the precise warning ;-P)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record: the warning was something like pkg/lwip/lwip/src/include/lwip/debug.h:71:32: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, and I thought then: why have a do { } while (0) around it anyway then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a reminder for me to try it without this patch

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not compile without the patch, so yes it is required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think there could be a way to get this patch upstream?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that it is technically perfectly fine code, since the #ifndef throws an error anyway if LWIP_PLATFORM_ASSERT isn't defined and it's just our -Werror that makes problems here. In my experience with the community there I don't think this will come through.

@miri64
Copy link
Member Author

miri64 commented Nov 30, 2015

fixed a few assertion related issues

@miri64
Copy link
Member Author

miri64 commented Nov 30, 2015

Now I tested receiving of IPv6 frames, too ;-)

* @brief Compiler hints for packing structures
* @{
*/
#define PACK_STRUCT_FIELD(x) x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we put parens around the x?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a macro to build structs platform indepentent.

@OlegHahm
Copy link
Member

Check this: remove the ifneq and call make info-boards-supported again.

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

First let me look what Murdock is saying about this.

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Check this: remove the ifneq and call make info-boards-supported again.

airfy-beacon arduino-due avsextrem cc2538dk fox frdm-k64f iotlab-m3 limifrog-v1 msba2 msbiot mulle nrf6310 nucleo-f103 nucleo-f303 nucleo-f334 nucleo-f401 nucleo-l1 openmote-cc2538 pba-d-01-kw2x pca10005 pttu remote saml21-xpro samr21-xpro stm32f0discovery stm32f3discovery stm32f4discovery udoo weio yunjia-nrf51822

@OlegHahm
Copy link
Member

DRIVER keeps set to netdev2_tap in buildtest.

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Should be reset in https://github.com/RIOT-OS/RIOT/pull/3551/files#diff-b2af745a4a882b6e5cb2abb8b6ac785bR23 (l. 23). But anyway, can you try and see, what happens if the colon is removed before the equal sign for the DRIVER assignments?

@OlegHahm
Copy link
Member

same result

@OlegHahm
Copy link
Member

I think the problem is somehow related to the fact that $BOARD is always set to native while $DRIVER is set when running make buildtest.

If you do BOARD=iotlab-m3 make buildtest or BOARD=iotlab-m3 make info-boards-supported everything is fine.

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Then setting BOARD to e.g. iotlab-m3 in l.3 would do the trick?

@OlegHahm
Copy link
Member

As a workaround for the broken FEATURES_REQUIRED/make buildtest thing, that would work, yes.

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

For some reason the Makefile on Murdock is only evaluated after the build happens:

In file included from /data/riotbuild/drivers/at86rf2xx/at86rf2xx_netdev.c:33:0:
/data/riotbuild/drivers/include/at86rf2xx.h:139:5: error: unknown type name 'spi_t'
     spi_t spi;              /**< SPI bus the device is connected to */
     ^
/data/riotbuild/drivers/include/at86rf2xx.h:140:5: error: unknown type name 'spi_speed_t'
     spi_speed_t spi_speed;  /**< SPI speed to use */
     ^
/data/riotbuild/Makefile.base:60: recipe for target '/data/riotbuild/tests/lwip/bin/ek-lm4f120xl/at86rf2xx/at86rf2xx_netdev.o' failed
make[3]: *** [/data/riotbuild/tests/lwip/bin/ek-lm4f120xl/at86rf2xx/at86rf2xx_netdev.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from /data/riotbuild/drivers/at86rf2xx/include/at86rf2xx_internal.h:27:0,
                 from /data/riotbuild/drivers/at86rf2xx/at86rf2xx.c:31:
/data/riotbuild/drivers/include/at86rf2xx.h:139:5: error: unknown type name 'spi_t'
     spi_t spi;              /**< SPI bus the device is connected to */
     ^
/data/riotbuild/drivers/include/at86rf2xx.h:140:5: error: unknown type name 'spi_speed_t'
     spi_speed_t spi_speed;  /**< SPI speed to use */
     ^
/data/riotbuild/drivers/at86rf2xx/at86rf2xx.c: In function 'at86rf2xx_setup':
/data/riotbuild/drivers/at86rf2xx/at86rf2xx.c:48:5: error: implicit declaration of function 'spi_init_master' [-Werror=implicit-function-declaration]
     spi_init_master(dev->params.spi, SPI_CONF_FIRST_RISING, params->spi_speed);
     ^
/data/riotbuild/drivers/at86rf2xx/at86rf2xx.c:48:38: error: 'SPI_CONF_FIRST_RISING' undeclared (first use in this function)
     spi_init_master(dev->params.spi, SPI_CONF_FIRST_RISING, params->spi_speed);
                                      ^
/data/riotbuild/drivers/at86rf2xx/at86rf2xx.c:48:38: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errors
/data/riotbuild/Makefile.base:60: recipe for target '/data/riotbuild/tests/lwip/bin/ek-lm4f120xl/at86rf2xx/at86rf2xx.o' failed
make[3]: *** [/data/riotbuild/tests/lwip/bin/ek-lm4f120xl/at86rf2xx/at86rf2xx.o] Error 1
/data/riotbuild/Makefile.base:20: recipe for target 'ALL--/data/riotbuild/drivers/at86rf2xx' failed
make[2]: *** [ALL--/data/riotbuild/drivers/at86rf2xx] Error 2
make[2]: *** Waiting for unfinished jobs....
In file included from /data/riotbuild/pkg/lwip/contrib/lwip.c:26:0:
/data/riotbuild/drivers/include/at86rf2xx.h:139:5: error: unknown type name 'spi_t'
     spi_t spi;              /**< SPI bus the device is connected to */
     ^
/data/riotbuild/drivers/include/at86rf2xx.h:140:5: error: unknown type name 'spi_speed_t'
     spi_speed_t spi_speed;  /**< SPI speed to use */
     ^
In file included from /data/riotbuild/pkg/lwip/contrib/lwip.c:27:0:
/data/riotbuild/drivers/at86rf2xx/include/at86rf2xx_params.h:35:38: error: 'SPI_0' undeclared here (not in a function)
 #define AT86RF2XX_PARAM_SPI         (SPI_0)
                                      ^
/data/riotbuild/drivers/at86rf2xx/include/at86rf2xx_params.h:53:45: note: in expansion of macro 'AT86RF2XX_PARAM_SPI'
 #define AT86RF2XX_PARAMS_DEFAULT    {.spi = AT86RF2XX_PARAM_SPI, \
                                             ^
/data/riotbuild/drivers/at86rf2xx/include/at86rf2xx_params.h:69:5: note: in expansion of macro 'AT86RF2XX_PARAMS_DEFAULT'
     AT86RF2XX_PARAMS_DEFAULT,
     ^
/data/riotbuild/drivers/at86rf2xx/include/at86rf2xx_params.h:38:38: error: 'SPI_SPEED_5MHZ' undeclared here (not in a function)
 #define AT86RF2XX_PARAM_SPI_SPEED   (SPI_SPEED_5MHZ)
                                      ^
/data/riotbuild/drivers/at86rf2xx/include/at86rf2xx_params.h:54:51: note: in expansion of macro 'AT86RF2XX_PARAM_SPI_SPEED'
                                      .spi_speed = AT86RF2XX_PARAM_SPI_SPEED, \
                                                   ^
/data/riotbuild/drivers/at86rf2xx/include/at86rf2xx_params.h:69:5: note: in expansion of macro 'AT86RF2XX_PARAMS_DEFAULT'
     AT86RF2XX_PARAMS_DEFAULT,
     ^
/data/riotbuild/Makefile.base:60: recipe for target '/data/riotbuild/tests/lwip/bin/ek-lm4f120xl/lwip_contrib/lwip.o' failed
make[2]: *** [/data/riotbuild/tests/lwip/bin/ek-lm4f120xl/lwip_contrib/lwip.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/data/riotbuild/Makefile.base:20: recipe for target 'ALL--/data/riotbuild/drivers' failed
make[1]: *** [ALL--/data/riotbuild/drivers] Error 2
make[1]: *** Waiting for unfinished jobs....
/data/riotbuild/Makefile.base:20: recipe for target 'ALL--/data/riotbuild/pkg/lwip/contrib' failed
make[1]: *** [ALL--/data/riotbuild/pkg/lwip/contrib] Error 2
/data/riotbuild/Makefile.include:253: recipe for target 'all' failed
make: *** [all] Error 2
Makefile:20: "START: DRIVER = '' FEATURES_REQUIRED = ''"
Makefile:40: "BEFORE CRITICAL: DRIVER = 'at86rf231' FEATURES_REQUIRED = ''"
Makefile:43: "IN CRITICAL: DRIVER = 'at86rf231' FEATURES_REQUIRED = ''"
Makefile:47: "AFTER CRITICAL: DRIVER = 'at86rf231' FEATURES_REQUIRED = 'periph_spi periph_gpio'"
Makefile:49: "END: DRIVER = 'at86rf231' FEATURES_REQUIRED = 'periph_spi periph_gpio'"

compare that to my output:

Makefile:20: "START: DRIVER = '' FEATURES_REQUIRED = ''"
Makefile:40: "BEFORE CRITICAL: DRIVER = 'at86rf231' FEATURES_REQUIRED = ''"
Makefile:43: "IN CRITICAL: DRIVER = 'at86rf231' FEATURES_REQUIRED = ''"
Makefile:47: "AFTER CRITICAL: DRIVER = 'at86rf231' FEATURES_REQUIRED = 'periph_spi periph_gpio'"
Makefile:49: "END: DRIVER = 'at86rf231' FEATURES_REQUIRED = 'periph_spi periph_gpio'"
There are unsatisfied feature requirements: periph_spi


EXPECT ERRORS!


Building application "lwip" for "ek-lm4f120xl" with MCU "lm4f120".

In file included from /home/martine/Repositories/RIOT-OS/RIOT/drivers/at86rf2xx/include/at86rf2xx_internal.h:27:0,
                 from /home/martine/Repositories/RIOT-OS/RIOT/drivers/at86rf2xx/at86rf2xx.c:31:
/home/martine/Repositories/RIOT-OS/RIOT/drivers/include/at86rf2xx.h:139:5: error: unknown type name 'spi_t'
     spi_t spi;              /**< SPI bus the device is connected to */
     ^
/home/martine/Repositories/RIOT-OS/RIOT/drivers/include/at86rf2xx.h:140:5: error: unknown type name 'spi_speed_t'
     spi_speed_t spi_speed;  /**< SPI speed to use */
     ^
/home/martine/Repositories/RIOT-OS/RIOT/drivers/at86rf2xx/at86rf2xx.c: In function 'at86rf2xx_setup':
/home/martine/Repositories/RIOT-OS/RIOT/drivers/at86rf2xx/at86rf2xx.c:48:5: error: implicit declaration of function 'spi_init_master' [-Werror=implicit-function-declaration]
     spi_init_master(dev->params.spi, SPI_CONF_FIRST_RISING, params->spi_speed);
     ^
/home/martine/Repositories/RIOT-OS/RIOT/drivers/at86rf2xx/at86rf2xx.c:48:38: error: 'SPI_CONF_FIRST_RISING' undeclared (first use in this function)
     spi_init_master(dev->params.spi, SPI_CONF_FIRST_RISING, params->spi_speed);
                                      ^
/home/martine/Repositories/RIOT-OS/RIOT/drivers/at86rf2xx/at86rf2xx.c:48:38: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errors
make[3]: *** [/home/martine/Repositories/RIOT-OS/RIOT/tests/lwip/bin/ek-lm4f120xl/at86rf2xx/at86rf2xx.o] Error 1
make[2]: *** [ALL--/home/martine/Repositories/RIOT-OS/RIOT/drivers/at86rf2xx] Error 2
make[1]: *** [ALL--/home/martine/Repositories/RIOT-OS/RIOT/drivers] Error 2
make: *** [all] Error 2

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Okay adapted for workaround now.

@OlegHahm
Copy link
Member

It's still saying BOARD ?= native

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Derp...

@OlegHahm
Copy link
Member

\o/ Murdock is finally green like Ireland!

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Then merge at will :-)

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Fixed assert issues and squashed immediately.

@OlegHahm
Copy link
Member

ACK

@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Murdock is happy.

@OlegHahm
Copy link
Member

I'd say: the honor to push the button is yours!

@miri64 miri64 merged commit 4dbc26f into RIOT-OS:master Mar 30, 2016
@miri64 miri64 deleted the pkg/port/lwip branch March 30, 2016 16:22
@miri64
Copy link
Member Author

miri64 commented Mar 30, 2016

Thanks for the review :-)

@OlegHahm
Copy link
Member

It was a pleasure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR PR-award-nominee Deprecated. Will be removed soon. Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants