Skip to content

Commit 8033251

Browse files
committed
Add mention of ESP32-S2/S3 differences to docs
1 parent f50ac6c commit 8033251

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

README.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The following features are supported:
3131

3232
* the entire `ESP32 ULP instruction set <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/ulp_instruction_set.html>`_
3333
* the entire `ESP32-S2 ULP instruction set <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/system/ulp_instruction_set.html>`_
34-
(this also covers the ESP32-S3) [#f1]_
34+
(this also covers the ESP32-S3) [#f1]_ [#f2]_
3535
* constants defined with ``.set``
3636
* constants defined with ``#define``
3737
* expressions in assembly code and constant definitions
@@ -44,6 +44,17 @@ The following features are supported:
4444
select the ``esp32s2`` cpu (`see docs </docs/index.rst>`_) when assembling code for
4545
use on an ESP32-S2/S3.
4646
47+
.. [#f2] Note: The ESP32-S2 and ESP32-S3 have the same ULP binary format, but the peripheral
48+
register addresses (those accessed with REG_RD and REG_WR) are different. For best
49+
results, use the correct peripheral register addresses for the specific variant you
50+
are working with. The assembler (when used with ``cpu=esp32s2``) will accept
51+
addresses for any of the 3 variants, because they are translated into relative
52+
offsets anyway and many registers live at the same relative offset on all 3 variants.
53+
This conveniently means that the same assembly code can assembled unmodified for each
54+
variant and produce a correctly working binary - as long as only peripheral registers
55+
are used, which have the same relative offset across the variants. Use with care!
56+
57+
4758
Quick start
4859
-----------
4960

docs/preprocess.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ are not needed on the device either.)
9595
micropython -m esp32_ulp.parse_to_db \
9696
esp-idf/components/soc/esp32/include/soc/{soc,soc_ulp,rtc_cntl_reg,rtc_io_reg,sens_reg}.h
9797
98+
99+
.. warning::
100+
101+
`:warning:` Ensure that you include the header files for the correct
102+
variant you are working with. In the example code above, simply switch
103+
``esp32`` to ``esp32s2`` or ``esp32s3`` in the path to the include files.
104+
105+
There are subtle differences across the ESP32 variants such as which
106+
constants are available or the value of certain constants. For example,
107+
peripheral register addresses differ between the 3 variants even though
108+
many constants for peripheral registers are available on all 3 variants.
109+
Other constants such as those relating to the HOLD functionality of touch
110+
pads are only available on the original ESP32.
111+
112+
98113
2. Using the defines database during preprocessing
99114

100115
The preprocessor will automatically use a defines database, when using the
@@ -108,6 +123,7 @@ are not needed on the device either.)
108123
or instantiate the ``Preprocessor`` class directly, without passing it a
109124
DefinesDB instance via ``use_db``.
110125

126+
111127
Design choices
112128
--------------
113129

0 commit comments

Comments
 (0)