mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-31 13:00:49 +00:00
Add TLS and health backtrace to esp32
This commit is contained in:
1 parent
c957f29f23
commit
2f2a5f2f02
8 files changed
+167
-263
No files matched your search
+4
-53
@@ -22,10 +22,8 @@
|
||||
#include <esp_system.h>
|
||||
#include <esp_mac.h>
|
||||
#include <esp_idf_version.h>
|
||||
#include <esp_ota_ops.h>
|
||||
#include <esp_task_wdt.h>
|
||||
#include <soc/soc.h>
|
||||
#include <soc/rtc_cntl_reg.h>
|
||||
// #include <esp_memory_utils.h> // For health record coredumps
|
||||
// #include <esp_core_dump.h> // For health record coredumps
|
||||
|
||||
#define MG_PATH_MAX 128
|
||||
|
||||
@@ -33,55 +31,8 @@
|
||||
#define MG_ENABLE_POSIX_FS 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_OTA_ESP32_WDT_TIMEOUT_MS
|
||||
#define MG_OTA_ESP32_WDT_TIMEOUT_MS 10000U
|
||||
#endif
|
||||
|
||||
static inline void mg_ota_esp32_timer_start(void) {
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
esp_task_wdt_config_t cfg = {0};
|
||||
esp_err_t err;
|
||||
|
||||
cfg.timeout_ms = MG_OTA_ESP32_WDT_TIMEOUT_MS;
|
||||
cfg.idle_core_mask = 0;
|
||||
cfg.trigger_panic = true;
|
||||
|
||||
err = esp_task_wdt_init(&cfg);
|
||||
if (err == ESP_ERR_INVALID_STATE) esp_task_wdt_reconfigure(&cfg);
|
||||
#else
|
||||
esp_task_wdt_init(MG_OTA_ESP32_WDT_TIMEOUT_MS / 1000U, true);
|
||||
#endif
|
||||
esp_task_wdt_add(NULL);
|
||||
esp_task_wdt_reset();
|
||||
}
|
||||
|
||||
static inline uint32_t mg_ota_esp32_state_set(uint32_t state) {
|
||||
if (state == 0) esp_ota_mark_app_valid_cancel_rollback();
|
||||
REG_WRITE(RTC_CNTL_STORE0_REG, state);
|
||||
return REG_READ(RTC_CNTL_STORE0_REG);
|
||||
}
|
||||
|
||||
#define MG_OTA_STATE_GET() \
|
||||
REG_READ(RTC_CNTL_STORE0_REG)
|
||||
|
||||
#define MG_OTA_STATE_SET(v) mg_ota_esp32_state_set((uint32_t) (v))
|
||||
|
||||
#ifndef MG_OTA_ROLLBACK_TIMER_START
|
||||
#define MG_OTA_ROLLBACK_TIMER_START() mg_ota_esp32_timer_start()
|
||||
#endif
|
||||
|
||||
#ifndef MG_OTA_ROLLBACK_TIMER_FEED
|
||||
#define MG_OTA_ROLLBACK_TIMER_FEED() \
|
||||
do { \
|
||||
(void) esp_task_wdt_reset(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef MG_OTA_ROLLBACK
|
||||
#define MG_OTA_ROLLBACK() \
|
||||
do { \
|
||||
(void) esp_ota_mark_app_invalid_rollback_and_reboot(); \
|
||||
} while (0)
|
||||
#ifndef MG_HEALTH_DATA_SIZE
|
||||
#define MG_HEALTH_DATA_SIZE 20
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user