Skip to content

Commit 06b60e3

Browse files
authored
Merge pull request #10295 from AndriiLishchynskyi/eclipse_configurations
eclipse_gcc_arm export improvement
2 parents 0b69837 + 7eb44cb commit 06b60e3

File tree

2 files changed

+19
-48
lines changed

2 files changed

+19
-48
lines changed

tools/export/cdt/__init__.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
import os
1919
import json
2020
from collections import namedtuple
21-
from tools.targets import TARGET_MAP
2221
from os.path import join, exists
2322
from os import makedirs, remove
2423
import shutil
2524
from copy import deepcopy
25+
from tools.targets import TARGET_MAP
2626

2727
from tools.export.makefile import Makefile, GccArm, Armc5, IAR
2828

@@ -38,19 +38,22 @@ class Eclipse(Makefile):
3838
"""Generic Eclipse project. Intended to be subclassed by classes that
3939
specify a type of Makefile.
4040
"""
41-
def get_target_config(self, ctx, configuration):
41+
def get_target_config(self, configuration):
4242
"""Retrieve info from cdt_definitions.json"""
43-
tgt = deepcopy(TARGET_MAP[self.target])
44-
defaults = deepcopy(_CONFIGS_OPTIONS['default'])
43+
defaults = _CONFIGS_OPTIONS['default']
4544
eclipse_config = deepcopy(defaults['generic'])
4645
if configuration in defaults:
4746
eclipse_config.update(defaults[configuration])
4847

48+
# Get target-specific options. Use labels to find alias
49+
# for target. This allows to define options within inheritance path
4950
target_specific = _CONFIGS_OPTIONS['targets']
50-
if tgt.name in target_specific:
51-
eclipse_config.update(target_specific[tgt.name]['generic'])
52-
if configuration in target_specific[tgt.name]:
53-
eclipse_config.update(target_specific[tgt.name][configuration])
51+
for target_alias in self.toolchain.target.labels:
52+
if target_alias in target_specific:
53+
eclipse_config.update(target_specific[target_alias]['generic'])
54+
if configuration in target_specific[target_alias]:
55+
eclipse_config.update(target_specific[target_alias][configuration])
56+
break
5457

5558
return eclipse_config
5659

@@ -63,7 +66,7 @@ def generate(self):
6366
starting_dot = re.compile(r'(^[.]/|^[.]$)')
6467
ctx = {
6568
'name': self.project_name,
66-
'elf_location': join('BUILD',self.project_name)+'.elf',
69+
'elf_location': join('BUILD', self.project_name)+'.elf',
6770
'c_symbols': self.toolchain.get_symbols(),
6871
'asm_symbols': self.toolchain.get_symbols(True),
6972
'target': self.target,
@@ -74,11 +77,11 @@ def generate(self):
7477
launch_cfgs = {}
7578
for launch_name in supported_launches:
7679
launch = deepcopy(ctx)
77-
launch.update({'device': self.get_target_config(ctx, launch_name)})
80+
launch.update({'device': self.get_target_config(launch_name)})
7881
launch_cfgs[launch_name] = launch
7982

80-
if not exists(join(self.export_dir,'eclipse-extras')):
81-
makedirs(join(self.export_dir,'eclipse-extras'))
83+
if not exists(join(self.export_dir, 'eclipse-extras')):
84+
makedirs(join(self.export_dir, 'eclipse-extras'))
8285

8386
for launch_name, ctx in launch_cfgs.items():
8487
# Generate launch configurations for former GNU ARM Eclipse plug-in
@@ -95,7 +98,7 @@ def generate(self):
9598
conf=launch_name)))
9699

97100
self.gen_file('cdt/necessary_software.tmpl', ctx,
98-
join('eclipse-extras','necessary_software.p2f'))
101+
join('eclipse-extras', 'necessary_software.p2f'))
99102

100103
self.gen_file('cdt/.cproject.tmpl', ctx, '.cproject')
101104
self.gen_file('cdt/.project.tmpl', ctx, '.project')
@@ -119,7 +122,7 @@ class EclipseArmc5(Eclipse, Armc5):
119122
def is_target_supported(cls, target_name):
120123
target = TARGET_MAP[target_name]
121124
if int(target.build_tools_metadata["version"]) > 0:
122-
return "ARMC5" in target.supported_toolchains;
125+
return "ARMC5" in target.supported_toolchains
123126
else:
124127
return True
125128

tools/export/cdt/cdt_definitions.json

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,47 +41,15 @@
4141
},
4242

4343
"targets": {
44-
"CY8CPROTO_062_4343W": {
44+
"PSOC6_01": {
4545
"generic": {
4646
"gdbServerGdbPortNumber": 3334,
4747
"gdbServerOther": "-p 3333
--no-deprecation-warning",
4848
"corePortNumber": 3334
4949
}
5050
},
5151

52-
"CY8CMOD_062_4343W": {
53-
"generic": {
54-
"gdbServerGdbPortNumber": 3334,
55-
"gdbServerOther": "-p 3333
--no-deprecation-warning",
56-
"corePortNumber": 3334
57-
}
58-
},
59-
60-
"CYW943012P6EVB_01": {
61-
"generic": {
62-
"gdbServerGdbPortNumber": 3334,
63-
"gdbServerOther": "-p 3333
--no-deprecation-warning",
64-
"corePortNumber": 3334
65-
}
66-
},
67-
68-
"CY8CKIT_062_WIFI_BT": {
69-
"generic": {
70-
"gdbServerGdbPortNumber": 3334,
71-
"gdbServerOther": "-p 3333
--no-deprecation-warning",
72-
"corePortNumber": 3334
73-
}
74-
},
75-
76-
"CY8CKIT_062_BLE": {
77-
"generic": {
78-
"gdbServerGdbPortNumber": 3334,
79-
"gdbServerOther": "-p 3333
--no-deprecation-warning",
80-
"corePortNumber": 3334
81-
}
82-
},
83-
84-
"CY8CKIT_062_4343W": {
52+
"PSOC6_02": {
8553
"generic": {
8654
"gdbServerGdbPortNumber": 3334,
8755
"gdbServerOther": "-p 3333
--no-deprecation-warning",

0 commit comments

Comments
 (0)