Chapter 2. API Reference
App version
Application version is stored in
offset from the beginning of the binary file.
esp_image_segment_header_t
To set version in your project manually you need to set PROJECT_VER variable in your project CMake-
Lists.txt/Makefile:
• In application CMakeLists.txt put set(PROJECT_VER
cmake.
(For legacy GNU Make build system: in application Makefile put PROJECT_VER = "0.1.0.1" before including
project.mk.)
If
CONFIG_APP_PROJECT_VER_FROM_CONFIG
be used. Otherwise if PROJECT_VER variable is not set in the project then it will be retrieved from ei-
ther $(PROJECT_PATH)/version.txt file (if present) else using git command git
neither is available then PROJECT_VER will be set to "1". Application can make use of this by calling
esp_ota_get_app_description()
API Reference
Header File
•
components/esp_system/include/esp_system.h
Functions
esp_err_t esp_register_shutdown_handler(shutdown_handler_t
Register shutdown handler.
This function allows you to register a handler that gets invoked before the application is restarted using
esp_restart function.
Return
• ESP_OK on success
• ESP_ERR_INVALID_STATE if the handler has already been registered
• ESP_ERR_NO_MEM if no more shutdown handler slots are available
Parameters
• handle: function to execute on restart
esp_err_t esp_unregister_shutdown_handler(shutdown_handler_t
Unregister shutdown handler.
This function allows you to unregister a handler which was previously registered using
esp_register_shutdown_handler function.
• ESP_OK on success
• ESP_ERR_INVALID_STATE if the given handler hasn't been registered before
void esp_restart(void)
Restart PRO and APP CPUs.
This function can be called both from PRO and APP CPUs. After successful restart, CPU reset reason will be
SW_CPU_RESET. Peripherals (except for WiFi, BT, UART0, SPI1, and legacy timers) are not reset. This
function does not return.
esp_reset_reason_t
esp_reset_reason(void)
Get reason of last reset.
Return See description of esp_reset_reason_t for explanation of each value.
uint32_t esp_get_free_heap_size(void)
Get the size of available heap.
Espressif Systems
esp_app_desc_t
structure. It is located in DROM sector and has a fixed
The structure is located after
structures. The field version has string type and max length 32 chars.
option is set, the value of
or
esp_ota_get_partition_description()
1014
Submit Document Feedback
esp_image_header_t
"0.1.0.1") before including project.
CONFIG_APP_PROJECT_VER
handle)
handle)
and
will
describe. If
functions.
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers