Can I use a custom shell or otherwise workaround CMD parameter length limitations?

I’m using PlatformIO in VS-Code to compile an esp32 project on windows 10. It’s a large(ish) source base with ~150 source files.

I’m now hitting a “command line too long” error in the link phase. The linker (xtensa-esp32-elf-g++) is being invoked with a list of .o files that is just under 8K so it’s likely that the 8192 character restriction on the cmd.exe shell is being hit.

I’ve tried setting the “Use legacy console” option OFF for the default cmd.exe invocation (in Windows properties) but this hasn’t fixed it.

Is there a way to either…

  • Force use of another shell (e.g. powershell)
  • Invoke the linker using a list of object files/parameters from a file. (There’s nothing in the help output that suggests this is possible but perhaps it is undocumented?)

Alternatively is there a way to workaround this through some magic platformio configuration? If necessary I’ll go spelunking through cmake files but was hoping there might be an easy fix for this. (Obvious workaround is to shorten the path names for all the source files but that’s a bit tedious…)

Thanks in advance…

In VSCode settings

Features->Terminal->Windows Exec

You can put the full path of any shell you want.

Thanks (useful to learn that tip!) but doesn’t that just change the default terminal from which platformio.exe is called by VS-Code? I get the same error when i call

…platformio\penv\Scripts\platformio.exe run --environment esp32-16MB
directly from powershell. The problem seems to be inside platformio.exe (or perhaps the way it uses Python to invoke build steps?). There aren’t any ‘obvious’ command line switches for platformio.exe run or configuration parameters to play with in the .ini file :frowning: