data
stringlengths
512
2.99k
leak_some_memory at /path/to/idf/examples/get-started/blink/main/./blink.c:29 0x400d27c1: blink_task at /path/to/idf/examples/get-started/blink/main/./blink.c:52 40 bytes 'leaked' in trace (2 allocations) total allocations 2 total frees 0 Note The above example output uses IDF Monitor to automatically decode PC address...
Tracingand enable CONFIG_APPTRACE_SV_ENABLE. Call the function heap_trace_init_tohost()early in the program, to initialize the JTAG heap tracing module. Call the function heap_trace_start()to begin recording all memory allocation and free calls in the system. Call this immediately before the piece of code which you...
The following code snippet demonstrates how application code would typically initialize, start, and stop host-based mode heap tracing: #include "esp_heap_trace.h" ... void app_main() { ... ESP_ERROR_CHECK( heap_trace_init_tohost() ); ... } void some_function() { ESP_ERROR_CHECK( heap_trace_start(HEAP_TRACE_LEAKS) ); do...
In order to use this feature, you need OpenOCD version v0.10.0-esp32-20181105 or later. You can use GDB to start and/or stop tracing automatically. To do this you need to prepare a special gdbinitfile: target remote :3333 mon reset halt maintenance flush register-cache tb heap_trace_start commands mon esp sysview sta...
Freed bytes @ 0x3ffb50bc from task "main" on core 0 by: /home/user/projects/esp/esp-idf/components/freertos/tasks.c:4590 /home/user/projects/esp/esp-idf/components/freertos/tasks.c:4590 [0.102436025] HEAP: Allocated 2 bytes @ 0x3ffaffe0 from task "alloc" on core 0 by: /home/user/projects/esp/esp-idf/examples/system/sy...
Freed bytes @ 0x3ffaffe8 from task "free" on core 0 by: /home/user/projects/esp/esp-idf/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c:31 (discriminator 9) /home/user/projects/esp/esp-idf/components/freertos/port.c:355 (discriminator 1) [0.202436200] HEAP: Allocated 3 bytes @ 0x3ffaffe8 from task "al...
HEAP: Allocated 4 bytes @ 0x3ffafff0 from task "alloc" on core 0 by: /home/user/projects/esp/esp-idf/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c:47 /home/user/projects/esp/esp-idf/components/freertos/port.c:355 (discriminator 1) [0.302451475] HEAP: Allocated 8 bytes @ 0x3ffb40b8 from task "alloc" ...
Processed 1019 events =============== HEAP TRACE REPORT =============== Processed 14 heap events. [0.002244575] HEAP: Allocated 1 bytes @ 0x3ffaffd8 from task "alloc" on core 0 by: /home/user/projects/esp/esp-idf/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c:47 /home/user/projects/esp/esp-idf/compon...
This function must be called before any other heap tracing functions. To disable heap tracing and allow the buffer to be freed, stop tracing and then call heap_trace_init_standalone(NULL, 0); - Parameters record_buffer -- Provide a buffer to use for heap trace data. Note: External RAM is allowed, but it prevents reco...
A non-zero-length buffer has not been set via heap_trace_init_standalone(). ESP_OK Tracing is started. - - esp_err_t heap_trace_stop(void) Stop heap tracing. - Returns ESP_ERR_NOT_SUPPORTED Project was compiled without heap tracing enabled in menuconfig. ESP_ERR_INVALID_STATE Heap tracing was not in progress. E...
[out] Record where the heap trace record will be copied. - - Returns ESP_ERR_NOT_SUPPORTED Project was compiled without heap tracing enabled in menuconfig. ESP_ERR_INVALID_STATE Heap tracing was not initialised. ESP_ERR_INVALID_ARG Index is out of bounds for current heap trace record count. ESP_OK Record returned ...
LSB (bit value 1) is the CPU number (0 or 1). - void *address Address which was allocated. If NULL, then this record is empty. - size_t size Size of the allocation. - void *alloced_by[CONFIG_HEAP_TRACING_STACK_DEPTH] Call stack of the caller which allocated the memory. - void *freed_by[CONFIG_HEAP_TRACING_STACK_DEPTH] ...
Although FreeRTOS provides software timers, FreeRTOS software timers have a few limitations: Maximum resolution is equal to the RTOS tick period Timer callbacks are dispatched from a low-priority timer service (i.e., daemon) task. This task can be preempted by other tasks, leading to decreased precision and accuracy. ...
Timer callbacks are dispatched directly from the timer interrupt handler. This method is useful for some simple callbacks which aim for lower latency. Creating and starting a timer, and dispatching the callback takes some time. Therefore, there is a lower limit to the timeout value of one-shot esp_timer. If esp_timer...
[out] Output, pointer to esp_timer_handle_t variable which will hold the created timer handle. - - Returns ESP_OK on success ESP_ERR_INVALID_ARG if some of the create_args are not valid ESP_ERR_INVALID_STATE if esp_timer library is not initialized yet ESP_ERR_NO_MEM if memory allocation fails - - esp_err_t esp_timer_st...
Internal and Unstable APIs This section is listing some APIs that are internal or likely to be changed or removed in the next releases of ESP-IDF. API Reference Header File This header file can be included with: #include "esp_rom_sys.h" Functions - void esp_rom_software_reset_system(void) Software Reset digital core ...
On targets that use CLIC as their interrupt controller, this number represents the external interrupt number. For example, passing cpu_intr_num = ito this function would in fact bind peripheral source to CPU interrupt CLIC_EXT_INTR_NUM_OFFSET + i. - - - uint32_t esp_rom_get_cpu_ticks_per_us(void) Get the real CPU ticks...
Note IPC stands for an "Inter-Processor Call" and NOT "Inter-Process Communication" as found on other operating systems. Overview Due to the dual core nature of the ESP32, there are some scenarios where a certain callback must be executed from a particular core such as: When allocating an ISR to an interrupt source o...
esp_test_ipc_isr_get_cycle_count_other_cpu .type esp_test_ipc_isr_get_cycle_count_other_cpu, @function // Args: // a2 - void* arg esp_test_ipc_isr_get_cycle_count_other_cpu: rsr.ccount a3 s32i a3, a2, 0 ret unit32_t cycle_count; esp_ipc_isr_call_blocking(esp_test_ipc_isr_get_cycle_count_other_cpu, (void *)cycle_count);...
If a IPC ISR call is already in progress, this function will busy-wait until the call completes before pausing the CPU stall feature. - void esp_ipc_isr_stall_abort(void) Abort a CPU stall. This function will abort any stalling routine of the other CPU due to a pervious call to esp_ipc_isr_stall_other_cpu(). This fun...
Interrupt Allocation Overview The ESP32 has two cores, with 32 interrupts each. Each interrupt has a fixed priority, most (but not all) interrupts are connected to the interrupt matrix. Because there are more interrupt sources than interrupts, sometimes it makes sense to share an interrupt in multiple drivers. The es...
Though the framework supports this feature, you have to use it very carefully. There usually exist two ways to stop an interrupt from being triggered: disable the source or mask peripheral interrupt status. ESP-IDF only handles enabling and disabling of the source itself, leaving status and mask bits to be handled by u...
Free: The interrupt is not allocated and can be used by esp_intr_alloc(). - Free (not general-use): The interrupt is not allocated, but is either a high-priority interrupt (priority 4-7) or an edge-triggered interrupt. High-priority interrupts can be allocated using esp_intr_alloc()but requires the handlers to be writt...
Some peripheral driver may default to allocating interrupts with ESP_INTR_FLAG_LEVEL1flag, so priority 2 and 3 interrupts do not get used by default. If esp_intr_dump()shows that some priority 2 or 3 interrupts are available, try changing the interrupt allocation flags when initializing the driver to ESP_INTR_FLAG_LEVE...
Optional argument for passed to the interrupt handler ret_handle -- Pointer to an intr_handle_t to store a handle that can later be used to request details or free the interrupt. Can be NULL if no handle is required. - - Returns ESP_ERR_INVALID_ARG if the combination of arguments is invalid. ESP_ERR_NOT_FOUND No free i...
Optional argument for passed to the interrupt handler ret_handle -- Pointer to an intr_handle_t to store a handle that can later be used to request details or free the interrupt. Can be NULL if no handle is required. - - Returns ESP_ERR_INVALID_ARG if the combination of arguments is invalid. ESP_ERR_NOT_FOUND No free i...
Enable the interrupt associated with the handle. Note For local interrupts (ESP_INTERNAL_* sources), this function has to be called on the CPU the interrupt is allocated on. Other interrupts have no such restriction. - Parameters handle -- The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus - Retur...
Accept a Level 1 interrupt vector (lowest priority) - ESP_INTR_FLAG_LEVEL2 Accept a Level 2 interrupt vector. - ESP_INTR_FLAG_LEVEL3 Accept a Level 3 interrupt vector. - ESP_INTR_FLAG_LEVEL4 Accept a Level 4 interrupt vector. - ESP_INTR_FLAG_LEVEL5 Accept a Level 5 interrupt vector. - ESP_INTR_FLAG_LEVEL6 Accept a Leve...
Logging library Overview The logging library provides three ways for setting log verbosity: At compile time: in menuconfig, set the verbosity level using the option CONFIG_LOG_DEFAULT_LEVEL. Optionally, also in menuconfig, set the maximum verbosity level using the option CONFIG_LOG_MAXIMUM_LEVEL. By default, this is t...
There are the following verbosity levels: Error (lowest) Warning Info Debug Verbose (highest) Note The function esp_log_level_set() cannot set logging levels higher than specified by CONFIG_LOG_MAXIMUM_LEVEL. To increase log level for a specific file above this maximum at compile time, use the macro LOG_LOCAL_LEVEL (s...
Additionally, there are ESP_EARLY_LOGx versions for each of these macros, e.g. ESP_EARLY_LOGE. These versions have to be used explicitly in the early startup code only, before heap allocator and syscalls have been initialized. Normal ESP_LOGx macros can also be used while compiling the bootloader, but they will fall ba...
At file scope, define it before including esp_log.h, e.g.: #define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE #include "esp_log.h" At component scope, define it in the component CMakeLists: target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLOG_LOCAL_LEVEL=ESP_LOG_VERBOSE") To configure logging output per module at runtime, ad...
It adds an additional level check for ESP_LOGx macros before calling esp_log_write(). This allows to set a higher CONFIG_LOG_MAXIMUM_LEVEL, but not inflict a performance hit during normal operation (only when directed). An application may set the master logging level ( esp_log_set_level_master()) globally to enforce a ...
ESP_LOGW("lib_name", "Message for print"); // no print, Master logging level blocks it esp_log_level_set("lib_name", ESP_LOG_INFO); // enable INFO logs from lib_name ESP_LOGI("lib_name", "Message for print"); // no print, Master logging level blocks it esp_log_set_level_master(ESP_LOG_INFO); // enables all INFO logs gl...
If logging for given component has already been enabled, changes previous setting. Note Note that this function can not raise log level above the level set using CONFIG_LOG_MAXIMUM_LEVEL setting in menuconfig. To raise log level above the default one for a given file, define LOG_LOCAL_LEVEL to one of the ESP_LOG_* va...
See also esp_log_write() Macros - ESP_LOG_BUFFER_HEX_LEVEL(tag, buffer, buff_len, level) Log a buffer of hex bytes at specified level, separated into 16 bytes each line. - Parameters tag -- description tag buffer -- Pointer to the buffer array buff_len -- length of buffer in bytes level -- level of the log - - ESP_LOG...
The dump log shows just like the one below: W (195) log_example: 0x3ffb4280 45 53 50 33 32 20 69 73 20 67 72 65 61 74 2c 20 |ESP32 is great, | W (195) log_example: 0x3ffb4290 77 6f 72 6b 69 6e 67 20 61 6c 6f 6e 67 20 77 69 |working along wi| W (205) log_example: 0x3ffb42a0 74 68 20 74 68 65 20 49 44 46 2e 00 |th the ID...
See also printf, ESP_LOGE, ESP_DRAM_LOGEIn the future, we want to become compatible with clang. Hence, we provide two versions of the following macros which are using variadic arguments. The first one is using the GNU extension ##__VA_ARGS__. The second one is using the C++20 feature VA_OPT(,). This allows users to com...
Similar to Usage: ESP_DRAM_LOGE(DRAM_STR("my_tag"), "format", orESP_DRAM_LOGE(TAG, "format", ...)`, where TAG is a char* that points to a str in the DRAM. See also ESP_EARLY_LOGE, the log level cannot be changed per-tag, however esp_log_level_set("*", level) will set the default level which controls these log lines al...
Miscellaneous System APIs Software Reset To perform software reset of the chip, the esp_restart() function is provided. When the function is called, execution of the program stops, both CPUs are reset, the application is loaded by the bootloader and starts execution again. Additionally, the esp_register_shutdown_handl...
| Interface | MAC Address (4 universally administered, default) | MAC Address (2 universally administered) | Wi-Fi Station | base_mac | base_mac | Wi-Fi SoftAP | base_mac, +1 to the last octet | Local MAC (derived from Wi-Fi Station MAC) | Bluetooth | base_mac, +2 to the last octet | base_mac, +1 to the last octet | ...
Custom Interface MAC Sometimes you may need to define custom MAC addresses that are not generated from the base MAC address. To set a custom interface MAC address, use the esp_iface_mac_addr_set() function. This function allows you to overwrite the MAC addresses of interfaces set (or not yet set) by the base MAC addre...
Once custom eFuse MAC address has been obtained (using esp_efuse_mac_get_custom() or esp_read_mac()), you need to set it as the base MAC address. There are two ways to do it: Use an old API: call esp_base_mac_addr_set(). Use a new API: call esp_iface_mac_addr_set()with the ESP_MAC_BASEargument. Local Versus Universal ...
ESP_IDF_VERSION_VAL(4, 0, 0) // enable functionality present in ESP-IDF v4.0 #endif App Version The 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_segmen...
Application can make use of this by calling esp_app_get_description() or esp_ota_get_partition_description() functions. API Reference Header File This header file can be included with: #include "esp_system.h" Functions - esp_err_t esp_register_shutdown_handler(shutdown_handler_t handle) Register shutdown handler. T...
Get reason of last reset. - Returns 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. Note Note that the returned value may be larger than the maximum contiguous block which can be allocated. - Returns Available heap size, in...
local_mac, const uint8_t *universal_mac) Derive local MAC address from universal MAC address. This function copies a universal MAC address and then sets the "locally administered" bit (bit 0x2) in the first octet, creating a locally administered MAC address. If the universal MAC address argument is already a locall...
The structure represents information about the chip. Public Members - esp_chip_model_t model chip model, one of esp_chip_model_t - uint32_t features bit mask of CHIP_FEATURE_x feature flags - uint16_t revision chip revision number (in format MXX; where M - wafer major version, XX - wafer minor version) - uint8_t core...
This function causes the current CPU core to execute its Wait For Interrupt (WFI or equivalent) instruction. After executing this function, the CPU core will stop execution until an interrupt occurs. - int esp_cpu_get_core_id(void) Get the current core's ID. This function will return the ID of the current CPU (i.e.,...
[in] The core's ID intr_num -- [in] Interrupt number intr_desc_ret -- [out] The interrupt's descriptor - - void esp_cpu_intr_set_ivt_addr(const void *ivt_addr) Set the base address of the current CPU's Interrupt Vector Table (IVT) - Parameters ivt_addr -- Interrupt Vector Table's base address - bool esp_cpu_intr_has_ha...
The the argument passed to the handler function - void esp_cpu_intr_enable(uint32_t intr_mask) Enable particular interrupts on the current CPU. - Parameters intr_mask -- Bit mask of the interrupts to enable - void esp_cpu_intr_disable(uint32_t intr_mask) Disable particular interrupts on the current CPU. - Parameters in...
Clear a hardware breakpoint on the current CPU. Note Clears a breakpoint regardless of whether it was previously set - Parameters bp_num -- Hardware breakpoint number [0..SOC_CPU_BREAKPOINTS_NUM - 1] - Returns ESP_OK if breakpoint is cleared. Failure otherwise - esp_err_t esp_cpu_set_watchpoint(int wp_num, const void...
Given the return address, calculate the address of the preceding call instruction This is typically used to answer the question "where was the function called from?". - Parameters return_address -- The value of the return address register. Typically set to the value of __builtin_return_address(0). - Returns Address of ...
This structure includes app version. Return description for running app. - Returns Pointer to esp_app_desc structure. - int esp_app_get_elf_sha256(char *dst, size_t size) Fill the provided buffer with SHA256 of the ELF file, formatted as hexadecimal, null-terminated. If the buffer size is not sufficient to fit the ...
Over The Air Updates (OTA) OTA Process Overview The OTA update mechanism allows a device to update itself based on data received while the normal firmware is running (for example, over Wi-Fi or Bluetooth.) OTA requires configuring the Partition Tables of the device with at least two OTA app slot partitions (i.e., ota_...
Will be selected. | ESP_OTA_IMG_INVALID | Will not be selected. | ESP_OTA_IMG_ABORTED | Will not be selected. | ESP_OTA_IMG_NEW | If CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE option is set it will be selected only once. In bootloader the state immediately changes to | ESP_OTA_IMG_PENDING_VERIFY | If CONFIG_BOOTLOADER_AP...
The bootloader checks for the ESP_OTA_IMG_PENDING_VERIFYstate if it is set, then it will be written to ESP_OTA_IMG_ABORTED. The bootloader selects a new application to boot so that the state is not set as ESP_OTA_IMG_INVALIDor ESP_OTA_IMG_ABORTED. The bootloader checks the selected application for ESP_OTA_IMG_NEWstat...
The bootloader will boot the specified application. To determine if self-tests should be run during startup of an application, call the esp_ota_get_state_partition() function. If result is ESP_OTA_IMG_PENDING_VERIFY then self-testing and subsequent confirmation of operability is required. Where the States Are Set A b...
Then the application should perform diagnostics of the operation and if it is completed successfully, you should call esp_ota_mark_app_valid_cancel_rollback()function to mark the running application with the ESP_OTA_IMG_VALIDstate and update the secure version on chip. Note that if was called esp_ota_mark_app_invalid_r...
bool image_header_was_checked = false; while (1) { int data_read = esp_http_client_read(client, ota_write_data, BUFFSIZE); ... if (data_read > 0) { if (image_header_was_checked == false) { esp_app_desc_t new_app_info; if (data_read > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc...
In application image it is stored in esp_app_descstructure. The number is set CONFIG_BOOTLOADER_APP_SECURE_VERSION. In ESP32 it is stored in efuse EFUSE_BLK3_RDATA4_REG. (when a eFuse bit is programmed to 1, it can never be reverted to 0). The number of bits set in this register is the security_versionfrom app. Secur...
import sys import os idf_path = os.environ["IDF_PATH"] # get value of IDF_PATH from environment otatool_dir = os.path.join(idf_path, "components", "app_update") # otatool.py lives in $IDF_PATH/components/app_update sys.path.append(otatool_dir) # this enables Python to find otatool module from otatool import * # import ...
[subcommand-args] - command-args - these are arguments that are needed for executing the main command (parttool.py), mostly pertaining to the target device - subcommand - this is the operation to be performed - subcommand-args - these are arguments that are specific to the chosen operation # Erase otadata, resetting th...
This structure includes app version. Return description for running app. Note This API is present for backward compatibility reasons. Alternative function with the same functionality is esp_app_get_description - Returns Pointer to esp_app_desc structure. - int esp_ota_get_app_elf_sha256(char *dst, size_t size) Fill...
Flash write failed. ESP_ERR_OTA_ROLLBACK_INVALID_STATE: If the running app has not confirmed state. Before performing an update, the application must be valid. - - esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size) Write OTA update data to partition. This function can be called multiple ...
OTA data partition has invalid contents - - esp_err_t esp_ota_write_with_offset(esp_ota_handle_t handle, const void *data, size_t size, uint32_t offset) Write OTA update data to partition at an offset. This function can write data in non-contiguous manner. If flash encryption is enabled, data should be 16 bytes align...
If flash encryption is enabled, this result indicates an internal error writing the final encrypted bytes to flash. - - esp_err_t esp_ota_abort(esp_ota_handle_t handle) Abort OTA update, free the handle and memory associated with it. - Parameters handle -- obtained from esp_ota_begin(). - Returns ESP_OK: Handle and its...
If esp_ota_set_boot_partition() has been called, the partition which was set by that function will be returned. If esp_ota_set_boot_partition() has not been called, the result is usually the same as esp_ota_get_running_partition(). The two results are not equal if the configured boot partition does not contain a vali...
[out] Structure of info about app. - - Returns ESP_OK Successful. ESP_ERR_NOT_FOUND app_desc structure is not found. Magic word is incorrect. ESP_ERR_NOT_SUPPORTED Partition is not application. ESP_ERR_INVALID_ARG Arguments is NULL or if partition's offset exceeds partition size. ESP_ERR_INVALID_SIZE Read would g...
ESP_ERR_INVALID_SIZE Read would go out of bounds of the partition. or one of error codes from lower-level flash driver. - - uint8_t esp_ota_get_app_partition_count(void) Returns number of ota partitions provided in partition table. - Returns Number of OTA partitions - - esp_err_t esp_ota_mark_app_valid_cancel_rollback...
: Returns true if the slots have at least one app (except the running app). False: The rollback is not possible. - Macros - OTA_SIZE_UNKNOWN Used for esp_ota_begin() if new image size is unknown - OTA_WITH_SEQUENTIAL_WRITES Used for esp_ota_begin() if new image size is unknown and erase can be done in incremental man...
Performance Monitor The Performance Monitor component provides APIs to use ESP32 internal performance counters to profile functions and applications. Application Example An example which combines performance monitor is provided in examples/system/perfmon directory. This example initializes the performance monitor stru...
Stop PM counters. Stop all PM counters synchronously. Write 0 to the PGM register - uint32_t xtensa_perfmon_value(int id) Read PM counter. Read value of defined PM counter. - Parameters id -- [in] performance counter number - Returns Performance counter value - - esp_err_t xtensa_perfmon_overflow(int id) Read PM over...
[in] used parameters passed from configuration (callback_params). This parameter expected as FILE* hanle, where data will be stored. If this parameter NULL, then data will be stored to the stdout. select -- [in] select value for current counter mask -- [in] mask value for current counter value -- [in] counter value for...