Skip to content

Tools: Allow exporting of uARM-only targets to uvision #7197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tools/export/uvision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,16 @@ class Uvision(Exporter):
@classmethod
def is_target_supported(cls, target_name):
target = TARGET_MAP[target_name]
return apply_supported_whitelist(
cls.TOOLCHAIN, cls.POST_BINARY_WHITELIST, target) and\
DeviceCMSIS.check_supported(target_name)
if not (set(target.supported_toolchains) and set(["ARM", "uARM"])):
return False
if not DeviceCMSIS.check_supported(target_name):
return False
if not hasattr(target, "post_binary_hook"):
return True
if target.post_binary_hook['function'] in cls.POST_BINARY_WHITELIST:
return True
else:
return False

#File associations within .uvprojx file
file_types = {'.cpp': 8, '.c': 1, '.s': 2,
Expand Down
9 changes: 7 additions & 2 deletions tools/toolchains/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,7 @@ def add_macros(self, new_macros):

def get_labels(self):
if self.labels is None:
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
toolchain_labels.remove('mbedToolchain')
toolchain_labels = self._get_toolchain_labels()
self.labels = {
'TARGET': self.target.labels,
'FEATURE': self.target.features,
Expand All @@ -551,6 +550,12 @@ def get_labels(self):
self.labels['TARGET'].append("RELEASE")
return self.labels

def _get_toolchain_labels(self):
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
toolchain_labels.remove('mbedToolchain')
toolchain_labels.remove('object')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is 'object' now also being removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it was never supposed to be there in the first place and adds no information.

return toolchain_labels


# Determine whether a source file needs updating/compiling
def need_update(self, target, dependencies):
Expand Down
19 changes: 17 additions & 2 deletions tools/toolchains/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def __init__(self, target, notify=None, macros=None,
raise NotSupportedException(
"this compiler does not support the core %s" % target.core)

if getattr(target, "default_lib", "std") == "small":
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:
self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD")
if "--library_type=microlib" not in self.flags['ld']:
self.flags['ld'].append("--library_type=microlib")

if target.core == "Cortex-M0+":
cpu = "Cortex-M0"
elif target.core == "Cortex-M4F":
Expand Down Expand Up @@ -85,6 +91,12 @@ def __init__(self, target, notify=None, macros=None,

self.SHEBANG += " --cpu=%s" % cpu

def _get_toolchain_labels(self):
if getattr(self.target, "default_lib", "std") == "small":
return ["ARM", "ARM_MICRO"]
else:
return ["ARM", "ARM_STD"]

def parse_dependencies(self, dep_path):
dependencies = []
for line in open(dep_path).readlines():
Expand Down Expand Up @@ -291,8 +303,8 @@ def __init__(self, target, notify=None, macros=None,
build_profile=None, build_dir=None):
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
build_profile=build_profile)
if "ARM" not in target.supported_toolchains:
raise NotSupportedException("ARM compiler support is required for ARM build")
if not set(("ARM", "uARM")).intersection(set(target.supported_toolchains)):
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")


class ARM_MICRO(ARM):
Expand Down Expand Up @@ -388,6 +400,9 @@ def __init__(self, target, *args, **kwargs):
self.ar = [join(TOOLCHAIN_PATHS["ARMC6"], "armar")]
self.elf2bin = join(TOOLCHAIN_PATHS["ARMC6"], "fromelf")

def _get_toolchain_labels(self):
return ["ARM", "ARM_STD", "ARMC6"]

def parse_dependencies(self, dep_path):
return mbedToolchain.parse_dependencies(self, dep_path)

Expand Down