docs: clarified esp32 timer clk source, updated the flash encryption table and esptrace doc

This commit is contained in:
Wang Fang 2021-05-11 17:49:31 +08:00 committed by bot
parent 201018da43
commit 71141a326d
5 changed files with 33 additions and 60 deletions

View File

@ -393,7 +393,7 @@ Command usage examples:
esp sysview start file://pro-cpu.SVDat file://app-cpu.SVDat
The tracing data will be retrieved and saved in non-blocking mode. To stop data this process enter ``esp apptrace stop`` command on OpenOCD telnet prompt, optionally pressing Ctrl+C in OpenOCD window.
The tracing data will be retrieved and saved in non-blocking mode. To stop data this process enter ``esp sysview stop`` command on OpenOCD telnet prompt, optionally pressing Ctrl+C in OpenOCD window.
2. Retrieve tracing data and save them indefinitely.

View File

@ -31,12 +31,14 @@ The two {IDF_TARGET_NAME} timer groups, with two timers in each, provide the tot
First of all, the timer should be initialized by calling the function :cpp:func:`timer_init` and passing a structure :cpp:type:`timer_config_t` to it to define how the timer should operate. In particular, the following timer parameters can be set:
* **Clock Source**: Select the clock source, which together with the **Divider** define the resolution of the working timer. By default the clock source is APB_CLK (typically 80 MHz).
* **Divider**: Sets how quickly the timer's counter is "ticking". The setting :cpp:member:`divider` is used as a divisor of the clock source.
* **Mode**: Sets if the counter should be incrementing or decrementing. It can be defined using :cpp:member:`counter_dir` by selecting one of the values from :cpp:type:`timer_count_dir_t`.
* **Counter Enable**: If the counter is enabled, it will start incrementing / decrementing immediately after calling :cpp:func:`timer_init`. You can change the behavior with :cpp:member:`counter_en` by selecting one of the values from :cpp:type:`timer_start_t`.
* **Alarm Enable**: Can be set using :cpp:member:`alarm_en`.
* **Auto Reload**: Sets if the counter should :cpp:member:`auto_reload` the initial counter value on the timer's alarm or continue incrementing or decrementing.
.. list::
:not esp32: - **Clock Source**: Select the clock source, which together with the **Divider** define the resolution of the working timer. By default the clock source is APB_CLK (typically 80 MHz).
- **Divider**: Sets how quickly the timer's counter is "ticking". The setting :cpp:member:`divider` is used as a divisor of the clock source.
- **Mode**: Sets if the counter should be incrementing or decrementing. It can be defined using :cpp:member:`counter_dir` by selecting one of the values from :cpp:type:`timer_count_dir_t`.
- **Counter Enable**: If the counter is enabled, it will start incrementing / decrementing immediately after calling :cpp:func:`timer_init`. You can change the behavior with :cpp:member:`counter_en` by selecting one of the values from :cpp:type:`timer_start_t`.
- **Alarm Enable**: Can be set using :cpp:member:`alarm_en`.
- **Auto Reload**: Sets if the counter should :cpp:member:`auto_reload` the initial counter value on the timer's alarm or continue incrementing or decrementing.
To get the current values of the timer's settings, use the function :cpp:func:`timer_get_config`.

View File

@ -45,117 +45,86 @@ Other types of data can be encrypted conditionally:
Relevant eFuses
---------------
The flash encryption operation is controlled by various eFuses available on {IDF_TARGET_NAME}. The list of eFuses and their descriptions is given in the table below. The names in eFuse column are also used by espefuse.py tool. For usage in the eFuse API, modify the name by adding ``ESP_EFUSE_``, for example: esp_efuse_read_field_bit(ESP_EFUSE_**DISABLE_DL_ENCRYPT**).
The flash encryption operation is controlled by various eFuses available on {IDF_TARGET_NAME}. The list of eFuses and their descriptions is given in the table below. The names in eFuse column are also used by espefuse.py tool. For usage in the eFuse API, modify the name by adding ``ESP_EFUSE_``, for example: esp_efuse_read_field_bit(ESP_EFUSE_DISABLE_DL_ENCRYPT).
.. Comment: As text in cells of list-table header rows does not wrap, it is necessary to make 0 header rows and apply bold typeface to the first row. Otherwise, the table goes beyond the html page limits on the right.
.. only:: esp32
.. list-table:: eFuses Used in Flash Encryption
:widths: 25 40 10 15 10
:widths: 25 40 10
:header-rows: 0
* - **eFuse**
- **Description**
- **Bit Depth**
- **R/W Access Control Available**
- **Default Value**
* - ``CODING_SCHEME``
- Controls actual number of block1 bits used to derive final 256-bit AES key. Possible values: ``0`` for 256 bits, ``1`` for 192 bits, ``2`` for 128 bits. Final AES key is derived based on the ``FLASH_CRYPT_CONFIG`` value.
- 2
- Yes
- 0
* - ``flash_encryption`` (block1)
- AES key storage.
- 256
- Yes
- x
* - ``FLASH_CRYPT_CONFIG``
- Controls the AES encryption process.
- 4
- Yes
- 0xF
* - ``DISABLE_DL_ENCRYPT``
- If set, disables flash encryption operation while running in Firmware Download mode.
- 1
- Yes
- 0
* - ``DISABLE_DL_DECRYPT``
- If set, disables flash decryption while running in UART Firmware Download mode.
- 1
- Yes
- 0
* - ``{IDF_TARGET_CRYPT_CNT}``
- Enables/disables encryption at boot time. If even number of bits set (0, 2, 4, 6) - encrypt flash at boot time. If odd number of bits set (1, 3, 5, 7) - do not encrypt flash at boot time.
- 7
- Yes
- 0
.. only:: esp32s2
.. list-table:: eFuses Used in Flash Encryption
:widths: 25 40 10 15 10
:widths: 25 40 10
:header-rows: 0
* - **eFuse**
- **Description**
- **Bit Depth**
- **R/W Access Control Available**
- **Default Value**
* - ``BLOCK_KEYN``
- AES key storage. N is between 0 and 5.
- 256
- Yes
- x
* - ``KEY_PURPOSE_N``
- Controls the purpose of eFuse block ``BLOCK_KEYN``, where N is between 0 and 5. Possible values: ``2`` for ``XTS_AES_256_KEY_1`` , ``3`` for ``XTS_AES_256_KEY_2``, and ``4`` for ``XTS_AES_128_KEY``. Final AES key is derived based on the value of one or two of these purpose eFuses. For a detailed description of the possible combinations, see *{IDF_TARGET_NAME} Technical Reference Manual* > *External Memory Encryption and Decryption (XTS_AES)* [`PDF <{IDF_TARGET_TRM_EN_URL}#extmemencr>`__].
- 4
- Yes
- 0
* - ``DIS_DOWNLOAD_MANUAL_ENCRYPT``
- If set, disables flash encryption when in download bootmodes.
- 1
- Yes
- 0
* - ``{IDF_TARGET_CRYPT_CNT}``
- Enables encryption and decryption, when an SPI boot mode is set. Feature is enabled if 1 or 3 bits are set in the eFuse, disabled otherwise.
- 3
- Yes
- 0
.. only:: esp32c3
.. list-table:: eFuses Used in Flash Encryption
:widths: 25 40 10 15 10
:widths: 25 40 10
:header-rows: 0
* - **eFuse**
- **Description**
- **Bit Depth**
- **R/W Access Control Available**
- **Default Value**
* - ``BLOCK_KEYN``
- AES key storage. N is between 0 and 5.
- 256
- Yes
- x
* - ``KEY_PURPOSE_N``
- Controls the purpose of eFuse block ``BLOCK_KEYN``, where N is between 0 and 5. For flash encryption the only valid value is ``4`` for ``XTS_AES_128_KEY``.
- 4
- Yes
- 0
* - ``DIS_DOWNLOAD_MANUAL_ENCRYPT``
- If set, disables flash encryption when in download bootmodes.
- 1
- Yes
- 0
* - ``{IDF_TARGET_CRYPT_CNT}``
- Enables encryption and decryption, when an SPI boot mode is set. Feature is enabled if 1 or 3 bits are set in the eFuse, disabled otherwise.
- 3
- Yes
- 0
.. note::
* R/W access control is available for all the eFuse bits listed in the table above.
* The default value of these bits is 0 afer manufacturing.
Read and write access to eFuse bits is controlled by appropriate fields in the registers ``WR_DIS`` and ``RD_DIS``. For more information on {IDF_TARGET_NAME} eFuses, see :doc:`eFuse manager <../api-reference/system/efuse>`. To change protection bits of eFuse field using espefuse.py, use these two commands: read_protect_efuse and write_protect_efuse. Example ``espefuse.py write_protect_efuse DISABLE_DL_ENCRYPT``.

View File

@ -172,7 +172,7 @@ OpenOCD 应用程序跟踪命令
命令用法:
``esp32 apptrace [start <options>] | [stop] | [status] | [dump <cores_num> <outfile>]``
``esp apptrace [start <options>] | [stop] | [status] | [dump <cores_num> <outfile>]``
子命令:
@ -215,7 +215,7 @@ Start 子命令的语法:
::
esp32 apptrace start file://trace.log 1 2048 5 0 0
esp apptrace start file://trace.log 1 2048 5 0 0
跟踪数据会被检索并以非阻塞的模式保存到文件中,如果收集满 2048 字节的数据或者在 5 秒内都没有新的数据,那么该过程就会停止。
@ -227,15 +227,15 @@ Start 子命令的语法:
::
esp32 apptrace start file://trace.log 1 -1 -1 0 0
esp apptrace start file://trace.log 1 -1 -1 0 0
对收集数据的大小没有限制,并且没有设置任何超时时间。可以通过在 OpenOCD 的 telnet 会话窗口中发送 ``esp32 apptrace stop`` 命令,或者在 OpenOCD 窗口中使用快捷键 Ctrl+C 来停止此过程。
对收集数据的大小没有限制,并且没有设置任何超时时间。可以通过在 OpenOCD 的 telnet 会话窗口中发送 ``esp apptrace stop`` 命令,或者在 OpenOCD 窗口中使用快捷键 Ctrl+C 来停止此过程。
3. 检索跟踪数据并无限期保存。
::
esp32 apptrace start file://trace.log 0 -1 -1 0 0
esp apptrace start file://trace.log 0 -1 -1 0 0
在跟踪停止之前OpenOCD 的 telnet 会话窗口将不可用。要停止跟踪,请在 OpenOCD 的窗口中使用快捷键 Ctrl+C。
@ -243,7 +243,7 @@ Start 子命令的语法:
::
esp32 apptrace start file://trace.log 0 2048 -1 1 0
esp apptrace start file://trace.log 0 2048 -1 1 0
想要复位后立即开始跟踪,请使用 OpenOCD 的 ``reset halt`` 命令。
@ -353,7 +353,7 @@ OpenOCD SystemView 跟踪命令选项
命令用法:
``esp32 sysview [start <options>] | [stop] | [status]``
``esp sysview [start <options>] | [stop] | [status]``
子命令:
@ -391,9 +391,9 @@ Start 子命令语法:
::
esp32 sysview start file://pro-cpu.SVDat file://app-cpu.SVDat
esp sysview start file://pro-cpu.SVDat file://app-cpu.SVDat
跟踪数据被检索并以非阻塞的方式保存,要停止此过程,需要在 OpenOCD 的 telnet 会话窗口输入 ``esp32 apptrace stop`` 命令,或者也可以在 OpenOCD 窗口中按下 Ctrl+C。
跟踪数据被检索并以非阻塞的方式保存,要停止此过程,需要在 OpenOCD 的 telnet 会话窗口输入 ``esp sysview stop`` 命令,或者也可以在 OpenOCD 窗口中按下 Ctrl+C。
2. 检索跟踪数据并无限保存。

View File

@ -31,12 +31,14 @@
首先调用 :cpp:func:`timer_init` 函数,并将 :cpp:type:`timer_config_t` 结构体传递给此函数,用于定义定时器的工作方式,实现定时器初始化。特别注意以下定时器参数可设置为:
* **时钟源**: 选择时钟源,它同时钟分频器一起决定了定时器的分辨率。默认的时钟源是 APB_CLK (一般是 80 MHz)。
* **分频器**: 设置定时器中计数器计数的速度,:cpp:member:`divider` 的设置将用作输入时钟源的除数。
* **模式**: 设置计数器是递增还是递减。可通过从 :cpp:type:`timer_count_dir_t` 中选取一个值,后使用 :cpp:member:`counter_dir` 来选择模式。
* **计数器使能**: 如果计数器已使能,则在调用 :cpp:func:`timer_init` 后计数器将立即开始递增/递减。您可通过从 :cpp:type:`timer_start_t` 中选取一个值,后使用 :cpp:member:`counter_en` 改变此行为。
* **报警使能**: 可使用 :cpp:member:`alarm_en` 设置。
* **自动重载**: 设置计数器是否应该在定时器警报上使用 :cpp:member:`auto_reload` 自动重载首个计数值,还是继续递增或递减。
.. list::
:not esp32: - **时钟源**: 选择时钟源,它同时钟分频器一起决定了定时器的分辨率。默认的时钟源是 APB_CLK (一般是 80 MHz)。
- **分频器**: 设置定时器中计数器计数的速度,:cpp:member:`divider` 的设置将用作输入时钟源的除数。
- **模式**: 设置计数器是递增还是递减。可通过从 :cpp:type:`timer_count_dir_t` 中选取一个值,后使用 :cpp:member:`counter_dir` 来选择模式。
- **计数器使能**: 如果计数器已使能,则在调用 :cpp:func:`timer_init` 后计数器将立即开始递增/递减。您可通过从 :cpp:type:`timer_start_t` 中选取一个值,后使用 :cpp:member:`counter_en` 改变此行为。
- **报警使能**: 可使用 :cpp:member:`alarm_en` 设置。
- **自动重载**: 设置计数器是否应该在定时器警报上使用 :cpp:member:`auto_reload` 自动重载首个计数值,还是继续递增或递减。
要获取定时器设置的当前值,请使用函数 :cpp:func:`timer_get_config`