3 # * FreeRTOS Kernel <DEVELOPMENT BRANCH>
4 # * Copyright (C) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 # * SPDX-License-Identifier: MIT
8 # * Permission is hereby granted, free of charge, to any person obtaining a copy of
9 # * this software and associated documentation files (the "Software"), to deal in
10 # * the Software without restriction, including without limitation the rights to
11 # * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12 # * the Software, and to permit persons to whom the Software is furnished to do so,
13 # * subject to the following conditions:
15 # * The above copyright notice and this permission notice shall be included in all
16 # * copies or substantial portions of the Software.
18 # * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 # * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20 # * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21 # * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22 # * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 # * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 # * https://www.FreeRTOS.org
26 # * https://github.com/FreeRTOS
31 from common.header_checker import HeaderChecker
33 #--------------------------------------------------------------------------------------------------
35 #--------------------------------------------------------------------------------------------------
36 KERNEL_IGNORED_FILES = [
43 KERNEL_IGNORED_EXTENSIONS = [
69 KERNEL_ASM_EXTENSIONS = [
84 KERNEL_PY_EXTENSIONS = [
88 KERNEL_IGNORED_PATTERNS = [
90 r'.*portable/IAR/AtmelSAM7S64/.*AT91SAM7.*',
91 r'.*portable/GCC/ARM7_AT91SAM7S/.*',
92 r'.*portable/MPLAB/PIC18F/stdio.h',
93 r'.*portable/ThirdParty/xClang/XCOREAI/*',
97 r'.*portable/template/*',
98 r'.*template_configuration/*'
101 KERNEL_THIRD_PARTY_PATTERNS = [
102 r'.*portable/ThirdParty/GCC/Posix/port*',
103 r'.*portable/ThirdParty/*',
104 r'.*portable/IAR/AVR32_UC3/.*',
105 r'.*portable/GCC/AVR32_UC3/.*',
110 ' * FreeRTOS Kernel <DEVELOPMENT BRANCH>\n',
111 ' * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n',
113 ' * SPDX-License-Identifier: MIT\n',
115 ' * Permission is hereby granted, free of charge, to any person obtaining a copy of\n',
116 ' * this software and associated documentation files (the "Software"), to deal in\n',
117 ' * the Software without restriction, including without limitation the rights to\n',
118 ' * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n',
119 ' * the Software, and to permit persons to whom the Software is furnished to do so,\n',
120 ' * subject to the following conditions:\n',
122 ' * The above copyright notice and this permission notice shall be included in all\n',
123 ' * copies or substantial portions of the Software.\n',
125 ' * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n',
126 ' * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n',
127 ' * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n',
128 ' * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n',
129 ' * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n',
130 ' * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n',
132 ' * https://www.FreeRTOS.org\n',
133 ' * https://github.com/FreeRTOS\n',
139 FREERTOS_COPYRIGHT_REGEX = r"^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(C\) 20\d\d Amazon.com, Inc. or its affiliates. All Rights Reserved\.( \*\/)?$"
142 parser = HeaderChecker.configArgParser()
143 args = parser.parse_args()
145 # Configure the checks then run
146 checker = HeaderChecker(KERNEL_HEADER,
147 copyright_regex=FREERTOS_COPYRIGHT_REGEX,
148 ignored_files=KERNEL_IGNORED_FILES,
149 ignored_ext=KERNEL_IGNORED_EXTENSIONS,
150 ignored_patterns=KERNEL_IGNORED_PATTERNS,
151 third_party_patterns=KERNEL_THIRD_PARTY_PATTERNS,
152 py_ext=KERNEL_PY_EXTENSIONS,
153 asm_ext=KERNEL_ASM_EXTENSIONS)
154 checker.ignoreFile(os.path.split(__file__)[-1])
156 rc = checker.processArgs(args)
158 checker.showHelp(__file__)
162 if __name__ == '__main__':