1# Startup Time Example 2 3(See the README.md file in the upper level 'examples' directory for more information about examples.) 4 5This 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). 6 7Note 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. 8 9## How to use example 10 11### Hardware Required 12 13This example should be able to run on any commonly available ESP32 development board. 14 15### Configure the project 16 17This step is optional, the default settings in `sdkconfig.defaults` are already set to minimize startup time. 18 19``` 20idf.py menuconfig 21``` 22 23### Build and Flash 24 25Build the project and flash it to the board, then run monitor tool to view serial output: 26 27``` 28idf.py -p PORT flash monitor 29``` 30 31(Replace PORT with the name of the serial port to use.) 32 33(To exit the serial monitor, type ``Ctrl-]``.) 34 35See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. 36 37## Example Output 38 39The example should have log output similar to the following: 40 41``` 42W (34) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. 43I (37) example: App started! 44``` 45 46All 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.) 47 48Note that boot time reported in the log timestamp may vary depending on the chip target, chip revision, and eFuse configuration. 49 50## Applying To Your Own Project 51 52The file `sdkconfig.defaults` contains a range of setting which can be applied to any project in order for it to boot more rapidly. 53 54However, 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. 55 56The `sdkconfig.defaults` file in this directory contains comments above each of the settings to optimize boot speed. To add the settings 57to 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. 58 59## Additional Startup Speed 60 61Removing 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. 62 63If you wish to make this change run `idf.py menuconfig`, navigate to "Boot ROM Behavior" and set the "Permanently change Boot ROM output" option. 64