diff --git a/CMakeLists.txt b/CMakeLists.txt index 18c3ca51d..1f31f011e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,11 +59,13 @@ set(FREERTOS_PLUS_TCP_NETWORK_IF_LIST ESP32 KSZ8851SNL LIBSLIRP + LOOPBACK LPC17xx LPC18xx LPC54018 M487 MPS2_AN385 MPS3_AN552 MW300_RD + NXP1060 PIC32MZEF_ETH PIC32MZEF_WIFI POSIX WIN_PCAP # Native Linux & Windows respectively RX @@ -73,6 +75,7 @@ set(FREERTOS_PLUS_TCP_NETWORK_IF_LIST TM4C XILINX_ULTRASCALE ZYNQ # AMD/Xilinx ) + if(NOT FREERTOS_PLUS_TCP_NETWORK_IF) # Attempt to detect the system. if(UNIX) @@ -100,6 +103,7 @@ if(NOT FREERTOS_PLUS_TCP_NETWORK_IF IN_LIST FREERTOS_PLUS_TCP_NETWORK_IF_LIST ) " KSZ8851SNL Target: ksz8851snl Tested: TODO\n" " LIBSLIRP Target: libslirp Tested: TODO\n" " POSIX Target: linux/Posix\n" + " LOOPBACK Target: loopback Tested: TODO\n" " LPC17xx Target: LPC17xx Tested: TODO\n" " LPC18xx Target: LPC18xx Tested: TODO\n" " LPC54018 Target: LPC54018 Tested: TODO\n" @@ -107,6 +111,7 @@ if(NOT FREERTOS_PLUS_TCP_NETWORK_IF IN_LIST FREERTOS_PLUS_TCP_NETWORK_IF_LIST ) " MPS2_AN385 Target: MPS2_AN385 Tested: TODO\n" " MPS3_AN552 Target: MPS3_AN552" " MW300_RD Target: mw300_rd Tested: TODO\n" + " NXP1060 Target: NXP1060 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" @@ -171,54 +176,6 @@ else() endif() endif() -######################################################################## -# 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> - $<$:-Werror> - $<$:-Wpedantic> - $<$:-Wconversion> - $<$:-Wunused-variable> - $<$:-Weverything> - - # Suppressions required to build clean with clang. - $<$:-Wno-unused-macros> - $<$:-Wno-cast-qual> - $<$:-Wno-switch-enum> - $<$:-Wno-declaration-after-statement> - $<$:-Wno-padded> - $<$:-Wno-missing-variable-declarations> - $<$:-Wno-covered-switch-default> - $<$:-Wno-extra-semi-stmt> - $<$:-Wno-missing-noreturn> - $<$:-Wno-cast-align> -) - ######################################################################## # External Dependencies # Note: For backwards compatibility - still have .gitmodules defining submodules @@ -243,11 +200,3 @@ 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() diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 61debbdeb..ccda4fd50 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -4,8 +4,6 @@ set_property(TARGET freertos_plus_tcp PROPERTY C_STANDARD 90) target_sources( freertos_plus_tcp PRIVATE - include/FreeRTOSIPConfigDefaults.h - include/FreeRTOSIPDeprecatedDefinitions.h include/FreeRTOS_ARP.h include/FreeRTOS_BitConfig.h include/FreeRTOS_DHCP.h @@ -41,6 +39,8 @@ target_sources( freertos_plus_tcp include/FreeRTOS_TCP_Utils.h include/FreeRTOS_TCP_WIN.h include/FreeRTOS_UDP_IP.h + include/FreeRTOSIPConfigDefaults.h + include/FreeRTOSIPDeprecatedDefinitions.h include/IPTraceMacroDefaults.h include/NetworkBufferManagement.h include/NetworkInterface.h diff --git a/source/portable/NetworkInterface/CMakeLists.txt b/source/portable/NetworkInterface/CMakeLists.txt index 46a21ea29..165c1acab 100644 --- a/source/portable/NetworkInterface/CMakeLists.txt +++ b/source/portable/NetworkInterface/CMakeLists.txt @@ -36,12 +36,14 @@ add_subdirectory(esp32) add_subdirectory(ksz8851snl) add_subdirectory(libslirp) add_subdirectory(linux) +add_subdirectory(loopback) add_subdirectory(LPC17xx) add_subdirectory(LPC18xx) add_subdirectory(LPC54018) add_subdirectory(M487) add_subdirectory(MPS2_AN385) add_subdirectory(MPS3_AN552) +add_subdirectory(NXP1060) add_subdirectory(mw300_rd) add_subdirectory(pic32mzef) add_subdirectory(RX) diff --git a/source/portable/NetworkInterface/NXP1060/CMakeLists.txt b/source/portable/NetworkInterface/NXP1060/CMakeLists.txt new file mode 100644 index 000000000..a73602700 --- /dev/null +++ b/source/portable/NetworkInterface/NXP1060/CMakeLists.txt @@ -0,0 +1,20 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "NXP1060") ) + 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/Zynq/CMakeLists.txt b/source/portable/NetworkInterface/Zynq/CMakeLists.txt index 2f27c5125..6f4f75807 100644 --- a/source/portable/NetworkInterface/Zynq/CMakeLists.txt +++ b/source/portable/NetworkInterface/Zynq/CMakeLists.txt @@ -34,7 +34,7 @@ target_link_libraries(freertos_xil_uncached_memory #------------------------------------------------------------------------------ add_library( freertos_plus_tcp_network_if STATIC ) -set_property(TARGET freertos_plus_tcp_network_if PROPERTY C_STANDARD 99) +set_property(TARGET freertos_plus_tcp_network_if PROPERTY C_STANDARD 90) target_sources( freertos_plus_tcp_network_if PRIVATE diff --git a/source/portable/NetworkInterface/loopback/CMakeLists.txt b/source/portable/NetworkInterface/loopback/CMakeLists.txt new file mode 100644 index 000000000..c473dcbfa --- /dev/null +++ b/source/portable/NetworkInterface/loopback/CMakeLists.txt @@ -0,0 +1,20 @@ +if (NOT (FREERTOS_PLUS_TCP_NETWORK_IF STREQUAL "LOOPBACK") ) + return() +endif() + +#------------------------------------------------------------------------------ +add_library( freertos_plus_tcp_network_if STATIC ) + +target_sources( freertos_plus_tcp_network_if + PRIVATE + loopbackNetworkInterface.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/test/Coverity/CMakeLists.txt b/test/Coverity/CMakeLists.txt index b2ae40306..b098e37fa 100644 --- a/test/Coverity/CMakeLists.txt +++ b/test/Coverity/CMakeLists.txt @@ -1,5 +1,5 @@ # Minimum required version of CMake -cmake_minimum_required ( VERSION 3.13.0 ) +cmake_minimum_required ( VERSION 3.15.0 ) # Name of the project project ( "FreeRTOS+TCP Static analysis" diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index 45330b6be..23505fca3 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -74,6 +74,35 @@ else() add_library( freertos_config ALIAS freertos_plus_tcp_config_default) endif() +# FreeRTOS-Plus-TCP compilation options configuration +target_compile_options(freertos_plus_tcp + PRIVATE + + ### Gnu/Clang C Options + $<$:-fdiagnostics-color=always> + $<$:-fcolor-diagnostics> + + $<$:-Wall> + $<$:-Wextra> + $<$:-Werror> + $<$:-Wpedantic> + $<$:-Wconversion> + $<$:-Wunused-variable> + $<$:-Weverything> + + # Suppressions required to build clean with clang. + $<$:-Wno-unused-macros> + $<$:-Wno-cast-qual> + $<$:-Wno-switch-enum> + $<$:-Wno-declaration-after-statement> + $<$:-Wno-padded> + $<$:-Wno-missing-variable-declarations> + $<$:-Wno-covered-switch-default> + $<$:-Wno-extra-semi-stmt> + $<$:-Wno-missing-noreturn> + $<$:-Wno-cast-align> +) + # Common build combination test. add_executable(freertos_plus_tcp_build_test EXCLUDE_FROM_ALL) diff --git a/test/unit-test/CMakeLists.txt b/test/unit-test/CMakeLists.txt index 2f73c52d7..b93680075 100644 --- a/test/unit-test/CMakeLists.txt +++ b/test/unit-test/CMakeLists.txt @@ -1,5 +1,5 @@ # Set the required version. -cmake_minimum_required( VERSION 3.13.0 ) +cmake_minimum_required( VERSION 3.15.0 ) # Set the unit-test project. project( "FreeRTOS-Plus-TCP test" @@ -311,40 +311,40 @@ include( ${UNIT_TEST_DIR}/FreeRTOS_Routing_ConfigCompatibleWithSingle/ut.cmake ) add_custom_target( coverage COMMAND ${CMAKE_COMMAND} -P ${MODULE_ROOT_DIR}/test/unit-test/cmock/coverage.cmake DEPENDS cmock unity - FreeRTOS_ARP_utest +FreeRTOS_ARP_utest + FreeRTOS_ARP_DataLenLessThanMinPacket_utest FreeRTOS_BitConfig_utest FreeRTOS_DHCP_utest FreeRTOS_DHCPv6_utest - FreeRTOS_UDP_IP_utest - FreeRTOS_UDP_IPv4_utest - FreeRTOS_UDP_IPv6_utest + FreeRTOS_DNS_utest + FreeRTOS_DNS_Cache_utest + FreeRTOS_DNS_Callback_utest + FreeRTOS_DNS_ConfigNoCallback_utest + FreeRTOS_DNS_Networking_utest + FreeRTOS_DNS_Parser_utest + FreeRTOS_ICMP_utest + FreeRTOS_ICMP_wo_assert_utest FreeRTOS_IP_utest FreeRTOS_IP_DiffConfig_utest FreeRTOS_IP_DiffConfig1_utest FreeRTOS_IP_DiffConfig2_utest FreeRTOS_IP_DiffConfig3_utest - FreeRTOS_ICMP_utest + FreeRTOS_IP_Timers_utest FreeRTOS_IP_Utils_utest FreeRTOS_IP_Utils_DiffConfig_utest + FreeRTOS_IPv4_utest + FreeRTOS_IPv4_DiffConfig_utest + FreeRTOS_IPv4_DiffConfig1_utest + FreeRTOS_IPv4_Sockets_utest FreeRTOS_IPv4_Utils_utest + FreeRTOS_IPv6_utest + FreeRTOS_IPv6_ConfigDriverCheckChecksum_utest FreeRTOS_IPv6_Utils_utest - FreeRTOS_IP_Timers_utest - FreeRTOS_Stream_Buffer_utest - FreeRTOS_DNS_utest - FreeRTOS_DNS_ConfigNoCallback_utest FreeRTOS_ND_utest FreeRTOS_RA_utest - FreeRTOS_TCP_WIN_utest - FreeRTOS_Tiny_TCP_utest - FreeRTOS_TCP_Reception_utest - FreeRTOS_TCP_State_Handling_utest - FreeRTOS_TCP_State_Handling_IPv4_utest - FreeRTOS_TCP_State_Handling_IPv6_utest - FreeRTOS_TCP_Transmission - FreeRTOS_TCP_Transmission_IPv6 - FreeRTOS_TCP_IP - FreeRTOS_TCP_Utils - FreeRTOS_TCP_Utils_IPv6_utest + FreeRTOS_Routing_utest + FreeRTOS_Routing_ConfigCompatibleWithSingle_utest + FreeRTOS_Routing_ConfigV4Only_utest FreeRTOS_Sockets_GenericAPI_utest FreeRTOS_Sockets_privates_utest FreeRTOS_Sockets_TCP_API_utest @@ -355,15 +355,22 @@ add_custom_target( coverage FreeRTOS_Sockets_DiffConfig1_TCP_API_utest FreeRTOS_Sockets_DiffConfig1_UDP_API_utest FreeRTOS_Sockets_IPv6_utest - FreeRTOS_IPv6_utest - FreeRTOS_IPv6_ConfigDriverCheckChecksum_utest - FreeRTOS_IPv4_utest - FreeRTOS_IPv4_DiffConfig_utest - FreeRTOS_IPv4_DiffConfig1_utest - FreeRTOS_IPv4_Sockets_utest - FreeRTOS_Routing_utest - FreeRTOS_Routing_ConfigV4Only_utest - FreeRTOS_Routing_ConfigCompatibleWithSingle_utest + FreeRTOS_Stream_Buffer_utest + FreeRTOS_TCP_IP_utest + FreeRTOS_TCP_IP_DiffConfig_utest + FreeRTOS_TCP_Reception_utest + FreeRTOS_TCP_State_Handling_utest + FreeRTOS_TCP_State_Handling_IPv4_utest + FreeRTOS_TCP_State_Handling_IPv6_utest + FreeRTOS_TCP_Transmission_utest + FreeRTOS_TCP_Transmission_IPv6_utest + FreeRTOS_TCP_Utils_utest + FreeRTOS_TCP_Utils_IPv6_utest + FreeRTOS_TCP_WIN_utest + FreeRTOS_Tiny_TCP_utest + FreeRTOS_UDP_IP_utest + FreeRTOS_UDP_IPv4_utest + FreeRTOS_UDP_IPv6_utest WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) diff --git a/test/unit-test/ConfigFiles/IPTraceMacroDefaults.h b/test/unit-test/ConfigFiles/IPTraceMacroDefaults.h deleted file mode 100644 index 85b981196..000000000 --- a/test/unit-test/ConfigFiles/IPTraceMacroDefaults.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - -/* This file provides default (empty) implementations for any IP trace macros - * that are not defined by the user. See - * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Trace.html */ - -#ifndef UDP_TRACE_MACRO_DEFAULTS_H -#define UDP_TRACE_MACRO_DEFAULTS_H - -#ifndef iptraceNETWORK_DOWN - #define iptraceNETWORK_DOWN() -#endif - -#ifndef iptraceNETWORK_BUFFER_RELEASED - #define iptraceNETWORK_BUFFER_RELEASED( pxBufferAddress ) -#endif - -#ifndef iptraceNETWORK_BUFFER_OBTAINED - #define iptraceNETWORK_BUFFER_OBTAINED( pxBufferAddress ) -#endif - -#ifndef iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR - #define iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR( pxBufferAddress ) -#endif - -#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER - #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER() -#endif - -#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR - #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR() -#endif - -#ifndef iptraceCREATING_ARP_REQUEST - #define iptraceCREATING_ARP_REQUEST( ulIPAddress ) -#endif - -#ifndef iptraceARP_TABLE_ENTRY_WILL_EXPIRE - #define iptraceARP_TABLE_ENTRY_WILL_EXPIRE( ulIPAddress ) -#endif - -#ifndef iptraceARP_TABLE_ENTRY_EXPIRED - #define iptraceARP_TABLE_ENTRY_EXPIRED( ulIPAddress ) -#endif - -#ifndef iptraceARP_TABLE_ENTRY_CREATED - #define iptraceARP_TABLE_ENTRY_CREATED( ulIPAddress, ucMACAddress ) -#endif - -#ifndef iptraceSENDING_UDP_PACKET - #define iptraceSENDING_UDP_PACKET( ulIPAddress ) -#endif - -#ifndef iptracePACKET_DROPPED_TO_GENERATE_ARP - #define iptracePACKET_DROPPED_TO_GENERATE_ARP( ulIPAddress ) -#endif - -#ifndef iptraceICMP_PACKET_RECEIVED - #define iptraceICMP_PACKET_RECEIVED() -#endif - -#ifndef iptraceSENDING_PING_REPLY - #define iptraceSENDING_PING_REPLY( ulIPAddress ) -#endif - -#ifndef traceARP_PACKET_RECEIVED - #define traceARP_PACKET_RECEIVED() -#endif - -#ifndef iptracePROCESSING_RECEIVED_ARP_REPLY - #define iptracePROCESSING_RECEIVED_ARP_REPLY( ulIPAddress ) -#endif - -#ifndef iptraceSENDING_ARP_REPLY - #define iptraceSENDING_ARP_REPLY( ulIPAddress ) -#endif - -#ifndef iptraceFAILED_TO_CREATE_SOCKET - #define iptraceFAILED_TO_CREATE_SOCKET() -#endif - -#ifndef iptraceFAILED_TO_CREATE_EVENT_GROUP - #define iptraceFAILED_TO_CREATE_EVENT_GROUP() -#endif - -#ifndef iptraceRECVFROM_DISCARDING_BYTES - #define iptraceRECVFROM_DISCARDING_BYTES( xNumberOfBytesDiscarded ) -#endif - -#ifndef iptraceETHERNET_RX_EVENT_LOST - #define iptraceETHERNET_RX_EVENT_LOST() -#endif - -#ifndef iptraceSTACK_TX_EVENT_LOST - #define iptraceSTACK_TX_EVENT_LOST( xEvent ) -#endif - -#ifndef iptraceNETWORK_EVENT_RECEIVED - #define iptraceNETWORK_EVENT_RECEIVED( eEvent ) -#endif - -#ifndef iptraceBIND_FAILED - #define iptraceBIND_FAILED( xSocket, usPort ) -#endif - -#ifndef iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS - #define iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS( ulIPAddress ) -#endif - -#ifndef iptraceSENDING_DHCP_DISCOVER - #define iptraceSENDING_DHCP_DISCOVER() -#endif - -#ifndef iptraceSENDING_DHCP_REQUEST - #define iptraceSENDING_DHCP_REQUEST() -#endif - -#ifndef iptraceDHCP_SUCCEEDED - #define iptraceDHCP_SUCCEEDED( address ) -#endif - -#ifndef iptraceNETWORK_INTERFACE_TRANSMIT - #define iptraceNETWORK_INTERFACE_TRANSMIT() -#endif - -#ifndef iptraceNETWORK_INTERFACE_RECEIVE - #define iptraceNETWORK_INTERFACE_RECEIVE() -#endif - -#ifndef iptraceSENDING_DNS_REQUEST - #define iptraceSENDING_DNS_REQUEST() -#endif - -#ifndef iptraceWAITING_FOR_TX_DMA_DESCRIPTOR - #define iptraceWAITING_FOR_TX_DMA_DESCRIPTOR() -#endif - -#ifndef ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS - #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS 0 -#endif - -#ifndef iptraceFAILED_TO_NOTIFY_SELECT_GROUP - #define iptraceFAILED_TO_NOTIFY_SELECT_GROUP( xSocket ) -#endif - -#ifndef pvPortMallocSocket - #define pvPortMallocSocket( xSize ) pvPortMalloc( ( xSize ) ) -#endif - -#ifndef iptraceRECVFROM_TIMEOUT - #define iptraceRECVFROM_TIMEOUT() -#endif - -#ifndef iptraceRECVFROM_INTERRUPTED - #define iptraceRECVFROM_INTERRUPTED() -#endif - -#ifndef iptraceNO_BUFFER_FOR_SENDTO - #define iptraceNO_BUFFER_FOR_SENDTO() -#endif - -#ifndef iptraceSENDTO_SOCKET_NOT_BOUND - #define iptraceSENDTO_SOCKET_NOT_BOUND() -#endif - -#ifndef iptraceSENDTO_DATA_TOO_LONG - #define iptraceSENDTO_DATA_TOO_LONG() -#endif - -#endif /* UDP_TRACE_MACRO_DEFAULTS_H */ diff --git a/test/unit-test/ConfigFiles/NetworkBufferManagement.h b/test/unit-test/ConfigFiles/NetworkBufferManagement.h deleted file mode 100644 index 0b3b3e9aa..000000000 --- a/test/unit-test/ConfigFiles/NetworkBufferManagement.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - -#ifndef NETWORK_BUFFER_MANAGEMENT_H - #define NETWORK_BUFFER_MANAGEMENT_H - - #ifdef __cplusplus - extern "C" { - #endif - -/* NOTE PUBLIC API FUNCTIONS. */ - BaseType_t xNetworkBuffersInitialise( void ); - NetworkBufferDescriptor_t * pxGetNetworkBufferWithDescriptor( size_t xRequestedSizeBytes, - TickType_t xBlockTimeTicks ); - NetworkBufferDescriptor_t * pxNetworkBufferGetFromISR( size_t xRequestedSizeBytes ); - void vReleaseNetworkBufferAndDescriptor( NetworkBufferDescriptor_t * const pxNetworkBuffer ); - BaseType_t vNetworkBufferReleaseFromISR( NetworkBufferDescriptor_t * const pxNetworkBuffer ); - uint8_t * pucGetNetworkBuffer( size_t * pxRequestedSizeBytes ); - void vReleaseNetworkBuffer( uint8_t * pucEthernetBuffer ); - -/* Get the current number of free network buffers. */ - UBaseType_t uxGetNumberOfFreeNetworkBuffers( void ); - -/* Get the lowest number of free network buffers. */ - UBaseType_t uxGetMinimumFreeNetworkBuffers( void ); - -/* Copy a network buffer into a bigger buffer. */ - NetworkBufferDescriptor_t * pxDuplicateNetworkBufferWithDescriptor( NetworkBufferDescriptor_t * const pxNetworkBuffer, - size_t uxNewLength ); - -/* Increase the size of a Network Buffer. - * In case BufferAllocation_2.c is used, the new space must be allocated. */ - NetworkBufferDescriptor_t * pxResizeNetworkBufferWithDescriptor( NetworkBufferDescriptor_t * pxNetworkBuffer, - size_t xNewSizeBytes ); - - #if ipconfigTCP_IP_SANITY - -/* - * Check if an address is a valid pointer to a network descriptor - * by looking it up in the array of network descriptors - */ - UBaseType_t bIsValidNetworkDescriptor( const NetworkBufferDescriptor_t * pxDesc ); - BaseType_t prvIsFreeBuffer( const NetworkBufferDescriptor_t * pxDescr ); - #endif - - #ifdef __cplusplus -} /* extern "C" */ - #endif - -#endif /* NETWORK_BUFFER_MANAGEMENT_H */ diff --git a/test/unit-test/ConfigFiles/NetworkInterface.h b/test/unit-test/ConfigFiles/NetworkInterface.h deleted file mode 100644 index d682fcfa9..000000000 --- a/test/unit-test/ConfigFiles/NetworkInterface.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - -#ifndef NETWORK_INTERFACE_H - #define NETWORK_INTERFACE_H - - #ifdef __cplusplus - extern "C" { - #endif - -/* NOTE PUBLIC API FUNCTIONS. */ - BaseType_t xNetworkInterfaceInitialise( void ); - BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer, - BaseType_t xReleaseAfterSend ); - void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] ); - BaseType_t xGetPhyLinkStatus( void ); - - #ifdef __cplusplus -} /* extern "C" */ - #endif - -#endif /* NETWORK_INTERFACE_H */ diff --git a/test/unit-test/FreeRTOS_DNS_Cache/FreeRTOS_UDP_IP_stubs.c b/test/unit-test/FreeRTOS_DNS_Cache/FreeRTOS_DNS_Cache_stubs.c similarity index 100% rename from test/unit-test/FreeRTOS_DNS_Cache/FreeRTOS_UDP_IP_stubs.c rename to test/unit-test/FreeRTOS_DNS_Cache/FreeRTOS_DNS_Cache_stubs.c diff --git a/test/unit-test/FreeRTOS_DNS_Cache/ut.cmake b/test/unit-test/FreeRTOS_DNS_Cache/ut.cmake index ba26da63c..6c20e1210 100755 --- a/test/unit-test/FreeRTOS_DNS_Cache/ut.cmake +++ b/test/unit-test/FreeRTOS_DNS_Cache/ut.cmake @@ -44,7 +44,7 @@ add_compile_options(-Wno-pedantic -Wno-div-by-zero -O0 -ggdb3) set(real_source_files "" ) list(APPEND real_source_files - ${project_name}/FreeRTOS_UDP_IP_stubs.c + ${project_name}/${project_name}_stubs.c ${MODULE_ROOT_DIR}/source/FreeRTOS_DNS_Cache.c ) # list the directories the module under test includes diff --git a/test/unit-test/FreeRTOS_DNS_Callback/FreeRTOS_UDP_IP_stubs.c b/test/unit-test/FreeRTOS_DNS_Callback/FreeRTOS_DNS_Callback_stubs.c similarity index 100% rename from test/unit-test/FreeRTOS_DNS_Callback/FreeRTOS_UDP_IP_stubs.c rename to test/unit-test/FreeRTOS_DNS_Callback/FreeRTOS_DNS_Callback_stubs.c diff --git a/test/unit-test/FreeRTOS_DNS_Callback/ut.cmake b/test/unit-test/FreeRTOS_DNS_Callback/ut.cmake index f1f1483dc..e1962eaaa 100644 --- a/test/unit-test/FreeRTOS_DNS_Callback/ut.cmake +++ b/test/unit-test/FreeRTOS_DNS_Callback/ut.cmake @@ -45,7 +45,7 @@ add_compile_options(-Wno-pedantic -Wno-div-by-zero -O0 -ggdb3) # list the files you would like to test here set(real_source_files "") list(APPEND real_source_files - ${project_name}/FreeRTOS_UDP_IP_stubs.c + ${project_name}/${project_name}_stubs.c ${MODULE_ROOT_DIR}/source/FreeRTOS_DNS_Callback.c ) # list the directories the module under test includes diff --git a/test/unit-test/FreeRTOS_DNS_Networking/FreeRTOS_UDP_IP_stubs.c b/test/unit-test/FreeRTOS_DNS_Networking/FreeRTOS_DNS_Networking_stubs.c similarity index 100% rename from test/unit-test/FreeRTOS_DNS_Networking/FreeRTOS_UDP_IP_stubs.c rename to test/unit-test/FreeRTOS_DNS_Networking/FreeRTOS_DNS_Networking_stubs.c diff --git a/test/unit-test/FreeRTOS_DNS_Networking/ut.cmake b/test/unit-test/FreeRTOS_DNS_Networking/ut.cmake index 780f6301a..36328c338 100644 --- a/test/unit-test/FreeRTOS_DNS_Networking/ut.cmake +++ b/test/unit-test/FreeRTOS_DNS_Networking/ut.cmake @@ -40,7 +40,7 @@ add_compile_options(-Wno-pedantic -Wno-div-by-zero -O0 -ggdb3) set(real_source_files "" ) list(APPEND real_source_files - ${project_name}/FreeRTOS_UDP_IP_stubs.c + ${project_name}/${project_name}_stubs.c ${MODULE_ROOT_DIR}/source/FreeRTOS_DNS_Networking.c ) # list the directories the module under test includes diff --git a/test/unit-test/README.md b/test/unit-test/README.md index 4d563ba4a..685c505dd 100644 --- a/test/unit-test/README.md +++ b/test/unit-test/README.md @@ -18,18 +18,18 @@ project successfully, you must have the following: - Not found? Try `apt-get install make`. 2. Ruby (You can check whether you have this by typing `ruby --version`) - Not found? Try `apt-get install ruby`. -3. CMake version > 3.13.0 (You can check whether you have this by typing +3. CMake version > 3.15.0 (You can check whether you have this by typing `cmake --version`) - Not found? Try `apt-get install cmake` - Try the `cmake --version` command. If still the version number is >= - 3.13.0, skip to (4.) or else, continue. + 3.15.0, skip to (4.) or else, continue. - You will need to get the latest CMake version using curl or wget (or similar command). - Uninstall the current version of CMake using `sudo apt remove --purge --auto-remove cmake`. - - Download the [CMAKE version 3.13.0](https://cmake.org/files/v3.13/). - - Extract the cmake download using `tar -xzvf cmake-3.13.0.tar.gz`. - - Go to the extracted folder (`cd cmake-3.13.0`) and run `./bootstrap`. + - Download the [CMAKE version 3.15.0](https://cmake.org/files/v3.15/). + - Extract the cmake download using `tar -xzvf cmake-3.15.0.tar.gz`. + - Go to the extracted folder (`cd cmake-3.15.0`) and run `./bootstrap`. - Run `make -j$(nproc)' and then run `sudo make install`. - Check the version using `cmake --version` command. 4. lcov version 1.14 ( check with --version option ) diff --git a/test/unit-test/TCPFilePaths.cmake b/test/unit-test/TCPFilePaths.cmake index 6b4500bd7..adfb31218 100644 --- a/test/unit-test/TCPFilePaths.cmake +++ b/test/unit-test/TCPFilePaths.cmake @@ -6,37 +6,38 @@ set( TCP_SOURCES "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_ARP.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_BitConfig.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DHCP.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DHCPv6.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DNS.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DNS_Cache.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DNS_Parser.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DNS_Networking.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DNS_Callback.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DHCP.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DHCPv6.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DNS_Networking.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_DNS_Parser.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_ICMP.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IP.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_Routing.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_RA.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv4.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv6.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_ND.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IP_Timers.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IP_Utils.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv4.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv4_Sockets.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv4_Utils.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv6.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv6_Sockets.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv6_Utils.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IP_Timers.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_ND.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_RA.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_Routing.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_Sockets.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv4_Sockets.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_IPv6_Sockets.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_Stream_Buffer.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_IP.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_IP_IPv4.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Transmission.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Transmission_IPv4.c" - "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Transmission_IPv6.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_IP_IPv6.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Reception.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_State_Handling.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_State_Handling_IPv4.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_State_Handling_IPv6.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Transmission.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Transmission_IPv4.c" + "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Transmission_IPv6.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Utils.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Utils_IPv4.c" "${CMAKE_CURRENT_LIST_DIR}/../../source/FreeRTOS_TCP_Utils_IPv6.c" @@ -53,6 +54,7 @@ set( TCP_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/../../source/portable/Compiler/MSVC ${CMAKE_CURRENT_LIST_DIR}/stubs ) +# Kernel source files. set( KERNEL_SOURCES "${CMAKE_CURRENT_LIST_DIR}/../FreeRTOS-Kernel/croutine.c" "${CMAKE_CURRENT_LIST_DIR}/../FreeRTOS-Kernel/event_groups.c" diff --git a/test/unit-test/cmock/coverage.cmake b/test/unit-test/cmock/coverage.cmake index 11219b8dd..1bd2e9489 100644 --- a/test/unit-test/cmock/coverage.cmake +++ b/test/unit-test/cmock/coverage.cmake @@ -1,5 +1,5 @@ # Taken from amazon-freertos repository -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.15) set(BINARY_DIR ${CMAKE_BINARY_DIR}) set(CMOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../tools/CMock )