From 2260486418444e1b6f42b41854b3c81bcc12560e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=85=B4?= <704168417@qq.com> Date: Sat, 14 Jul 2018 00:40:55 +0800 Subject: [PATCH] fix some issue with IAR --- si4project_filelist.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/si4project_filelist.py b/si4project_filelist.py index 3985721..b2aa4c9 100644 --- a/si4project_filelist.py +++ b/si4project_filelist.py @@ -22,6 +22,16 @@ if os.path.exists(depfilename): sourcefile = depfilename outputfile = os.path.splitext(projectfilename)[0] + + # find current target + wsdtfile = os.path.join(os.getcwd(), 'settings') + wsdtfile = os.path.join(wsdtfile, entry.name.replace('.eww', '.wsdt')) + + if os.path.exists(wsdtfile): + tree = ET.ElementTree(file=wsdtfile) + ConfigDictionary = tree.find('ConfigDictionary') + CurrentConfigs = ConfigDictionary.find('CurrentConfigs') + TargetName = CurrentConfigs.find('Project').text.split('/')[1] break else: print('Please build the project once') @@ -95,11 +105,9 @@ if TargetName == tag.find('name').text: output_tag = tag.find('outputs') - for elem in output_tag.iterfind('file'): + for elem in output_tag.findall('file'): if elem.text.startswith('$PROJ_DIR$'): - if elem.text.endswith('.c'): - si4filelist.append(os.path.abspath(elem.text.replace('$PROJ_DIR$', os.getcwd()))+'\n') - elif elem.text.endswith('.h'): + if elem.text.endswith('.c') or elem.text.endswith('.s') or elem.text.endswith('.h'): si4filelist.append(os.path.abspath(elem.text.replace('$PROJ_DIR$', os.getcwd()))+'\n') break