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

Added LwIP support for stm32-cmake #263

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

robamu
Copy link
Contributor

@robamu robamu commented Aug 8, 2021

This feature allows using the LwIP source code and OS abstraction layer
provided by STM to build networking applications for STM MCUs with
stm32-cmake.

It uses the CMakeLists.txt already contained in the LwIP sources.
It is difficult to provide examples for LwIP code for various reasons:

  1. Networking code often requires special code which is board and
    architecture specific. Examples: PHY driver code or linker scripts for special
    lwip sections

  2. STM licenses a lot of their networking example code differently than the rest of
    the HAL repositories. This license might be incompatible to the MIT
    license.

A separate project is linked in the README example section for a basic
UDP echoserver on the H743ZI board.
The README was updated with intructions on how to use the LwIP support.

closes #209

robamu added 2 commits August 8, 2021 20:03
This feature allows using the LwIP source code and OS abstraction layer
provided by STM to build networking applications for STM MCUs with
stm32-cmake.

It uses the CMakeLists.txt already contained in the LwIP sources.
It is difficult to provide examples for LwIP code for various reasons:

1. Networking code often requires special code which is board and
   architecture specific. Examples: PHY or linker scripts for special
   lwip sections

2. STM licenses a lot of their example code differently than the rest of
   the HAL repositories. This license might be incompatible to the MIT
   license.

A separate project is linked in the README example section for a basic
UDP echoserver on the H743ZI board.
The README was updated with intructions on how to use the LwIP support.
@robamu
Copy link
Contributor Author

robamu commented Aug 10, 2021

Maybe this can be added to a milestone for v2.2.0?

@robamu
Copy link
Contributor Author

robamu commented Nov 5, 2021

Just bumping this a bit. Do you want to look over it or test it?

@atsju atsju self-requested a review November 5, 2021 10:25
Copy link
Collaborator

@atsju atsju left a comment

Choose a reason for hiding this comment

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

Hi @robamu
Sorry for late/slow reply. I had a look at your code when you pushed it (I even have a pending review comment for then) and discussed about it with @Hish15 but we did not come to a definitive conclusion then.

Our concern is that the only families supporting LWIP are F1 F2 F4 F7 and H7 and adding to that, the file Filelists.cmake is not always present this way. I think for the code to be merged, it should at least work for all versions of HAL that support LWIP.

endif()

# Use Filelists.cmake to get list of sources to compile
include("${LwIP_SOURCE_PATH}/Filelists.cmake")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file exists from F4 F7 H7 cube only. Although LWIP is in cube F1 F2 F4 F7 H7 because they are more or less up to date. ST updates Middleware only on minor (1.X.0) releases of cube

Edit: this is the pending comment from when I first read your code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh that's interesting. The Cube repositories have LwIP, but I am not even sure whether the processor or the boards support networking applications. I'm browsing the example applications here right now: https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32F429I-Discovery/Applications and I can't see any example applications. Have not checked F7 yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For me it appears only F7 and H7 have networking applications

Copy link
Contributor Author

@robamu robamu Jun 7, 2022

Choose a reason for hiding this comment

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

@robamu
Copy link
Contributor Author

robamu commented Jun 7, 2022

I double checked the F0 and F1 repositories again.

It seems there are two example applications with a TCP/IP demonstration available, but they are not available inside
the Cube repositories:

I have checked those example application and they appear to be very old, being last modified in 2009 and 2011.
They might even pre-date the cube repositories.

What do you think about letting the find_package process fail if the Filelists.cmake file does not exist?
Maybe also emit a custom warning with the minimum required lwIP version.

@robamu
Copy link
Contributor Author

robamu commented Jun 7, 2022

I added the following checks

if(NOT EXISTS "${LwIP_SOURCE_PATH}/Filelists.cmake")
    message(WARNING "${MSG_PREFIX} ${LwIP_SOURCE_PATH}/Filelists.cmake file not found.")
    message(FATAL_ERROR "${MSG_PREFIX} Please ensure that the LwIP version is at least 2.1.0")
endif()

@robamu
Copy link
Contributor Author

robamu commented Jun 7, 2022

I also checked the LwIP releases: https://git.savannah.nongnu.org/cgit/lwip.git/refs/tags

2.1.0 is 4 years old now. It might make more sense to ask STM whether they have plans to update the lwIP dependency of F0 and F1 while also adding the two networking examples than to bother with downwards compatibility to a > 5 year old dependency

@Hish15
Copy link
Collaborator

Hish15 commented Jun 12, 2022

@atsju Where are we on this topic?

@atsju
Copy link
Collaborator

atsju commented Jun 12, 2022

@Hish15 It's quite clear : LWIP is only in repos F1 F2 F4 F7 and H7 but F1 and F2 are not up to date enough to use this PR. This PR would be used for F4 F7 and H7. I haven't had a deep loop apart from that. In theory it's OK for me.

As a side note, the example in readme points to an external repo (I have nothing against it, just keep in mind maintainability)

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.

lwIP support
3 participants