PlatformIO Community

Argument list too long errors

Hello,

I am just trying out the STM32 Nucleo using l476RG and mbed and this is an example program that I copied and modified from the STMicro site. This compiles and runs on the on-line mbed compiler by ST.

#include "mbed.h"
#include "rtos.h"
 
DigitalOut led1(D7);
DigitalOut led2(D8);
Thread thread;
 
void led2_thread() {
    while (true) {
        led2 = !led2;
        wait(1.0);
    }
}
 
int main() {
    thread.start(led2_thread);
    
    while (true) {
        led1 = !led1;
        wait(0.135);
    }
}

When I do the same thing with Platformio and VS code, I get the following errors:

Compiling .pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/integration/basic/main.o
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
Compiling .pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/c_strings/main.o
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
*** [.pio/build/nucleo_l4476RG/src/main.o] Error 1
Compiling .pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/dev_null/main.o
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/events/queue/main.o] Error 1
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/integration/basic/main.o] Error 1
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/c_strings/main.o] Error 1
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/dev_null/main.o] Error 1

This is my .ini file:

[env:nucleo_l4476RG]
platform = ststm32
board = nucleo_l476rg
framework = mbed
lib_deps =
#mbed-os
#build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT

I have tried using mbed-os with lib-deps and without, and it makes no difference.

Thanks in advance for any help or advice.

Don

This seems like an artefact to me when you added mbed-os to the lib_deps folder. The resulting deep folder structure and the include paths overflow the maximum length handled by the operating system. PIO has to handle it differently.

Please remove the .pio\libdeps folder entirely, and do not re-add mbed-os, but do re-add the build_flags line, and retry compilation.

1 Like

Hello Max,

Thank you for your reply. I did as you suggested by removing the .pio\libdeps folder and adding the build_flags. I still get the error messages:

> Executing task: platformio run <

Processing nucleo_l4476RG (platform: ststm32; board: nucleo_l476rg; framework: mbed)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_l476rg.html
PLATFORM: ST STM32 5.7.0 > ST Nucleo L476RG
HARDWARE: STM32L476RGT6 80MHz, 128KB RAM, 1MB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: toolchain-gccarmnoneeabi 1.70201.0 (7.2.1), framework-mbed 5.51401.191023 (5.14.1)
Collecting mbed sources...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <mbed-os>
Building in release mode
Compiling .pio/build/nucleo_l4476RG/src/main.o
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
Compiling .pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/events/queue/main.o
Compiling .pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/integration/basic/main.o
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
Compiling .pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/c_strings/main.o
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
Compiling .pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/dev_null/main.o
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
*** [.pio/build/nucleo_l4476RG/src/main.o] Error 1
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/events/queue/main.o] Error 1
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/integration/basic/main.o] Error 1
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/c_strings/main.o] Error 1
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/dev_null/main.o] Error 1
Compiling .pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/echo/main.o
arm-none-eabi-g++: error trying to exec '/Users/donblack/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1plus': execv: Argument list too long
*** [.pio/build/nucleo_l4476RG/lib322/mbed-os_ID2499/TESTS/mbed_drivers/echo/main.o] Error 1
============================================================================ [FAILED] Took 76.21 seconds ============================================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

Here is the .ini file:

;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

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:nucleo_l4476RG]

platform = ststm32

board = nucleo_l476rg

framework = mbed

build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT

Perhaps I should remove all the Frameworks associated with STM32 and reload them?

Thanks again for your help – sorry for being useless with this, but I am really confused.

Don

Dependency Graph 
|-- <mbed-os>

The mbed-os “library” is still in the dependency graph, which is the source of the error. Can you please remove your entire .pio\ folder in the project. Have you installed this library in the global library space by any chance? If yes, open a PIO terminal and execute

pio lib uninstall mbed-os

and attempt recompilation.

Thanks, Max.

This solution eliminated the error regarding the argument list too long. I still have errors related to RTOS, but I will attempt to get them worked out.

Thanks again for your fast response and help.

Don