Trying to compile Marlin 2.0.7 - PIO Errors

I have an SKr v1.3 running Marlin 2.0.7 and I needed to update 2 lines of code and recompile it. My VScode and PlatformIO is up to date but it does not like this old version of Marlin. I have been searching this forum for 2 days now for a solution and while I do see some stuff that is helpful I cannot find a specific solution to this problem. Before I even try to compile I get this in the Output tab of VScode:

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 LPC1768 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 LPC1768 (platform: https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip; board: nxp_lpc1768; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
SyntaxError: source code string cannot contain null bytes

========================== [FAILED] Took 1.16 seconds ==========================

Environment    Status    Duration
-------------  --------  ------------
LPC1768        FAILED    00:00:01.157
==================== 1 failed, 0 succeeded in 00:00:01.157 ====================



I get this when trying to compile:

 *  Executing task: C:\Users\kortt\.platformio\penv\Scripts\platformio.exe run 

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 LPC1768 (platform: https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip; board: nxp_lpc1768; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
SyntaxError: source code string cannot contain null bytes

========================================================================= [FAILED] Took 1.39 seconds =========================================================================

Environment    Status    Duration
-------------  --------  ------------
LPC1768        FAILED    00:00:01.386
==================================================================== 1 failed, 0 succeeded in 00:00:01.386 ====================================================================

 *  The terminal process "C:\Users\kortt\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

Can anyone help or point me in the right place if this has been covered?
Thanks so much!

I think your platformio.ini - without seeing it :wink: - is using outdated (= deprecated) configuration options. Replace them with the new ones mentioned in the warning messages an everything should be fine …

For more details please have a look at https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/index.html

Usually that error is thrown from Python when there’s a null byte in the source code (.py files). That should never ever happen normally. You’ve got a corrupted hard drive?

And as said before, downgrade your PlatformIO core version to match that old Marlin version, so that it doesn’t complain about invalid configuration options. If needed, delete C:\Users\<user>\.platformio completely to get a clean start.

This laptop is a month old, I hope the drive isn’t corrupt :). It’s got a 1TB ssd that windows is on and a 2TB ssd data drive.

When you say downgrade the Platformio core is this the same as when you do the “install a different version” from PIO’s settings menu? I have dried downgrading to several different versions but I get errors concerning Python when it tries to install the lower version. How do you downgrade the core?

Thanks, bit of a noob when it comes to Platformio.

No, in the VSCode extension menu you would only downgrade the PlatformIO extension version. (Of course they’re also kind of coupled, not sure if the latest PlatformIO VSCode extension can talk with an ancient PIO core correctly).

As partly referenced here, you’ll have to open a PlatformIO Core CLI and use

pio system info

to find the

Python Executable           C:\Users\Max\.platformio\penv\Scripts\python.exe

location (will be different on your computer). Then, in that same terminal, you can issue a command like

C:\Users\Max\.platformio\penv\Scripts\python.exe -m pip install "platformio==6.1.4"

with a version selected from here.

After that,

pio --version

should hopefully reflect the change. This might need a restart of VScode, too.

Thanks Max, got a bit further with your advice.
I tracked Marlin 2.0.7 back to around Sep of 2020. So I used the steps you listed to downgrade platformio core to version 5.0.1 which is listed as being available Sep 2020. I know this version of Marlin DID compile at one time so my thinking was if I can get vscode and platforamio back to a state close to what it was when I initially compiled it it might work again, maybe it’s a pipe dream lol.

Iafter completed the above steps I did pio --version and it reported PlatformIO Core version 5.0.1 and directed me to restart vscode. After restart…same old errors and it reports it as version 6.1.15 again.
Do I need to try compiling after downgrading the Core but before I restart VScode?

Ah, in the extension settings of the PlatformIO VSCode extension, there should be a “Disable Autopupdate for PIO core” option.

Tried a bunch of different things but no go. I ended up going back to the latest Platformio IDO. I then commented out all the deprecated lines in the platformio.ini. It’s better but still getting the syntax err.

Warning! Ignore unknown configuration option `monitor_flags` in section [env]
Warning! Ignore unknown configuration option `monitor_flags` in section [env]
Resolving LPC1768 dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...
UserSideException: Warning! Ignore unknown configuration option `monitor_flags` in section [env]
Processing LPC1768 (platform: https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip; board: nxp_lpc1768; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
SyntaxError: source code string cannot contain null bytes

========================== [FAILED] Took 1.02 seconds ==========================

Environment    Status    Duration
-------------  --------  ------------
LPC1768        FAILED    00:00:01.022
==================== 1 failed, 0 succeeded in 00:00:01.022 ====================

Also when I load any configuration file such as configuration.h or configuaration_adv.h I alway get the “function call is not allowed in a constant expression” errors in the problems tab.

I’d pull out my hair if I had any left :slight_smile:

Is it “2.0.7” from 2020 or “2.0.7.3” from 2023 or some other version? I’m seeing different ones being available.

https://github.com/MarlinFirmware/Marlin/tree/2.0.7

#define CONFIGURATION_H_VERSION 020007

I’m pretty sure it is the one you linked to.
Pretty much the only reason I’m messing with this old version is because it’s for my cnc machine which has some specific code unique to it involving the endstops and swaping x and y axis’ around. The latest version of Marlin handles these things different and I’m not sure what I need to do to translate it over. It’s increasingly apparent I may have to do just that though.

I got it to compile with a lot of yellow warnings. I’m a little leary to try the file after all the warnings but if it fails on the machine then I’ll have to bite the bullet and upgrade to the latest Marlin.

In the end, I downloaded a copy from the link you provided, copied the two configuration files from the old Marlin 2.0.7 folder to the new Marlin folder and it compiled. Bob’s your Auntie.

Thanks for all your help @maxgerhardt