Browse Source

pio: update ldpath as soon as possible

trying to fix #2343
*** [.pio\build\$PIOENV\firmware.bin] TypeError
`expected str, bytes or os.PathLike object, not Dir' trying to evaluate `${__get_flash_size(__env__)}'

as it turns out, PIO platform internals (sometimes) did not use the correct ldscript path
mcspr-patch-1
Maxim Prokhorov 3 years ago
parent
commit
e1b643fd00
1 changed files with 11 additions and 12 deletions
  1. +11
    -12
      code/scripts/espurna_utils/ldscripts.py

+ 11
- 12
code/scripts/espurna_utils/ldscripts.py View File

@ -1,23 +1,22 @@
import os
def ldscripts_inject_libpath(env):
platform = env.PioPlatform()
framework_dir = platform.get_package_dir("framework-arduinoespressif8266")
# espressif8266@1.5.0 did not append this directory into the LIBPATH
libpath_sdk = os.path.join(framework_dir, "tools", "sdk", "ld")
env.Append(LIBPATH=[libpath_sdk])
libpath_base = os.path.join("$PROJECT_DIR", "..", "dist", "ld")
env.Append(LIBPATH=[os.path.join(libpath_base, "pre_2.5.0")])
# local.eagle.app.v6.common.ld exists only with Core >2.5.0
def check_local_ld(target, source, env):
# we depend on different ldscript formats for old Core version
# TODO: 1.5.0 needs to be removed next release
# TODO: ldscript can be kept in the root of the repo
# (as this was done originally, during 2.3.0...2.4.2 times)
if platform.version == "1.5.0":
libpath_sdk = os.path.join(framework_dir, "tools", "sdk", "ld")
env.Append(LIBPATH=[libpath_sdk])
env.Prepend(LIBPATH=[os.path.join(libpath_base, "pre_2.5.0")])
else:
local_ld = env.subst(
os.path.join("$BUILD_DIR", "ld", "local.eagle.app.v6.common.ld")
)
if os.path.exists(local_ld):
env.Prepend(LIBPATH=[os.path.join(libpath_base, "latest")])
env.AddPreAction(os.path.join("$BUILD_DIR", "firmware.elf"), check_local_ld)
env.Prepend(LIBPATH=[os.path.join(libpath_base, "latest")])

Loading…
Cancel
Save