Skip to content

Commit 1953af4

Browse files
committed
Merge branch 'doc/c3_system_api' into 'master'
docs: update system api reference chapters for C3 Closes IDF-2327 and IDF-2320 See merge request espressif/esp-idf!12730
2 parents 5b4132c + 91439e3 commit 1953af4

File tree

18 files changed

+131
-105
lines changed

18 files changed

+131
-105
lines changed

components/esp_timer/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ menu "High resolution timer (esp_timer)"
6363
- "LAC timer of Timer Group 0" implementation is simpler, and has smaller
6464
run time overhead because software handling of timer overflow is not needed.
6565

66-
- "SYSTIMER" implementation is similar to "LAC timer of Timer Group 0" but for ESP32-S2 chip.
66+
- "SYSTIMER" implementation is similar to "LAC timer of Timer Group 0" but for non ESP32 chips.
6767

6868
config ESP_TIMER_IMPL_FRC2
6969
bool "FRC2 (legacy) timer"

components/soc/esp32c3/include/soc/soc_caps.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66
#pragma once
77

8-
#define SOC_CPU_CORES_NUM 1
9-
#define SOC_GDMA_SUPPORTED 1
10-
#define SOC_TWAI_SUPPORTED 1
11-
#define SOC_BT_SUPPORTED 1
12-
#define SOC_DIG_SIGN_SUPPORTED 1
13-
#define SOC_HMAC_SUPPORTED 1
8+
#define SOC_CPU_CORES_NUM 1
9+
#define SOC_GDMA_SUPPORTED 1
10+
#define SOC_TWAI_SUPPORTED 1
11+
#define SOC_BT_SUPPORTED 1
12+
#define SOC_DIG_SIGN_SUPPORTED 1
13+
#define SOC_HMAC_SUPPORTED 1
14+
#define SOC_ASYNC_MEMCPY_SUPPORTED 1
1415

1516
/*-------------------------- DAC CAPS ----------------------------------------*/
1617
#define SOC_DAC_PERIPH_NUM 0

components/soc/esp32s2/include/soc/soc_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#define SOC_CCOMP_TIMER_SUPPORTED 1
5151
#define SOC_DIG_SIGN_SUPPORTED 1
5252
#define SOC_HMAC_SUPPORTED 1
53+
#define SOC_ASYNC_MEMCPY_SUPPORTED 1
5354
#define SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS 3
5455

5556
#define SOC_CACHE_SUPPORT_WRAP 1

components/soc/esp32s3/include/soc/soc_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define SOC_CCOMP_TIMER_SUPPORTED 1
2020
#define SOC_DIG_SIGN_SUPPORTED 1
2121
#define SOC_HMAC_SUPPORTED 1
22+
#define SOC_ASYNC_MEMCPY_SUPPORTED 1
2223
#define SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS 3
2324

2425

docs/conf_common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@
169169

170170
RISCV_COPROC_DOCS = ['api-guides/ulp-risc-v.rst',]
171171

172-
XTENSA_DOCS = ['api-guides/hlinterrupts.rst']
172+
XTENSA_DOCS = ['api-guides/hlinterrupts.rst',
173+
'api-reference/system/perfmon.rst']
173174

174175
RISCV_DOCS = []
175176

@@ -211,6 +212,7 @@
211212
'SOC_RISCV_COPROC_SUPPORTED':RISCV_COPROC_DOCS,
212213
'SOC_DIG_SIGN_SUPPORTED':['api-reference/peripherals/ds.rst'],
213214
'SOC_HMAC_SUPPORTED':['api-reference/peripherals/hmac.rst'],
215+
'SOC_ASYNC_MEMCPY_SUPPORTED':['api-reference/system/async_memcpy.rst'],
214216
'CONFIG_IDF_TARGET_ARCH_XTENSA':XTENSA_DOCS,
215217
'CONFIG_IDF_TARGET_ARCH_RISCV':RISCV_DOCS,
216218
'esp32':ESP32_DOCS,

docs/en/api-reference/system/app_image_format.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ You can also see the information on segments in the IDF logs while your applicat
6262

6363
For more details on the type of memory segments and their address ranges, see *{IDF_TARGET_NAME} Technical Reference Manual* > *System and Memory* > *Embedded Memory* [`PDF <{IDF_TARGET_TRM_EN_URL}#sysmem>`__].
6464

65-
.. only:: esp32s2
65+
.. only:: esp32s2 or esp32c3
6666

6767
For more details on the type of memory segments and their address ranges, see *{IDF_TARGET_NAME} Technical Reference Manual* > *System and Memory* > *Internal Memory* [`PDF <{IDF_TARGET_TRM_EN_URL}#sysmem>`__].
6868

docs/en/api-reference/system/console.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Line editing
1919

2020
Line editing feature lets users compose commands by typing them, erasing symbols using 'backspace' key, navigating within the command using left/right keys, navigating to previously typed commands using up/down keys, and performing autocompletion using 'tab' key.
2121

22-
.. note::
22+
.. note::
2323

24-
This feature relies on ANSI escape sequence support in the terminal application. As such, serial monitors which display raw UART data can not be used together with the line editing library. If you see ``[6n`` or similar escape sequence when running :example:`system/console` example instead of a command prompt (e.g. ``esp> ``), it means that the serial monitor does not support escape sequences. Programs which are known to work are GNU screen, minicom, and idf_monitor.py (which can be invoked using ``idf.py monitor`` from project directory).
24+
This feature relies on ANSI escape sequence support in the terminal application. As such, serial monitors which display raw UART data can not be used together with the line editing library. If you see ``[6n`` or similar escape sequence when running :example:`system/console` example instead of a command prompt (e.g. ``esp>`` ), it means that the serial monitor does not support escape sequences. Programs which are known to work are GNU screen, minicom, and idf_monitor.py (which can be invoked using ``idf.py monitor`` from project directory).
2525

2626
Here is an overview of functions provided by `linenoise`_ library.
2727

@@ -148,7 +148,7 @@ Initialize console REPL environment
148148

149149
To establish a basic REPL environment, ``console`` component provides several useful APIs, combining those functions described above.
150150

151-
In a typical application, you only need to call :cpp:func:`esp_console_new_repl_uart` to initialize the REPL environment based on UART device, including driver install, basic console configuration, spawning a thread to do REPL task and register several useful commands (e.g. `help`).
151+
In a typical application, you only need to call :cpp:func:`esp_console_new_repl_uart` to initialize the REPL environment based on UART device, including driver install, basic console configuration, spawning a thread to do REPL task and register several useful commands (e.g. `help`).
152152

153153
After that, you can register your own commands with :cpp:func:`esp_console_cmd_register`. The REPL environment keeps in init state until you call :cpp:func:`esp_console_start_repl`.
154154

docs/en/api-reference/system/esp_https_ota.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ can be set to lower value which is not possible without enabling this configurat
4242
Default value of mbedTLS Rx buffer size is set to 16K. By using partial_http_download with max_http_request_size of 4K,
4343
size of mbedTLS Rx buffer can be reduced to 4K. With this confiuration, memory saving of around 12K is expected.
4444

45-
.. only:: esp32
45+
Signature Verification
46+
----------------------
4647

47-
Signature Verification
48-
----------------------
49-
50-
For additional security, signature of OTA firmware images can be verified. For that, refer :ref:`secure-ota-updates`
48+
For additional security, signature of OTA firmware images can be verified. For that, refer :ref:`secure-ota-updates`
5149

5250
API Reference
5351
-------------

docs/en/api-reference/system/esp_pthread.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Overview
55
--------
66

77
This module offers Espressif specific extensions to the pthread library that can be used to influence the behaviour of pthreads. Currently the following configuration can be tuned:
8+
89
* Stack size of the pthreads
910
* Priority of the created pthreads
1011
* Inheriting this configuration across threads
@@ -35,9 +36,9 @@ Example to tune the stack size of the pthread:
3536
The API can also be used for inheriting the settings across threads. For example:
3637

3738
.. code-block:: c
38-
39+
3940
void * my_thread2(void * p)
40-
{
41+
{
4142
/* This thread will inherit the stack size of 4K */
4243
printf("In my_thread2\n");
4344

docs/en/api-reference/system/esp_timer.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ An interrupt level of the handler depends on the :ref:`CONFIG_ESP_TIMER_INTERRUP
1515

1616
``esp_timer`` set of APIs provides one-shot and periodic timers, microsecond time resolution, and 64-bit range.
1717

18-
Internally, ``esp_timer`` uses a 64-bit hardware timer :ref:`CONFIG_ESP_TIMER_IMPL`:
18+
Internally, ``esp_timer`` uses a 64-bit hardware timer, where the implemention depends on :ref:`CONFIG_ESP_TIMER_IMPL`. Available options are:
1919

20-
- LAC timer (ESP32)
21-
- (legacy) FRC2 timer (ESP32)
22-
- SYSTIMER for (ESP32-S2)
20+
.. list::
2321

24-
.. note: The FRC2 is a legacy option for ESP32 until v4.2, a 32-bit hardware timer was used. Starting at v4.2, use the new LAC timer option instead, it has a simpler implementation, and has smaller run time overhead because software handling of timer overflow is not needed.
22+
:esp32: - LAC timer
23+
:esp32: - (legacy) FRC2 timer
24+
:not esp32: - SYSTIMER
25+
26+
.. only:: esp32
27+
28+
.. note:: The FRC2 is a legacy option for ESP32 until v4.2, a 32-bit hardware timer was used. Starting at v4.2, use the new LAC timer option instead, it has a simpler implementation, and has smaller run time overhead because software handling of timer overflow is not needed.
2529

2630
Timer callbacks can dispatched by two methods:
2731

@@ -59,7 +63,7 @@ Callback functions
5963

6064
.. note: Keep the callback functions as short as possible otherwise it will affect all timers.
6165
62-
Timer callbacks which are processed by ``ESP_TIMER_ISR`` method should not have inside the context switch call - ``portYIELD_FROM_ISR()`` instead of this use the :cpp:func:`esp_timer_isr_dispatch_need_yield` function.
66+
Timer callbacks which are processed by ``ESP_TIMER_ISR`` method should not call the context switch call - ``portYIELD_FROM_ISR()``, instead of this you should use the :cpp:func:`esp_timer_isr_dispatch_need_yield` function.
6367
The context switch will be done after all ISR dispatch timers have been processed, if required by the system.
6468

6569
esp_timer during the light sleep

docs/en/api-reference/system/heap_debug.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,13 @@ To gather and analyse heap trace do the following on the host:
304304

305305
tb heap_trace_start
306306
commands
307-
mon esp32 sysview start file:///tmp/heap.svdat
307+
mon esp sysview start file:///tmp/heap.svdat
308308
c
309309
end
310310

311311
tb heap_trace_stop
312312
commands
313-
mon esp32 sysview stop
313+
mon esp sysview stop
314314
end
315315

316316
c

docs/en/api-reference/system/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ System API
66

77
App image format <app_image_format>
88
Application Level Tracing <app_trace>
9-
:esp32s2: Async Memory Copy <async_memcpy>
9+
:SOC_ASYNC_MEMCPY_SUPPORTED: Async Memory Copy <async_memcpy>
1010
Console Component <console>
1111
eFuse Manager <efuse>
1212
Error Codes and Helper Functions <esp_err>
@@ -19,13 +19,13 @@ System API
1919
Heap Memory Debugging <heap_debug>
2020
High Resolution Timer <esp_timer>
2121
:esp32: Himem (large external SPI RAM) API <himem>
22-
:esp32: Inter-Processor Call <ipc>
22+
:not CONFIG_FREERTOS_UNICORE: Inter-Processor Call <ipc>
2323
Call function with external stack <esp_function_with_shared_stack>
2424
Interrupt Allocation <intr_alloc>
2525
Logging <log>
2626
Miscellaneous System APIs <system>
2727
Over The Air Updates (OTA) <ota>
28-
Performance Monitor <perfmon>
28+
:CONFIG_IDF_TARGET_ARCH_XTENSA: Performance Monitor <perfmon>
2929
Power Management <power_management>
3030
Sleep Modes <sleep_modes>
3131
Watchdogs <wdts>

docs/en/api-reference/system/intr_alloc.rst

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ Overview
66

77
.. only:: esp32
88

9-
The {IDF_TARGET_NAME} has two cores, with 32 interrupts each. Each interrupt has a certain priority level, most (but not all) interrupts are connected
10-
to the interrupt mux. Because there are more interrupt sources than interrupts, sometimes it makes sense to share an interrupt in
11-
multiple drivers. The esp_intr_alloc abstraction exists to hide all these implementation details.
9+
The {IDF_TARGET_NAME} has two cores, with 32 interrupts each. Each interrupt has a certain priority level, most (but not all) interrupts are connected to the interrupt mux.
1210

1311
.. only:: esp32s2
1412

15-
The {IDF_TARGET_NAME} has one core, with 32 interrupts. Each interrupt has a certain priority level, most (but not all) interrupts are connected
16-
to the interrupt mux. Because there are more interrupt sources than interrupts, sometimes it makes sense to share an interrupt in
17-
multiple drivers. The esp_intr_alloc abstraction exists to hide all these implementation details.
13+
The {IDF_TARGET_NAME} has one core, with 32 interrupts. Each interrupt has a certain priority level, most (but not all) interrupts are connected to the interrupt mux.
1814

19-
A driver can allocate an interrupt for a certain peripheral by calling esp_intr_alloc (or esp_intr_alloc_sintrstatus). It can use
15+
.. only:: esp32c3
16+
17+
The {IDF_TARGET_NAME} has one core, with 31 interrupts. Each interrupt has a programmable priority level.
18+
19+
Because there are more interrupt sources than interrupts, sometimes it makes sense to share an interrupt in multiple drivers. The :cpp:func:`esp_intr_alloc` abstraction exists to hide all these implementation details.
20+
21+
A driver can allocate an interrupt for a certain peripheral by calling :cpp:func:`esp_intr_alloc` (or :cpp:func:`esp_intr_alloc_intrstatus`). It can use
2022
the flags passed to this function to set the type of interrupt allocated, specifying a specific level or trigger method. The
2123
interrupt allocation code will then find an applicable interrupt, use the interrupt mux to hook it up to the peripheral, and
2224
install the given interrupt handler and ISR to it.
@@ -37,48 +39,50 @@ interrupt for DevA is still pending, but because the int line never went low (De
3739
even when the int for DevB was cleared) the interrupt is never serviced.)
3840

3941

40-
Multicore issues
41-
----------------
42+
.. only:: CONFIG_IDF_TARGET_ARCH_XTENSA
43+
44+
Multicore issues
45+
----------------
4246

43-
Peripherals that can generate interrupts can be divided in two types:
47+
Peripherals that can generate interrupts can be divided in two types:
4448

45-
- External peripherals, within the {IDF_TARGET_NAME} but outside the Xtensa cores themselves. Most {IDF_TARGET_NAME} peripherals are of this type.
46-
- Internal peripherals, part of the Xtensa CPU cores themselves.
49+
- External peripherals, within the {IDF_TARGET_NAME} but outside the Xtensa cores themselves. Most {IDF_TARGET_NAME} peripherals are of this type.
50+
- Internal peripherals, part of the Xtensa CPU cores themselves.
4751

48-
Interrupt handling differs slightly between these two types of peripherals.
52+
Interrupt handling differs slightly between these two types of peripherals.
4953

50-
Internal peripheral interrupts
51-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
Internal peripheral interrupts
55+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5256

53-
Each Xtensa CPU core has its own set of six internal peripherals:
57+
Each Xtensa CPU core has its own set of six internal peripherals:
5458

55-
- Three timer comparators
56-
- A performance monitor
57-
- Two software interrupts.
59+
- Three timer comparators
60+
- A performance monitor
61+
- Two software interrupts.
5862

59-
Internal interrupt sources are defined in esp_intr_alloc.h as ``ETS_INTERNAL_*_INTR_SOURCE``.
63+
Internal interrupt sources are defined in esp_intr_alloc.h as ``ETS_INTERNAL_*_INTR_SOURCE``.
6064

61-
These peripherals can only be configured from the core they are associated with. When generating an interrupt,
62-
the interrupt they generate is hard-wired to their associated core; it's not possible to have e.g. an internal
63-
timer comparator of one core generate an interrupt on another core. That is why these sources can only be managed
64-
using a task running on that specific core. Internal interrupt sources are still allocatable using esp_intr_alloc
65-
as normal, but they cannot be shared and will always have a fixed interrupt level (namely, the one associated in
66-
hardware with the peripheral).
65+
These peripherals can only be configured from the core they are associated with. When generating an interrupt,
66+
the interrupt they generate is hard-wired to their associated core; it's not possible to have e.g. an internal
67+
timer comparator of one core generate an interrupt on another core. That is why these sources can only be managed
68+
using a task running on that specific core. Internal interrupt sources are still allocatable using esp_intr_alloc
69+
as normal, but they cannot be shared and will always have a fixed interrupt level (namely, the one associated in
70+
hardware with the peripheral).
6771

68-
External Peripheral Interrupts
69-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72+
External Peripheral Interrupts
73+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7074

71-
The remaining interrupt sources are from external peripherals. These are defined in soc/soc.h as ``ETS_*_INTR_SOURCE``.
75+
The remaining interrupt sources are from external peripherals. These are defined in soc/soc.h as ``ETS_*_INTR_SOURCE``.
7276

73-
Non-internal interrupt slots in both CPU cores are wired to an interrupt multiplexer, which can be used to
74-
route any external interrupt source to any of these interrupt slots.
77+
Non-internal interrupt slots in both CPU cores are wired to an interrupt multiplexer, which can be used to
78+
route any external interrupt source to any of these interrupt slots.
7579

76-
- Allocating an external interrupt will always allocate it on the core that does the allocation.
77-
- Freeing an external interrupt must always happen on the same core it was allocated on.
78-
- Disabling and enabling external interrupts from another core is allowed.
79-
- Multiple external interrupt sources can share an interrupt slot by passing ``ESP_INTR_FLAG_SHARED`` as a flag to esp_intr_alloc().
80+
- Allocating an external interrupt will always allocate it on the core that does the allocation.
81+
- Freeing an external interrupt must always happen on the same core it was allocated on.
82+
- Disabling and enabling external interrupts from another core is allowed.
83+
- Multiple external interrupt sources can share an interrupt slot by passing ``ESP_INTR_FLAG_SHARED`` as a flag to esp_intr_alloc().
8084

81-
Care should be taken when calling esp_intr_alloc() from a task which is not pinned to a core. During task switching, these tasks can migrate between cores. Therefore it is impossible to tell which CPU the interrupt is allocated on, which makes it difficult to free the interrupt handle and may also cause debugging difficulties. It is advised to use xTaskCreatePinnedToCore() with a specific CoreID argument to create tasks that will allocate interrupts. In the case of internal interrupt sources, this is required.
85+
Care should be taken when calling esp_intr_alloc() from a task which is not pinned to a core. During task switching, these tasks can migrate between cores. Therefore it is impossible to tell which CPU the interrupt is allocated on, which makes it difficult to free the interrupt handle and may also cause debugging difficulties. It is advised to use xTaskCreatePinnedToCore() with a specific CoreID argument to create tasks that will allocate interrupts. In the case of internal interrupt sources, this is required.
8286

8387
IRAM-Safe Interrupt Handlers
8488
----------------------------

docs/en/api-reference/system/ipc.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ Inter-Processor Call
44
Overview
55
--------
66

7-
Due to the dual core nature of the ESP32, there are instances where a certain
7+
Due to the dual core nature of the {IDF_TARGET_NAME}, there are instances where a certain
88
function must be run in the context of a particular core (e.g. allocating
9-
ISR to an interrupt source of a particular core). The IPC (Inter-Processor
9+
ISR to an interrupt source of a particular core). The IPC (Inter-Processor
1010
Call) feature allows for the execution of functions on a particular CPU.
1111

12-
A given function can be executed on a particular core by calling
13-
:cpp:func:`esp_ipc_call` or :cpp:func:`esp_ipc_call_blocking`. IPC is
12+
A given function can be executed on a particular core by calling
13+
:cpp:func:`esp_ipc_call` or :cpp:func:`esp_ipc_call_blocking`. IPC is
1414
implemented via two high priority FreeRTOS tasks pinned to each CPU known as
15-
the IPC Tasks. The two IPC Tasks remain inactive (blocked) until
16-
:cpp:func:`esp_ipc_call` or :cpp:func:`esp_ipc_call_blocking` is called. When
17-
an IPC Task of a particular core is unblocked, it will preempt the current
18-
running task on that core and execute a given function.
15+
the IPC Tasks. The two IPC Tasks remain inactive (blocked) until
16+
:cpp:func:`esp_ipc_call` or :cpp:func:`esp_ipc_call_blocking` is called. When
17+
an IPC Task of a particular core is unblocked, it will preempt the current
18+
running task on that core and execute a given function.
1919

2020
Usage
2121
-----
2222

2323
:cpp:func:`esp_ipc_call` unblocks the IPC task on a particular core to execute
2424
a given function. The task that calls :cpp:func:`esp_ipc_call` will be blocked
25-
until the IPC Task begins execution of the given function.
25+
until the IPC Task begins execution of the given function.
2626
:cpp:func:`esp_ipc_call_blocking` is similar but will block the calling task
2727
until the IPC Task has completed execution of the given function.
28-
29-
Functions executed by IPCs must be functions of type
30-
`void func(void *arg)`. To run more complex functions which require a larger
31-
stack, the IPC tasks' stack size can be configured by modifying
28+
29+
Functions executed by IPCs must be functions of type
30+
`void func(void *arg)`. To run more complex functions which require a larger
31+
stack, the IPC tasks' stack size can be configured by modifying
3232
:ref:`CONFIG_ESP_IPC_TASK_STACK_SIZE` in `menuconfig`. The IPC API is protected by a
3333
mutex hence simultaneous IPC calls are not possible.
3434

0 commit comments

Comments
 (0)