diff --git a/mbed/mbed.py b/mbed/mbed.py index 8354a44e..d86b997f 100644 --- a/mbed/mbed.py +++ b/mbed/mbed.py @@ -1116,6 +1116,12 @@ def getlibs(self): for f in files: if f.endswith('.lib') or f.endswith('.bld'): + # If a library imports mbed-os and we're in including that + # library in our app, skip the import of mbed-os: the app + # will have already imported mbed-os. + if f == 'mbed-os.lib' and self.pathtype() == 'library': + action("Skipping redundant import of mbed-os in \"%s\"" % self.path) + continue repo = Repo.fromlib(os.path.join(root, f)) if repo: yield repo