Skip to content

Commit 98c3035

Browse files
committed
Handle uVision static libraries that use .lib file extension, show error message and solution
1 parent 41e2ec6 commit 98c3035

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mbed/mbed.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,13 @@ def fromurl(cls, url, path=None):
568568
def fromlib(cls, lib=None):
569569
assert lib.endswith('.lib')
570570
with open(lib) as f:
571-
return cls.fromurl(f.read(), lib[:-4])
571+
ref = f.read(200)
572+
if ref.startswith('!<arch>'):
573+
error(
574+
"A Keil uVision static library \"%s\" in \"%s\" uses a non-standard .lib file extension (should be .ar), which is not compatible with the mbed build tools.\n"
575+
"Please rename the static library to \"%s\" and try again.\n" % (os.path.basename(lib), os.path.split(lib)[0], os.path.basename(lib).replace('.lib', '.ar')))
576+
else:
577+
return cls.fromurl(ref, lib[:-4])
572578

573579
@classmethod
574580
def fromrepo(cls, path=None):

0 commit comments

Comments
 (0)