Resolved code review comments

pull/9646/head
Andriy.Lishchynskyi 2019-01-31 19:31:28 +02:00 committed by adbridge
parent ea074d0c71
commit 3bf6e9afb0
1 changed files with 8 additions and 11 deletions

View File

@ -22,6 +22,7 @@ from tools.targets import TARGET_MAP
from os.path import join, exists from os.path import join, exists
from os import makedirs, remove from os import makedirs, remove
import shutil import shutil
from copy import deepcopy
from tools.export.makefile import Makefile, GccArm, Armc5, IAR from tools.export.makefile import Makefile, GccArm, Armc5, IAR
@ -39,22 +40,19 @@ class Eclipse(Makefile):
""" """
def get_target_config(self, ctx, configuration): def get_target_config(self, ctx, configuration):
"""Retrieve info from cdt_definitions.json""" """Retrieve info from cdt_definitions.json"""
tgt = TARGET_MAP[self.target] tgt = deepcopy(TARGET_MAP[self.target])
defaults = _CONFIGS_OPTIONS['default'] defaults = deepcopy(_CONFIGS_OPTIONS['default'])
eclipse_config = defaults['generic'] eclipse_config = deepcopy(defaults['generic'])
if configuration in defaults: if configuration in defaults:
eclipse_config.update(defaults[configuration]) eclipse_config.update(defaults[configuration])
target_specific = _CONFIGS_OPTIONS['targets'] target_specific = _CONFIGS_OPTIONS['targets']
if tgt.name in target_specific: if tgt.name in target_specific:
eclipse_config.update(target_specific[tgt.name]['generic']) eclipse_config.update(target_specific[tgt.name]['generic'])
if configuration in target_specific[tgt.name]: if configuration in target_specific[tgt.name]:
target_info.update(target_specific[tgt.name][configuration]) eclipse_config.update(target_specific[tgt.name][configuration])
eclipse_config.update(target_info) return eclipse_config
Eclipsedevice = namedtuple('Eclipsedevice', eclipse_config.keys())
return Eclipsedevice(**eclipse_config)
def generate(self): def generate(self):
"""Generate Makefile, .cproject & .project Eclipse project file, """Generate Makefile, .cproject & .project Eclipse project file,
@ -88,8 +86,7 @@ class Eclipse(Makefile):
'{target}_{project}_{conf}_pyocd_settings.launch'.format( '{target}_{project}_{conf}_pyocd_settings.launch'.format(
target=self.target, target=self.target,
project=self.project_name, project=self.project_name,
conf=launch_name, conf=launch_name)))
launch='pyocd_settings')))
# Generate launch configurations for GNU MCU Eclipse plug-in # Generate launch configurations for GNU MCU Eclipse plug-in
self.gen_file('cdt/%s' % 'pyocd_settings_gnu_mcu.tmpl', ctx, join('eclipse-extras', self.gen_file('cdt/%s' % 'pyocd_settings_gnu_mcu.tmpl', ctx, join('eclipse-extras',
'{target}_{project}_{conf}.launch'.format( '{target}_{project}_{conf}.launch'.format(