Custom build of esp32 over idf-release/v5.1

Hi there,

I’ve a custom build of esp32 arduino libraries that builds on top of ESP-IDF v5.1.

Can I use that build within PlatformIO? And How?

With Thanks,
Hamza Hajeir

Not so easy. Easiest is to build a complete Framework with the libs which can be used in Platformio. I modified the Arduino Lib Builder to generate a fully valid framework.
My fork of the lib Builder. GitHub - Jason2866/esp32-arduino-lib-builder at 5.1_fs_grow
The build is done via GH Actions and generates Releases. This Releases can directly be used with platform_packages

Nicely built tools! I do perform these steps manually and did made several of v2.0.x custom builds, but with the lack of arduino 3.0.0 release, I’m not sure what to do, as it seems 3.0.0 upwards have a bit different file heirarchy (tools/sdk no longer used), and further the lack of knowledge how PlatformIO decides the toolchain* with the absence of Arduino release and the further Espressif32 platform’s one.

* The IDF v5.0+ comes with GCC v12.2+.

Best,

You can use my Platformio platform for Arduino 3.0 / IDF 5.1 with
platform = https://github.com/Jason2866/platform-espressif32/.git#Arduino/IDF5
and add your built framework with platform_packages
example:

platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1643/framework-arduinoespressif32-release_v5.1-f45a4361b2.zip

It is a fully working setup for pre Arduino 3.0 and IDF 5.1. Even Arduino as component of IDF does work.
See CI run building the examples 1638 · Jason2866/platform-espressif32@4744a1d · GitHub

1 Like

Thanks @jason2866, I’ll try this at soonest!

Hi @jason2866, I’m facing a build error and I’m not sure what’s the root cause of, here’s a pio run command:

Is it something wrong with the espressif32 platform, my build, or PlatformIO?

pio run -e esp32s3-devkitc -v
Processing esp32s3-devkitc (framework: arduino; platform: https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5; platform_packages: platformio/framework-arduinoespressif32 @ https://github.com/HamzaHajeir/arduino-esp32#lwip-tls-3.0.0-rc1; board: esp32-s3-devkitc-1; lib_deps: https://github.com/HamzaHajeir/AEAD_OCB.git, densaugeo/base64 @ ^1.4.0, bblanchon/ArduinoJson@^6.19.4, https://github.com/mapbox/protozero#v1.7.1, https://github.com/HamzaHajeir/H4#4.0.3, https://github.com/HamzaHajeir/H4AsyncTCP#0.0.18, https://github.com/HamzaHajeir/H4AsyncMQTT#1.0.0-rc6, https://github.com/HamzaHajeir/H4AsyncWebServer#0.0.7, https://github.com/HamzaHajeir/ArmadilloHTTP#0.1.5, LittleFS; lib_ldf_mode: deep+; board_build.filesystem: littlefs; build_flags: -std=gnu++2a, -DEMBEDDED_PLATFORM=1, -DLWIP_ALTCP=1, -DLWIP_ALTCP_TLS=1, -DLWIP_ALTCP_TLS_MBEDTLS=1, -DBOARD_HAS_PSRAM; build_unflags: -std=gnu++11; build_src_flags: -DPROJ_BAUD_RATE=115200; debug_build_flags: -std=gnu++2a, -DEMBEDDED_PLATFORM=1, -DLWIP_ALTCP=1, -DLWIP_ALTCP_TLS=1, -DLWIP_ALTCP_TLS_MBEDTLS=1, -DBOARD_HAS_PSRAM, -Og -ggdb3 -g3; upload_speed: 921600; monitor_filters: esp32_exception_decoder, time, log2file; monitor_speed: 115200; monitor_eol: LF)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (2023.8.1+sha.5f5cd6e) (git+https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.0.0+sha.7bfb11c (git+https://github.com/HamzaHajeir/arduino-esp32#lwip-tls-3.0.0-rc1)
 - tool-esptoolpy @ 1.40700.0+dev (4.7.0, https://github.com/tasmota/esptool/releases/download/v4.7.0-dev/esptool-4.7.0.zip)
 - tool-mklittlefs @ 3.2.0
 - tool-mkspiffs @ 2.230.0 (2.30)
 - toolchain-riscv32-esp @ 12.2.0+20230208
 - toolchain-xtensa-esp32s3 @ 12.2.0+20230208
KeyError: 'framework-arduinoespressif32-libs':
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\builder\main.py", line 173:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Hamza\.platformio\platforms\espressif32\builder\main.py", line 343:
    target_elf = env.BuildProgram()
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\envs.py", line 242:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\builder\tools\piobuild.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\envs.py", line 242:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\builder\tools\piobuild.py", line 121:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\envs.py", line 242:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\builder\tools\piobuild.py", line 342:
    SConscript(env.GetFrameworkScript(name), exports="env")
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 662:
    return method(*args, **kw)
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Hamza\.platformio\platforms\espressif32\builder\frameworks\arduino.py", line 51:
    SConscript(
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 662:
    return method(*args, **kw)
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Hamza\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Hamza\.platformio\packages\framework-arduinoespressif32\tools\platformio-build.py", line 40:
    FRAMEWORK_LIBS_DIR = platform.get_package_dir("framework-arduinoespressif32-libs")
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\platform\_packages.py", line 32:
    pkg = self.get_package(name)
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\platform\_packages.py", line 29:
    return self.pm.get_package(spec or self.get_package_spec(name))
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\platform\_packages.py", line 21:
    owner=self.packages[name].get("owner"),

Your custom arduino-esp32 fork has a modified build script that requires framework-arduinoespressif32-libs, but no such package is declared in the platform. I don’t think it should be using git+https://github.com/HamzaHajeir/arduino-esp32#lwip-tls-3.0.0-rc1 if you want to use the standard https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5? If so, just delete C:\Users\Hamza\.platformio\packages\framework-arduinoespressif32 so that the platform can download the correct framework version automatically.

1 Like

Yes, Max is right (as always :wink: ) I modified the Platformio build script so that everything is in the framework. The libs are not downloaded from somewhere. You cant mix.
If you want to use your fork, you have to place the compiled libs in folder tools in folder esp32-arduino-libs and change the script platformio-build.py in Arduino to this one https://github.com/tasmota/arduino-esp32/blob/main/tools/platformio-build.py

EDIT: And in Lib Builder is a Platformio build file changed too.

1 Like

As i said before it is not plain easy. Some understanding needed how the pieces fits together. To avoid errors i would not do the build without fully automating the process.
Just fork my builder and change the repos where to fetch the sources. Thats all.

I’ve made several successful builds previously, but due to major changes (idf5 arduino3) somethings have been changed.

I’ve just patched the aforementioned scripts and the compiler seems working! I’ll consider forking your one and put my overriding lwip library under components soon.

Thanks again :slight_smile:

There has been indeed some major changes how the packages are provided with Arduino 3.0. I have reverted to the way to include the libs in the framework and NOT to download it separate from github.

1 Like

Hi @jason2866, I’ve fetched your v5.1_arduino branch and starting building atop of it.

However, there’s a strange linking error I’m facing when building arduino application, which states some mbedtls functions are not defined:
undefined reference to 'mbedtls_ssl_ticket_XXXX' (XXXX is the specific function).

I’ve made sure that MBEDTLS_SSL_TICKET_C and MBEDTLS_SSL_SESSION_TICKETS are defined in <mbedtls/mbedtls_config.h> within the built code.

I’ve read the compiled library (libmbedtls.a) and found no reference for those functions.

However, I’ve checked out the relevant snippet within build/build.ninja file and here’s it:

build esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedtls.dir/ssl_ticket.c.obj: C_COMPILER__mbedtls_ /home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/mbedtls/mbedtls/library/ssl_ticket.c || cmake_object_order_depends_target_mbedtls
  DEFINES = -DESP_PLATFORM -DIDF_VER=\"c1c843f5e2-dirty\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DNDEBUG -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS
  DEP_FILE = esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedtls.dir/ssl_ticket.c.obj.d
  FLAGS = -mlongcalls  -Wall -Wextra -Wwrite-strings -Wformat=2 -Wno-format-nonliteral -Wvla -Wlogical-op -Wshadow -Wformat-signedness -Wformat-overflow=2 -Wformat-truncation -Werror -Wmissing-declarations -Wmissing-prototypes -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fmacro-prefix-map=/home/hamza/arduino/esp32-arduino-lib-builder=. -fmacro-prefix-map=/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration
  INCLUDES = -I/home/hamza/arduino/esp32-arduino-lib-builder/build/config -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/mbedtls/port/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/mbedtls/mbedtls/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/mbedtls/mbedtls/library -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/newlib/platform_include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/freertos/esp_additions/include/freertos -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/freertos/esp_additions/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/freertos/esp_additions/arch/xtensa/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/include/soc -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/include/soc/esp32s3 -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/port/esp32s3/. -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/port/esp32s3/private_include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/heap/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/log/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/soc/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/soc/esp32s3 -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/soc/esp32s3/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/hal/esp32s3/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/hal/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/hal/platform_port/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_rom/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_rom/include/esp32s3 -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_rom/esp32s3 -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_common/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_system/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_system/port/soc -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/esp_system/port/include/private -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/xtensa/include -I/home/hamza/arduino/esp32-arduino-lib-builder/esp-idf/components/xtensa/esp32s3/include -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/include -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/include/apps -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/include/apps/sntp -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/lwip/src/include -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/port/include -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/port/freertos/include -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/port/esp32xx/include -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/port/esp32xx/include/arch -I/home/hamza/arduino/esp32-arduino-lib-builder/components/lwip/lwip/src/apps/altcp_tls
  OBJECT_DIR = esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedtls.dir
  OBJECT_FILE_DIR = esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedtls.dir
  TARGET_COMPILE_PDB = esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedtls.dir/mbedtls.pdb
  TARGET_PDB = esp-idf/mbedtls/mbedtls/library/libmbedtls.pdb

What could be the issue?

Thanks

There is a reason why forked. Heavily tweaked sdkconfig for our needs. Removed or trimmed down anything we do not use. Removed in sdkconfig nearly all mbedtls stuff since we do not use. To enable mbedtls with all features again, remove everything in defconfig.common which has a dependency to mbedtls. The errors you see will be gone.

To understand,

Do you mean that for example:

# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set

Does mean it’s disabled? i.e Not to fall to the default value…?

Otherwise, I’ve did enable it there by changing to:

CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y

Keep in mind the linking error appears in building arduino applications, not within esp32-arduin-lib-builder.

Remove this lines https://github.com/Jason2866/esp32-arduino-lib-builder/blob/v5.1_arduino/configs/defconfig.common#L91-L183
and you get a standard mbedtls setup which does work for most use cases.

Or even simplier use the configs from the orig. Arduino Lib Builder!

1 Like

Hi Jason,
Thanks for your input, I was diving in proceeding, but still having some issues in the builds. And some other issues to debug it.

I’ve opened a new topic for the latter one, as I think it might be PIO-related.

Please confirm that you can debug in your side, so I ensure it’s something in my side.

Best,
Hamza

The missing GDB package was already fixed last week (Track Arduino ESP32 Alpha Release v3.0.0 based on ESP-IDF v5.1 · Issue #1211 · platformio/platform-espressif32 · GitHub), you need to pull the latest commit of Jason’s platform.

I’ve the updated platform by jason but it doesn’t install the gdb, I’ve found that it bounds the gdb presence to espidf framework:

Is it necessary to append espidf to the framework in platformio.ini?

I’ve appended the platform.py script to intall gdb for arduino framework, and here’s the related pkg list:

Resolving esp32s3-devkitc dependencies...
Platform espressif32 @ 2023.10.11+sha.ce0c9ae (required: git+https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5)
├── framework-arduinoespressif32 @ 3.0.0+sha.d94e4cc (required: git+https://github.com/HamzaHajeir/arduino-esp32#lwip-tls-3.0.0-rc2)
├── tool-cmake @ 3.21.3 (required: platformio/tool-cmake @ ~3.21.0)
├── tool-dfuutil-arduino @ 1.11.0 (required: platformio/tool-dfuutil-arduino @ ~1.11.0)
├── tool-esptoolpy @ 1.40700.0+dev2 (required: https://github.com/tasmota/esptool/releases/download/v4.7.0-dev2/esptool-4.7.0.zip)
├── tool-idf @ 1.0.1 (required: platformio/tool-idf @ ~1.0.1)
├── tool-mconf @ 1.4060000.20190628 (required: platformio/tool-mconf @ ~1.4060000.0)
├── tool-mkfatfs @ 2.0.1 (required: platformio/tool-mkfatfs @ ~2.0.0)
├── tool-mklittlefs @ 3.2.0 (required: tasmota/tool-mklittlefs @ ^3.2.0)
├── tool-mkspiffs @ 2.230.0 (required: platformio/tool-mkspiffs @ ~2.230.0)
├── tool-ninja @ 1.9.0 (required: platformio/tool-ninja @ ^1.7.0)
├── tool-openocd-esp32 @ 2.1100.20220706 (required: platformio/tool-openocd-esp32 @ ~2.1100.0)
├── tool-riscv32-esp-elf-gdb @ 11.2.0+20220823 (required: espressif/tool-riscv32-esp-elf-gdb @ ~11.2.0)
├── tool-xtensa-esp-elf-gdb @ 11.2.0+20230208 (required: espressif/tool-xtensa-esp-elf-gdb @ ~11.2.0)
├── toolchain-esp32ulp @ 1.23500.220830 (required: platformio/toolchain-esp32ulp @ ~1.23500.0)
├── toolchain-riscv32-esp @ 12.2.0+20230208 (required: espressif/toolchain-riscv32-esp @ 12.2.0+20230208)
└── toolchain-xtensa-esp32s3 @ 12.2.0+20230208 (required: espressif/toolchain-xtensa-esp32s3 @ 12.2.0+20230208)

Okay I need to tweak the script to not install all those tools related to espidf, but I’ve got the gdb now.

The error on Debug Console haven’t changed:

undefinedFileNotFoundError: Traceback (most recent call last):
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\__main__.py", line 103, in main
    cli()  # pylint: disable=no-value-for-parameter
    ^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\cli.py", line 85, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\debug\cli.py", line 106, in cli
    _run(project_dir, debug_config, __unprocessed)
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\debug\cli.py", line 172, in _run
    loop.run_until_complete(coro)
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\debug\process\gdb.py", line 57, in run
    await self.spawn(*args, cwd=self.project_dir, wait_until_exit=True)
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\debug\process\base.py", line 76, in spawn
    await loop.subprocess_exec(
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1694, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 399, in _make_subprocess_transport
    transp = _WindowsSubprocessTransport(self, protocol, args, shell,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 921, in _start
    self._proc = windows_utils.Popen(
                 ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_utils.py", line 153, in __init__
    super().__init__(args, stdin=stdin_rfd, stdout=stdout_wfd,
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1024, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Hamza\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1493, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `python -m pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq/index.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

Dismiss this issue, I think this was due to a config:

debug_load_mode = manual