From 27f326673c9427b8f1cfd5680dfea784d48b35b8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 16 Sep 2021 21:13:54 +0300 Subject: [PATCH] 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 --- HISTORY.rst | 2 ++ platformio/builder/tools/piolib.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 4127fdca..3d31d53e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -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 `_) + 5.2.0 (2021-09-13) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 186485d2..dfe781e0 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -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