diff --git a/mbed/mbed.py b/mbed/mbed.py index 8354a44e..65d57900 100644 --- a/mbed/mbed.py +++ b/mbed/mbed.py @@ -1116,6 +1116,11 @@ def getlibs(self): for f in files: if f.endswith('.lib') or f.endswith('.bld'): + # If we are in a subdirectory that is importing mbed-os, + # skip the import of mbed-os: the app will have already + # imported mbed-os. + if (f == 'mbed-os.lib') and (root != cwd_root): + continue repo = Repo.fromlib(os.path.join(root, f)) if repo: yield repo