mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
docs:update CN translation for fatal-errors, external-ram, and idf-monitor
This commit is contained in:
parent
0f2052ca36
commit
e1ad9a1d20
@ -1,3 +1,4 @@
|
||||
|
||||
Support for external RAM
|
||||
************************
|
||||
|
||||
@ -40,7 +41,6 @@ ESP-IDF fully supports the use of external memory in applications. Once the exte
|
||||
|
||||
.. _external_ram_config_memory_map:
|
||||
|
||||
|
||||
Integrate RAM into the {IDF_TARGET_NAME} memory map
|
||||
---------------------------------------------------
|
||||
|
||||
@ -111,8 +111,11 @@ Restrictions
|
||||
External RAM use has the following restrictions:
|
||||
|
||||
* When flash cache is disabled (for example, if the flash is being written to), the external RAM also becomes inaccessible; any reads from or writes to it will lead to an illegal cache access exception. This is also the reason why ESP-IDF does not by default allocate any task stacks in external RAM (see below).
|
||||
|
||||
* External RAM cannot be used as a place to store DMA transaction descriptors or as a buffer for a DMA transfer to read from or write into. Any buffers that will be used in combination with DMA must be allocated using ``heap_caps_malloc(size, MALLOC_CAP_DMA)`` and can be freed using a standard ``free()`` call.
|
||||
|
||||
* External RAM uses the same cache region as the external flash. This means that frequently accessed variables in external RAM can be read and modified almost as quickly as in internal ram. However, when accessing large chunks of data (>32 KB), the cache can be insufficient, and speeds will fall back to the access speed of the external RAM. Moreover, accessing large chunks of data can "push out" cached flash, possibly making the execution of code slower afterwards.
|
||||
|
||||
* In general, external RAM cannot be used as task stack memory. Due to this, :cpp:func:`xTaskCreate` and similar functions will always allocate internal memory for stack and task TCBs, and functions such as :cpp:func:`xTaskCreateStatic` will check if the buffers passed are internal.
|
||||
|
||||
.. only:: esp32
|
||||
@ -134,4 +137,4 @@ Failure to initialize
|
||||
.. include:: inc/external-ram-esp32-notes.rst
|
||||
|
||||
.. _ESP32 ECO: https://www.espressif.com/sites/default/files/documentation/eco_and_workarounds_for_bugs_in_esp32_en.pdf
|
||||
.. _ESP32 ECO V3 User Guide: https://www.espressif.com/sites/default/files/documentation/ESP32_ECO_V3_User_Guide__EN.pdf
|
||||
.. _ESP32 ECO V3 User Guide: https://www.espressif.com/sites/default/files/documentation/ESP32_ECO_V3_User_Guide__EN.pdf
|
@ -2,6 +2,8 @@ Fatal Errors
|
||||
============
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
.. _Overview:
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
@ -207,6 +209,8 @@ If :doc:`IDF Monitor <tools/idf-monitor>` is used, Program Counter values will b
|
||||
|
||||
To find the location where a fatal error has happened, look at the lines which follow the "Backtrace" line. Fatal error location is the top line, and subsequent lines show the call stack.
|
||||
|
||||
.. _GDB-Stub:
|
||||
|
||||
GDB Stub
|
||||
--------
|
||||
|
||||
@ -238,6 +242,8 @@ If :doc:`IDF Monitor <tools/idf-monitor>` is used, GDB is started automatically
|
||||
|
||||
GDB prompt can be used to inspect CPU registers, local and static variables, and arbitrary locations in memory. It is not possible to set breakpoints, change PC, or continue execution. To reset the program, exit GDB and perform external reset: Ctrl-T Ctrl-R in IDF Monitor, or using external reset button on the development board.
|
||||
|
||||
.. _Guru-Meditation-Errors:
|
||||
|
||||
Guru Meditation Errors
|
||||
----------------------
|
||||
|
||||
@ -253,8 +259,7 @@ This section explains the meaning of different error causes, printed in parens a
|
||||
|ILLEGAL_INSTR_MSG|
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This CPU exception indicates that the instruction which was executed was not a valid instruction.
|
||||
Most common reasons for this error include:
|
||||
This CPU exception indicates that the instruction which was executed was not a valid instruction. Most common reasons for this error include:
|
||||
|
||||
- FreeRTOS task function has returned. In FreeRTOS, if task function needs to terminate, it should call :cpp:func:`vTaskDelete` function and delete itself, instead of returning.
|
||||
|
||||
@ -484,4 +489,4 @@ The types of errors reported by UBSAN can be as follows:
|
||||
* - ``builtin_unreachable``
|
||||
- ``__builtin_unreachable`` function called.
|
||||
* - ``pointer_overflow``
|
||||
- Overflow in pointer arithmetic.
|
||||
- Overflow in pointer arithmetic.
|
@ -10,6 +10,7 @@ This tool can be launched from an IDF project by running ``idf.py monitor``.
|
||||
|
||||
For the legacy GNU Make system, run ``make monitor``.
|
||||
|
||||
|
||||
Keyboard Shortcuts
|
||||
==================
|
||||
|
||||
@ -54,7 +55,7 @@ For easy interaction with IDF Monitor, use the keyboard shortcuts given in the t
|
||||
- Creates a file in the project directory and the output is written to that file until this is disabled with the same keyboard shortcut (or IDF Monitor exits).
|
||||
* - * Ctrl+I (or I)
|
||||
- Stop/resume printing timestamps
|
||||
- IDF Monitor can print a timestamp in the beginning of each line. The timestamp format can be changed by the --timestamp-format command line argument.
|
||||
- IDF Monitor can print a timestamp in the beginning of each line. The timestamp format can be changed by the ``--timestamp-format`` command line argument.
|
||||
* - * Ctrl+H (or H)
|
||||
- Display all keyboard shortcuts
|
||||
-
|
||||
@ -189,7 +190,6 @@ To decode each address, IDF Monitor runs the following command in the background
|
||||
Launching GDB with GDBStub
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
By default, if esp-idf crashes, the panic handler prints relevant registers and the stack dump (similar to the ones above) over the serial port. Then it resets the board.
|
||||
|
||||
Furthermore, the application can be configured to run GDBStub in the background and handle the Ctrl+C event from the monitor.
|
||||
@ -205,7 +205,6 @@ In the background, IDF Monitor runs the following command::
|
||||
{IDF_TARGET_TOOLCHAIN_PREFIX}-gdb -ex "set serial baud BAUD" -ex "target remote PORT" -ex interrupt build/PROJECT.elf :idf_target:`Hello NAME chip`
|
||||
|
||||
|
||||
|
||||
Output Filtering
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -278,4 +277,4 @@ Issues Observed on Windows
|
||||
.. _addr2line: https://sourceware.org/binutils/docs/binutils/addr2line.html
|
||||
.. _gdb: https://sourceware.org/gdb/download/onlinedocs/
|
||||
.. _pySerial: https://github.com/pyserial/pyserial
|
||||
.. _miniterm: https://pyserial.readthedocs.org/en/latest/tools.html#module-serial.tools.miniterm
|
||||
.. _miniterm: https://pyserial.readthedocs.org/en/latest/tools.html#module-serial.tools.miniterm
|
@ -14,5 +14,4 @@ API Reference
|
||||
Storage <storage/index>
|
||||
System <system/index>
|
||||
Configuration Options <kconfig>
|
||||
Error Codes Reference <error-codes>
|
||||
|
||||
Error Codes Reference <error-codes>
|
@ -35,5 +35,4 @@ Peripherals API
|
||||
UART <uart>
|
||||
:SOC_USB_SUPPORTED: USB <usb>
|
||||
|
||||
|
||||
Code examples for this API section are provided in the :example:`peripherals` directory of ESP-IDF examples.
|
||||
Code examples for this API section are provided in the :example:`peripherals` directory of ESP-IDF examples.
|
@ -116,19 +116,25 @@ ESP-IDF 启动过程中,片外 RAM 被映射到以 0x3F800000 起始的数据
|
||||
|
||||
* 片外 RAM 与片外 flash 使用相同的 cache 区域,这意味着频繁在片外 RAM 访问的变量可以像在片上 RAM 中一样快速读取和修改。但访问大块数据时(大于 32 KB),cache 空间可能会不足,访问速度将回落到片外 RAM 访问速度。此外,访问大块数据可以挤出 flash cache,可能会降低代码执行速度。
|
||||
|
||||
* 片外 RAM 不可用作任务堆栈存储器。因此 :cpp:func:`xTaskCreate` 及类似函数将始终为堆栈和任务 TCB 分配片上储存器,而 :cpp:func:`xTaskCreateStatic` 类型的函数将检查传递的 Buffer 是否属于片上存储器。
|
||||
* 一般来说,片外 RAM 不可用作任务堆栈存储器。因此 :cpp:func:`xTaskCreate` 及类似函数将始终为堆栈和任务 TCB 分配片上储存器,而 :cpp:func:`xTaskCreateStatic` 类型的函数将检查传递的 Buffer 是否属于片上存储器。
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
可以使用 :ref:`CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` 选项将任务堆栈放入片外存储器。这时,必须使用 :cpp:func:`xTaskCreateStatic` 指定从片外存储器分配的任务堆栈缓冲区,否则任务堆栈将会从片上存储器分配。
|
||||
|
||||
初始化失败
|
||||
=====================
|
||||
|
||||
默认情况下,片外 RAM 初始化失败将终止 ESP-IDF 启动。如果想禁用此功能,可启用 :ref:`CONFIG_SPIRAM_IGNORE_NOTFOUND` 配置选项。
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
如果启用 :ref:`CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY`,:ref:`CONFIG_SPIRAM_IGNORE_NOTFOUND` 选项将不能使用,这是因为在链接时,链接器已经向片外 RAM 分配符号。
|
||||
.. only:: esp32
|
||||
|
||||
如果启用 :ref:`CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY`,忽略失败的选项将无法使用,这是因为在链接时,链接器已经向片外存储器分配符号。
|
||||
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
.. include:: inc/external-ram-esp32-notes.rst
|
||||
.. include:: inc/external-ram-esp32-notes.rst
|
||||
|
||||
.. _ESP32 ECO: https://www.espressif.com/sites/default/files/documentation/eco_and_workarounds_for_bugs_in_esp32_cn.pdf
|
||||
.. _ESP32 ECO V3 User Guide: https://www.espressif.com/sites/default/files/documentation/ESP32_ECO_V3_User_Guide__CN.pdf
|
||||
|
||||
.. _ESP32 ECO V3 User Guide: https://www.espressif.com/sites/default/files/documentation/ESP32_ECO_V3_User_Guide__CN.pdf
|
@ -19,6 +19,7 @@
|
||||
- 堆栈溢出
|
||||
- Stack 粉碎保护检查
|
||||
- Heap 完整性检查
|
||||
- 未定义行为清理器(UBSAN)检查
|
||||
|
||||
- 使用 ``assert``、``configASSERT`` 等类似的宏断言失败。
|
||||
|
||||
@ -63,10 +64,13 @@
|
||||
|
||||
紧急处理程序的行为还受到另外两个配置项的影响:
|
||||
|
||||
- 如果使能了 :ref:`CONFIG_{IDF_TARGET_CFG_PREFIX}_DEBUG_OCDAWARE` (默认),紧急处理程序会检测 {IDF_TARGET_NAME} 是否已经连接 JTAG 调试器。如果检测成功,程序会暂停运行,并将控制权交给调试器。在这种情况下,寄存器和回溯不会被打印到控制台,并且也不会使用 GDB Stub 和 Core Dump 的功能。
|
||||
|
||||
- 如果 :ref:`CONFIG_{IDF_TARGET_CFG_PREFIX}_DEBUG_OCDAWARE` 被使能了(默认),紧急处理程序会检测 {IDF_TARGET_NAME} 是否已经连接 JTAG 调试器。如果检测成功,程序会暂停运行,并将控制权交给调试器。在这种情况下,寄存器和回溯不会被打印到控制台,并且也不会使用 GDB Stub 和 Core Dump 的功能。
|
||||
- 如果使能了 :doc:`内核转储 <core_dump>` 功能,系统状态(任务堆栈和寄存器)会被转储到 Flash 或者 UART 以供后续分析。
|
||||
|
||||
- 如果使能了 :doc:`Core Dump <core_dump>` 功能(``CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH`` 或者 ``CONFIG_ESP_COREDUMP_ENABLE_TO_UART`` 选项),系统状态(任务堆栈和寄存器)会被转储到 Flash 或者 UART 以供后续分析。
|
||||
- 如果 :ref:`CONFIG_ESP_PANIC_HANDLER_IRAM` 被禁用(默认情况下禁用),紧急处理程序的代码会放置在 Flash 而不是 IRAM 中。这意味着,如果 ESP-IDF 在 Flash 高速缓存禁用时崩溃,在运行 GDB Stub 和内核转储之前紧急处理程序会自动重新使能 Flash 高速缓存。如果 Flash 高速缓存也崩溃了,这样做会增加一些小风险。
|
||||
|
||||
如果使能了该选项,紧急处理程序的代码(包括所需的 UART 函数)会放置在 IRAM 中。当禁用 Flash 高速缓存(如写入 SPI flash)时或触发异常导致 Flash 高速缓存崩溃时,可用此选项调试一些复杂的崩溃问题。
|
||||
|
||||
下图展示了紧急处理程序的行为:
|
||||
|
||||
@ -294,8 +298,9 @@ Guru Meditation 错误
|
||||
|
||||
这类异常通常发生于以下几种场合:
|
||||
|
||||
应用程序尝试从仅支持 32 位加载/存储的内存区域执行 8 位或 16 位加载/存储操作,例如,解引用一个指向指令内存区域(比如 IRAM 或者 IROM)的 char* 指针就会触发这个错误。
|
||||
应用程序尝试保存数据到只读的内存区域(比如 IROM 或者 DROM)也会触发这个错误。
|
||||
- 应用程序尝试从仅支持 32 位加载/存储的内存区域执行 8 位或 16 位加载/存储操作,例如,解引用一个指向指令内存区域(比如 IRAM 或者 IROM)的 char* 指针就会触发这个错误。
|
||||
|
||||
- 应用程序尝试保存数据到只读的内存区域(比如 IROM 或者 DROM)也会触发这个错误。
|
||||
|
||||
Unhandled debug exception
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -377,7 +382,7 @@ Stack 粉碎保护(基于 GCC ``-fstack-protector*`` 标志)可以通过 ESP
|
||||
Backtrace: 0x4008e6c0:0x3ffc1780 0x4008e8b7:0x3ffc17a0 0x400d2138:0x3ffc17c0 0x400e79d5:0x3ffc17e0 0x400e79a7:0x3ffc1840 0x400e79df:0x3ffc18a0 0x400e2235:0x3ffc18c0 0x400e1916:0x3ffc18f0 0x400e19cd:0x3ffc1910 0x400e1a11:0x3ffc1930 0x400e1bb2:0x3ffc1950 0x400d2c44:0x3ffc1a80
|
||||
0
|
||||
|
||||
回溯信息会指明发生 Stack 粉碎的函数,建议检查函数中是否有代码访问本地数组时发生了越界。
|
||||
回溯信息会指明发生 Stack 粉碎的函数,建议检查函数中是否有代码访问局部数组时发生了越界。
|
||||
|
||||
.. only:: CONFIG_IDF_TARGET_ARCH_XTENSA
|
||||
|
||||
@ -390,3 +395,98 @@ Stack 粉碎保护(基于 GCC ``-fstack-protector*`` 标志)可以通过 ESP
|
||||
.. |CPU_EXCEPTIONS_LIST| replace:: 非法指令,加载/存储时的内存对齐错误,加载/存储时的访问权限错误。
|
||||
.. |ILLEGAL_INSTR_MSG| replace:: Illegal instruction
|
||||
.. |CACHE_ERR_MSG| replace:: Cache error
|
||||
|
||||
未定义行为清理器(UBSAN)检查
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
未定义行为清理器 (UBSAN) 是一种编译器功能,它会为可能不正确的操作添加运行时检查,例如:
|
||||
|
||||
- 溢出(乘法溢出、有符号整数溢出)
|
||||
- 移位基数或指数错误(如移位超过 32 位)
|
||||
- 整数转换错误
|
||||
|
||||
请参考 `GCC 文档 <https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html>`_ 中的``-fsanitize=undefined`` 选项,查看支持检查的完整列表。
|
||||
|
||||
使能 UBSAN
|
||||
""""""""""""""
|
||||
|
||||
默认情况下未启用 UBSAN。可以通过在构建系统中添加编译器选项 ``-fsanitize=undefined`` 在文件、组件或项目级别上使能 UBSAN。
|
||||
|
||||
在对使用硬件寄存器头文件(``soc/xxx_reg.h``)的代码使能 UBSAN 时,建议使用 ``-fno-sanitize=shift-base`` 选项禁用移位基数清理器。这是由于 ESP-IDF 寄存器头文件目前包含的模式会对这个特定的清理器选项造成误报。
|
||||
|
||||
要在项目级使能 UBSAN,请在项目 CMakeLists.txt 文件的末尾添加以下内容::
|
||||
|
||||
idf_build_set_property(COMPILE_OPTIONS "-fsanitize=undefined" "-fno-sanitize=shift-base" APPEND)
|
||||
|
||||
或者,通过 ``EXTRA_CFLAGS`` 和 ``EXTRA_CXXFLAGS`` 环境变量来传递这些选项。
|
||||
|
||||
使能 UBSAN 会明显增加代码量和数据大小。当为整个应用程序使能 UBSAN 时,微控制器的可用 RAM 无法容纳大多数应用程序(除了一些微小程序)。因此,建议为特定的待测组件使能 UBSAN。
|
||||
|
||||
要为项目 CMakeLists.txt 文件中的特定组件(``component_name``)启用 UBSAN,请在文件末尾添加以下内容::
|
||||
|
||||
idf_component_get_property(lib component_name COMPONENT_LIB)
|
||||
target_compile_options(${lib} PRIVATE "-fsanitize=undefined" "-fno-sanitize=shift-base")
|
||||
|
||||
.. 注意:: 关于 :ref:`构建属性 <cmake-build-properties>` 和 :ref:`组件属性 <cmake-component-properties>` 的更多信息,请查看构建系统文档。
|
||||
|
||||
要为同一组件的 CMakeLists.txt 中的特定组件(``component_name``)使能 UBSAN,在文件末尾添加以下内容::
|
||||
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-fsanitize=undefined" "-fno-sanitize=shift-base")
|
||||
|
||||
UBSAN 输出
|
||||
""""""""""""""""
|
||||
|
||||
当 UBSAN 检测到一个错误时,会打印一个信息和回溯,例如::
|
||||
|
||||
Undefined behavior of type out_of_bounds
|
||||
|
||||
Backtrace:0x4008b383:0x3ffcd8b0 0x4008c791:0x3ffcd8d0 0x4008c587:0x3ffcd8f0 0x4008c6be:0x3ffcd950 0x400db74f:0x3ffcd970 0x400db99c:0x3ffcd9a0
|
||||
|
||||
当使用 :doc:`IDF 监视器 <tools/idf-monitor>` 时,回溯会被解码为函数名以及源代码位置,并指向问题发生的位置(这里是 ``main.c:128``)::
|
||||
|
||||
0x4008b383: panic_abort at /path/to/esp-idf/components/esp_system/panic.c:367
|
||||
|
||||
0x4008c791: esp_system_abort at /path/to/esp-idf/components/esp_system/system_api.c:106
|
||||
|
||||
0x4008c587: __ubsan_default_handler at /path/to/esp-idf/components/esp_system/ubsan.c:152
|
||||
|
||||
0x4008c6be: __ubsan_handle_out_of_bounds at /path/to/esp-idf/components/esp_system/ubsan.c:223
|
||||
|
||||
0x400db74f: test_ub at main.c:128
|
||||
|
||||
0x400db99c: app_main at main.c:56 (discriminator 1)
|
||||
|
||||
UBSAN 报告的错误类型为以下几种:
|
||||
|
||||
.. list-table::
|
||||
:widths: 40 60
|
||||
:header-rows: 1
|
||||
|
||||
* - 名称
|
||||
- 含义
|
||||
* - ``type_mismatch``、``type_mismatch_v1``
|
||||
- 指针值不正确:空、未对齐、或与给定类型不兼容
|
||||
* - ``add_overflow``、``sub_overflow``、``mul_overflow``、``negate_overflow``
|
||||
- 加法、减法、乘法、求反过程中的整数溢出
|
||||
* - ``divrem_overflow``
|
||||
- 整数除以 0 或 ``INT_MIN``
|
||||
* - ``shift_out_of_bounds``
|
||||
- 左移或右移运算符导致的溢出
|
||||
* - ``out_of_bounds``
|
||||
- 访问超出数组范围
|
||||
* - ``unreachable``
|
||||
- 执行无法访问的代码
|
||||
* - ``missing_return``
|
||||
- Non-void 函数已结束而没有返回值(仅限 C++)
|
||||
* - ``vla_bound_not_positive``
|
||||
- 可变长度数组的大小不是正数
|
||||
* - ``load_invalid_value``
|
||||
- bool 或 enum(仅 C++)变量的值无效(超出范围)
|
||||
* - ``nonnull_arg``
|
||||
- 对于 ``nonnull`` 属性的函数,传递给函数的参数为空
|
||||
* - ``nonnull_return``
|
||||
- 对于 ``returns_nonnull`` 属性的函数,函数返回值为空
|
||||
* - ``builtin_unreachable``
|
||||
- 调用 ``__builtin_unreachable`` 函数
|
||||
* - ``pointer_overflow``
|
||||
- 指针运算过程中的溢出
|
@ -52,13 +52,19 @@ IDF 监视器是一个串行终端程序,用于收发目标设备串口的串
|
||||
- 激活时,会丢弃所有传入的串行数据。允许在不退出监视器的情况下快速暂停和检查日志输出。
|
||||
* - * Ctrl+L
|
||||
- 停止/恢复向文件写入日志输出
|
||||
- 在工程目录下创建一个文件,用于写入日志输出。可使用快捷键停止/恢复该功能(退出 IDF 监视器也会终止该功能)
|
||||
- 在工程目录下创建一个文件,用于写入日志输出。可使用快捷键停止/恢复该功能(退出 IDF 监视器也会终止该功能)
|
||||
* - * Ctrl+I (或者 I)
|
||||
- 停止/恢复打印时间标记
|
||||
- IDF 监视器可以在每一行的开头打印一个时间标记。时间标记的格式可以通过 ``--timestamp-format`` 命令行参数来改变。
|
||||
* - * Ctrl+H (或者 H)
|
||||
- 显示所有快捷键
|
||||
-
|
||||
* - * Ctrl+X (或者 X)
|
||||
- 退出监视器程序
|
||||
-
|
||||
-
|
||||
* - Ctrl+C
|
||||
- 中断正在运行的应用程序
|
||||
- 暂停 IDF 监视器并运行 GDB_ 项目调试器,从而在运行时调试应用程序。这需要启 :ref:CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME 选项。
|
||||
|
||||
除了 ``Ctrl-]`` 和 ``Ctrl-T``,其他快捷键信号会通过串口发送到目标设备。
|
||||
|
||||
@ -186,15 +192,17 @@ IDF 监视器在后台运行以下命令,解码各地址::
|
||||
|
||||
默认情况下,如果 ESP-IDF 应用程序发生 crash 事件,panic 处理器将在串口上打印相关寄存器和堆栈转储(类似上述情况),然后重置开发板。
|
||||
|
||||
此外,可以配置应用程序在后台运行 GDBStub 并处理运行中的应用程序突然中断事件 (Ctrl+C)。
|
||||
|
||||
或者选择配置 panic 处理器以运行 GDBStub,GDBStub 工具可以与 GDB_ 项目调试器进行通信,允许读取内存、检查调用堆栈帧和变量等。GDBStub 虽然没有 JTAG 通用,但不需要使用特殊硬件。
|
||||
|
||||
如需启用 GDBStub,请运行 ``idf.py menuconfig`` (适用于 CMake 编译系统),并将 :ref:`CONFIG_ESP_SYSTEM_PANIC` 选项设置为 ``Invoke GDBStub``。
|
||||
如需在发生 panic 事件时启用 GDBStub,请运行 ``idf.py menuconfig`` 打开项目配置菜单,并将 :ref:`CONFIG_ESP_SYSTEM_PANIC` 选项设置为 ``GDBStub on panic``,或者将 :ref:`CONFIG_ESP_SYSTEM_PANIC` 设置为 ``GDBStub on runtime``。
|
||||
|
||||
在这种情况下,如果 panic 处理器被触发,只要 IDF 监视器监控到 GDBStub 已经加载,panic 处理器就会自动暂停串行监控并使用必要的参数运行 GDB。GDB 退出后,通过 RTS 串口线复位开发板。如果未连接 RTS 串口线,请按复位键,手动复位开发板。
|
||||
在这种情况下,如果 panic 处理器被触发或应用程序突然中断 (Ctrl+C),只要 IDF 监视器监控到 GDBStub 已经加载,panic 处理器就会自动暂停串行监控并使用必要的参数运行 GDB。GDB 退出后,通过 RTS 串口线复位开发板。如果未连接 RTS 串口线,请按复位键,手动复位开发板。
|
||||
|
||||
IDF 监控器在后台运行如下命令::
|
||||
|
||||
{IDF_TARGET_TOOLCHAIN_PREFIX}-gdb -ex "set serial baud BAUD" -ex "target remote PORT" -ex interrupt build/PROJECT.elf
|
||||
{IDF_TARGET_TOOLCHAIN_PREFIX}-gdb -ex "set serial baud BAUD" -ex "target remote PORT" -ex interrupt build/PROJECT.elf :idf_target:`Hello NAME chip`
|
||||
|
||||
|
||||
输出筛选
|
||||
@ -262,7 +270,6 @@ IDF 监视器已知问题
|
||||
Windows 环境下已知问题
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- 若在 Windows 环境下,出现 "winpty: command not found" 错误,请运行 ``pacman -S winpty`` 进行修复。
|
||||
- 由于 Windows 控制台限制,有些箭头键及其他一些特殊键无法在 GDB 中使用。
|
||||
- 偶然情况下,``idf.py`` 或 ``make`` 退出时,可能会在 IDF 监视器恢复之前暂停 30 秒。
|
||||
- GDB 运行时,可能会暂停一段时间,然后才开始与 GDBStub 进行通信。
|
||||
@ -270,4 +277,4 @@ Windows 环境下已知问题
|
||||
.. _addr2line: https://sourceware.org/binutils/docs/binutils/addr2line.html
|
||||
.. _gdb: https://sourceware.org/gdb/download/onlinedocs/
|
||||
.. _pySerial: https://github.com/pyserial/pyserial
|
||||
.. _miniterm: https://pyserial.readthedocs.org/en/latest/tools.html#module-serial.tools.miniterm
|
||||
.. _miniterm: https://pyserial.readthedocs.org/en/latest/tools.html#module-serial.tools.miniterm
|
@ -6,13 +6,12 @@ API 参考
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
:SOC_BT_SUPPORTED: Bluetooth <bluetooth/index>
|
||||
Networking <network/index>
|
||||
Peripherals <peripherals/index>
|
||||
:SOC_BT_SUPPORTED: 蓝牙 <bluetooth/index>
|
||||
连网 <network/index>
|
||||
外设 <peripherals/index>
|
||||
协议 <protocols/index>
|
||||
Provisioning <provisioning/index>
|
||||
Storage <storage/index>
|
||||
配网 <provisioning/index>
|
||||
存储 <storage/index>
|
||||
System <system/index>
|
||||
Configuration Options <kconfig>
|
||||
Error Codes Reference <error-codes>
|
||||
|
||||
Error Codes Reference <error-codes>
|
@ -9,13 +9,13 @@
|
||||
ADC <adc>
|
||||
:SOC_DAC_SUPPORTED: DAC <dac>
|
||||
通用定时器 <timer>
|
||||
GPIO (包括 RTC 低功耗 I/O) <gpio>
|
||||
:SOC_DEDICATED_GPIO_SUPPORTED: 专用 GPIO <dedic_gpio>
|
||||
GPIO (including RTC low power I/O) <gpio>
|
||||
:SOC_DEDICATED_GPIO_SUPPORTED: Dedicated GPIO <dedic_gpio>
|
||||
:SOC_HMAC_SUPPORTED: HMAC <hmac>
|
||||
:SOC_DIG_SIGN_SUPPORTED: Digital Signature <ds>
|
||||
I2C <i2c>
|
||||
I2S <i2s>
|
||||
LED Control <ledc>
|
||||
LED 控制器 <ledc>
|
||||
:SOC_MCPWM_SUPPORTED: MCPWM <mcpwm>
|
||||
:SOC_PCNT_SUPPORTED: Pulse Counter <pcnt>
|
||||
Remote Control <rmt>
|
||||
@ -27,9 +27,9 @@
|
||||
SPI Master <spi_master>
|
||||
SPI Slave <spi_slave>
|
||||
:esp32: Secure Element <secure_element>
|
||||
:esp32s2: SPI Slave 半双工 (half duplex) <spi_slave_hd>
|
||||
:esp32s2: SPI Slave Half Duplex <spi_slave_hd>
|
||||
:esp32s2: Temp sensor <temp_sensor>
|
||||
:SOC_TOUCH_SENSOR_NUM: Touch Sensor <touch_pad>
|
||||
:SOC_TOUCH_SENSOR_NUM: 触摸传感器 <touch_pad>
|
||||
:esp32s2: Touch Element <touch_element>
|
||||
TWAI <twai>
|
||||
UART <uart>
|
||||
|
Loading…
x
Reference in New Issue
Block a user