| <!-- |
| Documentation/_templates/layout.html |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. The |
| ASF licenses this file to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance with the |
| License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| License for the specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en"> |
| <head> |
| <meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>Espressif ESP32-S2 — NuttX latest documentation</title> |
| <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/custom.css" /> |
| |
| |
| <link rel="shortcut icon" href="../../../_static/favicon.ico"/> |
| <script src="../../../_static/jquery.js"></script> |
| <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script> |
| <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script> |
| <script src="../../../_static/doctools.js"></script> |
| <script src="../../../_static/sphinx_highlight.js"></script> |
| <script src="../../../_static/clipboard.min.js"></script> |
| <script src="../../../_static/copybutton.js"></script> |
| <script src="../../../_static/js/theme.js"></script> |
| <link rel="index" title="Index" href="../../../genindex.html" /> |
| <link rel="search" title="Search" href="../../../search.html" /> |
| <link rel="next" title="ESP32-S2-Kaluga-1 Kit v1.3" href="boards/esp32s2-kaluga-1/index.html" /> |
| <link rel="prev" title="ESP-WROVER-KIT" href="../esp32/boards/esp32-wrover-kit/index.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| <div class="wy-grid-for-nav"> |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| <a href="../../../index.html" class="icon icon-home"> NuttX |
| |
| |
| |
| </a> |
| |
| <!-- this version selector is quite ugly, should be probably replaced by something |
| more modern --> |
| |
| <div class="version-selector"> |
| <select onchange="javascript:location.href = this.value;"> |
| |
| <option value="../../../../latest" selected="selected">latest</option> |
| |
| <option value="../../../../10.0.0" >10.0.0</option> |
| |
| <option value="../../../../10.0.1" >10.0.1</option> |
| |
| <option value="../../../../10.1.0" >10.1.0</option> |
| |
| <option value="../../../../10.2.0" >10.2.0</option> |
| |
| <option value="../../../../10.3.0" >10.3.0</option> |
| |
| <option value="../../../../11.0.0" >11.0.0</option> |
| |
| <option value="../../../../12.0.0" >12.0.0</option> |
| |
| <option value="../../../../12.1.0" >12.1.0</option> |
| |
| <option value="../../../../12.2.0" >12.2.0</option> |
| |
| <option value="../../../../12.2.1" >12.2.1</option> |
| |
| <option value="../../../../12.3.0" >12.3.0</option> |
| |
| <option value="../../../../12.4.0" >12.4.0</option> |
| |
| <option value="../../../../12.5.0" >12.5.0</option> |
| |
| <option value="../../../../12.5.1" >12.5.1</option> |
| |
| <option value="../../../../12.6.0" >12.6.0</option> |
| |
| <option value="../../../../12.7.0" >12.7.0</option> |
| |
| <option value="../../../../12.8.0" >12.8.0</option> |
| |
| <option value="../../../../12.9.0" >12.9.0</option> |
| |
| <option value="../../../../12.10.0" >12.10.0</option> |
| |
| <option value="../../../../12.11.0" >12.11.0</option> |
| |
| </select> |
| </div> |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> |
| <p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../../index.html">Home</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../introduction/index.html">Introduction</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../quickstart/index.html">Getting Started</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../contributing/index.html">Contributing</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Supported Platforms</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../../arm/index.html">ARM</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../arm64/index.html">ARM64</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../avr/index.html">Microchip AVR</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../ceva/index.html">CEVA</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../hc/index.html">HC</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../mips/index.html">MIPS</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../misco/index.html">Misoc</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../or1k/index.html">OpenRISC</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../renesas/index.html">Renesas</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../risc-v/index.html">RISC-V</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../sim/index.html">Simulators</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../sim/network_linux.html">Network Support on Linux</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../sim/network_vpnkit.html">Network support with VPNKit</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../sparc/index.html">SPARC</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../tricore/index.html">TriCore</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../x86/index.html">Intel 80x86</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../x86_64/index.html">Intel 80x86_64</a></li> |
| <li class="toctree-l2 current"><a class="reference internal" href="../index.html">Xtensa</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="../esp32/index.html">Espressif ESP32</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#">Espressif ESP32-S2</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#esp32-s2-toolchain">ESP32-S2 Toolchain</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#the-prebuilt-toolchain-recommended">The prebuilt Toolchain (Recommended)</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#building-from-source">Building from source</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="#building-and-flashing-nuttx">Building and flashing NuttX</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#bootloader-and-partitions">Bootloader and partitions</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#building-and-flashing">Building and Flashing</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="#debugging-with-openocd-and-gdb">Debugging with <code class="docutils literal notranslate"><span class="pre">openocd</span></code> and <code class="docutils literal notranslate"><span class="pre">gdb</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#peripheral-support">Peripheral Support</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#memory-map">Memory Map</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#address-mapping">Address Mapping</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#embedded-memory">Embedded Memory</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#boundary-address-embedded">Boundary Address (Embedded)</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#external-memory">External Memory</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#boundary-address-external">Boundary Address (External)</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#linker-segments">Linker Segments</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="#bit-timers">64-bit Timers</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#watchdog-timers">Watchdog Timers</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#i2s">I2S</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#wi-fi">Wi-Fi</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#wi-fi-softap">Wi-Fi SoftAP</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#secure-boot-and-flash-encryption">Secure Boot and Flash Encryption</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#secure-boot">Secure Boot</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#flash-encryption">Flash Encryption</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#prerequisites">Prerequisites</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#enabling-secure-boot-and-flash-encryption">Enabling Secure Boot and Flash Encryption</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="#supported-boards">Supported Boards</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="boards/esp32s2-kaluga-1/index.html">ESP32-S2-Kaluga-1 Kit v1.3</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="boards/esp32s2-saola-1/index.html">ESP32-S2-Saola-1</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../esp32s3/index.html">Espressif ESP32-S3</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../z16/index.html">Z16</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../z80/index.html">Z80</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../components/index.html">OS Components</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../applications/index.html">Applications</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../implementation/index.html">Implementation Details</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../reference/index.html">API Reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../faq/index.html">FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../guides/index.html">Guides</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../glossary.html">Glossary</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../logos/index.html">NuttX Logos</a></li> |
| </ul> |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../../../index.html">NuttX</a> |
| </nav> |
| |
| <div class="wy-nav-content"> |
| <div class="rst-content"> |
| <div role="navigation" aria-label="Page navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li> |
| <li class="breadcrumb-item"><a href="../../index.html">Supported Platforms</a></li> |
| <li class="breadcrumb-item"><a href="../index.html">Xtensa</a></li> |
| <li class="breadcrumb-item active">Espressif ESP32-S2</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="../../../_sources/platforms/xtensa/esp32s2/index.rst.txt" rel="nofollow"> View page source</a> |
| </li> |
| </ul> |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <section id="espressif-esp32-s2"> |
| <h1>Espressif ESP32-S2<a class="headerlink" href="#espressif-esp32-s2" title="Permalink to this heading"></a></h1> |
| <p>The ESP32-S2 is a series of single-core SoCs from Espressif based on Harvard |
| architecture Xtensa LX7 CPU and with on-chip support for Wi-Fi.</p> |
| <p>All embedded memory, external memory and peripherals are located on the |
| data bus and/or the instruction bus of the CPU. Multiple peripherals in |
| the system can access embedded memory via DMA.</p> |
| <section id="esp32-s2-toolchain"> |
| <h2>ESP32-S2 Toolchain<a class="headerlink" href="#esp32-s2-toolchain" title="Permalink to this heading"></a></h2> |
| <p>The toolchain used to build ESP32-S2 firmware can be either downloaded or built from the sources. |
| It is <strong>highly</strong> recommended to use (download or build) the same toolchain version that is being |
| used by the NuttX CI.</p> |
| <p>Please refer to the Docker |
| <a class="reference external" href="https://github.com/apache/nuttx/tree/master/tools/ci/docker/linux/Dockerfile">container</a> and |
| check for the current compiler version being used. For instance:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>############################################################################### |
| # Build image for tool required by ESP32 builds |
| ############################################################################### |
| FROM nuttx-toolchain-base AS nuttx-toolchain-esp32 |
| # Download the latest ESP32 GCC toolchain prebuilt by Espressif |
| RUN mkdir -p xtensa-esp32-elf-gcc && \ |
| curl -s -L "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" \ |
| | tar -C xtensa-esp32-elf-gcc --strip-components 1 -xJ |
| |
| RUN mkdir -p xtensa-esp32s2-elf-gcc && \ |
| curl -s -L "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" \ |
| | tar -C xtensa-esp32s2-elf-gcc --strip-components 1 -xJ |
| |
| RUN mkdir -p xtensa-esp32s3-elf-gcc && \ |
| curl -s -L "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" \ |
| | tar -C xtensa-esp32s3-elf-gcc --strip-components 1 -xJ |
| </pre></div> |
| </div> |
| <p>For ESP32-S2, the toolchain version is based on GGC 12.2.0 (<code class="docutils literal notranslate"><span class="pre">xtensa-esp32s2-elf-12.2.0_20230208</span></code>)</p> |
| <section id="the-prebuilt-toolchain-recommended"> |
| <h3>The prebuilt Toolchain (Recommended)<a class="headerlink" href="#the-prebuilt-toolchain-recommended" title="Permalink to this heading"></a></h3> |
| <p>First, create a directory to hold the toolchain:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>mkdir<span class="w"> </span>-p<span class="w"> </span>/path/to/your/toolchain/xtensa-esp32s2-elf-gcc |
| </pre></div> |
| </div> |
| <p>Download and extract toolchain:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>curl<span class="w"> </span>-s<span class="w"> </span>-L<span class="w"> </span><span class="s2">"https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz"</span><span class="w"> </span><span class="se">\</span> |
| <span class="p">|</span><span class="w"> </span>tar<span class="w"> </span>-C<span class="w"> </span>xtensa-esp32s2-elf-gcc<span class="w"> </span>--strip-components<span class="w"> </span><span class="m">1</span><span class="w"> </span>-xJ |
| </pre></div> |
| </div> |
| <p>Add the toolchain to your <cite>PATH</cite>:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">echo</span><span class="w"> </span><span class="s2">"export PATH=/path/to/your/toolchain/xtensa-esp32s2-elf-gcc/bin:</span><span class="nv">$PATH</span><span class="s2">"</span><span class="w"> </span>>><span class="w"> </span>~/.bashrc |
| </pre></div> |
| </div> |
| <p>You can edit your shell’s rc files if you don’t use bash.</p> |
| </section> |
| <section id="building-from-source"> |
| <h3>Building from source<a class="headerlink" href="#building-from-source" title="Permalink to this heading"></a></h3> |
| <p>You can also build the toolchain yourself. The steps to |
| build the toolchain with crosstool-NG on Linux are as follows</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/espressif/crosstool-NG.git |
| <span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>crosstool-NG |
| <span class="gp">$ </span>git<span class="w"> </span>submodule<span class="w"> </span>update<span class="w"> </span>--init |
| |
| <span class="gp">$ </span>./bootstrap<span class="w"> </span><span class="o">&&</span><span class="w"> </span>./configure<span class="w"> </span>--enable-local<span class="w"> </span><span class="o">&&</span><span class="w"> </span>make |
| |
| <span class="gp">$ </span>./ct-ng<span class="w"> </span>xtensa-esp32s2-elf |
| <span class="gp">$ </span>./ct-ng<span class="w"> </span>build |
| |
| <span class="gp">$ </span>chmod<span class="w"> </span>-R<span class="w"> </span>u+w<span class="w"> </span>builds/xtensa-esp32s2-elf |
| |
| <span class="gp">$ </span><span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">"crosstool-NG/builds/xtensa-esp32-elf/bin:</span><span class="nv">$PATH</span><span class="s2">"</span> |
| </pre></div> |
| </div> |
| <p>These steps are given in the setup guide in |
| <a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/latest/get-started/linux-setup-scratch.html">ESP-IDF documentation</a>.</p> |
| </section> |
| </section> |
| <section id="building-and-flashing-nuttx"> |
| <h2>Building and flashing NuttX<a class="headerlink" href="#building-and-flashing-nuttx" title="Permalink to this heading"></a></h2> |
| <section id="bootloader-and-partitions"> |
| <h3>Bootloader and partitions<a class="headerlink" href="#bootloader-and-partitions" title="Permalink to this heading"></a></h3> |
| <p>NuttX can boot the ESP32-S2 directly using the so-called “Simple Boot”. An externally-built |
| 2nd stage bootloader is not required in this case as all functions required to boot the device |
| are built within NuttX. Simple boot does not require any specific configuration (it is selectable |
| by default if no other 2nd stage bootloader is used).</p> |
| <p>If other features are required, an externally-built 2nd stage bootloader is needed. The bootloader |
| is built using the <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">bootloader</span></code> command. This command generates the firmware in the |
| <code class="docutils literal notranslate"><span class="pre">nuttx</span></code> folder. The <code class="docutils literal notranslate"><span class="pre">ESPTOOL_BINDIR</span></code> is used in the <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">flash</span></code> command to specify the path |
| to the bootloader. For compatibility among other SoCs and future options of 2nd stage bootloaders, |
| the commands <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">bootloader</span></code> and the <code class="docutils literal notranslate"><span class="pre">ESPTOOL_BINDIR</span></code> option (for the <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">flash</span></code>) can be |
| used even if no externally-built 2nd stage bootloader is being built (they will be ignored if |
| Simple Boot is used, for instance):</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ make bootloader |
| </pre></div> |
| </div> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <p>It is recommended that if this is the first time you are using the board with NuttX to |
| perform a complete SPI FLASH erase.</p> |
| <blockquote> |
| <div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>esptool.py<span class="w"> </span>erase_flash |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </div> |
| </section> |
| <section id="building-and-flashing"> |
| <h3>Building and Flashing<a class="headerlink" href="#building-and-flashing" title="Permalink to this heading"></a></h3> |
| <p>First, make sure that <code class="docutils literal notranslate"><span class="pre">esptool.py</span></code> is installed. This tool is used to convert the ELF to a |
| compatible ESP32-S2 image and to flash the image into the board. |
| It can be installed with: <code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">esptool==4.8.dev4</span></code>.</p> |
| <p>It’s a two-step process where the first converts the ELF file into an ESP32-S2 compatible binary |
| and the second flashes it to the board. These steps are included in the build system and it is |
| possible to build and flash the NuttX firmware simply by running:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ make flash ESPTOOL_PORT=<port> ESPTOOL_BINDIR=./ |
| </pre></div> |
| </div> |
| <p>where <code class="docutils literal notranslate"><span class="pre"><port></span></code> is typically <code class="docutils literal notranslate"><span class="pre">/dev/ttyUSB0</span></code> or similar. <code class="docutils literal notranslate"><span class="pre">ESPTOOL_BINDIR=./</span></code> is the path of the |
| externally-built 2nd stage bootloader and the partition table (if applicable): when built using the |
| <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">bootloader</span></code>, these files are placed into <code class="docutils literal notranslate"><span class="pre">nuttx</span></code> folder. <code class="docutils literal notranslate"><span class="pre">ESPTOOL_BAUD</span></code> is able to |
| change the flash baud rate if desired.</p> |
| </section> |
| </section> |
| <section id="debugging-with-openocd-and-gdb"> |
| <h2>Debugging with <code class="docutils literal notranslate"><span class="pre">openocd</span></code> and <code class="docutils literal notranslate"><span class="pre">gdb</span></code><a class="headerlink" href="#debugging-with-openocd-and-gdb" title="Permalink to this heading"></a></h2> |
| <p>Espressif uses a specific version of OpenOCD to support ESP32-S2: <a class="reference external" href="https://github.com/espressif/">openocd-esp32</a>.</p> |
| <p>Please check <a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/release-v5.1/esp32s2/api-guides/jtag-debugging/index.html#jtag-debugging-building-openocd">Building OpenOCD from Sources</a> |
| for more information on how to build OpenOCD for ESP32-S2.</p> |
| <p>ESP32-S2 has dedicated pins for JTAG debugging. The following pins are used for JTAG debugging:</p> |
| <table class="docutils align-default"> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>ESP32-S2 Pin</p></th> |
| <th class="head"><p>JTAG Signal</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><p>MTDO / GPIO40</p></td> |
| <td><p>TDO</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>MTDI / GPIO41</p></td> |
| <td><p>TDI</p></td> |
| </tr> |
| <tr class="row-even"><td><p>MTCK / GPIO39</p></td> |
| <td><p>TCK</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>MTMS / GPIO42</p></td> |
| <td><p>TMS</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <p>Some boards, like <a class="reference internal" href="boards/esp32s2-kaluga-1/index.html#esp32-s2-kaluga-1-kit-v1-3"><span class="std std-ref">ESP32-S2-Kaluga-1 Kit v1.3</span></a> have a built-in JTAG debugger.</p> |
| <p>Other boards that don’t have any built-in JTAG debugger can be debugged using an external JTAG debugger being connected |
| directly to the ESP32-S2 JTAG pins.</p> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <p>One must configure the USB drivers to enable JTAG communication. Please check |
| <a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/release-v5.1/esp32s2/api-guides/jtag-debugging/configure-ft2232h-jtag.html?highlight=udev#configure-usb-drivers">Configure USB Drivers</a> |
| for configuring the JTAG adapter of the <a class="reference internal" href="boards/esp32s2-kaluga-1/index.html#esp32-s2-kaluga-1-kit-v1-3"><span class="std std-ref">ESP32-S2-Kaluga-1</span></a> board |
| and other FT2232-based JTAG adapters.</p> |
| </div> |
| <p>OpenOCD can then be used:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>openocd -c 'set ESP_RTOS hwthread; set ESP_FLASH_SIZE 0' -f board/esp32s2-kaluga-1.cfg |
| </pre></div> |
| </div> |
| <p>Once OpenOCD is running, you can use GDB to connect to it and debug your application:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>xtensa-esp32s2-elf-gdb -x gdbinit nuttx |
| </pre></div> |
| </div> |
| <p>whereas the content of the <code class="docutils literal notranslate"><span class="pre">gdbinit</span></code> file is:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>target remote :3333 |
| set remote hardware-watchpoint-limit 2 |
| mon reset halt |
| flushregs |
| monitor reset halt |
| thb nsh_main |
| c |
| </pre></div> |
| </div> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <p><code class="docutils literal notranslate"><span class="pre">nuttx</span></code> is the ELF file generated by the build process. Please note that <code class="docutils literal notranslate"><span class="pre">CONFIG_DEBUG_SYMBOLS</span></code> must be enabled in the <code class="docutils literal notranslate"><span class="pre">menuconfig</span></code>.</p> |
| </div> |
| <p>Please refer to <a class="reference internal" href="../../../quickstart/debugging.html"><span class="doc">Debugging</span></a> for more information about debugging techniques.</p> |
| </section> |
| <section id="peripheral-support"> |
| <h2>Peripheral Support<a class="headerlink" href="#peripheral-support" title="Permalink to this heading"></a></h2> |
| <p>The following list indicates the state of peripherals’ support in NuttX:</p> |
| <table class="docutils align-default"> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>Peripheral</p></th> |
| <th class="head"><p>Support</p></th> |
| <th class="head"><p>NOTES</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><p>ADC</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>AES</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>CAN/TWAI</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>DMA</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>eFuse</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>Ethernet</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>GPIO</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>I2C</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>I2S</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>LED_PWM</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>Pulse_CNT</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>RMT</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>RNG</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>RSA</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>RTC</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>SHA</p></td> |
| <td><p>No</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>SPI</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>SPIFLASH</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>SPIRAM</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>Timers</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>Touch</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>UART</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>Watchdog</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>Wifi</p></td> |
| <td><p>Yes</p></td> |
| <td></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="memory-map"> |
| <h2>Memory Map<a class="headerlink" href="#memory-map" title="Permalink to this heading"></a></h2> |
| <section id="address-mapping"> |
| <h3>Address Mapping<a class="headerlink" href="#address-mapping" title="Permalink to this heading"></a></h3> |
| <table class="docutils align-default"> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>BUS TYPE</p></th> |
| <th class="head"><p>START</p></th> |
| <th class="head"><p>LAST</p></th> |
| <th class="head"><p>DESCRIPTION</p></th> |
| <th class="head"><p>NOTES</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><p>.</p></td> |
| <td><p>0x00000000</p></td> |
| <td><p>0x3EFFFFFF</p></td> |
| <td></td> |
| <td><p>Reserved</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>Data</p></td> |
| <td><p>0x3F000000</p></td> |
| <td><p>0x3F3FFFFF</p></td> |
| <td><p>External Memory</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>Data</p></td> |
| <td><p>0x3F400000</p></td> |
| <td><p>0x3F4FFFFF</p></td> |
| <td><p>Peripheral</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>Data</p></td> |
| <td><p>0x3F500000</p></td> |
| <td><p>0x3FF7FFFF</p></td> |
| <td><p>External Memory</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>.</p></td> |
| <td><p>0x3FF80000</p></td> |
| <td><p>0x3FF9DFFF</p></td> |
| <td></td> |
| <td><p>Reserved</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>Data</p></td> |
| <td><p>0x3FF9E000</p></td> |
| <td><p>0x3FFFFFFF</p></td> |
| <td><p>Embedded Memory</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>Instruction</p></td> |
| <td><p>0x40000000</p></td> |
| <td><p>0x40071FFF</p></td> |
| <td><p>Embedded Memory</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>.</p></td> |
| <td><p>0x40072000</p></td> |
| <td><p>0x4007FFFF</p></td> |
| <td></td> |
| <td><p>Reserved</p></td> |
| </tr> |
| <tr class="row-even"><td><p>Instruction</p></td> |
| <td><p>0x40080000</p></td> |
| <td><p>0x407FFFFF</p></td> |
| <td><p>External Memory</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>.</p></td> |
| <td><p>0x40800000</p></td> |
| <td><p>0x4FFFFFFF</p></td> |
| <td></td> |
| <td><p>Reserved</p></td> |
| </tr> |
| <tr class="row-even"><td><p>Data / Instruction</p></td> |
| <td><p>0x50000000</p></td> |
| <td><p>0x50001FFF</p></td> |
| <td><p>Embedded Memory</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>.</p></td> |
| <td><p>0x50002000</p></td> |
| <td><p>0x5FFFFFFF</p></td> |
| <td></td> |
| <td><p>Reserved</p></td> |
| </tr> |
| <tr class="row-even"><td><p>Data / Instruction</p></td> |
| <td><p>0x60000000</p></td> |
| <td><p>0x600BFFFF</p></td> |
| <td><p>Peripheral</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>.</p></td> |
| <td><p>0x600C0000</p></td> |
| <td><p>0x617FFFFF</p></td> |
| <td></td> |
| <td><p>Reserved</p></td> |
| </tr> |
| <tr class="row-even"><td><p>Data / Instruction</p></td> |
| <td><p>0x61800000</p></td> |
| <td><p>0x61803FFF</p></td> |
| <td><p>Peripheral</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>.</p></td> |
| <td><p>0x61804000</p></td> |
| <td><p>0xFFFFFFFF</p></td> |
| <td></td> |
| <td><p>Reserved</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="embedded-memory"> |
| <h3>Embedded Memory<a class="headerlink" href="#embedded-memory" title="Permalink to this heading"></a></h3> |
| <table class="docutils align-default"> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>BUS TYPE</p></th> |
| <th class="head"><p>START</p></th> |
| <th class="head"><p>LAST</p></th> |
| <th class="head"><p>DESCRIPTION</p></th> |
| <th class="head"><p>PERMISSION CONTROL</p></th> |
| <th class="head"><p>NOTES</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><p>Data</p></td> |
| <td><p>0x3FF9E000</p></td> |
| <td><p>0x3FF9FFFF</p></td> |
| <td><p>RTC FAST Memory</p></td> |
| <td><p>YES</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>Data</p></td> |
| <td><p>0x3FFA0000</p></td> |
| <td><p>0x3FFAFFFF</p></td> |
| <td><p>Internal ROM 1</p></td> |
| <td><p>NO</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>Data</p></td> |
| <td><p>0x3FFB0000</p></td> |
| <td><p>0x3FFB7FFF</p></td> |
| <td><p>Internal SRAM 0</p></td> |
| <td><p>YES</p></td> |
| <td><p>DMA</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>Data</p></td> |
| <td><p>0x3FFB8000</p></td> |
| <td><p>0x3FFFFFFF</p></td> |
| <td><p>Internal SRAM 1</p></td> |
| <td><p>YES</p></td> |
| <td><p>DMA</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="boundary-address-embedded"> |
| <h3>Boundary Address (Embedded)<a class="headerlink" href="#boundary-address-embedded" title="Permalink to this heading"></a></h3> |
| <table class="docutils align-default"> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>BUS TYPE</p></th> |
| <th class="head"><p>START</p></th> |
| <th class="head"><p>LAST</p></th> |
| <th class="head"><p>DESCRIPTION</p></th> |
| <th class="head"><p>PERMISSION CONTROL</p></th> |
| <th class="head"><p>NOTES</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><p>Instruction</p></td> |
| <td><p>0x40000000</p></td> |
| <td><p>0x4000FFFF</p></td> |
| <td><p>Internal ROM 0</p></td> |
| <td><p>NO</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>Instruction</p></td> |
| <td><p>0x40010000</p></td> |
| <td><p>0x4001FFFF</p></td> |
| <td><p>Internal ROM 1</p></td> |
| <td><p>NO</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>Instruction</p></td> |
| <td><p>0x40020000</p></td> |
| <td><p>0x40027FFF</p></td> |
| <td><p>Internal SRAM 0</p></td> |
| <td><p>YES</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>Instruction</p></td> |
| <td><p>0x40028000</p></td> |
| <td><p>0x4006FFFF</p></td> |
| <td><p>Internal SRAM 1</p></td> |
| <td><p>YES</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-even"><td><p>Instruction</p></td> |
| <td><p>0x40070000</p></td> |
| <td><p>0x40071FFF</p></td> |
| <td><p>RTC FAST Memory</p></td> |
| <td><p>YES</p></td> |
| <td></td> |
| </tr> |
| <tr class="row-odd"><td><p>Data / Instruction</p></td> |
| <td><p>0x50000000</p></td> |
| <td><p>0x50001FFF</p></td> |
| <td><p>RTC SLOW Memory</p></td> |
| <td><p>YES</p></td> |
| <td></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="external-memory"> |
| <h3>External Memory<a class="headerlink" href="#external-memory" title="Permalink to this heading"></a></h3> |
| <table class="docutils align-default"> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>BUS TYPE</p></th> |
| <th class="head"><p>START</p></th> |
| <th class="head"><p>LAST</p></th> |
| <th class="head"><p>DESCRIPTION</p></th> |
| <th class="head"><p>PERMISSION CONTROL</p></th> |
| <th class="head"><p>NOTES</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><p>Data</p></td> |
| <td><p>0x3F000000</p></td> |
| <td><p>0x3F3FFFFF</p></td> |
| <td><p>ICache</p></td> |
| <td><p>YES</p></td> |
| <td><p>Read</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>Data</p></td> |
| <td><p>0x3F500000</p></td> |
| <td><p>0x3FF7FFFF</p></td> |
| <td><p>DCache</p></td> |
| <td><p>YES</p></td> |
| <td><p>Read and Write</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="boundary-address-external"> |
| <h3>Boundary Address (External)<a class="headerlink" href="#boundary-address-external" title="Permalink to this heading"></a></h3> |
| <table class="docutils align-default"> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>BUS TYPE</p></th> |
| <th class="head"><p>START</p></th> |
| <th class="head"><p>LAST</p></th> |
| <th class="head"><p>DESCRIPTION</p></th> |
| <th class="head"><p>PERMISSION CONTROL</p></th> |
| <th class="head"><p>NOTES</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><p>Instruction</p></td> |
| <td><p>0x40080000</p></td> |
| <td><p>0x407FFFFF</p></td> |
| <td><p>ICache</p></td> |
| <td><p>YES</p></td> |
| <td><p>Read</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="linker-segments"> |
| <h3>Linker Segments<a class="headerlink" href="#linker-segments" title="Permalink to this heading"></a></h3> |
| <table class="docutils align-default"> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>DESCRIPTION</p></th> |
| <th class="head"><p>START</p></th> |
| <th class="head"><p>END</p></th> |
| <th class="head"><p>ATTR</p></th> |
| <th class="head"><p>LINKER SEGMENT NAME</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><dl class="simple"> |
| <dt>FLASH mapped data:</dt><dd><ul class="simple"> |
| <li><p>.rodata</p></li> |
| <li><p>Constructors |
| /destructors</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </td> |
| <td><p>0X3F000020</p></td> |
| <td><p>0X3F000020 + |
| FLASH_SIZE - 0x20</p></td> |
| <td><p>R</p></td> |
| <td><p>drom0_0_seg (NOTE 1)</p></td> |
| </tr> |
| <tr class="row-odd"><td><dl class="simple"> |
| <dt>COMMON data RAM:</dt><dd><ul class="simple"> |
| <li><p>.bss/.data</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </td> |
| <td><p>0X3FFB0000</p></td> |
| <td><p>0x3FFDE000</p></td> |
| <td><p>RW</p></td> |
| <td><p>dram0_0_seg (NOTE 2)</p></td> |
| </tr> |
| <tr class="row-even"><td><dl class="simple"> |
| <dt>IRAM for PRO cpu:</dt><dd><ul class="simple"> |
| <li><p>Interrupt Vectors</p></li> |
| <li><p>Low level |
| handlers</p></li> |
| <li><p>Xtensa/Espressif |
| libraries</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </td> |
| <td><p>0x40022000</p></td> |
| <td><p>0x40050000</p></td> |
| <td><p>RX</p></td> |
| <td><p>iram0_0_seg</p></td> |
| </tr> |
| <tr class="row-odd"><td><dl class="simple"> |
| <dt>RTC fast memory:</dt><dd><ul class="simple"> |
| <li><p>.rtc.text |
| (unused?)</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </td> |
| <td><p>0x40070000</p></td> |
| <td><p>0x40072000</p></td> |
| <td><p>RWX</p></td> |
| <td><p>rtc_iram_seg</p></td> |
| </tr> |
| <tr class="row-even"><td><dl class="simple"> |
| <dt>FLASH:</dt><dd><ul class="simple"> |
| <li><p>.text</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </td> |
| <td><p>0x40080020</p></td> |
| <td><p>0x40080020 + |
| FLASH_SIZE |
| (NOTE 3)</p></td> |
| <td><p>RX</p></td> |
| <td><p>irom0_0_seg (actually FLASH)</p></td> |
| </tr> |
| <tr class="row-odd"><td><dl class="simple"> |
| <dt>RTC slow memory:</dt><dd><ul class="simple"> |
| <li><p>.rtc.data/rodata |
| (unused?)</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </td> |
| <td><p>0x50000000</p></td> |
| <td><p>0x50002000</p></td> |
| <td><p>RW</p></td> |
| <td><p>rtc_slow_seg (NOTE 4)</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <ol class="arabic simple"> |
| <li><p>The linker script will reserve space at the beginning of the segment |
| for MCUboot header if ESP32S2_APP_FORMAT_MCUBOOT flag is active.</p></li> |
| <li><p>Heap starts at the end of dram_0_seg.</p></li> |
| <li><p>Subtract 0x20 if ESP32S2_APP_FORMAT_MCUBOOT is not active.</p></li> |
| <li><p>Linker script will reserve space at the beginning and at the end |
| of the segment for ULP coprocessor reserve memory.</p></li> |
| </ol> |
| </div> |
| </section> |
| </section> |
| <section id="bit-timers"> |
| <h2>64-bit Timers<a class="headerlink" href="#bit-timers" title="Permalink to this heading"></a></h2> |
| <p>ESP32-S2 has 4 generic timers of 64 bits (2 from Group 0 and 2 from Group 1). |
| They’re accessible as character drivers, the configuration along with a |
| guidance on how to run the example and the description of the application level |
| interface can be found in the <a class="reference internal" href="../../../components/drivers/character/timers/timer.html"><span class="doc">timer documentation</span></a>.</p> |
| </section> |
| <section id="watchdog-timers"> |
| <h2>Watchdog Timers<a class="headerlink" href="#watchdog-timers" title="Permalink to this heading"></a></h2> |
| <p>ESP32-S2 has 3 WDTs. 2 MWDTs from the Timers Module and 1 RWDT from the RTC Module |
| (Currently not supported yet). They’re accessible as character drivers, |
| The configuration along with a guidance on how to run the example and the description |
| of the application level interface can be found in the |
| <a class="reference internal" href="../../../components/drivers/character/timers/watchdog.html"><span class="doc">watchdog documentation</span></a>.</p> |
| </section> |
| <section id="i2s"> |
| <h2>I2S<a class="headerlink" href="#i2s" title="Permalink to this heading"></a></h2> |
| <p>The I2S peripheral is accessible using either the generic I2S audio driver or a specific |
| audio codec driver. Also, it’s possible to use the I2S character driver to bypass the |
| audio subsystem and develop specific usages of the I2S peripheral.</p> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <p>Note that the bit-width and sample rate can be modified “on-the-go” when using |
| audio-related drivers. That is not the case for the I2S character device driver and |
| such parameters are set on compile time through <cite>make menuconfig</cite>.</p> |
| </div> |
| <p>Please check for usage examples using the <a class="reference internal" href="boards/esp32s2-saola-1/index.html"><span class="doc">ESP32-S2-Saola-1</span></a>.</p> |
| </section> |
| <section id="wi-fi"> |
| <h2>Wi-Fi<a class="headerlink" href="#wi-fi" title="Permalink to this heading"></a></h2> |
| <div class="admonition tip"> |
| <p class="admonition-title">Tip</p> |
| <p>Boards usually expose a <code class="docutils literal notranslate"><span class="pre">wifi</span></code> defconfig which enables Wi-Fi.</p> |
| </div> |
| <p>A standard network interface will be configured and can be initialized such as:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> ifup wlan0 |
| nsh> wapi psk wlan0 mypasswd 3 |
| nsh> wapi essid wlan0 myssid 1 |
| nsh> renew wlan0 |
| </pre></div> |
| </div> |
| <p>In this case a connection to AP with SSID <code class="docutils literal notranslate"><span class="pre">myssid</span></code> is done, using <code class="docutils literal notranslate"><span class="pre">mypasswd</span></code> as |
| password. IP address is obtained via DHCP using <code class="docutils literal notranslate"><span class="pre">renew</span></code> command. You can check |
| the result by running <code class="docutils literal notranslate"><span class="pre">ifconfig</span></code> afterwards.</p> |
| <div class="admonition tip"> |
| <p class="admonition-title">Tip</p> |
| <p>Please refer to <a class="reference internal" href="../esp32/index.html#esp32-wi-fi-sta"><span class="std std-ref">ESP32 Wi-Fi Station Mode</span></a> |
| for more information.</p> |
| </div> |
| </section> |
| <section id="wi-fi-softap"> |
| <h2>Wi-Fi SoftAP<a class="headerlink" href="#wi-fi-softap" title="Permalink to this heading"></a></h2> |
| <p>It is possible to use ESP32-S2 as an Access Point (SoftAP).</p> |
| <div class="admonition tip"> |
| <p class="admonition-title">Tip</p> |
| <p>Boards usually expose a <code class="docutils literal notranslate"><span class="pre">sta_softap</span></code> defconfig which enables Wi-Fi |
| (STA + SoftAP).</p> |
| </div> |
| <p>If you are using this board config profile you can run these commands to be able |
| to connect your smartphone or laptop to your board:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> ifup wlan1 |
| nsh> dhcpd_start wlan1 |
| nsh> wapi psk wlan1 mypasswd 3 |
| nsh> wapi essid wlan1 nuttxap 1 |
| </pre></div> |
| </div> |
| <p>In this case, you are creating the access point <code class="docutils literal notranslate"><span class="pre">nuttxapp</span></code> in your board and to |
| connect to it on your smartphone you will be required to type the password <code class="docutils literal notranslate"><span class="pre">mypasswd</span></code> |
| using WPA2.</p> |
| <div class="admonition tip"> |
| <p class="admonition-title">Tip</p> |
| <p>Please refer to <a class="reference internal" href="../esp32/index.html#esp32-wi-fi-softap"><span class="std std-ref">ESP32 Wi-Fi SoftAP Mode</span></a> |
| for more information.</p> |
| </div> |
| <p>The <code class="docutils literal notranslate"><span class="pre">dhcpd_start</span></code> is necessary to let your board to associate an IP to your smartphone.</p> |
| </section> |
| <section id="secure-boot-and-flash-encryption"> |
| <h2>Secure Boot and Flash Encryption<a class="headerlink" href="#secure-boot-and-flash-encryption" title="Permalink to this heading"></a></h2> |
| <section id="secure-boot"> |
| <h3>Secure Boot<a class="headerlink" href="#secure-boot" title="Permalink to this heading"></a></h3> |
| <p>Secure Boot protects a device from running any unauthorized (i.e., unsigned) code by checking that |
| each piece of software that is being booted is signed. On an ESP32-S2, these pieces of software include |
| the second stage bootloader and each application binary. Note that the first stage bootloader does not |
| require signing as it is ROM code thus cannot be changed. This is achieved using specific hardware in |
| conjunction with MCUboot (read more about MCUboot <a class="reference external" href="https://docs.mcuboot.com/">here</a>).</p> |
| <p>The Secure Boot process on the ESP32-S2 involves the following steps performed:</p> |
| <ol class="arabic simple"> |
| <li><p>The first stage bootloader verifies the second stage bootloader’s RSA-PSS signature. If the verification is successful, |
| the first stage bootloader loads and executes the second stage bootloader.</p></li> |
| <li><p>When the second stage bootloader loads a particular application image, the application’s signature (RSA, ECDSA or ED25519) is verified |
| by MCUboot. |
| If the verification is successful, the application image is executed.</p></li> |
| </ol> |
| <div class="admonition warning"> |
| <p class="admonition-title">Warning</p> |
| <p>Once enabled, Secure Boot will not boot a modified bootloader. The bootloader will only boot an |
| application firmware image if it has a verified digital signature. There are implications for reflashing |
| updated images once Secure Boot is enabled. You can find more information about the ESP32-S2’s Secure boot |
| <a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/security/secure-boot-v2.html">here</a>.</p> |
| </div> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <p>As the bootloader image is built on top of the Hardware Abstraction Layer component |
| of <a class="reference external" href="https://github.com/espressif/esp-idf">ESP-IDF</a>, the |
| <a class="reference external" href="https://docs.mcuboot.com/readme-espressif.html">API port by Espressif</a> will be used |
| by MCUboot rather than the original NuttX port.</p> |
| </div> |
| </section> |
| <section id="flash-encryption"> |
| <h3>Flash Encryption<a class="headerlink" href="#flash-encryption" title="Permalink to this heading"></a></h3> |
| <p>Flash encryption is intended for encrypting the contents of the ESP32-S2’s off-chip flash memory. Once this feature is enabled, |
| firmware is flashed as plaintext, and then the data is encrypted in place on the first boot. As a result, physical readout |
| of flash will not be sufficient to recover most flash contents.</p> |
| <div class="admonition warning"> |
| <p class="admonition-title">Warning</p> |
| <p>After enabling Flash Encryption, an encryption key is generated internally by the device and |
| cannot be accessed by the user for re-encrypting data and re-flashing the system, hence it will be permanently encrypted. |
| Re-flashing an encrypted system is complicated and not always possible. You can find more information about the ESP32-S2’s Flash Encryption |
| <a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/security/flash-encryption.html">here</a>.</p> |
| </div> |
| </section> |
| <section id="prerequisites"> |
| <h3>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this heading"></a></h3> |
| <p>First of all, we need to install <code class="docutils literal notranslate"><span class="pre">imgtool</span></code> (a MCUboot utility application to manipulate binary |
| images) and <code class="docutils literal notranslate"><span class="pre">esptool</span></code> (the ESP32-S2 toolkit):</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ pip install imgtool esptool==4.8.dev4 |
| </pre></div> |
| </div> |
| <p>We also need to make sure that the python modules are added to <code class="docutils literal notranslate"><span class="pre">PATH</span></code>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ echo "PATH=$PATH:/home/$USER/.local/bin" >> ~/.bashrc |
| </pre></div> |
| </div> |
| <p>Now, we will create a folder to store the generated keys (such as <code class="docutils literal notranslate"><span class="pre">~/signing_keys</span></code>):</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ mkdir ~/signing_keys && cd ~/signing_keys |
| </pre></div> |
| </div> |
| <p>With all set up, we can now generate keys to sign the bootloader and application binary images, |
| respectively, of the compiled project:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ espsecure.py generate_signing_key --version 2 bootloader_signing_key.pem |
| $ imgtool keygen --key app_signing_key.pem --type rsa-3072 |
| </pre></div> |
| </div> |
| <div class="admonition important"> |
| <p class="admonition-title">Important</p> |
| <p>The contents of the key files must be stored securely and kept secret.</p> |
| </div> |
| </section> |
| <section id="enabling-secure-boot-and-flash-encryption"> |
| <h3>Enabling Secure Boot and Flash Encryption<a class="headerlink" href="#enabling-secure-boot-and-flash-encryption" title="Permalink to this heading"></a></h3> |
| <p>To enable Secure Boot for the current project, go to the project’s NuttX directory, execute <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">menuconfig</span></code> and the following steps:</p> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p>Enable experimental features in <span class="menuselection">Build Setup ‣ Show experimental options</span>;</p></li> |
| <li><p>Enable MCUboot in <span class="menuselection">Application Configuration ‣ Bootloader Utilities ‣ MCUboot</span>;</p></li> |
| <li><p>Change image type to <code class="docutils literal notranslate"><span class="pre">MCUboot-bootable</span> <span class="pre">format</span></code> in <span class="menuselection">System Type ‣ Application Image Configuration ‣ Application Image Format</span>;</p></li> |
| <li><p>Enable building MCUboot from the source code by selecting <code class="docutils literal notranslate"><span class="pre">Build</span> <span class="pre">binaries</span> <span class="pre">from</span> <span class="pre">source</span></code>; |
| in <span class="menuselection">System Type ‣ Application Image Configuration ‣ Source for bootloader binaries</span>;</p></li> |
| <li><p>Enable Secure Boot in <span class="menuselection">System Type ‣ Application Image Configuration ‣ Enable hardware Secure Boot in bootloader</span>;</p></li> |
| <li><p>If you want to protect the SPI Bus against data sniffing, you can enable Flash Encryption in |
| <span class="menuselection">System Type ‣ Application Image Configuration ‣ Enable Flash Encryption on boot</span>.</p></li> |
| </ol> |
| </div></blockquote> |
| <p>Now you can design an update and confirm agent to your application. Check the <a class="reference external" href="https://docs.mcuboot.com/design.html">MCUboot design guide</a> and the |
| <a class="reference external" href="https://docs.mcuboot.com/readme-espressif.html">MCUboot Espressif port documentation</a> for |
| more information on how to apply MCUboot. Also check some <a class="reference external" href="https://github.com/mcu-tools/mcuboot/blob/main/docs/readme-nuttx.md">notes about the NuttX MCUboot port</a>, |
| the <a class="reference external" href="https://github.com/mcu-tools/mcuboot/blob/main/docs/PORTING.md">MCUboot porting guide</a> and some |
| <a class="reference external" href="https://github.com/apache/nuttx-apps/tree/master/examples/mcuboot">examples of MCUboot applied in NuttX applications</a>.</p> |
| <p>After you developed an application which implements all desired functions, you need to flash it into the primary image slot |
| of the device (it will automatically be in the confirmed state, you can learn more about image |
| confirmation <a class="reference external" href="https://docs.mcuboot.com/design.html#image-swapping">here</a>). |
| To flash to the primary image slot, select <code class="docutils literal notranslate"><span class="pre">Application</span> <span class="pre">image</span> <span class="pre">primary</span> <span class="pre">slot</span></code> in |
| <span class="menuselection">System Type ‣ Application Image Configuration ‣ Target slot for image flashing</span> |
| and compile it using <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">-j</span> <span class="pre">ESPSEC_KEYDIR=~/signing_keys</span></code>.</p> |
| <p>When creating update images, make sure to change <span class="menuselection">System Type ‣ Application Image Configuration ‣ Target slot for image flashing</span> |
| to <code class="docutils literal notranslate"><span class="pre">Application</span> <span class="pre">image</span> <span class="pre">secondary</span> <span class="pre">slot</span></code>.</p> |
| <div class="admonition important"> |
| <p class="admonition-title">Important</p> |
| <p>When deploying your application, make sure to disable UART Download Mode by selecting <code class="docutils literal notranslate"><span class="pre">Permanently</span> <span class="pre">disabled</span></code> in |
| <span class="menuselection">System Type ‣ Application Image Configuration ‣ UART ROM download mode</span> |
| and change usage mode to <code class="docutils literal notranslate"><span class="pre">Release</span></code> in <cite>System Type –> Application Image Configuration –> Enable usage mode</cite>. |
| <strong>After disabling UART Download Mode you will not be able to flash other images through UART.</strong></p> |
| </div> |
| </section> |
| </section> |
| <section id="supported-boards"> |
| <h2>Supported Boards<a class="headerlink" href="#supported-boards" title="Permalink to this heading"></a></h2> |
| <div class="toctree-wrapper compound"> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="boards/esp32s2-kaluga-1/index.html">ESP32-S2-Kaluga-1 Kit v1.3</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="boards/esp32s2-saola-1/index.html">ESP32-S2-Saola-1</a></li> |
| </ul> |
| </div> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="../esp32/boards/esp32-wrover-kit/index.html" class="btn btn-neutral float-left" title="ESP-WROVER-KIT" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="boards/esp32s2-kaluga-1/index.html" class="btn btn-neutral float-right" title="ESP32-S2-Kaluga-1 Kit v1.3" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2023, The Apache Software Foundation.</p> |
| </div> |
| |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |