Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0 KiB

  1. # coding=utf-8
  2. # pylint: dummy-variables-rgx='(_+[a-zA-Z0-9]*?$)|dummy|env|projenv'
  3. #
  4. # Original extra_scripts.py
  5. # Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
  6. #
  7. # ldscripts, lwip patching, updated postmortem flags and git support
  8. # Copyright (C) 2019-2020 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
  9. # Run this script every time building an env AFTER platform-specific code is loaded
  10. from espurna_utils import (
  11. check_printsize,
  12. remove_float_support,
  13. ldscripts_inject_libpath,
  14. lwip_inject_patcher,
  15. app_inject_revision,
  16. dummy_ets_printf,
  17. app_inject_flags,
  18. copy_release,
  19. )
  20. Import("env", "projenv")
  21. import os
  22. CI = any([os.environ.get("TRAVIS"), os.environ.get("CI")])
  23. # Always show warnings for project code
  24. projenv.ProcessUnFlags("-w")
  25. # XXX: note that this will also break %d format with floats and print raw memory contents as int
  26. # Cores after 2.3.0 can disable %f in the printf / scanf to reduce .bin size
  27. remove_float_support(env)
  28. ldscripts_inject_libpath(env)
  29. # two-step update hint when using 1MB boards
  30. if not CI:
  31. env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_printsize)
  32. # disable postmortem printing to the uart. another one is in eboot, but this is what causes the most harm
  33. if "DISABLE_POSTMORTEM_STACKDUMP" in env["CPPFLAGS"]:
  34. env.AddPostAction(
  35. "$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.c.o", dummy_ets_printf
  36. )
  37. env.AddPostAction(
  38. "$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.cpp.o", dummy_ets_printf
  39. )
  40. # patch lwip1 sources conditionally:
  41. # https://github.com/xoseperez/espurna/issues/1610
  42. lwip_inject_patcher(env)
  43. # when using git, add -DAPP_REVISION=(git-commit-hash)
  44. app_inject_revision(projenv)
  45. # handle OTA board and flags here, since projenv is not available in pre-scripts
  46. app_inject_flags(projenv)
  47. # handle `-t release` when CI does a tagged build
  48. env.AlwaysBuild(env.Alias("release", "${BUILD_DIR}/${PROGNAME}.bin", copy_release))