Skip to content

Introduce the lwip-interface into the core mbed repo #2231

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

Merged
merged 40 commits into from
Jul 23, 2016

Conversation

geky
Copy link
Contributor

@geky geky commented Jul 22, 2016

This patch introduces the network-socket API compatible lwip-interface into the core mbed repo.

dir features/net/FEATURE_IPV4/lwip-interface
related #2216
cc @sg-, @c1728p9

Bogdan Marinescu and others added 30 commits July 22, 2016 02:02
Responded to feedback from mbed-client implementation
to introduce a full feature set that should support most
of the use cases for the API.
The size was increased to 4 bytes. Thanks @c1728p9 for spotting this.
Move the backend of LWIPInterface from the LWIP socket API to the
asynch UDP/TCP APIs used in https://github.com/armmbed/sal-stack-lwip.
Provides asynchronous functionality for the LWIPInterface.
Pros
- Simplifies interface
- Easier base implementation

Cons
- May need shutdown functionality, in this case shutdown
  can be added as another function in the future
Pros
- Easier to implement
- More similar to SIGIO in BDS sockets

Cons
- Less information, but this information had a high risk of being
  faulty/spurious
- socket_create -> socket_open
- socket_destroy -> socket_close
Adds the following functions for direct configuration of interface
- (set|get)stackopt
- (set|get)sockopt
NetworkInterface  -> NetworkStack
EthernetInterface -> EthernetStack
WiFiInterface     -> WiFiStack
CellularInterface -> CellularStack
MeshInterface     -> MeshStack
Remove all the hal files in preparation for pulling in mbedmicro/mbed.
Sync the directory lwip-eth with that of mbedmicro/mbed at revision
b32f7a9.
per the socket API documentation:

  /** Get the local IP address
   *
   *  @return         Null-terminated representation of the local IP address
   *                  or null if not yet connected
   */
  virtual const char *get_ip_address() = 0;

LWIPInterface incorrectly returned "\0" if unconnected
- Semaphore returns 0 on timeout, and negative was incorrect used for
  errors
- Correctly checked error code on tcp_connect

thanks to @LiyouZhou
fixes ARMmbed#284, fixes ARMmbed#285, fixes ARMmbed#166
For very slow networks the previous default has be problematically short
Don't have GCC_ARM use GCC_CR's memory region in mem.c.  This fixes
some tests.
Refactor LWIPInterface so it is a NetworkInterface rather than a
NetworkStack.  Rename LWIPInterface to EthernetInterface since it
is no longer a stack.  Update tests to use this new name.
adustm and others added 9 commits July 22, 2016 02:02
* NUCLEO_F746ZG : enable Ethernet and LwIP for this target.
Net tests were passed :
mbed-os-features-feature_ipv4-tests-mbedmicro-net-nist_internet_time_service
| OK
mbed-os-features-feature_ipv4-tests-mbedmicro-net-tcp_client_hello_world
| OK
The 2 other are failing because I cannot test them on my ST computer.
- lwip socket api did not provide signaling mechanism compatible with
  mutliple stacks
- lwip raw api did not support multiple threads

The netconn api provides the necessary signalling mechanism while still
supporting multiple threads. The netconn api also shares several design
similarities to the current socket api.

Additionally, the move to a higher-level api reduced implementation
complexity significantly and will hopefully reduce integration
difficulties
- Renamed LWIPInterface to LWIPStack
- Moved LWIPStack to static declaration
- Removed hidden comments
- Reduced lwip includes
Globally declared C++ classes with vtables are not gced by current
toolchains, even if the C++ class contains no member variables and
no constructor. This causes all of lwip to be dragged into resulting
binaries, even if lwip is not accessed.

Adoption of the SingletonPtr class in lwip allows us to workaround
this issue.
- Removes problem with non-gced vtables
- Moves some tedius operations up into the nsapi
…858cf3de3678aea4deec941add516790'

git-subtree-dir: features/net/FEATURE_IPV4/lwip-interface
git-subtree-mainline: 83f24fb
git-subtree-split: 63e816f
@sg-
Copy link
Contributor

sg- commented Jul 22, 2016

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM,ARM,IAR
TARGETS=K64F,NRF51_DK,NUCLEO_F411RE

@sg-
Copy link
Contributor

sg- commented Jul 22, 2016

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 481

A build failure occurred!

@mbed-bot
Copy link

[Build ${MBED_BUILD_ID}]
FAILURE: Something went wrong when building and testing.

@sg-
Copy link
Contributor

sg- commented Jul 22, 2016

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM,ARM,IAR
TARGETS=K64F,NRF51_DK,NUCLEO_F411RE

@sg-
Copy link
Contributor

sg- commented Jul 22, 2016

/morph test

@bridadan
Copy link
Contributor

I'm already seeing an issue with lwip_stack.c for the target NUCLEO_F746ZG.

It boiled down to not having stdbool.h and string.h included in the file. The K64F and other lwip platforms must do this in their hal somewhere so it didn't get caught there.

@geky Could these two includes be added to lwip_stack.c?

@mbed-bot
Copy link

[Build 681]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 484

A build failure occurred!

@c1728p9
Copy link
Contributor

c1728p9 commented Jul 22, 2016

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM,ARM,IAR
TARGETS=K64F,NRF51_DK,NUCLEO_F411RE

@sg-
Copy link
Contributor

sg- commented Jul 22, 2016

/morph test

@geky
Copy link
Contributor Author

geky commented Jul 22, 2016

Ah yeah, thanks @c1728p9!

@mbed-bot
Copy link

[Build 684]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@sg-
Copy link
Contributor

sg- commented Jul 23, 2016

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 487

A test failure occurred!

@sg-
Copy link
Contributor

sg- commented Jul 23, 2016

LGTM 👍 Failures are know test execution failures.

@sg- sg- merged commit db99e72 into ARMmbed:master Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants