From 1d957506b34a5f50cb19545a0789610170f8a562 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Sat, 22 Aug 2020 01:36:44 +0300 Subject: [PATCH] PIO: remove Arduino Core 2.3.0 support (#2333) As this is no longer an option since PIO 4.4.0 ref. https://github.com/platformio/platformio-core/commit/04694b4126ba793bd24dbcd537f35f554f6973fc https://docs.platformio.org/en/latest/core/history.html *...I have known you for so long When we ran in circles...* --- .travis.yml | 2 - code/espurna/telnet.cpp | 11 ++++- code/ota.py | 8 ++-- code/platformio.ini | 63 +++++++++----------------- code/scripts/espurna_utils/__init__.py | 2 - code/scripts/espurna_utils/lwip.py | 56 ----------------------- code/scripts/pio_main.py | 8 ---- 7 files changed, 33 insertions(+), 117 deletions(-) delete mode 100644 code/scripts/espurna_utils/lwip.py diff --git a/.travis.yml b/.travis.yml index 1ee8dc49..07daa892 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ python: cache: directories: - ~/.npm - - ~/.platformio env: global: - BUILDER_TOTAL_THREADS=4 @@ -48,7 +47,6 @@ deploy: LMCdaQnCxSQ5EuKhqcFR6VTfDCWc06jwD4fdHfkmBaeWBMMzdoZEqN26AwdTnoLLlQJTR9l21NypgGybssBr69Md/ZinMahWCJJ4gVzPe9Adr9ijRbzj/wckirLBVZjRWn8fxTjJgjpu1ten2CgBfNcc/roN3fI6DV/1Fvv1REfihND4EeIermsxIVRXOyluu1vnPV9ZM28XBNch9XfkKwIpLEaHNNtkzlSEua39U34WpZShrxxEVoZhiF/R1ZF+NiAnursPcPsn5hdrXyHFLFT2dVDnlpdIp79c6SGkCZ636//5erB6hgBHshbwuT9TYXxtwLyL7AeN/MfCg0gtZSsDII8mLKzytW1tl7r1W9l7s21z/55tljSz2Z6dcbJC3bxucgcLxM9R6PrsPdDrPQTd0QwYqYalMNlfuA8KGcesZueqI9Q4uw7uHFUwIp7FIaoKhwhjTKe/ZHZ75zU4wdBTXof4dnSQOudoGGjRyyj7V0eR/Mhuni45N2Bldy9hDaldgtWMuEdx3ABW1IrPXtPDVTXM6QjUHm0nj5zzCgoCvQEw3jycA7Wlgbzo8MQkKH3u4MtupJcEGHJAqMbk+JlRpIfdWTiqtI697CReRGYSWT6YxF68TeJo77JPPph724BIBMtKtIk2+4RkHxz5RqM8O2vt+AFNjnWNIvVQtY8= file_glob: true file: firmware/espurna-*.bin - skip_cleanup: true on: tags: true repo: xoseperez/espurna diff --git a/code/espurna/telnet.cpp b/code/espurna/telnet.cpp index ef08d493..e2bb546f 100644 --- a/code/espurna/telnet.cpp +++ b/code/espurna/telnet.cpp @@ -31,7 +31,13 @@ Updated to use WiFiServer and support reverse connections by Niek van der Maas < struct AsyncBufferedClient { public: - constexpr static const size_t BUFFERS_MAX = 5; + constexpr static size_t BuffersMax = +#if (TCP_MSS == 1460) + 2ul; +#else + 5ul; +#endif + using buffer_t = std::vector; explicit AsyncBufferedClient(AsyncClient* client); @@ -221,8 +227,9 @@ void AsyncBufferedClient::_addBuffer() { size_t AsyncBufferedClient::write(const char* data, size_t size) { - if (_buffers.size() > AsyncBufferedClient::BUFFERS_MAX) return 0; + if (_buffers.size() > AsyncBufferedClient::BuffersMax) return 0; + // TODO: just waiting for onPoll is insufficient, we need to push data asap size_t written = 0; if (_buffers.empty()) { written = _client->add(data, size); diff --git a/code/ota.py b/code/ota.py index 21681a62..3dcb3563 100755 --- a/code/ota.py +++ b/code/ota.py @@ -328,8 +328,8 @@ def parse_commandline_args(): "-a", "--arduino-core", help="Arduino ESP8266 Core version", - default="2_3_0", - choices=["2_3_0", "latest", "git"], + default="current", + choices=["current", "latest", "git"], ) parser.add_argument("-o", "--flags", help="extra flags", default="") parser.add_argument("-p", "--password", help="auth password", default="") @@ -402,15 +402,13 @@ def discover_devices(args): @functools.lru_cache(maxsize=None) def get_platformio_env(arduino_core, size): - # todo: eventually 2_3_0 is dropped - # todo: naming prefix = "esp8266" if not size in [1, 2, 4]: raise ValueError( "Board memory size can only be one of: 1 for 1M, 2 for 2M, 4 for 4M" ) core = "" - if arduino_core != "2_3_0": + if arduino_core != "current": core = "-{}".format(arduino_core) return "{prefix}-{size:d}m{core}-base".format(prefix=prefix, core=core, size=size) diff --git a/code/platformio.ini b/code/platformio.ini index c08a49ea..d269e14f 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -20,22 +20,28 @@ extra_configs = # ------------------------------------------------------------------------------ # PLATFORM: # !! DO NOT confuse platformio's ESP8266 development platform with Arduino core for ESP8266 -# We use Arduino Core 2.3.0 (platformIO 1.5.0) as default # -# arduino core 2.3.0 = platformIO 1.5.0 -# arduino core 2.4.0 = platformIO 1.6.0 (not supported) -# arduino core 2.4.1 = platformIO 1.7.3 (not supported) -# arduino core 2.4.2 = platformIO 1.8.0 (not supported) -# arduino core 2.5.0 = platformIO 2.0.4 (not supported) -# arduino core 2.5.1 = platformIO 2.1.1 (not supported) -# arduino core 2.5.2 = platformIO 2.2.3 (not supported) -# arduino core 2.6.1 = platformIO 2.3.0 (not supported) -# arduino core 2.6.2 = platformIO 2.3.1 (not supported) -# arduino core 2.6.3 = platformIO 2.4.0 -# arduino core 2.7.1 = platformIO 2.5.3 +# arduino core 2.3.0 = espressif8266@1.5.0 (not supported) +# arduino core 2.4.0 = espressif8266@1.6.0 (not supported) +# arduino core 2.4.1 = espressif8266@1.7.3 (not supported) +# arduino core 2.4.2 = espressif8266@1.8.0 (not supported) +# arduino core 2.5.0 = espressif8266@2.0.4 (not supported) +# arduino core 2.5.1 = espressif8266@2.1.1 (not supported) +# arduino core 2.5.2 = espressif8266@2.2.3 (not supported) +# arduino core 2.6.1 = espressif8266@2.3.0 (not supported) +# arduino core 2.6.2 = espressif8266@2.3.1 (not supported) +# arduino core 2.6.3 = espressif8266@2.4.0 (not supported) +# arduino core 2.7.1 = espressif8266@2.5.3 (platform) +# arduino core 2.7.4 = espressif8266@2.6.2 (platform_latest) +# +# Arduino Core 2.3.0: +# "Error: Development platform 'espressif8266' is not compatible with PlatformIO Core v4.4.0-b.1 and depends on PlatformIO Core ^3.0.0" +# ref. https://docs.platformio.org/en/latest/core/history.html +# # ------------------------------------------------------------------------------ -platform_2_3_0 = espressif8266@1.5.0 -platform_latest = espressif8266@2.5.3 + +platform = espressif8266@2.5.3 +platform_latest = espressif8266@2.6.2 # ------------------------------------------------------------------------------ # FLASH SIZE: @@ -123,11 +129,6 @@ git_platform_packages = framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git toolchain-xtensa @ ~2.100100.200706 -# XXX: 2.3.0 depends on these -legacy_lib_deps = - https://github.com/xoseperez/Time - https://github.com/xoseperez/NtpClient.git#0942ebc - lib_deps = https://github.com/me-no-dev/ESPAsyncTCP.git#7e9ed22 ArduinoJson@5.13.4 @@ -161,7 +162,7 @@ lib_deps = # COMMON ENVIRONMENT SETTINGS: # ------------------------------------------------------------------------------ [env] -platform = ${common.platform_2_3_0} +platform = ${common.platform} framework = arduino board_build.flash_mode = dout build_flags = ${common.build_flags} @@ -181,8 +182,6 @@ lib_deps = lib_ignore = AsyncTCP Brzo I2C - Time - NtpClientLib # ------------------------------------------------------------------------------ # Base enrivonments, -DMANUFACTURER=..., -DDEVICE=... must be set: @@ -194,38 +193,18 @@ lib_ignore = [env:esp8266-512k-base] board = ${common.board_512k} board_build.ldscript = ${common.ldscript_512k} -lib_deps = - ${common.legacy_lib_deps} - ${common.lib_deps} -lib_ignore = - AsyncTCP [env:esp8266-1m-base] board = ${common.board_1m} board_build.ldscript = ${common.ldscript_1m} -lib_deps = - ${common.legacy_lib_deps} - ${common.lib_deps} -lib_ignore = - AsyncTCP [env:esp8266-2m-base] board = ${common.board_2m} board_build.ldscript = ${common.ldscript_2m} -lib_deps = - ${common.legacy_lib_deps} - ${common.lib_deps} -lib_ignore = - AsyncTCP [env:esp8266-4m-base] board = ${common.board_4m} board_build.ldscript = ${common.ldscript_4m} -lib_deps = - ${common.legacy_lib_deps} - ${common.lib_deps} -lib_ignore = - AsyncTCP [env:esp8266-1m-latest-base] platform = ${common.platform_latest} diff --git a/code/scripts/espurna_utils/__init__.py b/code/scripts/espurna_utils/__init__.py index 37fe11c3..8906ad17 100644 --- a/code/scripts/espurna_utils/__init__.py +++ b/code/scripts/espurna_utils/__init__.py @@ -23,7 +23,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 .lwip import lwip_inject_patcher from .postmortem import dummy_ets_printf from .git import app_inject_revision from .release import copy_release @@ -35,7 +34,6 @@ __all__ = [ "remove_float_support", "ldscripts_inject_libpath", "libalgobsec_inject_patcher", - "lwip_inject_patcher", "dummy_ets_printf", "app_inject_revision", "app_inject_flags", diff --git a/code/scripts/espurna_utils/lwip.py b/code/scripts/espurna_utils/lwip.py deleted file mode 100644 index a742fcd7..00000000 --- a/code/scripts/espurna_utils/lwip.py +++ /dev/null @@ -1,56 +0,0 @@ -import os - - -def lwip_inject_patcher(env): - # ignore when building with lwip2 - if "lwip_gcc" not in env["LIBS"]: - return - - platform = env.PioPlatform() - framework_dir = platform.get_package_dir("framework-arduinoespressif8266") - toolchain_prefix = os.path.join( - platform.get_package_dir("toolchain-xtensa"), "bin", "xtensa-lx106-elf-" - ) - - patch_action = env.VerboseAction( - " ".join( - [ - "-patch", - "-u", - "-N", - "-d", - os.path.join(framework_dir, "tools", "sdk", "lwip"), - os.path.join("src", "core", "tcp_out.c"), - env.subst( - os.path.join( - "$PROJECT_DIR", - "..", - "dist", - "patches", - "lwip_mtu_issue_1610.patch", - ) - ), - ] - ), - "Patching lwip source", - ) - build_action = env.VerboseAction( - " ".join( - [ - "make", - "-C", - os.path.join(framework_dir, "tools", "sdk", "lwip", "src"), - "install", - "TOOLS_PATH={}".format(toolchain_prefix), - "LWIP_LIB=liblwip_gcc.a", - ] - ), - "Rebuilding lwip", - ) - - patcher = env.Alias("patch-lwip", None, patch_action) - builder = env.Alias("build-lwip", patcher, build_action) - if os.environ.get("ESPURNA_PIO_PATCH_ISSUE_1610"): - env.Depends("$BUILD_DIR/${PROGNAME}.elf", builder) - env.AlwaysBuild(patcher) - env.AlwaysBuild(builder) diff --git a/code/scripts/pio_main.py b/code/scripts/pio_main.py index 8218e61f..4b8f15b2 100644 --- a/code/scripts/pio_main.py +++ b/code/scripts/pio_main.py @@ -14,7 +14,6 @@ from espurna_utils import ( remove_float_support, ldscripts_inject_libpath, libalgobsec_inject_patcher, - lwip_inject_patcher, app_inject_revision, dummy_ets_printf, app_inject_flags, @@ -42,9 +41,6 @@ if not CI: # disable postmortem printing to the uart. another one is in eboot, but this is what causes the most harm if "DISABLE_POSTMORTEM_STACKDUMP" in env["CPPFLAGS"]: - env.AddPostAction( - "$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.c.o", dummy_ets_printf - ) env.AddPostAction( "$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.cpp.o", dummy_ets_printf ) @@ -52,10 +48,6 @@ if "DISABLE_POSTMORTEM_STACKDUMP" in env["CPPFLAGS"]: # 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) -# patch lwip1 sources conditionally: -# https://github.com/xoseperez/espurna/issues/1610 -lwip_inject_patcher(env) - # when using git, add -DAPP_REVISION=(git-commit-hash) app_inject_revision(projenv)