Skip to content

Commit 5c2de0e

Browse files
authored
Merge branch 'main' into autoReloadName
2 parents 4048372 + c0585ad commit 5c2de0e

File tree

123 files changed

+2722
-6627
lines changed

Some content is hidden

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

123 files changed

+2722
-6627
lines changed

.github/.cSpellWords.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ MAINRDY
448448
MAIR
449449
Mang
450450
Mbits
451+
mbranch
451452
mcause
452453
MCFR
453454
MCKA
@@ -586,6 +587,8 @@ OWATCOM
586587
OWDR
587588
OWER
588589
OWSR
590+
pacbti
591+
PACBTI
589592
PAGEN
590593
PCDR
591594
PCER
@@ -900,6 +903,7 @@ TXTEN
900903
TXUBR
901904
TXVC
902905
TXVDIS
906+
UBTI
903907
UDCP
904908
UNACKED
905909
uncrustify
@@ -915,6 +919,7 @@ UNSUB
915919
UNSUBACK
916920
unsubscriptions
917921
unsuspended
922+
UPAC
918923
URAD
919924
URAT
920925
URSTEN

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# the repo. Unless a later match takes precedence,
55
# @global-owner1 and @global-owner2 will be requested for
66
# review when someone opens a pull request.
7-
* @FreeRTOS/pr-bar-raiser
7+
* @FreeRTOS/pr-bar-raisers
88

99
# Order is important; the last matching pattern takes the most
1010
# precedence. When someone opens a pull request that only

.github/scripts/kernel_checker.py

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
# */
2929

3030
import os
31+
import re
3132
from common.header_checker import HeaderChecker
3233

3334
#--------------------------------------------------------------------------------------------------
@@ -106,6 +107,15 @@
106107
r'.*portable/GCC/AVR32_UC3/.*',
107108
]
108109

110+
KERNEL_ARM_COLLAB_FILES_PATTERNS = [
111+
r'.*portable/ARMv8M/*',
112+
r'.*portable/.*/ARM_CM23*',
113+
r'.*portable/.*/ARM_CM33*',
114+
r'.*portable/.*/ARM_CM35*',
115+
r'.*portable/.*/ARM_CM55*',
116+
r'.*portable/.*/ARM_CM85*',
117+
]
118+
109119
KERNEL_HEADER = [
110120
'/*\n',
111121
' * FreeRTOS Kernel <DEVELOPMENT BRANCH>\n',
@@ -139,19 +149,92 @@
139149

140150
FREERTOS_COPYRIGHT_REGEX = r"^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(C\) 20\d\d Amazon.com, Inc. or its affiliates. All Rights Reserved\.( \*\/)?$"
141151

152+
FREERTOS_ARM_COLLAB_COPYRIGHT_REGEX = r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(C\) 20\d\d Amazon.com, Inc. or its affiliates. All Rights Reserved\.( \*\/)?$)|" + \
153+
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright 20\d\d Arm Limited and/or its affiliates( \*\/)?$)|" + \
154+
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? <[email protected]>( \*\/)?$)"
155+
156+
157+
class KernelHeaderChecker(HeaderChecker):
158+
def __init__(
159+
self,
160+
header,
161+
padding=1000,
162+
ignored_files=None,
163+
ignored_ext=None,
164+
ignored_patterns=None,
165+
py_ext=None,
166+
asm_ext=None,
167+
third_party_patterns=None,
168+
copyright_regex = None
169+
):
170+
super().__init__(header, padding, ignored_files, ignored_ext, ignored_patterns,
171+
py_ext, asm_ext, third_party_patterns, copyright_regex)
172+
173+
self.armCollabRegex = re.compile(FREERTOS_ARM_COLLAB_COPYRIGHT_REGEX)
174+
175+
self.armCollabFilesPatternList = []
176+
for pattern in KERNEL_ARM_COLLAB_FILES_PATTERNS:
177+
self.armCollabFilesPatternList.append(re.compile(pattern))
178+
179+
def isArmCollabFile(self, path):
180+
for pattern in self.armCollabFilesPatternList:
181+
if pattern.match(path):
182+
return True
183+
return False
184+
185+
def checkArmCollabFile(self, path):
186+
isValid = False
187+
file_ext = os.path.splitext(path)[-1]
188+
189+
with open(path, encoding="utf-8", errors="ignore") as file:
190+
chunk = file.read(len("".join(self.header)) + self.padding)
191+
lines = [("%s\n" % line) for line in chunk.strip().splitlines()][
192+
: len(self.header) + 2
193+
]
194+
if (len(lines) > 0) and (lines[0].find("#!") == 0):
195+
lines.remove(lines[0])
196+
197+
# Split lines in sections.
198+
headers = dict()
199+
headers["text"] = []
200+
headers["copyright"] = []
201+
headers["spdx"] = []
202+
for line in lines:
203+
if self.armCollabRegex.match(line):
204+
headers["copyright"].append(line)
205+
elif "SPDX-License-Identifier:" in line:
206+
headers["spdx"].append(line)
207+
else:
208+
headers["text"].append(line)
209+
210+
text_equal = self.isValidHeaderSection(file_ext, "text", headers["text"])
211+
spdx_equal = self.isValidHeaderSection(file_ext, "spdx", headers["spdx"])
212+
213+
if text_equal and spdx_equal and len(headers["copyright"]) == 3:
214+
isValid = True
215+
216+
return isValid
217+
218+
def customCheck(self, path):
219+
isValid = False
220+
if self.isArmCollabFile(path):
221+
isValid = self.checkArmCollabFile(path)
222+
return isValid
223+
224+
142225
def main():
143226
parser = HeaderChecker.configArgParser()
144227
args = parser.parse_args()
145228

146229
# Configure the checks then run
147-
checker = HeaderChecker(KERNEL_HEADER,
148-
copyright_regex=FREERTOS_COPYRIGHT_REGEX,
149-
ignored_files=KERNEL_IGNORED_FILES,
150-
ignored_ext=KERNEL_IGNORED_EXTENSIONS,
151-
ignored_patterns=KERNEL_IGNORED_PATTERNS,
152-
third_party_patterns=KERNEL_THIRD_PARTY_PATTERNS,
153-
py_ext=KERNEL_PY_EXTENSIONS,
154-
asm_ext=KERNEL_ASM_EXTENSIONS)
230+
checker = KernelHeaderChecker(KERNEL_HEADER,
231+
copyright_regex=FREERTOS_COPYRIGHT_REGEX,
232+
ignored_files=KERNEL_IGNORED_FILES,
233+
ignored_ext=KERNEL_IGNORED_EXTENSIONS,
234+
ignored_patterns=KERNEL_IGNORED_PATTERNS,
235+
third_party_patterns=KERNEL_THIRD_PARTY_PATTERNS,
236+
py_ext=KERNEL_PY_EXTENSIONS,
237+
asm_ext=KERNEL_ASM_EXTENSIONS)
155238
checker.ignoreFile(os.path.split(__file__)[-1])
156239

157240
rc = checker.processArgs(args)

.github/third_party_tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ team.
1111
| Tool | Website | Getting Started |
1212
|------|---------|-----------------|
1313
| Code Sonar | [Link](https://codesecure.com/our-products/codesonar/) | [Link](https://github.com/CodeSecure-SE/FreeRTOS-Kernel/blob/main/examples/codesonar/README.md) |
14-
| Coverity | [Link](https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html) | [Link](../examples/coverity/README.md) |
14+
| Coverity | [Link](https://www.blackduck.com/static-analysis-tools-sast/coverity.html) | [Link](../examples/coverity/README.md) |

.github/workflows/unit-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ jobs:
4545
fail_ci_if_error: false
4646
verbose: false
4747
- name: Archive code coverage data
48-
uses: actions/upload-artifact@v2
48+
uses: actions/upload-artifact@v4
4949
with:
5050
name: coverage-data
5151
path: FreeRTOS/Test/CMock/build/cmock_test*
5252
- name: Archive code coverage html report
53-
uses: actions/upload-artifact@v2
53+
uses: actions/upload-artifact@v4
5454
with:
5555
name: coverage-report
5656
path: FreeRTOS/Test/CMock/build/coverage

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,18 @@ if(NOT FREERTOS_PORT)
138138
" IAR_ARM_CM33_NONSECURE - Compiler: IAR Target: ARM Cortex-M33 non-secure\n"
139139
" IAR_ARM_CM33_SECURE - Compiler: IAR Target: ARM Cortex-M33 secure\n"
140140
" IAR_ARM_CM33_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M33 non-trustzone non-secure\n"
141+
" IAR_ARM_CM33_TFM - Compiler: IAR Target: ARM Cortex-M33 non-secure for TF-M\n"
141142
" IAR_ARM_CM35P_NONSECURE - Compiler: IAR Target: ARM Cortex-M35P non-secure\n"
142143
" IAR_ARM_CM35P_SECURE - Compiler: IAR Target: ARM Cortex-M35P secure\n"
143144
" IAR_ARM_CM35P_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M35P non-trustzone non-secure\n"
144145
" IAR_ARM_CM55_NONSECURE - Compiler: IAR Target: ARM Cortex-M55 non-secure\n"
145146
" IAR_ARM_CM55_SECURE - Compiler: IAR Target: ARM Cortex-M55 secure\n"
146147
" IAR_ARM_CM55_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M55 non-trustzone non-secure\n"
148+
" IAR_ARM_CM55_TFM - Compiler: IAR Target: ARM Cortex-M55 non-secure for TF-M\n"
147149
" IAR_ARM_CM85_NONSECURE - Compiler: IAR Target: ARM Cortex-M85 non-secure\n"
148150
" IAR_ARM_CM85_SECURE - Compiler: IAR Target: ARM Cortex-M85 secure\n"
149151
" IAR_ARM_CM85_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M85 non-trustzone non-secure\n"
152+
" IAR_ARM_CM85_TFM - Compiler: IAR Target: ARM Cortex-M85 non-secure for TF-M\n"
150153
" IAR_ARM_CRX_NOGIC - Compiler: IAR Target: ARM Cortex-Rx no GIC\n"
151154
" IAR_ATMEGA323 - Compiler: IAR Target: ATMega323\n"
152155
" IAR_ATMEL_SAM7S64 - Compiler: IAR Target: Atmel SAM7S64\n"

event_groups.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@
551551
ListItem_t * pxNext;
552552
ListItem_t const * pxListEnd;
553553
List_t const * pxList;
554-
EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits;
554+
EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits, uxReturnBits;
555555
EventGroup_t * pxEventBits = xEventGroup;
556556
BaseType_t xMatchFound = pdFALSE;
557557

@@ -635,12 +635,15 @@
635635
/* Clear any bits that matched when the eventCLEAR_EVENTS_ON_EXIT_BIT
636636
* bit was set in the control word. */
637637
pxEventBits->uxEventBits &= ~uxBitsToClear;
638+
639+
/* Snapshot resulting bits. */
640+
uxReturnBits = pxEventBits->uxEventBits;
638641
}
639642
( void ) xTaskResumeAll();
640643

641-
traceRETURN_xEventGroupSetBits( pxEventBits->uxEventBits );
644+
traceRETURN_xEventGroupSetBits( uxReturnBits );
642645

643-
return pxEventBits->uxEventBits;
646+
return uxReturnBits;
644647
}
645648
/*-----------------------------------------------------------*/
646649

examples/coverity/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MISRA Compliance for FreeRTOS-Kernel
22
FreeRTOS-Kernel is MISRA C:2012 compliant. This directory contains a project to
3-
run [Synopsys Coverity](https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html)
3+
run [Synopsys Coverity](https://www.blackduck.com/static-analysis-tools-sast/coverity.html)
44
for checking MISRA compliance.
55

66
> **Note**
@@ -17,7 +17,7 @@ files.
1717

1818
## Getting Started
1919
### Prerequisites
20-
Coverity can be run on any platform mentioned [here](https://sig-docs.synopsys.com/polaris/topics/c_coverity-compatible-platforms.html).
20+
Coverity can be run on any platform mentioned [here](https://documentation.blackduck.com/bundle/coverity-docs/page/deploy-install-guide/topics/supported_platforms_for_coverity_analysis.html).
2121
The following are the prerequisites to generate coverity report:
2222

2323
1. CMake version > 3.13.0 (You can check whether you have this by typing `cmake --version`).

include/FreeRTOS.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,6 +3032,18 @@
30323032
#define configCONTROL_INFINITE_LOOP()
30333033
#endif
30343034

3035+
/* Set configENABLE_PAC and/or configENABLE_BTI to 1 to enable PAC and/or BTI
3036+
* support and 0 to disable them. These are currently used in ARMv8.1-M ports. */
3037+
#if ( portHAS_PACBTI_FEATURE == 1 )
3038+
#ifndef configENABLE_PAC
3039+
#define configENABLE_PAC 0
3040+
#endif
3041+
3042+
#ifndef configENABLE_BTI
3043+
#define configENABLE_BTI 0
3044+
#endif
3045+
#endif
3046+
30353047
/* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
30363048
* dynamically allocated RAM, in which case when any task is deleted it is known
30373049
* that both the task's stack and TCB need to be freed. Sometimes the

include/event_groups.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,14 +483,11 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
483483
* and bit 0 set uxBitsToSet to 0x09.
484484
*
485485
* @return The value of the event group at the time the call to
486-
* xEventGroupSetBits() returns. There are two reasons why the returned value
487-
* might have the bits specified by the uxBitsToSet parameter cleared. First,
488-
* if setting a bit results in a task that was waiting for the bit leaving the
489-
* blocked state then it is possible the bit will be cleared automatically
490-
* (see the xClearBitOnExit parameter of xEventGroupWaitBits()). Second, any
491-
* unblocked (or otherwise Ready state) task that has a priority above that of
492-
* the task that called xEventGroupSetBits() will execute and may change the
493-
* event group value before the call to xEventGroupSetBits() returns.
486+
* xEventGroupSetBits() returns. Returned value might have the bits specified
487+
* by the uxBitsToSet parameter cleared if setting a bit results in a task
488+
* that was waiting for the bit leaving the blocked state then it is possible
489+
* the bit will be cleared automatically (see the xClearBitOnExit parameter
490+
* of xEventGroupWaitBits()).
494491
*
495492
* Example usage:
496493
* @code{c}

0 commit comments

Comments
 (0)