Issue building STM32F103RET6_creality

Recently I started getting errors building Marlin Firmware an STM32F103RET6_creality Environment like so. Its the default configuration of Marlin-2.0.x for Ender 3 v2
The STM32F103RET6_creality_maple Environment works just fine.

PS C:\Marlin-2.0.x> platformio run -e STM32F103RET6_creality
Processing STM32F103RET6_creality (platform: ststm32@~12.1; board: genericSTM32F103RE; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
Zugriff verweigert
CalledProcessError: Command ‘“C:\Users\KJ.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-g++.exe” -D__MARLIN_FIRMWARE__ -DNDEBUG -DUSBCON -DUSBD_USE_CDC -DTIM_IRQ_PRIO=13 -DADC_RESOLUTION=12 -DMCU_STM32F103RE -DHAL_SD_MODULE_ENABLED -DSS_TIMER=4 -DTIMER_SERVO=TIM5 -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h’ returned non-zero exit status 1.:
File “C:\Users\KJ.platformio\penv\Lib\site-packages\platformio\builder\”, line 175:
env.SConscript(item, exports=“env”)
File “C:\Users\KJ.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\”, line 591:
return _SConscript(self.fs, *files, **subst_kw)
File “C:\Users\KJ.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\”, line 280:
exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
File “C:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\”, line 309:
if not env.MarlinFeatureIsEnabled(feature):
File “C:\Users\KJ.platformio\packages\tool-scons\scons-local-4.1.0\SCons\”, line 658:
return self.method(*nargs, **kwargs)
File “C:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\”, line 285:
File “C:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\”, line 273:
define_list = subprocess.check_output(cmd, shell=True).splitlines()
File “C:\Users\KJ.platformio\python3\lib\”, line 424:
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “C:\Users\KJ.platformio\python3\lib\”, line 528:
raise CalledProcessError(retcode, process.args,
==================================================================== [FAILED] Took 1.98 seconds ====================================================================

Environment Status Duration

STM32F103RET6_creality FAILED 00:00:01.978

could someone help me or give me a hint how to solve the issu?

I already removed Marlin and PlatformIO extension from vscode and also reinstalled vscode and the required extension but still but still the same errors

Im using Windows 10 x64 and Python 3.9.6

  • Antivirus active?
  • does C:\Users\KJ\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-g++.exe exist?

Kaspersky is the most aggressive antivirus known to me, I’ve seen multiple instances of it still blocking things although being “disabled”. Since the binary exists but cannot be executed, I heavily suspected that access to it is blocked by the AV.

In the case of a broken toolchain download (which doesn’t seem to be the case here because the sizes look all good), you can try and delete the C:\Users\KJ.platformio\packages\toolchain-gccarmnoneeabi folder, which forces PlatformIO to redownload the toolchain at the next build.

I have already done this. Deleted the whole C:\Users\KJ.platformio folder… removed a few times PlatformIO from vscode and added it back again. Also removed vscode and installed it back again

I’d recommend backuping the license key for Kaspersky and uninstalling it at this point.

You can also sanity-check that this occurs in other projects as well, e.g., follow PlatformIO IDE for VSCode — PlatformIO latest documentation but instead of a Arduino Uno project create a STM32F103RE project and attempt to compile it.

i troubleshooted the issue to the line 273

define_list = subprocess.check_output(cmd, shell=True).splitlines()

In this file

this line ccausing “access denied”

Yes that’s the line of code that executes the compiler command, but it itself is not causing the access denied, that comes from Windows or a component interfering with Windows. If the compiler path is correct, it should go through.

The Compiling process itself works. Just did it. The maple on is working but the one without not.

Also tried to compile outside of vscode. Using command prompt and python. same error.
by the way thank you so far.

Well if it compiles for one STM board but not for another that’s really weird.

I cross-checked this though by downloading Marlin, the Marlin/Configurations repo of the same version, grabbed the files from Configurations-\config\examples\Creality\Ender-3 Pro\CrealityV422\*.h and copied them into Marlin-\Marlin and ran on the CLI / commandline with PlatformIO commands installed

C:\Users\Max\Marlin->pio run -e STM32F103RET6_creality
Processing STM32F103RET6_creality (platform: ststm32@~12.1; board: genericSTM32F103RE; framework: arduino)
------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 (12.1.1) > STM32F103RE (64k RAM. 512k Flash)
HARDWARE: STM32F103RET6 72MHz, 64KB RAM, 512KB Flash
DEBUG: Current (jlink) External (blackmagic, cmsis-dap, jlink, stlink)
 - framework-arduinoststm32 4.10900.200819 (1.9.0)
 - framework-cmsis 2.50501.200527 (5.5.1)
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Converting Marlin.ino
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Library Manager: Installing U8glib-HAL @ ~0.4.5
Library Manager: U8glib-HAL @ 0.4.5 has been installed!
Found 11 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <U8glib-HAL> 0.4.5
|   |-- <Wire> 1.0
|   |-- <SPI> 1.0
|-- <SPI> 1.0
|-- <Servo> 1.1.2
|-- <EEPROM> 2.0.1
|-- <SoftwareSerial> 1.0
|-- <IWatchdog> 1.0.0
|-- <Wire> 1.0
Building in release mode
Compiling .pio\build\STM32F103RET6_creality\FrameworkArduinoVariant\PeripheralPins.c.o
Linking .pio\build\STM32F103RET6_creality\firmware-20210725-124309.elf
Checking size .pio\build\STM32F103RET6_creality\firmware-20210725-124309.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  11.9% (used 7808 bytes from 65536 bytes)
Flash: [===       ]  27.9% (used 146072 bytes from 524288 bytes)
Building .pio\build\STM32F103RET6_creality\firmware-20210725-124309.bin
============================================= [SUCCESS] Took 57.61 seconds =============================================
Environment             Status    Duration
----------------------  --------  ------------
STM32F103RET6_creality  SUCCESS   00:00:57.610
============================================= 1 succeeded in 00:00:57.610 =============================================

So that all works very nicely.

Can you and try and do it exactly that way?

i tried but still the same issu.

and here the maple version

Does the same behavior of building/not building occur when you delete the .pio folder of the project and retry?

Yes, after deleting the folder and building/not building the folder is created again with a file .gcc_path in it.

inside the file

What is the output when you manually copy-paste this command into the terminal and execute it? Starting from

"C:\....." ... common-dependencies.h 


File “C:\Users\KJ\Marlin-\buildroot\share\PlatformIO\scripts\”,
line 34, in
NameError: name ‘Import’ is not defined

o_O executing GCC gives a Python error? That’s impossible.

100% sure you executed

"C:\Users\KJ\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-g++.exe" -D__MARLIN_FIRMWARE__ -DNDEBUG -DUSBCON -DUSBD_USE_CDC -DTIM_IRQ_PRIO=13 -DADC_RESOLUTION=12 -DMCU_STM32F103RE -DHAL_SD_MODULE_ENABLED -DSS_TIMER=4 -DTIMER_SERVO=TIM5 -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h


Can you show a screenshot?

Mea culpa. I executed

here the the required execution.

There’s a " missing at the very start of the command