Trying to compile Marlin 2.1.2 for Ender 3 SKR Mini v2.0 board

Hi,

I’m new to Marlin.

I’ve tried to compile https://www.danbp.org/downloads/Marlin-2.1.2_SKR_Mini_E3_v2_BLTouch.zip which comes from this excellent site -
Pre-configured Marlin for SKR Mini E3 v2 on Ender 3 | Brookepedia

Now I’ve got as far as these error messages:

platformio run --silent -e STM32F103RE_btt_USB_maple ; echo “done” >|“/tmp/ipc”
RuntimeError: deque mutated during iteration:
File “/home/userx/.platformio/penv/lib/python3.11/site-packages/platformio/builder/main.py”, line 181:
env.SConscript(env.GetExtraScripts(“post”), exports=“env”)
File “/home/userx/.platformio/packages/tool-scons/scons-local-4.5.2/SCons/Script/SConscript.py”, line 598:
return _SConscript(self.fs, *files, **subst_kw)
File “/home/userx/.platformio/packages/tool-scons/scons-local-4.5.2/SCons/Script/SConscript.py”, line 285:
exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
File “/home/userx/projects/ender3/firmware/Marlin-2.1.2_SKR_Mini_E3_v2_BLTouch/buildroot/share/PlatformIO/scripts/custom_board.py”, line 14:
marlin.relocate_firmware(address)
File “/home/userx/projects/ender3/firmware/Marlin-2.1.2_SKR_Mini_E3_v2_BLTouch/buildroot/share/PlatformIO/scripts/marlin.py”, line 26:
replace_define(“VECT_TAB_ADDR”, address)
File “/home/userx/projects/ender3/firmware/Marlin-2.1.2_SKR_Mini_E3_v2_BLTouch/buildroot/share/PlatformIO/scripts/marlin.py”, line 19:
for define in env[‘CPPDEFINES’]:
==========================================
[FAILED] Took 7.79 seconds
==========================================

Environment Status Duration


STM32F103RE_btt_USB_maple FAILED 00:00:07.788


pio system info gives me:

PlatformIO Core 6.1.8a1
Python 3.11.2-final.0
System Type linux_x86_64
Platform Linux-6.2.0-20-generic-x86_64-with-glibc2.37
File System Encoding utf-8
Locale Encoding UTF-8
PlatformIO Core Directory /home/userx/.platformio
PlatformIO Core Executable /home/userx/.platformio/penv/bin/platformio
Python Executable /home/userx/.platformio/penv/bin/python
Global Libraries 0
Development Platforms 1
Tools & Toolchains 5


I don’t have a clue on what to do next. Anybody any idea? Thanks in advance.
MH

1 Like

I have the same problem currently

I had the project set up a while ago when i upgraded my Ender 3s Mainboard. I didnt do anything with it until a couple of days ago where i changed some firmware confugirations (successfully) it notified me about some updates (automated we love those). Now i tried building again and got the exact same error message apparently out of nowhere.

I already tried solutions from https://github.com/platformio/platformio-core/issues/4270 and others:

  • I have the 6.1.8a dev core installed (After Error)
  • PlatformIO 3.1.1 installed (Presumingly couple of days ago)
  • Reinstalled PlatformIO including deletion of C:/Users//.platformio
  • Downloaded the latest firmware from the BTT/BIGTREETECH-SKR-mini-E3 github page and replaced the whole project (preserving my configuration.h and my configuration_adv.h)

and according to this build Fixed "RuntimeError: deque mutated during iteration" · platformio/platformio-core@f2d206c · GitHub
There was an attempt to fix this bug but here we are. Would really like to build my firmware again ;__;

I download this .zip file, extract it, open it in VSCode and hit “Build”…

PLATFORM: ST STM32 (12.1.1) > STM32F103RE (64k RAM. 512k Flash)
HARDWARE: STM32F103RET6 72MHz, 64KB RAM, 512KB Flash
DEBUG: Current (stlink) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32-maple @ 3.10000.201129 (1.0.0)
 - tool-stm32duino @ 1.0.2
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
Converting Marlin.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies...
Dependency Graph
|-- SoftwareSerialM @ 1.0.0
|-- USBComposite for STM32F1 @ 0.91.0  
|-- TMCStepper @ 0.7.3
|-- U8glib-HAL @ 0.5.2
|-- SlowSoftI2CMaster @ 1.0.0
|-- SlowSoftWire @ 0.0.0+20230119195304
|-- STM32ADC @ 1.0
|-- EEPROM
|-- Wire @ 1.0
|-- Servo(STM32F1) @ 1.1.2
...

Linking .pio\build\STM32F103RE_btt_USB_maple\firmware.elf
Checking size .pio\build\STM32F103RE_btt_USB_maple\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  24.3% (used 15936 bytes from 65536 bytes)
Flash: [=====     ]  47.0% (used 246548 bytes from 524288 bytes)
Building .pio\build\STM32F103RE_btt_USB_maple\firmware.bin
==================================== [SUCCESS] Took 56.71 seconds ====================================

Zero problems.

And I’m on

>pio system info
--------------------------  --------------------------------------------------------------------
PlatformIO Core             6.1.7a2
Python                      3.11.1-final.0
System Type                 windows_amd64
Platform                    Windows-10

here.

hi @mongoq
try this
step 1:
platformio run --silent -e STM32F103RE_btt_USB_maple ; echo “done” >|“/tmp/ipc”
RuntimeError: deque mutated during iteration:
File “/home/userx/.platformio/penv/lib/python3.11/site-packages/platformio/builder/main.py”, line 181:
go to the location by using ctrl + click
step 2:
env.SConscript(env.GetExtraScripts(“post”), exports=“env”)
comment on this line by using #
I think it will work.

1 Like

Fails with the same error as well for me
pio system info

PlatformIO Core             6.1.8a1
Python                      3.11.3-final.0
System Type                 windows_amd64
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp1252
PlatformIO Core Directory   C:\Users\<user>\.platformio
PlatformIO Core Executable  C:\Users\<user>\.platformio\penv\Scripts\platformio.exe
Python Executable           C:\Users\<user>\.platformio\penv\Scripts\python.exe
Global Libraries            0
Development Platforms       2
Tools & Toolchains          7

That gets me as far as this:

userx@x220:~/projects/ender3/firmware/Marlin-2.1.2_SKR_Mini_E3_v2_BLTouch$ platformio run --silent -e STM32F103RE_btt_USB_maple ; echo “done” >|“/tmp/ipc”
In file included from Marlin/src/gcode/config/…/…/pins/pinsDebug.h:171:0,
from Marlin/src/gcode/config/M43.cpp:29:
Marlin/src/gcode/config/…/…/pins/…/HAL/STM32F1/pinsDebug.h:57:15: warning: ‘int8_t get_pin_mode(pin_t)’ defined but not used [-Wunused-function]
static int8_t get_pin_mode(pin_t pin) {
^~~~~~~~~~~~
Marlin/src/inc/Warnings.cpp:731:6: warning: #warning “Motherboard DIAG jumpers must be removed when SENSORLESS_HOMING is disabled. (Define DIAG_JUMPERS_REMOVED to suppress this warning.)” [-Wcpp]
#warning “Motherboard DIAG jumpers must be removed when SENSORLESS_HOMING is disabled. (Define DIAG_JUMPERS_REMOVED to suppress this warning.)”
^~~~~~~
Marlin/src/inc/Warnings.cpp:770:4: warning: #warning “Maple build environments are deprecated. Please use a non-Maple build environment. Report issues to the Marlin Firmware project.” [-Wcpp]
#warning “Maple build environments are deprecated. Please use a non-Maple build environment. Report issues to the Marlin Firmware project.”
^~~~~~~
/home/userx/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/7.2.1/…/…/…/…/arm-none-eabi/bin/ld: cannot open linker script file STM32F103RE_SKR_MINI_512K.ld: Datei oder Verzeichnis nicht gefunden
collect2: error: ld returned 1 exit status
*** [.pio/build/STM32F103RE_btt_USB_maple/firmware.elf] Error 1
=========================================
[FAILED] Took 122.01 seconds
=========================================

Environment Status Duration


STM32F103RE_btt_USB_maple FAILED 00:02:02.009
1 failed, 0 succeeded in 00:02:02.009


Now I do have the missing file → ./Marlin-2.1.2_SKR_Mini_E3_v2_BLTouch/buildroot/share/PlatformIO/ldscripts/STM32F103RE_SKR_MINI_512K.ld

But how can I ensure that it is found?

go to the extension(ctrl +shift + x )and search for Pylance
install Pylance with the 2023.5.10 version

Okay indeed with pio core version 6.1.8a1 it also fails for me.

Maybe you can open a PlatformIO Core CLI

pip uninstall platform
pip install "platformio==6.1.7"

? (or 6.1.6)

A more correct fix on the Marlin builder script is go to

buildroot/share/PlatformIO/scripts/marlin.py

and in line 16, replace the function with the current Marlin code

The important thing is that it does .copy() in line 19.

6 Likes

That worked for me! Wondering why this problem occured in the first place because i did not alter the build environment/firmware besides some configuration.h and configuration_adv.h tweaks. Also would there be possibly a downside to just using plane marlin with my configs adopted instead of the BTT forked FW?

PlatformIO had a new core version released lately because of installation issues on Mac OS here. The PlatformIO extension auto-updates to the newest stable core version.

Not sure how this code could ever work though on the old core version though, but it obviously did for me… Maybe you should open an issue about the regression in Issues · platformio/platformio-core · GitHub

For reference: Marlin fixed this issue already 2 months ago.

Of course all of these forked Marlin repos are now not having that.