|
|
@ -92,6 +92,36 @@ def dummy_ets_printf(target, source, env): |
|
|
|
env.Execute(env.VerboseAction(" ".join(cmd), "Removing ets_printf / ets_printf_P")) |
|
|
|
env.Depends(postmortem_obj_file,"$BUILD_DIR/src/dummy_ets_printf.c.o") |
|
|
|
|
|
|
|
def patch_lwip(): |
|
|
|
# ignore when building with lwip2 |
|
|
|
if "lwip_gcc" not in env["LIBS"]: |
|
|
|
return |
|
|
|
|
|
|
|
framework_dir = env["FRAMEWORK_ARDUINOESP8266_DIR"] |
|
|
|
|
|
|
|
platform = env.PioPlatform() |
|
|
|
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) |
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
|
|
|
# Hooks |
|
|
|
# ------------------------------------------------------------------------------ |
|
|
@ -109,3 +139,7 @@ env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_size) |
|
|
|
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) |
|
|
|
|
|
|
|
# patch lwip1 sources conditionally: |
|
|
|
# https://github.com/xoseperez/espurna/issues/1610 |
|
|
|
patch_lwip() |