Espressif ESP32-S2 Programming Manual page 1453

Table of Contents

Advertisement

Chapter 4. API Guides
Improving Startup Time
can be tweaked to specifically reduce startup time:
• Minimizing the
CONFIG_LOG_DEFAULT_LEVEL
large impact on startup time.
FIG_LOG_MAXIMUM_LEVEL
The
system/startup_time
• If using deep sleep, setting
wake from sleep. Note that if using Secure Boot this represents a security compromise, as Secure Boot vali-
dation will not be performed on wake.
• Setting
CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON
boot from power-on reset. How much time this saves depends on the binary size and the flash settings. Note
that this setting carries some risk if the flash becomes corrupt unexpectedly. Read the help text of the
item
for an explanation and recommendations if using this option.
• It's possible to save a small amount of time during boot by disabling RTC slow clock calibration. To do so,
set
CONFIG_ESP32S2_RTC_CLK_CAL_CYCLES
a timing source will be less accurate as a result.
The example project
system/startup_time
tem/startup_time/sdkconfig.defaults
You can append these to the end of your project's own sdkconfig file to merge the settings, but please read the
documentation for each setting first.
Task Priorities
As ESP-IDF FreeRTOS is a real-time operating system, it's necessary to ensure that high
throughput or low latency tasks are granted a high priority in order to run immediately. Priority is set when calling
xTaskCreate()
or
xTaskCreatePinnedToCore()
oritySet().
It's also necessary to ensure that tasks yield CPU (by calling vTaskDelay(), sleep(), or by blocking on
semaphores, queues, task notifications, etc) in order to not starve lower priority tasks and cause problems for the
overall system. The
Task Watchdog Timer
however note that a Task WDT timeout does not always indicate a problem (sometimes the correct operation of the
firmware requires some long-running computation). In these cases tweaking the Task WDT timeout or even disabling
the Task WDT may be necessary.
Built-In Task Priorities
started during the boot process, some are started only if the application firmware initializes a particular feature. To
optimize performance, structure application task priorities so that they are not delayed by system tasks, while also
not starving system tasks and impacting other functions of the system.
This may require splitting up a particular task. For example, perform a time-critical operation in a high priority task
or an interrupt handler and do the non-time-critical part in a lower priority task.
Header
components/esp_system/include/esp_task.h
tasks system.
Common priorities are:
Main task that executes app_main function
High Resolution Timer
ESP_TASK_TIMER_PRIO)
• FreeRTOS Timer Task to handle FreeRTOS timer callbacks is created when the scheduler initializes and has
minimum task priority (1, configurable).
Event Handling
system task to manage the default system event loop and execute callbacks has high
priority (20, ESP_TASK_EVENT_PRIO). This configuration is only used if the application calls
esp_event_loop_create_default(), it's possible to call
a custom task configuration instead.
lwIP
TCP/IP task has high priority (18, ESP_TASK_TCPIP_PRIO).
Wi-Fi Driver
task has high priority (23).
Espressif Systems
In addition to the overall performance improvements shown above, the following options
To enable more logging after the app starts up, set the
as well and then call esp_log_set_level() to restore higher level logs.
main function shows how to do this.
CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP
is pre-configured to optimize startup time.
and
system/startup_time/sdkconfig.defaults.esp32s2
provides a mechanism to automatically detect if task starvation happens,
ESP-IDF starts a number of system tasks at fixed priority levels. Some are automatically
contains macros for the priority levels used for built-in ESP-IDF
has minimum priority (1).
system task to manage timer events and execute callbacks has high priority (22,
Submit Document Feedback
and
CONFIG_BOOTLOADER_LOG_LEVEL
will skip verifying the binary on every
to 0. Any part of the firmware that uses RTC slow clock as
and can be changed at runtime by calling
esp_event_loop_create()
1442
has a
CON-
allows a faster
config
The files
sys-
contain all of these settings.
vTaskPri-
with
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF