Merge pull request #10295 from AndriiLishchynskyi/eclipse_configurations

eclipse_gcc_arm export improvement
pull/10320/head
Martin Kojtal 2019-04-04 12:42:34 +02:00 committed by GitHub
commit 06b60e3f68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 48 deletions

View File

@ -18,11 +18,11 @@ import re
import os import os
import json import json
from collections import namedtuple from collections import namedtuple
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 copy import deepcopy
from tools.targets import TARGET_MAP
from tools.export.makefile import Makefile, GccArm, Armc5, IAR from tools.export.makefile import Makefile, GccArm, Armc5, IAR
@ -38,19 +38,22 @@ class Eclipse(Makefile):
"""Generic Eclipse project. Intended to be subclassed by classes that """Generic Eclipse project. Intended to be subclassed by classes that
specify a type of Makefile. specify a type of Makefile.
""" """
def get_target_config(self, ctx, configuration): def get_target_config(self, configuration):
"""Retrieve info from cdt_definitions.json""" """Retrieve info from cdt_definitions.json"""
tgt = deepcopy(TARGET_MAP[self.target]) defaults = _CONFIGS_OPTIONS['default']
defaults = deepcopy(_CONFIGS_OPTIONS['default'])
eclipse_config = deepcopy(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])
# Get target-specific options. Use labels to find alias
# for target. This allows to define options within inheritance path
target_specific = _CONFIGS_OPTIONS['targets'] target_specific = _CONFIGS_OPTIONS['targets']
if tgt.name in target_specific: for target_alias in self.toolchain.target.labels:
eclipse_config.update(target_specific[tgt.name]['generic']) if target_alias in target_specific:
if configuration in target_specific[tgt.name]: eclipse_config.update(target_specific[target_alias]['generic'])
eclipse_config.update(target_specific[tgt.name][configuration]) if configuration in target_specific[target_alias]:
eclipse_config.update(target_specific[target_alias][configuration])
break
return eclipse_config return eclipse_config
@ -63,7 +66,7 @@ class Eclipse(Makefile):
starting_dot = re.compile(r'(^[.]/|^[.]$)') starting_dot = re.compile(r'(^[.]/|^[.]$)')
ctx = { ctx = {
'name': self.project_name, 'name': self.project_name,
'elf_location': join('BUILD',self.project_name)+'.elf', 'elf_location': join('BUILD', self.project_name)+'.elf',
'c_symbols': self.toolchain.get_symbols(), 'c_symbols': self.toolchain.get_symbols(),
'asm_symbols': self.toolchain.get_symbols(True), 'asm_symbols': self.toolchain.get_symbols(True),
'target': self.target, 'target': self.target,
@ -74,11 +77,11 @@ class Eclipse(Makefile):
launch_cfgs = {} launch_cfgs = {}
for launch_name in supported_launches: for launch_name in supported_launches:
launch = deepcopy(ctx) launch = deepcopy(ctx)
launch.update({'device': self.get_target_config(ctx, launch_name)}) launch.update({'device': self.get_target_config(launch_name)})
launch_cfgs[launch_name] = launch launch_cfgs[launch_name] = launch
if not exists(join(self.export_dir,'eclipse-extras')): if not exists(join(self.export_dir, 'eclipse-extras')):
makedirs(join(self.export_dir,'eclipse-extras')) makedirs(join(self.export_dir, 'eclipse-extras'))
for launch_name, ctx in launch_cfgs.items(): for launch_name, ctx in launch_cfgs.items():
# Generate launch configurations for former GNU ARM Eclipse plug-in # Generate launch configurations for former GNU ARM Eclipse plug-in
@ -95,7 +98,7 @@ class Eclipse(Makefile):
conf=launch_name))) conf=launch_name)))
self.gen_file('cdt/necessary_software.tmpl', ctx, self.gen_file('cdt/necessary_software.tmpl', ctx,
join('eclipse-extras','necessary_software.p2f')) join('eclipse-extras', 'necessary_software.p2f'))
self.gen_file('cdt/.cproject.tmpl', ctx, '.cproject') self.gen_file('cdt/.cproject.tmpl', ctx, '.cproject')
self.gen_file('cdt/.project.tmpl', ctx, '.project') self.gen_file('cdt/.project.tmpl', ctx, '.project')
@ -119,7 +122,7 @@ class EclipseArmc5(Eclipse, Armc5):
def is_target_supported(cls, target_name): def is_target_supported(cls, target_name):
target = TARGET_MAP[target_name] target = TARGET_MAP[target_name]
if int(target.build_tools_metadata["version"]) > 0: if int(target.build_tools_metadata["version"]) > 0:
return "ARMC5" in target.supported_toolchains; return "ARMC5" in target.supported_toolchains
else: else:
return True return True

View File

@ -41,7 +41,7 @@
}, },
"targets": { "targets": {
"CY8CPROTO_062_4343W": { "PSOC6_01": {
"generic": { "generic": {
"gdbServerGdbPortNumber": 3334, "gdbServerGdbPortNumber": 3334,
"gdbServerOther": "-p 3333
--no-deprecation-warning", "gdbServerOther": "-p 3333
--no-deprecation-warning",
@ -49,39 +49,7 @@
} }
}, },
"CY8CMOD_062_4343W": { "PSOC6_02": {
"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": { "generic": {
"gdbServerGdbPortNumber": 3334, "gdbServerGdbPortNumber": 3334,
"gdbServerOther": "-p 3333
--no-deprecation-warning", "gdbServerOther": "-p 3333
--no-deprecation-warning",