diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 146a5fb1c..8bc02b4ff 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: board: - # Alphabetical order + # S2 Alphabetical order - 'adafruit_feather_esp32s2' - 'adafruit_feather_esp32s2_tft' - 'adafruit_feather_esp32s2_reverse_tft' @@ -47,13 +47,13 @@ jobs: - 'unexpectedmaker_feathers2' - 'unexpectedmaker_feathers2_neo' - 'unexpectedmaker_tinys2' + # S3 Alphabetical order + - 'espressif_esp32s3_devkitc_1' + - 'espressif_esp32s3_devkitm_1' steps: - name: Setup Python uses: actions/setup-python@v2 - - name: Pull ESP-IDF docker - run: docker pull espressif/idf:release-v4.4 - - name: Checkout uses: actions/checkout@v2 @@ -61,7 +61,7 @@ jobs: run: git submodule update --init lib/tinyusb lib/uf2 - name: Build - run: docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.3 make -C ports/esp32s2/ BOARD=${{ matrix.board }} all self-update copy-artifact + run: docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.4 make -C ports/esp32s2/ BOARD=${{ matrix.board }} all self-update copy-artifact - uses: actions/upload-artifact@v2 with: diff --git a/lib/tinyusb b/lib/tinyusb index 9b3ec69b2..a4cfd1c69 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 9b3ec69b27b5d18d4c1f34d6730cec21afc8e628 +Subproject commit a4cfd1c69a6aa5651dbb5964c380231e2ef1f317 diff --git a/ports/esp32s2/CMakeLists.txt b/ports/esp32s2/CMakeLists.txt index a92d6eafb..f6111a6de 100644 --- a/ports/esp32s2/CMakeLists.txt +++ b/ports/esp32s2/CMakeLists.txt @@ -15,6 +15,8 @@ if(NOT (DEFINED BOARD AND EXISTS "${CMAKE_SOURCE_DIR}/boards/${BOARD}/board.h") message(FATAL_ERROR "Invalid BOARD specified") endif() +include(${CMAKE_SOURCE_DIR}/boards/${BOARD}/board.cmake) + # TOP is absolute path to root directory set(TOP "../..") get_filename_component(TOP "${TOP}" REALPATH) @@ -25,7 +27,6 @@ set(SDKCONFIG_DEFAULTS sdkconfig.defaults boards/${BOARD}/sdkconfig) set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig) include($ENV{IDF_PATH}/tools/cmake/project.cmake) -set(SUPPORTED_TARGETS esp32s2) execute_process(COMMAND git describe --dirty --always --tags OUTPUT_VARIABLE GIT_VERSION diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 6ab6da9ec..8f28d49dd 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -20,37 +20,13 @@ all: build: all -app: - idf.py -B$(BUILD) -DBOARD=$(BOARD) app - -clean: - idf.py -B$(BUILD) -DBOARD=$(BOARD) clean - @rm -rf $(BIN) - fullclean: idf.py -B$(BUILD) -DBOARD=$(BOARD) fullclean @rm -rf $(BIN) + @rm -rf $(SELF_BUILD) -flash: - idf.py -B$(BUILD) -DBOARD=$(BOARD) $(SERIAL_OPT) flash - -bootloader-flash: - idf.py -B$(BUILD) -DBOARD=$(BOARD) $(SERIAL_OPT) bootloader-flash - -app-flash: - idf.py -B$(BUILD) -DBOARD=$(BOARD) $(SERIAL_OPT) app-flash - -erase: - idf.py -B$(BUILD) -DBOARD=$(BOARD) erase_flash - -monitor: - idf.py -B$(BUILD) -DBOARD=$(BOARD) monitor - -size-components: - idf.py -B$(BUILD) -DBOARD=$(BOARD) size-components - -size-files: - idf.py -B$(BUILD) -DBOARD=$(BOARD) size-files +app bootloader clean flash bootloader-flash app-flash erase monitor dfu-flash dfu size size-components size-files: + idf.py -B$(BUILD) -DBOARD=$(BOARD) $(SERIAL_OPT) $@ $(BUILD)/combined.bin: app UF2_OFFSET=`awk '{if(FNR==2)print $$1}' $(BUILD)/app-flash_args)`; \ @@ -63,13 +39,25 @@ $(BUILD)/combined.bin: app #-------------- Self Update -------------- SELF_BUILD = apps/self_update/$(BUILD) +UF2_FAMILY_ID_S2 = 0xbfdd4eee +UF2_FAMILY_ID_S3 = 0xc47e5767 + +BOARD_CMAKE := $(file < boards/$(BOARD)/board.cmake) +ifneq ($(findstring esp32s2,$(BOARD_CMAKE)),) + UF2_FAMILY_ID := $(UF2_FAMILY_ID_S2) +else + ifneq ($(findstring esp32s3,$(BOARD_CMAKE)),) + UF2_FAMILY_ID := $(UF2_FAMILY_ID_S3) + endif +endif + $(SELF_BUILD)/update-tinyuf2.bin: app $(PYTHON3) $(TOP)/lib/uf2/utils/uf2conv.py --carray $(BUILD)/tinyuf2.bin -o $(TOP)/apps/self_update/bootloader_bin.c idf.py -C apps/self_update/ -B$(SELF_BUILD) -DBOARD=$(BOARD) app @rm $(TOP)/apps/self_update/bootloader_bin.c $(SELF_BUILD)/update-tinyuf2.uf2: $(SELF_BUILD)/update-tinyuf2.bin - $(PYTHON3) $(TOP)/lib/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ + $(PYTHON3) $(TOP)/lib/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b 0x0000 -c -o $@ $^ self-update: $(SELF_BUILD)/update-tinyuf2.uf2 diff --git a/ports/esp32s2/README.md b/ports/esp32s2/README.md index 6c77561a0..3061c9cfe 100644 --- a/ports/esp32s2/README.md +++ b/ports/esp32s2/README.md @@ -69,13 +69,15 @@ There are a few ways to enter UF2 mode: ## Convert Binary to UF2 -To create your own UF2 file, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file, specifying the family as **0xbfdd4eee**. Note you must specify application address of 0x00 with the -b switch, the bootloader will use it as offset to write to ota partition. - -To create a UF2 image from a .bin file using family option `ESP32S2` or its magic number as followss: +To create your own UF2 file, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file, specifying the family id as `ESP32S2`, ``ESP32S3` or their magic number as follows. Note you must specify application address of 0x00 with the -b switch, the bootloader will use it as offset to write to ota partition. ``` uf2conv.py firmware.bin -c -b 0x00 -f ESP32S2 uf2conv.py firmware.bin -c -b 0x00 -f 0xbfdd4eee + +uf2conv.py firmware.bin -c -b 0x00 -f ESP32S3 +uf2conv.py firmware.bin -c -b 0x00 -f 0xc47e5767 + ``` ## 2nd Stage Bootloader diff --git a/ports/esp32s2/apps/self_update/CMakeLists.txt b/ports/esp32s2/apps/self_update/CMakeLists.txt index 4f802856a..3183423b7 100644 --- a/ports/esp32s2/apps/self_update/CMakeLists.txt +++ b/ports/esp32s2/apps/self_update/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.5) # Check for -DBOARD= if(NOT (DEFINED BOARD AND EXISTS "${CMAKE_SOURCE_DIR}/../../boards/${BOARD}/board.h") ) - file(GLOB BOARD_LIST RELATIVE ${CMAKE_SOURCE_DIR}/../boards "boards/*/board.h") + file(GLOB BOARD_LIST RELATIVE ${CMAKE_SOURCE_DIR}/../../boards "boards/*/board.h") message("Please specify `-DBOARD=` with one of supported boards") foreach(board IN LISTS BOARD_LIST) @@ -15,6 +15,8 @@ if(NOT (DEFINED BOARD AND EXISTS "${CMAKE_SOURCE_DIR}/../../boards/${BOARD}/boar message(FATAL_ERROR "Invalid BOARD specified") endif() +include(${CMAKE_SOURCE_DIR}/../../boards/${BOARD}/board.cmake) + # TOP is absolute path to root directory set(TOP "../../../..") get_filename_component(TOP "${TOP}" REALPATH) @@ -22,7 +24,6 @@ get_filename_component(TOP "${TOP}" REALPATH) set(EXTRA_COMPONENT_DIRS "${TOP}/apps/self_update" "../../boards" "../../components") include($ENV{IDF_PATH}/tools/cmake/project.cmake) -set(SUPPORTED_TARGETS esp32s2) add_compile_definitions(TINYUF2_SELF_UPDATE) diff --git a/ports/esp32s2/apps/self_update/sdkconfig.defaults b/ports/esp32s2/apps/self_update/sdkconfig.defaults index 253ee5536..f8f6106ec 100644 --- a/ports/esp32s2/apps/self_update/sdkconfig.defaults +++ b/ports/esp32s2/apps/self_update/sdkconfig.defaults @@ -1,14 +1,7 @@ CONFIG_IDF_CMAKE=y -CONFIG_IDF_TARGET="esp32s2" -CONFIG_IDF_TARGET_ESP32S2=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -# Partition Table -#CONFIG_PARTITION_TABLE_CUSTOM=y -#CONFIG_PARTITION_TABLE_OFFSET=0x8000 -#CONFIG_PARTITION_TABLE_MD5=y - # Compiler options CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2/board.cmake b/ports/esp32s2/boards/adafruit_feather_esp32s2/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2/sdkconfig b/ports/esp32s2/boards/adafruit_feather_esp32s2/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2/sdkconfig +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_reverse_tft/board.cmake b/ports/esp32s2/boards/adafruit_feather_esp32s2_reverse_tft/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_reverse_tft/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig b/ports/esp32s2/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tft/board.cmake b/ports/esp32s2/boards/adafruit_feather_esp32s2_tft/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tft/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tft/sdkconfig b/ports/esp32s2/boards/adafruit_feather_esp32s2_tft/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tft/sdkconfig +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tft/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/adafruit_funhouse_esp32s2/board.cmake b/ports/esp32s2/boards/adafruit_funhouse_esp32s2/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_funhouse_esp32s2/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/adafruit_funhouse_esp32s2/sdkconfig b/ports/esp32s2/boards/adafruit_funhouse_esp32s2/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/adafruit_funhouse_esp32s2/sdkconfig +++ b/ports/esp32s2/boards/adafruit_funhouse_esp32s2/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/adafruit_magtag_29gray/board.cmake b/ports/esp32s2/boards/adafruit_magtag_29gray/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_magtag_29gray/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/adafruit_magtag_29gray/sdkconfig b/ports/esp32s2/boards/adafruit_magtag_29gray/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/adafruit_magtag_29gray/sdkconfig +++ b/ports/esp32s2/boards/adafruit_magtag_29gray/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/board.cmake b/ports/esp32s2/boards/adafruit_metro_esp32s2/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/sdkconfig b/ports/esp32s2/boards/adafruit_metro_esp32s2/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/sdkconfig +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/adafruit_qtpy_esp32s2/board.cmake b/ports/esp32s2/boards/adafruit_qtpy_esp32s2/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_qtpy_esp32s2/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/adafruit_qtpy_esp32s2/sdkconfig b/ports/esp32s2/boards/adafruit_qtpy_esp32s2/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/adafruit_qtpy_esp32s2/sdkconfig +++ b/ports/esp32s2/boards/adafruit_qtpy_esp32s2/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/artisense_rd00/board.cmake b/ports/esp32s2/boards/artisense_rd00/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/artisense_rd00/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/artisense_rd00/sdkconfig b/ports/esp32s2/boards/artisense_rd00/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/artisense_rd00/sdkconfig +++ b/ports/esp32s2/boards/artisense_rd00/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/atmegazero_esp32s2/board.cmake b/ports/esp32s2/boards/atmegazero_esp32s2/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/atmegazero_esp32s2/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/atmegazero_esp32s2/sdkconfig b/ports/esp32s2/boards/atmegazero_esp32s2/sdkconfig index 555b008a2..e4fa04e07 100644 --- a/ports/esp32s2/boards/atmegazero_esp32s2/sdkconfig +++ b/ports/esp32s2/boards/atmegazero_esp32s2/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-16MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y diff --git a/ports/esp32s2/boards/boards.h b/ports/esp32s2/boards/boards.h index 2ffa86af5..a3738b201 100644 --- a/ports/esp32s2/boards/boards.h +++ b/ports/esp32s2/boards/boards.h @@ -29,10 +29,18 @@ extern "C" { #endif +#include "sdkconfig.h" #include "board.h" // Family ID for updating Application -#define BOARD_UF2_FAMILY_ID 0xbfdd4eee +#if CONFIG_IDF_TARGET_ESP32S2 + #define BOARD_UF2_FAMILY_ID 0xbfdd4eee +#elif CONFIG_IDF_TARGET_ESP32S3 + #define BOARD_UF2_FAMILY_ID 0xc47e5767 +#else + #error unsupported MCUs +#endif + // Flash Start Address of Application #define BOARD_FLASH_APP_START 0 diff --git a/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/board.cmake b/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/board.cmake new file mode 100644 index 000000000..c1426c950 --- /dev/null +++ b/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s3") diff --git a/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/board.h b/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/board.h new file mode 100644 index 000000000..bc5c26cbb --- /dev/null +++ b/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/board.h @@ -0,0 +1,74 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2020 Ha Thach (tinyusb.org) 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. + */ + +#ifndef ESPRESSIF_S3_DEVKITC_H_ +#define ESPRESSIF_S3_DEVKITC_H_ + +//--------------------------------------------------------------------+ +// Button +//--------------------------------------------------------------------+ + +// Enter UF2 mode if GPIO is pressed while 2nd stage bootloader indicator +// is on e.g RGB = Purple. If it is GPIO0, user should not hold this while +// reset since that will instead run the 1st stage ROM bootloader +#define PIN_BUTTON_UF2 0 + +// GPIO that implement 1-bit memory with RC components which hold the +// pin value long enough for double reset detection. +// #define PIN_DOUBLE_RESET_RC + +//--------------------------------------------------------------------+ +// LED +//--------------------------------------------------------------------+ + +// GPIO connected to Neopixel data +#define NEOPIXEL_PIN 48 + +// Brightness percentage from 1 to 255 +#define NEOPIXEL_BRIGHTNESS 0x10 + +// Number of neopixels +#define NEOPIXEL_NUMBER 1 + + +// LED for indicator +// If not defined neopixel will be use for flash writing instead +// #define LED_PIN 42 +// #define LED_STATE_ON 1 + +//--------------------------------------------------------------------+ +// USB UF2 +//--------------------------------------------------------------------+ + +#define USB_VID 0x239A +#define USB_PID 0x00A5 // TODO temporarily shared with S2 saola wrover +#define USB_MANUFACTURER "Espressif" +#define USB_PRODUCT "ESP32S3 DevKitC 1" + +#define UF2_PRODUCT_NAME USB_MANUFACTURER " " USB_PRODUCT +#define UF2_BOARD_ID "ESP32S3-DevKitC-v1.0" +#define UF2_VOLUME_LABEL "S3DKC1BOOT" +#define UF2_INDEX_URL "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html" + +#endif diff --git a/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/sdkconfig b/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/sdkconfig new file mode 100644 index 000000000..329b9a9f2 --- /dev/null +++ b/ports/esp32s2/boards/espressif_esp32s3_devkitc_1/sdkconfig @@ -0,0 +1,7 @@ +# Board Specific Config + +# Partition Table +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MB.csv" + +# Serial flasher config +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y diff --git a/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/board.cmake b/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/board.cmake new file mode 100644 index 000000000..c1426c950 --- /dev/null +++ b/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s3") diff --git a/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/board.h b/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/board.h new file mode 100644 index 000000000..7a8d9b87c --- /dev/null +++ b/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/board.h @@ -0,0 +1,74 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2020 Ha Thach (tinyusb.org) 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. + */ + +#ifndef ESPRESSIF_S3_DEVKITM_H_ +#define ESPRESSIF_S3_DEVKITM_H_ + +//--------------------------------------------------------------------+ +// Button +//--------------------------------------------------------------------+ + +// Enter UF2 mode if GPIO is pressed while 2nd stage bootloader indicator +// is on e.g RGB = Purple. If it is GPIO0, user should not hold this while +// reset since that will instead run the 1st stage ROM bootloader +#define PIN_BUTTON_UF2 0 + +// GPIO that implement 1-bit memory with RC components which hold the +// pin value long enough for double reset detection. +// #define PIN_DOUBLE_RESET_RC + +//--------------------------------------------------------------------+ +// LED +//--------------------------------------------------------------------+ + +// GPIO connected to Neopixel data +#define NEOPIXEL_PIN 48 + +// Brightness percentage from 1 to 255 +#define NEOPIXEL_BRIGHTNESS 0x10 + +// Number of neopixels +#define NEOPIXEL_NUMBER 1 + + +// LED for indicator +// If not defined neopixel will be use for flash writing instead +// #define LED_PIN 42 +// #define LED_STATE_ON 1 + +//--------------------------------------------------------------------+ +// USB UF2 +//--------------------------------------------------------------------+ + +#define USB_VID 0x239A +#define USB_PID 0x00A5 // TODO temporarily shared with S2 saola wrover +#define USB_MANUFACTURER "Espressif" +#define USB_PRODUCT "ESP32S3 DevKitM 1" + +#define UF2_PRODUCT_NAME USB_MANUFACTURER " " USB_PRODUCT +#define UF2_BOARD_ID "ESP32S3-DevKitM-v1.0" +#define UF2_VOLUME_LABEL "S3DKM1BOOT" +#define UF2_INDEX_URL "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html" + +#endif diff --git a/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/sdkconfig b/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/sdkconfig new file mode 100644 index 000000000..329b9a9f2 --- /dev/null +++ b/ports/esp32s2/boards/espressif_esp32s3_devkitm_1/sdkconfig @@ -0,0 +1,7 @@ +# Board Specific Config + +# Partition Table +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MB.csv" + +# Serial flasher config +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y diff --git a/ports/esp32s2/boards/espressif_hmi_1/board.cmake b/ports/esp32s2/boards/espressif_hmi_1/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/espressif_hmi_1/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/espressif_hmi_1/sdkconfig b/ports/esp32s2/boards/espressif_hmi_1/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/espressif_hmi_1/sdkconfig +++ b/ports/esp32s2/boards/espressif_hmi_1/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/espressif_kaluga_1/board.cmake b/ports/esp32s2/boards/espressif_kaluga_1/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/espressif_kaluga_1/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/espressif_kaluga_1/sdkconfig b/ports/esp32s2/boards/espressif_kaluga_1/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/espressif_kaluga_1/sdkconfig +++ b/ports/esp32s2/boards/espressif_kaluga_1/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/board.cmake b/ports/esp32s2/boards/espressif_saola_1_wroom/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/sdkconfig b/ports/esp32s2/boards/espressif_saola_1_wroom/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/sdkconfig +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/board.cmake b/ports/esp32s2/boards/espressif_saola_1_wrover/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/sdkconfig b/ports/esp32s2/boards/espressif_saola_1_wrover/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wrover/sdkconfig +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/gravitech_cucumberRIS_v1.1/board.cmake b/ports/esp32s2/boards/gravitech_cucumberRIS_v1.1/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/gravitech_cucumberRIS_v1.1/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/gravitech_cucumberRIS_v1.1/sdkconfig b/ports/esp32s2/boards/gravitech_cucumberRIS_v1.1/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/gravitech_cucumberRIS_v1.1/sdkconfig +++ b/ports/esp32s2/boards/gravitech_cucumberRIS_v1.1/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.cmake b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig +++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/lolin_s2-pico/board.cmake b/ports/esp32s2/boards/lolin_s2-pico/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/lolin_s2-pico/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/lolin_s2-pico/sdkconfig b/ports/esp32s2/boards/lolin_s2-pico/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/lolin_s2-pico/sdkconfig +++ b/ports/esp32s2/boards/lolin_s2-pico/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/lolin_s2_mini/board.cmake b/ports/esp32s2/boards/lolin_s2_mini/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/lolin_s2_mini/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/lolin_s2_mini/sdkconfig b/ports/esp32s2/boards/lolin_s2_mini/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/sdkconfig +++ b/ports/esp32s2/boards/lolin_s2_mini/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/microdev_micro_s2/board.cmake b/ports/esp32s2/boards/microdev_micro_s2/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/microdev_micro_s2/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/microdev_micro_s2/sdkconfig b/ports/esp32s2/boards/microdev_micro_s2/sdkconfig index 555b008a2..e4fa04e07 100644 --- a/ports/esp32s2/boards/microdev_micro_s2/sdkconfig +++ b/ports/esp32s2/boards/microdev_micro_s2/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-16MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y diff --git a/ports/esp32s2/boards/morpheans_morphesp-240/board.cmake b/ports/esp32s2/boards/morpheans_morphesp-240/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/morpheans_morphesp-240/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/morpheans_morphesp-240/sdkconfig b/ports/esp32s2/boards/morpheans_morphesp-240/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/morpheans_morphesp-240/sdkconfig +++ b/ports/esp32s2/boards/morpheans_morphesp-240/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/muselab_nanoesp32-s2_wroom/board.cmake b/ports/esp32s2/boards/muselab_nanoesp32-s2_wroom/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/muselab_nanoesp32-s2_wroom/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/muselab_nanoesp32-s2_wroom/sdkconfig b/ports/esp32s2/boards/muselab_nanoesp32-s2_wroom/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/muselab_nanoesp32-s2_wroom/sdkconfig +++ b/ports/esp32s2/boards/muselab_nanoesp32-s2_wroom/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/muselab_nanoesp32-s2_wrover/board.cmake b/ports/esp32s2/boards/muselab_nanoesp32-s2_wrover/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/muselab_nanoesp32-s2_wrover/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/muselab_nanoesp32-s2_wrover/sdkconfig b/ports/esp32s2/boards/muselab_nanoesp32-s2_wrover/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/muselab_nanoesp32-s2_wrover/sdkconfig +++ b/ports/esp32s2/boards/muselab_nanoesp32-s2_wrover/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/olimex_esp32s2_devkit_lipo_vB1/board.cmake b/ports/esp32s2/boards/olimex_esp32s2_devkit_lipo_vB1/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/olimex_esp32s2_devkit_lipo_vB1/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/olimex_esp32s2_devkit_lipo_vB1/sdkconfig b/ports/esp32s2/boards/olimex_esp32s2_devkit_lipo_vB1/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/olimex_esp32s2_devkit_lipo_vB1/sdkconfig +++ b/ports/esp32s2/boards/olimex_esp32s2_devkit_lipo_vB1/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/targett_mcb_wroom/board.cmake b/ports/esp32s2/boards/targett_mcb_wroom/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/targett_mcb_wroom/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/targett_mcb_wroom/sdkconfig b/ports/esp32s2/boards/targett_mcb_wroom/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/targett_mcb_wroom/sdkconfig +++ b/ports/esp32s2/boards/targett_mcb_wroom/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/targett_mcb_wrover/board.cmake b/ports/esp32s2/boards/targett_mcb_wrover/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/targett_mcb_wrover/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/targett_mcb_wrover/sdkconfig b/ports/esp32s2/boards/targett_mcb_wrover/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/targett_mcb_wrover/sdkconfig +++ b/ports/esp32s2/boards/targett_mcb_wrover/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.cmake b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/sdkconfig b/ports/esp32s2/boards/unexpectedmaker_feathers2/sdkconfig index 555b008a2..e4fa04e07 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/sdkconfig +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-16MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_neo/board.cmake b/ports/esp32s2/boards/unexpectedmaker_feathers2_neo/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_neo/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_neo/sdkconfig b/ports/esp32s2/boards/unexpectedmaker_feathers2_neo/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_neo/sdkconfig +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_neo/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/boards/unexpectedmaker_tinys2/board.cmake b/ports/esp32s2/boards/unexpectedmaker_tinys2/board.cmake new file mode 100644 index 000000000..6d7173e92 --- /dev/null +++ b/ports/esp32s2/boards/unexpectedmaker_tinys2/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32s2") diff --git a/ports/esp32s2/boards/unexpectedmaker_tinys2/sdkconfig b/ports/esp32s2/boards/unexpectedmaker_tinys2/sdkconfig index 6ab3b92b2..33a8c772b 100644 --- a/ports/esp32s2/boards/unexpectedmaker_tinys2/sdkconfig +++ b/ports/esp32s2/boards/unexpectedmaker_tinys2/sdkconfig @@ -1,6 +1,7 @@ +# Board Specific Config +# Partition Table CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv" # Serial flasher config CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/ports/esp32s2/components/bootloader/subproject/main/bootloader_start.c b/ports/esp32s2/components/bootloader/subproject/main/bootloader_start.c index afc5ae1ea..a2acc0078 100644 --- a/ports/esp32s2/components/bootloader/subproject/main/bootloader_start.c +++ b/ports/esp32s2/components/bootloader/subproject/main/bootloader_start.c @@ -18,25 +18,26 @@ #include "bootloader_common.h" #include "bootloader_hooks.h" -#include "esp32s2/rom/gpio.h" -#include "soc/cpu.h" -#include "hal/gpio_ll.h" +// components/esp_rom #include "esp_rom_sys.h" #include "esp_rom_gpio.h" +#include "soc/cpu.h" +#include "hal/gpio_ll.h" + // Specific board header specified with -DBOARD= #include "board.h" #ifdef TCA9554_ADDR -#include "hal/i2c_types.h" + #include "hal/i2c_types.h" -// Using GPIO expander requires long reset delay (somehow) -#define NEOPIXEL_RESET_DELAY ns2cycle(1000*1000) + // Using GPIO expander requires long reset delay (somehow) + #define NEOPIXEL_RESET_DELAY ns2cycle(1000*1000) #endif #ifndef NEOPIXEL_RESET_DELAY -// Need at least 200 us for initial delay although Neopixel reset time is only 50 us -#define NEOPIXEL_RESET_DELAY ns2cycle(200*1000) + // Need at least 200 us for initial delay although Neopixel reset time is only 50 us + #define NEOPIXEL_RESET_DELAY ns2cycle(200*1000) #endif @@ -64,7 +65,8 @@ static void board_led_off(void); // Get Reset Reason Hint requested by Application to enter UF2 //--------------------------------------------------------------------+ -// copied from esp_system/port/soc/esp32s2/reset_reason.c +// copied from components/esp_system/port/soc/esp32s2/reset_reason.c +// since esp_system is not included with bootloader build #define RST_REASON_BIT 0x80000000 #define RST_REASON_MASK 0x7FFF #define RST_REASON_SHIFT 16 @@ -211,29 +213,29 @@ static int selected_boot_partition(const bootloader_state_t *bs) #ifdef PIN_DOUBLE_RESET_RC // Double reset detect if board implements 1-bit memory with RC components PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[PIN_DOUBLE_RESET_RC]); - if ( GPIO_INPUT_GET(PIN_DOUBLE_RESET_RC) == 1 ) + if ( gpio_ll_get_level(&GPIO, PIN_DOUBLE_RESET_RC) == 1 ) { ESP_LOGI(TAG, "Detect double reset using RC on GPIO %d to enter UF2 bootloader", PIN_DOUBLE_RESET_RC); boot_index = FACTORY_INDEX; } else { - GPIO_OUTPUT_SET(PIN_DOUBLE_RESET_RC, 1); + gpio_ll_set_level(&GPIO, PIN_DOUBLE_RESET_RC, 1); } #endif if ( boot_index != FACTORY_INDEX ) { - gpio_pad_select_gpio(PIN_BUTTON_UF2); + esp_rom_gpio_pad_select_gpio(PIN_BUTTON_UF2); if (GPIO_PIN_MUX_REG[PIN_BUTTON_UF2]) { PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[PIN_BUTTON_UF2]); } - gpio_pad_pullup(PIN_BUTTON_UF2); + esp_rom_gpio_pad_pullup_only(PIN_BUTTON_UF2); uint32_t tm_start = esp_log_early_timestamp(); while (UF2_DETECTION_DELAY_MS > (esp_log_early_timestamp() - tm_start) ) { - if ( GPIO_INPUT_GET(PIN_BUTTON_UF2) == 0 ) + if ( gpio_ll_get_level(&GPIO, PIN_BUTTON_UF2) == 0 ) { ESP_LOGI(TAG, "Detect GPIO %d active to enter UF2 bootloader", PIN_BUTTON_UF2); @@ -245,7 +247,7 @@ static int selected_boot_partition(const bootloader_state_t *bs) } #if PIN_DOUBLE_RESET_RC - GPIO_OUTPUT_SET(PIN_DOUBLE_RESET_RC, 0); + gpio_ll_set_level(&GPIO, PIN_DOUBLE_RESET_RC, 0); #endif board_led_off(); @@ -271,8 +273,16 @@ struct _reent *__getreent(void) static inline uint32_t ns2cycle(uint32_t ns) { - extern uint32_t g_ticks_per_us_pro; // e.g 80 for 80 Mhz - return (g_ticks_per_us_pro*ns) / 1000; + uint32_t tick_per_us; + +#if CONFIG_IDF_TARGET_ESP32S3 + tick_per_us = ets_get_cpu_frequency(); +#else // ESP32S2 + extern uint32_t g_ticks_per_us_pro; + tick_per_us = g_ticks_per_us_pro; +#endif + + return (tick_per_us*ns) / 1000; } static inline uint32_t delay_cycle(uint32_t cycle) @@ -449,7 +459,7 @@ void sw_i2c_end() // Initialize I2C pins void sw_i2c_init() { - gpio_pad_select_gpio(I2C_MASTER_SDA_IO); + esp_rom_gpio_pad_select_gpio(I2C_MASTER_SDA_IO); gpio_ll_input_enable(&GPIO, I2C_MASTER_SDA_IO); gpio_ll_output_enable(&GPIO, I2C_MASTER_SDA_IO); gpio_ll_od_enable(&GPIO, I2C_MASTER_SDA_IO); @@ -458,7 +468,7 @@ void sw_i2c_init() gpio_ll_intr_disable(&GPIO, I2C_MASTER_SDA_IO); gpio_ll_set_level(&GPIO, I2C_MASTER_SDA_IO, HIGH); - gpio_pad_select_gpio(I2C_MASTER_SCL_IO); + esp_rom_gpio_pad_select_gpio(I2C_MASTER_SCL_IO); gpio_ll_input_disable(&GPIO, I2C_MASTER_SCL_IO); gpio_ll_output_enable(&GPIO, I2C_MASTER_SCL_IO); gpio_ll_od_enable(&GPIO, I2C_MASTER_SCL_IO); @@ -498,13 +508,13 @@ static void board_led_on(void) #endif #ifdef NEOPIXEL_POWER_PIN - gpio_pad_select_gpio(NEOPIXEL_POWER_PIN); + esp_rom_gpio_pad_select_gpio(NEOPIXEL_POWER_PIN); gpio_ll_input_disable(&GPIO, NEOPIXEL_POWER_PIN); gpio_ll_output_enable(&GPIO, NEOPIXEL_POWER_PIN); gpio_ll_set_level(&GPIO, NEOPIXEL_POWER_PIN, NEOPIXEL_POWER_STATE); #endif - gpio_pad_select_gpio(NEOPIXEL_PIN); + esp_rom_gpio_pad_select_gpio(NEOPIXEL_PIN); gpio_ll_input_disable(&GPIO, NEOPIXEL_PIN); gpio_ll_output_enable(&GPIO, NEOPIXEL_PIN); gpio_ll_set_level(&GPIO, NEOPIXEL_PIN, 0); @@ -516,18 +526,18 @@ static void board_led_on(void) #endif #ifdef DOTSTAR_PIN_DATA - gpio_pad_select_gpio(DOTSTAR_PIN_DATA); + esp_rom_gpio_pad_select_gpio(DOTSTAR_PIN_DATA); gpio_ll_input_disable(&GPIO, DOTSTAR_PIN_DATA); gpio_ll_output_enable(&GPIO, DOTSTAR_PIN_DATA); gpio_ll_set_level(&GPIO, DOTSTAR_PIN_DATA, 0); - gpio_pad_select_gpio(DOTSTAR_PIN_SCK); + esp_rom_gpio_pad_select_gpio(DOTSTAR_PIN_SCK); gpio_ll_input_disable(&GPIO, DOTSTAR_PIN_SCK); gpio_ll_output_enable(&GPIO, DOTSTAR_PIN_SCK); gpio_ll_set_level(&GPIO, DOTSTAR_PIN_SCK, 0); #ifdef DOTSTAR_PIN_PWR - gpio_pad_select_gpio(DOTSTAR_PIN_PWR); + esp_rom_gpio_pad_select_gpio(DOTSTAR_PIN_PWR); gpio_ll_input_disable(&GPIO, DOTSTAR_PIN_PWR); gpio_ll_output_enable(&GPIO, DOTSTAR_PIN_PWR); gpio_ll_set_level(&GPIO, DOTSTAR_PIN_PWR, DOTSTAR_POWER_STATE); @@ -537,7 +547,7 @@ static void board_led_on(void) #endif #ifdef LED_PIN - gpio_pad_select_gpio(LED_PIN); + esp_rom_gpio_pad_select_gpio(LED_PIN); gpio_ll_input_disable(&GPIO, LED_PIN); gpio_ll_output_enable(&GPIO, LED_PIN); diff --git a/ports/esp32s2/sdkconfig.defaults b/ports/esp32s2/sdkconfig.defaults index 7846c0aab..453a1a50f 100644 --- a/ports/esp32s2/sdkconfig.defaults +++ b/ports/esp32s2/sdkconfig.defaults @@ -1,6 +1,4 @@ CONFIG_IDF_CMAKE=y -CONFIG_IDF_TARGET="esp32s2" -CONFIG_IDF_TARGET_ESP32S2=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y diff --git a/ports/esp32s2/tusb_config.h b/ports/esp32s2/tusb_config.h index 23d986edd..c23b8f92e 100644 --- a/ports/esp32s2/tusb_config.h +++ b/ports/esp32s2/tusb_config.h @@ -30,11 +30,18 @@ extern "C" { #endif +#include "sdkconfig.h" + //-------------------------------------------------------------------- // COMMON CONFIGURATION //-------------------------------------------------------------------- -#define CFG_TUSB_MCU OPT_MCU_ESP32S2 +#if CONFIG_IDF_TARGET_ESP32S2 + #define CFG_TUSB_MCU OPT_MCU_ESP32S2 +#elif CONFIG_IDF_TARGET_ESP32S3 + #define CFG_TUSB_MCU OPT_MCU_ESP32S3 +#endif + #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE #define CFG_TUSB_OS OPT_OS_FREERTOS diff --git a/ports/make.mk b/ports/make.mk index 6ca37bf44..7dfefa0be 100644 --- a/ports/make.mk +++ b/ports/make.mk @@ -103,10 +103,7 @@ SRC_C += \ $(TINYUSB_DIR)/class/cdc/cdc_device.c \ $(TINYUSB_DIR)/class/dfu/dfu_rt_device.c \ $(TINYUSB_DIR)/class/hid/hid_device.c \ - $(TINYUSB_DIR)/class/midi/midi_device.c \ $(TINYUSB_DIR)/class/msc/msc_device.c \ - $(TINYUSB_DIR)/class/net/net_device.c \ - $(TINYUSB_DIR)/class/usbtmc/usbtmc_device.c \ $(TINYUSB_DIR)/class/vendor/vendor_device.c INC += $(TOP)/$(TINYUSB_DIR) diff --git a/ports/mimxrt10xx/port.mk b/ports/mimxrt10xx/port.mk index 0d642ec03..208bc7d63 100644 --- a/ports/mimxrt10xx/port.mk +++ b/ports/mimxrt10xx/port.mk @@ -38,7 +38,7 @@ SRC_C += $(MCU_DIR)/drivers/fsl_romapi.c endif ifndef BUILD_NO_TINYUSB -SRC_C += lib/tinyusb/src/portable/nxp/transdimension/dcd_transdimension.c +SRC_C += lib/tinyusb/src/portable/chipidea/ci_hs/dcd_ci_hs.c endif SRC_S += $(MCU_DIR)/gcc/startup_$(MCU).S diff --git a/ports/stm32f4/Makefile b/ports/stm32f4/Makefile index 3620cc419..0ee507b00 100644 --- a/ports/stm32f4/Makefile +++ b/ports/stm32f4/Makefile @@ -40,7 +40,7 @@ PORT_SRC_C += \ SRC_C += \ $(PORT_SRC_C) \ - lib/tinyusb/src/portable/st/synopsys/dcd_synopsys.c \ + lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c \ # Port include INC += \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09ce0e590..f5057080e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,6 @@ target_sources(${COMPONENT_TARGET} PUBLIC "${TOP}/lib/tinyusb/src/class/hid/hid_device.c" "${TOP}/lib/tinyusb/src/class/midi/midi_device.c" "${TOP}/lib/tinyusb/src/class/msc/msc_device.c" - "${TOP}/lib/tinyusb/src/class/net/net_device.c" "${TOP}/lib/tinyusb/src/class/usbtmc/usbtmc_device.c" "${TOP}/lib/tinyusb/src/class/vendor/vendor_device.c" "${TOP}/lib/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c"