diff --git a/pio-tools/strip-floats.py b/pio-tools/strip-floats.py index da916ebe2..dfb8916dc 100644 --- a/pio-tools/strip-floats.py +++ b/pio-tools/strip-floats.py @@ -1,5 +1,7 @@ Import('env') +build_flags = " ".join(env.GetProjectOption("build_flags")) + # # Dump build environment (for debug) #print env.Dump() @@ -8,6 +10,10 @@ Import('env') flags = " ".join(env['LINKFLAGS']) flags = flags.replace("-u _printf_float", "") flags = flags.replace("-u _scanf_float", "") +if "FIRMWARE_SAFEBOOT" in build_flags: + # Crash Recorder is not included in safeboot firmware -> remove Linker wrap + flags = flags.replace("-Wl,--wrap=panicHandler", "") + flags = flags.replace("-Wl,--wrap=xt_unhandled_exception", "") newflags = flags.split() env.Replace( diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index aaa40a3da..9616c885d 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -812,7 +812,9 @@ void CmndStatus(void) if (payload > MAX_STATUS) { return; } // {"Command":"Error"} if (!Settings->flag.mqtt_enabled && (6 == payload)) { return; } // SetOption3 - Enable MQTT if (!TasmotaGlobal.energy_driver && (9 == payload)) { return; } + #ifndef FIRMWARE_SAFEBOOT if (!CrashFlag() && (12 == payload)) { return; } + #endif // FIRMWARE_SAFEBOOT if (!Settings->flag3.shutter_mode && (13 == payload)) { return; } char stemp[200]; @@ -1042,6 +1044,7 @@ void CmndStatus(void) CmndStatusResponse(11); } +#ifndef FIRMWARE_SAFEBOOT if (CrashFlag()) { if ((0 == payload) || (12 == payload)) { Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS12_STATUS "\":")); @@ -1050,6 +1053,7 @@ void CmndStatus(void) CmndStatusResponse(12); } } +#endif // FIRMWARE_SAFEBOOT #ifdef USE_SHUTTER if ((0 == payload) || (13 == payload)) { @@ -1252,6 +1256,7 @@ void CmndRestart(void) TasmotaGlobal.restart_deepsleep = true; ResponseCmndChar(PSTR("Go to sleep")); break; +#ifndef FIRMWARE_SAFEBOOT case -1: CmndCrash(); // force a crash break; @@ -1261,6 +1266,7 @@ void CmndRestart(void) case -3: CmndBlockedLoop(); break; +#endif // FIRMWARE_SAFEBOOT case 99: AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING)); EspRestart(); diff --git a/tasmota/tasmota_support/support_crash_recorder.ino b/tasmota/tasmota_support/support_crash_recorder.ino index 4814c0552..9e41f938f 100644 --- a/tasmota/tasmota_support/support_crash_recorder.ino +++ b/tasmota/tasmota_support/support_crash_recorder.ino @@ -17,6 +17,8 @@ along with this program. If not, see . */ +#ifndef FIRMWARE_SAFEBOOT + // Generate a crash to test the crash recorder void CmndCrash(void) { @@ -359,5 +361,7 @@ void CrashDump(void) { } -#endif -#endif \ No newline at end of file +#endif +#endif + +#endif // FIRMWARE_SAFEBOOT \ No newline at end of file diff --git a/tasmota/tasmota_support/support_wifi.ino b/tasmota/tasmota_support/support_wifi.ino index cffc51a85..f0f0c6e42 100644 --- a/tasmota/tasmota_support/support_wifi.ino +++ b/tasmota/tasmota_support/support_wifi.ino @@ -1159,7 +1159,9 @@ void WifiDisable(void) { void EspRestart(void) { ResetPwm(); WifiShutdown(true); +#ifndef FIRMWARE_SAFEBOOT CrashDumpClear(); // Clear the stack dump in RTC +#endif // FIRMWARE_SAFEBOOT #ifdef CONFIG_IDF_TARGET_ESP32C3 GpioForceHoldRelay(); // Retain the state when the chip or system is reset, for example, when watchdog time-out or Deep-sleep diff --git a/tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino b/tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino index 542cb86b3..681be4104 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino @@ -1018,9 +1018,12 @@ void MqttConnected(void) { } #endif // USE_WEBSERVER Response_P(PSTR("{\"Info3\":{\"" D_JSON_RESTARTREASON "\":")); +#ifndef FIRMWARE_SAFEBOOT if (CrashFlag()) { CrashDump(); - } else { + } else +#endif // FIRMWARE_SAFEBOOT + { ResponseAppend_P(PSTR("\"%s\""), GetResetReason().c_str()); } ResponseAppend_P(PSTR(",\"" D_JSON_BOOTCOUNT "\":%d}}"), Settings->bootcount +1);