Can someone get this to compile?

I obtained this Marlin source code from Artillery (after quite the argument…) - and I cannot get it to compile. I’d appreciate any direction that can be offered. (End goal is to enable Host Action Commands for my machine, but I can’t even get it to compile as they sent it to me)

https://drive.google.com/drive/folders/1LHze5McnA4xxd4xf8HlQYnBzJQdnl96Y?usp=drive_link

Thank you!

edit

I suppose I should include what I’ve tried, what failed, etc.

I tried building it as it is, of course, and that failed. I don’t remember the error codes, but my research indicated I needed to edit ini/stm324f.ini line 744 “platform_packages” to version 2.6.0 - which I did and ended up with another error.

I tried reverting PlatformIO Core and Python to a version predating the last successful build (Oct 2023, according to AutoBuild Marlin). That also didn’t work.

This is the error I’m currently getting with the firmware as it was given and all settings in VS back to normal:

> In file included from Marlin\src\HAL\STM32\MarlinSPI.cpp:27:
> Marlin\src\HAL\STM32\MarlinSPI.h:99:3: error: 'spi_mode_e' does not name a type
>    99 |   spi_mode_e _dataMode;
>       |   ^~~~~~~~~~
> In file included from Marlin\src\HAL\STM32\MarlinSPI.cpp:27:
> Marlin\src\HAL\STM32\MarlinSPI.h: In constructor 'MarlinSPI::MarlinSPI()':
> Marlin\src\HAL\STM32\MarlinSPI.h:55:27: warning: overflow in conversion from 'PinName' to 'pin_t' {aka 'short int'} changes value from 'NC' to '-1' [-Woverflow]
>    55 |   MarlinSPI() : MarlinSPI(NC, NC, NC, NC) {}
>       |                           ^~
> Marlin\src\HAL\STM32\MarlinSPI.h:55:31: warning: overflow in conversion from 'PinName' to 'pin_t' {aka 'short int'} changes value from 'NC' to '-1' [-Woverflow]
>    55 |   MarlinSPI() : MarlinSPI(NC, NC, NC, NC) {}
>       |                               ^~
> Marlin\src\HAL\STM32\MarlinSPI.h:55:35: warning: overflow in conversion from 'PinName' to 'pin_t' {aka 'short int'} changes value from 'NC' to '-1' [-Woverflow]
>    55 |   MarlinSPI() : MarlinSPI(NC, NC, NC, NC) {}
>       |                                   ^~
> Marlin\src\HAL\STM32\MarlinSPI.h:55:39: warning: overflow in conversion from 'PinName' to 'pin_t' {aka 'short int'} changes value from 'NC' to '-1' [-Woverflow]
>    55 |   MarlinSPI() : MarlinSPI(NC, NC, NC, NC) {}
>       |                                       ^~
> In file included from Marlin\src\HAL\STM32\MarlinSPI.cpp:27:
> Marlin\src\HAL\STM32\MarlinSPI.h: In constructor 'MarlinSPI::MarlinSPI(pin_t, pin_t, pin_t, pin_t)':
> Marlin\src\HAL\STM32\MarlinSPI.h:64:5: error: '_dataMode' was not declared in this scope; did you mean '_dataSize'?
>    64 |     _dataMode = SPI_MODE_0;
>       |     ^~~~~~~~~
>       |     _dataSize
> Marlin\src\HAL\STM32\MarlinSPI.h:64:17: error: 'SPI_MODE_0' was not declared in this scope; did you mean 'SPI_MODE0'?
>    64 |     _dataMode = SPI_MODE_0;
>       |                 ^~~~~~~~~~
>       |                 SPI_MODE0
> Marlin\src\HAL\STM32\MarlinSPI.h: In member function 'void MarlinSPI::setDataMode(uint8_t)':
> Marlin\src\HAL\STM32\MarlinSPI.h:83:23: error: '_dataMode' was not declared in this scope; did you mean '_dataSize'?
>    83 |       case SPI_MODE0: _dataMode = SPI_MODE_0; break;
>       |                       ^~~~~~~~~
>       |                       _dataSize
> Marlin\src\HAL\STM32\MarlinSPI.h:83:35: error: 'SPI_MODE_0' was not declared in this scope; did you mean 'SPI_MODE0'?
>    83 |       case SPI_MODE0: _dataMode = SPI_MODE_0; break;
>       |                                   ^~~~~~~~~~
>       |                                   SPI_MODE0
> compilation terminated due to -fmax-errors=5.
> *** [.pio\build\mks_yuntu_tjc\src\src\HAL\STM32\MarlinSPI.cpp.o] Error 1

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

This is probably where I went wrong? I’m attempting the build now using this line, whereas prior, I was pointing to the 2.6.0 zip file on github. (it turns out I already applied the function fix in marlin.py, apparently).

Thank you SO much.

*edit

Yes! This worked! That was the key! I should’ve asked here in the first place before chasing my tail for 8 hours down the google rabbit hole!