-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards: xtensa: Add support for Lolin S2 Mini
Add support for LOLIN S2 Mini board, a cheap board also sold as Wemos S2 Mini. Signed-off-by: Moritz Fischer <moritzf@google.com>
- Loading branch information
Showing
10 changed files
with
330 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# ESP32S2 LOLIN S2 MINI board configuration | ||
|
||
# Copyright (c) 2023 Google, LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_ESP32S2_LOLIN_MINI | ||
bool "ESP32S2 Lolin Mini Board" | ||
depends on SOC_ESP32S2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# ESP32S2 LOLIN S2 MINI board configuration | ||
|
||
# Copyright (c) 2023 Google, LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD | ||
default "esp32s2_lolin_mini" | ||
depends on BOARD_ESP32S2_LOLIN_MINI | ||
|
||
config ENTROPY_GENERATOR | ||
default y | ||
|
||
config HEAP_MEM_POOL_SIZE | ||
default 32768 if WIFI | ||
default 4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*") | ||
set(OPENOCD OPENOCD-NOTFOUND) | ||
endif() | ||
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH) | ||
|
||
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
.. _esp32s2_lolin_mini: | ||
|
||
ESP32-S2 | ||
######## | ||
|
||
Overview | ||
******** | ||
|
||
ESP32-S2 is a highly integrated, low-power, single-core Wi-Fi Microcontroller SoC, designed to be secure and | ||
cost-effective, with a high performance and a rich set of IO capabilities. [1]_ | ||
|
||
The features include the following: | ||
|
||
- RSA-3072-based secure boot | ||
- AES-XTS-256-based flash encryption | ||
- Protected private key and device secrets from software access | ||
- Cryptographic accelerators for enhanced performance | ||
- Protection against physical fault injection attacks | ||
- Various peripherals: | ||
|
||
- 43x programmable GPIOs | ||
- 14x configurable capacitive touch GPIOs | ||
- USB OTG | ||
- LCD interface | ||
- camera interface | ||
- SPI | ||
- I2S | ||
- UART | ||
- ADC | ||
- DAC | ||
- LED PWM with up to 8 channels | ||
|
||
System requirements | ||
******************* | ||
|
||
Prerequisites | ||
------------- | ||
|
||
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command | ||
below to retrieve those files. | ||
|
||
.. code-block:: console | ||
west blobs fetch hal_espressif | ||
.. note:: | ||
|
||
It is recommended running the command above after :file:`west update`. | ||
|
||
Building & Flashing | ||
------------------- | ||
|
||
Build and flash applications as usual (see :ref:`build_an_application` and | ||
:ref:`application_run` for more details). | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/hello_world | ||
:board: esp32s2_lolin_mini | ||
:goals: build | ||
|
||
The usual ``flash`` target will work with the ``esp32s2_lolin_mini`` board | ||
configuration after putting the board into bootloader mode by holding the '0' | ||
button then pressing 'RST' and releasing the 'RST' button. | ||
|
||
Here is an example for the :ref:`hello_world` | ||
application. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/hello_world | ||
:board: esp32s2_lolin_mini | ||
:goals: flash | ||
|
||
Open a serial port using e.g. screen | ||
|
||
.. code-block:: shell | ||
screen /dev/ttyUSB0 115200 | ||
After the board has been manually reset and booted, you should see the following | ||
message in the monitor: | ||
|
||
.. code-block:: console | ||
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx ***** | ||
Hello World! esp32s2_lolin_mini | ||
References | ||
********** | ||
|
||
.. [1] https://www.espressif.com/en/products/socs/esp32-s2 | ||
.. _`ESP32S2 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf | ||
.. _`ESP32S2 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf |
22 changes: 22 additions & 0 deletions
22
boards/xtensa/esp32s2_lolin_mini/esp32s2_lolin_mini-pinctrl.dtsi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2023 Google, LLC | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h> | ||
#include <dt-bindings/pinctrl/esp32s2-pinctrl.h> | ||
#include <zephyr/dt-bindings/pinctrl/esp32s2-gpio-sigmap.h> | ||
|
||
&pinctrl { | ||
|
||
uart0_default: uart0_default { | ||
group1 { | ||
pinmux = <UART0_TX_GPIO16>; | ||
}; | ||
group2 { | ||
pinmux = <UART0_RX_GPIO17>; | ||
bias-pull-up; | ||
}; | ||
}; | ||
}; |
143 changes: 143 additions & 0 deletions
143
boards/xtensa/esp32s2_lolin_mini/esp32s2_lolin_mini.dts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* | ||
* Copyright (c) 2023 Google, LLC | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
|
||
#include <espressif/esp32s2.dtsi> | ||
#include "esp32s2_lolin_mini-pinctrl.dtsi" | ||
|
||
/ { | ||
model = "esp32s2_lolin_mini"; | ||
compatible = "espressif,esp32s2"; | ||
|
||
aliases { | ||
sw0 = &user_button; | ||
led0 = &user_led; | ||
watchdog0 = &wdt0; | ||
}; | ||
|
||
chosen { | ||
zephyr,sram = &sram0; | ||
zephyr,console = &uart0; | ||
zephyr,shell-uart = &uart0; | ||
zephyr,flash = &flash0; | ||
}; | ||
|
||
power-states { | ||
light_sleep: light_sleep { | ||
compatible = "zephyr,power-state"; | ||
power-state-name = "standby"; | ||
min-residency-us = <200>; | ||
exit-latency-us = <60>; | ||
}; | ||
|
||
deep_sleep: deep_sleep { | ||
compatible = "zephyr,power-state"; | ||
power-state-name = "soft-off"; | ||
min-residency-us = <2000>; | ||
exit-latency-us = <212>; | ||
}; | ||
}; | ||
|
||
leds { | ||
compatible = "gpio-leds"; | ||
user_led: led { | ||
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; | ||
label = "LED1"; | ||
}; | ||
}; | ||
|
||
gpio_keys { | ||
compatible = "gpio-keys"; | ||
user_button: user_button { | ||
label = "0"; | ||
gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; | ||
}; | ||
}; | ||
}; | ||
|
||
&cpu0 { | ||
clock-frequency = <ESP32_CLK_CPU_240M>; | ||
cpu-power-states = <&deep_sleep &light_sleep>; | ||
}; | ||
|
||
&uart0 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart0_default>; | ||
pinctrl-names = "default"; | ||
}; | ||
|
||
&gpio0 { | ||
status = "okay"; | ||
}; | ||
|
||
&gpio1 { | ||
status = "okay"; | ||
}; | ||
|
||
&timer0 { | ||
status = "disabled"; | ||
}; | ||
|
||
&timer1 { | ||
status = "disabled"; | ||
}; | ||
|
||
&timer2 { | ||
status = "disabled"; | ||
}; | ||
|
||
&timer3 { | ||
status = "disabled"; | ||
}; | ||
|
||
&trng0 { | ||
status = "okay"; | ||
}; | ||
|
||
&flash0 { | ||
status = "okay"; | ||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
/* Reserve 60kB for the bootloader */ | ||
boot_partition: partition@1000 { | ||
label = "mcuboot"; | ||
reg = <0x00001000 0x0000F000>; | ||
read-only; | ||
}; | ||
|
||
/* Reserve 1024kB for the application in slot 0 */ | ||
slot0_partition: partition@10000 { | ||
label = "image-0"; | ||
reg = <0x00010000 0x00100000>; | ||
}; | ||
|
||
/* Reserve 1024kB for the application in slot 1 */ | ||
slot1_partition: partition@110000 { | ||
label = "image-1"; | ||
reg = <0x00110000 0x00100000>; | ||
}; | ||
|
||
/* Reserve 256kB for the scratch partition */ | ||
scratch_partition: partition@210000 { | ||
label = "image-scratch"; | ||
reg = <0x00210000 0x00040000>; | ||
}; | ||
|
||
storage_partition: partition@250000 { | ||
label = "storage"; | ||
reg = <0x00250000 0x00006000>; | ||
}; | ||
}; | ||
}; | ||
|
||
&wdt0 { | ||
status = "okay"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
identifier: esp32s2_lolin_mini | ||
name: Lolin ESP32-S2 Mini | ||
type: mcu | ||
arch: xtensa | ||
toolchain: | ||
- zephyr | ||
supported: | ||
- gpio | ||
- watchdog | ||
- uart | ||
testing: | ||
ignore_tags: | ||
- net | ||
- bluetooth |
22 changes: 22 additions & 0 deletions
22
boards/xtensa/esp32s2_lolin_mini/esp32s2_lolin_mini_defconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
CONFIG_XTENSA_RESET_VECTOR=n | ||
|
||
CONFIG_BOARD_ESP32S2_LOLIN_MINI=y | ||
CONFIG_SOC_ESP32S2=y | ||
CONFIG_MAIN_STACK_SIZE=2048 | ||
|
||
CONFIG_CONSOLE=y | ||
CONFIG_SERIAL=y | ||
CONFIG_UART_CONSOLE=y | ||
|
||
CONFIG_XTENSA_USE_CORE_CRT1=n | ||
|
||
CONFIG_GPIO=y | ||
|
||
CONFIG_GEN_ISR_TABLES=y | ||
CONFIG_GEN_IRQ_VECTOR_TABLE=n | ||
|
||
CONFIG_CLOCK_CONTROL=y | ||
|
||
CONFIG_BOOTLOADER_ESP_IDF=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set ESP_RTOS none | ||
|
||
source [find interface/ftdi/esp32s2_kaluga_v1.cfg] | ||
source [find target/esp32s2.cfg] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters