blob: fd44c14b371e3d2e34bd4c20b6bdcef65d4833cb [file] [log] [blame]
<!--
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 &mdash; NuttX latest documentation</title>
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/tabs.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/custom.css" type="text/css" />
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<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/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 DevKitC" href="boards/esp32-devkitc/index.html" />
<link rel="prev" title="Xtensa" href="../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>
</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="../../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 current"><a class="reference internal" href="../index.html">Xtensa</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#">Espressif ESP32</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#toolchain">Toolchain</a><ul>
<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="#flashing">Flashing</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#bootloader-and-partitions">Bootloader and partitions</a></li>
</ul>
</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">Boundary Address</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="#id1">Boundary Address</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="#smp">SMP</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#open-issues">Open Issues</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="#wifi">WiFi</a></li>
<li class="toctree-l4"><a class="reference internal" href="#wifi-softap">WiFi SoftAP</a></li>
<li class="toctree-l4"><a class="reference internal" href="#bluetooth">Bluetooth</a></li>
<li class="toctree-l4"><a class="reference internal" href="#using-qemu">Using QEMU</a></li>
<li class="toctree-l4"><a class="reference internal" href="#things-to-do">Things to Do</a></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/esp32-devkitc/index.html">ESP32 DevKitC</a></li>
<li class="toctree-l5"><a class="reference internal" href="boards/esp32-wrover-kit/index.html">ESP-WROVER-KIT</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</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="../../../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>
</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</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/platforms/xtensa/esp32/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">
<h1>Espressif ESP32<a class="headerlink" href="#espressif-esp32" title="Permalink to this heading"></a></h1>
<p>The ESP32 is a series of single and dual-core SoCs from Espressif
based on Harvard architecture Xtensa LX6 CPUs and with on-chip support
for Bluetooth and WiFi.</p>
<p>All embedded memory, external memory and peripherals are located on the
data bus and/or the instruction bus of these CPUs. With some minor
exceptions, the address mapping of two CPUs is symmetric, meaning they
use the same addresses to access the same memory. Multiple peripherals in
the system can access embedded memory via DMA.</p>
<p>On dual-core SoCs, the two CPUs are typically named “PRO_CPU” and “APP_CPU”
(for “protocol” and “application”), however for most purposes the
two CPUs are interchangeable.</p>
<section id="toolchain">
<h2>Toolchain<a class="headerlink" href="#toolchain" title="Permalink to this heading"></a></h2>
<p>You can use the prebuilt <a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-tools.html#xtensa-esp32-elf">toolchain</a>
for Xtensa architecture and <a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-tools.html#openocd-esp32">OpenOCD</a>
for ESP32 by Espressif.</p>
<p>For flashing firmware, you will need to install <code class="docutils literal notranslate"><span class="pre">esptool.py</span></code> by running:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ pip install esptool
</pre></div>
</div>
<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>checkout<span class="w"> </span>esp-2021r1
<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">&amp;&amp;</span><span class="w"> </span>./configure<span class="w"> </span>--enable-local<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span>make
<span class="gp">$ </span>./ct-ng<span class="w"> </span>xtensa-esp32-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-esp32-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">&quot;crosstool-NG/builds/xtensa-esp32-elf/bin:</span><span class="nv">$PATH</span><span class="s2">&quot;</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="flashing">
<h2>Flashing<a class="headerlink" href="#flashing" title="Permalink to this heading"></a></h2>
<p>Firmware for ESP32 is flashed via the USB/UART interface using the <code class="docutils literal notranslate"><span class="pre">esptool.py</span></code> tool.
It’s a two step process where the first converts the ELF file into a ESP32-compatible binary
and the second flashes it to the board. These steps are included into the build system and you can
flash your NuttX firmware simply by running:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ make download ESPTOOL_PORT=&lt;port&gt;
</pre></div>
</div>
<p>where <code class="docutils literal notranslate"><span class="pre">&lt;port&gt;</span></code> is typically <code class="docutils literal notranslate"><span class="pre">/dev/ttyUSB0</span></code> or similar. You can change the baudrate by passing <code class="docutils literal notranslate"><span class="pre">ESPTOOL_BAUD</span></code>.</p>
<section id="bootloader-and-partitions">
<h3>Bootloader and partitions<a class="headerlink" href="#bootloader-and-partitions" title="Permalink to this heading"></a></h3>
<p>ESP32 requires a bootloader to be flashed as well as a set of FLASH partitions. This is only needed the first time
(or any time you which to modify either of these). An easy way is to use prebuilt binaries for NuttX from <a class="reference external" href="https://github.com/espressif/esp-nuttx-bootloader">here</a>. In there you will find instructions to rebuild these if necessary.
Once you downloaded both binaries, you can flash them by adding an <code class="docutils literal notranslate"><span class="pre">ESPTOOL_BINDIR</span></code> parameter, pointing to the directory where these binaries were downloaded:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>make<span class="w"> </span>download<span class="w"> </span><span class="nv">ESPTOOL_PORT</span><span class="o">=</span>&lt;port&gt;<span class="w"> </span><span class="nv">ESPTOOL_BINDIR</span><span class="o">=</span>&lt;dir&gt;
</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 that you perform a complete
SPI FLASH erase.</p>
<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>
</section>
</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>GPIO</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>SPI</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>DMA</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>
<tr class="row-even"><td><p>Ethernet</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>Watchdog</p></td>
<td><p>Yes</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>RTC</p></td>
<td><p>Yes</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>AES</p></td>
<td><p>Yes</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>eFuse</p></td>
<td><p>Yes</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>ADC</p></td>
<td><p>No</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Bluetooth</p></td>
<td><p>No</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>SDIO</p></td>
<td><p>No</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>SD/MMC</p></td>
<td><p>No</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>I2S</p></td>
<td><p>No</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>LED_PWM</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>MCPWM</p></td>
<td><p>No</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Pulse_CNT</p></td>
<td><p>No</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>SHA</p></td>
<td><p>No</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>RSA</p></td>
<td><p>No</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>Data</p></td>
<td><p>0x3F400000</p></td>
<td><p>0x3F7FFFFF</p></td>
<td><p>External Memory</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Data</p></td>
<td><p>0x3F800000
0x3FC00000</p></td>
<td><p>0x3FBFFFFF
0x3FEFFFFF</p></td>
<td><p>External Memory</p></td>
<td><p>Reserved</p></td>
</tr>
<tr class="row-even"><td><p>Data</p></td>
<td><p>0x3FF00000</p></td>
<td><p>0x3FF7FFFF</p></td>
<td><p>Peripheral</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Data</p></td>
<td><p>0x3FF80000</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>0x400C1FFF</p></td>
<td><p>Embedded Memory</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Instruction</p></td>
<td><p>0x400C2000</p></td>
<td><p>0x40BFFFFF</p></td>
<td><p>External Memory</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>.</p></td>
<td><p>0x40C00000</p></td>
<td><p>0x4FFFFFFF</p></td>
<td></td>
<td><p>Reserved</p></td>
</tr>
<tr class="row-odd"><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-even"><td><p>.</p></td>
<td><p>0x50002000</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>NOTES</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Data</p></td>
<td><p>0x3ff80000</p></td>
<td><p>0x3ff81fff</p></td>
<td><p>RTC FAST Memory</p></td>
<td><p>PRO_CPU Only</p></td>
</tr>
<tr class="row-odd"><td><p>.</p></td>
<td><p>0x3ff82000</p></td>
<td><p>0x3ff8ffff</p></td>
<td></td>
<td><p>Reserved</p></td>
</tr>
<tr class="row-even"><td><p>Data</p></td>
<td><p>0x3ff90000</p></td>
<td><p>0x3ff9ffff</p></td>
<td><p>Internal ROM 1</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>.</p></td>
<td><p>0x3ffa0000</p></td>
<td><p>0x3ffadfff</p></td>
<td></td>
<td><p>Reserved</p></td>
</tr>
<tr class="row-even"><td><p>Data</p></td>
<td><p>0x3ffae000</p></td>
<td><p>0x3ffdffff</p></td>
<td><p>Internal SRAM 2</p></td>
<td><p>DMA</p></td>
</tr>
<tr class="row-odd"><td><p>Data</p></td>
<td><p>0x3ffe0000</p></td>
<td><p>0x3fffffff</p></td>
<td><p>Internal SRAM 1</p></td>
<td><p>DMA</p></td>
</tr>
</tbody>
</table>
</section>
<section id="boundary-address">
<h3>Boundary Address<a class="headerlink" href="#boundary-address" 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>Instruction</p></td>
<td><p>0x40000000</p></td>
<td><p>0x40007fff</p></td>
<td><p>Internal ROM 0</p></td>
<td><p>Remap</p></td>
</tr>
<tr class="row-odd"><td><p>Instruction</p></td>
<td><p>0x40008000</p></td>
<td><p>0x4005ffff</p></td>
<td><p>Internal ROM 0</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>.</p></td>
<td><p>0x40060000</p></td>
<td><p>0x4006ffff</p></td>
<td></td>
<td><p>Reserved</p></td>
</tr>
<tr class="row-odd"><td><p>Instruction</p></td>
<td><p>0x40070000</p></td>
<td><p>0x4007ffff</p></td>
<td><p>Internal SRAM 0</p></td>
<td><p>Cache</p></td>
</tr>
<tr class="row-even"><td><p>Instruction</p></td>
<td><p>0x40080000</p></td>
<td><p>0x4009ffff</p></td>
<td><p>Internal SRAM 0</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Instruction</p></td>
<td><p>0x400a0000</p></td>
<td><p>0x400affff</p></td>
<td><p>Internal SRAM 1</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Instruction</p></td>
<td><p>0x400b0000</p></td>
<td><p>0x400b7FFF</p></td>
<td><p>Internal SRAM 1</p></td>
<td><p>Remap</p></td>
</tr>
<tr class="row-odd"><td><p>Instruction</p></td>
<td><p>0x400b8000</p></td>
<td><p>0x400bffff</p></td>
<td><p>Internal SRAM 1</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Instruction</p></td>
<td><p>0x400c0000</p></td>
<td><p>0x400c1FFF</p></td>
<td><p>RTC FAST Memory</p></td>
<td><p>PRO_CPU Only</p></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></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>NOTES</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Data</p></td>
<td><p>0x3f400000</p></td>
<td><p>0x3f7fffff</p></td>
<td><p>External Flash</p></td>
<td><p>Read</p></td>
</tr>
<tr class="row-odd"><td><p>Data</p></td>
<td><p>0x3f800000</p></td>
<td><p>0x3fbfffff</p></td>
<td><p>External SRAM</p></td>
<td><p>Read and Write</p></td>
</tr>
</tbody>
</table>
</section>
<section id="id1">
<h3>Boundary Address<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h3>
<p>Instruction 0x400c2000 0x40bfffff 11512 KB External Flash Read</p>
</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>0x3f400010</p></td>
<td><p>0x3fc00010</p></td>
<td><p>R</p></td>
<td><p>drom0_0_seg</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>0x40000000</p></td>
<td><p>RW</p></td>
<td><p>dram0_0_seg (NOTE 1,2,3)</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>0x40080000</p></td>
<td><p>0x400a0000</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>0x400c0000</p></td>
<td><p>0x400c2000</p></td>
<td><p>RWX</p></td>
<td><p>rtc_iram_seg (PRO_CPU only)</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>0x400d0018</p></td>
<td><p>0x40400018</p></td>
<td><p>RX</p></td>
<td><p>iram0_2_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>0x50001000</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>Linker script will reserve space at the beginning of the segment
for BT and at the end for trace memory.</p></li>
<li><p>Heap ends at the top of dram_0_seg.</p></li>
<li><p>Parts of this region is reserved for the ROM bootloader.</p></li>
<li><p>Linker script will reserve space at the beginning of the segment
for co-processor reserve memory and at the end 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 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 <a class="reference internal" href="../../../components/drivers/character/timer.html"><span class="doc">here</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 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
<a class="reference internal" href="../../../components/drivers/character/watchdog.html"><span class="doc">here</span></a>.</p>
</section>
<section id="smp">
<h2>SMP<a class="headerlink" href="#smp" title="Permalink to this heading"></a></h2>
<p>The ESP32 has 2 CPUs. Support is included for testing an SMP configuration.
That configuration is still not yet ready for usage but can be enabled with
the following configuration settings,
in <span class="menuselection">RTOS Features ‣ Tasks and Scheduling</span>, with:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_SPINLOCK=y
CONFIG_SMP=y
CONFIG_SMP_NCPUS=2
</pre></div>
</div>
<p>Debug Tip: During debug session, OpenOCD may mysteriously switch from one
CPU to another. This behavior can be eliminated by uncommenting one of the
following in <code class="docutils literal notranslate"><span class="pre">scripts/esp32.cfg</span></code>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span># Only configure the PRO CPU
#set ESP32_ONLYCPU 1
# Only configure the APP CPU
#set ESP32_ONLYCPU 2
</pre></div>
</div>
<section id="open-issues">
<h3>Open Issues<a class="headerlink" href="#open-issues" title="Permalink to this heading"></a></h3>
<blockquote>
<div><ol class="arabic simple">
<li><p>Cache Issues. I have not thought about this yet, but certainly caching is
an issue in an SMP system:</p>
<ul class="simple">
<li><p>Cache coherency. Are there separate caches for each CPU? Or a single
shared cache? If the are separate then keep the caches coherent will
be an issue.</p></li>
<li><p>Caching MAY interfere with spinlocks as they are currently implemented.
Waiting on a cached copy of the spinlock may result in a hang or a
failure to wait.</p></li>
</ul>
</li>
<li><p>Assertions. On a fatal assertions, other CPUs need to be stopped.</p></li>
</ol>
</div></blockquote>
</section>
</section>
<section id="wifi">
<h2>WiFi<a class="headerlink" href="#wifi" title="Permalink to this heading"></a></h2>
<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&gt; ifup wlan0
nsh&gt; wapi psk wlan0 mypasswd 3
nsh&gt; wapi essid wlan0 myssid 1
nsh&gt; 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>Boards usually expose a <code class="docutils literal notranslate"><span class="pre">wapi</span></code> defconfig which enables WiFi</p>
</div>
</section>
<section id="wifi-softap">
<h2>WiFi SoftAP<a class="headerlink" href="#wifi-softap" title="Permalink to this heading"></a></h2>
<p>It is possible to use ESP32 as an Access Point (SoftAP). Actually there are some
boards with a <code class="docutils literal notranslate"><span class="pre">sta_softap</span></code> which enables this support.</p>
<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&gt; ifup wlan1
nsh&gt; dhcpd_start wlan1
nsh&gt; wapi psk wlan0 mypasswd 1
nsh&gt; 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>.
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="bluetooth">
<h2>Bluetooth<a class="headerlink" href="#bluetooth" title="Permalink to this heading"></a></h2>
<p>Bluetooth is not currently supported.</p>
</section>
<section id="using-qemu">
<h2>Using QEMU<a class="headerlink" href="#using-qemu" title="Permalink to this heading"></a></h2>
<p>First follow the instructions <a class="reference external" href="https://github.com/espressif/qemu/wiki">here</a> to build QEMU.
Enable the ESP32_QEMU_IMAGE config found in “Board Selection -&gt; ESP32 binary image for QEMU”.
Download the bootloader and the partition table from <a class="reference external" href="https://github.com/espressif/esp-nuttx-bootloader/releases">https://github.com/espressif/esp-nuttx-bootloader/releases</a>
and place them in a directory, say ../esp-bins.
Build and generate the QEMU image: <cite>make ESPTOOL_BINDIR=../esp-bins</cite>
A new image “esp32_qemu_image.bin” will be created. It can be run as:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>~/PATH_TO_QEMU/qemu/build/xtensa-softmmu/qemu-system-xtensa -nographic \
-machine esp32 \
-drive file=esp32_qemu_image.bin,if=mtd,format=raw
</pre></div>
</div>
</section>
<section id="things-to-do">
<h2>Things to Do<a class="headerlink" href="#things-to-do" title="Permalink to this heading"></a></h2>
<ol class="arabic">
<li><p>Lazy co-processor save logic supported by Xtensa. That logic works like this:</p>
<ol class="loweralpha simple">
<li><p>CPENABLE is set to zero on each context switch, disabling all co-
processors.</p></li>
<li><p>If/when the task attempts to use the disabled co-processor, an
exception occurs</p></li>
<li><p>The co-processor exception handler re-enables the co-processor.</p></li>
</ol>
<p>Instead, the NuttX logic saves and restores CPENABLE on each context
switch. This has disadvantages in that (1) co-processor context will
be saved and restored even if the co-processor was never used, and (2)
tasks must explicitly enable and disable co-processors.</p>
</li>
<li><p>Currently the Xtensa port copies register state save information from
the stack into the TCB. A more efficient alternative would be to just
save a pointer to a register state save area in the TCB. This would
add some complexity to signal handling and also to up_initialstate().
But the performance improvement might be worth the effort.</p></li>
<li><p>See SMP-related issues above</p></li>
</ol>
</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/esp32-devkitc/index.html">ESP32 DevKitC</a></li>
<li class="toctree-l1"><a class="reference internal" href="boards/esp32-wrover-kit/index.html">ESP-WROVER-KIT</a></li>
</ul>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../index.html" class="btn btn-neutral float-left" title="Xtensa" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="boards/esp32-devkitc/index.html" class="btn btn-neutral float-right" title="ESP32 DevKitC" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020, The Apache Software Foundation.</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>