diff --git a/.github/scripts/install-arduino-cli.sh b/.github/scripts/install-arduino-cli.sh new file mode 100755 index 00000000000..ba7547ccc28 --- /dev/null +++ b/.github/scripts/install-arduino-cli.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +OSBITS=`arch` +if [[ "$OSTYPE" == "linux"* ]]; then + export OS_IS_LINUX="1" + if [[ "$OSBITS" == "i686" ]]; then + OS_NAME="linux32" + elif [[ "$OSBITS" == "x86_64" ]]; then + OS_NAME="linux64" + elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then + OS_NAME="linuxarm" + else + OS_NAME="$OSTYPE-$OSBITS" + echo "Unknown OS '$OS_NAME'" + exit 1 + fi +elif [[ "$OSTYPE" == "darwin"* ]]; then + export OS_IS_MACOS="1" + OS_NAME="macosx" +elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then + export OS_IS_WINDOWS="1" + OS_NAME="windows" +else + OS_NAME="$OSTYPE-$OSBITS" + echo "Unknown OS '$OS_NAME'" + exit 1 +fi +export OS_NAME + +if [ "$OS_IS_MACOS" == "1" ]; then + export ARDUINO_IDE_PATH="$HOME/bin" + export ARDUINO_USR_PATH="$HOME/Documents/Arduino" +elif [ "$OS_IS_WINDOWS" == "1" ]; then + export ARDUINO_IDE_PATH="$HOME/bin" + export ARDUINO_USR_PATH="$HOME/Documents/Arduino" +else + export ARDUINO_IDE_PATH="$HOME/bin" + export ARDUINO_USR_PATH="$HOME/Arduino" +fi + +if [ ! -d "$ARDUINO_IDE_PATH" ] || [ ! -f "$ARDUINO_IDE_PATH/arduino-cli" ]; then + echo "Installing Arduino CLI on $OS_NAME ..." + mkdir -p "$ARDUINO_IDE_PATH" + curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$ARDUINO_IDE_PATH" sh +fi + diff --git a/.github/scripts/install-platformio-esp32.sh b/.github/scripts/install-platformio-esp32.sh index 96cf7330f6b..b3f7b081ba1 100755 --- a/.github/scripts/install-platformio-esp32.sh +++ b/.github/scripts/install-platformio-esp32.sh @@ -3,8 +3,8 @@ export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32" PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git" -TOOLCHAIN_VERSION="8.4.0+2021r2-patch3" -ESPTOOLPY_VERSION="~1.40201.0" +TOOLCHAIN_VERSION="8.4.0+2021r2-patch5" +ESPTOOLPY_VERSION="~1.40400.0" ESPRESSIF_ORGANIZATION_NAME="espressif" echo "Installing Python Wheel ..." diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 71a92a1021a..0ca5a648fd0 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -9,7 +9,8 @@ function build(){ local fqbn=$2 local chunk_index=$3 local chunks_cnt=$4 - local sketches=$5 + shift; shift; shift; shift; + local sketches=$* local BUILD_SKETCH="${SCRIPTS_DIR}/sketch_utils.sh build" local BUILD_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh chunk_build" @@ -24,15 +25,15 @@ function build(){ ${BUILD_SKETCHES} ${args} else for sketch in ${sketches}; do - args+=" -s $(dirname $sketch)" - if [ "$OS_IS_WINDOWS" == "1" ]; then + local sargs="$args -s $(dirname $sketch)" + if [ "$OS_IS_WINDOWS" == "1" ] && [ -d "$ARDUINO_IDE_PATH/tools-builder" ]; then local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"` local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"` win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version" - args+=" ${win_opts}" + sargs+=" ${win_opts}" fi - ${BUILD_SKETCH} ${args} + ${BUILD_SKETCH} ${sargs} done fi } @@ -59,7 +60,8 @@ fi SCRIPTS_DIR="./.github/scripts" if [ "$BUILD_PIO" -eq 0 ]; then - source ${SCRIPTS_DIR}/install-arduino-ide.sh + #source ${SCRIPTS_DIR}/install-arduino-ide.sh + source ${SCRIPTS_DIR}/install-arduino-cli.sh source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh FQBN_ESP32="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app" diff --git a/.github/scripts/on-release.sh b/.github/scripts/on-release.sh index fb595b4df2c..947146ec492 100755 --- a/.github/scripts/on-release.sh +++ b/.github/scripts/on-release.sh @@ -197,10 +197,10 @@ find "$PKG_DIR" -name '*.git*' -type f -delete echo "Generating platform.txt..." cat "$GITHUB_WORKSPACE/platform.txt" | \ sed "s/version=.*/version=$ver$extent/g" | \ -sed 's/runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf//g' | \ -sed 's/runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf//g' | \ -sed 's/runtime.tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf//g' | \ -sed 's/runtime.tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf//g' | \ +sed 's/tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf/tools.xtensa-esp32-elf-gcc.path=\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \ +sed 's/tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf/tools.xtensa-esp32s2-elf-gcc.path=\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \ +sed 's/tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf/tools.xtensa-esp32s3-elf-gcc.path=\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \ +sed 's/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\{runtime.tools.riscv32-esp-elf-gcc.path\}/g' | \ sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \ sed 's/debug.server.openocd.path={runtime.platform.path}\/tools\/openocd-esp32\/bin\/openocd/debug.server.openocd.path=\{runtime.tools.openocd-esp32.path\}\/bin\/openocd/g' | \ sed 's/debug.server.openocd.scripts_dir={runtime.platform.path}\/tools\/openocd-esp32\/share\/openocd\/scripts\//debug.server.openocd.scripts_dir=\{runtime.tools.openocd-esp32.path\}\/share\/openocd\/scripts\//g' | \ diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index 3a856202e51..4a8d500bcbc 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -121,34 +121,65 @@ function build_sketch(){ # build_sketch [ex if [ -n "$ARDUINO_BUILD_DIR" ]; then build_dir="$ARDUINO_BUILD_DIR" elif [ $len -eq 1 ]; then - build_dir="$sketchdir/build" + # build_dir="$sketchdir/build" + build_dir="$HOME/.arduino/build.tmp" fi mkdir -p "$ARDUINO_CACHE_DIR" for i in `seq 0 $(($len - 1))` do if [ $len -ne 1 ]; then - build_dir="$sketchdir/build$i" + # build_dir="$sketchdir/build$i" + build_dir="$HOME/.arduino/build$i.tmp" fi rm -rf $build_dir mkdir -p $build_dir currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'` sketchname=$(basename $sketchdir) - echo "Building $sketchname with FQBN=$currfqbn" - $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \ - -fqbn=\"$currfqbn\" \ - -warnings="all" \ - -tools "$ide_path/tools-builder" \ - -tools "$ide_path/tools" \ - -built-in-libraries "$ide_path/libraries" \ - -hardware "$ide_path/hardware" \ - -hardware "$user_path/hardware" \ - -libraries "$user_path/libraries" \ - -build-cache "$ARDUINO_CACHE_DIR" \ - -build-path "$build_dir" \ - $xtra_opts "${sketchdir}/${sketchname}.ino" + + if [ -f "$ide_path/arduino-cli" ]; then + echo "Building $sketchname with arduino-cli and FQBN=$currfqbn" + + curroptions=`echo "$currfqbn" | cut -d':' -f4` + currfqbn=`echo "$currfqbn" | cut -d':' -f1-3` + $ide_path/arduino-cli compile \ + --fqbn "$currfqbn" \ + --board-options "$curroptions" \ + --warnings "all" \ + --build-cache-path "$ARDUINO_CACHE_DIR" \ + --build-path "$build_dir" \ + $xtra_opts "${sketchdir}" + elif [ -f "$ide_path/arduino-builder" ]; then + echo "Building $sketchname with arduino-builder and FQBN=$currfqbn" + + $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \ + -fqbn=\"$currfqbn\" \ + -warnings="all" \ + -tools "$ide_path/tools-builder" \ + -hardware "$user_path/hardware" \ + -libraries "$user_path/libraries" \ + -build-cache "$ARDUINO_CACHE_DIR" \ + -build-path "$build_dir" \ + $xtra_opts "${sketchdir}/${sketchname}.ino" + + # $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \ + # -fqbn=\"$currfqbn\" \ + # -warnings="all" \ + # -tools "$ide_path/tools-builder" \ + # -tools "$ide_path/tools" \ + # -built-in-libraries "$ide_path/libraries" \ + # -hardware "$ide_path/hardware" \ + # -hardware "$user_path/hardware" \ + # -libraries "$user_path/libraries" \ + # -build-cache "$ARDUINO_CACHE_DIR" \ + # -build-path "$build_dir" \ + # $xtra_opts "${sketchdir}/${sketchname}.ino" + fi done + unset fqbn + unset xtra_opts + unset options } function count_sketches(){ # count_sketches [target] @@ -294,8 +325,7 @@ function build_sketches(){ # build_sketches test/sdkconfig.defaults - idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build + # build-esp-idf-component: + # name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }} + # runs-on: ubuntu-20.04 + # strategy: + # matrix: + # # The version names here correspond to the versions of espressif/idf Docker image. + # # See https://hub.docker.com/r/espressif/idf/tags and + # # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html + # # for details. + # idf_ver: ["release-v4.4"] + # idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c3"] + # container: espressif/idf:${{ matrix.idf_ver }} + # steps: + # - name: Check out arduino-esp32 as a component + # uses: actions/checkout@v3 + # with: + # submodules: recursive + # path: components/arduino-esp32 + # - name: Build + # env: + # IDF_TARGET: ${{ matrix.idf_target }} + # shell: bash + # run: | + # . ${IDF_PATH}/export.sh + # idf.py create-project test + # echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults + # idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build diff --git a/.gitignore b/.gitignore index c9d6a46ba85..4ed76929896 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ _build/ debug.cfg debug.svd debug_custom.json +libraries/Insights/examples/*/*.ino.zip diff --git a/CMakeLists.txt b/CMakeLists.txt index 851d1488eca..b95765e1aa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ # export ARDUINO_SKIP_IDF_VERSION_CHECK=1 # idf.py build -set(min_supported_idf_version "4.4.0") -set(max_supported_idf_version "4.4.99") +set(min_supported_idf_version "5.1.0") +set(max_supported_idf_version "5.1.99") set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}") if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}") @@ -35,6 +35,7 @@ set(CORE_SRCS cores/esp32/esp32-hal-ledc.c cores/esp32/esp32-hal-matrix.c cores/esp32/esp32-hal-misc.c + cores/esp32/esp32-hal-periman.c cores/esp32/esp32-hal-psram.c cores/esp32/esp32-hal-rgb-led.c cores/esp32/esp32-hal-sigmadelta.c @@ -121,7 +122,6 @@ set(LIBRARY_SRCS libraries/WebServer/src/Parsing.cpp libraries/WebServer/src/detail/mimetable.cpp libraries/WiFiClientSecure/src/ssl_client.cpp - libraries/WiFiClientSecure/src/esp_crt_bundle.c libraries/WiFiClientSecure/src/WiFiClientSecure.cpp libraries/WiFi/src/WiFiAP.cpp libraries/WiFi/src/WiFiClient.cpp @@ -207,8 +207,8 @@ set(includedirs set(srcs ${CORE_SRCS} ${LIBRARY_SRCS} ${BLE_SRCS}) set(priv_includes cores/esp32/libb64) -set(requires spi_flash mbedtls mdns esp_adc_cal wifi_provisioning nghttp wpa_supplicant) -set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl bt esp_ipc esp_hid) +set(requires spi_flash mbedtls mdns wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser) +set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid) idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) @@ -251,6 +251,9 @@ endfunction() maybe_add_component(esp-dsp) +if(CONFIG_ESP_INSIGHTS_ENABLED) + maybe_add_component(esp_insights) +endif() if(CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK) maybe_add_component(esp_rainmaker) maybe_add_component(qrcode) diff --git a/README.md b/README.md index 00d8334c591..72496f2d170 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ You can use the [Arduino-ESP32 Online Documentation](https://docs.espressif.com/ * [Getting Started](https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html) * [Installing (Windows, Linux and macOS)](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html) * [Libraries](https://docs.espressif.com/projects/arduino-esp32/en/latest/libraries.html) -* [ESP-IDF as Component](https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html) +* [Arduino as an ESP-IDF component](https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html) * [FAQ](https://docs.espressif.com/projects/arduino-esp32/en/latest/faq.html) * [Troubleshooting](https://docs.espressif.com/projects/arduino-esp32/en/latest/troubleshooting.html) diff --git a/boards.txt b/boards.txt index c0ceb0d7f88..5464de8c06e 100644 --- a/boards.txt +++ b/boards.txt @@ -1,3 +1,4 @@ +# Official Espressif options menu.UploadSpeed=Upload Speed menu.USBMode=USB Mode menu.CDCOnBoot=USB CDC On Boot @@ -11,15 +12,19 @@ menu.FlashSize=Flash Size menu.PartitionScheme=Partition Scheme menu.DebugLevel=Core Debug Level menu.PSRAM=PSRAM -menu.Revision=Board Revision -menu.LORAWAN_REGION=LoRaWan Region -menu.LoRaWanDebugLevel=LoRaWan Debug Level menu.LoopCore=Arduino Runs On menu.EventsCore=Events Run On menu.MemoryType=Memory Type menu.EraseFlash=Erase All Flash Before Sketch Upload menu.JTAGAdapter=JTAG Adapter +# Custom options +menu.Revision=Board Revision +menu.LORAWAN_REGION=LoRaWan Region +menu.LoRaWanDebugLevel=LoRaWan Debug Level +menu.LORAWAN_DEVEUI=LoRaWan DevEUI +menu.LORAWAN_PREAMBLE_LENGTH=LoRaWan Preamble Length + ############################################################## ### DO NOT PUT BOARDS ABOVE THE OFFICIAL ESPRESSIF BOARDS! ### ############################################################## @@ -2929,6 +2934,124 @@ S_ODI_Ultra.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +lilygo_t_display_s3.name=LilyGo T-Display-S3 +lilygo_t_display_s3.vid.0=0x303a +lilygo_t_display_s3.pid.0=0x1001 + +lilygo_t_display_s3.bootloader.tool=esptool_py +lilygo_t_display_s3.bootloader.tool.default=esptool_py + +lilygo_t_display_s3.upload.tool=esptool_py +lilygo_t_display_s3.upload.tool.default=esptool_py +lilygo_t_display_s3.upload.tool.network=esp_ota + +lilygo_t_display_s3.upload.maximum_size=3145728 +lilygo_t_display_s3.upload.maximum_data_size=327680 +lilygo_t_display_s3.upload.speed=921600 +lilygo_t_display_s3.upload.flags= +lilygo_t_display_s3.upload.extra_flags= +lilygo_t_display_s3.upload.use_1200bps_touch=false +lilygo_t_display_s3.upload.wait_for_upload_port=false + +lilygo_t_display_s3.serial.disableDTR=false +lilygo_t_display_s3.serial.disableRTS=false + +lilygo_t_display_s3.build.tarch=xtensa +lilygo_t_display_s3.build.bootloader_addr=0x0 +lilygo_t_display_s3.build.target=esp32s3 +lilygo_t_display_s3.build.mcu=esp32s3 +lilygo_t_display_s3.build.core=esp32 +lilygo_t_display_s3.build.variant=lilygo_t_display_s3 +lilygo_t_display_s3.build.board=LILYGO_T_DISPLAY_S3 + +lilygo_t_display_s3.build.usb_mode=1 +lilygo_t_display_s3.build.cdc_on_boot=1 +lilygo_t_display_s3.build.msc_on_boot=0 +lilygo_t_display_s3.build.dfu_on_boot=0 +lilygo_t_display_s3.build.f_cpu=240000000L +lilygo_t_display_s3.build.flash_size=16MB +lilygo_t_display_s3.build.flash_freq=80m +lilygo_t_display_s3.build.flash_mode=dio +lilygo_t_display_s3.build.boot=qio +lilygo_t_display_s3.build.boot_freq=80m +lilygo_t_display_s3.build.partitions=app3M_fat9M_16MB +lilygo_t_display_s3.build.defines= +lilygo_t_display_s3.build.loop_core= +lilygo_t_display_s3.build.event_core= +lilygo_t_display_s3.build.psram_type=opi +lilygo_t_display_s3.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +lilygo_t_display_s3.menu.JTAGAdapter.default=Disabled +lilygo_t_display_s3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +lilygo_t_display_s3.menu.JTAGAdapter.builtin=Integrated USB JTAG +lilygo_t_display_s3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +lilygo_t_display_s3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 + +lilygo_t_display_s3.menu.LoopCore.1=Core 1 +lilygo_t_display_s3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +lilygo_t_display_s3.menu.LoopCore.0=Core 0 +lilygo_t_display_s3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +lilygo_t_display_s3.menu.EventsCore.1=Core 1 +lilygo_t_display_s3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +lilygo_t_display_s3.menu.EventsCore.0=Core 0 +lilygo_t_display_s3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +lilygo_t_display_s3.menu.USBMode.hwcdc=Hardware CDC and JTAG +lilygo_t_display_s3.menu.USBMode.hwcdc.build.usb_mode=1 +lilygo_t_display_s3.menu.USBMode.default=USB-OTG (TinyUSB) +lilygo_t_display_s3.menu.USBMode.default.build.usb_mode=0 + +lilygo_t_display_s3.menu.CDCOnBoot.cdc=Enabled +lilygo_t_display_s3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +lilygo_t_display_s3.menu.CDCOnBoot.default=Disabled +lilygo_t_display_s3.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +lilygo_t_display_s3.menu.MSCOnBoot.default=Disabled +lilygo_t_display_s3.menu.MSCOnBoot.default.build.msc_on_boot=0 +lilygo_t_display_s3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +lilygo_t_display_s3.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +lilygo_t_display_s3.menu.DFUOnBoot.default=Disabled +lilygo_t_display_s3.menu.DFUOnBoot.default.build.dfu_on_boot=0 +lilygo_t_display_s3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +lilygo_t_display_s3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +lilygo_t_display_s3.menu.UploadMode.default=UART0 / Hardware CDC +lilygo_t_display_s3.menu.UploadMode.default.upload.use_1200bps_touch=false +lilygo_t_display_s3.menu.UploadMode.default.upload.wait_for_upload_port=false +lilygo_t_display_s3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +lilygo_t_display_s3.menu.UploadMode.cdc.upload.use_1200bps_touch=true +lilygo_t_display_s3.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +lilygo_t_display_s3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +lilygo_t_display_s3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +lilygo_t_display_s3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +lilygo_t_display_s3.menu.PartitionScheme.rainmaker=RainMaker +lilygo_t_display_s3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +lilygo_t_display_s3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 + +lilygo_t_display_s3.menu.DebugLevel.none=None +lilygo_t_display_s3.menu.DebugLevel.none.build.code_debug=0 +lilygo_t_display_s3.menu.DebugLevel.error=Error +lilygo_t_display_s3.menu.DebugLevel.error.build.code_debug=1 +lilygo_t_display_s3.menu.DebugLevel.warn=Warn +lilygo_t_display_s3.menu.DebugLevel.warn.build.code_debug=2 +lilygo_t_display_s3.menu.DebugLevel.info=Info +lilygo_t_display_s3.menu.DebugLevel.info.build.code_debug=3 +lilygo_t_display_s3.menu.DebugLevel.debug=Debug +lilygo_t_display_s3.menu.DebugLevel.debug.build.code_debug=4 +lilygo_t_display_s3.menu.DebugLevel.verbose=Verbose +lilygo_t_display_s3.menu.DebugLevel.verbose.build.code_debug=5 + +lilygo_t_display_s3.menu.EraseFlash.none=Disabled +lilygo_t_display_s3.menu.EraseFlash.none.upload.erase_cmd= +lilygo_t_display_s3.menu.EraseFlash.all=Enabled +lilygo_t_display_s3.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + micros2.name=microS2 micros2.vid.0=0x239A micros2.pid.0=0x80C5 @@ -8256,6 +8379,177 @@ adafruit_feather_esp32s2_tft.menu.EraseFlash.none.upload.erase_cmd= adafruit_feather_esp32s2_tft.menu.EraseFlash.all=Enabled adafruit_feather_esp32s2_tft.menu.EraseFlash.all.upload.erase_cmd=-e +############################################################## +# Adafruit Feather ESP32-S2 Reverse TFT + +adafruit_feather_esp32s2_reversetft.name=Adafruit Feather ESP32-S2 Reverse TFT +adafruit_feather_esp32s2_reversetft.vid.0=0x239A +adafruit_feather_esp32s2_reversetft.pid.0=0x80ED +adafruit_feather_esp32s2_reversetft.vid.1=0x239A +adafruit_feather_esp32s2_reversetft.pid.1=0x00ED +adafruit_feather_esp32s2_reversetft.vid.2=0x239A +adafruit_feather_esp32s2_reversetft.pid.2=0x80EE + +adafruit_feather_esp32s2_reversetft.bootloader.tool=esptool_py +adafruit_feather_esp32s2_reversetft.bootloader.tool.default=esptool_py + +adafruit_feather_esp32s2_reversetft.upload.tool=esptool_py +adafruit_feather_esp32s2_reversetft.upload.tool.default=esptool_py +adafruit_feather_esp32s2_reversetft.upload.tool.network=esp_ota + +adafruit_feather_esp32s2_reversetft.upload.maximum_size=1310720 +adafruit_feather_esp32s2_reversetft.upload.maximum_data_size=327680 +adafruit_feather_esp32s2_reversetft.upload.flags= +adafruit_feather_esp32s2_reversetft.upload.extra_flags= +adafruit_feather_esp32s2_reversetft.upload.use_1200bps_touch=true +adafruit_feather_esp32s2_reversetft.upload.wait_for_upload_port=true + +adafruit_feather_esp32s2_reversetft.serial.disableDTR=false +adafruit_feather_esp32s2_reversetft.serial.disableRTS=false + +adafruit_feather_esp32s2_reversetft.build.tarch=xtensa +adafruit_feather_esp32s2_reversetft.build.bootloader_addr=0x1000 +adafruit_feather_esp32s2_reversetft.build.target=esp32s2 +adafruit_feather_esp32s2_reversetft.build.mcu=esp32s2 +adafruit_feather_esp32s2_reversetft.build.core=esp32 +adafruit_feather_esp32s2_reversetft.build.variant=adafruit_feather_esp32s2_reversetft +adafruit_feather_esp32s2_reversetft.build.board=ADAFRUIT_FEATHER_ESP32S2_REVTFT + +adafruit_feather_esp32s2_reversetft.build.cdc_on_boot=1 +adafruit_feather_esp32s2_reversetft.build.msc_on_boot=0 +adafruit_feather_esp32s2_reversetft.build.dfu_on_boot=0 +adafruit_feather_esp32s2_reversetft.build.f_cpu=240000000L +adafruit_feather_esp32s2_reversetft.build.flash_size=4MB +adafruit_feather_esp32s2_reversetft.build.flash_freq=80m +adafruit_feather_esp32s2_reversetft.build.flash_mode=dio +adafruit_feather_esp32s2_reversetft.build.boot=qio +adafruit_feather_esp32s2_reversetft.build.partitions=default +adafruit_feather_esp32s2_reversetft.build.defines= + +adafruit_feather_esp32s2_reversetft.menu.CDCOnBoot.cdc=Enabled +adafruit_feather_esp32s2_reversetft.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +adafruit_feather_esp32s2_reversetft.menu.CDCOnBoot.default=Disabled +adafruit_feather_esp32s2_reversetft.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +adafruit_feather_esp32s2_reversetft.menu.MSCOnBoot.default=Disabled +adafruit_feather_esp32s2_reversetft.menu.MSCOnBoot.default.build.msc_on_boot=0 +adafruit_feather_esp32s2_reversetft.menu.MSCOnBoot.msc=Enabled +adafruit_feather_esp32s2_reversetft.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +adafruit_feather_esp32s2_reversetft.menu.DFUOnBoot.default=Disabled +adafruit_feather_esp32s2_reversetft.menu.DFUOnBoot.default.build.dfu_on_boot=0 +adafruit_feather_esp32s2_reversetft.menu.DFUOnBoot.dfu=Enabled +adafruit_feather_esp32s2_reversetft.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +adafruit_feather_esp32s2_reversetft.menu.UploadMode.cdc=Internal USB +adafruit_feather_esp32s2_reversetft.menu.UploadMode.cdc.upload.use_1200bps_touch=true +adafruit_feather_esp32s2_reversetft.menu.UploadMode.cdc.upload.wait_for_upload_port=true +adafruit_feather_esp32s2_reversetft.menu.UploadMode.default=UART0 +adafruit_feather_esp32s2_reversetft.menu.UploadMode.default.upload.use_1200bps_touch=false +adafruit_feather_esp32s2_reversetft.menu.UploadMode.default.upload.wait_for_upload_port=false + +adafruit_feather_esp32s2_reversetft.menu.PSRAM.enabled=Enabled +adafruit_feather_esp32s2_reversetft.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +adafruit_feather_esp32s2_reversetft.menu.PSRAM.disabled=Disabled +adafruit_feather_esp32s2_reversetft.menu.PSRAM.disabled.build.defines= + +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.tinyuf2=TinyUF2 4MB (1.3MB APP/960KB FFAT) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.tinyuf2.build.custom_bootloader=bootloader-tinyuf2 +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.tinyuf2.build.custom_partitions=partitions-4MB-tinyuf2 +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.tinyuf2.upload.maximum_size=1441792 +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.tinyuf2.upload.extra_flags=0x2d0000 "{runtime.platform.path}/variants/{build.variant}/tinyuf2.bin" +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.default.build.partitions=default +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.minimal.build.partitions=minimal +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.no_ota.build.partitions=no_ota +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.huge_app.build.partitions=huge_app +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +adafruit_feather_esp32s2_reversetft.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.240=240MHz (WiFi) +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.240.build.f_cpu=240000000L +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.160=160MHz (WiFi) +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.160.build.f_cpu=160000000L +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.80=80MHz (WiFi) +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.80.build.f_cpu=80000000L +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.40=40MHz +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.40.build.f_cpu=40000000L +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.20=20MHz +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.20.build.f_cpu=20000000L +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.10=10MHz +adafruit_feather_esp32s2_reversetft.menu.CPUFreq.10.build.f_cpu=10000000L + +adafruit_feather_esp32s2_reversetft.menu.FlashMode.qio=QIO +adafruit_feather_esp32s2_reversetft.menu.FlashMode.qio.build.flash_mode=dio +adafruit_feather_esp32s2_reversetft.menu.FlashMode.qio.build.boot=qio +adafruit_feather_esp32s2_reversetft.menu.FlashMode.dio=DIO +adafruit_feather_esp32s2_reversetft.menu.FlashMode.dio.build.flash_mode=dio +adafruit_feather_esp32s2_reversetft.menu.FlashMode.dio.build.boot=dio +adafruit_feather_esp32s2_reversetft.menu.FlashMode.qout=QOUT +adafruit_feather_esp32s2_reversetft.menu.FlashMode.qout.build.flash_mode=dout +adafruit_feather_esp32s2_reversetft.menu.FlashMode.qout.build.boot=qout +adafruit_feather_esp32s2_reversetft.menu.FlashMode.dout=DOUT +adafruit_feather_esp32s2_reversetft.menu.FlashMode.dout.build.flash_mode=dout +adafruit_feather_esp32s2_reversetft.menu.FlashMode.dout.build.boot=dout + +adafruit_feather_esp32s2_reversetft.menu.FlashFreq.80=80MHz +adafruit_feather_esp32s2_reversetft.menu.FlashFreq.80.build.flash_freq=80m +adafruit_feather_esp32s2_reversetft.menu.FlashFreq.40=40MHz +adafruit_feather_esp32s2_reversetft.menu.FlashFreq.40.build.flash_freq=40m + +adafruit_feather_esp32s2_reversetft.menu.FlashSize.4M=4MB (32Mb) +adafruit_feather_esp32s2_reversetft.menu.FlashSize.4M.build.flash_size=4MB + +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.921600=921600 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.921600.upload.speed=921600 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.115200=115200 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.115200.upload.speed=115200 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.256000.windows=256000 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.256000.upload.speed=256000 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.230400.windows.upload.speed=256000 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.230400=230400 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.230400.upload.speed=230400 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.460800.linux=460800 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.460800.macosx=460800 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.460800.upload.speed=460800 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.512000.windows=512000 +adafruit_feather_esp32s2_reversetft.menu.UploadSpeed.512000.upload.speed=512000 + +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.none=None +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.none.build.code_debug=0 +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.error=Error +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.error.build.code_debug=1 +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.warn=Warn +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.warn.build.code_debug=2 +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.info=Info +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.info.build.code_debug=3 +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.debug=Debug +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.debug.build.code_debug=4 +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.verbose=Verbose +adafruit_feather_esp32s2_reversetft.menu.DebugLevel.verbose.build.code_debug=5 + +adafruit_feather_esp32s2_reversetft.menu.EraseFlash.none=Disabled +adafruit_feather_esp32s2_reversetft.menu.EraseFlash.none.upload.erase_cmd= +adafruit_feather_esp32s2_reversetft.menu.EraseFlash.all=Enabled +adafruit_feather_esp32s2_reversetft.menu.EraseFlash.all.upload.erase_cmd=-e + ############################################################## # Adafruit QT Py ESP32-S2 @@ -9354,6 +9648,206 @@ adafruit_feather_esp32s3_tft.menu.EraseFlash.none.upload.erase_cmd= adafruit_feather_esp32s3_tft.menu.EraseFlash.all=Enabled adafruit_feather_esp32s3_tft.menu.EraseFlash.all.upload.erase_cmd=-e +############################################################## +# Adafruit Feather ESP32-S3 Reverse TFT + +adafruit_feather_esp32s3_reversetft.name=Adafruit Feather ESP32-S3 Reverse TFT +adafruit_feather_esp32s3_reversetft.vid.0=0x239A +adafruit_feather_esp32s3_reversetft.pid.0=0x8123 +adafruit_feather_esp32s3_reversetft.vid.1=0x239A +adafruit_feather_esp32s3_reversetft.pid.1=0x0123 +adafruit_feather_esp32s3_reversetft.vid.2=0x239A +adafruit_feather_esp32s3_reversetft.pid.2=0x8124 + +adafruit_feather_esp32s3_reversetft.bootloader.tool=esptool_py +adafruit_feather_esp32s3_reversetft.bootloader.tool.default=esptool_py + +adafruit_feather_esp32s3_reversetft.upload.tool=esptool_py +adafruit_feather_esp32s3_reversetft.upload.tool.default=esptool_py +adafruit_feather_esp32s3_reversetft.upload.tool.network=esp_ota + +adafruit_feather_esp32s3_reversetft.upload.maximum_size=1310720 +adafruit_feather_esp32s3_reversetft.upload.maximum_data_size=327680 +adafruit_feather_esp32s3_reversetft.upload.flags= +adafruit_feather_esp32s3_reversetft.upload.extra_flags= +adafruit_feather_esp32s3_reversetft.upload.use_1200bps_touch=true +adafruit_feather_esp32s3_reversetft.upload.wait_for_upload_port=true + +adafruit_feather_esp32s3_reversetft.serial.disableDTR=false +adafruit_feather_esp32s3_reversetft.serial.disableRTS=false + +adafruit_feather_esp32s3_reversetft.build.tarch=xtensa +adafruit_feather_esp32s3_reversetft.build.bootloader_addr=0x0 +adafruit_feather_esp32s3_reversetft.build.target=esp32s3 +adafruit_feather_esp32s3_reversetft.build.mcu=esp32s3 +adafruit_feather_esp32s3_reversetft.build.core=esp32 +adafruit_feather_esp32s3_reversetft.build.variant=adafruit_feather_esp32s3_reversetft +adafruit_feather_esp32s3_reversetft.build.board=ADAFRUIT_FEATHER_ESP32S3_REVTFT + +adafruit_feather_esp32s3_reversetft.build.usb_mode=0 +adafruit_feather_esp32s3_reversetft.build.cdc_on_boot=1 +adafruit_feather_esp32s3_reversetft.build.msc_on_boot=0 +adafruit_feather_esp32s3_reversetft.build.dfu_on_boot=0 +adafruit_feather_esp32s3_reversetft.build.f_cpu=240000000L +adafruit_feather_esp32s3_reversetft.build.flash_size=4MB +adafruit_feather_esp32s3_reversetft.build.flash_freq=80m +adafruit_feather_esp32s3_reversetft.build.flash_mode=dio +adafruit_feather_esp32s3_reversetft.build.boot=qio +adafruit_feather_esp32s3_reversetft.build.partitions=default +adafruit_feather_esp32s3_reversetft.build.defines= +adafruit_feather_esp32s3_reversetft.build.loop_core= +adafruit_feather_esp32s3_reversetft.build.event_core= +adafruit_feather_esp32s3_reversetft.build.flash_type=qio +adafruit_feather_esp32s3_reversetft.build.psram_type=qspi +adafruit_feather_esp32s3_reversetft.build.memory_type={build.flash_type}_{build.psram_type} + +adafruit_feather_esp32s3_reversetft.menu.LoopCore.1=Core 1 +adafruit_feather_esp32s3_reversetft.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +adafruit_feather_esp32s3_reversetft.menu.LoopCore.0=Core 0 +adafruit_feather_esp32s3_reversetft.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +adafruit_feather_esp32s3_reversetft.menu.EventsCore.1=Core 1 +adafruit_feather_esp32s3_reversetft.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +adafruit_feather_esp32s3_reversetft.menu.EventsCore.0=Core 0 +adafruit_feather_esp32s3_reversetft.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +adafruit_feather_esp32s3_reversetft.menu.USBMode.default=USB-OTG (TinyUSB) +adafruit_feather_esp32s3_reversetft.menu.USBMode.default.build.usb_mode=0 +adafruit_feather_esp32s3_reversetft.menu.USBMode.hwcdc=Hardware CDC and JTAG +adafruit_feather_esp32s3_reversetft.menu.USBMode.hwcdc.build.usb_mode=1 + +adafruit_feather_esp32s3_reversetft.menu.CDCOnBoot.cdc=Enabled +adafruit_feather_esp32s3_reversetft.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +adafruit_feather_esp32s3_reversetft.menu.CDCOnBoot.default=Disabled +adafruit_feather_esp32s3_reversetft.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +adafruit_feather_esp32s3_reversetft.menu.MSCOnBoot.default=Disabled +adafruit_feather_esp32s3_reversetft.menu.MSCOnBoot.default.build.msc_on_boot=0 +adafruit_feather_esp32s3_reversetft.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +adafruit_feather_esp32s3_reversetft.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +adafruit_feather_esp32s3_reversetft.menu.DFUOnBoot.default=Disabled +adafruit_feather_esp32s3_reversetft.menu.DFUOnBoot.default.build.dfu_on_boot=0 +adafruit_feather_esp32s3_reversetft.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +adafruit_feather_esp32s3_reversetft.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +adafruit_feather_esp32s3_reversetft.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +adafruit_feather_esp32s3_reversetft.menu.UploadMode.cdc.upload.use_1200bps_touch=true +adafruit_feather_esp32s3_reversetft.menu.UploadMode.cdc.upload.wait_for_upload_port=true +adafruit_feather_esp32s3_reversetft.menu.UploadMode.default=UART0 / Hardware CDC +adafruit_feather_esp32s3_reversetft.menu.UploadMode.default.upload.use_1200bps_touch=false +adafruit_feather_esp32s3_reversetft.menu.UploadMode.default.upload.wait_for_upload_port=false + +adafruit_feather_esp32s3_reversetft.menu.PSRAM.enabled=QSPI PSRAM +adafruit_feather_esp32s3_reversetft.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +adafruit_feather_esp32s3_reversetft.menu.PSRAM.enabled.build.psram_type=qspi +adafruit_feather_esp32s3_reversetft.menu.PSRAM.disabled=Disabled +adafruit_feather_esp32s3_reversetft.menu.PSRAM.disabled.build.defines= +adafruit_feather_esp32s3_reversetft.menu.PSRAM.disabled.build.psram_type=qspi +adafruit_feather_esp32s3_reversetft.menu.PSRAM.opi=OPI PSRAM +adafruit_feather_esp32s3_reversetft.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +adafruit_feather_esp32s3_reversetft.menu.PSRAM.opi.build.psram_type=opi + +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.tinyuf2=TinyUF2 4MB (1.3MB APP/960KB FFAT) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.tinyuf2.build.custom_bootloader=bootloader-tinyuf2 +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.tinyuf2.build.custom_partitions=partitions-4MB-tinyuf2 +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.tinyuf2.upload.maximum_size=1441792 +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.tinyuf2.upload.extra_flags=0x2d0000 "{runtime.platform.path}/variants/{build.variant}/tinyuf2.bin" +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.default.build.partitions=default +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.minimal.build.partitions=minimal +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.no_ota.build.partitions=no_ota +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.huge_app.build.partitions=huge_app +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +adafruit_feather_esp32s3_reversetft.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.240=240MHz (WiFi) +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.240.build.f_cpu=240000000L +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.160=160MHz (WiFi) +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.160.build.f_cpu=160000000L +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.80=80MHz (WiFi) +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.80.build.f_cpu=80000000L +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.40=40MHz +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.40.build.f_cpu=40000000L +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.20=20MHz +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.20.build.f_cpu=20000000L +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.10=10MHz +adafruit_feather_esp32s3_reversetft.menu.CPUFreq.10.build.f_cpu=10000000L + +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio=QIO 80MHz +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio.build.flash_mode=dio +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio.build.boot=qio +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio.build.boot_freq=80m +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio.build.flash_freq=80m +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio120=QIO 120MHz +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio120.build.flash_mode=dio +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio120.build.boot=qio +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio120.build.boot_freq=120m +adafruit_feather_esp32s3_reversetft.menu.FlashMode.qio120.build.flash_freq=80m +adafruit_feather_esp32s3_reversetft.menu.FlashMode.dio=DIO 80MHz +adafruit_feather_esp32s3_reversetft.menu.FlashMode.dio.build.flash_mode=dio +adafruit_feather_esp32s3_reversetft.menu.FlashMode.dio.build.boot=dio +adafruit_feather_esp32s3_reversetft.menu.FlashMode.dio.build.boot_freq=80m +adafruit_feather_esp32s3_reversetft.menu.FlashMode.dio.build.flash_freq=80m +adafruit_feather_esp32s3_reversetft.menu.FlashMode.opi=OPI 80MHz +adafruit_feather_esp32s3_reversetft.menu.FlashMode.opi.build.flash_mode=dout +adafruit_feather_esp32s3_reversetft.menu.FlashMode.opi.build.boot=opi +adafruit_feather_esp32s3_reversetft.menu.FlashMode.opi.build.boot_freq=80m +adafruit_feather_esp32s3_reversetft.menu.FlashMode.opi.build.flash_freq=80m + +adafruit_feather_esp32s3_reversetft.menu.FlashSize.4M=4MB (32Mb) +adafruit_feather_esp32s3_reversetft.menu.FlashSize.4M.build.flash_size=4MB + +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.921600=921600 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.921600.upload.speed=921600 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.115200=115200 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.115200.upload.speed=115200 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.256000.windows=256000 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.256000.upload.speed=256000 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.230400.windows.upload.speed=256000 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.230400=230400 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.230400.upload.speed=230400 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.460800.linux=460800 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.460800.macosx=460800 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.460800.upload.speed=460800 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.512000.windows=512000 +adafruit_feather_esp32s3_reversetft.menu.UploadSpeed.512000.upload.speed=512000 + +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.none=None +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.none.build.code_debug=0 +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.error=Error +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.error.build.code_debug=1 +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.warn=Warn +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.warn.build.code_debug=2 +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.info=Info +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.info.build.code_debug=3 +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.debug=Debug +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.debug.build.code_debug=4 +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.verbose=Verbose +adafruit_feather_esp32s3_reversetft.menu.DebugLevel.verbose.build.code_debug=5 + +adafruit_feather_esp32s3_reversetft.menu.EraseFlash.none=Disabled +adafruit_feather_esp32s3_reversetft.menu.EraseFlash.none.upload.erase_cmd= +adafruit_feather_esp32s3_reversetft.menu.EraseFlash.all=Enabled +adafruit_feather_esp32s3_reversetft.menu.EraseFlash.all.upload.erase_cmd=-e + ############################################################## # Adafruit QT Py ESP32-S3 No PSRAM @@ -12008,8 +12502,8 @@ heltec_wifi_lora_32_V3.build.bootloader_addr=0x0 heltec_wifi_lora_32_V3.build.target=esp32s3 heltec_wifi_lora_32_V3.build.mcu=esp32s3 heltec_wifi_lora_32_V3.build.core=esp32 -heltec_wifi_lora_32_V3.build.variant=heltec_heltec_wifi_lora_32_V3 -heltec_wifi_lora_32_V3.build.board=heltec_heltec_wifi_32_lora_V3 +heltec_wifi_lora_32_V3.build.variant=heltec_wifi_lora_32_V3 +heltec_wifi_lora_32_V3.build.board=heltec_wifi_32_lora_V3 heltec_wifi_lora_32_V3.build.usb_mode=1 heltec_wifi_lora_32_V3.build.cdc_on_boot=0 @@ -12119,7 +12613,6 @@ heltec_wifi_lora_32_V3.menu.LORAWAN_PREAMBLE_LENGTH.1=16(For M00 and M00L) heltec_wifi_lora_32_V3.menu.LORAWAN_PREAMBLE_LENGTH.1.build.LORAWAN_PREAMBLE_LENGTH=16 heltec_wifi_lora_32_V3.build.defines=-D{build.band} -DLoRaWAN_DEBUG_LEVEL={build.LoRaWanDebugLevel} -DACTIVE_REGION=LORAMAC_{build.band} -DLORAWAN_PREAMBLE_LENGTH={build.LORAWAN_PREAMBLE_LENGTH} -DLORAWAN_DEVEUI_AUTO={build.LORAWAN_DEVEUI_AUTO} -D{build.board} -heltec_wifi_lora_32_V3.build.extra_libs=-lheltec heltec_wifi_lora_32_V3.menu.EraseFlash.none=Disabled heltec_wifi_lora_32_V3.menu.EraseFlash.none.upload.erase_cmd= @@ -20649,3 +21142,797 @@ esp32c3m1IKit.menu.EraseFlash.all=Enabled esp32c3m1IKit.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## + +roboheart_hercules.name=RoboHeart Hercules + +roboheart_hercules.upload.tool=esptool_py +roboheart_hercules.upload.maximum_size=1310720 +roboheart_hercules.upload.maximum_data_size=327680 +roboheart_hercules.upload.wait_for_upload_port=true +roboheart_hercules.upload.flags= +roboheart_hercules.upload.extra_flags= + +roboheart_hercules.serial.disableDTR=true +roboheart_hercules.serial.disableRTS=true + +roboheart_hercules.build.tarch=xtensa +roboheart_hercules.build.bootloader_addr=0x1000 +roboheart_hercules.build.target=esp32 +roboheart_hercules.build.mcu=esp32 +roboheart_hercules.build.core=esp32 +roboheart_hercules.build.variant=roboheart_hercules +roboheart_hercules.build.board=roboheart_hercules + +roboheart_hercules.build.f_cpu=240000000L +roboheart_hercules.build.flash_size=4MB +roboheart_hercules.build.flash_freq=40m +roboheart_hercules.build.flash_mode=dio +roboheart_hercules.build.boot=dio +roboheart_hercules.build.partitions=default +roboheart_hercules.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +roboheart_hercules.build.extra_libs= + +roboheart_hercules.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +roboheart_hercules.menu.PartitionScheme.default.build.partitions=default +roboheart_hercules.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +roboheart_hercules.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +roboheart_hercules.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT) +roboheart_hercules.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +roboheart_hercules.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +roboheart_hercules.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +roboheart_hercules.menu.PartitionScheme.minimal.build.partitions=minimal +roboheart_hercules.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +roboheart_hercules.menu.PartitionScheme.no_ota.build.partitions=no_ota +roboheart_hercules.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +roboheart_hercules.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +roboheart_hercules.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +roboheart_hercules.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +roboheart_hercules.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +roboheart_hercules.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +roboheart_hercules.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +roboheart_hercules.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +roboheart_hercules.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +roboheart_hercules.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +roboheart_hercules.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +roboheart_hercules.menu.PartitionScheme.huge_app.build.partitions=huge_app +roboheart_hercules.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +roboheart_hercules.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +roboheart_hercules.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +roboheart_hercules.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +roboheart_hercules.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT) +roboheart_hercules.menu.PartitionScheme.fatflash.build.partitions=ffat +roboheart_hercules.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +roboheart_hercules.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS) +roboheart_hercules.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +roboheart_hercules.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +roboheart_hercules.menu.PartitionScheme.rainmaker=RainMaker +roboheart_hercules.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +roboheart_hercules.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 + +roboheart_hercules.menu.CPUFreq.240=240MHz (WiFi/BT) +roboheart_hercules.menu.CPUFreq.240.build.f_cpu=240000000L +roboheart_hercules.menu.CPUFreq.160=160MHz (WiFi/BT) +roboheart_hercules.menu.CPUFreq.160.build.f_cpu=160000000L +roboheart_hercules.menu.CPUFreq.80=80MHz (WiFi/BT) +roboheart_hercules.menu.CPUFreq.80.build.f_cpu=80000000L +roboheart_hercules.menu.CPUFreq.40=40MHz +roboheart_hercules.menu.CPUFreq.40.build.f_cpu=40000000L +roboheart_hercules.menu.CPUFreq.20=20MHz +roboheart_hercules.menu.CPUFreq.20.build.f_cpu=20000000L +roboheart_hercules.menu.CPUFreq.10=10MHz +roboheart_hercules.menu.CPUFreq.10.build.f_cpu=10000000L + +roboheart_hercules.menu.FlashMode.qio=QIO +roboheart_hercules.menu.FlashMode.qio.build.flash_mode=dio +roboheart_hercules.menu.FlashMode.qio.build.boot=qio +roboheart_hercules.menu.FlashMode.dio=DIO +roboheart_hercules.menu.FlashMode.dio.build.flash_mode=dio +roboheart_hercules.menu.FlashMode.dio.build.boot=dio +roboheart_hercules.menu.FlashMode.qout=QOUT +roboheart_hercules.menu.FlashMode.qout.build.flash_mode=dout +roboheart_hercules.menu.FlashMode.qout.build.boot=qout +roboheart_hercules.menu.FlashMode.dout=DOUT +roboheart_hercules.menu.FlashMode.dout.build.flash_mode=dout +roboheart_hercules.menu.FlashMode.dout.build.boot=dout + +roboheart_hercules.menu.FlashFreq.80=80MHz +roboheart_hercules.menu.FlashFreq.80.build.flash_freq=80m +roboheart_hercules.menu.FlashFreq.40=40MHz +roboheart_hercules.menu.FlashFreq.40.build.flash_freq=40m + +roboheart_hercules.menu.UploadSpeed.921600=921600 +roboheart_hercules.menu.UploadSpeed.921600.upload.speed=921600 +roboheart_hercules.menu.UploadSpeed.115200=115200 +roboheart_hercules.menu.UploadSpeed.115200.upload.speed=115200 +roboheart_hercules.menu.UploadSpeed.256000.windows=256000 +roboheart_hercules.menu.UploadSpeed.256000.upload.speed=256000 +roboheart_hercules.menu.UploadSpeed.230400.windows.upload.speed=256000 +roboheart_hercules.menu.UploadSpeed.230400=230400 +roboheart_hercules.menu.UploadSpeed.230400.upload.speed=230400 +roboheart_hercules.menu.UploadSpeed.460800.linux=460800 +roboheart_hercules.menu.UploadSpeed.460800.macosx=460800 +roboheart_hercules.menu.UploadSpeed.460800.upload.speed=460800 +roboheart_hercules.menu.UploadSpeed.512000.windows=512000 +roboheart_hercules.menu.UploadSpeed.512000.upload.speed=512000 + +roboheart_hercules.menu.DebugLevel.none=None +roboheart_hercules.menu.DebugLevel.none.build.code_debug=0 +roboheart_hercules.menu.DebugLevel.error=Error +roboheart_hercules.menu.DebugLevel.error.build.code_debug=1 +roboheart_hercules.menu.DebugLevel.warn=Warn +roboheart_hercules.menu.DebugLevel.warn.build.code_debug=2 +roboheart_hercules.menu.DebugLevel.info=Info +roboheart_hercules.menu.DebugLevel.info.build.code_debug=3 +roboheart_hercules.menu.DebugLevel.debug=Debug +roboheart_hercules.menu.DebugLevel.debug.build.code_debug=4 +roboheart_hercules.menu.DebugLevel.verbose=Verbose +roboheart_hercules.menu.DebugLevel.verbose.build.code_debug=5 + +roboheart_hercules.menu.EraseFlash.none=Disabled +roboheart_hercules.menu.EraseFlash.none.upload.erase_cmd= +roboheart_hercules.menu.EraseFlash.all=Enabled +roboheart_hercules.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## +VALTRACK_V4_VTS_ESP32_C3.name=VALTRACK_V4_VTS_ESP32_C3 +VALTRACK_V4_VTS_ESP32_C3.vid.0=0x303a +VALTRACK_V4_VTS_ESP32_C3.pid.0=0x1001 + +VALTRACK_V4_VTS_ESP32_C3.bootloader.tool=esptool_py +VALTRACK_V4_VTS_ESP32_C3.bootloader.tool.default=esptool_py + +VALTRACK_V4_VTS_ESP32_C3.upload.tool=esptool_py +VALTRACK_V4_VTS_ESP32_C3.upload.tool.default=esptool_py +VALTRACK_V4_VTS_ESP32_C3.upload.tool.network=esp_ota + +VALTRACK_V4_VTS_ESP32_C3.upload.maximum_size=1310720 +VALTRACK_V4_VTS_ESP32_C3.upload.maximum_data_size=327680 +VALTRACK_V4_VTS_ESP32_C3.upload.flags= +VALTRACK_V4_VTS_ESP32_C3.upload.extra_flags= +VALTRACK_V4_VTS_ESP32_C3.upload.use_1200bps_touch=false +VALTRACK_V4_VTS_ESP32_C3.upload.wait_for_upload_port=false + +VALTRACK_V4_VTS_ESP32_C3.serial.disableDTR=false +VALTRACK_V4_VTS_ESP32_C3.serial.disableRTS=false + +VALTRACK_V4_VTS_ESP32_C3.build.tarch=riscv32 +VALTRACK_V4_VTS_ESP32_C3.build.target=esp +VALTRACK_V4_VTS_ESP32_C3.build.mcu=esp32c3 +VALTRACK_V4_VTS_ESP32_C3.build.core=esp32 +VALTRACK_V4_VTS_ESP32_C3.build.variant=VALTRACK_V4_VTS_ESP32_C3 +VALTRACK_V4_VTS_ESP32_C3.build.board=VALTRACK_V4_VTS_ESP32_C3 +VALTRACK_V4_VTS_ESP32_C3.build.bootloader_addr=0x0 + +VALTRACK_V4_VTS_ESP32_C3.build.cdc_on_boot=1 +VALTRACK_V4_VTS_ESP32_C3.build.f_cpu=160000000L +VALTRACK_V4_VTS_ESP32_C3.build.flash_size=4MB +VALTRACK_V4_VTS_ESP32_C3.build.flash_freq=80m +VALTRACK_V4_VTS_ESP32_C3.build.flash_mode=qio +VALTRACK_V4_VTS_ESP32_C3.build.boot=qio +VALTRACK_V4_VTS_ESP32_C3.build.partitions=default +VALTRACK_V4_VTS_ESP32_C3.build.defines= + +VALTRACK_V4_VTS_ESP32_C3.menu.CDCOnBoot.default=Enabled +VALTRACK_V4_VTS_ESP32_C3.menu.CDCOnBoot.default.build.cdc_on_boot=1 +VALTRACK_V4_VTS_ESP32_C3.menu.CDCOnBoot.cdc=Disabled +VALTRACK_V4_VTS_ESP32_C3.menu.CDCOnBoot.cdc.build.cdc_on_boot=0 + +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.default.build.partitions=default +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.minimal.build.partitions=minimal +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.no_ota.build.partitions=no_ota +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.huge_app.build.partitions=huge_app +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.fatflash.build.partitions=ffat +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.rainmaker=RainMaker +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +VALTRACK_V4_VTS_ESP32_C3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 + +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.160=160MHz (WiFi) +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.160.build.f_cpu=160000000L +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.80=80MHz (WiFi) +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.80.build.f_cpu=80000000L +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.40=40MHz +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.40.build.f_cpu=40000000L +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.20=20MHz +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.20.build.f_cpu=20000000L +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.10=10MHz +VALTRACK_V4_VTS_ESP32_C3.menu.CPUFreq.10.build.f_cpu=10000000L + +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.qio=QIO +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.qio.build.flash_mode=dio +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.qio.build.boot=qio +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.dio=DIO +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.dio.build.flash_mode=dio +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.dio.build.boot=dio +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.qout=QOUT +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.qout.build.flash_mode=dout +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.qout.build.boot=qout +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.dout=DOUT +VALTRACK_V4_VTS_ESP32_C3.menu.FlashMode.dout.build.flash_mode=dout + +VALTRACK_V4_VTS_ESP32_C3.menu.FlashFreq.80=80MHz +VALTRACK_V4_VTS_ESP32_C3.menu.FlashFreq.80.build.flash_freq=80m +VALTRACK_V4_VTS_ESP32_C3.menu.FlashFreq.40=40MHz +VALTRACK_V4_VTS_ESP32_C3.menu.FlashFreq.40.build.flash_freq=40m + +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.4M=4MB (32Mb) +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.4M.build.flash_size=4MB +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.8M=8MB (64Mb) +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.8M.build.flash_size=8MB +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.8M.build.partitions=default_8MB +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.2M=2MB (16Mb) +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.2M.build.flash_size=2MB +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.2M.build.partitions=minimal +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.16M=16MB (128Mb) +VALTRACK_V4_VTS_ESP32_C3.menu.FlashSize.16M.build.flash_size=16MB + +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.921600=921600 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.921600.upload.speed=921600 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.115200=115200 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.115200.upload.speed=115200 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.256000.windows=256000 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.256000.upload.speed=256000 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.230400.windows.upload.speed=256000 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.230400=230400 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.230400.upload.speed=230400 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.460800.linux=460800 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.460800.macosx=460800 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.460800.upload.speed=460800 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.512000.windows=512000 +VALTRACK_V4_VTS_ESP32_C3.menu.UploadSpeed.512000.upload.speed=512000 + +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.none=None +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.none.build.code_debug=0 +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.error=Error +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.error.build.code_debug=1 +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.warn=Warn +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.warn.build.code_debug=2 +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.info=Info +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.info.build.code_debug=3 +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.debug=Debug +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.debug.build.code_debug=4 +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.verbose=Verbose +VALTRACK_V4_VTS_ESP32_C3.menu.DebugLevel.verbose.build.code_debug=5 + +VALTRACK_V4_VTS_ESP32_C3.menu.EraseFlash.none=Disabled +VALTRACK_V4_VTS_ESP32_C3.menu.EraseFlash.none.upload.erase_cmd= +VALTRACK_V4_VTS_ESP32_C3.menu.EraseFlash.all=Enabled +VALTRACK_V4_VTS_ESP32_C3.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +VALTRACK_V4_MFW_ESP32_C3.name=VALTRACK_V4_MFW_ESP32_C3 +VALTRACK_V4_MFW_ESP32_C3.vid.0=0x303a +VALTRACK_V4_MFW_ESP32_C3.pid.0=0x1001 + +VALTRACK_V4_MFW_ESP32_C3.bootloader.tool=esptool_py +VALTRACK_V4_MFW_ESP32_C3.bootloader.tool.default=esptool_py + +VALTRACK_V4_MFW_ESP32_C3.upload.tool=esptool_py +VALTRACK_V4_MFW_ESP32_C3.upload.tool.default=esptool_py +VALTRACK_V4_MFW_ESP32_C3.upload.tool.network=esp_ota + +VALTRACK_V4_MFW_ESP32_C3.upload.maximum_size=1310720 +VALTRACK_V4_MFW_ESP32_C3.upload.maximum_data_size=327680 +VALTRACK_V4_MFW_ESP32_C3.upload.flags= +VALTRACK_V4_MFW_ESP32_C3.upload.extra_flags= +VALTRACK_V4_MFW_ESP32_C3.upload.use_1200bps_touch=false +VALTRACK_V4_MFW_ESP32_C3.upload.wait_for_upload_port=false + +VALTRACK_V4_MFW_ESP32_C3.serial.disableDTR=false +VALTRACK_V4_MFW_ESP32_C3.serial.disableRTS=false + +VALTRACK_V4_MFW_ESP32_C3.build.tarch=riscv32 +VALTRACK_V4_MFW_ESP32_C3.build.target=esp +VALTRACK_V4_MFW_ESP32_C3.build.mcu=esp32c3 +VALTRACK_V4_MFW_ESP32_C3.build.core=esp32 +VALTRACK_V4_MFW_ESP32_C3.build.variant=VALTRACK_V4_MFW_ESP32_C3 +VALTRACK_V4_MFW_ESP32_C3.build.board=VALTRACK_V4_MFW_ESP32_C3 +VALTRACK_V4_MFW_ESP32_C3.build.bootloader_addr=0x0 + +VALTRACK_V4_MFW_ESP32_C3.build.cdc_on_boot=1 +VALTRACK_V4_MFW_ESP32_C3.build.f_cpu=160000000L +VALTRACK_V4_MFW_ESP32_C3.build.flash_size=4MB +VALTRACK_V4_MFW_ESP32_C3.build.flash_freq=80m +VALTRACK_V4_MFW_ESP32_C3.build.flash_mode=qio +VALTRACK_V4_MFW_ESP32_C3.build.boot=qio +VALTRACK_V4_MFW_ESP32_C3.build.partitions=default +VALTRACK_V4_MFW_ESP32_C3.build.defines= + +VALTRACK_V4_MFW_ESP32_C3.menu.CDCOnBoot.default=Enabled +VALTRACK_V4_MFW_ESP32_C3.menu.CDCOnBoot.default.build.cdc_on_boot=1 +VALTRACK_V4_MFW_ESP32_C3.menu.CDCOnBoot.cdc=Disabled +VALTRACK_V4_MFW_ESP32_C3.menu.CDCOnBoot.cdc.build.cdc_on_boot=0 + +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.default.build.partitions=default +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.minimal.build.partitions=minimal +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.no_ota.build.partitions=no_ota +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.huge_app.build.partitions=huge_app +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.fatflash.build.partitions=ffat +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.rainmaker=RainMaker +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +VALTRACK_V4_MFW_ESP32_C3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 + +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.160=160MHz (WiFi) +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.160.build.f_cpu=160000000L +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.80=80MHz (WiFi) +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.80.build.f_cpu=80000000L +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.40=40MHz +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.40.build.f_cpu=40000000L +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.20=20MHz +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.20.build.f_cpu=20000000L +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.10=10MHz +VALTRACK_V4_MFW_ESP32_C3.menu.CPUFreq.10.build.f_cpu=10000000L + +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.qio=QIO +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.qio.build.flash_mode=dio +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.qio.build.boot=qio +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.dio=DIO +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.dio.build.flash_mode=dio +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.dio.build.boot=dio +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.qout=QOUT +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.qout.build.flash_mode=dout +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.qout.build.boot=qout +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.dout=DOUT +VALTRACK_V4_MFW_ESP32_C3.menu.FlashMode.dout.build.flash_mode=dout + +VALTRACK_V4_MFW_ESP32_C3.menu.FlashFreq.80=80MHz +VALTRACK_V4_MFW_ESP32_C3.menu.FlashFreq.80.build.flash_freq=80m +VALTRACK_V4_MFW_ESP32_C3.menu.FlashFreq.40=40MHz +VALTRACK_V4_MFW_ESP32_C3.menu.FlashFreq.40.build.flash_freq=40m + +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.4M=4MB (32Mb) +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.4M.build.flash_size=4MB +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.8M=8MB (64Mb) +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.8M.build.flash_size=8MB +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.8M.build.partitions=default_8MB +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.2M=2MB (16Mb) +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.2M.build.flash_size=2MB +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.2M.build.partitions=minimal +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.16M=16MB (128Mb) +VALTRACK_V4_MFW_ESP32_C3.menu.FlashSize.16M.build.flash_size=16MB + +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.921600=921600 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.921600.upload.speed=921600 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.115200=115200 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.115200.upload.speed=115200 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.256000.windows=256000 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.256000.upload.speed=256000 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.230400.windows.upload.speed=256000 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.230400=230400 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.230400.upload.speed=230400 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.460800.linux=460800 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.460800.macosx=460800 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.460800.upload.speed=460800 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.512000.windows=512000 +VALTRACK_V4_MFW_ESP32_C3.menu.UploadSpeed.512000.upload.speed=512000 + +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.none=None +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.none.build.code_debug=0 +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.error=Error +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.error.build.code_debug=1 +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.warn=Warn +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.warn.build.code_debug=2 +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.info=Info +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.info.build.code_debug=3 +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.debug=Debug +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.debug.build.code_debug=4 +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.verbose=Verbose +VALTRACK_V4_MFW_ESP32_C3.menu.DebugLevel.verbose.build.code_debug=5 + +VALTRACK_V4_MFW_ESP32_C3.menu.EraseFlash.none=Disabled +VALTRACK_V4_MFW_ESP32_C3.menu.EraseFlash.none.upload.erase_cmd= +VALTRACK_V4_MFW_ESP32_C3.menu.EraseFlash.all=Enabled +VALTRACK_V4_MFW_ESP32_C3.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +Edgebox-ESP-100.name=Edgebox-ESP-100 + +Edgebox-ESP-100.bootloader.tool=esptool_py +Edgebox-ESP-100.bootloader.tool.default=esptool_py + +Edgebox-ESP-100.upload.tool=esptool_py +Edgebox-ESP-100.upload.tool.default=esptool_py +Edgebox-ESP-100.upload.tool.network=esp_ota + +Edgebox-ESP-100.upload.maximum_size=1310720 +Edgebox-ESP-100.upload.maximum_data_size=327680 +Edgebox-ESP-100.upload.flags= +Edgebox-ESP-100.upload.extra_flags= +Edgebox-ESP-100.upload.use_1200bps_touch=false +Edgebox-ESP-100.upload.wait_for_upload_port=false + +Edgebox-ESP-100.serial.disableDTR=false +Edgebox-ESP-100.serial.disableRTS=false + +Edgebox-ESP-100.build.tarch=xtensa +Edgebox-ESP-100.build.bootloader_addr=0x0 +Edgebox-ESP-100.build.target=esp32s3 +Edgebox-ESP-100.build.mcu=esp32s3 +Edgebox-ESP-100.build.core=esp32 +Edgebox-ESP-100.build.variant=Edgebox-ESP-100 +Edgebox-ESP-100.build.board=Edgebox-ESP-100 + +Edgebox-ESP-100.build.usb_mode=1 +Edgebox-ESP-100.build.cdc_on_boot=0 +Edgebox-ESP-100.build.msc_on_boot=0 +Edgebox-ESP-100.build.dfu_on_boot=0 +Edgebox-ESP-100.build.f_cpu=240000000L +Edgebox-ESP-100.build.flash_size=4MB +Edgebox-ESP-100.build.flash_freq=80m +Edgebox-ESP-100.build.flash_mode=dio +Edgebox-ESP-100.build.boot=qio +Edgebox-ESP-100.build.boot_freq=80m +Edgebox-ESP-100.build.partitions=default +Edgebox-ESP-100.build.defines= +Edgebox-ESP-100.build.loop_core= +Edgebox-ESP-100.build.event_core= +Edgebox-ESP-100.build.psram_type=qspi +Edgebox-ESP-100.build.memory_type={build.boot}_{build.psram_type} + +Edgebox-ESP-100.menu.PSRAM.disabled=Disabled +Edgebox-ESP-100.menu.PSRAM.disabled.build.defines= +Edgebox-ESP-100.menu.PSRAM.disabled.build.psram_type=qspi +Edgebox-ESP-100.menu.PSRAM.enabled=QSPI PSRAM +Edgebox-ESP-100.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +Edgebox-ESP-100.menu.PSRAM.enabled.build.psram_type=qspi +Edgebox-ESP-100.menu.PSRAM.opi=OPI PSRAM +Edgebox-ESP-100.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +Edgebox-ESP-100.menu.PSRAM.opi.build.psram_type=opi + +Edgebox-ESP-100.menu.FlashMode.qio=QIO 80MHz +Edgebox-ESP-100.menu.FlashMode.qio.build.flash_mode=dio +Edgebox-ESP-100.menu.FlashMode.qio.build.boot=qio +Edgebox-ESP-100.menu.FlashMode.qio.build.boot_freq=80m +Edgebox-ESP-100.menu.FlashMode.qio.build.flash_freq=80m +Edgebox-ESP-100.menu.FlashMode.qio120=QIO 120MHz +Edgebox-ESP-100.menu.FlashMode.qio120.build.flash_mode=dio +Edgebox-ESP-100.menu.FlashMode.qio120.build.boot=qio +Edgebox-ESP-100.menu.FlashMode.qio120.build.boot_freq=120m +Edgebox-ESP-100.menu.FlashMode.qio120.build.flash_freq=80m +Edgebox-ESP-100.menu.FlashMode.dio=DIO 80MHz +Edgebox-ESP-100.menu.FlashMode.dio.build.flash_mode=dio +Edgebox-ESP-100.menu.FlashMode.dio.build.boot=dio +Edgebox-ESP-100.menu.FlashMode.dio.build.boot_freq=80m +Edgebox-ESP-100.menu.FlashMode.dio.build.flash_freq=80m +Edgebox-ESP-100.menu.FlashMode.opi=OPI 80MHz +Edgebox-ESP-100.menu.FlashMode.opi.build.flash_mode=dout +Edgebox-ESP-100.menu.FlashMode.opi.build.boot=opi +Edgebox-ESP-100.menu.FlashMode.opi.build.boot_freq=80m +Edgebox-ESP-100.menu.FlashMode.opi.build.flash_freq=80m + +Edgebox-ESP-100.menu.FlashSize.4M=4MB (32Mb) +Edgebox-ESP-100.menu.FlashSize.4M.build.flash_size=4MB +Edgebox-ESP-100.menu.FlashSize.8M=8MB (64Mb) +Edgebox-ESP-100.menu.FlashSize.8M.build.flash_size=8MB +Edgebox-ESP-100.menu.FlashSize.8M.build.partitions=default_8MB +Edgebox-ESP-100.menu.FlashSize.16M=16MB (128Mb) +Edgebox-ESP-100.menu.FlashSize.16M.build.flash_size=16MB +#Edgebox-ESP-100.menu.FlashSize.32M=32MB (256Mb) +#Edgebox-ESP-100.menu.FlashSize.32M.build.flash_size=32MB + +Edgebox-ESP-100.menu.LoopCore.1=Core 1 +Edgebox-ESP-100.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +Edgebox-ESP-100.menu.LoopCore.0=Core 0 +Edgebox-ESP-100.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +Edgebox-ESP-100.menu.EventsCore.1=Core 1 +Edgebox-ESP-100.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +Edgebox-ESP-100.menu.EventsCore.0=Core 0 +Edgebox-ESP-100.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +Edgebox-ESP-100.menu.USBMode.default=Hardware CDC and JTAG +Edgebox-ESP-100.menu.USBMode.default.build.usb_mode=1 +Edgebox-ESP-100.menu.USBMode.hwcdc=USB-OTG (TinyUSB) +Edgebox-ESP-100.menu.USBMode.hwcdc.build.usb_mode=0 + +Edgebox-ESP-100.menu.CDCOnBoot.default=Disabled +Edgebox-ESP-100.menu.CDCOnBoot.default.build.cdc_on_boot=0 +Edgebox-ESP-100.menu.CDCOnBoot.cdc=Enabled +Edgebox-ESP-100.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +Edgebox-ESP-100.menu.MSCOnBoot.default=Disabled +Edgebox-ESP-100.menu.MSCOnBoot.default.build.msc_on_boot=0 +Edgebox-ESP-100.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +Edgebox-ESP-100.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +Edgebox-ESP-100.menu.DFUOnBoot.default=Disabled +Edgebox-ESP-100.menu.DFUOnBoot.default.build.dfu_on_boot=0 +Edgebox-ESP-100.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +Edgebox-ESP-100.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +Edgebox-ESP-100.menu.UploadMode.default=UART0 / Hardware CDC +Edgebox-ESP-100.menu.UploadMode.default.upload.use_1200bps_touch=false +Edgebox-ESP-100.menu.UploadMode.default.upload.wait_for_upload_port=false +Edgebox-ESP-100.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +Edgebox-ESP-100.menu.UploadMode.cdc.upload.use_1200bps_touch=true +Edgebox-ESP-100.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +Edgebox-ESP-100.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +Edgebox-ESP-100.menu.PartitionScheme.default.build.partitions=default +Edgebox-ESP-100.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +Edgebox-ESP-100.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +Edgebox-ESP-100.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +Edgebox-ESP-100.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +Edgebox-ESP-100.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +Edgebox-ESP-100.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +Edgebox-ESP-100.menu.PartitionScheme.minimal.build.partitions=minimal +Edgebox-ESP-100.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +Edgebox-ESP-100.menu.PartitionScheme.no_ota.build.partitions=no_ota +Edgebox-ESP-100.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +Edgebox-ESP-100.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +Edgebox-ESP-100.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +Edgebox-ESP-100.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +Edgebox-ESP-100.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +Edgebox-ESP-100.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +Edgebox-ESP-100.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +Edgebox-ESP-100.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +Edgebox-ESP-100.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +Edgebox-ESP-100.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +Edgebox-ESP-100.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +Edgebox-ESP-100.menu.PartitionScheme.huge_app.build.partitions=huge_app +Edgebox-ESP-100.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +Edgebox-ESP-100.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +Edgebox-ESP-100.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +Edgebox-ESP-100.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +Edgebox-ESP-100.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +Edgebox-ESP-100.menu.PartitionScheme.fatflash.build.partitions=ffat +Edgebox-ESP-100.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +Edgebox-ESP-100.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +Edgebox-ESP-100.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +Edgebox-ESP-100.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +Edgebox-ESP-100.menu.PartitionScheme.rainmaker=RainMaker +Edgebox-ESP-100.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +Edgebox-ESP-100.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 + +Edgebox-ESP-100.menu.CPUFreq.240=240MHz (WiFi) +Edgebox-ESP-100.menu.CPUFreq.240.build.f_cpu=240000000L +Edgebox-ESP-100.menu.CPUFreq.160=160MHz (WiFi) +Edgebox-ESP-100.menu.CPUFreq.160.build.f_cpu=160000000L +Edgebox-ESP-100.menu.CPUFreq.80=80MHz (WiFi) +Edgebox-ESP-100.menu.CPUFreq.80.build.f_cpu=80000000L +Edgebox-ESP-100.menu.CPUFreq.40=40MHz +Edgebox-ESP-100.menu.CPUFreq.40.build.f_cpu=40000000L +Edgebox-ESP-100.menu.CPUFreq.20=20MHz +Edgebox-ESP-100.menu.CPUFreq.20.build.f_cpu=20000000L +Edgebox-ESP-100.menu.CPUFreq.10=10MHz +Edgebox-ESP-100.menu.CPUFreq.10.build.f_cpu=10000000L + +Edgebox-ESP-100.menu.UploadSpeed.921600=921600 +Edgebox-ESP-100.menu.UploadSpeed.921600.upload.speed=921600 +Edgebox-ESP-100.menu.UploadSpeed.115200=115200 +Edgebox-ESP-100.menu.UploadSpeed.115200.upload.speed=115200 +Edgebox-ESP-100.menu.UploadSpeed.256000.windows=256000 +Edgebox-ESP-100.menu.UploadSpeed.256000.upload.speed=256000 +Edgebox-ESP-100.menu.UploadSpeed.230400.windows.upload.speed=256000 +Edgebox-ESP-100.menu.UploadSpeed.230400=230400 +Edgebox-ESP-100.menu.UploadSpeed.230400.upload.speed=230400 +Edgebox-ESP-100.menu.UploadSpeed.460800.linux=460800 +Edgebox-ESP-100.menu.UploadSpeed.460800.macosx=460800 +Edgebox-ESP-100.menu.UploadSpeed.460800.upload.speed=460800 +Edgebox-ESP-100.menu.UploadSpeed.512000.windows=512000 +Edgebox-ESP-100.menu.UploadSpeed.512000.upload.speed=512000 + +Edgebox-ESP-100.menu.DebugLevel.none=None +Edgebox-ESP-100.menu.DebugLevel.none.build.code_debug=0 +Edgebox-ESP-100.menu.DebugLevel.error=Error +Edgebox-ESP-100.menu.DebugLevel.error.build.code_debug=1 +Edgebox-ESP-100.menu.DebugLevel.warn=Warn +Edgebox-ESP-100.menu.DebugLevel.warn.build.code_debug=2 +Edgebox-ESP-100.menu.DebugLevel.info=Info +Edgebox-ESP-100.menu.DebugLevel.info.build.code_debug=3 +Edgebox-ESP-100.menu.DebugLevel.debug=Debug +Edgebox-ESP-100.menu.DebugLevel.debug.build.code_debug=4 +Edgebox-ESP-100.menu.DebugLevel.verbose=Verbose +Edgebox-ESP-100.menu.DebugLevel.verbose.build.code_debug=5 + +Edgebox-ESP-100.menu.EraseFlash.none=Disabled +Edgebox-ESP-100.menu.EraseFlash.none.upload.erase_cmd= +Edgebox-ESP-100.menu.EraseFlash.all=Enabled +Edgebox-ESP-100.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +crabik_slot_esp32_s3.name=Crabik Slot ESP32-S3 +crabik_slot_esp32_s3.vid.0=0x303a +crabik_slot_esp32_s3.pid.0=0x1001 + +crabik_slot_esp32_s3.bootloader.tool=esptool_py +crabik_slot_esp32_s3.bootloader.tool.default=esptool_py + +crabik_slot_esp32_s3.upload.tool=esptool_py +crabik_slot_esp32_s3.upload.tool.default=esptool_py +crabik_slot_esp32_s3.upload.tool.network=esp_ota + +crabik_slot_esp32_s3.upload.maximum_size=1310720 +crabik_slot_esp32_s3.upload.maximum_data_size=327680 +crabik_slot_esp32_s3.upload.speed=921600 +crabik_slot_esp32_s3.upload.flags= +crabik_slot_esp32_s3.upload.extra_flags= +crabik_slot_esp32_s3.upload.use_1200bps_touch=false +crabik_slot_esp32_s3.upload.wait_for_upload_port=false + +crabik_slot_esp32_s3.serial.disableDTR=false +crabik_slot_esp32_s3.serial.disableRTS=false + +crabik_slot_esp32_s3.build.tarch=xtensa +crabik_slot_esp32_s3.build.bootloader_addr=0x0 +crabik_slot_esp32_s3.build.target=esp32s3 +crabik_slot_esp32_s3.build.mcu=esp32s3 +crabik_slot_esp32_s3.build.core=esp32 +crabik_slot_esp32_s3.build.variant=crabik_slot_esp32_s3 +crabik_slot_esp32_s3.build.board=CRABIK_SLOT_ESP32_S3 + +crabik_slot_esp32_s3.build.usb_mode=0 +crabik_slot_esp32_s3.build.cdc_on_boot=0 +crabik_slot_esp32_s3.build.msc_on_boot=0 +crabik_slot_esp32_s3.build.dfu_on_boot=0 +crabik_slot_esp32_s3.build.f_cpu=240000000L +crabik_slot_esp32_s3.build.flash_size=8MB +crabik_slot_esp32_s3.build.flash_freq=80m +crabik_slot_esp32_s3.build.flash_mode=dio +crabik_slot_esp32_s3.build.boot=qio +crabik_slot_esp32_s3.build.partitions=default +crabik_slot_esp32_s3.build.defines= +crabik_slot_esp32_s3.build.memory_type=qio_qspi +crabik_slot_esp32_s3.build.loop_core= +crabik_slot_esp32_s3.build.event_core= + +## IDE 2.0 Seems to not update the value +crabik_slot_esp32_s3.menu.JTAGAdapter.default=Disabled +crabik_slot_esp32_s3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +crabik_slot_esp32_s3.menu.JTAGAdapter.builtin=Integrated USB JTAG +crabik_slot_esp32_s3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +crabik_slot_esp32_s3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 + +crabik_slot_esp32_s3.menu.LoopCore.1=Core 1 +crabik_slot_esp32_s3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +crabik_slot_esp32_s3.menu.LoopCore.0=Core 0 +crabik_slot_esp32_s3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +crabik_slot_esp32_s3.menu.EventsCore.1=Core 1 +crabik_slot_esp32_s3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +crabik_slot_esp32_s3.menu.EventsCore.0=Core 0 +crabik_slot_esp32_s3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +crabik_slot_esp32_s3.menu.CDCOnBoot.default=Enabled (Requires Hardware CDC and JTAG Mode) +crabik_slot_esp32_s3.menu.CDCOnBoot.default.build.cdc_on_boot=1 +crabik_slot_esp32_s3.menu.CDCOnBoot.discdc=Disabled +crabik_slot_esp32_s3.menu.CDCOnBoot.discdc.build.cdc_on_boot=0 + +crabik_slot_esp32_s3.menu.MSCOnBoot.default=Disabled +crabik_slot_esp32_s3.menu.MSCOnBoot.default.build.msc_on_boot=0 +crabik_slot_esp32_s3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +crabik_slot_esp32_s3.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +crabik_slot_esp32_s3.menu.USBMode.default=Hardware CDC and JTAG +crabik_slot_esp32_s3.menu.USBMode.default.build.usb_mode=1 +crabik_slot_esp32_s3.menu.USBMode.default.build.cdc_on_boot=1 +crabik_slot_esp32_s3.menu.USBMode.usbotg=USB-OTG +crabik_slot_esp32_s3.menu.USBMode.usbotg.build.usb_mode=0 +crabik_slot_esp32_s3.menu.USBMode.usbotg.build.cdc_on_boot=0 + +crabik_slot_esp32_s3.menu.UploadMode.default=UART0 / Hardware CDC +crabik_slot_esp32_s3.menu.UploadMode.default.upload.use_1200bps_touch=false +crabik_slot_esp32_s3.menu.UploadMode.default.upload.wait_for_upload_port=false +crabik_slot_esp32_s3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +crabik_slot_esp32_s3.menu.UploadMode.cdc.upload.use_1200bps_touch=true +crabik_slot_esp32_s3.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +crabik_slot_esp32_s3.menu.CPUFreq.240=240MHz (WiFi) +crabik_slot_esp32_s3.menu.CPUFreq.240.build.f_cpu=240000000L +crabik_slot_esp32_s3.menu.CPUFreq.160=160MHz (WiFi) +crabik_slot_esp32_s3.menu.CPUFreq.160.build.f_cpu=160000000L +crabik_slot_esp32_s3.menu.CPUFreq.80=80MHz (WiFi) +crabik_slot_esp32_s3.menu.CPUFreq.80.build.f_cpu=80000000L + +crabik_slot_esp32_s3.menu.PartitionScheme.default=8M Flash (3MB APP/1.5MB FATFS) +crabik_slot_esp32_s3.menu.PartitionScheme.default.build.partitions=default_8MB +crabik_slot_esp32_s3.menu.PartitionScheme.default.upload.maximum_size=3342336 +crabik_slot_esp32_s3.menu.PartitionScheme.default_4MB=4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +crabik_slot_esp32_s3.menu.PartitionScheme.default_4MB.build.partitions=default +crabik_slot_esp32_s3.menu.PartitionScheme.defaultffat=4MB with ffat (1.2MB APP/1.5MB FATFS) +crabik_slot_esp32_s3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +crabik_slot_esp32_s3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +crabik_slot_esp32_s3.menu.PartitionScheme.no_ota.build.partitions=no_ota +crabik_slot_esp32_s3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +crabik_slot_esp32_s3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +crabik_slot_esp32_s3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +crabik_slot_esp32_s3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +crabik_slot_esp32_s3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +crabik_slot_esp32_s3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +crabik_slot_esp32_s3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +crabik_slot_esp32_s3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +crabik_slot_esp32_s3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +crabik_slot_esp32_s3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 + +crabik_slot_esp32_s3.menu.UploadSpeed.921600=921600 +crabik_slot_esp32_s3.menu.UploadSpeed.921600.upload.speed=921600 +crabik_slot_esp32_s3.menu.UploadSpeed.115200=115200 +crabik_slot_esp32_s3.menu.UploadSpeed.115200.upload.speed=115200 +crabik_slot_esp32_s3.menu.UploadSpeed.256000.windows=256000 +crabik_slot_esp32_s3.menu.UploadSpeed.256000.upload.speed=256000 +crabik_slot_esp32_s3.menu.UploadSpeed.230400.windows.upload.speed=256000 +crabik_slot_esp32_s3.menu.UploadSpeed.230400=230400 +crabik_slot_esp32_s3.menu.UploadSpeed.230400.upload.speed=230400 +crabik_slot_esp32_s3.menu.UploadSpeed.460800.linux=460800 +crabik_slot_esp32_s3.menu.UploadSpeed.460800.macosx=460800 +crabik_slot_esp32_s3.menu.UploadSpeed.460800.upload.speed=460800 +crabik_slot_esp32_s3.menu.UploadSpeed.512000.windows=512000 +crabik_slot_esp32_s3.menu.UploadSpeed.512000.upload.speed=512000 + +crabik_slot_esp32_s3.menu.DebugLevel.none=None +crabik_slot_esp32_s3.menu.DebugLevel.none.build.code_debug=0 +crabik_slot_esp32_s3.menu.DebugLevel.error=Error +crabik_slot_esp32_s3.menu.DebugLevel.error.build.code_debug=1 +crabik_slot_esp32_s3.menu.DebugLevel.warn=Warn +crabik_slot_esp32_s3.menu.DebugLevel.warn.build.code_debug=2 +crabik_slot_esp32_s3.menu.DebugLevel.info=Info +crabik_slot_esp32_s3.menu.DebugLevel.info.build.code_debug=3 +crabik_slot_esp32_s3.menu.DebugLevel.debug=Debug +crabik_slot_esp32_s3.menu.DebugLevel.debug.build.code_debug=4 +crabik_slot_esp32_s3.menu.DebugLevel.verbose=Verbose +crabik_slot_esp32_s3.menu.DebugLevel.verbose.build.code_debug=5 + +crabik_slot_esp32_s3.menu.EraseFlash.none=Disabled +crabik_slot_esp32_s3.menu.EraseFlash.none.upload.erase_cmd= +crabik_slot_esp32_s3.menu.EraseFlash.all=Enabled +crabik_slot_esp32_s3.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## diff --git a/cores/esp32/Arduino.h b/cores/esp32/Arduino.h index 8b0aa220d98..112b244c12a 100644 --- a/cores/esp32/Arduino.h +++ b/cores/esp32/Arduino.h @@ -173,7 +173,6 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val); #include "Udp.h" #include "HardwareSerial.h" #include "Esp.h" -#include "esp32/spiram.h" // Use float-compatible stl abs() and round(), we don't use Arduino macros to avoid issues with the C++ libraries using std::abs; @@ -192,7 +191,8 @@ size_t getArduinoLoopTaskStackSize(void); #define SET_LOOP_TASK_STACK_SIZE(sz) size_t getArduinoLoopTaskStackSize() { return sz;} // allows user to bypass esp_spiram_test() -#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_spiram_test(); } +bool esp_psram_extram_test(void); +#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_psram_extram_test(); } unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); diff --git a/cores/esp32/Esp.cpp b/cores/esp32/Esp.cpp index 4825b0d931c..37612300cd0 100644 --- a/cores/esp32/Esp.cpp +++ b/cores/esp32/Esp.cpp @@ -20,7 +20,7 @@ #include "Arduino.h" #include "Esp.h" #include "esp_sleep.h" -#include "esp_spi_flash.h" +#include "spi_flash_mmap.h" #include #include #include @@ -32,6 +32,9 @@ extern "C" { #include "soc/spi_reg.h" #include "esp_system.h" +#include "esp_chip_info.h" +#include "esp_mac.h" +#include "esp_flash.h" #ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 #include "esp32/rom/spi_flash.h" @@ -330,7 +333,7 @@ uint32_t EspClass::getFlashChipSize(void) uint32_t EspClass::getFlashChipSpeed(void) { esp_image_header_t fhdr; - if(flashRead(ESP_FLASH_IMAGE_BASE, (uint32_t*)&fhdr, sizeof(esp_image_header_t)) && fhdr.magic != ESP_IMAGE_HEADER_MAGIC) { + if(esp_flash_read(esp_flash_default_chip, (void*)&fhdr, ESP_FLASH_IMAGE_BASE, sizeof(esp_image_header_t)) && fhdr.magic != ESP_IMAGE_HEADER_MAGIC) { return 0; } return magicFlashChipSpeed(fhdr.spi_speed); @@ -405,18 +408,18 @@ FlashMode_t EspClass::magicFlashChipMode(uint8_t byte) bool EspClass::flashEraseSector(uint32_t sector) { - return spi_flash_erase_sector(sector) == ESP_OK; + return esp_flash_erase_region(esp_flash_default_chip, sector * SPI_FLASH_SEC_SIZE, SPI_FLASH_SEC_SIZE) == ESP_OK; } // Warning: These functions do not work with encrypted flash bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size) { - return spi_flash_write(offset, (uint32_t*) data, size) == ESP_OK; + return esp_flash_write(esp_flash_default_chip, (const void*) data, offset, size) == ESP_OK; } bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size) { - return spi_flash_read(offset, (uint32_t*) data, size) == ESP_OK; + return esp_flash_read(esp_flash_default_chip, (void*) data, offset, size) == ESP_OK; } bool EspClass::partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size) diff --git a/cores/esp32/Esp.h b/cores/esp32/Esp.h index 34ddb3bde11..7f4427c883e 100644 --- a/cores/esp32/Esp.h +++ b/cores/esp32/Esp.h @@ -23,6 +23,7 @@ #include #include #include +#include "esp_cpu.h" /** * AVR macros for WDT managment @@ -111,7 +112,7 @@ class EspClass uint32_t ARDUINO_ISR_ATTR EspClass::getCycleCount() { - return cpu_hal_get_cycle_count(); + return (uint32_t)esp_cpu_get_cycle_count(); } extern EspClass ESP; diff --git a/cores/esp32/FirmwareMSC.cpp b/cores/esp32/FirmwareMSC.cpp index e869cbef01c..638f1823499 100644 --- a/cores/esp32/FirmwareMSC.cpp +++ b/cores/esp32/FirmwareMSC.cpp @@ -18,9 +18,11 @@ #include #include "esp_partition.h" #include "esp_ota_ops.h" +#include "esp_image_format.h" #include "esp32-hal.h" #include "pins_arduino.h" #include "firmware_msc_fat.h" +#include "spi_flash_mmap.h" #ifndef USB_FW_MSC_VENDOR_ID #define USB_FW_MSC_VENDOR_ID "ESP32" //max 8 chars diff --git a/cores/esp32/FunctionalInterrupt.h b/cores/esp32/FunctionalInterrupt.h index b5e3181f986..69bb5aee7b3 100644 --- a/cores/esp32/FunctionalInterrupt.h +++ b/cores/esp32/FunctionalInterrupt.h @@ -9,6 +9,7 @@ #define CORE_CORE_FUNCTIONALINTERRUPT_H_ #include +#include struct InterruptArgStructure { std::function interruptFunction; diff --git a/cores/esp32/HWCDC.cpp b/cores/esp32/HWCDC.cpp index 25744f0b0a3..aacd589e5ec 100644 --- a/cores/esp32/HWCDC.cpp +++ b/cores/esp32/HWCDC.cpp @@ -22,7 +22,10 @@ #include "freertos/ringbuf.h" #include "esp_intr_alloc.h" #include "soc/periph_defs.h" +#pragma GCC diagnostic ignored "-Wvolatile" #include "hal/usb_serial_jtag_ll.h" +#pragma GCC diagnostic warning "-Wvolatile" +#include "rom/ets_sys.h" ESP_EVENT_DEFINE_BASE(ARDUINO_HW_CDC_EVENTS); diff --git a/cores/esp32/Print.cpp b/cores/esp32/Print.cpp index e5d388ec588..53231e60909 100644 --- a/cores/esp32/Print.cpp +++ b/cores/esp32/Print.cpp @@ -57,7 +57,7 @@ size_t Print::printf(const char *format, ...) if(len < 0) { va_end(arg); return 0; - }; + } if(len >= (int)sizeof(loc_buf)){ // comparation of same sign type for the compiler temp = (char*) malloc(len+1); if(temp == NULL) { diff --git a/cores/esp32/USB.cpp b/cores/esp32/USB.cpp index d82659ebbcf..60dcf3dc943 100644 --- a/cores/esp32/USB.cpp +++ b/cores/esp32/USB.cpp @@ -20,6 +20,8 @@ #include "esp32-hal-tinyusb.h" #include "common/tusb_common.h" #include "StreamString.h" +#include "rom/ets_sys.h" +#include "esp_mac.h" #ifndef USB_VID #define USB_VID USB_ESPRESSIF_VID diff --git a/cores/esp32/USBCDC.cpp b/cores/esp32/USBCDC.cpp index ccf5180d7c7..0eb7b0fde67 100644 --- a/cores/esp32/USBCDC.cpp +++ b/cores/esp32/USBCDC.cpp @@ -16,6 +16,7 @@ #include "USBCDC.h" #include "esp32-hal-tinyusb.h" +#include "rom/ets_sys.h" ESP_EVENT_DEFINE_BASE(ARDUINO_USB_CDC_EVENTS); esp_err_t arduino_usb_event_post(esp_event_base_t event_base, int32_t event_id, void *event_data, size_t event_data_size, TickType_t ticks_to_wait); diff --git a/cores/esp32/WMath.cpp b/cores/esp32/WMath.cpp index 078e18a8767..4632cf9d6fa 100644 --- a/cores/esp32/WMath.cpp +++ b/cores/esp32/WMath.cpp @@ -28,6 +28,7 @@ extern "C" { #include "esp_system.h" } #include "esp32-hal-log.h" +#include "esp_random.h" void randomSeed(unsigned long seed) { diff --git a/cores/esp32/WString.cpp b/cores/esp32/WString.cpp index f31024ea8ba..9b92fb84559 100644 --- a/cores/esp32/WString.cpp +++ b/cores/esp32/WString.cpp @@ -176,26 +176,25 @@ void String::invalidate(void) { init(); } -unsigned char String::reserve(unsigned int size) { +bool String::reserve(unsigned int size) { if(buffer() && capacity() >= size) - return 1; + return true; if(changeBuffer(size)) { if(len() == 0) wbuffer()[0] = 0; - return 1; + return true; } - return 0; + return false; } -unsigned char String::changeBuffer(unsigned int maxStrLen) { +bool String::changeBuffer(unsigned int maxStrLen) { // Can we use SSO here to avoid allocation? if (maxStrLen < sizeof(sso.buff) - 1) { if (isSSO() || !buffer()) { // Already using SSO, nothing to do - uint16_t oldLen = len(); + uint16_t oldLen = len(); setSSO(true); setLen(oldLen); - return 1; } else { // if bufptr && !isSSO() // Using bufptr, need to shrink into sso.buff char temp[sizeof(sso.buff)]; @@ -205,8 +204,8 @@ unsigned char String::changeBuffer(unsigned int maxStrLen) { setSSO(true); memcpy(wbuffer(), temp, maxStrLen); setLen(oldLen); - return 1; } + return true; } // Fallthrough to normal allocator size_t newSize = (maxStrLen + 16) & (~0xf); @@ -230,9 +229,9 @@ unsigned char String::changeBuffer(unsigned int maxStrLen) { setCapacity(newSize - 1); setBuffer(newbuffer); setLen(oldLen); // Needed in case of SSO where len() never existed - return 1; + return true; } - return 0; + return false; } // /*********************************************/ @@ -338,34 +337,34 @@ String & String::operator =(const __FlashStringHelper *pstr) { // /* concat */ // /*********************************************/ -unsigned char String::concat(const String &s) { +bool String::concat(const String &s) { // Special case if we're concatting ourself (s += s;) since we may end up // realloc'ing the buffer and moving s.buffer in the method called if (&s == this) { unsigned int newlen = 2 * len(); if (!s.buffer()) - return 0; + return false; if (s.len() == 0) - return 1; + return true; if (!reserve(newlen)) - return 0; + return false; memmove(wbuffer() + len(), buffer(), len()); setLen(newlen); wbuffer()[len()] = 0; - return 1; + return true; } else { return concat(s.buffer(), s.len()); } } -unsigned char String::concat(const char *cstr, unsigned int length) { +bool String::concat(const char *cstr, unsigned int length) { unsigned int newlen = len() + length; if(!cstr) - return 0; + return false; if(length == 0) - return 1; + return true; if(!reserve(newlen)) - return 0; + return false; if (cstr >= wbuffer() && cstr < wbuffer() + len()) // compatible with SSO in ram #6155 (case "x += x.c_str()") memmove(wbuffer() + len(), cstr, length + 1); @@ -373,79 +372,82 @@ unsigned char String::concat(const char *cstr, unsigned int length) { // compatible with source in flash #6367 memcpy_P(wbuffer() + len(), cstr, length + 1); setLen(newlen); - return 1; + return true; } -unsigned char String::concat(const char *cstr) { +bool String::concat(const char *cstr) { if(!cstr) - return 0; + return false; return concat(cstr, strlen(cstr)); } -unsigned char String::concat(char c) { +bool String::concat(char c) { char buf[] = { c, '\0' }; return concat(buf, 1); } -unsigned char String::concat(unsigned char num) { +bool String::concat(unsigned char num) { char buf[1 + 3 * sizeof(unsigned char)]; return concat(buf, sprintf(buf, "%d", num)); } -unsigned char String::concat(int num) { +bool String::concat(int num) { char buf[2 + 3 * sizeof(int)]; return concat(buf, sprintf(buf, "%d", num)); } -unsigned char String::concat(unsigned int num) { +bool String::concat(unsigned int num) { char buf[1 + 3 * sizeof(unsigned int)]; utoa(num, buf, 10); return concat(buf, strlen(buf)); } -unsigned char String::concat(long num) { +bool String::concat(long num) { char buf[2 + 3 * sizeof(long)]; return concat(buf, sprintf(buf, "%ld", num)); } -unsigned char String::concat(unsigned long num) { +bool String::concat(unsigned long num) { char buf[1 + 3 * sizeof(unsigned long)]; ultoa(num, buf, 10); return concat(buf, strlen(buf)); } -unsigned char String::concat(float num) { +bool String::concat(float num) { char buf[20]; char* string = dtostrf(num, 4, 2, buf); return concat(string, strlen(string)); } -unsigned char String::concat(double num) { +bool String::concat(double num) { char buf[20]; char* string = dtostrf(num, 4, 2, buf); return concat(string, strlen(string)); } -unsigned char String::concat(long long num) { +bool String::concat(long long num) { char buf[2 + 3 * sizeof(long long)]; return concat(buf, sprintf(buf, "%lld", num)); // NOT SURE - NewLib Nano ... does it support %lld? } -unsigned char String::concat(unsigned long long num) { +bool String::concat(unsigned long long num) { char buf[1 + 3 * sizeof(unsigned long long)]; ulltoa(num, buf, 10); return concat(buf, strlen(buf)); } -unsigned char String::concat(const __FlashStringHelper * str) { - if (!str) return 0; +bool String::concat(const __FlashStringHelper * str) { + if (!str) + return false; int length = strlen_P((PGM_P)str); - if (length == 0) return 1; + if (length == 0) + return true; unsigned int newlen = len() + length; - if (!reserve(newlen)) return 0; + if (!reserve(newlen)) + return false; memcpy_P(wbuffer() + len(), (PGM_P)str, length + 1); setLen(newlen); - return 1; + return true; } /*********************************************/ @@ -559,11 +561,11 @@ int String::compareTo(const String &s) const { return strcmp(buffer(), s.buffer()); } -unsigned char String::equals(const String &s2) const { +bool String::equals(const String &s2) const { return (len() == s2.len() && compareTo(s2) == 0); } -unsigned char String::equals(const char *cstr) const { +bool String::equals(const char *cstr) const { if(len() == 0) return (cstr == NULL || *cstr == 0); if(cstr == NULL) @@ -571,36 +573,36 @@ unsigned char String::equals(const char *cstr) const { return strcmp(buffer(), cstr) == 0; } -unsigned char String::operator<(const String &rhs) const { +bool String::operator<(const String &rhs) const { return compareTo(rhs) < 0; } -unsigned char String::operator>(const String &rhs) const { +bool String::operator>(const String &rhs) const { return compareTo(rhs) > 0; } -unsigned char String::operator<=(const String &rhs) const { +bool String::operator<=(const String &rhs) const { return compareTo(rhs) <= 0; } -unsigned char String::operator>=(const String &rhs) const { +bool String::operator>=(const String &rhs) const { return compareTo(rhs) >= 0; } -unsigned char String::equalsIgnoreCase(const String &s2) const { +bool String::equalsIgnoreCase(const String &s2) const { if(this == &s2) - return 1; + return true; if(len() != s2.len()) - return 0; + return false; if(len() == 0) - return 1; + return true; const char *p1 = buffer(); const char *p2 = s2.buffer(); while(*p1) { if(tolower(*p1++) != tolower(*p2++)) - return 0; + return false; } - return 1; + return true; } unsigned char String::equalsConstantTime(const String &s2) const { @@ -630,21 +632,21 @@ unsigned char String::equalsConstantTime(const String &s2) const { return (equalcond & diffcond); //bitwise AND } -unsigned char String::startsWith(const String &s2) const { +bool String::startsWith(const String &s2) const { if(len() < s2.len()) - return 0; + return false; return startsWith(s2, 0); } -unsigned char String::startsWith(const String &s2, unsigned int offset) const { +bool String::startsWith(const String &s2, unsigned int offset) const { if(offset > (unsigned)(len() - s2.len()) || !buffer() || !s2.buffer()) - return 0; + return false; return strncmp(&buffer()[offset], s2.buffer(), s2.len()) == 0; } -unsigned char String::endsWith(const String &s2) const { +bool String::endsWith(const String &s2) const { if(len() < s2.len() || !buffer() || !s2.buffer()) - return 0; + return false; return strcmp(&buffer()[len() - s2.len()], s2.buffer()) == 0; } diff --git a/cores/esp32/WString.h b/cores/esp32/WString.h index 99e85e0df52..f7f0d814ddc 100644 --- a/cores/esp32/WString.h +++ b/cores/esp32/WString.h @@ -81,7 +81,7 @@ class String { // return true on success, false on failure (in which case, the string // is left unchanged). reserve(0), if successful, will validate an // invalid string (i.e., "if (s)" will be true afterwards) - unsigned char reserve(unsigned int size); + bool reserve(unsigned int size); inline unsigned int length(void) const { if(buffer()) { return len(); @@ -112,21 +112,21 @@ class String { // returns true on success, false on failure (in which case, the string // is left unchanged). if the argument is null or invalid, the // concatenation is considered unsuccessful. - unsigned char concat(const String &str); - unsigned char concat(const char *cstr); - unsigned char concat(const char *cstr, unsigned int length); - unsigned char concat(const uint8_t *cstr, unsigned int length) {return concat((const char*)cstr, length);} - unsigned char concat(char c); - unsigned char concat(unsigned char c); - unsigned char concat(int num); - unsigned char concat(unsigned int num); - unsigned char concat(long num); - unsigned char concat(unsigned long num); - unsigned char concat(float num); - unsigned char concat(double num); - unsigned char concat(long long num); - unsigned char concat(unsigned long long num); - unsigned char concat(const __FlashStringHelper * str); + bool concat(const String &str); + bool concat(const char *cstr); + bool concat(const char *cstr, unsigned int length); + bool concat(const uint8_t *cstr, unsigned int length) {return concat((const char*)cstr, length);} + bool concat(char c); + bool concat(unsigned char c); + bool concat(int num); + bool concat(unsigned int num); + bool concat(long num); + bool concat(unsigned long num); + bool concat(float num); + bool concat(double num); + bool concat(long long num); + bool concat(unsigned long long num); + bool concat(const __FlashStringHelper * str); // if there's not enough memory for the concatenated value, the string // will be left unchanged (but this isn't signalled in any way) @@ -202,39 +202,39 @@ class String { return buffer() ? &String::StringIfHelper : 0; } int compareTo(const String &s) const; - unsigned char equals(const String &s) const; - unsigned char equals(const char *cstr) const; - unsigned char operator ==(const String &rhs) const { + bool equals(const String &s) const; + bool equals(const char *cstr) const; + bool operator ==(const String &rhs) const { return equals(rhs); } - unsigned char operator ==(const char *cstr) const { + bool operator ==(const char *cstr) const { return equals(cstr); } - unsigned char operator !=(const String &rhs) const { + bool operator !=(const String &rhs) const { return !equals(rhs); } - unsigned char operator !=(const char *cstr) const { + bool operator !=(const char *cstr) const { return !equals(cstr); } - unsigned char operator <(const String &rhs) const; - unsigned char operator >(const String &rhs) const; - unsigned char operator <=(const String &rhs) const; - unsigned char operator >=(const String &rhs) const; - unsigned char equalsIgnoreCase(const String &s) const; + bool operator <(const String &rhs) const; + bool operator >(const String &rhs) const; + bool operator <=(const String &rhs) const; + bool operator >=(const String &rhs) const; + bool equalsIgnoreCase(const String &s) const; unsigned char equalsConstantTime(const String &s) const; - unsigned char startsWith(const String &prefix) const; - unsigned char startsWith(const char *prefix) const { + bool startsWith(const String &prefix) const; + bool startsWith(const char *prefix) const { return this->startsWith(String(prefix)); } - unsigned char startsWith(const __FlashStringHelper *prefix) const { + bool startsWith(const __FlashStringHelper *prefix) const { return this->startsWith(String(prefix)); } - unsigned char startsWith(const String &prefix, unsigned int offset) const; - unsigned char endsWith(const String &suffix) const; - unsigned char endsWith(const char *suffix) const { + bool startsWith(const String &prefix, unsigned int offset) const; + bool endsWith(const String &suffix) const; + bool endsWith(const char *suffix) const { return this->endsWith(String(suffix)); } - unsigned char endsWith(const __FlashStringHelper * suffix) const { + bool endsWith(const __FlashStringHelper * suffix) const { return this->endsWith(String(suffix)); } @@ -345,7 +345,7 @@ class String { protected: void init(void); void invalidate(void); - unsigned char changeBuffer(unsigned int maxStrLen); + bool changeBuffer(unsigned int maxStrLen); // copy and move String & copy(const char *cstr, unsigned int length); diff --git a/cores/esp32/esp32-hal-adc.c b/cores/esp32/esp32-hal-adc.c index 0fe73d14cbd..50a3d5e676e 100644 --- a/cores/esp32/esp32-hal-adc.c +++ b/cores/esp32/esp32-hal-adc.c @@ -26,7 +26,7 @@ static uint8_t __analogAttenuation = 3;//11db static uint8_t __analogWidth = ADC_WIDTH_MAX - 1; //3 for ESP32/ESP32C3; 4 for ESP32S2 -static uint8_t __analogReturnedWidth = SOC_ADC_MAX_BITWIDTH; //12 for ESP32/ESP32C3; 13 for ESP32S2 +static uint8_t __analogReturnedWidth = SOC_ADC_RTC_MAX_BITWIDTH; //12 for ESP32/ESP32C3; 13 for ESP32S2 static uint8_t __analogClockDiv = 1; static adc_attenuation_t __pin_attenuation[SOC_GPIO_PIN_COUNT]; @@ -256,13 +256,6 @@ void __analogSetVRefPin(uint8_t pin){ __analogVRefPin = pin; } -int __hallRead() //hall sensor using idf read -{ - pinMode(36, ANALOG); - pinMode(39, ANALOG); - __analogSetWidth(12); - return hall_sensor_read(); -} #endif extern uint16_t analogRead(uint8_t pin) __attribute__ ((weak, alias("__analogRead"))); @@ -277,5 +270,4 @@ extern bool adcAttachPin(uint8_t pin) __attribute__ ((weak, alias("__adcAttachPi #if CONFIG_IDF_TARGET_ESP32 extern void analogSetVRefPin(uint8_t pin) __attribute__ ((weak, alias("__analogSetVRefPin"))); extern void analogSetWidth(uint8_t bits) __attribute__ ((weak, alias("__analogSetWidth"))); -extern int hallRead() __attribute__ ((weak, alias("__hallRead"))); #endif diff --git a/cores/esp32/esp32-hal-adc.h b/cores/esp32/esp32-hal-adc.h index 1b094d8ebd0..c226384a422 100644 --- a/cores/esp32/esp32-hal-adc.h +++ b/cores/esp32/esp32-hal-adc.h @@ -90,11 +90,6 @@ void analogSetWidth(uint8_t bits); * */ void analogSetVRefPin(uint8_t pin); -/* - * Get value for HALL sensor (without LNA) - * connected to pins 36(SVP) and 39(SVN) - * */ -int hallRead(); #endif #ifdef __cplusplus diff --git a/cores/esp32/esp32-hal-dac.c b/cores/esp32/esp32-hal-dac.c index db1bb74b4d8..70a0e15e7d0 100644 --- a/cores/esp32/esp32-hal-dac.c +++ b/cores/esp32/esp32-hal-dac.c @@ -19,7 +19,7 @@ #define NODAC #else #include "soc/dac_channel.h" -#include "driver/dac_common.h" +#include "driver/dac.h" void ARDUINO_ISR_ATTR __dacWrite(uint8_t pin, uint8_t value) { diff --git a/cores/esp32/esp32-hal-gpio.c b/cores/esp32/esp32-hal-gpio.c index f0f99db9abf..5569da5c0f1 100644 --- a/cores/esp32/esp32-hal-gpio.c +++ b/cores/esp32/esp32-hal-gpio.c @@ -98,7 +98,7 @@ extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode) } #endif - if (!GPIO_IS_VALID_GPIO(pin)) { + if (pin >= SOC_GPIO_PIN_COUNT) { log_e("Invalid pin selected"); return; } diff --git a/cores/esp32/esp32-hal-i2c-slave.c b/cores/esp32/esp32-hal-i2c-slave.c index 16dc050e58d..9b54cce9b1d 100644 --- a/cores/esp32/esp32-hal-i2c-slave.c +++ b/cores/esp32/esp32-hal-i2c-slave.c @@ -36,10 +36,10 @@ #include "freertos/ringbuf.h" #include "esp_intr_alloc.h" -#include "driver/periph_ctrl.h" #include "soc/i2c_reg.h" #include "soc/i2c_struct.h" #include "hal/i2c_ll.h" +#include "hal/clk_gate_ll.h" #include "esp32-hal-log.h" #include "esp32-hal-i2c-slave.h" @@ -292,10 +292,10 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t frequency = (frequency * 5) / 4; if (i2c->num == 0) { - periph_module_enable(PERIPH_I2C0_MODULE); + periph_ll_enable_clk_clear_rst(PERIPH_I2C0_MODULE); #if SOC_I2C_NUM > 1 } else { - periph_module_enable(PERIPH_I2C1_MODULE); + periph_ll_enable_clk_clear_rst(PERIPH_I2C1_MODULE); #endif } @@ -320,7 +320,7 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t } i2c_ll_disable_intr_mask(i2c->dev, I2C_LL_INTR_MASK); - i2c_ll_clr_intsts_mask(i2c->dev, I2C_LL_INTR_MASK); + i2c_ll_clear_intr_mask(i2c->dev, I2C_LL_INTR_MASK); i2c_ll_set_fifo_mode(i2c->dev, true); if (!i2c->intr_handle) { @@ -377,7 +377,7 @@ size_t i2cSlaveWrite(uint8_t num, const uint8_t *buf, uint32_t len, uint32_t tim log_e("Invalid port num: %u", num); return 0; } - size_t to_queue = 0, to_fifo = 0; + uint32_t to_queue = 0, to_fifo = 0; i2c_slave_struct_t * i2c = &_i2c_bus_array[num]; #if !CONFIG_DISABLE_HAL_LOCKS if(!i2c->lock){ @@ -391,35 +391,39 @@ size_t i2cSlaveWrite(uint8_t num, const uint8_t *buf, uint32_t len, uint32_t tim I2C_SLAVE_MUTEX_LOCK(); #if CONFIG_IDF_TARGET_ESP32 i2c_ll_slave_disable_tx_it(i2c->dev); - if (i2c_ll_get_txfifo_len(i2c->dev) < SOC_I2C_FIFO_LEN) { + uint32_t txfifo_len = 0; + i2c_ll_get_txfifo_len(i2c->dev, &txfifo_len); + if (txfifo_len < SOC_I2C_FIFO_LEN) { i2c_ll_txfifo_rst(i2c->dev); } #endif - to_fifo = i2c_ll_get_txfifo_len(i2c->dev); - if(len < to_fifo){ - to_fifo = len; - } - i2c_ll_write_txfifo(i2c->dev, (uint8_t*)buf, to_fifo); - buf += to_fifo; - len -= to_fifo; - //reset tx_queue - xQueueReset(i2c->tx_queue); - //write the rest of the bytes to the queue - if(len){ - to_queue = uxQueueSpacesAvailable(i2c->tx_queue); - if(len < to_queue){ - to_queue = len; + i2c_ll_get_txfifo_len(i2c->dev, &to_fifo); + if(to_fifo){ + if(len < to_fifo){ + to_fifo = len; } - for (size_t i = 0; i < to_queue; i++) { - if (xQueueSend(i2c->tx_queue, &buf[i], timeout_ms / portTICK_RATE_MS) != pdTRUE) { - xQueueReset(i2c->tx_queue); - to_queue = 0; - break; + i2c_ll_write_txfifo(i2c->dev, (uint8_t*)buf, to_fifo); + buf += to_fifo; + len -= to_fifo; + //reset tx_queue + xQueueReset(i2c->tx_queue); + //write the rest of the bytes to the queue + if(len){ + to_queue = uxQueueSpacesAvailable(i2c->tx_queue); + if(len < to_queue){ + to_queue = len; + } + for (size_t i = 0; i < to_queue; i++) { + if (xQueueSend(i2c->tx_queue, &buf[i], timeout_ms / portTICK_RATE_MS) != pdTRUE) { + xQueueReset(i2c->tx_queue); + to_queue = 0; + break; + } + } + //no need to enable TX_EMPTY if tx_queue is empty + if(to_queue){ + i2c_ll_slave_enable_tx_it(i2c->dev); } - } - //no need to enable TX_EMPTY if tx_queue is empty - if(to_queue){ - i2c_ll_slave_enable_tx_it(i2c->dev); } } I2C_SLAVE_MUTEX_UNLOCK(); @@ -434,7 +438,7 @@ static void i2c_slave_free_resources(i2c_slave_struct_t * i2c){ i2c_slave_detach_gpio(i2c); i2c_ll_set_slave_addr(i2c->dev, 0, false); i2c_ll_disable_intr_mask(i2c->dev, I2C_LL_INTR_MASK); - i2c_ll_clr_intsts_mask(i2c->dev, I2C_LL_INTR_MASK); + i2c_ll_clear_intr_mask(i2c->dev, I2C_LL_INTR_MASK); if (i2c->intr_handle) { esp_intr_free(i2c->intr_handle); @@ -485,13 +489,13 @@ static bool i2c_slave_set_frequency(i2c_slave_struct_t * i2c, uint32_t clk_speed uint32_t a = (clk_speed / 50000L) + 2; log_d("Fifo thresholds: rx_fifo_full = %d, tx_fifo_empty = %d", SOC_I2C_FIFO_LEN - a, a); - i2c_clk_cal_t clk_cal; + i2c_hal_clk_config_t clk_cal; #if SOC_I2C_SUPPORT_APB i2c_ll_cal_bus_clk(APB_CLK_FREQ, clk_speed, &clk_cal); - i2c_ll_set_source_clk(i2c->dev, I2C_SCLK_APB); /*!< I2C source clock from APB, 80M*/ + i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_APB); /*!< I2C source clock from APB, 80M*/ #elif SOC_I2C_SUPPORT_XTAL i2c_ll_cal_bus_clk(XTAL_CLK_FREQ, clk_speed, &clk_cal); - i2c_ll_set_source_clk(i2c->dev, I2C_SCLK_XTAL); /*!< I2C source clock from XTAL, 40M */ + i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_XTAL); /*!< I2C source clock from XTAL, 40M */ #endif i2c_ll_set_txfifo_empty_thr(i2c->dev, a); i2c_ll_set_rxfifo_full_thr(i2c->dev, SOC_I2C_FIFO_LEN - a); @@ -630,7 +634,8 @@ static bool i2c_slave_send_event(i2c_slave_struct_t * i2c, i2c_slave_queue_event static bool i2c_slave_handle_tx_fifo_empty(i2c_slave_struct_t * i2c) { bool pxHigherPriorityTaskWoken = false; - uint32_t d = 0, moveCnt = i2c_ll_get_txfifo_len(i2c->dev); + uint32_t d = 0, moveCnt = 0; + i2c_ll_get_txfifo_len(i2c->dev, &moveCnt); while (moveCnt > 0) { // read tx queue until Fifo is full or queue is empty if(xQueueReceiveFromISR(i2c->tx_queue, &d, (BaseType_t * const)&pxHigherPriorityTaskWoken) == pdTRUE){ i2c_ll_write_txfifo(i2c->dev, (uint8_t*)&d, 1); @@ -680,9 +685,11 @@ static void i2c_slave_isr_handler(void* arg) bool pxHigherPriorityTaskWoken = false; i2c_slave_struct_t * i2c = (i2c_slave_struct_t *) arg; // recover data - uint32_t activeInt = i2c_ll_get_intsts_mask(i2c->dev); - i2c_ll_clr_intsts_mask(i2c->dev, activeInt); - uint8_t rx_fifo_len = i2c_ll_get_rxfifo_cnt(i2c->dev); + uint32_t activeInt = 0; + i2c_ll_get_intr_mask(i2c->dev, &activeInt); + i2c_ll_clear_intr_mask(i2c->dev, activeInt); + uint32_t rx_fifo_len = 0; + i2c_ll_get_rxfifo_cnt(i2c->dev, &rx_fifo_len); bool slave_rw = i2c_ll_slave_rw(i2c->dev); if(activeInt & I2C_RXFIFO_WM_INT_ENA){ // RX FiFo Full diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index 4538a7ef076..c3f98e517bb 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -276,24 +276,41 @@ esp_err_t i2cSetClock(uint8_t i2c_num, uint32_t frequency){ #define I2C_CLK_LIMIT_XTAL (40 * 1000 * 1000 / 20) /*!< Limited by RTC, no more than XTAL/20*/ typedef struct { - uint8_t character; /*!< I2C source clock characteristic */ + soc_module_clk_t clk; /*!< I2C source clock */ uint32_t clk_freq; /*!< I2C source clock frequency */ } i2c_clk_alloc_t; + typedef enum { + I2C_SCLK_DEFAULT = 0, /*!< I2C source clock not selected*/ + #if SOC_I2C_SUPPORT_APB + I2C_SCLK_APB, /*!< I2C source clock from APB, 80M*/ + #endif + #if SOC_I2C_SUPPORT_XTAL + I2C_SCLK_XTAL, /*!< I2C source clock from XTAL, 40M */ + #endif + #if SOC_I2C_SUPPORT_RTC + I2C_SCLK_RTC, /*!< I2C source clock from 8M RTC, 8M */ + #endif + #if SOC_I2C_SUPPORT_REF_TICK + I2C_SCLK_REF_TICK, /*!< I2C source clock from REF_TICK, 1M */ + #endif + I2C_SCLK_MAX, + } i2c_sclk_t; + // i2c clock characteristic, The order is the same as i2c_sclk_t. static i2c_clk_alloc_t i2c_clk_alloc[I2C_SCLK_MAX] = { {0, 0}, #if SOC_I2C_SUPPORT_APB - {0, I2C_CLK_LIMIT_APB}, /*!< I2C APB clock characteristic*/ + {SOC_MOD_CLK_APB, I2C_CLK_LIMIT_APB}, /*!< I2C APB clock characteristic*/ #endif #if SOC_I2C_SUPPORT_XTAL - {0, I2C_CLK_LIMIT_XTAL}, /*!< I2C XTAL characteristic*/ + {SOC_MOD_CLK_XTAL, I2C_CLK_LIMIT_XTAL}, /*!< I2C XTAL characteristic*/ #endif #if SOC_I2C_SUPPORT_RTC - {I2C_SCLK_SRC_FLAG_LIGHT_SLEEP | I2C_SCLK_SRC_FLAG_AWARE_DFS, I2C_CLK_LIMIT_RTC}, /*!< I2C 20M RTC characteristic*/ + {SOC_MOD_CLK_RC_FAST, I2C_CLK_LIMIT_RTC}, /*!< I2C 20M RTC characteristic*/ #endif #if SOC_I2C_SUPPORT_REF_TICK - {I2C_SCLK_SRC_FLAG_AWARE_DFS, I2C_CLK_LIMIT_REF_TICK}, /*!< I2C REF_TICK characteristic*/ + {SOC_MOD_CLK_REF_TICK, I2C_CLK_LIMIT_REF_TICK},/*!< I2C REF_TICK characteristic*/ #endif }; @@ -310,13 +327,13 @@ esp_err_t i2cSetClock(uint8_t i2c_num, uint32_t frequency){ break; } } - if(src_clk == I2C_SCLK_MAX){ + if(src_clk == I2C_SCLK_DEFAULT || src_clk == I2C_SCLK_MAX){ log_e("clock source could not be selected"); ret = ESP_FAIL; } else { i2c_hal_context_t hal; hal.dev = I2C_LL_GET_HW(i2c_num); - i2c_hal_set_bus_timing(&(hal), frequency, src_clk); + i2c_hal_set_bus_timing(&(hal), frequency, i2c_clk_alloc[src_clk].clk, i2c_clk_alloc[src_clk].clk_freq); bus[i2c_num].frequency = frequency; //Clock Stretching Timeout: 20b:esp32, 5b:esp32-c3, 24b:esp32-s2 i2c_set_timeout((i2c_port_t)i2c_num, I2C_LL_MAX_TIMEOUT); diff --git a/cores/esp32/esp32-hal-ledc.c b/cores/esp32/esp32-hal-ledc.c index a02431b58fb..22c996ff75b 100644 --- a/cores/esp32/esp32-hal-ledc.c +++ b/cores/esp32/esp32-hal-ledc.c @@ -30,7 +30,7 @@ #define LEDC_DEFAULT_CLK LEDC_AUTO_CLK #endif -#define LEDC_MAX_BIT_WIDTH SOC_LEDC_TIMER_BIT_WIDE_NUM +#define LEDC_MAX_BIT_WIDTH SOC_LEDC_TIMER_BIT_WIDTH /* * LEDC Chan to Group/Channel/Timer Mapping diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 1a71b0e86f9..71530f7631b 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -40,13 +40,13 @@ #include "esp32/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32S2 #include "esp32s2/rom/rtc.h" -#include "driver/temp_sensor.h" +#include "driver/temperature_sensor.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/rtc.h" -#include "driver/temp_sensor.h" +#include "driver/temperature_sensor.h" #elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/rtc.h" -#include "driver/temp_sensor.h" +#include "driver/temperature_sensor.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -64,14 +64,38 @@ float temperatureRead() return (temprature_sens_read() - 32) / 1.8; } #else +static temperature_sensor_handle_t temp_sensor = NULL; + +static bool temperatureReadInit() +{ + static volatile bool initialized = false; + if(!initialized){ + initialized = true; + //Install temperature sensor, expected temp ranger range: 10~50 ℃ + temperature_sensor_config_t temp_sensor_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(10, 50); + if(temperature_sensor_install(&temp_sensor_config, &temp_sensor) != ESP_OK){ + initialized = false; + temp_sensor = NULL; + log_e("temperature_sensor_install failed"); + } + else if(temperature_sensor_enable(temp_sensor) != ESP_OK){ + temperature_sensor_uninstall(temp_sensor); + initialized = false; + temp_sensor = NULL; + log_e("temperature_sensor_enable failed"); + } + } + return initialized; +} + float temperatureRead() { float result = NAN; - temp_sensor_config_t tsens = TSENS_CONFIG_DEFAULT(); - temp_sensor_set_config(tsens); - temp_sensor_start(); - temp_sensor_read_celsius(&result); - temp_sensor_stop(); + if(temperatureReadInit()){ + if(temperature_sensor_get_celsius(temp_sensor, &result) != ESP_OK){ + log_e("temperature_sensor_get_celsius failed"); + } + } return result; } #endif diff --git a/cores/esp32/esp32-hal-periman.c b/cores/esp32/esp32-hal-periman.c new file mode 100644 index 00000000000..a990e3824ef --- /dev/null +++ b/cores/esp32/esp32-hal-periman.c @@ -0,0 +1,93 @@ +/* + * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "esp32-hal-log.h" +#include "esp32-hal-periman.h" +#include "esp_bit_defs.h" + +typedef struct { + peripheral_bus_type_t type; + void * bus; +} peripheral_pin_item_t; + +static peripheral_bus_deinit_cb_t deinit_functions[ESP32_BUS_TYPE_MAX]; +static peripheral_pin_item_t pins[SOC_GPIO_PIN_COUNT]; + +#define GPIO_NOT_VALID(p) ((p >= SOC_GPIO_PIN_COUNT) || ((SOC_GPIO_VALID_GPIO_MASK & (1ULL << p)) == 0)) + +bool perimanSetPinBus(uint8_t pin, peripheral_bus_type_t type, void * bus){ + peripheral_bus_type_t otype = ESP32_BUS_TYPE_INIT; + void * obus = NULL; + if(GPIO_NOT_VALID(pin)){ + log_e("Invalid pin: %u", pin); + return false; + } + if(type >= ESP32_BUS_TYPE_MAX){ + log_e("Invalid type: %u", (unsigned int)type); + return false; + } + if(type > ESP32_BUS_TYPE_GPIO && bus == NULL){ + log_e("Bus is NULL"); + return false; + } + otype = pins[pin].type; + obus = pins[pin].bus; + if(type == otype && bus == obus){ + log_i("Bus already set"); + return true; + } + if(obus != NULL){ + if(deinit_functions[otype] == NULL){ + log_e("Bus does not have deinit function set"); + return false; + } + if(!deinit_functions[otype](obus)){ + log_e("Previous bus failed to deinit"); + return false; + } + } + pins[pin].type = type; + pins[pin].bus = bus; + return true; +} + +void * perimanGetPinBus(uint8_t pin, peripheral_bus_type_t type){ + if(GPIO_NOT_VALID(pin)){ + log_e("Invalid pin: %u", pin); + return NULL; + } + if(type >= ESP32_BUS_TYPE_MAX){ + log_e("Invalid type: %u", (unsigned int)type); + return NULL; + } + if(pins[pin].type == type){ + return pins[pin].bus; + } + return NULL; +} + +peripheral_bus_type_t perimanGetPinBusType(uint8_t pin){ + if(GPIO_NOT_VALID(pin)){ + log_e("Invalid pin: %u", pin); + return ESP32_BUS_TYPE_MAX; + } + return pins[pin].type; +} + +bool perimanSetBusDeinit(peripheral_bus_type_t type, peripheral_bus_deinit_cb_t cb){ + if(type >= ESP32_BUS_TYPE_MAX){ + log_e("Invalid type: %u", (unsigned int)type); + return false; + } + if(cb == NULL){ + log_e("Callback is NULL"); + return false; + } + deinit_functions[type] = cb; + return true; +} + + diff --git a/cores/esp32/esp32-hal-periman.h b/cores/esp32/esp32-hal-periman.h new file mode 100644 index 00000000000..af94d0d061e --- /dev/null +++ b/cores/esp32/esp32-hal-periman.h @@ -0,0 +1,74 @@ +/* + * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "soc/soc_caps.h" +#include +#include +#include + +typedef enum { + ESP32_BUS_TYPE_INIT, // IO has not been attached to a bus yet + ESP32_BUS_TYPE_GPIO, // IO is used as GPIO + ESP32_BUS_TYPE_UART, // IO is used as UART pin +#if SOC_SDM_SUPPORTED + ESP32_BUS_TYPE_SIGMADELTA, // IO is used as SigmeDelta output +#endif +#if SOC_ADC_SUPPORTED + ESP32_BUS_TYPE_ADC_ONESHOT, // IO is used as ADC OneShot input + ESP32_BUS_TYPE_ADC_CONT, // IO is used as ADC continuous input +#endif +#if SOC_DAC_SUPPORTED + ESP32_BUS_TYPE_DAC_ONESHOT, // IO is used as DAC OneShot output + ESP32_BUS_TYPE_DAC_CONT, // IO is used as DAC continuous output + ESP32_BUS_TYPE_DAC_COSINE, // IO is used as DAC cosine output +#endif +#if SOC_LEDC_SUPPORTED + ESP32_BUS_TYPE_LEDC, // IO is used as LEDC output +#endif +#if SOC_RMT_SUPPORTED + ESP32_BUS_TYPE_RMT_TX, // IO is used as RMT output + ESP32_BUS_TYPE_RMT_RX, // IO is used as RMT input +#endif +#if SOC_I2S_SUPPORTED + ESP32_BUS_TYPE_I2S_STD, // IO is used as I2S STD pin + ESP32_BUS_TYPE_I2S_PDM, // IO is used as I2S PDM pin + ESP32_BUS_TYPE_I2S_TDM, // IO is used as I2S TDM pin +#endif +#if SOC_I2C_SUPPORTED + ESP32_BUS_TYPE_I2C_MASTER, // IO is used as I2C master pin + ESP32_BUS_TYPE_I2C_SLAVE, // IO is used as I2C slave pin +#endif +#if SOC_GPSPI_SUPPORTED + ESP32_BUS_TYPE_SPI_MASTER, // IO is used as SPI master pin +#endif +#if SOC_SDMMC_HOST_SUPPORTED + ESP32_BUS_TYPE_SDMMC, // IO is used as SDMMC pin +#endif + ESP32_BUS_TYPE_MAX +} peripheral_bus_type_t; + +typedef bool (*peripheral_bus_deinit_cb_t)(void * bus); + +// Sets the bus type and bus handle for given pin. +bool perimanSetPinBus(uint8_t pin, peripheral_bus_type_t type, void * bus); + +// Returns handle of the bus for the given pin if type of bus matches. NULL otherwise +void * perimanGetPinBus(uint8_t pin, peripheral_bus_type_t type); + +// Returns the type of the bus for the given pin if attached. ESP32_BUS_TYPE_MAX otherwise +peripheral_bus_type_t perimanGetPinBusType(uint8_t pin); + +// Sets the peripheral destructor callback. Used to destroy bus when pin is assigned another function +bool perimanSetBusDeinit(peripheral_bus_type_t type, peripheral_bus_deinit_cb_t cb); + +#ifdef __cplusplus +} +#endif diff --git a/cores/esp32/esp32-hal-psram.c b/cores/esp32/esp32-hal-psram.c index 424499e0058..1e8a681a9ee 100644 --- a/cores/esp32/esp32-hal-psram.c +++ b/cores/esp32/esp32-hal-psram.c @@ -19,21 +19,17 @@ #include "esp_heap_caps.h" #include "esp_system.h" -#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ +#include "esp_psram.h" +#include "esp_private/esp_psram_extram.h" #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 -#include "esp32/spiram.h" +#include "esp32/rom/cache.h" #elif CONFIG_IDF_TARGET_ESP32S2 -#include "esp32s2/spiram.h" #include "esp32s2/rom/cache.h" #elif CONFIG_IDF_TARGET_ESP32S3 -#include "esp32s3/spiram.h" #include "esp32s3/rom/cache.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif -#else // ESP32 Before IDF 4.0 -#include "esp_spiram.h" -#endif static volatile bool spiramDetected = false; static volatile bool spiramFailed = false; @@ -41,7 +37,7 @@ static volatile bool spiramFailed = false; //allows user to bypass SPI RAM test routine __attribute__((weak)) bool testSPIRAM(void) { - return esp_spiram_test(); + return esp_psram_extram_test(); } @@ -66,7 +62,7 @@ bool psramInit(){ esp_config_data_cache_mode(); Cache_Enable_DCache(0); #endif - if (esp_spiram_init() != ESP_OK) { + if (esp_psram_init() != ESP_OK) { spiramFailed = true; log_w("PSRAM init failed!"); #if CONFIG_IDF_TARGET_ESP32 @@ -77,14 +73,14 @@ bool psramInit(){ #endif return false; } - esp_spiram_init_cache(); + //testSPIRAM() allows user to bypass SPI RAM test routine if (!testSPIRAM()) { spiramFailed = true; log_e("PSRAM test failed!"); return false; } - if (esp_spiram_add_to_heapalloc() != ESP_OK) { + if (esp_psram_extram_add_to_heap_allocator() != ESP_OK) { spiramFailed = true; log_e("PSRAM could not be added to the heap!"); return false; diff --git a/cores/esp32/esp32-hal-sigmadelta.c b/cores/esp32/esp32-hal-sigmadelta.c index 82ba1a289fb..12b095e348b 100644 --- a/cores/esp32/esp32-hal-sigmadelta.c +++ b/cores/esp32/esp32-hal-sigmadelta.c @@ -1,89 +1,89 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - +/* + * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "esp32-hal.h" -#include "soc/soc_caps.h" -#include "driver/sigmadelta.h" +#include "esp32-hal-periman.h" -static uint8_t duty_set[SOC_SIGMADELTA_CHANNEL_NUM] = {0}; -static uint32_t prescaler_set[SOC_SIGMADELTA_CHANNEL_NUM] = {0}; +#if SOC_SDM_SUPPORTED +#include "driver/sdm.h" -static void _on_apb_change(void * arg, apb_change_ev_t ev_type, uint32_t old_apb, uint32_t new_apb){ - if(old_apb == new_apb){ - return; +static bool sigmaDeltaDetachBus(void * bus){ + esp_err_t err = sdm_channel_disable((sdm_channel_handle_t)bus); + if(err != ESP_OK){ + log_w("sdm_channel_disable failed with error: %d", err); } - uint32_t iarg = (uint32_t)arg; - uint8_t channel = iarg; - if(ev_type == APB_AFTER_CHANGE){ - old_apb /= 1000000; - new_apb /= 1000000; - uint32_t old_prescale = prescaler_set[channel] + 1; - uint32_t new_prescale = ((new_apb * old_prescale) / old_apb) - 1; - sigmadelta_set_prescale(channel,new_prescale); - prescaler_set[channel] = new_prescale; + err = sdm_del_channel((sdm_channel_handle_t)bus); + if(err != ESP_OK){ + log_e("sdm_del_channel failed with error: %d", err); + return false; } + return true; } -uint32_t sigmaDeltaSetup(uint8_t pin, uint8_t channel, uint32_t freq) //chan 0-x according to SOC, freq 1220-312500 +bool sigmaDeltaAttach(uint8_t pin, uint32_t freq) //freq 1220-312500 { - if(channel >= SOC_SIGMADELTA_CHANNEL_NUM){ - return 0; - } - - uint32_t apb_freq = getApbFrequency(); - uint32_t prescale = (apb_freq/(freq*256)) - 1; - if(prescale > 0xFF) { - prescale = 0xFF; + perimanSetBusDeinit(ESP32_BUS_TYPE_SIGMADELTA, sigmaDeltaDetachBus); + sdm_channel_handle_t bus = (sdm_channel_handle_t)perimanGetPinBus(pin, ESP32_BUS_TYPE_SIGMADELTA); + if(bus != NULL && !perimanSetPinBus(pin, ESP32_BUS_TYPE_INIT, NULL)){ + return false; } - - sigmadelta_config_t sigmadelta_cfg = { - .channel = channel, - .sigmadelta_prescale = prescale, - .sigmadelta_duty = 0, - .sigmadelta_gpio = pin, + bus = NULL; + sdm_config_t config = { + .gpio_num = (int)pin, + .clk_src = SDM_CLK_SRC_DEFAULT, + .sample_rate_hz = freq, + .flags = { + .invert_out = 0, + .io_loop_back = 0 + } }; - sigmadelta_config(&sigmadelta_cfg); - - prescaler_set[channel] = prescale; - uint32_t iarg = channel; - addApbChangeCallback((void*)iarg, _on_apb_change); - - return apb_freq/((prescale + 1) * 256); + esp_err_t err = sdm_new_channel(&config, &bus); + if(err != ESP_OK){ + log_e("sdm_new_channel failed with error: %d", err); + return false; + } + err = sdm_channel_enable(bus); + if(err != ESP_OK){ + sigmaDeltaDetachBus((void *)bus); + log_e("sdm_channel_enable failed with error: %d", err); + return false; + } + if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_SIGMADELTA, (void *)bus)){ + sigmaDeltaDetachBus((void *)bus); + return false; + } + return true; } -void sigmaDeltaWrite(uint8_t channel, uint8_t duty) //chan 0-x according to SOC duty 8 bit +bool sigmaDeltaWrite(uint8_t pin, uint8_t duty) //chan 0-x according to SOC duty 8 bit { - if(channel >= SOC_SIGMADELTA_CHANNEL_NUM){ - return; + sdm_channel_handle_t bus = (sdm_channel_handle_t)perimanGetPinBus(pin, ESP32_BUS_TYPE_SIGMADELTA); + if(bus != NULL){ + int8_t d = duty - 128; + esp_err_t err = sdm_channel_set_duty(bus, d); + if(err != ESP_OK){ + log_e("sdm_channel_set_duty failed with error: %d", err); + return false; + } + return true; + } else { + log_e("pin %u is not attached to SigmaDelta", pin); } - duty -= 128; - - sigmadelta_set_duty(channel,duty); - duty_set[channel] = duty; + return false; } -uint8_t sigmaDeltaRead(uint8_t channel) //chan 0-x according to SOC +bool sigmaDeltaDetach(uint8_t pin) { - if(channel >= SOC_SIGMADELTA_CHANNEL_NUM){ - return 0; + void * bus = perimanGetPinBus(pin, ESP32_BUS_TYPE_SIGMADELTA); + if(bus != NULL){ + // will call sigmaDeltaDetachBus + return perimanSetPinBus(pin, ESP32_BUS_TYPE_INIT, NULL); + } else { + log_e("pin %u is not attached to SigmaDelta"); } - return duty_set[channel]+128; + return false; } - -void sigmaDeltaDetachPin(uint8_t pin) -{ - pinMatrixOutDetach(pin, false, false); -} \ No newline at end of file +#endif diff --git a/cores/esp32/esp32-hal-sigmadelta.h b/cores/esp32/esp32-hal-sigmadelta.h index 0a526e8d513..bca2c532018 100644 --- a/cores/esp32/esp32-hal-sigmadelta.h +++ b/cores/esp32/esp32-hal-sigmadelta.h @@ -1,36 +1,27 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +/* + * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _ESP32_HAL_SD_H_ -#define _ESP32_HAL_SD_H_ +#pragma once #ifdef __cplusplus extern "C" { #endif +#include "soc/soc_caps.h" +#if SOC_SDM_SUPPORTED + #include #include -//channel 0-7 freq 1220-312500 duty 0-255 -uint32_t sigmaDeltaSetup(uint8_t pin, uint8_t channel, uint32_t freq); -void sigmaDeltaWrite(uint8_t channel, uint8_t duty); -uint8_t sigmaDeltaRead(uint8_t channel); -void sigmaDeltaDetachPin(uint8_t pin); - +//freq 1220-312500 duty 0-255 +bool sigmaDeltaAttach(uint8_t pin, uint32_t freq); +bool sigmaDeltaWrite(uint8_t pin, uint8_t duty); +bool sigmaDeltaDetach(uint8_t pin); +#endif #ifdef __cplusplus } #endif - -#endif /* _ESP32_HAL_SD_H_ */ diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 16ff3b65d10..7eb475c5e73 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -23,7 +23,7 @@ #include "soc/io_mux_reg.h" #include "soc/gpio_sig_map.h" #include "soc/rtc.h" -#include "driver/periph_ctrl.h" +#include "hal/clk_gate_ll.h" #include "esp_system.h" #ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ @@ -729,11 +729,11 @@ spi_t * spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_ } #elif CONFIG_IDF_TARGET_ESP32S3 if(spi_num == FSPI) { - periph_module_reset( PERIPH_SPI2_MODULE ); - periph_module_enable( PERIPH_SPI2_MODULE ); + periph_ll_reset( PERIPH_SPI2_MODULE ); + periph_ll_enable_clk_clear_rst( PERIPH_SPI2_MODULE ); } else if(spi_num == HSPI) { - periph_module_reset( PERIPH_SPI3_MODULE ); - periph_module_enable( PERIPH_SPI3_MODULE ); + periph_ll_reset( PERIPH_SPI3_MODULE ); + periph_ll_enable_clk_clear_rst( PERIPH_SPI3_MODULE ); } #elif CONFIG_IDF_TARGET_ESP32 if(spi_num == HSPI) { @@ -747,8 +747,8 @@ spi_t * spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_ DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_SPI01_RST); } #elif CONFIG_IDF_TARGET_ESP32C3 - periph_module_reset( PERIPH_SPI2_MODULE ); - periph_module_enable( PERIPH_SPI2_MODULE ); + periph_ll_reset( PERIPH_SPI2_MODULE ); + periph_ll_enable_clk_clear_rst( PERIPH_SPI2_MODULE ); #endif SPI_MUTEX_LOCK(); @@ -1515,11 +1515,11 @@ uint32_t spiFrequencyToClockDiv(uint32_t freq) uint8_t calN = 1; spiClk_t bestReg = { 0 }; - int32_t bestFreq = 0; + uint32_t bestFreq = 0; while(calN <= 0x3F) { spiClk_t reg = { 0 }; - int32_t calFreq; + uint32_t calFreq; int32_t calPre; int8_t calPreVari = -2; @@ -1541,11 +1541,11 @@ uint32_t spiFrequencyToClockDiv(uint32_t freq) } reg.clkcnt_l = ((reg.clkcnt_n + 1) / 2); calFreq = ClkRegToFreq(®); - if(calFreq == (int32_t) freq) { + if(calFreq == freq) { memcpy(&bestReg, ®, sizeof(bestReg)); break; - } else if(calFreq < (int32_t) freq) { - if(abs(freq - calFreq) < abs(freq - bestFreq)) { + } else if(calFreq < freq) { + if((freq - calFreq) < (freq - bestFreq)) { bestFreq = calFreq; memcpy(&bestReg, ®, sizeof(bestReg)); } diff --git a/cores/esp32/esp32-hal-timer.c b/cores/esp32/esp32-hal-timer.c index b6552b89377..87f48e5409c 100644 --- a/cores/esp32/esp32-hal-timer.c +++ b/cores/esp32/esp32-hal-timer.c @@ -221,11 +221,15 @@ bool IRAM_ATTR timerFnWrapper(void *arg){ return false; } -void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge){ +void timerAttachInterruptFlag(hw_timer_t *timer, void (*fn)(void), bool edge, int intr_alloc_flags){ if(edge){ log_w("EDGE timer interrupt is not supported! Setting to LEVEL..."); } - timer_isr_callback_add(timer->group, timer->num, timerFnWrapper, fn, 0); + timer_isr_callback_add(timer->group, timer->num, timerFnWrapper, fn, intr_alloc_flags); +} + +void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge){ + timerAttachInterruptFlag(timer, fn, edge, 0); } void timerDetachInterrupt(hw_timer_t *timer){ diff --git a/cores/esp32/esp32-hal-timer.h b/cores/esp32/esp32-hal-timer.h index 5bbed623586..5f0413b7445 100644 --- a/cores/esp32/esp32-hal-timer.h +++ b/cores/esp32/esp32-hal-timer.h @@ -36,6 +36,7 @@ void timerEnd(hw_timer_t *timer); void timerSetConfig(hw_timer_t *timer, uint32_t config); uint32_t timerGetConfig(hw_timer_t *timer); +void timerAttachInterruptFlag(hw_timer_t *timer, void (*fn)(void), bool edge, int intr_alloc_flags); void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge); void timerDetachInterrupt(hw_timer_t *timer); diff --git a/cores/esp32/esp32-hal-tinyusb.c b/cores/esp32/esp32-hal-tinyusb.c index 8bf9932d2e4..ebd65edce82 100644 --- a/cores/esp32/esp32-hal-tinyusb.c +++ b/cores/esp32/esp32-hal-tinyusb.c @@ -18,17 +18,17 @@ #include "soc/timer_group_struct.h" #include "soc/system_reg.h" +#include "rom/gpio.h" + #include "hal/usb_hal.h" #include "hal/gpio_ll.h" +#include "hal/clk_gate_ll.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/gpio.h" -#include "driver/periph_ctrl.h" -#include "esp_efuse.h" -#include "esp_efuse_table.h" #include "esp_rom_gpio.h" #include "esp32-hal.h" @@ -395,9 +395,9 @@ static void hw_cdc_reset_handler(void *arg) { static void usb_switch_to_cdc_jtag(){ // Disable USB-OTG - periph_module_reset(PERIPH_USB_MODULE); - //periph_module_enable(PERIPH_USB_MODULE); - periph_module_disable(PERIPH_USB_MODULE); + periph_ll_reset(PERIPH_USB_MODULE); + //periph_ll_enable_clk_clear_rst(PERIPH_USB_MODULE); + periph_ll_disable_clk_set_rst(PERIPH_USB_MODULE); // Switch to hardware CDC+JTAG CLEAR_PERI_REG_MASK(RTC_CNTL_USB_CONF_REG, (RTC_CNTL_SW_HW_USB_PHY_SEL|RTC_CNTL_SW_USB_PHY_SEL|RTC_CNTL_USB_PAD_ENABLE)); @@ -457,8 +457,8 @@ static void IRAM_ATTR usb_persist_shutdown_handler(void) chip_usb_set_persist_flags(USBDC_PERSIST_ENA); #if CONFIG_IDF_TARGET_ESP32S2 } else { - periph_module_reset(PERIPH_USB_MODULE); - periph_module_enable(PERIPH_USB_MODULE); + periph_ll_reset(PERIPH_USB_MODULE); + periph_ll_enable_clk_clear_rst(PERIPH_USB_MODULE); #endif } REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT); @@ -696,8 +696,8 @@ esp_err_t tinyusb_init(tinyusb_device_config_t *config) { //} else if(!usb_did_persist || !usb_persist_enabled){ // Reset USB module - periph_module_reset(PERIPH_USB_MODULE); - periph_module_enable(PERIPH_USB_MODULE); + periph_ll_reset(PERIPH_USB_MODULE); + periph_ll_enable_clk_clear_rst(PERIPH_USB_MODULE); } tinyusb_config_t tusb_cfg = { diff --git a/cores/esp32/esp32-hal-touch.c b/cores/esp32/esp32-hal-touch.c index 476df60850c..3c929de363f 100644 --- a/cores/esp32/esp32-hal-touch.c +++ b/cores/esp32/esp32-hal-touch.c @@ -91,7 +91,12 @@ static void __touchSetCycles(uint16_t measure, uint16_t sleep) { __touchSleepCycles = sleep; __touchMeasureCycles = measure; - touch_pad_set_meas_time(sleep, measure); +#if SOC_TOUCH_VERSION_1 // ESP32 + touch_pad_set_measurement_clock_cycles(measure); +#elif SOC_TOUCH_VERSION_2 // ESP32S2, ESP32S3 + touch_pad_set_charge_discharge_times(measure); +#endif + touch_pad_set_measurement_interval(sleep); } @@ -112,7 +117,8 @@ static void __touchInit() } // the next two lines will drive the touch reading values -- both will return ESP_OK touch_pad_set_voltage(TOUCH_HVOLT_2V7, TOUCH_LVOLT_0V5, TOUCH_HVOLT_ATTEN_0V); - touch_pad_set_meas_time(__touchMeasureCycles, __touchSleepCycles); + touch_pad_set_measurement_clock_cycles(__touchMeasureCycles); + touch_pad_set_measurement_interval(__touchSleepCycles); // Touch Sensor Timer initiated touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); // returns ESP_OK err = touch_pad_filter_start(10); @@ -131,7 +137,8 @@ static void __touchInit() goto err; } // the next lines will drive the touch reading values -- all os them return ESP_OK - touch_pad_set_meas_time(__touchSleepCycles, __touchMeasureCycles); + touch_pad_set_charge_discharge_times(__touchMeasureCycles); + touch_pad_set_measurement_interval(__touchSleepCycles); touch_pad_set_voltage(TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD); touch_pad_set_idle_channel_connect(TOUCH_PAD_IDLE_CH_CONNECT_DEFAULT); touch_pad_denoise_t denoise = { diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index e6247bc893c..2cd8e340cbb 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -23,6 +23,8 @@ #include "soc/soc_caps.h" #include "soc/uart_struct.h" #include "soc/uart_periph.h" +#include "rom/ets_sys.h" +#include "rom/gpio.h" #include "driver/gpio.h" #include "hal/gpio_hal.h" @@ -458,18 +460,26 @@ void uartSetBaudRate(uart_t* uart, uint32_t baud_rate) return; } UART_MUTEX_LOCK(); - uart_ll_set_baudrate(UART_LL_GET_HW(uart->num), _get_effective_baudrate(baud_rate)); + uint32_t sclk_freq; + if(uart_get_sclk_freq(UART_SCLK_DEFAULT, &sclk_freq) == ESP_OK){ + uart_ll_set_baudrate(UART_LL_GET_HW(uart->num), _get_effective_baudrate(baud_rate), sclk_freq); + } UART_MUTEX_UNLOCK(); } uint32_t uartGetBaudRate(uart_t* uart) { + uint32_t baud_rate = 0; + uint32_t sclk_freq; + if(uart == NULL) { return 0; } UART_MUTEX_LOCK(); - uint32_t baud_rate = uart_ll_get_baudrate(UART_LL_GET_HW(uart->num)); + if(uart_get_sclk_freq(UART_SCLK_DEFAULT, &sclk_freq) == ESP_OK){ + baud_rate = uart_ll_get_baudrate(UART_LL_GET_HW(uart->num), sclk_freq); + } UART_MUTEX_UNLOCK(); return baud_rate; } @@ -786,7 +796,7 @@ void uart_send_break(uint8_t uartNum) // This is very sensetive timing... it works fine for SERIAL_8N1 uint32_t breakTime = (uint32_t) (10.0 * (1000000.0 / currentBaudrate)); uart_set_line_inverse(uartNum, UART_SIGNAL_TXD_INV); - ets_delay_us(breakTime); + esp_rom_delay_us(breakTime); uart_set_line_inverse(uartNum, UART_SIGNAL_INV_DISABLE); } diff --git a/cores/esp32/wiring_pulse.c b/cores/esp32/wiring_pulse.c index cb3e946d6cc..8c55e7258ef 100644 --- a/cores/esp32/wiring_pulse.c +++ b/cores/esp32/wiring_pulse.c @@ -17,11 +17,11 @@ //#include #include "wiring_private.h" #include "pins_arduino.h" -#include +#include "esp_cpu.h" #define WAIT_FOR_PIN_STATE(state) \ while (digitalRead(pin) != (state)) { \ - if (cpu_hal_get_cycle_count() - start_cycle_count > timeout_cycles) { \ + if (esp_cpu_get_cycle_count() - start_cycle_count > timeout_cycles) { \ return 0; \ } \ } @@ -34,12 +34,12 @@ unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) timeout = max_timeout_us; } const uint32_t timeout_cycles = microsecondsToClockCycles(timeout); - const uint32_t start_cycle_count = cpu_hal_get_cycle_count(); + const uint32_t start_cycle_count = esp_cpu_get_cycle_count(); WAIT_FOR_PIN_STATE(!state); WAIT_FOR_PIN_STATE(state); - const uint32_t pulse_start_cycle_count = cpu_hal_get_cycle_count(); + const uint32_t pulse_start_cycle_count = esp_cpu_get_cycle_count(); WAIT_FOR_PIN_STATE(!state); - return clockCyclesToMicroseconds(cpu_hal_get_cycle_count() - pulse_start_cycle_count); + return clockCyclesToMicroseconds(esp_cpu_get_cycle_count() - pulse_start_cycle_count); } unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout) diff --git a/docs/source/api/sigmadelta.rst b/docs/source/api/sigmadelta.rst index d5036a38487..537c5894d6c 100644 --- a/docs/source/api/sigmadelta.rst +++ b/docs/source/api/sigmadelta.rst @@ -28,7 +28,7 @@ This function is used to setup the SigmaDelta channel frequency and resolution. .. code-block:: arduino - double ledcSetup(uint8_t channel, double freq, uint8_t resolution_bits); + uint32_t sigmaDeltaSetup(uint8_t pin, uint8_t channel, uint32_t freq); * ``pin`` select GPIO pin. * ``channel`` select SigmaDelta channel. diff --git a/libraries/ArduinoOTA/src/ArduinoOTA.cpp b/libraries/ArduinoOTA/src/ArduinoOTA.cpp index fe85580f566..f7ad9105813 100644 --- a/libraries/ArduinoOTA/src/ArduinoOTA.cpp +++ b/libraries/ArduinoOTA/src/ArduinoOTA.cpp @@ -287,7 +287,7 @@ void ArduinoOTAClass::_runUpdate() { if (!waited){ if(written && tried++ < 3){ log_i("Try[%u]: %u", tried, written); - if(!client.printf("%u", written)){ + if(!client.printf("%lu", written)){ log_e("failed to respond"); _state = OTA_IDLE; break; @@ -322,7 +322,7 @@ void ArduinoOTAClass::_runUpdate() { if(written != r){ log_w("didn't write enough! %u != %u", written, r); } - if(!client.printf("%u", written)){ + if(!client.printf("%lu", written)){ log_w("failed to respond"); } total += written; diff --git a/libraries/AsyncUDP/src/AsyncUDP.cpp b/libraries/AsyncUDP/src/AsyncUDP.cpp index 069cce7ba82..92f9e2a827b 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.cpp +++ b/libraries/AsyncUDP/src/AsyncUDP.cpp @@ -15,6 +15,28 @@ extern "C" { #include "lwip/priv/tcpip_priv.h" +static const char * netif_ifkeys[TCPIP_ADAPTER_IF_MAX] = { + "WIFI_STA_DEF", "WIFI_AP_DEF", "ETH_DEF", "PPP_DEF" +}; + +static esp_err_t tcpip_adapter_get_netif(tcpip_adapter_if_t tcpip_if, void ** netif){ + *netif = NULL; + if(tcpip_if < TCPIP_ADAPTER_IF_MAX){ + esp_netif_t *esp_netif = esp_netif_get_handle_from_ifkey(netif_ifkeys[tcpip_if]); + if(esp_netif == NULL){ + return ESP_FAIL; + } + int netif_index = esp_netif_get_netif_impl_index(esp_netif); + if(netif_index < 0){ + return ESP_FAIL; + } + *netif = (void*)netif_get_by_index(netif_index); + } else { + *netif = netif_default; + } + return (*netif != NULL)?ESP_OK:ESP_FAIL; +} + typedef struct { struct tcpip_api_call_data call; udp_pcb * pcb; diff --git a/libraries/AsyncUDP/src/AsyncUDP.h b/libraries/AsyncUDP/src/AsyncUDP.h index be04c01ffaa..963a67e3a6c 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.h +++ b/libraries/AsyncUDP/src/AsyncUDP.h @@ -8,10 +8,20 @@ #include extern "C" { #include "esp_netif.h" +#include "lwip/ip_addr.h" #include "freertos/queue.h" #include "freertos/semphr.h" } +// This enum and it's uses are copied and adapted for compatibility from ESP-IDF 4- +typedef enum { + TCPIP_ADAPTER_IF_STA = 0, /**< Wi-Fi STA (station) interface */ + TCPIP_ADAPTER_IF_AP, /**< Wi-Fi soft-AP interface */ + TCPIP_ADAPTER_IF_ETH, /**< Ethernet interface */ + TCPIP_ADAPTER_IF_PPP, /**< PPP interface */ + TCPIP_ADAPTER_IF_MAX +} tcpip_adapter_if_t; + class AsyncUDP; class AsyncUDPPacket; class AsyncUDPMessage; diff --git a/libraries/BLE/examples/BLE5_multi_advertising/BLE5_multi_advertising.ino b/libraries/BLE/examples/BLE5_multi_advertising/BLE5_multi_advertising.ino index 217c2ed3bc4..ddd282aea7b 100644 --- a/libraries/BLE/examples/BLE5_multi_advertising/BLE5_multi_advertising.ino +++ b/libraries/BLE/examples/BLE5_multi_advertising/BLE5_multi_advertising.ino @@ -15,7 +15,10 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_1M = { .interval_max = 0x30, .channel_map = ADV_CHNL_ALL, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr = {0,0,0,0,0,0}, .filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, .primary_phy = ESP_BLE_GAP_PHY_CODED, .max_skip = 0, .secondary_phy = ESP_BLE_GAP_PHY_1M, @@ -29,7 +32,10 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_2M = { .interval_max = 0x40, .channel_map = ADV_CHNL_ALL, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr = {0,0,0,0,0,0}, .filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, .primary_phy = ESP_BLE_GAP_PHY_1M, .max_skip = 0, .secondary_phy = ESP_BLE_GAP_PHY_2M, @@ -43,7 +49,10 @@ esp_ble_gap_ext_adv_params_t legacy_adv_params = { .interval_max = 0x45, .channel_map = ADV_CHNL_ALL, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr = {0,0,0,0,0,0}, .filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, .primary_phy = ESP_BLE_GAP_PHY_1M, .max_skip = 0, .secondary_phy = ESP_BLE_GAP_PHY_1M, @@ -57,7 +66,10 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_coded = { .interval_max = 0x50, .channel_map = ADV_CHNL_ALL, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr = {0,0,0,0,0,0}, .filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, .primary_phy = ESP_BLE_GAP_PHY_1M, .max_skip = 0, .secondary_phy = ESP_BLE_GAP_PHY_CODED, diff --git a/libraries/BLE/examples/BLE5_periodic_advertising/BLE5_periodic_advertising.ino b/libraries/BLE/examples/BLE5_periodic_advertising/BLE5_periodic_advertising.ino index 1b36bbb8b54..26f686cd1bd 100644 --- a/libraries/BLE/examples/BLE5_periodic_advertising/BLE5_periodic_advertising.ino +++ b/libraries/BLE/examples/BLE5_periodic_advertising/BLE5_periodic_advertising.ino @@ -15,7 +15,10 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_2M = { .interval_max = 0x40, .channel_map = ADV_CHNL_ALL, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr_type = BLE_ADDR_TYPE_RANDOM, + .peer_addr = {0,0,0,0,0,0}, .filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, .primary_phy = ESP_BLE_GAP_PHY_1M, .max_skip = 0, .secondary_phy = ESP_BLE_GAP_PHY_2M, diff --git a/libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino b/libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino index fdc25b394a2..98cb1e8a3bc 100644 --- a/libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino +++ b/libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino @@ -21,6 +21,7 @@ static esp_ble_gap_periodic_adv_sync_params_t periodic_adv_sync_params = { .filter_policy = 0, .sid = 0, .addr_type = BLE_ADDR_TYPE_RANDOM, + .addr = {0,0,0,0,0,0}, .skip = 10, .sync_timeout = 1000, // timeout: 1000 * 10ms }; diff --git a/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.ino b/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.ino index b46baa7c84e..d7d00abb729 100644 --- a/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.ino +++ b/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.ino @@ -118,8 +118,8 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks int temp = (int)payLoad[16] + (int)(payLoad[15] << 8); float calcTemp = temp / 256.0f; Serial.printf("Reported temperature from data: %.2fC\n", calcTemp); - Serial.printf("Reported advertise count: %d\n", foundEddyURL.getCount()); - Serial.printf("Reported time since last reboot: %ds\n", foundEddyURL.getTime()); + Serial.printf("Reported advertise count: %lu\n", foundEddyURL.getCount()); + Serial.printf("Reported time since last reboot: %lus\n", foundEddyURL.getTime()); Serial.println("\n"); Serial.print(foundEddyURL.toString().c_str()); Serial.println("\n"); diff --git a/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.ino b/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.ino index 96be28cd588..ea6d5ca0b72 100644 --- a/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.ino +++ b/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.ino @@ -86,9 +86,9 @@ void setup() Serial.begin(115200); gettimeofday(&nowTimeStruct, NULL); - Serial.printf("start ESP32 %d\n", bootcount++); + Serial.printf("start ESP32 %lu\n", bootcount++); - Serial.printf("deep sleep (%lds since last reset, %lds since last boot)\n", nowTimeStruct.tv_sec, nowTimeStruct.tv_sec - last); + Serial.printf("deep sleep (%llds since last reset, %llds since last boot)\n", nowTimeStruct.tv_sec, nowTimeStruct.tv_sec - last); last = nowTimeStruct.tv_sec; lastTenth = nowTimeStruct.tv_sec * 10; // Time since last reset as 0.1 second resolution counter diff --git a/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.ino b/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.ino index 335ea1ffbe6..d3938ee02fa 100644 --- a/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.ino +++ b/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.ino @@ -160,9 +160,9 @@ void setup() Serial.begin(115200); gettimeofday(&now, NULL); - Serial.printf("start ESP32 %d\n", bootcount++); + Serial.printf("start ESP32 %lu\n", bootcount++); - Serial.printf("deep sleep (%lds since last reset, %lds since last boot)\n", now.tv_sec, now.tv_sec - last); + Serial.printf("deep sleep (%llds since last reset, %llds since last boot)\n", now.tv_sec, now.tv_sec - last); last = now.tv_sec; diff --git a/libraries/BLE/examples/BLE_client/BLE_client.ino b/libraries/BLE/examples/BLE_client/BLE_client.ino index 5d39c109709..74ae8b7532d 100644 --- a/libraries/BLE/examples/BLE_client/BLE_client.ino +++ b/libraries/BLE/examples/BLE_client/BLE_client.ino @@ -29,7 +29,8 @@ static void notifyCallback( Serial.print(" of data length "); Serial.println(length); Serial.print("data: "); - Serial.println((char*)pData); + Serial.write(pData, length); + Serial.println(); } class MyClientCallback : public BLEClientCallbacks { diff --git a/libraries/BLE/src/BLEEddystoneTLM.cpp b/libraries/BLE/src/BLEEddystoneTLM.cpp index 10cc657a23c..4469e4d5ca5 100644 --- a/libraries/BLE/src/BLEEddystoneTLM.cpp +++ b/libraries/BLE/src/BLEEddystoneTLM.cpp @@ -78,30 +78,30 @@ std::string BLEEddystoneTLM::toString() { out += " C\n"; out += "Adv. Count "; - snprintf(val, sizeof(val), "%d", ENDIAN_CHANGE_U32(m_eddystoneData.advCount)); + snprintf(val, sizeof(val), "%ld", ENDIAN_CHANGE_U32(m_eddystoneData.advCount)); out += val; out += "\n"; out += "Time in seconds "; - snprintf(val, sizeof(val), "%d", rawsec/10); + snprintf(val, sizeof(val), "%ld", rawsec/10); out += val; out += "\n"; out += "Time "; - snprintf(val, sizeof(val), "%04d", rawsec / 864000); + snprintf(val, sizeof(val), "%04ld", rawsec / 864000); out += val; out += "."; - snprintf(val, sizeof(val), "%02d", (rawsec / 36000) % 24); + snprintf(val, sizeof(val), "%02ld", (rawsec / 36000) % 24); out += val; out += ":"; - snprintf(val, sizeof(val), "%02d", (rawsec / 600) % 60); + snprintf(val, sizeof(val), "%02ld", (rawsec / 600) % 60); out += val; out += ":"; - snprintf(val, sizeof(val), "%02d", (rawsec / 10) % 60); + snprintf(val, sizeof(val), "%02ld", (rawsec / 10) % 60); out += val; out += "\n"; diff --git a/libraries/BLE/src/BLEUUID.cpp b/libraries/BLE/src/BLEUUID.cpp index 45f698afb3a..3cbb34a5271 100644 --- a/libraries/BLE/src/BLEUUID.cpp +++ b/libraries/BLE/src/BLEUUID.cpp @@ -359,7 +359,7 @@ std::string BLEUUID::toString() { if (m_uuid.len == ESP_UUID_LEN_32) { // If the UUID is 32bit, pad correctly. char hex[9]; - snprintf(hex, sizeof(hex), "%08x", m_uuid.uuid.uuid32); + snprintf(hex, sizeof(hex), "%08lx", m_uuid.uuid.uuid32); return std::string(hex) + "-0000-1000-8000-00805f9b34fb"; } // End 32bit UUID diff --git a/libraries/BLE/src/FreeRTOS.cpp b/libraries/BLE/src/FreeRTOS.cpp index 115ef272c19..bab471dc44a 100644 --- a/libraries/BLE/src/FreeRTOS.cpp +++ b/libraries/BLE/src/FreeRTOS.cpp @@ -236,7 +236,7 @@ bool FreeRTOS::Semaphore::take(uint32_t timeoutMs, std::string owner) { std::string FreeRTOS::Semaphore::toString() { char hex[9]; std::string res = "name: " + m_name + " (0x"; - snprintf(hex, sizeof(hex), "%08x", (uint32_t)m_semaphore); + snprintf(hex, sizeof(hex), "%08lx", (uint32_t)m_semaphore); res += hex; res += "), owner: " + m_owner; return res; diff --git a/libraries/BLE/src/GeneralUtils.cpp b/libraries/BLE/src/GeneralUtils.cpp index e1e5cca879f..8eef970faff 100644 --- a/libraries/BLE/src/GeneralUtils.cpp +++ b/libraries/BLE/src/GeneralUtils.cpp @@ -18,6 +18,7 @@ #include #include #include +#include "esp_chip_info.h" #include "esp32-hal-log.h" static const char kBase64Alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" diff --git a/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp b/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp index 8a9e26e4d5a..94d3dc1de73 100644 --- a/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp +++ b/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp @@ -42,7 +42,7 @@ std::string BTAdvertisedDeviceSet::toString() { std::string res = "Name: " + getName() + ", Address: " + getAddress().toString(); if (haveCOD()) { char val[6]; - snprintf(val, sizeof(val), "%d", getCOD()); + snprintf(val, sizeof(val), "%ld", getCOD()); res += ", cod: "; res += val; } diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.cpp b/libraries/BluetoothSerial/src/BluetoothSerial.cpp index 800ef97e68c..9ba94f17644 100644 --- a/libraries/BluetoothSerial/src/BluetoothSerial.cpp +++ b/libraries/BluetoothSerial/src/BluetoothSerial.cpp @@ -54,7 +54,7 @@ static TaskHandle_t _spp_task_handle = NULL; static EventGroupHandle_t _spp_event_group = NULL; static EventGroupHandle_t _bt_event_group = NULL; static boolean secondConnectionAttempt; -static esp_spp_cb_t custom_spp_callback = NULL; +static esp_spp_cb_t * custom_spp_callback = NULL; static BluetoothSerialDataCb custom_data_callback = NULL; static esp_bd_addr_t current_bd_addr; static ConfirmRequestCb confirm_request_callback = NULL; @@ -673,7 +673,9 @@ static bool _init_bt(const char *deviceName) return false; } - if (esp_spp_init(ESP_SPP_MODE_CB) != ESP_OK){ + esp_spp_cfg_t cfg = BT_SPP_DEFAULT_CONFIG(); + cfg.mode = ESP_SPP_MODE_CB; + if (esp_spp_enhanced_init(&cfg) != ESP_OK){ log_e("spp init failed"); return false; } @@ -886,7 +888,7 @@ void BluetoothSerial::confirmReply(boolean confirm) } -esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t callback) +esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t * callback) { custom_spp_callback = callback; return ESP_OK; diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.h b/libraries/BluetoothSerial/src/BluetoothSerial.h index 4b225239333..0c087b06360 100644 --- a/libraries/BluetoothSerial/src/BluetoothSerial.h +++ b/libraries/BluetoothSerial/src/BluetoothSerial.h @@ -53,7 +53,7 @@ class BluetoothSerial: public Stream void end(void); void setTimeout(int timeoutMS); void onData(BluetoothSerialDataCb cb); - esp_err_t register_callback(esp_spp_cb_t callback); + esp_err_t register_callback(esp_spp_cb_t * callback); void onConfirmRequest(ConfirmRequestCb cb); void onAuthComplete(AuthCompleteCb cb); diff --git a/libraries/EEPROM/examples/eeprom_extra/eeprom_extra.ino b/libraries/EEPROM/examples/eeprom_extra/eeprom_extra.ino index 5ae01fb2268..ba062bca046 100644 --- a/libraries/EEPROM/examples/eeprom_extra/eeprom_extra.ino +++ b/libraries/EEPROM/examples/eeprom_extra/eeprom_extra.ino @@ -107,14 +107,14 @@ void setup() { value = 0; value = EEPROM.readLong64(value); - Serial.printf("0x%08X", (uint32_t)(value >> 32)); // Print High 4 bytes in HEX - Serial.printf("%08X\n", (uint32_t)value); // Print Low 4 bytes in HEX + Serial.printf("0x%08lX", (uint32_t)(value >> 32)); // Print High 4 bytes in HEX + Serial.printf("%08lX\n", (uint32_t)value); // Print Low 4 bytes in HEX address += sizeof(int64_t); Value = 0; // Clear Value Value = EEPROM.readULong64(Value); - Serial.printf("0x%08X", (uint32_t)(Value >> 32)); // Print High 4 bytes in HEX - Serial.printf("%08X\n", (uint32_t)Value); // Print Low 4 bytes in HEX + Serial.printf("0x%08lX", (uint32_t)(Value >> 32)); // Print High 4 bytes in HEX + Serial.printf("%08lX\n", (uint32_t)Value); // Print Low 4 bytes in HEX address += sizeof(uint64_t); Serial.println(EEPROM.readFloat(address), 4); diff --git a/libraries/ESP32/examples/AnalogOut/SigmaDelta/SigmaDelta.ino b/libraries/ESP32/examples/AnalogOut/SigmaDelta/SigmaDelta.ino index 6520815a113..261263fa98e 100644 --- a/libraries/ESP32/examples/AnalogOut/SigmaDelta/SigmaDelta.ino +++ b/libraries/ESP32/examples/AnalogOut/SigmaDelta/SigmaDelta.ino @@ -1,9 +1,9 @@ void setup() { - //setup on pin 18, channel 0 with frequency 312500 Hz - sigmaDeltaSetup(18,0, 312500); - //initialize channel 0 to off - sigmaDeltaWrite(0, 0); + //setup on pin 18 with frequency 312500 Hz + sigmaDeltaAttach(18, 312500); + //set pin 18 to off + sigmaDeltaWrite(18, 0); } void loop() @@ -11,6 +11,6 @@ void loop() //slowly ramp-up the value //will overflow at 256 static uint8_t i = 0; - sigmaDeltaWrite(0, i++); + sigmaDeltaWrite(18, i++); delay(100); } diff --git a/libraries/ESP32/examples/AnalogOut/ledcFrequency/ledcFrequency.ino b/libraries/ESP32/examples/AnalogOut/ledcFrequency/ledcFrequency.ino index ced1b4dcef3..12e3a3e8cdc 100644 --- a/libraries/ESP32/examples/AnalogOut/ledcFrequency/ledcFrequency.ino +++ b/libraries/ESP32/examples/AnalogOut/ledcFrequency/ledcFrequency.ino @@ -19,11 +19,11 @@ void setup() { uint32_t max_frequency; uint32_t frequency; uint32_t successful_frequency; - uint32_t max_freq_array[SOC_LEDC_TIMER_BIT_WIDE_NUM]; - uint32_t min_freq_array[SOC_LEDC_TIMER_BIT_WIDE_NUM]; + uint32_t max_freq_array[SOC_LEDC_TIMER_BIT_WIDTH]; + uint32_t min_freq_array[SOC_LEDC_TIMER_BIT_WIDTH]; // Find Max Frequency - for(uint8_t resolution = 1; resolution <= SOC_LEDC_TIMER_BIT_WIDE_NUM; ++resolution){ + for(uint8_t resolution = 1; resolution <= SOC_LEDC_TIMER_BIT_WIDTH; ++resolution){ max_freq_array[resolution-1] = 0; min_frequency = 0; max_frequency = UINT32_MAX; @@ -41,7 +41,7 @@ void setup() { } // for all resolutions // Find Min Frequency - for(uint8_t resolution = 1; resolution <= SOC_LEDC_TIMER_BIT_WIDE_NUM; ++resolution){ + for(uint8_t resolution = 1; resolution <= SOC_LEDC_TIMER_BIT_WIDTH; ++resolution){ min_freq_array[resolution-1] = 0; min_frequency = 0; max_frequency = max_freq_array[resolution-1]; @@ -59,9 +59,9 @@ void setup() { } // for all resolutions printf("Bit resolution | Min Frequency [Hz] | Max Frequency [Hz]\n"); - for(uint8_t r = 1; r <= SOC_LEDC_TIMER_BIT_WIDE_NUM; ++r){ + for(uint8_t r = 1; r <= SOC_LEDC_TIMER_BIT_WIDTH; ++r){ size_t max_len = std::to_string(UINT32_MAX).length(); - printf(" %s%d | %s%u | %s%u\n", + printf(" %s%d | %s%lu | %s%lu\n", std::string (2 - std::to_string(r).length(), ' ').c_str(), r, std::string (max_len - std::to_string(min_freq_array[r-1]).length(), ' ').c_str(), min_freq_array[r-1], diff --git a/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino b/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino index 702a557dde4..40154a0ecd8 100644 --- a/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino +++ b/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino @@ -59,8 +59,8 @@ void setup() { config.pin_pclk = PCLK_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM; config.pin_href = HREF_GPIO_NUM; - config.pin_sscb_sda = SIOD_GPIO_NUM; - config.pin_sscb_scl = SIOC_GPIO_NUM; + config.pin_sccb_sda = SIOD_GPIO_NUM; + config.pin_sccb_scl = SIOC_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000; diff --git a/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp b/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp index 01da91fb3b4..634d8d52a97 100644 --- a/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp +++ b/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp @@ -49,9 +49,13 @@ /* very large firmware, very slow, reboots when streaming... @@ -313,7 +317,7 @@ static esp_err_t bmp_handler(httpd_req_t *req) httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); char ts[32]; - snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec); + snprintf(ts, 32, "%lld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec); httpd_resp_set_hdr(req, "X-Timestamp", (const char *)ts); @@ -379,7 +383,7 @@ static esp_err_t capture_handler(httpd_req_t *req) httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); char ts[32]; - snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec); + snprintf(ts, 32, "%lld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec); httpd_resp_set_hdr(req, "X-Timestamp", (const char *)ts); #if CONFIG_ESP_FACE_DETECT_ENABLED diff --git a/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/SmoothBlink_ULP_Code.ino b/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/SmoothBlink_ULP_Code.ino index 77a886209df..28f9ffbccf8 100644 --- a/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/SmoothBlink_ULP_Code.ino +++ b/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/SmoothBlink_ULP_Code.ino @@ -8,6 +8,7 @@ #include #include "esp32/ulp.h" #include "driver/rtc_io.h" +#include "soc/rtc_io_reg.h" // RTC Memory used for ULP internal variable and Sketch interfacing #define RTC_dutyMeter 0 @@ -143,7 +144,7 @@ void setup() { while (!Serial) {} // wait for Serial to start ulp_setup(); // it really only runs on the first ESP32 boot - Serial.printf("\nStarted smooth blink with delay %d\n", *fadeCycleDelay); + Serial.printf("\nStarted smooth blink with delay %ld\n", *fadeCycleDelay); // *fadeCycleDelay resides in RTC_SLOW_MEM and persists along deep sleep waking up // it is used as a delay time parameter for smooth blinking, in the ULP processing code diff --git a/libraries/ESP32/examples/ESPNow/Basic/Slave/Slave.ino b/libraries/ESP32/examples/ESPNow/Basic/Slave/Slave.ino index d2b5b09b10c..50711b18fd5 100644 --- a/libraries/ESP32/examples/ESPNow/Basic/Slave/Slave.ino +++ b/libraries/ESP32/examples/ESPNow/Basic/Slave/Slave.ino @@ -78,10 +78,10 @@ void setup() { } // callback when data is recv from Master -void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) { +void OnDataRecv(const esp_now_recv_info_t * info, const uint8_t *data, int data_len) { char macStr[18]; snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x", - mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); + info->src_addr[0], info->src_addr[1], info->src_addr[2], info->src_addr[3], info->src_addr[4], info->src_addr[5]); Serial.print("Last Packet Recv from: "); Serial.println(macStr); Serial.print("Last Packet Recv Data: "); Serial.println(*data); Serial.println(""); diff --git a/libraries/ESP32/examples/ESPNow/Multi-Slave/Slave/Slave.ino b/libraries/ESP32/examples/ESPNow/Multi-Slave/Slave/Slave.ino index 42ce40ba0d1..ad3b94037c3 100644 --- a/libraries/ESP32/examples/ESPNow/Multi-Slave/Slave/Slave.ino +++ b/libraries/ESP32/examples/ESPNow/Multi-Slave/Slave/Slave.ino @@ -80,10 +80,10 @@ void setup() { } // callback when data is recv from Master -void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) { +void OnDataRecv(const esp_now_recv_info_t * info, const uint8_t *data, int data_len) { char macStr[18]; snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x", - mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); + info->src_addr[0], info->src_addr[1], info->src_addr[2], info->src_addr[3], info->src_addr[4], info->src_addr[5]); Serial.print("Last Packet Recv from: "); Serial.println(macStr); Serial.print("Last Packet Recv Data: "); Serial.println(*data); Serial.println(""); diff --git a/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/BasicMultiThreading.ino b/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/BasicMultiThreading.ino new file mode 100644 index 00000000000..745d5b6a46c --- /dev/null +++ b/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/BasicMultiThreading.ino @@ -0,0 +1,117 @@ +/* Basic Multi Threading Arduino Example + This example code is in the Public Domain (or CC0 licensed, at your option.) + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +// Please read file README.md in the folder containing this example. + +#if CONFIG_FREERTOS_UNICORE +#define ARDUINO_RUNNING_CORE 0 +#else +#define ARDUINO_RUNNING_CORE 1 +#endif + +#define ANALOG_INPUT_PIN A0 + +#ifndef LED_BUILTIN + #define LED_BUILTIN 13 // Specify the on which is your LED +#endif + +// Define two tasks for Blink & AnalogRead. +void TaskBlink( void *pvParameters ); +void TaskAnalogRead( void *pvParameters ); +TaskHandle_t analog_read_task_handle; // You can (don't have to) use this to be able to manipulate a task from somewhere else. + +// The setup function runs once when you press reset or power on the board. +void setup() { + // Initialize serial communication at 115200 bits per second: + Serial.begin(115200); + // Set up two tasks to run independently. + uint32_t blink_delay = 1000; // Delay between changing state on LED pin + xTaskCreate( + TaskBlink + , "Task Blink" // A name just for humans + , 2048 // The stack size can be checked by calling `uxHighWaterMark = uxTaskGetStackHighWaterMark(NULL);` + , (void*) &blink_delay // Task parameter which can modify the task behavior. This must be passed as pointer to void. + , 2 // Priority + , NULL // Task handle is not used here - simply pass NULL + ); + + // This variant of task creation can also specify on which core it will be run (only relevant for multi-core ESPs) + xTaskCreatePinnedToCore( + TaskAnalogRead + , "Analog Read" + , 2048 // Stack size + , NULL // When no parameter is used, simply pass NULL + , 1 // Priority + , &analog_read_task_handle // With task handle we will be able to manipulate with this task. + , ARDUINO_RUNNING_CORE // Core on which the task will run + ); + + Serial.printf("Basic Multi Threading Arduino Example\n"); + // Now the task scheduler, which takes over control of scheduling individual tasks, is automatically started. +} + +void loop(){ + if(analog_read_task_handle != NULL){ // Make sure that the task actually exists + delay(10000); + vTaskDelete(analog_read_task_handle); // Delete task + analog_read_task_handle = NULL; // prevent calling vTaskDelete on non-existing task + } +} + +/*--------------------------------------------------*/ +/*---------------------- Tasks ---------------------*/ +/*--------------------------------------------------*/ + +void TaskBlink(void *pvParameters){ // This is a task. + uint32_t blink_delay = *((uint32_t*)pvParameters); + +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + If you want to know what pin the on-board LED is connected to on your ESP32 model, check + the Technical Specs of your board. +*/ + + // initialize digital LED_BUILTIN on pin 13 as an output. + pinMode(LED_BUILTIN, OUTPUT); + + for (;;){ // A Task shall never return or exit. + digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) + // arduino-esp32 has FreeRTOS configured to have a tick-rate of 1000Hz and portTICK_PERIOD_MS + // refers to how many milliseconds the period between each ticks is, ie. 1ms. + delay(blink_delay); + digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW + delay(blink_delay); + } +} + +void TaskAnalogRead(void *pvParameters){ // This is a task. + (void) pvParameters; + // Check if the given analog pin is usable - if not - delete this task + if(!adcAttachPin(ANALOG_INPUT_PIN)){ + Serial.printf("TaskAnalogRead cannot work because the given pin %d cannot be used for ADC - the task will delete itself.\n", ANALOG_INPUT_PIN); + analog_read_task_handle = NULL; // Prevent calling vTaskDelete on non-existing task + vTaskDelete(NULL); // Delete this task + } + +/* + AnalogReadSerial + Reads an analog input on pin A3, prints the result to the serial monitor. + Graphical representation is available using serial plotter (Tools > Serial Plotter menu) + Attach the center pin of a potentiometer to pin A3, and the outside pins to +5V and ground. + + This example code is in the public domain. +*/ + + for (;;){ + // read the input on analog pin: + int sensorValue = analogRead(ANALOG_INPUT_PIN); + // print out the value you read: + Serial.println(sensorValue); + delay(100); // 100ms delay + } +} diff --git a/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/README.md b/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/README.md new file mode 100644 index 00000000000..c7112e8b4f9 --- /dev/null +++ b/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/README.md @@ -0,0 +1,89 @@ +# Basic Multi Threading Example + +This example demonstrates the basic usage of FreeRTOS Tasks for multi threading. + +Please refer to other examples in this folder to better utilize their full potential and safeguard potential problems. +It is also advised to read the documentation on FreeRTOS web pages: +[https://www.freertos.org/a00106.html](https://www.freertos.org/a00106.html) + +This example will blink the built-in LED and read analog data. +Additionally, this example demonstrates the usage of the task handle, simply by deleting the analog +read task after 10 seconds from the main loop by calling the function `vTaskDelete`. + +### Theory: +A task is simply a function that runs when the operating system (FreeeRTOS) sees fit. +This task can have an infinite loop inside if you want to do some work periodically for the entirety of the program run. +This, however, can create a problem - no other task will ever run and also the Watch Dog will trigger and your program will restart. +A nice behaving tasks know when it is useless to keep the processor for itself and give it away for other tasks to be used. +This can be achieved in many ways, but the simplest is called `delay(`milliseconds)`. +During that delay, any other task may run and do its job. +When the delay runs out the Operating System gives the processor the task which can continue. +For other ways to yield the CPU in a task please see other examples in this folder. +It is also worth mentioning that two or more tasks running the same function will run them with separate stacks, so if you want to run the same code (which could be differentiated by the argument) there is no need to have multiple copies of the same function. + +**Task creation has a few parameters you should understand:** +``` + xTaskCreate(TaskFunction_t pxTaskCode, + const char * const pcName, + const uint16_t usStackDepth, + void * const pvParameters, + UBaseType_t uxPriority, + TaskHandle_t * const pxCreatedTask ) +``` + - **pxTaskCode** is the name of your function which will run as a task + - **pcName** is a string of human-readable descriptions for your task + - **usStackDepth** is the number of words (word = 4B) available to the task. If you see an error similar to this "Debug exception reason: Stack canary watchpoint triggered (Task Blink)" you should increase it + - **pvParameters** is a parameter that will be passed to the task function - it must be explicitly converted to (void*) and in your function explicitly converted back to the intended data type. + - **uxPriority** is a number from 0 to configMAX_PRIORITIES which determines how the FreeRTOS will allow the tasks to run. 0 is the lowest priority. + - **pxCreatedTask** task handle is a pointer to the task which allows you to manipulate the task - delete it, suspend and resume. + If you don't need to do anything special with your task, simply pass NULL for this parameter. + You can read more about task control here: https://www.freertos.org/a00112.html + +# Supported Targets + +This example supports all SoCs. + +### Hardware Connection + +If your board does not have a built-in LED, please connect one to the pin specified by the `LED_BUILTIN` in the code (you can also change the number and connect it to the pin you desire). + +Optionally you can connect the analog element to the pin. such as a variable resistor, analog input such as an audio signal, or any signal generator. However, if the pin is left unconnected it will receive background noise and you will also see a change in the signal when the pin is touched by a finger. +Please refer to the ESP-IDF ADC documentation for specific SoC for info on which pins are available: +[ESP32](https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/api-reference/peripherals/adc.html), + [ESP32-S2](https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32s2/api-reference/peripherals/adc.html), + [ESP32-S3](https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32s3/api-reference/peripherals/adc.html), + [ESP32-C3](https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32c3/api-reference/peripherals/adc.html) + + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port. + +#### Using Platform IO + +* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file. + +## Troubleshooting + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. + +## Resources + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) +* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) +* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) +* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/ESP32/examples/FreeRTOS/FreeRTOS.ino b/libraries/ESP32/examples/FreeRTOS/FreeRTOS.ino deleted file mode 100644 index c9ba0eca6aa..00000000000 --- a/libraries/ESP32/examples/FreeRTOS/FreeRTOS.ino +++ /dev/null @@ -1,99 +0,0 @@ -#if CONFIG_FREERTOS_UNICORE -#define ARDUINO_RUNNING_CORE 0 -#else -#define ARDUINO_RUNNING_CORE 1 -#endif - -#ifndef LED_BUILTIN -#define LED_BUILTIN 13 -#endif - -// define two tasks for Blink & AnalogRead -void TaskBlink( void *pvParameters ); -void TaskAnalogReadA3( void *pvParameters ); - -// the setup function runs once when you press reset or power the board -void setup() { - - // initialize serial communication at 115200 bits per second: - Serial.begin(115200); - - // Now set up two tasks to run independently. - xTaskCreatePinnedToCore( - TaskBlink - , "TaskBlink" // A name just for humans - , 1024 // This stack size can be checked & adjusted by reading the Stack Highwater - , NULL - , 2 // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest. - , NULL - , ARDUINO_RUNNING_CORE); - - xTaskCreatePinnedToCore( - TaskAnalogReadA3 - , "AnalogReadA3" - , 1024 // Stack size - , NULL - , 1 // Priority - , NULL - , ARDUINO_RUNNING_CORE); - - // Now the task scheduler, which takes over control of scheduling individual tasks, is automatically started. -} - -void loop() -{ - // Empty. Things are done in Tasks. -} - -/*--------------------------------------------------*/ -/*---------------------- Tasks ---------------------*/ -/*--------------------------------------------------*/ - -void TaskBlink(void *pvParameters) // This is a task. -{ - (void) pvParameters; - -/* - Blink - Turns on an LED on for one second, then off for one second, repeatedly. - - If you want to know what pin the on-board LED is connected to on your ESP32 model, check - the Technical Specs of your board. -*/ - - // initialize digital LED_BUILTIN on pin 13 as an output. - pinMode(LED_BUILTIN, OUTPUT); - - for (;;) // A Task shall never return or exit. - { - digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) - // arduino-esp32 has FreeRTOS configured to have a tick-rate of 1000Hz and portTICK_PERIOD_MS - // refers to how many milliseconds the period between each ticks is, ie. 1ms. - vTaskDelay(1000 / portTICK_PERIOD_MS ); // vTaskDelay wants ticks, not milliseconds - digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW - vTaskDelay(1000 / portTICK_PERIOD_MS); // 1 second delay - } -} - -void TaskAnalogReadA3(void *pvParameters) // This is a task. -{ - (void) pvParameters; - -/* - AnalogReadSerial - Reads an analog input on pin A3, prints the result to the serial monitor. - Graphical representation is available using serial plotter (Tools > Serial Plotter menu) - Attach the center pin of a potentiometer to pin A3, and the outside pins to +5V and ground. - - This example code is in the public domain. -*/ - - for (;;) - { - // read the input on analog pin A3: - int sensorValueA3 = analogRead(A3); - // print out the value you read: - Serial.println(sensorValueA3); - vTaskDelay(100 / portTICK_PERIOD_MS); // 100ms delay - } -} diff --git a/libraries/ESP32/examples/FreeRTOS/Mutex/Mutex.ino b/libraries/ESP32/examples/FreeRTOS/Mutex/Mutex.ino new file mode 100644 index 00000000000..157c5742e69 --- /dev/null +++ b/libraries/ESP32/examples/FreeRTOS/Mutex/Mutex.ino @@ -0,0 +1,97 @@ +/* Basic Multi Threading Arduino Example + This example code is in the Public Domain (or CC0 licensed, at your option.) + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +// Please read file README.md in the folder containing this example. + +#define USE_MUTEX +int shared_variable = 0; +SemaphoreHandle_t shared_var_mutex = NULL; + +// Define a task function +void Task( void *pvParameters ); + +// The setup function runs once when you press reset or power on the board. +void setup() { + // Initialize serial communication at 115200 bits per second: + Serial.begin(115200); + while(!Serial) delay(100); + Serial.printf(" Task 0 | Task 1\n"); + +#ifdef USE_MUTEX + shared_var_mutex = xSemaphoreCreateMutex(); // Create the mutex +#endif + + // Set up two tasks to run the same function independently. + static int task_number0 = 0; + xTaskCreate( + Task + , "Task 0" // A name just for humans + , 2048 // The stack size + , (void*)&task_number0 // Pass reference to a variable describing the task number + //, 5 // High priority + , 1 // priority + , NULL // Task handle is not used here - simply pass NULL + ); + + static int task_number1 = 1; + xTaskCreate( + Task + , "Task 1" + , 2048 // Stack size + , (void*)&task_number1 // Pass reference to a variable describing the task number + , 1 // Low priority + , NULL // Task handle is not used here - simply pass NULL + ); + + // Now the task scheduler, which takes over control of scheduling individual tasks, is automatically started. +} + +void loop(){ +} + +/*--------------------------------------------------*/ +/*---------------------- Tasks ---------------------*/ +/*--------------------------------------------------*/ + +void Task(void *pvParameters){ // This is a task. + int task_num = *((int*)pvParameters); + Serial.printf("%s\n", task_num ? " Starting |" : " | Starting"); + for (;;){ // A Task shall never return or exit. +#ifdef USE_MUTEX + if(shared_var_mutex != NULL){ // Sanity check if the mutex exists + // Try to take the mutex and wait indefintly if needed + if(xSemaphoreTake(shared_var_mutex, portMAX_DELAY) == pdTRUE){ + // Mutex successfully taken +#endif + int new_value = random(1000); + + char str0[32]; sprintf(str0, " %d <- %d |", shared_variable, new_value); + char str1[32]; sprintf(str1, " | %d <- %d", shared_variable, new_value); + Serial.printf("%s\n", task_num ? str0 : str1); + + shared_variable = new_value; + delay(random(100)); // wait random time of max 100 ms - simulating some computation + + sprintf(str0, " R: %d |", shared_variable); + sprintf(str1, " | R: %d", shared_variable); + Serial.printf("%s\n", task_num ? str0 : str1); + //Serial.printf("Task %d after write: reading %d\n", task_num, shared_variable); + + if(shared_variable != new_value){ + Serial.printf("%s\n", task_num ? " Mismatch! |" : " | Mismatch!"); + //Serial.printf("Task %d: detected race condition - the value changed!\n", task_num); + } + +#ifdef USE_MUTEX + xSemaphoreGive(shared_var_mutex); // After accessing the shared resource give the mutex and allow other processes to access it + }else{ + // We could not obtain the semaphore and can therefore not access the shared resource safely. + } // mutex take + } // sanity check +#endif + delay(10); // Allow other task to be scheduled + } // Infinite loop +} \ No newline at end of file diff --git a/libraries/ESP32/examples/FreeRTOS/Mutex/README.md b/libraries/ESP32/examples/FreeRTOS/Mutex/README.md new file mode 100644 index 00000000000..d1c8c19e3be --- /dev/null +++ b/libraries/ESP32/examples/FreeRTOS/Mutex/README.md @@ -0,0 +1,121 @@ +# Mutex Example + +This example demonstrates the basic usage of FreeRTOS Mutually Exclusive Locks (Mutex) for securing access to shared resources in multi-threading. +Please refer to other examples in this folder to better understand the usage of tasks. +It is also advised to read the documentation on FreeRTOS web pages: +https://www.freertos.org/a00106.html + +This example creates 2 tasks with the same implementation - they write into a shared variable and then read it and check if it is the same as what they have written. +In single-thread programming like on Arduino this is of no concern and will be always ok, however when multi-threading is used the execution of the task is switched by the FreeRTOS and the value can be rewritten from another task before reading again. +The tasks print write and read operation - each in their column for better reading. Task 0 is on the left and Task 1 is on the right. +Watch the writes and read in secure mode when using the mutex (default) as the results are as you would expect them. +Then try to comment the USE_MUTEX and watch again - there will be a lot of mismatches! + +### Theory: +Mutex is a specialized version of Semaphore (please see the Semaphore example for more info). +In essence, the mutex is a variable whose value determines if the mute is taken (locked) or given (unlocked). +When two or more processes access the same resource (variable, peripheral, etc) it might happen, for example, that when one task starts to read a variable and the operating system (FreeRTOS) will schedule the execution of another task +which will write to this variable and when the previous task runs again it will read something different. + +Mutexes and binary semaphores are very similar but have some subtle differences: +Mutexes include a priority inheritance mechanism, whereas binary semaphores do not. +This makes binary semaphores the better choice for implementing synchronization (between tasks or between tasks and an interrupt), and mutexes the better +choice for implementing simple mutual exclusion. +What is priority inheritance? +If a low-priority task holds the Mutex but gets interrupted by a Higher priority task, which +then tries to take the Mutex, the low-priority task will temporarily ‘inherit’ the high priority so a middle-priority task can't block the low-priority task, and thus also block the high priority task. +Semaphores don't have the logic to handle this, in part because Semaphores aren't 'owned' by the task that takes them. + +A mutex can also be recursive - if a task that holds the mutex takes it again, it will succeed, and the mutex will be released +for other tasks only when it is given the same number of times that it was taken. + +You can check the danger by commenting on the definition of USE_MUTEX which will disable the mutex and present the danger of concurrent access. + + +# Supported Targets + +This example supports all ESP32 SoCs. + +## How to Use Example + +Flash and observe the serial output. + +Comment the `USE_MUTEX` definition, save and flash again and observe the behavior of unprotected access to the shared variable. + +* How to install the Arduino IDE: [Install Arduino IDE](https://github.com/espressif/arduino-esp32/tree/master/docs/arduino-ide). + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port. + +#### Using Platform IO + +* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file. + +## Example Log Output + +The expected output of shared variables protected by mutex demonstrates mutually exclusive access from tasks - they do not interrupt each other and do not rewrite the value before the other task has read it back. + +``` + Task 0 | Task 1 + | Starting + | 0 <- 227 + Starting | + | R: 227 + 227 <- 737 | + R: 737 | + | 737 <- 282 + | R: 282 + 282 <- 267 | +``` + +The output of unprotected access to shared variable - it happens often that a task is interrupted after writing and before reading the other task write a different value - a corruption occurred! + +``` + Task 0 | Task 1 + | Starting + | 0 <- 333 + Starting | + 333 <- 620 | + R: 620 | + 620 <- 244 | + | R: 244 + | Mismatch! + | 244 <- 131 + R: 131 | + Mismatch! | + 131 <- 584 | + | R: 584 + | Mismatch! + | 584 <- 134 + | R: 134 + | 134 <- 554 + R: 554 | + Mismatch! | + 554 <- 313 | +``` + +## Troubleshooting + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. + +## Resources + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) +* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) +* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) +* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/ESP32/examples/FreeRTOS/Queue/Queue.ino b/libraries/ESP32/examples/FreeRTOS/Queue/Queue.ino new file mode 100644 index 00000000000..a26ee3310d6 --- /dev/null +++ b/libraries/ESP32/examples/FreeRTOS/Queue/Queue.ino @@ -0,0 +1,120 @@ +/* Basic Multi Threading Arduino Example + This example code is in the Public Domain (or CC0 licensed, at your option.) + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +// Please read file README.md in the folder containing this example./* + +#define MAX_LINE_LENGTH (64) + +// Define two tasks for reading and writing from and to the serial port. +void TaskWriteToSerial(void *pvParameters); +void TaskReadFromSerial(void *pvParameters); + +// Define Queue handle +QueueHandle_t QueueHandle; +const int QueueElementSize = 10; +typedef struct{ + char line[MAX_LINE_LENGTH]; + uint8_t line_length; +} message_t; + +// The setup function runs once when you press reset or power on the board. +void setup() { + // Initialize serial communication at 115200 bits per second: + Serial.begin(115200); + while(!Serial){delay(10);} + + // Create the queue which will have number of elements, each of size `message_t` and pass the address to . + QueueHandle = xQueueCreate(QueueElementSize, sizeof(message_t)); + + // Check if the queue was successfully created + if(QueueHandle == NULL){ + Serial.println("Queue could not be created. Halt."); + while(1) delay(1000); // Halt at this point as is not possible to continue + } + + // Set up two tasks to run independently. + xTaskCreate( + TaskWriteToSerial + , "Task Write To Serial" // A name just for humans + , 2048 // The stack size can be checked by calling `uxHighWaterMark = uxTaskGetStackHighWaterMark(NULL);` + , NULL // No parameter is used + , 2 // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest. + , NULL // Task handle is not used here + ); + + xTaskCreate( + TaskReadFromSerial + , "Task Read From Serial" + , 2048 // Stack size + , NULL // No parameter is used + , 1 // Priority + , NULL // Task handle is not used here + ); + + // Now the task scheduler, which takes over control of scheduling individual tasks, is automatically started. + Serial.printf("\nAnything you write will return as echo.\nMaximum line length is %d characters (+ terminating '0').\nAnything longer will be sent as a separate line.\n\n", MAX_LINE_LENGTH-1); +} + +void loop(){ + // Loop is free to do any other work + + delay(1000); // While not being used yield the CPU to other tasks +} + +/*--------------------------------------------------*/ +/*---------------------- Tasks ---------------------*/ +/*--------------------------------------------------*/ + +void TaskWriteToSerial(void *pvParameters){ // This is a task. + message_t message; + for (;;){ // A Task shall never return or exit. + // One approach would be to poll the function (uxQueueMessagesWaiting(QueueHandle) and call delay if nothing is waiting. + // The other approach is to use infinite time to wait defined by constant `portMAX_DELAY`: + if(QueueHandle != NULL){ // Sanity check just to make sure the queue actually exists + int ret = xQueueReceive(QueueHandle, &message, portMAX_DELAY); + if(ret == pdPASS){ + // The message was successfully received - send it back to Serial port and "Echo: " + Serial.printf("Echo line of size %d: \"%s\"\n", message.line_length, message.line); + // The item is queued by copy, not by reference, so lets free the buffer after use. + }else if(ret == pdFALSE){ + Serial.println("The `TaskWriteToSerial` was unable to receive data from the Queue"); + } + } // Sanity check + } // Infinite loop +} + +void TaskReadFromSerial(void *pvParameters){ // This is a task. + message_t message; + for (;;){ + // Check if any data are waiting in the Serial buffer + message.line_length = Serial.available(); + if(message.line_length > 0){ + // Check if the queue exists AND if there is any free space in the queue + if(QueueHandle != NULL && uxQueueSpacesAvailable(QueueHandle) > 0){ + int max_length = message.line_length < MAX_LINE_LENGTH ? message.line_length : MAX_LINE_LENGTH-1; + for(int i = 0; i < max_length; ++i){ + message.line[i] = Serial.read(); + } + message.line_length = max_length; + message.line[message.line_length] = 0; // Add the terminating nul char + + // The line needs to be passed as pointer to void. + // The last parameter states how many milliseconds should wait (keep trying to send) if is not possible to send right away. + // When the wait parameter is 0 it will not wait and if the send is not possible the function will return errQUEUE_FULL + int ret = xQueueSend(QueueHandle, (void*) &message, 0); + if(ret == pdTRUE){ + // The message was successfully sent. + }else if(ret == errQUEUE_FULL){ + // Since we are checking uxQueueSpacesAvailable this should not occur, however if more than one task should + // write into the same queue it can fill-up between the test and actual send attempt + Serial.println("The `TaskReadFromSerial` was unable to send data into the Queue"); + } // Queue send check + } // Queue sanity check + }else{ + delay(100); // Allow other tasks to run when there is nothing to read + } // Serial buffer check + } // Infinite loop +} diff --git a/libraries/ESP32/examples/FreeRTOS/Queue/README.md b/libraries/ESP32/examples/FreeRTOS/Queue/README.md new file mode 100644 index 00000000000..745ce9e8db6 --- /dev/null +++ b/libraries/ESP32/examples/FreeRTOS/Queue/README.md @@ -0,0 +1,75 @@ +# Queue Example + +This example demonstrates the basic usage of FreeRTOS Queues which enables tasks to pass data between each other in a secure asynchronous way. +Please refer to other examples in this folder to better understand the usage of tasks. +It is also advised to read the documentation on FreeRTOS web pages: +[https://www.freertos.org/a00106.html](https://www.freertos.org/a00106.html) + +This example reads data received on the serial port (sent by the user) pass it via queue to another task which will send it back on Serial Output. + +### Theory: +A queue is a simple-to-use data structure (in the most basic way) controlled by `xQueueSend` and `xQueueReceive` functions. +Usually, one task writes into the queue and the other task reads from it. +Usage of queues enables the reading task to yield the CPU until there are data in the queue and therefore not waste precious computation time. + +# Supported Targets + +This example supports all ESP32 SoCs. + +## How to Use Example + +Flash and write anything to serial input. + +* How to install the Arduino IDE: [Install Arduino IDE](https://github.com/espressif/arduino-esp32/tree/master/docs/arduino-ide). + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port. + +#### Using Platform IO + +* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file. + +## Example Log Output + +``` +Anything you write will return as echo. +Maximum line length is 63 characters (+ terminating '0'). +Anything longer will be sent as a separate line. + +``` +< Input text "Short input" + +``Echo line of size 11: "Short input"`` + +< Input text "An example of very long input which is longer than default 63 characters will be split." + +``` +Echo line of size 63: "An example of very long input which is longer than default 63 c" +Echo line of size 24: "haracters will be split." +``` + +## Troubleshooting + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. + +## Resources + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) +* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) +* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) +* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/ESP32/examples/FreeRTOS/Semaphore/README.md b/libraries/ESP32/examples/FreeRTOS/Semaphore/README.md new file mode 100644 index 00000000000..8f860a52db5 --- /dev/null +++ b/libraries/ESP32/examples/FreeRTOS/Semaphore/README.md @@ -0,0 +1,81 @@ +# Semaphore Example + +This example demonstrates the basic usage of FreeRTOS Semaphores and queue sets for coordination between tasks for multi-threading. +Please refer to other examples in this folder to better understand the usage of tasks. +It is also advised to read the documentation on FreeRTOS web pages: +[https://www.freertos.org/a00106.html](https://www.freertos.org/a00106.html) + +### Theory: +Semaphore is in essence a variable. Tasks can set the value, wait until one or more +semaphores are set and thus communicate between each other their state. +A binary semaphore is a semaphore that has a maximum count of 1, hence the 'binary' name. +A task can only 'take' the semaphore if it is available, and the semaphore is only available if its count is 1. + +Semaphores can be controlled by any number of tasks. If you use semaphore as a one-way +signalization with only one task giving and only one task taking there is a much faster option +called Task Notifications - please see FreeRTOS documentation and read more about them: [https://www.freertos.org/RTOS-task-notifications.html](https://www.freertos.org/RTOS-task-notifications.html) + +This example uses a semaphore to signal when a package is delivered to a warehouse by multiple +delivery trucks, and multiple workers are waiting to receive the package. + +# Supported Targets + +This example supports all ESP32 SoCs. + +## How to Use Example + +Read the code and try to understand it, then flash and observe the Serial output. + +* How to install the Arduino IDE: [Install Arduino IDE](https://github.com/espressif/arduino-esp32/tree/master/docs/arduino-ide). + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port. + +#### Using Platform IO + +* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file. + +## Example Log Output + +``` +Anything you write will return as echo. +Maximum line length is 63 characters (+ terminating '0'). +Anything longer will be sent as a separate line. + +``` +< Input text "Short input" + +``Echo line of size 11: "Short input"`` + +< Input text "An example of very long input which is longer than default 63 characters will be split." + +``` +Echo line of size 63: "An example of very long input which is longer than default 63 c" +Echo line of size 24: "haracters will be split." +``` + +## Troubleshooting + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. + +## Resources + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) +* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) +* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) +* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/ESP32/examples/FreeRTOS/Semaphore/Semaphore.ino b/libraries/ESP32/examples/FreeRTOS/Semaphore/Semaphore.ino new file mode 100644 index 00000000000..ae3b3fd1bf7 --- /dev/null +++ b/libraries/ESP32/examples/FreeRTOS/Semaphore/Semaphore.ino @@ -0,0 +1,56 @@ +/* Basic Multi Threading Arduino Example + This example code is in the Public Domain (or CC0 licensed, at your option.) + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +// Please read file README.md in the folder containing this example. + +#include + +SemaphoreHandle_t package_delivered_semaphore; + +void delivery_truck_task(void *pvParameters) { + int truck_number = (int) pvParameters; + while(1) { + // Wait for a package to be delivered + // ... + // Notify the warehouse that a package has been delivered + xSemaphoreGive(package_delivered_semaphore); + Serial.printf("Package delivered by truck: %d\n", truck_number); + //wait for some time + vTaskDelay(1000 / portTICK_PERIOD_MS); + } +} + +void warehouse_worker_task(void *pvParameters) { + int worker_number = (int) pvParameters; + while(1) { + // Wait for a package to be delivered + xSemaphoreTake(package_delivered_semaphore, portMAX_DELAY); + Serial.printf("Package received by worker: %d\n", worker_number); + // Receive the package + // ... + } +} + +void setup() { + Serial.begin(115200); + while(!Serial){ delay(100); } + // Create the semaphore + package_delivered_semaphore = xSemaphoreCreateCounting(10, 0); + + // Create multiple delivery truck tasks + for (int i = 0; i < 5; i++) { + xTaskCreate(delivery_truck_task, "Delivery Truck", 2048, (void *)i, tskIDLE_PRIORITY, NULL); + } + + // Create multiple warehouse worker tasks + for (int i = 0; i < 3; i++) { + xTaskCreate(warehouse_worker_task, "Warehouse Worker", 2048, (void *)i, tskIDLE_PRIORITY, NULL); + } +} + +void loop() { + // Empty loop +} \ No newline at end of file diff --git a/libraries/ESP32/examples/GPIO/FunctionalInterrupt/FunctionalInterrupt.ino b/libraries/ESP32/examples/GPIO/FunctionalInterrupt/FunctionalInterrupt.ino index f18db753342..a32eaf53b8b 100644 --- a/libraries/ESP32/examples/GPIO/FunctionalInterrupt/FunctionalInterrupt.ino +++ b/libraries/ESP32/examples/GPIO/FunctionalInterrupt/FunctionalInterrupt.ino @@ -16,13 +16,13 @@ public: } void ARDUINO_ISR_ATTR isr() { - numberKeyPresses += 1; + numberKeyPresses = numberKeyPresses + 1; pressed = true; } void checkPressed() { if (pressed) { - Serial.printf("Button on pin %u has been pressed %u times\n", PIN, numberKeyPresses); + Serial.printf("Button on pin %u has been pressed %lu times\n", PIN, numberKeyPresses); pressed = false; } } diff --git a/libraries/ESP32/examples/GPIO/GPIOInterrupt/GPIOInterrupt.ino b/libraries/ESP32/examples/GPIO/GPIOInterrupt/GPIOInterrupt.ino index 8d9d8d3b1a0..f208024256f 100644 --- a/libraries/ESP32/examples/GPIO/GPIOInterrupt/GPIOInterrupt.ino +++ b/libraries/ESP32/examples/GPIO/GPIOInterrupt/GPIOInterrupt.ino @@ -30,11 +30,11 @@ void setup() { void loop() { if (button1.pressed) { - Serial.printf("Button 1 has been pressed %u times\n", button1.numberKeyPresses); + Serial.printf("Button 1 has been pressed %lu times\n", button1.numberKeyPresses); button1.pressed = false; } if (button2.pressed) { - Serial.printf("Button 2 has been pressed %u times\n", button2.numberKeyPresses); + Serial.printf("Button 2 has been pressed %lu times\n", button2.numberKeyPresses); button2.pressed = false; } static uint32_t lastMillis = 0; diff --git a/libraries/ESP32/examples/HallSensor/.skip.esp32c3 b/libraries/ESP32/examples/HallSensor/.skip.esp32c3 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/libraries/ESP32/examples/HallSensor/.skip.esp32s2 b/libraries/ESP32/examples/HallSensor/.skip.esp32s2 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/libraries/ESP32/examples/HallSensor/.skip.esp32s3 b/libraries/ESP32/examples/HallSensor/.skip.esp32s3 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/libraries/ESP32/examples/HallSensor/HallSensor.ino b/libraries/ESP32/examples/HallSensor/HallSensor.ino deleted file mode 100644 index 8045ac918da..00000000000 --- a/libraries/ESP32/examples/HallSensor/HallSensor.ino +++ /dev/null @@ -1,15 +0,0 @@ -//Simple sketch to access the internal hall effect detector on the esp32. -//values can be quite low. -//Brian Degger / @sctv -int val = 0; -void setup() { - Serial.begin(9600); - } - -void loop() { - // put your main code here, to run repeatedly: - val = hallRead(); - // print the results to the serial monitor: - //Serial.print("sensor = "); - Serial.println(val);//to graph -} diff --git a/libraries/ESP32/examples/I2S/HiFreq_ADC/HiFreq_ADC.ino b/libraries/ESP32/examples/I2S/HiFreq_ADC/HiFreq_ADC.ino index e3b40d2c8d5..db94960f205 100644 --- a/libraries/ESP32/examples/I2S/HiFreq_ADC/HiFreq_ADC.ino +++ b/libraries/ESP32/examples/I2S/HiFreq_ADC/HiFreq_ADC.ino @@ -51,7 +51,9 @@ void i2sInit(){ .dma_buf_len = I2S_DMA_BUF_LEN, .use_apll = false, .tx_desc_auto_clear = false, - .fixed_mclk = 0 + .fixed_mclk = 0, + .mclk_multiple = I2S_MCLK_MULTIPLE_128, + .bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT }; Serial.printf("Attempting to setup I2S ADC with sampling frequency %d Hz\n", I2S_SAMPLE_RATE); if(ESP_OK != i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL)){ @@ -120,7 +122,7 @@ void loop(){ if(read_counter == AVERAGE_EVERY_N_SAMPLES){ averaged_reading = read_sum / AVERAGE_EVERY_N_SAMPLES; //Serial.printf("averaged_reading = %d over %d samples\n", averaged_reading, read_counter); // Print with additional info - Serial.printf("Averaged_signal:%d", averaged_reading); // Print compatible with Arduino Plotter + Serial.printf("Averaged_signal:%ld", averaged_reading); // Print compatible with Arduino Plotter read_counter = 0; read_sum = 0; } diff --git a/libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino b/libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino index de28da6c85d..61e6b55abcc 100644 --- a/libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino +++ b/libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino @@ -62,6 +62,6 @@ void setup() void loop() { - Serial.printf("GPIO 4: %08x 5: %08x 10: %08x\n", mp1.val(), mp2.val(), mp3.val()); + Serial.printf("GPIO 4: %08lx 5: %08lx 10: %08lx\n", mp1.val(), mp2.val(), mp3.val()); delay(500); } \ No newline at end of file diff --git a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino index 6b1ee2fa55d..851ced04131 100644 --- a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino +++ b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino @@ -65,7 +65,7 @@ void loop() // Printout the received data plus the original values for (i=0; i<60; i++) { - Serial.printf("%08x=%08x ", my_data[i].val, data[i].val ); + Serial.printf("%08lx=%08lx ", my_data[i].val, data[i].val ); if (!((i+1)%4)) Serial.println("\n"); } Serial.println("\n"); diff --git a/libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino b/libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino index f87dd220513..1dcd8542da1 100644 --- a/libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino +++ b/libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino @@ -198,6 +198,6 @@ void setup() void loop() { // printout some of the channels - Serial.printf("%04x %04x %04x %04x\n", channels[0], channels[1], channels[2], channels[3]); + Serial.printf("%04lx %04lx %04lx %04lx\n", channels[0], channels[1], channels[2], channels[3]); delay(500); } diff --git a/libraries/ESP32/examples/ResetReason/ResetReason.ino b/libraries/ESP32/examples/ResetReason/ResetReason.ino index 2ccf7107d03..3da7d400382 100644 --- a/libraries/ESP32/examples/ResetReason/ResetReason.ino +++ b/libraries/ESP32/examples/ResetReason/ResetReason.ino @@ -91,7 +91,11 @@ void setup() { // Set ESP32 to go to deep sleep to see a variation // in the reset reason. Device will sleep for 5 seconds. +#if CONFIG_IDF_TARGET_ESP32C3 + esp_sleep_pd_config(ESP_PD_DOMAIN_RC_FAST, ESP_PD_OPTION_OFF); +#else esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF); +#endif Serial.println("Going to sleep"); esp_deep_sleep(5 * uS_TO_S_FACTOR); } diff --git a/libraries/ESP32/examples/Serial/OnReceiveError_BREAK_Demo/OnReceiveError_BREAK_Demo.ino b/libraries/ESP32/examples/Serial/OnReceiveError_BREAK_Demo/OnReceiveError_BREAK_Demo.ino index 5bb53bf90b8..3a712033506 100644 --- a/libraries/ESP32/examples/Serial/OnReceiveError_BREAK_Demo/OnReceiveError_BREAK_Demo.ino +++ b/libraries/ESP32/examples/Serial/OnReceiveError_BREAK_Demo/OnReceiveError_BREAK_Demo.ino @@ -84,7 +84,7 @@ void onReceiveErrorFunction(hardwareSerial_error_t err) { void onReceiveFunction() { // This is a callback function that will be activated on UART RX events size_t available = Serial1.available(); - received_bytes += available; + received_bytes = received_bytes + available; Serial.printf("onReceive Callback:: There are %d bytes available: {", available); while (available --) { Serial.print((char)Serial1.read()); diff --git a/libraries/ESP32/examples/Serial/OnReceive_Demo/OnReceive_Demo.ino b/libraries/ESP32/examples/Serial/OnReceive_Demo/OnReceive_Demo.ino index 192dbd020da..fa16645a64d 100644 --- a/libraries/ESP32/examples/Serial/OnReceive_Demo/OnReceive_Demo.ino +++ b/libraries/ESP32/examples/Serial/OnReceive_Demo/OnReceive_Demo.ino @@ -60,7 +60,7 @@ volatile size_t sent_bytes = 0, received_bytes = 0; void onReceiveFunction(void) { // This is a callback function that will be activated on UART RX events size_t available = Serial1.available(); - received_bytes += available; + received_bytes = received_bytes + available; Serial.printf("onReceive Callback:: There are %d bytes available: ", available); while (available --) { Serial.print((char)Serial1.read()); diff --git a/libraries/ESP32/examples/Serial/RxFIFOFull_Demo/RxFIFOFull_Demo.ino b/libraries/ESP32/examples/Serial/RxFIFOFull_Demo/RxFIFOFull_Demo.ino index f5c8dabaf39..878150264da 100644 --- a/libraries/ESP32/examples/Serial/RxFIFOFull_Demo/RxFIFOFull_Demo.ino +++ b/libraries/ESP32/examples/Serial/RxFIFOFull_Demo/RxFIFOFull_Demo.ino @@ -91,10 +91,10 @@ void testAndReport(uint8_t fifoFull) { uint32_t pastTime = millis() - now; Serial.printf("\nIt has sent %d bytes from Serial1 TX to Serial1 RX\n", sentBytes); - Serial.printf("It took %d milliseconds to read %d bytes\n", pastTime, bytesReceived); + Serial.printf("It took %lu milliseconds to read %d bytes\n", pastTime, bytesReceived); Serial.printf("Per execution Serial.read() number of bytes data and time information:\n"); for (i = 0; i < DATA_SIZE; i++) { - Serial.printf("#%03d - Received %03d bytes after %d ms.\n", i, bytesJustReceived[i], i > 0 ? timeStamp[i] - timeStamp[i - 1] : timeStamp[i] - now); + Serial.printf("#%03d - Received %03lu bytes after %lu ms.\n", i, bytesJustReceived[i], i > 0 ? timeStamp[i] - timeStamp[i - 1] : timeStamp[i] - now); if (i != DATA_SIZE - 1 && bytesJustReceived[i + 1] == 0) break; } diff --git a/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino b/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino index 35a94bd2747..b4592f8249d 100644 --- a/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino +++ b/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino @@ -87,7 +87,7 @@ void testAndReport(uint8_t rxTimeout) { uint32_t pastTime = millis() - now; Serial.printf("\nIt has sent %d bytes from Serial1 TX to Serial1 RX\n", sentBytes); - Serial.printf("It took %d milliseconds to read %d bytes\n", pastTime, bytesReceived); + Serial.printf("It took %lu milliseconds to read %d bytes\n", pastTime, bytesReceived); Serial.print("Received data: ["); Serial.write(dataReceived, DATA_SIZE); Serial.println("]"); diff --git a/libraries/ESP32/examples/TWAI/TWAIreceive/TWAIreceive.ino b/libraries/ESP32/examples/TWAI/TWAIreceive/TWAIreceive.ino index e0fd8864596..ebf9f857e86 100644 --- a/libraries/ESP32/examples/TWAI/TWAIreceive/TWAIreceive.ino +++ b/libraries/ESP32/examples/TWAI/TWAIreceive/TWAIreceive.ino @@ -24,6 +24,7 @@ created 05-11-2022 by Stephan Martin (designer2k2) */ +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" #include "driver/twai.h" // Pins used to connect to CAN bus transceiver: @@ -80,7 +81,7 @@ static void handle_rx_message(twai_message_t& message) { } else { Serial.println("Message is in Standard Format"); } - Serial.printf("ID: %x\nByte:", message.identifier); + Serial.printf("ID: %lx\nByte:", message.identifier); if (!(message.rtr)) { for (int i = 0; i < message.data_length_code; i++) { Serial.printf(" %d = %02x,", i, message.data[i]); @@ -107,13 +108,13 @@ void loop() { } if (alerts_triggered & TWAI_ALERT_BUS_ERROR) { Serial.println("Alert: A (Bit, Stuff, CRC, Form, ACK) error has occurred on the bus."); - Serial.printf("Bus error count: %d\n", twaistatus.bus_error_count); + Serial.printf("Bus error count: %lu\n", twaistatus.bus_error_count); } if (alerts_triggered & TWAI_ALERT_RX_QUEUE_FULL) { Serial.println("Alert: The RX queue is full causing a received frame to be lost."); - Serial.printf("RX buffered: %d\t", twaistatus.msgs_to_rx); - Serial.printf("RX missed: %d\t", twaistatus.rx_missed_count); - Serial.printf("RX overrun %d\n", twaistatus.rx_overrun_count); + Serial.printf("RX buffered: %lu\t", twaistatus.msgs_to_rx); + Serial.printf("RX missed: %lu\t", twaistatus.rx_missed_count); + Serial.printf("RX overrun %lu\n", twaistatus.rx_overrun_count); } // Check if message is received diff --git a/libraries/ESP32/examples/Template/ExampleTemplate/README.md b/libraries/ESP32/examples/Template/ExampleTemplate/README.md index 9819880d4f4..f5aa7b35e86 100644 --- a/libraries/ESP32/examples/Template/ExampleTemplate/README.md +++ b/libraries/ESP32/examples/Template/ExampleTemplate/README.md @@ -119,4 +119,5 @@ Before creating a new issue, be sure to try Troubleshooting and check if the sam * ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) * ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) * ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) +* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) * Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/ESP32/examples/Timer/RepeatTimer/RepeatTimer.ino b/libraries/ESP32/examples/Timer/RepeatTimer/RepeatTimer.ino index 0896e1f3e28..c6282429217 100644 --- a/libraries/ESP32/examples/Timer/RepeatTimer/RepeatTimer.ino +++ b/libraries/ESP32/examples/Timer/RepeatTimer/RepeatTimer.ino @@ -21,7 +21,7 @@ volatile uint32_t lastIsrAt = 0; void ARDUINO_ISR_ATTR onTimer(){ // Increment the counter and set the time of ISR portENTER_CRITICAL_ISR(&timerMux); - isrCounter++; + isrCounter = isrCounter + 1; lastIsrAt = millis(); portEXIT_CRITICAL_ISR(&timerMux); // Give a semaphore that we can check in the loop diff --git a/libraries/ESP32/examples/Timer/WatchdogTimer/WatchdogTimer.ino b/libraries/ESP32/examples/Timer/WatchdogTimer/WatchdogTimer.ino index e157dae3ad7..25163dafeb2 100644 --- a/libraries/ESP32/examples/Timer/WatchdogTimer/WatchdogTimer.ino +++ b/libraries/ESP32/examples/Timer/WatchdogTimer/WatchdogTimer.ino @@ -1,4 +1,5 @@ #include "esp_system.h" +#include "rom/ets_sys.h" const int button = 0; //gpio to use to trigger delay const int wdtTimeout = 3000; //time in ms to trigger the watchdog diff --git a/libraries/ESP32/examples/Touch/TouchRead/TouchRead.ino b/libraries/ESP32/examples/Touch/TouchRead/TouchRead.ino index 27b1480b0de..57312c62587 100644 --- a/libraries/ESP32/examples/Touch/TouchRead/TouchRead.ino +++ b/libraries/ESP32/examples/Touch/TouchRead/TouchRead.ino @@ -10,6 +10,6 @@ void setup() void loop() { - Serial.println(touchRead(T1)); // get value using T1 + Serial.println(touchRead(T1)); // get value using T0 delay(1000); } diff --git a/libraries/ESPmDNS/src/ESPmDNS.cpp b/libraries/ESPmDNS/src/ESPmDNS.cpp index 77ab313a08f..cb8ebf4fce3 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.cpp +++ b/libraries/ESPmDNS/src/ESPmDNS.cpp @@ -42,6 +42,7 @@ License (MIT license): #include "WiFi.h" #include #include "esp_wifi.h" +#include "esp_wifi_types.h" // Add quotes around defined value #ifdef __IN_ECLIPSE__ diff --git a/libraries/ESPmDNS/src/ESPmDNS.h b/libraries/ESPmDNS/src/ESPmDNS.h index 16c590d4a87..4a2950351bb 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.h +++ b/libraries/ESPmDNS/src/ESPmDNS.h @@ -44,6 +44,7 @@ License (MIT license): #include "Arduino.h" #include "IPv6Address.h" #include "mdns.h" +#include "esp_interface.h" //this should be defined at build time #ifndef ARDUINO_VARIANT diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index a9be448e6ac..0a79d46bf20 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -39,6 +39,11 @@ #endif #include "lwip/err.h" #include "lwip/dns.h" +#include "esp_mac.h" +#include "esp_netif.h" +#include "esp_netif_types.h" +#include "esp_netif_defaults.h" +#include "esp_eth_phy.h" extern void tcpipInit(); @@ -229,6 +234,10 @@ ETHClass::~ETHClass() bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_type_t type, eth_clock_mode_t clock_mode, bool use_mac_from_efuse) { #if ESP_IDF_VERSION_MAJOR > 3 + if(esp_netif != NULL){ + return true; + } + eth_clock_mode = clock_mode; tcpipInit(); @@ -239,10 +248,10 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ esp_base_mac_addr_set(p); } - tcpip_adapter_set_default_eth_handlers(); + //tcpip_adapter_set_default_eth_handlers(); esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH(); - esp_netif_t *eth_netif = esp_netif_new(&cfg); + esp_netif = esp_netif_new(&cfg); esp_eth_mac_t *eth_mac = NULL; #if CONFIG_ETH_SPI_ETHERNET_DM9051 @@ -251,13 +260,16 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ } else { #endif #if CONFIG_ETH_USE_ESP32_EMAC - eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); + eth_esp32_emac_config_t mac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG(); mac_config.clock_config.rmii.clock_mode = (eth_clock_mode) ? EMAC_CLK_OUT : EMAC_CLK_EXT_IN; mac_config.clock_config.rmii.clock_gpio = (1 == eth_clock_mode) ? EMAC_APPL_CLK_OUT_GPIO : (2 == eth_clock_mode) ? EMAC_CLK_OUT_GPIO : (3 == eth_clock_mode) ? EMAC_CLK_OUT_180_GPIO : EMAC_CLK_IN_GPIO; mac_config.smi_mdc_gpio_num = mdc; mac_config.smi_mdio_gpio_num = mdio; - mac_config.sw_reset_timeout_ms = 1000; - eth_mac = esp_eth_mac_new_esp32(&mac_config); + + eth_mac_config_t eth_mac_config = ETH_MAC_DEFAULT_CONFIG(); + eth_mac_config.sw_reset_timeout_ms = 1000; + + eth_mac = esp_eth_mac_new_esp32(&mac_config, ð_mac_config); #endif #if CONFIG_ETH_SPI_ETHERNET_DM9051 } @@ -274,7 +286,7 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ esp_eth_phy_t *eth_phy = NULL; switch(type){ case ETH_PHY_LAN8720: - eth_phy = esp_eth_phy_new_lan8720(&phy_config); + eth_phy = esp_eth_phy_new_lan87xx(&phy_config); break; case ETH_PHY_TLK110: eth_phy = esp_eth_phy_new_ip101(&phy_config); @@ -292,14 +304,14 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ #endif case ETH_PHY_KSZ8041: #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4,4,0) - eth_phy = esp_eth_phy_new_ksz8041(&phy_config); + eth_phy = esp_eth_phy_new_ksz80xx(&phy_config); #else log_e("unsupported ethernet type 'ETH_PHY_KSZ8041'"); #endif break; case ETH_PHY_KSZ8081: #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4,4,0) - eth_phy = esp_eth_phy_new_ksz8081(&phy_config); + eth_phy = esp_eth_phy_new_ksz80xx(&phy_config); #else log_e("unsupported ethernet type 'ETH_PHY_KSZ8081'"); #endif @@ -322,7 +334,7 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ } /* attach Ethernet driver to TCP/IP stack */ - if(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)) != ESP_OK){ + if(esp_netif_attach(esp_netif, esp_eth_new_netif_glue(eth_handle)) != ESP_OK){ log_e("esp_netif_attach failed"); return false; } @@ -392,7 +404,7 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ log_e("esp_eth_init error: %d", err); } #endif - // holds a few microseconds to let DHCP start and enter into a good state + // holds a few milliseconds to let DHCP start and enter into a good state // FIX ME -- adresses issue https://github.com/espressif/arduino-esp32/issues/5733 delay(50); @@ -402,7 +414,7 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1, IPAddress dns2) { esp_err_t err = ESP_OK; - tcpip_adapter_ip_info_t info; + esp_netif_ip_info_t info; if(static_cast(local_ip) != 0){ info.ip.addr = static_cast(local_ip); @@ -414,42 +426,42 @@ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, I info.netmask.addr = 0; } - err = tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_ETH); - if(err != ESP_OK && err != ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED){ + err = esp_netif_dhcpc_stop(esp_netif); + if(err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED){ log_e("DHCP could not be stopped! Error: %d", err); return false; } - err = tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_ETH, &info); + err = esp_netif_set_ip_info(esp_netif, &info); if(err != ERR_OK){ - log_e("STA IP could not be configured! Error: %d", err); + log_e("ETH IP could not be configured! Error: %d", err); return false; } if(info.ip.addr){ staticIP = true; } else { - err = tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_ETH); - if(err != ESP_OK && err != ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED){ + err = esp_netif_dhcpc_start(esp_netif); + if(err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STARTED){ log_w("DHCP could not be started! Error: %d", err); return false; } staticIP = false; } - ip_addr_t d; - d.type = IPADDR_TYPE_V4; + esp_netif_dns_info_t d; + d.ip.type = IPADDR_TYPE_V4; if(static_cast(dns1) != 0) { // Set DNS1-Server - d.u_addr.ip4.addr = static_cast(dns1); - dns_setserver(0, &d); + d.ip.u_addr.ip4.addr = static_cast(dns1); + esp_netif_set_dns_info(esp_netif, ESP_NETIF_DNS_MAIN, &d); } if(static_cast(dns2) != 0) { // Set DNS2-Server - d.u_addr.ip4.addr = static_cast(dns2); - dns_setserver(1, &d); + d.ip.u_addr.ip4.addr = static_cast(dns2); + esp_netif_set_dns_info(esp_netif, ESP_NETIF_DNS_BACKUP, &d); } return true; @@ -457,8 +469,8 @@ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, I IPAddress ETHClass::localIP() { - tcpip_adapter_ip_info_t ip; - if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){ + esp_netif_ip_info_t ip; + if(esp_netif_get_ip_info(esp_netif, &ip)){ return IPAddress(); } return IPAddress(ip.ip.addr); @@ -466,8 +478,8 @@ IPAddress ETHClass::localIP() IPAddress ETHClass::subnetMask() { - tcpip_adapter_ip_info_t ip; - if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){ + esp_netif_ip_info_t ip; + if(esp_netif_get_ip_info(esp_netif, &ip)){ return IPAddress(); } return IPAddress(ip.netmask.addr); @@ -475,8 +487,8 @@ IPAddress ETHClass::subnetMask() IPAddress ETHClass::gatewayIP() { - tcpip_adapter_ip_info_t ip; - if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){ + esp_netif_ip_info_t ip; + if(esp_netif_get_ip_info(esp_netif, &ip)){ return IPAddress(); } return IPAddress(ip.gw.addr); @@ -484,14 +496,17 @@ IPAddress ETHClass::gatewayIP() IPAddress ETHClass::dnsIP(uint8_t dns_no) { - const ip_addr_t * dns_ip = dns_getserver(dns_no); - return IPAddress(dns_ip->u_addr.ip4.addr); + esp_netif_dns_info_t d; + if(esp_netif_get_dns_info(esp_netif, dns_no?ESP_NETIF_DNS_BACKUP:ESP_NETIF_DNS_MAIN, &d) != ESP_OK){ + return IPAddress(); + } + return IPAddress(d.ip.u_addr.ip4.addr); } IPAddress ETHClass::broadcastIP() { - tcpip_adapter_ip_info_t ip; - if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){ + esp_netif_ip_info_t ip; + if(esp_netif_get_ip_info(esp_netif, &ip)){ return IPAddress(); } return WiFiGenericClass::calculateBroadcast(IPAddress(ip.gw.addr), IPAddress(ip.netmask.addr)); @@ -499,8 +514,8 @@ IPAddress ETHClass::broadcastIP() IPAddress ETHClass::networkID() { - tcpip_adapter_ip_info_t ip; - if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){ + esp_netif_ip_info_t ip; + if(esp_netif_get_ip_info(esp_netif, &ip)){ return IPAddress(); } return WiFiGenericClass::calculateNetworkID(IPAddress(ip.gw.addr), IPAddress(ip.netmask.addr)); @@ -508,8 +523,8 @@ IPAddress ETHClass::networkID() uint8_t ETHClass::subnetCIDR() { - tcpip_adapter_ip_info_t ip; - if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){ + esp_netif_ip_info_t ip; + if(esp_netif_get_ip_info(esp_netif, &ip)){ return (uint8_t)0; } return WiFiGenericClass::calculateSubnetCIDR(IPAddress(ip.netmask.addr)); @@ -518,7 +533,7 @@ uint8_t ETHClass::subnetCIDR() const char * ETHClass::getHostname() { const char * hostname; - if(tcpip_adapter_get_hostname(TCPIP_ADAPTER_IF_ETH, &hostname)){ + if(esp_netif_get_hostname(esp_netif, &hostname)){ return NULL; } return hostname; @@ -526,7 +541,7 @@ const char * ETHClass::getHostname() bool ETHClass::setHostname(const char * hostname) { - return tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_ETH, hostname) == 0; + return esp_netif_set_hostname(esp_netif, hostname) == 0; } bool ETHClass::fullDuplex() @@ -562,13 +577,13 @@ uint8_t ETHClass::linkSpeed() bool ETHClass::enableIpV6() { - return tcpip_adapter_create_ip6_linklocal(TCPIP_ADAPTER_IF_ETH) == 0; + return esp_netif_create_ip6_linklocal(esp_netif) == 0; } IPv6Address ETHClass::localIPv6() { - static ip6_addr_t addr; - if(tcpip_adapter_get_ip6_linklocal(TCPIP_ADAPTER_IF_ETH, &addr)){ + static esp_ip6_addr_t addr; + if(esp_netif_get_ip6_linklocal(esp_netif, &addr)){ return IPv6Address(); } return IPv6Address(addr.addr); diff --git a/libraries/Ethernet/src/ETH.h b/libraries/Ethernet/src/ETH.h index 7fc14f59cb3..c811ddbf103 100644 --- a/libraries/Ethernet/src/ETH.h +++ b/libraries/Ethernet/src/ETH.h @@ -24,6 +24,7 @@ #include "WiFi.h" #include "esp_system.h" #include "esp_eth.h" +#include "esp_netif.h" #ifndef ETH_PHY_ADDR #define ETH_PHY_ADDR 0 @@ -62,6 +63,7 @@ class ETHClass { bool staticIP; #if ESP_IDF_VERSION_MAJOR > 3 esp_eth_handle_t eth_handle; + esp_netif_t *esp_netif; protected: bool started; diff --git a/libraries/FFat/examples/FFat_Test/FFat_Test.ino b/libraries/FFat/examples/FFat_Test/FFat_Test.ino index 9ae55a8c5e4..d31637af0eb 100644 --- a/libraries/FFat/examples/FFat_Test/FFat_Test.ino +++ b/libraries/FFat/examples/FFat_Test/FFat_Test.ino @@ -127,7 +127,7 @@ void testFileIO(fs::FS &fs, const char * path){ } Serial.println(""); uint32_t end = millis() - start; - Serial.printf(" - %u bytes written in %u ms\r\n", 2048 * 512, end); + Serial.printf(" - %u bytes written in %lu ms\r\n", 2048 * 512, end); file.close(); file = fs.open(path); @@ -152,7 +152,7 @@ void testFileIO(fs::FS &fs, const char * path){ } Serial.println(""); end = millis() - start; - Serial.printf("- %u bytes read in %u ms\r\n", flen, end); + Serial.printf("- %u bytes read in %lu ms\r\n", flen, end); file.close(); } else { Serial.println("- failed to open file for reading"); diff --git a/libraries/FFat/src/FFat.cpp b/libraries/FFat/src/FFat.cpp index f58bc444c17..e312e7f8f92 100644 --- a/libraries/FFat/src/FFat.cpp +++ b/libraries/FFat/src/FFat.cpp @@ -53,12 +53,13 @@ bool F_Fat::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles esp_vfs_fat_mount_config_t conf = { .format_if_mount_failed = formatOnFail, .max_files = maxOpenFiles, - .allocation_unit_size = CONFIG_WL_SECTOR_SIZE + .allocation_unit_size = CONFIG_WL_SECTOR_SIZE, + .disk_status_check_enable = false }; - esp_err_t err = esp_vfs_fat_spiflash_mount(basePath, partitionLabel, &conf, &_wl_handle); + esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(basePath, partitionLabel, &conf, &_wl_handle); if(err){ log_e("Mounting FFat partition failed! Error: %d", err); - esp_vfs_fat_spiflash_unmount(basePath, _wl_handle); + esp_vfs_fat_spiflash_unmount_rw_wl(basePath, _wl_handle); _wl_handle = WL_INVALID_HANDLE; return false; } @@ -69,7 +70,7 @@ bool F_Fat::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles void F_Fat::end() { if(_wl_handle != WL_INVALID_HANDLE){ - esp_err_t err = esp_vfs_fat_spiflash_unmount(_impl->mountpoint(), _wl_handle); + esp_err_t err = esp_vfs_fat_spiflash_unmount_rw_wl(_impl->mountpoint(), _wl_handle); if(err){ log_e("Unmounting FFat partition failed! Error: %d", err); return; @@ -109,13 +110,14 @@ bool F_Fat::format(bool full_wipe, char* partitionLabel) esp_vfs_fat_mount_config_t conf = { .format_if_mount_failed = true, .max_files = 1, - .allocation_unit_size = CONFIG_WL_SECTOR_SIZE + .allocation_unit_size = CONFIG_WL_SECTOR_SIZE, + .disk_status_check_enable = false }; - result = esp_vfs_fat_spiflash_mount("/format_ffat", partitionLabel, &conf, &temp_handle); - esp_vfs_fat_spiflash_unmount("/format_ffat", temp_handle); + result = esp_vfs_fat_spiflash_mount_rw_wl("/format_ffat", partitionLabel, &conf, &temp_handle); + esp_vfs_fat_spiflash_unmount_rw_wl("/format_ffat", temp_handle); if (result != ESP_OK){ res = false; - log_w("esp_vfs_fat_spiflash_mount failed!"); + log_w("esp_vfs_fat_spiflash_mount_rw_wl failed!"); } return res; } diff --git a/libraries/I2S/examples/SimpleTone/SimpleTone.ino b/libraries/I2S/examples/SimpleTone/SimpleTone.ino index dd312cf8a82..49cae77238f 100644 --- a/libraries/I2S/examples/SimpleTone/SimpleTone.ino +++ b/libraries/I2S/examples/SimpleTone/SimpleTone.ino @@ -35,7 +35,7 @@ const int bps = 16; const int halfWavelength = (sampleRate / frequency); // half wavelength of square wave -short sample = amplitude; // current sample value +int32_t sample = amplitude; // current sample value int count = 0; i2s_mode_t mode = I2S_PHILIPS_MODE; // I2S decoder is needed diff --git a/libraries/I2S/src/I2S.cpp b/libraries/I2S/src/I2S.cpp index 78dc5c202df..7414067eb87 100644 --- a/libraries/I2S/src/I2S.cpp +++ b/libraries/I2S/src/I2S.cpp @@ -144,7 +144,20 @@ int I2SClass::_installDriver(){ .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2, .dma_buf_count = _I2S_DMA_BUFFER_COUNT, .dma_buf_len = _i2s_dma_buffer_size, - .use_apll = false + .use_apll = false, + #warning The following values are new and need to be checked + .tx_desc_auto_clear = true, + .fixed_mclk = 0, + .mclk_multiple = esp_i2s::I2S_MCLK_MULTIPLE_128, + .bits_per_chan = esp_i2s::I2S_BITS_PER_CHAN_DEFAULT +#if SOC_I2S_SUPPORTS_TDM + ,.chan_mask = esp_i2s::I2S_CHANNEL_STEREO, + .total_chan = 2, + .left_align = false, + .big_edin = false, + .bit_order_msb = false, + .skip_msk = false +#endif // SOC_I2S_SUPPORTS_TDM }; if(_driveClock == false){ @@ -317,6 +330,7 @@ int I2SClass::begin(int mode, int sampleRate, int bitsPerSample, bool driveClock int I2SClass::_applyPinSetting(){ if(_driverInstalled){ esp_i2s::i2s_pin_config_t pin_config = { + .mck_io_num = I2S_PIN_NO_CHANGE, .bck_io_num = _sckPin, .ws_io_num = _fsPin, .data_out_num = I2S_PIN_NO_CHANGE, diff --git a/libraries/LittleFS/examples/LITTLEFS_test/LITTLEFS_test.ino b/libraries/LittleFS/examples/LITTLEFS_test/LITTLEFS_test.ino index a3b0145385a..5c3ca4b2f9c 100644 --- a/libraries/LittleFS/examples/LITTLEFS_test/LITTLEFS_test.ino +++ b/libraries/LittleFS/examples/LITTLEFS_test/LITTLEFS_test.ino @@ -208,7 +208,7 @@ void testFileIO(fs::FS &fs, const char * path){ } Serial.println(""); uint32_t end = millis() - start; - Serial.printf(" - %u bytes written in %u ms\r\n", 2048 * 512, end); + Serial.printf(" - %u bytes written in %lu ms\r\n", 2048 * 512, end); file.close(); file = fs.open(path); @@ -233,7 +233,7 @@ void testFileIO(fs::FS &fs, const char * path){ } Serial.println(""); end = millis() - start; - Serial.printf("- %u bytes read in %u ms\r\n", flen, end); + Serial.printf("- %u bytes read in %lu ms\r\n", flen, end); file.close(); } else { Serial.println("- failed to open file for reading"); diff --git a/libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino b/libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino index 8ae1e5434f9..1b6abc7f49e 100644 --- a/libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino +++ b/libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino @@ -151,7 +151,7 @@ void setup() chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i; } - Serial.printf("\nChip ID: %d Service Name: %s\n", chipId, service_name); + Serial.printf("\nChip ID: %lu Service Name: %s\n", chipId, service_name); Serial.printf("\nStarting ESP-RainMaker\n"); RMaker.start(); diff --git a/libraries/RainMaker/src/RMaker.cpp b/libraries/RainMaker/src/RMaker.cpp index c7e3e921dd5..f8ced7970ff 100644 --- a/libraries/RainMaker/src/RMaker.cpp +++ b/libraries/RainMaker/src/RMaker.cpp @@ -139,6 +139,7 @@ esp_err_t RMakerClass::enableOTA(ota_type_t type, const char *cert) .ota_cb = NULL, .ota_diag = NULL, .server_cert = cert, + .priv = NULL }; err = esp_rmaker_ota_enable(&ota_config, type); if(err != ESP_OK) { diff --git a/libraries/SD/examples/SD_Test/SD_Test.ino b/libraries/SD/examples/SD_Test/SD_Test.ino index 8084ee17dae..5ecabaeea89 100644 --- a/libraries/SD/examples/SD_Test/SD_Test.ino +++ b/libraries/SD/examples/SD_Test/SD_Test.ino @@ -150,7 +150,7 @@ void testFileIO(fs::FS &fs, const char * path){ len -= toRead; } end = millis() - start; - Serial.printf("%u bytes read for %u ms\n", flen, end); + Serial.printf("%u bytes read for %lu ms\n", flen, end); file.close(); } else { Serial.println("Failed to open file for reading"); @@ -169,7 +169,7 @@ void testFileIO(fs::FS &fs, const char * path){ file.write(buf, 512); } end = millis() - start; - Serial.printf("%u bytes written for %u ms\n", 2048 * 512, end); + Serial.printf("%u bytes written for %lu ms\n", 2048 * 512, end); file.close(); } diff --git a/libraries/SD/src/sd_diskio.cpp b/libraries/SD/src/sd_diskio.cpp index 4d690135594..d83bd020481 100644 --- a/libraries/SD/src/sd_diskio.cpp +++ b/libraries/SD/src/sd_diskio.cpp @@ -806,7 +806,9 @@ bool sdcard_mount(uint8_t pdrv, const char* path, uint8_t max_files, bool format log_e("alloc for f_mkfs failed"); return false; } - res = f_mkfs(drv, FM_ANY, 0, work, sizeof(work)); + //FRESULT f_mkfs (const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len); + const MKFS_PARM opt = {(BYTE)FM_ANY, 0, 0, 0, 0}; + res = f_mkfs(drv, &opt, work, sizeof(work)); free(work); if (res != FR_OK) { log_e("f_mkfs failed: %s", fferr2str[res]); diff --git a/libraries/SD_MMC/examples/SDMMC_Test/SDMMC_Test.ino b/libraries/SD_MMC/examples/SDMMC_Test/SDMMC_Test.ino index 024ea4bfdea..2ec9f663fd9 100644 --- a/libraries/SD_MMC/examples/SDMMC_Test/SDMMC_Test.ino +++ b/libraries/SD_MMC/examples/SDMMC_Test/SDMMC_Test.ino @@ -147,7 +147,7 @@ void testFileIO(fs::FS &fs, const char * path){ len -= toRead; } end = millis() - start; - Serial.printf("%u bytes read for %u ms\n", flen, end); + Serial.printf("%u bytes read for %lu ms\n", flen, end); file.close(); } else { Serial.println("Failed to open file for reading"); @@ -166,7 +166,7 @@ void testFileIO(fs::FS &fs, const char * path){ file.write(buf, 512); } end = millis() - start; - Serial.printf("%u bytes written for %u ms\n", 2048 * 512, end); + Serial.printf("%u bytes written for %lu ms\n", 2048 * 512, end); file.close(); } diff --git a/libraries/SD_MMC/src/SD_MMC.cpp b/libraries/SD_MMC/src/SD_MMC.cpp index 7365e0df01f..b8f0fd0e15f 100644 --- a/libraries/SD_MMC/src/SD_MMC.cpp +++ b/libraries/SD_MMC/src/SD_MMC.cpp @@ -72,8 +72,8 @@ bool SDMMCFS::setPins(int clk, int cmd, int d0, int d1, int d2, int d3) (d0 == (int)SDMMC_SLOT1_IOMUX_PIN_NUM_D0) && (((d1 == -1) && (d2 == -1) && (d3 == -1)) || ((d1 == (int)SDMMC_SLOT1_IOMUX_PIN_NUM_D1) && - (d1 == (int)SDMMC_SLOT1_IOMUX_PIN_NUM_D2) && - (d1 == (int)SDMMC_SLOT1_IOMUX_PIN_NUM_D3))); + (d2 == (int)SDMMC_SLOT1_IOMUX_PIN_NUM_D2) && + (d3 == (int)SDMMC_SLOT1_IOMUX_PIN_NUM_D3))); if (!pins_ok) { log_e("SDMMCFS: specified pins are not supported by this chip."); return false; @@ -123,7 +123,8 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount esp_vfs_fat_sdmmc_mount_config_t mount_config = { .format_if_mount_failed = format_if_mount_failed, .max_files = maxOpenFiles, - .allocation_unit_size = 0 + .allocation_unit_size = 0, + .disk_status_check_enable = false }; esp_err_t ret = esp_vfs_fat_sdmmc_mount(mountpoint, &host, &slot_config, &mount_config, &_card); diff --git a/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino b/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino index 9ee67e6c12f..3b19be5eaee 100644 --- a/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino +++ b/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino @@ -125,7 +125,7 @@ void testFileIO(fs::FS &fs, const char * path){ } Serial.println(""); uint32_t end = millis() - start; - Serial.printf(" - %u bytes written in %u ms\r\n", 2048 * 512, end); + Serial.printf(" - %u bytes written in %lu ms\r\n", 2048 * 512, end); file.close(); file = fs.open(path); @@ -150,7 +150,7 @@ void testFileIO(fs::FS &fs, const char * path){ } Serial.println(""); end = millis() - start; - Serial.printf("- %u bytes read in %u ms\r\n", flen, end); + Serial.printf("- %u bytes read in %lu ms\r\n", flen, end); file.close(); } else { Serial.println("- failed to open file for reading"); diff --git a/libraries/Ticker/examples/Arguments/Arguments.ino b/libraries/Ticker/examples/Arguments/Arguments.ino index cde8acbfa09..7f5bc5cde21 100644 --- a/libraries/Ticker/examples/Arguments/Arguments.ino +++ b/libraries/Ticker/examples/Arguments/Arguments.ino @@ -1,25 +1,49 @@ +/* + * This example demonstrates used of Ticker with arguments. + * You can call the same callback function with different argument on different times. + * Based on the argument the callback can perform different tasks. + */ + #include #include -// attach a LED to GPIO 21 -#define LED_PIN 21 +// Arguments for the function must remain valid (not run out of scope) otherwise the function would read garbage data. +int LED_PIN_1 = 4; +#ifdef LED_BUILTIN + int LED_PIN_2 = LED_BUILTIN; +#else + int LED_PIN_2 = 8; +#endif Ticker tickerSetHigh; Ticker tickerSetLow; -void setPin(int state) { - digitalWrite(LED_PIN, state); +// Argument to callback must always be passed a reference +void swapState(int *pin) { + static int led_1_state = 1; + static int led_2_state = 1; + if(*pin == LED_PIN_1){ + Serial.printf("[%lu ms] set pin %d to state: %d\n", millis(), *pin, led_1_state); + digitalWrite(*pin, led_1_state); + led_1_state = led_1_state ? 0 : 1; // reverse for next pass + }else if(*pin == LED_PIN_2){ + Serial.printf("[%lu ms] set pin %d to state: %d\n", millis(), *pin, led_2_state); + digitalWrite(*pin, led_2_state); + led_2_state = led_2_state ? 0 : 1; // reverse for next pass + } } void setup() { - pinMode(LED_PIN, OUTPUT); - digitalWrite(1, LOW); + Serial.begin(115200); + pinMode(LED_PIN_1, OUTPUT); + pinMode(LED_PIN_2, OUTPUT); + //digitalWrite(1, LOW); - // every 25 ms, call setPin(0) - tickerSetLow.attach_ms(25, setPin, 0); + // Blink LED every 500 ms on LED_PIN_1 + tickerSetLow.attach_ms(500, swapState, &LED_PIN_1); - // every 26 ms, call setPin(1) - tickerSetHigh.attach_ms(26, setPin, 1); + // Blink LED every 1000 ms on LED_PIN_2 + tickerSetHigh.attach_ms(1000, swapState, &LED_PIN_2); } void loop() { diff --git a/libraries/USB/examples/CompositeDevice/CompositeDevice.ino b/libraries/USB/examples/CompositeDevice/CompositeDevice.ino index 4c1021bc57b..587720ab85e 100644 --- a/libraries/USB/examples/CompositeDevice/CompositeDevice.ino +++ b/libraries/USB/examples/CompositeDevice/CompositeDevice.ino @@ -67,7 +67,7 @@ static void usbEventCallback(void* arg, esp_event_base_t event_base, int32_t eve HWSerial.printf("CDC LINE STATE: dtr: %u, rts: %u\n", data->line_state.dtr, data->line_state.rts); break; case ARDUINO_USB_CDC_LINE_CODING_EVENT: - HWSerial.printf("CDC LINE CODING: bit_rate: %u, data_bits: %u, stop_bits: %u, parity: %u\n", data->line_coding.bit_rate, data->line_coding.data_bits, data->line_coding.stop_bits, data->line_coding.parity); + HWSerial.printf("CDC LINE CODING: bit_rate: %lu, data_bits: %u, stop_bits: %u, parity: %u\n", data->line_coding.bit_rate, data->line_coding.data_bits, data->line_coding.stop_bits, data->line_coding.parity); break; case ARDUINO_USB_CDC_RX_EVENT: HWSerial.printf("CDC RX [%u]:", data->rx.len); diff --git a/libraries/USB/examples/USBMSC/USBMSC.ino b/libraries/USB/examples/USBMSC/USBMSC.ino index 67378109985..bf836cad087 100644 --- a/libraries/USB/examples/USBMSC/USBMSC.ino +++ b/libraries/USB/examples/USBMSC/USBMSC.ino @@ -136,13 +136,13 @@ static uint8_t msc_disk[DISK_SECTOR_COUNT][DISK_SECTOR_SIZE] = }; static int32_t onWrite(uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize){ - HWSerial.printf("MSC WRITE: lba: %u, offset: %u, bufsize: %u\n", lba, offset, bufsize); + HWSerial.printf("MSC WRITE: lba: %lu, offset: %lu, bufsize: %lu\n", lba, offset, bufsize); memcpy(msc_disk[lba] + offset, buffer, bufsize); return bufsize; } static int32_t onRead(uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize){ - HWSerial.printf("MSC READ: lba: %u, offset: %u, bufsize: %u\n", lba, offset, bufsize); + HWSerial.printf("MSC READ: lba: %lu, offset: %lu, bufsize: %lu\n", lba, offset, bufsize); memcpy(buffer, msc_disk[lba] + offset, bufsize); return bufsize; } diff --git a/libraries/USB/examples/USBSerial/USBSerial.ino b/libraries/USB/examples/USBSerial/USBSerial.ino index 0f57e2b1b1d..e9cd317d9c9 100644 --- a/libraries/USB/examples/USBSerial/USBSerial.ino +++ b/libraries/USB/examples/USBSerial/USBSerial.ino @@ -46,7 +46,7 @@ static void usbEventCallback(void* arg, esp_event_base_t event_base, int32_t eve HWSerial.printf("CDC LINE STATE: dtr: %u, rts: %u\n", data->line_state.dtr, data->line_state.rts); break; case ARDUINO_USB_CDC_LINE_CODING_EVENT: - HWSerial.printf("CDC LINE CODING: bit_rate: %u, data_bits: %u, stop_bits: %u, parity: %u\n", data->line_coding.bit_rate, data->line_coding.data_bits, data->line_coding.stop_bits, data->line_coding.parity); + HWSerial.printf("CDC LINE CODING: bit_rate: %lu, data_bits: %u, stop_bits: %u, parity: %u\n", data->line_coding.bit_rate, data->line_coding.data_bits, data->line_coding.stop_bits, data->line_coding.parity); break; case ARDUINO_USB_CDC_RX_EVENT: HWSerial.printf("CDC RX [%u]:", data->rx.len); diff --git a/libraries/USB/examples/USBVendor/USBVendor.ino b/libraries/USB/examples/USBVendor/USBVendor.ino index 9dbb54fb6e2..7336b4a55ab 100644 --- a/libraries/USB/examples/USBVendor/USBVendor.ino +++ b/libraries/USB/examples/USBVendor/USBVendor.ino @@ -113,7 +113,7 @@ bool vendorRequestCallback(uint8_t rhport, uint8_t requestStage, arduino_usb_con result = Vendor.sendResponse(rhport, request, (void*) &vendor_line_coding, sizeof(request_line_coding_t)); } else if (requestStage == REQUEST_STAGE_ACK) { //In the ACK stage the response is complete - HWSerial.printf("Vendor Line Coding: bit_rate: %u, data_bits: %u, stop_bits: %u, parity: %u\n", vendor_line_coding.bit_rate, vendor_line_coding.data_bits, vendor_line_coding.stop_bits, vendor_line_coding.parity); + HWSerial.printf("Vendor Line Coding: bit_rate: %lu, data_bits: %u, stop_bits: %u, parity: %u\n", vendor_line_coding.bit_rate, vendor_line_coding.data_bits, vendor_line_coding.stop_bits, vendor_line_coding.parity); } result = true; break; diff --git a/libraries/Update/examples/HTTPS_OTA_Update/HTTPS_OTA_Update.ino b/libraries/Update/examples/HTTPS_OTA_Update/HTTPS_OTA_Update.ino index 6e32ee5bd58..dfc6266e2fa 100644 --- a/libraries/Update/examples/HTTPS_OTA_Update/HTTPS_OTA_Update.ino +++ b/libraries/Update/examples/HTTPS_OTA_Update/HTTPS_OTA_Update.ino @@ -62,6 +62,9 @@ void HttpEvent(HttpEvent_t *event) case HTTP_EVENT_DISCONNECTED: Serial.println("Http Event Disconnected"); break; + case HTTP_EVENT_REDIRECT: + Serial.println("Http Event Redirect"); + break; } } diff --git a/libraries/Update/src/HttpsOTAUpdate.cpp b/libraries/Update/src/HttpsOTAUpdate.cpp index 106559bd3a4..07133fd403b 100644 --- a/libraries/Update/src/HttpsOTAUpdate.cpp +++ b/libraries/Update/src/HttpsOTAUpdate.cpp @@ -44,7 +44,14 @@ void https_ota_task(void *param) xEventGroupSetBits(ota_status, OTA_UPDATING_BIT); xEventGroupClearBits(ota_status, OTA_IDLE_BIT); } - esp_err_t ret = esp_https_ota((const esp_http_client_config_t *)param); + esp_https_ota_config_t cfg; + cfg.http_config = (const esp_http_client_config_t *)param; + cfg.http_client_init_cb = NULL; + cfg.bulk_flash_erase = false; //Erase entire flash partition during initialization + cfg.partial_http_download = false; //Enable Firmware image to be downloaded over multiple HTTP requests + cfg.max_http_request_size = 0; //Maximum request size for partial HTTP download + + esp_err_t ret = esp_https_ota((const esp_https_ota_config_t *)&cfg); if(ret == ESP_OK) { if(ota_status) { xEventGroupClearBits(ota_status, OTA_UPDATING_BIT); diff --git a/libraries/Update/src/HttpsOTAUpdate.h b/libraries/Update/src/HttpsOTAUpdate.h index c2030a96477..076e4f7894b 100644 --- a/libraries/Update/src/HttpsOTAUpdate.h +++ b/libraries/Update/src/HttpsOTAUpdate.h @@ -1,5 +1,5 @@ -#ifndef HTPSPOTUADATE_H -#define HTPSPOTUADATE_H +#ifndef HTTPSOTAUPDATE_H +#define HTTPSOTAUPDATE_H #include "esp_http_client.h" #define HttpEvent_t esp_http_client_event_t diff --git a/libraries/Update/src/Update.h b/libraries/Update/src/Update.h index 303ec7cc4cc..0969f248666 100644 --- a/libraries/Update/src/Update.h +++ b/libraries/Update/src/Update.h @@ -1,5 +1,5 @@ -#ifndef ESP8266UPDATER_H -#define ESP8266UPDATER_H +#ifndef ESP32UPDATER_H +#define ESP32UPDATER_H #include #include diff --git a/libraries/Update/src/Updater.cpp b/libraries/Update/src/Updater.cpp index 30d88cb8ff1..67a37cda879 100644 --- a/libraries/Update/src/Updater.cpp +++ b/libraries/Update/src/Updater.cpp @@ -1,6 +1,6 @@ #include "Update.h" #include "Arduino.h" -#include "esp_spi_flash.h" +#include "spi_flash_mmap.h" #include "esp_ota_ops.h" #include "esp_image_format.h" diff --git a/libraries/WebServer/examples/SDWebServer/SDWebServer.ino b/libraries/WebServer/examples/SDWebServer/SDWebServer.ino index de01610ecec..b9da60c2d60 100644 --- a/libraries/WebServer/examples/SDWebServer/SDWebServer.ino +++ b/libraries/WebServer/examples/SDWebServer/SDWebServer.ino @@ -214,7 +214,6 @@ void printDirectory() { dir.rewindDirectory(); server.setContentLength(CONTENT_LENGTH_UNKNOWN); server.send(200, "text/json", ""); - WiFiClient client = server.client(); server.sendContent("["); for (int cnt = 0; true; ++cnt) { diff --git a/libraries/WebServer/src/WebServer.cpp b/libraries/WebServer/src/WebServer.cpp index 66c01198fc9..a5117c985c1 100644 --- a/libraries/WebServer/src/WebServer.cpp +++ b/libraries/WebServer/src/WebServer.cpp @@ -127,9 +127,9 @@ static String md5str(String &in){ return String(out); memset(_buf, 0x00, 16); mbedtls_md5_init(&_ctx); - mbedtls_md5_starts_ret(&_ctx); - mbedtls_md5_update_ret(&_ctx, (const uint8_t *)in.c_str(), in.length()); - mbedtls_md5_finish_ret(&_ctx, _buf); + mbedtls_md5_starts(&_ctx); + mbedtls_md5_update(&_ctx, (const uint8_t *)in.c_str(), in.length()); + mbedtls_md5_finish(&_ctx, _buf); for(i = 0; i < 16; i++) { sprintf(out + (i * 2), "%02x", _buf[i]); } @@ -230,7 +230,7 @@ String WebServer::_getRandomHexString() { char buffer[33]; // buffer to hold 32 Hex Digit + /0 int i; for(i = 0; i < 4; i++) { - sprintf (buffer + (i*8), "%08x", esp_random()); + sprintf (buffer + (i*8), "%08lx", esp_random()); } return String(buffer); } diff --git a/libraries/WebServer/src/WebServer.h b/libraries/WebServer/src/WebServer.h index fc60d16496f..57d8724cccf 100644 --- a/libraries/WebServer/src/WebServer.h +++ b/libraries/WebServer/src/WebServer.h @@ -95,7 +95,7 @@ class WebServer String uri() { return _currentUri; } HTTPMethod method() { return _currentMethod; } - virtual WiFiClient client() { return _currentClient; } + virtual WiFiClient & client() { return _currentClient; } HTTPUpload& upload() { return *_currentUpload; } String pathArg(unsigned int i); // get request path argument by number diff --git a/libraries/WiFi/examples/FTM/FTM_Initiator/FTM_Initiator.ino b/libraries/WiFi/examples/FTM/FTM_Initiator/FTM_Initiator.ino index 91c1ba45cb4..6cc8659e3e2 100644 --- a/libraries/WiFi/examples/FTM/FTM_Initiator/FTM_Initiator.ino +++ b/libraries/WiFi/examples/FTM/FTM_Initiator/FTM_Initiator.ino @@ -35,7 +35,7 @@ void onFtmReport(arduino_event_t *event) { ftmSuccess = report->status == FTM_STATUS_SUCCESS; if (ftmSuccess) { // The estimated distance in meters may vary depending on some factors (see README file) - Serial.printf("FTM Estimate: Distance: %.2f m, Return Time: %u ns\n", (float)report->dist_est / 100.0, report->rtt_est); + Serial.printf("FTM Estimate: Distance: %.2f m, Return Time: %lu ns\n", (float)report->dist_est / 100.0, report->rtt_est); // Pointer to FTM Report with multiple entries, should be freed after use free(report->ftm_report_data); } else { diff --git a/libraries/WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino b/libraries/WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino index 4e654d12c79..f5c4bc2910c 100644 --- a/libraries/WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino +++ b/libraries/WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino @@ -15,7 +15,9 @@ #include #include +#ifndef LED_BUILTIN #define LED_BUILTIN 2 // Set the GPIO pin where you connected your test LED or comment this line out if your dev board has a built-in LED +#endif // Set these to your desired credentials. const char *ssid = "yourAP"; diff --git a/libraries/WiFi/examples/WiFiClient/README.md b/libraries/WiFi/examples/WiFiClient/README.md new file mode 100644 index 00000000000..079ed9f29a8 --- /dev/null +++ b/libraries/WiFi/examples/WiFiClient/README.md @@ -0,0 +1,165 @@ +# WiFiClient + +This example demonstrates reading and writing data from and to a web service which can be used for logging data, creating insights and taking actions based on those data. + +# Supported Targets + +Currently, this example supports all SoC with WiFi. + + +| Supported Targets | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 | + + +## How to Use Example + +Flash this example and observe the serial output. You can also take a look at the values at [https://thingspeak.com/channels/2005329](https://thingspeak.com/channels/2005329) + +Please note that this public channel can be accessed by anyone and it is possible that more people will write their values. + +### Configure the Project + +Change `SSID` and `password` to connect to your WiFi. +Default values will allow you to use this example without any changes. If you want to use your own channel and you don't have one already follow these steps: + +* Create an account on [thingspeak.com](https://www.thingspeak.com). +* After logging in, click on the "New Channel" button to create a new channel for your data. This is where your data will be stored and displayed. +* Fill in the Name, Description, and other fields for your channel as desired, then click the "Save Channel" button. +* Take note of the "Write API Key" located in the "API keys" tab, this is the key you will use to send data to your channel. +* Replace the channelID from tab "Channel Settings" and privateKey with "Read API Keys" from "API Keys" tab. +* Replace the host variable with the thingspeak server hostname "api.thingspeak.com" +* Upload the sketch to your ESP32 board and make sure that the board is connected to the internet. The ESP32 should now send data to your Thingspeak channel at the intervals specified by the loop function. +* Go to the channel view page on thingspeak and check the "Field1" for the new incoming data. +* You can use the data visualization and analysis tools provided by Thingspeak to display and process your data in various ways. +* Please note, that Thingspeak accepts only integer values. + +#### Config example: + +You can find the data to be changed at the top of the file: + +```cpp +const char* ssid = "your-ssid"; // Change this to your WiFi SSID +const char* password = "your-password"; // Change this to your WiFi password + +const char* host = "api.thingspeak.com"; // This should not be changed +const int httpPort = 80; // This should not be changed +const String channelID = "2005329"; // Change this to your channel ID +const String writeApiKey = "V6YOTILH9I7D51F9"; // Change this to your Write API key +const String readApiKey = "34W6LGLIFXD56MPM"; // Change this to your Read API key + +// The default example accepts one data filed named "field1" +// For your own server you can ofcourse create more of them. +int field1 = 0; + +int numberOfResults = 3; // Number of results to be read +int fieldNumber = 1; // Field number which will be read out +``` + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port. + +#### Using Platform IO + +* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file. + +## Example Log Output + +The initial output which is common for all examples can be ignored: +``` +SP-ROM:esp32c3-api1-20210207 +Build:Feb 7 2021 +rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT) +SPIWP:0xee +mode:DIO, clock div:1 +load:0x3fcd5810,len:0x438 +load:0x403cc710,len:0x918 +load:0x403ce710,len:0x24e4 +entry 0x403cc710 +``` +Follows the setup output where connection to your WiFi happens: +``` +****************************************************** +Connecting to your-ssid +. +WiFi connected +IP address: +192.168.1.2 +``` +Then you can see the write log: +``` +HTTP/1.1 200 OK +Date: Fri, 13 Jan 2023 13:12:31 GMT +Content-Type: text/plain; charset=utf-8 +Content-Length: 1 +Connection: close +Status: 200 OK +Cache-Control: max-age=0, private, must-revalidate +Access-Control-Allow-Origin: * +Access-Control-Max-Age: 1800 +X-Request-Id: 188e3464-f155-44b0-96f6-0f3614170bb0 +Access-Control-Allow-Headers: origin, content-type, X-Requested-With +Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH +ETag: W/"5feceb66ffc86f38d952786c6d696c79" +X-Frame-Options: SAMEORIGIN + +0 +Closing connection +``` +Last portion is the read log: +``` +HTTP/1.1 200 OK +Date: Fri, 13 Jan 2023 13:12:32 GMT +Content-Type: application/json; charset=utf-8 +Transfer-Encoding: chunked +Connection: close +Status: 200 OK +Cache-Control: max-age=7, private +Access-Control-Allow-Origin: * +Access-Control-Max-Age: 1800 +X-Request-Id: 91b97016-7625-44f6-9797-1b2973aa57b7 +Access-Control-Allow-Headers: origin, content-type, X-Requested-With +Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH +ETag: W/"8e9c308fe2c50309f991586be1aff28d" +X-Frame-Options: SAMEORIGIN + +1e3 +{"channel":{"id":2005329,"name":"WiFiCLient example","description":"Default setup for Arduino ESP32 WiFiClient example","latitude":"0.0","longitude":"0.0","field1":"data0","created_at":"2023-01-11T15:56:08Z","updated_at":"2023-01-13T08:13:58Z","last_entry_id":2871},"feeds":[{"created_at":"2023-01-13T13:11:30Z","entry_id":2869,"field1":"359"},{"created_at":"2023-01-13T13:11:57Z","entry_id":2870,"field1":"361"},{"created_at":"2023-01-13T13:12:23Z","entry_id":2871,"field1":"363"}]} +0 + + +Closing connection +``` +After this the write+read log repeat every 10 seconds. + + +## Troubleshooting + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +* **WiFi not connected:** Check the SSID and password and also that the signal has sufficient strength. +* **400 Bad Request:** Check the writeApiKey. +* **404 Not Found:** Check the channel ID. +* **No data on chart / reading NULL:** Data must be sent as an integer, without commas. + +If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute). + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try the Troubleshooting and to check if the same issue was already created by someone else. + +## Resources + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) +* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) +* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) +* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/WiFi/examples/WiFiClient/WiFiClient.ino b/libraries/WiFi/examples/WiFiClient/WiFiClient.ino index 7dd9c8d0d35..ebd207984a2 100644 --- a/libraries/WiFi/examples/WiFiClient/WiFiClient.ino +++ b/libraries/WiFi/examples/WiFiClient/WiFiClient.ino @@ -1,29 +1,46 @@ /* - * This sketch sends data via HTTP GET requests to data.sparkfun.com service. - * - * You need to get streamId and privateKey at data.sparkfun.com and paste them - * below. Or just customize this script to talk to other HTTP servers. - * + Go to thingspeak.com and create an account if you don't have one already. + After logging in, click on the "New Channel" button to create a new channel for your data. This is where your data will be stored and displayed. + Fill in the Name, Description, and other fields for your channel as desired, then click the "Save Channel" button. + Take note of the "Write API Key" located in the "API keys" tab, this is the key you will use to send data to your channel. + Replace the channelID from tab "Channel Settings" and privateKey with "Read API Keys" from "API Keys" tab. + Replace the host variable with the thingspeak server hostname "api.thingspeak.com" + Upload the sketch to your ESP32 board and make sure that the board is connected to the internet. The ESP32 should now send data to your Thingspeak channel at the intervals specified by the loop function. + Go to the channel view page on thingspeak and check the "Field1" for the new incoming data. + You can use the data visualization and analysis tools provided by Thingspeak to display and process your data in various ways. + Please note, that Thingspeak accepts only integer values. + + You can later check the values at https://thingspeak.com/channels/2005329 + Please note that this public channel can be accessed by anyone and it is possible that more people will write their values. */ #include -const char* ssid = "your-ssid"; -const char* password = "your-password"; +const char* ssid = "your-ssid"; // Change this to your WiFi SSID +const char* password = "your-password"; // Change this to your WiFi password -const char* host = "data.sparkfun.com"; -const char* streamId = "...................."; -const char* privateKey = "...................."; +const char* host = "api.thingspeak.com"; // This should not be changed +const int httpPort = 80; // This should not be changed +const String channelID = "2005329"; // Change this to your channel ID +const String writeApiKey = "V6YOTILH9I7D51F9"; // Change this to your Write API key +const String readApiKey = "34W6LGLIFXD56MPM"; // Change this to your Read API key + +// The default example accepts one data filed named "field1" +// For your own server you can ofcourse create more of them. +int field1 = 0; + +int numberOfResults = 3; // Number of results to be read +int fieldNumber = 1; // Field number which will be read out void setup() { Serial.begin(115200); - delay(10); + while(!Serial){delay(100);} // We start by connecting to a WiFi network Serial.println(); - Serial.println(); + Serial.println("******************************************************"); Serial.print("Connecting to "); Serial.println(ssid); @@ -40,55 +57,52 @@ void setup() Serial.println(WiFi.localIP()); } -int value = 0; - -void loop() -{ - delay(5000); - ++value; - - Serial.print("connecting to "); - Serial.println(host); - - // Use WiFiClient class to create TCP connections - WiFiClient client; - const int httpPort = 80; - if (!client.connect(host, httpPort)) { - Serial.println("connection failed"); - return; +void readResponse(WiFiClient *client){ + unsigned long timeout = millis(); + while(client->available() == 0){ + if(millis() - timeout > 5000){ + Serial.println(">>> Client Timeout !"); + client->stop(); + return; } + } - // We now create a URI for the request - String url = "/input/"; - url += streamId; - url += "?private_key="; - url += privateKey; - url += "&value="; - url += value; - - Serial.print("Requesting URL: "); - Serial.println(url); - - // This will send the request to the server - client.print(String("GET ") + url + " HTTP/1.1\r\n" + - "Host: " + host + "\r\n" + - "Connection: close\r\n\r\n"); - unsigned long timeout = millis(); - while (client.available() == 0) { - if (millis() - timeout > 5000) { - Serial.println(">>> Client Timeout !"); - client.stop(); - return; - } - } - - // Read all the lines of the reply from server and print them to Serial - while(client.available()) { - String line = client.readStringUntil('\r'); - Serial.print(line); - } + // Read all the lines of the reply from server and print them to Serial + while(client->available()) { + String line = client->readStringUntil('\r'); + Serial.print(line); + } - Serial.println(); - Serial.println("closing connection"); + Serial.printf("\nClosing connection\n\n"); } +void loop(){ + WiFiClient client; + String footer = String(" HTTP/1.1\r\n") + "Host: " + String(host) + "\r\n" + "Connection: close\r\n\r\n"; + + // WRITE -------------------------------------------------------------------------------------------- + if (!client.connect(host, httpPort)) { + return; + } + + client.print("GET /update?api_key=" + writeApiKey + "&field1=" + field1 + footer); + readResponse(&client); + + // READ -------------------------------------------------------------------------------------------- + + String readRequest = "GET /channels/" + channelID + "/fields/" + fieldNumber + ".json?results=" + numberOfResults + " HTTP/1.1\r\n" + + "Host: " + host + "\r\n" + + "Connection: close\r\n\r\n"; + + if (!client.connect(host, httpPort)) { + return; + } + + client.print(readRequest); + readResponse(&client); + + // ------------------------------------------------------------------------------------------------- + + ++field1; + delay(10000); +} \ No newline at end of file diff --git a/libraries/WiFi/examples/WiFiScan/WiFiScan.ino b/libraries/WiFi/examples/WiFiScan/WiFiScan.ino index 12827e88ed0..5bef55f878d 100644 --- a/libraries/WiFi/examples/WiFiScan/WiFiScan.ino +++ b/libraries/WiFi/examples/WiFiScan/WiFiScan.ino @@ -36,9 +36,9 @@ void loop() Serial.print(" | "); Serial.printf("%-32.32s", WiFi.SSID(i).c_str()); Serial.print(" | "); - Serial.printf("%4d", WiFi.RSSI(i)); + Serial.printf("%4ld", WiFi.RSSI(i)); Serial.print(" | "); - Serial.printf("%2d", WiFi.channel(i)); + Serial.printf("%2ld", WiFi.channel(i)); Serial.print(" | "); switch (WiFi.encryptionType(i)) { diff --git a/libraries/WiFi/src/WiFiAP.h b/libraries/WiFi/src/WiFiAP.h index a9d8f551e51..7ac03034b4c 100644 --- a/libraries/WiFi/src/WiFiAP.h +++ b/libraries/WiFi/src/WiFiAP.h @@ -38,6 +38,10 @@ class WiFiAPClass public: bool softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4, bool ftm_responder = false); + bool softAP(const String& ssid, const String& passphrase = emptyString, int channel = 1, int ssid_hidden = 0, int max_connection = 4, bool ftm_responder = false) { + return softAP(ssid.c_str(), passphrase.c_str(), channel, ssid_hidden, max_connection, ftm_responder); + } + bool softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dhcp_lease_start = (uint32_t) 0); bool softAPdisconnect(bool wifioff = false); diff --git a/libraries/WiFi/src/WiFiClient.cpp b/libraries/WiFi/src/WiFiClient.cpp index 6e56e94ac53..9e2a85f5dea 100644 --- a/libraries/WiFi/src/WiFiClient.cpp +++ b/libraries/WiFi/src/WiFiClient.cpp @@ -210,9 +210,9 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) { return connect(ip,port,_timeout); } -int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout) +int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout_ms) { - _timeout = timeout; + _timeout = timeout_ms; int sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { log_e("socket: %d", errno); @@ -231,7 +231,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout) FD_ZERO(&fdset); FD_SET(sockfd, &fdset); tv.tv_sec = _timeout / 1000; - tv.tv_usec = 0; + tv.tv_usec = (_timeout % 1000) * 1000; #ifdef ESP_IDF_VERSION_MAJOR int res = lwip_connect(sockfd, (struct sockaddr*)&serveraddr, sizeof(serveraddr)); @@ -292,13 +292,13 @@ int WiFiClient::connect(const char *host, uint16_t port) return connect(host,port,_timeout); } -int WiFiClient::connect(const char *host, uint16_t port, int32_t timeout) +int WiFiClient::connect(const char *host, uint16_t port, int32_t timeout_ms) { IPAddress srv((uint32_t)0); if(!WiFiGenericClass::hostByName(host, srv)){ return 0; } - return connect(srv, port, timeout); + return connect(srv, port, timeout_ms); } int WiFiClient::setSocketOption(int option, char* value, size_t len) diff --git a/libraries/WiFi/src/WiFiClient.h b/libraries/WiFi/src/WiFiClient.h index e6e7ecd4b3c..b18f9324209 100644 --- a/libraries/WiFi/src/WiFiClient.h +++ b/libraries/WiFi/src/WiFiClient.h @@ -50,9 +50,9 @@ class WiFiClient : public ESPLwIPClient WiFiClient(int fd); ~WiFiClient(); int connect(IPAddress ip, uint16_t port); - int connect(IPAddress ip, uint16_t port, int32_t timeout); + int connect(IPAddress ip, uint16_t port, int32_t timeout_ms); int connect(const char *host, uint16_t port); - int connect(const char *host, uint16_t port, int32_t timeout); + int connect(const char *host, uint16_t port, int32_t timeout_ms); size_t write(uint8_t data); size_t write(const uint8_t *buf, size_t size); size_t write_P(PGM_P buf, size_t size); diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index 1b74d322739..1489376bb83 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -36,10 +36,12 @@ extern "C" { #include #include #include +#include #include "lwip/ip_addr.h" #include "lwip/opt.h" #include "lwip/err.h" #include "lwip/dns.h" +#include "dhcpserver/dhcpserver.h" #include "dhcpserver/dhcpserver_options.h" } //extern "C" diff --git a/libraries/WiFi/src/WiFiGeneric.h b/libraries/WiFi/src/WiFiGeneric.h index 2f670a34d05..3c51fc8e8c5 100644 --- a/libraries/WiFi/src/WiFiGeneric.h +++ b/libraries/WiFi/src/WiFiGeneric.h @@ -29,6 +29,8 @@ #include "WiFiType.h" #include "IPAddress.h" #include "esp_smartconfig.h" +#include "esp_netif_types.h" +#include "esp_eth_driver.h" #include "wifi_provisioning/manager.h" ESP_EVENT_DECLARE_BASE(ARDUINO_EVENTS); diff --git a/libraries/WiFi/src/WiFiSTA.cpp b/libraries/WiFi/src/WiFiSTA.cpp index 7bcafea1d3e..06543485573 100644 --- a/libraries/WiFi/src/WiFiSTA.cpp +++ b/libraries/WiFi/src/WiFiSTA.cpp @@ -43,6 +43,7 @@ extern "C" { #include #include #include "esp_wpa2.h" +#include "esp_mac.h" } // ----------------------------------------------------------------------------------------------------------------------- diff --git a/libraries/WiFi/src/WiFiUdp.cpp b/libraries/WiFi/src/WiFiUdp.cpp index 476b5a4a8b5..16b0ac2920d 100644 --- a/libraries/WiFi/src/WiFiUdp.cpp +++ b/libraries/WiFi/src/WiFiUdp.cpp @@ -80,7 +80,7 @@ uint8_t WiFiUDP::begin(uint16_t p){ uint8_t WiFiUDP::beginMulticast(IPAddress a, uint16_t p){ if(begin(IPAddress(INADDR_ANY), p)){ - if(a != 0){ + if((uint32_t)a != 0){ struct ip_mreq mreq; mreq.imr_multiaddr.s_addr = (in_addr_t)a; mreq.imr_interface.s_addr = INADDR_ANY; @@ -109,7 +109,7 @@ void WiFiUDP::stop(){ } if(udp_server == -1) return; - if(multicast_ip != 0){ + if((uint32_t)multicast_ip != 0){ struct ip_mreq mreq; mreq.imr_multiaddr.s_addr = (in_addr_t)multicast_ip; mreq.imr_interface.s_addr = (in_addr_t)0; diff --git a/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp b/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp index a6814b0a60b..1c9ea8d2190 100644 --- a/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp +++ b/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp @@ -124,12 +124,21 @@ int WiFiClientSecure::connect(const char *host, uint16_t port, int32_t timeout){ int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *CA_cert, const char *cert, const char *private_key) { - return connect(ip.toString().c_str(), port, CA_cert, cert, private_key); + return connect(ip, port, NULL, CA_cert, cert, private_key); } int WiFiClientSecure::connect(const char *host, uint16_t port, const char *CA_cert, const char *cert, const char *private_key) { - int ret = start_ssl_client(sslclient, host, port, _timeout, CA_cert, _use_ca_bundle, cert, private_key, NULL, NULL, _use_insecure, _alpn_protos); + IPAddress address; + if (!WiFi.hostByName(host, address)) + return 0; + + return connect(address, port, host, CA_cert, cert, private_key); +} + +int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *host, const char *CA_cert, const char *cert, const char *private_key) +{ + int ret = start_ssl_client(sslclient, ip, port, host, _timeout, CA_cert, _use_ca_bundle, cert, private_key, NULL, NULL, _use_insecure, _alpn_protos); _lastError = ret; if (ret < 0) { log_e("start_ssl_client: %d", ret); @@ -146,7 +155,12 @@ int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *pskIdent, int WiFiClientSecure::connect(const char *host, uint16_t port, const char *pskIdent, const char *psKey) { log_v("start_ssl_client with PSK"); - int ret = start_ssl_client(sslclient, host, port, _timeout, NULL, false, NULL, NULL, pskIdent, psKey, _use_insecure, _alpn_protos); + + IPAddress address; + if (!WiFi.hostByName(host, address)) + return 0; + + int ret = start_ssl_client(sslclient, address, port, host, _timeout, NULL, false, NULL, NULL, pskIdent, psKey, _use_insecure, _alpn_protos); _lastError = ret; if (ret < 0) { log_e("start_ssl_client: %d", ret); @@ -264,10 +278,10 @@ void WiFiClientSecure::setCACert (const char *rootCA) { if (bundle != NULL) { - arduino_esp_crt_bundle_set(bundle); + esp_crt_bundle_set(bundle, sizeof(bundle)); _use_ca_bundle = true; } else { - arduino_esp_crt_bundle_detach(NULL); + esp_crt_bundle_detach(NULL); _use_ca_bundle = false; } } diff --git a/libraries/WiFiClientSecure/src/WiFiClientSecure.h b/libraries/WiFiClientSecure/src/WiFiClientSecure.h index 2d49610425d..6c967fbd0e6 100644 --- a/libraries/WiFiClientSecure/src/WiFiClientSecure.h +++ b/libraries/WiFiClientSecure/src/WiFiClientSecure.h @@ -55,6 +55,7 @@ class WiFiClientSecure : public WiFiClient int connect(const char *host, uint16_t port, const char *rootCABuff, const char *cli_cert, const char *cli_key); int connect(IPAddress ip, uint16_t port, const char *pskIdent, const char *psKey); int connect(const char *host, uint16_t port, const char *pskIdent, const char *psKey); + int connect(IPAddress ip, uint16_t port, const char *host, const char *CA_cert, const char *cert, const char *private_key); int peek(); size_t write(uint8_t data); size_t write(const uint8_t *buf, size_t size); diff --git a/libraries/WiFiClientSecure/src/esp_crt_bundle.c b/libraries/WiFiClientSecure/src/esp_crt_bundle.c deleted file mode 100644 index 82a0708662c..00000000000 --- a/libraries/WiFiClientSecure/src/esp_crt_bundle.c +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -#include -#include -#include -#include "esp_crt_bundle.h" -#include "esp_err.h" - -#define BUNDLE_HEADER_OFFSET 2 -#define CRT_HEADER_OFFSET 4 - -/* a dummy certificate so that - * cacert_ptr passes non-NULL check during handshake */ -static mbedtls_x509_crt s_dummy_crt; - - -typedef struct crt_bundle_t { - const uint8_t **crts; - uint16_t num_certs; - size_t x509_crt_bundle_len; -} crt_bundle_t; - -static crt_bundle_t s_crt_bundle; - -static int esp_crt_verify_callback(void *buf, mbedtls_x509_crt *crt, int data, uint32_t *flags); -static int esp_crt_check_signature(mbedtls_x509_crt *child, const uint8_t *pub_key_buf, size_t pub_key_len); - - -static int esp_crt_check_signature(mbedtls_x509_crt *child, const uint8_t *pub_key_buf, size_t pub_key_len) -{ - int ret = 0; - mbedtls_x509_crt parent; - const mbedtls_md_info_t *md_info; - unsigned char hash[MBEDTLS_MD_MAX_SIZE]; - - mbedtls_x509_crt_init(&parent); - - if ( (ret = mbedtls_pk_parse_public_key(&parent.pk, pub_key_buf, pub_key_len) ) != 0) { - log_e("PK parse failed with error %X", ret); - goto cleanup; - } - - - // Fast check to avoid expensive computations when not necessary - if (!mbedtls_pk_can_do(&parent.pk, child->sig_pk)) { - log_e("Simple compare failed"); - ret = -1; - goto cleanup; - } - - md_info = mbedtls_md_info_from_type(child->sig_md); - if ( (ret = mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash )) != 0 ) { - log_e("Internal mbedTLS error %X", ret); - goto cleanup; - } - - if ( (ret = mbedtls_pk_verify_ext( child->sig_pk, child->sig_opts, &parent.pk, - child->sig_md, hash, mbedtls_md_get_size( md_info ), - child->sig.p, child->sig.len )) != 0 ) { - - log_e("PK verify failed with error %X", ret); - goto cleanup; - } -cleanup: - mbedtls_x509_crt_free(&parent); - - return ret; -} - - -/* This callback is called for every certificate in the chain. If the chain - * is proper each intermediate certificate is validated through its parent - * in the x509_crt_verify_chain() function. So this callback should - * only verify the first untrusted link in the chain is signed by the - * root certificate in the trusted bundle -*/ -int esp_crt_verify_callback(void *buf, mbedtls_x509_crt *crt, int depth, uint32_t *flags) -{ - mbedtls_x509_crt *child = crt; - - /* It's OK for a trusted cert to have a weak signature hash alg. - as we already trust this certificate */ - uint32_t flags_filtered = *flags & ~(MBEDTLS_X509_BADCERT_BAD_MD); - - if (flags_filtered != MBEDTLS_X509_BADCERT_NOT_TRUSTED) { - return 0; - } - - - if (s_crt_bundle.crts == NULL) { - log_e("No certificates in bundle"); - return MBEDTLS_ERR_X509_FATAL_ERROR; - } - - log_d("%d certificates in bundle", s_crt_bundle.num_certs); - - size_t name_len = 0; - const uint8_t *crt_name; - - bool crt_found = false; - int start = 0; - int end = s_crt_bundle.num_certs - 1; - int middle = (end - start) / 2; - - /* Look for the certificate using binary search on subject name */ - while (start <= end) { - name_len = s_crt_bundle.crts[middle][0] << 8 | s_crt_bundle.crts[middle][1]; - crt_name = s_crt_bundle.crts[middle] + CRT_HEADER_OFFSET; - - int cmp_res = memcmp(child->issuer_raw.p, crt_name, name_len ); - if (cmp_res == 0) { - crt_found = true; - break; - } else if (cmp_res < 0) { - end = middle - 1; - } else { - start = middle + 1; - } - middle = (start + end) / 2; - } - - int ret = MBEDTLS_ERR_X509_FATAL_ERROR; - if (crt_found) { - size_t key_len = s_crt_bundle.crts[middle][2] << 8 | s_crt_bundle.crts[middle][3]; - ret = esp_crt_check_signature(child, s_crt_bundle.crts[middle] + CRT_HEADER_OFFSET + name_len, key_len); - } - - if (ret == 0) { - log_i("Certificate validated"); - *flags = 0; - return 0; - } - - log_e("Failed to verify certificate"); - return MBEDTLS_ERR_X509_FATAL_ERROR; -} - - -/* Initialize the bundle into an array so we can do binary search for certs, - the bundle generated by the python utility is already presorted by subject name - */ -static esp_err_t esp_crt_bundle_init(const uint8_t *x509_bundle) -{ - s_crt_bundle.num_certs = (x509_bundle[0] << 8) | x509_bundle[1]; - s_crt_bundle.crts = calloc(s_crt_bundle.num_certs, sizeof(x509_bundle)); - - if (s_crt_bundle.crts == NULL) { - log_e("Unable to allocate memory for bundle"); - return ESP_ERR_NO_MEM; - } - - const uint8_t *cur_crt; - cur_crt = x509_bundle + BUNDLE_HEADER_OFFSET; - - for (int i = 0; i < s_crt_bundle.num_certs; i++) { - s_crt_bundle.crts[i] = cur_crt; - - size_t name_len = cur_crt[0] << 8 | cur_crt[1]; - size_t key_len = cur_crt[2] << 8 | cur_crt[3]; - cur_crt = cur_crt + CRT_HEADER_OFFSET + name_len + key_len; - } - - return ESP_OK; -} - -esp_err_t arduino_esp_crt_bundle_attach(void *conf) -{ - esp_err_t ret = ESP_OK; - // If no bundle has been set by the user then use the bundle embedded in the binary - if (s_crt_bundle.crts == NULL) { - log_e("Failed to attach bundle"); - return ret; - } - - if (conf) { - /* point to a dummy certificate - * This is only required so that the - * cacert_ptr passes non-NULL check during handshake - */ - mbedtls_ssl_config *ssl_conf = (mbedtls_ssl_config *)conf; - mbedtls_x509_crt_init(&s_dummy_crt); - mbedtls_ssl_conf_ca_chain(ssl_conf, &s_dummy_crt, NULL); - mbedtls_ssl_conf_verify(ssl_conf, esp_crt_verify_callback, NULL); - } - - return ret; -} - -void arduino_esp_crt_bundle_detach(mbedtls_ssl_config *conf) -{ - free(s_crt_bundle.crts); - s_crt_bundle.crts = NULL; - if (conf) { - mbedtls_ssl_conf_verify(conf, NULL, NULL); - } -} - -void arduino_esp_crt_bundle_set(const uint8_t *x509_bundle) -{ - // Free any previously used bundle - free(s_crt_bundle.crts); - esp_crt_bundle_init(x509_bundle); -} diff --git a/libraries/WiFiClientSecure/src/esp_crt_bundle.h b/libraries/WiFiClientSecure/src/esp_crt_bundle.h deleted file mode 100644 index a1d95194af4..00000000000 --- a/libraries/WiFiClientSecure/src/esp_crt_bundle.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -#ifndef _ESP_CRT_BUNDLE_H_ -#define _ESP_CRT_BUNDLE_H_ - -#include "mbedtls/ssl.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @brief Attach and enable use of a bundle for certificate verification - * - * Attach and enable use of a bundle for certificate verification through a verification callback. - * If no specific bundle has been set through esp_crt_bundle_set() it will default to the - * bundle defined in menuconfig and embedded in the binary. - * - * @param[in] conf The config struct for the SSL connection. - * - * @return - * - ESP_OK if adding certificates was successful. - * - Other if an error occured or an action must be taken by the calling process. - */ -esp_err_t arduino_esp_crt_bundle_attach(void *conf); - - -/** - * @brief Disable and dealloc the certification bundle - * - * Removes the certificate verification callback and deallocates used resources - * - * @param[in] conf The config struct for the SSL connection. - */ -void arduino_esp_crt_bundle_detach(mbedtls_ssl_config *conf); - - -/** - * @brief Set the default certificate bundle used for verification - * - * Overrides the default certificate bundle. In most use cases the bundle should be - * set through menuconfig. The bundle needs to be sorted by subject name since binary search is - * used to find certificates. - * - * @param[in] x509_bundle A pointer to the certificate bundle. - */ -void arduino_esp_crt_bundle_set(const uint8_t *x509_bundle); - - -#ifdef __cplusplus -} -#endif - -#endif //_ESP_CRT_BUNDLE_H_ diff --git a/libraries/WiFiClientSecure/src/ssl_client.cpp b/libraries/WiFiClientSecure/src/ssl_client.cpp index 299c47beaf1..8dcf05877ba 100644 --- a/libraries/WiFiClientSecure/src/ssl_client.cpp +++ b/libraries/WiFiClientSecure/src/ssl_client.cpp @@ -53,8 +53,7 @@ void ssl_init(sslclient_context *ssl_client) mbedtls_ctr_drbg_init(&ssl_client->drbg_ctx); } - -int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, bool useRootCABundle, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos) +int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_t port, const char* hostname, int timeout, const char *rootCABuff, bool useRootCABundle, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos) { char buf[512]; int ret, flags; @@ -74,16 +73,11 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p return ssl_client->socket; } - IPAddress srv((uint32_t)0); - if(!WiFiGenericClass::hostByName(host, srv)){ - return -1; - } - fcntl( ssl_client->socket, F_SETFL, fcntl( ssl_client->socket, F_GETFL, 0 ) | O_NONBLOCK ); struct sockaddr_in serv_addr; memset(&serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = srv; + serv_addr.sin_addr.s_addr = ip; serv_addr.sin_port = htons(port); if(timeout <= 0){ @@ -193,7 +187,7 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p } } else if (useRootCABundle) { log_v("Attaching root CA cert bundle"); - ret = arduino_esp_crt_bundle_attach(&ssl_client->ssl_conf); + ret = esp_crt_bundle_attach(&ssl_client->ssl_conf); if (ret < 0) { return handle_error(ret); @@ -246,7 +240,10 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p } log_v("Loading private key"); - ret = mbedtls_pk_parse_key(&ssl_client->client_key, (const unsigned char *)cli_key, strlen(cli_key) + 1, NULL, 0); + mbedtls_ctr_drbg_context ctr_drbg; + mbedtls_ctr_drbg_init( &ctr_drbg ); + ret = mbedtls_pk_parse_key(&ssl_client->client_key, (const unsigned char *)cli_key, strlen(cli_key) + 1, NULL, 0, mbedtls_ctr_drbg_random, &ctr_drbg); + mbedtls_ctr_drbg_free( &ctr_drbg ); if (ret != 0) { mbedtls_x509_crt_free(&ssl_client->client_cert); // cert+key are free'd in pair @@ -259,7 +256,7 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p log_v("Setting hostname for TLS session..."); // Hostname set here should match CN in server certificate - if((ret = mbedtls_ssl_set_hostname(&ssl_client->ssl_ctx, host)) != 0){ + if((ret = mbedtls_ssl_set_hostname(&ssl_client->ssl_ctx, hostname != NULL ? hostname : ip.toString().c_str())) != 0){ return handle_error(ret); } @@ -331,13 +328,13 @@ void stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, cons } // avoid memory leak if ssl connection attempt failed - if (ssl_client->ssl_conf.ca_chain != NULL) { + //if (ssl_client->ssl_conf.ca_chain != NULL) { mbedtls_x509_crt_free(&ssl_client->ca_cert); - } - if (ssl_client->ssl_conf.key_cert != NULL) { + //} + //if (ssl_client->ssl_conf.key_cert != NULL) { mbedtls_x509_crt_free(&ssl_client->client_cert); mbedtls_pk_free(&ssl_client->client_key); - } + //} mbedtls_ssl_free(&ssl_client->ssl_ctx); mbedtls_ssl_config_free(&ssl_client->ssl_conf); mbedtls_ctr_drbg_free(&ssl_client->drbg_ctx); diff --git a/libraries/WiFiClientSecure/src/ssl_client.h b/libraries/WiFiClientSecure/src/ssl_client.h index 1f4179c98dd..69e49707cba 100644 --- a/libraries/WiFiClientSecure/src/ssl_client.h +++ b/libraries/WiFiClientSecure/src/ssl_client.h @@ -5,7 +5,7 @@ #ifndef ARD_SSL_H #define ARD_SSL_H #include "mbedtls/platform.h" -#include "mbedtls/net.h" +#include "mbedtls/net_sockets.h" #include "mbedtls/debug.h" #include "mbedtls/ssl.h" #include "mbedtls/entropy.h" @@ -30,7 +30,7 @@ typedef struct sslclient_context { void ssl_init(sslclient_context *ssl_client); -int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, bool useRootCABundle, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos); +int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_t port, const char* hostname, int timeout, const char *rootCABuff, bool useRootCABundle, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos); void stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, const char *cli_cert, const char *cli_key); int data_to_read(sslclient_context *ssl_client); int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, size_t len); diff --git a/libraries/Wire/examples/WireMaster/WireMaster.ino b/libraries/Wire/examples/WireMaster/WireMaster.ino index e3736bf9fcc..ba5bca5c168 100644 --- a/libraries/Wire/examples/WireMaster/WireMaster.ino +++ b/libraries/Wire/examples/WireMaster/WireMaster.ino @@ -15,7 +15,7 @@ void loop() { //Write message to the slave Wire.beginTransmission(I2C_DEV_ADDR); - Wire.printf("Hello World! %u", i++); + Wire.printf("Hello World! %lu", i++); uint8_t error = Wire.endTransmission(true); Serial.printf("endTransmission: %u\n", error); diff --git a/libraries/Wire/examples/WireSlave/WireSlave.ino b/libraries/Wire/examples/WireSlave/WireSlave.ino index ea5c1995b71..e689e189a7a 100644 --- a/libraries/Wire/examples/WireSlave/WireSlave.ino +++ b/libraries/Wire/examples/WireSlave/WireSlave.ino @@ -27,7 +27,7 @@ void setup() { #if CONFIG_IDF_TARGET_ESP32 char message[64]; - snprintf(message, 64, "%u Packets.", i++); + snprintf(message, 64, "%lu Packets.", i++); Wire.slaveWrite((uint8_t *)message, strlen(message)); #endif } diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 09dddcd3316..d960dcbcbc3 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -36,35 +36,35 @@ } ], "toolsDependencies": [ - { - "packager": "esp32", - "name": "riscv32-esp-elf-gcc", - "version": "gcc8_4_0-esp-2021r2-patch5" - }, { "packager": "esp32", "name": "xtensa-esp32-elf-gcc", - "version": "gcc8_4_0-esp-2021r2-patch5" + "version": "esp-2022r1-11.2.0" }, { "packager": "esp32", "name": "xtensa-esp32s2-elf-gcc", - "version": "gcc8_4_0-esp-2021r2-patch5" + "version": "esp-2022r1-11.2.0" }, { "packager": "esp32", "name": "xtensa-esp32s3-elf-gcc", - "version": "gcc8_4_0-esp-2021r2-patch5" + "version": "esp-2022r1-11.2.0" }, { "packager": "esp32", - "name": "esptool_py", - "version": "4.2.1" + "name": "riscv32-esp-elf-gcc", + "version": "esp-2022r1-11.2.0" }, { "packager": "esp32", "name": "openocd-esp32", - "version": "v0.11.0-esp32-20220706" + "version": "v0.11.0-esp32-20221026" + }, + { + "packager": "esp32", + "name": "esptool_py", + "version": "4.5" }, { "packager": "esp32", @@ -81,332 +81,353 @@ ], "tools": [ { - "name": "riscv32-esp-elf-gcc", - "version": "gcc8_4_0-esp-2021r2-patch5", + "name": "xtensa-esp32-elf-gcc", + "version": "esp-2022r1-11.2.0", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz", - "archiveFileName": "riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz", - "checksum": "SHA-256:f7d73e5f9e2df3ea6ca8e2c95d6ca6d23d6b38fd101ea5d3012f3cb3cd59f39f", - "size": "192388486" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32-elf-gcc11_2_0-esp-2022r1-linux-amd64.tar.xz", + "archiveFileName": "xtensa-esp32-elf-gcc11_2_0-esp-2022r1-linux-amd64.tar.xz", + "checksum": "SHA-256:698d8407e18275d18feb7d1afdb68800b97904fbe39080422fb8609afa49df30", + "size": "64781328" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz", - "archiveFileName": "riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz", - "checksum": "SHA-256:cf520ae3a72f65b9758ea187524b105b8b7546566d738c32e60a0df9846ef1af", - "size": "188626914" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32-elf-gcc11_2_0-esp-2022r1-linux-arm64.tar.xz", + "archiveFileName": "xtensa-esp32-elf-gcc11_2_0-esp-2022r1-linux-arm64.tar.xz", + "checksum": "SHA-256:48ed01abff1e89e6fe1c3ebe4e00df6a0a67e53ae24979970464a4a3b64aa622", + "size": "60675980" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-linux-armel.tar.gz", - "archiveFileName": "riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-linux-armel.tar.gz", - "checksum": "SHA-256:2dc3536214caa1697f6834bb4701d05894ca55b53589fc5b54064b050ef93799", - "size": "188624050" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32-elf-gcc11_2_0-esp-2022r1-linux-armel.tar.xz", + "archiveFileName": "xtensa-esp32-elf-gcc11_2_0-esp-2022r1-linux-armel.tar.xz", + "checksum": "SHA-256:0e6131a9ab4e3da0a153ee75097012823ccf21f90c69368c3bf53c8a086736f8", + "size": "59117264" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-linux-i686.tar.gz", - "archiveFileName": "riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-linux-i686.tar.gz", - "checksum": "SHA-256:165d6d53e76d79f5ade7e2b7ade54b2b495ecfda0d1184d84d6343659d0e3bdb", - "size": "194606113" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32-elf-gcc11_2_0-esp-2022r1-linux-i686.tar.xz", + "archiveFileName": "xtensa-esp32-elf-gcc11_2_0-esp-2022r1-linux-i686.tar.xz", + "checksum": "SHA-256:d06511bb18057d72b555d6c5b62b0686f19e9f8c7d7eae218b712eed0907dbb2", + "size": "65914276" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-macos.tar.gz", - "archiveFileName": "riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-macos.tar.gz", - "checksum": "SHA-256:d6d4cef216cbf28d6fbb88f3e127d4f42a376d9497c260bf8c1ad9cef440f839", - "size": "199411930" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32-elf-gcc11_2_0-esp-2022r1-macos.tar.xz", + "archiveFileName": "xtensa-esp32-elf-gcc11_2_0-esp-2022r1-macos.tar.xz", + "checksum": "SHA-256:1c9d873c56469e3abec1e4214b7200d36804a605d4f0991e539b1577415409bf", + "size": "68189688" + }, + { + "host": "arm64-apple-darwin", + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32-elf-gcc11_2_0-esp-2022r1-macos-arm64.tar.xz", + "archiveFileName": "xtensa-esp32-elf-gcc11_2_0-esp-2022r1-macos-arm64.tar.xz", + "checksum": "SHA-256:297249b0dc5307fd496c4d85d960b69824996c0c450a8c92f8414a5fd32a7c3b", + "size": "58460768" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-win32.zip", - "archiveFileName": "riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-win32.zip", - "checksum": "SHA-256:1e0cfcfbc8f82c441261cadd21742f66d716ec18c18bf10ed7c7d5b0bee6752f", - "size": "257844437" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32-elf-gcc11_2_0-esp-2022r1-win32.zip", + "archiveFileName": "xtensa-esp32-elf-gcc11_2_0-esp-2022r1-win32.zip", + "checksum": "SHA-256:858ee049d6d8de730ed3e30285c4adc1a9cdfe077b591ed0b6f2bfa5e3564f53", + "size": "129786756" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip", - "archiveFileName": "riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip", - "checksum": "SHA-256:b08f568e8fe5069dd521b87da21b8e56117e5c2c3b492f73a51966a46d3379a4", - "size": "259712666" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32-elf-gcc11_2_0-esp-2022r1-win64.zip", + "archiveFileName": "xtensa-esp32-elf-gcc11_2_0-esp-2022r1-win64.zip", + "checksum": "SHA-256:f469aff6a71113e3a145466d814184339e02248b158357766970646f5d2a3da7", + "size": "133936844" } ] }, { - "name": "xtensa-esp32-elf-gcc", - "version": "gcc8_4_0-esp-2021r2-patch5", + "name": "xtensa-esp32s2-elf-gcc", + "version": "esp-2022r1-11.2.0", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz", - "archiveFileName": "xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz", - "checksum": "SHA-256:8ef14e0409c2011b41e504a30f70d3e35287313a795d1f2462ad2cd0e2052d37", - "size": "94397702" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-linux-amd64.tar.xz", + "archiveFileName": "xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-linux-amd64.tar.xz", + "checksum": "SHA-256:56e5913b6662b8eec7d6b46780e668bc7e7cebef239e326a74f764c92a3cc841", + "size": "51546516" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz", - "archiveFileName": "xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz", - "checksum": "SHA-256:e7d217ac2ef52c746a41f8647840b2717edcd8afc15f081bc1c4505e10a189b7", - "size": "90684219" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-linux-arm64.tar.xz", + "archiveFileName": "xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-linux-arm64.tar.xz", + "checksum": "SHA-256:2f0ccc9d40279d6407ed9547250fb0434f16060faa94460c52b74614a38a1e21", + "size": "46338036" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-armel.tar.gz", - "archiveFileName": "xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-armel.tar.gz", - "checksum": "SHA-256:ea6631f8a5105ae90d7fc462c10ed4f9049924ea8c2f9391d90b339d5f881dac", - "size": "89954866" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-linux-armel.tar.xz", + "archiveFileName": "xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-linux-armel.tar.xz", + "checksum": "SHA-256:f71974c4aaf3f637f6adaa28bbbdf3a911db3385e0ab1544844513ec65185cc5", + "size": "43326084" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-i686.tar.gz", - "archiveFileName": "xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-i686.tar.gz", - "checksum": "SHA-256:ecb90af9cede0982672234da0b1bd7b7f76eadde60aa5c82eefdf37d64ffe49f", - "size": "96354023" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-linux-i686.tar.xz", + "archiveFileName": "xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-linux-i686.tar.xz", + "checksum": "SHA-256:504efe97ce24561537bd442494b1046fc8fb9cc43a1c06ef1afa4652b7517201", + "size": "53807024" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-macos.tar.gz", - "archiveFileName": "xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-macos.tar.gz", - "checksum": "SHA-256:19af109fda024a3a4c989f7ccaa104f9b1b74cfd6c9363e730bb8cb9b50d5dc4", - "size": "101712946" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-macos.tar.xz", + "archiveFileName": "xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-macos.tar.xz", + "checksum": "SHA-256:f53da9423490001727c5b6c3b8e1602b887783f0ed68e5defbb3c7712ada9631", + "size": "53568496" + }, + { + "host": "arm64-apple-darwin", + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-macos-arm64.tar.xz", + "archiveFileName": "xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-macos-arm64.tar.xz", + "checksum": "SHA-256:3592e0fbdb2ca438c7360d93fd62ef0e05ead2fc8144eff344bbe1971d333287", + "size": "44218948" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win32.zip", - "archiveFileName": "xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win32.zip", - "checksum": "SHA-256:9851c2cfa355e1fad8abfb643a1c945d27385b1851f3ae468915ea78fcbec940", - "size": "118610020" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-win32.zip", + "archiveFileName": "xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-win32.zip", + "checksum": "SHA-256:96b873210438713a84ea6e39e591cdbbeef453cb431d8392ac3fa2e68a48bc97", + "size": "94981372" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip", - "archiveFileName": "xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip", - "checksum": "SHA-256:a328b3c55631846241bbe7999a309b20b797c8dc50b6e8dccf463e66a2da5fb4", - "size": "121846722" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-win64.zip", + "archiveFileName": "xtensa-esp32s2-elf-gcc11_2_0-esp-2022r1-win64.zip", + "checksum": "SHA-256:9ab0387e08047916bbf7ff0d2eb974c710bcf2e042cb04037b4dd93c9186f676", + "size": "99074758" } ] }, { - "name": "xtensa-esp32s2-elf-gcc", - "version": "gcc8_4_0-esp-2021r2-patch5", + "name": "xtensa-esp32s3-elf-gcc", + "version": "esp-2022r1-11.2.0", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz", - "archiveFileName": "xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz", - "checksum": "SHA-256:19c77bd91fefab7c8c40a6334f9b985e2d9a1c7fac6d424b692110930dd3682f", - "size": "67849099" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-linux-amd64.tar.xz", + "archiveFileName": "xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-linux-amd64.tar.xz", + "checksum": "SHA-256:5058b2e724166c34ca09ec2d5377350252de8bce5039b06c00352f9a8151f76e", + "size": "51899328" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz", - "archiveFileName": "xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz", - "checksum": "SHA-256:bdcd24676ef2a65b670ca9e0a01768ece47f4dfcfb545a3307f76a054c33b522", - "size": "64154532" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-linux-arm64.tar.xz", + "archiveFileName": "xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-linux-arm64.tar.xz", + "checksum": "SHA-256:d2c6fb98a5018139a9f5af6eb808e968f1381a5b34547a185f4dec142b0fa44e", + "size": "45458872" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-linux-armel.tar.gz", - "archiveFileName": "xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-linux-armel.tar.gz", - "checksum": "SHA-256:b26723b6ce1c35b90f204eb39e5ab06a6f80fb7895f000e16b6962e4c176ae32", - "size": "63448105" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-linux-armel.tar.xz", + "archiveFileName": "xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-linux-armel.tar.xz", + "checksum": "SHA-256:9944e67d95a5de9875670c5cd5cb0bb282ebac235a38b5fd6d53069813fead9e", + "size": "44532116" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-linux-i686.tar.gz", - "archiveFileName": "xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-linux-i686.tar.gz", - "checksum": "SHA-256:da3b5c45e4997d14269df1814c92dd7004902bb810608341bc3819c3e506fa0b", - "size": "69656104" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-linux-i686.tar.xz", + "archiveFileName": "xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-linux-i686.tar.xz", + "checksum": "SHA-256:0feccf884e36b6e93c27c793729199b18df22a409557b16c90b2883a6748e041", + "size": "53956012" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-macos.tar.gz", - "archiveFileName": "xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-macos.tar.gz", - "checksum": "SHA-256:8eb63745b44083edef7cc6fdf3b06999f576b75134bc5e8b0ef881ca439b72d7", - "size": "75154138" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-macos.tar.xz", + "archiveFileName": "xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-macos.tar.xz", + "checksum": "SHA-256:2b46730adc6afd8115e0be9365050a87f9523617e5e58ee35cb85ff1ddf2756c", + "size": "54256036" + }, + { + "host": "arm64-apple-darwin", + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-macos-arm64.tar.xz", + "archiveFileName": "xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-macos-arm64.tar.xz", + "checksum": "SHA-256:bb449ac62b9917638b35234c98ce03ddf1cac75c2d80fbd67c46ecec08369838", + "size": "44835256" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-win32.zip", - "archiveFileName": "xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-win32.zip", - "checksum": "SHA-256:c758062295804b082fbd77fcd59a356f62d4e76372aaa29589cc871603309cba", - "size": "82338511" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-win32.zip", + "archiveFileName": "xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-win32.zip", + "checksum": "SHA-256:0c9ec6d296b66523e3990b195b6597dfc4030f2335bf904b614f990ad6dabbde", + "size": "95241895" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip", - "archiveFileName": "xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip", - "checksum": "SHA-256:1c1e168ff8bc460a9719f3b216d3c1125d29040389786d738244838499362c74", - "size": "85579252" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-win64.zip", + "archiveFileName": "xtensa-esp32s3-elf-gcc11_2_0-esp-2022r1-win64.zip", + "checksum": "SHA-256:7213a0bf22607e9c70febaabef37822c2ae5e071ac53d6467e6031b02bb0b2bf", + "size": "99495535" } ] }, { - "name": "xtensa-esp32s3-elf-gcc", - "version": "gcc8_4_0-esp-2021r2-patch5", + "name": "riscv32-esp-elf-gcc", + "version": "esp-2022r1-11.2.0", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz", - "archiveFileName": "xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz", - "checksum": "SHA-256:8aa17a6adf01efa5b1628c8ac578063a44d26ae9581d39486b92223a41ef262f", - "size": "68099473" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-linux-amd64.tar.xz", + "archiveFileName": "riscv32-esp-elf-gcc11_2_0-esp-2022r1-linux-amd64.tar.xz", + "checksum": "SHA-256:52710f804df4a033a2b621cc16cfa21023b42052819a51e35a2a164140bbf665", + "size": "110107900" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz", - "archiveFileName": "xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz", - "checksum": "SHA-256:b218c11122e5565b6442376ebd21a652abdfcbf90981afa3e177ce978710225d", - "size": "64233211" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-linux-arm64.tar.xz", + "archiveFileName": "riscv32-esp-elf-gcc11_2_0-esp-2022r1-linux-arm64.tar.xz", + "checksum": "SHA-256:812a18f2ecdc3f72c1d098c4e8baa968841099ce9d9ecf95baea85ff71e11013", + "size": "104279292" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-linux-armel.tar.gz", - "archiveFileName": "xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-linux-armel.tar.gz", - "checksum": "SHA-256:967477434ad5483718915936a77ce915a10c5972a6b3fd02688a5c4e14182bfb", - "size": "63530586" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-linux-armel.tar.xz", + "archiveFileName": "riscv32-esp-elf-gcc11_2_0-esp-2022r1-linux-armel.tar.xz", + "checksum": "SHA-256:bc6e3ff8323d1f8b137374788b5615152281aab9e7561c55ab1504145677b6c7", + "size": "102802824" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-linux-i686.tar.gz", - "archiveFileName": "xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-linux-i686.tar.gz", - "checksum": "SHA-256:07671d01a63ebd389912787efb2b263677c7b351c07fe430ded733cdae95e81d", - "size": "70025439" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-linux-i686.tar.xz", + "archiveFileName": "riscv32-esp-elf-gcc11_2_0-esp-2022r1-linux-i686.tar.xz", + "checksum": "SHA-256:39d7295c30a23b5ea91baf61c207718ce86d4b1589014b030e121300370f696d", + "size": "111505972" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-macos.tar.gz", - "archiveFileName": "xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-macos.tar.gz", - "checksum": "SHA-256:99b6d44cea5aebbedc8b6965e7bf551aa4a40ed83ddbe1c0e9b7cb255564ded5", - "size": "75719772" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-macos.tar.xz", + "archiveFileName": "riscv32-esp-elf-gcc11_2_0-esp-2022r1-macos.tar.xz", + "checksum": "SHA-256:d3a6f42b02a5f1485ba3fa92b8a9d9f307f643420e22b3765e88bbe4570aee01", + "size": "112060920" + }, + { + "host": "arm64-apple-darwin", + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-macos-arm64.tar.xz", + "archiveFileName": "riscv32-esp-elf-gcc11_2_0-esp-2022r1-macos-arm64.tar.xz", + "checksum": "SHA-256:23d9a715d932a3af57fd7393b0789f88d0f70fedaf5b803deb9ab81dee271bd6", + "size": "101254152" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-win32.zip", - "archiveFileName": "xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-win32.zip", - "checksum": "SHA-256:658d3036ffdf11ddad6f0a784c8829f6ffd4dbd7c252d7f61722256d0ad43975", - "size": "82665716" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-win32.zip", + "archiveFileName": "riscv32-esp-elf-gcc11_2_0-esp-2022r1-win32.zip", + "checksum": "SHA-256:3e677ef068d7f154d33b0d3788b5f985c5066d110028eac44e0f76b3bda4429b", + "size": "268053767" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip", - "archiveFileName": "xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip", - "checksum": "SHA-256:9000be38d44bf79c39b93a2aeb99b42e956c593ccbc02fe31cb9c71ae1bbcb22", - "size": "86022563" + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-win64.zip", + "archiveFileName": "riscv32-esp-elf-gcc11_2_0-esp-2022r1-win64.zip", + "checksum": "SHA-256:324a5c679fef75313766cc48d3433c48bf23985a11b5070c5d19144538c6357b", + "size": "271158759" } ] }, { - "name": "esptool_py", - "version": "4.2.1", + "name": "openocd-esp32", + "version": "v0.11.0-esp32-20221026", "systems": [ { - "host": "i686-mingw32", - "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-windows.zip", - "archiveFileName": "esptool-4.2.1-windows.zip", - "checksum": "SHA-256:582560067bfbd9895f4862eb5fdf87558ddee5d4d30e7575c9b8bcb0dd60fd94", - "size": "6368279" + "host": "x86_64-pc-linux-gnu", + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20221026/openocd-esp32-linux-amd64-0.11.0-esp32-20221026.tar.gz", + "archiveFileName": "openocd-esp32-linux-amd64-0.11.0-esp32-20221026.tar.gz", + "checksum": "SHA-256:ce63e9b1dfab60cc62da5dc2abcc22ba7036c42afe74671c787eb026744e7d0b", + "size": "2051435" }, { - "host": "x86_64-mingw32", - "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-windows.zip", - "archiveFileName": "esptool-4.2.1-windows.zip", - "checksum": "SHA-256:582560067bfbd9895f4862eb5fdf87558ddee5d4d30e7575c9b8bcb0dd60fd94", - "size": "6368279" + "host": "aarch64-linux-gnu", + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20221026/openocd-esp32-linux-arm64-0.11.0-esp32-20221026.tar.gz", + "archiveFileName": "openocd-esp32-linux-arm64-0.11.0-esp32-20221026.tar.gz", + "checksum": "SHA-256:fe60a3a603e8c6bee47367e40fcb8c0da3a38e01163e9674ebc919b067700506", + "size": "1993843" }, { - "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-macos.tar.gz", - "archiveFileName": "esptool-4.2.1-macos.tar.gz", - "checksum": "SHA-256:a984f7ad8bdb40c42d0d368bf4bb21b69a9587aed46b7b6d7de23ca58a3f150d", - "size": "5816598" + "host": "arm-linux-gnueabihf", + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20221026/openocd-esp32-linux-armel-0.11.0-esp32-20221026.tar.gz", + "archiveFileName": "openocd-esp32-linux-armel-0.11.0-esp32-20221026.tar.gz", + "checksum": "SHA-256:6ef76101cca196a4be30fc74f191eff34abb423e32930a383012b866c9b76135", + "size": "2092111" }, { - "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-linux.tar.gz", - "archiveFileName": "esptool-4.2.1-linux.tar.gz", - "checksum": "SHA-256:5a45fb77eb6574554ec2f45230d0b350f26f9c24ab3b6c13c4031ebdf72a34ab", - "size": "90123" + "host": "x86_64-apple-darwin", + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20221026/openocd-esp32-macos-0.11.0-esp32-20221026.tar.gz", + "archiveFileName": "openocd-esp32-macos-0.11.0-esp32-20221026.tar.gz", + "checksum": "SHA-256:8edc666a0a230432554b73df7c62e0b5ec21fb018e7fda13b11a7ca8b6c1763b", + "size": "2199855" }, { - "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-linux.tar.gz", - "archiveFileName": "esptool-4.2.1-linux.tar.gz", - "checksum": "SHA-256:5a45fb77eb6574554ec2f45230d0b350f26f9c24ab3b6c13c4031ebdf72a34ab", - "size": "90123" + "host": "arm64-apple-darwin", + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20221026/openocd-esp32-macos-arm64-0.11.0-esp32-20221026.tar.gz", + "archiveFileName": "openocd-esp32-macos-arm64-0.11.0-esp32-20221026.tar.gz", + "checksum": "SHA-256:c426c0158ba6488e2f432f7c5b22e79155b5b0fae6d1ad5bbd7894723b43aa12", + "size": "2247179" }, { - "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-linux.tar.gz", - "archiveFileName": "esptool-4.2.1-linux.tar.gz", - "checksum": "SHA-256:5a45fb77eb6574554ec2f45230d0b350f26f9c24ab3b6c13c4031ebdf72a34ab", - "size": "90123" + "host": "i686-mingw32", + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20221026/openocd-esp32-win32-0.11.0-esp32-20221026.zip", + "archiveFileName": "openocd-esp32-win32-0.11.0-esp32-20221026.zip", + "checksum": "SHA-256:e0e789d35308c029c6b53457cf4a42a5620cb1a3014740026c089c2ed4fd77b2", + "size": "2493214" }, { - "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-linux.tar.gz", - "archiveFileName": "esptool-4.2.1-linux.tar.gz", - "checksum": "SHA-256:5a45fb77eb6574554ec2f45230d0b350f26f9c24ab3b6c13c4031ebdf72a34ab", - "size": "90123" + "host": "x86_64-mingw32", + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20221026/openocd-esp32-win32-0.11.0-esp32-20221026.zip", + "archiveFileName": "openocd-esp32-win32-0.11.0-esp32-20221026.zip", + "checksum": "SHA-256:e0e789d35308c029c6b53457cf4a42a5620cb1a3014740026c089c2ed4fd77b2", + "size": "2493214" } ] }, { - "name": "openocd-esp32", - "version": "v0.11.0-esp32-20220706", + "name": "esptool_py", + "version": "4.5", "systems": [ { - "host": "i686-mingw32", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20220706/openocd-esp32-win32-0.11.0-esp32-20220706.zip", - "archiveFileName": "openocd-esp32-win32-0.11.0-esp32-20220706.zip", - "checksum": "SHA-256:c3d39eb4365a9947e71f1d3780ce031185bc6437f21186568a5c05f23f57a8d0", - "size": "2608736" - }, - { - "host": "x86_64-mingw32", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20220706/openocd-esp32-win32-0.11.0-esp32-20220706.zip", - "archiveFileName": "openocd-esp32-win32-0.11.0-esp32-20220706.zip", - "checksum": "SHA-256:c3d39eb4365a9947e71f1d3780ce031185bc6437f21186568a5c05f23f57a8d0", - "size": "2608736" + "host": "x86_64-pc-linux-gnu", + "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.6/esptool-v4.5-src.tar.gz", + "archiveFileName": "esptool-v4.5-src.tar.gz", + "checksum": "SHA-256:0f5d20c4624d913c3c994db57da3c4e5a43bd8437351d9b789f79d3f1b057292", + "size": "96621" }, { - "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20220706/openocd-esp32-macos-0.11.0-esp32-20220706.tar.gz", - "archiveFileName": "openocd-esp32-macos-0.11.0-esp32-20220706.tar.gz", - "checksum": "SHA-256:333ee2ec3c9b5dc6ad4509faae55335cdea7f8bf83a56bfcf5327e4497c8538a", - "size": "2077882" + "host": "i686-pc-linux-gnu", + "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.6/esptool-v4.5-src.tar.gz", + "archiveFileName": "esptool-v4.5-src.tar.gz", + "checksum": "SHA-256:0f5d20c4624d913c3c994db57da3c4e5a43bd8437351d9b789f79d3f1b057292", + "size": "96621" }, { - "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20220706/openocd-esp32-linux-amd64-0.11.0-esp32-20220706.tar.gz", - "archiveFileName": "openocd-esp32-linux-amd64-0.11.0-esp32-20220706.tar.gz", - "checksum": "SHA-256:26f1f18dd93eb70a13203848d3fb1cc2e0de1fd6749c7dd771b2de8709735aed", - "size": "2011201" + "host": "aarch64-linux-gnu", + "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.6/esptool-v4.5-src.tar.gz", + "archiveFileName": "esptool-v4.5-src.tar.gz", + "checksum": "SHA-256:0f5d20c4624d913c3c994db57da3c4e5a43bd8437351d9b789f79d3f1b057292", + "size": "96621" }, { - "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20220706/openocd-esp32-linux-amd64-0.11.0-esp32-20220706.tar.gz", - "archiveFileName": "openocd-esp32-linux-amd64-0.11.0-esp32-20220706.tar.gz", - "checksum": "SHA-256:26f1f18dd93eb70a13203848d3fb1cc2e0de1fd6749c7dd771b2de8709735aed", - "size": "2011201" + "host": "arm-linux-gnueabihf", + "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.6/esptool-v4.5-src.tar.gz", + "archiveFileName": "esptool-v4.5-src.tar.gz", + "checksum": "SHA-256:0f5d20c4624d913c3c994db57da3c4e5a43bd8437351d9b789f79d3f1b057292", + "size": "96621" }, { - "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20220706/openocd-esp32-linux-armhf-0.11.0-esp32-20220706.tar.gz", - "archiveFileName": "openocd-esp32-linux-armhf-0.11.0-esp32-20220706.tar.gz", - "checksum": "SHA-256:7f3b57332104e8b8e6194553365a70a9d3754878cfc063d5dc5d839513a63de9", - "size": "1902964" + "host": "x86_64-apple-darwin", + "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.6/esptool-v4.5-macos.tar.gz", + "archiveFileName": "esptool-v4.5-macos.tar.gz", + "checksum": "SHA-256:adcce051f282a19f78da30717ff0e4334b0edaf16a7f14d185ba4cae464586e2", + "size": "5850835" }, { - "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.11.0-esp32-20220706/openocd-esp32-linux-arm64-0.11.0-esp32-20220706.tar.gz", - "archiveFileName": "openocd-esp32-linux-arm64-0.11.0-esp32-20220706.tar.gz", - "checksum": "SHA-256:f97792bc2852937ec0accb9f0eb2e49926c0f747a71f101a4e34aed75d2c6fcc", - "size": "1954685" + "host": "x86_64-mingw32", + "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.6/esptool-v4.5-win64.zip", + "archiveFileName": "esptool-v4.5-win64.zip", + "checksum": "SHA-256:a55c5f7d490fbd2cd5fdf486d71f2ed13e3304482d54374b6aa23d42c9b98a96", + "size": "6639416" } ] }, diff --git a/platform.txt b/platform.txt index 7fc48d07115..b6152789e24 100644 --- a/platform.txt +++ b/platform.txt @@ -1,10 +1,10 @@ name=ESP32 Arduino version=2.0.6 -runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf -runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf -runtime.tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s3-elf -runtime.tools.riscv32-esp-elf-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf +tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf +tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf +tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s3-elf +tools.riscv32-esp-elf-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf debug.server.openocd.path={runtime.platform.path}/tools/openocd-esp32/bin/openocd debug.server.openocd.scripts_dir={runtime.platform.path}/tools/openocd-esp32/share/openocd/scripts/ @@ -27,7 +27,7 @@ tools.gen_esp32part.cmd.windows="{runtime.platform.path}/tools/gen_esp32part.exe tools.gen_insights_pkg.cmd=python3 "{runtime.platform.path}"/tools/gen_insights_package.py tools.gen_insights_pkg.cmd.windows="{runtime.platform.path}/tools/gen_insights_package.exe" -compiler.path={runtime.tools.{build.tarch}-{build.target}-elf-gcc.path}/bin/ +compiler.path={tools.{build.tarch}-{build.target}-elf-gcc.path}/bin/ compiler.sdk.path={runtime.platform.path}/tools/sdk/{build.mcu} compiler.prefix={build.tarch}-{build.target}-elf- diff --git a/tools/get.py b/tools/get.py index 088e2f67139..16e1e097b2a 100755 --- a/tools/get.py +++ b/tools/get.py @@ -75,6 +75,10 @@ def unpack(filename, destination): tfile = tarfile.open(filename, 'r:gz') tfile.extractall(destination) dirname = tfile.getnames()[0] + elif filename.endswith('tar.xz'): + tfile = tarfile.open(filename, 'r:xz') + tfile.extractall(destination) + dirname = tfile.getnames()[0] elif filename.endswith('zip'): zfile = zipfile.ZipFile(filename) zfile.extractall(destination) @@ -177,20 +181,34 @@ def load_tools_list(filename, platform): for t in tools_info: tool_platform = [p for p in t['systems'] if p['host'] == platform] if len(tool_platform) == 0: - continue + # Fallback to x86 on Apple ARM + if platform == 'arm64-apple-darwin': + tool_platform = [p for p in t['systems'] if p['host'] == 'x86_64-apple-darwin'] + if len(tool_platform) == 0: + continue + # Fallback to 32bit on 64bit x86 Windows + elif platform == 'x86_64-mingw32': + tool_platform = [p for p in t['systems'] if p['host'] == 'i686-mingw32'] + if len(tool_platform) == 0: + continue + else: + continue tools_to_download.append(tool_platform[0]) return tools_to_download def identify_platform(): - arduino_platform_names = {'Darwin' : {32 : 'i386-apple-darwin', 64 : 'x86_64-apple-darwin'}, - 'Linux' : {32 : 'i686-pc-linux-gnu', 64 : 'x86_64-pc-linux-gnu'}, - 'LinuxARM': {32 : 'arm-linux-gnueabihf', 64 : 'aarch64-linux-gnu'}, - 'Windows' : {32 : 'i686-mingw32', 64 : 'i686-mingw32'}} + arduino_platform_names = {'Darwin' : {32 : 'i386-apple-darwin', 64 : 'x86_64-apple-darwin'}, + 'DarwinARM': {32 : 'arm64-apple-darwin', 64 : 'arm64-apple-darwin'}, + 'Linux' : {32 : 'i686-pc-linux-gnu', 64 : 'x86_64-pc-linux-gnu'}, + 'LinuxARM' : {32 : 'arm-linux-gnueabihf', 64 : 'aarch64-linux-gnu'}, + 'Windows' : {32 : 'i686-mingw32', 64 : 'x86_64-mingw32'}} bits = 32 if sys.maxsize > 2**32: bits = 64 sys_name = platform.system() sys_platform = platform.platform() + if 'Darwin' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('arm64') > 0): + sys_name = 'DarwinARM' if 'Linux' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('aarch64') > 0): sys_name = 'LinuxARM' if 'CYGWIN_NT' in sys_name: diff --git a/tools/platformio-build.py b/tools/platformio-build.py index b3fa396a489..e3c7b50dbb8 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -51,19 +51,19 @@ def get_partition_table_csv(variants_dir): if partitions_name: # A custom partitions file is selected - if isfile(join(variant_partitions_dir, partitions_name)): + if isfile(env.subst(join(variant_partitions_dir, partitions_name))): return join(variant_partitions_dir, partitions_name) return abspath( join(fwpartitions_dir, partitions_name) - if isfile(join(fwpartitions_dir, partitions_name)) + if isfile(env.subst(join(fwpartitions_dir, partitions_name))) else partitions_name ) variant_partitions = join(variant_partitions_dir, "partitions.csv") return ( variant_partitions - if isfile(variant_partitions) + if isfile(env.subst(variant_partitions)) else join(fwpartitions_dir, "default.csv") ) @@ -81,7 +81,7 @@ def get_bootloader_image(variants_dir): return ( variant_bootloader - if isfile(variant_bootloader) + if isfile(env.subst(variant_bootloader)) else generate_bootloader_image( join( FRAMEWORK_DIR, @@ -126,8 +126,8 @@ def add_tinyuf2_extra_image(): ) # Add the UF2 image only if it exists and it's not already added - if not isfile(tinuf2_image): - print("Warning! The `%s` UF2 bootloader image doesn't exist" % tinuf2_image) + if not isfile(env.subst(tinuf2_image)): + print("Warning! The `%s` UF2 bootloader image doesn't exist" % env.subst(tinuf2_image)) return if any( diff --git a/variants/AirM2M_CORE_ESP32C3/pins_arduino.h b/variants/AirM2M_CORE_ESP32C3/pins_arduino.h index af061a0eee2..4af6c1d87cd 100644 --- a/variants/AirM2M_CORE_ESP32C3/pins_arduino.h +++ b/variants/AirM2M_CORE_ESP32C3/pins_arduino.h @@ -11,6 +11,10 @@ #define digitalPinToInterrupt(p) (((p) + +#define EXTERNAL_NUM_INTERRUPTS 34 +#define NUM_DIGITAL_PINS 34 +#define NUM_ANALOG_INPUTS 2 + +#define analogInputToDigitalPin(p) (((p)<2)?(analogChannelToDigitalPin(p)):-1) +#define digitalPinToInterrupt(p) (((p)<34)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +//Programming and Debugging Port +static const uint8_t TXD = 43; +static const uint8_t RXD = 44; +static const uint8_t RST = 0; + +//I2C +static const uint8_t SDA = 20; +static const uint8_t SCL = 19; + +//I2C INT fro RTC PCF8563 +static const uint8_t I2C_INT = 9; + +//SPI BUS for W5500 Ethernet Port Driver +static const uint8_t SS = 10; +static const uint8_t MOSI = 12; +static const uint8_t MISO = 11; +static const uint8_t SCK = 13; +static const uint8_t ETH_INT = 14; +static const uint8_t ETH_RST = 15; + +//A7670G +static const uint8_t LTE_PWR_EN = 16; +static const uint8_t LTE_PWR_KEY = 21; +static const uint8_t LTE_TXD = 48; +static const uint8_t LTE_RXD = 47; + +//RS485 +static const uint8_t RS485_TXD = 17; +static const uint8_t RS485_RXD = 18; +static const uint8_t RS485_RTS = 8; + +//CAN BUS +static const uint8_t CAN_TXD = 1; +static const uint8_t CAN_RXD = 2; + +//BUZZER +static const uint8_t BUZZER = 45; + +static const uint8_t DO0 = 40; +static const uint8_t DO1 = 39; +static const uint8_t DO2 = 38; +static const uint8_t DO3 = 37; +static const uint8_t DO4 = 36; +static const uint8_t DO5 = 35; + +static const uint8_t DI0 = 4; +static const uint8_t DI1 = 5; +static const uint8_t DI2 = 6; +static const uint8_t DI3 = 7; + +static const uint8_t AO0 = 42; +static const uint8_t AO1 = 41; + +#endif /* Pins_Arduino_h */ \ No newline at end of file diff --git a/variants/VALTRACK_V4_MFW_ESP32_C3/pins_arduino.h b/variants/VALTRACK_V4_MFW_ESP32_C3/pins_arduino.h new file mode 100644 index 00000000000..4e3c771578b --- /dev/null +++ b/variants/VALTRACK_V4_MFW_ESP32_C3/pins_arduino.h @@ -0,0 +1,57 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 22 +#define NUM_DIGITAL_PINS 22 +#define NUM_ANALOG_INPUTS 6 + +#define analogInputToDigitalPin(p) (((p) + +#define EXTERNAL_NUM_INTERRUPTS 22 +#define NUM_DIGITAL_PINS 22 +#define NUM_ANALOG_INPUTS 6 + +#define analogInputToDigitalPin(p) (((p) + + +#define USB_VID 0x239A +#define USB_PID 0x8123 +#define USB_MANUFACTURER "Adafruit" +#define USB_PRODUCT "Feather ESP32-S3 Reverse TFT" +#define USB_SERIAL "" // Empty string for MAC adddress + + +#define EXTERNAL_NUM_INTERRUPTS 46 +#define NUM_DIGITAL_PINS 48 +#define NUM_ANALOG_INPUTS 20 + +#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1) +#define digitalPinToInterrupt(p) (((p)<48)?(p):-1) +#define digitalPinHasPWM(p) (p < 46) + +#define LED_BUILTIN 13 + +#define PIN_NEOPIXEL 33 +#define NEOPIXEL_NUM 1 // number of neopixels +#define NEOPIXEL_POWER 21 // power pin +#define NEOPIXEL_POWER_ON HIGH // power pin state when on + +#define TFT_I2C_POWER 7 +#define TFT_CS 42 +#define TFT_RST 41 +#define TFT_DC 40 +#define TFT_BACKLITE 45 + +static const uint8_t SDA = 3; +static const uint8_t SCL = 4; + +static const uint8_t SS = 42; +static const uint8_t MOSI = 35; +static const uint8_t SCK = 36; +static const uint8_t MISO = 37; + +static const uint8_t A0 = 18; +static const uint8_t A1 = 17; +static const uint8_t A2 = 16; +static const uint8_t A3 = 15; +static const uint8_t A4 = 14; +static const uint8_t A5 = 8; + +static const uint8_t TX = 39; +static const uint8_t RX = 38; +#define TX1 TX +#define RX1 RX + +static const uint8_t T5 = 5; +static const uint8_t T6 = 6; +static const uint8_t T8 = 8; +static const uint8_t T9 = 9; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; +static const uint8_t T13 = 13; +static const uint8_t T14 = 14; + +static const uint8_t DAC1 = 17; +static const uint8_t DAC2 = 18; + +#endif /* Pins_Arduino_h */ diff --git a/variants/adafruit_feather_esp32s3_reversetft/tinyuf2.bin b/variants/adafruit_feather_esp32s3_reversetft/tinyuf2.bin new file mode 100644 index 00000000000..7e852a31efd Binary files /dev/null and b/variants/adafruit_feather_esp32s3_reversetft/tinyuf2.bin differ diff --git a/variants/adafruit_feather_esp32s3_reversetft/variant.cpp b/variants/adafruit_feather_esp32s3_reversetft/variant.cpp new file mode 100644 index 00000000000..548ce9ff4a1 --- /dev/null +++ b/variants/adafruit_feather_esp32s3_reversetft/variant.cpp @@ -0,0 +1,42 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + + +#include "esp32-hal-gpio.h" +#include "pins_arduino.h" + +extern "C" { + +// Initialize variant/board, called before setup() +void initVariant(void) +{ + // This board has power control pins, and we must set them to output and high + // in order to enable the NeoPixels, TFT & I2C + pinMode(NEOPIXEL_POWER, OUTPUT); + digitalWrite(NEOPIXEL_POWER, HIGH); + pinMode(TFT_I2C_POWER, OUTPUT); + digitalWrite(TFT_I2C_POWER, HIGH); +} + +} diff --git a/variants/crabik_slot_esp32_s3/pins_arduino.h b/variants/crabik_slot_esp32_s3/pins_arduino.h new file mode 100644 index 00000000000..31aa9ee79cb --- /dev/null +++ b/variants/crabik_slot_esp32_s3/pins_arduino.h @@ -0,0 +1,88 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x303a +#define USB_PID 0x814D // for user apps (https://github.com/espressif/usb-pids/pull/77) +#define USB_MANUFACTURER "Crabik" +#define USB_PRODUCT "Slot ESP32-S3" +#define USB_SERIAL "" + +#define EXTERNAL_NUM_INTERRUPTS 46 +#define NUM_DIGITAL_PINS 48 +#define NUM_ANALOG_INPUTS 20 + +#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1) +#define digitalPinToInterrupt(p) (((p)<48)?(p):-1) +#define digitalPinHasPWM(p) (p < 46) + +static const uint8_t LED_BUILTIN = 21; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN + +static const uint8_t S1 = 1; +static const uint8_t S2 = 12; +static const uint8_t S3 = 2; +static const uint8_t S4 = 11; +static const uint8_t S5 = 17; +static const uint8_t S6 = 18; +static const uint8_t S7 = 3; +static const uint8_t S8 = 4; +static const uint8_t S9 = 5; +static const uint8_t S10 = 6; +static const uint8_t S11 = 7; +static const uint8_t S12 = 8; +static const uint8_t S13 = 9; +static const uint8_t S14 = 10; +static const uint8_t S15 = 45; +static const uint8_t S16 = 46; +static const uint8_t S17 = 48; +static const uint8_t S18 = 47; +static const uint8_t S19 = 33; +static const uint8_t S20 = 34; + +static const uint8_t TX = S12; +static const uint8_t RX = S11; +#define TX1 TX +#define RX1 RX + +static const uint8_t SDA = 13; +static const uint8_t SCL = 14; +static const uint8_t D = SDA; +static const uint8_t C = SCL; + +static const uint8_t MOSI = 35; +static const uint8_t MISO = 37; +static const uint8_t SCK = 36; +static const uint8_t DO = MOSI; +static const uint8_t DI = MISO; +static const uint8_t CLK = SCK; +static const uint8_t CS1 = S5; +static const uint8_t CS2 = S6; +static const uint8_t SS = CS1; + +static const uint8_t T1 = 1; +static const uint8_t T2 = 2; +static const uint8_t T3 = 3; +static const uint8_t T4 = 4; +static const uint8_t T5 = 5; +static const uint8_t T6 = 6; +static const uint8_t T7 = 7; +static const uint8_t T8 = 8; +static const uint8_t T9 = 9; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; + +static const uint8_t USB_DN = 19; +static const uint8_t USB_DP = 20; + +static const uint8_t BOOT_BTN = 0; +static const uint8_t USER_LED = LED_BUILTIN; + +static const uint8_t EN_TROYKA = 15; + +static const uint8_t LIPO_ALERT = 16; + +#endif /* Pins_Arduino_h */ diff --git a/variants/heltec_wifi_lora_32_V3/pins_arduino.h b/variants/heltec_wifi_lora_32_V3/pins_arduino.h index 04dcadc4030..24fd2a41f28 100644 --- a/variants/heltec_wifi_lora_32_V3/pins_arduino.h +++ b/variants/heltec_wifi_lora_32_V3/pins_arduino.h @@ -29,8 +29,8 @@ static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+48; static const uint8_t TX = 43; static const uint8_t RX = 44; -static const uint8_t SDA = 8; -static const uint8_t SCL = 9; +static const uint8_t SDA = 41; +static const uint8_t SCL = 42; static const uint8_t SS = 10; static const uint8_t MOSI = 11; diff --git a/variants/lilygo_t_display_s3/pins_arduino.h b/variants/lilygo_t_display_s3/pins_arduino.h new file mode 100644 index 00000000000..099bdad5876 --- /dev/null +++ b/variants/lilygo_t_display_s3/pins_arduino.h @@ -0,0 +1,92 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +#define EXTERNAL_NUM_INTERRUPTS 46 +#define NUM_DIGITAL_PINS 48 +#define NUM_ANALOG_INPUTS 20 + +#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1) +#define digitalPinToInterrupt(p) (((p)<48)?(p):-1) +#define digitalPinHasPWM(p) (p < 46) + +static const uint8_t BUTTON_1 = 0; +static const uint8_t BUTTON_2 = 14; +static const uint8_t BAT_VOLT = 4; + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t SDA = 18; +static const uint8_t SCL = 17; + +static const uint8_t SS = 10; +static const uint8_t MOSI = 11; +static const uint8_t MISO = 13; +static const uint8_t SCK = 12; + +static const uint8_t TP_RESET = 21; +static const uint8_t TP_INIT = 16; + +// ST7789 IPS TFT 170x320 +static const uint8_t LCD_BL = 38; +static const uint8_t LCD_D0 = 39; +static const uint8_t LCD_D1 = 40; +static const uint8_t LCD_D2 = 41; +static const uint8_t LCD_D3 = 42; +static const uint8_t LCD_D4 = 45; +static const uint8_t LCD_D5 = 46; +static const uint8_t LCD_D6 = 47; +static const uint8_t LCD_D7 = 48; +static const uint8_t LCD_WR = 8; +static const uint8_t LCD_RD = 9; +static const uint8_t LCD_DC = 7; +static const uint8_t LCD_CS = 6; +static const uint8_t LCD_RES = 5; +static const uint8_t LCD_POWER_ON = 15; + +// P1 +static const uint8_t PIN_43 = 43; +static const uint8_t PIN_44 = 44; +static const uint8_t PIN_18 = 18; +static const uint8_t PIN_17 = 17; +static const uint8_t PIN_21 = 21; +static const uint8_t PIN_16 = 16; + +// P2 +static const uint8_t PIN_1 = 1; +static const uint8_t PIN_2 = 2; +static const uint8_t PIN_3 = 3; +static const uint8_t PIN_10 = 10; +static const uint8_t PIN_11 = 11; +static const uint8_t PIN_12 = 12; +static const uint8_t PIN_13 = 13; + +// Analog +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A9 = 10; +static const uint8_t A10 = 11; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; +static const uint8_t A15 = 16; +static const uint8_t A16 = 17; +static const uint8_t A17 = 18; + + +// Touch +static const uint8_t T1 = 1; +static const uint8_t T2 = 2; +static const uint8_t T3 = 3; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; +static const uint8_t T13 = 13; + +#endif /* Pins_Arduino_h */ diff --git a/variants/roboheart_hercules/pins_arduino.h b/variants/roboheart_hercules/pins_arduino.h new file mode 100644 index 00000000000..17a5951773e --- /dev/null +++ b/variants/roboheart_hercules/pins_arduino.h @@ -0,0 +1,104 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 20 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + + +// Motor driver pins +#define MOTOR_A_IN1 25 // PHASE/IN1 +#define MOTOR_A_IN2 26 // ENABLE/IN2 + +#define MOTOR_B_IN1 27 // PHASE/IN1 +#define MOTOR_B_IN2 32 // ENABLE/IN2 + +#define MOTOR_C_IN1 33 // PHASE/IN1 +#define MOTOR_C_IN2 4 // ENABLE/IN2 + +#define SLEEP_MOTOR_ABC 2 // nSLEEP + +#define LED_ROBOHEART 14 // Built in LED +#define BUILTIN_LED LED_ROBOHEART // backward compatibility +#define LED_BUILTIN LED_ROBOHEART + +#define BUTTON_ROBOHEART 0 // Button + +// I2C IMU sensor +#define IMU_SDA 21 +#define IMU_SCL 22 + +#define RXD1 16 +#define TXD1 17 + +// GSM Vela connector board pins +#define GSM_PWRKEY 12 +#define GSM_DTR 13 +#define GSM_CTS 15 +#define GSM_RTS 14 +#define GSM_TX TXD1 +#define GSM_RX RXD1 +#define BATTERY_PIN 36 // Battery ADC pin + +static const uint8_t TX = 35; +static const uint8_t RX = 34; + +static const uint8_t TXD2 = 17; +static const uint8_t RXD2 = 16; + +static const uint8_t SDA = 21; +static const uint8_t SCL = 22; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 23; +static const uint8_t MISO = 19; +static const uint8_t SCK = 18; + +static const uint8_t G23 = 23; +static const uint8_t G19 = 19; +static const uint8_t G18 = 18; +static const uint8_t G3 = 3; +static const uint8_t G16 = 16; +static const uint8_t G21 = 21; +static const uint8_t G2 = 2; +static const uint8_t G12 = 12; +static const uint8_t G15 = 15; +static const uint8_t G35 = 35; +static const uint8_t G36 = 36; +static const uint8_t G25 = 25; +static const uint8_t G26 = 26; +static const uint8_t G1 = 1; +static const uint8_t G17 = 17; +static const uint8_t G22 = 22; +static const uint8_t G5 = 5; +static const uint8_t G13 = 13; +static const uint8_t G0 = 0; +static const uint8_t G34 = 34; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t A0 = 36; +static const uint8_t A3 = 39; +static const uint8_t A4 = 32; +static const uint8_t A5 = 33; +static const uint8_t A6 = 34; +static const uint8_t A7 = 35; +static const uint8_t A10 = 4; +static const uint8_t A11 = 0; +static const uint8_t A12 = 2; +static const uint8_t A13 = 15; +static const uint8_t A14 = 13; +static const uint8_t A15 = 12; +static const uint8_t A16 = 14; +static const uint8_t A17 = 27; +static const uint8_t A18 = 25; +static const uint8_t A19 = 26; + +#endif /* Pins_Arduino_h */