C6 compiles, runs but wifi crashes

This commit is contained in:
Scott Shawcroft 2023-09-19 16:27:00 -07:00
parent e22eefabd7
commit 7bad82a219
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
57 changed files with 815 additions and 126 deletions

2
.gitmodules vendored
View File

@ -152,7 +152,7 @@
url = https://github.com/espressif/esp-iot-solution.git
[submodule "ports/espressif/esp-camera"]
path = ports/espressif/esp-camera
url = https://github.com/espressif/esp32-camera.git
url = https://github.com/adafruit/esp32-camera.git
branch = circuitpython
[submodule "frozen/Adafruit_CircuitPython_ST7789"]
path = frozen/Adafruit_CircuitPython_ST7789

View File

@ -27,6 +27,9 @@ include ../../py/circuitpy_mkenv.mk
ifeq ($(IDF_TARGET),esp32c3)
IDF_TARGET_ARCH = riscv
CROSS_COMPILE = riscv32-esp-elf-
else ifeq ($(IDF_TARGET),esp32c6)
IDF_TARGET_ARCH = riscv
CROSS_COMPILE = riscv32-esp-elf-
else
IDF_TARGET_ARCH = xtensa
CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf-
@ -84,7 +87,8 @@ INC += \
-isystem esp-idf/components/efuse/include \
-isystem esp-idf/components/efuse/$(IDF_TARGET)/include \
-isystem esp-idf/components/$(IDF_TARGET)/include \
-isystem esp-idf/components/esp_adc/deprecated/include \
-isystem esp-idf/components/esp_adc/include \
-isystem esp-idf/components/esp_adc/$(IDF_TARGET)/include \
-isystem esp-idf/components/esp_app_format/include \
-isystem esp-idf/components/esp_common/include \
-isystem esp-idf/components/esp_event/include \
@ -172,6 +176,7 @@ CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_D
# Most current ESPs have nano versions of newlib in ROM so we use them.
ifneq ($(IDF_TARGET),esp32c6)
CFLAGS += --specs=nano.specs
LDFLAGS += -T$(IDF_TARGET).rom.newlib-nano.ld
endif
ifeq ($(IDF_TARGET_ARCH),xtensa)
@ -192,7 +197,6 @@ LDFLAGS += \
-T$(IDF_TARGET).rom.ld \
-T$(IDF_TARGET).rom.api.ld \
-T$(IDF_TARGET).rom.libgcc.ld \
-T$(IDF_TARGET).rom.newlib-nano.ld \
-Wl,-Bstatic \
-Wl,--no-warn-mismatch \
-Wl,--build-id=none \
@ -208,6 +212,15 @@ LDFLAGS += \
-Tesp32c3.rom.newlib.ld \
-Tesp32c3.rom.version.ld \
-Tesp32c3.rom.eco3.ld
else ifeq ($(IDF_TARGET),esp32c6)
LDFLAGS += \
-Tesp32c6.rom.phy.ld \
-Tesp32c6.rom.pp.ld \
-Tesp32c6.rom.net80211.ld \
-Tesp32c6.rom.newlib.ld \
-Tesp32c6.rom.coexist.ld \
-Tesp32c6.rom.heap.ld \
-Tesp32c6.rom.wdt.ld
else ifeq ($(IDF_TARGET),esp32s2)
LDFLAGS += \
-T$(IDF_TARGET).rom.newlib-data.ld \
@ -222,7 +235,7 @@ endif
LIBS := -lgcc -lc -lstdc++
# Use toolchain libm if we're not using our own.
ifndef INTERNAL_LIBM
ifneq ($(INTERNAL_LIBM),1)
LIBS += -lm
endif
@ -262,12 +275,16 @@ SRC_C += \
SRC_C += $(wildcard common-hal/espidf/*.c)
ifeq ($(IDF_TARGET),esp32c3)
ifneq ($(CIRCUITPY_ESP_USB_SERIAL_JTAG),0)
SRC_C += supervisor/usb_serial_jtag.c
else
SRC_C += \
peripherals/pcnt.c \
peripherals/touch.c
endif
ifneq ($(CIRCUITPY_COUNTIO),0)
SRC_C += peripherals/pcnt.c
endif
ifneq ($(CIRCUITPY_TOUCHIO_USE_NATIVE),0)
SRC_C += peripherals/touch.c
endif
ifneq ($(CIRCUITPY_USB),0)
@ -435,13 +452,28 @@ endif
ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_coex esp_common esp_event esp_hw_support esp_mm esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
ifneq ($(CIRCUITPY_BLEIO),0)
BLE_IMPL_esp32 := esp32
BLE_IMPL_esp32s3 := esp32c3
BLE_IMPL_esp32c2 := libble
BLE_IMPL_esp32c3 := esp32c3
BLE_IMPL_esp32c6 := libble
BLE_IMPL_esp32h2 := libble
BLE_IMPL = $(BLE_IMPL_$(IDF_TARGET))
ESP_IDF_COMPONENTS_LINK += bt
ifeq ($(IDF_TARGET),esp32)
BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a
else
ifeq ($(BLE_IMPL),esp32)
BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a
endif
ifeq ($(BLE_IMPL),esp32c3)
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \
esp-idf/components/bt/controller/lib_esp32c3_family/$(IDF_TARGET)/libbtdm_app.a
endif
ifeq ($(BLE_IMPL),libble)
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \
esp-idf/components/bt/controller/lib_$(IDF_TARGET)/$(IDF_TARGET)-bt-lib/libble_app.a
endif
endif
ifneq ($(CIRCUITPY_ESPULP),0)
ESP_IDF_COMPONENTS_LINK += ulp
@ -469,11 +501,16 @@ ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp-camera/libesp-camera
endif
ifneq ($(VALID_BOARD),)
# From esp-idf/components/bootloader/Kconfig.projbuild
# BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable.
ifeq ($(IDF_TARGET),esp32)
BOOTLOADER_OFFSET = 0x1000
else ifeq ($(IDF_TARGET),esp32h2)
BOOTLOADER_OFFSET = 0x0
else ifeq ($(IDF_TARGET),esp32c3)
BOOTLOADER_OFFSET = 0x0
else ifeq ($(IDF_TARGET),esp32c6)
BOOTLOADER_OFFSET = 0x0
else ifeq ($(IDF_TARGET),esp32s3)
BOOTLOADER_OFFSET = 0x0
else ifeq ($(IDF_TARGET),esp32s2)

View File

@ -36,5 +36,3 @@
// For entering safe mode
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9)
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1

View File

@ -43,5 +43,3 @@
// For entering safe mode
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9)
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1

View File

@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 2MB
CIRCUITPY_DUALBANK = 0
CIRCUITPY_ESP_USB_SERIAL_JTAG = 0

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE = qio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 0

View File

@ -40,5 +40,3 @@
#define CIRCUITPY_BOARD_UART (1)
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}}
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)

View File

@ -7,3 +7,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE=qio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1

View File

@ -40,5 +40,3 @@
// For entering safe mode
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9)
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1

View File

@ -0,0 +1,29 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
*
* 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 "supervisor/board.h"
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

View File

@ -0,0 +1,35 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
*
* 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.
*/
// Micropython setup
#define MICROPY_HW_BOARD_NAME "ESP32-C6-DevKitC-1-N8"
#define MICROPY_HW_MCU_NAME "ESP32C6"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO8)
#define DEFAULT_UART_BUS_RX (&pin_GPIO17)
#define DEFAULT_UART_BUS_TX (&pin_GPIO16)

View File

@ -0,0 +1,8 @@
CIRCUITPY_CREATOR_ID = 0x000C303A
CIRCUITPY_CREATION_ID = 0x00C60002
IDF_TARGET = esp32c6
CIRCUITPY_ESP_FLASH_MODE = qio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 8MB

View File

@ -0,0 +1,36 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_IO22), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_IO23), MP_ROM_PTR(&pin_GPIO23) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -0,0 +1,15 @@
#
# Espressif IoT Development Framework Configuration
#
#
# Component config
#
#
# LWIP
#
CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32c6"
# end of LWIP
# end of Component config
# end of Espressif IoT Development Framework Configuration

View File

@ -0,0 +1,29 @@
/*
* 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 "supervisor/board.h"
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

View File

@ -0,0 +1,37 @@
/*
* 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.
*/
// Board setup
#define MICROPY_HW_BOARD_NAME "ESP32-C6-DevKitM-1"
#define MICROPY_HW_MCU_NAME "ESP32-C6N4"
// Status LED
#define MICROPY_HW_NEOPIXEL (&pin_GPIO8)
#define MICROPY_HW_NEOPIXEL_COUNT (1)
// Default bus pins
#define DEFAULT_UART_BUS_RX (&pin_GPIO16)
#define DEFAULT_UART_BUS_TX (&pin_GPIO17)

View File

@ -0,0 +1,8 @@
CIRCUITPY_CREATOR_ID = 0x000C303A
CIRCUITPY_CREATION_ID = 0x00C60001
IDF_TARGET = esp32c6
CIRCUITPY_ESP_FLASH_MODE = qio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB

View File

@ -0,0 +1,61 @@
/*
* 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 "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_MTMS), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_MTDI), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_MTCK), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_MTDO), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -0,0 +1,15 @@
#
# Espressif IoT Development Framework Configuration
#
#
# Component config
#
#
# LWIP
#
CONFIG_LWIP_LOCAL_HOSTNAME="ESP32-C6-DevKitM-1"
# end of LWIP
# end of Component config
# end of Espressif IoT Development Framework Configuration

View File

@ -44,5 +44,3 @@
#define CIRCUITPY_BOARD_UART (1)
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}}
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE=qio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1

View File

@ -44,5 +44,3 @@
#define CIRCUITPY_BOARD_UART (1)
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}}
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)

View File

@ -7,5 +7,7 @@ CIRCUITPY_ESP_FLASH_MODE=qio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel

View File

@ -34,5 +34,3 @@
#define CIRCUITPY_BOARD_UART (1)
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}}
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE=dio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE=dio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 0

View File

@ -35,8 +35,6 @@
#define CIRCUITPY_BOARD_UART (1)
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}}
// #define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)
// Serial over UART
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO20)
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO21)

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE=qio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 0

View File

@ -45,8 +45,5 @@
#define DEFAULT_UART_BUS_RX (&pin_GPIO20)
#define DEFAULT_UART_BUS_TX (&pin_GPIO21)
// For REPL over built-in USB Serial
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)
// For entering safe mode
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9)

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1

View File

@ -10,5 +10,3 @@
#define DEFAULT_UART_BUS_RX (&pin_GPIO20)
#define DEFAULT_UART_BUS_TX (&pin_GPIO21)
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1)

View File

@ -6,3 +6,5 @@ IDF_TARGET = esp32c3
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_ESP_USB_SERIAL_JTAG = 1

View File

@ -56,12 +56,14 @@
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#define ADC_RESULT_BYTE 2
#define ADC_CONV_LIMIT_EN 0
#elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32H2)
#elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
#define ADC_RESULT_BYTE 4
#define ADC_CONV_LIMIT_EN 0
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#define ADC_RESULT_BYTE 4
#define ADC_CONV_LIMIT_EN 0
#else
#error No known CONFIG_IDF_TARGET_xxx found
#endif
static void start_dma(analogbufio_bufferedin_obj_t *self, adc_digi_convert_mode_t *convert_mode, adc_digi_output_format_t *output_format);
@ -205,7 +207,12 @@ void common_hal_analogbufio_bufferedin_deinit(analogbufio_bufferedin_obj_t *self
}
static bool check_valid_data(const adc_digi_output_data_t *data, const mcu_pin_obj_t *pin, adc_digi_convert_mode_t convert_mode, adc_digi_output_format_t output_format) {
unsigned int unit = data->type2.unit;
unsigned int unit;
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
unit = 0;
#else
unit = data->type2.unit;
#endif
if (output_format == ADC_DIGI_OUTPUT_FORMAT_TYPE2) {
if (data->type2.channel >= SOC_ADC_CHANNEL_NUM(unit)) {
return false;

View File

@ -25,14 +25,18 @@
*/
#include "common-hal/analogio/AnalogIn.h"
#include "bindings/espidf/__init__.h"
#include "shared-bindings/analogio/AnalogIn.h"
#include "py/mperrno.h"
#include "py/runtime.h"
#include "supervisor/shared/translate/translate.h"
#include "driver/adc.h"
#include "adc_cali_schemes.h"
#include "esp_adc/adc_oneshot.h"
#include "esp_adc/adc_cali.h"
#include "driver/gpio.h"
#include "esp_adc_cal.h"
#include "hal/adc_types.h"
#include "shared-bindings/microcontroller/Pin.h"
@ -42,13 +46,17 @@
#define NO_OF_SAMPLES 2
#define ATTENUATION ADC_ATTEN_DB_11
#if defined(CONFIG_IDF_TARGET_ESP32)
#define DATA_WIDTH ADC_WIDTH_BIT_12
#define DATA_WIDTH ADC_BITWIDTH_12
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
#define DATA_WIDTH ADC_WIDTH_BIT_12
#define DATA_WIDTH ADC_BITWIDTH_12
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
#define DATA_WIDTH ADC_BITWIDTH_12
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#define DATA_WIDTH ADC_WIDTH_BIT_13
#define DATA_WIDTH ADC_BITWIDTH_13
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#define DATA_WIDTH ADC_WIDTH_BIT_12
#define DATA_WIDTH ADC_BITWIDTH_12
#elif defined(CONFIG_IDF_TARGET_ESP32H2)
#define DATA_WIDTH ADC_BITWIDTH_12
#else
#error No known CONFIG_IDF_TARGET_xxx found
#endif
@ -79,38 +87,86 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
}
uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
if (self->pin->adc_index == ADC_UNIT_1) {
adc1_config_width(DATA_WIDTH);
adc1_config_channel_atten((adc1_channel_t)self->pin->adc_channel, ATTENUATION);
} else if (self->pin->adc_index == ADC_UNIT_2) {
adc2_config_channel_atten((adc2_channel_t)self->pin->adc_channel, ATTENUATION);
} else {
raise_ValueError_invalid_pin();
adc_oneshot_unit_handle_t adc_handle;
adc_oneshot_unit_init_cfg_t adc_config = {
.unit_id = self->pin->adc_index,
.ulp_mode = ADC_ULP_MODE_DISABLE
};
cp_check_esp_error(adc_oneshot_new_unit(&adc_config, &adc_handle));
adc_oneshot_chan_cfg_t channel_config = {
.atten = ATTENUATION,
.bitwidth = DATA_WIDTH
};
adc_channel_t channel = (adc_channel_t)self->pin->adc_channel;
adc_oneshot_config_channel(adc_handle, channel, &channel_config);
adc_cali_scheme_ver_t supported_schemes;
adc_cali_check_scheme(&supported_schemes);
adc_cali_scheme_ver_t calibration_scheme;
adc_cali_handle_t calibration;
#if defined(ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
adc_cali_curve_fitting_config_t config = {
.unit_id = self->pin->adc_index,
.chan = channel,
.atten = ATTENUATION,
.bitwidth = DATA_WIDTH
};
if (adc_cali_create_scheme_curve_fitting(&config, &calibration) == ESP_OK) {
calibration_scheme = ADC_CALI_SCHEME_VER_CURVE_FITTING;
}
// Automatically select calibration process depending on status of efuse
esp_adc_cal_characteristics_t adc_chars;
memset(&adc_chars, 0, sizeof(adc_chars));
esp_adc_cal_characterize(self->pin->adc_index, ATTENUATION, DATA_WIDTH, DEFAULT_VREF, &adc_chars);
uint32_t adc_reading = 0;
// Multisampling
for (int i = 0; i < NO_OF_SAMPLES; i++) {
if (self->pin->adc_index == ADC_UNIT_1) {
adc_reading += adc1_get_raw((adc1_channel_t)self->pin->adc_channel);
} else {
int raw;
esp_err_t r = adc2_get_raw((adc2_channel_t)self->pin->adc_channel, DATA_WIDTH, &raw);
if (r != ESP_OK) {
mp_raise_ValueError(translate("ADC2 is being used by WiFi"));
}
adc_reading += raw;
#endif
#if defined(ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
if (calibration_scheme == 0) {
adc_cali_line_fitting_config_t config = {
.unit_id = self->pin->adc_index,
.atten = ATTENUATION,
.bitwidth = DATA_WIDTH,
#ifdef CONFIG_IDF_TARGET_ESP32
.default_vref = DEFAULT_VREF;
#endif
};
if (adc_cali_create_scheme_line_fitting(&config, &calibration) == ESP_OK) {
calibration_scheme = ADC_CALI_SCHEME_VER_LINE_FITTING;
}
}
adc_reading /= NO_OF_SAMPLES;
#endif
uint32_t adc_reading = 0;
size_t sample_count = 0;
// Multisampling
esp_err_t ret = ESP_OK;
for (int i = 0; i < NO_OF_SAMPLES; i++) {
int raw;
ret = adc_oneshot_read(adc_handle, channel, &raw);
if (ret != ESP_OK) {
continue;
}
adc_reading += raw;
sample_count += 1;
}
if (sample_count == 0) {
raise_esp_error(ret);
}
adc_reading /= sample_count;
// This corrects non-linear regions of the ADC range with a LUT, so it's a better reading than raw
uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, &adc_chars);
int voltage;
adc_cali_raw_to_voltage(calibration, adc_reading, &voltage);
#if defined(ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
if (calibration_scheme == ADC_CALI_SCHEME_VER_CURVE_FITTING) {
adc_cali_delete_scheme_curve_fitting(calibration);
}
#endif
#if defined(ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
if (calibration_scheme == ADC_CALI_SCHEME_VER_LINE_FITTING) {
adc_cali_delete_scheme_line_fitting(calibration);
}
#endif
adc_oneshot_del_unit(adc_handle);
return voltage * ((1 << 16) - 1) / 3300;
}

View File

@ -230,7 +230,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
uart_config.stop_bits = UART_STOP_BITS_2;
}
// uart_set_stop_bits(self->uart_num, stop_bits);
uart_config.source_clk = UART_SCLK_APB; // guessing here...
uart_config.source_clk = UART_SCLK_DEFAULT;
// config all in one?
if (uart_param_config(self->uart_num, &uart_config) != ESP_OK) {

View File

@ -39,40 +39,29 @@
#include "hal/twai_ll.h"
#if SOC_TWAI_CONTROLLER_NUM > 1
#define TWAI TWAI0
#endif
// IDE = "extended ID" flag of packet header. We always add this bit to the
// mask because a match is always for just one kind of address length
#define FILTER16_IDE (1 << 3)
#define FILTER32_IDE (1 << 2)
// Work around a problem reported at
// https://github.com/espressif/esp-idf/issues/6020 where
// twai_ll_set_acc_filter does not work under -Os optimization
__attribute__((optimize("O0")))
__attribute__((noinline))
static void canio_set_acc_filter(twai_dev_t *hw, uint32_t code, uint32_t mask, bool single_filter) {
uint32_t code_swapped = __builtin_bswap32(code);
uint32_t mask_swapped = __builtin_bswap32(mask);
for (int i = 0; i < 4; i++) {
hw->acceptance_filter.acr[i].val = ((code_swapped >> (i * 8)) & 0xFF);
hw->acceptance_filter.amr[i].val = ((mask_swapped >> (i * 8)) & 0xFF);
}
hw->mode_reg.afm = single_filter;
}
STATIC void install_standard_filter(canio_listener_obj_t *self, canio_match_obj_t *match) {
canio_set_acc_filter(&TWAI, match->id << 21, ~(match->mask << 21), true);
twai_ll_set_acc_filter(&TWAI, match->id << 21, ~(match->mask << 21), true);
self->extended = false;
self->standard = true;
}
STATIC void install_extended_filter(canio_listener_obj_t *self, canio_match_obj_t *match) {
canio_set_acc_filter(&TWAI, match->id << 3, ~(match->mask << 3), true);
twai_ll_set_acc_filter(&TWAI, match->id << 3, ~(match->mask << 3), true);
self->extended = true;
self->standard = false;
}
STATIC void install_all_match_filter(canio_listener_obj_t *self) {
canio_set_acc_filter(&TWAI, 0u, ~0u, true);
twai_ll_set_acc_filter(&TWAI, 0u, ~0u, true);
self->extended = true;
self->standard = true;
}

View File

@ -60,11 +60,15 @@ static void IRAM_ATTR timer_interrupt_handler(void *self_in) {
// reset interrupt
timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0);
#if SOC_TIMER_GROUP_TIMERS_PER_GROUP > 1
if (self->timer.idx) {
device->int_clr_timers.t1_int_clr = 1;
} else {
device->int_clr_timers.t0_int_clr = 1;
}
#endif
device->int_clr_timers.t0_int_clr = 1;
#if SOC_TIMER_GROUP_TIMERS_PER_GROUP > 1
}
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3)
device->hw_timer[self->timer.idx].config.tn_alarm_en = 1;

View File

@ -59,15 +59,18 @@ STATIC uint64_t _in_use_pin_mask;
#define GPIO_SEL_18 (BIT(18)) /*!< Pin 18 selected */
#define GPIO_SEL_19 (BIT(19)) /*!< Pin 19 selected */
#define GPIO_SEL_20 (BIT(20)) /*!< Pin 20 selected */
#if SOC_GPIO_PIN_COUNT > 21
#define GPIO_SEL_21 (BIT(21)) /*!< Pin 21 selected */
#if defined(CONFIG_IDF_TARGET_ESP32)
#endif
#if SOC_GPIO_PIN_COUNT > 22
#define GPIO_SEL_22 (BIT(22)) /*!< Pin 22 selected */
#define GPIO_SEL_23 (BIT(23)) /*!< Pin 23 selected */
#define GPIO_SEL_24 (BIT(24)) /*!< Pin 24 selected */
#define GPIO_SEL_25 (BIT(25)) /*!< Pin 25 selected */
#endif
#define GPIO_SEL_26 (BIT(26)) /*!< Pin 26 selected */
#define GPIO_SEL_27 (BIT(27)) /*!< Pin 27 selected */
#endif
#if SOC_GPIO_PIN_COUNT > 28
#define GPIO_SEL_28 (BIT(28)) /*!< Pin 28 selected */
#define GPIO_SEL_29 (BIT(29)) /*!< Pin 29 selected */
#define GPIO_SEL_30 (BIT(30)) /*!< Pin 30 selected */
@ -80,6 +83,7 @@ STATIC uint64_t _in_use_pin_mask;
#define GPIO_SEL_37 ((uint64_t)PIN_BIT(37)) /*!< Pin 37 selected */
#define GPIO_SEL_38 ((uint64_t)PIN_BIT(38)) /*!< Pin 38 selected */
#define GPIO_SEL_39 ((uint64_t)PIN_BIT(39)) /*!< Pin 39 selected */
#endif
#if SOC_GPIO_PIN_COUNT > 40
#define GPIO_SEL_40 ((uint64_t)PIN_BIT(40)) /*!< Pin 40 selected */
#define GPIO_SEL_41 ((uint64_t)PIN_BIT(41)) /*!< Pin 41 selected */
@ -88,11 +92,11 @@ STATIC uint64_t _in_use_pin_mask;
#define GPIO_SEL_44 ((uint64_t)PIN_BIT(44)) /*!< Pin 44 selected */
#define GPIO_SEL_45 ((uint64_t)PIN_BIT(45)) /*!< Pin 45 selected */
#define GPIO_SEL_46 ((uint64_t)PIN_BIT(46)) /*!< Pin 46 selected */
#if defined(CONFIG_IDF_TARGET_ESP32S3)
#endif
#if SOC_GPIO_PIN_COUNT > 47
#define GPIO_SEL_47 ((uint64_t)PIN_BIT(47)) /*!< Pin 47 selected */
#define GPIO_SEL_48 ((uint64_t)PIN_BIT(48)) /*!< Pin 48 selected */
#endif
#endif
// Bit mask of all pins that should never EVER be reset.
// Typically these are SPI flash and PSRAM control pins, and communication pins.
@ -126,6 +130,26 @@ static const uint64_t pin_mask_reset_forbidden =
#endif
#endif // ESP32C3
#if defined(CONFIG_IDF_TARGET_ESP32C6)
// Never ever reset pins used to communicate with SPI flash.
GPIO_SEL_24 | // SPICS0
GPIO_SEL_25 | // SPIQ
GPIO_SEL_26 | // SPIWP
GPIO_SEL_28 | // SPIHD
GPIO_SEL_29 | // SPICLK
GPIO_SEL_30 | // SPID
#if CIRCUITPY_ESP_USB_SERIAL_JTAG
// Never ever reset serial/JTAG communication pins.
GPIO_SEL_12 | // USB D-
GPIO_SEL_13 | // USB D+
#endif
#if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) && CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0
// Never reset debug UART/console pins.
GPIO_SEL_16 |
GPIO_SEL_17 |
#endif
#endif // ESP32C6
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
// Never ever reset pins used to communicate with SPI flash and PSRAM.
GPIO_SEL_19 | // USB D-
@ -254,10 +278,12 @@ void preserve_pin_number(gpio_num_t pin_number) {
_preserved_pin_mask |= PIN_BIT(pin_number);
}
if (_preserved_pin_mask) {
#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
// Allow pin holds to work during deep sleep. This increases power consumption noticeably
// during deep sleep, so enable holds only if we actually are holding some pins.
// 270uA or so extra current is consumed even with no pins held.
gpio_deep_sleep_hold_en();
#endif
}
}
@ -301,7 +327,9 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) {
void reset_all_pins(void) {
// Undo deep sleep holds in case we woke up from deep sleep.
// We still need to unhold individual pins, which is done by _reset_pin.
#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
gpio_deep_sleep_hold_dis();
#endif
for (uint8_t i = 0; i < GPIO_PIN_COUNT; i++) {
uint32_t iomux_address = GPIO_PIN_MUX_REG[i];

View File

@ -65,17 +65,7 @@ float common_hal_mcu_processor_get_voltage(void) {
}
uint32_t common_hal_mcu_processor_get_frequency(void) {
#if defined(CONFIG_IDF_TARGET_ESP32)
return CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000;
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
return CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ * 1000000;
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
return CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000;
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
return CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000;
#else
#error No known CONFIG_IDF_TARGET_xxx found
#endif
return CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ * 1000000;
}
STATIC uint8_t swap_nibbles(uint8_t v) {

View File

@ -42,21 +42,30 @@
#include "freertos/FreeRTOS.h"
#include "soc/rtc_cntl_reg.h"
#include "esp_private/system_internal.h"
#if defined(CONFIG_IDF_TARGET_ESP32)
#include "soc/rtc_cntl_reg.h"
#include "esp32/rom/rtc.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
#include "soc/rtc_cntl_reg.h"
#include "esp32c3/rom/rtc.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
#include "soc/lp_aon_reg.h"
#include "esp32c6/rom/rtc.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#include "soc/rtc_cntl_reg.h"
#include "esp32s2/rom/rtc.h"
#include "esp32s2/rom/usb/usb_persist.h"
#include "esp32s2/rom/usb/chip_usb_dw_wrapper.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#include "soc/rtc_cntl_reg.h"
#include "esp32s3/rom/rtc.h"
#include "esp32s3/rom/usb/usb_persist.h"
#include "esp32s3/rom/usb/chip_usb_dw_wrapper.h"
#elif defined(CONFIG_IDF_TARGET_ESP32H)
#include "soc/lp_aon_reg.h"
#include "esp32h2/rom/rtc.h"
#else
#error No known CONFIG_IDF_TARGET_xxx found
#endif
@ -101,10 +110,18 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
REG_WRITE(RTC_RESET_CAUSE_REG, 0); // reset uf2
#endif
#if SOC_LP_AON_SUPPORTED
REG_WRITE(LP_AON_STORE0_REG, 0); // reset safe mode
#else
REG_WRITE(RTC_CNTL_STORE0_REG, 0); // reset safe mode
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32)
#if SOC_LP_AON_SUPPORTED
REG_WRITE(LP_AON_SYS_CFG_REG, 0); // reset bootloader
#else
REG_WRITE(RTC_CNTL_OPTION1_REG, 0); // reset bootloader
#endif
#endif
break;
case RUNMODE_SAFE_MODE:
// enter safe mode on next boot
@ -118,8 +135,12 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
chip_usb_set_persist_flags(USBDC_BOOT_DFU);
#endif
#if SOC_LP_AON_SUPPORTED
REG_WRITE(LP_AON_SYS_CFG_REG, LP_AON_FORCE_DOWNLOAD_BOOT);
#else
REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
#endif
#endif
break;
default:
break;

View File

@ -0,0 +1,66 @@
#
# Espressif IoT Development Framework Configuration
#
#
# Component config
#
#
# Bluetooth
#
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y
#
# NimBLE Options
#
CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y
CONFIG_BT_NIMBLE_NVS_PERSIST=y
#
# Memory Settings
#
CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=20
CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE=70
# end of Memory Settings
CONFIG_BT_NIMBLE_EXT_ADV=y
# end of NimBLE Options
# end of Bluetooth
#
# Driver Configurations
#
#
# PCNT Configuration
#
CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y
# end of PCNT Configuration
#
# RMT Configuration
#
CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y
# end of RMT Configuration
#
# I2S Configuration
#
CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y
# end of I2S Configuration
# end of Driver Configurations
#
# PHY
#
CONFIG_ESP_PHY_ENABLE_USB=y
# end of PHY
#
# Wi-Fi
#
CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=4
# end of Wi-Fi
# end of Component config
# end of Espressif IoT Development Framework Configuration

View File

@ -1,10 +1,14 @@
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y

View File

@ -35,6 +35,14 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384
# CONFIG_ESP_DEBUG_OCDAWARE is not set
# end of ESP System Settings
#
# Wi-Fi
#
CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=8
CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=16
# CONFIG_ESP_WIFI_NVS_ENABLED is not set
# end of Wi-Fi
#
# LWIP
#

View File

@ -59,12 +59,10 @@
// Nearly all boards have this because it is used to enter the ROM bootloader.
#ifndef CIRCUITPY_BOOT_BUTTON
#ifdef CONFIG_IDF_TARGET_ESP32C3
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9)
#else
#ifndef CONFIG_IDF_TARGET_ESP32
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#endif
#elif !defined(CONFIG_IDF_TARGET_ESP32)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#endif
#endif
@ -90,12 +88,6 @@
#define CIRCUITPY_I2C_ALLOW_INTERNAL_PULL_UP (0)
#endif
// Define to (1) in mpconfigboard.h if the board uses the internal USB to
// Serial/JTAG to connect do USB.
#ifndef CIRCUITPY_ESP_USB_SERIAL_JTAG
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (0)
#endif
#ifndef DEFAULT_RESERVED_PSRAM
#define DEFAULT_RESERVED_PSRAM (0)
#endif

View File

@ -2,7 +2,7 @@
INTERNAL_FLASH_FILESYSTEM = 1
# Internal math library is substantially smaller than toolchain one
INTERNAL_LIBM = 1
INTERNAL_LIBM = 0
# Longints can be implemented as mpz, as longlong, or not
LONGINT_IMPL = MPZ
@ -68,16 +68,36 @@ CIRCUITPY_TOUCHIO ?= 1
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
# Features
CIRCUITPY_USB = 0
CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1
else ifeq ($(IDF_TARGET),esp32c6)
# Modules
CIRCUITPY_ALARM = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_ESPCAMERA = 0
CIRCUITPY_ESPULP = 0
CIRCUITPY_MEMORYMAP = 0
CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_TOUCHIO ?= 1
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
# Features
CIRCUITPY_USB = 0
CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1
else ifeq ($(IDF_TARGET),esp32s2)
# Modules
CIRCUITPY_BLEIO = 0
CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0
CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0
else ifeq ($(IDF_TARGET),esp32s3)
# Modules
CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0
CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0
endif
# No room for dualbank on boards with 2MB flash

View File

@ -32,10 +32,16 @@
#include "components/esp_rom/include/esp32/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
#include "components/esp_rom/include/esp32c3/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
#include "components/esp_rom/include/esp32c6/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32H2)
#include "components/esp_rom/include/esp32h2/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#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"
#else
#error Unknown CONFIG_IDF_TARGET_xxx
#endif
void mp_hal_delay_us(mp_uint_t delay) {
@ -43,7 +49,7 @@ void mp_hal_delay_us(mp_uint_t delay) {
}
// This is provided by the esp-idf/components/xtensa/esp32s2/libhal.a binary blob.
#ifndef CONFIG_IDF_TARGET_ESP32C3
#ifndef CONFIG_IDF_TARGET_ARCH_RISCV
extern void xthal_window_spill(void);
#endif
@ -61,7 +67,7 @@ mp_uint_t cpu_get_regs_and_sp(mp_uint_t *regs) {
// there is a HAL call to do it. There is a bit of a race condition here
// because the register value could change after it's been restored but that
// is unlikely to happen with a heap pointer while we do a GC.
#ifndef CONFIG_IDF_TARGET_ESP32C3
#ifndef CONFIG_IDF_TARGET_ARCH_RISCV
xthal_window_spill();
#endif
return (mp_uint_t)__builtin_frame_address(0);

View File

@ -0,0 +1,59 @@
/*
* 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, ADC_UNIT_1, ADC_CHANNEL_0, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO1 = PIN(1, ADC_UNIT_1, ADC_CHANNEL_1, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO2 = PIN(2, ADC_UNIT_1, ADC_CHANNEL_2, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO3 = PIN(3, ADC_UNIT_1, ADC_CHANNEL_3, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO4 = PIN(4, ADC_UNIT_1, ADC_CHANNEL_4, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO5 = PIN(5, ADC_UNIT_1, ADC_CHANNEL_5, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO6 = PIN(6, ADC_UNIT_1, ADC_CHANNEL_6, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO7 = PIN(7, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO8 = PIN(8, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO9 = PIN(9, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO10 = PIN(10, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO11 = PIN(11, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO12 = PIN(12, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO13 = PIN(13, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO14 = PIN(14, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO15 = PIN(15, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO16 = PIN(16, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO17 = PIN(17, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO18 = PIN(18, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO19 = PIN(19, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO20 = PIN(20, NO_ADC, NO_ADC_CHANNEL, 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_GPIO22 = PIN(22, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO23 = PIN(23, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO24 = PIN(24, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL);
const mcu_pin_obj_t pin_GPIO25 = PIN(25, 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);

View File

@ -0,0 +1,94 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2023 Scott Shawcroft for Adafruit Industries LLC
*
* 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.
#pragma once
#define GPIO0_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO0;
#define GPIO1_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO1;
#define GPIO2_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO2;
#define GPIO3_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO3;
#define GPIO4_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO4;
#define GPIO5_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO5;
#define GPIO6_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO6;
#define GPIO7_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO7;
#define GPIO8_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO8;
#define GPIO9_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO9;
#define GPIO10_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO10;
#define GPIO11_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO11;
#define GPIO12_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO12;
#define GPIO13_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO13;
#define GPIO14_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO14;
#define GPIO15_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO15;
#define GPIO16_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO16;
#define GPIO17_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO17;
#define GPIO18_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO18;
#define GPIO19_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO19;
#define GPIO20_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO20;
#define GPIO21_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO21;
#define GPIO22_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO22;
#define GPIO23_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO23;
#define GPIO24_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO24;
#define GPIO25_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO25;
#define GPIO26_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO26;
#define GPIO27_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO27;
#define GPIO28_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO28;
#define GPIO29_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO29;
#define GPIO30_EXISTS 1
extern const mcu_pin_obj_t pin_GPIO30;

View File

@ -69,6 +69,10 @@ extern const mp_obj_type_t mcu_pin_type;
#include "esp32/pins.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
#include "esp32c3/pins.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
#include "esp32c6/pins.h"
#elif defined(CONFIG_IDF_TARGET_ESP32H2)
#include "esp32h2/pins.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#include "esp32s2/pins.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)

View File

@ -87,7 +87,13 @@
#endif
#include "soc/efuse_reg.h"
#if defined(CONFIG_IDF_TARGET_ESP3H2) || defined(CONFIG_IDF_TARGET_ESP32C6)
#include "soc/lp_aon_reg.h"
#define CP_SAVED_WORD_REGISTER LP_AON_STORE0_REG
#else
#include "soc/rtc_cntl_reg.h"
#define CP_SAVED_WORD_REGISTER RTC_CNTL_STORE0_REG
#endif
#include "soc/spi_pins.h"
#include "bootloader_flash_config.h"
@ -451,7 +457,7 @@ void reset_to_bootloader(void) {
}
void reset_cpu(void) {
#ifndef CONFIG_IDF_TARGET_ESP32C3
#ifndef CONFIG_IDF_TARGET_ARCH_RISCV
esp_backtrace_print(100);
#endif
esp_restart();
@ -491,13 +497,12 @@ bool port_has_fixed_stack(void) {
return true;
}
// Place the word to save just after our BSS section that gets blanked.
void port_set_saved_word(uint32_t value) {
REG_WRITE(RTC_CNTL_STORE0_REG, value);
REG_WRITE(CP_SAVED_WORD_REGISTER, value);
}
uint32_t port_get_saved_word(void) {
return REG_READ(RTC_CNTL_STORE0_REG);
return REG_READ(CP_SAVED_WORD_REGISTER);
}
uint64_t port_get_raw_ticks(uint8_t *subticks) {

View File

@ -38,12 +38,27 @@ internal_memory = {
("Internal SRAM 1", (0x3FC8_0000, 0x4037_8000), 416 * 1024),
("Internal SRAM 2", (0x3FCF_0000,), 64 * 1024),
],
"esp32c2": [
# Name, Start, Length
("Internal SRAM 0", (0x4037_C000,), 16 * 1024),
("Internal SRAM 1", (0x3FCA_0000, 0x4038_0000), 256 * 1024),
],
"esp32c3": [
# Name, Start, Length
("RTC Fast Memory", (0x5000_0000,), 8 * 1024),
("Internal SRAM 0", (0x4037_C000,), 16 * 1024),
("Internal SRAM 1", (0x3FC8_0000, 0x4038_0000), 384 * 1024),
],
"esp32c6": [
# Name, Start, Length
("LP SRAM", (0x5000_0000,), 16 * 1024),
("HP SRAM", (0x4080_0000,), 512 * 1024),
],
"esp32h2": [
# Name, Start, Length
("LP SRAM", (0x5000_0000,), 4 * 1024),
("HP SRAM", (0x4080_0000,), 320 * 1024),
],
}

View File

@ -173,7 +173,7 @@ def update(debug, board, update_all):
if key == "IDF_TARGET":
target = value
if uf2_bootloader is None:
uf2_bootloader = target not in ("esp32", "esp32c3")
uf2_bootloader = target not in ("esp32", "esp32c3", "esp32c6", "esp32h2")
elif key == "CIRCUITPY_ESP_FLASH_SIZE":
flash_size = value
elif key == "CIRCUITPY_ESP_FLASH_MODE":

View File

@ -243,6 +243,9 @@ CFLAGS += -DCIRCUITPY_ESPNOW=$(CIRCUITPY_ESPNOW)
CIRCUITPY_ESPULP ?= 0
CFLAGS += -DCIRCUITPY_ESPULP=$(CIRCUITPY_ESPULP)
CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0
CFLAGS += -DCIRCUITPY_ESP_USB_SERIAL_JTAG=$(CIRCUITPY_ESP_USB_SERIAL_JTAG)
CIRCUITPY_ESPCAMERA ?= 0
CFLAGS += -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA)

View File

@ -94,7 +94,10 @@ def preprocess():
def pp(flags):
def run(files):
return subprocess.check_output(args.pp + flags + files)
completed = subprocess.run(args.pp + flags + files, stdout=subprocess.PIPE)
if completed.returncode != 0:
raise RuntimeError()
return completed.stdout
return run