Browse Source

sns: remove need to patch bme680 static library (#2429)

Upstream released a version of their proprietary library which does not require any modification to the linker script.
dev
Rui Marinho 3 years ago
committed by GitHub
parent
commit
bfa704c2fd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 76 deletions
  1. +1
    -1
      code/platformio.ini
  2. +0
    -2
      code/scripts/espurna_utils/__init__.py
  3. +0
    -69
      code/scripts/espurna_utils/libalgobsec.py
  4. +0
    -4
      code/scripts/pio_main.py

+ 1
- 1
code/platformio.ini View File

@ -152,7 +152,7 @@ lib_deps =
https://github.com/mcleng/MAX6675-Library#2.0.1
https://github.com/ThingPulse/esp8266-oled-ssd1306#3398c97
Adafruit SI1145 Library@~1.1.1
https://github.com/BoschSensortec/BSEC-Arduino-library.git#c5503e0
https://github.com/BoschSensortec/BSEC-Arduino-library.git#v1.6.1480
adafruit/Adafruit NeoPixel@^1.7.0
# ------------------------------------------------------------------------------


+ 0
- 2
code/scripts/espurna_utils/__init__.py View File

@ -22,7 +22,6 @@
from .checks import check_cppcheck, check_printsize
from .float_support import remove_float_support
from .ldscripts import ldscripts_inject_libpath
from .libalgobsec import libalgobsec_inject_patcher
from .postmortem import dummy_ets_printf
from .git import app_inject_revision
from .release import copy_release
@ -33,7 +32,6 @@ __all__ = [
"check_printsize",
"remove_float_support",
"ldscripts_inject_libpath",
"libalgobsec_inject_patcher",
"dummy_ets_printf",
"app_inject_revision",
"app_inject_flags",


+ 0
- 69
code/scripts/espurna_utils/libalgobsec.py View File

@ -1,69 +0,0 @@
import os
import sys
def libalgobsec_inject_patcher(env):
libalgobsec_builder = next(
(
builder
for builder in env.GetLibBuilders()
if builder.name == "BSEC Software Library"
),
None,
)
if libalgobsec_builder is None:
return
def process_archive(target, source, env):
import subprocess
# Allows `import espurna_utils` for external scripts, where we might not be within scons runtime
from SCons.Script import Delete, Mkdir
tmpdir = env.get(
"ESPURNA_LIBALGOBSEC_PATCHER_TMPDIR",
os.path.join(str(target[0].get_dir()), "_tmpdir"),
)
env.Execute(Mkdir(tmpdir))
# XXX: $AR does not support output argument for the extraction
# always switch into tmpdir when running commands
def run(cmd):
sys.stdout.write(" ".join(cmd))
sys.stdout.write("\n")
subprocess.check_call(cmd, cwd=tmpdir)
run([env.subst("$AR"), "x", source[0].abspath])
names = []
for infilename in os.listdir(tmpdir):
newname = infilename
if not infilename.endswith(".c.o"):
newname = infilename.replace(".o", ".c.o")
os.rename(os.path.join(tmpdir, infilename), os.path.join(tmpdir, newname))
names.append(newname)
pack_cmd = [env.subst("$AR"), "cr", target[0].abspath]
pack_cmd.extend(names)
run(pack_cmd)
env.Execute(Delete(tmpdir))
# Instead of replacing the file in-place, link with the patched version
libalgobsec_dir = os.path.join(libalgobsec_builder.src_dir, "esp8266")
target = env.File(
"libalgobsec.a", directory=env.subst("$BUILD_DIR/libalgobsec_patched")
)
source = env.File("libalgobsec.a", directory=libalgobsec_dir)
command = env.Command(target, source, process_archive)
patcher = env.Alias("patch-libalgobsec", command)
env.Append(LIBPATH=[target.get_dir()])
env.Append(LIBS=["algobsec"])
env.Depends("$BUILD_DIR/${PROGNAME}.elf", patcher)

+ 0
- 4
code/scripts/pio_main.py View File

@ -13,7 +13,6 @@ from espurna_utils import (
check_printsize,
remove_float_support,
ldscripts_inject_libpath,
libalgobsec_inject_patcher,
app_inject_revision,
dummy_ets_printf,
app_inject_flags,
@ -45,9 +44,6 @@ if "DISABLE_POSTMORTEM_STACKDUMP" in env["CPPFLAGS"]:
"$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.cpp.o", dummy_ets_printf
)
# place bsec's libalgobsec.a sections in the flash to avoid "section ‘.text' will not fit in region 'iram1_0_seg'" error
libalgobsec_inject_patcher(env)
# when using git, add -DAPP_REVISION=(git-commit-hash)
app_inject_revision(projenv)


Loading…
Cancel
Save