Unable to build Marlin code for SKR Mini E3 v1.2 STM32F103RC_btt

Only made a minor configuration change and unable to build.

Made sure to update PIO to most recent, compared master rep from Big Skr with local rep and no obvious errors.

Error begins with the following from below:
Building in release mode
NameError: name ‘env’ is not defined:
File “C:\Users\Josh.platformio\penv\lib\site-packages\platformio\builder\main.py”, line 182:
env.SConscript(env.GetExtraScripts(“post”), exports=“env”)

Log from attempted build:

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: ST STM32 (6.1.1) > STM32F103RC (48k RAM. 256k Flash)
HARDWARE: STM32F103RCT6 72MHz, 48KB RAM, 256KB 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
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 31 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- SoftwareSerialM @ 1.0.0
    |-- TMCStepper @ 0.7.3
    |-- U8glib-HAL @ 0.4.5
    |-- STM32ADC @ 1.0
    |-- EEPROM
    |-- Wire @ 1.0
    |-- USBComposite for STM32F1 @ 0.91
    |-- Servo(STM32F1) @ 1.1.2
    Building in release mode
    NameError: name ‘env’ is not defined:
    File “C:\Users\Josh.platformio\penv\lib\site-packages\platformio\builder\main.py”, line 182:
    env.SConscript(env.GetExtraScripts(“post”), exports=“env”)
    File “C:\Users\Josh.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py”, line 598:
    return _SConscript(self.fs, *files, **subst_kw)
    File “C:\Users\Josh.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 “C:\Users\Josh\Documents\GitHub\BIGTREETECH-SKR-mini-E3\firmware\V1.2\Marlin-2.0.7.2-SKR-mini-E3-V1.2\buildroot\share\PlatformIO\scripts\STM32F103RC_SKR_MINI.py”, line 7:
    for define in env[‘CPPDEFINES’]:
    =========================================================================== [FAILED] Took 17.86 seconds ===========================================================================

Environment Status Duration


STM32F103RC_btt FAILED 00:00:17.857
====================================================================== 1 failed, 0 succeeded in 00:00:17.857 ======================================================================

  • The terminal process “C:\Users\Josh.platformio\penv\Scripts\platformio.exe ‘run’, ‘–environment’, ‘STM32F103RC_btt’” terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

Screenshot and snippet

import os
Import(“env”)

STM32_FLASH_SIZE = 256

for define in env[‘CPPDEFINES’]:
if define[0] == “VECT_TAB_ADDR”:
env[‘CPPDEFINES’].remove(define)
if define[0] == “STM32_FLASH_SIZE”:
STM32_FLASH_SIZE = define[1]

Relocate firmware from 0x08000000 to 0x08007000

env[‘CPPDEFINES’].append((“VECT_TAB_ADDR”, “0x08007000”))

custom_ld_script = os.path.abspath(“buildroot/share/PlatformIO/ldscripts/STM32F103RC_SKR_MINI_” + str(STM32_FLASH_SIZE) + “K.ld”)
for i, flag in enumerate(env[“LINKFLAGS”]):
if “-Wl,-T” in flag:
env[“LINKFLAGS”][i] = “-Wl,-T” + custom_ld_script
elif flag == “-T”:
env[“LINKFLAGS”][i + 1] = custom_ld_script

I have a identical problem with SKR MINI E3 2.0 and Marlin 2.0.7.2. I need rebuild this version of Marlin. I’m not interested newer or older Marlin version.
My Visual Studio Code is actual
How can help me ?

Warning! Ignore unknown configuration option `monitor_flags` in section [env]
Warning! `src_filter` configuration option in section [env:DUE] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:SAMD51_grandcentral_m4] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:STM32F4] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:STM32F7] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:malyan_M300] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:esp32] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy31] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy35] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy36] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy41] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_build_flags` configuration option in section [env:linux_native] is deprecated and will be removed in the next release! Please use `build_src_flags` instead
Warning! `src_filter` configuration option in section [env:linux_native] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:include_tree] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! Ignore unknown configuration option `monitor_flags` in section [env]
Warning! `src_filter` configuration option in section [env:DUE] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:SAMD51_grandcentral_m4] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:STM32F4] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:STM32F7] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:malyan_M300] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:esp32] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy31] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy35] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy36] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy41] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_build_flags` configuration option in section [env:linux_native] is deprecated and will be removed in the next release! Please use `build_src_flags` instead
Warning! `src_filter` configuration option in section [env:linux_native] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:include_tree] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Resolving STM32F103RC_btt_512K dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...
UserSideException: Warning! Ignore unknown configuration option `monitor_flags` in section [env]
Warning! `src_filter` configuration option in section [env:DUE] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:SAMD51_grandcentral_m4] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:STM32F4] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:STM32F7] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:malyan_M300] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:esp32] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy31] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy35] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy36] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy41] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_build_flags` configuration option in section [env:linux_native] is deprecated and will be removed in the next release! Please use `build_src_flags` instead
Warning! `src_filter` configuration option in section [env:linux_native] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:include_tree] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
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
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
|-- TMCStepper @ 0.7.1
|-- Adafruit NeoPixel @ 1.2.4+sha.b72627a
|-- U8glib-HAL @ 0.4.3
|-- STM32ADC @ 1.0
|-- EEPROM
|-- Wire @ 1.0
|-- USBComposite for STM32F1 @ 0.91
|-- Servo(STM32F1) @ 1.1.2
Building in release mode
RuntimeError: deque mutated during iteration:
  File "C:\Users\zzz\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 182:
    env.SConscript(env.GetExtraScripts("post"), exports="env")
  File "C:\Users\zzz\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\zzz\.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 "C:\BIGTREETECH-SKR-mini-E3\firmware\V2.0\Marlin-2.0.7.2-SKR-mini-E3-V2.0\buildroot\share\PlatformIO\scripts\STM32F103RC_SKR_MINI.py", line 6:
    for define in env['CPPDEFINES']:
========================= [FAILED] Took 43.28 seconds =========================

Environment           Status    Duration
--------------------  --------  ------------
STM32F103RC_btt_512K  FAILED    00:00:43.276
==================== 1 failed, 0 succeeded in 00:00:43.276 ====================

We already discussed that in Trying to compile Marlin 2.1.2 for Ender 3 SKR Mini v2.0 board - #9 by maxgerhardt

Otherwise you’d need to install a much lower PlatformIO core version, or Python version.

1 Like

Thank you I updated this in STM32F103RC_SKR_MINI.py and commented out the older function.

Then was able to build marlin successfully

Good working, thanks