-
Notifications
You must be signed in to change notification settings - Fork 339
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
robamu
wants to merge
4
commits into
ObKo:master
Choose a base branch
from
us-irs:mueller/lwip-feature-squashed
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# If NO_SYS is set to 0 and the Netconn or Socket API is used, the user should link against | ||
# the CMSIS RTOS or RTOS_V2 support because the sys_arch.c LwIP OS port layer makes use of | ||
# CMSIS calls. | ||
find_path(LwIP_ROOT | ||
NAMES CMakeLists.txt | ||
PATHS "${STM32_CUBE_${FAMILY}_PATH}/Middlewares/Third_Party/LwIP" | ||
NO_DEFAULT_PATH | ||
) | ||
|
||
if(LwIP_ROOT MATCHES "LwIP_ROOT-NOTFOUND") | ||
message(WARNING "LwIP root foolder not found. LwIP might not be supported") | ||
endif() | ||
|
||
set(LWIP_DIR ${LwIP_ROOT}) | ||
|
||
find_path(LwIP_SOURCE_PATH | ||
NAMES Filelists.cmake | ||
PATHS "${STM32_CUBE_${FAMILY}_PATH}/Middlewares/Third_Party/LwIP/src" | ||
NO_DEFAULT_PATH | ||
) | ||
|
||
if(LwIP_SOURCE_PATH MATCHES "LwIP_SOURCE_PATH-NOTFOUND") | ||
message(WARNING "LwIP filelist CMake file not found. Build might fail") | ||
endif() | ||
|
||
if(IS_DIRECTORY "${LwIP_SOURCE_PATH}/include") | ||
set(LwIP_INCLUDE_DIR "${LwIP_SOURCE_PATH}/include") | ||
else() | ||
message(WARNING "LwIP include directory not found. Build might fail") | ||
endif() | ||
|
||
if(IS_DIRECTORY "${LwIP_ROOT}/system") | ||
set(LwIP_SYS_INCLUDE_DIR "${LwIP_ROOT}/system") | ||
set(LwIP_SYS_SOURCES "${LwIP_ROOT}/system/OS/sys_arch.c") | ||
else() | ||
message(WARNING "LwIP system include directory not found. Build might fail") | ||
endif() | ||
|
||
# Use Filelists.cmake to get list of sources to compile | ||
include("${LwIP_SOURCE_PATH}/Filelists.cmake") | ||
|
||
if(NOT (TARGET LwIP)) | ||
add_library(LwIP INTERFACE IMPORTED) | ||
target_sources(LwIP INTERFACE ${lwipcore_SRCS}) | ||
target_include_directories(LwIP INTERFACE | ||
${LwIP_INCLUDE_DIR} ${LwIP_SYS_INCLUDE_DIR} | ||
) | ||
endif() | ||
|
||
# Compile the system components which use CMSIS RTOS. This is necessary for the NETIF and Socket API | ||
# This target also requires that the application was linked against the CMSIS RTOS support | ||
if(NOT (TARGET LwIP::SYS)) | ||
add_library(LwIP::SYS INTERFACE IMPORTED) | ||
target_sources(LwIP::SYS INTERFACE ${LwIP_SYS_SOURCES}) | ||
target_link_libraries(LwIP::SYS INTERFACE LwIP) | ||
endif() | ||
|
||
if(NOT (TARGET LwIP::IPv4)) | ||
add_library(LwIP::IPv4 INTERFACE IMPORTED) | ||
target_sources(LwIP::IPv4 INTERFACE ${lwipcore4_SRCS}) | ||
target_link_libraries(LwIP::IPv4 INTERFACE LwIP) | ||
endif() | ||
|
||
if(NOT (TARGET LwIP::IPv6)) | ||
add_library(LwIP::IPv6 INTERFACE IMPORTED) | ||
target_sources(LwIP::IPv6 INTERFACE ${lwipcore6_SRCS}) | ||
target_link_libraries(LwIP::IPv6 INTERFACE LwIP) | ||
endif() | ||
|
||
if(NOT (TARGET LwIP::API)) | ||
add_library(LwIP::API INTERFACE IMPORTED) | ||
target_sources(LwIP::API INTERFACE ${lwipapi_SRCS}) | ||
target_link_libraries(LwIP::API INTERFACE LwIP::SYS) | ||
endif() | ||
|
||
if(NOT (TARGET LwIP::NETIF)) | ||
add_library(LwIP::NETIF INTERFACE IMPORTED) | ||
target_sources(LwIP::NETIF INTERFACE ${lwipnetif_SRCS}) | ||
target_link_libraries(LwIP::NETIF INTERFACE LwIP) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(LwIP | ||
REQUIRED_VARS LwIP_ROOT LwIP_INCLUDE_DIR LwIP_SYS_INCLUDE_DIR | ||
FOUND_VAR LwIP_FOUND | ||
HANDLE_COMPONENTS | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction: F4 seems to have one as well: https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32F429ZI-Nucleo/Applications/LwIP/LwIP_HTTP_Server_Netconn_RTOS