15
15
limitations under the License.
16
16
"""
17
17
18
+ import copy
19
+
18
20
from os import walk , sep
19
- from os .path import splitext , basename , join , dirname
21
+ from os .path import splitext , basename , join , dirname , relpath
20
22
from random import randint
21
23
from tools .utils import mkdir
22
24
from tools .export .exporters import Exporter
@@ -251,7 +253,7 @@ class Sw4STM32(Exporter):
251
253
252
254
def __gen_dir (self , dir_name ):
253
255
"""
254
- Method that created directory
256
+ Method that creates directory
255
257
"""
256
258
settings = join (self .export_dir , dir_name )
257
259
mkdir (settings )
@@ -268,9 +270,9 @@ def filter_dot(path):
268
270
This function removes ./ from str.
269
271
str must be converted with win_to_unix() before using this function.
270
272
"""
271
- if path is None :
272
- return None
273
- if path [: 2 ] == './' :
273
+ if not path :
274
+ return path
275
+ if path . startswith ( './' ) :
274
276
return path [2 :]
275
277
return path
276
278
@@ -302,15 +304,12 @@ def remove_unused(self, path):
302
304
Method adds path to excluded list if not needed
303
305
and is not subdirectory of already excluded directory
304
306
"""
305
- found = False
306
- for used in self .include_path :
307
- if path == used :
308
- found = True
307
+ found = path in self .include_path
309
308
needtoadd = True
310
309
if not found :
311
310
for directory in self .exclude_dirs :
312
- # Do not exclude subfolders from excluded folder
313
- if path . find ( directory + '/' ) != - 1 :
311
+ # Do not exclude subfolders from excluded folder
312
+ if directory + '/' in path :
314
313
needtoadd = False
315
314
if needtoadd :
316
315
self .exclude_dirs .append (path )
@@ -326,6 +325,8 @@ def generate(self):
326
325
fp_hardware = "fpv5-d16"
327
326
fp_abi = "softfp"
328
327
328
+ config_header = self .filter_dot (self .toolchain .get_config_header ())
329
+
329
330
self .resources .win_to_unix ()
330
331
331
332
libraries = []
@@ -346,7 +347,6 @@ def generate(self):
346
347
347
348
ld_script = self .filter_dot (self .resources .linker_script )
348
349
349
- # self.lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs]
350
350
lib_dirs = [self .filter_dot (s ) for s in self .resources .lib_dirs ]
351
351
352
352
symbols = [s .replace ('"' , '"' )
@@ -355,6 +355,7 @@ def generate(self):
355
355
ctx = {
356
356
'name' : self .project_name ,
357
357
'include_paths' : self .include_path ,
358
+ 'config_header' : config_header ,
358
359
'exclude_paths' : self .exclude_dirs ,
359
360
'linker_script' : ld_script ,
360
361
'library_paths' : lib_dirs ,
@@ -363,8 +364,6 @@ def generate(self):
363
364
'symbols' : symbols ,
364
365
'board_name' : self .BOARDS [self .target .upper ()]['name' ],
365
366
'mcu_name' : self .BOARDS [self .target .upper ()]['mcuId' ],
366
- 'c_include_uid' : self .__generate_uid (),
367
- 'cpp_include_uid' : self .__generate_uid (),
368
367
'debug_config_uid' : self .__generate_uid (),
369
368
'debug_tool_compiler_uid' : self .__generate_uid (),
370
369
'debug_tool_compiler_input_uid' : self .__generate_uid (),
0 commit comments