esp-idf/examples/system/startup_time
2024-01-04 09:36:38 +08:00
..
main Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
CMakeLists.txt tools: Increase the minimal supported CMake version to 3.16 2022-06-01 06:35:02 +00:00
pytest_startup_time.py ci(p4): added todo jira for disabled tests on p4 2024-01-04 09:36:38 +08:00
README.md feat(ci): Enable p4 example, test_apps and unit tests CI build 2023-08-24 12:51:19 +08:00
sdkconfig.ci.always_skip bootloader: allow skip image validation on C2 2022-08-25 16:51:44 +08:00
sdkconfig.ci.defaults bootloader: allow skip image validation on C2 2022-08-25 16:51:44 +08:00
sdkconfig.defaults soc: moved kconfig options out of the target component. 2022-04-21 12:09:43 +08:00

Supported Targets ESP32 ESP32-C2 ESP32-C3 ESP32-C6 ESP32-H2 ESP32-P4 ESP32-S2 ESP32-S3

Startup Time Example

(See the README.md file in the upper level 'examples' directory for more information about examples.)

This example demonstrates the configuration settings to obtain the minimum possible startup time for an ESP-IDF application (i.e. time from initial reset until the app_main() function is running).

Note that some of the configuration settings in sdkconfig.defaults have trade-offs that may not be suitable for your project, see the "Applying To Your Own Project" section at the bottom for more details.

How to use example

Hardware Required

This example should be able to run on any commonly available ESP32 development board.

Configure the project

This step is optional, the default settings in sdkconfig.defaults are already set to minimize startup time.

idf.py menuconfig

Build and Flash

Build the project and flash it to the board, then run monitor tool to view serial output:

idf.py -p PORT flash monitor

(Replace PORT with the name of the serial port to use.)

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

Example Output

The example should have log output similar to the following:

W (34) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (37) example: App started!

All early log output is disabled in order to save time (it's also possible to disable the ROM log output immediately after reset, see below.)

Note that boot time reported in the log timestamp may vary depending on the chip target, chip revision, and eFuse configuration.

Applying To Your Own Project

The file sdkconfig.defaults contains a range of setting which can be applied to any project in order for it to boot more rapidly.

However, note that some of these settings may have tradeoffs - for example not all hardware may support all flash modes and speeds, some applications would prefer the reliability of checking the application on every boot rather than waiting for a crash and then checking the application, and some applications will use features such as Secure Boot which require additional overhead on boot.

The sdkconfig.defaults file in this directory contains comments above each of the settings to optimize boot speed. To add the settings to your own project, either search for the setting name in menuconfig or exit menuconfig and then copy-paste the setting lines at the end of your project's sdkconfig file.

Additional Startup Speed

Removing the default boot log output printed by the ROM can shave several milliseconds off the SoC boot time. The default configuration doesn't make this change, as it is done via eFuse the change is permanent.

If you wish to make this change run idf.py menuconfig, navigate to "Boot ROM Behavior" and set the "Permanently change Boot ROM output" option.