Esp-idf ulp+mqtt wont build :Command too long

Hi
I’m a new platformio user with a familiar problem: The length of a compiler command exceeds the maximum allowable command length for my windows 11 system. I realize this is basically a limitation of the windows command line but am hoping someone may have a workaround.

I started with the espidf-ulp-pulse example and tried to add the bits for wifi and mqtt as follows

CMakeLists.txt

cmake_minimum_required(VERSION 3.16.0)

list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

project(espidf-ulp-pulse-new)

src/CMakeLists.txt

idf_component_register(SRCS "ulp_example_main.c"
                    INCLUDE_DIRS ""
                    REQUIRES driver soc nvs_flash ulp 
                    PRIV_REQUIRES mqtt esp_wifi
                    )
#
# ULP support additions to component CMakeLists.txt.
#
# 1. The ULP app name must be unique (if multiple components use ULP).
set(ulp_app_name ulp_main)
#
# 2. Specify all assembly source files.
#    Files should be placed into a separate directory (in this case, ulp/),
#    which should not be added to COMPONENT_SRCS.
set(ulp_s_sources "../ulp/pulse_cnt.S" "../ulp/wake_up.S")
#
# 3. List all the component source files which include automatically
#    generated ULP export file, ${ulp_app_name}.h:
set(ulp_exp_dep_srcs "ulp_example_main.c")
#
# 4. Call function to build ULP binary and embed in project using the argument
#    values above.
ulp_embed_binary(${ulp_app_name} "${ulp_s_sources}" "${ulp_exp_dep_srcs}")

target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

By my count the command is just over 9K in length. Interestingly removing mqtt from the REQUIRES line shortens it just enough to come in under the 8K windows command line limit.

I tried adding the script suggested as a workaround at 2021 Issue

“Command line is too long” while building large project under Windows

but that python script would not run on my system.

I’m using latest versions of all systems as installed by the VSCode extension system:
Windows 11 Home Edition, fully patched
VSCode version 1.101.1
Platform IO version 3.3.4
ESP-IDF v5.1.2

Complete output at gist pio run -v

Please file a bug in https://github.com/platformio/platform-espressif32/issues/.

Done: Windows 11 esp-idf cmake fails with "Command too long" · Issue #1603 · platformio/platform-espressif32 · GitHub

I found a somewhat Rube Goldberg-ish workaround for the windows command line length limitations.

  1. Install a linux distro from the Microsoft Store
  2. Install the PlatformIO using the instructions at Installer Script (Recommended) — PlatformIO latest documentation
  3. activate the platformio virtualeve with source /home/gertr/.platformio/penv/bin/activate
  4. Copy the project dir into the linux filesystem because pio on linux doesnt cope with the windows “My Documents” path rsync -av “/mnt/c/users/gertr/My Documents/PlatformIO/Projects/new-ulp-example” .
  5. build it with cd new-ulp-example; pio run
  6. Now copy the built image back to windows land because WSL doesnt have access to the USB ports rsync -av .pio/build/lolin32_lite/firmware.bin “/mnt/c/users/gertr/My Documents/PlatformIO/Projects/new-ulp-example/.pio/build/lolin32_lite”
  7. And finally upload it from the Windows PIO terminal with pio run -t nobuild -t upload

I did see there is now a way to give WSL access to USB ports - Connect USB devices | Microsoft Learn but I didnt want to go down that route