@klimbot:
Here my test sources. In mos.yml you can see the four blocks I have tested with comments.
(I tested it on a Olimex ESP-PoE hardware with a led at GPIO2)
@scaprile:
Unfortunately, your two lines do not help, the coredump is written anyway. I hoped so, too!
But as far as I have seen, the coredump is written by the ESP32 only, and not by the ESP8266. On the ESP32-System, I can take another Uart for the listening device, so it is no problem!
Thanks a lot for your inputs!
Rolf
mos.yml:
author: Rolf
description: FreeRTOS Watchdog Tests
version: 1.0
#platform: esp8266
platform: esp32
cxxflags:
#- "-DPLATFORM_ESP8266="
- "-DPLATFORM_ESP32="
sources:
- src
#######################################################################################
## Tests for suppress core dumps:
## Test 1: Not compilable: "undefined reference to 'mgos_freertos_extract_regs' ..." ???
#build_vars:
# ESP_IDF_SDKCONFIG_OPTS: >
# ${build_vars.ESP_IDF_SDKCONFIG_OPTS}
# CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y
## Test 2: Compilable but no effect, coredump is sent anyway:
#build_vars:
# ESP_IDF_SDKCONFIG_OPTS: >
# ${build_vars.ESP_IDF_SDKCONFIG_OPTS}
# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART=
# CONFIG_ESP32_ENABLE_COREDUMP=n
## Test 3: Compilable but no effect, coredump is sent anyway:
#build_vars:
# ESP_IDF_SDKCONFIG_OPTS: >
# ${build_vars.ESP_IDF_SDKCONFIG_OPTS}
# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART=1
# CONFIG_ESP32_ENABLE_COREDUMP=n
## Test 4: Compilable but no effect, coredump is sent anyway:
#build_vars:
# ESP_IDF_SDKCONFIG_OPTS: >
# ${build_vars.ESP_IDF_SDKCONFIG_OPTS}
# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART=n
# CONFIG_ESP32_ENABLE_COREDUMP=n
#######################################################################################
config_schema:
- ["debug.stdout_uart", -1]
- ["debug.stderr_uart", -1]
#- ["sys.wdt_timeout", "i", 10, {title: "Watchdog timeout seconds (default value = 30 (?))"}]
manifest_version: 2017-05-18
libs_version: ${mos_version}
modules_version: ${mos_version}
mongoose_os_version: ${mos_version}
main.cpp:
#include "mgos.h"
#if defined(PLATFORM_ESP32)
#include "FreeRTOS.h"
#endif
// ESP32-Olimex-PoE with led on Gpio2:
#if defined(PLATFORM_ESP32)
#define LED_PIN 2
#endif
// ESP8266-NodeMcuV2 with led on Gpio16:
#if defined(PLATFORM_ESP8266)
#define LED_PIN 16
#endif
#define WDT_CHECK_TIME_ms 1000
//---------------------------------------------------------
static void wdtFunction(void* pArg)
//---------------------------------------------------------
{
#if defined(PLATFORM_ESP32)
mgos_wdt_set_timeout(10); // Optional! (Overwrites the 'sys.wdt_timeout' in the yml-file, which has a default of 30 sec)
mgos_wdt_enable(); // Mandatory!
//mgos_wdt_feed(); // Optional: No 'first feed' is necessary!
TickType_t xLastWakeTime = xTaskGetTickCount();
static int counter = 0;
for(;;) {
// Feed the watchdog for the first x loops (10 sec in this case!), stop afterwards to let watchdog bite:
if ((counter++) < 10) {
mgos_wdt_feed();
}
// Delay:
vTaskDelayUntil(&xLastWakeTime, WDT_CHECK_TIME_ms / portTICK_PERIOD_MS);
}
#endif
#if defined(PLATFORM_ESP8266)
static int counter = 0;
// After the first x loops, stop the system (10 sec in this case!), to let watchdog bite:
if ((counter++) > 10) {
for (;;) {
}
}
#endif
}
//---------------------------------------------------------
void ledTimer_cb(void* arg)
//---------------------------------------------------------
{
// Blink led:
static bool bState = true;
bState = !bState;
mgos_gpio_write(LED_PIN, bState);
}
//---------------------------------------------------------
enum mgos_app_init_result mgos_app_init(void)
//---------------------------------------------------------
{
#if defined(PLATFORM_ESP32)
// Create extra watchdog task:
xTaskCreate(wdtFunction, "WDT_TASK", 500, NULL, 1, NULL );
#endif
#if defined(PLATFORM_ESP8266)
// Start timer for watchdog:
mgos_set_timer(WDT_CHECK_TIME_ms, MGOS_TIMER_REPEAT, wdtFunction, NULL);
#endif
// Set led pin to output:
mgos_gpio_set_mode(LED_PIN, MGOS_GPIO_MODE_OUTPUT);
// Start timer to blink led:
mgos_set_timer(100, MGOS_TIMER_REPEAT, ledTimer_cb, NULL);
// Return success:
return MGOS_APP_INIT_SUCCESS;
}