2 # * FreeRTOS Kernel V10.2.0
\r
3 # * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 # * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 # * this software and associated documentation files (the "Software"), to deal in
\r
7 # * the Software without restriction, including without limitation the rights to
\r
8 # * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 # * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 # * subject to the following conditions:
\r
12 # * The above copyright notice and this permission notice shall be included in all
\r
13 # * copies or substantial portions of the Software.
\r
15 # * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 # * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 # * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 # * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 # * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 # * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 # * http://www.FreeRTOS.org
\r
23 # * http://aws.amazon.com/freertos
\r
25 # * 1 tab == 4 spaces!
\r
31 _THIS_FILE_DIRECTORY_ = os.path.dirname(os.path.realpath(__file__))
\r
32 _FREERTOS_PORTABLE_DIRECTORY_ = os.path.dirname(_THIS_FILE_DIRECTORY_)
\r
34 _COMPILERS_ = ['GCC', 'IAR']
\r
35 _ARCH_NS_ = ['ARM_CM33', 'ARM_CM33_NTZ']
\r
36 _ARCH_S_ = ['ARM_CM33']
\r
38 # Files to be complied in the Secure Project
\r
39 _SECURE_FILE_PATHS_ = [
\r
40 os.path.join('secure', 'context'),
\r
41 os.path.join('secure', 'context', 'portable', '_COMPILER_ARCH_'),
\r
42 os.path.join('secure', 'heap'),
\r
43 os.path.join('secure', 'init'),
\r
44 os.path.join('secure', 'macros')
\r
47 # Files to be complied in the Non-Secure Project
\r
48 _NONSECURE_FILE_PATHS_ = [
\r
50 os.path.join('non_secure', 'portable', '_COMPILER_ARCH_')
\r
53 def copy_files_in_dir(src_abs_path, dst_abs_path):
\r
54 for src_file in os.listdir(src_abs_path):
\r
55 src_file_abs_path = os.path.join(src_abs_path, src_file)
\r
56 if os.path.isfile(src_file_abs_path) and src_file != 'ReadMe.txt':
\r
57 if not os.path.exists(dst_abs_path):
\r
58 os.makedirs(dst_abs_path)
\r
59 print('Copying {}...'.format(os.path.basename(src_file_abs_path)))
\r
60 shutil.copy2(src_file_abs_path, dst_abs_path)
\r
63 def copy_files_for_compiler_and_arch(compiler, arch, src_paths, dst_path):
\r
64 _COMPILER_ARCH_ = os.path.join(compiler, arch)
\r
65 for src_path in src_paths:
\r
66 src_path_sanitized = src_path.replace('_COMPILER_ARCH_', _COMPILER_ARCH_ )
\r
68 src_abs_path = os.path.join(_THIS_FILE_DIRECTORY_, src_path_sanitized)
\r
69 dst_abs_path = os.path.join(_FREERTOS_PORTABLE_DIRECTORY_, _COMPILER_ARCH_, dst_path)
\r
71 copy_files_in_dir(src_abs_path, dst_abs_path)
\r
76 for compiler in _COMPILERS_:
\r
77 for arch in _ARCH_S_:
\r
78 copy_files_for_compiler_and_arch(compiler, arch, _SECURE_FILE_PATHS_, 'secure')
\r
80 # Copy Non-Secure Files
\r
81 for compiler in _COMPILERS_:
\r
82 for arch in _ARCH_NS_:
\r
83 copy_files_for_compiler_and_arch(compiler, arch, _NONSECURE_FILE_PATHS_, 'non_secure')
\r
90 if __name__ == '__main__':
\r