PlatformIO Community

STM32F103RC_btt_512K does not compile in VSCode PlatformIO IDE

Hi all, A VScode noob here trying to understand why my marlin in not compiling.

I bought myself an ender 3 a while ago, and recently upgraded to a skr mini e3 V1.2, and a bltouch. to make it all work i needed to update the firmware, so that is what i am doing right now.
I followed this turtorial, and no problems, till i wanted to compile the whole thing.

i have also tried reinstalling platformIO and VSCode but without succes.

this is my error code:

> Executing task: C:\Users\Henri\.platformio\penv\Scripts\pio.exe run <

Processing STM32F103RC_btt_512K (platform: ststm32@~6.1; board: genericSTM32F103RC; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
'CC' is not recognized as an internal or external command,
operable program or batch file.
CalledProcessError: Command 'CC -DTARGET_STM32F1 -D__MARLIN_FIRMWARE__ -DHAVE_SW_SERIAL -DDEBUG_LEVEL=0 -DSS_TIMER=4 -DSTM32_FLASH_SIZE=512 -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h' returned non-zero exit status 1.:
  File "C:\users\henri\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 168:
    env.SConscript(item, exports="env")
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\AAA\Marlin\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 286:
    apply_features_config()
  File "C:\AAA\Marlin\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 118:
    if not env.MarlinFeatureIsEnabled(feature):
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\AAA\Marlin\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 262:
    load_marlin_features()
  File "C:\AAA\Marlin\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 250:
    define_list = subprocess.check_output(cmd, shell=True).splitlines()
  File "C:\Users\Henri\.platformio\python3\lib\subprocess.py", line 411:
    **kwargs).stdout
  File "C:\Users\Henri\.platformio\python3\lib\subprocess.py", line 512:
    output=stdout, stderr=stderr)
======================================================================================================== [FAILED] Took 0.57 seconds ======================================================================================================== 

Environment           Status    Duration
--------------------  --------  ------------
STM32F103RC_btt_512K  FAILED    00:00:00.568
=================================================================================================== 1 failed, 0 succeeded in 00:00:00.568 ===================================================================================================The terminal process "C:\Users\Henri\.platformio\penv\Scripts\pio.exe 'run'" terminated with exit code: 1.

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

Compiling Marlin apparently has the apparently non-documented requirement that you need to have a compiler (gcc) installed in your system a quirk in Windows related to finding the compiler executable correctly, which may be related to the PlatformIO core, but can still be solved by installing GCC globally.

This was already covered in PlatformIO cannot compile Marlin for the LPC1769 environment.

I have downloaded and added this to the PATH and restarted my pc:
C:\Program Files (x86)\mingw-w64\

still does not work. did i fill it in correctly?

You must add the folder which contains the gcc executable.

In my case that would be C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin but it varies from user to user depending which installation options were chosen.

Check that by adding that to the path, then opening a terminal window (Windows+R -> cmd.exe) and typing gcc --version. It the command is found, it worked.

Then restart VSCode and retry.

Ah! that makes sense. i have changed it and now it says this:

> Executing task: C:\Users\Henri\.platformio\penv\Scripts\pio.exe run <

Processing STM32F103RC_btt_512K (platform: ststm32@~6.1; board: genericSTM32F103RC; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103RC.html
PLATFORM: ST STM32 (6.1.1) > STM32F103RC (48k RAM. 256k Flash)
HARDWARE: STM32F103RCT6 72MHz, 48KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32-maple 2.10000.200103 (1.0.0)
 - tool-stm32duino 1.0.2
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Converting Marlin.ino
'arm-none-eabi-g++' is not recognized as an internal or external command,
operable program or batch file.
*** Error 1
AssertionError: :
  File "C:\users\henri\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 170:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\users\henri\.platformio\platforms\ststm32@6.1.1\builder\main.py", line 98:
    target_elf = env.BuildProgram()
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\users\henri\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\users\henri\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 127:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\users\henri\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 339:
    env.ConvertInoToCpp()
  File "C:\Users\Henri\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\users\henri\.platformio\penv\lib\site-packages\platformio\builder\tools\piomisc.py", line 239:
    out_file = c.convert(ino_nodes)
  File "C:\users\henri\.platformio\penv\lib\site-packages\platformio\builder\tools\piomisc.py", line 91:
    return self.process(contents)
  File "C:\users\henri\.platformio\penv\lib\site-packages\platformio\builder\tools\piomisc.py", line 112:
    assert self._gcc_preprocess(contents, out_file)
======================================================================================================== [FAILED] Took 0.81 seconds ======================================================================================================== 

Environment           Status    Duration
--------------------  --------  ------------
STM32F103RC_btt_512K  FAILED    00:00:00.809
=================================================================================================== 1 failed, 0 succeeded in 00:00:00.809 ===================================================================================================The terminal process "C:\Users\Henri\.platformio\penv\Scripts\pio.exe 'run'" terminated with exit code: 1.

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

On a sidenote, are you using the latest Marlin from https://github.com/MarlinFirmware/Marlin or are you using some other repository?

Hm that’s weird. Please remove the folder C:\Users\Henri\.platformio\pacakges\toolchain-gccarmnoneeabi and retry the build. I suspect the binary in there got somehow corrupted (in bin\arm-none-eabi-g++.exe.

1 Like

i used this guide to clone it from github: To clone Marlin in VSCode via PlatformIO follow these steps:

  1. click the alien icon on the left
  2. click Clone Git Project
  3. paste “https://github.com/MarlinFirmware/Marlin/
  4. hit enter
  5. save it
  6. after it is done downloading, click open on the popup (bottom right)

it is now working after deleting the folder!

thanks for your help and time!

1 Like