Can someone get this to compile?

When I open and build the project, I get the error

RuntimeError: deque mutated during iteration:
  File "C:\Users\Max\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 180:
    env.SConscript(env.GetExtraScripts("post"), exports="env")
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Script\SConscript.py", line 620:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Max\Downloads\Marlin-2.1.2.PRO_1.28\Marlin-2.1.2.PRO\buildroot\share\PlatformIO\scripts\offset_and_rename.py", line 24:
    marlin.relocate_vtab(LD_FLASH_OFFSET)
  File "C:\Users\Max\Downloads\Marlin-2.1.2.PRO_1.28\Marlin-2.1.2.PRO\buildroot\share\PlatformIO\scripts\marlin.py", line 30:
    replace_define("VECT_TAB_OFFSET", address)
  File "C:\Users\Max\Downloads\Marlin-2.1.2.PRO_1.28\Marlin-2.1.2.PRO\buildroot\share\PlatformIO\scripts\marlin.py", line 19:
    for define in env['CPPDEFINES']:

Which we have already discussed in

Marlin 2.1.2, being from 2 years ago, does not have that fix yet. That was fixed only last year. Applying the same fix leads me to:

Marlin\src\HAL\STM32\MarlinSPI.h:99:3: error: 'spi_mode_e' does not name a type

which is because the ini/stm32f4.ini does something rather crazy:

platform_packages           = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip

this seemingly two year old Marlin version pulls the bleeding edge Arduino STM32 core. Of course, many things have changed by now, and this broke compatibility. There is no spi_mode_e nowadays, it’s just SPIMode. The solution is as posted here already, to fixate this version to 2.6.0, which we specify in line 744 with

platform_packages           = framework-arduinoststm32@~4.20600.231001

And after this, we get

Linking .pio\build\mks_yuntu_tjc\firmware.elf
Building C:\Users\Max\Downloads\Marlin-2.1.2.PRO_1.28\Marlin-2.1.2.PRO\.pio\build\mks_yuntu_tjc/firmware.hex
Checking size .pio\build\mks_yuntu_tjc\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====     ]  46.2% (used 30268 bytes from 65536 bytes)
Flash: [=======   ]  66.7% (used 174784 bytes from 262144 bytes)
Building .pio\build\mks_yuntu_tjc\firmware.bin
====================== [SUCCESS] Took 138.53 seconds ======================

A successfull build.

1 Like