Browse Source

special dummy printf to disable Serial using some boards

pull/1664/head
Max Prokhorov 5 years ago
parent
commit
f2ad37152b
2 changed files with 29 additions and 2 deletions
  1. +5
    -0
      code/espurna/config/prototypes.h
  2. +24
    -2
      code/extra_scripts.py

+ 5
- 0
code/espurna/config/prototypes.h View File

@ -57,6 +57,11 @@ extern "C" {
#endif
}
// special dummy printf to disable Serial using some boards
int dummy_ets_printf(const char* format, ...) {
return 0;
}
// -----------------------------------------------------------------------------
// Domoticz
// -----------------------------------------------------------------------------


+ 24
- 2
code/extra_scripts.py View File

@ -59,12 +59,12 @@ def remove_float_support():
LINKFLAGS = newflags
)
def cpp_check(source, target, env):
def cpp_check(target, source, env):
print("Started cppcheck...\n")
call(["cppcheck", os.getcwd()+"/espurna", "--force", "--enable=all"])
print("Finished cppcheck...\n")
def check_size(source, target, env):
def check_size(target, source, env):
(binary,) = target
path = binary.get_abspath()
size = os.stat(path).st_size
@ -78,6 +78,21 @@ def check_size(source, target, env):
print_warning("https://github.com/xoseperez/espurna/wiki/TwoStepUpdates", color=Color.LIGHT_CYAN)
print_filler("*", color=Color.LIGHT_YELLOW, err=True)
def dummy_ets_printf(target, source, env):
(postmortem_src_file, ) = source
(postmortem_obj_file, ) = target
cmd = ["xtensa-lx106-elf-objcopy"]
# recent Core switched to cpp+newlib & ets_printf_P
if postmortem_src_file.get_abspath().endswith(".cpp"):
cmd.extend(["--redefine-sym", "ets_printf_P=dummy_ets_printf"])
else:
cmd.extend(["--redefine-sym", "ets_printf=dummy_ets_printf"])
cmd.append(postmortem_obj_file.get_abspath())
env.VerboseAction(cmd, "Running $TARGET")
# ------------------------------------------------------------------------------
# Hooks
# ------------------------------------------------------------------------------
@ -85,6 +100,13 @@ def check_size(source, target, env):
# Always show warnings for project code
projenv.ProcessUnFlags("-w")
# 2.4.0 and up
remove_float_support()
# two-step update hint when using 1MB boards
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_size)
# disable postmortem printing to the uart. another one is in eboot, but this is what causes the most harm
if "DISABLE_POSTMORTEM_STACKDUMP" if 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)

Loading…
Cancel
Save