Skip to content

Commit d53e812

Browse files
authored
Merge branch 'dev/IPv6_integration' into dev-defines
2 parents 0285d24 + 8926945 commit d53e812

File tree

96 files changed

+2592
-606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2592
-606
lines changed

.github/lexicon.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ ehertype
251251
eigrp
252252
einitialwait
253253
einprogress
254+
einval
254255
einvalidchecksum
255256
einvaliddata
256257
eleasedaddress
@@ -896,6 +897,7 @@ pvportmalloclarge
896897
pvportmallocsocket
897898
pvptr
898899
pvsearchid
900+
pvsocketid
899901
pvsource
900902
pxackmessage
901903
pxaddr
@@ -1138,6 +1140,7 @@ snd
11381140
snprintf
11391141
sntptimestamp
11401142
sockaddr
1143+
socketid
11411144
socketset
11421145
sockopt
11431146
sof
@@ -1661,8 +1664,10 @@ vrxfaultinjection
16611664
vsocketbind
16621665
vsocketclose
16631666
vsocketclosenexttime
1667+
vsocketgetsocketid
16641668
vsocketlistennexttime
16651669
vsocketselect
1670+
vsocketsetsocketid
16661671
vsocketwakeupuser
16671672
vstartntptask
16681673
vtaskdelay

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ Test Steps
88
-----------
99
<!-- Describe the steps to reproduce. -->
1010

11+
Checklist:
12+
----------
13+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
14+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
15+
- [ ] I have tested my changes. No regression in existing tests.
16+
- [ ] I have modified and/or added unit-tests to cover the code changes in this Pull Request.
17+
1118
Related Issue
1219
-----------
1320
<!-- If any, please provide issue ID. -->

.github/workflows/ci.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Clone This Repo
5252
uses: actions/checkout@v2
5353
with:
54-
path: ./tcp
54+
path: ./tcp
5555
- name: Install spell
5656
run: |
5757
sudo apt-get install spell
@@ -99,7 +99,7 @@ jobs:
9999
fi
100100
101101
doxygen:
102-
runs-on: ubuntu-20.04
102+
runs-on: ubuntu-latest
103103
steps:
104104
- uses: actions/checkout@v2
105105
- name: Run doxygen build
@@ -111,23 +111,23 @@ jobs:
111111
runs-on: ubuntu-latest
112112
steps:
113113
- uses: actions/checkout@v2
114-
- name: Update submodules
115-
run: git submodule update --init --checkout
114+
- name: Build Install Dependencies
115+
run: |
116+
sudo apt-get install -y libpcap-dev
116117
- name: Build checks (Enable all functionalities)
117118
run: |
118-
cmake -S test/build-combination -B test/build-combination/build/ \
119-
-DTEST_CONFIGURATION=ENABLE_ALL
120-
make -C test/build-combination/build/
119+
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL
120+
cmake --build build --target freertos_plus_tcp_build_test
121121
- name: Build checks (Disable all functionalities)
122122
run: |
123-
cmake -S test/build-combination -B test/build-combination/build/ \
124-
-DTEST_CONFIGURATION=DISABLE_ALL
125-
make -C test/build-combination/build/
123+
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL
124+
cmake --build build --target clean
125+
cmake --build build --target freertos_plus_tcp_build_test
126126
- name: Build checks (Default configuration)
127127
run: |
128-
cmake -S test/build-combination -B test/build-combination/build/ \
129-
-DTEST_CONFIGURATION=DEFAULT_CONF
130-
make -C test/build-combination/build/
128+
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF
129+
cmake --build build --target clean
130+
cmake --build build --target freertos_plus_tcp_build_test
131131
132132
complexity:
133133
runs-on: ubuntu-latest
@@ -178,3 +178,18 @@ jobs:
178178
run: |
179179
git-secrets --register-aws
180180
git-secrets --scan
181+
proof_ci:
182+
runs-on: cbmc_ubuntu-latest_16-core
183+
steps:
184+
- name: Set up CBMC runner
185+
uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@main
186+
with:
187+
cbmc_version: "5.61.0"
188+
- run: |
189+
git submodule update --init --checkout --recursive
190+
sudo apt-get update
191+
sudo apt-get install --yes --no-install-recommends gcc-multilib
192+
- name: Run CBMC
193+
uses: FreeRTOS/CI-CD-Github-Actions/run_cbmc@main
194+
with:
195+
proofs_dir: test/cbmc/proofs

.github/workflows/uncrustify.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
- name: Checkout upstream repo
3232
uses: actions/checkout@v2
3333
with:
34-
token: ${{ secrets.PAT }}
3534
repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }}
3635
ref: ${{ steps.upstreambranch.outputs.branchname }}
3736
- name: Install Uncrustify

CMakeLists.txt

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
2+
cmake_minimum_required(VERSION 3.15)
3+
cmake_policy(SET CMP0048 NEW) # project version
4+
cmake_policy(SET CMP0076 NEW) # full paths
5+
6+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
7+
8+
########################################################################
9+
# Project Details
10+
project(FreeRTOS-Plus-TCP
11+
VERSION 3.1.0
12+
DESCRIPTION "FreeRTOS TCP/UDP Network Layer"
13+
HOMEPAGE_URL https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/index.html
14+
LANGUAGES C)
15+
16+
# Do not allow in-source build.
17+
if( ${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR} )
18+
message( FATAL_ERROR "In-source build is not allowed. Please build in a separate directory, such as ${PROJECT_SOURCE_DIR}/build." )
19+
endif()
20+
21+
# Options
22+
option(FREERTOS_PLUS_TCP_BUILD_TEST "Build the test for FreeRTOS Plus TCP" OFF)
23+
24+
# Configuration
25+
# Override these at project level with:
26+
# Optional: set(FREERTOS_PLUS_TCP_BUFFER_ALLOCATION "1" CACHE STRING "" FORCE)
27+
# Optional: set(FREERTOS_PLUS_TCP_COMPILER "" CACHE STRING "" FORCE)
28+
# Required: set(FREERTOS_PLUS_TCP_NETWORK_IF "POSIX" CACHE STRING "" FORCE)
29+
30+
# Select the appropriate buffer allocaiton method.
31+
# See: https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/Embedded_Ethernet_Buffer_Management.html
32+
if (NOT FREERTOS_PLUS_TCP_BUFFER_ALLOCATION)
33+
message(STATUS "Using default FREERTOS_PLUS_TCP_BUFFER_ALLOCATION = 2")
34+
set(FREERTOS_PLUS_TCP_BUFFER_ALLOCATION "2" CACHE STRING "FreeRTOS buffer allocation model number. 1 .. 2.")
35+
endif()
36+
37+
# Select the Compiler - if left blank will detect using CMake
38+
# Note relies on CMake to detect over any setting here.
39+
# Valid options are:
40+
# FREERTOS_PLUS_TCP_COMPILER | Detected | CMake
41+
# -------------------------------------------------
42+
# CCS | No | ?TBD?
43+
# GCC | Yes | GNU
44+
# IAR | Yes | IAR
45+
# Keil | Yes | ARMCC
46+
# MSVC | Yes | MSVC # Note only for MinGW
47+
# Renesas | No | ?TBD?
48+
# Will always a attempt to detect and if detectable double checks that the compiler is set correctly.
49+
set(FREERTOS_PLUS_TCP_COMPILER "" CACHE STRING "FreeRTOS Plus TCP Compiler Selection")
50+
51+
52+
# Select the appropriate network interface
53+
# This will fail the CMake preparation step if not set to one of those values.
54+
set(FREERTOS_PLUS_TCP_NETWORK_IF "" CACHE STRING "FreeRTOS Plus TCP Network Interface selection")
55+
set(FREERTOS_PLUS_TCP_NETWORK_IF_LIST
56+
A_CUSTOM_NETWORK_IF
57+
ATSAM43 ATSAME5x # AT
58+
DRIVER_SAM
59+
ESP32
60+
KSZ8851SNL
61+
LPC17xx LPC18xx LPC54018
62+
M487
63+
MPS2_AN385
64+
MW300_RD
65+
PIC32MZEF_ETH PIC32MZEF_WIFI
66+
POSIX WIN_PCAP # Native Linux & Windows respectively
67+
RX
68+
SH2A
69+
STM32FXX STM32HXX # ST Micro
70+
MSP432
71+
TM4C
72+
XILINX_ULTRASCALE ZYNQ # AMD/Xilinx
73+
)
74+
if(NOT FREERTOS_PLUS_TCP_NETWORK_IF)
75+
# Attempt to detect the system.
76+
if(UNIX)
77+
message(STATUS "Detected UNIX/Posix system setting FREERTOS_PLUS_TCP_NETWORK_IF = POSIX")
78+
set(FREERTOS_PLUS_TCP_NETWORK_IF POSIX)
79+
elseif(MINGW)
80+
message(STATUS "Detected Windows MinGW system setting FREERTOS_PLUS_TCP_NETWORK_IF = WIN_PCAP")
81+
set(FREERTOS_PLUS_TCP_NETWORK_IF WIN_PCAP)
82+
endif()
83+
endif()
84+
85+
if(NOT FREERTOS_PLUS_TCP_NETWORK_IF IN_LIST FREERTOS_PLUS_TCP_NETWORK_IF_LIST )
86+
message(FATAL_ERROR " FREERTOS_PLUS_TCP_NETWORK_IF is '${FREERTOS_PLUS_TCP_NETWORK_IF}'.\n"
87+
" Please specify it from top-level CMake file (example):\n"
88+
" set(FREERTOS_PLUS_TCP_NETWORK_IF POSIX CACHE STRING \"\")\n"
89+
" or from CMake command line option:\n"
90+
" -DFREERTOS_PLUS_TCP_NETWORK_IF=POSIX\n"
91+
" \n"
92+
" Available port options: (Tested means compiled with that variant)\n"
93+
" A_CUSTOM_NETWORK_IF Target: User Defined\n"
94+
" ATSAM4E Target: ATSAM4E Tested: TODO\n"
95+
" ATSAME5x Target: ATSAME5x Tested: TODO\n"
96+
" DRIVER_SAM Target: Driver SAM Tested: TODO\n"
97+
" ESP32 Target: ESP-32 Tested: TODO\n"
98+
" KSZ8851SNL Target: ksz8851snl Tested: TODO\n"
99+
" POSIX Target: linux/Posix\n"
100+
" LPC17xx Target: LPC17xx Tested: TODO\n"
101+
" LPC18xx Target: LPC18xx Tested: TODO\n"
102+
" LPC54018 Target: LPC54018 Tested: TODO\n"
103+
" M487 Target: M487 Tested: TODO\n"
104+
" MPS2_AN385 Target: MPS2_AN385 Tested: TODO\n"
105+
" MW300_RD Target: mw300_rd Tested: TODO\n"
106+
" PIC32MZEF_ETH Target: pic32mzef ethernet Tested: TODO\n"
107+
" PIC32MZEF_WIFI Target: pic32mzef Wifi Tested: TODO\n"
108+
" RX Target: RX Tested: TODO\n"
109+
" SH2A Target: SH2A Tested: TODO\n"
110+
" STM32FXX Target: STM32Fxx Tested: TODO\n"
111+
" STM32HXX Target: STM32Hxx Tested: TODO\n"
112+
" MSP432 Target: MSP432 Tested: TODO\n"
113+
" TM4C Target: TM4C Tested: TODO\n"
114+
" WIN_PCAP Target: Windows Tested: TODO\n"
115+
" XILINX_ULTRASCALE Target: Xilinx Ultrascale Tested: TODO\n"
116+
" ZYNQ Target: Xilinx Zynq")
117+
elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_port) )
118+
message(FATAL_ERROR " FREERTOS_PLUS_TCP_NETWORK_IF is set to A_CUSTOM_NETWORK_IF.\n"
119+
" Please specify the custom network interface target with all necessary files.\n"
120+
" For example, assuming a directory of:\n"
121+
" FreeRTOSCustomNetworkInterface/\n"
122+
" CMakeLists.txt\n"
123+
" NetworkInterface.c\n\n"
124+
" Where FreeRTOSCustomNetworkInterface/CMakeLists.txt is a modified version of:\n"
125+
" add_library(freertos_plus_tcp_network_if STATIC)\n\n"
126+
" target_sources(freertos_plus_tcp_network_if\n"
127+
" PRIVATE\n"
128+
" NetworkInterface.c)\n\n"
129+
" target_include_directories(freertos_plus_tcp_network_if\n"
130+
" PUBLIC\n"
131+
" .)\n\n"
132+
" taget_link_libraries(freertos_plus_tcp_network_if\n"
133+
" PUBLIC\n"
134+
" freertos_plus_tcp_port\n"
135+
" freertos_plus_tcp_network_if_common\n"
136+
" PRIVATE\n"
137+
" freertos_kernel)")
138+
endif()
139+
140+
# There is also the need to add a target - typically an interface library that describes the
141+
# Configuration for FreeRTOS-Kernel and FreeRTOS-Plus-TCP.
142+
# This is called freertos_config
143+
# If not defined will be default compile with one of the test build combinations AllEnable.
144+
145+
# Select the appropriate Build Test configuration
146+
# This is only used when freertos_config is not defined, otherwise the build test will be performed
147+
# on the config defined in the freertos_config
148+
set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION "CUSTOM" CACHE STRING "FreeRTOS Plus TCP Build Test configuration")
149+
set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST
150+
CUSTOM # Custom (external) configuration -eg from a top-level project
151+
ENABLE_ALL # Enable all configuration settings
152+
DISABLE_ALL # Disable all configuration settings
153+
DEFAULT_CONF # Default (typical) configuration
154+
)
155+
if(NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION IN_LIST FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST)
156+
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}")
157+
else()
158+
message(STATUS "Using FreeRTOS-Plus-TCP Test Configuration : ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}")
159+
if (NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM")
160+
message(WARNING "FreeRTOS-Kernel configuration settings are configured by FreeRTOS-Plus-TCP")
161+
endif()
162+
endif()
163+
164+
########################################################################
165+
# Requirements
166+
set(CMAKE_C_STANDARD 90) # Note FreeRTOS-Kernel uses C99 constructs.
167+
set(CMAKE_C_STANDARD_REQUIRED ON)
168+
169+
########################################################################
170+
# Overall Compile Options
171+
# Note the compile option strategy is to error on everything and then
172+
# Per library opt-out of things that are warnings/errors.
173+
# This ensures that no matter what strategy for compilation you take, the
174+
# builds will still occur.
175+
#
176+
# Only tested with GNU and Clang.
177+
# Other options are https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID
178+
# Naming of compilers translation map:
179+
# For the ?TBD? - Suggest trying GNU-based and adding the appropriate toolchain file.
180+
# For Toolchain examples see _deps/cmake-src/toolchain/arm-none-eabil-gcc.toolchain.cmake
181+
#
182+
# FreeRTOS | CMake
183+
# -------------------
184+
# CCS | ?TBD?
185+
# GCC | GNU, Clang, *Clang Others?
186+
# IAR | IAR
187+
# Keil | ARMCC
188+
# MSVC | MSVC # Note only for MinGW?
189+
# Renesas | ?TBD?
190+
191+
add_compile_options(
192+
### Gnu/Clang C Options
193+
$<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always>
194+
$<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics>
195+
196+
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
197+
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
198+
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic>
199+
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
200+
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wunused-variable>
201+
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
202+
203+
# TODO: Add in other Compilers here.
204+
)
205+
206+
########################################################################
207+
# External Dependencies
208+
# Note: For backwards compatibility - still have .gitmodules defining submodules
209+
# To support fetching content in a higher level project see
210+
# README.md `Consume with CMake`
211+
# This will allow you to upgrade submodules and have one common submodule for
212+
# all your builds despite multiple submodules having different versions.
213+
include(FetchContent)
214+
215+
FetchContent_Declare( freertos_kernel
216+
GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Kernel.git
217+
GIT_TAG main
218+
)
219+
220+
FetchContent_Declare( cmock
221+
GIT_REPOSITORY https://github.com/ThrowTheSwitch/CMock
222+
GIT_TAG v2.5.3
223+
)
224+
225+
add_subdirectory(source)
226+
add_subdirectory(tools)
227+
add_subdirectory(test)
228+
229+
FetchContent_MakeAvailable(freertos_kernel cmock)
230+
231+
# Note following are can be removed once FreeRTOS-Kernel v10.5.0 + fixes their issues.
232+
# To ignore header specific issues - change all of the headers to SYSTEM
233+
set(_freertos_kernel_targets freertos_kernel freertos_kernel_port)
234+
# foreach (_target ${_freertos_kernel_targets} )
235+
# get_target_property( interface_directories ${_target} INTERFACE_INCLUDE_DIRECTORIES )
236+
# set_target_properties(${_target} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${interface_directories}" )
237+
# endforeach()

History.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ Changes between dev/ipv6_integration branch RC1 and main branch V3.0.0 releases:
55
+ New WinSim demo to support both IPv4 and IPv6.
66
**Note**- This release does not support ESP32/ M487/ mw300_rd ports yet. This will be released soon.
77

8+
Changes between V3.0.0 and V3.1.0 releases:
9+
+ Fixed a bug in the Connect function where multiple SYN and RST packet combinations can
10+
lead to orphaned sockets.
11+
+ Added network interface support for NetifSlirp.
12+
813
Changes between V3.0.0 and V2.4.0 releases:
914
+ Split the source files according to the function the code performs.
1015
This makes the code modular making test coverage easier.

MISRA.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ with ( Assuming rule 11.4 violation; with justification in point 2 ):
1414
```
1515
grep 'MISRA Ref 11.4.2' . -rI
1616
```
17+
#### Directive 4.12
18+
19+
_Ref 4.12.1_
20+
21+
- MISRA C:2012 Directive 4.12: Dynamic memory allocation shall not be used.
22+
MISRA warns against the use of dynamic memory allocation as it might
23+
lead to undefined behavior if not used properly. However, the
24+
FreeRTOS-Plus-TCP library only uses the memory allocation primitives
25+
defined by the FreeRTOS-Kernel, which are deterministic. Additionally,
26+
proper care is taken in the code to not use free'd pointers and to check
27+
the validity of malloc'd memory before it is dereferenced or used.
28+
1729
#### Rule 2.2
1830

1931
_Ref 2.2.1_

0 commit comments

Comments
 (0)