Merge pull request #5615 from microDev1/espressif

Update espressif port
This commit is contained in:
Dan Halbert 2021-12-03 14:55:05 -05:00 committed by GitHub
commit f594ab2e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 417 additions and 158 deletions

2
.gitmodules vendored
View File

@ -149,7 +149,7 @@
[submodule "ports/espressif/esp-idf"] [submodule "ports/espressif/esp-idf"]
path = ports/espressif/esp-idf path = ports/espressif/esp-idf
url = https://github.com/espressif/esp-idf.git url = https://github.com/espressif/esp-idf.git
branch = release/v4.3 branch = release/v4.4
[submodule "ports/espressif/certificates/nina-fw"] [submodule "ports/espressif/certificates/nina-fw"]
path = ports/espressif/certificates/nina-fw path = ports/espressif/certificates/nina-fw
url = https://github.com/adafruit/nina-fw.git url = https://github.com/adafruit/nina-fw.git

View File

@ -213,7 +213,7 @@ Supported Support status
================ ============================================================ ================ ============================================================
atmel-samd ``SAMD21`` stable | ``SAMD51`` stable atmel-samd ``SAMD21`` stable | ``SAMD51`` stable
cxd56 stable cxd56 stable
espressif ``ESP32-C3`` beta | ``ESP32-S2`` stable espressif ``ESP32-C3`` beta | ``ESP32-S2`` stable | ``ESP32-S3`` beta
litex alpha litex alpha
mimxrt10xx alpha mimxrt10xx alpha
nrf stable nrf stable
@ -229,7 +229,7 @@ unix alpha
Boards Boards
~~~~~~ ~~~~~~
- Each ``port`` has a ``boards`` directory containing variations of boards - Each ``port`` has a ``boards`` directory containing boards
which belong to a specific microcontroller line. which belong to a specific microcontroller line.
- A list of native modules supported by a particular board can be found - A list of native modules supported by a particular board can be found
`here <https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html>`__. `here <https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html>`__.

View File

@ -59,19 +59,20 @@ include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds. # Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk include $(TOP)/py/circuitpy_defns.mk
ifeq ($(IDF_TARGET),esp32s2) ifeq ($(IDF_TARGET),esp32c3)
IDF_TARGET_ARCH = xtensa
CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf-
else ifeq ($(IDF_TARGET),esp32c3)
IDF_TARGET_ARCH = riscv IDF_TARGET_ARCH = riscv
CROSS_COMPILE = riscv32-esp-elf- CROSS_COMPILE = riscv32-esp-elf-
else
IDF_TARGET_ARCH = xtensa
CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf-
endif endif
####################################### #######################################
# CFLAGS # CFLAGS
####################################### #######################################
INC += -I.\ INC += \
-I.\
-I./boards \ -I./boards \
-I./boards/$(BOARD) \ -I./boards/$(BOARD) \
-I./peripherals \ -I./peripherals \
@ -92,6 +93,7 @@ INC += -I.\
-isystem esp-idf/components/esp_common/include \ -isystem esp-idf/components/esp_common/include \
-isystem esp-idf/components/esp_event/include \ -isystem esp-idf/components/esp_event/include \
-isystem esp-idf/components/esp_hw_support/include \ -isystem esp-idf/components/esp_hw_support/include \
-isystem esp-idf/components/esp_hw_support/include/soc \
-isystem esp-idf/components/esp_netif/include \ -isystem esp-idf/components/esp_netif/include \
-isystem esp-idf/components/esp_pm/include \ -isystem esp-idf/components/esp_pm/include \
-isystem esp-idf/components/esp_ringbuf/include \ -isystem esp-idf/components/esp_ringbuf/include \
@ -101,6 +103,8 @@ INC += -I.\
-isystem esp-idf/components/esp_wifi/include \ -isystem esp-idf/components/esp_wifi/include \
-isystem esp-idf/components/freertos/include \ -isystem esp-idf/components/freertos/include \
-isystem esp-idf/components/freertos/include/freertos \ -isystem esp-idf/components/freertos/include/freertos \
-isystem esp-idf/components/freertos/include/esp_additions \
-isystem esp-idf/components/freertos/include/esp_additions/freertos \
-isystem esp-idf/components/freertos/port/$(IDF_TARGET_ARCH)/include \ -isystem esp-idf/components/freertos/port/$(IDF_TARGET_ARCH)/include \
-isystem esp-idf/components/hal/include \ -isystem esp-idf/components/hal/include \
-isystem esp-idf/components/hal/$(IDF_TARGET)/include \ -isystem esp-idf/components/hal/$(IDF_TARGET)/include \
@ -126,7 +130,8 @@ ifeq ($(IDF_TARGET),esp32c3)
CFLAGS += -include "esp32c3_fix.h" CFLAGS += -include "esp32c3_fix.h"
endif endif
CFLAGS += -DHAVE_CONFIG_H \ CFLAGS += \
-DHAVE_CONFIG_H \
-DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" \ -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" \
-DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX
@ -158,33 +163,38 @@ endif
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
LDFLAGS += -L$(BUILD)/esp-idf/esp-idf/$(IDF_TARGET) \ LDFLAGS += \
-L$(BUILD)/esp-idf/esp-idf/$(IDF_TARGET)/ld \ -L$(BUILD)/esp-idf/esp-idf/esp_system/ld \
-Lesp-idf/components/$(IDF_TARGET)/ld \
-Lesp-idf/components/esp_rom/$(IDF_TARGET)/ld \ -Lesp-idf/components/esp_rom/$(IDF_TARGET)/ld \
-T$(IDF_TARGET)_out.ld \ -Lesp-idf/components/soc/$(IDF_TARGET)/ld \
-T$(IDF_TARGET).project.ld \ -Tmemory.ld \
-Tsections.ld \
-T$(IDF_TARGET).peripherals.ld \ -T$(IDF_TARGET).peripherals.ld \
-T$(IDF_TARGET).rom.ld \ -T$(IDF_TARGET).rom.ld \
-T$(IDF_TARGET).rom.api.ld \ -T$(IDF_TARGET).rom.api.ld \
-T$(IDF_TARGET).rom.libgcc.ld \ -T$(IDF_TARGET).rom.libgcc.ld \
-T$(IDF_TARGET).rom.newlib-nano.ld -T$(IDF_TARGET).rom.newlib-nano.ld \
-Wl,-Bstatic \
ifeq ($(IDF_TARGET),esp32c3)
LDFLAGS += -Tesp32c3.rom.newlib.ld \
-Tesp32c3.rom.version.ld \
-Tesp32c3.rom.eco3.ld
else
LDFLAGS += -T$(IDF_TARGET).rom.newlib-data.ld \
-T$(IDF_TARGET).rom.newlib-funcs.ld \
-T$(IDF_TARGET).rom.spiflash.ld
endif
LDFLAGS += -Wl,-Bstatic \
-Wl,--no-warn-mismatch \ -Wl,--no-warn-mismatch \
-Wl,--build-id=none \ -Wl,--build-id=none \
-fno-rtti -fno-rtti
ifeq ($(IDF_TARGET),esp32c3)
LDFLAGS += \
-Tesp32c3.rom.newlib.ld \
-Tesp32c3.rom.version.ld \
-Tesp32c3.rom.eco3.ld
else ifeq ($(IDF_TARGET),esp32s2)
LDFLAGS += \
-T$(IDF_TARGET).rom.newlib-data.ld \
-T$(IDF_TARGET).rom.newlib-funcs.ld \
-T$(IDF_TARGET).rom.spiflash.ld
else ifeq ($(IDF_TARGET),esp32s3)
LDFLAGS += \
-Tesp32s3.rom.newlib.ld \
-Tesp32s3.rom.version.ld
endif
LIBS := -lgcc -lc -lstdc++ LIBS := -lgcc -lc -lstdc++
# Use toolchain libm if we're not using our own. # Use toolchain libm if we're not using our own.
@ -226,10 +236,13 @@ SRC_C += \
ifneq ($(IDF_TARGET),esp32c3) ifneq ($(IDF_TARGET),esp32c3)
SRC_C += \ SRC_C += \
cam.c \
i2s_lcd_esp32s2_driver.c \
peripherals/pcnt.c \ peripherals/pcnt.c \
peripherals/touch.c peripherals/touch.c
ifeq ($(IDF_TARGET),esp32s2)
SRC_C += \
cam.c \
i2s_lcd_esp32s2_driver.c
endif
endif endif
$(BUILD)/i2s_lcd_esp32s2_driver.o: CFLAGS += -Wno-sign-compare $(BUILD)/i2s_lcd_esp32s2_driver.o: CFLAGS += -Wno-sign-compare
@ -238,17 +251,16 @@ ifneq ($(CIRCUITPY_USB),0)
SRC_C += lib/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c SRC_C += lib/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c
endif endif
SRC_S = SRC_COMMON_HAL_EXPANDED = \
$(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \ $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
$(addprefix common-hal/, $(SRC_COMMON_HAL)) $(addprefix common-hal/, $(SRC_COMMON_HAL))
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \ SRC_SHARED_MODULE_EXPANDED = \
$(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
$(addprefix shared-module/, $(SRC_SHARED_MODULE)) \ $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \
$(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL))
ifneq ($(FROZEN_MPY_DIR),) ifneq ($(FROZEN_MPY_DIR),)
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py') FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy)) FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
@ -261,7 +273,6 @@ ifeq ($(INTERNAL_LIBM),1)
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
endif endif
OBJ += $(addprefix $(BUILD)/, $(SRC_CIRCUITPY_COMMON:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_CIRCUITPY_COMMON:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.S=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os $(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
@ -271,8 +282,6 @@ $(BUILD)/lib/protomatter/src/core.o: CFLAGS += -DESP32
# List of sources for qstr extraction # List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
# Sources that only hold QSTRs after pre-processing.
SRC_QSTR_PREPROCESSOR +=
# IDF build commands # IDF build commands
IDF_PATH = $(realpath ./esp-idf) IDF_PATH = $(realpath ./esp-idf)
@ -315,32 +324,28 @@ menuconfig: $(BUILD)/esp-idf/config
# qstr builds include headers so we need to make sure they are up to date # qstr builds include headers so we need to make sure they are up to date
$(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h $(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h
ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET) $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_netif esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a
BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS))
ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a) ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
MBEDTLS_COMPONENTS_LINK = crypto tls x509 MBEDTLS_COMPONENTS_LINK = crypto tls x509
MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a) MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a)
BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libphy.a
ifneq ($(IDF_TARGET),esp32c3)
BINARY_WIFI_BLOBS += librtc.a
endif
BINARY_BLOBS = $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS))
ifeq ($(IDF_TARGET_ARCH),xtensa) ifeq ($(IDF_TARGET_ARCH),xtensa)
BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
endif endif
ifeq ($(IDF_TARGET), esp32c3) ifeq ($(IDF_TARGET),esp32c3)
ESPTOOL_BAUDRATE = 230400 BOOTLOADER_OFFSET = 0x0
BOOTLOADER_OFFSET = 0x0000 else ifeq ($(IDF_TARGET),esp32s3)
BOOTLOADER_OFFSET = 0x0
else else
ESPTOOL_BAUDRATE = 460800
BOOTLOADER_OFFSET = 0x1000 BOOTLOADER_OFFSET = 0x1000
endif endif
PARTITION_TABLE_OFFSET = 0x8000 PARTITION_TABLE_OFFSET = 0x8000
FIRMWARE_OFFSET = 0x10000 FIRMWARE_OFFSET = 0x10000
@ -348,7 +353,7 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/$(IDF_TARGET)/$(IDF_TARGET)_out.ld $(B
FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE)
ESPTOOL_FLAGS ?= -b $(ESPTOOL_BAUDRATE) --before=default_reset --after=no_reset ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset
ifeq ($(IDF_TARGET),esp32c3) ifeq ($(IDF_TARGET),esp32c3)
all: $(BUILD)/firmware.bin all: $(BUILD)/firmware.bin
@ -360,17 +365,18 @@ endif
esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
$(Q)ninja -C $(BUILD)/esp-idf \ $(Q)ninja -C $(BUILD)/esp-idf \
bootloader/bootloader.bin \ bootloader/bootloader.bin \
esp-idf/esp_system/__ldgen_output_sections.ld \
esp-idf/app_update/libapp_update.a \ esp-idf/app_update/libapp_update.a \
esp-idf/bootloader_support/libbootloader_support.a \ esp-idf/bootloader_support/libbootloader_support.a \
esp-idf/driver/libdriver.a \ esp-idf/driver/libdriver.a \
esp-idf/efuse/libefuse.a \ esp-idf/efuse/libefuse.a \
esp-idf/$(IDF_TARGET)/lib$(IDF_TARGET).a \
esp-idf/$(IDF_TARGET)/ld/$(IDF_TARGET).project.ld \
esp-idf/esp_adc_cal/libesp_adc_cal.a \ esp-idf/esp_adc_cal/libesp_adc_cal.a \
esp-idf/esp_common/libesp_common.a \ esp-idf/esp_common/libesp_common.a \
esp-idf/esp_event/libesp_event.a \ esp-idf/esp_event/libesp_event.a \
esp-idf/esp_hw_support/libesp_hw_support.a \ esp-idf/esp_hw_support/libesp_hw_support.a \
esp-idf/esp_ipc/libesp_ipc.a \
esp-idf/esp_netif/libesp_netif.a \ esp-idf/esp_netif/libesp_netif.a \
esp-idf/esp_phy/libesp_phy.a \
esp-idf/esp_pm/libesp_pm.a \ esp-idf/esp_pm/libesp_pm.a \
esp-idf/esp_ringbuf/libesp_ringbuf.a \ esp-idf/esp_ringbuf/libesp_ringbuf.a \
esp-idf/esp_rom/libesp_rom.a \ esp-idf/esp_rom/libesp_rom.a \

View File

@ -11,6 +11,7 @@ Support Status:
ESP32-C3, "beta" ESP32-C3, "beta"
ESP32-S2, "stable" ESP32-S2, "stable"
ESP32-S3, "beta"
How this port is organized: How this port is organized:
--------------------------------------- ---------------------------------------
@ -31,9 +32,11 @@ Connecting to the ESP32-C3
**USB Connetion:** **USB Connetion:**
On ESP32-C3 REV3 chips, a USB Serial/JTAG Controller is available. Note: The USB connection cannot be used for a ``CIRCUITPY`` drive. On ESP32-C3 REV3 chips, a USB Serial/JTAG Controller is available. Note: This USB connection cannot be used for a ``CIRCUITPY`` drive.
Depending on the board you have the USB port may or may not be connected to native USB, if it isn't connected to native USB then following connections need to be made to get serial console, REPL interface, flashing CircuitPython and JTAG debugging. Depending on the board you have, the USB port may or may not be connected to native USB.
Following connections need to be made if native USB isn't available on USB port:
.. csv-table:: .. csv-table::
:header: GPIO, USB :header: GPIO, USB
@ -47,7 +50,9 @@ Connect these pins using a `USB adapter <https://www.adafruit.com/product/4090>`
**UART Connection:** **UART Connection:**
A `USB to UART convertor <https://www.adafruit.com/product/3309>`_ can be used for connecting to ESP32-C3 to get serial console, REPL interface and flashing CircuitPython. Following connections need to be made in this case. A `USB to UART convertor <https://www.adafruit.com/product/3309>`_ can be used for connecting to ESP32-C3 to get serial console, REPL interface and flashing CircuitPython.
Following connections need to be made in this case.
.. csv-table:: .. csv-table::
:header: GPIO, UART :header: GPIO, UART
@ -66,7 +71,9 @@ Connecting to the ESP32-S2
**USB Connetion:** **USB Connetion:**
Depending on the board you have the USB port may or may not be connected to native USB, if it isn't connected to native USB then following connections need to be made to get CircuitPython working. Depending on the board you have, the USB port may or may not be connected to native USB.
Following connections need to be made if native USB isn't available on USB port:
.. csv-table:: .. csv-table::
:header: GPIO, USB :header: GPIO, USB
@ -78,16 +85,79 @@ Depending on the board you have the USB port may or may not be connected to nati
Connect these pins using a `USB adapter <https://www.adafruit.com/product/4090>`_ or `breakout cable <https://www.adafruit.com/product/4448>`_ to access the CircuitPython drive. Connect these pins using a `USB adapter <https://www.adafruit.com/product/4090>`_ or `breakout cable <https://www.adafruit.com/product/4448>`_ to access the CircuitPython drive.
**UART Connection:**
A `USB to UART convertor <https://www.adafruit.com/product/3309>`_ can be used for connecting to ESP32-S2 to get serial console and flashing CircuitPython.
Following connections need to be made in this case:
.. csv-table::
:header: GPIO, UART
43, "RX"
44, "TX"
GND, "GND"
5V, "5V"
**BLE Connection:**
This feature isn't available on ESP32-S2.
Connecting to the ESP32-S3
---------------------------------------
**USB Connetion:**
Depending on the board you have, the USB port may or may not be connected to native USB.
Following connections need to be made if native USB isn't available on USB port:
.. csv-table::
:header: GPIO, USB
20, "D+ (green)"
19, "D- (white)"
GND, "GND (black)"
5V, "5V (red)"
Connect these pins using a `USB adapter <https://www.adafruit.com/product/4090>`_ or `breakout cable <https://www.adafruit.com/product/4448>`_ to access the CircuitPython drive.
**UART Connection:**
A `USB to UART convertor <https://www.adafruit.com/product/3309>`_ can be used for connecting to ESP32-S3 to get serial console and flashing CircuitPython.
Following connections need to be made in this case:
.. csv-table::
:header: GPIO, UART
43, "RX"
44, "TX"
GND, "GND"
5V, "5V"
**BLE Connection:**
This feature is not yet available and currently under development.
Building and flashing Building and flashing
--------------------------------------- ---------------------------------------
Before building or flashing the, you must `install the esp-idf <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/index.html>`_. This must be re-done every time the esp-idf is updated, but not every time you build. Run ``cd ports/espressif`` from ``circuitpython/`` to move to the espressif port root, and run: Before building or flashing the, you must `install the esp-idf <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/index.html>`_.
Note: This must be re-done every time the esp-idf is updated, but not every time you build.
Run ``cd ports/espressif`` from ``circuitpython/`` to move to the espressif port root, and run:
.. code-block:: .. code-block::
./esp-idf/install.sh ./esp-idf/install.sh
After this initial installation, you must add the esp-idf tools to your path. You must also do this **any time you open a new bash environment for building or flashing**: After this initial installation, you must add the esp-idf tools to your path.
Note: This must be re-done every time you open a new bash environment for building or flashing.
Run ``cd ports/espressif`` from ``circuitpython/`` to move to the espressif port root, and run:
.. code-block:: .. code-block::
@ -106,7 +176,7 @@ Building boards is typically done through ``make BOARD=board_id``. The default p
Debugging Debugging
--------------------------------------- ---------------------------------------
TODO: Add documentation for ESP32-C3 JTAG feature. TODO: Add documentation for ESP32-C3/S3 JTAG feature.
The ESP32-S2 supports JTAG debugging over OpenOCD using a JLink or other probe hardware. The official tutorials can be found on the Espressif website `here <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/jtag-debugging/index.html>`_, but they are mostly for the ESP32-S2 Kaluga, which has built-in debugging. The ESP32-S2 supports JTAG debugging over OpenOCD using a JLink or other probe hardware. The official tutorials can be found on the Espressif website `here <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/jtag-debugging/index.html>`_, but they are mostly for the ESP32-S2 Kaluga, which has built-in debugging.

View File

@ -21,8 +21,13 @@
#include "esp_log.h" #include "esp_log.h"
#include "soc/i2s_struct.h" #include "soc/i2s_struct.h"
#include "soc/apb_ctrl_reg.h" #include "soc/apb_ctrl_reg.h"
#ifdef CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rom/lldesc.h" #include "esp32s2/rom/lldesc.h"
#include "esp32s2/rom/cache.h" #include "esp32s2/rom/cache.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#include "esp32s3/rom/lldesc.h"
#include "esp32s3/rom/cache.h"
#endif
#include "soc/dport_access.h" #include "soc/dport_access.h"
#include "soc/dport_reg.h" #include "soc/dport_reg.h"
#include "driver/ledc.h" #include "driver/ledc.h"

View File

@ -32,11 +32,11 @@
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/__init__.h"
#include "esp_sleep.h"
#include "hal/gpio_ll.h" #include "hal/gpio_ll.h"
#include "esp_debug_helpers.h" #include "esp_debug_helpers.h"
#include "components/driver/include/driver/rtc_io.h" #include "components/driver/include/driver/rtc_io.h"
#include "components/esp_system/include/esp_sleep.h"
#include "components/freertos/include/freertos/FreeRTOS.h" #include "components/freertos/include/freertos/FreeRTOS.h"
void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, const mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, const mcu_pin_obj_t *pin, bool value, bool edge, bool pull) {

View File

@ -40,7 +40,13 @@
#define DEFAULT_VREF 1100 #define DEFAULT_VREF 1100
#define NO_OF_SAMPLES 2 #define NO_OF_SAMPLES 2
#define ATTENUATION ADC_ATTEN_DB_11 #define ATTENUATION ADC_ATTEN_DB_11
#ifdef CONFIG_IDF_TARGET_ESP32C3
#define DATA_WIDTH ADC_WIDTH_BIT_12
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#define DATA_WIDTH ADC_WIDTH_BIT_13 #define DATA_WIDTH ADC_WIDTH_BIT_13
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#define DATA_WIDTH ADC_WIDTH_BIT_12
#endif
void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self,
const mcu_pin_obj_t *pin) { const mcu_pin_obj_t *pin) {

View File

@ -41,6 +41,7 @@
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self,
const mcu_pin_obj_t *pin) { const mcu_pin_obj_t *pin) {
#ifdef CONFIG_IDF_TARGET_ESP32S2
if (pin == &pin_GPIO17) { if (pin == &pin_GPIO17) {
self->channel = DAC_CHANNEL_1; self->channel = DAC_CHANNEL_1;
} else if (pin == &pin_GPIO18) { } else if (pin == &pin_GPIO18) {
@ -49,6 +50,9 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self,
mp_raise_ValueError(translate("Invalid DAC pin supplied")); mp_raise_ValueError(translate("Invalid DAC pin supplied"));
} }
dac_output_enable(self->channel); dac_output_enable(self->channel);
#else
mp_raise_NotImplementedError(NULL);
#endif
} }
bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
@ -56,18 +60,24 @@ bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
} }
void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
#ifdef CONFIG_IDF_TARGET_ESP32S2
dac_output_disable(self->channel); dac_output_disable(self->channel);
self->channel = DAC_CHANNEL_MAX; self->channel = DAC_CHANNEL_MAX;
#endif
} }
void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self, void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self,
uint16_t value) { uint16_t value) {
#ifdef CONFIG_IDF_TARGET_ESP32S2
uint8_t dac_value = (value * 255) / 65535; uint8_t dac_value = (value * 255) / 65535;
dac_output_enable(self->channel); dac_output_enable(self->channel);
dac_output_voltage(self->channel, dac_value); dac_output_voltage(self->channel, dac_value);
#endif
} }
void analogout_reset(void) { void analogout_reset(void) {
#ifdef CONFIG_IDF_TARGET_ESP32S2
dac_output_disable(DAC_CHANNEL_1); dac_output_disable(DAC_CHANNEL_1);
dac_output_disable(DAC_CHANNEL_2); dac_output_disable(DAC_CHANNEL_2);
#endif
} }

View File

@ -56,11 +56,15 @@ static void IRAM_ATTR timer_interrupt_handler(void *self_in) {
// reset interrupt // reset interrupt
timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0); timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0);
if (self->timer.idx) { if (self->timer.idx) {
device->int_clr.t1 = 1; device->int_clr_timers.t1_int_clr = 1;
} else { } else {
device->int_clr.t0 = 1; device->int_clr_timers.t0_int_clr = 1;
} }
device->hw_timer[self->timer.idx].config.alarm_en = 1; #ifdef CONFIG_IDF_TARGET_ESP32S2
device->hw_timer[self->timer.idx].config.tx_alarm_en = 1;
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
device->hw_timer[self->timer.idx].config.tn_alarm_en = 1;
#endif
} }
static void init_pcnt(frequencyio_frequencyin_obj_t *self) { static void init_pcnt(frequencyio_frequencyin_obj_t *self) {

View File

@ -43,11 +43,15 @@
float common_hal_mcu_processor_get_temperature(void) { float common_hal_mcu_processor_get_temperature(void) {
float tsens_out; float tsens_out;
#ifdef CONFIG_IDF_TARGET_ESP32S3
mp_raise_NotImplementedError(NULL);
#else
temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃. temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃.
temp_sensor_set_config(temp_sensor); temp_sensor_set_config(temp_sensor);
temp_sensor_start(); temp_sensor_start();
temp_sensor_read_celsius(&tsens_out); temp_sensor_read_celsius(&tsens_out);
temp_sensor_stop(); temp_sensor_stop();
#endif
return tsens_out; return tsens_out;
} }

View File

@ -47,13 +47,16 @@
#ifdef CONFIG_IDF_TARGET_ESP32C3 #ifdef CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/rtc.h" #include "esp32c3/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32S2 #elif defined(CONFIG_IDF_TARGET_ESP32S2)
#include "esp32s2/rom/rtc.h" #include "esp32s2/rom/rtc.h"
#include "esp32s2/rom/usb/usb_persist.h" #include "esp32s2/rom/usb/usb_persist.h"
#include "esp32s2/rom/usb/chip_usb_dw_wrapper.h" #include "esp32s2/rom/usb/chip_usb_dw_wrapper.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#include "esp32s3/rom/rtc.h"
#include "esp32s3/rom/usb/usb_persist.h"
#include "esp32s3/rom/usb/chip_usb_dw_wrapper.h"
#endif #endif
void common_hal_mcu_delay_us(uint32_t delay) { void common_hal_mcu_delay_us(uint32_t delay) {
mp_hal_delay_us(delay); mp_hal_delay_us(delay);
} }

@ -1 +1 @@
Subproject commit e493a4c30e1b2f7c54a376327388b9e12262cbbf Subproject commit ddc44956bf718540d5451e17e1becf6c7dffe5b8

View File

@ -1,9 +1,3 @@
#
# Bootloader config
#
# CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set
# end of Bootloader config
# #
# Serial flasher config # Serial flasher config
# #
@ -50,6 +44,14 @@ CONFIG_ESP32S2_DATA_CACHE_16KB=y
# end of Cache config # end of Cache config
# end of ESP32S2-specific # end of ESP32S2-specific
#
# ESP32S3-specific
#
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240
# end of ESP32S3-specific
# #
# Common ESP-related # Common ESP-related
# #

View File

@ -26,7 +26,7 @@ CIRCUITPY_FRAMEBUFFERIO ?= 1
CIRCUITPY_FREQUENCYIO ?= 1 CIRCUITPY_FREQUENCYIO ?= 1
CIRCUITPY_IMAGECAPTURE ?= 1 CIRCUITPY_IMAGECAPTURE ?= 1
CIRCUITPY_I2CPERIPHERAL ?= 1 CIRCUITPY_I2CPERIPHERAL ?= 1
CIRCUITPY_RGBMATRIX ?= 1 CIRCUITPY_RGBMATRIX ?= 0
CIRCUITPY_ROTARYIO ?= 1 CIRCUITPY_ROTARYIO ?= 1
CIRCUITPY_NVM ?= 1 CIRCUITPY_NVM ?= 1
CIRCUITPY_PS2IO ?= 1 CIRCUITPY_PS2IO ?= 1
@ -43,17 +43,18 @@ CIRCUITPY_USB = 0
CIRCUITPY_ALARM = 0 CIRCUITPY_ALARM = 0
CIRCUITPY_COUNTIO = 0 CIRCUITPY_COUNTIO = 0
CIRCUITPY_ROTARYIO = 0 CIRCUITPY_ROTARYIO = 0
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_IMAGECAPTURE = 0 CIRCUITPY_IMAGECAPTURE = 0
CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_TOUCHIO ?= 1 CIRCUITPY_TOUCHIO ?= 1
CIRCUITPY_TOUCHIO_USE_NATIVE = 0 CIRCUITPY_TOUCHIO_USE_NATIVE = 0
else ifeq ($(IDF_TARGET),esp32s3)
CIRCUITPY_IMAGECAPTURE = 0
CIRCUITPY_PARALLELDISPLAY = 0
endif endif
# From the ESP32-S2 datasheet: # From ESP32-S2/S3 Technical Reference Manual:
# #
# Endpoint number 0 always present (bi-directional, consisting of EP0 IN and EP0 OUT) # Endpoint number 0 always present (bi-directional, consisting of EP0 IN and EP0 OUT)
# Six additional endpoints (endpoint numbers 1 to 6), configurable as IN or OUT # Six additional endpoints (endpoint numbers 1 to 6), configurable as IN or OUT

View File

@ -25,22 +25,17 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include <string.h>
#include "py/mphal.h" #include "py/mphal.h"
#include "py/mpstate.h" #include "supervisor/cpu.h"
#include "py/gc.h"
#include "esp_debug_helpers.h"
#ifdef CONFIG_IDF_TARGET_ESP32C3 #ifdef CONFIG_IDF_TARGET_ESP32C3
#include "components/esp_rom/include/esp32c3/rom/ets_sys.h" #include "components/esp_rom/include/esp32c3/rom/ets_sys.h"
#elif CONFIG_IDF_TARGET_ESP32S2 #elif defined(CONFIG_IDF_TARGET_ESP32S2)
#include "components/esp_rom/include/esp32s2/rom/ets_sys.h" #include "components/esp_rom/include/esp32s2/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#include "components/esp_rom/include/esp32s3/rom/ets_sys.h"
#endif #endif
#include "supervisor/cpu.h"
void mp_hal_delay_us(mp_uint_t delay) { void mp_hal_delay_us(mp_uint_t delay) {
ets_delay_us(delay); ets_delay_us(delay);
} }

View File

@ -0,0 +1,73 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 microDev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "peripherals/pins.h"
const mcu_pin_obj_t pin_GPIO0 = PIN(0, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO1 = PIN(1, ADC_UNIT_1, ADC_CHANNEL_0, TOUCH_PAD_NUM1);
const mcu_pin_obj_t pin_GPIO2 = PIN(2, ADC_UNIT_1, ADC_CHANNEL_1, TOUCH_PAD_NUM2);
const mcu_pin_obj_t pin_GPIO3 = PIN(3, ADC_UNIT_1, ADC_CHANNEL_2, TOUCH_PAD_NUM3);
const mcu_pin_obj_t pin_GPIO4 = PIN(4, ADC_UNIT_1, ADC_CHANNEL_3, TOUCH_PAD_NUM4);
const mcu_pin_obj_t pin_GPIO5 = PIN(5, ADC_UNIT_1, ADC_CHANNEL_4, TOUCH_PAD_NUM5);
const mcu_pin_obj_t pin_GPIO6 = PIN(6, ADC_UNIT_1, ADC_CHANNEL_5, TOUCH_PAD_NUM6);
const mcu_pin_obj_t pin_GPIO7 = PIN(7, ADC_UNIT_1, ADC_CHANNEL_6, TOUCH_PAD_NUM7);
const mcu_pin_obj_t pin_GPIO8 = PIN(8, ADC_UNIT_1, ADC_CHANNEL_7, TOUCH_PAD_NUM8);
const mcu_pin_obj_t pin_GPIO9 = PIN(9, ADC_UNIT_1, ADC_CHANNEL_8, TOUCH_PAD_NUM9);
const mcu_pin_obj_t pin_GPIO10 = PIN(10, ADC_UNIT_1, ADC_CHANNEL_9, TOUCH_PAD_NUM10);
const mcu_pin_obj_t pin_GPIO11 = PIN(11, ADC_UNIT_2, ADC_CHANNEL_0, TOUCH_PAD_NUM11);
const mcu_pin_obj_t pin_GPIO12 = PIN(12, ADC_UNIT_2, ADC_CHANNEL_1, TOUCH_PAD_NUM12);
const mcu_pin_obj_t pin_GPIO13 = PIN(13, ADC_UNIT_2, ADC_CHANNEL_2, TOUCH_PAD_NUM13);
const mcu_pin_obj_t pin_GPIO14 = PIN(14, ADC_UNIT_2, ADC_CHANNEL_3, TOUCH_PAD_NUM14);
const mcu_pin_obj_t pin_GPIO15 = PIN(15, ADC_UNIT_2, ADC_CHANNEL_4, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO16 = PIN(16, ADC_UNIT_2, ADC_CHANNEL_5, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO17 = PIN(17, ADC_UNIT_2, ADC_CHANNEL_6, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO18 = PIN(18, ADC_UNIT_2, ADC_CHANNEL_7, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO19 = PIN(19, ADC_UNIT_2, ADC_CHANNEL_8, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO20 = PIN(20, ADC_UNIT_2, ADC_CHANNEL_9, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO21 = PIN(21, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO26 = PIN(26, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO27 = PIN(27, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO28 = PIN(28, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO29 = PIN(29, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO30 = PIN(30, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO31 = PIN(31, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO32 = PIN(32, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO33 = PIN(33, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO34 = PIN(34, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO35 = PIN(35, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO36 = PIN(36, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO37 = PIN(37, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO38 = PIN(38, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO39 = PIN(39, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO40 = PIN(40, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO41 = PIN(41, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO42 = PIN(42, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO43 = PIN(43, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO44 = PIN(44, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO45 = PIN(45, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO46 = PIN(46, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO47 = PIN(47, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO48 = PIN(48, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);

View File

@ -0,0 +1,80 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 microDev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// DO NOT include this file directly.
// Use shared-bindings/microcontroller/Pin.h instead.
// This ensures that all necessary includes are already included.
#ifndef MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S3_PINS_H
#define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S3_PINS_H
extern const mcu_pin_obj_t pin_GPIO0;
extern const mcu_pin_obj_t pin_GPIO1;
extern const mcu_pin_obj_t pin_GPIO2;
extern const mcu_pin_obj_t pin_GPIO3;
extern const mcu_pin_obj_t pin_GPIO4;
extern const mcu_pin_obj_t pin_GPIO5;
extern const mcu_pin_obj_t pin_GPIO6;
extern const mcu_pin_obj_t pin_GPIO7;
extern const mcu_pin_obj_t pin_GPIO8;
extern const mcu_pin_obj_t pin_GPIO9;
extern const mcu_pin_obj_t pin_GPIO10;
extern const mcu_pin_obj_t pin_GPIO11;
extern const mcu_pin_obj_t pin_GPIO12;
extern const mcu_pin_obj_t pin_GPIO13;
extern const mcu_pin_obj_t pin_GPIO14;
extern const mcu_pin_obj_t pin_GPIO15;
extern const mcu_pin_obj_t pin_GPIO16;
extern const mcu_pin_obj_t pin_GPIO17;
extern const mcu_pin_obj_t pin_GPIO18;
extern const mcu_pin_obj_t pin_GPIO19;
extern const mcu_pin_obj_t pin_GPIO20;
extern const mcu_pin_obj_t pin_GPIO21;
extern const mcu_pin_obj_t pin_GPIO26;
extern const mcu_pin_obj_t pin_GPIO27;
extern const mcu_pin_obj_t pin_GPIO28;
extern const mcu_pin_obj_t pin_GPIO29;
extern const mcu_pin_obj_t pin_GPIO30;
extern const mcu_pin_obj_t pin_GPIO31;
extern const mcu_pin_obj_t pin_GPIO32;
extern const mcu_pin_obj_t pin_GPIO33;
extern const mcu_pin_obj_t pin_GPIO34;
extern const mcu_pin_obj_t pin_GPIO35;
extern const mcu_pin_obj_t pin_GPIO36;
extern const mcu_pin_obj_t pin_GPIO37;
extern const mcu_pin_obj_t pin_GPIO38;
extern const mcu_pin_obj_t pin_GPIO39;
extern const mcu_pin_obj_t pin_GPIO40;
extern const mcu_pin_obj_t pin_GPIO41;
extern const mcu_pin_obj_t pin_GPIO42;
extern const mcu_pin_obj_t pin_GPIO43;
extern const mcu_pin_obj_t pin_GPIO44;
extern const mcu_pin_obj_t pin_GPIO45;
extern const mcu_pin_obj_t pin_GPIO46;
extern const mcu_pin_obj_t pin_GPIO47;
extern const mcu_pin_obj_t pin_GPIO48;
#endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S3_PINS_H

View File

@ -28,6 +28,7 @@
#define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_PCNT_HANDLER_H #define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_PCNT_HANDLER_H
#include "driver/pcnt.h" #include "driver/pcnt.h"
#include "soc/pcnt_struct.h"
extern int peripherals_pcnt_init(pcnt_config_t pcnt_config); extern int peripherals_pcnt_init(pcnt_config_t pcnt_config);
extern void peripherals_pcnt_deinit(pcnt_unit_t *unit); extern void peripherals_pcnt_deinit(pcnt_unit_t *unit);

View File

@ -67,8 +67,10 @@ extern const mp_obj_type_t mcu_pin_type;
// Choose based on chip // Choose based on chip
#ifdef CONFIG_IDF_TARGET_ESP32C3 #ifdef CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/pins.h" #include "esp32c3/pins.h"
#elif CONFIG_IDF_TARGET_ESP32S2 #elif defined(CONFIG_IDF_TARGET_ESP32S2)
#include "esp32s2/pins.h" #include "esp32s2/pins.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#include "esp32s3/pins.h"
#endif #endif
#endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_PINS_H #endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_PINS_H

View File

@ -58,6 +58,9 @@
#if CIRCUITPY_COUNTIO || CIRCUITPY_ROTARYIO || CIRCUITPY_FREQUENCYIO #if CIRCUITPY_COUNTIO || CIRCUITPY_ROTARYIO || CIRCUITPY_FREQUENCYIO
#include "peripherals/pcnt.h" #include "peripherals/pcnt.h"
#endif
#if CIRCUITPY_TOUCHIO_USE_NATIVE
#include "peripherals/touch.h" #include "peripherals/touch.h"
#endif #endif
@ -69,17 +72,10 @@
#include "cam.h" #include "cam.h"
#endif #endif
#include "esp_heap_caps.h"
#include "esp_debug_helpers.h"
#include "soc/cache_memory.h" #include "soc/cache_memory.h"
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
#ifdef CONFIG_IDF_TARGET_ESP32C3 #include "esp_debug_helpers.h"
#include "components/esp_rom/include/esp32c3/rom/ets_sys.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "components/esp_rom/include/esp32s2/rom/ets_sys.h"
#endif
#define HEAP_SIZE (48 * 1024) #define HEAP_SIZE (48 * 1024)
@ -136,7 +132,7 @@ safe_mode_t port_init(void) {
#ifdef CONFIG_IDF_TARGET_ESP32C3 #ifdef CONFIG_IDF_TARGET_ESP32C3
common_hal_never_reset_pin(&pin_GPIO20); common_hal_never_reset_pin(&pin_GPIO20);
common_hal_never_reset_pin(&pin_GPIO21); common_hal_never_reset_pin(&pin_GPIO21);
#elif CONFIG_IDF_TARGET_ESP32S2 #elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO43);
common_hal_never_reset_pin(&pin_GPIO44); common_hal_never_reset_pin(&pin_GPIO44);
#endif #endif
@ -153,7 +149,7 @@ safe_mode_t port_init(void) {
common_hal_never_reset_pin(&pin_GPIO5); common_hal_never_reset_pin(&pin_GPIO5);
common_hal_never_reset_pin(&pin_GPIO6); common_hal_never_reset_pin(&pin_GPIO6);
common_hal_never_reset_pin(&pin_GPIO7); common_hal_never_reset_pin(&pin_GPIO7);
#elif CONFIG_IDF_TARGET_ESP32S2 #elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
common_hal_never_reset_pin(&pin_GPIO39); common_hal_never_reset_pin(&pin_GPIO39);
common_hal_never_reset_pin(&pin_GPIO40); common_hal_never_reset_pin(&pin_GPIO40);
common_hal_never_reset_pin(&pin_GPIO41); common_hal_never_reset_pin(&pin_GPIO41);

View File

@ -33,6 +33,7 @@
#include "shared/readline/readline.h" #include "shared/readline/readline.h"
#include "hal/gpio_ll.h" #include "hal/gpio_ll.h"
#include "hal/usb_hal.h"
#include "soc/usb_periph.h" #include "soc/usb_periph.h"
#include "components/driver/include/driver/gpio.h" #include "components/driver/include/driver/gpio.h"
@ -40,15 +41,15 @@
#ifdef CONFIG_IDF_TARGET_ESP32C3 #ifdef CONFIG_IDF_TARGET_ESP32C3
#include "components/esp_rom/include/esp32c3/rom/gpio.h" #include "components/esp_rom/include/esp32c3/rom/gpio.h"
#elif CONFIG_IDF_TARGET_ESP32S2 #elif defined(CONFIG_IDF_TARGET_ESP32S2)
#include "components/esp_rom/include/esp32s2/rom/gpio.h" #include "components/esp_rom/include/esp32s2/rom/gpio.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#include "components/esp_rom/include/esp32s3/rom/gpio.h"
#endif #endif
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "hal/usb_hal.h"
#include "tusb.h" #include "tusb.h"
#ifdef CFG_TUSB_DEBUG #ifdef CFG_TUSB_DEBUG