bootloader: allow skip image validation on C2

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.
This commit is contained in:
Marius Vikhammer 2022-08-24 17:39:01 +08:00
parent dfbebccf91
commit c36cd5238c
7 changed files with 23 additions and 30 deletions

View File

@ -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

View File

@ -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.

View File

@ -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"

View File

@ -1,22 +0,0 @@
from __future__ import print_function
import re
import ttfw_idf
from tiny_test_fw import TinyFW
@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'])
def test_startup_time_example(env, _):
key = 'startup_time'
dut = env.get_dut(key, 'examples/system/startup_time')
dut.start_app()
res = dut.expect(re.compile(r'\((\d+)\) [^:]+: App started!'))
time = int(res[0])
TinyFW.JunitReport.update_performance([(key, time)])
if __name__ == '__main__':
test_startup_time_example()

View File

@ -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}')

View File

@ -0,0 +1 @@
CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y