EasyManua.ls Logo

Espressif ESP32-S2 - Page 1025

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
App version
Application version is stored in esp_app_desc_t structure. It is located in DROM sector and has a fixed
offset from the beginning of the binary file. The structure is located after esp_image_header_t and
esp_image_segment_header_t structures. The field version has string type and max length 32 chars.
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 "0.1.0.1") before including project.
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 option is set, the value of CONFIG_APP_PROJECT_VER will
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 le (if present) else using git command git describe. If
neither is available then PROJECT_VER will be set to 1. Application can make use of this by calling
esp_ota_get_app_description() or esp_ota_get_partition_description() functions.
API Reference
Header File
components/esp_system/include/esp_system.h
Functions
esp_err_t esp_register_shutdown_handler(shutdown_handler_t handle)
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 handle)
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 hasnt 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 1014
Submit Document Feedback
Release v4.4

Table of Contents