platform-espressif8266 icon indicating copy to clipboard operation
platform-espressif8266 copied to clipboard

Restore compatibility when selecting older Arduino-ESP8266 versions

Open maxgerhardt opened this issue 4 years ago • 0 comments

Per https://community.platformio.org/t/filesystem-upload-option-not-available/23579/7?u=maxgerhardt.

When using a project that uses a recent platform version but selects an older Arduino-ESP8266 core (e.g., 2.5.2), problems arise when attempting to upload a filesystem image.

This code here

https://github.com/platformio/platform-espressif8266/blob/b6994e387be663ca4e8c29bc134777005a4fc014/builder/main.py#L93-L101

puts the values extracted from the linkerscript into the environment and enforces that FS_START and FS_END exist.

However, these symbols do not exist in older Arduino-ESP8266 versions

2.5.2 did

https://github.com/esp8266/Arduino/blob/8b899c12fb5044a6a51b92501bfcdf86a3d98dd8/tools/sdk/ld/eagle.flash.2m256.ld#L17-L20

Recent is

https://github.com/esp8266/Arduino/blob/612e7ffd7fb398fc2cdcf8bd1d177b75d997d46c/tools/sdk/ld/eagle.flash.2m256.ld#L16-L25

and thus an error

Building in release mode
AssertionError: :
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\main.py", line 178:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Max\.platformio\platforms\espressif8266\builder\main.py", line 243:
    target_firm = env.DataToBin(
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Environment.py", line 238:
    return super().__call__(target, source, *args, **kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Builder.py", line 654:
    return self._execute(env, target, source, OverrideWarner(kw), ekw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Builder.py", line 560:
    tlist, slist = self._create_nodes(env, target, source)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Builder.py", line 522:
    target, source = self.emitter(target=tlist, source=slist, env=env)
  File "C:\Users\Max\.platformio\platforms\espressif8266\builder\main.py", line 119:
    fetch_fs_size(env)
  File "C:\Users\Max\.platformio\platforms\espressif8266\builder\main.py", line 98:
    assert all([
========================================================================================= [FAILED] Took 2.53 sec

is thrown.

For backward compatibility reasons, recent platforms should support building of this eariler Arduino core by checking for the deprecated values, too.

Especially so since using an older platform version (which would have the correct code) brings other problems such as the one described in https://github.com/platformio/platformio-core/issues/4060 with it.

A reference project can be found at https://github.com/maxgerhardt/pio-old-esp8266.

maxgerhardt avatar Sep 22 '21 14:09 maxgerhardt