diff --git a/boards/xtensa/esp32s2_franzininho/Kconfig.board b/boards/xtensa/esp32s2_franzininho/Kconfig.board new file mode 100644 index 0000000000000..3f78d5baf931e --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/Kconfig.board @@ -0,0 +1,8 @@ +# ESP32S2 Franzininho board configuration + +# Copyright (c) 2022 Felipe Neves +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ESP32S2_FRANZININHO + bool "ESP32S2 Franzininho Board" + depends on SOC_ESP32S2 diff --git a/boards/xtensa/esp32s2_franzininho/Kconfig.defconfig b/boards/xtensa/esp32s2_franzininho/Kconfig.defconfig new file mode 100644 index 0000000000000..4ef2fdce9bb0d --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/Kconfig.defconfig @@ -0,0 +1,11 @@ +# ESP32S2 Franzininho board configuration + +# Copyright (c) 2022 Felipe Neves +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "esp32s2_franzininho" + depends on BOARD_ESP32S2_FRANZININHO + +config ENTROPY_GENERATOR + default y diff --git a/boards/xtensa/esp32s2_franzininho/board.cmake b/boards/xtensa/esp32s2_franzininho/board.cmake new file mode 100644 index 0000000000000..2f04d1fe8861e --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/board.cmake @@ -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) diff --git a/boards/xtensa/esp32s2_franzininho/doc/img/esp32_s2_franzininho.jpg b/boards/xtensa/esp32s2_franzininho/doc/img/esp32_s2_franzininho.jpg new file mode 100644 index 0000000000000..fce18f48e63d2 Binary files /dev/null and b/boards/xtensa/esp32s2_franzininho/doc/img/esp32_s2_franzininho.jpg differ diff --git a/boards/xtensa/esp32s2_franzininho/doc/index.rst b/boards/xtensa/esp32s2_franzininho/doc/index.rst new file mode 100644 index 0000000000000..20ea1c864b477 --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/doc/index.rst @@ -0,0 +1,93 @@ +.. _esp32s2_franzininho: + +ESP32-S2 Franzininho +#################### + +Overview +******** + +Franzininho is an educational development board based on ESP32-S2 which 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 + +.. figure:: img/esp32_s2_franzininho.jpg + :align: center + :alt: ESP32-S2 FRANZININHO + +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_franzininho + :goals: build + +The usual ``flash`` target will work with the ``esp32s2_franzininho`` board +configuration. Here is an example for the :ref:`hello_world` +application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: esp32s2_franzininho + :goals: flash + +Open the serial monitor using the following command: + +.. code-block:: shell + + west espressif monitor + +After the board has automatically 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_franzininho + +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 diff --git a/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho-pinctrl.dtsi b/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho-pinctrl.dtsi new file mode 100644 index 0000000000000..c00040066e069 --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho-pinctrl.dtsi @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Felipe Neves. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +&pinctrl { + + uart0_default: uart0_default { + group1 { + pinmux = ; + }; + group2 { + pinmux = ; + bias-pull-up; + }; + }; + + spim2_default: spim2_default { + group1 { + pinmux = , + , + ; + }; + group2 { + pinmux = ; + output-low; + }; + }; + + spim3_default: spim3_default { + group1 { + pinmux = , + , + ; + }; + group2 { + pinmux = ; + output-low; + }; + }; + + i2c0_default: i2c0_default { + group1 { + pinmux = , + ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; + + i2c1_default: i2c1_default { + group1 { + pinmux = , + ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; + +}; diff --git a/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho.dts b/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho.dts new file mode 100644 index 0000000000000..f7492d6966205 --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho.dts @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2022 Felipe Neves. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "esp32s2_franzininho-pinctrl.dtsi" + +/ { + model = "esp32s2_franzininho"; + compatible = "espressif,esp32s2"; + + aliases { + led0 = &user_led_0; + led1 = &user_led_1; + i2c-0 = &i2c0; + watchdog0 = &wdt0; + }; + + chosen { + zephyr,sram = &sram0; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + + user_led_0: led_0 { + gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>; + label = "User - LED0"; + }; + + user_led_1: led_1 { + gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; + label = "User - LED1"; + }; + }; +}; + +&cpu0 { + clock-frequency = ; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +}; + +&timer2 { + status = "okay"; +}; + +&timer3 { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; +}; + +&i2c1 { + clock-frequency = ; + pinctrl-0 = <&i2c1_default>; + pinctrl-names = "default"; +}; + +&trng0 { + status = "okay"; +}; + +&spi2 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + pinctrl-0 = <&spim2_default>; + pinctrl-names = "default"; +}; + +&spi3 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + pinctrl-0 = <&spim3_default>; + pinctrl-names = "default"; +}; + +&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"; +}; diff --git a/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho.yaml b/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho.yaml new file mode 100644 index 0000000000000..cf4d884291d34 --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho.yaml @@ -0,0 +1,18 @@ +identifier: esp32s2_franzininho +name: ESP32-S2 +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - gpio + - i2c + - watchdog + - uart + - pinmux + - nvs +testing: + ignore_tags: + - heap + - net + - bluetooth diff --git a/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho_defconfig b/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho_defconfig new file mode 100644 index 0000000000000..0e8d4af0b02e9 --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/esp32s2_franzininho_defconfig @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_XTENSA_RESET_VECTOR=n + +CONFIG_BOARD_ESP32S2_FRANZININHO=y +CONFIG_SOC_ESP32S2=y +CONFIG_MAIN_STACK_SIZE=2048 + +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=240000000 + +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 diff --git a/boards/xtensa/esp32s2_franzininho/support/openocd.cfg b/boards/xtensa/esp32s2_franzininho/support/openocd.cfg new file mode 100644 index 0000000000000..f75d53b0b34cd --- /dev/null +++ b/boards/xtensa/esp32s2_franzininho/support/openocd.cfg @@ -0,0 +1,4 @@ +set ESP_RTOS none + +source [find interface/ftdi/esp32s2_kaluga_v1.cfg] +source [find target/esp32s2.cfg]