Chapter 4. API Guides
–core-format {b64,elf,raw}, -t {b64,elf,raw} File specified with“-c”is an ELF (“elf”), raw
(raw) or base64-encoded (b64) binary
--off OFF, -o OFF Offset of coredump partition in flash (type “make parti-
tion_table”to see).
--save-core SAVE_CORE, -s SAVE_CORE Save core to file. Otherwise tem-
porary core file will be deleted. Does not work with “-c”
--rom-elf ROM_ELF, -r ROM_ELF Path to ROM ELF file. Will use “<tar-
get>_rom.elf”if not specified
--print-mem, -m Print memory dump. Only valid when info_corefile.
<prog> Path to program ELF file.
4.10 Event Handling
Several ESP-IDF components use events to inform application about state changes, such as connection or disconnec-
tion. This document gives an overview of these event mechanisms.
4.10.1 Wi-Fi, Ethernet, and IP Events
Before the introduction of esp_event library, events from Wi-Fi driver, Ethernet driver, and TCP/IP stack were
dispatched using the so-called legacy event loop. The following sections explain each of the methods.
esp_event Library Event Loop
esp_event library is designed to supersede the legacy event loop for the purposes of event handling in ESP-IDF. In
the legacy event loop, all possible event types and event data structures had to be defined in system_event_id_t
enumeration and system_event_info_t union, which made it impossible to send custom events to the event
loop, and use the event loop for other kinds of events (e.g. Mesh). Legacy event loop also supported only one event
handler function, therefore application components could not handle some of Wi-Fi or IP events themselves, and
required application to forward these events from its event handler function.
See esp_event library API reference for general information on using this library. Wi-Fi, Ethernet, and IP events are
sent to the default event loop provided by this library.
Legacy Event Loop
This event loop implementation is started using esp_event_loop_init() function. Application typically sup-
plies an event handler, a function with the following signature:
esp_err_t event_handler(void *ctx, system_event_t *event)
{
}
Both the pointer to event handler function, and an arbitrary context pointer are passed to
esp_event_loop_init().
When Wi-Fi, Ethernet, or IP stack generate an event, this event is sent to a high-priority event task via
a queue. Application-provided event handler function is called in the context of this task. Event task stack
size and event queue size can be adjusted using CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE and CON-
FIG_ESP_SYSTEM_EVENT_QUEUE_SIZE options, respectively.
Event handler receives a pointer to the event structure (system_event_t) which describes current event. This
structure follows a tagged union pattern: event_id member indicates the type of event, and event_info member
is a union of description structures. Application event handler will typically use switch(event->event_id)
to handle different kinds of events.
Espressif Systems 1330
Submit Document Feedback
Release v4.4