Skip to content

Commit 5a69cc0

Browse files
Raffael Rostagnonashif
authored andcommitted
boards: esp8684_devkitm: Add support
Add support for board esp8684_devkitm Signed-off-by: Raffael Rostagno <[email protected]>
1 parent 0d274a1 commit 5a69cc0

File tree

11 files changed

+430
-0
lines changed

11 files changed

+430
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ESP8684 devkitm board configuration
2+
3+
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
7+
int
8+
default 65535 if WIFI && BT
9+
default 51200 if WIFI
10+
default 40960 if BT
11+
default 4096
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ESP8684 devkitm board configuration
2+
3+
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_ESP8684_DEVKITM
7+
select SOC_ESP8684_MINI_H4
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
choice BOOTLOADER
5+
default BOOTLOADER_MCUBOOT
6+
endchoice
7+
8+
choice BOOT_SIGNATURE_TYPE
9+
default BOOT_SIGNATURE_TYPE_NONE
10+
endchoice
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
4+
set(OPENOCD OPENOCD-NOTFOUND)
5+
endif()
6+
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
7+
8+
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
board:
2+
name: esp8684_devkitm
3+
vendor: espressif
4+
socs:
5+
- name: esp32c2
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
.. _esp8684_devkitm:
2+
3+
ESP32-C2
4+
########
5+
6+
Overview
7+
********
8+
9+
ESP32-C2 (ESP8684 core) is a low-cost, Wi-Fi 4 & Bluetooth 5 (LE) chip. Its unique design
10+
makes the chip smaller and yet more powerful than ESP8266. ESP32-C2 is built around a RISC-V
11+
32-bit, single-core processor, with 272 KB of SRAM (16 KB dedicated to cache) and 576 KB of ROM.
12+
ESP32-C2 has been designed to target simple, high-volume, and low-data-rate IoT applications,
13+
such as smart plugs and smart light bulbs. ESP32-C2 offers easy and robust wireless connectivity,
14+
which makes it the go-to solution for developing simple, user-friendly and reliable
15+
smart-home devices [1]_.
16+
17+
Features include the following (`ESP8684 Datasheet`_):
18+
19+
- 32-bit core RISC-V microcontroller with a maximum clock speed of 120 MHz
20+
- 2 MB or 4 MB in chip (ESP8684) or in package (ESP32-C2) flash
21+
- 272 KB of internal RAM
22+
- 802.11b/g/n
23+
- A Bluetooth LE subsystem that supports features of Bluetooth 5 and Bluetooth Mesh
24+
- Various peripherals:
25+
26+
- 14 programmable GPIOs
27+
- 3 SPI
28+
- 2 UART
29+
- 1 I2C Master
30+
- LED PWM controller, with up to 6 channels
31+
- General DMA controller (GDMA)
32+
- 1 12-bit SAR ADC, up to 5 channels
33+
- 1 temperature sensor
34+
- 1 54-bit general-purpose timer
35+
- 2 watchdog timers
36+
- 1 52-bit system timer
37+
38+
- Cryptographic hardware acceleration (RNG, ECC, RSA, SHA-2, AES)
39+
40+
For detailed information check `ESP8684 Technical Reference Manual`_.
41+
42+
Supported Features
43+
==================
44+
45+
Current Zephyr's ESP8684-Devkitm board supports the following features:
46+
47+
+------------+------------+-------------------------------------+
48+
| Interface | Controller | Driver/Component |
49+
+============+============+=====================================+
50+
| UART | on-chip | serial port |
51+
+------------+------------+-------------------------------------+
52+
| GPIO | on-chip | gpio |
53+
+------------+------------+-------------------------------------+
54+
| PINMUX | on-chip | pinmux |
55+
+------------+------------+-------------------------------------+
56+
| Watchdog | on-chip | watchdog |
57+
+------------+------------+-------------------------------------+
58+
| TRNG | on-chip | entropy |
59+
+------------+------------+-------------------------------------+
60+
| Timers | on-chip | counter |
61+
+------------+------------+-------------------------------------+
62+
63+
For a getting started user guide, please check `ESP8684 Devkitm User Guide`_.
64+
65+
System requirements
66+
*******************
67+
68+
Prerequisites
69+
=============
70+
71+
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
72+
below to retrieve those files.
73+
74+
.. code-block:: console
75+
76+
west blobs fetch hal_espressif
77+
78+
.. note::
79+
80+
It is recommended running the command above after :file:`west update`.
81+
82+
Building & Flashing
83+
*******************
84+
85+
Simple boot
86+
===========
87+
88+
The board could be loaded using the single binary image, without 2nd stage bootloader.
89+
It is the default option when building the application without additional configuration.
90+
91+
.. note::
92+
93+
Simple boot does not provide any security features nor OTA updates.
94+
95+
MCUboot bootloader
96+
==================
97+
98+
User may choose to use MCUboot bootloader instead. In that case the bootloader
99+
must be build (and flash) at least once.
100+
101+
There are two options to be used when building an application:
102+
103+
1. Sysbuild
104+
2. Manual build
105+
106+
.. note::
107+
108+
User can select the MCUboot bootloader by adding the following line
109+
to the board default configuration file.
110+
111+
.. code:: cfg
112+
113+
CONFIG_BOOTLOADER_MCUBOOT=y
114+
115+
Sysbuild
116+
========
117+
118+
The sysbuild makes possible to build and flash all necessary images needed to
119+
bootstrap the board with the ESP32 SoC.
120+
121+
To build the sample application using sysbuild use the command:
122+
123+
.. zephyr-app-commands::
124+
:tool: west
125+
:app: samples/hello_world
126+
:board: esp8684_devkitm
127+
:goals: build
128+
:west-args: --sysbuild
129+
:compact:
130+
131+
By default, the ESP32 sysbuild creates bootloader (MCUboot) and application
132+
images. But it can be configured to create other kind of images.
133+
134+
Build directory structure created by sysbuild is different from traditional
135+
Zephyr build. Output is structured by the domain subdirectories:
136+
137+
.. code-block::
138+
139+
build/
140+
├── hello_world
141+
│ └── zephyr
142+
│ ├── zephyr.elf
143+
│ └── zephyr.bin
144+
├── mcuboot
145+
│ └── zephyr
146+
│ ├── zephyr.elf
147+
│ └── zephyr.bin
148+
└── domains.yaml
149+
150+
.. note::
151+
152+
With ``--sysbuild`` option the bootloader will be re-build and re-flash
153+
every time the pristine build is used.
154+
155+
For more information about the system build please read the :ref:`sysbuild` documentation.
156+
157+
Manual build
158+
============
159+
160+
During the development cycle, it is intended to build & flash as quickly possible.
161+
For that reason, images can be build one at a time using traditional build.
162+
163+
The instructions following are relevant for both manual build and sysbuild.
164+
The only difference is the structure of the build directory.
165+
166+
.. note::
167+
168+
Remember that bootloader (MCUboot) needs to be flash at least once.
169+
170+
Build and flash applications as usual (see :ref:`build_an_application` and
171+
:ref:`application_run` for more details).
172+
173+
.. zephyr-app-commands::
174+
:zephyr-app: samples/hello_world
175+
:board: esp8684_devkitm
176+
:goals: build
177+
178+
The usual ``flash`` target will work with the ``esp8684_devkitm`` board
179+
configuration. Here is an example for the :ref:`hello_world`
180+
application.
181+
182+
.. zephyr-app-commands::
183+
:zephyr-app: samples/hello_world
184+
:board: esp8684_devkitm
185+
:goals: flash
186+
187+
Open the serial monitor using the following command:
188+
189+
.. code-block:: shell
190+
191+
west espressif monitor
192+
193+
After the board has automatically reset and booted, you should see the following
194+
message in the monitor:
195+
196+
.. code-block:: console
197+
198+
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
199+
Hello World! esp8684_devkitm
200+
201+
Debugging
202+
*********
203+
204+
As with much custom hardware, the ESP8684 modules require patches to
205+
OpenOCD that are not upstreamed yet. Espressif maintains their own fork of
206+
the project. The custom OpenOCD can be obtained at `OpenOCD ESP32`_
207+
208+
The Zephyr SDK uses a bundled version of OpenOCD by default. You can overwrite that behavior by adding the
209+
``-DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>``
210+
parameter when building.
211+
212+
Here is an example for building the :ref:`hello_world` application.
213+
214+
.. zephyr-app-commands::
215+
:zephyr-app: samples/hello_world
216+
:board: esp8684_devkitm
217+
:goals: build flash
218+
:gen-args: -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>
219+
220+
You can debug an application in the usual way. Here is an example for the :ref:`hello_world` application.
221+
222+
.. zephyr-app-commands::
223+
:zephyr-app: samples/hello_world
224+
:board: esp8684_devkitm
225+
:goals: debug
226+
227+
.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
228+
229+
References
230+
**********
231+
232+
.. [1] https://www.espressif.com/en/products/socs/esp8684
233+
.. _ESP8684 Devkitm User Guide: https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp8684/esp8684-devkitm-1/user_guide.html
234+
.. _ESP8684 Technical Reference Manual: https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_en.pdf
235+
.. _ESP8684 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
8+
#include <dt-bindings/pinctrl/esp32c2-pinctrl.h>
9+
#include <zephyr/dt-bindings/pinctrl/esp32c2-gpio-sigmap.h>
10+
11+
&pinctrl {
12+
13+
uart0_default: uart0_default {
14+
group1 {
15+
pinmux = <UART0_TX_GPIO20>;
16+
output-high;
17+
};
18+
group2 {
19+
pinmux = <UART0_RX_GPIO19>;
20+
bias-pull-up;
21+
};
22+
};
23+
};

0 commit comments

Comments
 (0)