question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Worked last week, now Fails to compile: ESP32 KeyError: "Invalid board option 'build.cpu'":

See original GitHub issue
  • PlatformIO Core.

Configuration

Operating system: Windows 10 PlatformIO Version (platformio --version): PlatformIO Core, version 5.2.0

Description of problem

Compile fails on project that’s been working flawlessly for the past 8 months. Last week was able to compile just fine, noting has changed in the code base yet this week I get an obscure error that I’m unable to find any relevant documentation or solutions to. I’m getting this error on my other Windows 10 desktop as well. However, I’m able to compile a similar project with the same PIO file without issue.

I’ve done the regedit fix for python 3.9, didn’t help. Uninstalled 3.9, same problem. I currently have Python 3.7.7

> Executing task: C:\Users\Phil\.platformio\penv\Scripts\platformio.exe run <

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.3.2) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - tool-openocd-esp32 2.1000.20210721 (10.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
KeyError: "Invalid board option 'build.cpu'":
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 178:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Phil\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Phil\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Phil\.platformio\platforms\espressif32\builder\main.py", line 218:
    target_elf = env.BuildProgram()
  File "C:\Users\Phil\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 62:    
    env.ProcessProjectDeps()
  File "C:\Users\Phil\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 141:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "C:\Users\Phil\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1089:
    project.install_dependencies()
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 907:
    if _is_builtin(spec):
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 899:
    for lb in self.env.GetLibBuilders():
  File "C:\Users\Phil\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1020:
    lb = LibBuilderFactory.new(env, lib_dir)
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 61:
    obj = getattr(sys.modules[__name__], clsname)(env, path, verbose=verbose)
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 139:
    self.process_extra_options()
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 279:
    self.env.ProcessFlags(self.build_flags)
  File "C:\Users\Phil\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 570:
    LIBPATH=os.path.join(self.src_dir, board_config.get("build.cpu"))
  File "c:\users\phil\.platformio\penv\lib\site-packages\platformio\platform\board.py", line 46:
    raise KeyError("Invalid board option '%s'" % path)
============================================= [FAILED] Took 0.94 seconds =============================================
The terminal process "C:\Users\Phil\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

If problems with PlatformIO Build System:

The content of platformio.ini:

;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html


[platformio]
src_dir = src
lib_dir = lib
default_envs = esp32dev
;[common_env_data]

[common]
lib_ldf_mode = deep+
lib_deps_builtin = 
	SPIFFS
	FS
	SPI
lib_deps = 
	bodmer/TFT_eSPI@^2.3.70
	lbernstone/Tone32@^1.0.0
	contrem/arduino-timer@^2.3.0
	mikalhart/TinyGPSPlus@^1.0.2
	sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@^1.0.4
	ivanseidel/LinkedList@0.0.0-alpha+sha.dac3874d28
	paulstoffregen/Time@^1.6
	sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0
	lvgl/lvgl@7.11.0
	adafruit/RTClib@^1.13.0
	h2zero/NimBLE-Arduino@^1.2.0
	contrem/arduino-timer @ ^2.3.0
 	;adafruit/Adafruit BME280 Library@^2.1.4.
	;cesanta/mDash @ ^1.2.14

build_flags = 
	-DCORE_DEBUG_LEVEL=5
	-DPS_LOG_LEVEL=5
	;-DCONFIG_BT_NIMBLE_DEBUG
	-Wno-unused-variable
	-Wno-unused-function
	-DDEBUG_REPORT_HEAP_SIZE
	-DDEBUG_REPORT_STACK_FREE
	-D LV_CONF_INCLUDE_SIMPLE
	-I src
	-DUSER_SETUP_LOADED=1
	-D ST7796_DRIVER
	-DTFT_BL=32
	-DTFT_MISO=19
	-DTFT_MOSI=23
	-DTFT_SCLK=18
	-DTFT_CS=17
	-DTFT_DC=2
	-DTFT_RST=4
	-DTOUCH_CS=0
	-DLOAD_GLCD
	-DLOAD_FONT2
	-DLOAD_FONT4
	-DLOAD_FONT6
	-DLOAD_FONT7
	-DLOAD_FONT8
	-DLOAD_GFXFF
	-DLED_RED=25
	-DLED_GREEN=26
	-DLED_BLUE=27
	-DBUZZER_PIN=5
	-DPIN_TARE=33
	-DPIN_UP=36
	-DPIN_DOWN=34
	-DPIN_ENTER=39
	-DBTLE_DB=5
	;-L.pio/libdeps/esp32dev/mDash/src/esp32/ -llibmDash

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
upload_protocol = esptool
upload_speed = 921600
board_build.partitions = min_spiffs.csv
;upload_protocol = espota
;upload_port = 192.168.1.212
upload_port = COM11
;monitor_port = COM5
build_type = debug
;debug_tool = esp-prog
;upload_protocol = esp-prog
monitor_speed = 115200
monitor_flags = 
	--eol=CRLF
	--echo
	--filter=esp32_exception_decoder
board_build.f_cpu = 240000000L
; set frequency to 80MHz
board_build.f_flash = 80000000L
build_flags = ${common.build_flags}
src_filter = 
	+<*.h> +<*.s> +<*.S> +<*.cpp> +<*.c> +<*.ino> +<src/>
	-<.git/> -<data/> -<test/> -<tests/>
lib_deps = 
	bodmer/TFT_eSPI@^2.3.70
	lbernstone/Tone32@^1.0.0
	contrem/arduino-timer@^2.3.0
	mikalhart/TinyGPSPlus@^1.0.2
	sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@^1.0.4
	ivanseidel/LinkedList@0.0.0-alpha+sha.dac3874d28
	paulstoffregen/Time@^1.6
	sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0
	lvgl/lvgl@7.11.0
	adafruit/RTClib@^1.13.0
	h2zero/NimBLE-Arduino@^1.2.0
	contrem/arduino-timer @ ^2.3.0
 	;adafruit/Adafruit BME280 Library@^2.1.4
	;cesanta/mDash @ ^1.2.14

Source file to reproduce issue:

Insert here...

Additional info

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
ivankravetscommented, Sep 16, 2021

Please give us a few minutes, we will release 5.2.1.

@maxgerhardt, thanks for the report! 🙏

1reaction
maxgerhardtcommented, Sep 17, 2021

Can confirm that PlatformIO now links against precompiled libraries in the example of my original issue with a ARM Cortex-M4 based mkrwifi1010. It also works even when the legacy build_flags with the linker options are included. Also tested an ESP32 with the BSEC library (unmodified) and it works. The nice thing is now that even when I delete the BSEC library’s library.json file, it now links correctly, just using the now-respected properties of the library.properties.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GOB on Twitter: "#VSCode でM5Stack関連build時にKeyError ...
Worked last week, now Fails to compile: ESP32 KeyError: "Invalid board option 'build.cpu'": · Issue... PlatformIO Core. Configuration Operating system: ...
Read more >
Compile error KeyError : 'toolchain-xtensa32' - PlatformIO Core
It looks like the platform's manifest is broken. Please remove the .platformio/platforms folder and build the project again.
Read more >
Error compiling for board ESP32 DEVKIT V1 - YouTube
Copy & paste the following link into preferences : ESP32 : https://dl.espressif.com/dl/package_esp32_index.json ESP8266: ...
Read more >
micropython 标签 - Gitee.com
The nrf port now includes uasyncio in the default board manifest, ... fails to compile script - run-tests.py: enable `-X realtime` option for...
Read more >
micropython-docs.pdf
This chapter describes modules (function and class libraries) which are built into MicroPython. This documentation in general aspires to describe all ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found