From 4c292eb74b19bce92cdf92db546d77f6113a3fee Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Fri, 23 Sep 2022 14:09:02 -0700 Subject: [PATCH 01/21] #556 Initial Cmake Module definition. --- .github/workflows/ci.yml | 17 +- CMakeLists.txt | 279 ++++++++++++++++++ cmake_modules/FindPCAP.cmake | 75 +++++ source/CMakeLists.txt | 112 +++++++ source/portable/CMakeLists.txt | 177 +++++++++++ test/CMakeLists.txt | 8 + test/build-combination/CMakeLists.txt | 141 ++++----- .../build-combination/Common/FreeRTOSConfig.h | 2 +- .../DefaultConf/FreeRTOSIPConfig.h | 4 + test/build-combination/README.md | 18 +- tools/CMakeLists.txt | 38 +++ 11 files changed, 765 insertions(+), 106 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 cmake_modules/FindPCAP.cmake create mode 100644 source/CMakeLists.txt create mode 100644 source/portable/CMakeLists.txt create mode 100644 test/CMakeLists.txt create mode 100644 tools/CMakeLists.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f8ecdc683..58b87c798d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: - name: Clone This Repo uses: actions/checkout@v2 with: - path: ./tcp + path: ./tcp - name: Install spell run: | sudo apt-get install spell @@ -115,19 +115,16 @@ jobs: run: git submodule update --init --checkout - name: Build checks (Enable all functionalities) run: | - cmake -S test/build-combination -B test/build-combination/build/ \ - -DTEST_CONFIGURATION=ENABLE_ALL - make -C test/build-combination/build/ + cmake -S . -B build/ -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL + make -C build/ - name: Build checks (Disable all functionalities) run: | - cmake -S test/build-combination -B test/build-combination/build/ \ - -DTEST_CONFIGURATION=DISABLE_ALL - make -C test/build-combination/build/ + cmake -S . -B build/ -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL + make -C build/ - name: Build checks (Default configuration) run: | - cmake -S test/build-combination -B test/build-combination/build/ \ - -DTEST_CONFIGURATION=DEFAULT_CONF - make -C test/build-combination/build/ + cmake -S . -B build/ -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF + make -C build/ complexity: runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..7e4012e206 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,279 @@ + +cmake_minimum_required(VERSION 3.15) +cmake_policy(SET CMP0048 NEW) # project version +cmake_policy(SET CMP0076 NEW) # full paths + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules") + +######################################################################## +# Project Details +project(FreeRTOS-Plus-TCP + VERSION 3.1.0 + DESCRIPTION "FreeRTOS TCP/UDP Network Layer" + HOMEPAGE_URL https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/index.html + LANGUAGES C) + +# Do not allow in-source build. +if( ${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR} ) +message( FATAL_ERROR "In-source build is not allowed. Please build in a separate directory, such as ${PROJECT_SOURCE_DIR}/build." ) +endif() + +# Options +option(FREERTOS_PLUS_TCP_BUILD_TEST "Build the test for FreeRTOS Plus TCP" OFF) + +# Configuration +# Override these at project level with: +# Optional: set(FREERTOS_PLUS_TCP_BUFFER_ALLOCATION "1" CACHE STRING "" FORCE) +# Optional: set(FREERTOS_PLUS_TCP_COMPILER "" CACHE STRING "" FORCE) +# Required: set(FREERTOS_PLUS_TCP_NETWORK_IF "POSIX" CACHE STRING "" FORCE) + +# Select the appropriate buffer allocaiton method. +# See: https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/Embedded_Ethernet_Buffer_Management.html +if (NOT FREERTOS_PLUS_TCP_BUFFER_ALLOCATION) + message(STATUS "Using default FREERTOS_PLUS_TCP_BUFFER_ALLOCATION = 2") + set(FREERTOS_PLUS_TCP_BUFFER_ALLOCATION "2" CACHE STRING "FreeRTOS buffer allocation model number. 1 .. 2.") +endif() + +# Select the Compiler - if left blank will detect using CMake +# Note relies on CMake to detect over any setting here. +# Valid options are: +# FREERTOS_PLUS_TCP_COMPILER | Detected | CMake +# ------------------------------------------------- +# CCS | No | ?TBD? +# GCC | Yes | GNU +# IAR | Yes | IAR +# Keil | Yes | ARMCC +# MSVC | Yes | MSVC # Note only for MinGW +# Renesas | No | ?TBD? +# Will always a attempt to detect and if detectable double checks that the compiler is set correctly. +set(FREERTOS_PLUS_TCP_COMPILER "" CACHE STRING "FreeRTOS Plus TCP Compiler Selection") + + +# Select the appropriate network interface +# This will fail the CMake preparation step if not set to one of those values. +set(FREERTOS_PLUS_TCP_NETWORK_IF "" CACHE STRING "FreeRTOS Plus TCP Network Interface selection") +set(FREERTOS_PLUS_TCP_NETWORK_IF_LIST + A_CUSTOM_NETWORK_IF + ATSAM43 ATSAME5x # AT + DRIVER_SAM + ESP32 + KSZ8851SNL + LPC17xx LPC18xx LPC54018 + M487 + MPS2_AN385 + MW300_RD + PIC32MZEF_ETH PIC32MZEF_WIFI + POSIX WIN_PCAP # Native Linux & Windows respectively + RX + SH2A + STM32FXX STM32HXX # ST Micro + MSP432 + TM4C + XILINX_ULTRASCALE ZYNQ # AMD/Xilinx +) +if(NOT FREERTOS_PLUS_TCP_NETWORK_IF) + # Attempt to detect the system. + if(UNIX) + message(STATUS "Detected UNIX/Posix system setting FREERTOS_PLUS_TCP_NETWORK_IF = POSIX") + set(FREERTOS_PLUS_TCP_NETWORK_IF POSIX) + elseif(MINGW) + message(STATUS "Detected Windows MinGW system setting FREERTOS_PLUS_TCP_NETWORK_IF = WIN_PCAP") + set(FREERTOS_PLUS_TCP_NETWORK_IF WIN_PCAP) + endif() +endif() + +if(NOT FREERTOS_PLUS_TCP_NETWORK_IF IN_LIST FREERTOS_PLUS_TCP_NETWORK_IF_LIST ) + message(FATAL_ERROR " FREERTOS_PLUS_TCP_NETWORK_IF is '${FREERTOS_PLUS_TCP_NETWORK_IF}'.\n" + " Please specify it from top-level CMake file (example):\n" + " set(FREERTOS_PLUS_TCP_NETWORK_IF POSIX CACHE STRING \"\")\n" + " or from CMake command line option:\n" + " -DFREERTOS_PLUS_TCP_NETWORK_IF=POSIX\n" + " \n" + " Available port options:\n" + " A_CUSTOM_NETWORK_IF Target: User Defined\n" + " ATSAM4E Target: ATSAM4E - TODO\n" + " ATSAME5x Target: ATSAME5x - TODO\n" + " DRIVER_SAM Target: Driver SAM - TODO\n" + " ESP32 Target: ESP-32 - TODO\n" + " KSZ8851SNL Target: ksz8851snl - TODO\n" + " POSIX Target: linux/Posix\n" + " LPC17xx Target: LPC17xx - TODO\n" + " LPC18xx Target: LPC18xx - TODO\n" + " LPC54018 Target: LPC54018 - TODO\n" + " M487 Target: M487- TODO\n" + " MPS2_AN385 Target: MPS2_AN385 - TODO\n" + " MW300_RD Target: mw300_rd - TODO\n" + " PIC32MZEF_ETH Target: pic32mzef ethernet- TODO\n" + " PIC32MZEF_WIFI Target: pic32mzef Wifi- TODO\n" + " RX Target: RX- TODO\n" + " SH2A Target: SH2A- TODO\n" + " STM32FXX Target: STM32Fxx - TODO\n" + " STM32HXX Target: STM32Hxx - TODO\n" + " MSP432 Target: MSP432 - TODO\n" + " TM4C Target: TM4C- TODO\n" + " WIN_PCAP Target: Windows - TODO\n" + " XILINX_ULTRASCALE Target: Xilinx Ultrascale - TODO\n" + " ZYNQ Target: Xilinx Zynq") +elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_port) ) + message(FATAL_ERROR " FREERTOS_PLUS_TCP_NETWORK_IF is set to A_CUSTOM_NETWORK_IF.\n" + " Please specify the custom network interface target with all necessary files.\n" + " For example, assuming a directory of:\n" + " FreeRTOSCustomNetworkInterface/\n" + " CMakeLists.txt\n" + " NetworkInterface.c\n\n" + " Where FreeRTOSCustomNetworkInterface/CMakeLists.txt is a modified version of:\n" + " add_library(freertos_plus_tcp_network_if STATIC)\n\n" + " target_sources(freertos_plus_tcp_network_if\n" + " PRIVATE\n" + " NetworkInterface.c)\n\n" + " target_include_directories(freertos_plus_tcp_network_if\n" + " PUBLIC\n" + " .)\n\n" + " taget_link_libraries(freertos_plus_tcp_network_if\n" + " PRIVATE\n" + " freertos_kernel)") +endif() + +# There is also the need to add a target - typically an interface library that describes the +# Configuration for FreeRTOS-Kernel and FreeRTOS-Plus-TCP. +# This is called FreeRTOS::Config +# If not defined will be default compile with one of the test build combinations AllEnable. + +# Select the appropriate Build Test configuration +# This is only used when FreeRTOS::Config is not defined, otherwise the build test will be performed +# on the config defined in the FreeRTOS::Config +set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION "DEFAULT_CONF" CACHE STRING "FreeRTOS Plus TCP Build Test configuration") +set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST + CUSTOM # Custom (external) configuration -eg from a top-level project + ENABLE_ALL # Enable all configuration settings + DISABLE_ALL # Disable all configuration settings + DEFAULT_CONF # Default (typical) configuration) +) +if(NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION IN_LIST FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST) + message(FATAL_ERROR "Invalid FREERTOS_PLUS_TCP_TEST_CONFIGURATION value '${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}' should be one of: ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST}") +else() + message(WARNING "Using FreeRTOS-Plus-TCP Test Configuration : ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}" + " FreeRTOS-Kernel configuration settings are configured by FreeRTOS-Plus-TCP") + if (NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM") + # Configuration for FreeRTOS-Kernel + set(FREERTOS_CONFIG_FILE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/test/build-combination/Common" CACHE STRING "" FORCE) + if(UNIX) + set(FREERTOS_PORT GCC_POSIX CACHE STRING "" FORCE) + elseif(MINGW) + set(FREERTOS_PORT MSVC_MINGW CACHE STRING "" FORCE) + endif() + endif() +endif() + +######################################################################## +# Requirements +set(CMAKE_C_STANDARD 99) # Note FreeRTOS-Kernel uses C99 constructs. +set(CMAKE_C_STANDARD_REQUIRED ON) + +######################################################################## +# Overall Compile Options +# Note the compile option strategy is to error on everything and then +# Per library opt-out of things that are warnings/errors. +# This ensures that no matter what strategy for compilation you take, the +# builds will still occur. +# +# Only tested with GNU and Clang. +# Other options are https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID +# Naming of compilers translation map: +# For the ?TBD? - Suggest trying GNU-based and adding the appropriate toolchain file. +# For Toolchain examples see _deps/cmake-src/toolchain/arm-none-eabil-gcc.toolchain.cmake +# +# FreeRTOS | CMake +# ------------------- +# CCS | ?TBD? +# GCC | GNU, Clang, *Clang Others? +# IAR | IAR +# Keil | ARMCC +# MSVC | MSVC # Note only for MinGW? +# Renesas | ?TBD? + +add_compile_options( + ### Gnu/Clang C Options + $<$:-fdiagnostics-color=always> + $<$:-fcolor-diagnostics> + + $<$:-Wall> + $<$:-Wextra> + $<$:-Wpedantic> + $<$:-Werror> + $<$:-Weverything> + + # Documentation types - add unrecognized but supported doxygen commands + # $<$:-fcomment-block-commands=retval> + # $<$:-fcomment-block-commands=copydetails> + + # TODO: Add in other Compilers here. +) + +######################################################################## +# External Dependencies +# Note: For backwards compatibility - still have .gitmodules defining submodules +# To support fetching content in a higher level project add: +# +# FetchContent_Declare( freertos_plus_tcp +# GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git +# GIT_TAG V3.0.0 +# GIT_SUBMODULES "" # Don't grab any submodules - rely on FetchContent +# ) +# +# This will allow you to upgrade submodules and have one common submodule for +# all your builds despite multiple submodules having different versions. +include(FetchContent) + +FetchContent_Declare( freertos_kernel + GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Kernel.git + GIT_TAG V10.5.0 +) + +FetchContent_Declare( cmock + GIT_REPOSITORY https://github.com/ThrowTheSwitch/CMock + GIT_TAG v2.5.3 +) + +add_subdirectory(source) +add_subdirectory(tools) +add_subdirectory(test) + +FetchContent_MakeAvailable(freertos_kernel cmock) + +# Note following are can be removed once FreeRTOS-Kernel v10.5.0 + fixes their issues. +# To ignore header specific issues - change all of the headers to SYSTEM +set(_freertos_kernel_targets freertos_kernel freertos_kernel_port) +foreach (_target ${_freertos_kernel_targets} ) + get_target_property( interface_directories ${_target} INTERFACE_INCLUDE_DIRECTORIES ) + set_target_properties(${_target} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${interface_directories}" ) +endforeach() +target_compile_options( freertos_kernel + PRIVATE + $<$:-Wno-cast-align> + $<$:-Wno-covered-switch-default> + $<$:-Wno-documentation> + $<$:-Wno-extra-semi-stmt> + $<$:-Wno-int-to-pointer-cast> + $<$:-Wno-missing-noreturn> + $<$:-Wno-missing-variable-declarations> + $<$:-Wno-padded> + $<$:-Wno-pointer-to-int-cast> + $<$:-Wno-shorten-64-to-32> + $<$:-Wno-sign-conversion> + $<$:-Wno-unused-macros> + $<$:-Wno-unused-variable> +) +target_compile_options( freertos_kernel_port + PRIVATE + $<$:-Wno-disabled-macro-expansion> + $<$:-Wno-documentation> + $<$:-Wno-missing-noreturn> + $<$:-Wno-missing-variable-declarations> + $<$:-Wno-padded> + $<$:-Wno-pointer-to-int-cast> + $<$:-Wno-reserved-macro-identifier> + $<$:-Wno-sign-conversion> + $<$:-Wno-type-limits> + $<$:-Wno-unused-macros> +) diff --git a/cmake_modules/FindPCAP.cmake b/cmake_modules/FindPCAP.cmake new file mode 100644 index 0000000000..4f3c7b6412 --- /dev/null +++ b/cmake_modules/FindPCAP.cmake @@ -0,0 +1,75 @@ +# - Try to find libpcap include dirs and libraries +# +# Usage of this module as follows: +# +# find_package(PCAP) +# +# Variables used by this module, they can change the default behaviour and need +# to be set before calling find_package: +# +# PCAP_ROOT_DIR Set this variable to the root installation of +# libpcap if the module has problems finding the +# proper installation path. +# +# Variables defined by this module: +# +# PCAP_FOUND System has libpcap, include and library dirs found +# PCAP_INCLUDE_DIR The libpcap include directories. +# PCAP_LIBRARY The libpcap library (possibly includes a thread +# library e.g. required by pf_ring's libpcap) +# HAVE_PF_RING If a found version of libpcap supports PF_RING + +find_path(PCAP_ROOT_DIR + NAMES include/pcap.h +) + +find_path(PCAP_INCLUDE_DIR + NAMES pcap.h + HINTS ${PCAP_ROOT_DIR}/include +) + +find_library(PCAP_LIBRARY + NAMES pcap + HINTS ${PCAP_ROOT_DIR}/lib +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PCAP DEFAULT_MSG + PCAP_LIBRARY + PCAP_INCLUDE_DIR +) + +include(CheckCSourceCompiles) +set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY}) +check_c_source_compiles("int main() { return 0; }" PCAP_LINKS_SOLO) +set(CMAKE_REQUIRED_LIBRARIES) + +# check if linking against libpcap also needs to link against a thread library +if (NOT PCAP_LINKS_SOLO) + find_package(Threads) + if (THREADS_FOUND) + set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + check_c_source_compiles("int main() { return 0; }" PCAP_NEEDS_THREADS) + set(CMAKE_REQUIRED_LIBRARIES) + endif () + if (THREADS_FOUND AND PCAP_NEEDS_THREADS) + set(_tmp ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + list(REMOVE_DUPLICATES _tmp) + set(PCAP_LIBRARY ${_tmp} + CACHE STRING "Libraries needed to link against libpcap" FORCE) + else () + message(FATAL_ERROR "Couldn't determine how to link against libpcap") + endif () +endif () + +include(CheckFunctionExists) +set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY}) +check_function_exists(pcap_get_pfring_id HAVE_PF_RING) +check_function_exists(pcap_dump_open_append HAVE_PCAP_DUMP_OPEN_APPEND) +set(CMAKE_REQUIRED_LIBRARIES) + +mark_as_advanced( + PCAP_ROOT_DIR + PCAP_INCLUDE_DIR + PCAP_LIBRARY +) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt new file mode 100644 index 0000000000..96939e21cc --- /dev/null +++ b/source/CMakeLists.txt @@ -0,0 +1,112 @@ +add_library( freertos_plus_tcp STATIC ) +add_library( FreeRTOS::PlusTCP ALIAS freertos_plus_tcp ) + +target_sources( freertos_plus_tcp + PRIVATE + include/FreeRTOS_ARP.h + include/FreeRTOS_DHCP.h + include/FreeRTOS_DNS_Cache.h + include/FreeRTOS_DNS_Callback.h + include/FreeRTOS_DNS_Globals.h + include/FreeRTOS_DNS_Networking.h + include/FreeRTOS_DNS_Parser.h + include/FreeRTOS_DNS.h + include/FreeRTOS_errno_TCP.h + include/FreeRTOS_ICMP.h + include/FreeRTOS_IP_Private.h + include/FreeRTOS_IP_Timers.h + include/FreeRTOS_IP_Utils.h + include/FreeRTOS_IP.h + include/FreeRTOS_Sockets.h + include/FreeRTOS_Stream_Buffer.h + include/FreeRTOS_TCP_IP.h + include/FreeRTOS_TCP_Reception.h + include/FreeRTOS_TCP_State_Handling.h + include/FreeRTOS_TCP_Transmission.h + include/FreeRTOS_TCP_Utils.h + include/FreeRTOS_TCP_WIN.h + include/FreeRTOS_UDP_IP.h + include/FreeRTOSIPConfigDefaults.h + include/IPTraceMacroDefaults.h + include/NetworkBufferManagement.h + include/NetworkInterface.h + + FreeRTOS_ARP.c + FreeRTOS_DHCP.c + FreeRTOS_DNS_Cache.c + FreeRTOS_DNS_Callback.c + FreeRTOS_DNS_Networking.c + FreeRTOS_DNS_Parser.c + FreeRTOS_DNS.c + FreeRTOS_ICMP.c + FreeRTOS_IP_Timers.c + FreeRTOS_IP_Utils.c + FreeRTOS_IP.c + FreeRTOS_Sockets.c + FreeRTOS_Stream_Buffer.c + FreeRTOS_TCP_IP.c + FreeRTOS_TCP_Reception.c + FreeRTOS_TCP_State_Handling.c + FreeRTOS_TCP_Transmission.c + FreeRTOS_TCP_Utils.c + FreeRTOS_TCP_WIN.c + FreeRTOS_Tiny_TCP.c + FreeRTOS_UDP_IP.c +) + +# Note: Have to make system due to compiler warnings in header files. +target_include_directories( freertos_plus_tcp SYSTEM + PUBLIC + include +) + +#TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed. +target_compile_options( freertos_plus_tcp + PRIVATE + $<$:-Wno-address-of-packed-member> + $<$:-Wno-bad-function-cast> + $<$:-Wno-declaration-after-statement> + $<$:-Wno-documentation> + $<$:-Wno-cast-qual> + $<$:-Wno-conditional-uninitialized> + $<$:-Wno-covered-switch-default> + $<$:-Wno-extra-semi-stmt> + $<$:-Wno-format-nonliteral> + $<$:-Wno-format> + $<$:-Wno-gnu-statement-expression> + $<$:-Wno-implicit-int-conversion> + $<$:-Wno-int-to-pointer-cast> + $<$:-Wno-macro-redefined> + $<$:-Wno-missing-noreturn> + $<$:-Wno-missing-prototypes> + $<$:-Wno-missing-variable-declarations> + $<$:-Wno-packed> + $<$:-Wno-padded> + $<$:-Wno-pedantic> # ENABLE_ALL config only + $<$:-Wno-pointer-to-int-cast> + $<$:-Wno-reserved-identifier> + $<$:-Wno-reserved-macro-identifier> + $<$:-Wno-shorten-64-to-32> + $<$:-Wno-sign-conversion> + $<$:-Wno-tautological-constant-out-of-range-compare> + $<$:-Wno-type-limits> + $<$:-Wno-undef> + $<$:-Wno-uninitialized> + $<$:-Wno-unused-but-set-variable> + $<$:-Wno-unused-function> + $<$:-Wno-unused-macros> + $<$:-Wno-unused-parameter> + $<$:-Wno-unused-variable> +) + +target_link_libraries( freertos_plus_tcp + PUBLIC + FreeRTOS::Config + freertos_plus_tcp_port # for pack_struct_start.h used in headers. + PRIVATE + freertos_kernel + freertos_plus_tcp_network_if + freertos_plus_tcp_tools +) + +add_subdirectory(portable) diff --git a/source/portable/CMakeLists.txt b/source/portable/CMakeLists.txt new file mode 100644 index 0000000000..0a04cd5033 --- /dev/null +++ b/source/portable/CMakeLists.txt @@ -0,0 +1,177 @@ +add_library( freertos_plus_tcp_port STATIC ) +add_library( FreeRTOS::PlusTCP::Port ALIAS freertos_plus_tcp_port ) + +target_sources( freertos_plus_tcp_port + PRIVATE + BufferManagement/BufferAllocation_${FREERTOS_PLUS_TCP_BUFFER_ALLOCATION}.c + # TODO: There's NetworkInterface/pic32mzef that has it's own BufferAllocation_2.c +) + +target_include_directories( freertos_plus_tcp_port + PUBLIC + # Using Cmake to detect except for unknown compilers. + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/CCS> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/CCS> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/GCC> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/IAR> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/Keil> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/MSVC> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/Renesas> +) + +target_compile_options( freertos_plus_tcp_port + PRIVATE + $<$:-Wno-cast-align> + $<$:-Wno-extra-semi> + $<$:-Wno-pedantic> # How STATIC_ASSERT is defined +) + +target_link_libraries( freertos_plus_tcp_port + PRIVATE + freertos_kernel + freertos_plus_tcp + freertos_plus_tcp_network_if +) + +#------------------------------------------------------------------------------ +if (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "A_CUSTOM_NETWORK_IF") + message(STATUS "Using a custom FREERTOS_PLUS_TCP_NETWORK_IF.") + return() +endif() + +add_library( freertos_plus_tcp_network_if STATIC ) +add_library( FreeRTOS::PlusTCP::NetworkIF ALIAS freertos_plus_tcp_network_if ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface/Common/phyHandling.c + NetworkInterface/include/phyHandling.h + + #$<$:> # TODO + $<$: + NetworkInterface/ATSAME5x/NetworkInterface.c> + $<$: + NetworkInterface/DriverSAM/gmac_SAM.c + NetworkInterface/DriverSAM/gmac_SAM.h + NetworkInterface/DriverSAM/NetworkInterface.c> + $<$: + NetworkInterface/esp32/NetworkInterface.c> + $<$: + NetworkInterface/ksz8851snl/ksz8851snl_reg.h + NetworkInterface/ksz8851snl/ksz8851snl.c + NetworkInterface/ksz8851snl/ksz8851snl.h + NetworkInterface/ksz8851snl/NetworkInterface.c> + $<$: + NetworkInterface/linux/NetworkInterface.c> + $<$: + NetworkInterface/LPC17xx/NetworkInterface.c> + $<$: + NetworkInterface/LPC18xx/NetworkInterface.c> + $<$: + NetworkInterface/LPC54018/NetworkInterface.c> + $<$: + NetworkInterface/M487/m480_eth.c + NetworkInterface/M487/m480_eth.h + NetworkInterface/M487/NetworkInterface.c> + # $<$:> # TODO + $<$: + NetworkInterface/mw300_rd/NetworkInterface.c> + # $<$:> # TODO + # $<$:> # TODO + $<$: + NetworkInterface/RX/ether_callback.c + NetworkInterface/RX/NetworkInterface.c> + $<$: + NetworkInterface/SH2A/NetworkInterface.c> + # $<$:> # TODO + # $<$:> # TODO + $<$: + NetworkInterface/ThirdParty/MSP432/NetworkInterface.c + NetworkInterface/ThirdParty/MSP432/NetworkInterface.h + NetworkInterface/ThirdParty/MSP432/NetworkMiddleware.c + NetworkInterface/ThirdParty/MSP432/NetworkMiddleware.h> + $<$: + NetworkInterface/TM4C/NetworkInterface.c> + $<$: + NetworkInterface/WinPCAP/FaultInjection.c + NetworkInterface/WinPCAP/NetworkInterface.c> + $<$: + NetworkInterface/xilinx_ultrascale/NetworkInterface.c + NetworkInterface/xilinx_ultrascale/readme.md + NetworkInterface/xilinx_ultrascale/uncached_memory.c + NetworkInterface/xilinx_ultrascale/uncached_memory.h + NetworkInterface/xilinx_ultrascale/x_emacpsif_dma.c + NetworkInterface/xilinx_ultrascale/x_emacpsif_hw.c + NetworkInterface/xilinx_ultrascale/x_emacpsif_hw.h + NetworkInterface/xilinx_ultrascale/x_emacpsif_physpeed.c + NetworkInterface/xilinx_ultrascale/x_emacpsif.h + NetworkInterface/xilinx_ultrascale/x_topology.h> + $<$: + NetworkInterface/Zynq/NetworkInterface.c + NetworkInterface/Zynq/README.txt + NetworkInterface/Zynq/uncached_memory.c + NetworkInterface/Zynq/uncached_memory.h + NetworkInterface/Zynq/x_emacpsif_dma.c + NetworkInterface/Zynq/x_emacpsif_hw.c + NetworkInterface/Zynq/x_emacpsif_hw.h + NetworkInterface/Zynq/x_emacpsif_physpeed.c + NetworkInterface/Zynq/x_emacpsif.h + NetworkInterface/Zynq/x_topology.h> +) + +if( FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "POSIX") + find_package(PCAP REQUIRED) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) + find_package(Threads) +endif() + +target_include_directories( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port # For compiler pragmas. + NetworkInterface/include + PRIVATE + # $<$ #TODO + $<$:NetworkInterface/DriverSAM> + $<$:NetworkInterface/ksz8851snl> + $<$:NetworkInterface/M487> + # $<$:> #TODO + $<$:NetworkInterface/STM32Fxx> + $<$:NetworkInterface/STM32Hxx> + $<$:NetworkInterface/ThirdParty/MSP432> + $<$:NetworkInterface/xilinx_ultrascale> + $<$:NetworkInterface/Zynq> +) + +target_compile_options( freertos_plus_tcp_network_if + PRIVATE + $<$:-Wno-cast-align> + $<$:-Wno-conditional-uninitialized> + $<$:-Wno-documentation> + $<$:-Wno-empty-translation-unit> + $<$:-Wno-extra-semi-stmt> + $<$:-Wno-gnu-statement-expression> + $<$:-Wno-implicit-int-conversion> + $<$:-Wno-int-to-pointer-cast> + $<$:-Wno-missing-noreturn> + $<$:-Wno-missing-prototypes> + $<$:-Wno-pointer-to-int-cast> + $<$:-Wno-newline-eof> + $<$:-Wno-padded> + $<$:-Wno-shorten-64-to-32> + $<$:-Wno-type-limits> + $<$:-Wno-undef> + $<$:-Wno-uninitialized> + $<$:-Wno-unused-but-set-variable> + $<$:-Wno-unused-macros> + $<$:-Wno-unused-parameter> +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + PRIVATE + freertos_kernel + freertos_plus_tcp + $<$:${PCAP_LIBRARY}> + $<$:Threads::Threads> +) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000000..97d4459107 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,8 @@ +add_subdirectory(build-combination) + +if(FREERTOS_PLUS_TCP_BUILD_TEST) + add_subdirectory(cbmc) + add_subdirectory(Coverity) + add_subdirectory(unit-test) +endif() + diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index c695073309..2a716510d8 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -1,89 +1,58 @@ -cmake_minimum_required ( VERSION 3.13.0 ) -project ( "FreeRTOS-Plus-TCP Build Combination" - VERSION 1.0.0 - LANGUAGES C ) - -# Allow the project to be organized into folders. -set_property( GLOBAL PROPERTY USE_FOLDERS ON ) - -# Use C90. -set( CMAKE_C_STANDARD 90 ) -set( CMAKE_C_STANDARD_REQUIRED ON ) - -# Do not allow in-source build. -if( ${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR} ) - message( FATAL_ERROR "In-source build is not allowed. Please build in a separate directory, such as ${PROJECT_SOURCE_DIR}/build." ) -endif() - -# Set global path variables. -get_filename_component(__MODULE_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) -set(MODULE_ROOT_DIR ${__MODULE_ROOT_DIR} CACHE INTERNAL "FreeRTOS-Plus-TCP repository root.") - -# Configure options to always show in CMake GUI. -option( BUILD_CLONE_SUBMODULES - "Set this to ON to automatically clone any required Git submodules. When OFF, submodules must be manually cloned." - ON ) - - -option(TEST_CONFIGURATION "Configuration All Enable/Disable or default" ENABLE_ALL) - -message( STATUS "Argument: ${TEST_CONFIGURATION}") - -# Set output directories. -set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) -set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) -set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) - - -set( FREERTOS_KERNEL_DIR ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel ) -set( TEST_DIR ${MODULE_ROOT_DIR}/test/build-combination ) - -include_directories( ${MODULE_ROOT_DIR}/source/include ) -include_directories( ${MODULE_ROOT_DIR}/source/portable/Compiler/MSVC ) -include_directories( ${FREERTOS_KERNEL_DIR}/include ) -# Add the correct portable directory to include search paths. -if (WIN32) - include_directories( ${FREERTOS_KERNEL_DIR}/portable/MSVC-MingW ) -else() - include_directories( ${FREERTOS_KERNEL_DIR}/portable/ThirdParty/GCC/Posix ) -endif() -include_directories( ${TEST_DIR}/Common ) - -if( ${TEST_CONFIGURATION} STREQUAL "ENABLE_ALL" ) - include_directories( ${TEST_DIR}/AllEnable ) -elseif( ${TEST_CONFIGURATION} STREQUAL "DISABLE_ALL" ) - include_directories( ${TEST_DIR}/AllDisable ) -else() - include_directories( ${TEST_DIR}/DefaultConf ) -endif() - -# Pick the correct kernel port files for the platform. -if (WIN32) - file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c" - "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/MSVC-MingW/*.c") +add_library( freertos_plus_tcp_config_common INTERFACE ) +target_include_directories(freertos_plus_tcp_config_common INTERFACE Common ) + +# ------------------------------------------------------------------- +add_library( freertos_plus_tcp_config_all_disable INTERFACE) +target_include_directories(freertos_plus_tcp_config_all_disable INTERFACE AllDisable) +target_link_libraries(freertos_plus_tcp_config_all_disable INTERFACE freertos_plus_tcp_config_common) + +# ------------------------------------------------------------------- +add_library( freertos_plus_tcp_config_all_enable INTERFACE) +target_include_directories(freertos_plus_tcp_config_all_enable INTERFACE AllEnable) +target_link_libraries(freertos_plus_tcp_config_all_enable INTERFACE freertos_plus_tcp_config_common) + +# ------------------------------------------------------------------- +add_library( freertos_plus_tcp_config_default INTERFACE) +target_include_directories(freertos_plus_tcp_config_default INTERFACE DefaultConf) +target_link_libraries(freertos_plus_tcp_config_default INTERFACE freertos_plus_tcp_config_common) + +# ------------------------------------------------------------------- +# Configuration for FreeRTOS-Kernel +if(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM" ) + # Check Config target is available. And then do nothing. + if(NOT TARGET FreeRTOS::Config ) + message(FATAL_ERROR "FREERTOS_PLUS_TCP_TEST_CONFIGURATIN = CUSTOM, but no FreeRTOS::Config target defined.") + endif() +elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "DISABLE_ALL" ) + add_library( FreeRTOS::Config ALIAS freertos_plus_tcp_config_all_disable) +elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "ENABLE_ALL" ) + add_library( FreeRTOS::Config ALIAS freertos_plus_tcp_config_all_enable) else() - file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c" - "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/*.c" - "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/utils/*.c") + add_library( FreeRTOS::Config ALIAS freertos_plus_tcp_config_default) endif() -file(GLOB TCP_SOURCES "${MODULE_ROOT_DIR}/source/*.c" ) - -message(STATUS "${KERNEL_SOURCES}") -message(STATUS "${TCP_SOURCES}") - -add_executable(project ${KERNEL_SOURCES} - ${TCP_SOURCES} - ${FREERTOS_KERNEL_DIR}/portable/MemMang/heap_4.c - ${MODULE_ROOT_DIR}/source/portable/BufferManagement/BufferAllocation_2.c - ${TEST_DIR}/Common/main.c ) - -if (WIN32) - # Add preprocessor definitions to suppress warnings. - target_compile_definitions( project PRIVATE - _CRT_SECURE_NO_WARNINGS ) -else() - # Link pthread which is needed for POSIX port. - find_package( Threads REQUIRED ) - target_link_libraries( project Threads::Threads ) -endif() +add_executable(freertos_plus_tcp_build_test) + +target_sources(freertos_plus_tcp_build_test + PRIVATE + Common/main.c +) + +target_compile_options(freertos_plus_tcp_build_test + PRIVATE + $<$:-Wno-cast-qual> + $<$:-Wno-missing-noreturn> + $<$:-Wno-missing-prototypes> + $<$:-Wno-missing-variable-declarations> + $<$:-Wno-shorten-64-to-32> + $<$:-Wno-sign-conversion> + $<$:-Wno-unused-parameter> + $<$:-Wno-unused-macros> + $<$:-Wno-unused-variable> +) + +target_link_libraries(freertos_plus_tcp_build_test + PRIVATE + freertos_plus_tcp + freertos_kernel +) diff --git a/test/build-combination/Common/FreeRTOSConfig.h b/test/build-combination/Common/FreeRTOSConfig.h index 7d5de97dc4..082522559d 100644 --- a/test/build-combination/Common/FreeRTOSConfig.h +++ b/test/build-combination/Common/FreeRTOSConfig.h @@ -219,7 +219,7 @@ extern void vLoggingPrint( const char * pcMessage ); #define configPROFILING ( 0 ) /* Pseudo random number generator used by some tasks. */ -extern uint32_t ulRand(); +extern uint32_t ulRand(void); #define configRAND32() ulRand() /* The platform that FreeRTOS is running on. */ diff --git a/test/build-combination/DefaultConf/FreeRTOSIPConfig.h b/test/build-combination/DefaultConf/FreeRTOSIPConfig.h index c908f0fcd3..4bb2595be1 100644 --- a/test/build-combination/DefaultConf/FreeRTOSIPConfig.h +++ b/test/build-combination/DefaultConf/FreeRTOSIPConfig.h @@ -40,4 +40,8 @@ * dependent. */ #define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN +/* The windows simulator cannot really simulate MAC interrupts, and needs to + * block occasionally to allow other tasks to run. */ +#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS ) + #endif diff --git a/test/build-combination/README.md b/test/build-combination/README.md index 0bbcba87d3..8b83253ce1 100644 --- a/test/build-combination/README.md +++ b/test/build-combination/README.md @@ -9,20 +9,20 @@ All the CMake commands are to be run from the root of the repository. * Build checks (Enable all functionalities) ``` -cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=ENABLE_ALL -make -C test/build-combination/build/ +cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL +make -C build ``` * Build checks (Disable all functionalities) ``` -cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=DISABLE_ALL -make -C test/build-combination/build/ +cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL +make -C build ``` * Build checks (Default configuration) ``` -cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=DEFAULT_CONF -make -C test/build-combination/build/ +cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF +make -C . ``` ## Windows @@ -31,21 +31,21 @@ All the CMake commands are to be run from the root of the repository. * Build checks (Enable all functionalities) ``` -cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +cmake -S . -B build -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 ``` Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` in Visual Studio and click `Build --> Build Solution`. * Build checks (Disable all functionalities) ``` -cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +cmake -S . -B build -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 ``` Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` in Visual Studio and click `Build --> Build Solution`. * Build checks (Default configuration) ``` -cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +cmake -S . -B build -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 ``` Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` in Visual Studio and click `Build --> Build Solution`. diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000000..f5e3462188 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,38 @@ +add_library( freertos_plus_tcp_tools STATIC ) +add_library( FreeRTOS::PlusTCP::Tools ALIAS freertos_plus_tcp_tools ) + +target_sources( freertos_plus_tcp_tools + PRIVATE + tcp_utilities/include/tcp_dump_packets.h + tcp_utilities/include/tcp_mem_stats.h + tcp_utilities/include/tcp_netstat.h + + tcp_utilities/tcp_dump_packets.c + tcp_utilities/tcp_mem_stats.c + tcp_utilities/tcp_netstat.c +) + +# Note: Have to make system due to compiler warnings in header files. +target_include_directories( freertos_plus_tcp_tools SYSTEM + PUBLIC + tcp_utilities/include +) + +#TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed. +target_compile_options( freertos_plus_tcp_tools + PRIVATE + $<$:-Wno-extra-semi-stmt> + $<$:-Wno-format> + $<$:-Wno-missing-variable-declarations> + $<$:-Wno-padded> + $<$:-Wno-unused-but-set-variable> + $<$:-Wno-unused-function> + $<$:-Wno-unused-macros> + $<$:-Wno-unused-variable> +) + +target_link_libraries( freertos_plus_tcp_tools + PRIVATE + freertos_kernel + freertos_plus_tcp +) From 20ea305d0c6225904ab9e54ee974578869c7773d Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Sun, 25 Sep 2022 00:39:43 -0700 Subject: [PATCH 02/21] Fixing CI builds, rely on pcap. (#556) --- .github/workflows/ci.yml | 8 ++++++-- source/CMakeLists.txt | 24 +++--------------------- tools/CMakeLists.txt | 1 - 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58b87c798d..eca6cbc061 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,8 +111,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Update submodules - run: git submodule update --init --checkout + # Using CMake FetchContent to pull FreeRTOS-Kernel now. + # - name: Update submodules + # run: git submodule update --init --checkout + - name: Build Install Dependencies + run: | + sudo apt-get install -y libpcap-dev - name: Build checks (Enable all functionalities) run: | cmake -S . -B build/ -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 96939e21cc..51c3bbd65d 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -63,39 +63,21 @@ target_include_directories( freertos_plus_tcp SYSTEM #TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed. target_compile_options( freertos_plus_tcp PRIVATE - $<$:-Wno-address-of-packed-member> $<$:-Wno-bad-function-cast> - $<$:-Wno-declaration-after-statement> - $<$:-Wno-documentation> $<$:-Wno-cast-qual> $<$:-Wno-conditional-uninitialized> $<$:-Wno-covered-switch-default> + $<$:-Wno-documentation> $<$:-Wno-extra-semi-stmt> - $<$:-Wno-format-nonliteral> - $<$:-Wno-format> - $<$:-Wno-gnu-statement-expression> $<$:-Wno-implicit-int-conversion> - $<$:-Wno-int-to-pointer-cast> - $<$:-Wno-macro-redefined> $<$:-Wno-missing-noreturn> $<$:-Wno-missing-prototypes> - $<$:-Wno-missing-variable-declarations> - $<$:-Wno-packed> - $<$:-Wno-padded> $<$:-Wno-pedantic> # ENABLE_ALL config only - $<$:-Wno-pointer-to-int-cast> $<$:-Wno-reserved-identifier> - $<$:-Wno-reserved-macro-identifier> $<$:-Wno-shorten-64-to-32> $<$:-Wno-sign-conversion> - $<$:-Wno-tautological-constant-out-of-range-compare> - $<$:-Wno-type-limits> - $<$:-Wno-undef> - $<$:-Wno-uninitialized> - $<$:-Wno-unused-but-set-variable> - $<$:-Wno-unused-function> - $<$:-Wno-unused-macros> - $<$:-Wno-unused-parameter> + $<$:-Wno-unused-but-set-variable> + $<$:-Wno-unused-macros> $<$:-Wno-unused-variable> ) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index f5e3462188..e147fe85d8 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -21,7 +21,6 @@ target_include_directories( freertos_plus_tcp_tools SYSTEM #TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed. target_compile_options( freertos_plus_tcp_tools PRIVATE - $<$:-Wno-extra-semi-stmt> $<$:-Wno-format> $<$:-Wno-missing-variable-declarations> $<$:-Wno-padded> From 5f15260d98512571112ba2728abfdd4bb89d503d Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Thu, 29 Sep 2022 13:56:44 -0700 Subject: [PATCH 03/21] Updating tested configurations and minor clean-up of missing network interfaces (#555) --- CMakeLists.txt | 44 +++++++++++++++++----------------- source/CMakeLists.txt | 6 ++--- source/portable/CMakeLists.txt | 34 +++++++++++++++++++------- 3 files changed, 51 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e4012e206..04aea3b9c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,30 +89,30 @@ if(NOT FREERTOS_PLUS_TCP_NETWORK_IF IN_LIST FREERTOS_PLUS_TCP_NETWORK_IF_LIST ) " or from CMake command line option:\n" " -DFREERTOS_PLUS_TCP_NETWORK_IF=POSIX\n" " \n" - " Available port options:\n" + " Available port options: (Tested means compiled with that variant)\n" " A_CUSTOM_NETWORK_IF Target: User Defined\n" - " ATSAM4E Target: ATSAM4E - TODO\n" - " ATSAME5x Target: ATSAME5x - TODO\n" - " DRIVER_SAM Target: Driver SAM - TODO\n" - " ESP32 Target: ESP-32 - TODO\n" - " KSZ8851SNL Target: ksz8851snl - TODO\n" + " ATSAM4E Target: ATSAM4E Tested: TODO\n" + " ATSAME5x Target: ATSAME5x Tested: TODO\n" + " DRIVER_SAM Target: Driver SAM Tested: TODO\n" + " ESP32 Target: ESP-32 Tested: TODO\n" + " KSZ8851SNL Target: ksz8851snl Tested: TODO\n" " POSIX Target: linux/Posix\n" - " LPC17xx Target: LPC17xx - TODO\n" - " LPC18xx Target: LPC18xx - TODO\n" - " LPC54018 Target: LPC54018 - TODO\n" - " M487 Target: M487- TODO\n" - " MPS2_AN385 Target: MPS2_AN385 - TODO\n" - " MW300_RD Target: mw300_rd - TODO\n" - " PIC32MZEF_ETH Target: pic32mzef ethernet- TODO\n" - " PIC32MZEF_WIFI Target: pic32mzef Wifi- TODO\n" - " RX Target: RX- TODO\n" - " SH2A Target: SH2A- TODO\n" - " STM32FXX Target: STM32Fxx - TODO\n" - " STM32HXX Target: STM32Hxx - TODO\n" - " MSP432 Target: MSP432 - TODO\n" - " TM4C Target: TM4C- TODO\n" - " WIN_PCAP Target: Windows - TODO\n" - " XILINX_ULTRASCALE Target: Xilinx Ultrascale - TODO\n" + " LPC17xx Target: LPC17xx Tested: TODO\n" + " LPC18xx Target: LPC18xx Tested: TODO\n" + " LPC54018 Target: LPC54018 Tested: TODO\n" + " M487 Target: M487 Tested: TODO\n" + " MPS2_AN385 Target: MPS2_AN385 Tested: TODO\n" + " MW300_RD Target: mw300_rd Tested: TODO\n" + " PIC32MZEF_ETH Target: pic32mzef ethernet Tested: TODO\n" + " PIC32MZEF_WIFI Target: pic32mzef Wifi Tested: TODO\n" + " RX Target: RX Tested: TODO\n" + " SH2A Target: SH2A Tested: TODO\n" + " STM32FXX Target: STM32Fxx Tested: TODO\n" + " STM32HXX Target: STM32Hxx Tested: TODO\n" + " MSP432 Target: MSP432 Tested: TODO\n" + " TM4C Target: TM4C Tested: TODO\n" + " WIN_PCAP Target: Windows Tested: TODO\n" + " XILINX_ULTRASCALE Target: Xilinx Ultrascale Tested: TODO\n" " ZYNQ Target: Xilinx Zynq") elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_port) ) message(FATAL_ERROR " FREERTOS_PLUS_TCP_NETWORK_IF is set to A_CUSTOM_NETWORK_IF.\n" diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 51c3bbd65d..efb3e4c0f0 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -63,11 +63,11 @@ target_include_directories( freertos_plus_tcp SYSTEM #TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed. target_compile_options( freertos_plus_tcp PRIVATE - $<$:-Wno-bad-function-cast> +# $<$:-Wno-bad-function-cast> $<$:-Wno-cast-qual> - $<$:-Wno-conditional-uninitialized> +# $<$:-Wno-conditional-uninitialized> $<$:-Wno-covered-switch-default> - $<$:-Wno-documentation> +# $<$:-Wno-documentation> $<$:-Wno-extra-semi-stmt> $<$:-Wno-implicit-int-conversion> $<$:-Wno-missing-noreturn> diff --git a/source/portable/CMakeLists.txt b/source/portable/CMakeLists.txt index 0a04cd5033..f91f5d5f57 100644 --- a/source/portable/CMakeLists.txt +++ b/source/portable/CMakeLists.txt @@ -10,13 +10,13 @@ target_sources( freertos_plus_tcp_port target_include_directories( freertos_plus_tcp_port PUBLIC # Using Cmake to detect except for unknown compilers. - $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/CCS> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/CCS> $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/CCS> $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/GCC> $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/IAR> $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/Keil> $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/MSVC> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/Renesas> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/Renesas> ) target_compile_options( freertos_plus_tcp_port @@ -73,18 +73,36 @@ target_sources( freertos_plus_tcp_network_if NetworkInterface/M487/m480_eth.c NetworkInterface/M487/m480_eth.h NetworkInterface/M487/NetworkInterface.c> - # $<$:> # TODO + $<$: + NetworkInterface/MPS2_AN385/ether_lan9118 + NetworkInterface/MPS2_AN385/ether_lan9118/SMM_MPS2.h + NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_emac_config.h + NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_eth_drv.c + NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_eth_drv.h + NetworkInterface/MPS2_AN385/NetworkInterface.c> $<$: NetworkInterface/mw300_rd/NetworkInterface.c> - # $<$:> # TODO - # $<$:> # TODO + $<$: + NetworkInterface/pic32mzef/NetworkInterface_eth.c> + $<$: + NetworkInterface/pic32mzef/NetworkInterface_wifi.c> $<$: NetworkInterface/RX/ether_callback.c NetworkInterface/RX/NetworkInterface.c> $<$: NetworkInterface/SH2A/NetworkInterface.c> - # $<$:> # TODO - # $<$:> # TODO + $<$: + NetworkInterface/STM32Fxx/NetworkInterface.c + NetworkInterface/STM32Fxx/stm32f2xx_hal_eth.h + NetworkInterface/STM32Fxx/stm32f4xx_hal_eth.h + NetworkInterface/STM32Fxx/stm32f7xx_hal_eth.h + NetworkInterface/STM32Fxx/stm32fxx_hal_eth.c + NetworkInterface/STM32Fxx/stm32fxx_hal_eth.h> + $<$: + NetworkInterface/STM32Hxx/NetworkInterface.c + NetworkInterface/STM32Hxx/stm32h7xx_hal_eth.h + NetworkInterface/STM32Hxx/stm32hxx_hal_eth.c + NetworkInterface/STM32Hxx/stm32hxx_hal_eth.h> $<$: NetworkInterface/ThirdParty/MSP432/NetworkInterface.c NetworkInterface/ThirdParty/MSP432/NetworkInterface.h @@ -134,7 +152,7 @@ target_include_directories( freertos_plus_tcp_network_if $<$:NetworkInterface/DriverSAM> $<$:NetworkInterface/ksz8851snl> $<$:NetworkInterface/M487> - # $<$:> #TODO + $<$:NetworkInterface/MPS2_AN385/ether_lan9118> $<$:NetworkInterface/STM32Fxx> $<$:NetworkInterface/STM32Hxx> $<$:NetworkInterface/ThirdParty/MSP432> From dad63ec1ccab65b314cfde6df65c9ad533e22d13 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Thu, 29 Sep 2022 17:22:34 -0700 Subject: [PATCH 04/21] Further clean-up based on testing with build environment. (#555) --- CMakeLists.txt | 8 +--- source/CMakeLists.txt | 15 +++----- source/portable/CMakeLists.txt | 36 +++++++++--------- test/build-combination/CMakeLists.txt | 13 ++++--- test/build-combination/Common/main.c | 53 +++++++++++++++++++-------- tools/CMakeLists.txt | 1 + 6 files changed, 72 insertions(+), 54 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04aea3b9c1..a5053096c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,9 +152,9 @@ set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST if(NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION IN_LIST FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST) message(FATAL_ERROR "Invalid FREERTOS_PLUS_TCP_TEST_CONFIGURATION value '${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}' should be one of: ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST}") else() - message(WARNING "Using FreeRTOS-Plus-TCP Test Configuration : ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}" - " FreeRTOS-Kernel configuration settings are configured by FreeRTOS-Plus-TCP") + message(STATUS "Using FreeRTOS-Plus-TCP Test Configuration : ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}") if (NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM") + message(WARNING "FreeRTOS-Kernel configuration settings are configured by FreeRTOS-Plus-TCP") # Configuration for FreeRTOS-Kernel set(FREERTOS_CONFIG_FILE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/test/build-combination/Common" CACHE STRING "" FORCE) if(UNIX) @@ -203,10 +203,6 @@ add_compile_options( $<$:-Werror> $<$:-Weverything> - # Documentation types - add unrecognized but supported doxygen commands - # $<$:-fcomment-block-commands=retval> - # $<$:-fcomment-block-commands=copydetails> - # TODO: Add in other Compilers here. ) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index efb3e4c0f0..8992f55cf4 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -63,28 +63,25 @@ target_include_directories( freertos_plus_tcp SYSTEM #TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed. target_compile_options( freertos_plus_tcp PRIVATE -# $<$:-Wno-bad-function-cast> + $<$:-Wno-bad-function-cast> $<$:-Wno-cast-qual> -# $<$:-Wno-conditional-uninitialized> + $<$:-Wno-conditional-uninitialized> $<$:-Wno-covered-switch-default> -# $<$:-Wno-documentation> + $<$:-Wno-documentation> $<$:-Wno-extra-semi-stmt> $<$:-Wno-implicit-int-conversion> $<$:-Wno-missing-noreturn> - $<$:-Wno-missing-prototypes> - $<$:-Wno-pedantic> # ENABLE_ALL config only $<$:-Wno-reserved-identifier> $<$:-Wno-shorten-64-to-32> $<$:-Wno-sign-conversion> - $<$:-Wno-unused-but-set-variable> $<$:-Wno-unused-macros> - $<$:-Wno-unused-variable> + $<$:-Wno-unused-parameter> ) target_link_libraries( freertos_plus_tcp PUBLIC - FreeRTOS::Config - freertos_plus_tcp_port # for pack_struct_start.h used in headers. + freertos_config + freertos_plus_tcp_port # for pack_struct_start.h PRIVATE freertos_kernel freertos_plus_tcp_network_if diff --git a/source/portable/CMakeLists.txt b/source/portable/CMakeLists.txt index f91f5d5f57..781dce4229 100644 --- a/source/portable/CMakeLists.txt +++ b/source/portable/CMakeLists.txt @@ -22,8 +22,8 @@ target_include_directories( freertos_plus_tcp_port target_compile_options( freertos_plus_tcp_port PRIVATE $<$:-Wno-cast-align> - $<$:-Wno-extra-semi> - $<$:-Wno-pedantic> # How STATIC_ASSERT is defined + $<$:-Wno-extra-semi-stmt> + $<$:-Wno-pedantic> # Strange definition for STATIC_ASSERT ) target_link_libraries( freertos_plus_tcp_port @@ -73,7 +73,7 @@ target_sources( freertos_plus_tcp_network_if NetworkInterface/M487/m480_eth.c NetworkInterface/M487/m480_eth.h NetworkInterface/M487/NetworkInterface.c> - $<$: + $<$: NetworkInterface/MPS2_AN385/ether_lan9118 NetworkInterface/MPS2_AN385/ether_lan9118/SMM_MPS2.h NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_emac_config.h @@ -82,7 +82,7 @@ target_sources( freertos_plus_tcp_network_if NetworkInterface/MPS2_AN385/NetworkInterface.c> $<$: NetworkInterface/mw300_rd/NetworkInterface.c> - $<$: + $<$: NetworkInterface/pic32mzef/NetworkInterface_eth.c> $<$: NetworkInterface/pic32mzef/NetworkInterface_wifi.c> @@ -91,7 +91,7 @@ target_sources( freertos_plus_tcp_network_if NetworkInterface/RX/NetworkInterface.c> $<$: NetworkInterface/SH2A/NetworkInterface.c> - $<$: + $<$: NetworkInterface/STM32Fxx/NetworkInterface.c NetworkInterface/STM32Fxx/stm32f2xx_hal_eth.h NetworkInterface/STM32Fxx/stm32f4xx_hal_eth.h @@ -138,9 +138,9 @@ target_sources( freertos_plus_tcp_network_if ) if( FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "POSIX") - find_package(PCAP REQUIRED) - set(THREADS_PREFER_PTHREAD_FLAG TRUE) - find_package(Threads) + find_package(PCAP REQUIRED) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) + find_package(Threads) endif() target_include_directories( freertos_plus_tcp_network_if @@ -148,16 +148,16 @@ target_include_directories( freertos_plus_tcp_network_if freertos_plus_tcp_port # For compiler pragmas. NetworkInterface/include PRIVATE - # $<$ #TODO - $<$:NetworkInterface/DriverSAM> - $<$:NetworkInterface/ksz8851snl> - $<$:NetworkInterface/M487> - $<$:NetworkInterface/MPS2_AN385/ether_lan9118> - $<$:NetworkInterface/STM32Fxx> - $<$:NetworkInterface/STM32Hxx> - $<$:NetworkInterface/ThirdParty/MSP432> - $<$:NetworkInterface/xilinx_ultrascale> - $<$:NetworkInterface/Zynq> + # $<$ #TODO + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/DriverSAM> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/ksz8851snl> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/M487> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/MPS2_AN385/ether_lan9118> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/STM32Fxx> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/STM32Hxx> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/ThirdParty/MSP432> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/xilinx_ultrascale> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/Zynq> ) target_compile_options( freertos_plus_tcp_network_if diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index 2a716510d8..ce894b58f6 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -20,15 +20,15 @@ target_link_libraries(freertos_plus_tcp_config_default INTERFACE freertos_plus_t # Configuration for FreeRTOS-Kernel if(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM" ) # Check Config target is available. And then do nothing. - if(NOT TARGET FreeRTOS::Config ) - message(FATAL_ERROR "FREERTOS_PLUS_TCP_TEST_CONFIGURATIN = CUSTOM, but no FreeRTOS::Config target defined.") + if(NOT TARGET freertos_config ) + message(FATAL_ERROR "FREERTOS_PLUS_TCP_TEST_CONFIGURATIN = CUSTOM, but no freertos_config target defined.") endif() elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "DISABLE_ALL" ) - add_library( FreeRTOS::Config ALIAS freertos_plus_tcp_config_all_disable) + add_library( freertos_config ALIAS freertos_plus_tcp_config_all_disable) elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "ENABLE_ALL" ) - add_library( FreeRTOS::Config ALIAS freertos_plus_tcp_config_all_enable) + add_library( freertos_config ALIAS freertos_plus_tcp_config_all_enable) else() - add_library( FreeRTOS::Config ALIAS freertos_plus_tcp_config_default) + add_library( freertos_config ALIAS freertos_plus_tcp_config_default) endif() add_executable(freertos_plus_tcp_build_test) @@ -41,9 +41,12 @@ target_sources(freertos_plus_tcp_build_test target_compile_options(freertos_plus_tcp_build_test PRIVATE $<$:-Wno-cast-qual> + $<$:-Wno-format-nonliteral> + $<$:-Wno-implicit-function-declaration> $<$:-Wno-missing-noreturn> $<$:-Wno-missing-prototypes> $<$:-Wno-missing-variable-declarations> + $<$:-Wno-reserved-identifier> $<$:-Wno-shorten-64-to-32> $<$:-Wno-sign-conversion> $<$:-Wno-unused-parameter> diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index a60035f543..1775e71daa 100644 --- a/test/build-combination/Common/main.c +++ b/test/build-combination/Common/main.c @@ -39,8 +39,16 @@ #include "FreeRTOS_Sockets.h" #include "FreeRTOS_DHCP.h" +#include + #define mainHOST_NAME "Build Combination" +#define mainDEVICE_NICK_NAME "Build_Combination" +#if defined( _MSC_VER ) && ( _MSC_VER <= 1600 ) + #define local_stricmp _stricmp +#else + #define local_stricmp strcasecmp +#endif /*-----------------------------------------------------------*/ /* Notes if the trace is running or not. */ @@ -157,11 +165,11 @@ void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) /* Determine if a name lookup is for this node. Two names are given * to this node: that returned by pcApplicationHostnameHook() and that set * by mainDEVICE_NICK_NAME. */ - if( _stricmp( pcName, pcApplicationHostnameHook() ) == 0 ) + if( local_stricmp( pcName, pcApplicationHostnameHook() ) == 0 ) { xReturn = pdPASS; } - else if( _stricmp( pcName, mainDEVICE_NICK_NAME ) == 0 ) + else if( local_stricmp( pcName, mainDEVICE_NICK_NAME ) == 0 ) { xReturn = pdPASS; } @@ -190,9 +198,8 @@ void vApplicationIdleHook( void ) /* Exit. Just a stub. */ } /*-----------------------------------------------------------*/ - void vAssertCalled( const char * pcFile, - uint32_t ulLine ) + size_t ulLine ) { const uint32_t ulLongSleep = 1000UL; volatile uint32_t ulBlockVariable = 0UL; @@ -212,6 +219,17 @@ void vAssertCalled( const char * pcFile, } /*-----------------------------------------------------------*/ +void vLoggingPrintf( const char * pcFormat, + ... ) +{ + va_list arg; + + va_start( arg, pcFormat ); + vprintf( pcFormat, arg ); + va_end( arg ); +} +/*-----------------------------------------------------------*/ + void getUserCmd( char * pucUserCmd ) { /* Provide a stub for this function. */ @@ -235,6 +253,8 @@ BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber ) return pdTRUE; } +/*-----------------------------------------------------------*/ + void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t * pulIdleTaskStackSize ) @@ -242,6 +262,19 @@ void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, /* Provide a stub for this function. */ } +/*-----------------------------------------------------------*/ + +void vApplicationTickHook( void ) +{ + /* Provide a stub for this function. */ +} + +/*-----------------------------------------------------------*/ + +void vApplicationDaemonTaskStartupHook( void ) +{ + /* Provide a stub for this function. */ +} /* * Callback that provides the inputs necessary to generate a randomized TCP @@ -274,18 +307,6 @@ void vApplicationMallocFailedHook( void ) /* Provide a stub for this function. */ } -BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer, - BaseType_t bReleaseAfterSend ) -{ - /* Provide a stub for this function. */ - return pdTRUE; -} - -BaseType_t xNetworkInterfaceInitialise( void ) -{ - /* Provide a stub for this function. */ - return pdTRUE; -} #if ( ( ipconfigUSE_TCP == 1 ) && ( ipconfigUSE_DHCP_HOOK != 0 ) ) eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index e147fe85d8..f5e3462188 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -21,6 +21,7 @@ target_include_directories( freertos_plus_tcp_tools SYSTEM #TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed. target_compile_options( freertos_plus_tcp_tools PRIVATE + $<$:-Wno-extra-semi-stmt> $<$:-Wno-format> $<$:-Wno-missing-variable-declarations> $<$:-Wno-padded> From 5560d9b2a265f865c07d3b6fe226c7da8c2f4495 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Fri, 30 Sep 2022 15:14:41 -0700 Subject: [PATCH 05/21] Using single definition for libraries everywhere. (#555) --- CMakeLists.txt | 6 +++--- source/CMakeLists.txt | 1 - source/portable/CMakeLists.txt | 2 -- tools/CMakeLists.txt | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5053096c4..be2eb3dff7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,12 +136,12 @@ endif() # There is also the need to add a target - typically an interface library that describes the # Configuration for FreeRTOS-Kernel and FreeRTOS-Plus-TCP. -# This is called FreeRTOS::Config +# This is called freertos_config # If not defined will be default compile with one of the test build combinations AllEnable. # Select the appropriate Build Test configuration -# This is only used when FreeRTOS::Config is not defined, otherwise the build test will be performed -# on the config defined in the FreeRTOS::Config +# This is only used when freertos_config is not defined, otherwise the build test will be performed +# on the config defined in the freertos_config set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION "DEFAULT_CONF" CACHE STRING "FreeRTOS Plus TCP Build Test configuration") set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST CUSTOM # Custom (external) configuration -eg from a top-level project diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 8992f55cf4..b6e127aa0f 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,5 +1,4 @@ add_library( freertos_plus_tcp STATIC ) -add_library( FreeRTOS::PlusTCP ALIAS freertos_plus_tcp ) target_sources( freertos_plus_tcp PRIVATE diff --git a/source/portable/CMakeLists.txt b/source/portable/CMakeLists.txt index 781dce4229..466a9a296e 100644 --- a/source/portable/CMakeLists.txt +++ b/source/portable/CMakeLists.txt @@ -1,5 +1,4 @@ add_library( freertos_plus_tcp_port STATIC ) -add_library( FreeRTOS::PlusTCP::Port ALIAS freertos_plus_tcp_port ) target_sources( freertos_plus_tcp_port PRIVATE @@ -40,7 +39,6 @@ if (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "A_CUSTOM_NETWORK_IF") endif() add_library( freertos_plus_tcp_network_if STATIC ) -add_library( FreeRTOS::PlusTCP::NetworkIF ALIAS freertos_plus_tcp_network_if ) target_sources( freertos_plus_tcp_network_if PRIVATE diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index f5e3462188..24accb5f00 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,5 +1,4 @@ add_library( freertos_plus_tcp_tools STATIC ) -add_library( FreeRTOS::PlusTCP::Tools ALIAS freertos_plus_tcp_tools ) target_sources( freertos_plus_tcp_tools PRIVATE From 4cf6101f1964564afcf68ca018af27f14e31439d Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Thu, 6 Oct 2022 14:01:19 -0700 Subject: [PATCH 06/21] Fixing A_CUSTOM_NETWORK_IF compile option. --- CMakeLists.txt | 3 ++ source/portable/CMakeLists.txt | 53 ++++++++++++++++++++++++-------- test/build-combination/README.md | 6 ++-- 3 files changed, 47 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be2eb3dff7..c03d2b63ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,9 @@ elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_ " PUBLIC\n" " .)\n\n" " taget_link_libraries(freertos_plus_tcp_network_if\n" + " PUBLIC\n" + " freertos_plus_tcp_port\n" + " freertos_plus_tcp_network_if_common\n" " PRIVATE\n" " freertos_kernel)") endif() diff --git a/source/portable/CMakeLists.txt b/source/portable/CMakeLists.txt index 466a9a296e..b40ea0e382 100644 --- a/source/portable/CMakeLists.txt +++ b/source/portable/CMakeLists.txt @@ -32,6 +32,36 @@ target_link_libraries( freertos_plus_tcp_port freertos_plus_tcp_network_if ) +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if_common STATIC ) + +target_sources( freertos_plus_tcp_network_if_common + PRIVATE + NetworkInterface/Common/phyHandling.c + NetworkInterface/include/phyHandling.h +) + +target_include_directories( freertos_plus_tcp_network_if_common + PUBLIC + NetworkInterface/include +) + +target_compile_options( freertos_plus_tcp_network_if_common + PRIVATE + $<$:-Wno-conditional-uninitialized> + $<$:-Wno-implicit-int-conversion> + $<$:-Wno-padded> + $<$:-Wno-uninitialized> + $<$:-Wno-unused-but-set-variable> + $<$:-Wno-unused-macros> +) + +target_link_libraries( freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) + #------------------------------------------------------------------------------ if (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "A_CUSTOM_NETWORK_IF") message(STATUS "Using a custom FREERTOS_PLUS_TCP_NETWORK_IF.") @@ -142,20 +172,18 @@ if( FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "POSIX") endif() target_include_directories( freertos_plus_tcp_network_if - PUBLIC - freertos_plus_tcp_port # For compiler pragmas. - NetworkInterface/include PRIVATE + NetworkInterface # $<$ #TODO - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/DriverSAM> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/ksz8851snl> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/M487> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/MPS2_AN385/ether_lan9118> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/STM32Fxx> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/STM32Hxx> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/ThirdParty/MSP432> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/xilinx_ultrascale> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/Zynq> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/DriverSAM> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/ksz8851snl> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/M487> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/MPS2_AN385/ether_lan9118> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/STM32Fxx> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/STM32Hxx> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/ThirdParty/MSP432> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/xilinx_ultrascale> + # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/Zynq> ) target_compile_options( freertos_plus_tcp_network_if @@ -185,6 +213,7 @@ target_compile_options( freertos_plus_tcp_network_if target_link_libraries( freertos_plus_tcp_network_if PUBLIC freertos_plus_tcp_port + freertos_plus_tcp_network_if_common PRIVATE freertos_kernel freertos_plus_tcp diff --git a/test/build-combination/README.md b/test/build-combination/README.md index 8b83253ce1..c4d9408df7 100644 --- a/test/build-combination/README.md +++ b/test/build-combination/README.md @@ -31,21 +31,21 @@ All the CMake commands are to be run from the root of the repository. * Build checks (Enable all functionalities) ``` -cmake -S . -B build -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 ``` Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` in Visual Studio and click `Build --> Build Solution`. * Build checks (Disable all functionalities) ``` -cmake -S . -B build -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 ``` Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` in Visual Studio and click `Build --> Build Solution`. * Build checks (Default configuration) ``` -cmake -S . -B build -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 ``` Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` in Visual Studio and click `Build --> Build Solution`. From 88739fd443f2119c6b4adb5449f19a8076fdbbf1 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Thu, 6 Oct 2022 15:05:50 -0700 Subject: [PATCH 07/21] Identifying and fixing compile issues. --- source/CMakeLists.txt | 2 +- source/portable/CMakeLists.txt | 3 ++- test/build-combination/Common/main.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b6e127aa0f..54cb75ac80 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -74,7 +74,7 @@ target_compile_options( freertos_plus_tcp $<$:-Wno-shorten-64-to-32> $<$:-Wno-sign-conversion> $<$:-Wno-unused-macros> - $<$:-Wno-unused-parameter> + $<$:-Wno-unused-parameter> ) target_link_libraries( freertos_plus_tcp diff --git a/source/portable/CMakeLists.txt b/source/portable/CMakeLists.txt index b40ea0e382..8b6511145a 100644 --- a/source/portable/CMakeLists.txt +++ b/source/portable/CMakeLists.txt @@ -205,9 +205,10 @@ target_compile_options( freertos_plus_tcp_network_if $<$:-Wno-type-limits> $<$:-Wno-undef> $<$:-Wno-uninitialized> - $<$:-Wno-unused-but-set-variable> + $<$:-Wno-unused-but-set-variable> $<$:-Wno-unused-macros> $<$:-Wno-unused-parameter> + $<$:-Wno-pedantic> ) target_link_libraries( freertos_plus_tcp_network_if diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index 1775e71daa..52b19db68d 100644 --- a/test/build-combination/Common/main.c +++ b/test/build-combination/Common/main.c @@ -40,6 +40,7 @@ #include "FreeRTOS_DHCP.h" #include +#include #define mainHOST_NAME "Build Combination" #define mainDEVICE_NICK_NAME "Build_Combination" @@ -198,8 +199,8 @@ void vApplicationIdleHook( void ) /* Exit. Just a stub. */ } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * pcFile, - size_t ulLine ) +void vAssertCalled( const char * const pcFile, + unsigned long ulLine ) { const uint32_t ulLongSleep = 1000UL; volatile uint32_t ulBlockVariable = 0UL; From afb1e28dc196a40c137fd81b45984c7d2797a840 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Sun, 23 Oct 2022 12:57:12 -0700 Subject: [PATCH 08/21] Adding in additional warnings for GNU to ignore for now. --- source/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 54cb75ac80..5b8479d0a4 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -74,6 +74,7 @@ target_compile_options( freertos_plus_tcp $<$:-Wno-shorten-64-to-32> $<$:-Wno-sign-conversion> $<$:-Wno-unused-macros> + $<$:-Wno-unused-but-set-variable> $<$:-Wno-unused-parameter> ) From 27a9f4f94653b1aee7ffbe7bcf56dbd06680f562 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Sun, 23 Oct 2022 13:14:25 -0700 Subject: [PATCH 09/21] Fixing formatting issues with uncrustify. --- test/build-combination/Common/FreeRTOSConfig.h | 2 +- test/build-combination/Common/main.c | 8 ++++---- test/build-combination/DefaultConf/FreeRTOSIPConfig.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/build-combination/Common/FreeRTOSConfig.h b/test/build-combination/Common/FreeRTOSConfig.h index 082522559d..431cfad9cb 100644 --- a/test/build-combination/Common/FreeRTOSConfig.h +++ b/test/build-combination/Common/FreeRTOSConfig.h @@ -219,7 +219,7 @@ extern void vLoggingPrint( const char * pcMessage ); #define configPROFILING ( 0 ) /* Pseudo random number generator used by some tasks. */ -extern uint32_t ulRand(void); +extern uint32_t ulRand( void ); #define configRAND32() ulRand() /* The platform that FreeRTOS is running on. */ diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index 52b19db68d..aaac460d43 100644 --- a/test/build-combination/Common/main.c +++ b/test/build-combination/Common/main.c @@ -42,13 +42,13 @@ #include #include -#define mainHOST_NAME "Build Combination" -#define mainDEVICE_NICK_NAME "Build_Combination" +#define mainHOST_NAME "Build Combination" +#define mainDEVICE_NICK_NAME "Build_Combination" #if defined( _MSC_VER ) && ( _MSC_VER <= 1600 ) - #define local_stricmp _stricmp + #define local_stricmp _stricmp #else - #define local_stricmp strcasecmp + #define local_stricmp strcasecmp #endif /*-----------------------------------------------------------*/ diff --git a/test/build-combination/DefaultConf/FreeRTOSIPConfig.h b/test/build-combination/DefaultConf/FreeRTOSIPConfig.h index 4bb2595be1..313c401e6e 100644 --- a/test/build-combination/DefaultConf/FreeRTOSIPConfig.h +++ b/test/build-combination/DefaultConf/FreeRTOSIPConfig.h @@ -38,10 +38,10 @@ /* It is not sensible for this macro to have a default value as it is hardware * dependent. */ -#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN /* The windows simulator cannot really simulate MAC interrupts, and needs to * block occasionally to allow other tasks to run. */ #define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS ) -#endif +#endif /* ifndef FREERTOS_IP_CONFIG_H */ From ecc9d85590a5f17d8588f01f29f65b9061c32d36 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Sun, 23 Oct 2022 15:45:35 -0700 Subject: [PATCH 10/21] More warnings for GNU used by CI/CD pipeline. --- source/CMakeLists.txt | 2 ++ test/build-combination/Common/FreeRTOSConfig.h | 2 +- test/build-combination/Common/main.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 5b8479d0a4..6bd289206a 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -76,6 +76,8 @@ target_compile_options( freertos_plus_tcp $<$:-Wno-unused-macros> $<$:-Wno-unused-but-set-variable> $<$:-Wno-unused-parameter> + $<$:-Wno-unused-variable> + $<$:-Wno-pedantic> ) target_link_libraries( freertos_plus_tcp diff --git a/test/build-combination/Common/FreeRTOSConfig.h b/test/build-combination/Common/FreeRTOSConfig.h index 431cfad9cb..4ba6dc1376 100644 --- a/test/build-combination/Common/FreeRTOSConfig.h +++ b/test/build-combination/Common/FreeRTOSConfig.h @@ -116,7 +116,7 @@ /* Assert call defined for debug builds. */ void vAssertCalled( const char * pcFile, - uint32_t ulLine ); + unsigned long ulLine ); #define configASSERT( x ) diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index aaac460d43..333f159c57 100644 --- a/test/build-combination/Common/main.c +++ b/test/build-combination/Common/main.c @@ -199,7 +199,7 @@ void vApplicationIdleHook( void ) /* Exit. Just a stub. */ } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * const pcFile, +void vAssertCalled( const char * pcFile, unsigned long ulLine ) { const uint32_t ulLongSleep = 1000UL; From 88c58727402beefc9fd30e3c34b07682aa3ad1c6 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Sun, 23 Oct 2022 17:25:19 -0700 Subject: [PATCH 11/21] Assuming custom for build tests and using latest freertos-kernel code. Updated readme for how to consume at project level. --- CMakeLists.txt | 66 +++++---------------------- README.md | 35 +++++++++++++- test/build-combination/CMakeLists.txt | 2 +- 3 files changed, 47 insertions(+), 56 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c03d2b63ba..3110f66091 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,12 +145,12 @@ endif() # Select the appropriate Build Test configuration # This is only used when freertos_config is not defined, otherwise the build test will be performed # on the config defined in the freertos_config -set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION "DEFAULT_CONF" CACHE STRING "FreeRTOS Plus TCP Build Test configuration") +set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION "CUSTOM" CACHE STRING "FreeRTOS Plus TCP Build Test configuration") set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST CUSTOM # Custom (external) configuration -eg from a top-level project ENABLE_ALL # Enable all configuration settings DISABLE_ALL # Disable all configuration settings - DEFAULT_CONF # Default (typical) configuration) + DEFAULT_CONF # Default (typical) configuration ) if(NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION IN_LIST FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST) message(FATAL_ERROR "Invalid FREERTOS_PLUS_TCP_TEST_CONFIGURATION value '${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}' should be one of: ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST}") @@ -158,13 +158,6 @@ else() message(STATUS "Using FreeRTOS-Plus-TCP Test Configuration : ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}") if (NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM") message(WARNING "FreeRTOS-Kernel configuration settings are configured by FreeRTOS-Plus-TCP") - # Configuration for FreeRTOS-Kernel - set(FREERTOS_CONFIG_FILE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/test/build-combination/Common" CACHE STRING "" FORCE) - if(UNIX) - set(FREERTOS_PORT GCC_POSIX CACHE STRING "" FORCE) - elseif(MINGW) - set(FREERTOS_PORT MSVC_MINGW CACHE STRING "" FORCE) - endif() endif() endif() @@ -212,21 +205,15 @@ add_compile_options( ######################################################################## # External Dependencies # Note: For backwards compatibility - still have .gitmodules defining submodules -# To support fetching content in a higher level project add: -# -# FetchContent_Declare( freertos_plus_tcp -# GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git -# GIT_TAG V3.0.0 -# GIT_SUBMODULES "" # Don't grab any submodules - rely on FetchContent -# ) -# -# This will allow you to upgrade submodules and have one common submodule for -# all your builds despite multiple submodules having different versions. +# To support fetching content in a higher level project see +# README.md `Consume with CMake` +# This will allow you to upgrade submodules and have one common submodule for +# all your builds despite multiple submodules having different versions. include(FetchContent) FetchContent_Declare( freertos_kernel - GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Kernel.git - GIT_TAG V10.5.0 + GIT_REPOSITORY https://github.com/phelter/FreeRTOS-Kernel.git #https://github.com/FreeRTOS/FreeRTOS-Kernel.git + GIT_TAG feature/fixing-clang-gnu-compiler-warnings #master ) FetchContent_Declare( cmock @@ -243,36 +230,7 @@ FetchContent_MakeAvailable(freertos_kernel cmock) # Note following are can be removed once FreeRTOS-Kernel v10.5.0 + fixes their issues. # To ignore header specific issues - change all of the headers to SYSTEM set(_freertos_kernel_targets freertos_kernel freertos_kernel_port) -foreach (_target ${_freertos_kernel_targets} ) - get_target_property( interface_directories ${_target} INTERFACE_INCLUDE_DIRECTORIES ) - set_target_properties(${_target} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${interface_directories}" ) -endforeach() -target_compile_options( freertos_kernel - PRIVATE - $<$:-Wno-cast-align> - $<$:-Wno-covered-switch-default> - $<$:-Wno-documentation> - $<$:-Wno-extra-semi-stmt> - $<$:-Wno-int-to-pointer-cast> - $<$:-Wno-missing-noreturn> - $<$:-Wno-missing-variable-declarations> - $<$:-Wno-padded> - $<$:-Wno-pointer-to-int-cast> - $<$:-Wno-shorten-64-to-32> - $<$:-Wno-sign-conversion> - $<$:-Wno-unused-macros> - $<$:-Wno-unused-variable> -) -target_compile_options( freertos_kernel_port - PRIVATE - $<$:-Wno-disabled-macro-expansion> - $<$:-Wno-documentation> - $<$:-Wno-missing-noreturn> - $<$:-Wno-missing-variable-declarations> - $<$:-Wno-padded> - $<$:-Wno-pointer-to-int-cast> - $<$:-Wno-reserved-macro-identifier> - $<$:-Wno-sign-conversion> - $<$:-Wno-type-limits> - $<$:-Wno-unused-macros> -) +# foreach (_target ${_freertos_kernel_targets} ) +# get_target_property( interface_directories ${_target} INTERFACE_INCLUDE_DIRECTORIES ) +# set_target_properties(${_target} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${interface_directories}" ) +# endforeach() diff --git a/README.md b/README.md index 7c6ee16c6e..b3ee6c5ecc 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,40 @@ Once python is downloaded and installed, you can verify the version from your te To run the script, you should switch to the FreeRTOS-Plus-TCP directory that was created using the [Cloning this repository](#cloning-this-repository) step above. And then run `python /GenerateOriginalFiles.py`. -## Cloning this repository +## To consume FreeRTOS+FAT + +### Consume with CMake +If using CMake, it is recommended to use this repository using FetchContent. +Add the following into your project's main or a subdirectory's `CMakeLists.txt`: + +- Define the source and version/tag you want to use: + +```cmake +FetchContent_Declare( freertos_plus_tcp + GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git + GIT_TAG master #Note: Best practice to use specific git-hash or tagged version + GIT_SUBMODULES "" # Don't grab any submodules since not latest +) +``` + +- Configure the FreeRTOS-Kernel and make it available + - this particular example supports a native and cross-compiled build option. + +```cmake +set( FREERTOS_PLUS_FAT_DEV_SUPPORT OFF CACHE BOOL "" FORCE) +# Select the native compile PORT +set( FREERTOS_PLUS_FAT_PORT "POSIX" CACHE STRING "" FORCE) +# Select the cross-compile PORT +if (CMAKE_CROSSCOMPILING) + # Eg. Zynq 2019_3 version of port + set(FREERTOS_PLUS_FAT_PORT "ZYNQ_2019_3" CACHE STRING "" FORCE) +endif() + +FetchContent_MakeAvailable(freertos_plus_tcp) +``` + +### Consuming stand-alone + This repository uses [Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to bring in dependent components. Note: If you download the ZIP file provided by GitHub UI, you will not get the contents of the submodules. (The ZIP file is also not a valid Git repository) diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index ce894b58f6..02dd950525 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -21,7 +21,7 @@ target_link_libraries(freertos_plus_tcp_config_default INTERFACE freertos_plus_t if(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM" ) # Check Config target is available. And then do nothing. if(NOT TARGET freertos_config ) - message(FATAL_ERROR "FREERTOS_PLUS_TCP_TEST_CONFIGURATIN = CUSTOM, but no freertos_config target defined.") + message(FATAL_ERROR "FREERTOS_PLUS_TCP_TEST_CONFIGURATION = CUSTOM, but no freertos_config target defined.") endif() elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "DISABLE_ALL" ) add_library( freertos_config ALIAS freertos_plus_tcp_config_all_disable) From c46edd868bb5e8c55a683968d02ed0011b58ffb2 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Thu, 3 Nov 2022 12:46:42 -0700 Subject: [PATCH 12/21] Fixing up issues identified in the PR. Making the build_test EXCLUDE_FROM_ALL so only compiled if requested. --- .github/workflows/ci.yml | 17 ++++++++--------- README.md | 2 +- source/portable/CMakeLists.txt | 10 ---------- test/build-combination/CMakeLists.txt | 2 +- test/build-combination/README.md | 6 +++--- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eca6cbc061..d7f98eb98f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,24 +111,23 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - # Using CMake FetchContent to pull FreeRTOS-Kernel now. - # - name: Update submodules - # run: git submodule update --init --checkout - name: Build Install Dependencies run: | sudo apt-get install -y libpcap-dev - name: Build checks (Enable all functionalities) run: | - cmake -S . -B build/ -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL - make -C build/ + cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL + cmake --build build --target freertos_plus_tcp_build_test - name: Build checks (Disable all functionalities) run: | - cmake -S . -B build/ -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL - make -C build/ + cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL + cmake --build build --target clean + cmake --build build --target freertos_plus_tcp_build_test - name: Build checks (Default configuration) run: | - cmake -S . -B build/ -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF - make -C build/ + cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF + cmake --build build --target clean + cmake --build build --target freertos_plus_tcp_build_test complexity: runs-on: ubuntu-latest diff --git a/README.md b/README.md index b3ee6c5ecc..07971fe2d7 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Once python is downloaded and installed, you can verify the version from your te To run the script, you should switch to the FreeRTOS-Plus-TCP directory that was created using the [Cloning this repository](#cloning-this-repository) step above. And then run `python /GenerateOriginalFiles.py`. -## To consume FreeRTOS+FAT +## To consume FreeRTOS+TCP ### Consume with CMake If using CMake, it is recommended to use this repository using FetchContent. diff --git a/source/portable/CMakeLists.txt b/source/portable/CMakeLists.txt index 8b6511145a..1e7e45e77e 100644 --- a/source/portable/CMakeLists.txt +++ b/source/portable/CMakeLists.txt @@ -174,16 +174,6 @@ endif() target_include_directories( freertos_plus_tcp_network_if PRIVATE NetworkInterface - # $<$ #TODO - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/DriverSAM> - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/ksz8851snl> - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/M487> - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/MPS2_AN385/ether_lan9118> - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/STM32Fxx> - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/STM32Hxx> - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/ThirdParty/MSP432> - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/xilinx_ultrascale> - # $<$:${CMAKE_CURRENT_SOURCE_DIR}/NetworkInterface/Zynq> ) target_compile_options( freertos_plus_tcp_network_if diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index 02dd950525..9c77788cb3 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -31,7 +31,7 @@ else() add_library( freertos_config ALIAS freertos_plus_tcp_config_default) endif() -add_executable(freertos_plus_tcp_build_test) +add_executable(freertos_plus_tcp_build_test EXCLUDE_FROM_ALL) target_sources(freertos_plus_tcp_build_test PRIVATE diff --git a/test/build-combination/README.md b/test/build-combination/README.md index c4d9408df7..8d7aca4957 100644 --- a/test/build-combination/README.md +++ b/test/build-combination/README.md @@ -10,19 +10,19 @@ All the CMake commands are to be run from the root of the repository. * Build checks (Enable all functionalities) ``` cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -make -C build +cmake --build build --target freertos_plus_tcp_build_test ``` * Build checks (Disable all functionalities) ``` cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL -make -C build +cmake --build build --target freertos_plus_tcp_build_test ``` * Build checks (Default configuration) ``` cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF -make -C . +cmake --build build --target freertos_plus_tcp_build_test ``` ## Windows From 9f6ca62599aca57d0c0e6642ff87b6ddaaf7c693 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Fri, 4 Nov 2022 17:26:07 -0700 Subject: [PATCH 13/21] Changing to support C89 instead of C99. Renaming tcp_tools to tcp_utilities to mimic the directory. --- CMakeLists.txt | 2 +- source/CMakeLists.txt | 2 +- tools/CMakeLists.txt | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3110f66091..6b1b258c81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,7 @@ endif() ######################################################################## # Requirements -set(CMAKE_C_STANDARD 99) # Note FreeRTOS-Kernel uses C99 constructs. +set(CMAKE_C_STANDARD 89) # Note FreeRTOS-Kernel uses C99 constructs. set(CMAKE_C_STANDARD_REQUIRED ON) ######################################################################## diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 6bd289206a..a990fe9478 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -87,7 +87,7 @@ target_link_libraries( freertos_plus_tcp PRIVATE freertos_kernel freertos_plus_tcp_network_if - freertos_plus_tcp_tools + freertos_plus_tcp_utilities ) add_subdirectory(portable) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 24accb5f00..dfbbdc5b8a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,6 +1,6 @@ -add_library( freertos_plus_tcp_tools STATIC ) +add_library( freertos_plus_tcp_utilities STATIC ) -target_sources( freertos_plus_tcp_tools +target_sources( freertos_plus_tcp_utilities PRIVATE tcp_utilities/include/tcp_dump_packets.h tcp_utilities/include/tcp_mem_stats.h @@ -12,13 +12,13 @@ target_sources( freertos_plus_tcp_tools ) # Note: Have to make system due to compiler warnings in header files. -target_include_directories( freertos_plus_tcp_tools SYSTEM +target_include_directories( freertos_plus_tcp_utilities SYSTEM PUBLIC tcp_utilities/include ) #TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed. -target_compile_options( freertos_plus_tcp_tools +target_compile_options( freertos_plus_tcp_utilities PRIVATE $<$:-Wno-extra-semi-stmt> $<$:-Wno-format> @@ -30,7 +30,7 @@ target_compile_options( freertos_plus_tcp_tools $<$:-Wno-unused-variable> ) -target_link_libraries( freertos_plus_tcp_tools +target_link_libraries( freertos_plus_tcp_utilities PRIVATE freertos_kernel freertos_plus_tcp From e846d3c38d31c072316ec6ecfc7302feabbb69c7 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Fri, 4 Nov 2022 17:43:05 -0700 Subject: [PATCH 14/21] Using C90 ISO. Fixing compiler warnings. --- CMakeLists.txt | 2 +- source/CMakeLists.txt | 1 + source/FreeRTOS_IP.c | 4 ++++ source/FreeRTOS_Sockets.c | 4 ++++ source/portable/NetworkInterface/linux/NetworkInterface.c | 8 ++++---- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b1b258c81..71d0b56d0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,7 @@ endif() ######################################################################## # Requirements -set(CMAKE_C_STANDARD 89) # Note FreeRTOS-Kernel uses C99 constructs. +set(CMAKE_C_STANDARD 90) # Note FreeRTOS-Kernel uses C99 constructs. set(CMAKE_C_STANDARD_REQUIRED ON) ######################################################################## diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index a990fe9478..12df1ccf93 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -66,6 +66,7 @@ target_compile_options( freertos_plus_tcp $<$:-Wno-cast-qual> $<$:-Wno-conditional-uninitialized> $<$:-Wno-covered-switch-default> + $<$:-Wno-declaration-after-statement> $<$:-Wno-documentation> $<$:-Wno-extra-semi-stmt> $<$:-Wno-implicit-int-conversion> diff --git a/source/FreeRTOS_IP.c b/source/FreeRTOS_IP.c index 9add500e51..360cc3ede1 100644 --- a/source/FreeRTOS_IP.c +++ b/source/FreeRTOS_IP.c @@ -55,6 +55,10 @@ #include "NetworkBufferManagement.h" #include "FreeRTOS_DNS.h" +#if ( ipconfigUSE_TCP_MEM_STATS != 0 ) +#include "tcp_mem_stats.h" +#endif + /* IPv4 multi-cast addresses range from 224.0.0.0.0 to 240.0.0.0. */ #define ipFIRST_MULTI_CAST_IPv4 0xE0000000U /**< Lower bound of the IPv4 multicast address. */ #define ipLAST_MULTI_CAST_IPv4 0xF0000000U /**< Higher bound of the IPv4 multicast address. */ diff --git a/source/FreeRTOS_Sockets.c b/source/FreeRTOS_Sockets.c index a782304fea..5b159232d9 100644 --- a/source/FreeRTOS_Sockets.c +++ b/source/FreeRTOS_Sockets.c @@ -50,6 +50,10 @@ #include "FreeRTOS_DNS.h" #include "NetworkBufferManagement.h" +#if ( ipconfigUSE_TCP_MEM_STATS != 0 ) +#include "tcp_mem_stats.h" +#endif + /* The ItemValue of the sockets xBoundSocketListItem member holds the socket's * port number. */ /** @brief Set the port number for the socket in the xBoundSocketListItem. */ diff --git a/source/portable/NetworkInterface/linux/NetworkInterface.c b/source/portable/NetworkInterface/linux/NetworkInterface.c index 30203f86a3..230b90d5c8 100644 --- a/source/portable/NetworkInterface/linux/NetworkInterface.c +++ b/source/portable/NetworkInterface/linux/NetworkInterface.c @@ -650,14 +650,14 @@ static void * prvLinuxPcapRecvThread( void * pvParam ) { int ret; - ( void ) pvParam; - /* Disable signals to this thread since this is a Linux pthread to be able to * printf and other blocking operations without being interrupted and put in * suspension mode by the linux port signals */ sigset_t set; + ( void ) pvParam; + sigfillset( &set ); pthread_sigmask( SIG_SETMASK, &set, NULL ); @@ -689,12 +689,12 @@ static void * prvLinuxPcapSendThread( void * pvParam ) uint8_t ucBuffer[ ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER ]; const time_t xMaxMSToWait = 1000; - ( void ) pvParam; - /* disable signals to avoid treating this thread as a FreeRTOS task and putting * it to sleep by the scheduler */ sigset_t set; + ( void ) pvParam; + sigfillset( &set ); pthread_sigmask( SIG_SETMASK, &set, NULL ); From c3bc360cce123d576d1d8e1be18cec84c967b6a4 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Fri, 4 Nov 2022 21:00:46 -0700 Subject: [PATCH 15/21] Fixing non C90 compliant declaration after statement --- source/FreeRTOS_ARP.c | 4 +++- source/FreeRTOS_DNS.c | 4 +--- source/FreeRTOS_TCP_IP.c | 6 +++--- source/FreeRTOS_UDP_IP.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/FreeRTOS_ARP.c b/source/FreeRTOS_ARP.c index dab7aaecd5..453127dd1c 100644 --- a/source/FreeRTOS_ARP.c +++ b/source/FreeRTOS_ARP.c @@ -168,6 +168,8 @@ eFrameProcessingResult_t eARPProcessPacket( ARPPacket_t * const pxARPFrame ) /* Introduce a do while loop to allow use of breaks. */ do { + uint32_t ulHostEndianProtocolAddr; + /* Only Ethernet hardware type is supported. * Only IPv4 address can be present in the ARP packet. * The hardware length (the MAC address) must be 6 bytes. And, @@ -193,7 +195,7 @@ eFrameProcessingResult_t eARPProcessPacket( ARPPacket_t * const pxARPFrame ) break; } - uint32_t ulHostEndianProtocolAddr = FreeRTOS_ntohl( ulSenderProtocolAddress ); + ulHostEndianProtocolAddr = FreeRTOS_ntohl( ulSenderProtocolAddress ); if( ( ipFIRST_LOOPBACK_IPv4 <= ulHostEndianProtocolAddr ) && ( ulHostEndianProtocolAddr < ipLAST_LOOPBACK_IPv4 ) ) diff --git a/source/FreeRTOS_DNS.c b/source/FreeRTOS_DNS.c index d856862ff5..3844001f4d 100644 --- a/source/FreeRTOS_DNS.c +++ b/source/FreeRTOS_DNS.c @@ -395,9 +395,7 @@ /* Obtain the DNS server address. */ FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulIPAddress ); #if ( ipconfigUSE_LLMNR == 1 ) - BaseType_t bHasDot = llmnr_has_dot( pcHostName ); - - if( bHasDot == pdFALSE ) + if( llmnr_has_dot( pcHostName ) == pdFALSE ) { /* Use LLMNR addressing. */ pxAddress->sin_addr = ipLLMNR_IP_ADDR; /* Is in network byte order. */ diff --git a/source/FreeRTOS_TCP_IP.c b/source/FreeRTOS_TCP_IP.c index 7db7737267..d0ede7b5b0 100644 --- a/source/FreeRTOS_TCP_IP.c +++ b/source/FreeRTOS_TCP_IP.c @@ -619,9 +619,6 @@ /* Function might modify the parameter. */ NetworkBufferDescriptor_t * pxNetworkBuffer = pxDescriptor; - configASSERT( pxNetworkBuffer != NULL ); - configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); - /* Map the buffer onto a ProtocolHeaders_t struct for easy access to the fields. */ /* MISRA Ref 11.3.1 [Misaligned access] */ @@ -641,6 +638,9 @@ const IPHeader_t * pxIPHeader; + configASSERT( pxNetworkBuffer != NULL ); + configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); + /* Check for a minimum packet size. */ if( pxNetworkBuffer->xDataLength < ( ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) + ipSIZE_OF_TCP_HEADER ) ) { diff --git a/source/FreeRTOS_UDP_IP.c b/source/FreeRTOS_UDP_IP.c index b5249e4302..d12137d8ee 100644 --- a/source/FreeRTOS_UDP_IP.c +++ b/source/FreeRTOS_UDP_IP.c @@ -311,9 +311,6 @@ BaseType_t xProcessReceivedUDPPacket( NetworkBufferDescriptor_t * pxNetworkBuffe BaseType_t xReturn = pdPASS; FreeRTOS_Socket_t * pxSocket; - configASSERT( pxNetworkBuffer != NULL ); - configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); - /* Map the ethernet buffer to the UDPPacket_t struct for easy access to the fields. */ /* MISRA Ref 11.3.1 [Misaligned access] */ @@ -321,6 +318,9 @@ BaseType_t xProcessReceivedUDPPacket( NetworkBufferDescriptor_t * pxNetworkBuffe /* coverity[misra_c_2012_rule_11_3_violation] */ const UDPPacket_t * pxUDPPacket = ( ( const UDPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer ); + configASSERT( pxNetworkBuffer != NULL ); + configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); + /* Caller must check for minimum packet size. */ pxSocket = pxUDPSocketLookup( usPort ); From 7957c2991bd709ecee1f9cc6d474f3ee488bc913 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Fri, 4 Nov 2022 21:14:18 -0700 Subject: [PATCH 16/21] Separating out CMakeLists so each port is independent. --- source/CMakeLists.txt | 1 - source/portable/CMakeLists.txt | 179 +----------------- .../NetworkInterface/ATSAM4E/CMakeLists.txt | 26 +++ .../NetworkInterface/ATSAME5x/CMakeLists.txt | 20 ++ .../portable/NetworkInterface/CMakeLists.txt | 54 ++++++ .../NetworkInterface/DriverSAM/CMakeLists.txt | 22 +++ .../NetworkInterface/LPC17xx/CMakeLists.txt | 28 +++ .../NetworkInterface/LPC18xx/CMakeLists.txt | 28 +++ .../NetworkInterface/LPC54018/CMakeLists.txt | 28 +++ .../NetworkInterface/M487/CMakeLists.txt | 22 +++ .../MPS2_AN385/CMakeLists.txt | 29 +++ .../NetworkInterface/RX/CMakeLists.txt | 22 +++ .../NetworkInterface/SH2A/CMakeLists.txt | 25 +++ .../NetworkInterface/STM32Fxx/CMakeLists.txt | 25 +++ .../NetworkInterface/STM32Hxx/CMakeLists.txt | 23 +++ .../NetworkInterface/TM4C/CMakeLists.txt | 20 ++ .../ThirdParty/MSP432/CMakeLists.txt | 23 +++ .../NetworkInterface/WinPCap/CMakeLists.txt | 25 +++ .../NetworkInterface/Zynq/CMakeLists.txt | 73 +++++++ .../board_family/CMakeLists.txt | 20 ++ .../NetworkInterface/esp32/CMakeLists.txt | 28 +++ .../ksz8851snl/CMakeLists.txt | 23 +++ .../NetworkInterface/libslirp/CMakeLists.txt | 29 +++ .../NetworkInterface/linux/CMakeLists.txt | 33 ++++ .../NetworkInterface/mw300_rd/CMakeLists.txt | 20 ++ .../NetworkInterface/pic32mzef/CMakeLists.txt | 23 +++ .../xilinx_ultrascale/CMakeLists.txt | 70 +++++++ 27 files changed, 740 insertions(+), 179 deletions(-) create mode 100644 source/portable/NetworkInterface/ATSAM4E/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/ATSAME5x/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/DriverSAM/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/LPC17xx/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/LPC18xx/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/LPC54018/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/M487/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/MPS2_AN385/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/RX/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/SH2A/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/STM32Hxx/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/TM4C/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/ThirdParty/MSP432/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/WinPCap/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/Zynq/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/board_family/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/esp32/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/ksz8851snl/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/libslirp/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/linux/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/mw300_rd/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/pic32mzef/CMakeLists.txt create mode 100644 source/portable/NetworkInterface/xilinx_ultrascale/CMakeLists.txt diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 12df1ccf93..a990fe9478 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -66,7 +66,6 @@ target_compile_options( freertos_plus_tcp $<$:-Wno-cast-qual> $<$:-Wno-conditional-uninitialized> $<$:-Wno-covered-switch-default> - $<$:-Wno-declaration-after-statement> $<$:-Wno-documentation> $<$:-Wno-extra-semi-stmt> $<$:-Wno-implicit-int-conversion> diff --git a/source/portable/CMakeLists.txt b/source/portable/CMakeLists.txt index 1e7e45e77e..c3aede2013 100644 --- a/source/portable/CMakeLists.txt +++ b/source/portable/CMakeLists.txt @@ -33,181 +33,4 @@ target_link_libraries( freertos_plus_tcp_port ) #------------------------------------------------------------------------------ -add_library( freertos_plus_tcp_network_if_common STATIC ) - -target_sources( freertos_plus_tcp_network_if_common - PRIVATE - NetworkInterface/Common/phyHandling.c - NetworkInterface/include/phyHandling.h -) - -target_include_directories( freertos_plus_tcp_network_if_common - PUBLIC - NetworkInterface/include -) - -target_compile_options( freertos_plus_tcp_network_if_common - PRIVATE - $<$:-Wno-conditional-uninitialized> - $<$:-Wno-implicit-int-conversion> - $<$:-Wno-padded> - $<$:-Wno-uninitialized> - $<$:-Wno-unused-but-set-variable> - $<$:-Wno-unused-macros> -) - -target_link_libraries( freertos_plus_tcp_network_if_common - PRIVATE - freertos_kernel - freertos_plus_tcp -) - -#------------------------------------------------------------------------------ -if (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "A_CUSTOM_NETWORK_IF") - message(STATUS "Using a custom FREERTOS_PLUS_TCP_NETWORK_IF.") - return() -endif() - -add_library( freertos_plus_tcp_network_if STATIC ) - -target_sources( freertos_plus_tcp_network_if - PRIVATE - NetworkInterface/Common/phyHandling.c - NetworkInterface/include/phyHandling.h - - #$<$:> # TODO - $<$: - NetworkInterface/ATSAME5x/NetworkInterface.c> - $<$: - NetworkInterface/DriverSAM/gmac_SAM.c - NetworkInterface/DriverSAM/gmac_SAM.h - NetworkInterface/DriverSAM/NetworkInterface.c> - $<$: - NetworkInterface/esp32/NetworkInterface.c> - $<$: - NetworkInterface/ksz8851snl/ksz8851snl_reg.h - NetworkInterface/ksz8851snl/ksz8851snl.c - NetworkInterface/ksz8851snl/ksz8851snl.h - NetworkInterface/ksz8851snl/NetworkInterface.c> - $<$: - NetworkInterface/linux/NetworkInterface.c> - $<$: - NetworkInterface/LPC17xx/NetworkInterface.c> - $<$: - NetworkInterface/LPC18xx/NetworkInterface.c> - $<$: - NetworkInterface/LPC54018/NetworkInterface.c> - $<$: - NetworkInterface/M487/m480_eth.c - NetworkInterface/M487/m480_eth.h - NetworkInterface/M487/NetworkInterface.c> - $<$: - NetworkInterface/MPS2_AN385/ether_lan9118 - NetworkInterface/MPS2_AN385/ether_lan9118/SMM_MPS2.h - NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_emac_config.h - NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_eth_drv.c - NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_eth_drv.h - NetworkInterface/MPS2_AN385/NetworkInterface.c> - $<$: - NetworkInterface/mw300_rd/NetworkInterface.c> - $<$: - NetworkInterface/pic32mzef/NetworkInterface_eth.c> - $<$: - NetworkInterface/pic32mzef/NetworkInterface_wifi.c> - $<$: - NetworkInterface/RX/ether_callback.c - NetworkInterface/RX/NetworkInterface.c> - $<$: - NetworkInterface/SH2A/NetworkInterface.c> - $<$: - NetworkInterface/STM32Fxx/NetworkInterface.c - NetworkInterface/STM32Fxx/stm32f2xx_hal_eth.h - NetworkInterface/STM32Fxx/stm32f4xx_hal_eth.h - NetworkInterface/STM32Fxx/stm32f7xx_hal_eth.h - NetworkInterface/STM32Fxx/stm32fxx_hal_eth.c - NetworkInterface/STM32Fxx/stm32fxx_hal_eth.h> - $<$: - NetworkInterface/STM32Hxx/NetworkInterface.c - NetworkInterface/STM32Hxx/stm32h7xx_hal_eth.h - NetworkInterface/STM32Hxx/stm32hxx_hal_eth.c - NetworkInterface/STM32Hxx/stm32hxx_hal_eth.h> - $<$: - NetworkInterface/ThirdParty/MSP432/NetworkInterface.c - NetworkInterface/ThirdParty/MSP432/NetworkInterface.h - NetworkInterface/ThirdParty/MSP432/NetworkMiddleware.c - NetworkInterface/ThirdParty/MSP432/NetworkMiddleware.h> - $<$: - NetworkInterface/TM4C/NetworkInterface.c> - $<$: - NetworkInterface/WinPCAP/FaultInjection.c - NetworkInterface/WinPCAP/NetworkInterface.c> - $<$: - NetworkInterface/xilinx_ultrascale/NetworkInterface.c - NetworkInterface/xilinx_ultrascale/readme.md - NetworkInterface/xilinx_ultrascale/uncached_memory.c - NetworkInterface/xilinx_ultrascale/uncached_memory.h - NetworkInterface/xilinx_ultrascale/x_emacpsif_dma.c - NetworkInterface/xilinx_ultrascale/x_emacpsif_hw.c - NetworkInterface/xilinx_ultrascale/x_emacpsif_hw.h - NetworkInterface/xilinx_ultrascale/x_emacpsif_physpeed.c - NetworkInterface/xilinx_ultrascale/x_emacpsif.h - NetworkInterface/xilinx_ultrascale/x_topology.h> - $<$: - NetworkInterface/Zynq/NetworkInterface.c - NetworkInterface/Zynq/README.txt - NetworkInterface/Zynq/uncached_memory.c - NetworkInterface/Zynq/uncached_memory.h - NetworkInterface/Zynq/x_emacpsif_dma.c - NetworkInterface/Zynq/x_emacpsif_hw.c - NetworkInterface/Zynq/x_emacpsif_hw.h - NetworkInterface/Zynq/x_emacpsif_physpeed.c - NetworkInterface/Zynq/x_emacpsif.h - NetworkInterface/Zynq/x_topology.h> -) - -if( FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "POSIX") - find_package(PCAP REQUIRED) - set(THREADS_PREFER_PTHREAD_FLAG TRUE) - find_package(Threads) -endif() - -target_include_directories( freertos_plus_tcp_network_if - PRIVATE - NetworkInterface -) - -target_compile_options( freertos_plus_tcp_network_if - PRIVATE - $<$:-Wno-cast-align> - $<$:-Wno-conditional-uninitialized> - $<$:-Wno-documentation> - $<$:-Wno-empty-translation-unit> - $<$:-Wno-extra-semi-stmt> - $<$:-Wno-gnu-statement-expression> - $<$:-Wno-implicit-int-conversion> - $<$:-Wno-int-to-pointer-cast> - $<$:-Wno-missing-noreturn> - $<$:-Wno-missing-prototypes> - $<$:-Wno-pointer-to-int-cast> - $<$:-Wno-newline-eof> - $<$:-Wno-padded> - $<$:-Wno-shorten-64-to-32> - $<$:-Wno-type-limits> - $<$:-Wno-undef> - $<$:-Wno-uninitialized> - $<$:-Wno-unused-but-set-variable> - $<$:-Wno-unused-macros> - $<$:-Wno-unused-parameter> - $<$:-Wno-pedantic> -) - -target_link_libraries( freertos_plus_tcp_network_if - PUBLIC - freertos_plus_tcp_port - freertos_plus_tcp_network_if_common - PRIVATE - freertos_kernel - freertos_plus_tcp - $<$:${PCAP_LIBRARY}> - $<$:Threads::Threads> -) +add_subdirectory(NetworkInterface) diff --git a/source/portable/NetworkInterface/ATSAM4E/CMakeLists.txt b/source/portable/NetworkInterface/ATSAM4E/CMakeLists.txt new file mode 100644 index 0000000000..22bacf3789 --- /dev/null +++ b/source/portable/NetworkInterface/ATSAM4E/CMakeLists.txt @@ -0,0 +1,26 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "ATSAM4E") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + component/gmac.h + instance/gmac.h + ethernet_phy.c + ethernet_phy.h + gmac.c + gmac.h + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/ATSAME5x/CMakeLists.txt b/source/portable/NetworkInterface/ATSAME5x/CMakeLists.txt new file mode 100644 index 0000000000..7fe7b5dd01 --- /dev/null +++ b/source/portable/NetworkInterface/ATSAME5x/CMakeLists.txt @@ -0,0 +1,20 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "ATSAME5x") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/CMakeLists.txt b/source/portable/NetworkInterface/CMakeLists.txt new file mode 100644 index 0000000000..dcf98604dd --- /dev/null +++ b/source/portable/NetworkInterface/CMakeLists.txt @@ -0,0 +1,54 @@ +add_library( freertos_plus_tcp_network_if_common STATIC ) + +target_sources( freertos_plus_tcp_network_if_common + PRIVATE + Common/phyHandling.c + include/phyHandling.h +) + +target_include_directories( freertos_plus_tcp_network_if_common + PUBLIC + include +) + +target_compile_options( freertos_plus_tcp_network_if_common + PRIVATE + $<$:-Wno-conditional-uninitialized> + $<$:-Wno-implicit-int-conversion> + $<$:-Wno-padded> + $<$:-Wno-uninitialized> + $<$:-Wno-unused-but-set-variable> + $<$:-Wno-unused-macros> +) + +target_link_libraries( freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) + +#------------------------------------------------------------------------------ +add_subdirectory(ATSAM4E) +add_subdirectory(ATSAME5x) +#add_subdirectory(board_family) - This is only an example. +add_subdirectory(DriverSAM) +add_subdirectory(esp32) +add_subdirectory(ksz8851snl) +add_subdirectory(libslirp) +add_subdirectory(linux) +add_subdirectory(LPC17xx) +add_subdirectory(LPC18xx) +add_subdirectory(LPC54018) +add_subdirectory(M487) +add_subdirectory(MPS2_AN385) +add_subdirectory(mw300_rd) +add_subdirectory(pic32mzef) +add_subdirectory(RX) +add_subdirectory(SH2A) +add_subdirectory(STM32Fxx) +add_subdirectory(STM32Hxx) +add_subdirectory(ThirdParty/MSP432) +add_subdirectory(TM4C) +add_subdirectory(WinPCap) +add_subdirectory(xilinx_ultrascale) +add_subdirectory(Zynq) diff --git a/source/portable/NetworkInterface/DriverSAM/CMakeLists.txt b/source/portable/NetworkInterface/DriverSAM/CMakeLists.txt new file mode 100644 index 0000000000..d142a9cd05 --- /dev/null +++ b/source/portable/NetworkInterface/DriverSAM/CMakeLists.txt @@ -0,0 +1,22 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "DRIVER_SAM") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + gmac_SAM.c + gmac_SAM.h + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/LPC17xx/CMakeLists.txt b/source/portable/NetworkInterface/LPC17xx/CMakeLists.txt new file mode 100644 index 0000000000..1e6ca4f1b2 --- /dev/null +++ b/source/portable/NetworkInterface/LPC17xx/CMakeLists.txt @@ -0,0 +1,28 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "LPC17xx") ) + return() +endif() + +if(NOT TARGET lpc17xx_driver) + message(FATAL_ERROR "For FREERTOS_PLUS_TCP_NETWORK_IF=LPC17xx must have a target for the lpc17xx_driver") +endif() +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_link_libraries(freertos_plus_tcp_network_if + PRIVATE + lpc17xx_driver # TODO +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/LPC18xx/CMakeLists.txt b/source/portable/NetworkInterface/LPC18xx/CMakeLists.txt new file mode 100644 index 0000000000..480acf5725 --- /dev/null +++ b/source/portable/NetworkInterface/LPC18xx/CMakeLists.txt @@ -0,0 +1,28 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "LPC18xx") ) + return() +endif() + +if(NOT TARGET lpc17xx_driver) + message(FATAL_ERROR "For FREERTOS_PLUS_TCP_NETWORK_IF=LPC18xx must have a target for the lpc18xx_driver") +endif() +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_link_libraries(freertos_plus_tcp_network_if + PRIVATE + lpc18xx_driver # TODO +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/LPC54018/CMakeLists.txt b/source/portable/NetworkInterface/LPC54018/CMakeLists.txt new file mode 100644 index 0000000000..6d444220ed --- /dev/null +++ b/source/portable/NetworkInterface/LPC54018/CMakeLists.txt @@ -0,0 +1,28 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "LPC54018") ) + return() +endif() + +if(NOT TARGET fsl_enet_driver) + message(FATAL_ERROR "For FREERTOS_PLUS_TCP_NETWORK_IF=LPC54018 must have a target for the fsl_enet_driver") +endif() +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_link_libraries(freertos_plus_tcp_network_if + PRIVATE + lpc54018_driver # TODO +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/M487/CMakeLists.txt b/source/portable/NetworkInterface/M487/CMakeLists.txt new file mode 100644 index 0000000000..8400bc6bb8 --- /dev/null +++ b/source/portable/NetworkInterface/M487/CMakeLists.txt @@ -0,0 +1,22 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "M487") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + m480_eth.c + m480_eth.h + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/MPS2_AN385/CMakeLists.txt b/source/portable/NetworkInterface/MPS2_AN385/CMakeLists.txt new file mode 100644 index 0000000000..231b4aaada --- /dev/null +++ b/source/portable/NetworkInterface/MPS2_AN385/CMakeLists.txt @@ -0,0 +1,29 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "MPS2_AN385") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + ether_lan9118/SMM_MPS2.h + ether_lan9118/smsc9220_emac_config.h + ether_lan9118/smsc9220_eth_drv.c + ether_lan9118/smsc9220_eth_drv.h + NetworkInterface.c +) + +target_include_directories( freertos_plus_tcp_network_if + PRIVATE + ether_lan9118 +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/RX/CMakeLists.txt b/source/portable/NetworkInterface/RX/CMakeLists.txt new file mode 100644 index 0000000000..9fed7027f0 --- /dev/null +++ b/source/portable/NetworkInterface/RX/CMakeLists.txt @@ -0,0 +1,22 @@ +if (NOT ( (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "RX") ) ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +# TODO What about BufferAllocation_2.c here? +target_sources( freertos_plus_tcp_network_if + PRIVATE + ether_callback.c + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/SH2A/CMakeLists.txt b/source/portable/NetworkInterface/SH2A/CMakeLists.txt new file mode 100644 index 0000000000..54f704c0de --- /dev/null +++ b/source/portable/NetworkInterface/SH2A/CMakeLists.txt @@ -0,0 +1,25 @@ +if (NOT ( (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "SH2A") ) ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +# target_link_libraries( freertos_plus_tcp_network_if +# PRIVATE +# hwEthernetLib # Todo where is hwEthernet.h? +# ) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt b/source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt new file mode 100644 index 0000000000..ad2b9d9b3d --- /dev/null +++ b/source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt @@ -0,0 +1,25 @@ +if (NOT ( (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "STM32FXX") ) ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c + # stm32f2xx_hal_eth.h + # stm32f4xx_hal_eth.h + stm32f7xx_hal_eth.h #TODO: Only one of these ? + stm32fxx_hal_eth.c + stm32fxx_hal_eth.h> +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/STM32Hxx/CMakeLists.txt b/source/portable/NetworkInterface/STM32Hxx/CMakeLists.txt new file mode 100644 index 0000000000..016f1b927c --- /dev/null +++ b/source/portable/NetworkInterface/STM32Hxx/CMakeLists.txt @@ -0,0 +1,23 @@ +if (NOT ( (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "STM32HXX") ) ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c + stm32h7xx_hal_eth.h + stm32hxx_hal_eth.c + stm32hxx_hal_eth.h +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/TM4C/CMakeLists.txt b/source/portable/NetworkInterface/TM4C/CMakeLists.txt new file mode 100644 index 0000000000..b019e71a4c --- /dev/null +++ b/source/portable/NetworkInterface/TM4C/CMakeLists.txt @@ -0,0 +1,20 @@ +if (NOT ( (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "TM4C") ) ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/ThirdParty/MSP432/CMakeLists.txt b/source/portable/NetworkInterface/ThirdParty/MSP432/CMakeLists.txt new file mode 100644 index 0000000000..fdbcc425b2 --- /dev/null +++ b/source/portable/NetworkInterface/ThirdParty/MSP432/CMakeLists.txt @@ -0,0 +1,23 @@ +if (NOT ( (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "MSP432") ) ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c + NetworkInterface.h + NetworkMiddleware.c + NetworkMiddleware.h +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/WinPCap/CMakeLists.txt b/source/portable/NetworkInterface/WinPCap/CMakeLists.txt new file mode 100644 index 0000000000..eb5f37573a --- /dev/null +++ b/source/portable/NetworkInterface/WinPCap/CMakeLists.txt @@ -0,0 +1,25 @@ +if (NOT ( (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "WIN_PCAP") ) ) + return() +endif() + +find_package(PCAP REQUIRED) + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + FaultInjection.c + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp + ${PCAP_LIBRARY} +) + diff --git a/source/portable/NetworkInterface/Zynq/CMakeLists.txt b/source/portable/NetworkInterface/Zynq/CMakeLists.txt new file mode 100644 index 0000000000..2f27c5125e --- /dev/null +++ b/source/portable/NetworkInterface/Zynq/CMakeLists.txt @@ -0,0 +1,73 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "ZYNQ") ) + return() +endif() + +if(NOT TARGET xil_bsp) + message(FATAL_ERROR "For FREERTOS_PLUS_TCP_NETWORK_IF=ZYNQ must have a target for the xil_bsp") +endif() + +# ZYNQ port shares uncached_memory.c and .h with FreeRTOS-Plus-FAT. +# Separating out so it can potentially be included there as well. +#------------------------------------------------------------------------------ +add_library(freertos_xil_uncached_memory STATIC) + +target_sources(freertos_xil_uncached_memory + PRIVATE + uncached_memory.c + uncached_memory.h +) + +target_include_directories(freertos_xil_uncached_memory + PUBLIC + . + PRIVATE + .. +) + +target_link_libraries(freertos_xil_uncached_memory + PRIVATE + freertos_kernel + freertos_plus_tcp + freertos_plus_tcp_network_if + xil_bsp +) + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) +set_property(TARGET freertos_plus_tcp_network_if PROPERTY C_STANDARD 99) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c + x_emacpsif_dma.c + x_emacpsif_hw.c + x_emacpsif_hw.h + x_emacpsif_physpeed.c + x_emacpsif.h + x_topology.h +) + +target_include_directories( freertos_plus_tcp_network_if + PRIVATE + .. +) + +target_compile_options( freertos_plus_tcp_network_if + PRIVATE + $<$:-Wno-cast-align> + $<$:-Wno-declaration-after-statement> + $<$:-Wno-padded> + $<$:-Wno-pedantic> + $<$:-Wno-unused-parameter> +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp + freertos_xil_uncached_memory + xil_bsp +) diff --git a/source/portable/NetworkInterface/board_family/CMakeLists.txt b/source/portable/NetworkInterface/board_family/CMakeLists.txt new file mode 100644 index 0000000000..03f46e4051 --- /dev/null +++ b/source/portable/NetworkInterface/board_family/CMakeLists.txt @@ -0,0 +1,20 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/esp32/CMakeLists.txt b/source/portable/NetworkInterface/esp32/CMakeLists.txt new file mode 100644 index 0000000000..899f711cca --- /dev/null +++ b/source/portable/NetworkInterface/esp32/CMakeLists.txt @@ -0,0 +1,28 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "ESP32") ) + return() +endif() + +if(NOT TARGET esp32_lib) + message(FATAL_ERROR "For FREERTOS_PLUS_TCP_NETWORK_IF=ESP32 must have a target for the esp32_lib") +endif() +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PRIVATE + esp32_lib # TODO +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/ksz8851snl/CMakeLists.txt b/source/portable/NetworkInterface/ksz8851snl/CMakeLists.txt new file mode 100644 index 0000000000..0ab28dfa81 --- /dev/null +++ b/source/portable/NetworkInterface/ksz8851snl/CMakeLists.txt @@ -0,0 +1,23 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "KSZ8851SNL") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + ksz8851snl_reg.h + ksz8851snl.c + ksz8851snl.h + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/libslirp/CMakeLists.txt b/source/portable/NetworkInterface/libslirp/CMakeLists.txt new file mode 100644 index 0000000000..3c4a94dbf6 --- /dev/null +++ b/source/portable/NetworkInterface/libslirp/CMakeLists.txt @@ -0,0 +1,29 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "LIBSLIRP") ) + return() +endif() + +if(NOT TARGET slirp) + message(FATAL_ERROR "For FREERTOS_PLUS_TCP_NETWORK_IF=LIBSLIRP must have a target for the slirp") +endif() +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + MBuffNetifBackendLibslirp.c + MBuffNetworkInterface.c +) + +target_link_libraries(freertos_plus_tcp_network_if + PRIVATE + slirp # TODO +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/linux/CMakeLists.txt b/source/portable/NetworkInterface/linux/CMakeLists.txt new file mode 100644 index 0000000000..a2354048d5 --- /dev/null +++ b/source/portable/NetworkInterface/linux/CMakeLists.txt @@ -0,0 +1,33 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "POSIX") ) + return() +endif() + +find_package(PCAP REQUIRED) +set(THREADS_PREFER_PTHREAD_FLAG TRUE) +find_package(Threads) + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_compile_options( freertos_plus_tcp_network_if + PRIVATE + $<$:-Wno-cast-align> + $<$:-Wno-declaration-after-statement> + $<$:-Wno-padded> +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp + ${PCAP_LIBRARY} + Threads::Threads +) diff --git a/source/portable/NetworkInterface/mw300_rd/CMakeLists.txt b/source/portable/NetworkInterface/mw300_rd/CMakeLists.txt new file mode 100644 index 0000000000..974008c93e --- /dev/null +++ b/source/portable/NetworkInterface/mw300_rd/CMakeLists.txt @@ -0,0 +1,20 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "MW300_RD") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/pic32mzef/CMakeLists.txt b/source/portable/NetworkInterface/pic32mzef/CMakeLists.txt new file mode 100644 index 0000000000..31f5ff6ea3 --- /dev/null +++ b/source/portable/NetworkInterface/pic32mzef/CMakeLists.txt @@ -0,0 +1,23 @@ +if (NOT ( (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "PIC32MZEF_ETH") OR + (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "PIC32MZEF_WIFI") ) ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +# TODO What about BufferAllocation_2.c here? +target_sources( freertos_plus_tcp_network_if + PRIVATE + $<$:NetworkInterface_eth.c> + $<$:NetworkInterface_wifi.c> +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp +) diff --git a/source/portable/NetworkInterface/xilinx_ultrascale/CMakeLists.txt b/source/portable/NetworkInterface/xilinx_ultrascale/CMakeLists.txt new file mode 100644 index 0000000000..674a1dc506 --- /dev/null +++ b/source/portable/NetworkInterface/xilinx_ultrascale/CMakeLists.txt @@ -0,0 +1,70 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "XILINX_ULTRASCALE") ) + return() +endif() + +if(NOT TARGET xil_bsp) + message(FATAL_ERROR "For FREERTOS_PLUS_TCP_NETWORK_IF=XILINX_ULTRASCALE must have a target for the xil_bsp") +endif() + +# XILINX_ULTRASCALE port shares uncached_memory.c and .h with FreeRTOS-Plus-FAT. +# Separating out so it can potentially be included there as well. +#------------------------------------------------------------------------------ +add_library(freertos_xil_uncached_memory STATIC) + +target_sources(freertos_xil_uncached_memory + PRIVATE + uncached_memory.c + uncached_memory.h +) + +target_include_directories(freertos_xil_uncached_memory + PUBLIC + . + PRIVATE + .. +) + +target_link_libraries(freertos_xil_uncached_memory + PRIVATE + freertos_kernel + freertos_plus_tcp + freertos_plus_tcp_network_if + xil_bsp +) + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + NetworkInterface.c + x_emacpsif_dma.c + x_emacpsif_hw.c + x_emacpsif_hw.h + x_emacpsif_physpeed.c + x_emacpsif.h + x_topology.h +) + +target_include_directories( freertos_plus_tcp_network_if + PRIVATE + .. +) + +target_compile_options( freertos_plus_tcp_network_if + PRIVATE + $<$:-Wno-cast-align> + $<$:-Wno-declaration-after-statement> + $<$:-Wno-padded> +) + +target_link_libraries( freertos_plus_tcp_network_if + PUBLIC + freertos_plus_tcp_port + freertos_plus_tcp_network_if_common + PRIVATE + freertos_kernel + freertos_plus_tcp + freertos_xil_uncached_memory + xil_bsp +) From 50d2e8b0ad175382d95bd48bb95f547c067d43a3 Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Fri, 4 Nov 2022 21:44:03 -0700 Subject: [PATCH 17/21] Updating warning list in code. --- source/portable/NetworkInterface/linux/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/portable/NetworkInterface/linux/CMakeLists.txt b/source/portable/NetworkInterface/linux/CMakeLists.txt index a2354048d5..0b2e44cbd6 100644 --- a/source/portable/NetworkInterface/linux/CMakeLists.txt +++ b/source/portable/NetworkInterface/linux/CMakeLists.txt @@ -18,7 +18,13 @@ target_compile_options( freertos_plus_tcp_network_if PRIVATE $<$:-Wno-cast-align> $<$:-Wno-declaration-after-statement> + $<$:-Wno-documentation> + $<$:-Wno-missing-noreturn> $<$:-Wno-padded> + $<$:-Wno-shorten-64-to-32> + $<$:-Wno-undef> + $<$:-Wno-unused-macros> + $<$:-Wno-unused-parameter> ) target_link_libraries( freertos_plus_tcp_network_if From eb9653ae8f5861f03df6c0fdcc7c232fabb8617d Mon Sep 17 00:00:00 2001 From: Paul Helter Date: Fri, 4 Nov 2022 21:46:02 -0700 Subject: [PATCH 18/21] Fixed formatting with uncrustify. --- source/FreeRTOS_IP.c | 2 +- source/FreeRTOS_Sockets.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/FreeRTOS_IP.c b/source/FreeRTOS_IP.c index 360cc3ede1..c90d055125 100644 --- a/source/FreeRTOS_IP.c +++ b/source/FreeRTOS_IP.c @@ -56,7 +56,7 @@ #include "FreeRTOS_DNS.h" #if ( ipconfigUSE_TCP_MEM_STATS != 0 ) -#include "tcp_mem_stats.h" + #include "tcp_mem_stats.h" #endif /* IPv4 multi-cast addresses range from 224.0.0.0.0 to 240.0.0.0. */ diff --git a/source/FreeRTOS_Sockets.c b/source/FreeRTOS_Sockets.c index 5b159232d9..d78c19cba2 100644 --- a/source/FreeRTOS_Sockets.c +++ b/source/FreeRTOS_Sockets.c @@ -51,7 +51,7 @@ #include "NetworkBufferManagement.h" #if ( ipconfigUSE_TCP_MEM_STATS != 0 ) -#include "tcp_mem_stats.h" + #include "tcp_mem_stats.h" #endif /* The ItemValue of the sockets xBoundSocketListItem member holds the socket's From 79985b2717c6ceb50971fe4262f5637e4716d0bb Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu, 23 Feb 2023 18:08:08 +0000 Subject: [PATCH 19/21] Fix failing tests --- source/FreeRTOS_TCP_IP.c | 6 +++--- test/build-combination/Common/FreeRTOSConfig.h | 7 ------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/source/FreeRTOS_TCP_IP.c b/source/FreeRTOS_TCP_IP.c index 62248bcfb5..995173573d 100644 --- a/source/FreeRTOS_TCP_IP.c +++ b/source/FreeRTOS_TCP_IP.c @@ -634,6 +634,9 @@ /* Function might modify the parameter. */ NetworkBufferDescriptor_t * pxNetworkBuffer = pxDescriptor; + configASSERT( pxNetworkBuffer != NULL ); + configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); + /* Map the buffer onto a ProtocolHeaders_t struct for easy access to the fields. */ /* MISRA Ref 11.3.1 [Misaligned access] */ @@ -653,9 +656,6 @@ const IPHeader_t * pxIPHeader; - configASSERT( pxNetworkBuffer != NULL ); - configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); - /* Check for a minimum packet size. */ if( pxNetworkBuffer->xDataLength < ( ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) + ipSIZE_OF_TCP_HEADER ) ) { diff --git a/test/build-combination/Common/FreeRTOSConfig.h b/test/build-combination/Common/FreeRTOSConfig.h index 4ba6dc1376..a7f7d86bad 100644 --- a/test/build-combination/Common/FreeRTOSConfig.h +++ b/test/build-combination/Common/FreeRTOSConfig.h @@ -114,18 +114,11 @@ * functions. */ #define configUSE_STATS_FORMATTING_FUNCTIONS 1 -/* Assert call defined for debug builds. */ -void vAssertCalled( const char * pcFile, - unsigned long ulLine ); - -#define configASSERT( x ) - /* The function that implements FreeRTOS printf style output, and the macro * that maps the configPRINTF() macros to that function. */ #define configPRINTF( X ) /* Non-format version thread-safe print. */ -extern void vLoggingPrint( const char * pcMessage ); #define configPRINT( X ) /* Non-format version thread-safe print. */ From f12741dbc21f1804146424b6afebf20037a05a1d Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu, 23 Feb 2023 18:29:07 +0000 Subject: [PATCH 20/21] Fix failing unit-test --- source/FreeRTOS_UDP_IP.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/FreeRTOS_UDP_IP.c b/source/FreeRTOS_UDP_IP.c index d12137d8ee..b5249e4302 100644 --- a/source/FreeRTOS_UDP_IP.c +++ b/source/FreeRTOS_UDP_IP.c @@ -311,6 +311,9 @@ BaseType_t xProcessReceivedUDPPacket( NetworkBufferDescriptor_t * pxNetworkBuffe BaseType_t xReturn = pdPASS; FreeRTOS_Socket_t * pxSocket; + configASSERT( pxNetworkBuffer != NULL ); + configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); + /* Map the ethernet buffer to the UDPPacket_t struct for easy access to the fields. */ /* MISRA Ref 11.3.1 [Misaligned access] */ @@ -318,9 +321,6 @@ BaseType_t xProcessReceivedUDPPacket( NetworkBufferDescriptor_t * pxNetworkBuffe /* coverity[misra_c_2012_rule_11_3_violation] */ const UDPPacket_t * pxUDPPacket = ( ( const UDPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer ); - configASSERT( pxNetworkBuffer != NULL ); - configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); - /* Caller must check for minimum packet size. */ pxSocket = pxUDPSocketLookup( usPort ); From 97a3c4d9224d4b7e7a8f39fede4ea93220e4f1ad Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu, 23 Feb 2023 18:51:13 +0000 Subject: [PATCH 21/21] Fix a typo. --- source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt b/source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt index ad2b9d9b3d..cfe8f1c1f1 100644 --- a/source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt +++ b/source/portable/NetworkInterface/STM32Fxx/CMakeLists.txt @@ -12,7 +12,7 @@ target_sources( freertos_plus_tcp_network_if # stm32f4xx_hal_eth.h stm32f7xx_hal_eth.h #TODO: Only one of these ? stm32fxx_hal_eth.c - stm32fxx_hal_eth.h> + stm32fxx_hal_eth.h ) target_link_libraries( freertos_plus_tcp_network_if