Skip to content

Commit

Permalink
bootloader: allow skip image validation on C2
Browse files Browse the repository at this point in the history
BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not supported on C2 due to
no RTC memory, but BOOTLOADER_SKIP_VALIDATE_ALWAYS should still be
supported.
  • Loading branch information
ESP-Marius committed Aug 25, 2022
1 parent dfbebcc commit c36cd52
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 30 deletions.
2 changes: 1 addition & 1 deletion components/bootloader/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ menu "Bootloader config"
# only available if both Secure Boot and Check Signature on Boot are disabled
depends on !SECURE_SIGNED_ON_BOOT
default n
select BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP
select BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP if SOC_RTC_FAST_MEM_SUPPORTED
select BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON
help
Selecting this option prevents the bootloader from ever validating the app image before
Expand Down
2 changes: 1 addition & 1 deletion docs/en/api-guides/performance/speed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ In addition to the overall performance improvements shown above, the following o
.. list::

- Minimizing the :ref:`CONFIG_LOG_DEFAULT_LEVEL` and :ref:`CONFIG_BOOTLOADER_LOG_LEVEL` has a large impact on startup time. To enable more logging after the app starts up, set the :ref:`CONFIG_LOG_MAXIMUM_LEVEL` as well and then call :cpp:func:`esp_log_level_set` to restore higher level logs. The :example:`system/startup_time` main function shows how to do this.
- If using deep sleep, setting :ref:`CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP` allows a faster wake from sleep. Note that if using Secure Boot this represents a security compromise, as Secure Boot validation will not be performed on wake.
:SOC_RTC_FAST_MEM_SUPPORTED: - If using deep sleep, setting :ref:`CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP` allows a faster wake from sleep. Note that if using Secure Boot this represents a security compromise, as Secure Boot validation will not be performed on wake.
- Setting :ref:`CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON` will skip verifying the binary on every 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 :ref:`config item <CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON>` 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 :ref:`CONFIG_RTC_CLK_CAL_CYCLES` to 0. Any part of the firmware that uses RTC slow clock as a timing source will be less accurate as a result.

Expand Down
6 changes: 0 additions & 6 deletions examples/system/.build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ examples/system/select:
temporary: true
reason: lack of runners

examples/system/startup_time:
disable_test:
- if: IDF_TARGET == "esp32s3" or IDF_TARGET == "esp32c2"
temporary: true
reason: lack of runners

examples/system/sysview_tracing:
disable_test:
- if: IDF_TARGET != "esp32"
Expand Down
22 changes: 0 additions & 22 deletions examples/system/startup_time/example_test.py

This file was deleted.

20 changes: 20 additions & 0 deletions examples/system/startup_time/pytest_startup_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import logging

import pytest
from pytest_embedded import Dut


@pytest.mark.supported_targets
@pytest.mark.generic
@pytest.mark.parametrize('config', [
'defaults',
'always_skip',
], indirect=True)
def test_startup_time_example(dut: Dut) -> None:

res = dut.expect(r'\((\d+)\) [^:]+: App started!')
time = int(res[1])

logging.info(f'[Performance][startup_time]: {time}')
1 change: 1 addition & 0 deletions examples/system/startup_time/sdkconfig.ci.always_skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y
Empty file.

0 comments on commit c36cd52

Please sign in to comment.