Browse Source

Merge remote-tracking branch 'origin/dev' into rfb/refactoring

mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
e19c16e222
8 changed files with 34 additions and 118 deletions
  1. +0
    -2
      .travis.yml
  2. +1
    -1
      code/espurna/libs/BasePin.h
  3. +9
    -2
      code/espurna/telnet.cpp
  4. +3
    -5
      code/ota.py
  5. +21
    -42
      code/platformio.ini
  6. +0
    -2
      code/scripts/espurna_utils/__init__.py
  7. +0
    -56
      code/scripts/espurna_utils/lwip.py
  8. +0
    -8
      code/scripts/pio_main.py

+ 0
- 2
.travis.yml View File

@ -5,7 +5,6 @@ python:
cache: cache:
directories: directories:
- ~/.npm - ~/.npm
- ~/.platformio
env: env:
global: global:
- BUILDER_TOTAL_THREADS=4 - BUILDER_TOTAL_THREADS=4
@ -48,7 +47,6 @@ deploy:
LMCdaQnCxSQ5EuKhqcFR6VTfDCWc06jwD4fdHfkmBaeWBMMzdoZEqN26AwdTnoLLlQJTR9l21NypgGybssBr69Md/ZinMahWCJJ4gVzPe9Adr9ijRbzj/wckirLBVZjRWn8fxTjJgjpu1ten2CgBfNcc/roN3fI6DV/1Fvv1REfihND4EeIermsxIVRXOyluu1vnPV9ZM28XBNch9XfkKwIpLEaHNNtkzlSEua39U34WpZShrxxEVoZhiF/R1ZF+NiAnursPcPsn5hdrXyHFLFT2dVDnlpdIp79c6SGkCZ636//5erB6hgBHshbwuT9TYXxtwLyL7AeN/MfCg0gtZSsDII8mLKzytW1tl7r1W9l7s21z/55tljSz2Z6dcbJC3bxucgcLxM9R6PrsPdDrPQTd0QwYqYalMNlfuA8KGcesZueqI9Q4uw7uHFUwIp7FIaoKhwhjTKe/ZHZ75zU4wdBTXof4dnSQOudoGGjRyyj7V0eR/Mhuni45N2Bldy9hDaldgtWMuEdx3ABW1IrPXtPDVTXM6QjUHm0nj5zzCgoCvQEw3jycA7Wlgbzo8MQkKH3u4MtupJcEGHJAqMbk+JlRpIfdWTiqtI697CReRGYSWT6YxF68TeJo77JPPph724BIBMtKtIk2+4RkHxz5RqM8O2vt+AFNjnWNIvVQtY8= LMCdaQnCxSQ5EuKhqcFR6VTfDCWc06jwD4fdHfkmBaeWBMMzdoZEqN26AwdTnoLLlQJTR9l21NypgGybssBr69Md/ZinMahWCJJ4gVzPe9Adr9ijRbzj/wckirLBVZjRWn8fxTjJgjpu1ten2CgBfNcc/roN3fI6DV/1Fvv1REfihND4EeIermsxIVRXOyluu1vnPV9ZM28XBNch9XfkKwIpLEaHNNtkzlSEua39U34WpZShrxxEVoZhiF/R1ZF+NiAnursPcPsn5hdrXyHFLFT2dVDnlpdIp79c6SGkCZ636//5erB6hgBHshbwuT9TYXxtwLyL7AeN/MfCg0gtZSsDII8mLKzytW1tl7r1W9l7s21z/55tljSz2Z6dcbJC3bxucgcLxM9R6PrsPdDrPQTd0QwYqYalMNlfuA8KGcesZueqI9Q4uw7uHFUwIp7FIaoKhwhjTKe/ZHZ75zU4wdBTXof4dnSQOudoGGjRyyj7V0eR/Mhuni45N2Bldy9hDaldgtWMuEdx3ABW1IrPXtPDVTXM6QjUHm0nj5zzCgoCvQEw3jycA7Wlgbzo8MQkKH3u4MtupJcEGHJAqMbk+JlRpIfdWTiqtI697CReRGYSWT6YxF68TeJo77JPPph724BIBMtKtIk2+4RkHxz5RqM8O2vt+AFNjnWNIvVQtY8=
file_glob: true file_glob: true
file: firmware/espurna-*.bin file: firmware/espurna-*.bin
skip_cleanup: true
on: on:
tags: true tags: true
repo: xoseperez/espurna repo: xoseperez/espurna


+ 1
- 1
code/espurna/libs/BasePin.h View File

@ -9,7 +9,7 @@ Copyright (C) 2020 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include "config/types.h"
#include "../config/types.h"
// base interface for generic pin handler. // base interface for generic pin handler.
struct BasePin { struct BasePin {


+ 9
- 2
code/espurna/telnet.cpp View File

@ -31,7 +31,13 @@ Updated to use WiFiServer and support reverse connections by Niek van der Maas <
struct AsyncBufferedClient { struct AsyncBufferedClient {
public: 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<uint8_t>; using buffer_t = std::vector<uint8_t>;
explicit AsyncBufferedClient(AsyncClient* client); explicit AsyncBufferedClient(AsyncClient* client);
@ -221,8 +227,9 @@ void AsyncBufferedClient::_addBuffer() {
size_t AsyncBufferedClient::write(const char* data, size_t size) { 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; size_t written = 0;
if (_buffers.empty()) { if (_buffers.empty()) {
written = _client->add(data, size); written = _client->add(data, size);


+ 3
- 5
code/ota.py View File

@ -328,8 +328,8 @@ def parse_commandline_args():
"-a", "-a",
"--arduino-core", "--arduino-core",
help="Arduino ESP8266 Core version", 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("-o", "--flags", help="extra flags", default="")
parser.add_argument("-p", "--password", help="auth password", default="") parser.add_argument("-p", "--password", help="auth password", default="")
@ -402,15 +402,13 @@ def discover_devices(args):
@functools.lru_cache(maxsize=None) @functools.lru_cache(maxsize=None)
def get_platformio_env(arduino_core, size): def get_platformio_env(arduino_core, size):
# todo: eventually 2_3_0 is dropped
# todo: naming
prefix = "esp8266" prefix = "esp8266"
if not size in [1, 2, 4]: if not size in [1, 2, 4]:
raise ValueError( raise ValueError(
"Board memory size can only be one of: 1 for 1M, 2 for 2M, 4 for 4M" "Board memory size can only be one of: 1 for 1M, 2 for 2M, 4 for 4M"
) )
core = "" core = ""
if arduino_core != "2_3_0":
if arduino_core != "current":
core = "-{}".format(arduino_core) core = "-{}".format(arduino_core)
return "{prefix}-{size:d}m{core}-base".format(prefix=prefix, core=core, size=size) return "{prefix}-{size:d}m{core}-base".format(prefix=prefix, core=core, size=size)


+ 21
- 42
code/platformio.ini View File

@ -20,22 +20,28 @@ extra_configs =
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# PLATFORM: # PLATFORM:
# !! DO NOT confuse platformio's ESP8266 development platform with Arduino core for ESP8266 # !! 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: # FLASH SIZE:
@ -123,11 +129,6 @@ git_platform_packages =
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git
toolchain-xtensa @ ~2.100100.200706 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 = lib_deps =
https://github.com/me-no-dev/ESPAsyncTCP.git#7e9ed22 https://github.com/me-no-dev/ESPAsyncTCP.git#7e9ed22
ArduinoJson@5.13.4 ArduinoJson@5.13.4
@ -161,7 +162,7 @@ lib_deps =
# COMMON ENVIRONMENT SETTINGS: # COMMON ENVIRONMENT SETTINGS:
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[env] [env]
platform = ${common.platform_2_3_0}
platform = ${common.platform}
framework = arduino framework = arduino
board_build.flash_mode = dout board_build.flash_mode = dout
build_flags = ${common.build_flags} build_flags = ${common.build_flags}
@ -181,8 +182,6 @@ lib_deps =
lib_ignore = lib_ignore =
AsyncTCP AsyncTCP
Brzo I2C Brzo I2C
Time
NtpClientLib
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Base enrivonments, -DMANUFACTURER=..., -DDEVICE=... must be set: # Base enrivonments, -DMANUFACTURER=..., -DDEVICE=... must be set:
@ -194,38 +193,18 @@ lib_ignore =
[env:esp8266-512k-base] [env:esp8266-512k-base]
board = ${common.board_512k} board = ${common.board_512k}
board_build.ldscript = ${common.ldscript_512k} board_build.ldscript = ${common.ldscript_512k}
lib_deps =
${common.legacy_lib_deps}
${common.lib_deps}
lib_ignore =
AsyncTCP
[env:esp8266-1m-base] [env:esp8266-1m-base]
board = ${common.board_1m} board = ${common.board_1m}
board_build.ldscript = ${common.ldscript_1m} board_build.ldscript = ${common.ldscript_1m}
lib_deps =
${common.legacy_lib_deps}
${common.lib_deps}
lib_ignore =
AsyncTCP
[env:esp8266-2m-base] [env:esp8266-2m-base]
board = ${common.board_2m} board = ${common.board_2m}
board_build.ldscript = ${common.ldscript_2m} board_build.ldscript = ${common.ldscript_2m}
lib_deps =
${common.legacy_lib_deps}
${common.lib_deps}
lib_ignore =
AsyncTCP
[env:esp8266-4m-base] [env:esp8266-4m-base]
board = ${common.board_4m} board = ${common.board_4m}
board_build.ldscript = ${common.ldscript_4m} board_build.ldscript = ${common.ldscript_4m}
lib_deps =
${common.legacy_lib_deps}
${common.lib_deps}
lib_ignore =
AsyncTCP
[env:esp8266-1m-latest-base] [env:esp8266-1m-latest-base]
platform = ${common.platform_latest} platform = ${common.platform_latest}


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

@ -23,7 +23,6 @@ from .checks import check_cppcheck, check_printsize
from .float_support import remove_float_support from .float_support import remove_float_support
from .ldscripts import ldscripts_inject_libpath from .ldscripts import ldscripts_inject_libpath
from .libalgobsec import libalgobsec_inject_patcher from .libalgobsec import libalgobsec_inject_patcher
from .lwip import lwip_inject_patcher
from .postmortem import dummy_ets_printf from .postmortem import dummy_ets_printf
from .git import app_inject_revision from .git import app_inject_revision
from .release import copy_release from .release import copy_release
@ -35,7 +34,6 @@ __all__ = [
"remove_float_support", "remove_float_support",
"ldscripts_inject_libpath", "ldscripts_inject_libpath",
"libalgobsec_inject_patcher", "libalgobsec_inject_patcher",
"lwip_inject_patcher",
"dummy_ets_printf", "dummy_ets_printf",
"app_inject_revision", "app_inject_revision",
"app_inject_flags", "app_inject_flags",


+ 0
- 56
code/scripts/espurna_utils/lwip.py View File

@ -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)

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

@ -14,7 +14,6 @@ from espurna_utils import (
remove_float_support, remove_float_support,
ldscripts_inject_libpath, ldscripts_inject_libpath,
libalgobsec_inject_patcher, libalgobsec_inject_patcher,
lwip_inject_patcher,
app_inject_revision, app_inject_revision,
dummy_ets_printf, dummy_ets_printf,
app_inject_flags, 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 # 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"]: if "DISABLE_POSTMORTEM_STACKDUMP" in env["CPPFLAGS"]:
env.AddPostAction(
"$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.c.o", dummy_ets_printf
)
env.AddPostAction( env.AddPostAction(
"$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.cpp.o", dummy_ets_printf "$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 # 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) 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) # when using git, add -DAPP_REVISION=(git-commit-hash)
app_inject_revision(projenv) app_inject_revision(projenv)


Loading…
Cancel
Save