Cannot open source file "kobj-types-enum.h"

Hello, im trying the tutorial from Valerii Koval and im having difficulties building it. I followed the steps and tried to compile it, but it seems im missing a header file named kobj-types-enum.h. Here is the error message:

 *  Executing task: platformio run --environment nrf52840_dk 

Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: zephyr)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES: 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Reading CMake configuration...
Parsing system calls...
Generating syscall files
Generating KObject files...
Traceback (most recent call last):
  File "/home/tom/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
Validating driver...
Traceback (most recent call last):
  File "/home/tom/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /home/tom/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel_includes.h:41,
                 from /home/tom/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel.h:17,
                 from /home/tom/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/tom/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets.c:9:
/home/tom/.platformio/packages/framework-zephyr@2.20701.220422/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/nrf52840_dk/zephyr_final/zephyr/misc/empty_file.c.o
*** [.pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
====================================================================== [FAILED] Took 9.76 seconds ======================================================================

 *  The terminal process "platformio 'run', '--environment', 'nrf52840_dk'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

As you can already see, a Python module named distutils is missing. I tried to install it with my package manager, but it is not found:

apt search distutils
Sorting... Done
Full Text Search... Done
python-pbr-doc/noble 5.11.1-0ubuntu1 all
  inject useful and sensible default behaviors into setuptools - doc

python-pkginfo-doc/noble 1.9.6-1 all
  Python module to query metadata from packages documentation

python-setuptools-doc/noble-updates,noble-security,now 68.1.2-2ubuntu1.1 all [installed,automatic]
  Python Distutils Enhancements (documentation)

python3-bdist-nsi/noble 0.1.5-4 all
  Create NSIS windows installers for Python modules (Python 3)

python3-d2to1/noble 0.2.12-3 all
  Python3 support for distutils2-like setup.cfg files as package metadata

python3-distlib/noble 0.3.8-1 all
  low-level components of python distutils2/packaging

**python3-distutils-extra**/noble,now 3.0 all [installed]
  enhancements to the Python3 build system

python3-looseversion/noble 1.3.0-3 all
  Version numbering for anarchists and software realists

python3-pbr/noble,now 5.11.1-0ubuntu1 all [installed,automatic]
  inject useful and sensible default behaviors into setuptools - Python 3.x

python3-pkginfo/noble 1.9.6-1 all
  Python 3.x module to query metadata from packages

python3-pyqt-distutils/noble 0.7.3-3 all
  distutils extension to work with PyQt applications and UI files (Python3)

python3-pytest-runner/noble 2.11.1-4 all
  Invoke py.test as distutils command with dependency resolution - Python 3.x

**python3-setuptools**/noble-updates,noble-security,now 68.1.2-2ubuntu1.1 all [installed,automatic]
  Python3 Distutils Enhancements

python3-setuptools-whl/noble-updates,noble-security,now 68.1.2-2ubuntu1.1 all [installed,automatic]
  Python Distutils Enhancements (wheel package)

python3-sip-dev/noble 4.19.25+dfsg-5build3 amd64
  Python 3/C++ bindings generator development files

python3-stdeb/noble 0.10.0-2 all
  Python to Debian source package conversion plugins for distutils

python3-versioneer/noble 0.29-1 all
  determine version from repository tag

Instead, i have installed both python3-distutils-extra and python3-setuptools (found here that setuptools couldve solved this, but didnt). What do i have to do now? Downgrade to Python 3.11 which would hopefully have distutils installed?

Here is also my platformio.ini :

[env:nrf52840_dk]
platform = nordicnrf52
board = nrf52840_dk
framework = zephyr

Thanks in advance!

Does this happen with a clean PlatformIO installation?

rm -rf /home/tom/.platformio

and restart VSCode and try again.

I removed it. Running this inside the /home returns nothing tom@tom-hs-pc:~$ ls -la | grep ".platformio"

Relaunching VS Code caused it to install the packages anew and update the indexes. It also showed a message about not findint the CMake files and VS Code wanted me to select a kit, but this solved itself automatically and it uses now the /home/tom/.local/share/CMakeTools/ :

[
  {
    "name": "GCC 13.3.0 x86_64-linux-gnu",
    "compilers": {
      "C": "/usr/bin/gcc",
      "CXX": "/usr/bin/g++"
    },
    "isTrusted": true
  }
]

It also loaded the new variants ([variant] Loaded new set of variants) (whatever those are).

It took a long time “Updating metadata for the vscode IDE” but still, the package is missing.

Deactivate the Makefile and CMake extension when working with PltaformIO projects. Then restart VSCode. Delete the .vscode folder if needed.

Removed .vscode and disabled those extensions. Relaunching VS Code caused this output:

Resolving nrf52840_dk dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...
UserSideException: Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: zephyr)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES: 
 - framework-zephyr @ 3.40000.0 (4.0.0) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Installing `mbedtls` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/crypto/mbedtls'...
HEAD is now at a78176c6f Merge pull request #63 from tomi-font/bump_to_3.6.2
Installing `mcuboot` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/bootloader/mcuboot'...
HEAD is now at f74b77cf imgtool: fix signing for fix-sig-pubkey public rsa
Installing `mipi-sys-t` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/mipi-sys-t'...
HEAD is now at 71ace1f mipi_syst: fix build error when having protocol timestamp disabled
Installing `open-amp` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/lib/open-amp'...
HEAD is now at b735edb lib: remoteproc: replace strncpy with internal strlcpy
Installing `openthread` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/lib/openthread'...
Updating files:  84% (3282/3889)
Updating files:  85% (3306/3889)
Updating files:  86% (3345/3889)
Updating files:  87% (3384/3889)
Updating files:  88% (3423/3889)
Updating files:  89% (3462/3889)
Updating files:  90% (3501/3889)
Updating files:  91% (3539/3889)
Updating files:  92% (3578/3889)
Updating files:  93% (3617/3889)
Updating files:  94% (3656/3889)
Updating files:  95% (3695/3889)
Updating files:  96% (3734/3889)
Updating files:  97% (3773/3889)
Updating files:  98% (3812/3889)
Updating files:  99% (3851/3889)
Updating files: 100% (3889/3889)
Updating files: 100% (3889/3889), done.
HEAD is now at 2aeb8b833 [mle] prioritize equivalent pending dataset update over MLE announce (#10631)
Installing `percepio` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/percepio'...
HEAD is now at b68d179 Merge branch 'main' into zephyr
Installing `picolibc` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/lib/picolibc'...
HEAD is now at d492d5fa7 cmake: Guard CMAKE_BUILD_TYPE when integrating with Zephyr
Installing `segger` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger'...
HEAD is now at 798f95e config: SEGGER_RTT_Conf: remove mutex locking
Installing `tinycrypt` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/crypto/tinycrypt'...
HEAD is now at 1012a3e Fix warnings reported by UBSAN
Installing `uoscore-uedhoc` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/lib/uoscore-uedhoc'...
HEAD is now at 84ef879 Merge pull request #4 from rlubos/upmerge-06-06-24
Installing `zcbor` project
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/lib/zcbor'...
HEAD is now at 47f34dd Update version to 0.9.0
Reading CMake configuration
-- Application: /home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/zephyr
-- CMake version: 3.21.3
-- Found Python3: /home/tom-retterath/.platformio/penv/.zephyr-4.0.0/bin/python (found suitable version "3.12.3", minimum required is "3.10") found components: Interpreter 
-- Cache files will be written to: /home/tom-retterath/.cache/zephyr
-- Zephyr version: 4.0.0 (/home/tom-retterath/.platformio/packages/framework-zephyr), build: zephyr-v40000
-- Board: nrf52840dk, qualifiers: nrf52840
-- Found toolchain: gnuarmemb (/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi)
-- Found Dtc: /home/tom-retterath/.platformio/packages/tool-dtc/dtc (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: /home/tom-retterath/.platformio/packages/framework-zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: /home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/zephyr.dts
-- Generated pickled edt: /home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/edt.pickle
-- Generated zephyr.dts: /home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/dts.cmake
Parsing /home/tom-retterath/.platformio/packages/framework-zephyr/Kconfig
Loaded configuration '/home/tom-retterath/.platformio/packages/framework-zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig'
Merged configuration '/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/zephyr/prj.conf'
-- Configuring incomplete, errors occurred!

CMake Warning at /home/tom-retterath/.platformio/packages/framework-zephyr/cmake/app/boilerplate.cmake:20 (message):
  Loading of Zephyr boilerplate.cmake directly is deprecated, please use
  'find_package(Zephyr)'
Call Stack (most recent call first):
  CMakeLists.txt:2 (include)


Loading Zephyr default modules (Zephyr base).
CMake Warning at /home/tom-retterath/.platformio/packages/framework-zephyr/cmake/modules/boards.cmake:110 (message):
  Deprecated BOARD=nrf52840dk_nrf52840 specified, board automatically changed
  to: nrf52840dk/nrf52840.
Call Stack (most recent call first):
  /home/tom-retterath/.platformio/packages/framework-zephyr/cmake/modules/zephyr_default.cmake:133 (include)
  /home/tom-retterath/.platformio/packages/framework-zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /home/tom-retterath/.platformio/packages/framework-zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  /home/tom-retterath/.platformio/packages/framework-zephyr/cmake/app/boilerplate.cmake:25 (find_package)
  CMakeLists.txt:2 (include)



/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/zephyr/prj.conf:2: warning: attempt to assign the value 'y' to the undefined symbol BT_DEBUG_LOG

error: Aborting due to Kconfig warnings

CMake Error at /home/tom-retterath/.platformio/packages/framework-zephyr/cmake/modules/kconfig.cmake:395 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  /home/tom-retterath/.platformio/packages/framework-zephyr/cmake/modules/zephyr_default.cmake:133 (include)
  /home/tom-retterath/.platformio/packages/framework-zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /home/tom-retterath/.platformio/packages/framework-zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  /home/tom-retterath/.platformio/packages/framework-zephyr/cmake/app/boilerplate.cmake:25 (find_package)
  CMakeLists.txt:2 (include)


========================= [FAILED] Took 110.20 seconds =========================

Can you remove this line to in your prj.conf? Delete the .pio folder and build again.

According to the tutorial, i had to additionally add a /zephyr/prj.conf file that contains this:

CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEVICE_NAME="Test beacon"

Could this be the reason?

First i commented out, which didnt work at all. But now i have a different error because of a missing file sys/printk.h. I added the .vscode folder back and got the same warning message as earlier:

However, when i build, i got the missing sys/printk.h. Confusing. It is there, but the kobj-types-enum.h is missing.

I tracked it down to the kobject.h:

These are my c_cpp_properties.json:

//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
    "configurations": [
        {
            "name": "PlatformIO",
            "includePath": [
                "/home/tom-retterath/Documents/PlatformIO/Projects/test/include",
                "/home/tom-retterath/Documents/PlatformIO/Projects/test/src",
                "/home/tom-retterath/Documents/PlatformIO/Projects/test/.pio/build/nrf52840_dk/zephyr/include/generated/zephyr",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/include",
                "/home/tom-retterath/Documents/PlatformIO/Projects/test/.pio/build/nrf52840_dk/zephyr/include/generated",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic/nrf52",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic/common",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/subsys/bluetooth",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/cmsis/CMSIS/Core/Include",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/modules/cmsis",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx/drivers/include",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx/mdk",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/modules/hal_nordic/nrfx",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger/SEGGER",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger/Config",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "path": [
                    "/home/tom-retterath/Documents/PlatformIO/Projects/test/include",
                    "/home/tom-retterath/Documents/PlatformIO/Projects/test/src",
                    "/home/tom-retterath/Documents/PlatformIO/Projects/test/.pio/build/nrf52840_dk/zephyr/include/generated/zephyr",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/include",
                    "/home/tom-retterath/Documents/PlatformIO/Projects/test/.pio/build/nrf52840_dk/zephyr/include/generated",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic/nrf52",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic/common",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/subsys/bluetooth",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/cmsis/CMSIS/Core/Include",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/modules/cmsis",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx/drivers/include",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx/mdk",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/modules/hal_nordic/nrfx",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger/SEGGER",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger/Config",
                    ""
                ]
            },
            "defines": [
                "PLATFORMIO=60117",
                "ARDUINO_NRF52_DK",
                "KERNEL",
                "K_HEAP_MEM_POOL_SIZE=0",
                "NRF52840_XXAA",
                "__LINUX_ERRNO_EXTENSIONS__",
                "__PROGRAM_START",
                "__ZEPHYR__=1",
                ""
            ],
            "cStandard": "c99",
            "forcedInclude": [
                "/home/tom-retterath/Documents/PlatformIO/Projects/test/.pio/build/nrf52840_dk/zephyr/include/generated/zephyr/autoconf.h",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/toolchain/zephyr_stdint.h",
                ""
            ],
            "compilerPath": "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
            "compilerArgs": [
                "-mcpu=cortex-m4",
                "-mthumb",
                "-mabi=aapcs",
                "-mfp16-format=ieee",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/lib/libc/common/include",
                "-isystem",
                "/home/tom-retterath/Documents/PlatformIO/Projects/test/.pio/build/nrf52840_dk/modules/picolibc/picolibc/include",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed",
                ""
            ]
        }
    ],
    "version": 4
}

Some Zephyr files are only generated after the firmware built. With the bogstandard main.c from

https://github.com/platformio/platform-nordicnrf52/tree/develop/examples/zephyr-blink/src

does the project build?

No, i still get dependency errors:

 *  Executing task: platformio run --environment nrf52840_dk 

Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: zephyr)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES: 
 - framework-zephyr @ 3.40000.0 (4.0.0) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Reading CMake configuration
Parsing system calls
Generating syscall files
Generating KObject files
Validating driver
Generating version header file
-- Zephyr version: 4.0.0 (/home/tom-retterath/.platformio/packages/framework-zephyr), build: zephyr-v40000
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
Compiling .pio/build/nrf52840_dk/zephyr_final/zephyr/misc/empty_file.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/setjmp.S.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/strcmp.S.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/strcpy.S.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/aeabi_memset.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/bzero.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/memchr.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/memchr.S.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/memcpy.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/memcpy.S.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/memmove.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/memset.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/memset.S.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/strlen.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/machine/arm/strlen.S.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_add.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_add_sep.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_append.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_count.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_create.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_create_sep.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_delete.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_extract.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_insert.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_next.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_replace.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/argz_stringify.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/buf_findstr.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/envz_add.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/envz_entry.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/envz_get.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/envz_merge.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/envz_remove.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/argz/envz_strip.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/categories.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/ctype_.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isalnum.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isalnum_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isalpha.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isalpha_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isascii.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isascii_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isblank.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isblank_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iscntrl.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iscntrl_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isdigit.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isdigit_l.c.o
Generating header file with offsets .pio/build/nrf52840_dk/zephyr/include/generated/zephyr/offsets.h
Archiving .pio/build/nrf52840_dk/zephyr/liboffsets.a
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isgraph.c.o
Indexing .pio/build/nrf52840_dk/zephyr/liboffsets.a
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isgraph_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/islower.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/islower_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isprint.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isprint_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/ispunct.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/ispunct_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isspace.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isspace_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isupper.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/isupper_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswalnum.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswalnum_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswalpha.c.o
Compiling .pio/build/nrf52840_dk/zephyr_pre0/zephyr/misc/empty_file.c.o
Compiling .pio/build/nrf52840_dk/src/main.o
Generating linker script .pio/build/nrf52840_dk/zephyr/linker_zephyr_pre0.cmd
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswalpha_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswblank.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswblank_l.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswcntrl.c.o
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswcntrl_l.c.o
src/main.c:7:11: fatal error: zephyr.h: No such file or directory

**********************************************************************
* Looking for zephyr.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:zephyr.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKzephyr.h
*
**********************************************************************

  #include <zephyr.h>
           ^~~~~~~~~~
compilation terminated.
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswctype.c.o
*** [.pio/build/nrf52840_dk/src/main.o] Error 1
Compiling .pio/build/nrf52840_dk/c/modules/picolibc/newlib/libc/ctype/iswctype_l.c.o
======================================================================= [FAILED] Took 34.82 seconds =======================================================================

 *  The terminal process "platformio 'run', '--environment', 'nrf52840_dk'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

This is very frustrating lol. Could it be that the c_cpp_properties.json is wrong? :

//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
    "configurations": [
        {
            "name": "PlatformIO",
            "includePath": [
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/include",
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/src",
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated/zephyr",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/include",
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic/nrf52",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic/common",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/subsys/bluetooth",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/cmsis/CMSIS/Core/Include",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/modules/cmsis",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx/drivers/include",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx/mdk",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/modules/hal_nordic/nrfx",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger/SEGGER",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger/Config",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth/audio",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth/classic",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth/mesh",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth/services",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "path": [
                    "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/include",
                    "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/src",
                    "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated/zephyr",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/include",
                    "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic/nrf52",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/soc/nordic/common",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/subsys/bluetooth",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/cmsis/CMSIS/Core/Include",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/modules/cmsis",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx/drivers/include",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/hal/nordic/nrfx/mdk",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/modules/hal_nordic/nrfx",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger/SEGGER",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/_pio/modules/debug/segger/Config",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth/audio",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth/classic",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth/mesh",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth/services",
                    ""
                ]
            },
            "defines": [
                "PLATFORMIO=60117",
                "ARDUINO_NRF52_DK",
                "KERNEL",
                "K_HEAP_MEM_POOL_SIZE=0",
                "NRF52840_XXAA",
                "__LINUX_ERRNO_EXTENSIONS__",
                "__PROGRAM_START",
                "__ZEPHYR__=1",
                ""
            ],
            "cStandard": "c99",
            "forcedInclude": [
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated/zephyr/autoconf.h",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/toolchain/zephyr_stdint.h",
                ""
            ],
            "compilerPath": "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
            "compilerArgs": [
                "-mcpu=cortex-m4",
                "-mthumb",
                "-mabi=aapcs",
                "-mfp16-format=ieee",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/framework-zephyr/lib/libc/common/include",
                "-isystem",
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/modules/picolibc/picolibc/include",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed",
                ""
            ]
        }
    ],
    "version": 4
}

Perhaps i should link to each library with the .ini file:

;
;   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

[env:nrf52840_dk]
platform = nordicnrf52
board = nrf52840_dk
framework = zephyr
platform_packages = platformio/framework-zephyr@^3.40000.0
; change microcontroller
board_build.mcu = nrf52840
; change MCU frequency
board_build.f_cpu = 64000000L

lib_extra_dirs = /home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth

Im now trying the CLI way to execut things, following the guide from here: platform-nordicnrf52/examples/zephyr-blink at develop · platformio/platform-nordicnrf52 · GitHub. Its still cloning and installing dependencies, but it seems to miss multiple ones:

pio --help
tom-retterath@tom-retterath-hs-pc:~/Documents/PlatformIO/Projects/platform-nordicnrf52-develop$ pio --help
Usage: pio [OPTIONS] COMMAND [ARGS]...

Options:
  --version          Show the version and exit.
  -c, --caller TEXT  Caller ID (service)
  --no-ansi          Do not print ANSI control characters
  -h, --help         Show this message and exit.

Commands:
  access    Manage resource access
  account   Manage PlatformIO account
  boards    Board Explorer
  check     Static Code Analysis
  ci        Continuous Integration
  debug     Unified Debugger
  device    Device manager & Serial/Socket monitor
  home      GUI to manage PlatformIO
  org       Manage organizations
  pkg       Unified Package Manager
  project   Project Manager
  remote    Remote Development
  run       Run project targets (build, upload, clean, etc.)
  settings  Manage system settings
  system    Miscellaneous system commands
  team      Manage organization teams
  test      Unit Testing
  upgrade   Upgrade PlatformIO Core to the latest version
tom-retterath@tom-retterath-hs-pc:~/Documents/PlatformIO/Projects/platform-nordicnrf52-develop$ cd examples/
tom-retterath@tom-retterath-hs-pc:~/Documents/PlatformIO/Projects/platform-nordicnrf52-develop/examples$ ls
arduino-ble-led  arduino-bluefruit-bleuart        arduino-serial-plotter  mbed-rtos-blink-baremetal  zephyr-ble-beacon  zephyr-net-echo-client
arduino-blink    arduino-nina-b1-generic-example  mbed-rtos-ble-battery   mbed-rtos-nfc              zephyr-blink       zephyr-subsys-nvs
tom-retterath@tom-retterath-hs-pc:~/Documents/PlatformIO/Projects/platform-nordicnrf52-develop/examples$ cd zephyr-blink/
tom-retterath@tom-retterath-hs-pc:~/Documents/PlatformIO/Projects/platform-nordicnrf52-develop/examples/zephyr-blink$ ls
include  lib  platformio.ini  README.md  src  test  zephyr
tom-retterath@tom-retterath-hs-pc:~/Documents/PlatformIO/Projects/platform-nordicnrf52-develop/examples/zephyr-blink$ pio run
Processing adafruit_feather_nrf52832 (platform: nordicnrf52; framework: zephyr; board: adafruit_feather_nrf52832)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/framework-cmsis @ ~2.50700.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: framework-cmsis@2.50700.210515 has been installed!
Tool Manager: Installing platformio/framework-zephyr @ ~2.20701.0
Unpacking  [####################################]  100%          
Tool Manager: framework-zephyr@2.20701.220422 has been installed!
Tool Manager: Installing platformio/tool-adafruit-nrfutil @ ~1.503.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-adafruit-nrfutil@1.503.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/adafruit_feather_nrf52832.html
PLATFORM: Nordic nRF52 (10.7.0) > Adafruit Bluefruit nRF52832 Feather
HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-cmsis @ 2.50700.210515 (5.7.0) 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-adafruit-nrfutil @ 1.503.0 (5.3) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Installing `canopennode` package...
Couldn't install the `framework-zephyr-canopennode` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/canopennode'...
HEAD is now at f167efe zephyr: move build configuration into zephyr repository
Installing `civetweb` package...
Couldn't install the `framework-zephyr-civetweb` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/civetweb'...
HEAD is now at 094aeb41 cmake: relax minimum version requirements
Installing `cmsis` package...
Couldn't install the `framework-zephyr-cmsis` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/cmsis'...
HEAD is now at b0612c9 DSP: Integrate CMSIS-DSP 1.9.0 (CMSIS 5.8.0)
Installing `fatfs` package...
Couldn't install the `framework-zephyr-fatfs` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/fs/fatfs'...
HEAD is now at 94fcd6b fs: Update driver to version 0.14b
Installing `hal_nordic` package...
Couldn't install the `framework-zephyr-hal-nordic` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/nordic'...
Updating files:  67% (958/1425)
Updating files:  68% (969/1425)
Updating files:  69% (984/1425)
Updating files:  70% (998/1425)
Updating files:  71% (1012/1425)
Updating files:  72% (1026/1425)
Updating files:  73% (1041/1425)
Updating files:  74% (1055/1425)
Updating files:  75% (1069/1425)
Updating files:  76% (1083/1425)
Updating files:  77% (1098/1425)
Updating files:  78% (1112/1425)
Updating files:  79% (1126/1425)
Updating files:  80% (1140/1425)
Updating files:  81% (1155/1425)
Updating files:  82% (1169/1425)
Updating files:  83% (1183/1425)
Updating files:  84% (1197/1425)
Updating files:  85% (1212/1425)
Updating files:  86% (1226/1425)
Updating files:  87% (1240/1425)
Updating files:  88% (1254/1425)
Updating files:  89% (1269/1425)
Updating files:  90% (1283/1425)
Updating files:  91% (1297/1425)
Updating files:  92% (1311/1425)
Updating files:  93% (1326/1425)
Updating files:  94% (1340/1425)
Updating files:  95% (1354/1425)
Updating files:  96% (1368/1425)
Updating files:  97% (1383/1425)
Updating files:  98% (1397/1425)
Updating files:  99% (1411/1425)
Updating files: 100% (1425/1425)
Updating files: 100% (1425/1425), done.
HEAD is now at a6e5299 mdk: Fix bitfield names in system_nrf53_approtect.h
Installing `hal_st` package...
Couldn't install the `framework-zephyr-hal-st` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/st'...
HEAD is now at 575de9d sensor/stmemsc: Align stmemsc i/f to v2.00
Installing `libmetal` package...
Couldn't install the `framework-zephyr-libmetal` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/libmetal'...
HEAD is now at 39d049d lib: update libmetal to release v2021.04.0 + VERSION path fix
Installing `littlefs` package...
Couldn't install the `framework-zephyr-littlefs` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/fs/littlefs'...
HEAD is now at 9e4498d lfs_util: fix log declaration when logging is disabled
Installing `loramac-node` package...
Couldn't install the `framework-zephyr-loramac-node` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/loramac-node'...
HEAD is now at 12019623 zephyr: radio: sx127x: override buffer read/write functions
Installing `lvgl` package...
Couldn't install the `framework-zephyr-lvgl` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/gui/lvgl'...
Updating files:  20% (828/4110)
Updating files:  21% (864/4110)
Updating files:  22% (905/4110)
Updating files:  23% (946/4110)
Updating files:  24% (987/4110)
Updating files:  25% (1028/4110)
Updating files:  26% (1069/4110)
Updating files:  27% (1110/4110)
Updating files:  28% (1151/4110)
Updating files:  29% (1192/4110)
Updating files:  30% (1233/4110)
Updating files:  31% (1275/4110)
Updating files:  32% (1316/4110)
Updating files:  33% (1357/4110)
Updating files:  34% (1398/4110)
Updating files:  35% (1439/4110)
Updating files:  36% (1480/4110)
Updating files:  37% (1521/4110)
Updating files:  38% (1562/4110)
Updating files:  39% (1603/4110)
Updating files:  40% (1644/4110)
Updating files:  41% (1686/4110)
Updating files:  42% (1727/4110)
Updating files:  43% (1768/4110)
Updating files:  44% (1809/4110)
Updating files:  45% (1850/4110)
Updating files:  46% (1891/4110)
Updating files:  47% (1932/4110)
Updating files:  48% (1973/4110)
Updating files:  49% (2014/4110)
Updating files:  50% (2055/4110)
Updating files:  51% (2097/4110)
Updating files:  52% (2138/4110)
Updating files:  53% (2179/4110)
Updating files:  54% (2220/4110)
Updating files:  55% (2261/4110)
Updating files:  56% (2302/4110)
Updating files:  57% (2343/4110)
Updating files:  58% (2384/4110)
Updating files:  59% (2425/4110)
Updating files:  60% (2466/4110)
Updating files:  61% (2508/4110)
Updating files:  62% (2549/4110)
Updating files:  63% (2590/4110)
Updating files:  64% (2631/4110)
Updating files:  65% (2672/4110)
Updating files:  66% (2713/4110)
Updating files:  67% (2754/4110)
Updating files:  68% (2795/4110)
Updating files:  69% (2836/4110)
Updating files:  70% (2877/4110)
Updating files:  71% (2919/4110)
Updating files:  72% (2960/4110)
Updating files:  73% (3001/4110)
Updating files:  74% (3042/4110)
Updating files:  75% (3083/4110)
Updating files:  76% (3124/4110)
Updating files:  76% (3164/4110)
Updating files:  77% (3165/4110)
Updating files:  78% (3206/4110)
Updating files:  79% (3247/4110)
Updating files:  80% (3288/4110)
Updating files:  81% (3330/4110)
Updating files:  82% (3371/4110)
Updating files:  83% (3412/4110)
Updating files:  84% (3453/4110)
Updating files:  85% (3494/4110)
Updating files:  86% (3535/4110)
Updating files:  87% (3576/4110)
Updating files:  88% (3617/4110)
Updating files:  89% (3658/4110)
Updating files:  90% (3699/4110)
Updating files:  91% (3741/4110)
Updating files:  92% (3782/4110)
Updating files:  93% (3823/4110)
Updating files:  94% (3864/4110)
Updating files:  95% (3905/4110)
Updating files:  96% (3946/4110)
Updating files:  97% (3987/4110)
Updating files:  98% (4028/4110)
Updating files:  99% (4069/4110)
Updating files: 100% (4110/4110)
Updating files: 100% (4110/4110), done.
HEAD is now at 783c1f78c cmake: added missing file ext to lv_font_dejavu_16_persian_hebrew.c
Installing `lz4` package...
Couldn't install the `framework-zephyr-lz4` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/lz4'...
HEAD is now at 8e303c2 zephyr: make this repo a zephyr module
Installing `mbedtls` package...
Couldn't install the `framework-zephyr-mbedtls` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/crypto/mbedtls'...
HEAD is now at 5765cb7f7 mbedtls: update README with laterst version information
Installing `mcuboot` package...
Couldn't install the `framework-zephyr-mcuboot` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/bootloader/mcuboot'...
HEAD is now at 70bfbd21 merge: synchronize up to 85da97f + cherry-pick upstream bugfixes for LTS 2.7.0
Installing `mcumgr` package...
Couldn't install the `framework-zephyr-mcumgr` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/mcumgr'...
HEAD is now at 9ffebd5 img_mgmt: fix callback parameter values
Installing `mipi-sys-t` package...
Couldn't install the `framework-zephyr-mipi-sys-t` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/debug/mipi-sys-t'...
HEAD is now at 75e6715 zephyr: move platform.h to zephyr tree
Installing `nanopb` package...
Couldn't install the `framework-zephyr-nanopb` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/nanopb'...
HEAD is now at d148bd2 Add zephyr module support
Installing `open-amp` package...
Couldn't install the `framework-zephyr-open-amp` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/open-amp'...
HEAD is now at 6010f05 lib: update open-amp lib to release v2021.04.0
Installing `openthread` package...
Couldn't install the `framework-zephyr-openthread` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/openthread'...
Updating files:  85% (3306/3889)
Updating files:  86% (3345/3889)
Updating files:  87% (3384/3889)
Updating files:  88% (3423/3889)
Updating files:  89% (3462/3889)
Updating files:  90% (3501/3889)
Updating files:  91% (3539/3889)
Updating files:  92% (3578/3889)
Updating files:  93% (3617/3889)
Updating files:  94% (3656/3889)
Updating files:  95% (3695/3889)
Updating files:  96% (3734/3889)
Updating files:  97% (3773/3889)
Updating files:  98% (3812/3889)
Updating files:  99% (3851/3889)
Updating files: 100% (3889/3889)
Updating files: 100% (3889/3889), done.
HEAD is now at 5d706547e Merge pull request #47 from canisLupus1313/zephyr
Installing `segger` package...
Couldn't install the `framework-zephyr-segger` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/debug/segger'...
HEAD is now at 3a52ab2 config: Use zephyr provided options
Installing `sof` package...
Couldn't install the `framework-zephyr-sof` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/audio/sof'...
HEAD is now at 76feb11d1 ipc4: mixer: add mixin & mixout modules support
Installing `tflite-micro` package...
Couldn't install the `framework-zephyr-tflite-micro` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/tflite-micro'...
HEAD is now at 9156d050 tflite-micro: fix module name
Installing `tinycbor` package...
Couldn't install the `framework-zephyr-tinycbor` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/lib/tinycbor'...
HEAD is now at 40daca9 zephyr: Remove TINYCBOR from interface libraries
Installing `tinycrypt` package...
Couldn't install the `framework-zephyr-tinycrypt` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/crypto/tinycrypt'...
HEAD is now at 3e9a49d cmake: Fix conditional in root CMakeLists.txt
Installing `TraceRecorderSource` package...
Couldn't install the `framework-zephyr-TraceRecorderSource` package from PlatformIO Registry.
Cloning into '/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/debug/TraceRecorder'...
HEAD is now at 36c5777 Merge remote-tracking branch 'upstream/main' into zephyr
Reading CMake configuration...
Parsing system calls...
Generating syscall files
Generating KObject files...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
Validating driver...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/adafruit_feather_nrf52832/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel_includes.h:41,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel.h:17,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets.c:9:
/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/adafruit_feather_nrf52832/zephyr_final/zephyr/misc/empty_file.c.o
*** [.pio/build/adafruit_feather_nrf52832/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
============================================================================== [FAILED] Took 206.44 seconds ==============================================================================

Processing nrf52_dk (platform: nordicnrf52; framework: zephyr; board: nrf52_dk)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52-DK
HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES: 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Reading CMake configuration...
Parsing system calls...
Generating syscall files
Generating KObject files...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
Validating driver...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nrf52_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel_includes.h:41,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel.h:17,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets.c:9:
/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/nrf52_dk/zephyr_final/zephyr/misc/empty_file.c.o
*** [.pio/build/nrf52_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
=============================================================================== [FAILED] Took 7.79 seconds ===============================================================================

Processing nrf52840_dk (platform: nordicnrf52; framework: zephyr; board: nrf52840_dk)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES: 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Reading CMake configuration...
Parsing system calls...
Generating syscall files
Generating KObject files...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
Validating driver...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel_includes.h:41,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel.h:17,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets.c:9:
/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/nrf52840_dk/zephyr_final/zephyr/misc/empty_file.c.o
*** [.pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
=============================================================================== [FAILED] Took 7.68 seconds ===============================================================================

Processing particle_xenon (platform: nordicnrf52; framework: zephyr; board: particle_xenon)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/particle_xenon.html
PLATFORM: Nordic nRF52 (10.7.0) > Particle Xenon
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-cmsis @ 2.50700.210515 (5.7.0) 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-adafruit-nrfutil @ 1.503.0 (5.3) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Reading CMake configuration...
Parsing system calls...
Generating syscall files
Generating KObject files...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
Validating driver...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/particle_xenon/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel_includes.h:41,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel.h:17,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets.c:9:
/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/particle_xenon/zephyr_final/zephyr/misc/empty_file.c.o
*** [.pio/build/particle_xenon/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
=============================================================================== [FAILED] Took 7.73 seconds ===============================================================================

Environment                Status    Duration
-------------------------  --------  ------------
adafruit_feather_nrf52832  FAILED    00:03:26.440
nrf52_dk                   FAILED    00:00:07.787
nrf52840_dk                FAILED    00:00:07.679
particle_xenon             FAILED    00:00:07.725
========================================================================== 4 failed, 0 succeeded in 00:03:49.631 ==========================================================================
tom-retterath@tom-retterath-hs-pc:~/Documents/PlatformIO/Projects/platform-nordicnrf52-develop/examples/zephyr-blink$ 

Ok, everything fails?? It still relies on this distutils package. I will downgrade Python from 3.12->3.9 on antother machine and try this there.

I don’t think you can just upgrade to 4.0.0 like that without some modiifcations in the platform too. Can you remove all of these instructions, delete the .pio folder of the project, and build again?

Sure, this updated the c_cpp_properties.json:

//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
    "configurations": [
        {
            "name": "PlatformIO",
            "includePath": [
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/include",
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/src",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include",
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/soc/arm/nordic_nrf/nrf52",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/cmsis/CMSIS/Core/Include",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/nordic/nrfx",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/nordic/nrfx/drivers/include",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/nordic/nrfx/mdk",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/modules/hal_nordic/nrfx",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/debug/segger/SEGGER",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/debug/segger/Config",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/modules/segger",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "path": [
                    "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/include",
                    "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/src",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include",
                    "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/soc/arm/nordic_nrf/nrf52",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/cmsis/CMSIS/Core/Include",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/nordic/nrfx",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/nordic/nrfx/drivers/include",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/hal/nordic/nrfx/mdk",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/modules/hal_nordic/nrfx",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/debug/segger/SEGGER",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/_pio/modules/debug/segger/Config",
                    "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/modules/segger",
                    ""
                ]
            },
            "defines": [
                "PLATFORMIO=60117",
                "ARDUINO_NRF52_DK",
                "BUILD_VERSION=zephyr-v20701",
                "KERNEL",
                "NRF52840_XXAA",
                "_FORTIFY_SOURCE=2",
                "__PROGRAM_START",
                "__ZEPHYR__=1",
                ""
            ],
            "cStandard": "c99",
            "forcedInclude": [
                "/home/tom-retterath/Documents/PlatformIO/Projects/DongleFirmware/.pio/build/nrf52840_dk/zephyr/include/generated/autoconf.h",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/toolchain/zephyr_stdint.h",
                ""
            ],
            "compilerPath": "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
            "compilerArgs": [
                "-mcpu=cortex-m4",
                "-mthumb",
                "-mabi=aapcs",
                "-mfp16-format=ieee",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/lib/libc/minimal/include",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include",
                "-isystem",
                "/home/tom-retterath/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed",
                ""
            ]
        }
    ],
    "version": 4
}

The platformio.ini:

; PlatformIO Project Configuration File
;
;   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
; *  Executing task: platformio run --environment nrf52840_dk 

Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: zephyr)
-----------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES: 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Generating KObject files...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
Validating driver...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel_includes.h:41,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel.h:17,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets.c:9:
/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/nrf52840_dk/zephyr_final/zephyr/misc/empty_file.c.o
*** [.pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
============================== [FAILED] Took 2.75 seconds ==============================

 *  The terminal process "platformio 'run', '--environment', 'nrf52840_dk'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:nrf52840_dk]
platform = nordicnrf52
board = nrf52840_dk
framework = zephyr
;platform_packages = platformio/framework-zephyr@^3.40000.0
; change microcontroller
board_build.mcu = nrf52840
; change MCU frequency
;board_build.f_cpu = 64000000L

;lib_extra_dirs = /home/tom-retterath/.platformio/packages/framework-zephyr/include/zephyr/bluetooth

But this kobj-types-enum.h is still missing…

 *  Executing task: platformio run --environment nrf52840_dk 

Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: zephyr)
-----------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES: 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Generating KObject files...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
Validating driver...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel_includes.h:41,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel.h:17,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets.c:9:
/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/nrf52840_dk/zephyr_final/zephyr/misc/empty_file.c.o
*** [.pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
============================== [FAILED] Took 2.75 seconds ==============================

 *  The terminal process "platformio 'run', '--environment', 'nrf52840_dk'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Okay, this is definitely the source of the problem, but I don’t know why it won’t be installed.

Building the reference blinky works just fine for me.

Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: zephyr)
---------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES:
 - framework-zephyr @ 2.20701.220422 (2.7.1)
 - tool-cmake @ 3.21.3
 - tool-dtc @ 1.4.7
 - tool-ninja @ 1.9.0
 - tool-sreccat @ 1.164.0 (1.64)
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Reading CMake configuration...
Parsing system calls...
Generating syscall files
Generating KObject files...
C:\Users\Max\.platformio\packages\framework-zephyr@2.20701.220422\scripts\gen_kobject_list.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
Validating driver...
C:\Users\Max\.platformio\packages\framework-zephyr@2.20701.220422\scripts\gen_kobject_list.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\nrf52840_dk\offsets\zephyr\arch\arm\core\offsets\offsets.c.o
Compiling .pio\build\nrf52840_dk\zephyr_final\zephyr\misc\empty_file.c.o
Generating header file with offsets .pio\build\nrf52840_dk\zephyr\include\generated\offsets.h
Archiving .pio\build\nrf52840_dk\zephyr\liboffsets.a
Indexing .pio\build\nrf52840_dk\zephyr\liboffsets.a
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__mpu\zephyr\arch\arch\arm\core\aarch32\mpu\arm_mpu.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\soc\arm\nordic_nrf\validate_base_addresses.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\sem.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\mutex.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\fault.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\crc7_sw.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\mailbox.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\thread_entry.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdlib\bsearch.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\crc16_sw.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\time\gmtime.c.o
Compiling .pio\build\nrf52840_dk\lib__posix\zephyr\lib\posix\pthread_common.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\cbprintf.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\fdtable.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\errno.c.o
Compiling .pio\build\nrf52840_dk\drivers__timer\zephyr\drivers\timer\nrf_rtc_timer.c.o
Compiling .pio\build\nrf52840_dk\src\main.o
Compiling .pio\build\nrf52840_dk\zephyr_prebuilt\zephyr\misc\empty_file.c.o
Compiling .pio\build\nrf52840_dk\modules__hal_nordic__nrfx\modules\hal_nordic\nrfx\nrfx_glue.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\notify.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdlib\malloc.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\swap_helper.S.o
Compiling .pio\build\nrf52840_dk\arch__common\zephyr\arch\common\sw_isr_common.c.o
Compiling .pio\build\nrf52840_dk\lib__posix\zephyr\lib\posix\nanosleep.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\string\strstr.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdout\sprintf.c.o
Compiling .pio\build\nrf52840_dk\soc__arm__common__cortex_m\zephyr\soc\arm\common\cortex_m\arm_mpu_regions.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\timer.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\thread_abort.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\thread.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\cbprintf_packaged.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdlib\atoi.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\cbprintf_complete.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\banner.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\dec.c.o
Archiving .pio\build\nrf52840_dk\zephyr\arch\common\libarch__common.a
Archiving .pio\build\nrf52840_dk\zephyr\lib\posix\liblib__posix.a
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\prep_c.c.o
Compiling .pio\build\nrf52840_dk\soc__arm__nordic_nrf__nrf52\zephyr\soc\arm\nordic_nrf\nrf52\power.c.o
Compiling .pio\build\nrf52840_dk\modules__segger\modules\segger\SEGGER_RTT_zephyr.c.o
Archiving .pio\build\nrf52840_dk\zephyr\soc\arm\common\cortex_m\libsoc__arm__common__cortex_m.a
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\rb.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\main_weak.c.o
Indexing .pio\build\nrf52840_dk\zephyr\arch\common\libarch__common.a
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\fatal.c.o
Indexing .pio\build\nrf52840_dk\zephyr\lib\posix\liblib__posix.a
Indexing .pio\build\nrf52840_dk\zephyr\soc\arm\common\cortex_m\libsoc__arm__common__cortex_m.a
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\mem_slab.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\msg_q.c.o
Compiling .pio\build\nrf52840_dk\_pio___bare_module\modules\_bare_module\__dummy.cpp.o
Compiling .pio\build\nrf52840_dk\modules__segger\modules\segger\SEGGER_RTT.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\subsys\pm\policy\policy_residency.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\hex.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdlib\strtol.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\soc\arm\nordic_nrf\common\soc_nrf_common.S.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\thread.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\reset.S.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\xip.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\heap.c.o
Compiling .pio\build\nrf52840_dk\drivers__timer\zephyr\drivers\timer\sys_clock_init.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\cpu_idle.S.o
Generating linker script .pio\build\nrf52840_dk\zephyr\linker_zephyr_prebuilt.cmd
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\work.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdlib\qsort.c.o
Compiling .pio\build\nrf52840_dk\modules__hal_nordic__nrfx\modules\hal_nordic\nrfx\nrfx_clock.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\configs.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\subsys\pm\pm_ctrl.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\scb.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\string\strspn.c.o
Compiling .pio\build\nrf52840_dk\_pio___bare_module\modules\_bare_module\__dummy.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\system_work_q.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\string\string.c.o
Compiling .pio\build\nrf52840_dk\drivers__clock_control\zephyr\drivers\clock_control\clock_control_nrf.c.o
Archiving .pio\build\nrf52840_dk\modules\segger\libmodules__segger.a
Archiving .pio\build\nrf52840_dk\zephyr\drivers\timer\libdrivers__timer.a
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\isr_wrapper.S.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\irq_init.c.o
Indexing .pio\build\nrf52840_dk\modules\segger\libmodules__segger.a
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdout\stdout_console.c.o   
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\irq_manage.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\subsys\pm\power.c.o
Indexing .pio\build\nrf52840_dk\zephyr\drivers\timer\libdrivers__timer.a
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\queue.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\fault_s.S.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\kheap.c.o
Compiling .pio\build\nrf52840_dk\soc__arm__nordic_nrf__nrf52\zephyr\soc\arm\nordic_nrf\nrf52\soc.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\exc_exit.S.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\crc32c_sw.c.o
Compiling .pio\build\nrf52840_dk\_pio___bare_module\modules\_bare_module\__dummy.S.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\bitarray.c.o
Compiling .pio\build\nrf52840_dk\modules__hal_nordic__nrfx\modules\hal_nordic\nrfx\system_nrf52840.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\sched.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\stack.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__mpu\zephyr\arch\arch\arm\core\aarch32\mpu\arm_core_mpu.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\device.c.o
Generating final linker script .pio\build\nrf52840_dk\zephyr\linker.cmd
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\heap-validate.c.o
Archiving .pio\build\nrf52840_dk\modules\_bare_module\lib_pio___bare_module.a
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\mempool.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\version.c.o
Archiving .pio\build\nrf52840_dk\zephyr\drivers\clock_control\libdrivers__clock_control.a
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\fpu.c.o
Indexing .pio\build\nrf52840_dk\zephyr\drivers\clock_control\libdrivers__clock_control.a
Indexing .pio\build\nrf52840_dk\modules\_bare_module\lib_pio___bare_module.a
Compiling .pio\build\nrf52840_dk\modules__hal_nordic__nrfx\modules\hal_nordic\nrfx\nrfx_gpiote.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdlib\strtoul.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\subsys\tracing\tracing_none.c.o
Archiving .pio\build\nrf52840_dk\zephyr\soc\arm\nordic_nrf\nrf52\libsoc__arm__nordic_nrf__nrf52.a
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdlib\abort.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\onoff.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\init.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\nmi_on_reset.S.o   
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\soc\arm\nordic_nrf\validate_enabled_instances.c.o
Indexing .pio\build\nrf52840_dk\zephyr\soc\arm\nordic_nrf\nrf52\libsoc__arm__nordic_nrf__nrf52.a
Archiving .pio\build\nrf52840_dk\zephyr\arch\arch\arm\core\aarch32\mpu\libarch__arm__core__aarch32__mpu.a
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\string\strncasecmp.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\idle.c.o
Indexing .pio\build\nrf52840_dk\zephyr\arch\arch\arm\core\aarch32\mpu\libarch__arm__core__aarch32__mpu.a
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdout\fprintf.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\printk.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\fatal.c.o
Compiling .pio\build\nrf52840_dk\drivers__gpio\zephyr\drivers\gpio\gpio_nrfx.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\nmi.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\timeout.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\timeutil.c.o
Compiling .pio\build\nrf52840_dk\isr_tables\zephyr\arch\common\isr_tables.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\pipes.c.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32__cortex_m\zephyr\arch\arch\arm\core\aarch32\cortex_m\vector_table.S.o
Compiling .pio\build\nrf52840_dk\arch__arm__core__aarch32\zephyr\arch\arch\arm\core\aarch32\swap.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\crc32_sw.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\condvar.c.o
Compiling .pio\build\nrf52840_dk\lib__libc__minimal\zephyr\lib\libc\minimal\source\stdlib\exit.c.o
Compiling .pio\build\nrf52840_dk\zephyr\zephyr\lib\os\crc8_sw.c.o
Compiling .pio\build\nrf52840_dk\kernel\zephyr\kernel\sem.c.o
Archiving .pio\build\nrf52840_dk\zephyr\arch\arch\arm\core\aarch32\cortex_m\libarch__arm__core__aarch32__cortex_m.a
Archiving .pio\build\nrf52840_dk\zephyr\arch\common\libisr_tables.a
Archiving .pio\build\nrf52840_dk\modules\hal_nordic\nrfx\libmodules__hal_nordic__nrfx.a
Indexing .pio\build\nrf52840_dk\zephyr\arch\common\libisr_tables.a
Archiving .pio\build\nrf52840_dk\zephyr\arch\arch\arm\core\aarch32\libarch__arm__core__aarch32.a
Indexing .pio\build\nrf52840_dk\zephyr\arch\arch\arm\core\aarch32\cortex_m\libarch__arm__core__aarch32__cortex_m.a
Indexing .pio\build\nrf52840_dk\modules\hal_nordic\nrfx\libmodules__hal_nordic__nrfx.a
Archiving .pio\build\nrf52840_dk\zephyr\libzephyr.a
Indexing .pio\build\nrf52840_dk\zephyr\arch\arch\arm\core\aarch32\libarch__arm__core__aarch32.a
Archiving .pio\build\nrf52840_dk\zephyr\lib\libc\minimal\liblib__libc__minimal.a
Archiving .pio\build\nrf52840_dk\zephyr\drivers\gpio\libdrivers__gpio.a
Indexing .pio\build\nrf52840_dk\zephyr\libzephyr.a
Indexing .pio\build\nrf52840_dk\zephyr\drivers\gpio\libdrivers__gpio.a
Indexing .pio\build\nrf52840_dk\zephyr\lib\libc\minimal\liblib__libc__minimal.a
Archiving .pio\build\nrf52840_dk\zephyr\kernel\libkernel.a
Indexing .pio\build\nrf52840_dk\zephyr\kernel\libkernel.a
Linking .pio\build\nrf52840_dk\zephyr\firmware-pre.elf
Generating .pio\build\nrf52840_dk\zephyr\dev_handles.c
Generating ISR list .pio\build\nrf52840_dk\zephyr\isrList.bin
Generating ISR table .pio\build\nrf52840_dk\zephyr\isr_tables.c
Compiling .pio\build\nrf52840_dk\zephyr_final\zephyr\isr_tables.c.o
C:\Users\Max\.platformio\packages\framework-zephyr@2.20701.220422\scripts\gen_handles.py:46: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
Compiling .pio\build\nrf52840_dk\zephyr_final\zephyr\dev_handles.c.o
Linking .pio\build\nrf52840_dk\firmware.elf
Checking size .pio\build\nrf52840_dk\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   2.1% (used 5395 bytes from 262144 bytes)
Flash: [          ]   1.2% (used 12612 bytes from 1048576 bytes)
Building .pio\build\nrf52840_dk\firmware.hex
==========[SUCCESS] Took 19.39 seconds ==========
>pio system info
--------------------------  ----------------------------------------------------
PlatformIO Core             6.1.17
Python                      3.11.7-final.0
System Type                 windows_amd64
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp1252
PlatformIO Core Directory   C:\Users\Max\.platformio
PlatformIO Core Executable  C:\Users\Max\.platformio\penv\Scripts\platformio.exe
Python Executable           C:\Users\Max\.platformio\penv\Scripts\python.exe
Global Libraries            0
Development Platforms       33
Tools & Toolchains          175
--------------------------  ----------------------------------------------------

Can you, now that the platformio.ini is only the basic 4 lines, do

rm -rf /home/tom/.platformio

again, remove the .pio folder of the project, restart VSCode and rebuild.

No, this still doesnt work. I see that you have Python 3.11.7, while i have Python 3.12.3:

python3 --version
Python 3.12.3

The output is still depending on this distutils:


 *  Executing task: platformio run --environment nrf52840_dk 

Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: zephyr)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
PLATFORM: Nordic nRF52 (10.7.0) > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES: 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-gperf @ 3.0.4 
 - tool-ninja @ 1.7.1 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Generating KObject files...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
Validating driver...
Traceback (most recent call last):
  File "/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/scripts/gen_kobject_list.py", line 60, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
*** Error 1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel_includes.h:41,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/kernel.h:17,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/arch/arm/core/offsets/offsets.c:9:
/home/tom-retterath/.platformio/packages/framework-zephyr@2.20701.220422/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/nrf52840_dk/zephyr_final/zephyr/misc/empty_file.c.o
*** [.pio/build/nrf52840_dk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
======================================================================= [FAILED] Took 2.80 seconds =======================================================================

 *  The terminal process "platformio 'run', '--environment', 'nrf52840_dk'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

What is the output of pio system info on the PIO CLI?

pio system info
--------------------------  ---------------------------------------------------
PlatformIO Core             6.1.17
Python                      3.12.3-final.0
System Type                 linux_x86_64
Platform                    Linux-6.11.0-17-generic-x86_64-with-glibc2.39
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core Directory   /home/tom-retterath/.platformio
PlatformIO Core Executable  /home/tom-retterath/.platformio/penv/bin/platformio
Python Executable           /home/tom-retterath/.platformio/penv/bin/python
Global Libraries            0
Development Platforms       1
Tools & Toolchains          12
--------------------------  ---------------------------------------------------
tom-retterath@tom-retterath-hs-pc:~/Documents/PlatformIO/Projects/DongleFirmware$ 

Can you, in that same CLI, do

/home/tom-retterath/.platformio/penv/bin/python -m pip install setuptools

and clean recompile (delete .pio folder and build again)

Edit: It says here that distutils was removed in favor of setuptools, exactly starting at Python version 3.12: https://stackoverflow.com/a/76691103/5296568

So my Python 3.11 version may as well be the reason.

CC @ivankravets I have reason to believe that

  1. PlatformIO core installer installs Python 3.12
  2. Zephyr depends on distutils which was previously present in Python 3.11, but with Python 3.12 was removed in favor of the setuptools package
  3. setuptools package is by default not installed
  4. nRF52 CI does not catch this because it still works on Python 3.9
  5. Hence building Zephyr project with the Python 3.12 enviornment does not seem to be possible without workarounds (installing setuptools package)
2 Likes