From 9fa2c75912b0c2655e8183b4592db2c33ec54b9c Mon Sep 17 00:00:00 2001 From: "Andriy.Lishchynskyi" Date: Thu, 10 Jan 2019 17:02:47 +0200 Subject: [PATCH 1/8] added support for debug and program launch configurations --- tools/export/cdt/__init__.py | 17 +++-- tools/export/cdt/pyocd_settings_debug.tmpl | 70 ++++++++++++++++++++ tools/export/cdt/pyocd_settings_program.tmpl | 70 ++++++++++++++++++++ 3 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 tools/export/cdt/pyocd_settings_debug.tmpl create mode 100644 tools/export/cdt/pyocd_settings_program.tmpl diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index 226526ba2d..685b2413a9 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -3,6 +3,7 @@ import re from os.path import join, exists from os import makedirs, remove import shutil +from jinja2.exceptions import TemplateNotFound from tools.export.makefile import Makefile, GccArm, Armc5, IAR @@ -29,11 +30,19 @@ class Eclipse(Makefile): if not exists(join(self.export_dir,'eclipse-extras')): makedirs(join(self.export_dir,'eclipse-extras')) + templates = ['%s.tmpl' % (self.target.lower())] + \ + ['%s.tmpl' % (label.lower()) for label + in self.toolchain.target.extra_labels] + \ + ['%s.tmpl' % 'pyocd_settings'] + + for templatefile in templates: + try: + self.gen_file('cdt/%s' % templatefile, ctx, join('eclipse-extras', + '{target}_{project}_{launch}.launch'.format(target=self.target, + project=self.project_name, launch=templatefile))) + except TemplateNotFound: + pass - self.gen_file('cdt/pyocd_settings.tmpl', ctx, - join('eclipse-extras', - '{target}_pyocd_{project}_settings.launch'.format(target=self.target, - project=self.project_name))) self.gen_file('cdt/necessary_software.tmpl', ctx, join('eclipse-extras','necessary_software.p2f')) diff --git a/tools/export/cdt/pyocd_settings_debug.tmpl b/tools/export/cdt/pyocd_settings_debug.tmpl new file mode 100644 index 0000000000..290338d3c7 --- /dev/null +++ b/tools/export/cdt/pyocd_settings_debug.tmpl @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/export/cdt/pyocd_settings_program.tmpl b/tools/export/cdt/pyocd_settings_program.tmpl new file mode 100644 index 0000000000..dc6c0c34a2 --- /dev/null +++ b/tools/export/cdt/pyocd_settings_program.tmpl @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 7a85ae75e6a3083a52fc63b019d85f993dcdd9c4 Mon Sep 17 00:00:00 2001 From: "Andriy.Lishchynskyi" Date: Mon, 14 Jan 2019 17:02:29 +0200 Subject: [PATCH 2/8] Reworked launch configuration creation mechanism - switched to single template. Specific data comes from the JSON file --- tools/export/cdt/__init__.py | 63 +++++++++++++----- tools/export/cdt/cdt_definitions.json | 60 +++++++++++++++++ tools/export/cdt/pyocd_settings.tmpl | 38 +++++------ tools/export/cdt/pyocd_settings_debug.tmpl | 70 -------------------- tools/export/cdt/pyocd_settings_program.tmpl | 70 -------------------- 5 files changed, 127 insertions(+), 174 deletions(-) create mode 100644 tools/export/cdt/cdt_definitions.json delete mode 100644 tools/export/cdt/pyocd_settings_debug.tmpl delete mode 100644 tools/export/cdt/pyocd_settings_program.tmpl diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index 685b2413a9..fa51a1efe9 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -1,16 +1,49 @@ import re - +import os +import json +from collections import namedtuple +from tools.targets import TARGET_MAP from os.path import join, exists from os import makedirs, remove import shutil -from jinja2.exceptions import TemplateNotFound from tools.export.makefile import Makefile, GccArm, Armc5, IAR +_eclipse_defs = os.path.join( + os.path.dirname(os.path.abspath(__file__)), 'cdt_definitions.json') + +with open(_eclipse_defs, 'r') as f: + _CONFIGS_OPTIONS = json.load(f) + +supported_launches = ['debug', 'program'] + class Eclipse(Makefile): """Generic Eclipse project. Intended to be subclassed by classes that specify a type of Makefile. """ + def get_target_config(self, ctx, configuration): + """Retrieve info from cdt_definitions.json""" + tgt = TARGET_MAP[self.target] + defaults = _CONFIGS_OPTIONS['default'] + eclipse_config = defaults['generic'] + if configuration in defaults: + eclipse_config.update(defaults[configuration]) + + target_specific = _CONFIGS_OPTIONS['targets'] + if tgt.name in target_specific: + target_info = target_specific[tgt.name]['generic'] + if configuration in target_specific[tgt.name]: + target_info.update(target_specific[tgt.name][configuration]) + + eclipse_config.update(target_info) + + #special case for gdbClientOtherOptions param - in some cases it may contain dynamical values, fill in it here + eclipse_config['gdbClientOtherOptions'] = eclipse_config['gdbClientOtherOptions'].format( + elf_location=ctx['elf_location']) + + Eclipsedevice = namedtuple('Eclipsedevice', eclipse_config.keys()) + return Eclipsedevice(**eclipse_config) + def generate(self): """Generate Makefile, .cproject & .project Eclipse project file, py_ocd_settings launch file, and software link .p2f file @@ -26,22 +59,22 @@ class Eclipse(Makefile): 'include_paths': [starting_dot.sub('%s/' % self.project_name, inc) for inc in self.resources.inc_dirs], 'load_exe': str(self.LOAD_EXE).lower() } - + + launch_cfgs = {} + for launch_name in supported_launches: + launch = dict(ctx.items() + {'device': self.get_target_config(ctx, launch_name)}.items()) + launch_cfgs.update({launch_name: launch}) + if not exists(join(self.export_dir,'eclipse-extras')): makedirs(join(self.export_dir,'eclipse-extras')) - templates = ['%s.tmpl' % (self.target.lower())] + \ - ['%s.tmpl' % (label.lower()) for label - in self.toolchain.target.extra_labels] + \ - ['%s.tmpl' % 'pyocd_settings'] - - for templatefile in templates: - try: - self.gen_file('cdt/%s' % templatefile, ctx, join('eclipse-extras', - '{target}_{project}_{launch}.launch'.format(target=self.target, - project=self.project_name, launch=templatefile))) - except TemplateNotFound: - pass + for launch_name, ctx in launch_cfgs.items(): + self.gen_file('cdt/%s' % 'pyocd_settings.tmpl', ctx, join('eclipse-extras', + '{target}_{project}_{conf}_{launch}.launch'.format( + target=self.target, + project=self.project_name, + conf=launch_name, + launch='pyocd_settings'))) self.gen_file('cdt/necessary_software.tmpl', ctx, join('eclipse-extras','necessary_software.p2f')) diff --git a/tools/export/cdt/cdt_definitions.json b/tools/export/cdt/cdt_definitions.json new file mode 100644 index 0000000000..112d09adf7 --- /dev/null +++ b/tools/export/cdt/cdt_definitions.json @@ -0,0 +1,60 @@ +{ + "default": { + "generic": { + "doContinue": "true", + "doFirstReset": "true", + "doGdbServerAllocateSemihostingConsole": "true", + "doSecondReset": "true", + "enableSemihosting": "true", + "firstResetType": "init", + "gdbClientOtherCommands": "set mem inaccessible-by-default off", + "gdbClientOtherOptions": "", + "gdbServerBusSpeed": 1000000, + "gdbServerEnableSemihosting": "true", + "gdbServerFlashMode": 0, + "gdbServerGdbPortNumber": 3333, + "gdbServerHaltAtHardFault": "true", + "gdbServerOther": "", + "secondResetType": "halt", + "coreLoadImage": "true", + "coreLoadSymbols": "true", + "corePortNumber": 3333, + "setStopAt": "true" + }, + + "debug": { + }, + + "program": { + "doContinue": "false", + "doSecondReset": "false", + "gdbClientOtherCommands": "set mem inaccessible-by-default off target remote localhost:3333 mon reset halt load mon reset quit", + "gdbClientOtherOptions": "{elf_location}", + "coreLoadImage": "false", + "coreLoadSymbols": "false", + "setStopAt": "false" + } + }, + + "targets": { + "CY8CPROTO_062_4343W": { + "generic": { + "doFirstReset": "false", + "doGdbServerAllocateSemihostingConsole": "false", + "enableSemihosting": "false", + "firstResetType": "", + "gdbServerEnableSemihosting": "false", + "gdbServerFlashMode": 2, + "gdbServerGdbPortNumber": 3334, + "gdbServerHaltAtHardFault": "false", + "gdbServerOther": "-p 3333 --no-deprecation-warning", + "secondResetType": "", + "corePortNumber": 3334 + }, + + "program": { + "gdbClientOtherCommands": "set mem inaccessible-by-default off target remote localhost:3334 mon reset halt load mon reset quit" + } + } + } +} \ No newline at end of file diff --git a/tools/export/cdt/pyocd_settings.tmpl b/tools/export/cdt/pyocd_settings.tmpl index 67d0ed4fba..a59987a6cb 100644 --- a/tools/export/cdt/pyocd_settings.tmpl +++ b/tools/export/cdt/pyocd_settings.tmpl @@ -1,27 +1,27 @@ - + - + - - + + - - - - + + + + - + - + - - - + + + - + @@ -29,18 +29,18 @@ - + - - + + - + - + diff --git a/tools/export/cdt/pyocd_settings_debug.tmpl b/tools/export/cdt/pyocd_settings_debug.tmpl deleted file mode 100644 index 290338d3c7..0000000000 --- a/tools/export/cdt/pyocd_settings_debug.tmpl +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/export/cdt/pyocd_settings_program.tmpl b/tools/export/cdt/pyocd_settings_program.tmpl deleted file mode 100644 index dc6c0c34a2..0000000000 --- a/tools/export/cdt/pyocd_settings_program.tmpl +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 7f2caacbdde410107594ebf6d77cfb92e621524d Mon Sep 17 00:00:00 2001 From: "Andriy.Lishchynskyi" Date: Fri, 18 Jan 2019 18:14:35 +0200 Subject: [PATCH 3/8] Added GNU MCU Eclipse plug-in support --- tools/export/cdt/__init__.py | 12 +++- tools/export/cdt/cdt_definitions.json | 2 - ...tings.tmpl => pyocd_settings_gnu_arm.tmpl} | 0 tools/export/cdt/pyocd_settings_gnu_mcu.tmpl | 69 +++++++++++++++++++ 4 files changed, 79 insertions(+), 4 deletions(-) rename tools/export/cdt/{pyocd_settings.tmpl => pyocd_settings_gnu_arm.tmpl} (100%) create mode 100644 tools/export/cdt/pyocd_settings_gnu_mcu.tmpl diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index fa51a1efe9..7319ce99eb 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -46,7 +46,8 @@ class Eclipse(Makefile): def generate(self): """Generate Makefile, .cproject & .project Eclipse project file, - py_ocd_settings launch file, and software link .p2f file + pyocd_settings launch files for both GNU ARM Eclipse and + GNU MCU Eclipse plug-ins, and software link .p2f file """ super(Eclipse, self).generate() starting_dot = re.compile(r'(^[.]/|^[.]$)') @@ -69,12 +70,19 @@ class Eclipse(Makefile): makedirs(join(self.export_dir,'eclipse-extras')) for launch_name, ctx in launch_cfgs.items(): - self.gen_file('cdt/%s' % 'pyocd_settings.tmpl', ctx, join('eclipse-extras', + # Generate launch configurations for former GNU ARM Eclipse plug-in + self.gen_file('cdt/%s' % 'pyocd_settings_gnu_arm.tmpl', ctx, join('eclipse-extras', '{target}_{project}_{conf}_{launch}.launch'.format( target=self.target, project=self.project_name, conf=launch_name, launch='pyocd_settings'))) + # Generate launch configurations for GNU MCU Eclipse plug-in + self.gen_file('cdt/%s' % 'pyocd_settings_gnu_mcu.tmpl', ctx, join('eclipse-extras', + '{target}_{project}_{conf}.launch'.format( + target=self.target, + project=self.project_name, + conf=launch_name))) self.gen_file('cdt/necessary_software.tmpl', ctx, join('eclipse-extras','necessary_software.p2f')) diff --git a/tools/export/cdt/cdt_definitions.json b/tools/export/cdt/cdt_definitions.json index 112d09adf7..cfd8a02cb4 100644 --- a/tools/export/cdt/cdt_definitions.json +++ b/tools/export/cdt/cdt_definitions.json @@ -42,13 +42,11 @@ "doFirstReset": "false", "doGdbServerAllocateSemihostingConsole": "false", "enableSemihosting": "false", - "firstResetType": "", "gdbServerEnableSemihosting": "false", "gdbServerFlashMode": 2, "gdbServerGdbPortNumber": 3334, "gdbServerHaltAtHardFault": "false", "gdbServerOther": "-p 3333 --no-deprecation-warning", - "secondResetType": "", "corePortNumber": 3334 }, diff --git a/tools/export/cdt/pyocd_settings.tmpl b/tools/export/cdt/pyocd_settings_gnu_arm.tmpl similarity index 100% rename from tools/export/cdt/pyocd_settings.tmpl rename to tools/export/cdt/pyocd_settings_gnu_arm.tmpl diff --git a/tools/export/cdt/pyocd_settings_gnu_mcu.tmpl b/tools/export/cdt/pyocd_settings_gnu_mcu.tmpl new file mode 100644 index 0000000000..689b3e1377 --- /dev/null +++ b/tools/export/cdt/pyocd_settings_gnu_mcu.tmpl @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 55a6ca5b1a4ef3f31b7c4df6abd5accc3827caa5 Mon Sep 17 00:00:00 2001 From: "Andriy.Lishchynskyi" Date: Wed, 23 Jan 2019 23:25:20 +0200 Subject: [PATCH 4/8] Fix python3 compatibility issue --- tools/export/cdt/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index 7319ce99eb..423d6eed31 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -63,7 +63,8 @@ class Eclipse(Makefile): launch_cfgs = {} for launch_name in supported_launches: - launch = dict(ctx.items() + {'device': self.get_target_config(ctx, launch_name)}.items()) + launch = dict(ctx.items()) + launch.update({'device': self.get_target_config(ctx, launch_name)}.items()) launch_cfgs.update({launch_name: launch}) if not exists(join(self.export_dir,'eclipse-extras')): From 48dfcd98a907cb178da60f1cda692ebadfe38285 Mon Sep 17 00:00:00 2001 From: "Andriy.Lishchynskyi" Date: Wed, 30 Jan 2019 19:48:20 +0200 Subject: [PATCH 5/8] Changes: - added new erase launch configuration - added new kits support - code cleanup --- tools/export/cdt/__init__.py | 6 +- tools/export/cdt/cdt_definitions.json | 60 +++++++++++++++----- tools/export/cdt/pyocd_settings_gnu_arm.tmpl | 2 +- tools/export/cdt/pyocd_settings_gnu_mcu.tmpl | 2 +- 4 files changed, 50 insertions(+), 20 deletions(-) diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index 423d6eed31..fce242ad49 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -15,7 +15,7 @@ _eclipse_defs = os.path.join( with open(_eclipse_defs, 'r') as f: _CONFIGS_OPTIONS = json.load(f) -supported_launches = ['debug', 'program'] +supported_launches = ['debug', 'program', 'erase'] class Eclipse(Makefile): """Generic Eclipse project. Intended to be subclassed by classes that @@ -37,10 +37,6 @@ class Eclipse(Makefile): eclipse_config.update(target_info) - #special case for gdbClientOtherOptions param - in some cases it may contain dynamical values, fill in it here - eclipse_config['gdbClientOtherOptions'] = eclipse_config['gdbClientOtherOptions'].format( - elf_location=ctx['elf_location']) - Eclipsedevice = namedtuple('Eclipsedevice', eclipse_config.keys()) return Eclipsedevice(**eclipse_config) diff --git a/tools/export/cdt/cdt_definitions.json b/tools/export/cdt/cdt_definitions.json index cfd8a02cb4..6a11a88dc8 100644 --- a/tools/export/cdt/cdt_definitions.json +++ b/tools/export/cdt/cdt_definitions.json @@ -15,21 +15,25 @@ "gdbServerGdbPortNumber": 3333, "gdbServerHaltAtHardFault": "true", "gdbServerOther": "", + "otherRunCommands": "", "secondResetType": "halt", "coreLoadImage": "true", "coreLoadSymbols": "true", "corePortNumber": 3333, "setStopAt": "true" }, - "debug": { }, - "program": { + "doContinue": "false", + "otherRunCommands": "continue& quit", + "coreLoadSymbols": "false", + "setStopAt": "false" + }, + "erase": { "doContinue": "false", "doSecondReset": "false", - "gdbClientOtherCommands": "set mem inaccessible-by-default off target remote localhost:3333 mon reset halt load mon reset quit", - "gdbClientOtherOptions": "{elf_location}", + "otherRunCommands": "mon erase --chip quit", "coreLoadImage": "false", "coreLoadSymbols": "false", "setStopAt": "false" @@ -39,19 +43,49 @@ "targets": { "CY8CPROTO_062_4343W": { "generic": { - "doFirstReset": "false", - "doGdbServerAllocateSemihostingConsole": "false", - "enableSemihosting": "false", - "gdbServerEnableSemihosting": "false", - "gdbServerFlashMode": 2, "gdbServerGdbPortNumber": 3334, - "gdbServerHaltAtHardFault": "false", "gdbServerOther": "-p 3333 --no-deprecation-warning", "corePortNumber": 3334 - }, + } + }, - "program": { - "gdbClientOtherCommands": "set mem inaccessible-by-default off target remote localhost:3334 mon reset halt load mon reset quit" + "CY8CMOD_062_4343W": { + "generic": { + "gdbServerGdbPortNumber": 3334, + "gdbServerOther": "-p 3333 --no-deprecation-warning", + "corePortNumber": 3334 + } + }, + + "CYW943012P6EVB_01": { + "generic": { + "gdbServerGdbPortNumber": 3334, + "gdbServerOther": "-p 3333 --no-deprecation-warning", + "corePortNumber": 3334 + } + }, + + "CY8CKIT_062_WIFI_BT": { + "generic": { + "gdbServerGdbPortNumber": 3334, + "gdbServerOther": "-p 3333 --no-deprecation-warning", + "corePortNumber": 3334 + } + }, + + "CY8CKIT_062_BLE": { + "generic": { + "gdbServerGdbPortNumber": 3334, + "gdbServerOther": "-p 3333 --no-deprecation-warning", + "corePortNumber": 3334 + } + }, + + "CY8CKIT_062_4343W": { + "generic": { + "gdbServerGdbPortNumber": 3334, + "gdbServerOther": "-p 3333 --no-deprecation-warning", + "corePortNumber": 3334 } } } diff --git a/tools/export/cdt/pyocd_settings_gnu_arm.tmpl b/tools/export/cdt/pyocd_settings_gnu_arm.tmpl index a59987a6cb..9bfff6359e 100644 --- a/tools/export/cdt/pyocd_settings_gnu_arm.tmpl +++ b/tools/export/cdt/pyocd_settings_gnu_arm.tmpl @@ -28,7 +28,7 @@ - + diff --git a/tools/export/cdt/pyocd_settings_gnu_mcu.tmpl b/tools/export/cdt/pyocd_settings_gnu_mcu.tmpl index 689b3e1377..c87fa3a4f9 100644 --- a/tools/export/cdt/pyocd_settings_gnu_mcu.tmpl +++ b/tools/export/cdt/pyocd_settings_gnu_mcu.tmpl @@ -29,7 +29,7 @@ - + From 6f584cd35e4d11d6455aa81134cb3069346abbf2 Mon Sep 17 00:00:00 2001 From: "Andriy.Lishchynskyi" Date: Thu, 31 Jan 2019 16:31:02 +0200 Subject: [PATCH 6/8] Added copyright notes --- tools/export/cdt/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index fce242ad49..eaaae626cd 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -1,3 +1,19 @@ +""" +mbed SDK +Copyright (c) 2016-2019 ARM Limited + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" import re import os import json From 020c840cf8880fcc601efd03285ba82fcb33d208 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 31 Jan 2019 19:29:13 +0200 Subject: [PATCH 7/8] Apply suggestions from code review Co-Authored-By: Cypress-OpenOCD <39907069+Cypress-OpenOCD@users.noreply.github.com> --- tools/export/cdt/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index eaaae626cd..f5788cb78d 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -47,7 +47,7 @@ class Eclipse(Makefile): target_specific = _CONFIGS_OPTIONS['targets'] if tgt.name in target_specific: - target_info = target_specific[tgt.name]['generic'] + eclipse_config.update(target_specific[tgt.name]['generic']) if configuration in target_specific[tgt.name]: target_info.update(target_specific[tgt.name][configuration]) @@ -75,9 +75,9 @@ class Eclipse(Makefile): launch_cfgs = {} for launch_name in supported_launches: - launch = dict(ctx.items()) - launch.update({'device': self.get_target_config(ctx, launch_name)}.items()) - launch_cfgs.update({launch_name: launch}) + launch = deepcopy(ctx) + launch.update({'device': self.get_target_config(ctx, launch_name)}) + launch_cfgs[launch_name] = launch if not exists(join(self.export_dir,'eclipse-extras')): makedirs(join(self.export_dir,'eclipse-extras')) @@ -85,7 +85,7 @@ class Eclipse(Makefile): for launch_name, ctx in launch_cfgs.items(): # Generate launch configurations for former GNU ARM Eclipse plug-in self.gen_file('cdt/%s' % 'pyocd_settings_gnu_arm.tmpl', ctx, join('eclipse-extras', - '{target}_{project}_{conf}_{launch}.launch'.format( + '{target}_{project}_{conf}_pyocd_settings.launch'.format( target=self.target, project=self.project_name, conf=launch_name, From be5a62577163a0edee10f092801d350618c39d0d Mon Sep 17 00:00:00 2001 From: "Andriy.Lishchynskyi" Date: Thu, 31 Jan 2019 19:31:28 +0200 Subject: [PATCH 8/8] Resolved code review comments --- tools/export/cdt/__init__.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index f5788cb78d..21e8a15750 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -22,6 +22,7 @@ from tools.targets import TARGET_MAP from os.path import join, exists from os import makedirs, remove import shutil +from copy import deepcopy from tools.export.makefile import Makefile, GccArm, Armc5, IAR @@ -39,22 +40,19 @@ class Eclipse(Makefile): """ def get_target_config(self, ctx, configuration): """Retrieve info from cdt_definitions.json""" - tgt = TARGET_MAP[self.target] - defaults = _CONFIGS_OPTIONS['default'] - eclipse_config = defaults['generic'] + tgt = deepcopy(TARGET_MAP[self.target]) + defaults = deepcopy(_CONFIGS_OPTIONS['default']) + eclipse_config = deepcopy(defaults['generic']) if configuration in defaults: eclipse_config.update(defaults[configuration]) target_specific = _CONFIGS_OPTIONS['targets'] 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]: - target_info.update(target_specific[tgt.name][configuration]) - - eclipse_config.update(target_info) + eclipse_config.update(target_specific[tgt.name][configuration]) - Eclipsedevice = namedtuple('Eclipsedevice', eclipse_config.keys()) - return Eclipsedevice(**eclipse_config) + return eclipse_config def generate(self): """Generate Makefile, .cproject & .project Eclipse project file, @@ -88,8 +86,7 @@ class Eclipse(Makefile): '{target}_{project}_{conf}_pyocd_settings.launch'.format( target=self.target, project=self.project_name, - conf=launch_name, - launch='pyocd_settings'))) + conf=launch_name))) # Generate launch configurations for GNU MCU Eclipse plug-in self.gen_file('cdt/%s' % 'pyocd_settings_gnu_mcu.tmpl', ctx, join('eclipse-extras', '{target}_{project}_{conf}.launch'.format(