Merge branch 'doc/fix_config_links' into 'master'
doc: Fix config links, add navigation lists to config items page See merge request idf/esp-idf!3310
This commit is contained in:
commit
e1ac237169
27 changed files with 132 additions and 93 deletions
|
@ -84,7 +84,7 @@ config MQTT_TASK_CORE_SELECTION_ENABLED
|
||||||
help
|
help
|
||||||
This will enable core selection
|
This will enable core selection
|
||||||
|
|
||||||
choice
|
choice MQTT_TASK_CORE_SELECTION
|
||||||
depends on MQTT_TASK_CORE_SELECTION_ENABLED
|
depends on MQTT_TASK_CORE_SELECTION_ENABLED
|
||||||
prompt "Core to use ?"
|
prompt "Core to use ?"
|
||||||
config MQTT_USE_CORE_0
|
config MQTT_USE_CORE_0
|
||||||
|
|
|
@ -60,8 +60,14 @@ call_with_python('../gen-dxd.py')
|
||||||
print("Generating kconfig.inc from kconfig contents")
|
print("Generating kconfig.inc from kconfig contents")
|
||||||
kconfig_inc_path = '{}/inc/kconfig.inc'.format(builddir)
|
kconfig_inc_path = '{}/inc/kconfig.inc'.format(builddir)
|
||||||
temp_sdkconfig_path = '{}/sdkconfig.tmp'.format(builddir)
|
temp_sdkconfig_path = '{}/sdkconfig.tmp'.format(builddir)
|
||||||
kconfigs = subprocess.check_output(["find", "../../components", "-name", "Kconfig"]).decode()
|
# note: trimming "examples" dir from KConfig/KConfig.projbuild as MQTT submodule
|
||||||
kconfig_projbuilds = subprocess.check_output(["find", "../../components", "-name", "Kconfig.projbuild"]).decode()
|
# has its own examples in the submodule.
|
||||||
|
kconfigs = subprocess.check_output(["find", "../../components",
|
||||||
|
"-name", "examples", "-prune",
|
||||||
|
"-o", "-name", "Kconfig", "-print"]).decode()
|
||||||
|
kconfig_projbuilds = subprocess.check_output(["find", "../../components",
|
||||||
|
"-name", "examples", "-prune",
|
||||||
|
"-o", "-name", "Kconfig.projbuild", "-print"]).decode()
|
||||||
confgen_args = [sys.executable,
|
confgen_args = [sys.executable,
|
||||||
"../../tools/kconfig_new/confgen.py",
|
"../../tools/kconfig_new/confgen.py",
|
||||||
"--kconfig", "../../Kconfig",
|
"--kconfig", "../../Kconfig",
|
||||||
|
|
|
@ -30,7 +30,7 @@ The library supports two modes of operation:
|
||||||
|
|
||||||
**Post-mortem mode**. This is the default mode. The mode does not need interaction from the host side. In this mode tracing module does not check whether host has read all the data from *HW UP BUFFER* buffer and overwrites old data with the new ones. This mode is useful when only the latest trace data are interesting to the user, e.g. for analyzing program's behaviour just before the crash. Host can read the data later on upon user request, e.g. via special OpenOCD command in case of working via JTAG interface.
|
**Post-mortem mode**. This is the default mode. The mode does not need interaction from the host side. In this mode tracing module does not check whether host has read all the data from *HW UP BUFFER* buffer and overwrites old data with the new ones. This mode is useful when only the latest trace data are interesting to the user, e.g. for analyzing program's behaviour just before the crash. Host can read the data later on upon user request, e.g. via special OpenOCD command in case of working via JTAG interface.
|
||||||
|
|
||||||
**Streaming mode.** Tracing module enters this mode when host connects to ESP32. In this mode before writing new data to *HW UP BUFFER* tracing module checks that there is enough space in it and if necessary waits for the host to read data and free enough memory. Maximum waiting time is controled via timeout values passed by users to corresponding API routines. So when application tries to write data to trace buffer using finite value of the maximum waiting time it is possible situation that this data will be dropped. Especially this is true for tracing from time critical code (ISRs, OS scheduler code etc.) when infinite timeouts can lead to system malfunction. In order to avoid loss of such critical data developers can enable additional data buffering via menuconfig option :envvar:`CONFIG_ESP32_APPTRACE_PENDING_DATA_SIZE_MAX`. This macro specifies the size of data which can be buffered in above conditions. The option can also help to overcome situation when data transfer to the host is temporarily slowed down, e.g due to USB bus congestions etc. But it will not help when average bitrate of trace data stream exceeds HW interface capabilities.
|
**Streaming mode.** Tracing module enters this mode when host connects to ESP32. In this mode before writing new data to *HW UP BUFFER* tracing module checks that there is enough space in it and if necessary waits for the host to read data and free enough memory. Maximum waiting time is controled via timeout values passed by users to corresponding API routines. So when application tries to write data to trace buffer using finite value of the maximum waiting time it is possible situation that this data will be dropped. Especially this is true for tracing from time critical code (ISRs, OS scheduler code etc.) when infinite timeouts can lead to system malfunction. In order to avoid loss of such critical data developers can enable additional data buffering via menuconfig option :ref:`CONFIG_ESP32_APPTRACE_PENDING_DATA_SIZE_MAX`. This macro specifies the size of data which can be buffered in above conditions. The option can also help to overcome situation when data transfer to the host is temporarily slowed down, e.g due to USB bus congestions etc. But it will not help when average bitrate of trace data stream exceeds HW interface capabilities.
|
||||||
|
|
||||||
|
|
||||||
Configuration Options and Dependencies
|
Configuration Options and Dependencies
|
||||||
|
@ -47,8 +47,8 @@ Using of this feature depends on two components:
|
||||||
|
|
||||||
There are two additional menuconfig options not mentioned above:
|
There are two additional menuconfig options not mentioned above:
|
||||||
|
|
||||||
1. *Threshold for flushing last trace data to host on panic* (:envvar:`CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH`). This option is necessary due to the nature of working over JTAG. In that mode trace data are exposed to the host in 16KB blocks. In post-mortem mode when one block is filled it is exposed to the host and the previous one becomes unavailable. In other words trace data are overwritten in 16KB granularity. On panic the latest data from the current input block are exposed to host and host can read them for post-analysis. It can happen that system panic occurs when there are very small amount of data which are not exposed to the host yet. In this case the previous 16KB of collected data will be lost and host will see the latest, but very small piece of the trace. It can be insufficient to diagnose the problem. This menuconfig option allows avoiding such situations. It controls the threshold for flushing data in case of panic. For example user can decide that it needs not less then 512 bytes of the recent trace data, so if there is less then 512 bytes of pending data at the moment of panic they will not be flushed and will not overwrite previous 16KB. The option is only meaningful in post-mortem mode and when working over JTAG.
|
1. *Threshold for flushing last trace data to host on panic* (:ref:`CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH`). This option is necessary due to the nature of working over JTAG. In that mode trace data are exposed to the host in 16KB blocks. In post-mortem mode when one block is filled it is exposed to the host and the previous one becomes unavailable. In other words trace data are overwritten in 16KB granularity. On panic the latest data from the current input block are exposed to host and host can read them for post-analysis. It can happen that system panic occurs when there are very small amount of data which are not exposed to the host yet. In this case the previous 16KB of collected data will be lost and host will see the latest, but very small piece of the trace. It can be insufficient to diagnose the problem. This menuconfig option allows avoiding such situations. It controls the threshold for flushing data in case of panic. For example user can decide that it needs not less then 512 bytes of the recent trace data, so if there is less then 512 bytes of pending data at the moment of panic they will not be flushed and will not overwrite previous 16KB. The option is only meaningful in post-mortem mode and when working over JTAG.
|
||||||
2. *Timeout for flushing last trace data to host on panic* (:envvar:`CONFIG_ESP32_APPTRACE_ONPANIC_HOST_FLUSH_TMO`). The option is only meaningful in streaming mode and controls the maximum time tracing module will wait for the host to read the last data in case of panic.
|
2. *Timeout for flushing last trace data to host on panic* (:ref:`CONFIG_ESP32_APPTRACE_ONPANIC_HOST_FLUSH_TMO`). The option is only meaningful in streaming mode and controls the maximum time tracing module will wait for the host to read the last data in case of panic.
|
||||||
|
|
||||||
|
|
||||||
How to use this library
|
How to use this library
|
||||||
|
@ -323,9 +323,9 @@ Another useful IDF feature built on top of application tracing library is the sy
|
||||||
How To Use It
|
How To Use It
|
||||||
"""""""""""""
|
"""""""""""""
|
||||||
|
|
||||||
Support for this feature is enabled by *Component config > Application Level Tracing > FreeRTOS SystemView Tracing* (:envvar:`CONFIG_SYSVIEW_ENABLE`) menuconfig option. There are several other options enabled under the same menu:
|
Support for this feature is enabled by *Component config > Application Level Tracing > FreeRTOS SystemView Tracing* (:ref:`CONFIG_SYSVIEW_ENABLE`) menuconfig option. There are several other options enabled under the same menu:
|
||||||
|
|
||||||
1. *ESP32 timer to use as SystemView timestamp source* (:envvar:`CONFIG_SYSVIEW_TS_SOURCE`) selects the source of timestamps for SystemView events. In single core mode timestamps are generated using ESP32 internal cycle counter running at maximum 240 Mhz (~4 ns granularity). In dual-core mode external timer working at 40Mhz is used, so timestamp granularity is 25 ns.
|
1. *ESP32 timer to use as SystemView timestamp source* (:ref:`CONFIG_SYSVIEW_TS_SOURCE`) selects the source of timestamps for SystemView events. In single core mode timestamps are generated using ESP32 internal cycle counter running at maximum 240 Mhz (~4 ns granularity). In dual-core mode external timer working at 40Mhz is used, so timestamp granularity is 25 ns.
|
||||||
2. Individually enabled or disabled collection of SystemView events (``CONFIG_SYSVIEW_EVT_XXX``):
|
2. Individually enabled or disabled collection of SystemView events (``CONFIG_SYSVIEW_EVT_XXX``):
|
||||||
|
|
||||||
- Trace Buffer Overflow Event
|
- Trace Buffer Overflow Event
|
||||||
|
|
|
@ -13,22 +13,22 @@ FACTORY reset
|
||||||
---------------------------
|
---------------------------
|
||||||
The user can write a basic working firmware and load it into the factory partition.
|
The user can write a basic working firmware and load it into the factory partition.
|
||||||
Next, update the firmware via OTA (over the air). The updated firmware will be loaded into an OTA app partition slot and the OTA data partition is updated to boot from this partition.
|
Next, update the firmware via OTA (over the air). The updated firmware will be loaded into an OTA app partition slot and the OTA data partition is updated to boot from this partition.
|
||||||
If you want to be able to roll back to the factory firmware and clear the settings, then you need to set :envvar:`CONFIG_BOOTLOADER_FACTORY_RESET`.
|
If you want to be able to roll back to the factory firmware and clear the settings, then you need to set :ref:`CONFIG_BOOTLOADER_FACTORY_RESET`.
|
||||||
The factory reset mechanism allows to reset the device to factory settings:
|
The factory reset mechanism allows to reset the device to factory settings:
|
||||||
|
|
||||||
- Clear one or more data partitions.
|
- Clear one or more data partitions.
|
||||||
- Boot from "factory" partition.
|
- Boot from "factory" partition.
|
||||||
|
|
||||||
:envvar:`CONFIG_BOOTLOADER_DATA_FACTORY_RESET` allows customers to select which data partitions will be erased when the factory reset is executed.
|
:ref:`CONFIG_BOOTLOADER_DATA_FACTORY_RESET` allows customers to select which data partitions will be erased when the factory reset is executed.
|
||||||
Can specify the names of partitions through comma-delimited with optional spaces for readability. (Like this: "nvs, phy_init, nvs_custom, ...").
|
Can specify the names of partitions through comma-delimited with optional spaces for readability. (Like this: "nvs, phy_init, nvs_custom, ...").
|
||||||
Make sure that the name specified in the partition table and here are the same.
|
Make sure that the name specified in the partition table and here are the same.
|
||||||
Partitions of type "app" cannot be specified here.
|
Partitions of type "app" cannot be specified here.
|
||||||
|
|
||||||
:envvar:`CONFIG_BOOTLOADER_OTA_DATA_ERASE` - the device will boot from "factory" partition after a factory reset. The OTA data partition will be cleared.
|
:ref:`CONFIG_BOOTLOADER_OTA_DATA_ERASE` - the device will boot from "factory" partition after a factory reset. The OTA data partition will be cleared.
|
||||||
|
|
||||||
:envvar:`CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET`- number of the GPIO input for factory reset uses to trigger a factory reset, this GPIO must be pulled low on reset to trigger this.
|
:ref:`CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET`- number of the GPIO input for factory reset uses to trigger a factory reset, this GPIO must be pulled low on reset to trigger this.
|
||||||
|
|
||||||
:envvar:`CONFIG_BOOTLOADER_HOLD_TIME_GPIO`- this is hold time of GPIO for reset/test mode (by default 5 seconds). The GPIO must be held low continuously for this period of time after reset before a factory reset or test partition boot (as applicable) is performed.
|
:ref:`CONFIG_BOOTLOADER_HOLD_TIME_GPIO`- this is hold time of GPIO for reset/test mode (by default 5 seconds). The GPIO must be held low continuously for this period of time after reset before a factory reset or test partition boot (as applicable) is performed.
|
||||||
|
|
||||||
Partition table.::
|
Partition table.::
|
||||||
|
|
||||||
|
@ -45,12 +45,12 @@ Partition table.::
|
||||||
Boot from TEST firmware
|
Boot from TEST firmware
|
||||||
------------------------
|
------------------------
|
||||||
The user can write a special firmware for testing in production, and run it as needed. The partition table also needs a dedicated partition for this testing firmware (See `partition table`).
|
The user can write a special firmware for testing in production, and run it as needed. The partition table also needs a dedicated partition for this testing firmware (See `partition table`).
|
||||||
To trigger a test app you need to set :envvar:`CONFIG_BOOTLOADER_APP_TEST`.
|
To trigger a test app you need to set :ref:`CONFIG_BOOTLOADER_APP_TEST`.
|
||||||
|
|
||||||
:envvar:`CONFIG_BOOTLOADER_NUM_PIN_APP_TEST` - number of the GPIO input to boot TEST partition. The selected GPIO will be configured as an input with internal pull-up enabled. To trigger a test app, this GPIO must be pulled low on reset.
|
:ref:`CONFIG_BOOTLOADER_NUM_PIN_APP_TEST` - number of the GPIO input to boot TEST partition. The selected GPIO will be configured as an input with internal pull-up enabled. To trigger a test app, this GPIO must be pulled low on reset.
|
||||||
After the GPIO input is deactivated and the device reboots, the old application will boot (factory or any OTA slot).
|
After the GPIO input is deactivated and the device reboots, the old application will boot (factory or any OTA slot).
|
||||||
|
|
||||||
:envvar:`CONFIG_BOOTLOADER_HOLD_TIME_GPIO` - this is hold time of GPIO for reset/test mode (by default 5 seconds). The GPIO must be held low continuously for this period of time after reset before a factory reset or test partition boot (as applicable) is performed.
|
:ref:`CONFIG_BOOTLOADER_HOLD_TIME_GPIO` - this is hold time of GPIO for reset/test mode (by default 5 seconds). The GPIO must be held low continuously for this period of time after reset before a factory reset or test partition boot (as applicable) is performed.
|
||||||
|
|
||||||
Customer bootloader
|
Customer bootloader
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
@ -40,7 +40,7 @@ For each error code defined in ESP-IDF components, :cpp:type:`esp_err_t` value c
|
||||||
|
|
||||||
Additionally, :cpp:func:`esp_err_to_name_r` function will attempt to interpret the error code as a `standard POSIX error code <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html>`_, if no matching ``ESP_ERR_`` value is found. This is done using ``strerror_r`` function. POSIX error codes (such as ``ENOENT``, ``ENOMEM``) are defined in ``errno.h`` and are typically obtained from ``errno`` variable. In ESP-IDF this variable is thread-local: multiple FreeRTOS tasks have their own copies of ``errno``. Functions which set ``errno`` only modify its value for the task they run in.
|
Additionally, :cpp:func:`esp_err_to_name_r` function will attempt to interpret the error code as a `standard POSIX error code <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html>`_, if no matching ``ESP_ERR_`` value is found. This is done using ``strerror_r`` function. POSIX error codes (such as ``ENOENT``, ``ENOMEM``) are defined in ``errno.h`` and are typically obtained from ``errno`` variable. In ESP-IDF this variable is thread-local: multiple FreeRTOS tasks have their own copies of ``errno``. Functions which set ``errno`` only modify its value for the task they run in.
|
||||||
|
|
||||||
This feature is enabled by default, but can be disabled to reduce application binary size. See :envvar:`CONFIG_ESP_ERR_TO_NAME_LOOKUP`. When this feature is disabled, :cpp:func:`esp_err_to_name` and :cpp:func:`esp_err_to_name_r` are still defined and can be called. In this case, :cpp:func:`esp_err_to_name` will return ``UNKNOWN ERROR``, and :cpp:func:`esp_err_to_name_r` will return ``Unknown error 0xXXXX(YYYYY)``, where ``0xXXXX`` and ``YYYYY`` are the hexadecimal and decimal representations of the error code, respectively.
|
This feature is enabled by default, but can be disabled to reduce application binary size. See :ref:`CONFIG_ESP_ERR_TO_NAME_LOOKUP`. When this feature is disabled, :cpp:func:`esp_err_to_name` and :cpp:func:`esp_err_to_name_r` are still defined and can be called. In this case, :cpp:func:`esp_err_to_name` will return ``UNKNOWN ERROR``, and :cpp:func:`esp_err_to_name_r` will return ``Unknown error 0xXXXX(YYYYY)``, where ``0xXXXX`` and ``YYYYY`` are the hexadecimal and decimal representations of the error code, respectively.
|
||||||
|
|
||||||
``ESP_ERROR_CHECK`` macro
|
``ESP_ERROR_CHECK`` macro
|
||||||
-------------------------
|
-------------------------
|
||||||
|
@ -59,7 +59,7 @@ Error message will typically look like this::
|
||||||
|
|
||||||
.. note:: If :doc:`IDF monitor <../get-started/idf-monitor>` is used, addresses in the backtrace will be converted to file names and line numbers.
|
.. note:: If :doc:`IDF monitor <../get-started/idf-monitor>` is used, addresses in the backtrace will be converted to file names and line numbers.
|
||||||
|
|
||||||
- The first line mentions the error code as a hexadecimal value, and the identifier used for this error in source code. The latter depends on :envvar:`CONFIG_ESP_ERR_TO_NAME_LOOKUP` option being set. Address in the program where error has occured is printed as well.
|
- The first line mentions the error code as a hexadecimal value, and the identifier used for this error in source code. The latter depends on :ref:`CONFIG_ESP_ERR_TO_NAME_LOOKUP` option being set. Address in the program where error has occured is printed as well.
|
||||||
|
|
||||||
- Subsequent lines show the location in the program where :cpp:func:`ESP_ERROR_CHECK` macro was called, and the expression which was passed to the macro as an argument.
|
- Subsequent lines show the location in the program where :cpp:func:`ESP_ERROR_CHECK` macro was called, and the expression which was passed to the macro as an argument.
|
||||||
|
|
||||||
|
@ -113,9 +113,9 @@ Error handling patterns
|
||||||
C++ Exceptions
|
C++ Exceptions
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
Support for C++ Exceptions in ESP-IDF is disabled by default, but can be enabled using :envvar:`CONFIG_CXX_EXCEPTIONS` option.
|
Support for C++ Exceptions in ESP-IDF is disabled by default, but can be enabled using :ref:`CONFIG_CXX_EXCEPTIONS` option.
|
||||||
|
|
||||||
Enabling exception handling normally increases application binary size by a few kB. Additionally it may be necessary to reserve some amount of RAM for exception emergency pool. Memory from this pool will be used if it is not possible to allocate exception object from the heap. Amount of memory in the emergency pool can be set using :envvar:`CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE` variable.
|
Enabling exception handling normally increases application binary size by a few kB. Additionally it may be necessary to reserve some amount of RAM for exception emergency pool. Memory from this pool will be used if it is not possible to allocate exception object from the heap. Amount of memory in the emergency pool can be set using :ref:`CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE` variable.
|
||||||
|
|
||||||
If an exception is thrown, but there is no ``catch`` block, the program will be terminated by ``abort`` function, and backtrace will be printed. See :doc:`Fatal Errors <fatal-errors>` for more information about backtraces.
|
If an exception is thrown, but there is no ``catch`` block, the program will be terminated by ``abort`` function, and backtrace will be printed. See :doc:`Fatal Errors <fatal-errors>` for more information about backtraces.
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ The use of external RAM has a few restrictions:
|
||||||
execution of code afterwards slower.
|
execution of code afterwards slower.
|
||||||
* External RAM cannot be used as task stack memory; because of this, xTaskCreate and similar functions will always allocate internal memory
|
* External RAM cannot be used as task stack memory; because of this, xTaskCreate and similar functions will always allocate internal memory
|
||||||
for stack and task TCBs and xTaskCreateStatic-type functions will check if the buffers passed are internal. However, for tasks not calling
|
for stack and task TCBs and xTaskCreateStatic-type functions will check if the buffers passed are internal. However, for tasks not calling
|
||||||
on code in ROM in any way, directly or indirectly, the menuconfig option :envvar:`CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` will eliminate
|
on code in ROM in any way, directly or indirectly, the menuconfig option :ref:`CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` will eliminate
|
||||||
the check in xTaskCreateStatic, allowing task stack in external RAM. Using this is not advised, however.
|
the check in xTaskCreateStatic, allowing task stack in external RAM. Using this is not advised, however.
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ The bugs in this silicon revision introduce a hazard when certain sequences of m
|
||||||
To work around this, the gcc compiler to compile ESP-IDF has been expanded with a flag: ``-mfix-esp32-psram-cache-issue``. With this flag passed to gcc
|
To work around this, the gcc compiler to compile ESP-IDF has been expanded with a flag: ``-mfix-esp32-psram-cache-issue``. With this flag passed to gcc
|
||||||
on the command line, the compiler works around these sequences and only outputs code that can safely be executed.
|
on the command line, the compiler works around these sequences and only outputs code that can safely be executed.
|
||||||
|
|
||||||
In ESP-IDF, this flag is enabled when you select :envvar:`CONFIG_SPIRAM_CACHE_WORKAROUND`. ESP-IDF also takes other measures to make
|
In ESP-IDF, this flag is enabled when you select :ref:`CONFIG_SPIRAM_CACHE_WORKAROUND`. ESP-IDF also takes other measures to make
|
||||||
sure no combination of PSRAM access plus the offending instruction sets are used: it links to a version of Newlib recompiled with the gcc flag, doesn't use
|
sure no combination of PSRAM access plus the offending instruction sets are used: it links to a version of Newlib recompiled with the gcc flag, doesn't use
|
||||||
some ROM functions and allocates static memory for the WiFi stack.
|
some ROM functions and allocates static memory for the WiFi stack.
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ In certain situations, execution of the program can not be continued in a well d
|
||||||
- System level checks and safeguards:
|
- System level checks and safeguards:
|
||||||
|
|
||||||
- :doc:`Interrupt watchdog <../api-reference/system/wdts>` timeout
|
- :doc:`Interrupt watchdog <../api-reference/system/wdts>` timeout
|
||||||
- :doc:`Task watchdog <../api-reference/system/wdts>` timeout (only fatal if :envvar:`CONFIG_TASK_WDT_PANIC` is set)
|
- :doc:`Task watchdog <../api-reference/system/wdts>` timeout (only fatal if :ref:`CONFIG_TASK_WDT_PANIC` is set)
|
||||||
- Cache access error
|
- Cache access error
|
||||||
- Brownout detection event
|
- Brownout detection event
|
||||||
- Stack overflow
|
- Stack overflow
|
||||||
|
@ -37,7 +37,7 @@ For some of the system level checks (interrupt watchdog, cache access error), th
|
||||||
|
|
||||||
In all cases, error cause will be printed in parens. See `Guru Meditation Errors`_ for a list of possible error causes.
|
In all cases, error cause will be printed in parens. See `Guru Meditation Errors`_ for a list of possible error causes.
|
||||||
|
|
||||||
Subsequent behavior of the panic handler can be set using :envvar:`CONFIG_ESP32_PANIC` configuration choice. The available options are:
|
Subsequent behavior of the panic handler can be set using :ref:`CONFIG_ESP32_PANIC` configuration choice. The available options are:
|
||||||
|
|
||||||
- Print registers and reboot (``CONFIG_ESP32_PANIC_PRINT_REBOOT``) — default option.
|
- Print registers and reboot (``CONFIG_ESP32_PANIC_PRINT_REBOOT``) — default option.
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ Subsequent behavior of the panic handler can be set using :envvar:`CONFIG_ESP32_
|
||||||
|
|
||||||
Behavior of panic handler is affected by two other configuration options.
|
Behavior of panic handler is affected by two other configuration options.
|
||||||
|
|
||||||
- If :envvar:`CONFIG_ESP32_DEBUG_OCDAWARE` is enabled (which is the default), panic handler will detect whether a JTAG debugger is connected. If it is, execution will be halted and control will be passed to the debugger. In this case registers and backtrace are not dumped to the console, and GDBStub / Core Dump functions are not used.
|
- If :ref:`CONFIG_ESP32_DEBUG_OCDAWARE` is enabled (which is the default), panic handler will detect whether a JTAG debugger is connected. If it is, execution will be halted and control will be passed to the debugger. In this case registers and backtrace are not dumped to the console, and GDBStub / Core Dump functions are not used.
|
||||||
|
|
||||||
- If :doc:`Core Dump <core_dump>` feature is enabled (``CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH`` or ``CONFIG_ESP32_ENABLE_COREDUMP_TO_UART`` options), then system state (task stacks and registers) will be dumped either to Flash or UART, for later analysis.
|
- If :doc:`Core Dump <core_dump>` feature is enabled (``CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH`` or ``CONFIG_ESP32_ENABLE_COREDUMP_TO_UART`` options), then system state (task stacks and registers) will be dumped either to Flash or UART, for later analysis.
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ Other Fatal Errors
|
||||||
Brownout
|
Brownout
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
ESP32 has a built-in brownout detector, which is enabled by default. Brownout detector can trigger system reset if supply voltage goes below safe level. Brownout detector can be configured using :envvar:`CONFIG_BROWNOUT_DET` and :envvar:`CONFIG_BROWNOUT_DET_LVL_SEL` options.
|
ESP32 has a built-in brownout detector, which is enabled by default. Brownout detector can trigger system reset if supply voltage goes below safe level. Brownout detector can be configured using :ref:`CONFIG_BROWNOUT_DET` and :ref:`CONFIG_BROWNOUT_DET_LVL_SEL` options.
|
||||||
When brownout detector triggers, the following message is printed::
|
When brownout detector triggers, the following message is printed::
|
||||||
|
|
||||||
Brownout detector was triggered
|
Brownout detector was triggered
|
||||||
|
@ -280,7 +280,7 @@ Consult :doc:`Heap Memory Debugging <../api-reference/system/heap_debug>` docume
|
||||||
Stack Smashing
|
Stack Smashing
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Stack smashing protection (based on GCC ``-fstack-protector*`` flags) can be enabled in ESP-IDF using :envvar:`CONFIG_STACK_CHECK_MODE` option. If stack smashing is detected, message similar to the following will be printed::
|
Stack smashing protection (based on GCC ``-fstack-protector*`` flags) can be enabled in ESP-IDF using :ref:`CONFIG_STACK_CHECK_MODE` option. If stack smashing is detected, message similar to the following will be printed::
|
||||||
|
|
||||||
Stack smashing protect failure!
|
Stack smashing protect failure!
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ Static Alocation
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This feature has been backported from FreeRTOS v9.0.0 to ESP-IDF. The
|
This feature has been backported from FreeRTOS v9.0.0 to ESP-IDF. The
|
||||||
:envvar:`CONFIG_SUPPORT_STATIC_ALLOCATION` option must be enabled in `menuconfig`
|
:ref:`CONFIG_SUPPORT_STATIC_ALLOCATION` option must be enabled in `menuconfig`
|
||||||
in order for static allocation functions to be available. Once enabled, the
|
in order for static allocation functions to be available. Once enabled, the
|
||||||
following functions can be called...
|
following functions can be called...
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ called for that TLSP during task deletion. If a deletion callback is `NULL`,
|
||||||
users should manually free the memory pointed to by the associated TLSP before
|
users should manually free the memory pointed to by the associated TLSP before
|
||||||
task deletion in order to avoid memory leak.
|
task deletion in order to avoid memory leak.
|
||||||
|
|
||||||
:envvar:`CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS` in menuconfig can be used
|
:ref:`CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS` in menuconfig can be used
|
||||||
to configure the number TLSP and Deletion Callbacks a TCB will have.
|
to configure the number TLSP and Deletion Callbacks a TCB will have.
|
||||||
|
|
||||||
For more details see :doc:`FreeRTOS API reference<../api-reference/system/freertos>`.
|
For more details see :doc:`FreeRTOS API reference<../api-reference/system/freertos>`.
|
||||||
|
@ -478,25 +478,25 @@ The ESP-IDF FreeRTOS can be configured using ``make menuconfig`` under
|
||||||
ESP-IDF FreeRTOS configuration options. For a full list of ESP-IDF
|
ESP-IDF FreeRTOS configuration options. For a full list of ESP-IDF
|
||||||
FreeRTOS configurations, see :doc:`FreeRTOS <../api-reference/kconfig>`
|
FreeRTOS configurations, see :doc:`FreeRTOS <../api-reference/kconfig>`
|
||||||
|
|
||||||
:envvar:`CONFIG_FREERTOS_UNICORE` will run ESP-IDF FreeRTOS only
|
:ref:`CONFIG_FREERTOS_UNICORE` will run ESP-IDF FreeRTOS only
|
||||||
on **PRO_CPU**. Note that this is **not equivalent to running vanilla
|
on **PRO_CPU**. Note that this is **not equivalent to running vanilla
|
||||||
FreeRTOS**. Behaviors of multiple components in ESP-IDF will be modified such
|
FreeRTOS**. Behaviors of multiple components in ESP-IDF will be modified such
|
||||||
as :component_file:`esp32/cpu_start.c`. For more details regarding the
|
as :component_file:`esp32/cpu_start.c`. For more details regarding the
|
||||||
effects of running ESP-IDF FreeRTOS on a single core, search for
|
effects of running ESP-IDF FreeRTOS on a single core, search for
|
||||||
occurences of ``CONFIG_FREERTOS_UNICORE`` in the ESP-IDF components.
|
occurences of ``CONFIG_FREERTOS_UNICORE`` in the ESP-IDF components.
|
||||||
|
|
||||||
:envvar:`CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS` will define the
|
:ref:`CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS` will define the
|
||||||
number of Thread Local Storage Pointers each task will have in ESP-IDF
|
number of Thread Local Storage Pointers each task will have in ESP-IDF
|
||||||
FreeRTOS.
|
FreeRTOS.
|
||||||
|
|
||||||
:envvar:`CONFIG_SUPPORT_STATIC_ALLOCATION` will enable the backported
|
:ref:`CONFIG_SUPPORT_STATIC_ALLOCATION` will enable the backported
|
||||||
functionality of :cpp:func:`xTaskCreateStaticPinnedToCore` in ESP-IDF FreeRTOS
|
functionality of :cpp:func:`xTaskCreateStaticPinnedToCore` in ESP-IDF FreeRTOS
|
||||||
|
|
||||||
:envvar:`CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION` will trigger a halt in
|
:ref:`CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION` will trigger a halt in
|
||||||
particular functions in ESP-IDF FreeRTOS which have not been fully tested
|
particular functions in ESP-IDF FreeRTOS which have not been fully tested
|
||||||
in an SMP context.
|
in an SMP context.
|
||||||
|
|
||||||
:envvar:`CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER` will enclose all task functions
|
:ref:`CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER` will enclose all task functions
|
||||||
within a wrapper function. In the case that a task function mistakenly returns
|
within a wrapper function. In the case that a task function mistakenly returns
|
||||||
(i.e. does not call :cpp:func:`vTaskDelete`), the call flow will return to the
|
(i.e. does not call :cpp:func:`vTaskDelete`), the call flow will return to the
|
||||||
wrapper function. The wrapper function will then log an error and abort the
|
wrapper function. The wrapper function will then log an error and abort the
|
||||||
|
|
|
@ -9,7 +9,7 @@ This section provides collection of all tips and quirks referred to from various
|
||||||
Breakpoints and watchpoints available
|
Breakpoints and watchpoints available
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
ESP32 debugger supports 2 hardware implemented breakpoints and 64 software ones. Hardware breakpoints are implemented by ESP32 chip's logic and can be set anywhere in the code: either in flash or IRAM program's regions. Additionally there are 2 types of software breakpoints implemented by OpenOCD: flash (up to 32) and IRAM (up to 32) breakpoints. Currently GDB can not set software breakpoints in flash. So until this limitation is removed those breakpoints have to be emulated by OpenOCD as hardware ones (see :ref:`below <jtag-debugging-tip-where-breakpoints>` for details). ESP32 also supports two watchpoints, so two variables can be watched for change or read by the GDB command ``watch myVariable``. Note that menuconfig option :envvar:`CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK` uses the 2nd watchpoint and will not provide expected results, if you also try to use it within OpenOCD / GDB. See menuconfig's help for detailed description.
|
ESP32 debugger supports 2 hardware implemented breakpoints and 64 software ones. Hardware breakpoints are implemented by ESP32 chip's logic and can be set anywhere in the code: either in flash or IRAM program's regions. Additionally there are 2 types of software breakpoints implemented by OpenOCD: flash (up to 32) and IRAM (up to 32) breakpoints. Currently GDB can not set software breakpoints in flash. So until this limitation is removed those breakpoints have to be emulated by OpenOCD as hardware ones (see :ref:`below <jtag-debugging-tip-where-breakpoints>` for details). ESP32 also supports two watchpoints, so two variables can be watched for change or read by the GDB command ``watch myVariable``. Note that menuconfig option :ref:`CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK` uses the 2nd watchpoint and will not provide expected results, if you also try to use it within OpenOCD / GDB. See menuconfig's help for detailed description.
|
||||||
|
|
||||||
|
|
||||||
.. _jtag-debugging-tip-where-breakpoints:
|
.. _jtag-debugging-tip-where-breakpoints:
|
||||||
|
@ -54,8 +54,8 @@ Support options for OpenOCD at compile time
|
||||||
|
|
||||||
ESP-IDF has some support options for OpenOCD debugging which can be set at compile time:
|
ESP-IDF has some support options for OpenOCD debugging which can be set at compile time:
|
||||||
|
|
||||||
* :envvar:`CONFIG_ESP32_DEBUG_OCDAWARE` is enabled by default. If a panic or unhandled exception is thrown and a JTAG debugger is connected (ie openocd is running), ESP-IDF will break into the debugger.
|
* :ref:`CONFIG_ESP32_DEBUG_OCDAWARE` is enabled by default. If a panic or unhandled exception is thrown and a JTAG debugger is connected (ie openocd is running), ESP-IDF will break into the debugger.
|
||||||
* :envvar:`CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK` (disabled by default) sets watchpoint index 1 (the second of two) at the end of any task stack. This is the most accurate way to debug task stack overflows. Click the link for more details.
|
* :ref:`CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK` (disabled by default) sets watchpoint index 1 (the second of two) at the end of any task stack. This is the most accurate way to debug task stack overflows. Click the link for more details.
|
||||||
|
|
||||||
Please see the :ref:`make menuconfig <get-started-configure>` menu for more details on setting compile-time options.
|
Please see the :ref:`make menuconfig <get-started-configure>` menu for more details on setting compile-time options.
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Partition Tables
|
||||||
Overview
|
Overview
|
||||||
--------
|
--------
|
||||||
|
|
||||||
A single ESP32's flash can contain multiple apps, as well as many different kinds of data (calibration data, filesystems, parameter storage, etc). For this reason a partition table is flashed to (:envvar:`default offset <CONFIG_PARTITION_TABLE_OFFSET>`) 0x8000 in the flash.
|
A single ESP32's flash can contain multiple apps, as well as many different kinds of data (calibration data, filesystems, parameter storage, etc). For this reason a partition table is flashed to (:ref:`default offset <CONFIG_PARTITION_TABLE_OFFSET>`) 0x8000 in the flash.
|
||||||
|
|
||||||
Partition table length is 0xC00 bytes (maximum 95 partition table entries). An MD5 checksum is appended after the table data. If the partition table is signed due to `secure boot`, the signature is appended after the partition table.
|
Partition table length is 0xC00 bytes (maximum 95 partition table entries). An MD5 checksum is appended after the table data. If the partition table is signed due to `secure boot`, the signature is appended after the partition table.
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ When type is "data", the subtype field can be specified as ota (0), phy (1), nvs
|
||||||
- phy (1) is for storing PHY initialisation data. This allows PHY to be configured per-device, instead of in firmware.
|
- phy (1) is for storing PHY initialisation data. This allows PHY to be configured per-device, instead of in firmware.
|
||||||
|
|
||||||
- In the default configuration, the phy partition is not used and PHY initialisation data is compiled into the app itself. As such, this partition can be removed from the partition table to save space.
|
- In the default configuration, the phy partition is not used and PHY initialisation data is compiled into the app itself. As such, this partition can be removed from the partition table to save space.
|
||||||
- To load PHY data from this partition, run ``make menuconfig`` and enable :envvar:`CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION` option. You will also need to flash your devices with phy init data as the esp-idf build system does not do this automatically.
|
- To load PHY data from this partition, run ``make menuconfig`` and enable :ref:`CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION` option. You will also need to flash your devices with phy init data as the esp-idf build system does not do this automatically.
|
||||||
- nvs (2) is for the :doc:`Non-Volatile Storage (NVS) API <../api-reference/storage/nvs_flash>`.
|
- nvs (2) is for the :doc:`Non-Volatile Storage (NVS) API <../api-reference/storage/nvs_flash>`.
|
||||||
|
|
||||||
- NVS is used to store per-device PHY calibration data (different to initialisation data).
|
- NVS is used to store per-device PHY calibration data (different to initialisation data).
|
||||||
|
@ -131,7 +131,7 @@ App partitions have to be at offsets aligned to 0x10000 (64K). If you leave the
|
||||||
|
|
||||||
Sizes and offsets can be specified as decimal numbers, hex numbers with the prefix 0x, or size multipliers K or M (1024 and 1024*1024 bytes).
|
Sizes and offsets can be specified as decimal numbers, hex numbers with the prefix 0x, or size multipliers K or M (1024 and 1024*1024 bytes).
|
||||||
|
|
||||||
If you want the partitions in the partition table to work with any starting offset (:envvar:`CONFIG_PARTITION_TABLE_OFFSET`) of the table itself, leave the offset field (in CSV file) for all partitions blank. Similarly, if changing the partition table offset then be aware that all blank partition offsets may change to match, and that any fixed offsets may now collide with the partition table (causing an error).
|
If you want the partitions in the partition table to work with any starting offset (:ref:`CONFIG_PARTITION_TABLE_OFFSET`) of the table itself, leave the offset field (in CSV file) for all partitions blank. Similarly, if changing the partition table offset then be aware that all blank partition offsets may change to match, and that any fixed offsets may now collide with the partition table (causing an error).
|
||||||
|
|
||||||
Flags
|
Flags
|
||||||
~~~~~
|
~~~~~
|
||||||
|
@ -164,7 +164,7 @@ MD5 checksum
|
||||||
|
|
||||||
The binary format of the partition table contains an MD5 checksum computed based on the partition table. This checksum is used for checking the integrity of the partition table during the boot.
|
The binary format of the partition table contains an MD5 checksum computed based on the partition table. This checksum is used for checking the integrity of the partition table during the boot.
|
||||||
|
|
||||||
The MD5 checksum generation can be disabled by the ``--disable-md5sum`` option of ``gen_esp32part.py`` or by the :envvar:`CONFIG_PARTITION_TABLE_MD5` option. This is useful for example when one uses a legacy bootloader which cannot process MD5 checksums and the boot fails with the error message ``invalid magic number 0xebeb``.
|
The MD5 checksum generation can be disabled by the ``--disable-md5sum`` option of ``gen_esp32part.py`` or by the :ref:`CONFIG_PARTITION_TABLE_MD5` option. This is useful for example when one uses a legacy bootloader which cannot process MD5 checksums and the boot fails with the error message ``invalid magic number 0xebeb``.
|
||||||
|
|
||||||
Flashing the partition table
|
Flashing the partition table
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
|
@ -99,11 +99,11 @@ Change settings in ``menuconfig``
|
||||||
-> Component config -> ESP-MQTT Configuration
|
-> Component config -> ESP-MQTT Configuration
|
||||||
|
|
||||||
|
|
||||||
- :envvar:`CONFIG_MQTT_PROTOCOL_311`: Enables 3.1.1 version of MQTT protocol
|
- :ref:`CONFIG_MQTT_PROTOCOL_311`: Enables 3.1.1 version of MQTT protocol
|
||||||
|
|
||||||
- :envvar:`MQTT_TRANSPORT_%TRANSPORT%`: Enables specific MQTT transport layer, such as SSL, WEBSOCKET, WEBSOCKET_SECURE
|
- :ref:`CONFIG_MQTT_TRANSPORT_SSL`, :ref:`CONFIG_MQTT_TRANSPORT_WEBSOCKET`: Enables specific MQTT transport layer, such as SSL, WEBSOCKET, WEBSOCKET_SECURE
|
||||||
|
|
||||||
- :envvar:`MQTT_CUSTOM_OUTBOX`: Disables default implementation of mqtt_outbox, so a specific implementaion can be supplied
|
- :ref:`CONFIG_MQTT_CUSTOM_OUTBOX`: Disables default implementation of mqtt_outbox, so a specific implementaion can be supplied
|
||||||
|
|
||||||
|
|
||||||
API Reference
|
API Reference
|
||||||
|
|
|
@ -40,7 +40,7 @@ CPU A as well and returns control to the calling code.
|
||||||
|
|
||||||
Additionally, all API functions are protected with a mutex (s_flash_op_mutex).
|
Additionally, all API functions are protected with a mutex (s_flash_op_mutex).
|
||||||
|
|
||||||
In a single core environment (:envvar:`CONFIG_FREERTOS_UNICORE` enabled), we simply
|
In a single core environment (:ref:`CONFIG_FREERTOS_UNICORE` enabled), we simply
|
||||||
disable both caches, no inter-CPU communication takes place.
|
disable both caches, no inter-CPU communication takes place.
|
||||||
|
|
||||||
API Reference - SPI Flash
|
API Reference - SPI Flash
|
||||||
|
|
|
@ -374,7 +374,7 @@ defined Idle Hook and Tick Hook on every iteration of the Idle Task and Tick
|
||||||
Interrupt respectively.
|
Interrupt respectively.
|
||||||
|
|
||||||
Vanilla FreeRTOS hooks are referred to as **Legacy Hooks** in ESP-IDF FreeRTOS.
|
Vanilla FreeRTOS hooks are referred to as **Legacy Hooks** in ESP-IDF FreeRTOS.
|
||||||
To enable legacy hooks, :envvar:`CONFIG_FREERTOS_LEGACY_HOOKS` should be enabled
|
To enable legacy hooks, :ref:`CONFIG_FREERTOS_LEGACY_HOOKS` should be enabled
|
||||||
in ``make menuconfig``.
|
in ``make menuconfig``.
|
||||||
|
|
||||||
Due to vanilla FreeRTOS being designed for single core, ``vApplicationIdleHook()``
|
Due to vanilla FreeRTOS being designed for single core, ``vApplicationIdleHook()``
|
||||||
|
|
|
@ -62,7 +62,7 @@ Configuration
|
||||||
|
|
||||||
Temporarily increasing the heap corruption detection level can give more detailed information about heap corruption errors.
|
Temporarily increasing the heap corruption detection level can give more detailed information about heap corruption errors.
|
||||||
|
|
||||||
In ``make menuconfig``, under ``Component config`` there is a menu ``Heap memory debugging``. The setting :envvar:`CONFIG_HEAP_CORRUPTION_DETECTION` can be set to one of three levels:
|
In ``make menuconfig``, under ``Component config`` there is a menu ``Heap memory debugging``. The setting :ref:`CONFIG_HEAP_CORRUPTION_DETECTION` can be set to one of three levels:
|
||||||
|
|
||||||
Basic (no poisoning)
|
Basic (no poisoning)
|
||||||
++++++++++++++++++++
|
++++++++++++++++++++
|
||||||
|
@ -140,7 +140,7 @@ If you suspect a memory leak, the first step is to figure out which part of the
|
||||||
|
|
||||||
Once you've identified the code which you think is leaking:
|
Once you've identified the code which you think is leaking:
|
||||||
|
|
||||||
- Under ``make menuconfig``, navigate to ``Component settings`` -> ``Heap Memory Debugging`` and set :envvar:`CONFIG_HEAP_TRACING`.
|
- Under ``make menuconfig``, navigate to ``Component settings`` -> ``Heap Memory Debugging`` and set :ref:`CONFIG_HEAP_TRACING`.
|
||||||
- Call the function :cpp:func:`heap_trace_init_standalone` early in the program, to register a buffer which can be used to record the memory trace.
|
- Call the function :cpp:func:`heap_trace_init_standalone` early in the program, to register a buffer which can be used to record the memory trace.
|
||||||
- Call the function :cpp:func:`heap_trace_start` to begin recording all mallocs/frees in the system. Call this immediately before the piece of code which you suspect is leaking memory.
|
- Call the function :cpp:func:`heap_trace_start` to begin recording all mallocs/frees in the system. Call this immediately before the piece of code which you suspect is leaking memory.
|
||||||
- Call the function :cpp:func:`heap_trace_stop` to stop the trace once the suspect piece of code has finished executing.
|
- Call the function :cpp:func:`heap_trace_stop` to stop the trace once the suspect piece of code has finished executing.
|
||||||
|
|
|
@ -29,7 +29,7 @@ until the IPC Task has completed execution of the given function.
|
||||||
Functions executed by IPCs must be functions of type
|
Functions executed by IPCs must be functions of type
|
||||||
`void func(void *arg)`. To run more complex functions which require a larger
|
`void func(void *arg)`. To run more complex functions which require a larger
|
||||||
stack, the IPC tasks' stack size can be configured by modifying
|
stack, the IPC tasks' stack size can be configured by modifying
|
||||||
:envvar:`CONFIG_IPC_TASK_STACK_SIZE` in `menuconfig`. The IPC API is protected by a
|
:ref:`CONFIG_IPC_TASK_STACK_SIZE` in `menuconfig`. The IPC API is protected by a
|
||||||
mutex hence simultaneous IPC calls are not possible.
|
mutex hence simultaneous IPC calls are not possible.
|
||||||
|
|
||||||
Care should taken to avoid deadlock when writing functions to be executed by
|
Care should taken to avoid deadlock when writing functions to be executed by
|
||||||
|
|
|
@ -16,13 +16,13 @@ Naturally, requesting higher APB or CPU frequency or disabling light sleep cause
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Power management can be enabled at compile time, using :envvar:`CONFIG_PM_ENABLE` option.
|
Power management can be enabled at compile time, using :ref:`CONFIG_PM_ENABLE` option.
|
||||||
|
|
||||||
Enabling power management features comes at the cost of increased interrupt latency. Extra latency depends on a number of factors, among which are CPU frequency, single/dual core mode, whether frequency switch needs to be performed or not. Minimal extra latency is 0.2us (when CPU frequency is 240MHz, and frequency scaling is not enabled), maximum extra latency is 40us (when frequency scaling is enabled, and a switch from 40MHz to 80MHz is performed on interrupt entry).
|
Enabling power management features comes at the cost of increased interrupt latency. Extra latency depends on a number of factors, among which are CPU frequency, single/dual core mode, whether frequency switch needs to be performed or not. Minimal extra latency is 0.2us (when CPU frequency is 240MHz, and frequency scaling is not enabled), maximum extra latency is 40us (when frequency scaling is enabled, and a switch from 40MHz to 80MHz is performed on interrupt entry).
|
||||||
|
|
||||||
Dynamic frequency scaling (DFS) and automatic light sleep can be enabled in the application by calling :cpp:func:`esp_pm_configure` function. Its argument is a structure defining frequency scaling settings, cpp:class:`esp_pm_config_esp32_t`. In this structure, 3 fields need to be initialized:
|
Dynamic frequency scaling (DFS) and automatic light sleep can be enabled in the application by calling :cpp:func:`esp_pm_configure` function. Its argument is a structure defining frequency scaling settings, cpp:class:`esp_pm_config_esp32_t`. In this structure, 3 fields need to be initialized:
|
||||||
|
|
||||||
* ``max_freq_mhz`` - Maximal CPU frequency, in MHZ (i.e. frequency used when ``ESP_PM_CPU_FREQ_MAX`` lock is taken). This will usually be set to :envvar:`CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ`.
|
* ``max_freq_mhz`` - Maximal CPU frequency, in MHZ (i.e. frequency used when ``ESP_PM_CPU_FREQ_MAX`` lock is taken). This will usually be set to :ref:`CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ`.
|
||||||
|
|
||||||
* ``min_freq_mhz`` — Minimal CPU frequency, in MHz (i.e. frequency used when only ``ESP_PM_APB_FREQ_MAX`` locks are taken). This can be set to XTAL frequency, or XTAL frequency divided by integer. Note that 10MHz is the lowest frequency at which the default REF_TICK clock of 1MHz can be generated.
|
* ``min_freq_mhz`` — Minimal CPU frequency, in MHz (i.e. frequency used when only ``ESP_PM_APB_FREQ_MAX`` locks are taken). This can be set to XTAL frequency, or XTAL frequency divided by integer. Note that 10MHz is the lowest frequency at which the default REF_TICK clock of 1MHz can be generated.
|
||||||
|
|
||||||
|
@ -30,13 +30,13 @@ Dynamic frequency scaling (DFS) and automatic light sleep can be enabled in the
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Automatic light sleep is based on FreeRTOS Tickless Idle functionality. :cpp:func:`esp_pm_configure` will return an `ESP_ERR_NOT_SUPPORTED` error if :envvar:`CONFIG_FREERTOS_USE_TICKLESS_IDLE` option is not enabled in menuconfig, but automatic light sleep is requested.
|
Automatic light sleep is based on FreeRTOS Tickless Idle functionality. :cpp:func:`esp_pm_configure` will return an `ESP_ERR_NOT_SUPPORTED` error if :ref:`CONFIG_FREERTOS_USE_TICKLESS_IDLE` option is not enabled in menuconfig, but automatic light sleep is requested.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
In light sleep, peripherals are clock gated, and interrupts (from GPIOs and internal peripherals) will not be generated. Wakeup source described in :doc:`Sleep Modes <sleep_modes>` documentation can be used to wake from light sleep state. For example, EXT0 and EXT1 wakeup source can be used to wake up from a GPIO.
|
In light sleep, peripherals are clock gated, and interrupts (from GPIOs and internal peripherals) will not be generated. Wakeup source described in :doc:`Sleep Modes <sleep_modes>` documentation can be used to wake from light sleep state. For example, EXT0 and EXT1 wakeup source can be used to wake up from a GPIO.
|
||||||
|
|
||||||
Alternatively, :envvar:`CONFIG_PM_DFS_INIT_AUTO` option can be enabled in menuconfig. If enabled, maximal CPU frequency is determined by :envvar:`CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ` setting, and minimal CPU frequency is set to the XTAL frequency.
|
Alternatively, :ref:`CONFIG_PM_DFS_INIT_AUTO` option can be enabled in menuconfig. If enabled, maximal CPU frequency is determined by :ref:`CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ` setting, and minimal CPU frequency is set to the XTAL frequency.
|
||||||
|
|
||||||
|
|
||||||
Power Management Locks
|
Power Management Locks
|
||||||
|
@ -63,7 +63,7 @@ Power Management Algorithm for the ESP32
|
||||||
|
|
||||||
When dynamic frequency scaling is enabled, CPU frequency will be switched as follows:
|
When dynamic frequency scaling is enabled, CPU frequency will be switched as follows:
|
||||||
|
|
||||||
- If maximal CPU frequency (set using :cpp:func:`esp_pm_configure` or :envvar:`CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ`) is 240 MHz:
|
- If maximal CPU frequency (set using :cpp:func:`esp_pm_configure` or :ref:`CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ`) is 240 MHz:
|
||||||
|
|
||||||
1. When ``ESP_PM_CPU_FREQ_MAX`` or ``ESP_PM_APB_FREQ_MAX`` locks are acquired, CPU frequency will be 240 MHz, and APB frequency will be 80 MHz.
|
1. When ``ESP_PM_CPU_FREQ_MAX`` or ``ESP_PM_APB_FREQ_MAX`` locks are acquired, CPU frequency will be 240 MHz, and APB frequency will be 80 MHz.
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ If the universally administered MAC addresses are not enough for all of the netw
|
||||||
|
|
||||||
See `this article <https://en.wikipedia.org/wiki/MAC_address#Universal_vs._local>`_ for the definition of local and universally administered MAC addresses.
|
See `this article <https://en.wikipedia.org/wiki/MAC_address#Universal_vs._local>`_ for the definition of local and universally administered MAC addresses.
|
||||||
|
|
||||||
The number of universally administered MAC address can be configured using :envvar:`CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS`.
|
The number of universally administered MAC address can be configured using :ref:`CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS`.
|
||||||
|
|
||||||
If the number of universal MAC addresses is two, only two interfaces (Wi-Fi Station and Bluetooth) receive a universally administered MAC address. These are generated sequentially by adding 0 and 1 (respectively) to the base MAC address. The remaining two interfaces (Wi-Fi SoftAP and Ethernet) receive local MAC addresses. These are derived from the universal Wi-Fi station and Bluetooth MAC addresses, respectively.
|
If the number of universal MAC addresses is two, only two interfaces (Wi-Fi Station and Bluetooth) receive a universally administered MAC address. These are generated sequentially by adding 0 and 1 (respectively) to the base MAC address. The remaining two interfaces (Wi-Fi SoftAP and Ethernet) receive local MAC addresses. These are derived from the universal Wi-Fi station and Bluetooth MAC addresses, respectively.
|
||||||
|
|
||||||
|
|
|
@ -63,10 +63,10 @@ longer call :cpp:func:`esp_task_wdt_reset`. Once all tasks have unsubscribed
|
||||||
form the TWDT, the TWDT can be deinitialized by calling
|
form the TWDT, the TWDT can be deinitialized by calling
|
||||||
:cpp:func:`esp_task_wdt_deinit()`.
|
:cpp:func:`esp_task_wdt_deinit()`.
|
||||||
|
|
||||||
By default :envvar:`CONFIG_TASK_WDT` in ``make menuconfig`` will be enabled causing
|
By default :ref:`CONFIG_TASK_WDT` in ``make menuconfig`` will be enabled causing
|
||||||
the TWDT to be initialized automatically during startup. Likewise
|
the TWDT to be initialized automatically during startup. Likewise
|
||||||
:envvar:`CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0` and
|
:ref:`CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0` and
|
||||||
:envvar:`CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1` are also enabled by default causing
|
:ref:`CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1` are also enabled by default causing
|
||||||
the two Idle Tasks to be subscribed to the TWDT during startup.
|
the two Idle Tasks to be subscribed to the TWDT during startup.
|
||||||
|
|
||||||
JTAG and watchdogs
|
JTAG and watchdogs
|
||||||
|
|
|
@ -67,7 +67,7 @@ By default, if an esp-idf app crashes then the panic handler prints registers an
|
||||||
|
|
||||||
Optionally, the panic handler can be configured to run a serial "gdb stub" which can communicate with a gdb_ debugger program and allow memory to be read, variables and stack frames examined, etc. This is not as versatile as JTAG debugging, but no special hardware is required.
|
Optionally, the panic handler can be configured to run a serial "gdb stub" which can communicate with a gdb_ debugger program and allow memory to be read, variables and stack frames examined, etc. This is not as versatile as JTAG debugging, but no special hardware is required.
|
||||||
|
|
||||||
To enable the gdbstub, run ``make menuconfig`` and set :envvar:`CONFIG_ESP32_PANIC` option to ``Invoke GDBStub``.
|
To enable the gdbstub, run ``make menuconfig`` and set :ref:`CONFIG_ESP32_PANIC` option to ``Invoke GDBStub``.
|
||||||
|
|
||||||
If this option is enabled and IDF Monitor sees the gdb stub has loaded, it will automatically pause serial monitoring and run GDB with the correct arguments. After GDB exits, the board will be reset via the RTS serial line (if this is connected.)
|
If this option is enabled and IDF Monitor sees the gdb stub has loaded, it will automatically pause serial monitoring and run GDB with the correct arguments. After GDB exits, the board will be reset via the RTS serial line (if this is connected.)
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ To exit the monitor use shortcut ``Ctrl+]``.
|
||||||
e<><65><EFBFBD>)(Xn@<40>y.!<21><>(<28>PW+)<29><>Hn9a/9<>!<21>t5<74><35>P<EFBFBD>~<7E>k<EFBFBD><6B>e<EFBFBD>ea<65>5<EFBFBD>jA
|
e<><65><EFBFBD>)(Xn@<40>y.!<21><>(<28>PW+)<29><>Hn9a/9<>!<21>t5<74><35>P<EFBFBD>~<7E>k<EFBFBD><6B>e<EFBFBD>ea<65>5<EFBFBD>jA
|
||||||
~zY<7A><59>Y(1<>,1<15><> e<><65><EFBFBD>)(Xn@<40>y.!Dr<44>zY(<28>jpi<70>|<7C>+z5Ymvp
|
~zY<7A><59>Y(1<>,1<15><> e<><65><EFBFBD>)(Xn@<40>y.!Dr<44>zY(<28>jpi<70>|<7C>+z5Ymvp
|
||||||
|
|
||||||
or monitor fails shortly after upload, your board is likely using 26MHz crystal, while the ESP-IDF assumes default of 40MHz. Exit the monitor, go back to the :ref:`menuconfig <get-started-configure>`, change :envvar:`CONFIG_ESP32_XTAL_FREQ_SEL` to 26MHz, then :ref:`build and flash <get-started-build-flash>` the application again. This is found under ``make menuconfig`` under Component config --> ESP32-specific --> Main XTAL frequency.
|
or monitor fails shortly after upload, your board is likely using 26MHz crystal, while the ESP-IDF assumes default of 40MHz. Exit the monitor, go back to the :ref:`menuconfig <get-started-configure>`, change :ref:`CONFIG_ESP32_XTAL_FREQ_SEL` to 26MHz, then :ref:`build and flash <get-started-build-flash>` the application again. This is found under ``make menuconfig`` under Component config --> ESP32-specific --> Main XTAL frequency.
|
||||||
|
|
||||||
To execute ``make flash`` and ``make monitor`` in one go, type ``make flash monitor``. Check section :doc:`IDF Monitor <idf-monitor>` for handy shortcuts and more details on using this application.
|
To execute ``make flash`` and ``make monitor`` in one go, type ``make flash monitor``. Check section :doc:`IDF Monitor <idf-monitor>` for handy shortcuts and more details on using this application.
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ This is the documentation for Espressif IoT Development Framework (`esp-idf <htt
|
||||||
`API Guides`_ `Contribute`_ `Resources`_
|
`API Guides`_ `Contribute`_ `Resources`_
|
||||||
================== ================== ==================
|
================== ================== ==================
|
||||||
|
|
||||||
|
|
||||||
.. |Get Started| image:: ../_static/get-started.gif
|
.. |Get Started| image:: ../_static/get-started.gif
|
||||||
.. _Get Started: get-started/index.html
|
.. _Get Started: get-started/index.html
|
||||||
|
|
||||||
|
|
|
@ -285,8 +285,8 @@ Flash Encryption & Secure Boot
|
||||||
It is recommended to use flash encryption and secure boot together. However, if Secure Boot is enabled then additional restrictions apply to reflashing the device:
|
It is recommended to use flash encryption and secure boot together. However, if Secure Boot is enabled then additional restrictions apply to reflashing the device:
|
||||||
|
|
||||||
- :ref:`updating-encrypted-flash-ota` are not restricted (provided the new app is signed correctly with the Secure Boot signing key).
|
- :ref:`updating-encrypted-flash-ota` are not restricted (provided the new app is signed correctly with the Secure Boot signing key).
|
||||||
- :ref:`Plaintext serial flash updates <updating-encrypted-flash-serial>` are only possible if the :envvar:`Reflashable <CONFIG_SECURE_BOOTLOADER_REFLASHABLE>` Secure Boot mode is selected and a Secure Boot key was pre-generated and burned to the ESP32 (refer to :ref:`Secure Boot <secure-boot-reflashable>` docs.). In this configuration, ``make bootloader`` will produce a pre-digested bootloader and secure boot digest file for flashing at offset 0x0. When following the plaintext serial reflashing steps it is necessary to re-flash this file before flashing other plaintext data.
|
- :ref:`Plaintext serial flash updates <updating-encrypted-flash-serial>` are only possible if the :ref:`Reflashable <CONFIG_SECURE_BOOTLOADER_MODE>` Secure Boot mode is selected and a Secure Boot key was pre-generated and burned to the ESP32 (refer to :ref:`Secure Boot <secure-boot-reflashable>` docs.). In this configuration, ``make bootloader`` will produce a pre-digested bootloader and secure boot digest file for flashing at offset 0x0. When following the plaintext serial reflashing steps it is necessary to re-flash this file before flashing other plaintext data.
|
||||||
- :ref:`pregenerated-flash-encryption-key` is still possible, provided the bootloader is not reflashed. Reflashing the bootloader requires the same :envvar:`Reflashable <CONFIG_SECURE_BOOTLOADER_REFLASHABLE>` option to be enabled in the Secure Boot config.
|
- :ref:`pregenerated-flash-encryption-key` is still possible, provided the bootloader is not reflashed. Reflashing the bootloader requires the same :ref:`Reflashable <CONFIG_SECURE_BOOTLOADER_MODE>` option to be enabled in the Secure Boot config.
|
||||||
|
|
||||||
.. _flash-encryption-without-secure-boot:
|
.. _flash-encryption-without-secure-boot:
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ If the bootloader becomes too large, the ESP32 will fail to boot - errors will b
|
||||||
|
|
||||||
Options to work around this are:
|
Options to work around this are:
|
||||||
|
|
||||||
- Reduce :envvar:`bootloader log level <CONFIG_LOG_BOOTLOADER_LEVEL>`. Setting log level to Warning, Error or None all significantly reduce the final binary size (but may make it harder to debug).
|
- Reduce :ref:`bootloader log level <CONFIG_LOG_BOOTLOADER_LEVEL>`. Setting log level to Warning, Error or None all significantly reduce the final binary size (but may make it harder to debug).
|
||||||
- Set :envvar:`partition table offset <CONFIG_PARTITION_TABLE_OFFSET>` to a higher value than 0x8000, to place the partition table later in the flash. This increases the space available for the bootloader. If the :doc:`partition table </api-guides/partition-tables>` CSV file contains explicit partition offsets, they will need changing so no partition has an offset lower than ``CONFIG_PARTITION_TABLE_OFFSET + 0x1000``. (This includes the default partition CSV files supplied with ESP-IDF.)
|
- Set :ref:`partition table offset <CONFIG_PARTITION_TABLE_OFFSET>` to a higher value than 0x8000, to place the partition table later in the flash. This increases the space available for the bootloader. If the :doc:`partition table </api-guides/partition-tables>` CSV file contains explicit partition offsets, they will need changing so no partition has an offset lower than ``CONFIG_PARTITION_TABLE_OFFSET + 0x1000``. (This includes the default partition CSV files supplied with ESP-IDF.)
|
||||||
|
|
||||||
.. _secure-boot-howto:
|
.. _secure-boot-howto:
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ Re-Flashable Software Bootloader
|
||||||
|
|
||||||
Configuration "Secure Boot: One-Time Flash" is the recommended configuration for production devices. In this mode, each device gets a unique key that is never stored outside the device.
|
Configuration "Secure Boot: One-Time Flash" is the recommended configuration for production devices. In this mode, each device gets a unique key that is never stored outside the device.
|
||||||
|
|
||||||
However, an alternative mode :envvar:`Secure Boot: Reflashable <CONFIG_SECURE_BOOTLOADER_REFLASHABLE>` is also available. This mode allows you to supply a 256-bit key file that is used for the secure bootloader key. As you have the key file, you can generate new bootloader images and secure boot digests for them.
|
However, an alternative mode :ref:`Secure Boot: Reflashable <CONFIG_SECURE_BOOTLOADER_MODE>` is also available. This mode allows you to supply a 256-bit key file that is used for the secure bootloader key. As you have the key file, you can generate new bootloader images and secure boot digests for them.
|
||||||
|
|
||||||
In the esp-idf build process, this 256-bit key file is derived from the app signing key generated during the generate_signing_key step above. The private key's SHA-256 digest is used as the 256-bit secure bootloader key. This is a convenience so you only need to generate/protect a single private key.
|
In the esp-idf build process, this 256-bit key file is derived from the app signing key generated during the generate_signing_key step above. The private key's SHA-256 digest is used as the 256-bit secure bootloader key. This is a convenience so you only need to generate/protect a single private key.
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ ESP-IDF 中大多数函数会返回 :cpp:type:`esp_err_t` 类型的错误码,
|
||||||
|
|
||||||
此外,如果出现找不到匹配的 ``ESP_ERR_`` 值的情况,函数 :cpp:func:`esp_err_to_name_r` 则会尝试将错误码作为一种 `标准 POSIX 错误代码 <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html>`_ 进行解释。具体过程为:POSIX 错误代码(例如 ``ENOENT``, ``ENOMEM``)定义在 ``errno.h`` 文件中,可以通过 ``errno`` 变量获得,进而调用 ``strerror_r`` 函数实现。在 ESP-IDF 中,``errno`` 是一个基于线程的局部变量,即每个 FreeRTOS 任务都有自己的 ``errno`` 副本,通过函数修改 ``errno`` 也只会作用于当前任务中的 ``errno`` 变量值。
|
此外,如果出现找不到匹配的 ``ESP_ERR_`` 值的情况,函数 :cpp:func:`esp_err_to_name_r` 则会尝试将错误码作为一种 `标准 POSIX 错误代码 <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html>`_ 进行解释。具体过程为:POSIX 错误代码(例如 ``ENOENT``, ``ENOMEM``)定义在 ``errno.h`` 文件中,可以通过 ``errno`` 变量获得,进而调用 ``strerror_r`` 函数实现。在 ESP-IDF 中,``errno`` 是一个基于线程的局部变量,即每个 FreeRTOS 任务都有自己的 ``errno`` 副本,通过函数修改 ``errno`` 也只会作用于当前任务中的 ``errno`` 变量值。
|
||||||
|
|
||||||
该功能(即在无法匹配 ``ESP_ERR_`` 值时,尝试用标准 POSIX 解释错误码)默认启用。用户也可以禁用该功能,从而减小应用程序的二进制文件大小,详情可见 :envvar:`CONFIG_ESP_ERR_TO_NAME_LOOKUP`。注意,该功能对禁用并不影响 :cpp:func:`esp_err_to_name` 和 :cpp:func:`esp_err_to_name_r` 函数的定义,用户仍可调用这两个函数转化错误码。在这种情况下, :cpp:func:`esp_err_to_name` 函数在遇到无法匹配错误码的情况会返回 ``UNKNOWN ERROR``,而 :cpp:func:`esp_err_to_name_r` 函数会返回 ``Unknown error 0xXXXX(YYYYY)``,其中 ``0xXXXX`` 和 ``YYYYY`` 分别代表错误代码的十六进制和十进制表示。
|
该功能(即在无法匹配 ``ESP_ERR_`` 值时,尝试用标准 POSIX 解释错误码)默认启用。用户也可以禁用该功能,从而减小应用程序的二进制文件大小,详情可见 :ref:`CONFIG_ESP_ERR_TO_NAME_LOOKUP`。注意,该功能对禁用并不影响 :cpp:func:`esp_err_to_name` 和 :cpp:func:`esp_err_to_name_r` 函数的定义,用户仍可调用这两个函数转化错误码。在这种情况下, :cpp:func:`esp_err_to_name` 函数在遇到无法匹配错误码的情况会返回 ``UNKNOWN ERROR``,而 :cpp:func:`esp_err_to_name_r` 函数会返回 ``Unknown error 0xXXXX(YYYYY)``,其中 ``0xXXXX`` 和 ``YYYYY`` 分别代表错误代码的十六进制和十进制表示。
|
||||||
|
|
||||||
.. _esp-error-check-macro:
|
.. _esp-error-check-macro:
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ ESP-IDF 中大多数函数会返回 :cpp:type:`esp_err_t` 类型的错误码,
|
||||||
|
|
||||||
Backtrace: 0x40086e7c:0x3ffb4ff0 0x40087328:0x3ffb5010 0x400d1fdf:0x3ffb5030 0x400d0816:0x3ffb5050
|
Backtrace: 0x40086e7c:0x3ffb4ff0 0x40087328:0x3ffb5010 0x400d1fdf:0x3ffb5030 0x400d0816:0x3ffb5050
|
||||||
|
|
||||||
- 第一行打印错误代码的十六进制表示,及该错误在源代码中的标识符。这个标识符取决于 :envvar:`CONFIG_ESP_ERR_TO_NAME_LOOKUP` 选项的设定。最后,第一行还会打印程序中该错误发生的具体位置。
|
- 第一行打印错误代码的十六进制表示,及该错误在源代码中的标识符。这个标识符取决于 :ref:`CONFIG_ESP_ERR_TO_NAME_LOOKUP` 选项的设定。最后,第一行还会打印程序中该错误发生的具体位置。
|
||||||
|
|
||||||
- 下面几行显示了程序中调用 :cpp:func:`ESP_ERROR_CHECK` 宏的具体位置,以及传递给该宏的参数。
|
- 下面几行显示了程序中调用 :cpp:func:`ESP_ERROR_CHECK` 宏的具体位置,以及传递给该宏的参数。
|
||||||
|
|
||||||
|
@ -125,8 +125,8 @@ ESP-IDF 中大多数函数会返回 :cpp:type:`esp_err_t` 类型的错误码,
|
||||||
C++ 异常
|
C++ 异常
|
||||||
--------
|
--------
|
||||||
|
|
||||||
默认情况下,ESP-IDF 会禁用对 C++ 异常的支持,但是可以通过 :envvar:`CONFIG_CXX_EXCEPTIONS` 选项启用。
|
默认情况下,ESP-IDF 会禁用对 C++ 异常的支持,但是可以通过 :ref:`CONFIG_CXX_EXCEPTIONS` 选项启用。
|
||||||
|
|
||||||
通常情况下,启用异常处理会让应用程序的二进制文件增加几 kB。此外,启用该功能时还应为异常事故池预留一定内存。当应用程序无法从堆中分配异常对象时,就可以使用这个池中的内存。该内存池的大小可以通过 :envvar:`CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE` 来设定。
|
通常情况下,启用异常处理会让应用程序的二进制文件增加几 kB。此外,启用该功能时还应为异常事故池预留一定内存。当应用程序无法从堆中分配异常对象时,就可以使用这个池中的内存。该内存池的大小可以通过 :ref:`CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE` 来设定。
|
||||||
|
|
||||||
如果 C++ 程序抛出了异常,但是程序中并没有 ``catch`` 代码块来捕获该异常,那么程序的运行就会被 ``abort`` 函数中止,然后打印回溯信息。有关回溯的更多信息,请参阅 :doc:`不可恢复错误 <fatal-errors>` 。
|
如果 C++ 程序抛出了异常,但是程序中并没有 ``catch`` 代码块来捕获该异常,那么程序的运行就会被 ``abort`` 函数中止,然后打印回溯信息。有关回溯的更多信息,请参阅 :doc:`不可恢复错误 <fatal-errors>` 。
|
||||||
|
|
|
@ -65,7 +65,7 @@ IDF Monitor 为转储补充如下信息::
|
||||||
|
|
||||||
您可以选择配置 panic 处理函数,使其运行串行的 "gdb stub"。该程序可以与 gdb 调试器通信,提供内存,变量,栈帧读取的功能。虽然这不像 JTAG 调试那样通用,但您不需要使用特殊硬件。
|
您可以选择配置 panic 处理函数,使其运行串行的 "gdb stub"。该程序可以与 gdb 调试器通信,提供内存,变量,栈帧读取的功能。虽然这不像 JTAG 调试那样通用,但您不需要使用特殊硬件。
|
||||||
|
|
||||||
要启用 gdbstub,运行 ``make menuconfig`` 并将 :envvar:`CONFIG_ESP32_PANIC` 选项设置为 ``Invoke GDBStub``。
|
要启用 gdbstub,运行 ``make menuconfig`` 并将 :ref:`CONFIG_ESP32_PANIC` 选项设置为 ``Invoke GDBStub``。
|
||||||
|
|
||||||
如果启用此选项并且 IDF Monitor 发现 gdbstub 已加载,它将自动暂停串口监控并使用正确的参数运行 GDB。GDB 退出后,电路板将通过 RTS 串行线路复位(如果已连接)。
|
如果启用此选项并且 IDF Monitor 发现 gdbstub 已加载,它将自动暂停串口监控并使用正确的参数运行 GDB。GDB 退出后,电路板将通过 RTS 串行线路复位(如果已连接)。
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ ESP-IDF 的 :idf:`examples` 目录下有一系列示例工程,都可以按照
|
||||||
e<><65><EFBFBD>)(Xn@<40>y.!<21><>(<28>PW+)<29><>Hn9a/9<>!<21>t5<74><35>P<EFBFBD>~<7E>k<EFBFBD><6B>e<EFBFBD>ea<65>5<EFBFBD>jA
|
e<><65><EFBFBD>)(Xn@<40>y.!<21><>(<28>PW+)<29><>Hn9a/9<>!<21>t5<74><35>P<EFBFBD>~<7E>k<EFBFBD><6B>e<EFBFBD>ea<65>5<EFBFBD>jA
|
||||||
~zY<7A><59>Y(1<>,1<15><> e<><65><EFBFBD>)(Xn@<40>y.!Dr<44>zY(<28>jpi<70>|<7C>+z5Ymvp
|
~zY<7A><59>Y(1<>,1<15><> e<><65><EFBFBD>)(Xn@<40>y.!Dr<44>zY(<28>jpi<70>|<7C>+z5Ymvp
|
||||||
|
|
||||||
或者监视器程序启动失败,那么可能你的开发板用的是 26 MHz 晶振,而 ESP-IDF 默认的是 40 MHz 晶振。请退出监视器,回到 :ref:`配置 <get-started-configure>`,将 :envvar:`CONFIG_ESP32_XTAL_FREQ_SEL` 改为 26 MHz,然后再次 :ref:`编译和烧写 <get-started-build-flash>`。请在 ``make menuconfig`` 的 Component config --> ESP32-specific --> Main XTAL frequency 中配置。
|
或者监视器程序启动失败,那么可能你的开发板用的是 26 MHz 晶振,而 ESP-IDF 默认的是 40 MHz 晶振。请退出监视器,回到 :ref:`配置 <get-started-configure>`,将 :ref:`CONFIG_ESP32_XTAL_FREQ_SEL` 改为 26 MHz,然后再次 :ref:`编译和烧写 <get-started-build-flash>`。请在 ``make menuconfig`` 的 Component config --> ESP32-specific --> Main XTAL frequency 中配置。
|
||||||
|
|
||||||
要一次性执行 ``make flash`` 和 ``make monitor``,输入 ``make flash monitor``。参考文档 :doc:`IDF Monitor <idf-monitor>` 里的快捷键和更多内容。
|
要一次性执行 ``make flash`` 和 ``make monitor``,输入 ``make flash monitor``。参考文档 :doc:`IDF Monitor <idf-monitor>` 里的快捷键和更多内容。
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import kconfiglib
|
import kconfiglib
|
||||||
|
|
||||||
# Indentation to be used in the generated file
|
# Indentation to be used in the generated file
|
||||||
|
@ -40,6 +41,11 @@ def write_docs(config, filename):
|
||||||
with open(filename, "w") as f:
|
with open(filename, "w") as f:
|
||||||
config.walk_menu(lambda node: write_menu_item(f, node))
|
config.walk_menu(lambda node: write_menu_item(f, node))
|
||||||
|
|
||||||
|
def node_is_menu(node):
|
||||||
|
try:
|
||||||
|
return node.item == kconfiglib.MENU or node.is_menuconfig
|
||||||
|
except AttributeError:
|
||||||
|
return False # not all MenuNodes have is_menuconfig for some reason
|
||||||
|
|
||||||
def get_breadcrumbs(node):
|
def get_breadcrumbs(node):
|
||||||
# this is a bit wasteful as it recalculates each time, but still...
|
# this is a bit wasteful as it recalculates each time, but still...
|
||||||
|
@ -47,12 +53,26 @@ def get_breadcrumbs(node):
|
||||||
node = node.parent
|
node = node.parent
|
||||||
while node.parent:
|
while node.parent:
|
||||||
if node.prompt:
|
if node.prompt:
|
||||||
result = [ node.prompt[0] ] + result
|
result = [ ":ref:`%s`" % get_link_anchor(node) ] + result
|
||||||
node = node.parent
|
node = node.parent
|
||||||
return " > ".join(result)
|
return " > ".join(result)
|
||||||
|
|
||||||
|
def get_link_anchor(node):
|
||||||
|
try:
|
||||||
|
return "CONFIG_%s" % node.item.name
|
||||||
|
except AttributeError:
|
||||||
|
assert(node_is_menu(node)) # only menus should have no item.name
|
||||||
|
|
||||||
|
# for menus, build a link anchor out of the parents
|
||||||
|
result = []
|
||||||
|
while node.parent:
|
||||||
|
if node.prompt:
|
||||||
|
result = [ re.sub(r"[^a-zA-z0-9]+", "-", node.prompt[0]) ] + result
|
||||||
|
node = node.parent
|
||||||
|
result = "-".join(result).lower()
|
||||||
|
return result
|
||||||
|
|
||||||
def get_heading_level(node):
|
def get_heading_level(node):
|
||||||
# bit wasteful also
|
|
||||||
result = INITIAL_HEADING_LEVEL
|
result = INITIAL_HEADING_LEVEL
|
||||||
node = node.parent
|
node = node.parent
|
||||||
while node.parent:
|
while node.parent:
|
||||||
|
@ -71,42 +91,41 @@ def format_rest_text(text, indent):
|
||||||
text += '\n'
|
text += '\n'
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def write_menu_item(f, node):
|
def node_should_write(node):
|
||||||
if not node.prompt:
|
if not node.prompt:
|
||||||
return # Don't do anything for invisible menu items
|
return False # Don't do anything for invisible menu items
|
||||||
|
|
||||||
if isinstance(node.parent.item, kconfiglib.Choice):
|
if isinstance(node.parent.item, kconfiglib.Choice):
|
||||||
return # Skip choice nodes, they are handled as part of the parent (see below)
|
return False # Skip choice nodes, they are handled as part of the parent (see below)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def write_menu_item(f, node):
|
||||||
|
if not node_should_write(node):
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
name = node.item.name
|
name = node.item.name
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
name = None
|
name = None
|
||||||
|
|
||||||
try:
|
is_menu = node_is_menu(node)
|
||||||
is_menu = node.item == kconfiglib.MENU or node.is_menuconfig
|
|
||||||
except AttributeError:
|
|
||||||
is_menu = False # not all MenuNodes have is_menuconfig for some reason
|
|
||||||
|
|
||||||
## Heading
|
## Heading
|
||||||
if name:
|
if name:
|
||||||
title = name
|
title = 'CONFIG_%s' % name
|
||||||
# add link target so we can use :ref:`CONFIG_FOO`
|
|
||||||
f.write('.. _CONFIG_%s:\n\n' % name)
|
|
||||||
else:
|
else:
|
||||||
|
# if no symbol name, use the prompt as the heading
|
||||||
title = node.prompt[0]
|
title = node.prompt[0]
|
||||||
|
|
||||||
# if no symbol name, use the prompt as the heading
|
f.write(".. _%s:\n\n" % get_link_anchor(node))
|
||||||
if True or is_menu:
|
|
||||||
f.write('%s\n' % title)
|
f.write('%s\n' % title)
|
||||||
f.write(HEADING_SYMBOLS[get_heading_level(node)] * len(title))
|
f.write(HEADING_SYMBOLS[get_heading_level(node)] * len(title))
|
||||||
f.write('\n\n')
|
f.write('\n\n')
|
||||||
else:
|
|
||||||
f.write('**%s**\n\n\n' % title)
|
|
||||||
|
|
||||||
if name:
|
if name:
|
||||||
f.write('%s%s\n\n' % (INDENT, node.prompt[0]))
|
f.write('%s%s\n\n' % (INDENT, node.prompt[0]))
|
||||||
f.write('%s:emphasis:`Found in: %s`\n\n' % (INDENT, get_breadcrumbs(node)))
|
f.write('%s:emphasis:`Found in:` %s\n\n' % (INDENT, get_breadcrumbs(node)))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if node.help:
|
if node.help:
|
||||||
|
@ -131,6 +150,21 @@ def write_menu_item(f, node):
|
||||||
|
|
||||||
f.write('\n\n')
|
f.write('\n\n')
|
||||||
|
|
||||||
|
if is_menu:
|
||||||
|
# enumerate links to child items
|
||||||
|
first = True
|
||||||
|
child = node.list
|
||||||
|
while child:
|
||||||
|
try:
|
||||||
|
if node_should_write(child):
|
||||||
|
if first:
|
||||||
|
f.write("Contains:\n\n")
|
||||||
|
first = False
|
||||||
|
f.write('- :ref:`%s`\n' % get_link_anchor(child))
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
child = child.next
|
||||||
|
f.write('\n')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("Run this via 'confgen.py --output doc FILENAME'")
|
print("Run this via 'confgen.py --output doc FILENAME'")
|
||||||
|
|
Loading…
Reference in a new issue