Fixed a "KeyError: Invalid board option 'build.cpu'" when using a precompiled library with a board that does not have a CPU field in the manifest // Resolve #405

This commit is contained in:
Ivan Kravets
2021-09-16 21:13:54 +03:00
parent e6fd766fff
commit 27f326673c
2 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,8 @@ PlatformIO Core 5
5.2.1 (2021-??-??)
~~~~~~~~~~~~~~~~~~
- Fixed a "KeyError: Invalid board option 'build.cpu'" when using a precompiled library with a board that does not have a CPU field in the manifest (`issue #4056 <https://github.com/platformio/platformio-core/issues/4056>`_)
5.2.0 (2021-09-13)
~~~~~~~~~~~~~~~~~~

View File

@ -567,7 +567,7 @@ class ArduinoLibBuilder(LibBuilderBase):
# add to LDPATH {build.mcu} folder
board_config = self.env.BoardConfig()
self.env.PrependUnique(
LIBPATH=os.path.join(self.src_dir, board_config.get("build.cpu"))
LIBPATH=os.path.join(self.src_dir, board_config.get("build.cpu", ""))
)
ldflags = [flag for flag in ldflags if flag] # remove empty
return " ".join(ldflags) if ldflags else None