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.

52 lines
1.7 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. )
  19. Import("env", "projenv")
  20. # Always show warnings for project code
  21. projenv.ProcessUnFlags("-w")
  22. # XXX: note that this will also break %d format with floats and print raw memory contents as int
  23. # Cores after 2.3.0 can disable %f in the printf / scanf to reduce .bin size
  24. remove_float_support(env)
  25. ldscripts_inject_libpath(env)
  26. # two-step update hint when using 1MB boards
  27. env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_printsize)
  28. # disable postmortem printing to the uart. another one is in eboot, but this is what causes the most harm
  29. if "DISABLE_POSTMORTEM_STACKDUMP" in env["CPPFLAGS"]:
  30. env.AddPostAction(
  31. "$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.c.o", dummy_ets_printf
  32. )
  33. env.AddPostAction(
  34. "$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.cpp.o", dummy_ets_printf
  35. )
  36. # patch lwip1 sources conditionally:
  37. # https://github.com/xoseperez/espurna/issues/1610
  38. lwip_inject_patcher(env)
  39. # when using git, add -DAPP_REVISION=(git-commit-hash)
  40. app_inject_revision(projenv)
  41. # handle OTA board and flags here, since projenv is not available in pre-scripts
  42. app_inject_flags(projenv)