-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/esp32: add support for ESP32-S3 #18421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
benpicco
merged 8 commits into
RIOT-OS:master
from
gschorcht:cpu/esp32/add_esp32s3_cpu_support
Aug 22, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9c834f5
cpu/esp32/bootloader: add ESP32-S3 support
gschorcht d42b20d
cpu/esp_common: changes for ESP32-S3
gschorcht 55e1f88
cpu/esp32: add ESP32-S3 specific configuration header files
gschorcht 945a960
cpu/esp32: add ESP32-S3 support in peripheral drivers
gschorcht 84a1dec
boards/common: add common board definition for ESP32-S3
gschorcht 9e9a227
boards/esp32s3: add ESP32-S3-DevKit board definition
gschorcht a76f5fd
cpu/esp32: disable ESP-IDF dac API compilation if periph_dac isn't used
gschorcht e7bf789
cpu/esp32: move CLOCK_CORECLOCK to periph_cpu_*.h
gschorcht File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,20 @@ | ||
| # Copyright (c) 2020 HAW Hamburg | ||
| # 2022 Gunar Schorcht | ||
| # | ||
| # This file is subject to the terms and conditions of the GNU Lesser | ||
| # General Public License v2.1. See the file LICENSE in the top level | ||
| # directory for more details. | ||
|
|
||
| config BOARD_COMMON_ESP32S3 | ||
| bool | ||
| select HAS_PERIPH_UART | ||
| select HAVE_SAUL_GPIO | ||
|
|
||
| config MODULE_BOARDS_COMMON_ESP32S3 | ||
| bool | ||
| depends on TEST_KCONFIG | ||
| depends on BOARD_COMMON_ESP32S3 | ||
| depends on HAS_ARCH_ESP32 | ||
| default y | ||
| help | ||
| Common ESP32-S3 boards code. |
This file contains hidden or 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,3 @@ | ||
| MODULE = boards_common_esp32s3 | ||
|
|
||
| include $(RIOTBASE)/Makefile.base |
This file contains hidden or 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,5 @@ | ||
| USEMODULE += boards_common_esp32s3 | ||
|
|
||
| ifneq (,$(filter saul_default,$(USEMODULE))) | ||
| USEMODULE += saul_gpio | ||
| endif |
This file contains hidden or 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,5 @@ | ||
| CPU = esp32 | ||
| CPU_FAM = esp32s3 | ||
|
|
||
| # additional features provided by all boards is at least one UART | ||
| FEATURES_PROVIDED += periph_uart |
This file contains hidden or 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,5 @@ | ||
| INCLUDES += -I$(RIOTBOARD)/common/esp32s3/include | ||
|
|
||
| # configure the serial interface | ||
| PORT_LINUX ?= /dev/ttyUSB0 | ||
| PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) |
This file contains hidden or 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,99 @@ | ||
| /* | ||
| * Copyright (C) 2021 Gunar Schorcht | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup boards_common_esp32s3 | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Common declarations and functions for all ESP32-S3 boards. | ||
| * | ||
| * This file contains default declarations and functions that are valid | ||
| * for all ESP32-S3 boards. | ||
| * | ||
| * @author Gunar Schorcht <gunar@schorcht.net> | ||
| */ | ||
|
|
||
| #include "board.h" | ||
| #include "esp_common.h" | ||
| #include "kernel_defines.h" | ||
| #include "log.h" | ||
| #include "periph/gpio.h" | ||
| #include "periph/spi.h" | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| extern void adc_print_config(void); | ||
| extern void dac_print_config(void); | ||
| extern void pwm_print_config(void); | ||
| extern void i2c_print_config(void); | ||
| extern void spi_print_config(void); | ||
| extern void uart_print_config(void); | ||
| extern void can_print_config(void); | ||
|
|
||
| void print_board_config(void) | ||
| { | ||
| ets_printf("\nBoard configuration:\n"); | ||
|
|
||
| #if IS_USED(MODULE_PERIPH_ADC) | ||
| adc_print_config(); | ||
| #endif | ||
| #if IS_USED(MODULE_PERIPH_DAC) | ||
| dac_print_config(); | ||
| #endif | ||
| #if IS_USED(MODULE_PERIPH_PWM) | ||
| pwm_print_config(); | ||
| #endif | ||
| #if IS_USED(MODULE_PERIPH_I2C) | ||
| i2c_print_config(); | ||
| #endif | ||
| #if IS_USED(MODULE_PERIPH_SPI) | ||
| spi_print_config(); | ||
| #endif | ||
| #if IS_USED(MODULE_PERIPH_UART) | ||
| uart_print_config(); | ||
| #endif | ||
|
|
||
| #if IS_USED(MODULE_PERIPH_CAN) | ||
| can_print_config(); | ||
| #endif | ||
|
|
||
| ets_printf("\tLED\t\tpins=[ "); | ||
| #ifdef LED0_PIN | ||
| ets_printf("%d ", LED0_PIN); | ||
| #endif | ||
| #ifdef LED1_PIN | ||
| ets_printf("%d ", LED1_PIN); | ||
| #endif | ||
| #ifdef LED2_PIN | ||
| ets_printf("%d ", LED2_PIN); | ||
| #endif | ||
| ets_printf("]\n"); | ||
|
|
||
| ets_printf("\tBUTTONS\t\tpins=[ "); | ||
| #ifdef BUTTON0_PIN | ||
| ets_printf("%d ", BUTTON0_PIN); | ||
| #endif | ||
| #ifdef BUTTON2_PIN | ||
| ets_printf("%d ", BUTTON1_PIN); | ||
| #endif | ||
| #ifdef BUTTON3_PIN | ||
| ets_printf("%d ", BUTTON2_PIN); | ||
| #endif | ||
| ets_printf("]\n"); | ||
|
|
||
| ets_printf("\n"); | ||
| } | ||
|
|
||
| #ifdef __cplusplus | ||
| } /* end extern "C" */ | ||
| #endif | ||
|
|
||
| /** @} */ |
This file contains hidden or 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,28 @@ | ||
| /* | ||
| * Copyright (C) 2018 Gunar Schorcht | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @defgroup boards_common_esp32s3 ESP32-S3 Common | ||
| * @ingroup boards_common | ||
| * @ingroup boards_esp32s3 | ||
| * @brief Definitions and configurations that are common for | ||
| * all ESP32-S3 boards. | ||
| * | ||
| * For detailed information about the ESP32-S3, configuring and compiling RIOT | ||
| * for ESP32-S3 boards, please refer \ref esp32_riot. | ||
| */ | ||
|
|
||
| /** | ||
| * @defgroup boards_esp32s3 ESP32-S3 Boards | ||
| * @ingroup boards | ||
| * @brief This group of boards contains the documentation of ESP32-S3 boards. | ||
| * | ||
| * @note For detailed information about the ESP32-S3 SoC, the tool chain | ||
| * as well as configuring and compiling RIOT for ESP32-S3 boards, | ||
| * see \ref esp32_riot. | ||
| */ |
This file contains hidden or 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,72 @@ | ||
| /* | ||
| * Copyright (C) 2022 Gunar Schorcht | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup boards_common_esp32s3 | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Common board definitions for the Arduino API | ||
| * | ||
| * @author Gunar Schorcht <gunar@schorcht.net> | ||
| */ | ||
|
|
||
| #ifndef ARDUINO_BOARD_COMMON_H | ||
| #define ARDUINO_BOARD_COMMON_H | ||
|
|
||
| #include "arduino_pinmap.h" | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
| #endif | ||
|
|
||
| /** | ||
| * @brief Look-up table for the Arduino's digital pins | ||
| */ | ||
| static const gpio_t arduino_pinmap[] = { | ||
| ARDUINO_PIN_0, | ||
| ARDUINO_PIN_1, | ||
| ARDUINO_PIN_2, | ||
| ARDUINO_PIN_3, | ||
| ARDUINO_PIN_4, | ||
| ARDUINO_PIN_5, | ||
| ARDUINO_PIN_6, | ||
| ARDUINO_PIN_7, | ||
| ARDUINO_PIN_8, | ||
| ARDUINO_PIN_9, | ||
| ARDUINO_PIN_10, | ||
| ARDUINO_PIN_11, | ||
| ARDUINO_PIN_12, | ||
| ARDUINO_PIN_13, | ||
| ARDUINO_PIN_A0, | ||
| ARDUINO_PIN_A1, | ||
| ARDUINO_PIN_A2, | ||
| ARDUINO_PIN_A3, | ||
| ARDUINO_PIN_A4, | ||
| ARDUINO_PIN_A5 | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Look-up table for the Arduino's analog pins | ||
| */ | ||
| static const adc_t arduino_analog_map[] = { | ||
| ARDUINO_PIN_A0, | ||
| ARDUINO_PIN_A1, | ||
| ARDUINO_PIN_A2, | ||
| ARDUINO_PIN_A3, | ||
| ARDUINO_PIN_A4, | ||
| ARDUINO_PIN_A5 | ||
| }; | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* ARDUINO_BOARD_COMMON_H */ | ||
| /** @} */ |
This file contains hidden or 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,126 @@ | ||
| /* | ||
| * Copyright (C) 2022 Gunar Schorcht | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup boards_common_esp32s3 | ||
| * @brief Common board definitions for ESP32-S3 boards. | ||
| * | ||
| * This file contains board configurations that are valid for all | ||
| * ESP32-S3 boards. | ||
| * | ||
| * For detailed information about the configuration of ESP32-S3 boards, see | ||
| * section \ref esp32_peripherals "Common Peripherals". | ||
| * | ||
| * @author Gunar Schorcht <gunar@schorcht.net> | ||
| * @file | ||
| * @{ | ||
| */ | ||
|
|
||
| #ifndef BOARD_COMMON_H | ||
| #define BOARD_COMMON_H | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| #include "cpu.h" | ||
| #include "periph_conf.h" | ||
| #if MODULE_ARDUINO | ||
| #include "arduino_pinmap.h" | ||
| #endif | ||
|
|
||
| #include "periph/gpio.h" | ||
| #include "sdkconfig.h" | ||
|
|
||
| #if MODULE_MTD | ||
| #include "mtd.h" | ||
| #endif | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| /** | ||
| * @name LED configuration (three predefined LEDs at maximum) | ||
| * | ||
| * @note LEDx_ACTIVE value must be declared in board configuration. | ||
| * @{ | ||
| */ | ||
| #if defined(LED0_PIN) || DOXYGEN | ||
| #define LED0_MASK (BIT(LED0_PIN)) | ||
| #define LED0_ON (gpio_write(LED0_PIN, LED0_ACTIVE)) | ||
| #define LED0_OFF (gpio_write(LED0_PIN, !LED0_ACTIVE)) | ||
| #define LED0_TOGGLE (gpio_toggle(LED0_PIN)) | ||
| #endif | ||
|
|
||
| #if defined(LED1_PIN) || DOXYGEN | ||
| #define LED1_MASK (BIT(LED1_PIN)) | ||
| #define LED1_ON (gpio_write(LED1_PIN, LED1_ACTIVE)) | ||
| #define LED1_OFF (gpio_write(LED1_PIN, !LED1_ACTIVE)) | ||
| #define LED1_TOGGLE (gpio_toggle(LED1_PIN)) | ||
| #endif | ||
|
|
||
| #if defined(LED2_PIN) || DOXYGEN | ||
| #define LED2_MASK (BIT(LED2_PIN)) | ||
| #define LED2_ON (gpio_write(LED2_PIN, LED2_ACTIVE)) | ||
| #define LED2_OFF (gpio_write(LED2_PIN, !LED2_ACTIVE)) | ||
| #define LED2_TOGGLE (gpio_toggle(LED2_PIN)) | ||
| #endif | ||
| /** @} */ | ||
|
|
||
| /** | ||
| * @name STDIO configuration | ||
| * @{ | ||
| */ | ||
| /**< Default baudrate of UART for stdio */ | ||
| #ifndef STDIO_UART_BAUDRATE | ||
| #define STDIO_UART_BAUDRATE (115200) | ||
| #endif | ||
| /** @} */ | ||
|
|
||
| #if MODULE_MTD || DOXYGEN | ||
| /** | ||
| * @name MTD system drive configuration | ||
| * | ||
| * Built-in SPI flash memory is used as MTD system drive. | ||
| * @{ | ||
| */ | ||
|
|
||
| /** | ||
| * @brief MTD drive start address in SPI flash memory | ||
| * | ||
| * Defines the start address of the MTD system device in the SPI | ||
| * flash memory. It can be overridden by \ref esp32_application_specific_configurations | ||
| * "application-specific board configuration" | ||
| * | ||
| * If the MTD start address is not defined or is 0, the first possible | ||
| * multiple of 0x100000 (1 MByte) is used in free SPI flash memory, | ||
| * which was determined from the partition table. | ||
| */ | ||
| #ifndef SPI_FLASH_DRIVE_START | ||
| #define SPI_FLASH_DRIVE_START 0 | ||
| #endif | ||
|
|
||
| /** Default MTD drive definition */ | ||
| #define MTD_0 mtd0 | ||
|
|
||
| /** Pointer to the default MTD drive structure */ | ||
| extern mtd_dev_t *mtd0; | ||
|
|
||
| /** @} */ | ||
| #endif /* MODULE_MTD || DOXYGEN */ | ||
|
|
||
| /** | ||
| * @brief Print the board configuration in a human readable format | ||
| */ | ||
| void print_board_config(void); | ||
|
|
||
| #ifdef __cplusplus | ||
| } /* end extern "C" */ | ||
| #endif | ||
|
|
||
| #endif /* BOARD_COMMON_H */ | ||
| /** @} */ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.