diff --git a/.github/scripts/install-arduino-ide.sh b/.github/scripts/install-arduino-ide.sh index 7e268b1ff7e..e0c5b78b794 100755 --- a/.github/scripts/install-arduino-ide.sh +++ b/.github/scripts/install-arduino-ide.sh @@ -48,16 +48,22 @@ else export ARDUINO_USR_PATH="$HOME/Arduino" fi +# Updated as of Nov 3rd 2020 +ARDUINO_IDE_URL="https://github.com/espressif/arduino-esp32/releases/download/1.0.4/arduino-nightly-" + +# Currently not working +#ARDUINO_IDE_URL="https://www.arduino.cc/download.php?f=/arduino-nightly-" + if [ ! -d "$ARDUINO_IDE_PATH" ]; then echo "Installing Arduino IDE on $OS_NAME ..." - echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..." + echo "Downloading '$ARDUINO_IDE_URL$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..." if [ "$OS_IS_LINUX" == "1" ]; then - wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1 + wget -O "arduino.$ARCHIVE_FORMAT" "$ARDUINO_IDE_URL$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1 echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..." tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null mv arduino-nightly "$ARDUINO_IDE_PATH" else - curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1 + curl -o "arduino.$ARCHIVE_FORMAT" -L "$ARDUINO_IDE_URL$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1 echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..." unzip "arduino.$ARCHIVE_FORMAT" > /dev/null if [ "$OS_IS_MACOS" == "1" ]; then diff --git a/.github/scripts/install-platformio-esp32.sh b/.github/scripts/install-platformio-esp32.sh index 65dc0c40af6..c065b0a029c 100755 --- a/.github/scripts/install-platformio-esp32.sh +++ b/.github/scripts/install-platformio-esp32.sh @@ -12,19 +12,14 @@ echo "Installing Platform ESP32 ..." python -m platformio platform install https://github.com/platformio/platform-espressif32.git > /dev/null 2>&1 echo "Replacing the framework version ..." -if [[ "$OSTYPE" == "darwin"* ]]; then - sed 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json" > "platform.json" - mv -f "platform.json" "$HOME/.platformio/platforms/espressif32/platform.json" -else - sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json" -fi +python -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/espressif32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoespressif32']['version'] = '*'; del data['packages']['framework-arduinoespressif32']['owner']; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()" if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then echo "Linking Core..." ln -s $GITHUB_WORKSPACE "$PLATFORMIO_ESP32_PATH" else echo "Cloning Core Repository ..." - git clone https://github.com/espressif/arduino-esp32.git "$PLATFORMIO_ESP32_PATH" > /dev/null 2>&1 + git clone --recursive https://github.com/espressif/arduino-esp32.git "$PLATFORMIO_ESP32_PATH" > /dev/null 2>&1 fi echo "PlatformIO for ESP32 has been installed" diff --git a/.github/scripts/on-release.sh b/.github/scripts/on-release.sh index e5e320099dd..7b32d9cc544 100755 --- a/.github/scripts/on-release.sh +++ b/.github/scripts/on-release.sh @@ -330,7 +330,7 @@ fi if [ ! -z "$COMMITS_SINCE_RELEASE" ] && [ "$COMMITS_SINCE_RELEASE" != "null" ]; then echo "Getting commits since $COMMITS_SINCE_RELEASE ..." commitFile=$OUTPUT_DIR/commits.txt - git -C "$GITHUB_WORKSPACE" log --oneline $COMMITS_SINCE_RELEASE.. > "$OUTPUT_DIR/commits.txt" + git -C "$GITHUB_WORKSPACE" log --oneline "$COMMITS_SINCE_RELEASE..HEAD" > "$OUTPUT_DIR/commits.txt" releaseNotes+=$'\r\n##### Commits\r\n' IFS=$'\n' for next in `cat $commitFile` diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a2ca8e7286..4911dd5896d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ set(LIBRARY_SRCS libraries/SPI/src/SPI.cpp libraries/Ticker/src/Ticker.cpp libraries/Update/src/Updater.cpp + libraries/Update/src/HttpsOTAUpdate.cpp libraries/WebServer/src/WebServer.cpp libraries/WebServer/src/Parsing.cpp libraries/WebServer/src/detail/mimetable.cpp @@ -207,7 +208,7 @@ set(COMPONENT_ADD_INCLUDEDIRS set(COMPONENT_PRIV_INCLUDEDIRS cores/esp32/libb64) set(COMPONENT_REQUIRES spi_flash mbedtls mdns ethernet esp_adc_cal wifi_provisioning) -set(COMPONENT_PRIV_REQUIRES fatfs nvs_flash app_update spiffs bootloader_support openssl bt) +set(COMPONENT_PRIV_REQUIRES fatfs nvs_flash app_update spiffs bootloader_support openssl bt esp_http_client esp_https_ota) register_component() diff --git a/Kconfig.projbuild b/Kconfig.projbuild index 10bbf25181e..740f077c5fc 100644 --- a/Kconfig.projbuild +++ b/Kconfig.projbuild @@ -76,13 +76,18 @@ choice ARDUINO_UDP_RUNNING_CORE endchoice +config ARDUINO_UDP_TASK_PRIORITY + int "Priority of the UDP task" + default 3 + help + Select at what priority you want the UDP task to run. + config ARDUINO_UDP_RUNNING_CORE int default 0 if ARDUINO_UDP_RUN_CORE0 default 1 if ARDUINO_UDP_RUN_CORE1 default -1 if ARDUINO_UDP_RUN_NO_AFFINITY - config DISABLE_HAL_LOCKS bool "Disable mutex locks for HAL" default "n" diff --git a/README.md b/README.md index 27f18c077cc..cc4dee0edcf 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,11 @@ - [ESP32Dev Board PINMAP](#esp32dev-board-pinmap) ### Development Status -[Latest stable release ![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg?style=plastic) ![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) ![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg?style=plastic) -[Latest development release ![Development Version](https://img.shields.io/github/release/espressif/arduino-esp32/all.svg?style=plastic) ![Development Date](https://img.shields.io/github/release-date-pre/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) ![Downloads](https://img.shields.io/github/downloads-pre/espressif/arduino-esp32/latest/total.svg?style=plastic) +Latest Stable Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) + +Latest Development Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) + ### Installation Instructions - Using Arduino IDE Boards Manager (preferred) diff --git a/boards.txt b/boards.txt index 2b213a8dfd9..15783f7ec76 100644 --- a/boards.txt +++ b/boards.txt @@ -387,6 +387,60 @@ tinypico.menu.DebugLevel.debug.build.code_debug=4 tinypico.menu.DebugLevel.verbose=Verbose tinypico.menu.DebugLevel.verbose.build.code_debug=5 +############################################################## +S_ODI_Ultra.name=S.ODI Ultra v1 + +S_ODI_Ultra.upload.tool=esptool_py +S_ODI_Ultra.upload.maximum_size=1310720 +S_ODI_Ultra.upload.maximum_data_size=327680 +S_ODI_Ultra.upload.wait_for_upload_port=true + +S_ODI_Ultra.serial.disableDTR=true +S_ODI_Ultra.serial.disableRTS=true + +S_ODI_Ultra.build.mcu=esp32 +S_ODI_Ultra.build.core=esp32 +S_ODI_Ultra.build.variant=S_ODI_Ultra_v1 +S_ODI_Ultra.build.board=ESP32_DEV + +S_ODI_Ultra.build.f_cpu=240000000L +S_ODI_Ultra.build.flash_mode=dio +S_ODI_Ultra.build.flash_size=4MB +S_ODI_Ultra.build.boot=dio +S_ODI_Ultra.build.partitions=default +S_ODI_Ultra.build.defines= + +S_ODI_Ultra.menu.FlashFreq.80=80MHz +S_ODI_Ultra.menu.FlashFreq.80.build.flash_freq=80m +S_ODI_Ultra.menu.FlashFreq.40=40MHz +S_ODI_Ultra.menu.FlashFreq.40.build.flash_freq=40m + +S_ODI_Ultra.menu.UploadSpeed.921600=921600 +S_ODI_Ultra.menu.UploadSpeed.921600.upload.speed=921600 +S_ODI_Ultra.menu.UploadSpeed.115200=115200 +S_ODI_Ultra.menu.UploadSpeed.115200.upload.speed=115200 +S_ODI_Ultra.menu.UploadSpeed.256000.windows=256000 +S_ODI_Ultra.menu.UploadSpeed.256000.upload.speed=256000 +S_ODI_Ultra.menu.UploadSpeed.230400.windows.upload.speed=256000 +S_ODI_Ultra.menu.UploadSpeed.230400=230400 +S_ODI_Ultra.menu.UploadSpeed.230400.upload.speed=230400 +S_ODI_Ultra.menu.UploadSpeed.460800.linux=460800 +S_ODI_Ultra.menu.UploadSpeed.460800.macosx=460800 +S_ODI_Ultra.menu.UploadSpeed.460800.upload.speed=460800 +S_ODI_Ultra.menu.UploadSpeed.512000.windows=512000 +S_ODI_Ultra.menu.UploadSpeed.512000.upload.speed=512000 + +S_ODI_Ultra.menu.DebugLevel.none=None +S_ODI_Ultra.menu.DebugLevel.none.build.code_debug=0 +S_ODI_Ultra.menu.DebugLevel.error=Error +S_ODI_Ultra.menu.DebugLevel.error.build.code_debug=1 +S_ODI_Ultra.menu.DebugLevel.warn=Warn +S_ODI_Ultra.menu.DebugLevel.warn.build.code_debug=2 +S_ODI_Ultra.menu.DebugLevel.info=Info +S_ODI_Ultra.menu.DebugLevel.info.build.code_debug=3 +S_ODI_Ultra.menu.DebugLevel.debug=Debug +S_ODI_Ultra.menu.DebugLevel.debug.build.code_debug=4 + ############################################################## magicbit.name=MagicBit @@ -784,6 +838,70 @@ esp32thing.menu.DebugLevel.debug.build.code_debug=4 esp32thing.menu.DebugLevel.verbose=Verbose esp32thing.menu.DebugLevel.verbose.build.code_debug=5 +############################################################## + +esp32thing_plus.name=SparkFun ESP32 Thing Plus + +esp32thing_plus.upload.tool=esptool_py +esp32thing_plus.upload.maximum_size=1310720 +esp32thing_plus.upload.maximum_data_size=327680 +esp32thing_plus.upload.wait_for_upload_port=true + +esp32thing_plus.serial.disableDTR=true +esp32thing_plus.serial.disableRTS=true + +esp32thing_plus.build.mcu=esp32 +esp32thing_plus.build.core=esp32 +esp32thing_plus.build.variant=esp32thing_plus +esp32thing_plus.build.board=ESP32_THING_PLUS + +esp32thing_plus.build.f_cpu=240000000L +esp32thing_plus.build.flash_mode=dio +esp32thing_plus.build.flash_size=16MB +esp32thing_plus.build.boot=dio +esp32thing_plus.build.partitions=default +esp32thing_plus.build.defines= + +esp32thing_plus.menu.FlashFreq.80=80MHz +esp32thing_plus.menu.FlashFreq.80.build.flash_freq=80m +esp32thing_plus.menu.FlashFreq.40=40MHz +esp32thing_plus.menu.FlashFreq.40.build.flash_freq=40m + +esp32thing_plus.menu.PartitionScheme.default=Default (6.25MB APP/OTA/3.43MB SPIFFS) +esp32thing_plus.menu.PartitionScheme.default.build.partitions=default_16MB +esp32thing_plus.menu.PartitionScheme.default.upload.maximum_size=6553600 +esp32thing_plus.menu.PartitionScheme.large_spiffs=Large SPIFFS (4.5MB APP/OTA/6.93MB SPIFFS) +esp32thing_plus.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB +esp32thing_plus.menu.PartitionScheme.large_spiffs.upload.maximum_size=4718592 + +esp32thing_plus.menu.UploadSpeed.921600=921600 +esp32thing_plus.menu.UploadSpeed.921600.upload.speed=921600 +esp32thing_plus.menu.UploadSpeed.115200=115200 +esp32thing_plus.menu.UploadSpeed.115200.upload.speed=115200 +esp32thing_plus.menu.UploadSpeed.256000.windows=256000 +esp32thing_plus.menu.UploadSpeed.256000.upload.speed=256000 +esp32thing_plus.menu.UploadSpeed.230400.windows.upload.speed=256000 +esp32thing_plus.menu.UploadSpeed.230400=230400 +esp32thing_plus.menu.UploadSpeed.230400.upload.speed=230400 +esp32thing_plus.menu.UploadSpeed.460800.linux=460800 +esp32thing_plus.menu.UploadSpeed.460800.macosx=460800 +esp32thing_plus.menu.UploadSpeed.460800.upload.speed=460800 +esp32thing_plus.menu.UploadSpeed.512000.windows=512000 +esp32thing_plus.menu.UploadSpeed.512000.upload.speed=512000 + +esp32thing_plus.menu.DebugLevel.none=None +esp32thing_plus.menu.DebugLevel.none.build.code_debug=0 +esp32thing_plus.menu.DebugLevel.error=Error +esp32thing_plus.menu.DebugLevel.error.build.code_debug=1 +esp32thing_plus.menu.DebugLevel.warn=Warn +esp32thing_plus.menu.DebugLevel.warn.build.code_debug=2 +esp32thing_plus.menu.DebugLevel.info=Info +esp32thing_plus.menu.DebugLevel.info.build.code_debug=3 +esp32thing_plus.menu.DebugLevel.debug=Debug +esp32thing_plus.menu.DebugLevel.debug.build.code_debug=4 +esp32thing_plus.menu.DebugLevel.verbose=Verbose +esp32thing_plus.menu.DebugLevel.verbose.build.code_debug=5 + ############################################################## @@ -1996,6 +2114,61 @@ esp32doit-devkit-v1.menu.DebugLevel.debug.build.code_debug=4 ############################################################## +esp32doit-espduino.name=DOIT ESPduino32 + +esp32doit-espduino.upload.tool=esptool +esp32doit-espduino.upload.maximum_size=1310720 +esp32doit-espduino.upload.maximum_data_size=327680 +esp32doit-espduino.upload.wait_for_upload_port=true + +esp32doit-espduino.serial.disableDTR=true +esp32doit-espduino.serial.disableRTS=true + +esp32doit-espduino.build.mcu=esp32 +esp32doit-espduino.build.core=esp32 +esp32doit-espduino.build.variant=doitESPduino32 +esp32doit-espduino.build.board=ESP32_DEV + +esp32doit-espduino.build.f_cpu=240000000L +esp32doit-espduino.build.flash_mode=dio +esp32doit-espduino.build.flash_size=4MB +esp32doit-espduino.build.boot=dio +esp32doit-espduino.build.partitions=default +esp32doit-espduino.build.defines= + +esp32doit-espduino.menu.FlashFreq.80=80MHz +esp32doit-espduino.menu.FlashFreq.80.build.flash_freq=80m +esp32doit-espduino.menu.FlashFreq.40=40MHz +esp32doit-espduino.menu.FlashFreq.40.build.flash_freq=40m + +esp32doit-espduino.menu.UploadSpeed.921600=921600 +esp32doit-espduino.menu.UploadSpeed.921600.upload.speed=921600 +esp32doit-espduino.menu.UploadSpeed.115200=115200 +esp32doit-espduino.menu.UploadSpeed.115200.upload.speed=115200 +esp32doit-espduino.menu.UploadSpeed.256000.windows=256000 +esp32doit-espduino.menu.UploadSpeed.256000.upload.speed=256000 +esp32doit-espduino.menu.UploadSpeed.230400.windows.upload.speed=256000 +esp32doit-espduino.menu.UploadSpeed.230400=230400 +esp32doit-espduino.menu.UploadSpeed.230400.upload.speed=230400 +esp32doit-espduino.menu.UploadSpeed.460800.linux=460800 +esp32doit-espduino.menu.UploadSpeed.460800.macosx=460800 +esp32doit-espduino.menu.UploadSpeed.460800.upload.speed=460800 +esp32doit-espduino.menu.UploadSpeed.512000.windows=512000 +esp32doit-espduino.menu.UploadSpeed.512000.upload.speed=512000 + +esp32doit-espduino.menu.DebugLevel.none=None +esp32doit-espduino.menu.DebugLevel.none.build.code_debug=0 +esp32doit-espduino.menu.DebugLevel.error=Error +esp32doit-espduino.menu.DebugLevel.error.build.code_debug=1 +esp32doit-espduino.menu.DebugLevel.warn=Warn +esp32doit-espduino.menu.DebugLevel.warn.build.code_debug=2 +esp32doit-espduino.menu.DebugLevel.info=Info +esp32doit-espduino.menu.DebugLevel.info.build.code_debug=3 +esp32doit-espduino.menu.DebugLevel.debug=Debug +esp32doit-espduino.menu.DebugLevel.debug.build.code_debug=4 + +############################################################## + esp32-evb.name=OLIMEX ESP32-EVB esp32-evb.upload.tool=esptool_py @@ -2552,6 +2725,105 @@ m5stack-atom.menu.DebugLevel.verbose=Verbose m5stack-atom.menu.DebugLevel.verbose.build.code_debug=5 +############################################################## + +m5stack-core2.name=M5Stack-Core2 + +m5stack-core2.upload.tool=esptool_py +m5stack-core2.upload.maximum_size=6553600 +m5stack-core2.upload.maximum_data_size=4521984 +m5stack-core2.upload.wait_for_upload_port=true + +m5stack-core2.serial.disableDTR=true +m5stack-core2.serial.disableRTS=true + +m5stack-core2.build.mcu=esp32 +m5stack-core2.build.core=esp32 +m5stack-core2.build.variant=m5stack_core2 +m5stack-core2.build.board=M5STACK_Core2 + +m5stack-core2.build.f_cpu=240000000L +m5stack-core2.build.flash_size=16MB +m5stack-core2.build.flash_freq=80m +m5stack-core2.build.flash_mode=dio +m5stack-core2.build.boot=dio +m5stack-core2.build.partitions=default_16MB +m5stack-core2.build.defines= + +m5stack-core2.menu.PSRAM.enabled=Enabled +m5stack-core2.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue +m5stack-core2.menu.PSRAM.disabled=Disabled +m5stack-core2.menu.PSRAM.disabled.build.defines= + +m5stack-core2.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) +m5stack-core2.menu.PartitionScheme.default.build.partitions=default_16MB +m5stack-core2.menu.PartitionScheme.default.upload.maximum_size=6553600 +m5stack-core2.menu.PartitionScheme.large_spiffs=Large SPIFFS (7 MB) +m5stack-core2.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB +m5stack-core2.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824 + +m5stack-core2.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack-core2.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack-core2.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack-core2.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack-core2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack-core2.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack-core2.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack-core2.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack-core2.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack-core2.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack-core2.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack-core2.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack-core2.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack-core2.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +m5stack-core2.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack-core2.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack-core2.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack-core2.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack-core2.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack-core2.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack-core2.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack-core2.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack-core2.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack-core2.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack-core2.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack-core2.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack-core2.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack-core2.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack-core2.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack-core2.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack-core2.menu.UploadSpeed.921600=921600 +m5stack-core2.menu.UploadSpeed.921600.upload.speed=921600 +m5stack-core2.menu.UploadSpeed.115200=115200 +m5stack-core2.menu.UploadSpeed.115200.upload.speed=115200 +m5stack-core2.menu.UploadSpeed.256000.windows=256000 +m5stack-core2.menu.UploadSpeed.256000.upload.speed=256000 +m5stack-core2.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack-core2.menu.UploadSpeed.230400=230400 +m5stack-core2.menu.UploadSpeed.230400.upload.speed=230400 +m5stack-core2.menu.UploadSpeed.460800.linux=460800 +m5stack-core2.menu.UploadSpeed.460800.macosx=460800 +m5stack-core2.menu.UploadSpeed.460800.upload.speed=460800 +m5stack-core2.menu.UploadSpeed.512000.windows=512000 +m5stack-core2.menu.UploadSpeed.512000.upload.speed=512000 +m5stack-core2.menu.UploadSpeed.1500000=1500000 +m5stack-core2.menu.UploadSpeed.1500000.upload.speed=1500000 + +m5stack-core2.menu.DebugLevel.none=None +m5stack-core2.menu.DebugLevel.none.build.code_debug=0 +m5stack-core2.menu.DebugLevel.error=Error +m5stack-core2.menu.DebugLevel.error.build.code_debug=1 +m5stack-core2.menu.DebugLevel.warn=Warn +m5stack-core2.menu.DebugLevel.warn.build.code_debug=2 +m5stack-core2.menu.DebugLevel.info=Info +m5stack-core2.menu.DebugLevel.info.build.code_debug=3 +m5stack-core2.menu.DebugLevel.debug=Debug +m5stack-core2.menu.DebugLevel.debug.build.code_debug=4 +m5stack-core2.menu.DebugLevel.verbose=Verbose +m5stack-core2.menu.DebugLevel.verbose.build.code_debug=5 + ############################################################## odroid_esp32.name=ODROID ESP32 @@ -3544,8 +3816,8 @@ t-beam.serial.disableRTS=true t-beam.build.mcu=esp32 t-beam.build.core=esp32 -t-beam.build.variant=t-beam -t-beam.build.board=T-Beam +t-beam.build.variant=tbeam +t-beam.build.board=TBeam t-beam.build.f_cpu=240000000L t-beam.build.flash_mode=dio @@ -4005,15 +4277,46 @@ esp32cam.build.mcu=esp32 esp32cam.build.core=esp32 esp32cam.build.variant=esp32 esp32cam.build.board=ESP32_DEV -esp32cam.build.f_cpu=240000000L esp32cam.build.flash_size=4MB -esp32cam.build.flash_freq=80m -esp32cam.build.flash_mode=dio -esp32cam.build.boot=qio esp32cam.build.partitions=huge_app esp32cam.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue esp32cam.build.code_debug=0 +esp32cam.menu.CPUFreq.240=240MHz (WiFi/BT) +esp32cam.menu.CPUFreq.240.build.f_cpu=240000000L +esp32cam.menu.CPUFreq.160=160MHz (WiFi/BT) +esp32cam.menu.CPUFreq.160.build.f_cpu=160000000L +esp32cam.menu.CPUFreq.80=80MHz (WiFi/BT) +esp32cam.menu.CPUFreq.80.build.f_cpu=80000000L +esp32cam.menu.CPUFreq.40=40MHz (40MHz XTAL) +esp32cam.menu.CPUFreq.40.build.f_cpu=40000000L +esp32cam.menu.CPUFreq.26=26MHz (26MHz XTAL) +esp32cam.menu.CPUFreq.26.build.f_cpu=26000000L +esp32cam.menu.CPUFreq.20=20MHz (40MHz XTAL) +esp32cam.menu.CPUFreq.20.build.f_cpu=20000000L +esp32cam.menu.CPUFreq.13=13MHz (26MHz XTAL) +esp32cam.menu.CPUFreq.13.build.f_cpu=13000000L +esp32cam.menu.CPUFreq.10=10MHz (40MHz XTAL) +esp32cam.menu.CPUFreq.10.build.f_cpu=10000000L + +esp32cam.menu.FlashMode.qio=QIO +esp32cam.menu.FlashMode.qio.build.flash_mode=dio +esp32cam.menu.FlashMode.qio.build.boot=qio +esp32cam.menu.FlashMode.dio=DIO +esp32cam.menu.FlashMode.dio.build.flash_mode=dio +esp32cam.menu.FlashMode.dio.build.boot=dio +esp32cam.menu.FlashMode.qout=QOUT +esp32cam.menu.FlashMode.qout.build.flash_mode=dout +esp32cam.menu.FlashMode.qout.build.boot=qout +esp32cam.menu.FlashMode.dout=DOUT +esp32cam.menu.FlashMode.dout.build.flash_mode=dout +esp32cam.menu.FlashMode.dout.build.boot=dout + +esp32cam.menu.FlashFreq.80=80MHz +esp32cam.menu.FlashFreq.80.build.flash_freq=80m +esp32cam.menu.FlashFreq.40=40MHz +esp32cam.menu.FlashFreq.40.build.flash_freq=40m + ############################################################## sparkfun_lora_gateway_1-channel.name=SparkFun LoRa Gateway 1-Channel @@ -4087,72 +4390,79 @@ sparkfun_lora_gateway_1-channel.menu.UploadSpeed.512000.upload.speed=512000 ############################################################## -ttgo-t-watch.name=TTGO T-Watch - -ttgo-t-watch.upload.tool=esptool_py -ttgo-t-watch.upload.maximum_size=6553600 -ttgo-t-watch.upload.maximum_data_size=4521984 -ttgo-t-watch.upload.wait_for_upload_port=true - -ttgo-t-watch.serial.disableDTR=true -ttgo-t-watch.serial.disableRTS=true - -ttgo-t-watch.build.mcu=esp32 -ttgo-t-watch.build.core=esp32 -ttgo-t-watch.build.variant=twatch -ttgo-t-watch.build.board=T-Watch - -ttgo-t-watch.build.f_cpu=240000000L -ttgo-t-watch.build.flash_size=16MB -ttgo-t-watch.build.flash_freq=80m -ttgo-t-watch.build.flash_mode=dio -ttgo-t-watch.build.boot=dio -ttgo-t-watch.build.partitions=default_16MB -ttgo-t-watch.build.defines= - -ttgo-t-watch.menu.PSRAM.enabled=Enabled -ttgo-t-watch.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -ttgo-t-watch.menu.PSRAM.disabled=Disabled -ttgo-t-watch.menu.PSRAM.disabled.build.defines= - -ttgo-t-watch.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) -ttgo-t-watch.menu.PartitionScheme.default.build.partitions=default_16MB -ttgo-t-watch.menu.PartitionScheme.default.upload.maximum_size=6553600 -ttgo-t-watch.menu.PartitionScheme.large_spiffs=Large SPIFFS (7 MB) -ttgo-t-watch.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB -ttgo-t-watch.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824 - -ttgo-t-watch.menu.UploadSpeed.2000000=2000000 -ttgo-t-watch.menu.UploadSpeed.2000000.upload.speed=2000000 -ttgo-t-watch.menu.UploadSpeed.1152000=1152000 -ttgo-t-watch.menu.UploadSpeed.1152000.upload.speed=1152000 -ttgo-t-watch.menu.UploadSpeed.921600=921600 -ttgo-t-watch.menu.UploadSpeed.921600.upload.speed=921600 -ttgo-t-watch.menu.UploadSpeed.115200=115200 -ttgo-t-watch.menu.UploadSpeed.115200.upload.speed=115200 -ttgo-t-watch.menu.UploadSpeed.256000.windows=256000 -ttgo-t-watch.menu.UploadSpeed.256000.upload.speed=256000 -ttgo-t-watch.menu.UploadSpeed.230400.windows.upload.speed=256000 -ttgo-t-watch.menu.UploadSpeed.230400=230400 -ttgo-t-watch.menu.UploadSpeed.230400.upload.speed=230400 -ttgo-t-watch.menu.UploadSpeed.460800.linux=460800 -ttgo-t-watch.menu.UploadSpeed.460800.macosx=460800 -ttgo-t-watch.menu.UploadSpeed.460800.upload.speed=460800 -ttgo-t-watch.menu.UploadSpeed.512000.windows=512000 -ttgo-t-watch.menu.UploadSpeed.512000.upload.speed=512000 - -ttgo-t-watch.menu.DebugLevel.none=None -ttgo-t-watch.menu.DebugLevel.none.build.code_debug=0 -ttgo-t-watch.menu.DebugLevel.error=Error -ttgo-t-watch.menu.DebugLevel.error.build.code_debug=1 -ttgo-t-watch.menu.DebugLevel.warn=Warn -ttgo-t-watch.menu.DebugLevel.warn.build.code_debug=2 -ttgo-t-watch.menu.DebugLevel.info=Info -ttgo-t-watch.menu.DebugLevel.info.build.code_debug=3 -ttgo-t-watch.menu.DebugLevel.debug=Debug -ttgo-t-watch.menu.DebugLevel.debug.build.code_debug=4 -ttgo-t-watch.menu.DebugLevel.verbose=Verbose -ttgo-t-watch.menu.DebugLevel.verbose.build.code_debug=5 +twatch.name=TTGO T-Watch + +twatch.upload.tool=esptool_py +twatch.upload.maximum_size=6553600 +twatch.upload.maximum_data_size=4521984 +twatch.upload.wait_for_upload_port=true + +twatch.serial.disableDTR=true +twatch.serial.disableRTS=true + +twatch.build.mcu=esp32 +twatch.build.core=esp32 +twatch.build.variant=twatch +twatch.build.board=TWatch + +twatch.menu.Revision.TWATCH_BASE=T-Watch Base +twatch.menu.Revision.TWATCH_BASE.build.board=TWATCH_BASE +twatch.menu.Revision.TWATCH_2020_V1=T-Watch-2020-V1 +twatch.menu.Revision.TWATCH_2020_V1.build.board=TWATCH_2020_V1 +twatch.menu.Revision.TWATCH_2020_V2=T-Watch-2020-V2 +twatch.menu.Revision.TWATCH_2020_V2.build.board=TWATCH_2020_V2 + +twatch.build.f_cpu=240000000L +twatch.build.flash_size=16MB +twatch.build.flash_freq=80m +twatch.build.flash_mode=dio +twatch.build.boot=dio +twatch.build.partitions=default_16MB +twatch.build.defines= + +twatch.menu.PSRAM.enabled=Enabled +twatch.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue +twatch.menu.PSRAM.disabled=Disabled +twatch.menu.PSRAM.disabled.build.defines= + +twatch.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) +twatch.menu.PartitionScheme.default.build.partitions=default_16MB +twatch.menu.PartitionScheme.default.upload.maximum_size=6553600 +twatch.menu.PartitionScheme.large_spiffs=Large SPIFFS (7 MB) +twatch.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB +twatch.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824 + +twatch.menu.UploadSpeed.2000000=2000000 +twatch.menu.UploadSpeed.2000000.upload.speed=2000000 +twatch.menu.UploadSpeed.1152000=1152000 +twatch.menu.UploadSpeed.1152000.upload.speed=1152000 +twatch.menu.UploadSpeed.921600=921600 +twatch.menu.UploadSpeed.921600.upload.speed=921600 +twatch.menu.UploadSpeed.115200=115200 +twatch.menu.UploadSpeed.115200.upload.speed=115200 +twatch.menu.UploadSpeed.256000.windows=256000 +twatch.menu.UploadSpeed.256000.upload.speed=256000 +twatch.menu.UploadSpeed.230400.windows.upload.speed=256000 +twatch.menu.UploadSpeed.230400=230400 +twatch.menu.UploadSpeed.230400.upload.speed=230400 +twatch.menu.UploadSpeed.460800.linux=460800 +twatch.menu.UploadSpeed.460800.macosx=460800 +twatch.menu.UploadSpeed.460800.upload.speed=460800 +twatch.menu.UploadSpeed.512000.windows=512000 +twatch.menu.UploadSpeed.512000.upload.speed=512000 + +twatch.menu.DebugLevel.none=None +twatch.menu.DebugLevel.none.build.code_debug=0 +twatch.menu.DebugLevel.error=Error +twatch.menu.DebugLevel.error.build.code_debug=1 +twatch.menu.DebugLevel.warn=Warn +twatch.menu.DebugLevel.warn.build.code_debug=2 +twatch.menu.DebugLevel.info=Info +twatch.menu.DebugLevel.info.build.code_debug=3 +twatch.menu.DebugLevel.debug=Debug +twatch.menu.DebugLevel.debug.build.code_debug=4 +twatch.menu.DebugLevel.verbose=Verbose +twatch.menu.DebugLevel.verbose.build.code_debug=5 ############################################################## @@ -4938,8 +5248,8 @@ kits-edu.menu.DebugLevel.verbose=Verbose kits-edu.menu.DebugLevel.verbose.build.code_debug=5 ############################################################## -mPython.name=mPython +mPython.name=Labplus mPython mPython.upload.tool=esptool_py mPython.upload.maximum_size=1310720 mPython.upload.maximum_data_size=327680 @@ -5046,4 +5356,357 @@ mPython.menu.DebugLevel.debug=Debug mPython.menu.DebugLevel.debug.build.code_debug=4 mPython.menu.DebugLevel.verbose=Verbose mPython.menu.DebugLevel.verbose.build.code_debug=5 + ############################################################## + +OpenKB.name=INEX OpenKB + +OpenKB.upload.tool=esptool_py +OpenKB.upload.maximum_size=1310720 +OpenKB.upload.maximum_data_size=327680 +OpenKB.upload.wait_for_upload_port=true + +OpenKB.serial.disableDTR=true +OpenKB.serial.disableRTS=true + +OpenKB.build.mcu=esp32 +OpenKB.build.core=esp32 +OpenKB.build.variant=openkb +OpenKB.build.board=openkb + +OpenKB.build.f_cpu=240000000L +OpenKB.build.flash_mode=dio +OpenKB.build.flash_size=4MB +OpenKB.build.boot=dio +OpenKB.build.partitions=default +OpenKB.build.defines= + +OpenKB.menu.FlashFreq.80=80MHz +OpenKB.menu.FlashFreq.80.build.flash_freq=80m +OpenKB.menu.FlashFreq.40=40MHz +OpenKB.menu.FlashFreq.40.build.flash_freq=40m + +OpenKB.menu.UploadSpeed.921600=921600 +OpenKB.menu.UploadSpeed.921600.upload.speed=921600 +OpenKB.menu.UploadSpeed.115200=115200 +OpenKB.menu.UploadSpeed.115200.upload.speed=115200 +OpenKB.menu.UploadSpeed.256000.windows=256000 +OpenKB.menu.UploadSpeed.256000.upload.speed=256000 +OpenKB.menu.UploadSpeed.230400.windows.upload.speed=256000 +OpenKB.menu.UploadSpeed.230400=230400 +OpenKB.menu.UploadSpeed.230400.upload.speed=230400 +OpenKB.menu.UploadSpeed.460800.linux=460800 +OpenKB.menu.UploadSpeed.460800.macosx=460800 +OpenKB.menu.UploadSpeed.460800.upload.speed=460800 +OpenKB.menu.UploadSpeed.512000.windows=512000 +OpenKB.menu.UploadSpeed.512000.upload.speed=512000 + +############################################################## + +wifiduino32.name=WiFiduino32 + +wifiduino32.upload.tool=esptool_py +wifiduino32.upload.maximum_size=1310720 +wifiduino32.upload.maximum_data_size=327680 +wifiduino32.upload.wait_for_upload_port=true + +wifiduino32.serial.disableDTR=true +wifiduino32.serial.disableRTS=true + +wifiduino32.build.mcu=esp32 +wifiduino32.build.core=esp32 +wifiduino32.build.variant=wifiduino32 +wifiduino32.build.board=Wifiduino32 + +wifiduino32.build.f_cpu=240000000L +wifiduino32.build.flash_mode=dio +wifiduino32.build.flash_size=4MB +wifiduino32.build.boot=dio +wifiduino32.build.partitions=default +wifiduino32.build.defines= + +wifiduino32.menu.PartitionScheme.default=Default +wifiduino32.menu.PartitionScheme.default.build.partitions=default +wifiduino32.menu.PartitionScheme.no_ota=No OTA (Large APP) +wifiduino32.menu.PartitionScheme.no_ota.build.partitions=no_ota +wifiduino32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +wifiduino32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) +wifiduino32.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +wifiduino32.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +wifiduino32.menu.FlashFreq.80=80MHz +wifiduino32.menu.FlashFreq.80.build.flash_freq=80m +wifiduino32.menu.FlashFreq.40=40MHz +wifiduino32.menu.FlashFreq.40.build.flash_freq=40m + +wifiduino32.menu.UploadSpeed.921600=921600 +wifiduino32.menu.UploadSpeed.921600.upload.speed=921600 +wifiduino32.menu.UploadSpeed.115200=115200 +wifiduino32.menu.UploadSpeed.115200.upload.speed=115200 +wifiduino32.menu.UploadSpeed.256000.windows=256000 +wifiduino32.menu.UploadSpeed.256000.upload.speed=256000 +wifiduino32.menu.UploadSpeed.230400.windows.upload.speed=256000 +wifiduino32.menu.UploadSpeed.230400=230400 +wifiduino32.menu.UploadSpeed.230400.upload.speed=230400 +wifiduino32.menu.UploadSpeed.460800.linux=460800 +wifiduino32.menu.UploadSpeed.460800.macosx=460800 +wifiduino32.menu.UploadSpeed.460800.upload.speed=460800 +wifiduino32.menu.UploadSpeed.512000.windows=512000 +wifiduino32.menu.UploadSpeed.512000.upload.speed=512000 + +wifiduino32.menu.DebugLevel.none=None +wifiduino32.menu.DebugLevel.none.build.code_debug=0 +wifiduino32.menu.DebugLevel.error=Error +wifiduino32.menu.DebugLevel.error.build.code_debug=1 +wifiduino32.menu.DebugLevel.warn=Warn +wifiduino32.menu.DebugLevel.warn.build.code_debug=2 +wifiduino32.menu.DebugLevel.info=Info +wifiduino32.menu.DebugLevel.info.build.code_debug=3 +wifiduino32.menu.DebugLevel.debug=Debug +wifiduino32.menu.DebugLevel.debug.build.code_debug=4 +wifiduino32.menu.DebugLevel.verbose=Verbose +wifiduino32.menu.DebugLevel.verbose.build.code_debug=5 + +############################################################## + +ttgo-lora32-v21new.name=TTGO LoRa32-OLED v2.1.6 + +ttgo-lora32-v21new.upload.tool=esptool_py +ttgo-lora32-v21new.upload.maximum_size=1310720 +ttgo-lora32-v21new.upload.maximum_data_size=294912 +ttgo-lora32-v21new.upload.wait_for_upload_port=true + +ttgo-lora32-v21new.serial.disableDTR=true +ttgo-lora32-v21new.serial.disableRTS=true + +ttgo-lora32-v21new.build.mcu=esp32 +ttgo-lora32-v21new.build.core=esp32 +ttgo-lora32-v21new.build.variant=ttgo-lora32-v21new +ttgo-lora32-v21new.build.board=TTGO_LoRa32_v21new + +ttgo-lora32-v21new.build.f_cpu=240000000L +ttgo-lora32-v21new.build.flash_mode=dio +ttgo-lora32-v21new.build.flash_size=4MB +ttgo-lora32-v21new.build.boot=dio +ttgo-lora32-v21new.build.partitions=default + +ttgo-lora32-v21new.menu.FlashFreq.80=80MHz +ttgo-lora32-v21new.menu.FlashFreq.80.build.flash_freq=80m +ttgo-lora32-v21new.menu.FlashFreq.40=40MHz +ttgo-lora32-v21new.menu.FlashFreq.40.build.flash_freq=40m + +ttgo-lora32-v21new.menu.UploadSpeed.921600=921600 +ttgo-lora32-v21new.menu.UploadSpeed.921600.upload.speed=921600 +ttgo-lora32-v21new.menu.UploadSpeed.115200=115200 +ttgo-lora32-v21new.name=TTGO LoRa32-OLED v2.1.6 + +ttgo-lora32-v21new.upload.tool=esptool_py +ttgo-lora32-v21new.upload.maximum_size=1310720 +ttgo-lora32-v21new.upload.maximum_data_size=294912 +ttgo-lora32-v21new.upload.wait_for_upload_port=true + +ttgo-lora32-v21new.serial.disableDTR=true +ttgo-lora32-v21new.serial.disableRTS=true + +ttgo-lora32-v21new.build.mcu=esp32 +ttgo-lora32-v21new.build.core=esp32 +ttgo-lora32-v21new.build.variant=ttgo-lora32-v21new +ttgo-lora32-v21new.build.board=TTGO_LoRa32_v21new + +ttgo-lora32-v21new.build.f_cpu=240000000L +ttgo-lora32-v21new.build.flash_mode=dio +ttgo-lora32-v21new.build.flash_size=4MB +ttgo-lora32-v21new.build.boot=dio +ttgo-lora32-v21new.build.partitions=default + +ttgo-lora32-v21new.menu.FlashFreq.80=80MHz +ttgo-lora32-v21new.menu.FlashFreq.80.build.flash_freq=80m +ttgo-lora32-v21new.menu.FlashFreq.40=40MHz +ttgo-lora32-v21new.menu.FlashFreq.40.build.flash_freq=40m + +ttgo-lora32-v21new.menu.UploadSpeed.921600=921600 +ttgo-lora32-v21new.menu.UploadSpeed.921600.upload.speed=921600 +ttgo-lora32-v21new.menu.UploadSpeed.115200=115200 +ttgo-lora32-v21new.menu.UploadSpeed.115200.upload.speed=115200 +ttgo-lora32-v21new.menu.UploadSpeed.256000.windows=256000 +ttgo-lora32-v21new.menu.UploadSpeed.256000.upload.speed=256000 +ttgo-lora32-v21new.menu.UploadSpeed.230400.windows.upload.speed=256000 +ttgo-lora32-v21new.menu.UploadSpeed.230400=230400 +ttgo-lora32-v21new.menu.UploadSpeed.230400.upload.speed=230400 +ttgo-lora32-v21new.menu.UploadSpeed.460800.linux=460800 +ttgo-lora32-v21new.menu.UploadSpeed.460800.macosx=460800 +ttgo-lora32-v21new.menu.UploadSpeed.460800.upload.speed=460800 +ttgo-lora32-v21new.menu.UploadSpeed.512000.windows=512000 +ttgo-lora32-v21new.menu.UploadSpeed.512000.upload.speed=512000 + +ttgo-lora32-v21new.menu.DebugLevel.none=None +ttgo-lora32-v21new.menu.DebugLevel.none.build.code_debug=0 +ttgo-lora32-v21new.menu.DebugLevel.error=Error +ttgo-lora32-v21new.menu.DebugLevel.error.build.code_debug=1 +ttgo-lora32-v21new.menu.DebugLevel.warn=Warn +ttgo-lora32-v21new.menu.DebugLevel.warn.build.code_debug=2 +ttgo-lora32-v21new.menu.DebugLevel.info=Info +ttgo-lora32-v21new.menu.DebugLevel.info.build.code_debug=3 +ttgo-lora32-v21new.menu.DebugLevel.debug=Debug +ttgo-lora32-v21new.menu.DebugLevel.debug.build.code_debug=4 +ttgo-lora32-v21new.menu.DebugLevel.verbose=Verbose +ttgo-lora32-v21new.menu.DebugLevel.verbose.build.code_debug=5w.menu.UploadSpeed.115200.upload.speed=115200 +ttgo-lora32-v21new.menu.UploadSpeed.256000.windows=256000 +ttgo-lora32-v21new.menu.UploadSpeed.256000.upload.speed=256000 +ttgo-lora32-v21new.menu.UploadSpeed.230400.windows.upload.speed=256000 +ttgo-lora32-v21new.menu.UploadSpeed.230400=230400 +ttgo-lora32-v21new.menu.UploadSpeed.230400.upload.speed=230400 +ttgo-lora32-v21new.menu.UploadSpeed.460800.linux=460800 +ttgo-lora32-v21new.menu.UploadSpeed.460800.macosx=460800 +ttgo-lora32-v21new.menu.UploadSpeed.460800.upload.speed=460800 +ttgo-lora32-v21new.menu.UploadSpeed.512000.windows=512000 +ttgo-lora32-v21new.menu.UploadSpeed.512000.upload.speed=512000 + +ttgo-lora32-v21new.menu.DebugLevel.none=None +ttgo-lora32-v21new.menu.DebugLevel.none.build.code_debug=0 +ttgo-lora32-v21new.menu.DebugLevel.error=Error +ttgo-lora32-v21new.menu.DebugLevel.error.build.code_debug=1 +ttgo-lora32-v21new.menu.DebugLevel.warn=Warn +ttgo-lora32-v21new.menu.DebugLevel.warn.build.code_debug=2 +ttgo-lora32-v21new.menu.DebugLevel.info=Info +ttgo-lora32-v21new.menu.DebugLevel.info.build.code_debug=3 +ttgo-lora32-v21new.menu.DebugLevel.debug=Debug +ttgo-lora32-v21new.menu.DebugLevel.debug.build.code_debug=4 +ttgo-lora32-v21new.menu.DebugLevel.verbose=Verbose +ttgo-lora32-v21new.menu.DebugLevel.verbose.build.code_debug=5 + +############################################################## + +imbrios-logsens-v1p1.name=IMBRIOS LOGSENS_V1P1 + +imbrios-logsens-v1p1.upload.tool=esptool_py +imbrios-logsens-v1p1.upload.maximum_size=1310720 +imbrios-logsens-v1p1.upload.maximum_data_size=327680 +imbrios-logsens-v1p1.upload.wait_for_upload_port=true + +imbrios-logsens-v1p1.serial.disableDTR=true +imbrios-logsens-v1p1.serial.disableRTS=true + +imbrios-logsens-v1p1.build.mcu=esp32 +imbrios-logsens-v1p1.build.core=esp32 +imbrios-logsens-v1p1.build.variant=imbrios-logsens-v1p1 +imbrios-logsens-v1p1.build.board=IMBRIOS_LOGSENS_V1P1 + +imbrios-logsens-v1p1.build.f_cpu=240000000L +imbrios-logsens-v1p1.build.flash_mode=dio +imbrios-logsens-v1p1.build.flash_size=4MB +imbrios-logsens-v1p1.build.boot=dio +imbrios-logsens-v1p1.build.partitions=default +imbrios-logsens-v1p1.build.defines= + +imbrios-logsens-v1p1.menu.FlashFreq.80=80MHz +imbrios-logsens-v1p1.menu.FlashFreq.80.build.flash_freq=80m +imbrios-logsens-v1p1.menu.FlashFreq.40=40MHz +imbrios-logsens-v1p1.menu.FlashFreq.40.build.flash_freq=40m + +imbrios-logsens-v1p1.menu.PartitionScheme.default=Default +imbrios-logsens-v1p1.menu.PartitionScheme.default.build.partitions=default +imbrios-logsens-v1p1.menu.PartitionScheme.no_ota=No OTA (Large APP) +imbrios-logsens-v1p1.menu.PartitionScheme.no_ota.build.partitions=no_ota +imbrios-logsens-v1p1.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +imbrios-logsens-v1p1.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) +imbrios-logsens-v1p1.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +imbrios-logsens-v1p1.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +imbrios-logsens-v1p1.menu.CPUFreq.240=240MHz (WiFi/BT) +imbrios-logsens-v1p1.menu.CPUFreq.240.build.f_cpu=240000000L +imbrios-logsens-v1p1.menu.CPUFreq.160=160MHz (WiFi/BT) +imbrios-logsens-v1p1.menu.CPUFreq.160.build.f_cpu=160000000L +imbrios-logsens-v1p1.menu.CPUFreq.80=80MHz (WiFi/BT) +imbrios-logsens-v1p1.menu.CPUFreq.80.build.f_cpu=80000000L +imbrios-logsens-v1p1.menu.CPUFreq.40=40MHz (40MHz XTAL) +imbrios-logsens-v1p1.menu.CPUFreq.40.build.f_cpu=40000000L +imbrios-logsens-v1p1.menu.CPUFreq.26=26MHz (26MHz XTAL) +imbrios-logsens-v1p1.menu.CPUFreq.26.build.f_cpu=26000000L +imbrios-logsens-v1p1.menu.CPUFreq.20=20MHz (40MHz XTAL) +imbrios-logsens-v1p1.menu.CPUFreq.20.build.f_cpu=20000000L +imbrios-logsens-v1p1.menu.CPUFreq.13=13MHz (26MHz XTAL) +imbrios-logsens-v1p1.menu.CPUFreq.13.build.f_cpu=13000000L +imbrios-logsens-v1p1.menu.CPUFreq.10=10MHz (40MHz XTAL) +imbrios-logsens-v1p1.menu.CPUFreq.10.build.f_cpu=10000000L + +imbrios-logsens-v1p1.menu.UploadSpeed.921600=921600 +imbrios-logsens-v1p1.menu.UploadSpeed.921600.upload.speed=921600 +imbrios-logsens-v1p1.menu.UploadSpeed.115200=115200 +imbrios-logsens-v1p1.menu.UploadSpeed.115200.upload.speed=115200 +imbrios-logsens-v1p1.menu.UploadSpeed.256000.windows=256000 +imbrios-logsens-v1p1.menu.UploadSpeed.256000.upload.speed=256000 +imbrios-logsens-v1p1.menu.UploadSpeed.230400.windows.upload.speed=256000 +imbrios-logsens-v1p1.menu.UploadSpeed.230400=230400 +imbrios-logsens-v1p1.menu.UploadSpeed.230400.upload.speed=230400 +imbrios-logsens-v1p1.menu.UploadSpeed.460800.linux=460800 +imbrios-logsens-v1p1.menu.UploadSpeed.460800.macosx=460800 +imbrios-logsens-v1p1.menu.UploadSpeed.460800.upload.speed=460800 +imbrios-logsens-v1p1.menu.UploadSpeed.512000.windows=512000 +imbrios-logsens-v1p1.menu.UploadSpeed.512000.upload.speed=512000 + +############################################################## + +healthypi4.name=ProtoCentral HealthyPi 4 + +healthypi4.upload.tool=esptool_py +healthypi4.upload.maximum_size=1310720 +healthypi4.upload.maximum_data_size=327680 +healthypi4.upload.wait_for_upload_port=true + +healthypi4.serial.disableDTR=true +healthypi4.serial.disableRTS=true + +healthypi4.build.mcu=esp32 +healthypi4.build.core=esp32 +healthypi4.build.variant=healthypi4 +healthypi4.build.board=HEALTHYPI_4 + +healthypi4.build.f_cpu=240000000L +healthypi4.build.flash_mode=dio +healthypi4.build.flash_size=4MB +healthypi4.build.boot=dio +healthypi4.build.partitions=min_spiffs +healthypi4.build.defines= + +healthypi4.menu.FlashFreq.80=80MHz +healthypi4.menu.FlashFreq.80.build.flash_freq=80m +healthypi4.menu.FlashFreq.40=40MHz +healthypi4.menu.FlashFreq.40.build.flash_freq=40m + +healthypi4.menu.PartitionScheme.default=Default +healthypi4.menu.PartitionScheme.default.build.partitions=default +healthypi4.menu.PartitionScheme.no_ota=No OTA (Large APP) +healthypi4.menu.PartitionScheme.no_ota.build.partitions=no_ota +healthypi4.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +healthypi4.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) +healthypi4.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +healthypi4.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +healthypi4.menu.UploadSpeed.921600=921600 +healthypi4.menu.UploadSpeed.921600.upload.speed=921600 +healthypi4.menu.UploadSpeed.115200=115200 +healthypi4.menu.UploadSpeed.115200.upload.speed=115200 +healthypi4.menu.UploadSpeed.256000.windows=256000 +healthypi4.menu.UploadSpeed.256000.upload.speed=256000 +healthypi4.menu.UploadSpeed.230400.windows.upload.speed=256000 +healthypi4.menu.UploadSpeed.230400=230400 +healthypi4.menu.UploadSpeed.230400.upload.speed=230400 +healthypi4.menu.UploadSpeed.460800.linux=460800 +healthypi4.menu.UploadSpeed.460800.macosx=460800 +healthypi4.menu.UploadSpeed.460800.upload.speed=460800 +healthypi4.menu.UploadSpeed.512000.windows=512000 +healthypi4.menu.UploadSpeed.512000.upload.speed=512000 + +healthypi4.menu.DebugLevel.none=None +healthypi4.menu.DebugLevel.none.build.code_debug=0 +healthypi4.menu.DebugLevel.error=Error +healthypi4.menu.DebugLevel.error.build.code_debug=1 +healthypi4.menu.DebugLevel.warn=Warn +healthypi4.menu.DebugLevel.warn.build.code_debug=2 +healthypi4.menu.DebugLevel.info=Info +healthypi4.menu.DebugLevel.info.build.code_debug=3 +healthypi4.menu.DebugLevel.debug=Debug +healthypi4.menu.DebugLevel.debug.build.code_debug=4 +healthypi4.menu.DebugLevel.verbose=Verbose +healthypi4.menu.DebugLevel.verbose.build.code_debug=5 diff --git a/cores/esp32/Arduino.h b/cores/esp32/Arduino.h index 645b407034f..bc028e11b1b 100644 --- a/cores/esp32/Arduino.h +++ b/cores/esp32/Arduino.h @@ -78,7 +78,7 @@ #define interrupts() sei() #define noInterrupts() cli() -#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L ) +#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() ) #define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() ) #define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() ) diff --git a/cores/esp32/Esp.cpp b/cores/esp32/Esp.cpp index 54451127ef3..b44b85c97f0 100644 --- a/cores/esp32/Esp.cpp +++ b/cores/esp32/Esp.cpp @@ -218,6 +218,33 @@ uint8_t EspClass::getChipRevision(void) return chip_info.revision; } +const char * EspClass::getChipModel(void) +{ + uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG); + uint32_t pkg_ver = chip_ver & 0x7; + switch (pkg_ver) { + case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ6 : + return "ESP32-D0WDQ6"; + case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ5 : + return "ESP32-D0WDQ5"; + case EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 : + return "ESP32-D2WDQ5"; + case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 : + return "ESP32-PICO-D2"; + case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 : + return "ESP32-PICO-D4"; + default: + return "Unknown"; + } +} + +uint8_t EspClass::getChipCores(void) +{ + esp_chip_info_t chip_info; + esp_chip_info(&chip_info); + return chip_info.cores; +} + const char * EspClass::getSdkVersion(void) { return esp_get_idf_version(); @@ -309,6 +336,20 @@ bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size) return spi_flash_read(offset, (uint32_t*) data, size) == ESP_OK; } +bool EspClass::partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size) +{ + return esp_partition_erase_range(partition, offset, size) == ESP_OK; +} + +bool EspClass::partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size) +{ + return esp_partition_write(partition, offset, data, size) == ESP_OK; +} + +bool EspClass::partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size) +{ + return esp_partition_read(partition, offset, data, size) == ESP_OK; +} uint64_t EspClass::getEfuseMac(void) { diff --git a/cores/esp32/Esp.h b/cores/esp32/Esp.h index 2580eecf65b..76baadd72da 100644 --- a/cores/esp32/Esp.h +++ b/cores/esp32/Esp.h @@ -21,6 +21,7 @@ #define ESP_H #include +#include /** * AVR macros for WDT managment @@ -75,6 +76,8 @@ class EspClass uint32_t getMaxAllocPsram(); uint8_t getChipRevision(); + const char * getChipModel(); + uint8_t getChipCores(); uint32_t getCpuFreqMHz(){ return getCpuFrequencyMhz(); } inline uint32_t getCycleCount() __attribute__((always_inline)); const char * getSdkVersion(); @@ -97,6 +100,10 @@ class EspClass bool flashWrite(uint32_t offset, uint32_t *data, size_t size); bool flashRead(uint32_t offset, uint32_t *data, size_t size); + bool partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size); + bool partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size); + bool partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size); + uint64_t getEfuseMac(); }; diff --git a/cores/esp32/HardwareSerial.cpp b/cores/esp32/HardwareSerial.cpp index be80ca27d1d..b06e0735a71 100644 --- a/cores/esp32/HardwareSerial.cpp +++ b/cores/esp32/HardwareSerial.cpp @@ -53,6 +53,8 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in } _uart = uartBegin(_uart_nr, baud ? baud : 9600, config, rxPin, txPin, 256, invert); + _tx_pin = txPin; + _rx_pin = rxPin; if(!baud) { uartStartDetectBaudrate(_uart); @@ -70,6 +72,8 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in } else { log_e("Could not detect baudrate. Serial data at the port must be present within the timeout for detection to be possible"); _uart = NULL; + _tx_pin = 255; + _rx_pin = 255; } } } @@ -84,7 +88,8 @@ void HardwareSerial::end() if(uartGetDebug() == _uart_nr) { uartSetDebug(0); } - uartEnd(_uart); + log_v("pins %d %d",_tx_pin, _rx_pin); + uartEnd(_uart, _tx_pin, _rx_pin); _uart = 0; } @@ -179,3 +184,8 @@ HardwareSerial::operator bool() const { return true; } + +void HardwareSerial::setRxInvert(bool invert) +{ + uartSetRxInvert(_uart, invert); +} diff --git a/cores/esp32/HardwareSerial.h b/cores/esp32/HardwareSerial.h index 820476748da..e776e939d0b 100644 --- a/cores/esp32/HardwareSerial.h +++ b/cores/esp32/HardwareSerial.h @@ -100,10 +100,14 @@ class HardwareSerial: public Stream size_t setRxBufferSize(size_t); void setDebugOutput(bool); + + void setRxInvert(bool); protected: int _uart_nr; uart_t* _uart; + uint8_t _tx_pin; + uint8_t _rx_pin; }; extern void serialEventRun(void) __attribute__((weak)); diff --git a/cores/esp32/Print.cpp b/cores/esp32/Print.cpp index 60964703306..3636d99e658 100644 --- a/cores/esp32/Print.cpp +++ b/cores/esp32/Print.cpp @@ -110,24 +110,37 @@ size_t Print::print(unsigned int n, int base) } size_t Print::print(long n, int base) +{ + int t = 0; + if (base == 10 && n < 0) { + t = print('-'); + n = -n; + } + return printNumber(static_cast(n), base) + t; +} + +size_t Print::print(unsigned long n, int base) { if(base == 0) { return write(n); - } else if(base == 10) { - if(n < 0) { - int t = print('-'); - n = -n; - return printNumber(n, 10) + t; - } - return printNumber(n, 10); } else { return printNumber(n, base); } } -size_t Print::print(unsigned long n, int base) +size_t Print::print(long long n, int base) { - if(base == 0) { + int t = 0; + if (base == 10 && n < 0) { + t = print('-'); + n = -n; + } + return printNumber(static_cast(n), base) + t; +} + +size_t Print::print(unsigned long long n, int base) +{ + if (base == 0) { return write(n); } else { return printNumber(n, base); @@ -226,6 +239,20 @@ size_t Print::println(unsigned long num, int base) return n; } +size_t Print::println(long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + size_t Print::println(double num, int digits) { size_t n = print(num, digits); @@ -251,7 +278,7 @@ size_t Print::println(struct tm * timeinfo, const char * format) size_t Print::printNumber(unsigned long n, uint8_t base) { - char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char buf[8 * sizeof(n) + 1]; // Assumes 8-bit chars plus zero byte. char *str = &buf[sizeof(buf) - 1]; *str = '\0'; @@ -262,11 +289,34 @@ size_t Print::printNumber(unsigned long n, uint8_t base) } do { - unsigned long m = n; + char c = n % base; + n /= base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); + + return write(str); +} + +size_t Print::printNumber(unsigned long long n, uint8_t base) +{ + char buf[8 * sizeof(n) + 1]; // Assumes 8-bit chars plus zero byte. + char* str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) { + base = 10; + } + + do { + auto m = n; n /= base; char c = m - base * n; + *--str = c < 10 ? c + '0' : c + 'A' - 10; - } while(n); + } while (n); return write(str); } diff --git a/cores/esp32/Print.h b/cores/esp32/Print.h index eb2958584d9..15d07357ae9 100644 --- a/cores/esp32/Print.h +++ b/cores/esp32/Print.h @@ -36,6 +36,7 @@ class Print private: int write_error; size_t printNumber(unsigned long, uint8_t); + size_t printNumber(unsigned long long, uint8_t); size_t printFloat(double, uint8_t); protected: void setWriteError(int err = 1) @@ -81,6 +82,8 @@ class Print size_t print(unsigned int, int = DEC); size_t print(long, int = DEC); size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); size_t print(double, int = 2); size_t print(const Printable&); size_t print(struct tm * timeinfo, const char * format = NULL); @@ -94,6 +97,8 @@ class Print size_t println(unsigned int, int = DEC); size_t println(long, int = DEC); size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); size_t println(double, int = 2); size_t println(const Printable&); size_t println(struct tm * timeinfo, const char * format = NULL); diff --git a/cores/esp32/Stream.cpp b/cores/esp32/Stream.cpp index 5c090791968..7d1649a6fb5 100644 --- a/cores/esp32/Stream.cpp +++ b/cores/esp32/Stream.cpp @@ -87,22 +87,22 @@ unsigned long Stream::getTimeout(void) { } // find returns true if the target string is found -bool Stream::find(const char *target) +bool Stream::find(const char *target) { - return findUntil(target, (char*) ""); + return findUntil(target, strlen(target), NULL, 0); } // reads data from the stream until the target string of given length is found // returns true if target string is found, false if timed out bool Stream::find(const char *target, size_t length) { - return findUntil(target, length, NULL, 0); + return findUntil(target, length, NULL, 0); } // as find but search ends if the terminator string is found -bool Stream::findUntil(const char *target, const char *terminator) +bool Stream::findUntil(const char *target, const char *terminator) { - return findUntil(target, strlen(target), terminator, strlen(terminator)); + return findUntil(target, strlen(target), terminator, strlen(terminator)); } // reads data from the stream until the target string of the given length is found @@ -110,35 +110,78 @@ bool Stream::findUntil(const char *target, const char *terminator) // returns true if target string is found, false if terminated or timed out bool Stream::findUntil(const char *target, size_t targetLen, const char *terminator, size_t termLen) { - size_t index = 0; // maximum target string length is 64k bytes! - size_t termIndex = 0; - int c; + if (terminator == NULL) { + MultiTarget t[1] = {{target, targetLen, 0}}; + return findMulti(t, 1) == 0 ? true : false; + } else { + MultiTarget t[2] = {{target, targetLen, 0}, {terminator, termLen, 0}}; + return findMulti(t, 2) == 0 ? true : false; + } +} - if(*target == 0) { - return true; // return true if target is a null string - } - while((c = timedRead()) > 0) { +int Stream::findMulti( struct Stream::MultiTarget *targets, int tCount) { + // any zero length target string automatically matches and would make + // a mess of the rest of the algorithm. + for (struct MultiTarget *t = targets; t < targets+tCount; ++t) { + if (t->len <= 0) + return t - targets; + } - if(c != target[index]) { - index = 0; // reset index if any char does not match + while (1) { + int c = timedRead(); + if (c < 0) + return -1; + + for (struct MultiTarget *t = targets; t < targets+tCount; ++t) { + // the simple case is if we match, deal with that first. + if (c == t->str[t->index]) { + if (++t->index == t->len) + return t - targets; + else + continue; + } + + // if not we need to walk back and see if we could have matched further + // down the stream (ie '1112' doesn't match the first position in '11112' + // but it will match the second position so we can't just reset the current + // index to 0 when we find a mismatch. + if (t->index == 0) + continue; + + int origIndex = t->index; + do { + --t->index; + // first check if current char works against the new current index + if (c != t->str[t->index]) + continue; + + // if it's the only char then we're good, nothing more to check + if (t->index == 0) { + t->index++; + break; } - if(c == target[index]) { - //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); - if(++index >= targetLen) { // return true if all chars in the target match - return true; - } + // otherwise we need to check the rest of the found string + int diff = origIndex - t->index; + size_t i; + for (i = 0; i < t->index; ++i) { + if (t->str[i] != t->str[i + diff]) + break; } - if(termLen > 0 && c == terminator[termIndex]) { - if(++termIndex >= termLen) { - return false; // return false if terminate string found before target string - } - } else { - termIndex = 0; + // if we successfully got through the previous loop then our current + // index is good. + if (i == t->index) { + t->index++; + break; } + + // otherwise we just try the next index + } while (t->index); } - return false; + } + // unreachable + return -1; } // returns the first valid (long) integer value from the current position. diff --git a/cores/esp32/Stream.h b/cores/esp32/Stream.h index 4ce31955acd..2debee7e4f9 100644 --- a/cores/esp32/Stream.h +++ b/cores/esp32/Stream.h @@ -60,6 +60,7 @@ class Stream: public Print void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second unsigned long getTimeout(void); + bool find(const char *target); // reads data from the stream until the target string is found bool find(uint8_t *target) { @@ -123,6 +124,17 @@ class Stream: public Print // this allows format characters (typically commas) in values to be ignored float parseFloat(char skipChar); // as above but the given skipChar is ignored + + struct MultiTarget { + const char *str; // string you're searching for + size_t len; // length of string you're searching for + size_t index; // index used by the search routine. + }; + + // This allows you to search for an arbitrary number of strings. + // Returns index of the target that is found first or -1 if timeout occurs. + int findMulti(struct MultiTarget *targets, int tCount); + }; #endif diff --git a/cores/esp32/Udp.h b/cores/esp32/Udp.h index f47f83cc8e0..fd79975eb0a 100644 --- a/cores/esp32/Udp.h +++ b/cores/esp32/Udp.h @@ -43,6 +43,7 @@ class UDP: public Stream public: virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + virtual uint8_t beginMulticast(IPAddress, uint16_t) { return 0; } // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure virtual void stop() =0; // Finish with the UDP socket // Sending UDP packets diff --git a/cores/esp32/WMath.cpp b/cores/esp32/WMath.cpp index abec110b04c..d351b194e23 100644 --- a/cores/esp32/WMath.cpp +++ b/cores/esp32/WMath.cpp @@ -44,7 +44,7 @@ long random(long howbig) uint32_t t = -howbig; if (t >= howbig) { t -= howbig; - if (t >= howbig) + if (t >= howbig) t %= howbig; } while (l < t) { @@ -66,11 +66,11 @@ long random(long howsmall, long howbig) } long map(long x, long in_min, long in_max, long out_min, long out_max) { - long divisor = (in_max - in_min); - if(divisor == 0){ - return -1; //AVR returns -1, SAM returns 0 - } - return (x - in_min) * (out_max - out_min) / divisor + out_min; + const long dividend = out_max - out_min; + const long divisor = in_max - in_min; + const long delta = x - in_min; + + return (delta * dividend + (divisor / 2)) / divisor + out_min; } unsigned int makeWord(unsigned int w) diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index d85919cfdb3..d50ce4cc029 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -945,6 +945,14 @@ static void IRAM_ATTR i2c_isr_handler_default(void* arg) activeInt &=~I2C_RXFIFO_FULL_INT_ST; } + if(activeInt & I2C_RXFIFO_OVF_INT_ST) { + emptyRxFifo(p_i2c); + p_i2c->dev->int_clr.rx_fifo_full=1; + p_i2c->dev->int_ena.rx_fifo_full=1; //why? + + activeInt &=~I2C_RXFIFO_OVF_INT_ST; + } + if (activeInt & I2C_ACK_ERR_INT_ST_M) {//fatal error, abort i2c service if (p_i2c->mode == I2C_MASTER) { i2c_update_error_byte_cnt(p_i2c); // calc which byte caused ack Error, check if address or data diff --git a/cores/esp32/esp32-hal-rmt.c b/cores/esp32/esp32-hal-rmt.c index 2a36a5e742e..07750d96bba 100644 --- a/cores/esp32/esp32-hal-rmt.c +++ b/cores/esp32/esp32-hal-rmt.c @@ -94,6 +94,7 @@ struct rmt_obj_s transaction_state_t tx_state; rmt_rx_data_cb_t cb; bool data_alloc; + void * arg; }; /** @@ -104,14 +105,14 @@ static xSemaphoreHandle g_rmt_objlocks[MAX_CHANNELS] = { }; static rmt_obj_t g_rmt_objects[MAX_CHANNELS] = { - { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false}, - { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false}, - { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false}, - { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false}, - { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false}, - { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false}, - { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false}, - { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false}, + { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false, NULL}, + { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false, NULL}, + { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false, NULL}, + { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false, NULL}, + { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false, NULL}, + { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false, NULL}, + { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false, NULL}, + { false, NULL, 0, 0, 0, 0, 0, NULL, E_NO_INTR, E_INACTIVE, NULL, false, NULL}, }; /** @@ -324,6 +325,7 @@ bool rmtReadData(rmt_obj_t* rmt, uint32_t* data, size_t size) return true; } + bool rmtBeginReceive(rmt_obj_t* rmt) { if (!rmt) { @@ -357,7 +359,7 @@ bool rmtReceiveCompleted(rmt_obj_t* rmt) } } -bool rmtRead(rmt_obj_t* rmt, rmt_rx_data_cb_t cb) +bool rmtRead(rmt_obj_t* rmt, rmt_rx_data_cb_t cb, void * arg) { if (!rmt && !cb) { return false; @@ -365,6 +367,7 @@ bool rmtRead(rmt_obj_t* rmt, rmt_rx_data_cb_t cb) int channel = rmt->channel; RMT_MUTEX_LOCK(channel); + rmt->arg = arg; rmt->intr_mode = E_RX_INTR; rmt->tx_state = E_FIRST_HALF; rmt->cb = cb; @@ -391,6 +394,19 @@ bool rmtRead(rmt_obj_t* rmt, rmt_rx_data_cb_t cb) return true; } +bool rmtEnd(rmt_obj_t* rmt) { + if (!rmt) { + return false; + } + int channel = rmt->channel; + + RMT_MUTEX_LOCK(channel); + RMT.conf_ch[channel].conf1.rx_en = 1; + RMT_MUTEX_UNLOCK(channel); + + return true; +} + bool rmtReadAsync(rmt_obj_t* rmt, rmt_data_t* data, size_t size, void* eventFlag, bool waitForData, uint32_t timeout) { if (!rmt) { @@ -523,6 +539,8 @@ rmt_obj_t* rmtInit(int pin, bool tx_not_rx, rmt_reserve_memsize_t memsize) rmt->tx_not_rx = tx_not_rx; rmt->buffers =buffers; rmt->channel = channel; + rmt->arg = NULL; + _initPin(pin, channel, tx_not_rx); // Initialize the registers in default mode: @@ -544,6 +562,7 @@ rmt_obj_t* rmtInit(int pin, bool tx_not_rx, rmt_reserve_memsize_t memsize) RMT.conf_ch[channel].conf1.idle_out_lv = 0; // signal level for idle RMT.conf_ch[channel].conf1.idle_out_en = 1; // enable idle RMT.conf_ch[channel].conf1.ref_always_on = 0; // base clock + RMT.apb_conf.fifo_mask = 1; if (tx_not_rx) { @@ -659,7 +678,7 @@ static void IRAM_ATTR _rmt_isr(void* arg) } if (g_rmt_objects[ch].cb) { // actually received data ptr - (g_rmt_objects[ch].cb)(data_received, _rmt_get_mem_len(ch)); + (g_rmt_objects[ch].cb)(data_received, _rmt_get_mem_len(ch), g_rmt_objects[ch].arg); // restart the reception RMT.conf_ch[ch].conf1.mem_owner = 1; diff --git a/cores/esp32/esp32-hal-rmt.h b/cores/esp32/esp32-hal-rmt.h index ff6da396e5d..cce6c8c8107 100644 --- a/cores/esp32/esp32-hal-rmt.h +++ b/cores/esp32/esp32-hal-rmt.h @@ -40,7 +40,7 @@ typedef enum { typedef struct rmt_obj_s rmt_obj_t; -typedef void (*rmt_rx_data_cb_t)(uint32_t *data, size_t len); +typedef void (*rmt_rx_data_cb_t)(uint32_t *data, size_t len, void *arg); typedef struct { union { @@ -90,8 +90,13 @@ bool rmtReadAsync(rmt_obj_t* rmt, rmt_data_t* data, size_t size, void* eventFlag * and callback with data from ISR * */ -bool rmtRead(rmt_obj_t* rmt, rmt_rx_data_cb_t cb); +bool rmtRead(rmt_obj_t* rmt, rmt_rx_data_cb_t cb, void * arg); +/*** + * Ends async receive started with rmtRead(); but does not + * rmtDeInit(). + */ +bool rmtEnd(rmt_obj_t* rmt); /* Additional interface */ diff --git a/cores/esp32/esp32-hal-spi.h b/cores/esp32/esp32-hal-spi.h index 1317f38b239..65d56b2e018 100644 --- a/cores/esp32/esp32-hal-spi.h +++ b/cores/esp32/esp32-hal-spi.h @@ -54,7 +54,7 @@ extern "C" { struct spi_struct_t; typedef struct spi_struct_t spi_t; -spi_t * spiStartBus(uint8_t spi_num, uint32_t freq, uint8_t dataMode, uint8_t bitOrder); +spi_t * spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_t bitOrder); void spiStopBus(spi_t * spi); //Attach/Detach Signal Pins diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 26652846475..7ee23b95c95 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -124,21 +124,21 @@ void uartDisableInterrupt(uart_t* uart) UART_MUTEX_UNLOCK(); } -void uartDetachRx(uart_t* uart) +void uartDetachRx(uart_t* uart, uint8_t rxPin) { if(uart == NULL) { return; } - pinMatrixInDetach(UART_RXD_IDX(uart->num), false, false); + pinMatrixInDetach(rxPin, false, false); uartDisableInterrupt(uart); } -void uartDetachTx(uart_t* uart) +void uartDetachTx(uart_t* uart, uint8_t txPin) { if(uart == NULL) { return; } - pinMatrixOutDetach(UART_TXD_IDX(uart->num), false, false); + pinMatrixOutDetach(txPin, false, false); } void uartAttachRx(uart_t* uart, uint8_t rxPin, bool inverted) @@ -226,7 +226,7 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx return uart; } -void uartEnd(uart_t* uart) +void uartEnd(uart_t* uart, uint8_t txPin, uint8_t rxPin) { if(uart == NULL) { return; @@ -243,8 +243,8 @@ void uartEnd(uart_t* uart) UART_MUTEX_UNLOCK(); - uartDetachRx(uart); - uartDetachTx(uart); + uartDetachRx(uart, rxPin); + uartDetachTx(uart, txPin); } size_t uartResizeRxBuffer(uart_t * uart, size_t new_size) { @@ -257,6 +257,7 @@ size_t uartResizeRxBuffer(uart_t * uart, size_t new_size) { vQueueDelete(uart->queue); uart->queue = xQueueCreate(new_size, sizeof(uint8_t)); if(uart->queue == NULL) { + UART_MUTEX_UNLOCK(); return NULL; } } @@ -265,6 +266,17 @@ size_t uartResizeRxBuffer(uart_t * uart, size_t new_size) { return new_size; } +void uartSetRxInvert(uart_t* uart, bool invert) +{ + if (uart == NULL) + return; + + if (invert) + uart->dev->conf0.rxd_inv = 1; + else + uart->dev->conf0.rxd_inv = 0; +} + uint32_t uartAvailable(uart_t* uart) { if(uart == NULL || uart->queue == NULL) { @@ -359,7 +371,7 @@ void uartWriteBuf(uart_t* uart, const uint8_t * data, size_t len) void uartFlush(uart_t* uart) { - uartFlushTxOnly(uart,false); + uartFlushTxOnly(uart,true); } void uartFlushTxOnly(uart_t* uart, bool txOnly) diff --git a/cores/esp32/esp32-hal-uart.h b/cores/esp32/esp32-hal-uart.h index e44d25bbc5e..e35f05d4cff 100644 --- a/cores/esp32/esp32-hal-uart.h +++ b/cores/esp32/esp32-hal-uart.h @@ -52,7 +52,7 @@ struct uart_struct_t; typedef struct uart_struct_t uart_t; uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t queueLen, bool inverted); -void uartEnd(uart_t* uart); +void uartEnd(uart_t* uart, uint8_t rxPin, uint8_t txPin); uint32_t uartAvailable(uart_t* uart); uint32_t uartAvailableForWrite(uart_t* uart); @@ -70,6 +70,8 @@ uint32_t uartGetBaudRate(uart_t* uart); size_t uartResizeRxBuffer(uart_t* uart, size_t new_size); +void uartSetRxInvert(uart_t* uart, bool invert); + void uartSetDebug(uart_t* uart); int uartGetDebug(); diff --git a/cores/esp32/wiring_shift.c b/cores/esp32/wiring_shift.c index c6c279aa8a3..41cf8a0fa5b 100644 --- a/cores/esp32/wiring_shift.c +++ b/cores/esp32/wiring_shift.c @@ -16,7 +16,7 @@ Boston, MA 02111-1307 USA $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ */ - + #include "esp32-hal.h" #include "wiring_private.h" diff --git a/docs/ISSUE_TEMPLATE.md b/docs/ISSUE_TEMPLATE.md index 55f00770c68..5cf96ef213b 100644 --- a/docs/ISSUE_TEMPLATE.md +++ b/docs/ISSUE_TEMPLATE.md @@ -1,26 +1,28 @@ Make your question, not a Statement, inclusive. Include all pertinent information: -What you are trying to do. -Describe your system( Hardware, computer, O/S, core version, environment) -Describe what is failing -Show the shortest possible code that will duplicate the error -Show the EXACT error message(it doesn't work is not enough) +What you are trying to do +Describe your system (Hardware, computer, O/S, core version, environment) +Describe what is failing +Show the shortest possible code that will duplicate the error +Show the EXACT error message (it doesn't work is not enough) Then if someone is interested and knowledgeable you might get a answer. All of this work on your part shows us that you have worked to solve YOUR problem. The more complete your issue posting is, the more likely someone will volunteer their time to help you. If you have a Guru Meditation Error or Backtrace, ***please decode it***: -https://github.com/me-no-dev/EspExceptionDecoder +[ExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecoder) ----------------------------- Remove above ----------------------------- ### Hardware: -Board: ?ESP32 Dev Module? ?node32? ?ttgo_lora? -Core Installation/update date: ?11/jul/2017? -IDE name: ?Arduino IDE? ?Platform.io? ?IDF component? -Flash Frequency: ?40Mhz? -PSRAM enabled: ?no? -Upload Speed: ?115200? -Computer OS: ?Windows 10? ?Mac OSX? ?Ubuntu? +||||||| +|:---|---|---|---|---|---| +|Board|ESP32 Dev Module|node32|ttgo_lora|ESP32-S2-Saola|Custom w/ ESP32-S2-WROVER 16MB| +|Version/Date|1.0.4|2.0.0|0badbeef|11/jul/2017|today's master| +|IDE name|Arduino IDE|Atom + Platform.io|IDF component|VSCode| +|Flash Frequency|40Mhz|80Mhz| +|PSRAM enabled|yes|no| +|Upload Speed|115200| +|Computer OS|Windows 10|Mac OSX|Ubuntu| ### Description: Describe your problem here diff --git a/docs/arduino-ide/boards_manager.md b/docs/arduino-ide/boards_manager.md index 59428b9c3eb..c689314fb4c 100644 --- a/docs/arduino-ide/boards_manager.md +++ b/docs/arduino-ide/boards_manager.md @@ -4,7 +4,7 @@ - Stable release link: `https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json` - Development release link: `https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json` -Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32, 64 bit and ARM). +Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (x86, amd64, armhf and arm64). - Install the current upstream Arduino IDE at the 1.8 level or later. The current version is at the [Arduino website](http://www.arduino.cc/en/main/software). - Start Arduino and open Preferences window. diff --git a/docs/arduino-ide/mac.md b/docs/arduino-ide/mac.md index 9807cc7df2d..18553530067 100644 --- a/docs/arduino-ide/mac.md +++ b/docs/arduino-ide/mac.md @@ -7,9 +7,9 @@ Installation instructions for Mac OS ```bash mkdir -p ~/Documents/Arduino/hardware/espressif && \ cd ~/Documents/Arduino/hardware/espressif && \ - git clone https://github.com/espressif/arduino-esp32.git esp32 && \ + git clone https://github.com/espressif/arduino-esp32.git esp32 --depth 1 && \ cd esp32 && \ - git submodule update --init --recursive && \ + git submodule update --init --recursive --depth 1 && \ cd tools && \ python get.py ``` diff --git a/docs/esp-idf_component.md b/docs/esp-idf_component.md index 4e29b1acb2a..7fd4225d83c 100644 --- a/docs/esp-idf_component.md +++ b/docs/esp-idf_component.md @@ -72,6 +72,11 @@ If you are writing code that does not require Arduino to compile and you want yo #endif ``` +## FreeRTOS Tick Rate (Hz) + +You might notice that Arduino-esp32's `delay()` function will only work in multiples of 10ms. That is because, by default, esp-idf handles task events 100 times per second. +To fix that behavior you need to set FreeRTOS tick rate to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`. + ## Compilation Errors As commits are made to esp-idf and submodules, the codebases can develop incompatibilities which cause compilation errors. If you have problems compiling, follow the instructions in [Issue #1142](https://github.com/espressif/arduino-esp32/issues/1142) to roll esp-idf back to a known good version. diff --git a/libraries/ArduinoOTA/examples/OTAWebUpdater/OTAWebUpdater.ino b/libraries/ArduinoOTA/examples/OTAWebUpdater/OTAWebUpdater.ino index ed93c59f975..4c4adc7fe87 100644 --- a/libraries/ArduinoOTA/examples/OTAWebUpdater/OTAWebUpdater.ino +++ b/libraries/ArduinoOTA/examples/OTAWebUpdater/OTAWebUpdater.ino @@ -14,7 +14,7 @@ WebServer server(80); * Login page */ -const char* loginIndex = +const char* loginIndex = "
" "" "" @@ -25,8 +25,9 @@ const char* loginIndex = "
" "
" "" - "" - "" + "" + "" + "" "" "
" "
" @@ -54,12 +55,12 @@ const char* loginIndex = "}" "}" ""; - + /* * Server Index Page */ - -const char* serverIndex = + +const char* serverIndex = "" "" "" @@ -88,7 +89,7 @@ const char* serverIndex = "return xhr;" "}," "success:function(d, s) {" - "console.log('success!')" + "console.log('success!')" "}," "error: function (a, b, c) {" "}" diff --git a/libraries/ArduinoOTA/src/ArduinoOTA.cpp b/libraries/ArduinoOTA/src/ArduinoOTA.cpp index 884c9d341c1..fe85580f566 100644 --- a/libraries/ArduinoOTA/src/ArduinoOTA.cpp +++ b/libraries/ArduinoOTA/src/ArduinoOTA.cpp @@ -88,6 +88,17 @@ ArduinoOTAClass& ArduinoOTAClass::setPasswordHash(const char * password) { return *this; } +ArduinoOTAClass& ArduinoOTAClass::setPartitionLabel(const char * partition_label) { + if (!_initialized && !_partition_label.length() && partition_label) { + _partition_label = partition_label; + } + return *this; +} + +String ArduinoOTAClass::getPartitionLabel() { + return _partition_label; +} + ArduinoOTAClass& ArduinoOTAClass::setRebootOnSuccess(bool reboot){ _rebootOnSuccess = reboot; return *this; @@ -235,7 +246,8 @@ void ArduinoOTAClass::_onRx(){ } void ArduinoOTAClass::_runUpdate() { - if (!Update.begin(_size, _cmd)) { + const char *partition_label = _partition_label.length() ? _partition_label.c_str() : NULL; + if (!Update.begin(_size, _cmd, -1, LOW, partition_label)) { log_e("Begin ERROR: %s", Update.errorString()); @@ -358,7 +370,7 @@ void ArduinoOTAClass::end() { void ArduinoOTAClass::handle() { if (!_initialized) { - return; + return; } if (_state == OTA_RUNUPDATE) { _runUpdate(); diff --git a/libraries/ArduinoOTA/src/ArduinoOTA.h b/libraries/ArduinoOTA/src/ArduinoOTA.h index db0ead631db..cd0ba05f547 100644 --- a/libraries/ArduinoOTA/src/ArduinoOTA.h +++ b/libraries/ArduinoOTA/src/ArduinoOTA.h @@ -44,6 +44,10 @@ class ArduinoOTAClass //Sets the password as above but in the form MD5(password). Default NULL ArduinoOTAClass& setPasswordHash(const char *password); + //Sets the partition label to write to when updating SPIFFS. Default NULL + ArduinoOTAClass &setPartitionLabel(const char *partition_label); + String getPartitionLabel(); + //Sets if the device should be rebooted after successful update. Default true ArduinoOTAClass& setRebootOnSuccess(bool reboot); @@ -80,6 +84,7 @@ class ArduinoOTAClass int _port; String _password; String _hostname; + String _partition_label; String _nonce; WiFiUDP _udp_ota; bool _initialized; diff --git a/libraries/AsyncUDP/src/AsyncUDP.cpp b/libraries/AsyncUDP/src/AsyncUDP.cpp index 762529b9e0f..ea2fc04e744 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.cpp +++ b/libraries/AsyncUDP/src/AsyncUDP.cpp @@ -150,7 +150,7 @@ static bool _udp_task_start(){ } } if(!_udp_task_handle){ - xTaskCreateUniversal(_udp_task, "async_udp", 4096, NULL, 3, (TaskHandle_t*)&_udp_task_handle, CONFIG_ARDUINO_UDP_RUNNING_CORE); + xTaskCreateUniversal(_udp_task, "async_udp", 4096, NULL, CONFIG_ARDUINO_UDP_TASK_PRIORITY, (TaskHandle_t*)&_udp_task_handle, CONFIG_ARDUINO_UDP_RUNNING_CORE); if(!_udp_task_handle){ return false; } diff --git a/libraries/AzureIoT b/libraries/AzureIoT index 67dfa4f31ef..5e8ffb21115 160000 --- a/libraries/AzureIoT +++ b/libraries/AzureIoT @@ -1 +1 @@ -Subproject commit 67dfa4f31ef88b0938dd87d955612100dea5562e +Subproject commit 5e8ffb21115675f8c258e81bb287a9cd610e3205 diff --git a/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.ino b/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.ino new file mode 100644 index 00000000000..b46baa7c84e --- /dev/null +++ b/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.ino @@ -0,0 +1,153 @@ +/* + Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp + Ported to Arduino ESP32 by Evandro Copercini + Changed to a beacon scanner to report iBeacon, EddystoneURL and EddystoneTLM beacons by beegee-tokyo +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8)) + +int scanTime = 5; //In seconds +BLEScan *pBLEScan; + +class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks +{ + void onResult(BLEAdvertisedDevice advertisedDevice) + { + if (advertisedDevice.haveName()) + { + Serial.print("Device name: "); + Serial.println(advertisedDevice.getName().c_str()); + Serial.println(""); + } + + if (advertisedDevice.haveServiceUUID()) + { + BLEUUID devUUID = advertisedDevice.getServiceUUID(); + Serial.print("Found ServiceUUID: "); + Serial.println(devUUID.toString().c_str()); + Serial.println(""); + } + else + { + if (advertisedDevice.haveManufacturerData() == true) + { + std::string strManufacturerData = advertisedDevice.getManufacturerData(); + + uint8_t cManufacturerData[100]; + strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); + + if (strManufacturerData.length() == 25 && cManufacturerData[0] == 0x4C && cManufacturerData[1] == 0x00) + { + Serial.println("Found an iBeacon!"); + BLEBeacon oBeacon = BLEBeacon(); + oBeacon.setData(strManufacturerData); + Serial.printf("iBeacon Frame\n"); + Serial.printf("ID: %04X Major: %d Minor: %d UUID: %s Power: %d\n", oBeacon.getManufacturerId(), ENDIAN_CHANGE_U16(oBeacon.getMajor()), ENDIAN_CHANGE_U16(oBeacon.getMinor()), oBeacon.getProximityUUID().toString().c_str(), oBeacon.getSignalPower()); + } + else + { + Serial.println("Found another manufacturers beacon!"); + Serial.printf("strManufacturerData: %d ", strManufacturerData.length()); + for (int i = 0; i < strManufacturerData.length(); i++) + { + Serial.printf("[%X]", cManufacturerData[i]); + } + Serial.printf("\n"); + } + } + return; + } + + uint8_t *payLoad = advertisedDevice.getPayload(); + + BLEUUID checkUrlUUID = (uint16_t)0xfeaa; + + if (advertisedDevice.getServiceUUID().equals(checkUrlUUID)) + { + if (payLoad[11] == 0x10) + { + Serial.println("Found an EddystoneURL beacon!"); + BLEEddystoneURL foundEddyURL = BLEEddystoneURL(); + std::string eddyContent((char *)&payLoad[11]); // incomplete EddystoneURL struct! + + foundEddyURL.setData(eddyContent); + std::string bareURL = foundEddyURL.getURL(); + if (bareURL[0] == 0x00) + { + size_t payLoadLen = advertisedDevice.getPayloadLength(); + Serial.println("DATA-->"); + for (int idx = 0; idx < payLoadLen; idx++) + { + Serial.printf("0x%08X ", payLoad[idx]); + } + Serial.println("\nInvalid Data"); + return; + } + + Serial.printf("Found URL: %s\n", foundEddyURL.getURL().c_str()); + Serial.printf("Decoded URL: %s\n", foundEddyURL.getDecodedURL().c_str()); + Serial.printf("TX power %d\n", foundEddyURL.getPower()); + Serial.println("\n"); + } + else if (payLoad[11] == 0x20) + { + Serial.println("Found an EddystoneTLM beacon!"); + BLEEddystoneTLM foundEddyURL = BLEEddystoneTLM(); + std::string eddyContent((char *)&payLoad[11]); // incomplete EddystoneURL struct! + + eddyContent = "01234567890123"; + + for (int idx = 0; idx < 14; idx++) + { + eddyContent[idx] = payLoad[idx + 11]; + } + + foundEddyURL.setData(eddyContent); + Serial.printf("Reported battery voltage: %dmV\n", foundEddyURL.getVolt()); + Serial.printf("Reported temperature from TLM class: %.2fC\n", (double)foundEddyURL.getTemp()); + 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.println("\n"); + Serial.print(foundEddyURL.toString().c_str()); + Serial.println("\n"); + } + } + } +}; + +void setup() +{ + Serial.begin(115200); + Serial.println("Scanning..."); + + BLEDevice::init(""); + pBLEScan = BLEDevice::getScan(); //create new scan + pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); + pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster + pBLEScan->setInterval(100); + pBLEScan->setWindow(99); // less or equal setInterval value +} + +void loop() +{ + // put your main code here, to run repeatedly: + BLEScanResults foundDevices = pBLEScan->start(scanTime, false); + Serial.print("Devices found: "); + Serial.println(foundDevices.getCount()); + Serial.println("Scan done!"); + pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory + delay(2000); +} diff --git a/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.md b/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.md new file mode 100644 index 00000000000..558c3e7aec0 --- /dev/null +++ b/libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.md @@ -0,0 +1,9 @@ +## BLE Beacon Scanner + +Initiates a BLE device scan. +Checks if the discovered devices are +- an iBeacon +- an Eddystone TLM beacon +- an Eddystone URL beacon + +and sends the decoded beacon information over Serial log \ No newline at end of file diff --git a/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.ino b/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.ino new file mode 100644 index 00000000000..96be28cd588 --- /dev/null +++ b/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.ino @@ -0,0 +1,116 @@ +/* + EddystoneTLM beacon by BeeGee based on https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_Eddystone_TLM_deepsleep/ESP32_Eddystone_TLM_deepsleep.ino + EddystoneTLM frame specification https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md +*/ + +/* + Create a BLE server that will send periodic Eddystone URL frames. + The design of creating the BLE server is: + 1. Create a BLE Server + 2. Create advertising data + 3. Start advertising. + 4. wait + 5. Stop advertising. + 6. deep sleep + +*/ +#include "sys/time.h" + +#include + +#include "BLEDevice.h" +#include "BLEUtils.h" +#include "BLEBeacon.h" +#include "BLEAdvertising.h" +#include "BLEEddystoneURL.h" + +#include "esp_sleep.h" + +#define GPIO_DEEP_SLEEP_DURATION 10 // sleep x seconds and then wake up +RTC_DATA_ATTR static time_t last; // remember last boot in RTC Memory +RTC_DATA_ATTR static uint32_t bootcount; // remember number of boots in RTC Memory + +// See the following for generating UUIDs: +// https://www.uuidgenerator.net/ +BLEAdvertising *pAdvertising; +struct timeval nowTimeStruct; + +time_t lastTenth; + +#define BEACON_UUID "8ec76ea3-6668-48da-9866-75be8bc86f4d" // UUID 1 128-Bit (may use linux tool uuidgen or random numbers via https://www.uuidgenerator.net/) + +// Check +// https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md +// and http://www.hugi.scene.org/online/coding/hugi%2015%20-%20cmtadfix.htm +// for the temperature value. It is a 8.8 fixed-point notation +void setBeacon() +{ + char beacon_data[25]; + uint16_t beconUUID = 0xFEAA; + uint16_t volt = random(2800, 3700); // 3300mV = 3.3V + float tempFloat = random(2000, 3100) / 100.0f; + Serial.printf("Random temperature is %.2fC\n", tempFloat); + int temp = (int)(tempFloat * 256); //(uint16_t)((float)23.00); + Serial.printf("Converted to 8.8 format %0X%0X\n", (temp >> 8), (temp & 0xFF)); + + BLEAdvertisementData oAdvertisementData = BLEAdvertisementData(); + BLEAdvertisementData oScanResponseData = BLEAdvertisementData(); + + oScanResponseData.setFlags(0x06); // GENERAL_DISC_MODE 0x02 | BR_EDR_NOT_SUPPORTED 0x04 + oScanResponseData.setCompleteServices(BLEUUID(beconUUID)); + + beacon_data[0] = 0x20; // Eddystone Frame Type (Unencrypted Eddystone-TLM) + beacon_data[1] = 0x00; // TLM version + beacon_data[2] = (volt >> 8); // Battery voltage, 1 mV/bit i.e. 0xCE4 = 3300mV = 3.3V + beacon_data[3] = (volt & 0xFF); // + beacon_data[4] = (temp >> 8); // Beacon temperature + beacon_data[5] = (temp & 0xFF); // + beacon_data[6] = ((bootcount & 0xFF000000) >> 24); // Advertising PDU count + beacon_data[7] = ((bootcount & 0xFF0000) >> 16); // + beacon_data[8] = ((bootcount & 0xFF00) >> 8); // + beacon_data[9] = (bootcount & 0xFF); // + beacon_data[10] = ((lastTenth & 0xFF000000) >> 24); // Time since power-on or reboot as 0.1 second resolution counter + beacon_data[11] = ((lastTenth & 0xFF0000) >> 16); // + beacon_data[12] = ((lastTenth & 0xFF00) >> 8); // + beacon_data[13] = (lastTenth & 0xFF); // + + oScanResponseData.setServiceData(BLEUUID(beconUUID), std::string(beacon_data, 14)); + oAdvertisementData.setName("TLMBeacon"); + pAdvertising->setAdvertisementData(oAdvertisementData); + pAdvertising->setScanResponseData(oScanResponseData); +} + +void setup() +{ + + Serial.begin(115200); + gettimeofday(&nowTimeStruct, NULL); + + Serial.printf("start ESP32 %d\n", bootcount++); + + Serial.printf("deep sleep (%lds since last reset, %lds 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 + + // Create the BLE Device + BLEDevice::init("TLMBeacon"); + + BLEDevice::setPower(ESP_PWR_LVL_N12); + + pAdvertising = BLEDevice::getAdvertising(); + + setBeacon(); + // Start advertising + pAdvertising->start(); + Serial.println("Advertizing started for 10s ..."); + delay(10000); + pAdvertising->stop(); + Serial.printf("enter deep sleep for 10s\n"); + esp_deep_sleep(1000000LL * GPIO_DEEP_SLEEP_DURATION); + Serial.printf("in deep sleep\n"); +} + +void loop() +{ +} diff --git a/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.md b/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.md new file mode 100644 index 00000000000..2e34029d197 --- /dev/null +++ b/libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.md @@ -0,0 +1,14 @@ +## Eddystone TLM beacon +EddystoneTLM beacon by BeeGee based on +[pcbreflux ESP32 Eddystone TLM deepsleep](https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_Eddystone_TLM_deepsleep/ESP32_Eddystone_TLM_deepsleep.ino) + +[EddystoneTLM frame specification](https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md) + + Create a BLE server that will send periodic Eddystone TLM frames. + The design of creating the BLE server is: + 1. Create a BLE Server + 2. Create advertising data + 3. Start advertising. + 4. wait + 5. Stop advertising. + 6. deep sleep diff --git a/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.ino b/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.ino new file mode 100644 index 00000000000..335ea1ffbe6 --- /dev/null +++ b/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.ino @@ -0,0 +1,192 @@ +/* + EddystoneURL beacon by BeeGee + EddystoneURL frame specification https://github.com/google/eddystone/blob/master/eddystone-url/README.md + +*/ + +/* + Create a BLE server that will send periodic Eddystone URL frames. + The design of creating the BLE server is: + 1. Create a BLE Server + 2. Create advertising data + 3. Start advertising. + 4. wait + 5. Stop advertising. + 6. deep sleep + +*/ +#include "sys/time.h" + +#include + +#include "BLEDevice.h" +#include "BLEUtils.h" +#include "BLEBeacon.h" +#include "BLEAdvertising.h" +#include "BLEEddystoneURL.h" + +#include "esp_sleep.h" + +#define GPIO_DEEP_SLEEP_DURATION 10 // sleep x seconds and then wake up +RTC_DATA_ATTR static time_t last; // remember last boot in RTC Memory +RTC_DATA_ATTR static uint32_t bootcount; // remember number of boots in RTC Memory + +// See the following for generating UUIDs: +// https://www.uuidgenerator.net/ +BLEAdvertising *pAdvertising; +struct timeval now; + +#define BEACON_UUID "8ec76ea3-6668-48da-9866-75be8bc86f4d" // UUID 1 128-Bit (may use linux tool uuidgen or random numbers via https://www.uuidgenerator.net/) + +static const char *eddystone_url_prefix_subs[] = { + "http://www.", + "https://www.", + "http://", + "https://", + "urn:uuid:", + NULL +}; + +static const char *eddystone_url_suffix_subs[] = { + ".com/", + ".org/", + ".edu/", + ".net/", + ".info/", + ".biz/", + ".gov/", + ".com", + ".org", + ".edu", + ".net", + ".info", + ".biz", + ".gov", + NULL +}; + +static int string_begin_with(const char *str, const char *prefix) +{ + int prefix_len = strlen(prefix); + if (strncmp(prefix, str, prefix_len) == 0) + { + return prefix_len; + } + return 0; +} + +void setBeacon() +{ + BLEAdvertisementData oAdvertisementData = BLEAdvertisementData(); + BLEAdvertisementData oScanResponseData = BLEAdvertisementData(); + + const char url[] = "https://d.giesecke.tk"; + + int scheme_len, ext_len = 1, i, idx, url_idx; + char *ret_data; + int url_len = strlen(url); + + ret_data = (char *)calloc(1, url_len + 13); + + ret_data[0] = 2; // Len + ret_data[1] = 0x01; // Type Flags + ret_data[2] = 0x06; // GENERAL_DISC_MODE 0x02 | BR_EDR_NOT_SUPPORTED 0x04 + ret_data[3] = 3; // Len + ret_data[4] = 0x03; // Type 16-Bit UUID + ret_data[5] = 0xAA; // Eddystone UUID 2 -> 0xFEAA LSB + ret_data[6] = 0xFE; // Eddystone UUID 1 MSB + ret_data[7] = 19; // Length of Beacon Data + ret_data[8] = 0x16; // Type Service Data + ret_data[9] = 0xAA; // Eddystone UUID 2 -> 0xFEAA LSB + ret_data[10] = 0xFE; // Eddystone UUID 1 MSB + ret_data[11] = 0x10; // Eddystone Frame Type + ret_data[12] = 0xF4; // Beacons TX power at 0m + + i = 0, idx = 13, url_idx = 0; + + //replace prefix + scheme_len = 0; + while (eddystone_url_prefix_subs[i] != NULL) + { + if ((scheme_len = string_begin_with(url, eddystone_url_prefix_subs[i])) > 0) + { + ret_data[idx] = i; + idx++; + url_idx += scheme_len; + break; + } + i++; + } + while (url_idx < url_len) + { + i = 0; + ret_data[idx] = url[url_idx]; + ext_len = 1; + while (eddystone_url_suffix_subs[i] != NULL) + { + if ((ext_len = string_begin_with(&url[url_idx], eddystone_url_suffix_subs[i])) > 0) + { + ret_data[idx] = i; + break; + } + else + { + ext_len = 1; //inc 1 + } + i++; + } + url_idx += ext_len; + idx++; + } + ret_data[7] = idx - 8; + + Serial.printf("struct size %d url size %d reported len %d\n", + url_len + 13, + url_len, ret_data[7]); + + Serial.printf("URL in data %s\n", &ret_data[13]); + + std::string eddyStoneData(ret_data); + + oAdvertisementData.addData(eddyStoneData); + oScanResponseData.setName("URLBeacon"); + pAdvertising->setAdvertisementData(oAdvertisementData); + pAdvertising->setScanResponseData(oScanResponseData); +} + +void setup() +{ + + Serial.begin(115200); + gettimeofday(&now, NULL); + + Serial.printf("start ESP32 %d\n", bootcount++); + + Serial.printf("deep sleep (%lds since last reset, %lds since last boot)\n", now.tv_sec, now.tv_sec - last); + + last = now.tv_sec; + + // Create the BLE Device + BLEDevice::init("URLBeacon"); + + BLEDevice::setPower(ESP_PWR_LVL_N12); + + // Create the BLE Server + // BLEServer *pServer = BLEDevice::createServer(); // <-- no longer required to instantiate BLEServer, less flash and ram usage + + pAdvertising = BLEDevice::getAdvertising(); + + setBeacon(); + // Start advertising + pAdvertising->start(); + Serial.println("Advertizing started..."); + delay(10000); + pAdvertising->stop(); + Serial.printf("enter deep sleep\n"); + esp_deep_sleep(1000000LL * GPIO_DEEP_SLEEP_DURATION); + Serial.printf("in deep sleep\n"); +} + +void loop() +{ +} diff --git a/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.md b/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.md new file mode 100644 index 00000000000..2baf1cc526f --- /dev/null +++ b/libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.md @@ -0,0 +1,14 @@ +## Eddystone URL beacon +EddystoneURL beacon by BeeGee based on +[pcbreflux ESP32 Eddystone URL deepsleep](https://github.com/pcbreflux/espressif/tree/master/esp32/arduino/sketchbook/ESP32_Eddystone_URL_deepsleep) + +[EddystoneURL frame specification](https://github.com/google/eddystone/blob/master/eddystone-url/README.md) + + Create a BLE server that will send periodic Eddystone URL frames. + The design of creating the BLE server is: + 1. Create a BLE Server + 2. Create advertising data + 3. Start advertising. + 4. wait + 5. Stop advertising. + 6. deep sleep diff --git a/libraries/BLE/src/BLEAdvertisedDevice.cpp b/libraries/BLE/src/BLEAdvertisedDevice.cpp index f27ba6f6c7c..4b9c3380e51 100644 --- a/libraries/BLE/src/BLEAdvertisedDevice.cpp +++ b/libraries/BLE/src/BLEAdvertisedDevice.cpp @@ -388,6 +388,15 @@ void BLEAdvertisedDevice::parseAdvertisement(uint8_t* payload, size_t total_len) } // !finished } // parseAdvertisement +/** + * @brief Parse the advertising payload. + * @param [in] payload The payload of the advertised device. + * @param [in] total_len The length of payload + */ +void BLEAdvertisedDevice::setPayload(uint8_t* payload, size_t total_len) { + m_payload = payload; + m_payloadLength = total_len; +} // setPayload /** * @brief Set the address of the advertised device. diff --git a/libraries/BLE/src/BLEAdvertisedDevice.h b/libraries/BLE/src/BLEAdvertisedDevice.h index a3181c10b08..4cfa494e38d 100644 --- a/libraries/BLE/src/BLEAdvertisedDevice.h +++ b/libraries/BLE/src/BLEAdvertisedDevice.h @@ -64,6 +64,7 @@ class BLEAdvertisedDevice { friend class BLEScan; void parseAdvertisement(uint8_t* payload, size_t total_len=62); + void setPayload(uint8_t* payload, size_t total_len=62); void setAddress(BLEAddress address); void setAdFlag(uint8_t adFlag); void setAdvertizementResult(uint8_t* payload); diff --git a/libraries/BLE/src/BLEAdvertising.cpp b/libraries/BLE/src/BLEAdvertising.cpp index 3d86a5072a6..58f371ed981 100644 --- a/libraries/BLE/src/BLEAdvertising.cpp +++ b/libraries/BLE/src/BLEAdvertising.cpp @@ -28,7 +28,9 @@ * @brief Construct a default advertising object. * */ -BLEAdvertising::BLEAdvertising() { +BLEAdvertising::BLEAdvertising() +: m_scanRespData{} +{ m_advData.set_scan_rsp = false; m_advData.include_name = true; m_advData.include_txpower = true; @@ -215,10 +217,15 @@ void BLEAdvertising::start() { } if (!m_customScanResponseData && m_scanResp) { - m_advData.set_scan_rsp = true; - m_advData.include_name = m_scanResp; - m_advData.include_txpower = m_scanResp; - errRc = ::esp_ble_gap_config_adv_data(&m_advData); + // Set the configuration for scan response. + memcpy(&m_scanRespData, &m_advData, sizeof(esp_ble_adv_data_t)); // Copy the content of m_advData. + m_scanRespData.set_scan_rsp = true; // Define this struct as scan response data + m_scanRespData.include_name = true; // Caution: This may lead to a crash if the device name has more than 29 characters + m_scanRespData.include_txpower = true; + m_scanRespData.appearance = 0; // If defined the 'Appearance' attribute is already included in the advertising data + m_scanRespData.flag = 0; // 'Flags' attribute should no be included in the scan response + + errRc = ::esp_ble_gap_config_adv_data(&m_scanRespData); if (errRc != ESP_OK) { log_e("<< esp_ble_gap_config_adv_data (Scan response): rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); return; diff --git a/libraries/BLE/src/BLEAdvertising.h b/libraries/BLE/src/BLEAdvertising.h index 94bed945094..f1f0c66498f 100644 --- a/libraries/BLE/src/BLEAdvertising.h +++ b/libraries/BLE/src/BLEAdvertising.h @@ -30,7 +30,7 @@ class BLEAdvertisementData { void setPartialServices(BLEUUID uuid); void setServiceData(BLEUUID uuid, std::string data); void setShortName(std::string name); - void addData(std::string data); // Add data to the payload. + void addData(std::string data); // Add data to the payload. std::string getPayload(); // Retrieve the current advert payload. private: @@ -68,12 +68,13 @@ class BLEAdvertising { private: esp_ble_adv_data_t m_advData; + esp_ble_adv_data_t m_scanRespData; // Used for configuration of scan response data when m_scanResp is true esp_ble_adv_params_t m_advParams; std::vector m_serviceUUIDs; bool m_customAdvData = false; // Are we using custom advertising data? bool m_customScanResponseData = false; // Are we using custom scan response data? FreeRTOS::Semaphore m_semaphoreSetAdv = FreeRTOS::Semaphore("startAdvert"); - bool m_scanResp = true; + bool m_scanResp = true; }; #endif /* CONFIG_BT_ENABLED */ diff --git a/libraries/BLE/src/BLECharacteristic.cpp b/libraries/BLE/src/BLECharacteristic.cpp index 25146136184..7daaa32a51d 100644 --- a/libraries/BLE/src/BLECharacteristic.cpp +++ b/libraries/BLE/src/BLECharacteristic.cpp @@ -219,19 +219,22 @@ void BLECharacteristic::handleGATTServerEvent( // - uint8_t exec_write_flag - Either ESP_GATT_PREP_WRITE_EXEC or ESP_GATT_PREP_WRITE_CANCEL // case ESP_GATTS_EXEC_WRITE_EVT: { - if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) { - m_value.commit(); - m_pCallbacks->onWrite(this); // Invoke the onWrite callback handler. - } else { - m_value.cancel(); - } -// ??? - esp_err_t errRc = ::esp_ble_gatts_send_response( - gatts_if, - param->write.conn_id, - param->write.trans_id, ESP_GATT_OK, nullptr); - if (errRc != ESP_OK) { - log_e("esp_ble_gatts_send_response: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); + if(m_writeEvt){ + m_writeEvt = false; + if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) { + m_value.commit(); + m_pCallbacks->onWrite(this); // Invoke the onWrite callback handler. + } else { + m_value.cancel(); + } + // ??? + esp_err_t errRc = ::esp_ble_gatts_send_response( + gatts_if, + param->write.conn_id, + param->write.trans_id, ESP_GATT_OK, nullptr); + if (errRc != ESP_OK) { + log_e("esp_ble_gatts_send_response: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); + } } break; } // ESP_GATTS_EXEC_WRITE_EVT @@ -277,6 +280,7 @@ void BLECharacteristic::handleGATTServerEvent( if (param->write.handle == m_handle) { if (param->write.is_prep) { m_value.addPart(param->write.value, param->write.len); + m_writeEvt = true; } else { setValue(param->write.value, param->write.len); } diff --git a/libraries/BLE/src/BLECharacteristic.h b/libraries/BLE/src/BLECharacteristic.h index adec9587ee0..12ef1ceaa7d 100644 --- a/libraries/BLE/src/BLECharacteristic.h +++ b/libraries/BLE/src/BLECharacteristic.h @@ -107,6 +107,7 @@ class BLECharacteristic { BLEService* m_pService; BLEValue m_value; esp_gatt_perm_t m_permissions = ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE; + bool m_writeEvt = false; // If we have started a long write, this tells the commit code that we were the target void handleGATTServerEvent( esp_gatts_cb_event_t event, diff --git a/libraries/BLE/src/BLEClient.cpp b/libraries/BLE/src/BLEClient.cpp index 436813f859d..9d947710e94 100644 --- a/libraries/BLE/src/BLEClient.cpp +++ b/libraries/BLE/src/BLEClient.cpp @@ -105,6 +105,7 @@ bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) { esp_err_t errRc = ::esp_ble_gattc_app_register(m_appId); if (errRc != ESP_OK) { log_e("esp_ble_gattc_app_register: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); + BLEDevice::removePeerDevice(m_appId, true); return false; } @@ -122,6 +123,7 @@ bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) { ); if (errRc != ESP_OK) { log_e("esp_ble_gattc_open: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); + BLEDevice::removePeerDevice(m_appId, true); return false; } @@ -178,12 +180,13 @@ void BLEClient::gattClientEventHandler( // - uint16_t conn_id // - esp_bd_addr_t remote_bda case ESP_GATTC_DISCONNECT_EVT: { + if (evtParam->disconnect.conn_id != getConnId()) break; // If we receive a disconnect event, set the class flag that indicates that we are // no longer connected. - m_isConnected = false; - if (m_pClientCallbacks != nullptr) { + if (m_isConnected && m_pClientCallbacks != nullptr) { m_pClientCallbacks->onDisconnect(this); } + m_isConnected = false; esp_ble_gattc_app_unregister(m_gattc_if); m_semaphoreOpenEvt.give(ESP_GATT_IF_NONE); m_semaphoreRssiCmplEvt.give(); @@ -202,11 +205,13 @@ void BLEClient::gattClientEventHandler( // case ESP_GATTC_OPEN_EVT: { m_conn_id = evtParam->open.conn_id; - if (m_pClientCallbacks != nullptr) { - m_pClientCallbacks->onConnect(this); - } if (evtParam->open.status == ESP_GATT_OK) { m_isConnected = true; // Flag us as connected. + if (m_pClientCallbacks != nullptr) { + m_pClientCallbacks->onConnect(this); + } + } else { + log_e("Failed to connect, status=%s", GeneralUtils::errorToString(evtParam->open.status)); } m_semaphoreOpenEvt.give(evtParam->open.status); break; @@ -227,6 +232,7 @@ void BLEClient::gattClientEventHandler( } // ESP_GATTC_REG_EVT case ESP_GATTC_CFG_MTU_EVT: + if (evtParam->cfg_mtu.conn_id != getConnId()) break; if(evtParam->cfg_mtu.status != ESP_GATT_OK) { log_e("Config mtu failed"); } @@ -234,7 +240,8 @@ void BLEClient::gattClientEventHandler( break; case ESP_GATTC_CONNECT_EVT: { - BLEDevice::updatePeerDevice(this, true, m_gattc_if); + if (evtParam->connect.conn_id != getConnId()) break; + BLEDevice::updatePeerDevice(this, true, m_appId); esp_err_t errRc = esp_ble_gattc_send_mtu_req(gattc_if, evtParam->connect.conn_id); if (errRc != ESP_OK) { log_e("esp_ble_gattc_send_mtu_req: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); @@ -255,6 +262,7 @@ void BLEClient::gattClientEventHandler( // - uint16_t conn_id // case ESP_GATTC_SEARCH_CMPL_EVT: { + if (evtParam->search_cmpl.conn_id != getConnId()) break; esp_ble_gattc_cb_param_t* p_data = (esp_ble_gattc_cb_param_t*)evtParam; if (p_data->search_cmpl.status != ESP_GATT_OK){ log_e("search service failed, error status = %x", p_data->search_cmpl.status); @@ -285,6 +293,7 @@ void BLEClient::gattClientEventHandler( // - esp_gatt_id_t srvc_id // case ESP_GATTC_SEARCH_RES_EVT: { + if (evtParam->search_res.conn_id != getConnId()) break; BLEUUID uuid = BLEUUID(evtParam->search_res.srvc_id); BLERemoteService* pRemoteService = new BLERemoteService( evtParam->search_res.srvc_id, diff --git a/libraries/BLE/src/BLEEddystoneTLM.cpp b/libraries/BLE/src/BLEEddystoneTLM.cpp index 1ab794932e2..accc4db1bb3 100644 --- a/libraries/BLE/src/BLEEddystoneTLM.cpp +++ b/libraries/BLE/src/BLEEddystoneTLM.cpp @@ -3,6 +3,11 @@ * * Created on: Mar 12, 2018 * Author: pcbreflux + * Edited on: Mar 20, 2020 by beegee-tokyo + * Fix temperature value (8.8 fixed format) + * Fix time stamp (0.1 second resolution) + * Fixes based on EddystoneTLM frame specification https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md + * */ #include "sdkconfig.h" #if defined(CONFIG_BT_ENABLED) @@ -20,7 +25,7 @@ BLEEddystoneTLM::BLEEddystoneTLM() { m_eddystoneData.frameType = EDDYSTONE_TLM_FRAME_TYPE; m_eddystoneData.version = 0; m_eddystoneData.volt = 3300; // 3300mV = 3.3V - m_eddystoneData.temp = (uint16_t) ((float) 23.00); + m_eddystoneData.temp = (uint16_t) ((float) 23.00)/256; m_eddystoneData.advCount = 0; m_eddystoneData.tmil = 0; } // BLEEddystoneTLM @@ -38,41 +43,50 @@ uint8_t BLEEddystoneTLM::getVersion() { } // getVersion uint16_t BLEEddystoneTLM::getVolt() { - return m_eddystoneData.volt; + return ENDIAN_CHANGE_U16(m_eddystoneData.volt); } // getVolt float BLEEddystoneTLM::getTemp() { - return (float)m_eddystoneData.temp; + return ENDIAN_CHANGE_U16(m_eddystoneData.temp) / 256.0f; } // getTemp uint32_t BLEEddystoneTLM::getCount() { - return m_eddystoneData.advCount; + return ENDIAN_CHANGE_U32(m_eddystoneData.advCount); } // getCount uint32_t BLEEddystoneTLM::getTime() { - return m_eddystoneData.tmil; + return (ENDIAN_CHANGE_U32(m_eddystoneData.tmil)) / 10; } // getTime std::string BLEEddystoneTLM::toString() { std::string out = ""; uint32_t rawsec = ENDIAN_CHANGE_U32(m_eddystoneData.tmil); - char val[6]; + char val[12]; - out += "Version " + m_eddystoneData.version; + out += "Version "; // + std::string(m_eddystoneData.version); + snprintf(val, sizeof(val), "%d", m_eddystoneData.version); + out += val; out += "\n"; - out += "Battery Voltage " + ENDIAN_CHANGE_U16(m_eddystoneData.volt); + out += "Battery Voltage "; // + ENDIAN_CHANGE_U16(m_eddystoneData.volt); + snprintf(val, sizeof(val), "%d", ENDIAN_CHANGE_U16(m_eddystoneData.volt)); + out += val; out += " mV\n"; out += "Temperature "; - snprintf(val, sizeof(val), "%d", m_eddystoneData.temp); + snprintf(val, sizeof(val), "%.2f", ENDIAN_CHANGE_U16(m_eddystoneData.temp) / 256.0f); out += val; - out += ".0 °C\n"; + out += " C\n"; out += "Adv. Count "; snprintf(val, sizeof(val), "%d", ENDIAN_CHANGE_U32(m_eddystoneData.advCount)); out += val; out += "\n"; + out += "Time in seconds "; + snprintf(val, sizeof(val), "%d", rawsec/10); + out += val; + out += "\n"; + out += "Time "; snprintf(val, sizeof(val), "%04d", rawsec / 864000); diff --git a/libraries/BLE/src/BLERemoteCharacteristic.cpp b/libraries/BLE/src/BLERemoteCharacteristic.cpp index 6a5413893a1..d67710442ae 100644 --- a/libraries/BLE/src/BLERemoteCharacteristic.cpp +++ b/libraries/BLE/src/BLERemoteCharacteristic.cpp @@ -237,6 +237,13 @@ void BLERemoteCharacteristic::gattClientEventHandler(esp_gattc_cb_event_t event, break; } // ESP_GATTC_WRITE_CHAR_EVT + case ESP_GATTC_READ_DESCR_EVT: + case ESP_GATTC_WRITE_DESCR_EVT: + for (auto &myPair : m_descriptorMap) { + myPair.second->gattClientEventHandler( + event, gattc_if, evtParam); + } + break; default: break; @@ -467,7 +474,8 @@ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback, uint8_t val[] = {0x01, 0x00}; if(!notifications) val[0] = 0x02; BLERemoteDescriptor* desc = getDescriptor(BLEUUID((uint16_t)0x2902)); - desc->writeValue(val, 2); + if (desc != nullptr) + desc->writeValue(val, 2, true); } // End Register else { // If we weren't passed a callback function, then this is an unregistration. esp_err_t errRc = ::esp_ble_gattc_unregister_for_notify( @@ -482,7 +490,8 @@ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback, uint8_t val[] = {0x00, 0x00}; BLERemoteDescriptor* desc = getDescriptor((uint16_t)0x2902); - desc->writeValue(val, 2); + if (desc != nullptr) + desc->writeValue(val, 2, true); } // End Unregister m_semaphoreRegForNotifyEvt.wait("registerForNotify"); @@ -533,7 +542,7 @@ std::string BLERemoteCharacteristic::toString() { * @return N/A. */ void BLERemoteCharacteristic::writeValue(std::string newValue, bool response) { - writeValue((uint8_t*)newValue.c_str(), strlen(newValue.c_str()), response); + writeValue((uint8_t*)newValue.data(), newValue.length(), response); } // writeValue diff --git a/libraries/BLE/src/BLERemoteDescriptor.cpp b/libraries/BLE/src/BLERemoteDescriptor.cpp index ad506aae9b3..b1e0bef221b 100644 --- a/libraries/BLE/src/BLERemoteDescriptor.cpp +++ b/libraries/BLE/src/BLERemoteDescriptor.cpp @@ -49,6 +49,23 @@ BLEUUID BLERemoteDescriptor::getUUID() { return m_uuid; } // getUUID +void BLERemoteDescriptor::gattClientEventHandler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t* evtParam) { + switch(event) { + case ESP_GATTC_READ_DESCR_EVT: + if (evtParam->read.handle != getHandle()) + break; + m_semaphoreReadDescrEvt.give(); + break; + + case ESP_GATTC_WRITE_DESCR_EVT: + if (evtParam->write.handle != getHandle()) + break; + m_semaphoreWriteDescrEvt.give(); + break; + default: + break; + } +} std::string BLERemoteDescriptor::readValue() { log_v(">> readValue: %s", toString().c_str()); @@ -137,6 +154,8 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response return; } + m_semaphoreWriteDescrEvt.take("writeValue"); + esp_err_t errRc = ::esp_ble_gattc_write_char_descr( m_pRemoteCharacteristic->getRemoteService()->getClient()->getGattcIf(), m_pRemoteCharacteristic->getRemoteService()->getClient()->getConnId(), @@ -149,6 +168,8 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response if (errRc != ESP_OK) { log_e("esp_ble_gattc_write_char_descr: %d", errRc); } + + m_semaphoreWriteDescrEvt.wait("writeValue"); log_v("<< writeValue"); } // writeValue diff --git a/libraries/BLE/src/BLERemoteDescriptor.h b/libraries/BLE/src/BLERemoteDescriptor.h index 29efe573bfe..ebd847f2c24 100644 --- a/libraries/BLE/src/BLERemoteDescriptor.h +++ b/libraries/BLE/src/BLERemoteDescriptor.h @@ -35,7 +35,7 @@ class BLERemoteDescriptor { void writeValue(std::string newValue, bool response = false); void writeValue(uint8_t newValue, bool response = false); void setAuth(esp_gatt_auth_req_t auth); - + void gattClientEventHandler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t* evtParam); private: friend class BLERemoteCharacteristic; @@ -49,6 +49,7 @@ class BLERemoteDescriptor { std::string m_value; // Last received value of the descriptor. BLERemoteCharacteristic* m_pRemoteCharacteristic; // Reference to the Remote characteristic of which this descriptor is associated. FreeRTOS::Semaphore m_semaphoreReadDescrEvt = FreeRTOS::Semaphore("ReadDescrEvt"); + FreeRTOS::Semaphore m_semaphoreWriteDescrEvt = FreeRTOS::Semaphore("WriteDescrEvt"); esp_gatt_auth_req_t m_auth; diff --git a/libraries/BLE/src/BLERemoteService.cpp b/libraries/BLE/src/BLERemoteService.cpp index 278e9c1cab4..dfd36a90401 100644 --- a/libraries/BLE/src/BLERemoteService.cpp +++ b/libraries/BLE/src/BLERemoteService.cpp @@ -244,7 +244,15 @@ std::map* BLERemoteService::getCharacteristi * @brief This function is designed to get characteristics map when we have multiple characteristics with the same UUID */ void BLERemoteService::getCharacteristics(std::map* pCharacteristicMap) { - pCharacteristicMap = &m_characteristicMapByHandle; + log_v(">> getCharacteristics() for service: %s", getUUID().toString().c_str()); + // If is possible that we have not read the characteristics associated with the service so do that + // now. The request to retrieve the characteristics by calling "retrieveCharacteristics" is a blocking + // call and does not return until all the characteristics are available. + if (!m_haveCharacteristics) { + retrieveCharacteristics(); + } + log_v("<< getCharacteristics() for service: %s", getUUID().toString().c_str()); + *pCharacteristicMap = m_characteristicMapByHandle; } // Get the characteristics map. /** @@ -302,13 +310,10 @@ std::string BLERemoteService::getValue(BLEUUID characteristicUuid) { * @return N/A. */ void BLERemoteService::removeCharacteristics() { - for (auto &myPair : m_characteristicMap) { - delete myPair.second; - //m_characteristicMap.erase(myPair.first); // Should be no need to delete as it will be deleted by the clear - } m_characteristicMap.clear(); // Clear the map for (auto &myPair : m_characteristicMapByHandle) { delete myPair.second; + // delete the characteristics only once } m_characteristicMapByHandle.clear(); // Clear the map } // removeCharacteristics diff --git a/libraries/BLE/src/BLEScan.cpp b/libraries/BLE/src/BLEScan.cpp index cb28dd395a7..e6e962be61e 100644 --- a/libraries/BLE/src/BLEScan.cpp +++ b/libraries/BLE/src/BLEScan.cpp @@ -22,12 +22,15 @@ * Constructor */ BLEScan::BLEScan() { + memset(&m_scan_params, 0, sizeof(m_scan_params)); // Initialize all params m_scan_params.scan_type = BLE_SCAN_TYPE_PASSIVE; // Default is a passive scan. m_scan_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; m_scan_params.scan_filter_policy = BLE_SCAN_FILTER_ALLOW_ALL; + m_scan_params.scan_duplicate = BLE_SCAN_DUPLICATE_DISABLE; m_pAdvertisedDeviceCallbacks = nullptr; m_stopped = true; m_wantDuplicates = false; + m_shouldParse = true; setInterval(100); setWindow(100); } // BLEScan @@ -88,15 +91,18 @@ void BLEScan::handleGAPEvent( // ignore it. BLEAddress advertisedAddress(param->scan_rst.bda); bool found = false; - - if (m_scanResults.m_vectorAdvertisedDevices.count(advertisedAddress.toString()) != 0) { - found = true; - } - - if (found && !m_wantDuplicates) { // If we found a previous entry AND we don't want duplicates, then we are done. - log_d("Ignoring %s, already seen it.", advertisedAddress.toString().c_str()); - vTaskDelay(1); // <--- allow to switch task in case we scan infinity and dont have new devices to report, or we are blocked here - break; + bool shouldDelete = true; + + if (!m_wantDuplicates) { + if (m_scanResults.m_vectorAdvertisedDevices.count(advertisedAddress.toString()) != 0) { + found = true; + } + + if (found) { // If we found a previous entry AND we don't want duplicates, then we are done. + log_d("Ignoring %s, already seen it.", advertisedAddress.toString().c_str()); + vTaskDelay(1); // <--- allow to switch task in case we scan infinity and dont have new devices to report, or we are blocked here + break; + } } // We now construct a model of the advertised device that we have just found for the first @@ -107,19 +113,23 @@ void BLEScan::handleGAPEvent( advertisedDevice->setAddress(advertisedAddress); advertisedDevice->setRSSI(param->scan_rst.rssi); advertisedDevice->setAdFlag(param->scan_rst.flag); - advertisedDevice->parseAdvertisement((uint8_t*)param->scan_rst.ble_adv, param->scan_rst.adv_data_len + param->scan_rst.scan_rsp_len); + if (m_shouldParse) { + advertisedDevice->parseAdvertisement((uint8_t*)param->scan_rst.ble_adv, param->scan_rst.adv_data_len + param->scan_rst.scan_rsp_len); + } else { + advertisedDevice->setPayload((uint8_t*)param->scan_rst.ble_adv, param->scan_rst.adv_data_len + param->scan_rst.scan_rsp_len); + } advertisedDevice->setScan(this); advertisedDevice->setAddressType(param->scan_rst.ble_addr_type); - if (!found) { // If we have previously seen this device, don't record it again. - m_scanResults.m_vectorAdvertisedDevices.insert(std::pair(advertisedAddress.toString(), advertisedDevice)); - } - - if (m_pAdvertisedDeviceCallbacks) { + if (m_pAdvertisedDeviceCallbacks) { // if has callback, no need to record to vector m_pAdvertisedDeviceCallbacks->onResult(*advertisedDevice); + } else if (!m_wantDuplicates && !found) { // if no callback and not want duplicate, and not already in vector, record it + m_scanResults.m_vectorAdvertisedDevices.insert(std::pair(advertisedAddress.toString(), advertisedDevice)); + shouldDelete = false; } - if(found) + if (shouldDelete) { delete advertisedDevice; + } break; } // ESP_GAP_SEARCH_INQ_RES_EVT @@ -159,13 +169,14 @@ void BLEScan::setActiveScan(bool active) { * @brief Set the call backs to be invoked. * @param [in] pAdvertisedDeviceCallbacks Call backs to be invoked. * @param [in] wantDuplicates True if we wish to be called back with duplicates. Default is false. + * @param [in] shouldParse True if we wish to parse advertised package or raw payload. Default is true. */ -void BLEScan::setAdvertisedDeviceCallbacks(BLEAdvertisedDeviceCallbacks* pAdvertisedDeviceCallbacks, bool wantDuplicates) { +void BLEScan::setAdvertisedDeviceCallbacks(BLEAdvertisedDeviceCallbacks* pAdvertisedDeviceCallbacks, bool wantDuplicates, bool shouldParse) { m_wantDuplicates = wantDuplicates; m_pAdvertisedDeviceCallbacks = pAdvertisedDeviceCallbacks; + m_shouldParse = shouldParse; } // setAdvertisedDeviceCallbacks - /** * @brief Set the interval to scan. * @param [in] The interval in msecs. diff --git a/libraries/BLE/src/BLEScan.h b/libraries/BLE/src/BLEScan.h index 2f71a72738e..75cfdd71acc 100644 --- a/libraries/BLE/src/BLEScan.h +++ b/libraries/BLE/src/BLEScan.h @@ -51,7 +51,8 @@ class BLEScan { void setActiveScan(bool active); void setAdvertisedDeviceCallbacks( BLEAdvertisedDeviceCallbacks* pAdvertisedDeviceCallbacks, - bool wantDuplicates = false); + bool wantDuplicates = false, + bool shouldParse = true); void setInterval(uint16_t intervalMSecs); void setWindow(uint16_t windowMSecs); bool start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults), bool is_continue = false); @@ -73,6 +74,7 @@ class BLEScan { esp_ble_scan_params_t m_scan_params; BLEAdvertisedDeviceCallbacks* m_pAdvertisedDeviceCallbacks = nullptr; bool m_stopped = true; + bool m_shouldParse = true; FreeRTOS::Semaphore m_semaphoreScanEnd = FreeRTOS::Semaphore("ScanEnd"); BLEScanResults m_scanResults; bool m_wantDuplicates; diff --git a/libraries/BLE/src/BLESecurity.cpp b/libraries/BLE/src/BLESecurity.cpp index 921f5424431..f3b2cd3cbd3 100644 --- a/libraries/BLE/src/BLESecurity.cpp +++ b/libraries/BLE/src/BLESecurity.cpp @@ -61,6 +61,17 @@ void BLESecurity::setKeySize(uint8_t key_size) { esp_ble_gap_set_security_param(ESP_BLE_SM_MAX_KEY_SIZE, &m_keySize, sizeof(uint8_t)); } //setKeySize +/** + * Setup for static PIN connection, call it first and then call setAuthenticationMode eventually to change it + */ +void BLESecurity::setStaticPIN(uint32_t pin){ + uint32_t passkey = pin; + esp_ble_gap_set_security_param(ESP_BLE_SM_SET_STATIC_PASSKEY, &passkey, sizeof(uint32_t)); + setCapability(ESP_IO_CAP_OUT); + setKeySize(); + setAuthenticationMode(ESP_LE_AUTH_REQ_SC_ONLY); + setInitEncryptionKey(ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK); +} /** * @brief Debug function to display what keys are exchanged by peers diff --git a/libraries/BLE/src/BLESecurity.h b/libraries/BLE/src/BLESecurity.h index 48d09d2f3f6..dc6d6d715b9 100644 --- a/libraries/BLE/src/BLESecurity.h +++ b/libraries/BLE/src/BLESecurity.h @@ -21,6 +21,7 @@ class BLESecurity { void setInitEncryptionKey(uint8_t init_key); void setRespEncryptionKey(uint8_t resp_key); void setKeySize(uint8_t key_size = 16); + void setStaticPIN(uint32_t pin); static char* esp_key_type_to_str(esp_ble_key_type_t key_type); private: diff --git a/libraries/BLE/src/FreeRTOS.cpp b/libraries/BLE/src/FreeRTOS.cpp index 2f52b99d389..7539e252a19 100644 --- a/libraries/BLE/src/FreeRTOS.cpp +++ b/libraries/BLE/src/FreeRTOS.cpp @@ -193,8 +193,8 @@ bool FreeRTOS::Semaphore::take(std::string owner) { } else { rc = ::xSemaphoreTake(m_semaphore, portMAX_DELAY) == pdTRUE; } - m_owner = owner; if (rc) { + m_owner = owner; log_v("Semaphore taken: %s", toString().c_str()); } else { log_e("Semaphore NOT taken: %s", toString().c_str()); @@ -218,8 +218,8 @@ bool FreeRTOS::Semaphore::take(uint32_t timeoutMs, std::string owner) { } else { rc = ::xSemaphoreTake(m_semaphore, timeoutMs / portTICK_PERIOD_MS) == pdTRUE; } - m_owner = owner; if (rc) { + m_owner = owner; log_v("Semaphore taken: %s", toString().c_str()); } else { log_e("Semaphore NOT taken: %s", toString().c_str()); diff --git a/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino b/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino index 717d3c39c6b..9221af1eaa2 100644 --- a/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino +++ b/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino @@ -2,7 +2,7 @@ #include const byte DNS_PORT = 53; -IPAddress apIP(192, 168, 1, 1); +IPAddress apIP(8,8,4,4); // The default android DNS DNSServer dnsServer; WiFiServer server(80); @@ -12,11 +12,9 @@ String responseHTML = "" "be redirected here.

"; void setup() { - WiFi.disconnect(); //added to start with the wifi off, avoid crashing - WiFi.mode(WIFI_OFF); //added to start with the wifi off, avoid crashing WiFi.mode(WIFI_AP); + WiFi.softAP("ESP32-DNSServer"); WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); - WiFi.softAP("DNSServer CaptivePortal example"); // if DNSServer is started with "*" for domain name, it will reply with // provided IP to all DNS request diff --git a/libraries/DNSServer/src/DNSServer.cpp b/libraries/DNSServer/src/DNSServer.cpp index eafa97cfdf9..a7f0d15eb62 100644 --- a/libraries/DNSServer/src/DNSServer.cpp +++ b/libraries/DNSServer/src/DNSServer.cpp @@ -2,6 +2,12 @@ #include #include +// #define DEBUG_ESP_DNS +#ifdef DEBUG_ESP_PORT +#define DEBUG_OUTPUT DEBUG_ESP_PORT +#else +#define DEBUG_OUTPUT Serial +#endif DNSServer::DNSServer() { @@ -184,6 +190,11 @@ void DNSServer::replyWithIP() _udp.write((unsigned char*) &answerIPv4, 2 ); _udp.write(_resolvedIP, sizeof(_resolvedIP)); // The IP address to return _udp.endPacket(); + + #ifdef DEBUG_ESP_DNS + DEBUG_OUTPUT.printf("DNS responds: %s for %s\n", + IPAddress(_resolvedIP).toString().c_str(), getDomainNameWithoutWwwPrefix().c_str() ); + #endif } void DNSServer::replyWithCustomCode() diff --git a/libraries/EEPROM/examples/eeprom_class/eeprom_class.ino b/libraries/EEPROM/examples/eeprom_class/eeprom_class.ino index f5301f4ef1d..686f09d979e 100644 --- a/libraries/EEPROM/examples/eeprom_class/eeprom_class.ino +++ b/libraries/EEPROM/examples/eeprom_class/eeprom_class.ino @@ -17,6 +17,7 @@ EEPROMClass AGE("eeprom2", 0x100); void setup() { Serial.begin(115200); + delay(1000); Serial.println("Testing EEPROMClass\n"); if (!NAMES.begin(NAMES.length())) { Serial.println("Failed to initialise NAMES"); @@ -43,7 +44,7 @@ void setup() { uint32_t age = 47; // Write: Variables ---> EEPROM stores - NAMES.put(0, name); + NAMES.writeString(0, name); HEIGHT.put(0, height); AGE.put(0, age); Serial.print("name: "); Serial.println(name); diff --git a/libraries/ESP32/examples/ChipID/GetChipID/GetChipID.ino b/libraries/ESP32/examples/ChipID/GetChipID/GetChipID.ino index de8a7386b93..d6288c89fad 100644 --- a/libraries/ESP32/examples/ChipID/GetChipID/GetChipID.ino +++ b/libraries/ESP32/examples/ChipID/GetChipID/GetChipID.ino @@ -1,14 +1,30 @@ -uint64_t chipid; +/* The true ESP32 chip ID is essentially its MAC address. +This sketch provides an alternate chip ID that matches +the output of the ESP.getChipId() function on ESP8266 +(i.e. a 32-bit integer matching the last 3 bytes of +the MAC address. This is less unique than the +MAC address chip ID, but is helpful when you need +an identifier that can be no more than a 32-bit integer +(like for switch...case). + +created 2020-06-07 by cweinhofer +with help from Cicicok */ + +uint32_t chipId = 0; void setup() { Serial.begin(115200); } void loop() { - chipid=ESP.getEfuseMac();//The chip ID is essentially its MAC address(length: 6 bytes). - Serial.printf("ESP32 Chip ID = %04X",(uint16_t)(chipid>>32));//print High 2 bytes - Serial.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes. + for(int i=0; i<17; i=i+8) { + chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i; + } + Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision()); + Serial.printf("This chip has %d cores\n", ESP.getChipCores()); + Serial.print("Chip ID: "); Serial.println(chipId); + delay(3000); } diff --git a/libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino b/libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino new file mode 100644 index 00000000000..6a4c63bc7e5 --- /dev/null +++ b/libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino @@ -0,0 +1,64 @@ +#include "Arduino.h" +#include "esp32-hal.h" + +extern "C" void receive_trampoline(uint32_t *data, size_t len, void * arg); + +class MyProcessor { + private: + rmt_obj_t* rmt_recv = NULL; + float realNanoTick; + uint32_t buff; // rolling buffer of most recent 32 bits. + int at = 0; + + public: + MyProcessor(uint8_t pin, float nanoTicks) { + assert((rmt_recv = rmtInit(21, false, RMT_MEM_192))); + + realNanoTick = rmtSetTick(rmt_recv, nanoTicks); + }; + void begin() { + rmtRead(rmt_recv, receive_trampoline, this); + }; + + void process(rmt_data_t *data, size_t len) { + for (int i = 0; len; len--) { + if (data[i].duration0 == 0) + break; + buff = (buff << 1) | (data[i].level0 ? 1 : 0); + i++; + + if (data[i].duration1 == 0) + break; + buff = (buff << 1) | (data[i].level1 ? 1 : 0); + i++; + }; + }; + uint32_t val() { + return buff; + } +}; + +void receive_trampoline(uint32_t *data, size_t len, void * arg) +{ + MyProcessor * p = (MyProcessor *)arg; + p->process((rmt_data_t*) data, len); +} + +// Attach 3 processors to GPIO 4, 5 and 10 with different tick/speeds. +MyProcessor mp1 = MyProcessor(4, 1000); +MyProcessor mp2 = MyProcessor(5, 1000); +MyProcessor mp3 = MyProcessor(10, 500); + +void setup() +{ + Serial.begin(115200); + mp1.begin(); + mp2.begin(); + mp3.begin(); +} + +void loop() +{ + Serial.printf("GPIO 4: %08x 5: %08x 6: %08x\n", mp1.val(), mp2.val(), mp3.val()); + delay(500); +} diff --git a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino index 54f2d2c983c..248aad3fa36 100644 --- a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino +++ b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino @@ -16,6 +16,7 @@ static EventGroupHandle_t events; void setup() { Serial.begin(115200); + events = xEventGroupCreate(); if ((rmt_send = rmtInit(18, true, RMT_MEM_64)) == NULL) { diff --git a/libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino b/libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino index 29ab824d79d..39978d26dab 100644 --- a/libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino +++ b/libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino @@ -172,7 +172,7 @@ void parseRmt(rmt_data_t* items, size_t len, uint32_t* channels){ } } -extern "C" void receive_data(uint32_t *data, size_t len) +extern "C" void receive_data(uint32_t *data, size_t len, void * arg) { parseRmt((rmt_data_t*) data, len, channels); } @@ -192,7 +192,7 @@ void setup() Serial.printf("real tick set to: %fns\n", realTick); // Ask to start reading - rmtRead(rmt_recv, receive_data); + rmtRead(rmt_recv, receive_data, NULL); } void loop() diff --git a/libraries/ESPmDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino b/libraries/ESPmDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino index 8763d8d6108..946f51aacc1 100644 --- a/libraries/ESPmDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino +++ b/libraries/ESPmDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino @@ -47,7 +47,7 @@ void setup(void) // Set up mDNS responder: // - first argument is the domain name, in this example - // the fully-qualified domain name is "esp8266.local" + // the fully-qualified domain name is "esp32.local" // - second argument is the IP address to advertise // we send our IP address on the WiFi network if (!MDNS.begin("esp32")) { diff --git a/libraries/ESPmDNS/src/ESPmDNS.cpp b/libraries/ESPmDNS/src/ESPmDNS.cpp index 2211f67b9c7..9a76f623c91 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.cpp +++ b/libraries/ESPmDNS/src/ESPmDNS.cpp @@ -130,7 +130,7 @@ void MDNSResponder::disableWorkstation(){ } } -void MDNSResponder::addService(char *name, char *proto, uint16_t port){ +bool MDNSResponder::addService(char *name, char *proto, uint16_t port){ char _name[strlen(name)+2]; char _proto[strlen(proto)+2]; if (name[0] == '_') { @@ -146,7 +146,9 @@ void MDNSResponder::addService(char *name, char *proto, uint16_t port){ if(mdns_service_add(NULL, _name, _proto, port, NULL, 0)) { log_e("Failed adding service %s.%s.\n", name, proto); + return false; } + return true; } bool MDNSResponder::addServiceTxt(char *name, char *proto, char *key, char *value){ diff --git a/libraries/ESPmDNS/src/ESPmDNS.h b/libraries/ESPmDNS/src/ESPmDNS.h index e66fbdb7e62..8f56ea42fde 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.h +++ b/libraries/ESPmDNS/src/ESPmDNS.h @@ -65,12 +65,12 @@ class MDNSResponder { setInstanceName(String(name)); } - void addService(char *service, char *proto, uint16_t port); - void addService(const char *service, const char *proto, uint16_t port){ - addService((char *)service, (char *)proto, port); + bool addService(char *service, char *proto, uint16_t port); + bool addService(const char *service, const char *proto, uint16_t port){ + return addService((char *)service, (char *)proto, port); } - void addService(String service, String proto, uint16_t port){ - addService(service.c_str(), proto.c_str(), port); + bool addService(String service, String proto, uint16_t port){ + return addService(service.c_str(), proto.c_str(), port); } bool addServiceTxt(char *name, char *proto, char * key, char * value); diff --git a/libraries/FS/src/vfs_api.cpp b/libraries/FS/src/vfs_api.cpp index 6502f760560..346b7a93248 100644 --- a/libraries/FS/src/vfs_api.cpp +++ b/libraries/FS/src/vfs_api.cpp @@ -184,6 +184,11 @@ bool VFSImpl::rmdir(const char *path) return false; } + if (strcmp(_mountpoint, "/spiffs") == 0) { + log_e("rmdir is unnecessary in SPIFFS"); + return false; + } + VFSFileImpl f(this, path, "r"); if(!f || !f.isDirectory()) { if(f) { @@ -200,7 +205,7 @@ bool VFSImpl::rmdir(const char *path) return false; } sprintf(temp,"%s%s", _mountpoint, path); - auto rc = unlink(temp); + auto rc = ::rmdir(temp); free(temp); return rc == 0; } diff --git a/libraries/HTTPClient/src/HTTPClient.cpp b/libraries/HTTPClient/src/HTTPClient.cpp index 187cd6a64c4..49b941696f0 100644 --- a/libraries/HTTPClient/src/HTTPClient.cpp +++ b/libraries/HTTPClient/src/HTTPClient.cpp @@ -548,29 +548,106 @@ int HTTPClient::sendRequest(const char * type, String payload) */ int HTTPClient::sendRequest(const char * type, uint8_t * payload, size_t size) { - // connect to server - if(!connect()) { - return returnError(HTTPC_ERROR_CONNECTION_REFUSED); - } + int code; + bool redirect = false; + uint16_t redirectCount = 0; + do { + // wipe out any existing headers from previous request + for(size_t i = 0; i < _headerKeysCount; i++) { + if (_currentHeaders[i].value.length() > 0) { + _currentHeaders[i].value.clear(); + } + } - if(payload && size > 0) { - addHeader(F("Content-Length"), String(size)); - } + log_d("request type: '%s' redirCount: %d\n", type, redirectCount); + + // connect to server + if(!connect()) { + return returnError(HTTPC_ERROR_CONNECTION_REFUSED); + } - // send Header - if(!sendHeader(type)) { - return returnError(HTTPC_ERROR_SEND_HEADER_FAILED); - } + if(payload && size > 0) { + addHeader(F("Content-Length"), String(size)); + } - // send Payload if needed - if(payload && size > 0) { - if(_client->write(&payload[0], size) != size) { - return returnError(HTTPC_ERROR_SEND_PAYLOAD_FAILED); + // send Header + if(!sendHeader(type)) { + return returnError(HTTPC_ERROR_SEND_HEADER_FAILED); + } + + // send Payload if needed + if(payload && size > 0) { + if(_client->write(&payload[0], size) != size) { + return returnError(HTTPC_ERROR_SEND_PAYLOAD_FAILED); + } } - } + code = handleHeaderResponse(); + log_d("sendRequest code=%d\n", code); + + // Handle redirections as stated in RFC document: + // https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html + // + // Implementing HTTP_CODE_FOUND as redirection with GET method, + // to follow most of existing user agent implementations. + // + redirect = false; + if ( + _followRedirects != HTTPC_DISABLE_FOLLOW_REDIRECTS && + redirectCount < _redirectLimit && + _location.length() > 0 + ) { + switch (code) { + // redirecting using the same method + case HTTP_CODE_MOVED_PERMANENTLY: + case HTTP_CODE_TEMPORARY_REDIRECT: { + if ( + // allow to force redirections on other methods + // (the RFC require user to accept the redirection) + _followRedirects == HTTPC_FORCE_FOLLOW_REDIRECTS || + // allow GET and HEAD methods without force + !strcmp(type, "GET") || + !strcmp(type, "HEAD") + ) { + redirectCount += 1; + log_d("following redirect (the same method): '%s' redirCount: %d\n", _location.c_str(), redirectCount); + if (!setURL(_location)) { + log_d("failed setting URL for redirection\n"); + // no redirection + break; + } + // redirect using the same request method and payload, diffrent URL + redirect = true; + } + break; + } + // redirecting with method dropped to GET or HEAD + // note: it does not need `HTTPC_FORCE_FOLLOW_REDIRECTS` for any method + case HTTP_CODE_FOUND: + case HTTP_CODE_SEE_OTHER: { + redirectCount += 1; + log_d("following redirect (dropped to GET/HEAD): '%s' redirCount: %d\n", _location.c_str(), redirectCount); + if (!setURL(_location)) { + log_d("failed setting URL for redirection\n"); + // no redirection + break; + } + // redirect after changing method to GET/HEAD and dropping payload + type = "GET"; + payload = nullptr; + size = 0; + redirect = true; + break; + } + + default: + break; + } + } + + } while (redirect); // handle Server Response (Header) - return returnError(handleHeaderResponse()); + return returnError(code); } /** @@ -842,18 +919,19 @@ int HTTPClient::writeToStream(Stream * stream) */ String HTTPClient::getString(void) { - StreamString sstring; - - if(_size) { - // try to reserve needed memmory - if(!sstring.reserve((_size + 1))) { + // _size can be -1 when Server sends no Content-Length header + if(_size > 0 || _size == -1) { + StreamString sstring; + // try to reserve needed memory (noop if _size == -1) + if(sstring.reserve((_size + 1))) { + writeToStream(&sstring); + return sstring; + } else { log_d("not enough memory to reserve a string! need: %d", (_size + 1)); - return ""; } } - writeToStream(&sstring); - return sstring; + return ""; } /** @@ -1012,7 +1090,13 @@ bool HTTPClient::connect(void) log_d("HTTPClient::begin was not called or returned error"); return false; } - +#ifdef HTTPCLIENT_1_1_COMPATIBLE + if (_tcpDeprecated && !_transportTraits->verify(*_client, _host.c_str())) { + log_d("transport level verify failed"); + _client->stop(); + return false; + } +#endif if(!_client->connect(_host.c_str(), _port, _connectTimeout)) { log_d("failed connect to %s:%u", _host.c_str(), _port); return false; @@ -1023,14 +1107,6 @@ bool HTTPClient::connect(void) log_d(" connected to %s:%u", _host.c_str(), _port); -#ifdef HTTPCLIENT_1_1_COMPATIBLE - if (_tcpDeprecated && !_transportTraits->verify(*_client, _host.c_str())) { - log_d("transport level verify failed"); - _client->stop(); - return false; - } -#endif - /* #ifdef ESP8266 @@ -1110,6 +1186,7 @@ int HTTPClient::handleHeaderResponse() _transferEncoding = HTTPC_TE_IDENTITY; unsigned long lastDataTime = millis(); + bool firstLine = true; while(connected()) { size_t len = _client->available(); @@ -1121,11 +1198,13 @@ int HTTPClient::handleHeaderResponse() log_v("RX: '%s'", headerLine.c_str()); - if(headerLine.startsWith("HTTP/1.")) { - if(_canReuse) { + if(firstLine) { + firstLine = false; + if(_canReuse && headerLine.startsWith("HTTP/1.")) { _canReuse = (headerLine[sizeof "HTTP/1." - 1] != '0'); } - _returnCode = headerLine.substring(9, headerLine.indexOf(' ', 9)).toInt(); + int codePos = headerLine.indexOf(' ') + 1; + _returnCode = headerLine.substring(codePos, headerLine.indexOf(' ', codePos)).toInt(); } else if(headerLine.indexOf(':')) { String headerName = headerLine.substring(0, headerLine.indexOf(':')); String headerValue = headerLine.substring(headerLine.indexOf(':') + 1); @@ -1145,6 +1224,10 @@ int HTTPClient::handleHeaderResponse() transferEncoding = headerValue; } + if (headerName.equalsIgnoreCase("Location")) { + _location = headerValue; + } + for(size_t i = 0; i < _headerKeysCount; i++) { if(_currentHeaders[i].key.equalsIgnoreCase(headerName)) { _currentHeaders[i].value = headerValue; @@ -1322,3 +1405,52 @@ int HTTPClient::returnError(int error) } return error; } + +void HTTPClient::setFollowRedirects(followRedirects_t follow) +{ + _followRedirects = follow; +} + +void HTTPClient::setRedirectLimit(uint16_t limit) +{ + _redirectLimit = limit; +} + +/** + * set the URL to a new value. Handy for following redirects. + * @param url + */ +bool HTTPClient::setURL(const String& url) +{ + // if the new location is only a path then only update the URI + if (url && url[0] == '/') { + _uri = url; + clear(); + return true; + } + + if (!url.startsWith(_protocol + ':')) { + log_d("new URL not the same protocol, expected '%s', URL: '%s'\n", _protocol.c_str(), url.c_str()); + return false; + } + + // check if the port is specified + int indexPort = url.indexOf(':', 6); // find the first ':' excluding the one from the protocol + int indexURI = url.indexOf('/', 7); // find where the URI starts to make sure the ':' is not part of it + if (indexPort == -1 || indexPort > indexURI) { + // the port is not specified + _port = (_protocol == "https" ? 443 : 80); + } + + // disconnect but preserve _client. + // Also have to keep the connection otherwise it will free some of the memory used by _client + // and will blow up later when trying to do _client->available() or similar + _canReuse = true; + disconnect(true); + return beginInternal(url, _protocol.c_str()); +} + +const String &HTTPClient::getLocation(void) +{ + return _location; +} diff --git a/libraries/HTTPClient/src/HTTPClient.h b/libraries/HTTPClient/src/HTTPClient.h index e089bb54973..1b454e332a9 100644 --- a/libraries/HTTPClient/src/HTTPClient.h +++ b/libraries/HTTPClient/src/HTTPClient.h @@ -119,6 +119,24 @@ typedef enum { HTTPC_TE_CHUNKED } transferEncoding_t; +/** + * redirection follow mode. + * + `HTTPC_DISABLE_FOLLOW_REDIRECTS` - no redirection will be followed. + * + `HTTPC_STRICT_FOLLOW_REDIRECTS` - strict RFC2616, only requests using + * GET or HEAD methods will be redirected (using the same method), + * since the RFC requires end-user confirmation in other cases. + * + `HTTPC_FORCE_FOLLOW_REDIRECTS` - all redirections will be followed, + * regardless of a used method. New request will use the same method, + * and they will include the same body data and the same headers. + * In the sense of the RFC, it's just like every redirection is confirmed. + */ +typedef enum { + HTTPC_DISABLE_FOLLOW_REDIRECTS, + HTTPC_STRICT_FOLLOW_REDIRECTS, + HTTPC_FORCE_FOLLOW_REDIRECTS +} followRedirects_t; + + #ifdef HTTPCLIENT_1_1_COMPATIBLE class TransportTraits; typedef std::unique_ptr TransportTraitsPtr; @@ -156,6 +174,11 @@ class HTTPClient void setConnectTimeout(int32_t connectTimeout); void setTimeout(uint16_t timeout); + // Redirections + void setFollowRedirects(followRedirects_t follow); + void setRedirectLimit(uint16_t limit); // max redirects to follow for a single request + + bool setURL(const String &url); void useHTTP10(bool usehttp10 = true); /// request handling @@ -182,6 +205,7 @@ class HTTPClient int getSize(void); + const String &getLocation(void); WiFiClient& getStream(void); WiFiClient* getStreamPtr(void); @@ -235,6 +259,9 @@ class HTTPClient int _returnCode = 0; int _size = -1; bool _canReuse = false; + followRedirects_t _followRedirects = HTTPC_DISABLE_FOLLOW_REDIRECTS; + uint16_t _redirectLimit = 10; + String _location; transferEncoding_t _transferEncoding = HTTPC_TE_IDENTITY; }; diff --git a/libraries/HTTPUpdate/examples/httpUpdate/httpUpdate.ino b/libraries/HTTPUpdate/examples/httpUpdate/httpUpdate.ino index f646be04583..e98a5851366 100644 --- a/libraries/HTTPUpdate/examples/httpUpdate/httpUpdate.ino +++ b/libraries/HTTPUpdate/examples/httpUpdate/httpUpdate.ino @@ -52,7 +52,7 @@ void loop() { t_httpUpdate_return ret = httpUpdate.update(client, "http://server/file.bin"); // Or: - //t_httpUpdate_return ret = httpUpdate.update(client, "server", 80, "file.bin"); + //t_httpUpdate_return ret = httpUpdate.update(client, "server", 80, "/file.bin"); switch (ret) { case HTTP_UPDATE_FAILED: diff --git a/libraries/HTTPUpdate/examples/httpUpdateSecure/httpUpdateSecure.ino b/libraries/HTTPUpdate/examples/httpUpdateSecure/httpUpdateSecure.ino index 5daa2a4f2a1..1c85ace02a5 100644 --- a/libraries/HTTPUpdate/examples/httpUpdateSecure/httpUpdateSecure.ino +++ b/libraries/HTTPUpdate/examples/httpUpdateSecure/httpUpdateSecure.ino @@ -108,7 +108,7 @@ void loop() { t_httpUpdate_return ret = httpUpdate.update(client, "https://server/file.bin"); // Or: - //t_httpUpdate_return ret = httpUpdate.update(client, "server", 443, "file.bin"); + //t_httpUpdate_return ret = httpUpdate.update(client, "server", 443, "/file.bin"); switch (ret) { diff --git a/libraries/HTTPUpdateServer/examples/WebUpdater/WebUpdater.ino b/libraries/HTTPUpdateServer/examples/WebUpdater/WebUpdater.ino new file mode 100644 index 00000000000..f2503a7efe1 --- /dev/null +++ b/libraries/HTTPUpdateServer/examples/WebUpdater/WebUpdater.ino @@ -0,0 +1,51 @@ +/* + To upload through terminal you can use: curl -F "image=@firmware.bin" esp32-webupdate.local/update +*/ + +#include +#include +#include +#include +#include + +#ifndef STASSID +#define STASSID "your-ssid" +#define STAPSK "your-password" +#endif + +const char* host = "esp32-webupdate"; +const char* ssid = STASSID; +const char* password = STAPSK; + +WebServer httpServer(80); +HTTPUpdateServer httpUpdater; + +void setup(void) { + + Serial.begin(115200); + Serial.println(); + Serial.println("Booting Sketch..."); + WiFi.mode(WIFI_AP_STA); + WiFi.begin(ssid, password); + + while (WiFi.waitForConnectResult() != WL_CONNECTED) { + WiFi.begin(ssid, password); + Serial.println("WiFi failed, retrying."); + } + + MDNS.begin(host); + if (MDNS.begin("esp32")) { + Serial.println("mDNS responder started"); + } + + + httpUpdater.setup(&httpServer); + httpServer.begin(); + + MDNS.addService("http", "tcp", 80); + Serial.printf("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host); +} + +void loop(void) { + httpServer.handleClient(); +} \ No newline at end of file diff --git a/libraries/HTTPUpdateServer/keywords.txt b/libraries/HTTPUpdateServer/keywords.txt new file mode 100644 index 00000000000..a6f8a0c191c --- /dev/null +++ b/libraries/HTTPUpdateServer/keywords.txt @@ -0,0 +1,20 @@ +####################################### +# Syntax Coloring Map For HTTPUpdateServer +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +ESP32HTTPUpdateServer KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +begin KEYWORD2 +setup KEYWORD2 + +####################################### +# Constants (LITERAL1) +####################################### \ No newline at end of file diff --git a/libraries/HTTPUpdateServer/library.properties b/libraries/HTTPUpdateServer/library.properties new file mode 100644 index 00000000000..0601fd57ced --- /dev/null +++ b/libraries/HTTPUpdateServer/library.properties @@ -0,0 +1,9 @@ +name=HTTPUpdateServer +version=1.0 +author=Hristo Kapanakov +maintainer= +sentence=Simple HTTP Update server based on the WebServer +paragraph=The library accepts HTTP post requests to the /update url, and updates the ESP32 firmware. +category=Communication +url= +architectures=esp32 \ No newline at end of file diff --git a/libraries/HTTPUpdateServer/src/HTTPUpdateServer.h b/libraries/HTTPUpdateServer/src/HTTPUpdateServer.h new file mode 100644 index 00000000000..aa53ce6b0fe --- /dev/null +++ b/libraries/HTTPUpdateServer/src/HTTPUpdateServer.h @@ -0,0 +1,166 @@ +#ifndef __HTTP_UPDATE_SERVER_H +#define __HTTP_UPDATE_SERVER_H + +#include +#include +#include +#include + + +static const char serverIndex[] PROGMEM = +R"( + + + + + + + + Firmware:
+ + + +
+ FileSystem:
+ + + + + )"; +static const char successResponse[] PROGMEM = +"Update Success! Rebooting..."; + +class HTTPUpdateServer +{ +public: + HTTPUpdateServer(bool serial_debug=false) { + _serial_output = serial_debug; + _server = NULL; + _username = emptyString; + _password = emptyString; + _authenticated = false; + } + + void setup(WebServer *server) + { + setup(server, emptyString, emptyString); + } + + void setup(WebServer *server, const String& path) + { + setup(server, path, emptyString, emptyString); + } + + void setup(WebServer *server, const String& username, const String& password) + { + setup(server, "/update", username, password); + } + + void setup(WebServer *server, const String& path, const String& username, const String& password) + { + + _server = server; + _username = username; + _password = password; + + // handler for the /update form page + _server->on(path.c_str(), HTTP_GET, [&]() { + if (_username != emptyString && _password != emptyString && !_server->authenticate(_username.c_str(), _password.c_str())) + return _server->requestAuthentication(); + _server->send_P(200, PSTR("text/html"), serverIndex); + }); + + // handler for the /update form POST (once file upload finishes) + _server->on(path.c_str(), HTTP_POST, [&]() { + if (!_authenticated) + return _server->requestAuthentication(); + if (Update.hasError()) { + _server->send(200, F("text/html"), String(F("Update error: ")) + _updaterError); + } + else { + _server->client().setNoDelay(true); + _server->send_P(200, PSTR("text/html"), successResponse); + delay(100); + _server->client().stop(); + ESP.restart(); + } + }, [&]() { + // handler for the file upload, get's the sketch bytes, and writes + // them through the Update object + HTTPUpload& upload = _server->upload(); + + if (upload.status == UPLOAD_FILE_START) { + _updaterError.clear(); + if (_serial_output) + Serial.setDebugOutput(true); + + _authenticated = (_username == emptyString || _password == emptyString || _server->authenticate(_username.c_str(), _password.c_str())); + if (!_authenticated) { + if (_serial_output) + Serial.printf("Unauthenticated Update\n"); + return; + } + + if (_serial_output) + Serial.printf("Update: %s\n", upload.filename.c_str()); + if (upload.name == "filesystem") { + if (!Update.begin(SPIFFS.totalBytes(), U_SPIFFS)) {//start with max available size + if (_serial_output) Update.printError(Serial); + } + } + else { + uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; + if (!Update.begin(maxSketchSpace, U_FLASH)) {//start with max available size + _setUpdaterError(); + } + } + } + else if (_authenticated && upload.status == UPLOAD_FILE_WRITE && !_updaterError.length()) { + if (_serial_output) Serial.printf("."); + if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) { + _setUpdaterError(); + } + } + else if (_authenticated && upload.status == UPLOAD_FILE_END && !_updaterError.length()) { + if (Update.end(true)) { //true to set the size to the current progress + if (_serial_output) Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize); + } + else { + _setUpdaterError(); + } + if (_serial_output) Serial.setDebugOutput(false); + } + else if (_authenticated && upload.status == UPLOAD_FILE_ABORTED) { + Update.end(); + if (_serial_output) Serial.println("Update was aborted"); + } + delay(0); + }); + } + + void updateCredentials(const String& username, const String& password) + { + _username = username; + _password = password; + } + +protected: + void _setUpdaterError() + { + if (_serial_output) Update.printError(Serial); + StreamString str; + Update.printError(str); + _updaterError = str.c_str(); + } + +private: + bool _serial_output; + WebServer *_server; + String _username; + String _password; + bool _authenticated; + String _updaterError; +}; + + +#endif \ No newline at end of file diff --git a/libraries/Preferences/src/Preferences.cpp b/libraries/Preferences/src/Preferences.cpp index f06e9d0862a..6b45d2c7db1 100644 --- a/libraries/Preferences/src/Preferences.cpp +++ b/libraries/Preferences/src/Preferences.cpp @@ -15,7 +15,7 @@ #include "nvs.h" -const char * nvs_errors[] = { "OTHER", "NOT_INITIALIZED", "NOT_FOUND", "TYPE_MISMATCH", "READ_ONLY", "NOT_ENOUGH_SPACE", "INVALID_NAME", "INVALID_HANDLE", "REMOVE_FAILED", "KEY_TOO_LONG", "PAGE_FULL", "INVALID_STATE", "INVALID_LENGHT"}; +const char * nvs_errors[] = { "OTHER", "NOT_INITIALIZED", "NOT_FOUND", "TYPE_MISMATCH", "READ_ONLY", "NOT_ENOUGH_SPACE", "INVALID_NAME", "INVALID_HANDLE", "REMOVE_FAILED", "KEY_TOO_LONG", "PAGE_FULL", "INVALID_STATE", "INVALID_LENGTH"}; #define nvs_error(e) (((e)>ESP_ERR_NVS_BASE)?nvs_errors[(e)&~(ESP_ERR_NVS_BASE)]:nvs_errors[0]) Preferences::Preferences() @@ -280,6 +280,30 @@ size_t Preferences::putBytes(const char* key, const void* value, size_t len){ return len; } +PreferenceType Preferences::getType(const char* key) { + if(!_started || !key || strlen(key)>15){ + return PT_INVALID; + } + int8_t mt1; uint8_t mt2; int16_t mt3; uint16_t mt4; + int32_t mt5; uint32_t mt6; int64_t mt7; uint64_t mt8; + size_t len = 0; + if(nvs_get_i8(_handle, key, &mt1) == ESP_OK) return PT_I8; + if(nvs_get_u8(_handle, key, &mt2) == ESP_OK) return PT_U8; + if(nvs_get_i16(_handle, key, &mt3) == ESP_OK) return PT_I16; + if(nvs_get_u16(_handle, key, &mt4) == ESP_OK) return PT_U16; + if(nvs_get_i32(_handle, key, &mt5) == ESP_OK) return PT_I32; + if(nvs_get_u32(_handle, key, &mt6) == ESP_OK) return PT_U32; + if(nvs_get_i64(_handle, key, &mt7) == ESP_OK) return PT_I64; + if(nvs_get_u64(_handle, key, &mt8) == ESP_OK) return PT_U64; + if(nvs_get_str(_handle, key, NULL, &len) == ESP_OK) return PT_STR; + if(nvs_get_blob(_handle, key, NULL, &len) == ESP_OK) return PT_BLOB; + return PT_INVALID; +} + +bool Preferences::isKey(const char* key) { + return getType(key) != PT_INVALID; +} + /* * Get a key value * */ diff --git a/libraries/Preferences/src/Preferences.h b/libraries/Preferences/src/Preferences.h index 0ad94afbbad..1b8be270dd4 100644 --- a/libraries/Preferences/src/Preferences.h +++ b/libraries/Preferences/src/Preferences.h @@ -16,6 +16,10 @@ #include "Arduino.h" +typedef enum { + PT_I8, PT_U8, PT_I16, PT_U16, PT_I32, PT_U32, PT_I64, PT_U64, PT_STR, PT_BLOB, PT_INVALID +} PreferenceType; + class Preferences { protected: uint32_t _handle; @@ -48,6 +52,8 @@ class Preferences { size_t putString(const char* key, String value); size_t putBytes(const char* key, const void* value, size_t len); + bool isKey(const char* key); + PreferenceType getType(const char* key); int8_t getChar(const char* key, int8_t defaultValue = 0); uint8_t getUChar(const char* key, uint8_t defaultValue = 0); int16_t getShort(const char* key, int16_t defaultValue = 0); @@ -63,7 +69,7 @@ class Preferences { bool getBool(const char* key, bool defaultValue = false); size_t getString(const char* key, char* value, size_t maxLen); String getString(const char* key, String defaultValue = String()); - size_t getBytesLength(const char* key); + size_t getBytesLength(const char* key); size_t getBytes(const char* key, void * buf, size_t maxLen); size_t freeEntries(); }; diff --git a/libraries/SD/src/sd_diskio.cpp b/libraries/SD/src/sd_diskio.cpp index 0a9c86cc5f0..fea10fcb6ef 100644 --- a/libraries/SD/src/sd_diskio.cpp +++ b/libraries/SD/src/sd_diskio.cpp @@ -648,6 +648,7 @@ uint8_t sdcard_uninit(uint8_t pdrv) if (pdrv >= FF_VOLUMES || card == NULL) { return 1; } + sdTransaction(pdrv, GO_IDLE_STATE, 0, NULL); ff_diskio_register(pdrv, NULL); s_cards[pdrv] = NULL; esp_err_t err = ESP_OK; diff --git a/libraries/SPI/src/SPI.h b/libraries/SPI/src/SPI.h index 416fb363290..33bf5886acb 100644 --- a/libraries/SPI/src/SPI.h +++ b/libraries/SPI/src/SPI.h @@ -1,5 +1,5 @@ /* - SPI.h - SPI library for esp8266 + SPI.h - SPI library for esp32 Copyright (c) 2015 Hristo Gochkov. All rights reserved. This file is part of the esp8266 core for Arduino environment. @@ -25,6 +25,8 @@ #include "pins_arduino.h" #include "esp32-hal-spi.h" +#define SPI_HAS_TRANSACTION + class SPISettings { public: diff --git a/libraries/SPIFFS/src/SPIFFS.cpp b/libraries/SPIFFS/src/SPIFFS.cpp index db97fa2bf94..d3e1665491a 100644 --- a/libraries/SPIFFS/src/SPIFFS.cpp +++ b/libraries/SPIFFS/src/SPIFFS.cpp @@ -43,21 +43,38 @@ bool SPIFFSImpl::exists(const char* path) return (f == true) && !f.isDirectory(); } -SPIFFSFS::SPIFFSFS() : FS(FSImplPtr(new SPIFFSImpl())) +SPIFFSFS::SPIFFSFS() : FS(FSImplPtr(new SPIFFSImpl())), partitionLabel_(NULL) { } -bool SPIFFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles) +SPIFFSFS::~SPIFFSFS() { - if(esp_spiffs_mounted(NULL)){ + if (partitionLabel_){ + free(partitionLabel_); + partitionLabel_ = NULL; + } +} + +bool SPIFFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles, const char * partitionLabel) +{ + if (partitionLabel_){ + free(partitionLabel_); + partitionLabel_ = NULL; + } + + if (partitionLabel){ + partitionLabel_ = strdup(partitionLabel); + } + + if(esp_spiffs_mounted(partitionLabel_)){ log_w("SPIFFS Already Mounted!"); return true; } esp_vfs_spiffs_conf_t conf = { .base_path = basePath, - .partition_label = NULL, + .partition_label = partitionLabel_, .max_files = maxOpenFiles, .format_if_mount_failed = false }; @@ -78,8 +95,8 @@ bool SPIFFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFi void SPIFFSFS::end() { - if(esp_spiffs_mounted(NULL)){ - esp_err_t err = esp_vfs_spiffs_unregister(NULL); + if(esp_spiffs_mounted(partitionLabel_)){ + esp_err_t err = esp_vfs_spiffs_unregister(partitionLabel_); if(err){ log_e("Unmounting SPIFFS failed! Error: %d", err); return; @@ -91,7 +108,7 @@ void SPIFFSFS::end() bool SPIFFSFS::format() { disableCore0WDT(); - esp_err_t err = esp_spiffs_format(NULL); + esp_err_t err = esp_spiffs_format(partitionLabel_); enableCore0WDT(); if(err){ log_e("Formatting SPIFFS failed! Error: %d", err); @@ -103,7 +120,7 @@ bool SPIFFSFS::format() size_t SPIFFSFS::totalBytes() { size_t total,used; - if(esp_spiffs_info(NULL, &total, &used)){ + if(esp_spiffs_info(partitionLabel_, &total, &used)){ return 0; } return total; @@ -112,7 +129,7 @@ size_t SPIFFSFS::totalBytes() size_t SPIFFSFS::usedBytes() { size_t total,used; - if(esp_spiffs_info(NULL, &total, &used)){ + if(esp_spiffs_info(partitionLabel_, &total, &used)){ return 0; } return used; diff --git a/libraries/SPIFFS/src/SPIFFS.h b/libraries/SPIFFS/src/SPIFFS.h index 7d35da0439a..4d7eb5da688 100644 --- a/libraries/SPIFFS/src/SPIFFS.h +++ b/libraries/SPIFFS/src/SPIFFS.h @@ -23,11 +23,15 @@ class SPIFFSFS : public FS { public: SPIFFSFS(); - bool begin(bool formatOnFail=false, const char * basePath="/spiffs", uint8_t maxOpenFiles=10); + ~SPIFFSFS(); + bool begin(bool formatOnFail=false, const char * basePath="/spiffs", uint8_t maxOpenFiles=10, const char * partitionLabel=NULL); bool format(); size_t totalBytes(); size_t usedBytes(); void end(); + +private: + char * partitionLabel_; }; } diff --git a/libraries/Update/examples/HTTPS_OTA_Update/HTTPS_OTA_Update.ino b/libraries/Update/examples/HTTPS_OTA_Update/HTTPS_OTA_Update.ino new file mode 100644 index 00000000000..6e32ee5bd58 --- /dev/null +++ b/libraries/Update/examples/HTTPS_OTA_Update/HTTPS_OTA_Update.ino @@ -0,0 +1,98 @@ +// This sketch provide the functionality of OTA Firmware Upgrade +#include "WiFi.h" +#include "HttpsOTAUpdate.h" +// This sketch shows how to implement HTTPS firmware update Over The Air. +// Please provide your WiFi credentials, https URL to the firmware image and the server certificate. + +static const char *ssid = "your-ssid"; // your network SSID (name of wifi network) +static const char *password = "your-password"; // your network password + +static const char *url = "https://example.com/firmware.bin"; //state url of your firmware image + +static const char *server_certificate = "-----BEGIN CERTIFICATE-----\n" \ + "MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\n" \ + "MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n" \ + "DkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\n" \ + "SjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\n" \ + "GkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\n" \ + "AQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\n" \ + "q6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\n" \ + "SMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\n" \ + "Z8h/pZq4UmEUEz9l6YKHy9v6Dlb2honzhT+Xhq+w3Brvaw2VFn3EK6BlspkENnWA\n" \ + "a6xK8xuQSXgvopZPKiAlKQTGdMDQMc2PMTiVFrqoM7hD8bEfwzB/onkxEz0tNvjj\n" \ + "/PIzark5McWvxI0NHWQWM6r6hCm21AvA2H3DkwIDAQABo4IBfTCCAXkwEgYDVR0T\n" \ + "AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYwfwYIKwYBBQUHAQEEczBxMDIG\n" \ + "CCsGAQUFBzABhiZodHRwOi8vaXNyZy50cnVzdGlkLm9jc3AuaWRlbnRydXN0LmNv\n" \ + "bTA7BggrBgEFBQcwAoYvaHR0cDovL2FwcHMuaWRlbnRydXN0LmNvbS9yb290cy9k\n" \ + "c3Ryb290Y2F4My5wN2MwHwYDVR0jBBgwFoAUxKexpHsscfrb4UuQdf/EFWCFiRAw\n" \ + "VAYDVR0gBE0wSzAIBgZngQwBAgEwPwYLKwYBBAGC3xMBAQEwMDAuBggrBgEFBQcC\n" \ + "ARYiaHR0cDovL2Nwcy5yb290LXgxLmxldHNlbmNyeXB0Lm9yZzA8BgNVHR8ENTAz\n" \ + "MDGgL6AthitodHRwOi8vY3JsLmlkZW50cnVzdC5jb20vRFNUUk9PVENBWDNDUkwu\n" \ + "Y3JsMB0GA1UdDgQWBBSoSmpjBH3duubRObemRWXv86jsoTANBgkqhkiG9w0BAQsF\n" \ + "AAOCAQEA3TPXEfNjWDjdGBX7CVW+dla5cEilaUcne8IkCJLxWh9KEik3JHRRHGJo\n" \ + "uM2VcGfl96S8TihRzZvoroed6ti6WqEBmtzw3Wodatg+VyOeph4EYpr/1wXKtx8/\n" \ + "wApIvJSwtmVi4MFU5aMqrSDE6ea73Mj2tcMyo5jMd6jmeWUHK8so/joWUoHOUgwu\n" \ + "X4Po1QYz+3dszkDqMp4fklxBwXRsW10KXzPMTZ+sOPAveyxindmjkW8lGy+QsRlG\n" \ + "PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6\n" \ + "KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n" \ + "-----END CERTIFICATE-----"; + +static HttpsOTAStatus_t otastatus; + +void HttpEvent(HttpEvent_t *event) +{ + switch(event->event_id) { + case HTTP_EVENT_ERROR: + Serial.println("Http Event Error"); + break; + case HTTP_EVENT_ON_CONNECTED: + Serial.println("Http Event On Connected"); + break; + case HTTP_EVENT_HEADER_SENT: + Serial.println("Http Event Header Sent"); + break; + case HTTP_EVENT_ON_HEADER: + Serial.printf("Http Event On Header, key=%s, value=%s\n", event->header_key, event->header_value); + break; + case HTTP_EVENT_ON_DATA: + break; + case HTTP_EVENT_ON_FINISH: + Serial.println("Http Event On Finish"); + break; + case HTTP_EVENT_DISCONNECTED: + Serial.println("Http Event Disconnected"); + break; + } +} + +void setup(){ + + Serial.begin(115200); + Serial.print("Attempting to connect to SSID: "); + WiFi.begin(ssid, password); + + // attempt to connect to Wifi network: + while (WiFi.status() != WL_CONNECTED) { + Serial.print("."); + delay(1000); + } + + Serial.print("Connected to "); + Serial.println(ssid); + + HttpsOTA.onHttpEvent(HttpEvent); + Serial.println("Starting OTA"); + HttpsOTA.begin(url, server_certificate); + + Serial.println("Please Wait it takes some time ..."); +} + +void loop(){ + otastatus = HttpsOTA.status(); + if(otastatus == HTTPS_OTA_SUCCESS) { + Serial.println("Firmware written successfully. To reboot device, call API ESP.restart() or PUSH restart button on device"); + } else if(otastatus == HTTPS_OTA_FAIL) { + Serial.println("Firmware Upgrade Fail"); + } + delay(1000); +} diff --git a/libraries/Update/examples/HTTPS_OTA_Update/Readme.md b/libraries/Update/examples/HTTPS_OTA_Update/Readme.md new file mode 100644 index 00000000000..27fdb59612b --- /dev/null +++ b/libraries/Update/examples/HTTPS_OTA_Update/Readme.md @@ -0,0 +1,32 @@ +# OTA Firmware Upgrade for Arduino +This sketch allows Arduino user to perform Over The Air (OTA) firmware upgrade. It uses HTTPS. + +# API introduced for OTA + +## HttpsOTA.begin(const char * url, const char * server_certificate, bool skip_cert_common_name_check) + +Main API which starts firmware upgrade + +### Parameters +* url : URL for the uploaded firmware image +* server_certificate : Provide the ota server certificate for authentication via HTTPS +* skip_cert_common_name_check : Skip any validation of server certificate CN field + +The default value provided to skip_cert_common_name_check is true + +## HttpsOTA.onHttpEvent(function) + +This API exposes HTTP Events to the user + +### Parameter +Function passed has following signature +void HttpEvent (HttpEvent_t * event); + +# HttpsOTA.otaStatus() + +It tracks the progress of OTA firmware upgrade. +* HTTPS_OTA_IDLE : OTA upgrade have not started yet. +* HTTPS_OTA_UPDATNG : OTA upgarde is in progress. +* HTTPS_OTA_SUCCESS : OTA upgrade is successful. +* HTTPS_OTA_FAIL : OTA upgrade failed. +* HTTPS_OTA_ERR : Error occured while creating xEventGroup(). diff --git a/libraries/Update/src/HttpsOTAUpdate.cpp b/libraries/Update/src/HttpsOTAUpdate.cpp new file mode 100644 index 00000000000..574b054c721 --- /dev/null +++ b/libraries/Update/src/HttpsOTAUpdate.cpp @@ -0,0 +1,107 @@ +/* OTA task + + 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. +*/ +#include +#include + +#include +#include + +#include "esp32-hal-log.h" +#include "esp_http_client.h" +#include "esp_https_ota.h" + +#include "HttpsOTAUpdate.h" +#include "Esp.h" +#define OTA_TASK_STACK_SIZE 9216 + +typedef void (*HttpEventCb)(HttpEvent_t*); + +static esp_http_client_config_t config; +static HttpEventCb cb; +static EventGroupHandle_t ota_status = NULL;//check for ota status +static EventBits_t set_bit; + +const int OTA_IDLE_BIT = BIT0; +const int OTA_UPDATING_BIT = BIT1; +const int OTA_SUCCESS_BIT = BIT2; +const int OTA_FAIL_BIT = BIT3; + +esp_err_t http_event_handler(esp_http_client_event_t *event) +{ + cb(event); + return ESP_OK; +} + +void https_ota_task(void *param) +{ + if(ota_status) { + 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); + if(ret == ESP_OK) { + if(ota_status) { + xEventGroupClearBits(ota_status, OTA_UPDATING_BIT); + xEventGroupSetBits(ota_status, OTA_SUCCESS_BIT); + } + } else { + if(ota_status) { + xEventGroupClearBits(ota_status, OTA_UPDATING_BIT); + xEventGroupSetBits(ota_status, OTA_FAIL_BIT); + } + } + vTaskDelete(NULL); +} + +HttpsOTAStatus_t HttpsOTAUpdateClass::status() +{ + if(ota_status) { + set_bit = xEventGroupGetBits(ota_status); + if(set_bit == OTA_IDLE_BIT) { + return HTTPS_OTA_IDLE; + } + if(set_bit == OTA_UPDATING_BIT) { + return HTTPS_OTA_UPDATING; + } + if(set_bit == OTA_SUCCESS_BIT) { + return HTTPS_OTA_SUCCESS; + } + if(set_bit == OTA_FAIL_BIT) { + return HTTPS_OTA_FAIL; + } + } + return HTTPS_OTA_ERR; +} + +void HttpsOTAUpdateClass::onHttpEvent(HttpEventCb cbEvent) +{ + cb = cbEvent; +} + +void HttpsOTAUpdateClass::begin(const char *url, const char *cert_pem, bool skip_cert_common_name_check) +{ + config.url = url; + config.cert_pem = cert_pem; + config.skip_cert_common_name_check = skip_cert_common_name_check; + config.event_handler = http_event_handler; + + if(!ota_status) { + ota_status = xEventGroupCreate(); + if(!ota_status) { + log_e("OTA Event Group Create Failed"); + } + xEventGroupSetBits(ota_status, OTA_IDLE_BIT); + } + + if (xTaskCreate(&https_ota_task, "https_ota_task", OTA_TASK_STACK_SIZE, &config, 5, NULL) != pdPASS) { + log_e("Couldn't create ota task\n"); + } +} + +HttpsOTAUpdateClass HttpsOTA; diff --git a/libraries/Update/src/HttpsOTAUpdate.h b/libraries/Update/src/HttpsOTAUpdate.h new file mode 100644 index 00000000000..bc52a3055ce --- /dev/null +++ b/libraries/Update/src/HttpsOTAUpdate.h @@ -0,0 +1,21 @@ +#include "esp_http_client.h" +#define HttpEvent_t esp_http_client_event_t + +typedef enum +{ + HTTPS_OTA_IDLE, + HTTPS_OTA_UPDATING, + HTTPS_OTA_SUCCESS, + HTTPS_OTA_FAIL, + HTTPS_OTA_ERR +}HttpsOTAStatus_t; + +class HttpsOTAUpdateClass { + + public: + void begin(const char *url, const char *cert_pem, bool skip_cert_common_name_check = true); + void onHttpEvent(void (*http_event_cb_t)(HttpEvent_t *)); + HttpsOTAStatus_t status(); +}; + +extern HttpsOTAUpdateClass HttpsOTA; diff --git a/libraries/Update/src/Update.h b/libraries/Update/src/Update.h index 9a46a784870..15c7624c46d 100644 --- a/libraries/Update/src/Update.h +++ b/libraries/Update/src/Update.h @@ -26,6 +26,8 @@ #define U_SPIFFS 100 #define U_AUTH 200 +#define ENCRYPTED_BLOCK_SIZE 16 + class UpdateClass { public: typedef std::function THandlerFunction_Progress; @@ -41,7 +43,7 @@ class UpdateClass { Call this to check the space needed for the update Will return false if there is not enough space */ - bool begin(size_t size=UPDATE_SIZE_UNKNOWN, int command = U_FLASH, int ledPin = -1, uint8_t ledOn = LOW); + bool begin(size_t size=UPDATE_SIZE_UNKNOWN, int command = U_FLASH, int ledPin = -1, uint8_t ledOn = LOW, const char *label = NULL); /* Writes a buffer to the flash and increments the address @@ -78,7 +80,7 @@ class UpdateClass { /* Prints the last error to an output stream */ - void printError(Stream &out); + void printError(Print &out); const char * errorString(); @@ -88,12 +90,12 @@ class UpdateClass { bool setMD5(const char * expected_md5); /* - returns the MD5 String of the sucessfully ended firmware + returns the MD5 String of the successfully ended firmware */ String md5String(void){ return _md5.toString(); } /* - populated the result with the md5 bytes of the sucessfully ended firmware + populated the result with the md5 bytes of the successfully ended firmware */ void md5(uint8_t * result){ return _md5.getBytes(result); } @@ -163,10 +165,12 @@ class UpdateClass { bool _writeBuffer(); bool _verifyHeader(uint8_t data); bool _verifyEnd(); + bool _enablePartition(const esp_partition_t* partition); uint8_t _error; uint8_t *_buffer; + uint8_t *_skipBuffer; size_t _bufferLen; size_t _size; THandlerFunction_Progress _progress_callback; diff --git a/libraries/Update/src/Updater.cpp b/libraries/Update/src/Updater.cpp index cfa28827e96..7369de93733 100644 --- a/libraries/Update/src/Updater.cpp +++ b/libraries/Update/src/Updater.cpp @@ -36,11 +36,11 @@ static const char * _err2str(uint8_t _error){ } static bool _partitionIsBootable(const esp_partition_t* partition){ - uint8_t buf[4]; + uint8_t buf[ENCRYPTED_BLOCK_SIZE]; if(!partition){ return false; } - if(!ESP.flashRead(partition->address, (uint32_t*)buf, 4)) { + if(!ESP.partitionRead(partition, 0, (uint32_t*)buf, ENCRYPTED_BLOCK_SIZE)) { return false; } @@ -50,17 +50,11 @@ static bool _partitionIsBootable(const esp_partition_t* partition){ return true; } -static bool _enablePartition(const esp_partition_t* partition){ - uint8_t buf[4]; +bool UpdateClass::_enablePartition(const esp_partition_t* partition){ if(!partition){ return false; } - if(!ESP.flashRead(partition->address, (uint32_t*)buf, 4)) { - return false; - } - buf[0] = ESP_IMAGE_HEADER_MAGIC; - - return ESP.flashWrite(partition->address, (uint32_t*)buf, 4); + return ESP.partitionWrite(partition, 0, (uint32_t*) _skipBuffer, ENCRYPTED_BLOCK_SIZE); } UpdateClass::UpdateClass() @@ -110,7 +104,7 @@ bool UpdateClass::rollBack(){ return _partitionIsBootable(partition) && !esp_ota_set_boot_partition(partition); } -bool UpdateClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) { +bool UpdateClass::begin(size_t size, int command, int ledPin, uint8_t ledOn, const char *label) { if(_size > 0){ log_w("already running"); return false; @@ -121,6 +115,8 @@ bool UpdateClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) { _reset(); _error = 0; + _target_md5 = emptyString; + _md5 = MD5Builder(); if(size == 0) { _error = UPDATE_ERROR_SIZE; @@ -136,7 +132,7 @@ bool UpdateClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) { log_d("OTA Partition: %s", _partition->label); } else if (command == U_SPIFFS) { - _partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_SPIFFS, NULL); + _partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_SPIFFS, label); if(!_partition){ _error = UPDATE_ERROR_NO_PARTITION; return false; @@ -179,24 +175,33 @@ void UpdateClass::abort(){ bool UpdateClass::_writeBuffer(){ //first bytes of new firmware + uint8_t skip = 0; if(!_progress && _command == U_FLASH){ //check magic if(_buffer[0] != ESP_IMAGE_HEADER_MAGIC){ _abort(UPDATE_ERROR_MAGIC_BYTE); return false; } - //remove magic byte from the firmware now and write it upon success - //this ensures that partially written firmware will not be bootable - _buffer[0] = 0xFF; + + //Stash the first 16 bytes of data and set the offset so they are + //not written at this point so that partially written firmware + //will not be bootable + skip = ENCRYPTED_BLOCK_SIZE; + _skipBuffer = (uint8_t*)malloc(skip); + if(!_skipBuffer){ + log_e("malloc failed"); + return false; + } + memcpy(_skipBuffer, _buffer, skip); } if (!_progress && _progress_callback) { _progress_callback(0, _size); } - if(!ESP.flashEraseSector((_partition->address + _progress)/SPI_FLASH_SEC_SIZE)){ + if(!ESP.partitionEraseRange(_partition, _progress, SPI_FLASH_SEC_SIZE)){ _abort(UPDATE_ERROR_ERASE); return false; } - if (!ESP.flashWrite(_partition->address + _progress, (uint32_t*)_buffer, _bufferLen)) { + if (!ESP.partitionWrite(_partition, _progress + skip, (uint32_t*)_buffer + skip/sizeof(uint32_t), _bufferLen - skip)) { _abort(UPDATE_ERROR_WRITE); return false; } @@ -318,6 +323,8 @@ size_t UpdateClass::write(uint8_t *data, size_t len) { size_t UpdateClass::writeStream(Stream &data) { size_t written = 0; size_t toRead = 0; + int timeout_failures = 0; + if(hasError() || !isRunning()) return 0; @@ -339,15 +346,24 @@ size_t UpdateClass::writeStream(Stream &data) { bytesToRead = remaining(); } - toRead = data.readBytes(_buffer + _bufferLen, bytesToRead); - if(toRead == 0) { //Timeout - delay(100); - toRead = data.readBytes(_buffer + _bufferLen, bytesToRead); - if(toRead == 0) { //Timeout - _abort(UPDATE_ERROR_STREAM); - return written; + /* + Init read&timeout counters and try to read, if read failed, increase counter, + wait 100ms and try to read again. If counter > 300 (30 sec), give up/abort + */ + toRead = 0; + timeout_failures = 0; + while(!toRead) { + toRead = data.readBytes(_buffer + _bufferLen, bytesToRead); + if(toRead == 0) { + timeout_failures++; + if (timeout_failures >= 300) { + _abort(UPDATE_ERROR_STREAM); + return written; + } + delay(100); } } + if(_ledPin != -1) { digitalWrite(_ledPin, !_ledOn); // Switch LED off } @@ -359,7 +375,7 @@ size_t UpdateClass::writeStream(Stream &data) { return written; } -void UpdateClass::printError(Stream &out){ +void UpdateClass::printError(Print &out){ out.println(_err2str(_error)); } diff --git a/libraries/WebServer/examples/HelloServer/HelloServer.ino b/libraries/WebServer/examples/HelloServer/HelloServer.ino index f67b049c3ce..1a1180c2593 100644 --- a/libraries/WebServer/examples/HelloServer/HelloServer.ino +++ b/libraries/WebServer/examples/HelloServer/HelloServer.ino @@ -12,7 +12,7 @@ const int led = 13; void handleRoot() { digitalWrite(led, 1); - server.send(200, "text/plain", "hello from esp8266!"); + server.send(200, "text/plain", "hello from esp32!"); digitalWrite(led, 0); } diff --git a/libraries/WebServer/examples/PathArgServer/PathArgServer.ino b/libraries/WebServer/examples/PathArgServer/PathArgServer.ino index 6e120c3f801..0b4dc425869 100644 --- a/libraries/WebServer/examples/PathArgServer/PathArgServer.ino +++ b/libraries/WebServer/examples/PathArgServer/PathArgServer.ino @@ -32,7 +32,7 @@ void setup(void) { Serial.println("MDNS responder started"); } - server.on("/", []() { + server.on(F("/"), []() { server.send(200, "text/plain", "hello from esp32!"); }); diff --git a/libraries/WebServer/src/Parsing.cpp b/libraries/WebServer/src/Parsing.cpp index e2e9cc43b7e..1db2aef5541 100644 --- a/libraries/WebServer/src/Parsing.cpp +++ b/libraries/WebServer/src/Parsing.cpp @@ -356,9 +356,9 @@ bool WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){ client.readStringUntil('\n'); //start reading the form if (line == ("--"+boundary)){ - if(_postArgs) delete[] _postArgs; - _postArgs = new RequestArgument[WEBSERVER_MAX_POST_ARGS]; - _postArgsLen = 0; + if(_postArgs) delete[] _postArgs; + _postArgs = new RequestArgument[WEBSERVER_MAX_POST_ARGS]; + _postArgsLen = 0; while(1){ String argName; String argValue; @@ -413,6 +413,9 @@ bool WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){ if (line == ("--"+boundary+"--")){ log_v("Done Parsing POST"); break; + } else if (_postArgsLen >= WEBSERVER_MAX_POST_ARGS) { + log_e("Too many PostArgs (max: %d) in request.", WEBSERVER_MAX_POST_ARGS); + return false; } } else { _currentUpload.reset(new HTTPUpload()); @@ -458,7 +461,23 @@ bool WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){ } uint8_t endBuf[boundary.length()]; - client.readBytes(endBuf, boundary.length()); + uint32_t i = 0; + while(i < boundary.length()){ + argByte = _uploadReadByte(client); + if(argByte < 0) return _parseFormUploadAborted(); + if ((char)argByte == 0x0D){ + _uploadWriteByte(0x0D); + _uploadWriteByte(0x0A); + _uploadWriteByte((uint8_t)('-')); + _uploadWriteByte((uint8_t)('-')); + uint32_t j = 0; + while(j < i){ + _uploadWriteByte(endBuf[j++]); + } + goto readfile; + } + endBuf[i++] = (uint8_t)argByte; + } if (strstr((const char*)endBuf, boundary.c_str()) != NULL){ if(_currentHandler && _currentHandler->canUpload(_currentUri)) diff --git a/libraries/WebServer/src/Uri.h b/libraries/WebServer/src/Uri.h index 83772b2348e..d924a0bd0b1 100644 --- a/libraries/WebServer/src/Uri.h +++ b/libraries/WebServer/src/Uri.h @@ -12,6 +12,7 @@ class Uri { public: Uri(const char *uri) : _uri(uri) {} Uri(const String &uri) : _uri(uri) {} + Uri(const __FlashStringHelper *uri) : _uri(String(uri)) {} virtual ~Uri() {} virtual Uri* clone() const { diff --git a/libraries/WebServer/src/WebServer.cpp b/libraries/WebServer/src/WebServer.cpp index e686f2fcd8c..47e25239697 100644 --- a/libraries/WebServer/src/WebServer.cpp +++ b/libraries/WebServer/src/WebServer.cpp @@ -45,6 +45,7 @@ WebServer::WebServer(IPAddress addr, int port) , _currentVersion(0) , _currentStatus(HC_NONE) , _statusChange(0) +, _nullDelay(true) , _currentHandler(nullptr) , _firstHandler(nullptr) , _lastHandler(nullptr) @@ -66,6 +67,7 @@ WebServer::WebServer(int port) , _currentVersion(0) , _currentStatus(HC_NONE) , _statusChange(0) +, _nullDelay(true) , _currentHandler(nullptr) , _firstHandler(nullptr) , _lastHandler(nullptr) @@ -280,6 +282,9 @@ void WebServer::handleClient() { if (_currentStatus == HC_NONE) { WiFiClient client = _server.available(); if (!client) { + if (_nullDelay) { + delay(1); + } return; } @@ -370,6 +375,10 @@ void WebServer::setContentLength(const size_t contentLength) { _contentLength = contentLength; } +void WebServer::enableDelay(boolean value) { + _nullDelay = value; +} + void WebServer::enableCORS(boolean value) { _corsEnabled = value; } @@ -454,20 +463,23 @@ void WebServer::send(int code, const String& content_type, const String& content } void WebServer::sendContent(const String& content) { + sendContent(content.c_str(), content.length()); +} + +void WebServer::sendContent(const char* content, size_t contentLength) { const char * footer = "\r\n"; - size_t len = content.length(); if(_chunked) { char * chunkSize = (char *)malloc(11); if(chunkSize){ - sprintf(chunkSize, "%x%s", len, footer); + sprintf(chunkSize, "%x%s", contentLength, footer); _currentClientWrite(chunkSize, strlen(chunkSize)); free(chunkSize); } } - _currentClientWrite(content.c_str(), len); + _currentClientWrite(content, contentLength); if(_chunked){ _currentClient.write(footer, 2); - if (len == 0) { + if (contentLength == 0) { _chunked = false; } } diff --git a/libraries/WebServer/src/WebServer.h b/libraries/WebServer/src/WebServer.h index a0d3a1c1cfe..c169da82229 100644 --- a/libraries/WebServer/src/WebServer.h +++ b/libraries/WebServer/src/WebServer.h @@ -123,12 +123,14 @@ class WebServer void send_P(int code, PGM_P content_type, PGM_P content); void send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength); + void enableDelay(boolean value); void enableCORS(boolean value = true); void enableCrossOrigin(boolean value = true); void setContentLength(const size_t contentLength); void sendHeader(const String& name, const String& value, bool first = false); void sendContent(const String& content); + void sendContent(const char* content, size_t contentLength); void sendContent_P(PGM_P content); void sendContent_P(PGM_P content, size_t size); @@ -176,6 +178,7 @@ class WebServer uint8_t _currentVersion; HTTPClientStatus _currentStatus; unsigned long _statusChange; + boolean _nullDelay; RequestHandler* _currentHandler; RequestHandler* _firstHandler; diff --git a/libraries/WebServer/src/detail/RequestHandlersImpl.h b/libraries/WebServer/src/detail/RequestHandlersImpl.h index 153fbce63d0..27a2a8d328a 100644 --- a/libraries/WebServer/src/detail/RequestHandlersImpl.h +++ b/libraries/WebServer/src/detail/RequestHandlersImpl.h @@ -113,7 +113,7 @@ class StaticRequestHandler : public RequestHandler { } File f = _fs.open(path, "r"); - if (!f) + if (!f || !f.available()) return false; if (_cache_header.length() != 0) diff --git a/libraries/WiFi/examples/WPS/WPS.ino b/libraries/WiFi/examples/WPS/WPS.ino index 06ccbb38438..6b134375840 100644 --- a/libraries/WiFi/examples/WPS/WPS.ino +++ b/libraries/WiFi/examples/WPS/WPS.ino @@ -6,7 +6,7 @@ based WPS entry to get your ESP connected to your WiFi router. Hardware Requirements ======================== -ESP32 and a Router having atleast one WPS functionality +ESP32 and a Router having WPS functionality This code is under Public Domain License. @@ -63,7 +63,7 @@ void WiFiEvent(WiFiEvent_t event, system_event_info_t info){ WiFi.reconnect(); break; case SYSTEM_EVENT_STA_WPS_ER_SUCCESS: - Serial.println("WPS Successfull, stopping WPS and connecting to: " + String(WiFi.SSID())); + Serial.println("WPS Successful, stopping WPS and connecting to: " + String(WiFi.SSID())); esp_wifi_wps_disable(); delay(10); WiFi.begin(); @@ -75,7 +75,7 @@ void WiFiEvent(WiFiEvent_t event, system_event_info_t info){ esp_wifi_wps_start(0); break; case SYSTEM_EVENT_STA_WPS_ER_TIMEOUT: - Serial.println("WPS Timedout, retrying"); + Serial.println("WPS Timeout, retrying"); esp_wifi_wps_disable(); esp_wifi_wps_enable(&config); esp_wifi_wps_start(0); @@ -106,4 +106,4 @@ void setup(){ void loop(){ //nothing to do here -} \ No newline at end of file +} diff --git a/libraries/WiFi/examples/WiFiProv/README.md b/libraries/WiFi/examples/WiFiProv/README.md index 3c0c5dfea7d..0350de7af96 100644 --- a/libraries/WiFi/examples/WiFiProv/README.md +++ b/libraries/WiFi/examples/WiFiProv/README.md @@ -24,13 +24,13 @@ A function with following signature ## WiFi.beginProvision() -WiFi.beginProvision(scheme prov_scheme, wifi_prov_scheme_event_handler_t scheme_event_handler, wifi_prov_security_t security, char * pop, char * service_name, char * service_key, uint8_t * uuid); +WiFi.beginProvision(void ( * scheme_cb)(), wifi_prov_scheme_event_handler_t scheme_event_handler, wifi_prov_security_t security, char * pop, char * service_name, char * service_key, uint8_t * uuid); #### Parameters passed -* prov_scheme : choose the mode of transfer - * WIFI_PROV_SCHEME_BLE - Using BLE - * WIFI_PROV_SCHEME_SOFTAP - Using SoftAP +* function pointer : choose the mode of transfer + * provSchemeBLE - Using BLE + * provSchemeSoftAP - Using SoftAP * security : choose security type * WIFI_PROV_SECURITY_1 - It allows secure communication which consists of secure handshake using key exchange and proof of possession (pop) and encryption/decryption of messages. @@ -48,7 +48,7 @@ WiFi.beginProvision(scheme prov_scheme, wifi_prov_scheme_event_handler_t scheme_ * pop : It is the string that is used to provide the authentication. -* service_name : Specify service name for the device, if it is not specified then default chosen name via SoftAP is WIFI_XXX and via BLE is BLE_XXX where XXX are the last 3 bytes of the MAC address. +* service_name : Specify service name for the device, if it is not specified then default chosen name is PROV_XXX where XXX are the last 3 bytes of the MAC address. * service_key : Specify service key, if chosen mode of provisioning is BLE then service_key is always NULL @@ -63,7 +63,7 @@ WiFi.beginProvision(scheme prov_scheme, wifi_prov_scheme_event_handler_t scheme_ * scheme_event_handler = WIFI_PROV_EVENT_HANDLER_NONE * security = WIFI_PROV_SECURITY_1 * pop = "abcd1234" - * service_name = "WiFi_XXX" + * service_name = "PROV_XXX" * service_key = NULL * uuid = NULL @@ -79,7 +79,7 @@ https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/provis ``` [I][WiFiProv.cpp:117] beginProvision(): Starting AP using SOFTAP - service_name : WIFI_XXX + service_name : PROV_XXX password : 123456789 pop : abcd1234 @@ -100,7 +100,7 @@ Provisioning Ends ``` [I][WiFiProv.cpp:115] beginProvision(): Starting AP using BLE - service_name : BLE_XXX + service_name : PROV_XXX pop : abcd1234 Provisioning started @@ -119,8 +119,8 @@ Provisioning Ends ## Credentials are available on device ``` -[I][WiFiProv.cpp:125] beginProvision(): Aleardy Provisioned, starting Wi-Fi STA -[I][WiFiProv.cpp:126] beginProvision(): CONNECTING ACCESS POINT CREDENTIALS : -[I][WiFiProv.cpp:126] beginProvision(): SSID : GIONEE M2 - +[I][WiFiProv.cpp:146] beginProvision(): Aleardy Provisioned, starting Wi-Fi STA +[I][WiFiProv.cpp:150] beginProvision(): SSID : Wce***** +[I][WiFiProv.cpp:152] beginProvision(): CONNECTING TO THE ACCESS POINT : +Connected IP address : 192.168.43.120 ``` diff --git a/libraries/WiFi/examples/WiFiProv/WiFiProv.ino b/libraries/WiFi/examples/WiFiProv/WiFiProv.ino index 92b141b4a39..4b673ef06f9 100644 --- a/libraries/WiFi/examples/WiFiProv/WiFiProv.ino +++ b/libraries/WiFi/examples/WiFiProv/WiFiProv.ino @@ -56,7 +56,8 @@ void setup() { /* uint8_t uuid[16] = {0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf, 0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02 };*/ WiFi.onEvent(SysProvEvent); - WiFi.beginProvision(WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, "abcd1234", "BLE_XXX", NULL, NULL); + //WiFi.beginProvision(provSchemeBLE, WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, "abcd1234", "PROV_XXX", NULL, NULL); + WiFi.beginProvision(provSchemeSoftAP, WIFI_PROV_EVENT_HANDLER_NONE, WIFI_PROV_SECURITY_1, "abcd1234", NULL, NULL, NULL); } void loop() { diff --git a/libraries/WiFi/src/ETH.cpp b/libraries/WiFi/src/ETH.cpp index 2ffea758ded..d3ee9a670e4 100644 --- a/libraries/WiFi/src/ETH.cpp +++ b/libraries/WiFi/src/ETH.cpp @@ -193,8 +193,8 @@ IPAddress ETHClass::gatewayIP() IPAddress ETHClass::dnsIP(uint8_t dns_no) { - ip_addr_t dns_ip = dns_getserver(dns_no); - return IPAddress(dns_ip.u_addr.ip4.addr); + const ip_addr_t* dns_ip = dns_getserver(dns_no); + return IPAddress(dns_ip->u_addr.ip4.addr); } IPAddress ETHClass::broadcastIP() diff --git a/libraries/WiFi/src/WiFiClient.cpp b/libraries/WiFi/src/WiFiClient.cpp index e422b63673d..52df273149a 100644 --- a/libraries/WiFi/src/WiFiClient.cpp +++ b/libraries/WiFi/src/WiFiClient.cpp @@ -105,7 +105,7 @@ class WiFiClientRxBuffer { int read(uint8_t * dst, size_t len){ if(!dst || !len || (_pos == _fill && !fillBuffer())){ - return -1; + return _failed ? -1 : 0; } size_t a = _fill - _pos; if(len <= a || ((len - a) <= (_size - _fill) && fillBuffer() >= (len - a))){ @@ -346,6 +346,9 @@ int WiFiClient::read() if(res < 0) { return res; } + if (res == 0) { // No data available. + return -1; + } return data; } diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index 05458a26c7d..1362a65bee9 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -574,7 +574,7 @@ bool WiFiGenericClass::mode(wifi_mode_t m) */ wifi_mode_t WiFiGenericClass::getMode() { - if(!lowLevelInitDone){ + if(!lowLevelInitDone || !_esp_wifi_started){ return WIFI_MODE_NULL; } wifi_mode_t mode; @@ -639,6 +639,20 @@ bool WiFiGenericClass::setSleep(bool enable) return esp_wifi_set_ps(enable?WIFI_PS_MIN_MODEM:WIFI_PS_NONE) == ESP_OK; } +/** + * control modem sleep when only in STA mode + * @param mode wifi_ps_type_t + * @return ok + */ +bool WiFiGenericClass::setSleep(wifi_ps_type_t mode) +{ + if((getMode() & WIFI_MODE_STA) == 0){ + log_w("STA has not been started"); + return false; + } + return esp_wifi_set_ps(mode) == ESP_OK; +} + /** * get modem sleep enabled * @return true if modem sleep is enabled @@ -710,13 +724,13 @@ int WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResult) { ip_addr_t addr; aResult = static_cast(0); - waitStatusBits(WIFI_DNS_IDLE_BIT, 5000); - clearStatusBits(WIFI_DNS_IDLE_BIT); + waitStatusBits(WIFI_DNS_IDLE_BIT, 16000); + clearStatusBits(WIFI_DNS_IDLE_BIT | WIFI_DNS_DONE_BIT); err_t err = dns_gethostbyname(aHostname, &addr, &wifi_dns_found_callback, &aResult); if(err == ERR_OK && addr.u_addr.ip4.addr) { aResult = addr.u_addr.ip4.addr; } else if(err == ERR_INPROGRESS) { - waitStatusBits(WIFI_DNS_DONE_BIT, 4000); + waitStatusBits(WIFI_DNS_DONE_BIT, 15000); //real internal timeout in lwip library is 14[s] clearStatusBits(WIFI_DNS_DONE_BIT); } setStatusBits(WIFI_DNS_IDLE_BIT); diff --git a/libraries/WiFi/src/WiFiGeneric.h b/libraries/WiFi/src/WiFiGeneric.h index 364a685d7be..2cd2db4a890 100644 --- a/libraries/WiFi/src/WiFiGeneric.h +++ b/libraries/WiFi/src/WiFiGeneric.h @@ -108,6 +108,7 @@ class WiFiGenericClass bool enableAP(bool enable); bool setSleep(bool enable); + bool setSleep(wifi_ps_type_t mode); bool getSleep(); bool setTxPower(wifi_power_t power); diff --git a/libraries/WiFi/src/WiFiMulti.cpp b/libraries/WiFi/src/WiFiMulti.cpp index 730850333f1..876b3887684 100644 --- a/libraries/WiFi/src/WiFiMulti.cpp +++ b/libraries/WiFi/src/WiFiMulti.cpp @@ -157,7 +157,7 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout) WiFi.scanDelete(); if(bestNetwork.ssid) { - log_i("[WIFI] Connecting BSSID: %02X:%02X:%02X:%02X:%02X:%02X SSID: %s Channal: %d (%d)", bestBSSID[0], bestBSSID[1], bestBSSID[2], bestBSSID[3], bestBSSID[4], bestBSSID[5], bestNetwork.ssid, bestChannel, bestNetworkDb); + log_i("[WIFI] Connecting BSSID: %02X:%02X:%02X:%02X:%02X:%02X SSID: %s Channel: %d (%d)", bestBSSID[0], bestBSSID[1], bestBSSID[2], bestBSSID[3], bestBSSID[4], bestBSSID[5], bestNetwork.ssid, bestChannel, bestNetworkDb); WiFi.begin(bestNetwork.ssid, bestNetwork.passphrase, bestChannel, bestBSSID); status = WiFi.status(); diff --git a/libraries/WiFi/src/WiFiProv.cpp b/libraries/WiFi/src/WiFiProv.cpp index 1296efe8428..6c0eb277a17 100644 --- a/libraries/WiFi/src/WiFiProv.cpp +++ b/libraries/WiFi/src/WiFiProv.cpp @@ -27,19 +27,19 @@ #include #include -#include #include #include #include #undef IPADDR_NONE #include "WiFi.h" +wifi_prov_mgr_config_t config; +scheme_t prov_scheme; extern esp_err_t postToSysQueue(system_prov_event_t *); static const uint8_t custom_service_uuid[16] = { 0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf, 0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02, }; -#define SERV_NAME_PREFIX_BLE "BLE_" -#define SERV_NAME_PREFIX_WIFI "WIFI_" +#define SERV_NAME_PREFIX_PROV "PROV_" bool WiFiProvClass::prov_enable = true; @@ -48,6 +48,18 @@ bool WiFiProvClass::isProvEnabled() return prov_enable; } +void provSchemeBLE() +{ + prov_scheme = WIFI_PROV_SCHEME_BLE; + config.scheme = wifi_prov_scheme_ble; +} + +void provSchemeSoftAP() +{ + prov_scheme = WIFI_PROV_SCHEME_SOFTAP; + config.scheme = wifi_prov_scheme_softap; +} + static void prov_event_handler(void *user_data, wifi_prov_cb_event_t event, void *event_data) { if (!event) { @@ -87,33 +99,23 @@ static void prov_event_handler(void *user_data, wifi_prov_cb_event_t event, void } } -static void get_device_service_name(scheme prov_scheme, char *service_name, size_t max) +static void get_device_service_name(char *service_name, size_t max) { uint8_t eth_mac[6]; WiFi.macAddress(eth_mac); - if(prov_scheme == WIFI_PROV_SCHEME_BLE) { - snprintf(service_name, max, "%s%02X%02X%02X",SERV_NAME_PREFIX_BLE, eth_mac[3], eth_mac[4], eth_mac[5]); - } else { - snprintf(service_name, max, "%s%02X%02X%02X",SERV_NAME_PREFIX_WIFI, eth_mac[3], eth_mac[4], eth_mac[5]); - } + snprintf(service_name, max, "%s%02X%02X%02X",SERV_NAME_PREFIX_PROV, eth_mac[3], eth_mac[4], eth_mac[5]); } -void WiFiProvClass :: beginProvision(scheme prov_scheme, wifi_prov_event_handler_t scheme_event_handler, wifi_prov_security_t security, const char * pop, const char *service_name, const char *service_key, uint8_t * uuid) +void WiFiProvClass :: beginProvision(void (*scheme_cb)(), wifi_prov_event_handler_t scheme_event_handler, wifi_prov_security_t security, const char * pop, const char *service_name, const char *service_key, uint8_t * uuid) { prov_enable = true; bool provisioned = false; - wifi_prov_mgr_config_t config; + scheme_cb(); config.scheme_event_handler = scheme_event_handler; config.app_event_handler = { .event_cb = prov_event_handler, .user_data = NULL }; - - if(prov_scheme == WIFI_PROV_SCHEME_BLE) { - config.scheme = wifi_prov_scheme_ble; - } else { - config.scheme = wifi_prov_scheme_softap; - } wifi_prov_mgr_init(config); WiFi.mode(WIFI_MODE_AP); @@ -129,7 +131,7 @@ void WiFiProvClass :: beginProvision(scheme prov_scheme, wifi_prov_event_handler if(service_name == NULL) { char service_name_temp[12]; - get_device_service_name(prov_scheme,service_name_temp,sizeof(service_name_temp)); + get_device_service_name(service_name_temp,sizeof(service_name_temp)); service_name = (const char *)service_name_temp; } @@ -150,12 +152,13 @@ void WiFiProvClass :: beginProvision(scheme prov_scheme, wifi_prov_event_handler wifi_prov_mgr_deinit(); WiFi.mode(WIFI_MODE_STA); log_i("Aleardy Provisioned, starting Wi-Fi STA"); - log_i("CONNECTING ACCESS POINT CREDENTIALS : "); #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO wifi_config_t conf; esp_wifi_get_config(WIFI_IF_STA,&conf); log_i("SSID : %s\n",conf.sta.ssid); #endif + log_i("CONNECTING TO THE ACCESS POINT : "); + WiFi.begin(); } } diff --git a/libraries/WiFi/src/WiFiProv.h b/libraries/WiFi/src/WiFiProv.h index 6492c4dd644..edda35aae16 100644 --- a/libraries/WiFi/src/WiFiProv.h +++ b/libraries/WiFi/src/WiFiProv.h @@ -19,16 +19,18 @@ #include "wifi_provisioning/manager.h" #include "wifi_provisioning/scheme_ble.h" -#include "esp_wifi.h" #include "nvs_flash.h" #include "SimpleBLE.h" //Select the scheme using which you want to provision -enum scheme +typedef enum { WIFI_PROV_SCHEME_BLE, - WIFI_PROV_SCHEME_SOFTAP, - WIFI_PROV_SCHEME_CONSOLE -}; + WIFI_PROV_SCHEME_SOFTAP +}scheme_t; + +extern void provSchemeSoftAP(); +extern void provSchemeBLE(); + //Provisioning class class WiFiProvClass { @@ -42,7 +44,7 @@ class WiFiProvClass bool isProvEnabled(); - void beginProvision(scheme prov_scheme = WIFI_PROV_SCHEME_SOFTAP, wifi_prov_event_handler_t scheme_event_handler = WIFI_PROV_EVENT_HANDLER_NONE, wifi_prov_security_t security = WIFI_PROV_SECURITY_1, const char * pop = "abcd1234", const char * service_name = NULL, const char * service_key = NULL, uint8_t *uuid = NULL); + void beginProvision(void (*scheme_cb)() = provSchemeSoftAP, wifi_prov_event_handler_t scheme_event_handler = WIFI_PROV_EVENT_HANDLER_NONE, wifi_prov_security_t security = WIFI_PROV_SECURITY_1, const char * pop = "abcd1234", const char * service_name = NULL, const char * service_key = NULL, uint8_t *uuid = NULL); }; /* diff --git a/libraries/WiFi/src/WiFiSTA.cpp b/libraries/WiFi/src/WiFiSTA.cpp index db5e019af31..a1da8a874a9 100644 --- a/libraries/WiFi/src/WiFiSTA.cpp +++ b/libraries/WiFi/src/WiFiSTA.cpp @@ -224,8 +224,8 @@ wl_status_t WiFiSTAClass::begin() } /** - * will force a disconnect an then start reconnecting to AP - * @return ok + * will force a disconnect and then start reconnecting to AP + * @return true when successful */ bool WiFiSTAClass::reconnect() { @@ -337,7 +337,7 @@ bool WiFiSTAClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subne /** * is STA interface connected? - * @return true if STA is connected to an AD + * @return true if STA is connected to an AP */ bool WiFiSTAClass::isConnected() { @@ -488,8 +488,8 @@ IPAddress WiFiSTAClass::dnsIP(uint8_t dns_no) if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ return IPAddress(); } - ip_addr_t dns_ip = dns_getserver(dns_no); - return IPAddress(dns_ip.u_addr.ip4.addr); + const ip_addr_t* dns_ip = dns_getserver(dns_no); + return IPAddress(dns_ip->u_addr.ip4.addr); } /** diff --git a/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp b/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp index 3f545c6723c..5402fd503e5 100644 --- a/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp +++ b/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp @@ -274,18 +274,16 @@ bool WiFiClientSecure::verify(const char* fp, const char* domain_name) } char *WiFiClientSecure::_streamLoad(Stream& stream, size_t size) { - static char *dest = nullptr; - if(dest) { - free(dest); - } - dest = (char*)malloc(size); + char *dest = (char*)malloc(size+1); if (!dest) { return nullptr; } if (size != stream.readBytes(dest, size)) { free(dest); dest = nullptr; + return nullptr; } + dest[size] = '\0'; return dest; } diff --git a/libraries/WiFiClientSecure/src/ssl_client.cpp b/libraries/WiFiClientSecure/src/ssl_client.cpp index 3fa6138f558..9f168a0aabd 100644 --- a/libraries/WiFiClientSecure/src/ssl_client.cpp +++ b/libraries/WiFiClientSecure/src/ssl_client.cpp @@ -80,12 +80,16 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p if (lwip_connect(ssl_client->socket, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) == 0) { if(timeout <= 0){ - timeout = 30000; + timeout = 30000; // Milli seconds. } - lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); - lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); - lwip_setsockopt(ssl_client->socket, IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(enable)); - lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(enable)); + timeval so_timeout = { .tv_sec = timeout / 1000, .tv_usec = (timeout % 1000) * 1000 }; + +#define ROE(x,msg) { if (((x)<0)) { log_e("LWIP Socket config of " msg " failed."); return -1; }} + ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_RCVTIMEO, &so_timeout, sizeof(so_timeout)),"SO_RCVTIMEO"); + ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_SNDTIMEO, &so_timeout, sizeof(so_timeout)),"SO_SNDTIMEO"); + + ROE(lwip_setsockopt(ssl_client->socket, IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(enable)),"TCP_NODELAY"); + ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(enable)),"SO_KEEPALIVE"); } else { log_e("Connect to Server failed!"); return -1; @@ -122,6 +126,8 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p mbedtls_ssl_conf_ca_chain(&ssl_client->ssl_conf, &ssl_client->ca_cert, NULL); //mbedtls_ssl_conf_verify(&ssl_client->ssl_ctx, my_verify, NULL ); if (ret < 0) { + // free the ca_cert in the case parse failed, otherwise, the old ca_cert still in the heap memory, that lead to "out of memory" crash. + mbedtls_x509_crt_free(&ssl_client->ca_cert); return handle_error(ret); } } else if (pskIdent != NULL && psKey != NULL) { @@ -167,6 +173,8 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p ret = mbedtls_x509_crt_parse(&ssl_client->client_cert, (const unsigned char *)cli_cert, strlen(cli_cert) + 1); if (ret < 0) { + // free the client_cert in the case parse failed, otherwise, the old client_cert still in the heap memory, that lead to "out of memory" crash. + mbedtls_x509_crt_free(&ssl_client->client_cert); return handle_error(ret); } @@ -276,24 +284,21 @@ int data_to_read(sslclient_context *ssl_client) return res; } - int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, uint16_t len) { - log_v("Writing HTTP request..."); //for low level debug + log_v("Writing HTTP request with %d bytes...", len); //for low level debug int ret = -1; - while ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0) { - if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) { - return handle_error(ret); - } + if ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0){ + log_v("Handling error %d", ret); //for low level debug + return handle_error(ret); + } else{ + log_v("Returning with %d bytes written", ret); //for low level debug } - len = ret; - //log_v("%d bytes written", len); //for low level debug return ret; } - int get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, int length) { //log_d( "Reading HTTP response..."); //for low level debug diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 2e6533eda9d..d680101e28a 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -36,7 +36,7 @@ { "packager": "esp32", "name": "xtensa-esp32-elf-gcc", - "version": "1.22.0-80-g6c4433a-5.2.0" + "version": "1.22.0-96-g2852398-5.2.0" }, { "packager": "esp32", @@ -54,42 +54,49 @@ "tools": [ { "name": "xtensa-esp32-elf-gcc", - "version": "1.22.0-80-g6c4433a-5.2.0", + "version": "1.22.0-96-g2852398-5.2.0", "systems": [ { "host": "i686-mingw32", - "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-win32-1.22.0-80-g6c4433a-5.2.0.zip", - "archiveFileName": "xtensa-esp32-elf-win32-1.22.0-80-g6c4433a-5.2.0.zip", - "checksum": "SHA-256:f217fccbeaaa8c92db239036e0d6202458de4488b954a3a38f35ac2ec48058a4", - "size": "125719261" + "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-win32-1.22.0-96-g2852398-5.2.0.zip", + "archiveFileName": "xtensa-esp32-elf-win32-1.22.0-96-g2852398-5.2.0.zip", + "checksum": "SHA-256:8e2a2e25d4714ae6e4b992be1b1c261caed5b523b0cc0887b6749229c9febbb0", + "size": "125810912" }, { "host": "x86_64-apple-darwin", - "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-osx-1.22.0-80-g6c4433a-5.2.0.tar.gz", - "archiveFileName": "xtensa-esp32-elf-osx-1.22.0-80-g6c4433a-5.2.0.tar.gz", - "checksum": "SHA-256:a4307a97945d2f2f2745f415fbe80d727750e19f91f9a1e7e2f8a6065652f9da", - "size": "46517409" + "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-macos-1.22.0-96-g2852398-5.2.0.tar.gz", + "archiveFileName": "xtensa-esp32-elf-macos-1.22.0-96-g2852398-5.2.0.tar.gz", + "checksum": "SHA-256:6aeae9547f0cd7e442d1df21821cea8b15d0a6ce349bbd86466e2997b738a99c", + "size": "50520203" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz", - "archiveFileName": "xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz", - "checksum": "SHA-256:3fe96c151d46c1d4e5edc6ed690851b8e53634041114bad04729bc16b0445156", - "size": "44219107" + "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-96-g2852398-5.2.0.tar.gz", + "archiveFileName": "xtensa-esp32-elf-linux64-1.22.0-96-g2852398-5.2.0.tar.gz", + "checksum": "SHA-256:798a8638f11ad37f41b9640582f869c61ffb4da6d932279fde94a2b636ad2dac", + "size": "44211883" }, { "host": "i686-pc-linux-gnu", - "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-80-g6c4433a-5.2.0.tar.gz", - "archiveFileName": "xtensa-esp32-elf-linux32-1.22.0-80-g6c4433a-5.2.0.tar.gz", - "checksum": "SHA-256:b4055695ffc2dfc0bcb6dafdc2572a6e01151c4179ef5fa972b3fcb2183eb155", - "size": "45566336" + "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-96-g2852398-5.2.0.tar.gz", + "archiveFileName": "xtensa-esp32-elf-linux32-1.22.0-96-g2852398-5.2.0.tar.gz", + "checksum": "SHA-256:4eea601188aa8f3c3d45d7936ab4c0fabb75b4970dccf7a061de47dba49e377f", + "size": "45563578" }, { "host": "arm-linux-gnueabihf", - "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-linux-armel-1.22.0-87-gb57bad3-5.2.0.tar.gz", - "archiveFileName": "xtensa-esp32-elf-linux-armel-1.22.0-87-gb57bad3-5.2.0.tar.gz", - "checksum": "SHA-256:9c68c87bb23b1256dc0a1859b515946763e5292dcab4a4159a52fae5618ce861", - "size": "50655584" + "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-linux-armel-1.22.0-96-g2852398-5.2.0.tar.gz", + "archiveFileName": "xtensa-esp32-elf-linux-armel-1.22.0-96-g2852398-5.2.0.tar.gz", + "checksum": "SHA-256:abfe06522f7c3479f6c7434c4bf926c50fa2039362b96abe95fa1f05ec519a9b", + "size": "50670980" + }, + { + "host": "aarch64-linux-gnu", + "url": "https://dl.espressif.com/dl/xtensa-esp32-elf-linux-armel-1.22.0-96-g2852398-5.2.0.tar.gz", + "archiveFileName": "xtensa-esp32-elf-linux-armel-1.22.0-96-g2852398-5.2.0.tar.gz", + "checksum": "SHA-256:abfe06522f7c3479f6c7434c4bf926c50fa2039362b96abe95fa1f05ec519a9b", + "size": "50670980" } ] }, @@ -131,6 +138,13 @@ "archiveFileName": "esptool-2.6.1-linux.tar.gz", "checksum": "SHA-256:eaf82ff4070d9792f6a42ae1e485375de5a87bec59ef01dfb95de901519ec7fb", "size": "44762" + }, + { + "host": "aarch64-linux-gnu", + "url": "https://dl.espressif.com/dl/esptool-2.6.1-linux.tar.gz", + "archiveFileName": "esptool-2.6.1-linux.tar.gz", + "checksum": "SHA-256:eaf82ff4070d9792f6a42ae1e485375de5a87bec59ef01dfb95de901519ec7fb", + "size": "44762" } ] }, diff --git a/platform.txt b/platform.txt index 6583ee771e7..3677e1ee4bd 100644 --- a/platform.txt +++ b/platform.txt @@ -22,7 +22,7 @@ compiler.warning_flags.all=-Wall -Werror=all -Wextra compiler.path={runtime.tools.xtensa-esp32-elf-gcc.path}/bin/ compiler.sdk.path={runtime.platform.path}/tools/sdk -compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H -DGCC_NOT_5_2_0=0 -DWITH_POSIX "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/app_trace" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/asio" "-I{compiler.sdk.path}/include/bootloader_support" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/efuse" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/esp_adc_cal" "-I{compiler.sdk.path}/include/esp_event" "-I{compiler.sdk.path}/include/esp_http_client" "-I{compiler.sdk.path}/include/esp_http_server" "-I{compiler.sdk.path}/include/esp_https_ota" "-I{compiler.sdk.path}/include/esp_https_server" "-I{compiler.sdk.path}/include/esp_ringbuf" "-I{compiler.sdk.path}/include/espcoredump" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freemodbus" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/heap" "-I{compiler.sdk.path}/include/idf_test" "-I{compiler.sdk.path}/include/jsmn" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/libsodium" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/lwip" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/micro-ecc" "-I{compiler.sdk.path}/include/mqtt" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/nimble" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/protobuf-c" "-I{compiler.sdk.path}/include/protocomm" "-I{compiler.sdk.path}/include/pthread" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/smartconfig_ack" "-I{compiler.sdk.path}/include/soc" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/spiffs" "-I{compiler.sdk.path}/include/tcp_transport" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/unity" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/wear_levelling" "-I{compiler.sdk.path}/include/wifi_provisioning" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/esp32-camera" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/fb_gfx" +compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H -DGCC_NOT_5_2_0=0 -DWITH_POSIX "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/app_trace" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/asio" "-I{compiler.sdk.path}/include/bootloader_support" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/efuse" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/esp_adc_cal" "-I{compiler.sdk.path}/include/esp_event" "-I{compiler.sdk.path}/include/esp_http_client" "-I{compiler.sdk.path}/include/esp_http_server" "-I{compiler.sdk.path}/include/esp_https_ota" "-I{compiler.sdk.path}/include/esp_https_server" "-I{compiler.sdk.path}/include/esp_ringbuf" "-I{compiler.sdk.path}/include/esp_websocket_client" "-I{compiler.sdk.path}/include/espcoredump" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freemodbus" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/heap" "-I{compiler.sdk.path}/include/idf_test" "-I{compiler.sdk.path}/include/jsmn" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/libsodium" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/lwip" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/micro-ecc" "-I{compiler.sdk.path}/include/mqtt" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/nimble" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/protobuf-c" "-I{compiler.sdk.path}/include/protocomm" "-I{compiler.sdk.path}/include/pthread" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/smartconfig_ack" "-I{compiler.sdk.path}/include/soc" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/spiffs" "-I{compiler.sdk.path}/include/tcp_transport" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/unity" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/wear_levelling" "-I{compiler.sdk.path}/include/wifi_provisioning" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/esp32-camera" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/fb_gfx" compiler.c.cmd=xtensa-esp32-elf-gcc compiler.c.flags=-std=gnu99 -Os -g3 -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wpointer-arith {compiler.warning_flags} -Wno-maybe-uninitialized -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -Wno-old-style-declaration -MMD -c @@ -35,7 +35,7 @@ compiler.S.flags=-c -g3 -x assembler-with-cpp -MMD -mlongcalls compiler.c.elf.cmd=xtensa-esp32-elf-gcc compiler.c.elf.flags=-nostdlib "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" -T esp32_out.ld -T esp32.project.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception -compiler.c.elf.libs=-lgcc -lfreertos -lmesh -lod -lwear_levelling -lfb_gfx -lesp_adc_cal -lc_nano -lesp32 -ldriver -lhal -ljsmn -lsmartconfig -lesp_http_server -lprotocomm -lface_recognition -lespnow -ltcpip_adapter -lface_detection -lunity -lc -llibsodium -lesp_http_client -lapp_update -lnewlib -lcxx -ltcp_transport -lm -lefuse -lopenssl -lwifi_provisioning -lespcoredump -llog -lmbedtls -lesp_ringbuf -lwps -lnet80211 -lmqtt -lesp_https_server -lapp_trace -lesp_event -lesp32-camera -lsoc -lheap -llwip -lwpa -lrtc -lxtensa-debug-module -lspi_flash -lphy -lfr -lconsole -lcoap -lbtdm_app -lsdmmc -lfd -lmicro-ecc -ljson -lcore -lprotobuf-c -lethernet -lspiffs -lnvs_flash -lwpa_supplicant -lvfs -lasio -lwpa2 -lpp -lbootloader_support -limage_util -ldl_lib -lulp -lnghttp -lpthread -lfreemodbus -lexpat -lfatfs -lsmartconfig_ack -lmdns -lcoexist -lesp-tls -lesp_https_ota -lbt -lstdc++ +compiler.c.elf.libs=-lgcc -lopenssl -lbtdm_app -lfatfs -lwps -lcoexist -lwear_levelling -lesp_http_client -lprotobuf-c -lhal -lnewlib -ldriver -lbootloader_support -lpp -lfreemodbus -lmesh -lsmartconfig -ljsmn -lwpa -lethernet -lphy -lapp_trace -lconsole -lulp -lwpa_supplicant -lfreertos -lbt -lmicro-ecc -lesp32-camera -lcxx -lxtensa-debug-module -ltcp_transport -lod -lmdns -ldetection -lvfs -lpe -lesp_websocket_client -lespcoredump -lesp_ringbuf -lsoc -lcore -lfb_gfx -lsdmmc -llibsodium -lcoap -ltcpip_adapter -lprotocomm -lesp_event -limage_util -lc_nano -lesp-tls -lasio -lrtc -lspi_flash -lwpa2 -lwifi_provisioning -lesp32 -lface_recognition -lapp_update -lnghttp -ldl -lspiffs -lface_detection -lefuse -lunity -lesp_https_server -lespnow -lnvs_flash -lesp_adc_cal -llog -ldetection_cat_face -lsmartconfig_ack -lexpat -lm -lfr -lmqtt -lc -lheap -lmbedtls -llwip -lnet80211 -lesp_http_server -lpthread -ljson -lesp_https_ota -lfd -lstdc++ compiler.as.cmd=xtensa-esp32-elf-as @@ -44,6 +44,8 @@ compiler.ar.flags=cru compiler.size.cmd=xtensa-esp32-elf-size +compiler.libraries.ldflags= + # This can be overriden in boards.txt build.flash_size=4MB build.flash_mode=dio @@ -60,6 +62,7 @@ compiler.cpp.extra_flags= compiler.ar.extra_flags= compiler.objcopy.eep.extra_flags= compiler.elf2hex.extra_flags= +compiler.libraries.ldflags= # Build Dir: {build.path} # Sketch Dir: {build.source.path} @@ -81,16 +84,16 @@ recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.fla recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" ## Combine gc-sections, archives, and objects -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf" +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {compiler.libraries.ldflags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf" -## Create eeprom -recipe.objcopy.eep.pattern={tools.gen_esp32part.cmd} -q "{build.path}/partitions.csv" "{build.path}/{build.project_name}.partitions.bin" +## Create partitions.bin +recipe.objcopy.partitions.bin.pattern={tools.gen_esp32part.cmd} -q "{build.path}/partitions.csv" "{build.path}/{build.project_name}.partitions.bin" -## Create hex -recipe.objcopy.hex.pattern="{tools.esptool_py.path}/{tools.esptool_py.cmd}" --chip esp32 elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf" -recipe.objcopy.hex.pattern.linux=python "{tools.esptool_py.path}/{tools.esptool_py.cmd}" --chip esp32 elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf" +## Create bin +recipe.objcopy.bin.pattern="{tools.esptool_py.path}/{tools.esptool_py.cmd}" --chip esp32 elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf" +recipe.objcopy.bin.pattern.linux=python "{tools.esptool_py.path}/{tools.esptool_py.cmd}" --chip esp32 elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf" -## Save hex +## Save bin recipe.output.tmp_file={build.project_name}.bin recipe.output.save_file={build.project_name}.{build.variant}.bin diff --git a/tools/gen_esp32part.py b/tools/gen_esp32part.py index 17075074034..ac8f3af6a0f 100755 --- a/tools/gen_esp32part.py +++ b/tools/gen_esp32part.py @@ -160,7 +160,7 @@ def find_by_type(self, ptype, subtype): subtype = SUBTYPES[int(ptype)][subtype] except KeyError: try: - ptype = int(ptype, 0) + subtype = int(subtype, 0) except TypeError: pass diff --git a/tools/platformio-build.py b/tools/platformio-build.py index ec8d241a933..6a04dd613a2 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -35,7 +35,7 @@ assert isdir(FRAMEWORK_DIR) env.Append( - ASFLAGS=["-x", "assembler-with-cpp"], + ASFLAGS=["-x", "assembler-with-cpp", "-mlongcalls"], CFLAGS=[ "-std=gnu99", @@ -118,6 +118,7 @@ join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_https_ota"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_https_server"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_ringbuf"), + join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_websocket_client"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "espcoredump"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "ethernet"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "expat"), @@ -170,7 +171,7 @@ ], LIBS=[ - "-lgcc", "-lfreertos", "-lmesh", "-lod", "-lwear_levelling", "-lfb_gfx", "-lesp_adc_cal", "-lc_nano", "-lesp32", "-ldriver", "-lhal", "-ljsmn", "-lsmartconfig", "-lesp_http_server", "-lprotocomm", "-lface_recognition", "-lespnow", "-ltcpip_adapter", "-lface_detection", "-lunity", "-lc", "-llibsodium", "-lesp_http_client", "-lapp_update", "-lnewlib", "-lcxx", "-ltcp_transport", "-lm", "-lefuse", "-lopenssl", "-lwifi_provisioning", "-lespcoredump", "-llog", "-lmbedtls", "-lesp_ringbuf", "-lwps", "-lnet80211", "-lmqtt", "-lesp_https_server", "-lapp_trace", "-lesp_event", "-lesp32-camera", "-lsoc", "-lheap", "-llwip", "-lwpa", "-lrtc", "-lxtensa-debug-module", "-lspi_flash", "-lphy", "-lfr", "-lconsole", "-lcoap", "-lbtdm_app", "-lsdmmc", "-lfd", "-lmicro-ecc", "-ljson", "-lcore", "-lprotobuf-c", "-lethernet", "-lspiffs", "-lnvs_flash", "-lwpa_supplicant", "-lvfs", "-lasio", "-lwpa2", "-lpp", "-lbootloader_support", "-limage_util", "-ldl_lib", "-lulp", "-lnghttp", "-lpthread", "-lfreemodbus", "-lexpat", "-lfatfs", "-lsmartconfig_ack", "-lmdns", "-lcoexist", "-lesp-tls", "-lesp_https_ota", "-lbt", "-lstdc++" + "-lgcc", "-lopenssl", "-lbtdm_app", "-lfatfs", "-lwps", "-lcoexist", "-lwear_levelling", "-lesp_http_client", "-lprotobuf-c", "-lhal", "-lnewlib", "-ldriver", "-lbootloader_support", "-lpp", "-lfreemodbus", "-lmesh", "-lsmartconfig", "-ljsmn", "-lwpa", "-lethernet", "-lphy", "-lapp_trace", "-lconsole", "-lulp", "-lwpa_supplicant", "-lfreertos", "-lbt", "-lmicro-ecc", "-lesp32-camera", "-lcxx", "-lxtensa-debug-module", "-ltcp_transport", "-lod", "-lmdns", "-ldetection", "-lvfs", "-lpe", "-lesp_websocket_client", "-lespcoredump", "-lesp_ringbuf", "-lsoc", "-lcore", "-lfb_gfx", "-lsdmmc", "-llibsodium", "-lcoap", "-ltcpip_adapter", "-lprotocomm", "-lesp_event", "-limage_util", "-lc_nano", "-lesp-tls", "-lasio", "-lrtc", "-lspi_flash", "-lwpa2", "-lwifi_provisioning", "-lesp32", "-lface_recognition", "-lapp_update", "-lnghttp", "-ldl", "-lspiffs", "-lface_detection", "-lefuse", "-lunity", "-lesp_https_server", "-lespnow", "-lnvs_flash", "-lesp_adc_cal", "-llog", "-ldetection_cat_face", "-lsmartconfig_ack", "-lexpat", "-lm", "-lfr", "-lmqtt", "-lc", "-lheap", "-lmbedtls", "-llwip", "-lnet80211", "-lesp_http_server", "-lpthread", "-ljson", "-lesp_https_ota", "-lfd", "-lstdc++" ], LIBSOURCE_DIRS=[ diff --git a/tools/sdk/bin/bootloader_dio_40m.bin b/tools/sdk/bin/bootloader_dio_40m.bin index db78e6f6df0..350107a9e0c 100644 Binary files a/tools/sdk/bin/bootloader_dio_40m.bin and b/tools/sdk/bin/bootloader_dio_40m.bin differ diff --git a/tools/sdk/bin/bootloader_dio_80m.bin b/tools/sdk/bin/bootloader_dio_80m.bin index 360f93b4e78..0da9aa991fc 100644 Binary files a/tools/sdk/bin/bootloader_dio_80m.bin and b/tools/sdk/bin/bootloader_dio_80m.bin differ diff --git a/tools/sdk/bin/bootloader_dout_40m.bin b/tools/sdk/bin/bootloader_dout_40m.bin index 0c0ae97eda5..ced40a4d901 100644 Binary files a/tools/sdk/bin/bootloader_dout_40m.bin and b/tools/sdk/bin/bootloader_dout_40m.bin differ diff --git a/tools/sdk/bin/bootloader_dout_80m.bin b/tools/sdk/bin/bootloader_dout_80m.bin index 49d72a6c417..84920601075 100644 Binary files a/tools/sdk/bin/bootloader_dout_80m.bin and b/tools/sdk/bin/bootloader_dout_80m.bin differ diff --git a/tools/sdk/bin/bootloader_qio_40m.bin b/tools/sdk/bin/bootloader_qio_40m.bin index 45e68280d4f..8299f444980 100644 Binary files a/tools/sdk/bin/bootloader_qio_40m.bin and b/tools/sdk/bin/bootloader_qio_40m.bin differ diff --git a/tools/sdk/bin/bootloader_qio_80m.bin b/tools/sdk/bin/bootloader_qio_80m.bin index 9372befba7f..592e62b417e 100644 Binary files a/tools/sdk/bin/bootloader_qio_80m.bin and b/tools/sdk/bin/bootloader_qio_80m.bin differ diff --git a/tools/sdk/bin/bootloader_qout_40m.bin b/tools/sdk/bin/bootloader_qout_40m.bin index 066559ee572..f2d94dc3c8f 100644 Binary files a/tools/sdk/bin/bootloader_qout_40m.bin and b/tools/sdk/bin/bootloader_qout_40m.bin differ diff --git a/tools/sdk/bin/bootloader_qout_80m.bin b/tools/sdk/bin/bootloader_qout_80m.bin index d4b6fe86c83..b6c1b11a393 100644 Binary files a/tools/sdk/bin/bootloader_qout_80m.bin and b/tools/sdk/bin/bootloader_qout_80m.bin differ diff --git a/tools/sdk/include/bt/esp_a2dp_api.h b/tools/sdk/include/bt/esp_a2dp_api.h index 3b002a405fb..96aad492b59 100644 --- a/tools/sdk/include/bt/esp_a2dp_api.h +++ b/tools/sdk/include/bt/esp_a2dp_api.h @@ -76,7 +76,7 @@ typedef enum { /// A2DP media control commands typedef enum { - ESP_A2D_MEDIA_CTRL_NONE = 0, /*!< dummy command */ + ESP_A2D_MEDIA_CTRL_NONE = 0, /*!< Not for application use, use inside stack only. */ ESP_A2D_MEDIA_CTRL_CHECK_SRC_RDY, /*!< check whether AVDTP is connected, only used in A2DP source */ ESP_A2D_MEDIA_CTRL_START, /*!< command to set up media transmission channel */ ESP_A2D_MEDIA_CTRL_STOP, /*!< command to stop media transmission */ diff --git a/tools/sdk/include/bt/esp_blufi_api.h b/tools/sdk/include/bt/esp_blufi_api.h index 6905187485b..f17fcbc2282 100644 --- a/tools/sdk/include/bt/esp_blufi_api.h +++ b/tools/sdk/include/bt/esp_blufi_api.h @@ -83,6 +83,7 @@ typedef enum { ESP_BLUFI_DH_PARAM_ERROR, ESP_BLUFI_READ_PARAM_ERROR, ESP_BLUFI_MAKE_PUBLIC_ERROR, + ESP_BLUFI_DATA_FORMAT_ERROR, } esp_blufi_error_state_t; /** diff --git a/tools/sdk/include/bt/esp_bt.h b/tools/sdk/include/bt/esp_bt.h index 1ee7edf9525..fb38fe68df0 100644 --- a/tools/sdk/include/bt/esp_bt.h +++ b/tools/sdk/include/bt/esp_bt.h @@ -25,7 +25,7 @@ extern "C" { #endif -#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20190506 +#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20200611 /** * @brief Bluetooth mode for controller enable/disable @@ -96,6 +96,18 @@ the adv packet will be discarded until the memory is restored. */ #define BTDM_CONTROLLER_MODE_EFF ESP_BT_MODE_BTDM #endif +#ifdef CONFIG_BTDM_CTRL_AUTO_LATENCY_EFF +#define BTDM_CTRL_AUTO_LATENCY_EFF CONFIG_BTDM_CTRL_AUTO_LATENCY_EFF +#else +#define BTDM_CTRL_AUTO_LATENCY_EFF false +#endif + +#ifdef CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF +#define BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF +#else +#define BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF false +#endif + #define BTDM_CONTROLLER_BLE_MAX_CONN_LIMIT 9 //Maximum BLE connection limitation #define BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_LIMIT 7 //Maximum ACL connection limitation #define BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_LIMIT 3 //Maximum SCO/eSCO connection limitation @@ -109,7 +121,7 @@ the adv packet will be discarded until the memory is restored. */ .hci_uart_no = BT_HCI_UART_NO_DEFAULT, \ .hci_uart_baudrate = BT_HCI_UART_BAUDRATE_DEFAULT, \ .scan_duplicate_mode = SCAN_DUPLICATE_MODE, \ - .scan_duplicate_type = SCAN_DUPLICATE_TYPE_VALUE, \ + .scan_duplicate_type = SCAN_DUPLICATE_TYPE_VALUE, \ .normal_adv_size = NORMAL_SCAN_DUPLICATE_CACHE_SIZE, \ .mesh_adv_size = MESH_DUPLICATE_SCAN_CACHE_SIZE, \ .send_adv_reserved_size = SCAN_SEND_ADV_RESERVED_SIZE, \ @@ -118,6 +130,8 @@ the adv packet will be discarded until the memory is restored. */ .ble_max_conn = CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF, \ .bt_max_acl_conn = CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF, \ .bt_sco_datapath = CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF, \ + .auto_latency = BTDM_CTRL_AUTO_LATENCY_EFF, \ + .bt_legacy_auth_vs_evt = BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF, \ .bt_max_sync_conn = CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF, \ .magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \ }; @@ -149,6 +163,8 @@ typedef struct { uint8_t ble_max_conn; /*!< BLE maximum connection numbers */ uint8_t bt_max_acl_conn; /*!< BR/EDR maximum ACL connection numbers */ uint8_t bt_sco_datapath; /*!< SCO data path, i.e. HCI or PCM module */ + bool auto_latency; /*!< BLE auto latency, used to enhance classic BT performance */ + bool bt_legacy_auth_vs_evt; /*!< BR/EDR Legacy auth complete event required to protect from BIAS attack */ /* * Following parameters can not be configured runtime when call esp_bt_controller_init() * It will be overwrite with a constant value which in menuconfig or from a macro. diff --git a/tools/sdk/include/bt/esp_gap_bt_api.h b/tools/sdk/include/bt/esp_gap_bt_api.h index f5b2c8f15a2..627cb041802 100644 --- a/tools/sdk/include/bt/esp_gap_bt_api.h +++ b/tools/sdk/include/bt/esp_gap_bt_api.h @@ -174,6 +174,7 @@ typedef enum { ESP_BT_GAP_KEY_NOTIF_EVT, /*!< Simple Pairing Passkey Notification */ ESP_BT_GAP_KEY_REQ_EVT, /*!< Simple Pairing Passkey request */ ESP_BT_GAP_READ_RSSI_DELTA_EVT, /*!< read rssi event */ + ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< remove bond device complete event */ ESP_BT_GAP_EVT_MAX, } esp_bt_gap_cb_event_t; @@ -271,6 +272,14 @@ typedef union { struct key_req_param { esp_bd_addr_t bda; /*!< remote bluetooth device address*/ } key_req; /*!< passkey request parameter struct */ + + /** + * @brief ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT + */ + struct bt_remove_bond_dev_cmpl_evt_param { + esp_bd_addr_t bda; /*!< remote bluetooth device address*/ + esp_bt_status_t status; /*!< Indicate the remove bond device operation success status */ + }remove_bond_dev_cmpl; /*!< Event parameter of ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT */ } esp_bt_gap_cb_param_t; /** @@ -361,13 +370,15 @@ esp_err_t esp_bt_gap_register_callback(esp_bt_gap_cb_t callback); esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode); /** - * @brief Start device discovery. This function should be called after esp_bluedroid_enable() completes successfully. - * esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT if discovery is started or halted. - * esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_RES_EVT if discovery result is got. + * @brief This function starts Inquiry and Name Discovery. It should be called after esp_bluedroid_enable() completes successfully. + * When Inquiry is halted and cached results do not contain device name, then Name Discovery will connect to the peer target to get the device name. + * esp_bt_gap_cb_t will be called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT when Inquriry is started or Name Discovery is completed. + * esp_bt_gap_cb_t will be called with ESP_BT_GAP_DISC_RES_EVT each time the two types of discovery results are got. * - * @param[in] mode - inquiry mode - * @param[in] inq_len - inquiry duration in 1.28 sec units, ranging from 0x01 to 0x30 - * @param[in] num_rsps - number of inquiry responses that can be received, value 0 indicates an unlimited number of responses + * @param[in] mode - Inquiry mode + * @param[in] inq_len - Inquiry duration in 1.28 sec units, ranging from 0x01 to 0x30. This parameter only specifies the total duration of the Inquiry process, + * - when this time expires, Inquiry will be halted. + * @param[in] num_rsps - Number of responses that can be received before the Inquiry is halted, value 0 indicates an unlimited number of responses. * * @return * - ESP_OK : Succeed @@ -378,8 +389,9 @@ esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode); esp_err_t esp_bt_gap_start_discovery(esp_bt_inq_mode_t mode, uint8_t inq_len, uint8_t num_rsps); /** - * @brief Cancel device discovery. This function should be called after esp_bluedroid_enable() completes successfully - * esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT if discovery is stopped. + * @brief Cancel Inquiry and Name Discovery. This function should be called after esp_bluedroid_enable() completes successfully. + * esp_bt_gap_cb_t will be called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT if Inquiry or Name Discovery is cancelled by + * calling this function. * * @return * - ESP_OK : Succeed diff --git a/tools/sdk/include/bt/esp_gatt_common_api.h b/tools/sdk/include/bt/esp_gatt_common_api.h index 3a9b7445815..447a26bd957 100644 --- a/tools/sdk/include/bt/esp_gatt_common_api.h +++ b/tools/sdk/include/bt/esp_gatt_common_api.h @@ -44,6 +44,11 @@ extern "C" { */ extern esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu); +#if (BLE_INCLUDED == TRUE) +extern uint16_t esp_ble_get_sendable_packets_num (void); +extern uint16_t esp_ble_get_cur_sendable_packets_num (uint16_t connid); +#endif + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/bt/esp_gatt_defs.h b/tools/sdk/include/bt/esp_gatt_defs.h index d6c140a1400..615ea418bb3 100644 --- a/tools/sdk/include/bt/esp_gatt_defs.h +++ b/tools/sdk/include/bt/esp_gatt_defs.h @@ -34,7 +34,7 @@ extern "C" { * All "ESP_GATT_UUID_xxx" is attribute types */ #define ESP_GATT_UUID_IMMEDIATE_ALERT_SVC 0x1802 /* Immediate alert Service*/ -#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803 /* Link Loss Service*/ +#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803 /* Link Loss Service*/ #define ESP_GATT_UUID_TX_POWER_SVC 0x1804 /* TX Power Service*/ #define ESP_GATT_UUID_CURRENT_TIME_SVC 0x1805 /* Current Time Service Service*/ #define ESP_GATT_UUID_REF_TIME_UPDATE_SVC 0x1806 /* Reference Time Update Service*/ @@ -68,8 +68,14 @@ extern "C" { #define ESP_GATT_UUID_CHAR_PRESENT_FORMAT 0x2904 /* Characteristic Presentation Format*/ #define ESP_GATT_UUID_CHAR_AGG_FORMAT 0x2905 /* Characteristic Aggregate Format*/ #define ESP_GATT_UUID_CHAR_VALID_RANGE 0x2906 /* Characteristic Valid Range */ -#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907 -#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908 +#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907 /* External Report Reference */ +#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908 /* Report Reference */ +#define ESP_GATT_UUID_NUM_DIGITALS_DESCR 0x2909 /* Number of Digitals */ +#define ESP_GATT_UUID_VALUE_TRIGGER_DESCR 0x290A /* Value Trigger Setting */ +#define ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR 0x290B /* Environmental Sensing Configuration */ +#define ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR 0x290C /* Environmental Sensing Measurement */ +#define ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR 0x290D /* Environmental Sensing Trigger Setting */ +#define ESP_GATT_UUID_TIME_TRIGGER_DESCR 0x290E /* Time Trigger Setting */ /* GAP Profile Attributes */ #define ESP_GATT_UUID_GAP_DEVICE_NAME 0x2A00 @@ -299,7 +305,7 @@ typedef enum { * @brief Attribute description (used to create database) */ typedef struct - { + { uint16_t uuid_length; /*!< UUID length */ uint8_t *uuid_p; /*!< UUID value */ uint16_t perm; /*!< Attribute permission */ @@ -348,23 +354,23 @@ typedef struct /** * @brief Gatt include service entry element */ -typedef struct +typedef struct { - uint16_t start_hdl; /*!< Gatt start handle value of included service */ - uint16_t end_hdl; /*!< Gatt end handle value of included service */ - uint16_t uuid; /*!< Gatt attribute value UUID of included service */ + uint16_t start_hdl; /*!< Gatt start handle value of included service */ + uint16_t end_hdl; /*!< Gatt end handle value of included service */ + uint16_t uuid; /*!< Gatt attribute value UUID of included service */ } esp_gatts_incl_svc_desc_t; /*!< Gatt include service entry element */ /** * @brief Gatt include 128 bit service entry element */ -typedef struct +typedef struct { - uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */ - uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */ -} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */ + uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */ + uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */ +} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */ -/// Gatt attribute value +/// Gatt attribute value typedef struct { uint8_t value[ESP_GATT_MAX_ATTR_LEN]; /*!< Gatt attribute value */ uint16_t handle; /*!< Gatt attribute handle */ @@ -426,8 +432,8 @@ typedef struct { /** * @brief service element */ -typedef struct { - bool is_primary; /*!< The service flag, true if the service is primary service, else is secondly service */ +typedef struct { + bool is_primary; /*!< The service flag, true if the service is primary service, else is secondary service */ uint16_t start_handle; /*!< The start handle of the service */ uint16_t end_handle; /*!< The end handle of the service */ esp_bt_uuid_t uuid; /*!< The uuid of the service */ diff --git a/tools/sdk/include/bt/esp_spp_api.h b/tools/sdk/include/bt/esp_spp_api.h index 9628a1ed0ce..9e657642499 100644 --- a/tools/sdk/include/bt/esp_spp_api.h +++ b/tools/sdk/include/bt/esp_spp_api.h @@ -57,6 +57,7 @@ typedef enum { */ typedef enum { ESP_SPP_INIT_EVT = 0, /*!< When SPP is inited, the event comes */ + ESP_SPP_UNINIT_EVT = 1, /*!< When SPP is uninited, the event comes */ ESP_SPP_DISCOVERY_COMP_EVT = 8, /*!< When SDP discovery complete, the event comes */ ESP_SPP_OPEN_EVT = 26, /*!< When SPP Client connection open, the event comes */ ESP_SPP_CLOSE_EVT = 27, /*!< When SPP connection closed, the event comes */ @@ -66,6 +67,7 @@ typedef enum { ESP_SPP_CONG_EVT = 31, /*!< When SPP connection congestion status changed, the event comes, only for ESP_SPP_MODE_CB */ ESP_SPP_WRITE_EVT = 33, /*!< When SPP write operation completes, the event comes, only for ESP_SPP_MODE_CB */ ESP_SPP_SRV_OPEN_EVT = 34, /*!< When SPP Server connection open, the event comes */ + ESP_SPP_SRV_STOP_EVT = 35, /*!< When SPP server stopped, the event comes */ } esp_spp_cb_event_t; @@ -80,6 +82,13 @@ typedef union { esp_spp_status_t status; /*!< status */ } init; /*!< SPP callback param of SPP_INIT_EVT */ + /** + * @brief SPP_UNINIT_EVT + */ + struct spp_uninit_evt_param { + esp_spp_status_t status; /*!< status */ + } uninit; /*!< SPP callback param of SPP_UNINIT_EVT */ + /** * @brief SPP_DISCOVERY_COMP_EVT */ @@ -128,6 +137,14 @@ typedef union { uint8_t sec_id; /*!< security ID used by this server */ bool use_co; /*!< TRUE to use co_rfc_data */ } start; /*!< SPP callback param of ESP_SPP_START_EVT */ + + /** + * @brief ESP_SPP_SRV_STOP_EVT + */ + struct spp_srv_stop_evt_param { + esp_spp_status_t status; /*!< status */ + } srv_stop; /*!< SPP callback param of ESP_SPP_SRV_STOP_EVT */ + /** * @brief ESP_SPP_CL_INIT_EVT */ @@ -273,6 +290,16 @@ esp_err_t esp_spp_disconnect(uint32_t handle); esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask, esp_spp_role_t role, uint8_t local_scn, const char *name); +/** + * @brief This function stops a SPP server + * When the server is stopped successfully, the callback is called + * with ESP_SPP_SRV_STOP_EVT. + * + * @return + * - ESP_OK: success + * - other: failed + */ +esp_err_t esp_spp_stop_srv(void); /** * @brief This function is used to write data, only for ESP_SPP_MODE_CB. diff --git a/tools/sdk/include/config/sdkconfig.h b/tools/sdk/include/config/sdkconfig.h index 8722dcc6987..8f96328bb3c 100644 --- a/tools/sdk/include/config/sdkconfig.h +++ b/tools/sdk/include/config/sdkconfig.h @@ -21,6 +21,7 @@ #define CONFIG_TCP_WND_DEFAULT 5744 #define CONFIG_PARTITION_TABLE_OFFSET 0x8000 #define CONFIG_SW_COEXIST_ENABLE 1 +#define CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE 3 #define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 #define CONFIG_ESPTOOLPY_FLASHSIZE_4MB 1 #define CONFIG_IPC_TASK_STACK_SIZE 1024 @@ -28,8 +29,11 @@ #define CONFIG_FATFS_PER_FILE_CACHE 1 #define CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "40m" +#define CONFIG_LWIP_TCP_RTO_TIME 3000 +#define CONFIG_SCCB_HARDWARE_I2C_PORT1 1 #define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 #define CONFIG_UDP_RECVMBOX_SIZE 6 +#define CONFIG_APP_RETRIEVE_LEN_ELF_SHA 16 #define CONFIG_ARDUHAL_PARTITION_SCHEME_DEFAULT 1 #define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 #define CONFIG_MBEDTLS_AES_C 1 @@ -100,6 +104,7 @@ #define CONFIG_INT_WDT_CHECK_CPU1 1 #define CONFIG_ADC_CAL_LUT_ENABLE 1 #define CONFIG_FLASHMODE_DIO 1 +#define CONFIG_LWIP_ESP_LWIP_ASSERT 1 #define CONFIG_ESPTOOLPY_AFTER_RESET 1 #define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1 #define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 @@ -108,6 +113,7 @@ #define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024 #define CONFIG_MBEDTLS_RC4_DISABLED 1 #define CONFIG_FATFS_LFN_STACK 1 +#define CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED 1 #define CONFIG_CONSOLE_UART_NUM 0 #define CONFIG_ARDUINO_EVENT_RUNNING_CORE 1 #define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 @@ -122,6 +128,7 @@ #define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1 #define CONFIG_AUTOSTART_ARDUINO 1 #define CONFIG_ARDUINO_RUNNING_CORE 1 +#define CONFIG_ESP32_ECO3_CACHE_LOCK_FIX 1 #define CONFIG_PPP_CHAP_SUPPORT 1 #define CONFIG_LOG_DEFAULT_LEVEL_ERROR 1 #define CONFIG_TIMER_TASK_STACK_SIZE 4096 @@ -150,7 +157,6 @@ #define CONFIG_LWIP_MAX_ACTIVE_TCP 16 #define CONFIG_TASK_WDT_TIMEOUT_S 5 #define CONFIG_INT_WDT_TIMEOUT_MS 300 -#define CONFIG_SCCB_HARDWARE_I2C 1 #define CONFIG_ARDUINO_EVENT_RUN_CORE1 1 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_BTC_TASK_STACK_SIZE 8192 @@ -167,6 +173,7 @@ #define CONFIG_ESP32_REV_MIN 0 #define CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT 1 #define CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE 0 +#define CONFIG_OV5640_SUPPORT 1 #define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1 #define CONFIG_FATFS_TIMEOUT_MS 10000 #define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 32 @@ -180,7 +187,6 @@ #define CONFIG_ESP32_WIFI_NVS_ENABLED 1 #define CONFIG_MDNS_MAX_SERVICES 10 #define CONFIG_ULP_COPROC_ENABLED 1 -#define CONFIG_LSSH_SPARSE_MN_5 1 #define CONFIG_HFP_AUDIO_DATA_PATH_PCM 1 #define CONFIG_IDF_TARGET_ESP32 1 #define CONFIG_EMAC_CHECK_LINK_PERIOD_MS 2000 @@ -222,8 +228,8 @@ #define CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN 2 #define CONFIG_PICO_PSRAM_CS_IO 10 #define CONFIG_EMAC_TASK_STACK_SIZE 3072 +#define CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT 1 #define CONFIG_MB_QUEUE_LENGTH 20 -#define CONFIG_SW_COEXIST_PREFERENCE_VALUE 2 #define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1 #define CONFIG_OV2640_SUPPORT 1 #define CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER 1 @@ -238,12 +244,15 @@ #define CONFIG_SPIFFS_GC_MAX_RUNS 10 #define CONFIG_ARDUINO_RUN_CORE1 1 #define CONFIG_ESP32_APPTRACE_DEST_NONE 1 +#define CONFIG_ESP32_WIFI_RX_IRAM_OPT 1 +#define CONFIG_HP_NANO1 1 #define CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC 1 #define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 #define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM 32 #define CONFIG_HTTPD_MAX_URI_LEN 512 #define CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED 1 +#define CONFIG_OV7670_SUPPORT 1 #define CONFIG_ARDUHAL_ESP_LOG 1 #define CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED 1 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 240 @@ -262,6 +271,7 @@ #define CONFIG_BTU_TASK_STACK_SIZE 4096 #define CONFIG_SMP_ENABLE 1 #define CONFIG_SPIRAM_SIZE -1 +#define CONFIG_ARDUINO_UDP_TASK_PRIORITY 3 #define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1 #define CONFIG_SPIFFS_MAX_PARTITIONS 3 #define CONFIG_ESP_ERR_TO_NAME_LOOKUP 1 @@ -284,6 +294,7 @@ #define CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST 1 #define CONFIG_TCP_MAXRTX 12 #define CONFIG_ESPTOOLPY_AFTER "hard_reset" +#define CONFIG_LWIP_IP4_FRAG 1 #define CONFIG_TCPIP_TASK_AFFINITY 0x0 #define CONFIG_LWIP_SO_REUSE 1 #define CONFIG_ARDUINO_UDP_RUN_CORE1 1 @@ -301,7 +312,6 @@ #define CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY 1 #define CONFIG_D0WD_PSRAM_CLK_IO 17 #define CONFIG_BT_SSP_ENABLED 1 -#define CONFIG_SW_COEXIST_PREFERENCE_BALANCE 1 #define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 #define CONFIG_MONITOR_BAUD 115200 #define CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT -1 @@ -311,6 +321,8 @@ #define CONFIG_REDUCE_PHY_TX_POWER 1 #define CONFIG_BOOTLOADER_WDT_TIME_MS 9000 #define CONFIG_FREERTOS_CORETIMER_0 1 +#define CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF 1 +#define CONFIG_LWIP_IP6_FRAG 1 #define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0000 #define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" #define CONFIG_MBEDTLS_HAVE_TIME 1 @@ -340,6 +352,7 @@ #define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1 #define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1 #define CONFIG_HFP_CLIENT_ENABLE 1 +#define CONFIG_NT99141_SUPPORT 1 #define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1 #define CONFIG_SPI_SLAVE_ISR_IN_IRAM 1 #define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32 @@ -353,6 +366,7 @@ #define CONFIG_A2DP_ENABLE 1 #define CONFIG_MB_TIMER_GROUP 0 #define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 +#define CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS 5 #define CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE 1 #define CONFIG_SPIFFS_PAGE_SIZE 256 #define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1 @@ -375,9 +389,10 @@ #define CONFIG_UNITY_ENABLE_DOUBLE 1 #define CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD 20 #define CONFIG_BLUEDROID_PINNED_TO_CORE 0 +#define CONFIG_HD_NANO1 1 #define CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG 1 #define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR 1 #define CONFIG_ESP32_WIFI_IRAM_OPT 1 #define CONFIG_FATFS_API_ENCODING_ANSI_OEM 1 -#define CONFIG_ARDUINO_IDF_COMMIT "367c3c09c" +#define CONFIG_ARDUINO_IDF_COMMIT "66d3783c8" #define CONFIG_ARDUINO_IDF_BRANCH "release/v3.3" diff --git a/tools/sdk/include/driver/driver/ledc.h b/tools/sdk/include/driver/driver/ledc.h index 6a82c19a2f9..f54f5acd19d 100644 --- a/tools/sdk/include/driver/driver/ledc.h +++ b/tools/sdk/include/driver/driver/ledc.h @@ -171,6 +171,19 @@ esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf); */ esp_err_t ledc_update_duty(ledc_mode_t speed_mode, ledc_channel_t channel); +/** + * @brief Set LEDC output gpio. + * + * @param gpio_num The LEDC output gpio + * @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode + * @param ledc_channel LEDC channel (0-7), select from ledc_channel_t + * + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG Parameter error + */ +esp_err_t ledc_set_pin(int gpio_num, ledc_mode_t speed_mode, ledc_channel_t ledc_channel); + /** * @brief LEDC stop. * Disable LEDC output, and set idle level diff --git a/tools/sdk/include/driver/driver/periph_ctrl.h b/tools/sdk/include/driver/driver/periph_ctrl.h index 9689a8cb21c..1d010c0c2ca 100644 --- a/tools/sdk/include/driver/driver/periph_ctrl.h +++ b/tools/sdk/include/driver/driver/periph_ctrl.h @@ -62,6 +62,29 @@ void periph_module_disable(periph_module_t periph); */ void periph_module_reset(periph_module_t periph); +/** + * @brief enable wifi bt common module + * + * @note If wifi_bt_common_module_enable is called a number of times, + * wifi_bt_common_module_disable has to be called the same number of times + * in order to put the peripheral into disabled state. + * + * @return NULL + * + */ +void wifi_bt_common_module_enable(void); + +/** + * @brief disable wifi bt common module + * + * @note If wifi_bt_common_module_enable is called a number of times, + * wifi_bt_common_module_disable has to be called the same number of times + * in order to put the peripheral into disabled state. + * + * @return NULL + * + */ +void wifi_bt_common_module_disable(void); #ifdef __cplusplus } diff --git a/tools/sdk/include/driver/driver/sigmadelta.h b/tools/sdk/include/driver/driver/sigmadelta.h index 76237c193d3..b62d937a533 100644 --- a/tools/sdk/include/driver/driver/sigmadelta.h +++ b/tools/sdk/include/driver/driver/sigmadelta.h @@ -19,7 +19,7 @@ #include "soc/gpio_sd_reg.h" #include "driver/gpio.h" -#ifdef _cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -102,7 +102,7 @@ esp_err_t sigmadelta_set_prescale(sigmadelta_channel_t channel, uint8_t prescale */ esp_err_t sigmadelta_set_pin(sigmadelta_channel_t channel, gpio_num_t gpio_num); -#ifdef _cplusplus +#ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp-face/cat_face_3.h b/tools/sdk/include/esp-face/cat_face_3.h new file mode 100644 index 00000000000..42d6fa85821 --- /dev/null +++ b/tools/sdk/include/esp-face/cat_face_3.h @@ -0,0 +1,40 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2018 + * + * Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in which case, + * it is free of charge, to any person_body 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. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" +{ +#endif +#include "dl_lib_matrix3d.h" +#include "dl_lib_matrix3dq.h" +#include "freertos/FreeRTOS.h" +#include "detection.h" + + extern detection_model_t cat_face_3_model; + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/include/esp-face/detection.h b/tools/sdk/include/esp-face/detection.h new file mode 100644 index 00000000000..0bba4f49b6f --- /dev/null +++ b/tools/sdk/include/esp-face/detection.h @@ -0,0 +1,87 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2018 + * + * Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in which case, + * it is 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. + * + */ +#pragma once + +#ifdef __cplusplus +extern "C" +{ +#endif +#include "dl_lib_matrix3d.h" +#include "dl_lib_matrix3dq.h" +#include "freertos/FreeRTOS.h" + + typedef enum + { + Anchor_Point, /* #include -#if CONFIG_SPIRAM_SUPPORT +#if CONFIG_SPIRAM_SUPPORT || CONFIG_ESP32_SPIRAM_SUPPORT #include "freertos/FreeRTOS.h" +#define DL_SPIRAM_SUPPORT 1 +#else +#define DL_SPIRAM_SUPPORT 0 #endif + #ifndef max #define max(x, y) (((x) < (y)) ? (y) : (x)) #endif @@ -30,17 +34,17 @@ typedef enum typedef enum { - PADDING_VALID = 0, - PADDING_SAME = 1, - PADDING_SAME_DONT_FREE_INPUT = 2, - PADDING_SAME_MXNET = 3, + PADDING_VALID = 0, /*!< Valid padding */ + PADDING_SAME = 1, /*!< Same padding, from right to left, free input */ + PADDING_SAME_DONT_FREE_INPUT = 2, /*!< Same padding, from right to left, do not free input */ + PADDING_SAME_MXNET = 3, /*!< Same padding, from left to right */ } dl_padding_type; typedef enum { - DL_POOLING_MAX = 0, - DL_POOLING_AVG = 1, -} dl_pooling_type; + DL_POOLING_MAX = 0, /*!< Max pooling */ + DL_POOLING_AVG = 1, /*!< Average pooling */ +} dl_pooling_type; /* * Matrix for 3d * @Warning: the sequence of variables is fixed, cannot be modified, otherwise there will be errors in esp_dsp_dot_float @@ -65,11 +69,17 @@ typedef struct uc_t *item; /*!< Data */ } dl_matrix3du_t; +typedef enum +{ + UPSAMPLE_NEAREST_NEIGHBOR = 0, /*!< Use nearest neighbor interpolation as the upsample method*/ + UPSAMPLE_BILINEAR = 1, /*!< Use nearest bilinear interpolation as the upsample method*/ +} dl_upsample_type; + typedef struct { - int stride_x; - int stride_y; - dl_padding_type padding; + int stride_x; /*!< Strides of width */ + int stride_y; /*!< Strides of height */ + dl_padding_type padding; /*!< Padding type */ } dl_matrix3d_mobilenet_config_t; /* @@ -80,20 +90,20 @@ typedef struct * @param align Align of memory. If not required, set 0. * @return Pointer of allocated memory. Null for failed. */ -static inline void *dl_lib_calloc(int cnt, int size, int align) +static void *dl_lib_calloc(int cnt, int size, int align) { int total_size = cnt * size + align + sizeof(void *); void *res = malloc(total_size); if (NULL == res) { -#if CONFIG_SPIRAM_SUPPORT +#if DL_SPIRAM_SUPPORT res = heap_caps_malloc(total_size, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM); } if (NULL == res) { printf("Item psram alloc failed. Size: %d x %d\n", cnt, size); #else - printf("Item alloc failed. Size: %d x %d\n", cnt, size); + printf("Item alloc failed. Size: %d x %d, SPIRAM_FLAG: %d\n", cnt, size, DL_SPIRAM_SUPPORT); #endif return NULL; } @@ -109,6 +119,10 @@ static inline void *dl_lib_calloc(int cnt, int size, int align) return (void *)aligned; } +/** + * @brief Free the memory space allocated by 'dl_lib_calloc' + * + */ static inline void dl_lib_free(void *d) { if (NULL == d) @@ -286,15 +300,15 @@ void dl_matrix3d_sliced_transform_nchw(dl_matrix3d_t *out, /** * @brief Do a general CNN layer pass, dimension is (number, width, height, channel) * - * @param in Input matrix3d - * @param filter Weights of the neurons - * @param bias Bias for the CNN layer - * @param stride_x The step length of the convolution window in x(width) direction - * @param stride_y The step length of the convolution window in y(height) direction - * @param padding One of VALID or SAME - * @param mode Do convolution using C implement or xtensa implement, 0 or 1, with respect - * If ESP_PLATFORM is not defined, this value is not used. Default is 0 - * @return The result of CNN layer + * @param in Input matrix3d + * @param filter Weights of the neurons + * @param bias Bias for the CNN layer + * @param stride_x The step length of the convolution window in x(width) direction + * @param stride_y The step length of the convolution window in y(height) direction + * @param padding One of VALID or SAME + * @param mode Do convolution using C implement or xtensa implement, 0 or 1, with respect + * If ESP_PLATFORM is not defined, this value is not used. Default is 0 + * @return dl_matrix3d_t* The result of CNN layer */ dl_matrix3d_t *dl_matrix3d_conv(dl_matrix3d_t *in, dl_matrix3d_t *filter, @@ -316,14 +330,14 @@ dl_matrix3d_t *dl_matrix3d_global_pool(dl_matrix3d_t *in); /** * @brief Calculate pooling layer of a feature map * - * @param in Input matrix, size (1, w, h, c) - * @param f_w Window width - * @param f_h Window height - * @param stride_x Stride in horizontal direction - * @param stride_y Stride in vertical direction - * @param padding Padding type: PADDING_VALID and PADDING_SAME - * @param pooling_type Pooling type: DL_POOLING_MAX and POOLING_AVG - * @return Resulting matrix, size (1, w', h', c) + * @param in Input matrix, size (1, w, h, c) + * @param f_w Window width + * @param f_h Window height + * @param stride_x Stride in horizontal direction + * @param stride_y Stride in vertical direction + * @param padding Padding type: PADDING_VALID and PADDING_SAME + * @param pooling_type Pooling type: DL_POOLING_MAX and POOLING_AVG + * @return dl_matrix3d_t* Resulting matrix, size (1, w', h', c) */ dl_matrix3d_t *dl_matrix3d_pooling(dl_matrix3d_t *in, int f_w, @@ -346,20 +360,20 @@ void dl_matrix3d_batch_normalize(dl_matrix3d_t *m, /** * @brief Add a pair of matrix3d item-by-item: res=in_1+in_2 * - * @param in_1 First Floating point input matrix3d - * @param in_2 Second Floating point input matrix3d + * @param in_1 First Floating point input matrix3d + * @param in_2 Second Floating point input matrix3d * - * @return Added data + * @return dl_matrix3d_t* Added data */ dl_matrix3d_t *dl_matrix3d_add(dl_matrix3d_t *in_1, dl_matrix3d_t *in_2); /** * @brief Concatenate the channels of two matrix3ds into a new matrix3d * - * @param in_1 First Floating point input matrix3d - * @param in_2 Second Floating point input matrix3d + * @param in_1 First Floating point input matrix3d + * @param in_2 Second Floating point input matrix3d * - * @return A newly allocated matrix3d with as avlues in_1|in_2 + * @return dl_matrix3d_t* A newly allocated matrix3d with as avlues in_1|in_2 */ dl_matrix3d_t *dl_matrix3d_concat(dl_matrix3d_t *in_1, dl_matrix3d_t *in_2); @@ -477,8 +491,21 @@ dl_matrix3d_t *dl_matrix3d_mobilefaceblock_split(dl_matrix3d_t *in, int mode, int shortcut); +/** + * @brief Initialize the matrix3d feature map to bias + * + * @param out The matrix3d feature map needs to be initialized + * @param bias The bias of a convlotion operation + */ void dl_matrix3d_init_bias(dl_matrix3d_t *out, dl_matrix3d_t *bias); +/** + * @brief Do a elementwise multiplication of two matrix3ds + * + * @param out Preallocated matrix3d, size (n, w, h, c) + * @param in1 Input matrix 1, size (n, w, h, c) + * @param in2 Input matrix 2, size (n, w, h, c) + */ void dl_matrix3d_multiply(dl_matrix3d_t *out, dl_matrix3d_t *in1, dl_matrix3d_t *in2); // @@ -519,19 +546,49 @@ void dl_matrix3d_leaky_relu(dl_matrix3d_t *m, fptp_t alpha); // // Conv 1x1 // +/** + * @brief Do 1x1 convolution with a matrix3d + * + * @param out Preallocated matrix3d, size (1, w, h, n) + * @param in Input matrix, size (1, w, h, c) + * @param filter 1x1 filter, size (n, 1, 1, c) + */ void dl_matrix3dff_conv_1x1(dl_matrix3d_t *out, dl_matrix3d_t *in, dl_matrix3d_t *filter); +/** + * @brief Do 1x1 convolution with a matrix3d, with bias adding + * + * @param out Preallocated matrix3d, size (1, w, h, n) + * @param in Input matrix, size (1, w, h, c) + * @param filter 1x1 filter, size (n, 1, 1, c) + * @param bias Bias, size (1, 1, 1, n) + */ void dl_matrix3dff_conv_1x1_with_bias(dl_matrix3d_t *out, dl_matrix3d_t *in, dl_matrix3d_t *filter, dl_matrix3d_t *bias); +/** + * @brief Do 1x1 convolution with an 8-bit fixed point matrix + * + * @param out Preallocated matrix3d, size (1, w, h, n) + * @param in Input matrix, size (1, w, h, c) + * @param filter 1x1 filter, size (n, 1, 1, c) + */ void dl_matrix3duf_conv_1x1(dl_matrix3d_t *out, dl_matrix3du_t *in, dl_matrix3d_t *filter); +/** + * @brief Do 1x1 convolution with an 8-bit fixed point matrix, with bias adding + * + * @param out Preallocated matrix3d, size (1, w, h, n) + * @param in Input matrix, size (1, w, h, c) + * @param filter 1x1 filter, size (n, 1, 1, c) + * @param bias Bias, size (1, 1, 1, n) + */ void dl_matrix3duf_conv_1x1_with_bias(dl_matrix3d_t *out, dl_matrix3du_t *in, dl_matrix3d_t *filter, @@ -540,12 +597,33 @@ void dl_matrix3duf_conv_1x1_with_bias(dl_matrix3d_t *out, // // Conv 3x3 // + +/** + * @brief Do 3x3 convolution with a matrix3d, without padding + * + * @param out Preallocated matrix3d, size (1, w, h, n) + * @param in Input matrix, size (1, w, h, c) + * @param f 3x3 filter, size (n, 3, 3, c) + * @param step_x Stride of width + * @param step_y Stride of height + */ void dl_matrix3dff_conv_3x3_op(dl_matrix3d_t *out, dl_matrix3d_t *in, dl_matrix3d_t *f, int step_x, int step_y); +/** + * @brief Do 3x3 convolution with a matrix3d, with bias adding + * + * @param input Input matrix, size (1, w, h, c) + * @param filter 3x3 filter, size (n, 3, 3, c) + * @param bias Bias, size (1, 1, 1, n) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @return dl_matrix3d_t* Resulting matrix3d + */ dl_matrix3d_t *dl_matrix3dff_conv_3x3(dl_matrix3d_t *in, dl_matrix3d_t *filter, dl_matrix3d_t *bias, @@ -557,6 +635,17 @@ dl_matrix3d_t *dl_matrix3dff_conv_3x3(dl_matrix3d_t *in, // Conv Common // +/** + * @brief Do a general convolution layer pass with an 8-bit fixed point matrix, size is (number, width, height, channel) + * + * @param in Input image + * @param filter Weights of the neurons + * @param bias Bias for the CNN layer + * @param stride_x The step length of the convolution window in x(width) direction + * @param stride_y The step length of the convolution window in y(height) direction + * @param padding Padding type + * @return dl_matrix3d_t* Resulting matrix3d + */ dl_matrix3d_t *dl_matrix3duf_conv_common(dl_matrix3du_t *in, dl_matrix3d_t *filter, dl_matrix3d_t *bias, @@ -564,6 +653,17 @@ dl_matrix3d_t *dl_matrix3duf_conv_common(dl_matrix3du_t *in, int stride_y, dl_padding_type padding); +/** + * @brief Do a general convolution layer pass, size is (number, width, height, channel) + * + * @param in Input image + * @param filter Weights of the neurons + * @param bias Bias for the CNN layer + * @param stride_x The step length of the convolution window in x(width) direction + * @param stride_y The step length of the convolution window in y(height) direction + * @param padding Padding type + * @return dl_matrix3d_t* Resulting matrix3d + */ dl_matrix3d_t *dl_matrix3dff_conv_common(dl_matrix3d_t *in, dl_matrix3d_t *filter, dl_matrix3d_t *bias, @@ -575,18 +675,47 @@ dl_matrix3d_t *dl_matrix3dff_conv_common(dl_matrix3d_t *in, // Depthwise 3x3 // +/** + * @brief Do 3x3 depthwise convolution with a float matrix3d + * + * @param in Input matrix, size (1, w, h, c) + * @param filter 3x3 filter, size (1, 3, 3, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type, 0: valid, 1: same + * @return dl_matrix3d_t* Resulting float matrix3d + */ dl_matrix3d_t *dl_matrix3dff_depthwise_conv_3x3(dl_matrix3d_t *in, dl_matrix3d_t *filter, int stride_x, int stride_y, int padding); +/** + * @brief Do 3x3 depthwise convolution with a 8-bit fixed point matrix + * + * @param in Input matrix, size (1, w, h, c) + * @param filter 3x3 filter, size (1, 3, 3, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type, 0: valid, 1: same + * @return dl_matrix3d_t* Resulting float matrix3d + */ dl_matrix3d_t *dl_matrix3duf_depthwise_conv_3x3(dl_matrix3du_t *in, dl_matrix3d_t *filter, int stride_x, int stride_y, int padding); +/** + * @brief Do 3x3 depthwise convolution with a float matrix3d, without padding + * + * @param out Preallocated matrix3d, size (1, w, h, n) + * @param in Input matrix, size (1, w, h, c) + * @param f 3x3 filter, size (1, 3, 3, c) + * @param step_x Stride of width + * @param step_y Stride of height + */ void dl_matrix3dff_depthwise_conv_3x3_op(dl_matrix3d_t *out, dl_matrix3d_t *in, dl_matrix3d_t *f, @@ -630,6 +759,14 @@ void dl_matrix3dff_fc(dl_matrix3d_t *out, dl_matrix3d_t *in, dl_matrix3d_t *filter); +/** + * @brief Do fully connected layer forward, with bias adding + * + * @param out Preallocated resulting matrix, size (1, 1, 1, h) + * @param in Input matrix, size (1, 1, 1, w) + * @param filter Filter matrix, size (1, w, h, 1) + * @param bias Bias matrix, size (1, 1, 1, h) + */ void dl_matrix3dff_fc_with_bias(dl_matrix3d_t *out, dl_matrix3d_t *in, dl_matrix3d_t *filter, diff --git a/tools/sdk/include/esp-face/dl_lib_matrix3dq.h b/tools/sdk/include/esp-face/dl_lib_matrix3dq.h index 593cbe89ca7..0d982b4a0e0 100644 --- a/tools/sdk/include/esp-face/dl_lib_matrix3dq.h +++ b/tools/sdk/include/esp-face/dl_lib_matrix3dq.h @@ -56,6 +56,20 @@ typedef struct int compress_exponent; /*!< Exponent of compress filter */ } dl_matrix3dq_mobilenet_config_t; +typedef struct +{ + int stride_x; /*!< Strides of width */ + int stride_y; /*!< Strides of height */ + dl_padding_type padding; /*!< Padding type */ + dl_conv_mode mode; /*!< Implementation mode */ + int dw1_exponent; /*!< Exponent of dw1 filter */ + int pw1_exponent; /*!< Exponent of pw1 filter */ + int dw2_exponent; /*!< Exponent of dw2 filter */ + int pw2_exponent; /*!< Exponent of pw2 filter */ + int shortcut; /*!< Shortcut connection flag */ + int save_input; /*!< Input save flag */ +} dl_matrix3dq_blazeblock_config_t; + // // Utility // @@ -163,6 +177,13 @@ dl_matrix3dq_t *dl_matrixq_from_matrix3d_qmf(dl_matrix3d_t *m, int exponent); */ dl_matrix3dq_t *dl_matrixq_from_matrix3d(dl_matrix3d_t *m); +/** + * @brief Truncate the overflowed 16bit number + * + * @param value Input value + * @param location Location tag + * @return qtp_t Truncated value + */ qtp_t dl_matrix3dq_quant_range_exceeded_checking(int64_t value, char *location); /** @@ -186,13 +207,23 @@ void dl_matrix3dq_batch_normalize(dl_matrix3dq_t *m, dl_matrix3dq_t *scale, dl_m /** * @brief Add two quantized matrix with a pre-defined exponent * - * @param in_1 Adder 1 - * @param in_2 Adder 2 - * @param exponent Exponent for resulting matrix - * @return Result of accumulation of two matrix + * @param in_1 Adder 1 + * @param in_2 Adder 2 + * @param exponent Exponent for resulting matrix + * @return dl_matrix3dq_t* Result of accumulation of two matrix */ dl_matrix3dq_t *dl_matrix3dq_add(dl_matrix3dq_t *in_1, dl_matrix3dq_t *in_2, int exponent); +/** + * @brief Add two quantized matrix with different channels + * + * @param in_1 Adder 1 + * @param in_2 Adder 2 + * @param exponent Exponent for resulting matrix + * @return dl_matrix3dq_t* Result of accumulation of two matrix + */ +dl_matrix3dq_t *dl_matrix3dq_add_channel_diff(dl_matrix3dq_t *in_1, dl_matrix3dq_t *in_2, int exponent); + // // Activation // @@ -287,6 +318,7 @@ dl_matrix3dq_t *dl_matrix3dq_concat_8(dl_matrix3dq_t *in_1, * @param in Input matrix, size (1, w, h, c) * @param filter 1x1 filter, size (n, 1, 1, c) * @param mode Implementation mode + * @param name Layer name to debug */ void dl_matrix3dqq_conv_1x1(dl_matrix3dq_t *out, dl_matrix3dq_t *in, @@ -301,6 +333,7 @@ void dl_matrix3dqq_conv_1x1(dl_matrix3dq_t *out, * @param in Input matrix, size (1, w, h, c) * @param filter 1x1 filter, size (n, 1, 1, c) * @param mode Implementation mode + * @param name Layer name to debug */ void dl_matrix3dqq_conv_1x1_with_relu(dl_matrix3dq_t *out, dl_matrix3dq_t *in, @@ -326,13 +359,14 @@ void dl_matrix3dqq_conv_1x1_with_bias(dl_matrix3dq_t *out, char *name); /** - * @brief Do 1x1 convolution with a quantized matrix, with bias adding and relu activation + * @brief Do 1x1 convolution with a quantized matrix, with bias adding * * @param out Preallocated quantized matrix, size (1, w, h, n) * @param in Input matrix, size (1, w, h, c) * @param filter 1x1 filter, size (n, 1, 1, c) * @param bias Bias, size (1, 1, 1, n) * @param mode Implementation mode + * @param name Layer name to debug */ void dl_matrix3dqq_conv_1x1_with_bias_relu(dl_matrix3dq_t *out, dl_matrix3dq_t *in, @@ -342,14 +376,14 @@ void dl_matrix3dqq_conv_1x1_with_bias_relu(dl_matrix3dq_t *out, char *name); /** - * @brief + * @brief Do 1x1 convolution with a quantized matrix, with prelu activation * - * @param out - * @param in - * @param filter - * @param prelu - * @param mode - * @param name + * @param out Preallocated quantized matrix, size (1, w, h, n) + * @param in Input matrix, size (1, w, h, c) + * @param filter 1x1 filter, size (n, 1, 1, c) + * @param prelu prelu params, size (1, 1, 1, n) + * @param mode Implementation mode + * @param name Layer name to debug */ void dl_matrix3dqq_conv_1x1_with_prelu(dl_matrix3dq_t *out, dl_matrix3dq_t *in, @@ -365,6 +399,7 @@ void dl_matrix3dqq_conv_1x1_with_prelu(dl_matrix3dq_t *out, * @param in Input matrix, size (1, w, h, c) * @param filter 1x1 filter, size (n, 1, 1, c) * @param mode Implementation mode + * @param name Layer name to debug */ void dl_matrix3duq_conv_1x1(dl_matrix3dq_t *out, dl_matrix3du_t *in, @@ -380,6 +415,7 @@ void dl_matrix3duq_conv_1x1(dl_matrix3dq_t *out, * @param filter 1x1 filter, size (n, 1, 1, c) * @param bias Bias, size (1, 1, 1, n) * @param mode Implementation mode + * @param name Layer name to debug */ void dl_matrix3duq_conv_1x1_with_bias(dl_matrix3dq_t *out, dl_matrix3du_t *in, @@ -401,7 +437,7 @@ void dl_matrix3duq_conv_1x1_with_bias(dl_matrix3dq_t *out, * @param stride_y Stride of height * @param padding Padding type, 0: valid, 1: same * @param exponent Exponent for resulting matrix - * @param name + * @param name Layer name to debug * @return dl_matrix3dq_t* Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3dqq_conv_3x3(dl_matrix3dq_t *input, @@ -420,9 +456,9 @@ dl_matrix3dq_t *dl_matrix3dqq_conv_3x3(dl_matrix3dq_t *input, * @param bias Bias, size (1, 1, 1, n) * @param stride_x Stride of width * @param stride_y Stride of height - * @param padding + * @param padding Padding type * @param exponent Exponent for resulting matrix - * @param name + * @param name Layer name to debug * @return dl_matrix3dq_t* Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias(dl_matrix3dq_t *input, @@ -442,9 +478,9 @@ dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias(dl_matrix3dq_t *input, * @param bias Bias, size (1, 1, 1, n) * @param stride_x Stride of width * @param stride_y Stride of height - * @param padding + * @param padding Padding type * @param exponent Exponent for resulting matrix - * @param name + * @param name Layer name to debug * @return dl_matrix3dq_t* Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias_relu(dl_matrix3dq_t *input, @@ -457,17 +493,17 @@ dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias_relu(dl_matrix3dq_t *input, char *name); /** - * @brief + * @brief Do 3x3 convolution with an 8-bit fixed point matrix, with bias adding * - * @param input - * @param filter - * @param bias - * @param stride_x - * @param stride_y - * @param padding - * @param exponent - * @param name - * @return dl_matrix3dq_t* + * @param input Input matrix, size (1, w, h, c) + * @param filter 3x3 filter, size (n, 3, 3, c) + * @param bias Bias, size (1, 1, 1, n) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias(dl_matrix3du_t *input, dl_matrix3dq_t *filter, @@ -479,18 +515,18 @@ dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias(dl_matrix3du_t *input, char *name); /** - * @brief + * @brief Do 3x3 convolution with an 8-bit fixed point matrix, with bias adding, prelu activation * - * @param input - * @param filter - * @param bias - * @param prelu - * @param stride_x - * @param stride_y - * @param padding - * @param exponent - * @param name - * @return dl_matrix3dq_t* + * @param input Input matrix, size (1, w, h, c) + * @param filter 3x3 filter, size (n, 3, 3, c) + * @param bias Bias, size (1, 1, 1, n) + * @param prelu prelu params, size (1, 1, 1, n) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias_prelu(dl_matrix3du_t *input, dl_matrix3dq_t *filter, @@ -503,7 +539,20 @@ dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias_prelu(dl_matrix3du_t *input, char *name); - +/** + * @brief Do 3x3 convolution with a quantized matrix, with bias adding, prelu activation + * + * @param input Input matrix, size (1, w, h, c) + * @param filter 3x3 filter, size (n, 3, 3, c) + * @param bias Bias, size (1, 1, 1, n) + * @param prelu prelu params, size (1, 1, 1, n) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias_prelu(dl_matrix3dq_t *input, dl_matrix3dq_t *filter, dl_matrix3dq_t *bias, @@ -573,6 +622,7 @@ dl_matrix3dq_t *dl_matrix3duq_conv_common(dl_matrix3du_t *in, * @param stride_y Stride of height * @param padding Padding type, 0: valid, 1: same * @param exponent Exponent for resulting matrix + * @param name Layer name to debug * @return Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3duq_depthwise_conv_3x3(dl_matrix3du_t *in, @@ -591,7 +641,9 @@ dl_matrix3dq_t *dl_matrix3duq_depthwise_conv_3x3(dl_matrix3du_t *in, * @param stride_x Stride of width * @param stride_y Stride of height * @param padding Padding type, 0: valid, 1: same + * @param relu ReLU, 0: don't, 1: do * @param exponent Exponent for resulting matrix + * @param name Layer name to debug * @return Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3(dl_matrix3dq_t *in, @@ -599,6 +651,7 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3(dl_matrix3dq_t *in, int stride_x, int stride_y, dl_padding_type padding, + int relu, int exponent, char *name); @@ -624,13 +677,14 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_3(dl_matrix3dq_t *in, * @brief Do 3x3 depthwise convolution with a quantized matrix, with bias adding * * @param in Input matrix, size (1, w, h, c) - * @param filter 3x3 filter, size (1, 3, 3, c) + * @param f 3x3 filter, size (1, 3, 3, c) * @param bias Bias, size (1, 1, 1, c) * @param stride_x Stride of width * @param stride_y Stride of height * @param padding Padding type, 0: valid, 1: same * @param exponent Exponent for resulting matrix * @param relu Whether to use relu activation + * @param name Layer name to debug * @return Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_bias(dl_matrix3dq_t *in, @@ -647,11 +701,12 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_bias(dl_matrix3dq_t *in, * @brief Do 3x3 depthwise convolution with a quantized matrix, with bias adding and stride 1 * * @param in Input matrix, size (1, w, h, c) - * @param filter 3x3 filter, size (1, 3, 3, c) - * @param bias Bias, size (1, 1, 1, n) + * @param f 3x3 filter, size (1, 3, 3, c) + * @param bias Bias, size (1, 1, 1, c) * @param padding Padding type, 0: valid, 1: same * @param exponent Exponent for resulting matrix * @param relu Whether to use relu activation + * @param name Layer name to debug * @return Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3s1_with_bias(dl_matrix3dq_t *in, @@ -662,6 +717,19 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3s1_with_bias(dl_matrix3dq_t *in, int relu, char *name); +/** + * @brief Do 3x3 depthwise convolution with a quantized matrix, with prelu activation + * + * @param in Input matrix, size (1, w, h, c) + * @param filter 3x3 filter, size (1, 3, 3, c) + * @param prelu prelu params, size (1, 1, 1, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_prelu(dl_matrix3dq_t *in, dl_matrix3dq_t *filter, dl_matrix3dq_t *prelu, @@ -671,6 +739,20 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_prelu(dl_matrix3dq_t *in, int exponent, char *name); +/** + * @brief Do 3x3 depthwise convolution with a quantized matrix, with bias adding and prelu activation + * + * @param in Input matrix, size (1, w, h, c) + * @param f 3x3 filter, size (1, 3, 3, c) + * @param bias Bias, size (1, 1, 1, c) + * @param prelu prelu params, size (1, 1, 1, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_bias_prelu(dl_matrix3dq_t *in, dl_matrix3dq_t *f, dl_matrix3dq_t *bias, @@ -681,16 +763,226 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_bias_prelu(dl_matrix3dq_t int exponent, char *name); +/** + * @brief Do global depthwise convolution with a quantized matrix, with bias adding + * + * @param in Input matrix, size (1, w, h, c) + * @param filter filter, size (1, w, h, c) + * @param bias Bias, size (1, 1, 1, c) + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ dl_matrix3dq_t *dl_matrix3dqq_global_depthwise_conv_with_bias(dl_matrix3dq_t *in, dl_matrix3dq_t *filter, dl_matrix3dq_t *bias, int exponent, char *name); + + + +// +// Depthwise 2x2 +// +/** + * @brief Do 2x2 depthwise convolution with a quantized matrix + * + * @param in Input matrix, size (1, w, h, c) + * @param filter 2x2 filter, size (1, 2, 2, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type, 0: valid, 1: same + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_2x2(dl_matrix3dq_t *in, + dl_matrix3dq_t *filter, + int stride_x, + int stride_y, + dl_padding_type padding, + int exponent, + char *name); + +/** + * @brief Do 2x2 depthwise convolution with a quantized matrix, with bias adding + * + * @param in Input matrix, size (1, w, h, c) + * @param f 2x2 filter, size (1, 2, 2, c) + * @param bias Bias, size (1, 1, 1, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type, 0: valid, 1: same + * @param exponent Exponent for resulting matrix + * @param relu Whether to use relu activation + * @param name Layer name to debug + * @return Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_2x2_with_bias(dl_matrix3dq_t *in, + dl_matrix3dq_t *f, + dl_matrix3dq_t *bias, + int stride_x, + int stride_y, + dl_padding_type padding, + int exponent, + int relu, + char *name); + +/** + * @brief Do 2x2 depthwise convolution with a quantized matrix, with prelu activation + * + * @param in Input matrix, size (1, w, h, c) + * @param filter 2x2 filter, size (1, 2, 2, c) + * @param prelu prelu params, size (1, 1, 1, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_2x2_with_prelu(dl_matrix3dq_t *in, + dl_matrix3dq_t *filter, + dl_matrix3dq_t *prelu, + int stride_x, + int stride_y, + dl_padding_type padding, + int exponent, + char *name); + +/** + * @brief Do 2x2 depthwise convolution with a quantized matrix, with bias adding and prelu activation + * + * @param in Input matrix, size (1, w, h, c) + * @param f 2x2 filter, size (1, 2, 2, c) + * @param bias Bias, size (1, 1, 1, c) + * @param prelu prelu params, size (1, 1, 1, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_2x2_with_bias_prelu(dl_matrix3dq_t *in, + dl_matrix3dq_t *f, + dl_matrix3dq_t *bias, + dl_matrix3dq_t *prelu, + int stride_x, + int stride_y, + dl_padding_type padding, + int exponent, + char *name); + +// +// Depthwise 5x5 +// +/** + * @brief Do 5x5 depthwise convolution with a quantized matrix + * + * @param in Input matrix, size (1, w, h, c) + * @param filter 5x5 filter, size (1, 5, 5, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type, 0: valid, 1: same + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_5x5(dl_matrix3dq_t *in, + dl_matrix3dq_t *filter, + int stride_x, + int stride_y, + dl_padding_type padding, + int exponent, + char *name); + +/** + * @brief Do 5x5 depthwise convolution with a quantized matrix, with bias adding + * + * @param in Input matrix, size (1, w, h, c) + * @param f 5x5 filter, size (1, 5, 5, c) + * @param bias Bias, size (1, 1, 1, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type, 0: valid, 1: same + * @param exponent Exponent for resulting matrix + * @param relu Whether to use relu activation + * @param name Layer name to debug + * @return Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_5x5_with_bias(dl_matrix3dq_t *in, + dl_matrix3dq_t *f, + dl_matrix3dq_t *bias, + int stride_x, + int stride_y, + dl_padding_type padding, + int exponent, + int relu, + char *name); + +/** + * @brief Do 5x5 depthwise convolution with a quantized matrix, with prelu activation + * + * @param in Input matrix, size (1, w, h, c) + * @param filter 5x5 filter, size (1, 5, 5, c) + * @param prelu prelu params, size (1, 1, 1, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_5x5_with_prelu(dl_matrix3dq_t *in, + dl_matrix3dq_t *filter, + dl_matrix3dq_t *prelu, + int stride_x, + int stride_y, + dl_padding_type padding, + int exponent, + char *name); + +/** + * @brief Do 5x5 depthwise convolution with a quantized matrix, with bias adding and prelu activation + * + * @param in Input matrix, size (1, w, h, c) + * @param f 5x5 filter, size (1, 5, 5, c) + * @param bias Bias, size (1, 1, 1, c) + * @param prelu prelu params, size (1, 1, 1, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_5x5_with_bias_prelu(dl_matrix3dq_t *in, + dl_matrix3dq_t *f, + dl_matrix3dq_t *bias, + dl_matrix3dq_t *prelu, + int stride_x, + int stride_y, + dl_padding_type padding, + int exponent, + char *name); // // Depthwise Common // #if CONFIG_DEVELOPING_CODE +/** + * @brief Do a general depthwise convolution layer pass with a quantized matrix + * + * @param in Input matrix, size (1, w, h, c) + * @param filter Weights of the neurons, size (1, k_w, k_h, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param mode Implementation mode + * @return dl_matrix3dq_t* Resulting quantized matrix + */ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_common(dl_matrix3dq_t *in, dl_matrix3dq_t *filter, int stride_x, @@ -699,6 +991,18 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_common(dl_matrix3dq_t *in, int exponent, dl_conv_mode mode); +/** + * @brief Do a general depthwise convolution layer pass with an 8-bit fixed point matrix + * + * @param in Input matrix, size (1, w, h, c) + * @param filter Weights of the neurons, size (1, k_w, k_h, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Padding type + * @param exponent Exponent for resulting matrix + * @param mode Implementation mode + * @return dl_matrix3dq_t* Resulting quantized matrix + */ dl_matrix3dq_t *dl_matrix3duq_depthwise_conv_common(dl_matrix3du_t *in, dl_matrix3dq_t *filter, int stride_x, @@ -712,6 +1016,14 @@ dl_matrix3dq_t *dl_matrix3duq_depthwise_conv_common(dl_matrix3du_t *in, // Dot Product // +/** + * @brief Do dot product operation with a quantized matrix + * + * @param out Preallocated resulting matrix, size (1, 1, 1, h) + * @param in Input matrix, size (1, 1, 1, w) + * @param filter Filter matrix, size (1, w, h, 1) + * @param mode Implementation mode + */ void dl_matrix3dqq_dot_product(dl_matrix3dq_t *out, dl_matrix3dq_t *in, dl_matrix3dq_t *filter, @@ -727,7 +1039,7 @@ void dl_matrix3dqq_dot_product(dl_matrix3dq_t *out, * @param in Input matrix, size (1, 1, 1, w) * @param filter Filter matrix, size (1, w, h, 1) * @param mode Implementation mode - * @param name + * @param name Layer name to debug */ void dl_matrix3dqq_fc(dl_matrix3dq_t *out, dl_matrix3dq_t *in, @@ -743,6 +1055,7 @@ void dl_matrix3dqq_fc(dl_matrix3dq_t *out, * @param filter Filter matrix, size (1, w, h, 1) * @param bias Bias matrix, size (1, 1, 1, h) * @param mode Implementation mode + * @param name Layer name to debug */ void dl_matrix3dqq_fc_with_bias(dl_matrix3dq_t *out, dl_matrix3dq_t *in, @@ -830,6 +1143,28 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock(dl_matrix3dq_t *in, dl_conv_mode mode, int shortcut); +/** + * @brief Do mobilefacenet process, the process sequence is 1x1 pointwise->bn->prelu->3x3 depthwise->bn->prelu->1x1 pointwise->bn + * + * @param in Input matrix, size (1, w, h, c) + * @param pw Pointwise 1x1 filter, size (n1, 1, 1, c) + * @param pw_bias Pointwise bias, size (1, 1, 1, n1) + * @param pw_prelu Pointwise prelu, size (1, 1, 1, n1) + * @param dw Depthwise 3x3 filter, size (1, 3, 3, n1) + * @param dw_bias Depthwise bias, size (1, 1, 1, n1) + * @param dw_prelu Depthwise prelu, size(1, 1, 1, n1) + * @param pw_linear Pointwise 1x1 filter, size (n2, 1, 1, n1) + * @param pw_linear_bias Pointwise bias, size (1, 1, 1, n2) + * @param pw_exponent Exponent for pointwise resulting matrix + * @param dw_exponent Exponent for depthwise resulting matrix + * @param pw_linear_exponent Exponent for pointwise resulting matrix + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param padding Depthwise Convlution Padding type + * @param mode Implementation mode + * @param shortcut Whether has a shortcut at pointwise linear + * @return dl_matrix3dq_t* Resulting quantized matrix + */ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu(dl_matrix3dq_t *in, dl_matrix3dq_t *pw, dl_matrix3dq_t *pw_bias, @@ -848,6 +1183,15 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu(dl_matrix3dq_t *in, dl_conv_mode mode, int shortcut); +/**@{*/ +/** + * @brief Do mobilefacenet process, the process sequence is 1x1 pointwise->bn->prelu->3x3 depthwise->bn->prelu->1x1 pointwise->bn + * + * Compared to ‘dl_matrix3dqq_mobilefaceblock_prelu’, this family of functions 'dl_matrix3dqq_mobilefaceblock_prelu_split_x1_x2' + * split the first pointwise convlution into x1 pointwise convlutions, and split the second pointwise convlution into x2 pointwise convlutions. + * + * + */ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu_split_2_2(dl_matrix3dq_t *in, dl_matrix3dq_t *pw_1, dl_matrix3dq_t *pw_2, @@ -910,6 +1254,59 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu_split_1_2(dl_matrix3dq_t *in dl_padding_type padding, dl_conv_mode mode, int shortcut); +/**@}*/ + +// +// blazeblock +// + +/** + * @brief Do blazeblock process, the process sequence is depthwise->bn->1x1 pointwise->bn->shortcut->relu + * + * @param in Input matrix, size (1, w, h, c) + * @param dw1_kernel Depthwise filter, size (1, k, k, c) + * @param dw1_bias Depthwise bias, size (1, 1, 1, c) + * @param pw1_kernel Pointwise 1x1 filter, size (n, 1, 1, c) + * @param pw1_bias Pointwise bias, size (1, 1, 1, n) + * @param config blazeblock configuration + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_blazeblock(dl_matrix3dq_t *in, + dl_matrix3dq_t *dw1_kernel, + dl_matrix3dq_t *dw1_bias, + dl_matrix3dq_t *pw1_kernel, + dl_matrix3dq_t *pw1_bias, + dl_matrix3dq_blazeblock_config_t config, + char *name); + +/** + * @brief Do double blazeblock process, the process sequence is depthwise->bn->1x1 pointwise->bn->relu->depthwise->bn->1x1 pointwise->bn->shortcut->relu + * + * @param in Input matrix, size (1, w, h, c) + * @param dw1_kernel Depthwise filter, size (1, k, k, c) + * @param dw1_bias Depthwise bias, size (1, 1, 1, c) + * @param pw1_kernel Pointwise 1x1 filter, size (n1, 1, 1, c) + * @param pw1_bias Pointwise bias, size (1, 1, 1, n1) + * @param dw2_kernel Depthwise filter, size (1, k, k, n1) + * @param dw2_bias Depthwise bias, size (1, 1, 1, n1) + * @param pw2_kernel Pointwise 1x1 filter, size (n2, 1, 1, n1) + * @param pw2_bias Pointwise bias, size (1, 1, 1, n2) + * @param config blazeblock configuration + * @param name Layer name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix + */ +dl_matrix3dq_t *dl_matrix3dqq_double_blazeblock(dl_matrix3dq_t *in, + dl_matrix3dq_t *dw1_kernel, + dl_matrix3dq_t *dw1_bias, + dl_matrix3dq_t *pw1_kernel, + dl_matrix3dq_t *pw1_bias, + dl_matrix3dq_t *dw2_kernel, + dl_matrix3dq_t *dw2_bias, + dl_matrix3dq_t *pw2_kernel, + dl_matrix3dq_t *pw2_bias, + dl_matrix3dq_blazeblock_config_t config, + char *name); // // Mobilenet // @@ -925,7 +1322,8 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu_split_1_2(dl_matrix3dq_t *in * @param compress Pointwise 1x1 filter, size (n2, 1, 1, n1) * @param bias Pointwise bias, size (1, 1, 1, n2) * @param config Mobilenet configuration - * @return Resulting quantized matrix + * @param name Block name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3dqq_mobilenet(dl_matrix3dq_t *in, dl_matrix3dq_t *dilate, @@ -948,7 +1346,8 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilenet(dl_matrix3dq_t *in, * @param compress Pointwise 1x1 filter, size (n2, 1, 1, n1) * @param bias Pointwise bias, size (1, 1, 1, n2) * @param config Mobilenet configuration - * @return Resulting quantized matrix + * @param name Block name to debug + * @return dl_matrix3dq_t* Resulting quantized matrix */ dl_matrix3dq_t *dl_matrix3duq_mobilenet(dl_matrix3du_t *in, dl_matrix3dq_t *dilate, @@ -964,18 +1363,19 @@ dl_matrix3dq_t *dl_matrix3duq_mobilenet(dl_matrix3du_t *in, // Padding // +/**@{*/ /** - * @brief + * @brief This family of functions do a padding operation before a convlution * - * @param padded_input - * @param output_height - * @param output_width - * @param input - * @param stride_x - * @param stride_y - * @param kernel_size - * @param padding_type - * @return dl_error_type + * @param padded_input the padded result pointer + * @param output_height the output height pointer + * @param output_width the output width pointer + * @param input Input matrix, size (1, w, h, c) + * @param stride_x Stride of width + * @param stride_y Stride of height + * @param kernel_size Kernel size of the next convlution + * @param padding_type Padding type + * @return dl_error_type Return DL_SUCCESS if padding successfully, else return DL_FAIL */ dl_error_type dl_matrix3dqq_padding(dl_matrix3dq_t **padded_input, int *output_height, @@ -986,19 +1386,6 @@ dl_error_type dl_matrix3dqq_padding(dl_matrix3dq_t **padded_input, int kernel_size, dl_padding_type padding_type); -/** - * @brief - * - * @param padded_input - * @param output_height - * @param output_width - * @param input - * @param stride_x - * @param stride_y - * @param kernel_size - * @param padding_type - * @return dl_error_type - */ dl_error_type dl_matrix3duq_padding(dl_matrix3du_t **padded_input, int *output_height, int *output_width, @@ -1007,6 +1394,20 @@ dl_error_type dl_matrix3duq_padding(dl_matrix3du_t **padded_input, int stride_y, int kernel_size, dl_padding_type padding_type); +/**@}*/ + +// +// Upsample +// +/** + * @brief Upsample a feature map to twice the size + * + * @param in Input matrix, size (1, w, h, c) + * @param upsample upsample type + * @return dl_matrix3dq_t* Resulting matrix, size (1, 2*w, 2*h, c) + */ +dl_matrix3dq_t *dl_matrix3dqq_upsample_2x(dl_matrix3dq_t *in, + dl_upsample_type upsample); // // Pooling @@ -1014,22 +1415,22 @@ dl_error_type dl_matrix3duq_padding(dl_matrix3du_t **padded_input, /** * @brief Calculate average value of a feature map * - * @param in Input matrix, size (1, w, h, c) - * @return Resulting matrix, size (1, 1, 1, c) + * @param in Input matrix, size (1, w, h, c) + * @return dl_matrix3dq_t* Resulting matrix, size (1, 1, 1, c) */ dl_matrix3dq_t *dl_matrix3dq_global_pool(dl_matrix3dq_t *in); /** * @brief Calculate pooling layer of a feature map * - * @param in Input matrix, size (1, w, h, c) - * @param f_w Window width - * @param f_h Window height - * @param stride_x Stride in horizontal direction - * @param stride_y Stride in vertical direction - * @param padding Padding type: PADDING_VALID and PADDING_SAME - * @param pooling_type Pooling type: DL_POOLING_MAX and POOLING_AVG - * @return Resulting matrix, size (1, w', h', c) + * @param in Input matrix, size (1, w, h, c) + * @param f_w Window width + * @param f_h Window height + * @param stride_x Stride in horizontal direction + * @param stride_y Stride in vertical direction + * @param padding Padding type: PADDING_VALID and PADDING_SAME + * @param pooling_type Pooling type: DL_POOLING_MAX and POOLING_AVG + * @return dl_matrix3dq_t* Resulting matrix, size (1, w', h', c) */ dl_matrix3dq_t *dl_matrix3dq_pooling(dl_matrix3dq_t *in, int f_w, diff --git a/tools/sdk/include/esp-face/esp_image.hpp b/tools/sdk/include/esp-face/esp_image.hpp new file mode 100644 index 00000000000..f5f924d6b6a --- /dev/null +++ b/tools/sdk/include/esp-face/esp_image.hpp @@ -0,0 +1,344 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2018 + * + * Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in which case, + * it is 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. + * + */ +#pragma once + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#include +#include + +#ifdef __cplusplus +} +#endif + +typedef enum +{ + IMAGE_RESIZE_BILINEAR = 0, /* +class Image +{ +public: + /** + * @brief Convert a RGB565 pixel to RGB888 + * + * @param input Pixel value in RGB565 + * @param output Pixel value in RGB888 + */ + static inline void pixel_rgb565_to_rgb888(uint16_t input, T *output) + { + output[2] = (input & 0x1F00) >> 5; //blue + output[1] = ((input & 0x7) << 5) | ((input & 0xE000) >> 11); //green + output[0] = input & 0xF8; //red + }; + + /** + * @brief Resize a RGB565 image to a RGB88 image + * + * @param dst_image The destination image + * @param y_start The start y index of where resized image located + * @param y_end The end y index of where resized image located + * @param x_start The start x index of where resized image located + * @param x_end The end x index of where resized image located + * @param channel The channel number of image + * @param src_image The source image + * @param src_h The height of source image + * @param src_w The width of source image + * @param dst_w The width of destination image + * @param shift_left The bit number of left shifting + * @param type The resize type + */ + static void resize_to_rgb888(T *dst_image, int y_start, int y_end, int x_start, int x_end, int channel, uint16_t *src_image, int src_h, int src_w, int dst_w, int shift_left, image_resize_t type); + + /** + * @brief Resize a RGB888 image to a RGB88 image + * + * @param dst_image The destination image + * @param y_start The start y index of where resized image located + * @param y_end The end y index of where resized image located + * @param x_start The start x index of where resized image located + * @param x_end The end x index of where resized image located + * @param channel The channel number of image + * @param src_image The source image + * @param src_h The height of source image + * @param src_w The width of source image + * @param dst_w The width of destination image + * @param shift_left The bit number of left shifting + * @param type The resize type + */ + static void resize_to_rgb888(T *dst_image, int y_start, int y_end, int x_start, int x_end, int channel, uint8_t *src_image, int src_h, int src_w, int dst_w, int shift_left, image_resize_t type); + // static void resize_to_rgb565(uint16_t *dst_image, int y_start, int y_end, int x_start, int x_end, int channel, uint16_t *src_image, int src_h, int src_w, int dst_w, int shift_left, image_resize_t type); + // static void resize_to_rgb565(uint16_t *dst_image, int y_start, int y_end, int x_start, int x_end, int channel, uint8_t *src_image, int src_h, int src_w, int dst_w, int shift_left, image_resize_t type); +}; + +template +void Image::resize_to_rgb888(T *dst_image, int y_start, int y_end, int x_start, int x_end, int channel, uint16_t *src_image, int src_h, int src_w, int dst_w, int shift_left, image_resize_t type) +{ + assert(channel == 3); + float scale_y = (float)src_h / (y_end - y_start); + float scale_x = (float)src_w / (x_end - x_start); + int temp[13]; + + switch (type) + { + case IMAGE_RESIZE_BILINEAR: + for (size_t y = y_start; y < y_end; y++) + { + float ratio_y[2]; + ratio_y[0] = (float)((y + 0.5) * scale_y - 0.5); // y + int src_y = (int)ratio_y[0]; // y1 + ratio_y[0] -= src_y; // y - y1 + + if (src_y < 0) + { + ratio_y[0] = 0; + src_y = 0; + } + if (src_y > src_h - 2) + { + ratio_y[0] = 0; + src_y = src_h - 2; + } + ratio_y[1] = 1 - ratio_y[0]; // y2 - y + + int _dst_i = y * dst_w; + + int _src_row_0 = src_y * src_w; + int _src_row_1 = _src_row_0 + src_w; + + for (size_t x = x_start; x < x_end; x++) + { + float ratio_x[2]; + ratio_x[0] = (float)((x + 0.5) * scale_x - 0.5); // x + int src_x = (int)ratio_x[0]; // x1 + ratio_x[0] -= src_x; // x - x1 + + if (src_x < 0) + { + ratio_x[0] = 0; + src_x = 0; + } + if (src_x > src_w - 2) + { + ratio_x[0] = 0; + src_x = src_w - 2; + } + ratio_x[1] = 1 - ratio_x[0]; // x2 - x + + int dst_i = (_dst_i + x) * channel; + + int src_row_0 = _src_row_0 + src_x; + int src_row_1 = _src_row_1 + src_x; + + Image::pixel_rgb565_to_rgb888(src_image[src_row_0], temp); + Image::pixel_rgb565_to_rgb888(src_image[src_row_0 + 1], temp + 3); + Image::pixel_rgb565_to_rgb888(src_image[src_row_1], temp + 6); + Image::pixel_rgb565_to_rgb888(src_image[src_row_1 + 1], temp + 9); + + for (int c = 0; c < channel; c++) + { + temp[12] = round(temp[c] * ratio_x[1] * ratio_y[1] + temp[channel + c] * ratio_x[0] * ratio_y[1] + temp[channel + channel + c] * ratio_x[1] * ratio_y[0] + src_image[channel + channel + channel + c] * ratio_x[0] * ratio_y[0]); + dst_image[dst_i + c] = (shift_left > 0) ? (temp[12] << shift_left) : (temp[12] >> -shift_left); + } + } + } + break; + + case IMAGE_RESIZE_MEAN: + shift_left -= 2; + for (int y = y_start; y < y_end; y++) + { + int _dst_i = y * dst_w; + + float _src_row_0 = rintf(y * scale_y) * src_w; + float _src_row_1 = _src_row_0 + src_w; + + for (int x = x_start; x < x_end; x++) + { + int dst_i = (_dst_i + x) * channel; + + int src_row_0 = (_src_row_0 + rintf(x * scale_x)); + int src_row_1 = (_src_row_1 + rintf(x * scale_x)); + + Image::pixel_rgb565_to_rgb888(src_image[src_row_0], temp); + Image::pixel_rgb565_to_rgb888(src_image[src_row_0 + 1], temp + 3); + Image::pixel_rgb565_to_rgb888(src_image[src_row_1], temp + 6); + Image::pixel_rgb565_to_rgb888(src_image[src_row_1 + 1], temp + 9); + + dst_image[dst_i] = (shift_left > 0) ? ((temp[0] + temp[3] + temp[6] + temp[9]) << shift_left) : ((temp[0] + temp[3] + temp[6] + temp[9]) >> -shift_left); + dst_image[dst_i + 1] = (shift_left > 0) ? ((temp[1] + temp[4] + temp[7] + temp[10]) << shift_left) : ((temp[1] + temp[4] + temp[7] + temp[10]) >> -shift_left); + dst_image[dst_i + 2] = (shift_left > 0) ? ((temp[2] + temp[5] + temp[8] + temp[11]) << shift_left) : ((temp[1] + temp[4] + temp[7] + temp[10]) >> -shift_left); + } + } + + break; + + case IMAGE_RESIZE_NEAREST: + for (size_t y = y_start; y < y_end; y++) + { + int _dst_i = y * dst_w; + float _src_i = rintf(y * scale_y) * src_w; + + for (size_t x = x_start; x < x_end; x++) + { + int dst_i = (_dst_i + x) * channel; + int src_i = _src_i + rintf(x * scale_x); + + Image::pixel_rgb565_to_rgb888(src_image[src_i], temp); + + dst_image[dst_i] = (shift_left > 0) ? (temp[0] << shift_left) : (temp[0] >> -shift_left); + dst_image[dst_i + 1] = (shift_left > 0) ? (temp[1] << shift_left) : (temp[1] >> -shift_left); + dst_image[dst_i + 2] = (shift_left > 0) ? (temp[2] << shift_left) : (temp[2] >> -shift_left); + } + } + break; + + default: + break; + } +} + +template +void Image::resize_to_rgb888(T *dst_image, int y_start, int y_end, int x_start, int x_end, int channel, uint8_t *src_image, int src_h, int src_w, int dst_w, int shift_left, image_resize_t type) +{ + float scale_y = (float)src_h / (y_end - y_start); + float scale_x = (float)src_w / (x_end - x_start); + int temp; + + switch (type) + { + case IMAGE_RESIZE_BILINEAR: + for (size_t y = y_start; y < y_end; y++) + { + float ratio_y[2]; + ratio_y[0] = (float)((y + 0.5) * scale_y - 0.5); // y + int src_y = (int)ratio_y[0]; // y1 + ratio_y[0] -= src_y; // y - y1 + + if (src_y < 0) + { + ratio_y[0] = 0; + src_y = 0; + } + if (src_y > src_h - 2) + { + ratio_y[0] = 0; + src_y = src_h - 2; + } + ratio_y[1] = 1 - ratio_y[0]; // y2 - y + + int _dst_i = y * dst_w; + + int _src_row_0 = src_y * src_w; + int _src_row_1 = _src_row_0 + src_w; + + for (size_t x = x_start; x < x_end; x++) + { + float ratio_x[2]; + ratio_x[0] = (float)((x + 0.5) * scale_x - 0.5); // x + int src_x = (int)ratio_x[0]; // x1 + ratio_x[0] -= src_x; // x - x1 + + if (src_x < 0) + { + ratio_x[0] = 0; + src_x = 0; + } + if (src_x > src_w - 2) + { + ratio_x[0] = 0; + src_x = src_w - 2; + } + ratio_x[1] = 1 - ratio_x[0]; // x2 - x + + int dst_i = (_dst_i + x) * channel; + + int src_row_0 = (_src_row_0 + src_x) * channel; + int src_row_1 = (_src_row_1 + src_x) * channel; + + for (int c = 0; c < channel; c++) + { + temp = round(src_image[src_row_0 + c] * ratio_x[1] * ratio_y[1] + src_image[src_row_0 + channel + c] * ratio_x[0] * ratio_y[1] + src_image[src_row_1 + c] * ratio_x[1] * ratio_y[0] + src_image[src_row_1 + channel + c] * ratio_x[0] * ratio_y[0]); + dst_image[dst_i + c] = (shift_left > 0) ? (temp << shift_left) : (temp >> -shift_left); + } + } + } + break; + + case IMAGE_RESIZE_MEAN: + shift_left -= 2; + + for (size_t y = y_start; y < y_end; y++) + { + int _dst_i = y * dst_w; + + float _src_row_0 = rintf(y * scale_y) * src_w; + float _src_row_1 = _src_row_0 + src_w; + + for (size_t x = x_start; x < x_end; x++) + { + int dst_i = (_dst_i + x) * channel; + + int src_row_0 = (_src_row_0 + rintf(x * scale_x)) * channel; + int src_row_1 = (_src_row_1 + rintf(x * scale_x)) * channel; + + for (size_t c = 0; c < channel; c++) + { + temp = (int)src_image[src_row_0 + c] + (int)src_image[src_row_0 + channel + c] + (int)src_image[src_row_1 + c] + (int)src_image[src_row_1 + channel + c]; + dst_image[dst_i + c] = (shift_left > 0) ? (temp << shift_left) : (temp >> -shift_left); + } + } + } + break; + + case IMAGE_RESIZE_NEAREST: + for (size_t y = y_start; y < y_end; y++) + { + int _dst_i = y * dst_w; + float _src_i = rintf(y * scale_y) * src_w; + + for (size_t x = x_start; x < x_end; x++) + { + int dst_i = (_dst_i + x) * channel; + int src_i = (_src_i + rintf(x * scale_x)) * channel; + + for (size_t c = 0; c < channel; c++) + { + dst_image[dst_i + c] = (shift_left > 0) ? ((T)src_image[src_i + c] << shift_left) : ((T)src_image[src_i + c] >> -shift_left); + } + } + } + break; + + default: + break; + } +} \ No newline at end of file diff --git a/tools/sdk/include/esp-face/fd_forward.h b/tools/sdk/include/esp-face/fd_forward.h index 12db168f659..878c8c481c8 100644 --- a/tools/sdk/include/esp-face/fd_forward.h +++ b/tools/sdk/include/esp-face/fd_forward.h @@ -34,35 +34,40 @@ extern "C" typedef enum { - FAST = 0, - NORMAL = 1, + FAST = 0, /*!< fast resize type */ + NORMAL = 1, /*!< normal resize type */ } mtmn_resize_type; typedef struct { - float score; /// score threshold for filter candidates by score - float nms; /// nms threshold for nms process - int candidate_number; /// candidate number limitation for each net + float score; /*!< score threshold for filter candidates by score */ + float nms; /*!< nms threshold for nms process */ + int candidate_number; /*!< candidate number limitation for each net */ } threshold_config_t; typedef struct { - int w; /// net width - int h; /// net height - threshold_config_t threshold; /// threshold of net + int w; /*!< net width */ + int h; /*!< net height */ + threshold_config_t threshold; /*!< threshold of net */ } net_config_t; typedef struct { - float min_face; /// The minimum size of a detectable face - float pyramid; /// The scale of the gradient scaling for the input images - int pyramid_times; /// The pyramid resizing times - threshold_config_t p_threshold; /// The thresholds for P-Net. For details, see the definition of threshold_config_t - threshold_config_t r_threshold; /// The thresholds for R-Net. For details, see the definition of threshold_config_t - threshold_config_t o_threshold; /// The thresholds for O-Net. For details, see the definition of threshold_config_t - mtmn_resize_type type; /// The image resize type. 'pyramid' will lose efficacy, when 'type'==FAST. + float min_face; /*!< The minimum size of a detectable face */ + float pyramid; /*!< The scale of the gradient scaling for the input images */ + int pyramid_times; /*!< The pyramid resizing times */ + threshold_config_t p_threshold; /*!< The thresholds for P-Net. For details, see the definition of threshold_config_t */ + threshold_config_t r_threshold; /*!< The thresholds for R-Net. For details, see the definition of threshold_config_t */ + threshold_config_t o_threshold; /*!< The thresholds for O-Net. For details, see the definition of threshold_config_t */ + mtmn_resize_type type; /*!< The image resize type. 'pyramid' will lose efficacy, when 'type'==FAST. */ } mtmn_config_t; + /** + * @brief Get the initial MTMN model configuration + * + * @return mtmn_config_t MTMN configuration + */ static inline mtmn_config_t mtmn_init_config() { mtmn_config_t mtmn_config; diff --git a/tools/sdk/include/esp-face/fr_flash.h b/tools/sdk/include/esp-face/fr_flash.h index b21cea03060..5da0ddcc182 100644 --- a/tools/sdk/include/esp-face/fr_flash.h +++ b/tools/sdk/include/esp-face/fr_flash.h @@ -11,8 +11,8 @@ extern "C" #define FR_FLASH_SUBTYPE 32 #define FR_FLASH_PARTITION_NAME "fr" #define FR_FLASH_INFO_FLAG 12138 - - /** + + /** * @brief Produce face id according to the input aligned face, and save it to dest_id and flash. * * @param l Face id list @@ -24,6 +24,16 @@ extern "C" int8_t enroll_face_id_to_flash(face_id_list *l, dl_matrix3du_t *aligned_face); + /** + * @brief Produce face id according to the input aligned face, and save the id-name pairs to dest_id and flash. + * + * @param l Face id list + * @param new_id An aligned face + * @param name name corresponding to face id + * @return -2 Flash partition not found + * @return 0 Enrollment finish + * @return >=1 The left piece of aligned faces should be input + */ int8_t enroll_face_id_to_flash_with_name(face_id_name_list *l, dl_matrix3d_t *new_id, char *name); @@ -34,7 +44,13 @@ extern "C" * @return int8_t The number of IDs remaining in flash */ int8_t read_face_id_from_flash(face_id_list *l); - + + /** + * @brief Read the enrolled face IDs and their corresponding names from the flash. + * + * @param l Face id list + * @return int8_t The number of IDs remaining in flash + */ int8_t read_face_id_from_flash_with_name(face_id_name_list *l); /** @@ -44,7 +60,21 @@ extern "C" * @return int8_t The number of IDs remaining in flash */ int8_t delete_face_id_in_flash(face_id_list *l); - int8_t delete_face_id_in_flash_with_name(face_id_name_list *l, char *name); + + /** + * @brief Delete the enrolled face ID corresponding to the name in the flash. + * + * @param l Face id list + * @param name The name that needs to be deleted + * @return int8_t The number of IDs remaining in flash + */ + int8_t delete_face_id_in_flash_with_name(face_id_name_list *l, char *name); + + /** + * @brief Delete all the enrolled face IDs and names paris in the flash. + * + * @param l Face id list + */ void delete_face_all_in_flash_with_name(face_id_name_list *l); #if __cplusplus diff --git a/tools/sdk/include/esp-face/fr_forward.h b/tools/sdk/include/esp-face/fr_forward.h index c9dfd2a005a..32c55168eb6 100644 --- a/tools/sdk/include/esp-face/fr_forward.h +++ b/tools/sdk/include/esp-face/fr_forward.h @@ -29,15 +29,13 @@ extern "C" #define NOSE_EYE_RATIO_THRES_MIN 0.49f #define NOSE_EYE_RATIO_THRES_MAX 2.04f -/** - * @brief HTTP Client events data - */ + #define ENROLL_NAME_LEN 16 typedef struct tag_face_id_node { - struct tag_face_id_node *next; - char id_name[ENROLL_NAME_LEN]; - dl_matrix3d_t *id_vec; + struct tag_face_id_node *next; /*!< next face id node */ + char id_name[ENROLL_NAME_LEN]; /*!< name corresponding to the face id */ + dl_matrix3d_t *id_vec; /*!< face id */ } face_id_node; typedef struct @@ -59,14 +57,21 @@ extern "C" } face_id_list; /** - * @brief Initialize face id list + * @brief Initialize face id list. * - * @param l Face id list - * @param size Size of list, one list contains one vector - * @param confirm_times Enroll times for one id - * @return dl_matrix3du_t* Size: 1xFACE_WIDTHxFACE_HEIGHTx3 + * @param l Face id list + * @param size Size of list, one list contains one vector + * @param confirm_times Enroll times for one id */ void face_id_init(face_id_list *l, uint8_t size, uint8_t confirm_times); + + /** + * @brief Initialize face id list with name. + * + * @param l Face id list + * @param size Size of list, one list contains one vector + * @param confirm_times Enroll times for one id + */ void face_id_name_init(face_id_name_list *l, uint8_t size, uint8_t confirm_times); /** @@ -76,8 +81,9 @@ extern "C" */ dl_matrix3du_t *aligned_face_alloc(); + /**@{*/ /** - * @brief Align detected face to average face according to landmark + * @brief Align detected face to average face according to landmark. * * @param onet_boxes Output of MTMN with box and landmark * @param src Image matrix, rgb888 format @@ -88,10 +94,6 @@ extern "C" int8_t align_face_rot(box_array_t *onet_boxes, dl_matrix3du_t *src, dl_matrix3du_t *dest); - - int8_t align_face2(fptp_t *landmark, - dl_matrix3du_t *src, - dl_matrix3du_t *dest); int8_t align_face_sim(box_array_t *onet_boxes, dl_matrix3du_t *src, @@ -103,6 +105,7 @@ extern "C" { return align_face_sim(onet_boxes, src, dest); } + /**@}*/ /** * @brief Run the face recognition model to get the face feature @@ -115,26 +118,34 @@ extern "C" /** * @brief Add src_id to dest_id * - * @param dest_id - * @param src_id + * @param dest_id Face id after accumulation + * @param src_id Face id to be added */ void add_face_id(dl_matrix3d_t *dest_id, dl_matrix3d_t *src_id); /** * @brief Match face with the id_list, and return matched_id. - * + * + * @param l An ID list * @param algined_face An aligned face - * @param id_list An ID list * @return int8_t Matched face id */ int8_t recognize_face(face_id_list *l, dl_matrix3du_t *algined_face); + /** + * @brief Match face id with the id_list, and return matched face id node. + * + * @param l + * @param face_id + * @return face_id_node* + */ face_id_node *recognize_face_with_name(face_id_name_list *l, dl_matrix3d_t *face_id); + /** * @brief Produce face id according to the input aligned face, and save it to dest_id. * - * @param l face id list + * @param l Face id list * @param aligned_face An aligned face * @param enroll_confirm_times Confirm times for each face id enrollment * @return -1 Wrong input enroll_confirm_times @@ -143,18 +154,40 @@ extern "C" */ int8_t enroll_face(face_id_list *l, dl_matrix3du_t *aligned_face); + /** + * @brief Produce face id according to the input aligned face, and save the id-name pairs to dest_id + * + * @param l Face id list with name + * @param new_id A face id that need to be enrolled + * @param name name corresponding to the face id + * @return int8_t The left piece of aligned faces should be input + */ int8_t enroll_face_with_name(face_id_name_list *l, dl_matrix3d_t *new_id, char *name); /** - * @brief Alloc memory for aligned face. + * @brief Delete the enrolled face IDs * - * @param l face id list - * @return uint8_t left count + * @param l Face id list + * @return uint8_t The number of IDs remaining in face id list */ uint8_t delete_face(face_id_list *l); + + /** + * @brief Delete the enrolled face IDs and associated names + * + * @param l Face id list + * @param name The name that needs to be deleted + * @return int8_t The number of IDs remaining in face id list + */ int8_t delete_face_with_name(face_id_name_list *l, char *name); + + /** + * @brief Delete all the enrolled face IDs and names paris + * + * @param l Face id list with names + */ void delete_face_all_with_name(face_id_name_list *l); #if __cplusplus } diff --git a/tools/sdk/include/esp-face/frmn.h b/tools/sdk/include/esp-face/frmn.h index 6fb6d50d9e9..c1f08a0fadc 100644 --- a/tools/sdk/include/esp-face/frmn.h +++ b/tools/sdk/include/esp-face/frmn.h @@ -15,9 +15,10 @@ extern "C" * @return dl_matrix3d_t* Face ID feature vector, size is 512 */ dl_matrix3d_t *frmn(dl_matrix3d_t *in); - + + /**@{*/ /** - * @brief Forward the face recognition process with frmn model. Calculate in quantization. + * @brief Forward the face recognition process with specified model. Calculate in quantization. * * @param in Image matrix, rgb888 format, size is 56x56, normalized * @param mode 0: C implement; 1: handwrite xtensa instruction implement @@ -25,16 +26,8 @@ extern "C" */ dl_matrix3dq_t *frmn_q(dl_matrix3dq_t *in, dl_conv_mode mode); - /** - * @brief Forward the face recognition process with frmn2p model. Calculate in quantization. - * - * @param in Image matrix, rgb888 format, size is 56x56, normalized - * @param mode 0: C implement; 1: handwrite xtensa instruction implement - * @return Face ID feature vector, size is 512 - */ dl_matrix3dq_t *frmn2p_q(dl_matrix3dq_t *in, dl_conv_mode mode); - dl_matrix3dq_t *mfn56_42m_q(dl_matrix3dq_t *in, dl_conv_mode mode); dl_matrix3dq_t *mfn56_72m_q(dl_matrix3dq_t *in, dl_conv_mode mode); @@ -43,6 +36,8 @@ extern "C" dl_matrix3dq_t *mfn56_156m_q(dl_matrix3dq_t *in, dl_conv_mode mode); + /**@}*/ + #if __cplusplus } #endif diff --git a/tools/sdk/include/esp-face/hd_model.h b/tools/sdk/include/esp-face/hd_model.h new file mode 100644 index 00000000000..0bc28d70ddc --- /dev/null +++ b/tools/sdk/include/esp-face/hd_model.h @@ -0,0 +1,66 @@ +#pragma once + +#if __cplusplus +extern "C" +{ +#endif + +#include "dl_lib_matrix3d.h" +#include "dl_lib_matrix3dq.h" + + typedef struct + { + int num; /*!< The total number of the boxes */ + dl_matrix3d_t *cls; /*!< The class feature map corresponding to the box. size: (height, width, anchor_num, 1) */ + dl_matrix3d_t *score; /*!< The confidence score feature map of the class corresponding to the box. size: (height, width, anchor_num, 1) */ + dl_matrix3d_t *boxes; /*!< (x, y, w, h) of the boxes. x and y are the center coordinates. size:(height, width, anchor_num, 4) */ + } detection_result_t; + + /** + * @brief Forward the hand detection process with hd_nano1 model. Calculate in quantization. + * + * @param in A normalized image matrix in rgb888 format, its width and height must be integer multiples of 16. + * @param mode 0: C implement; 1: handwrite xtensa instruction implement + * @return detection_result_t** Detection results + */ + detection_result_t **hd_nano1_q(dl_matrix3dq_t *in, dl_conv_mode mode); + + /** + * @brief Forward the hand detection process with hd_lite1 model. Calculate in quantization. + * + * @param in A normalized image matrix in rgb888 format, its width and height must be integer multiples of 32. + * @param mode 0: C implement; 1: handwrite xtensa instruction implement. + * @return detection_result_t** Detection results. + */ + detection_result_t **hd_lite1_q(dl_matrix3dq_t *in, dl_conv_mode mode); + + /** + * @brief Free the single detection result. + * + * @param m The single detection result. + */ + void detection_result_free(detection_result_t *m); + + /** + * @brief Free the detection result group from different feature map. + * + * @param m The detection result group + * @param length The number of the detection results + */ + void detection_results_free(detection_result_t **m, int length); + + /** + * @brief Test the result of hand detection model. + * + */ + void hd_test(); + + /** + * @brief Test the forward time of hand detection model. + * + */ + void hd_time_test(); + +#if __cplusplus +} +#endif diff --git a/tools/sdk/include/esp-face/hp_model.h b/tools/sdk/include/esp-face/hp_model.h new file mode 100644 index 00000000000..ad9080c5473 --- /dev/null +++ b/tools/sdk/include/esp-face/hp_model.h @@ -0,0 +1,43 @@ +#pragma once + +#if __cplusplus +extern "C" +{ +#endif + +#include "dl_lib_matrix3d.h" +#include "dl_lib_matrix3dq.h" + + /** + * @brief Forward the hand pose estimation process with hp_nano1_ls16 model. Calculate in quantization. + * + * @param in A normalized image matrix in rgb888 format, its size is (1, 128, 128, 3). + * @param mode 0: C implement; 1: handwrite xtensa instruction implement + * @return dl_matrix3d_t* The resulting hand joint point coordinates, the size is (1, 1, 21, 2) + */ + dl_matrix3d_t *hp_nano1_ls16_q(dl_matrix3dq_t *in, dl_conv_mode mode); + + /** + * @brief Forward the hand pose estimation process with hp_lite1 model. Calculate in quantization. + * + * @param in A normalized image matrix in rgb888 format, its size is (1, 128, 128, 3). + * @param mode 0: C implement; 1: handwrite xtensa instruction implement + * @return dl_matrix3d_t* The resulting hand joint point coordinates, the size is (1, 1, 21, 2) + */ + dl_matrix3d_t *hp_lite1_q(dl_matrix3dq_t *in, dl_conv_mode mode); + + /** + * @brief Test the result of hand pose estimation model. + * + */ + void hp_test(); + + /** + * @brief Test the forward time of hand pose estimation model. + * + */ + void hp_time_test(); + +#if __cplusplus +} +#endif \ No newline at end of file diff --git a/tools/sdk/include/esp-face/image_util.h b/tools/sdk/include/esp-face/image_util.h index 65df1bc7711..f997b34154b 100644 --- a/tools/sdk/include/esp-face/image_util.h +++ b/tools/sdk/include/esp-face/image_util.h @@ -30,6 +30,8 @@ extern "C" #include #include "mtmn.h" +#define LANDMARKS_NUM (10) + #define MAX_VALID_COUNT_PER_IMAGE (30) #define DL_IMAGE_MIN(A, B) ((A) < (B) ? (A) : (B)) @@ -41,48 +43,64 @@ extern "C" typedef enum { - BINARY, + BINARY, /*!< binary */ } en_threshold_mode; + typedef struct { - fptp_t landmark_p[10]; + fptp_t landmark_p[LANDMARKS_NUM]; /*!< landmark struct */ } landmark_t; typedef struct { - fptp_t box_p[4]; + fptp_t box_p[4]; /*!< box struct */ } box_t; typedef struct tag_box_list { - fptp_t *score; - box_t *box; - landmark_t *landmark; - int len; + uint8_t *category; /*!< The category of the corresponding box */ + fptp_t *score; /*!< The confidence score of the class corresponding to the box */ + box_t *box; /*!< Anchor boxes or predicted boxes*/ + landmark_t *landmark; /*!< The landmarks corresponding to the box */ + int len; /*!< The num of the boxes */ } box_array_t; typedef struct tag_image_box { - struct tag_image_box *next; - fptp_t score; - box_t box; - box_t offset; - landmark_t landmark; + struct tag_image_box *next; /*!< Next image_box_t */ + uint8_t category; + fptp_t score; /*!< The confidence score of the class corresponding to the box */ + box_t box; /*!< Anchor boxes or predicted boxes */ + box_t offset; /*!< The predicted anchor-based offset */ + landmark_t landmark; /*!< The landmarks corresponding to the box */ } image_box_t; typedef struct tag_image_list { - image_box_t *head; - image_box_t *origin_head; - int len; + image_box_t *head; /*!< The current head of the image_list */ + image_box_t *origin_head; /*!< The original head of the image_list */ + int len; /*!< Length of the image_list */ } image_list_t; + /** + * @brief Get the width and height of the box. + * + * @param box Input box + * @param w Resulting width of the box + * @param h Resulting height of the box + */ static inline void image_get_width_and_height(box_t *box, float *w, float *h) { *w = box->box_p[2] - box->box_p[0] + 1; *h = box->box_p[3] - box->box_p[1] + 1; } + /** + * @brief Get the area of the box. + * + * @param box Input box + * @param area Resulting area of the box + */ static inline void image_get_area(box_t *box, float *area) { float w, h; @@ -90,6 +108,13 @@ extern "C" *area = w * h; } + /** + * @brief calibrate the boxes by offset + * + * @param image_list Input boxes + * @param image_height Height of the original image + * @param image_width Width of the original image + */ static inline void image_calibrate_by_offset(image_list_t *image_list, int image_height, int image_width) { for (image_box_t *head = image_list->head; head; head = head->next) @@ -113,6 +138,11 @@ extern "C" } } + /** + * @brief calibrate the landmarks + * + * @param image_list Input landmarks + */ static inline void image_landmark_calibrate(image_list_t *image_list) { for (image_box_t *head = image_list->head; head; head = head->next) @@ -136,6 +166,13 @@ extern "C" } } + /** + * @brief Convert a rectangular box into a square box + * + * @param boxes Input box + * @param width Width of the orignal image + * @param height height of the orignal image + */ static inline void image_rect2sqr(box_array_t *boxes, int width, int height) { for (int i = 0; i < boxes->len; i++) @@ -169,33 +206,67 @@ extern "C" } } + /**@{*/ + /** + * @brief Convert RGB565 image to RGB888 image + * + * @param in Input RGB565 image + * @param dst Resulting RGB888 image + */ static inline void rgb565_to_888(uint16_t in, uint8_t *dst) - { /*{{{*/ - dst[0] = (in & RGB565_MASK_BLUE) << 3; // blue + { /*{{{*/ + in = (in & 0xFF) << 8 | (in & 0xFF00) >> 8; + dst[2] = (in & RGB565_MASK_BLUE) << 3; // blue dst[1] = (in & RGB565_MASK_GREEN) >> 3; // green - dst[2] = (in & RGB565_MASK_RED) >> 8; // red - } /*}}}*/ + dst[0] = (in & RGB565_MASK_RED) >> 8; // red + // dst[0] = (in & 0x1F00) >> 5; + // dst[1] = ((in & 0x7) << 5) | ((in & 0xE000) >> 11); + // dst[2] = in & 0xF8; + } /*}}}*/ + + static inline void rgb565_to_888_q16(uint16_t in, int16_t *dst) + { /*{{{*/ + in = (in & 0xFF) << 8 | (in & 0xFF00) >> 8; + dst[2] = (in & RGB565_MASK_BLUE) << 3; // blue + dst[1] = (in & RGB565_MASK_GREEN) >> 3; // green + dst[0] = (in & RGB565_MASK_RED) >> 8; // red + + // dst[0] = (in & 0x1F00) >> 5; + // dst[1] = ((in & 0x7) << 5) | ((in & 0xE000) >> 11); + // dst[2] = in & 0xF8; + } /*}}}*/ + /**@}*/ + + /** + * @brief Convert RGB888 image to RGB565 image + * + * @param in Resulting RGB565 image + * @param r The red channel of the Input RGB888 image + * @param g The green channel of the Input RGB888 image + * @param b The blue channel of the Input RGB888 image + */ static inline void rgb888_to_565(uint16_t *in, uint8_t r, uint8_t g, uint8_t b) { /*{{{*/ uint16_t rgb565 = 0; rgb565 = ((r >> 3) << 11); rgb565 |= ((g >> 2) << 5); rgb565 |= (b >> 3); + rgb565 = (rgb565 & 0xFF) << 8 | (rgb565 & 0xFF00) >> 8; *in = rgb565; } /*}}}*/ /** - * @brief + * @brief Filter out the resulting boxes whose confidence score is lower than the threshold and convert the boxes to the actual boxes on the original image.((x, y, w, h) -> (x1, y1, x2, y2)) * - * @param score - * @param offset - * @param landmark - * @param width - * @param height - * @param anchor_number - * @param anchors_size - * @param score_threshold + * @param score Confidence score of the boxes + * @param offset The predicted anchor-based offset + * @param landmark The landmarks corresponding to the box + * @param width Height of the original image + * @param height Width of the original image + * @param anchor_number Anchor number of the detection output feature map + * @param anchors_size The anchor size + * @param score_threshold Threshold of the confidence score * @param stride * @param resized_height_scale * @param resized_width_scale @@ -215,32 +286,32 @@ extern "C" fptp_t resized_width_scale, bool do_regression); /** - * @brief + * @brief Sort the resulting box lists by their confidence score. * - * @param image_sorted_list - * @param insert_list + * @param image_sorted_list The sorted box list. + * @param insert_list The box list that have not been sorted. */ void image_sort_insert_by_score(image_list_t *image_sorted_list, const image_list_t *insert_list); /** - * @brief + * @brief Run NMS algorithm * - * @param image_list - * @param nms_threshold - * @param same_area + * @param image_list The input boxes list + * @param nms_threshold NMS threshold + * @param same_area The flag of boxes with same area */ void image_nms_process(image_list_t *image_list, fptp_t nms_threshold, int same_area); /** - * @brief + * @brief Resize an image to half size * - * @param dimage - * @param dw - * @param dh - * @param dc - * @param simage - * @param sw - * @param sc + * @param dimage The output image + * @param dw Width of the output image + * @param dh Height of the output image + * @param dc Channel of the output image + * @param simage Source image + * @param sw Width of the source image + * @param sc Channel of the source image */ void image_zoom_in_twice(uint8_t *dimage, int dw, @@ -251,82 +322,227 @@ extern "C" int sc); /** - * @brief + * @brief Resize the image in RGB888 format via bilinear interpolation * - * @param dst_image - * @param src_image - * @param dst_w - * @param dst_h - * @param dst_c - * @param src_w - * @param src_h + * @param dst_image The output image + * @param src_image Source image + * @param dst_w Width of the output image + * @param dst_h Height of the output image + * @param dst_c Channel of the output image + * @param src_w Width of the source image + * @param src_h Height of the source image */ void image_resize_linear(uint8_t *dst_image, uint8_t *src_image, int dst_w, int dst_h, int dst_c, int src_w, int src_h); /** - * @brief + * @brief Crop, rotate and zoom the image in RGB888 format, * - * @param corp_image - * @param src_image - * @param rotate_angle - * @param ratio - * @param center + * @param corp_image The output image + * @param src_image Source image + * @param rotate_angle Rotate angle + * @param ratio scaling ratio + * @param center Center of rotation */ void image_cropper(uint8_t *corp_image, uint8_t *src_image, int dst_w, int dst_h, int dst_c, int src_w, int src_h, float rotate_angle, float ratio, float *center); /** - * @brief + * @brief Convert the rgb565 image to the rgb888 image * - * @param m - * @param bmp - * @param count + * @param m The output rgb888 image + * @param bmp The input rgb565 image + * @param count Total pixels of the rgb565 image */ - void transform_input_image(uint8_t *m, uint16_t *bmp, int count); + void image_rgb565_to_888(uint8_t *m, uint16_t *bmp, int count); /** - * @brief + * @brief Convert the rgb888 image to the rgb565 image * - * @param bmp - * @param m - * @param count + * @param bmp The output rgb565 image + * @param m The input rgb888 image + * @param count Total pixels of the rgb565 image */ - void transform_output_image(uint16_t *bmp, uint8_t *m, int count); - void transform_output_image_adjustable(uint16_t *bmp, uint8_t *m, int src_w, int src_h, int dst_w, int dst_h); + void image_rgb888_to_565(uint16_t *bmp, uint8_t *m, int count); /** - * @brief + * @brief draw rectangle on the rgb565 image * - * @param buf - * @param boxes - * @param width + * @param buf Input image + * @param boxes Rectangle Boxes + * @param width Width of the input image */ void draw_rectangle_rgb565(uint16_t *buf, box_array_t *boxes, int width); /** - * @brief + * @brief draw rectangle on the rgb888 image * - * @param buf - * @param boxes - * @param width + * @param buf Input image + * @param boxes Rectangle Boxes + * @param width Width of the input image */ void draw_rectangle_rgb888(uint8_t *buf, box_array_t *boxes, int width); + + /** + * @brief Get the pixel difference of two images + * + * @param dst The output pixel difference + * @param src1 Input image 1 + * @param src2 Input image 2 + * @param count Total pixels of the input image + */ void image_abs_diff(uint8_t *dst, uint8_t *src1, uint8_t *src2, int count); + + /** + * @brief Binarize an image to 0 and value. + * + * @param dst The output image + * @param src Source image + * @param threshold Threshold of binarization + * @param value The value of binarization + * @param count Total pixels of the input image + * @param mode Threshold mode + */ void image_threshold(uint8_t *dst, uint8_t *src, int threshold, int value, int count, en_threshold_mode mode); + + /** + * @brief Erode the image + * + * @param dst The output image + * @param src Source image + * @param src_w Width of the source image + * @param src_h Height of the source image + * @param src_c Channel of the source image + */ void image_erode(uint8_t *dst, uint8_t *src, int src_w, int src_h, int src_c); typedef float matrixType; typedef struct { - int w; - int h; - matrixType **array; + int w; /*!< width */ + int h; /*!< height */ + matrixType **array; /*!< array */ } Matrix; + /** + * @brief Allocate a 2d matrix + * + * @param h Height of matrix + * @param w Width of matrix + * @return Matrix* 2d matrix + */ Matrix *matrix_alloc(int h, int w); + + /** + * @brief Free a 2d matrix + * + * @param m 2d matrix + */ void matrix_free(Matrix *m); + + /** + * @brief Get the similarity matrix of similarity transformation + * + * @param srcx Source x coordinates + * @param srcy Source y coordinates + * @param dstx Destination x coordinates + * @param dsty Destination y coordinates + * @param num The number of the coordinates + * @return Matrix* The resulting transformation matrix + */ Matrix *get_similarity_matrix(float *srcx, float *srcy, float *dstx, float *dsty, int num); + + /** + * @brief Get the affine transformation matrix + * + * @param srcx Source x coordinates + * @param srcy Source y coordinates + * @param dstx Destination x coordinates + * @param dsty Destination y coordinates + * @return Matrix* The resulting transformation matrix + */ + Matrix *get_affine_transform(float *srcx, float *srcy, float *dstx, float *dsty); + + /** + * @brief Applies an affine transformation to an image + * + * @param img Input image + * @param crop Dst output image that has the size dsize and the same type as src + * @param M Affine transformation matrix + */ void warp_affine(dl_matrix3du_t *img, dl_matrix3du_t *crop, Matrix *M); + /** + * @brief Resize the image in RGB888 format via bilinear interpolation, and quantify the output image + * + * @param dst_image Quantized output image + * @param src_image Input image + * @param dst_w Width of the output image + * @param dst_h Height of the output image + * @param dst_c Channel of the output image + * @param src_w Width of the input image + * @param src_h Height of the input image + * @param shift Shift parameter of quantization. + */ + void image_resize_linear_q(qtp_t *dst_image, uint8_t *src_image, int dst_w, int dst_h, int dst_c, int src_w, int src_h, int shift); + + /** + * @brief Preprocess the input image of object detection model. The process is like this: resize -> normalize -> quantify + * + * @param image Input image, RGB888 format. + * @param input_w Width of the input image. + * @param input_h Height of the input image. + * @param target_size Target size of the model input image. + * @param exponent Exponent of the quantized model input image. + * @param process_mode Process mode. 0: resize with padding to keep height == width. 1: resize without padding, height != width. + * @return dl_matrix3dq_t* The resulting preprocessed image. + */ + dl_matrix3dq_t *image_resize_normalize_quantize(uint8_t *image, int input_w, int input_h, int target_size, int exponent, int process_mode); + + /** + * @brief Resize the image in RGB565 format via mean neighbour interpolation, and quantify the output image + * + * @param dimage Quantized output image. + * @param simage Input image. + * @param dw Width of the allocated output image memory. + * @param dc Channel of the allocated output image memory. + * @param sw Width of the input image. + * @param sh Height of the input image. + * @param tw Target width of the output image. + * @param th Target height of the output image. + * @param shift Shift parameter of quantization. + */ + void image_resize_shift_fast(qtp_t *dimage, uint16_t *simage, int dw, int dc, int sw, int sh, int tw, int th, int shift); + + /** + * @brief Resize the image in RGB565 format via nearest neighbour interpolation, and quantify the output image + * + * @param dimage Quantized output image. + * @param simage Input image. + * @param dw Width of the allocated output image memory. + * @param dc Channel of the allocated output image memory. + * @param sw Width of the input image. + * @param sh Height of the input image. + * @param tw Target width of the output image. + * @param th Target height of the output image. + * @param shift Shift parameter of quantization. + */ + void image_resize_nearest_shift(qtp_t *dimage, uint16_t *simage, int dw, int dc, int sw, int sh, int tw, int th, int shift); + + /** + * @brief Crop the image in RGB565 format and resize it to target size, then quantify the output image + * + * @param dimage Quantized output image. + * @param simage Input image. + * @param dw Target size of the output image. + * @param sw Width of the input image. + * @param sh Height of the input image. + * @param x1 The x coordinate of the upper left corner of the cropped area + * @param y1 The y coordinate of the upper left corner of the cropped area + * @param x2 The x coordinate of the lower right corner of the cropped area + * @param y2 The y coordinate of the lower right corner of the cropped area + * @param shift Shift parameter of quantization. + */ + void image_crop_shift_fast(qtp_t *dimage, uint16_t *simage, int dw, int sw, int sh, int x1, int y1, int x2, int y2, int shift); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp32-camera/esp_camera.h b/tools/sdk/include/esp32-camera/esp_camera.h index 071b986fa5a..dadd0c0983f 100755 --- a/tools/sdk/include/esp32-camera/esp_camera.h +++ b/tools/sdk/include/esp32-camera/esp_camera.h @@ -68,6 +68,7 @@ #include "esp_err.h" #include "driver/ledc.h" #include "sensor.h" +#include "sys/time.h" #ifdef __cplusplus extern "C" { @@ -115,6 +116,7 @@ typedef struct { size_t width; /*!< Width of the buffer in pixels */ size_t height; /*!< Height of the buffer in pixels */ pixformat_t format; /*!< Format of the pixel data */ + struct timeval timestamp; /*!< Timestamp since boot of the first DMA buffer of the frame */ } camera_fb_t; #define ESP_ERR_CAMERA_BASE 0x20000 @@ -171,6 +173,19 @@ void esp_camera_fb_return(camera_fb_t * fb); */ sensor_t * esp_camera_sensor_get(); +/** + * @brief Save camera settings to non-volatile-storage (NVS) + * + * @param key A unique nvs key name for the camera settings + */ +esp_err_t esp_camera_save_to_nvs(const char *key); + +/** + * @brief Load camera settings from non-volatile-storage (NVS) + * + * @param key A unique nvs key name for the camera settings + */ +esp_err_t esp_camera_load_from_nvs(const char *key); #ifdef __cplusplus } diff --git a/tools/sdk/include/esp32-camera/sensor.h b/tools/sdk/include/esp32-camera/sensor.h index e8b4e0cc0e6..ad6cd890d19 100755 --- a/tools/sdk/include/esp32-camera/sensor.h +++ b/tools/sdk/include/esp32-camera/sensor.h @@ -9,11 +9,15 @@ #ifndef __SENSOR_H__ #define __SENSOR_H__ #include +#include +#define NT99141_PID (0x14) #define OV9650_PID (0x96) -#define OV2640_PID (0x26) #define OV7725_PID (0x77) +#define OV2640_PID (0x26) #define OV3660_PID (0x36) +#define OV5640_PID (0x56) +#define OV7670_PID (0x76) typedef enum { PIXFORMAT_RGB565, // 2BPP/RGB565 @@ -27,23 +31,45 @@ typedef enum { } pixformat_t; typedef enum { - FRAMESIZE_96x96, // 96x96 + FRAMESIZE_96X96, // 96x96 FRAMESIZE_QQVGA, // 160x120 - FRAMESIZE_QQVGA2, // 128x160 FRAMESIZE_QCIF, // 176x144 FRAMESIZE_HQVGA, // 240x176 - FRAMESIZE_240x240, // 240x240 + FRAMESIZE_240X240, // 240x240 FRAMESIZE_QVGA, // 320x240 FRAMESIZE_CIF, // 400x296 + FRAMESIZE_HVGA, // 480x320 FRAMESIZE_VGA, // 640x480 FRAMESIZE_SVGA, // 800x600 FRAMESIZE_XGA, // 1024x768 + FRAMESIZE_HD, // 1280x720 FRAMESIZE_SXGA, // 1280x1024 FRAMESIZE_UXGA, // 1600x1200 - FRAMESIZE_QXGA, // 2048*1536 + // 3MP Sensors + FRAMESIZE_FHD, // 1920x1080 + FRAMESIZE_P_HD, // 720x1280 + FRAMESIZE_P_3MP, // 864x1536 + FRAMESIZE_QXGA, // 2048x1536 + // 5MP Sensors + FRAMESIZE_QHD, // 2560x1440 + FRAMESIZE_WQXGA, // 2560x1600 + FRAMESIZE_P_FHD, // 1080x1920 + FRAMESIZE_QSXGA, // 2560x1920 FRAMESIZE_INVALID } framesize_t; +typedef enum { + ASPECT_RATIO_4X3, + ASPECT_RATIO_3X2, + ASPECT_RATIO_16X10, + ASPECT_RATIO_5X3, + ASPECT_RATIO_16X9, + ASPECT_RATIO_21X9, + ASPECT_RATIO_5X4, + ASPECT_RATIO_1X1, + ASPECT_RATIO_9X16 +} aspect_ratio_t; + typedef enum { GAINCEILING_2X, GAINCEILING_4X, @@ -54,6 +80,28 @@ typedef enum { GAINCEILING_128X, } gainceiling_t; +typedef struct { + uint16_t max_width; + uint16_t max_height; + uint16_t start_x; + uint16_t start_y; + uint16_t end_x; + uint16_t end_y; + uint16_t offset_x; + uint16_t offset_y; + uint16_t total_x; + uint16_t total_y; +} ratio_settings_t; + +typedef struct { + const uint16_t width; + const uint16_t height; + const aspect_ratio_t aspect_ratio; +} resolution_info_t; + +// Resolution table (in sensor.c) +extern const resolution_info_t resolution[]; + typedef struct { uint8_t MIDH; uint8_t MIDL; @@ -63,6 +111,8 @@ typedef struct { typedef struct { framesize_t framesize;//0 - 10 + bool scale; + bool binning; uint8_t quality;//0 - 63 int8_t brightness;//-2 - 2 int8_t contrast;//-2 - 2 @@ -132,9 +182,12 @@ typedef struct _sensor { int (*set_raw_gma) (sensor_t *sensor, int enable); int (*set_lenc) (sensor_t *sensor, int enable); -} sensor_t; -// Resolution table (in camera.c) -extern const int resolution[][2]; + int (*get_reg) (sensor_t *sensor, int reg, int mask); + int (*set_reg) (sensor_t *sensor, int reg, int mask, int value); + int (*set_res_raw) (sensor_t *sensor, int startX, int startY, int endX, int endY, int offsetX, int offsetY, int totalX, int totalY, int outputX, int outputY, bool scale, bool binning); + int (*set_pll) (sensor_t *sensor, int bypass, int mul, int sys, int root, int pre, int seld5, int pclken, int pclk); + int (*set_xclk) (sensor_t *sensor, int timer, int xclk); +} sensor_t; #endif /* __SENSOR_H__ */ diff --git a/tools/sdk/include/esp32/esp_coexist.h b/tools/sdk/include/esp32/esp_coexist.h index c9b241d3dc6..6def75c571f 100644 --- a/tools/sdk/include/esp32/esp_coexist.h +++ b/tools/sdk/include/esp32/esp_coexist.h @@ -32,6 +32,22 @@ typedef enum { ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */ } esp_coex_prefer_t; + /** + * @brief coex status type + */ +typedef enum { + ESP_COEX_ST_TYPE_WIFI = 0, + ESP_COEX_ST_TYPE_BLE, + ESP_COEX_ST_TYPE_BT, +} esp_coex_status_type_t; + +#define ESP_COEX_BLE_ST_MESH_CONFIG 0x08 +#define ESP_COEX_BLE_ST_MESH_TRAFFIC 0x10 +#define ESP_COEX_BLE_ST_MESH_STANDBY 0x20 + +#define ESP_COEX_BT_ST_A2DP_STREAMING 0x10 +#define ESP_COEX_BT_ST_A2DP_PAUSED 0x20 + /** * @brief Get software coexist version string * @@ -40,7 +56,8 @@ typedef enum { const char *esp_coex_version_get(void); /** - * @brief Set coexist preference of performance + * @deprecated Use esp_coex_status_bit_set() and esp_coex_status_bit_clear() instead. + * Set coexist preference of performance * For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt) * more smooth while wifi is runnning something. * If prefer to wifi, it will do similar things as prefer to bluetooth. @@ -51,6 +68,37 @@ const char *esp_coex_version_get(void); */ esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer); +/** + * @brief Set coex schm status + * @param type : WIFI/BLE/BT + * @param status : WIFI/BLE/BT STATUS + * @return : ESP_OK - success, other - failed + */ +esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status); + +/** + * @brief Clear coex schm status + * @param type : WIFI/BLE/BT + * @param status : WIFI/BLE/BT STATUS + * @return : ESP_OK - success, other - failed + */ +esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status); + +/** + * @brief Enable BLE connection dynamic priority + * @attention If the parameter is true, BLE connection performance will be better but WiFi performance + * will be poorer. And vice versa. + * @param low_interval : true - Increase BLE connection priority to be higher than WiFi's when BLE + * connection interval is less or equal than 50 ms. The default value + * is false. + * false - not increace + * @param high_interval : true - Increase BLE connection priority to be higher than WiFi's when BLE + * connection interval is more than 50 ms. The default value is true. + * false - not increace + * @return : ESP_OK - success, other - failed + */ +esp_err_t esp_coex_ble_conn_dynamic_prio_enable(bool low_interval, bool high_interval); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp32/esp_idf_version.h b/tools/sdk/include/esp32/esp_idf_version.h new file mode 100644 index 00000000000..6b59e6b2789 --- /dev/null +++ b/tools/sdk/include/esp32/esp_idf_version.h @@ -0,0 +1,62 @@ +// Copyright 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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/** Major version number (X.x.x) */ +#define ESP_IDF_VERSION_MAJOR 3 +/** Minor version number (x.X.x) */ +#define ESP_IDF_VERSION_MINOR 3 +/** Patch version number (x.x.X) */ +#define ESP_IDF_VERSION_PATCH 4 + +/** + * Macro to convert IDF version number into an integer + * + * To be used in comparisons, such as ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0) + */ +#define ESP_IDF_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch)) + +/** + * Current IDF version, as an integer + * + * To be used in comparisons, such as ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0) + */ +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(ESP_IDF_VERSION_MAJOR, \ + ESP_IDF_VERSION_MINOR, \ + ESP_IDF_VERSION_PATCH) + +#ifndef __ASSEMBLER__ + +/** + * Return full IDF version string, same as 'git describe' output. + * + * @note If you are printing the ESP-IDF version in a log file or other information, + * this function provides more information than using the numerical version macros. + * For example, numerical version macros don't differentiate between development, + * pre-release and release versions, but the output of this function does. + * + * @return constant string from IDF_VER + */ +const char* esp_get_idf_version(void); + +#endif + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/include/esp32/esp_mesh.h b/tools/sdk/include/esp32/esp_mesh.h index e52e541ff86..e703ec8280a 100644 --- a/tools/sdk/include/esp32/esp_mesh.h +++ b/tools/sdk/include/esp32/esp_mesh.h @@ -124,6 +124,9 @@ extern "C" { #define ESP_ERR_MESH_DISCARD_DUPLICATE (ESP_ERR_MESH_BASE + 20) /**< discard the packet due to the duplicate sequence number */ #define ESP_ERR_MESH_DISCARD (ESP_ERR_MESH_BASE + 21) /**< discard the packet */ #define ESP_ERR_MESH_VOTING (ESP_ERR_MESH_BASE + 22) /**< vote in progress */ +#define ESP_ERR_MESH_XMIT (ESP_ERR_MESH_BASE + 23) /**< XMIT */ +#define ESP_ERR_MESH_QUEUE_READ (ESP_ERR_MESH_BASE + 24) /**< error in reading queue */ +#define ESP_ERR_MESH_RECV_RELEASE (ESP_ERR_MESH_BASE + 26) /**< release esp_mesh_recv_toDS */ /** * @brief Flags bitmap for esp_mesh_send() and esp_mesh_recv() @@ -203,6 +206,7 @@ typedef enum { MESH_ROOT, /**< the only sink of the mesh network. Has the ability to access external IP network */ MESH_NODE, /**< intermediate device. Has the ability to forward packets over the mesh network */ MESH_LEAF, /**< has no forwarding ability */ + MESH_STA, /**< connect to router with a standlone Wi-Fi station mode, no network expansion capability */ } mesh_type_t; /** @@ -735,6 +739,7 @@ esp_err_t esp_mesh_recv(mesh_addr_t *from, mesh_data_t *data, int timeout_ms, * - ESP_ERR_MESH_NOT_START * - ESP_ERR_MESH_TIMEOUT * - ESP_ERR_MESH_DISCARD + * - ESP_ERR_MESH_RECV_RELEASE */ esp_err_t esp_mesh_recv_toDS(mesh_addr_t *from, mesh_addr_t *to, mesh_data_t *data, int timeout_ms, int *flag, mesh_opt_t opt[], @@ -830,8 +835,10 @@ esp_err_t esp_mesh_get_id(mesh_addr_t *id); /** * @brief Designate device type over the mesh network + * - MESH_IDLE: designates a device as a self-organized node for a mesh network * - MESH_ROOT: designates the root node for a mesh network - * - MESH_LEAF: designates a device as a standalone Wi-Fi station + * - MESH_LEAF: designates a device as a standalone Wi-Fi station that connects to a parent + * - MESH_STA: designates a device as a standalone Wi-Fi station that connects to a router * * @param[in] type device type * diff --git a/tools/sdk/include/esp32/esp_phy_init.h b/tools/sdk/include/esp32/esp_phy_init.h index 6783ff54b47..3402f197b0b 100644 --- a/tools/sdk/include/esp32/esp_phy_init.h +++ b/tools/sdk/include/esp32/esp_phy_init.h @@ -202,6 +202,18 @@ esp_err_t esp_phy_rf_deinit(phy_rf_module_t module); */ void esp_phy_load_cal_and_init(phy_rf_module_t module); +/** +* @brief Enable WiFi/BT common clock +* +*/ +void esp_phy_common_clock_enable(void); + +/** +* @brief Disable WiFi/BT common clock +* +*/ +void esp_phy_common_clock_disable(void); + /** * @brief Module requires to enter modem sleep */ diff --git a/tools/sdk/include/esp32/esp_system.h b/tools/sdk/include/esp32/esp_system.h index 05214c8f57b..1afbe1fdc56 100644 --- a/tools/sdk/include/esp32/esp_system.h +++ b/tools/sdk/include/esp32/esp_system.h @@ -19,6 +19,7 @@ #include #include "esp_err.h" #include "esp_sleep.h" +#include "esp_idf_version.h" #ifdef __cplusplus extern "C" { @@ -129,6 +130,16 @@ uint32_t system_get_time(void) __attribute__ ((deprecated)); */ uint32_t esp_get_free_heap_size(void); +/** + * @brief Get the size of available internal heap. + * + * Note that the returned value may be larger than the maximum contiguous block + * which can be allocated. + * + * @return Available internal heap size, in bytes. + */ +uint32_t esp_get_free_internal_heap_size(void); + /** @cond */ /** * @brief Get the size of available heap. @@ -292,14 +303,6 @@ esp_err_t esp_derive_local_mac(uint8_t* local_mac, const uint8_t* universal_mac) const char* system_get_sdk_version(void) __attribute__ ((deprecated)); /** @endcond */ -/** - * Get IDF version - * - * @return constant string from IDF_VER - */ -const char* esp_get_idf_version(void); - - /** * @brief Chip models */ @@ -329,6 +332,15 @@ typedef struct { */ void esp_chip_info(esp_chip_info_t* out_info); +/** + * @brief Cache lock bug exists or not + * + * @return + * - true : bug exists + * - false : bug not exists + */ +bool soc_has_cache_lock_bug(void); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp32/esp_wifi.h b/tools/sdk/include/esp32/esp_wifi.h index 3285fd35009..f920c57bce9 100644 --- a/tools/sdk/include/esp32/esp_wifi.h +++ b/tools/sdk/include/esp32/esp_wifi.h @@ -542,8 +542,10 @@ esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); /** * @brief Set primary/secondary channel of ESP32 * - * @attention 1. This is a special API for sniffer - * @attention 2. This API should be called after esp_wifi_start() and esp_wifi_set_promiscuous() + * @attention 1. This API should be called after esp_wifi_start() + * @attention 2. When ESP32 is in STA mode, this API should not be called when STA is scanning or connecting to an external AP + * @attention 3. When ESP32 is in softAP mode, this API should not be called when softAP has connected to external STAs + * @attention 4. When ESP32 is in STA+softAP mode, this API should not be called when in the scenarios described above * * @param primary for HT20, primary is the channel number, for HT40, primary is the primary channel * @param second for HT20, second is ignored, for HT40, second is the second channel @@ -798,6 +800,21 @@ esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf); */ esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta); +/** + * @brief Get AID of STA connected with soft-AP + * + * @param mac STA's mac address + * @param[out] aid Store the AID corresponding to STA mac + * + * @return + * - ESP_OK: succeed + * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init + * - ESP_ERR_INVALID_ARG: invalid argument + * - ESP_ERR_NOT_FOUND: Requested resource not found + * - ESP_ERR_WIFI_MODE: WiFi mode is wrong + * - ESP_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid + */ +esp_err_t esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); /** * @brief Set the WiFi API configuration storage type @@ -880,28 +897,59 @@ esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_v esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); /** - * @brief Set maximum WiFi transmitting power - * - * @param power Maximum WiFi transmitting power, unit is 0.25dBm, range is [40, 82] corresponding to 10dBm - 20.5dBm here. + * @brief Set maximum transmitting power after WiFi start. + * + * @attention 1. Maximum power before wifi startup is limited by PHY init data bin. + * @attention 2. The value set by this API will be mapped to the max_tx_power of the structure wifi_country_t variable. + * @attention 3. Mapping Table {Power, max_tx_power} = {{8, 2}, {20, 5}, {28, 7}, {34, 8}, {44, 11}, + * {52, 13}, {56, 14}, {60, 15}, {66, 16}, {72, 18}, {78, 20}}. + * @attention 4. Param power unit is 0.25dBm, range is [8, 78] corresponding to 2dBm - 20dBm. + * @attention 5. Relationship between set value and actual value. As follows: + * +------------+--------------+ + * | set value | actual value | + * +============+==============+ + * | [8, 19] | 8 | + * +------------+--------------+ + * | [20, 27] | 20 | + * +------------+--------------+ + * | [28, 33] | 28 | + * +------------+--------------+ + * | [34, 43] | 34 | + * +------------+--------------+ + * | [44, 51] | 44 | + * +------------+--------------+ + * | [52, 55] | 52 | + * +------------+--------------+ + * | [56, 59] | 56 | + * +------------+--------------+ + * | [60, 65] | 60 | + * +------------+--------------+ + * | [66, 71] | 66 | + * +------------+--------------+ + * | [72, 77] | 72 | + * +------------+--------------+ + * | 78 | 78 | + * +------------+--------------+ + * @param power Maximum WiFi transmitting power. * * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init * - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start - * - ESP_ERR_WIFI_NOT_ARG: invalid argument + * - ESP_ERR_WIFI_ARG: invalid argument, e.g. parameter is out of range */ esp_err_t esp_wifi_set_max_tx_power(int8_t power); /** - * @brief Get maximum WiFi transmiting power + * @brief Get maximum transmiting power after WiFi start * - * @param power Maximum WiFi transmitting power, unit is 0.25dBm. + * @param power Maximum WiFi transmitting power, unit is 0.25dBm. * * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init * - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start - * - ESP_ERR_INVALID_ARG: invalid argument + * - ESP_ERR_WIFI_ARG: invalid argument */ esp_err_t esp_wifi_get_max_tx_power(int8_t *power); @@ -1063,6 +1111,39 @@ esp_err_t esp_wifi_set_ant(const wifi_ant_config_t *config); */ esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config); +/** + * @brief Set the inactive time of the ESP32 STA or AP + * + * @attention 1. For Station, If the station does not receive a beacon frame from the connected SoftAP during the inactive time, + * disconnect from SoftAP. Default 6s. + * @attention 2. For SoftAP, If the softAP doesn't receive any data from the connected STA during inactive time, + * the softAP will force deauth the STA. Default is 300s. + * @attention 3. The inactive time configuration is not stored into flash + * + * @param ifx interface to be configured. + * @param sec Inactive time. Unit seconds. + * + * @return + * - ESP_OK: succeed + * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init + * - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start + * - ESP_ERR_WIFI_ARG: invalid argument, For Station, if sec is less than 3. For SoftAP, if sec is less than 10. + */ +esp_err_t esp_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec); + +/** + * @brief Get inactive time of specified interface + * + * @param ifx Interface to be configured. + * @param sec Inactive time. Unit seconds. + * + * @return + * - ESP_OK: succeed + * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init + * - ESP_ERR_WIFI_ARG: invalid argument + */ +esp_err_t esp_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp32/esp_wifi_internal.h b/tools/sdk/include/esp32/esp_wifi_internal.h index 468a1809373..71d0a9c24ff 100644 --- a/tools/sdk/include/esp32/esp_wifi_internal.h +++ b/tools/sdk/include/esp32/esp_wifi_internal.h @@ -318,6 +318,43 @@ esp_err_t esp_wifi_internal_set_log_mod(wifi_log_module_t module, uint32_t submo */ esp_err_t esp_wifi_internal_get_log(wifi_log_level_t *log_level, uint32_t *log_mod); +/** + * @brief Get the user-configured channel info + * + * @param ifx : WiFi interface + * @param primary : store the configured primary channel + * @param second : store the configured second channel + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_internal_get_config_channel(wifi_interface_t ifx, uint8_t *primary, uint8_t *second); + +/** + * @brief Get the negotiated channel info after WiFi connection established + * + * @param ifx : WiFi interface + * @param aid : the connection number when a STA connects to the softAP + * @param primary : store the negotiated primary channel + * @param second : store the negotiated second channel + * @attention the aid param is only works when the ESP32 in softAP/softAP+STA mode + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_internal_get_negotiated_channel(wifi_interface_t ifx, uint8_t aid, uint8_t *primary, uint8_t *second); + +/** + * @brief Get the negotiated bandwidth info after WiFi connection established + * + * @param ifx : WiFi interface + * @param bw : store the negotiated bandwidth + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_internal_get_negotiated_bandwidth(wifi_interface_t ifx, uint8_t aid, uint8_t *bw); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp32/esp_wifi_os_adapter.h b/tools/sdk/include/esp32/esp_wifi_os_adapter.h index c8b8766deaa..666c44d9263 100644 --- a/tools/sdk/include/esp32/esp_wifi_os_adapter.h +++ b/tools/sdk/include/esp32/esp_wifi_os_adapter.h @@ -78,6 +78,8 @@ typedef struct { void (* _dport_access_stall_other_cpu_end_wrap)(void); int32_t (* _phy_rf_deinit)(uint32_t module); void (* _phy_load_cal_and_init)(uint32_t module); + void (* _phy_common_clock_enable)(void); + void (* _phy_common_clock_disable)(void); int32_t (* _read_mac)(uint8_t* mac, uint32_t type); void (* _timer_arm)(void *timer, uint32_t tmout, bool repeat); void (* _timer_disarm)(void *timer); @@ -103,6 +105,7 @@ typedef struct { int32_t (* _get_time)(void *t); unsigned long (* _random)(void); void (* _log_write)(uint32_t level, const char* tag, const char* format, ...); + void (* _log_writev)(uint32_t level, const char* tag, const char* format, va_list args); uint32_t (* _log_timestamp)(void); void * (* _malloc_internal)(size_t size); void * (* _realloc_internal)(void *ptr, size_t size); diff --git a/tools/sdk/include/esp32/esp_wifi_types.h b/tools/sdk/include/esp32/esp_wifi_types.h index 3f6eccde0be..f7786f5a02c 100644 --- a/tools/sdk/include/esp32/esp_wifi_types.h +++ b/tools/sdk/include/esp32/esp_wifi_types.h @@ -93,6 +93,7 @@ typedef enum { WIFI_REASON_ASSOC_FAIL = 203, WIFI_REASON_HANDSHAKE_TIMEOUT = 204, WIFI_REASON_CONNECTION_FAIL = 205, + WIFI_REASON_AP_TSF_RESET = 206, } wifi_err_reason_t; typedef enum { @@ -114,7 +115,7 @@ typedef struct { } wifi_active_scan_time_t; /** @brief Aggregate of active & passive scan time per channel */ -typedef union { +typedef struct { wifi_active_scan_time_t active; /**< active scan time per channel, units: millisecond. */ uint32_t passive; /**< passive scan time per channel, units: millisecond, values above 1500ms may cause station to disconnect from AP and are not recommended. */ @@ -214,7 +215,7 @@ typedef struct { uint8_t channel; /**< Channel of ESP32 soft-AP */ wifi_auth_mode_t authmode; /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */ uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */ - uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */ + uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 10 */ uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ } wifi_ap_config_t; diff --git a/tools/sdk/include/esp32/esp_wps.h b/tools/sdk/include/esp32/esp_wps.h index 9bd61cc3af1..cb5e9327921 100644 --- a/tools/sdk/include/esp32/esp_wps.h +++ b/tools/sdk/include/esp32/esp_wps.h @@ -74,14 +74,21 @@ typedef struct { wps_factory_information_t factory_info; } esp_wps_config_t; +/* C & C++ compilers have different rules about C99-style named initializers */ +#ifdef __cplusplus +#define WPS_AGG(X) { X } +#else +#define WPS_AGG(X) X +#endif + #define WPS_CONFIG_INIT_DEFAULT(type) { \ .wps_type = type, \ .crypto_funcs = &g_wifi_default_wps_crypto_funcs, \ .factory_info = { \ - .manufacturer = "ESPRESSIF", \ - .model_number = "ESP32", \ - .model_name = "ESPRESSIF IOT", \ - .device_name = "ESP STATION", \ + WPS_AGG( .manufacturer = "ESPRESSIF" ), \ + WPS_AGG( .model_number = "ESP32" ), \ + WPS_AGG( .model_name = "ESPRESSIF IOT" ), \ + WPS_AGG( .device_name = "ESP STATION" ), \ } \ } diff --git a/tools/sdk/include/esp_event/esp_event.h b/tools/sdk/include/esp_event/esp_event.h index f97deaf8b4a..48918398cf4 100644 --- a/tools/sdk/include/esp_event/esp_event.h +++ b/tools/sdk/include/esp_event/esp_event.h @@ -296,7 +296,7 @@ esp_err_t esp_event_post_to(esp_event_loop_handle_t event_loop, address - memory address of the event loop name - name of the event loop, 'none' if no dedicated task total_recieved - number of successfully posted events - total_dropped - number of events unsucessfully posted due to queue being full + total_dropped - number of events unsuccessfully posted due to queue being full handler format: address ev:base,id inv:total_invoked run:total_runtime diff --git a/tools/sdk/include/esp_http_client/esp_http_client.h b/tools/sdk/include/esp_http_client/esp_http_client.h index 3292bafa475..4ee0ff359b4 100644 --- a/tools/sdk/include/esp_http_client/esp_http_client.h +++ b/tools/sdk/include/esp_http_client/esp_http_client.h @@ -470,6 +470,17 @@ esp_err_t esp_http_client_set_redirection(esp_http_client_handle_t client); */ void esp_http_client_add_auth(esp_http_client_handle_t client); +/** + * @brief Checks if entire data in the response has been read without any error. + * + * @param[in] client The esp_http_client handle + * + * @return + * - true + * - false + */ +bool esp_http_client_is_complete_data_received(esp_http_client_handle_t client); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp_https_ota/esp_https_ota.h b/tools/sdk/include/esp_https_ota/esp_https_ota.h index 0c8fd06934d..fd69f27f894 100644 --- a/tools/sdk/include/esp_https_ota/esp_https_ota.h +++ b/tools/sdk/include/esp_https_ota/esp_https_ota.h @@ -15,7 +15,7 @@ #pragma once #include -#include +#include #ifdef __cplusplus extern "C" { @@ -110,6 +110,19 @@ esp_err_t esp_https_ota_begin(esp_https_ota_config_t *ota_config, esp_https_ota_ */ esp_err_t esp_https_ota_perform(esp_https_ota_handle_t https_ota_handle); +/** + * @brief Checks if complete data was received or not + * + * @note This API can be called just before esp_https_ota_finish() to validate if the complete image was indeed received. + * + * @param[in] https_ota_handle pointer to esp_https_ota_handle_t structure + * + * @return + * - false + * - true + */ +bool esp_https_ota_is_complete_data_received(esp_https_ota_handle_t https_ota_handle); + /** * @brief Clean-up HTTPS OTA Firmware upgrade and close HTTPS connection * diff --git a/tools/sdk/include/esp_websocket_client/esp_websocket_client.h b/tools/sdk/include/esp_websocket_client/esp_websocket_client.h new file mode 100644 index 00000000000..6a8bca2b97b --- /dev/null +++ b/tools/sdk/include/esp_websocket_client/esp_websocket_client.h @@ -0,0 +1,223 @@ +// Copyright 2015-2018 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_WEBSOCKET_CLIENT_H_ +#define _ESP_WEBSOCKET_CLIENT_H_ + + +#include +#include +#include +#include "freertos/FreeRTOS.h" +#include "esp_err.h" +#include "esp_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct esp_websocket_client *esp_websocket_client_handle_t; + +ESP_EVENT_DECLARE_BASE(WEBSOCKET_EVENTS); // declaration of the task events family + +/** + * @brief Websocket Client events id + */ +typedef enum { + WEBSOCKET_EVENT_ANY = -1, + WEBSOCKET_EVENT_ERROR = 0, /*!< This event occurs when there are any errors during execution */ + WEBSOCKET_EVENT_CONNECTED, /*!< Once the Websocket has been connected to the server, no data exchange has been performed */ + WEBSOCKET_EVENT_DISCONNECTED, /*!< The connection has been disconnected */ + WEBSOCKET_EVENT_DATA, /*!< When receiving data from the server, possibly multiple portions of the packet */ + WEBSOCKET_EVENT_MAX +} esp_websocket_event_id_t; + +/** + * @brief Websocket event data + */ +typedef struct { + const char *data_ptr; /*!< Data pointer */ + int data_len; /*!< Data length */ + uint8_t op_code; /*!< Received opcode */ + esp_websocket_client_handle_t client; /*!< esp_websocket_client_handle_t context */ + void *user_context; /*!< user_data context, from esp_websocket_client_config_t user_data */ + int payload_len; /*!< Total payload length, payloads exceeding buffer will be posted through multiple events */ + int payload_offset; /*!< Actual offset for the data associated with this event */ +} esp_websocket_event_data_t; + +/** + * @brief Websocket Client transport + */ +typedef enum { + WEBSOCKET_TRANSPORT_UNKNOWN = 0x0, /*!< Transport unknown */ + WEBSOCKET_TRANSPORT_OVER_TCP, /*!< Transport over tcp */ + WEBSOCKET_TRANSPORT_OVER_SSL, /*!< Transport over ssl */ +} esp_websocket_transport_t; + +/** + * @brief Websocket client setup configuration + */ +typedef struct { + const char *uri; /*!< Websocket URI, the information on the URI can be overrides the other fields below, if any */ + const char *host; /*!< Domain or IP as string */ + int port; /*!< Port to connect, default depend on esp_websocket_transport_t (80 or 443) */ + const char *username; /*!< Using for Http authentication - Not supported for now */ + const char *password; /*!< Using for Http authentication - Not supported for now */ + const char *path; /*!< HTTP Path, if not set, default is `/` */ + bool disable_auto_reconnect; /*!< Disable the automatic reconnect function when disconnected */ + void *user_context; /*!< HTTP user data context */ + int task_prio; /*!< Websocket task priority */ + int task_stack; /*!< Websocket task stack */ + int buffer_size; /*!< Websocket buffer size */ + const char *cert_pem; /*!< SSL Certification, PEM format as string, if the client requires to verify server */ + esp_websocket_transport_t transport; /*!< Websocket transport type, see `esp_websocket_transport_t */ + char *subprotocol; /*!< Websocket subprotocol */ + char *user_agent; /*!< Websocket user-agent */ + char *headers; /*!< Websocket additional headers */ + int pingpong_timeout_sec; /*!< Period before connection is aborted due to no PONGs received, disabled if value is 0 */ +} esp_websocket_client_config_t; + +/** + * @brief Start a Websocket session + * This function must be the first function to call, + * and it returns a esp_websocket_client_handle_t that you must use as input to other functions in the interface. + * This call MUST have a corresponding call to esp_websocket_client_destroy when the operation is complete. + * + * @param[in] config The configuration + * + * @return + * - `esp_websocket_client_handle_t` + * - NULL if any errors + */ +esp_websocket_client_handle_t esp_websocket_client_init(const esp_websocket_client_config_t *config); + +/** + * @brief Set URL for client, when performing this behavior, the options in the URL will replace the old ones + * Must stop the WebSocket client before set URI if the client has been connected + * + * @param[in] client The client + * @param[in] uri The uri + * + * @return esp_err_t + */ +esp_err_t esp_websocket_client_set_uri(esp_websocket_client_handle_t client, const char *uri); + +/** + * @brief Open the WebSocket connection + * + * @param[in] client The client + * + * @return esp_err_t + */ +esp_err_t esp_websocket_client_start(esp_websocket_client_handle_t client); + +/** + * @brief Close the WebSocket connection + * + * Notes: + * - Cannot be called from the websocket event handler + * + * @param[in] client The client + * + * @return esp_err_t + */ +esp_err_t esp_websocket_client_stop(esp_websocket_client_handle_t client); + +/** + * @brief Destroy the WebSocket connection and free all resources. + * This function must be the last function to call for an session. + * It is the opposite of the esp_websocket_client_init function and must be called with the same handle as input that a esp_websocket_client_init call returned. + * This might close all connections this handle has used. + * + * Notes: + * - Cannot be called from the websocket event handler + * + * @param[in] client The client + * + * @return esp_err_t + */ +esp_err_t esp_websocket_client_destroy(esp_websocket_client_handle_t client); + +/** + * @brief Generic write data to the WebSocket connection; defaults to binary send + * + * @param[in] client The client + * @param[in] data The data + * @param[in] len The length + * @param[in] timeout Write data timeout in RTOS ticks + * + * @return + * - Number of data was sent + * - (-1) if any errors + */ +int esp_websocket_client_send(esp_websocket_client_handle_t client, const char *data, int len, TickType_t timeout); + +/** + * @brief Write binary data to the WebSocket connection (data send with WS OPCODE=02, i.e. binary) + * + * @param[in] client The client + * @param[in] data The data + * @param[in] len The length + * @param[in] timeout Write data timeout in RTOS ticks + * + * @return + * - Number of data was sent + * - (-1) if any errors + */ +int esp_websocket_client_send_bin(esp_websocket_client_handle_t client, const char *data, int len, TickType_t timeout); + +/** + * @brief Write textual data to the WebSocket connection (data send with WS OPCODE=01, i.e. text) + * + * @param[in] client The client + * @param[in] data The data + * @param[in] len The length + * @param[in] timeout Write data timeout in RTOS ticks + * + * @return + * - Number of data was sent + * - (-1) if any errors + */ +int esp_websocket_client_send_text(esp_websocket_client_handle_t client, const char *data, int len, TickType_t timeout); + +/** + * @brief Check the WebSocket client connection state + * + * @param[in] client The client handle + * + * @return + * - true + * - false + */ +bool esp_websocket_client_is_connected(esp_websocket_client_handle_t client); + +/** + * @brief Register the Websocket Events + * + * @param client The client handle + * @param event The event id + * @param event_handler The callback function + * @param event_handler_arg User context + * @return esp_err_t + */ +esp_err_t esp_websocket_register_events(esp_websocket_client_handle_t client, + esp_websocket_event_id_t event, + esp_event_handler_t event_handler, + void *event_handler_arg); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/sdk/include/log/esp_log.h b/tools/sdk/include/log/esp_log.h index e57aabbdd53..8616c561033 100644 --- a/tools/sdk/include/log/esp_log.h +++ b/tools/sdk/include/log/esp_log.h @@ -108,6 +108,15 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, . /** @cond */ +/** + * @brief Write message into the log, va_list variant + * @see esp_log_write() + * + * This function is provided to ease integration toward other logging framework, + * so that esp_log can be used as a log sink. + */ +void esp_log_writev(esp_log_level_t level, const char* tag, const char* format, va_list args); + #include "esp_log_internal.h" #ifndef LOG_LOCAL_LEVEL diff --git a/tools/sdk/include/lwip/arch/cc.h b/tools/sdk/include/lwip/arch/cc.h index cba0b365ea2..b3ff59bc4f4 100644 --- a/tools/sdk/include/lwip/arch/cc.h +++ b/tools/sdk/include/lwip/arch/cc.h @@ -43,6 +43,10 @@ #define BYTE_ORDER LITTLE_ENDIAN +#ifndef CONFIG_LWIP_ESP_LWIP_ASSERT +#define LWIP_NOASSERT 1 +#endif + typedef uint8_t u8_t; typedef int8_t s8_t; typedef uint16_t u16_t; diff --git a/tools/sdk/include/lwip/cc.h b/tools/sdk/include/lwip/cc.h index cba0b365ea2..b3ff59bc4f4 100644 --- a/tools/sdk/include/lwip/cc.h +++ b/tools/sdk/include/lwip/cc.h @@ -43,6 +43,10 @@ #define BYTE_ORDER LITTLE_ENDIAN +#ifndef CONFIG_LWIP_ESP_LWIP_ASSERT +#define LWIP_NOASSERT 1 +#endif + typedef uint8_t u8_t; typedef int8_t s8_t; typedef uint16_t u16_t; diff --git a/tools/sdk/include/lwip/lwip/dns.h b/tools/sdk/include/lwip/lwip/dns.h index 38ea6367e1c..250065aab56 100644 --- a/tools/sdk/include/lwip/lwip/dns.h +++ b/tools/sdk/include/lwip/lwip/dns.h @@ -105,11 +105,7 @@ typedef void (*dns_found_callback)(const char *name, const ip_addr_t *ipaddr, vo void dns_init(void); void dns_tmr(void); void dns_setserver(u8_t numdns, const ip_addr_t *dnsserver); -#if ESP_DNS -ip_addr_t dns_getserver(u8_t numdns); -#else const ip_addr_t* dns_getserver(u8_t numdns); -#endif err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg); err_t dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, diff --git a/tools/sdk/include/lwip/lwip/opt.h b/tools/sdk/include/lwip/lwip/opt.h index f15aa7b6887..c08dcc0c952 100644 --- a/tools/sdk/include/lwip/lwip/opt.h +++ b/tools/sdk/include/lwip/lwip/opt.h @@ -1345,6 +1345,12 @@ #define LWIP_WND_SCALE 0 #define TCP_RCV_SCALE 0 #endif + +#if ESP_LWIP +#if !defined LWIP_TCP_RTO_TIME || defined __DOXYGEN__ +#define LWIP_TCP_RTO_TIME 3000 +#endif +#endif /** * @} */ @@ -2292,6 +2298,14 @@ #define LWIP_ND6_QUEUEING (LWIP_IPV6) #endif +/** + * ESP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address + * is being resolved. + */ +#if !defined ESP_ND6_QUEUEING || defined __DOXYGEN__ +#define ESP_ND6_QUEUEING LWIP_IPV6 +#endif + /** * MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution. */ diff --git a/tools/sdk/include/lwip/lwipopts.h b/tools/sdk/include/lwip/lwipopts.h index 6aa2253dc72..ad9a776f849 100644 --- a/tools/sdk/include/lwip/lwipopts.h +++ b/tools/sdk/include/lwip/lwipopts.h @@ -157,18 +157,32 @@ -------------------------------- */ /** - * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that + * IP_REASSEMBLY==1: Reassemble incoming fragmented IP4 packets. Note that * this option does not affect outgoing packet sizes, which can be controlled * via IP_FRAG. */ -#define IP_REASSEMBLY CONFIG_LWIP_IP_REASSEMBLY +#define IP_REASSEMBLY CONFIG_LWIP_IP4_REASSEMBLY /** - * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note + * LWIP_IPV6_REASS==1: reassemble incoming IP6 packets that fragmented. Note that + * this option does not affect outgoing packet sizes, which can be controlled + * via LWIP_IPV6_FRAG. + */ +#define LWIP_IPV6_REASS CONFIG_LWIP_IP6_REASSEMBLY + +/** + * IP_FRAG==1: Fragment outgoing IP4 packets if their size exceeds MTU. Note + * that this option does not affect incoming packet sizes, which can be + * controlled via IP_REASSEMBLY. + */ +#define IP_FRAG CONFIG_LWIP_IP4_FRAG + +/** + * LWIP_IPV6_FRAG==1: Fragment outgoing IP6 packets if their size exceeds MTU. Note * that this option does not affect incoming packet sizes, which can be * controlled via IP_REASSEMBLY. */ -#define IP_FRAG CONFIG_LWIP_IP_FRAG +#define LWIP_IPV6_FRAG CONFIG_LWIP_IP6_FRAG /** * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally) @@ -376,6 +390,12 @@ #define TCP_RCV_SCALE CONFIG_TCP_RCV_SCALE #endif +/** + * LWIP_TCP_RTO_TIME: TCP rto time. + * Default is 3 second. + */ +#define LWIP_TCP_RTO_TIME CONFIG_LWIP_TCP_RTO_TIME + /* ---------------------------------- ---------- Pbuf options ---------- @@ -545,6 +565,11 @@ */ #define LWIP_TCP_KEEPALIVE 1 +/** + * LWIP_SO_LINGER==1: Enable SO_LINGER processing. + */ +#define LWIP_SO_LINGER CONFIG_LWIP_SO_LINGER + /** * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing. */ @@ -660,6 +685,22 @@ */ #define LWIP_IPV6 1 +/** + * LWIP_ND6_RDNSS_MAX_DNS_SERVERS: Allow IPv6 DNS servers to be retrieved from + * NDP, up to the maximum number of allowed DNS servers (minus fallback slot) + */ +#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0 + +/** + * MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution. + */ +#define MEMP_NUM_ND6_QUEUE CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE + +/** + * LWIP_ND6_NUM_NEIGHBORS: Number of entries in IPv6 neighbor cache + */ +#define LWIP_ND6_NUM_NEIGHBORS CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS + /* --------------------------------------- ---------- Hook options --------------- @@ -738,6 +779,17 @@ */ #define ETHARP_TRUST_IP_MAC CONFIG_LWIP_ETHARP_TRUST_IP_MAC +/** + * ETHARP_SUPPORT_VLAN==1: support receiving and sending ethernet packets with + * VLAN header. See the description of LWIP_HOOK_VLAN_CHECK and + * LWIP_HOOK_VLAN_SET hooks to check/set VLAN headers. + * Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check. + * If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted. + * If ETHARP_VLAN_CHECK is not defined, all traffic is accepted. + * Alternatively, define a function/define ETHARP_VLAN_CHECK_FN(eth_hdr, vlan) + * that returns 1 to accept a packet or 0 to drop a packet. + */ +#define ETHARP_SUPPORT_VLAN CONFIG_ETHARP_SUPPORT_VLAN /** * POSIX I/O functions are mapped to LWIP via the VFS layer @@ -759,12 +811,12 @@ #define ESP_LWIP 1 #define ESP_LWIP_ARP 1 +#define ESP_IPV6 1 #define ESP_PER_SOC_TCP_WND 0 #define ESP_THREAD_SAFE 1 #define ESP_THREAD_SAFE_DEBUG LWIP_DBG_OFF #define ESP_DHCP 1 #define ESP_DNS 1 -#define ESP_IPV6_AUTOCONFIG 1 #define ESP_PERF 0 #define ESP_IP4_ATON 1 #define ESP_LIGHT_SLEEP 1 @@ -780,6 +832,10 @@ #define ESP_AUTO_RECV 1 #define ESP_GRATUITOUS_ARP CONFIG_ESP_GRATUITOUS_ARP +#ifdef CONFIG_LWIP_IPV6_AUTOCONFIG +#define ESP_IPV6_AUTOCONFIG CONFIG_LWIP_IPV6_AUTOCONFIG +#endif + #ifdef ESP_IRAM_ATTR #undef ESP_IRAM_ATTR #endif diff --git a/tools/sdk/include/lwip/netif/ppp/ppp.h b/tools/sdk/include/lwip/netif/ppp/ppp.h index d9ea097efdb..3d73c365708 100644 --- a/tools/sdk/include/lwip/netif/ppp/ppp.h +++ b/tools/sdk/include/lwip/netif/ppp/ppp.h @@ -47,6 +47,10 @@ #include "lwip/ip6_addr.h" #endif /* PPP_IPV6_SUPPORT */ +#ifdef __cplusplus +extern "C" { +#endif + /* Disable non-working or rarely used PPP feature, so rarely that we don't want to bloat ppp_opts.h with them */ #ifndef PPP_OPTIONS #define PPP_OPTIONS 0 @@ -685,6 +689,10 @@ err_t ppp_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg); #define ppp_set_netif_linkcallback(ppp, link_cb) \ netif_set_link_callback(ppp->netif, link_cb); +#ifdef __cplusplus +} +#endif + #endif /* PPP_H */ #endif /* PPP_SUPPORT */ diff --git a/tools/sdk/include/lwip/netif/ppp/pppos.h b/tools/sdk/include/lwip/netif/ppp/pppos.h index d924a9fc7ea..380a965ce6a 100644 --- a/tools/sdk/include/lwip/netif/ppp/pppos.h +++ b/tools/sdk/include/lwip/netif/ppp/pppos.h @@ -42,6 +42,10 @@ #include "ppp.h" #include "vj.h" +#ifdef __cplusplus +extern "C" { +#endif + /* PPP packet parser states. Current state indicates operation yet to be * completed. */ enum { @@ -114,5 +118,9 @@ void pppos_input(ppp_pcb *ppp, u8_t* data, int len); err_t pppos_input_sys(struct pbuf *p, struct netif *inp); #endif /* !NO_SYS && !PPP_INPROC_IRQ_SAFE */ +#ifdef __cplusplus +} +#endif + #endif /* PPPOS_H */ #endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */ diff --git a/tools/sdk/include/mbedtls/mbedtls/aes.h b/tools/sdk/include/mbedtls/mbedtls/aes.h index 94e7282d36d..d20cdbd6da8 100644 --- a/tools/sdk/include/mbedtls/mbedtls/aes.h +++ b/tools/sdk/include/mbedtls/mbedtls/aes.h @@ -20,8 +20,15 @@ * . */ -/* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -35,6 +42,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/aesni.h b/tools/sdk/include/mbedtls/mbedtls/aesni.h index a4ca012f8a1..91a4e0f1160 100644 --- a/tools/sdk/include/mbedtls/mbedtls/aesni.h +++ b/tools/sdk/include/mbedtls/mbedtls/aesni.h @@ -8,7 +8,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -22,6 +28,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_AESNI_H diff --git a/tools/sdk/include/mbedtls/mbedtls/arc4.h b/tools/sdk/include/mbedtls/mbedtls/arc4.h index fb044d5b7fd..ecaf3101221 100644 --- a/tools/sdk/include/mbedtls/mbedtls/arc4.h +++ b/tools/sdk/include/mbedtls/mbedtls/arc4.h @@ -8,7 +8,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -22,6 +28,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) * */ diff --git a/tools/sdk/include/mbedtls/mbedtls/aria.h b/tools/sdk/include/mbedtls/mbedtls/aria.h index 1e8956ed13c..66f2668bf37 100644 --- a/tools/sdk/include/mbedtls/mbedtls/aria.h +++ b/tools/sdk/include/mbedtls/mbedtls/aria.h @@ -9,8 +9,15 @@ * Korean, but see http://210.104.33.10/ARIA/index-e.html in English) * and also described by the IETF in RFC 5794. */ -/* Copyright (C) 2006-2018, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -24,6 +31,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/asn1.h b/tools/sdk/include/mbedtls/mbedtls/asn1.h index 96c1c9a8ab2..c64038cdb5c 100644 --- a/tools/sdk/include/mbedtls/mbedtls/asn1.h +++ b/tools/sdk/include/mbedtls/mbedtls/asn1.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ASN1_H diff --git a/tools/sdk/include/mbedtls/mbedtls/asn1write.h b/tools/sdk/include/mbedtls/mbedtls/asn1write.h index a194243696a..4fed59371ca 100644 --- a/tools/sdk/include/mbedtls/mbedtls/asn1write.h +++ b/tools/sdk/include/mbedtls/mbedtls/asn1write.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ASN1_WRITE_H diff --git a/tools/sdk/include/mbedtls/mbedtls/base64.h b/tools/sdk/include/mbedtls/mbedtls/base64.h index 0d024164c56..215255e628e 100644 --- a/tools/sdk/include/mbedtls/mbedtls/base64.h +++ b/tools/sdk/include/mbedtls/mbedtls/base64.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BASE64_H diff --git a/tools/sdk/include/mbedtls/mbedtls/bignum.h b/tools/sdk/include/mbedtls/mbedtls/bignum.h index 82cc9b053cf..1e41d702456 100644 --- a/tools/sdk/include/mbedtls/mbedtls/bignum.h +++ b/tools/sdk/include/mbedtls/mbedtls/bignum.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BIGNUM_H @@ -186,7 +213,7 @@ extern "C" { */ typedef struct mbedtls_mpi { - int s; /*!< integer sign */ + int s; /*!< Sign: -1 if the mpi is negative, 1 otherwise */ size_t n; /*!< total # of limbs */ mbedtls_mpi_uint *p; /*!< pointer to limbs */ } @@ -561,6 +588,24 @@ int mbedtls_mpi_cmp_abs( const mbedtls_mpi *X, const mbedtls_mpi *Y ); */ int mbedtls_mpi_cmp_mpi( const mbedtls_mpi *X, const mbedtls_mpi *Y ); +/** + * \brief Check if an MPI is less than the other in constant time. + * + * \param X The left-hand MPI. This must point to an initialized MPI + * with the same allocated length as Y. + * \param Y The right-hand MPI. This must point to an initialized MPI + * with the same allocated length as X. + * \param ret The result of the comparison: + * \c 1 if \p X is less than \p Y. + * \c 0 if \p X is greater than or equal to \p Y. + * + * \return 0 on success. + * \return MBEDTLS_ERR_MPI_BAD_INPUT_DATA if the allocated length of + * the two input MPIs is not the same. + */ +int mbedtls_mpi_lt_mpi_ct( const mbedtls_mpi *X, const mbedtls_mpi *Y, + unsigned *ret ); + /** * \brief Compare an MPI with an integer. * diff --git a/tools/sdk/include/mbedtls/mbedtls/blowfish.h b/tools/sdk/include/mbedtls/mbedtls/blowfish.h index f01573dcaf8..d2a1ebdbf41 100644 --- a/tools/sdk/include/mbedtls/mbedtls/blowfish.h +++ b/tools/sdk/include/mbedtls/mbedtls/blowfish.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BLOWFISH_H diff --git a/tools/sdk/include/mbedtls/mbedtls/bn_mul.h b/tools/sdk/include/mbedtls/mbedtls/bn_mul.h index c33bd8d4ab5..42339b7b718 100644 --- a/tools/sdk/include/mbedtls/mbedtls/bn_mul.h +++ b/tools/sdk/include/mbedtls/mbedtls/bn_mul.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ /* @@ -642,7 +669,8 @@ "r6", "r7", "r8", "r9", "cc" \ ); -#elif defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1) +#elif (__ARM_ARCH >= 6) && \ + defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1) #define MULADDC_INIT \ asm( diff --git a/tools/sdk/include/mbedtls/mbedtls/camellia.h b/tools/sdk/include/mbedtls/mbedtls/camellia.h index 3eeb66366d6..41d6f955bae 100644 --- a/tools/sdk/include/mbedtls/mbedtls/camellia.h +++ b/tools/sdk/include/mbedtls/mbedtls/camellia.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CAMELLIA_H diff --git a/tools/sdk/include/mbedtls/mbedtls/ccm.h b/tools/sdk/include/mbedtls/mbedtls/ccm.h index f03e3b580ea..3647d5094f5 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ccm.h +++ b/tools/sdk/include/mbedtls/mbedtls/ccm.h @@ -29,7 +29,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -43,6 +49,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/certs.h b/tools/sdk/include/mbedtls/mbedtls/certs.h index 179ebbbad22..2a645ad0d04 100644 --- a/tools/sdk/include/mbedtls/mbedtls/certs.h +++ b/tools/sdk/include/mbedtls/mbedtls/certs.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CERTS_H diff --git a/tools/sdk/include/mbedtls/mbedtls/chacha20.h b/tools/sdk/include/mbedtls/mbedtls/chacha20.h index 2ae5e6e5f4e..e2950e1a015 100644 --- a/tools/sdk/include/mbedtls/mbedtls/chacha20.h +++ b/tools/sdk/include/mbedtls/mbedtls/chacha20.h @@ -12,8 +12,15 @@ * \author Daniel King */ -/* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -27,6 +34,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/chachapoly.h b/tools/sdk/include/mbedtls/mbedtls/chachapoly.h index 49e615d278f..bee5a3ab036 100644 --- a/tools/sdk/include/mbedtls/mbedtls/chachapoly.h +++ b/tools/sdk/include/mbedtls/mbedtls/chachapoly.h @@ -12,8 +12,15 @@ * \author Daniel King */ -/* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -27,6 +34,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/check_config.h b/tools/sdk/include/mbedtls/mbedtls/check_config.h index b86e5807e00..8ce73ceff11 100644 --- a/tools/sdk/include/mbedtls/mbedtls/check_config.h +++ b/tools/sdk/include/mbedtls/mbedtls/check_config.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ @@ -123,7 +150,7 @@ #error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites" #endif -#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \ +#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \ !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \ !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \ !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \ @@ -134,10 +161,22 @@ !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \ !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \ !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \ - !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) ) ) + !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \ + !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \ + !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) ) #error "MBEDTLS_ECP_C defined, but not all prerequisites" #endif +#if defined(MBEDTLS_ECP_C) && !( \ + defined(MBEDTLS_ECP_ALT) || \ + defined(MBEDTLS_CTR_DRBG_C) || \ + defined(MBEDTLS_HMAC_DRBG_C) || \ + defined(MBEDTLS_SHA512_C) || \ + defined(MBEDTLS_SHA256_C) || \ + defined(MBEDTLS_ECP_NO_INTERNAL_RNG)) +#error "MBEDTLS_ECP_C requires a DRBG or SHA-2 module unless MBEDTLS_ECP_NO_INTERNAL_RNG is defined or an alternative implementation is used" +#endif + #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C) #error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites" #endif @@ -279,6 +318,14 @@ #error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites" #endif +#if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) +#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequesites" +#endif + +#if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) +#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequesites" +#endif + #if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM) #error "MBEDTLS_PADLOCK_C defined, but not all prerequisites" #endif @@ -536,6 +583,23 @@ #error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites" #endif +#if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \ + defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \ + !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \ + defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) ) +#error "One or more versions of the TLS protocol are enabled " \ + "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx" +#endif + #if defined(MBEDTLS_SSL_PROTO_DTLS) && \ !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \ !defined(MBEDTLS_SSL_PROTO_TLS1_2) @@ -659,6 +723,10 @@ #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites" #endif +#if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C) +#error "MBEDTLS_CERTS_C defined, but not all prerequisites" +#endif + #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) #error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites" #endif @@ -691,7 +759,7 @@ /* * Avoid warning from -pedantic. This is a convenient place for this * workaround since this is included by every single file before the - * #if defined(MBEDTLS_xxx_C) that results in emtpy translation units. + * #if defined(MBEDTLS_xxx_C) that results in empty translation units. */ typedef int mbedtls_iso_c_forbids_empty_translation_units; diff --git a/tools/sdk/include/mbedtls/mbedtls/cipher.h b/tools/sdk/include/mbedtls/mbedtls/cipher.h index 082a6917415..8672dd2b98b 100644 --- a/tools/sdk/include/mbedtls/mbedtls/cipher.h +++ b/tools/sdk/include/mbedtls/mbedtls/cipher.h @@ -9,7 +9,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -23,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/cipher_internal.h b/tools/sdk/include/mbedtls/mbedtls/cipher_internal.h index c6def0bef75..558be52a7e0 100644 --- a/tools/sdk/include/mbedtls/mbedtls/cipher_internal.h +++ b/tools/sdk/include/mbedtls/mbedtls/cipher_internal.h @@ -7,7 +7,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -21,6 +27,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CIPHER_WRAP_H diff --git a/tools/sdk/include/mbedtls/mbedtls/cmac.h b/tools/sdk/include/mbedtls/mbedtls/cmac.h index 9d42b3f209f..20747475679 100644 --- a/tools/sdk/include/mbedtls/mbedtls/cmac.h +++ b/tools/sdk/include/mbedtls/mbedtls/cmac.h @@ -8,7 +8,13 @@ */ /* * Copyright (C) 2015-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -22,6 +28,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/compat-1.3.h b/tools/sdk/include/mbedtls/mbedtls/compat-1.3.h index a58b47243d9..71cc4f4d973 100644 --- a/tools/sdk/include/mbedtls/mbedtls/compat-1.3.h +++ b/tools/sdk/include/mbedtls/mbedtls/compat-1.3.h @@ -8,7 +8,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -22,6 +28,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/config.h b/tools/sdk/include/mbedtls/mbedtls/config.h index 654f9725e45..f7e55aef5cf 100644 --- a/tools/sdk/include/mbedtls/mbedtls/config.h +++ b/tools/sdk/include/mbedtls/mbedtls/config.h @@ -9,7 +9,13 @@ */ /* * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -23,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ @@ -139,7 +166,7 @@ * * System has time.h, time(), and an implementation for * mbedtls_platform_gmtime_r() (see below). - * The time needs to be correct (not necesarily very accurate, but at least + * The time needs to be correct (not necessarily very accurate, but at least * the date should be correct). This is used to verify the validity period of * X.509 certificates. * @@ -276,28 +303,52 @@ * For example, when a function accepts as input a pointer to a buffer that may * contain untrusted data, and its documentation mentions that this pointer * must not be NULL: - * - the pointer is checked to be non-NULL only if this option is enabled - * - the content of the buffer is always validated + * - The pointer is checked to be non-NULL only if this option is enabled. + * - The content of the buffer is always validated. * * When this flag is defined, if a library function receives a parameter that - * is invalid, it will: - * - invoke the macro MBEDTLS_PARAM_FAILED() which by default expands to a - * call to the function mbedtls_param_failed() - * - immediately return (with a specific error code unless the function - * returns void and can't communicate an error). - * - * When defining this flag, you also need to: - * - either provide a definition of the function mbedtls_param_failed() in - * your application (see platform_util.h for its prototype) as the library - * calls that function, but does not provide a default definition for it, - * - or provide a different definition of the macro MBEDTLS_PARAM_FAILED() - * below if the above mechanism is not flexible enough to suit your needs. - * See the documentation of this macro later in this file. + * is invalid: + * 1. The function will invoke the macro MBEDTLS_PARAM_FAILED(). + * 2. If MBEDTLS_PARAM_FAILED() did not terminate the program, the function + * will immediately return. If the function returns an Mbed TLS error code, + * the error code in this case is MBEDTLS_ERR_xxx_BAD_INPUT_DATA. + * + * When defining this flag, you also need to arrange a definition for + * MBEDTLS_PARAM_FAILED(). You can do this by any of the following methods: + * - By default, the library defines MBEDTLS_PARAM_FAILED() to call a + * function mbedtls_param_failed(), but the library does not define this + * function. If you do not make any other arrangements, you must provide + * the function mbedtls_param_failed() in your application. + * See `platform_util.h` for its prototype. + * - If you enable the macro #MBEDTLS_CHECK_PARAMS_ASSERT, then the + * library defines #MBEDTLS_PARAM_FAILED(\c cond) to be `assert(cond)`. + * You can still supply an alternative definition of + * MBEDTLS_PARAM_FAILED(), which may call `assert`. + * - If you define a macro MBEDTLS_PARAM_FAILED() before including `config.h` + * or you uncomment the definition of MBEDTLS_PARAM_FAILED() in `config.h`, + * the library will call the macro that you defined and will not supply + * its own version. Note that if MBEDTLS_PARAM_FAILED() calls `assert`, + * you need to enable #MBEDTLS_CHECK_PARAMS_ASSERT so that library source + * files include ``. * * Uncomment to enable validation of application-controlled parameters. */ //#define MBEDTLS_CHECK_PARAMS +/** + * \def MBEDTLS_CHECK_PARAMS_ASSERT + * + * Allow MBEDTLS_PARAM_FAILED() to call `assert`, and make it default to + * `assert`. This macro is only used if #MBEDTLS_CHECK_PARAMS is defined. + * + * If this macro is not defined, then MBEDTLS_PARAM_FAILED() defaults to + * calling a function mbedtls_param_failed(). See the documentation of + * #MBEDTLS_CHECK_PARAMS for details. + * + * Uncomment to allow MBEDTLS_PARAM_FAILED() to call `assert`. + */ +//#define MBEDTLS_CHECK_PARAMS_ASSERT + /* \} name SECTION: System support */ /** @@ -401,7 +452,7 @@ * \note Because of a signature change, the core AES encryption and decryption routines are * currently named mbedtls_aes_internal_encrypt and mbedtls_aes_internal_decrypt, * respectively. When setting up alternative implementations, these functions should - * be overriden, but the wrapper functions mbedtls_aes_decrypt and mbedtls_aes_encrypt + * be overridden, but the wrapper functions mbedtls_aes_decrypt and mbedtls_aes_encrypt * must stay untouched. * * \note If you use the AES_xxx_ALT macros, then is is recommended to also set @@ -416,6 +467,16 @@ * dependencies on them, and considering stronger message digests * and ciphers instead. * + * \warning If both MBEDTLS_ECDSA_SIGN_ALT and MBEDTLS_ECDSA_DETERMINISTIC are + * enabled, then the deterministic ECDH signature functions pass the + * the static HMAC-DRBG as RNG to mbedtls_ecdsa_sign(). Therefore + * alternative implementations should use the RNG only for generating + * the ephemeral key and nothing else. If this is not possible, then + * MBEDTLS_ECDSA_DETERMINISTIC should be disabled and an alternative + * implementation should be provided for mbedtls_ecdsa_sign_det_ext() + * (and for mbedtls_ecdsa_sign_det() too if backward compatibility is + * desirable). + * */ //#define MBEDTLS_MD2_PROCESS_ALT //#define MBEDTLS_MD4_PROCESS_ALT @@ -655,6 +716,13 @@ #define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN #define MBEDTLS_CIPHER_PADDING_ZEROS +/** \def MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + * + * Uncomment this macro to use a 128-bit key in the CTR_DRBG module. + * By default, CTR_DRBG uses a 256-bit key. + */ +//#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + /** * \def MBEDTLS_ENABLE_WEAK_CIPHERSUITES * @@ -739,6 +807,28 @@ */ #define MBEDTLS_ECP_NIST_OPTIM +/** + * \def MBEDTLS_ECP_NO_INTERNAL_RNG + * + * When this option is disabled, mbedtls_ecp_mul() will make use of an + * internal RNG when called with a NULL \c f_rng argument, in order to protect + * against some side-channel attacks. + * + * This protection introduces a dependency of the ECP module on one of the + * DRBG or SHA modules (HMAC-DRBG, CTR-DRBG, SHA-512 or SHA-256.) For very + * constrained applications that don't require this protection (for example, + * because you're only doing signature verification, so not manipulating any + * secret, or because local/physical side-channel attacks are outside your + * threat model), it might be desirable to get rid of that dependency. + * + * \warning Enabling this option makes some uses of ECP vulnerable to some + * side-channel attacks. Only enable it if you know that's not a problem for + * your use case. + * + * Uncomment this macro to disable some counter-measures in ECP. + */ +//#define MBEDTLS_ECP_NO_INTERNAL_RNG + /** * \def MBEDTLS_ECP_RESTARTABLE * @@ -1558,7 +1648,7 @@ * \def MBEDTLS_SSL_SESSION_TICKETS * * Enable support for RFC 5077 session tickets in SSL. - * Client-side, provides full support for session tickets (maintainance of a + * Client-side, provides full support for session tickets (maintenance of a * session store remains the responsibility of the application, though). * Server-side, you also need to provide callbacks for writing and parsing * tickets, including authenticated encryption and key management. Example @@ -1724,7 +1814,7 @@ * * \warning TLS-level compression MAY REDUCE SECURITY! See for example the * CRIME attack. Before enabling this option, you should examine with care if - * CRIME or similar exploits may be a applicable to your use case. + * CRIME or similar exploits may be applicable to your use case. * * \note Currently compression can't be used with DTLS. * @@ -2115,7 +2205,11 @@ * * Enable the CTR_DRBG AES-based random generator. * The CTR_DRBG generator uses AES-256 by default. - * To use AES-128 instead, enable MBEDTLS_CTR_DRBG_USE_128_BIT_KEY below. + * To use AES-128 instead, enable \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY above. + * + * \note To achieve a 256-bit security strength with CTR_DRBG, + * you must use AES-256 *and* use sufficient entropy. + * See ctr_drbg.h for more details. * * Module: library/ctr_drbg.c * Caller: @@ -3007,7 +3101,6 @@ //#define MBEDTLS_CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ //#define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ //#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ -//#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY /**< Use 128-bit key for CTR_DRBG - may reduce security (see ctr_drbg.h) */ /* HMAC_DRBG options */ //#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ @@ -3036,7 +3129,7 @@ //#define MBEDTLS_PLATFORM_STD_TIME time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ //#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */ -/* Note: your snprintf must correclty zero-terminate the buffer! */ +/* Note: your snprintf must correctly zero-terminate the buffer! */ //#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */ @@ -3053,20 +3146,23 @@ //#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ //#define MBEDTLS_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can be undefined */ //#define MBEDTLS_PLATFORM_PRINTF_MACRO printf /**< Default printf macro to use, can be undefined */ -/* Note: your snprintf must correclty zero-terminate the buffer! */ +/* Note: your snprintf must correctly zero-terminate the buffer! */ //#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf /**< Default snprintf macro to use, can be undefined */ //#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */ //#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */ /** * \brief This macro is invoked by the library when an invalid parameter - * is detected that is only checked with MBEDTLS_CHECK_PARAMS + * is detected that is only checked with #MBEDTLS_CHECK_PARAMS * (see the documentation of that option for context). * - * When you leave this undefined here, a default definition is - * provided that invokes the function mbedtls_param_failed(), - * which is declared in platform_util.h for the benefit of the - * library, but that you need to define in your application. + * When you leave this undefined here, the library provides + * a default definition. If the macro #MBEDTLS_CHECK_PARAMS_ASSERT + * is defined, the default definition is `assert(cond)`, + * otherwise the default definition calls a function + * mbedtls_param_failed(). This function is declared in + * `platform_util.h` for the benefit of the library, but + * you need to define in your application. * * When you define this here, this replaces the default * definition in platform_util.h (which no longer declares the @@ -3075,6 +3171,9 @@ * particular, that all the necessary declarations are visible * from within the library - you can ensure that by providing * them in this file next to the macro definition). + * If you define this macro to call `assert`, also define + * #MBEDTLS_CHECK_PARAMS_ASSERT so that library source files + * include ``. * * Note that you may define this macro to expand to nothing, in * which case you don't have to worry about declarations or diff --git a/tools/sdk/include/mbedtls/mbedtls/ctr_drbg.h b/tools/sdk/include/mbedtls/mbedtls/ctr_drbg.h index cc3df7b113f..894fa17130f 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ctr_drbg.h +++ b/tools/sdk/include/mbedtls/mbedtls/ctr_drbg.h @@ -1,7 +1,8 @@ /** * \file ctr_drbg.h * - * \brief This file contains CTR_DRBG definitions and functions. + * \brief This file contains definitions and functions for the + * CTR_DRBG pseudorandom generator. * * CTR_DRBG is a standardized way of building a PRNG from a block-cipher * in counter mode operation, as defined in NIST SP 800-90A: @@ -9,14 +10,42 @@ * Bit Generators. * * The Mbed TLS implementation of CTR_DRBG uses AES-256 (default) or AES-128 - * as the underlying block cipher. - * - * \warning Using 128-bit keys for CTR_DRBG limits the security of generated - * keys and operations that use random values generated to 128-bit security. + * (if \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is enabled at compile time) + * as the underlying block cipher, with a derivation function. + * The initial seeding grabs #MBEDTLS_CTR_DRBG_ENTROPY_LEN bytes of entropy. + * See the documentation of mbedtls_ctr_drbg_seed() for more details. + * + * Based on NIST SP 800-90A §10.2.1 table 3 and NIST SP 800-57 part 1 table 2, + * here are the security strengths achieved in typical configuration: + * - 256 bits under the default configuration of the library, with AES-256 + * and with #MBEDTLS_CTR_DRBG_ENTROPY_LEN set to 48 or more. + * - 256 bits if AES-256 is used, #MBEDTLS_CTR_DRBG_ENTROPY_LEN is set + * to 32 or more, and the DRBG is initialized with an explicit + * nonce in the \c custom parameter to mbedtls_ctr_drbg_seed(). + * - 128 bits if AES-256 is used but #MBEDTLS_CTR_DRBG_ENTROPY_LEN is + * between 24 and 47 and the DRBG is not initialized with an explicit + * nonce (see mbedtls_ctr_drbg_seed()). + * - 128 bits if AES-128 is used (\c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY enabled) + * and #MBEDTLS_CTR_DRBG_ENTROPY_LEN is set to 24 or more (which is + * always the case unless it is explicitly set to a different value + * in config.h). + * + * Note that the value of #MBEDTLS_CTR_DRBG_ENTROPY_LEN defaults to: + * - \c 48 if the module \c MBEDTLS_SHA512_C is enabled and the symbol + * \c MBEDTLS_ENTROPY_FORCE_SHA256 is disabled at compile time. + * This is the default configuration of the library. + * - \c 32 if the module \c MBEDTLS_SHA512_C is disabled at compile time. + * - \c 32 if \c MBEDTLS_ENTROPY_FORCE_SHA256 is enabled at compile time. */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * Copyright (C) 2006-2019, Arm Limited (or its affiliates), All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -30,6 +59,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ @@ -56,9 +106,19 @@ #define MBEDTLS_CTR_DRBG_BLOCKSIZE 16 /**< The block size used by the cipher. */ #if defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) -#define MBEDTLS_CTR_DRBG_KEYSIZE 16 /**< The key size used by the cipher (compile-time choice: 128 bits). */ +#define MBEDTLS_CTR_DRBG_KEYSIZE 16 +/**< The key size in bytes used by the cipher. + * + * Compile-time choice: 16 bytes (128 bits) + * because #MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is enabled. + */ #else -#define MBEDTLS_CTR_DRBG_KEYSIZE 32 /**< The key size used by the cipher (compile-time choice: 256 bits). */ +#define MBEDTLS_CTR_DRBG_KEYSIZE 32 +/**< The key size in bytes used by the cipher. + * + * Compile-time choice: 32 bytes (256 bits) + * because \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is disabled. + */ #endif #define MBEDTLS_CTR_DRBG_KEYBITS ( MBEDTLS_CTR_DRBG_KEYSIZE * 8 ) /**< The key size for the DRBG operation, in bits. */ @@ -73,21 +133,31 @@ * \{ */ +/** \def MBEDTLS_CTR_DRBG_ENTROPY_LEN + * + * \brief The amount of entropy used per seed by default, in bytes. + */ #if !defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) #if defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256) +/** This is 48 bytes because the entropy module uses SHA-512 + * (\c MBEDTLS_ENTROPY_FORCE_SHA256 is disabled). + */ #define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 -/**< The amount of entropy used per seed by default: - *
  • 48 with SHA-512.
  • - *
  • 32 with SHA-256.
+ +#else /* defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256) */ + +/** This is 32 bytes because the entropy module uses SHA-256 + * (the SHA512 module is disabled or + * \c MBEDTLS_ENTROPY_FORCE_SHA256 is enabled). */ -#else -#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 32 -/**< Amount of entropy used per seed by default: - *
  • 48 with SHA-512.
  • - *
  • 32 with SHA-256.
+#if !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) +/** \warning To achieve a 256-bit security strength, you must pass a nonce + * to mbedtls_ctr_drbg_seed(). */ -#endif -#endif +#endif /* !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) */ +#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 32 +#endif /* defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256) */ +#endif /* !defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) */ #if !defined(MBEDTLS_CTR_DRBG_RESEED_INTERVAL) #define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000 @@ -106,7 +176,7 @@ #if !defined(MBEDTLS_CTR_DRBG_MAX_SEED_INPUT) #define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 -/**< The maximum size of seed or reseed buffer. */ +/**< The maximum size of seed or reseed buffer in bytes. */ #endif /* \} name SECTION: Module settings */ @@ -164,17 +234,68 @@ void mbedtls_ctr_drbg_init( mbedtls_ctr_drbg_context *ctx ); * \brief This function seeds and sets up the CTR_DRBG * entropy source for future reseeds. * - * \note Personalization data can be provided in addition to the more generic - * entropy source, to make this instantiation as unique as possible. - * + * A typical choice for the \p f_entropy and \p p_entropy parameters is + * to use the entropy module: + * - \p f_entropy is mbedtls_entropy_func(); + * - \p p_entropy is an instance of ::mbedtls_entropy_context initialized + * with mbedtls_entropy_init() (which registers the platform's default + * entropy sources). + * + * The entropy length is #MBEDTLS_CTR_DRBG_ENTROPY_LEN by default. + * You can override it by calling mbedtls_ctr_drbg_set_entropy_len(). + * + * You can provide a personalization string in addition to the + * entropy source, to make this instantiation as unique as possible. + * + * \note The _seed_material_ value passed to the derivation + * function in the CTR_DRBG Instantiate Process + * described in NIST SP 800-90A §10.2.1.3.2 + * is the concatenation of the string obtained from + * calling \p f_entropy and the \p custom string. + * The origin of the nonce depends on the value of + * the entropy length relative to the security strength. + * - If the entropy length is at least 1.5 times the + * security strength then the nonce is taken from the + * string obtained with \p f_entropy. + * - If the entropy length is less than the security + * strength, then the nonce is taken from \p custom. + * In this case, for compliance with SP 800-90A, + * you must pass a unique value of \p custom at + * each invocation. See SP 800-90A §8.6.7 for more + * details. + */ +#if MBEDTLS_CTR_DRBG_ENTROPY_LEN < MBEDTLS_CTR_DRBG_KEYSIZE * 3 / 2 +/** \warning When #MBEDTLS_CTR_DRBG_ENTROPY_LEN is less than + * #MBEDTLS_CTR_DRBG_KEYSIZE * 3 / 2, to achieve the + * maximum security strength permitted by CTR_DRBG, + * you must pass a value of \p custom that is a nonce: + * this value must never be repeated in subsequent + * runs of the same application or on a different + * device. + */ +#endif +/** * \param ctx The CTR_DRBG context to seed. + * It must have been initialized with + * mbedtls_ctr_drbg_init(). + * After a successful call to mbedtls_ctr_drbg_seed(), + * you may not call mbedtls_ctr_drbg_seed() again on + * the same context unless you call + * mbedtls_ctr_drbg_free() and mbedtls_ctr_drbg_init() + * again first. * \param f_entropy The entropy callback, taking as arguments the * \p p_entropy context, the buffer to fill, and the - length of the buffer. - * \param p_entropy The entropy context. - * \param custom Personalization data, that is device-specific - identifiers. Can be NULL. - * \param len The length of the personalization data. + * length of the buffer. + * \p f_entropy is always called with a buffer size + * equal to the entropy length. + * \param p_entropy The entropy context to pass to \p f_entropy. + * \param custom The personalization string. + * This can be \c NULL, in which case the personalization + * string is empty regardless of the value of \p len. + * \param len The length of the personalization string. + * This must be at most + * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT + * - #MBEDTLS_CTR_DRBG_ENTROPY_LEN. * * \return \c 0 on success. * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure. @@ -197,7 +318,8 @@ void mbedtls_ctr_drbg_free( mbedtls_ctr_drbg_context *ctx ); * The default value is off. * * \note If enabled, entropy is gathered at the beginning of - * every call to mbedtls_ctr_drbg_random_with_add(). + * every call to mbedtls_ctr_drbg_random_with_add() + * or mbedtls_ctr_drbg_random(). * Only use this if your entropy source has sufficient * throughput. * @@ -209,18 +331,37 @@ void mbedtls_ctr_drbg_set_prediction_resistance( mbedtls_ctr_drbg_context *ctx, /** * \brief This function sets the amount of entropy grabbed on each - * seed or reseed. The default value is - * #MBEDTLS_CTR_DRBG_ENTROPY_LEN. + * seed or reseed. + * + * The default value is #MBEDTLS_CTR_DRBG_ENTROPY_LEN. + * + * \note The security strength of CTR_DRBG is bounded by the + * entropy length. Thus: + * - When using AES-256 + * (\c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is disabled, + * which is the default), + * \p len must be at least 32 (in bytes) + * to achieve a 256-bit strength. + * - When using AES-128 + * (\c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is enabled) + * \p len must be at least 16 (in bytes) + * to achieve a 128-bit strength. * * \param ctx The CTR_DRBG context. - * \param len The amount of entropy to grab. + * \param len The amount of entropy to grab, in bytes. + * This must be at most #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT. */ void mbedtls_ctr_drbg_set_entropy_len( mbedtls_ctr_drbg_context *ctx, size_t len ); /** * \brief This function sets the reseed interval. - * The default value is #MBEDTLS_CTR_DRBG_RESEED_INTERVAL. + * + * The reseed interval is the number of calls to mbedtls_ctr_drbg_random() + * or mbedtls_ctr_drbg_random_with_add() after which the entropy function + * is called again. + * + * The default value is #MBEDTLS_CTR_DRBG_RESEED_INTERVAL. * * \param ctx The CTR_DRBG context. * \param interval The reseed interval. @@ -233,8 +374,12 @@ void mbedtls_ctr_drbg_set_reseed_interval( mbedtls_ctr_drbg_context *ctx, * extracts data from the entropy source. * * \param ctx The CTR_DRBG context. - * \param additional Additional data to add to the state. Can be NULL. + * \param additional Additional data to add to the state. Can be \c NULL. * \param len The length of the additional data. + * This must be less than + * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT - \c entropy_len + * where \c entropy_len is the entropy length + * configured for the context. * * \return \c 0 on success. * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure. @@ -246,7 +391,8 @@ int mbedtls_ctr_drbg_reseed( mbedtls_ctr_drbg_context *ctx, * \brief This function updates the state of the CTR_DRBG context. * * \param ctx The CTR_DRBG context. - * \param additional The data to update the state with. + * \param additional The data to update the state with. This must not be + * \c NULL unless \p add_len is \c 0. * \param add_len Length of \p additional in bytes. This must be at * most #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT. * @@ -264,14 +410,23 @@ int mbedtls_ctr_drbg_update_ret( mbedtls_ctr_drbg_context *ctx, * \brief This function updates a CTR_DRBG instance with additional * data and uses it to generate random data. * - * \note The function automatically reseeds if the reseed counter is exceeded. + * This function automatically reseeds if the reseed counter is exceeded + * or prediction resistance is enabled. * * \param p_rng The CTR_DRBG context. This must be a pointer to a * #mbedtls_ctr_drbg_context structure. * \param output The buffer to fill. - * \param output_len The length of the buffer. - * \param additional Additional data to update. Can be NULL. - * \param add_len The length of the additional data. + * \param output_len The length of the buffer in bytes. + * \param additional Additional data to update. Can be \c NULL, in which + * case the additional data is empty regardless of + * the value of \p add_len. + * \param add_len The length of the additional data + * if \p additional is not \c NULL. + * This must be less than #MBEDTLS_CTR_DRBG_MAX_INPUT + * and less than + * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT - \c entropy_len + * where \c entropy_len is the entropy length + * configured for the context. * * \return \c 0 on success. * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or @@ -284,12 +439,14 @@ int mbedtls_ctr_drbg_random_with_add( void *p_rng, /** * \brief This function uses CTR_DRBG to generate random data. * - * \note The function automatically reseeds if the reseed counter is exceeded. + * This function automatically reseeds if the reseed counter is exceeded + * or prediction resistance is enabled. + * * * \param p_rng The CTR_DRBG context. This must be a pointer to a * #mbedtls_ctr_drbg_context structure. * \param output The buffer to fill. - * \param output_len The length of the buffer. + * \param output_len The length of the buffer in bytes. * * \return \c 0 on success. * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or @@ -336,7 +493,7 @@ MBEDTLS_DEPRECATED void mbedtls_ctr_drbg_update( * * \return \c 0 on success. * \return #MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error. - * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on + * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on reseed * failure. */ int mbedtls_ctr_drbg_write_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path ); @@ -350,8 +507,10 @@ int mbedtls_ctr_drbg_write_seed_file( mbedtls_ctr_drbg_context *ctx, const char * * \return \c 0 on success. * \return #MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error. - * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or - * #MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG on failure. + * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on + * reseed failure. + * \return #MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG if the existing + * seed file is too large. */ int mbedtls_ctr_drbg_update_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path ); #endif /* MBEDTLS_FS_IO */ diff --git a/tools/sdk/include/mbedtls/mbedtls/debug.h b/tools/sdk/include/mbedtls/mbedtls/debug.h index 736444bb76a..11928e98183 100644 --- a/tools/sdk/include/mbedtls/mbedtls/debug.h +++ b/tools/sdk/include/mbedtls/mbedtls/debug.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_DEBUG_H diff --git a/tools/sdk/include/mbedtls/mbedtls/des.h b/tools/sdk/include/mbedtls/mbedtls/des.h index 54e6b7894b6..4c6441d7d94 100644 --- a/tools/sdk/include/mbedtls/mbedtls/des.h +++ b/tools/sdk/include/mbedtls/mbedtls/des.h @@ -9,7 +9,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -23,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) * */ diff --git a/tools/sdk/include/mbedtls/mbedtls/dhm.h b/tools/sdk/include/mbedtls/mbedtls/dhm.h index 2909f5fbc8e..5c04ed19fb4 100644 --- a/tools/sdk/include/mbedtls/mbedtls/dhm.h +++ b/tools/sdk/include/mbedtls/mbedtls/dhm.h @@ -45,7 +45,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -59,6 +65,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/ecdh.h b/tools/sdk/include/mbedtls/mbedtls/ecdh.h index 4479a1d46fb..a0052df4719 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ecdh.h +++ b/tools/sdk/include/mbedtls/mbedtls/ecdh.h @@ -14,7 +14,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -28,6 +34,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/ecdsa.h b/tools/sdk/include/mbedtls/mbedtls/ecdsa.h index f8b28507c21..bc219dcad75 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ecdsa.h +++ b/tools/sdk/include/mbedtls/mbedtls/ecdsa.h @@ -12,7 +12,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -26,6 +32,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ @@ -175,6 +202,19 @@ int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, * (SECG): SEC1 Elliptic Curve Cryptography, section * 4.1.3, step 5. * + * \warning Since the output of the internal RNG is always the same for + * the same key and message, this limits the efficiency of + * blinding and leaks information through side channels. For + * secure behavior use mbedtls_ecdsa_sign_det_ext() instead. + * + * (Optimally the blinding is a random value that is different + * on every execution. In this case the blinding is still + * random from the attackers perspective, but is the same on + * each execution. This means that this blinding does not + * prevent attackers from recovering secrets by combining + * several measurement traces, but may prevent some attacks + * that exploit relationships between secret data.) + * * \see ecp.h * * \param grp The context for the elliptic curve to use. @@ -200,6 +240,52 @@ int mbedtls_ecdsa_sign_det( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, const mbedtls_mpi *d, const unsigned char *buf, size_t blen, mbedtls_md_type_t md_alg ); +/** + * \brief This function computes the ECDSA signature of a + * previously-hashed message, deterministic version. + * + * For more information, see RFC-6979: Deterministic + * Usage of the Digital Signature Algorithm (DSA) and Elliptic + * Curve Digital Signature Algorithm (ECDSA). + * + * \note If the bitlength of the message hash is larger than the + * bitlength of the group order, then the hash is truncated as + * defined in Standards for Efficient Cryptography Group + * (SECG): SEC1 Elliptic Curve Cryptography, section + * 4.1.3, step 5. + * + * \see ecp.h + * + * \param grp The context for the elliptic curve to use. + * This must be initialized and have group parameters + * set, for example through mbedtls_ecp_group_load(). + * \param r The MPI context in which to store the first part + * the signature. This must be initialized. + * \param s The MPI context in which to store the second part + * the signature. This must be initialized. + * \param d The private signing key. This must be initialized + * and setup, for example through mbedtls_ecp_gen_privkey(). + * \param buf The hashed content to be signed. This must be a readable + * buffer of length \p blen Bytes. It may be \c NULL if + * \p blen is zero. + * \param blen The length of \p buf in Bytes. + * \param md_alg The hash algorithm used to hash the original data. + * \param f_rng_blind The RNG function used for blinding. This must not be + * \c NULL. + * \param p_rng_blind The RNG context to be passed to \p f_rng. This may be + * \c NULL if \p f_rng doesn't need a context parameter. + * + * \return \c 0 on success. + * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX + * error code on failure. + */ +int mbedtls_ecdsa_sign_det_ext( mbedtls_ecp_group *grp, mbedtls_mpi *r, + mbedtls_mpi *s, const mbedtls_mpi *d, + const unsigned char *buf, size_t blen, + mbedtls_md_type_t md_alg, + int (*f_rng_blind)(void *, unsigned char *, + size_t), + void *p_rng_blind ); #endif /* MBEDTLS_ECDSA_DETERMINISTIC */ /** diff --git a/tools/sdk/include/mbedtls/mbedtls/ecjpake.h b/tools/sdk/include/mbedtls/mbedtls/ecjpake.h index 3d8d02ae646..1b6c6ac244e 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ecjpake.h +++ b/tools/sdk/include/mbedtls/mbedtls/ecjpake.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ECJPAKE_H diff --git a/tools/sdk/include/mbedtls/mbedtls/ecp.h b/tools/sdk/include/mbedtls/mbedtls/ecp.h index 065a4cc0b99..8db206060b2 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ecp.h +++ b/tools/sdk/include/mbedtls/mbedtls/ecp.h @@ -16,7 +16,13 @@ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -30,6 +36,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ @@ -813,6 +840,9 @@ int mbedtls_ecp_tls_write_group( const mbedtls_ecp_group *grp, * intermediate results to prevent potential timing attacks * targeting these results. We recommend always providing * a non-NULL \p f_rng. The overhead is negligible. + * Note: unless #MBEDTLS_ECP_NO_INTERNAL_RNG is defined, when + * \p f_rng is NULL, an internal RNG (seeded from the value + * of \p m) will be used instead. * * \param grp The ECP group to use. * This must be initialized and have group parameters diff --git a/tools/sdk/include/mbedtls/mbedtls/ecp_internal.h b/tools/sdk/include/mbedtls/mbedtls/ecp_internal.h index 7625ed48e1a..4e9445ae444 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ecp_internal.h +++ b/tools/sdk/include/mbedtls/mbedtls/ecp_internal.h @@ -6,7 +6,13 @@ */ /* * Copyright (C) 2016, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -20,6 +26,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/entropy.h b/tools/sdk/include/mbedtls/mbedtls/entropy.h index ca06dc3c58e..fd70cd7e9e0 100644 --- a/tools/sdk/include/mbedtls/mbedtls/entropy.h +++ b/tools/sdk/include/mbedtls/mbedtls/entropy.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ENTROPY_H diff --git a/tools/sdk/include/mbedtls/mbedtls/entropy_poll.h b/tools/sdk/include/mbedtls/mbedtls/entropy_poll.h index 94dd657eb95..9843a9e460b 100644 --- a/tools/sdk/include/mbedtls/mbedtls/entropy_poll.h +++ b/tools/sdk/include/mbedtls/mbedtls/entropy_poll.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ENTROPY_POLL_H diff --git a/tools/sdk/include/mbedtls/mbedtls/error.h b/tools/sdk/include/mbedtls/mbedtls/error.h index bee0fe485ac..3ee7bbba892 100644 --- a/tools/sdk/include/mbedtls/mbedtls/error.h +++ b/tools/sdk/include/mbedtls/mbedtls/error.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ERROR_H @@ -100,6 +127,7 @@ * ECP 4 10 (Started from top) * MD 5 5 * HKDF 5 1 (Started from top) + * SSL 5 1 (Started from 0x5E80) * CIPHER 6 8 * SSL 6 23 (Started from top) * SSL 7 32 diff --git a/tools/sdk/include/mbedtls/mbedtls/gcm.h b/tools/sdk/include/mbedtls/mbedtls/gcm.h index fd130abd7cf..52d03b0ce89 100644 --- a/tools/sdk/include/mbedtls/mbedtls/gcm.h +++ b/tools/sdk/include/mbedtls/mbedtls/gcm.h @@ -13,7 +13,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -27,6 +33,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/havege.h b/tools/sdk/include/mbedtls/mbedtls/havege.h index 4c1c86087a8..75ab3cb9637 100644 --- a/tools/sdk/include/mbedtls/mbedtls/havege.h +++ b/tools/sdk/include/mbedtls/mbedtls/havege.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_HAVEGE_H diff --git a/tools/sdk/include/mbedtls/mbedtls/hkdf.h b/tools/sdk/include/mbedtls/mbedtls/hkdf.h index 40ee64eb03c..a8db554d9f4 100644 --- a/tools/sdk/include/mbedtls/mbedtls/hkdf.h +++ b/tools/sdk/include/mbedtls/mbedtls/hkdf.h @@ -7,22 +7,49 @@ * specified by RFC 5869. */ /* - * Copyright (C) 2016-2018, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * Copyright (C) 2016-2019, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * - * 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 + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. * - * http://www.apache.org/licenses/LICENSE-2.0 + * ********** + * Apache 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. + * 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 * - * This file is part of mbed TLS (https://tls.mbed.org) + * 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. + * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_HKDF_H #define MBEDTLS_HKDF_H diff --git a/tools/sdk/include/mbedtls/mbedtls/hmac_drbg.h b/tools/sdk/include/mbedtls/mbedtls/hmac_drbg.h index 7eae32bbd67..231fb459bcf 100644 --- a/tools/sdk/include/mbedtls/mbedtls/hmac_drbg.h +++ b/tools/sdk/include/mbedtls/mbedtls/hmac_drbg.h @@ -1,11 +1,21 @@ /** * \file hmac_drbg.h * - * \brief HMAC_DRBG (NIST SP 800-90A) + * \brief The HMAC_DRBG pseudorandom generator. + * + * This module implements the HMAC_DRBG pseudorandom generator described + * in NIST SP 800-90A: Recommendation for Random Number Generation Using + * Deterministic Random Bit Generators. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * Copyright (C) 2006-2019, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_HMAC_DRBG_H @@ -82,7 +113,7 @@ extern "C" { */ typedef struct mbedtls_hmac_drbg_context { - /* Working state: the key K is not stored explicitely, + /* Working state: the key K is not stored explicitly, * but is implied by the HMAC context */ mbedtls_md_context_t md_ctx; /*!< HMAC context (inc. K) */ unsigned char V[MBEDTLS_MD_MAX_SIZE]; /*!< V in the spec */ @@ -104,38 +135,72 @@ typedef struct mbedtls_hmac_drbg_context } mbedtls_hmac_drbg_context; /** - * \brief HMAC_DRBG context initialization - * Makes the context ready for mbedtls_hmac_drbg_seed(), - * mbedtls_hmac_drbg_seed_buf() or - * mbedtls_hmac_drbg_free(). + * \brief HMAC_DRBG context initialization. + * + * This function makes the context ready for mbedtls_hmac_drbg_seed(), + * mbedtls_hmac_drbg_seed_buf() or mbedtls_hmac_drbg_free(). * - * \param ctx HMAC_DRBG context to be initialized + * \param ctx HMAC_DRBG context to be initialized. */ void mbedtls_hmac_drbg_init( mbedtls_hmac_drbg_context *ctx ); /** - * \brief HMAC_DRBG initial seeding - * Seed and setup entropy source for future reseeds. - * - * \param ctx HMAC_DRBG context to be seeded - * \param md_info MD algorithm to use for HMAC_DRBG - * \param f_entropy Entropy callback (p_entropy, buffer to fill, buffer - * length) - * \param p_entropy Entropy context - * \param custom Personalization data (Device specific identifiers) - * (Can be NULL) - * \param len Length of personalization data - * - * \note The "security strength" as defined by NIST is set to: - * 128 bits if md_alg is SHA-1, - * 192 bits if md_alg is SHA-224, - * 256 bits if md_alg is SHA-256 or higher. - * Note that SHA-256 is just as efficient as SHA-224. + * \brief HMAC_DRBG initial seeding. + * + * Set the initial seed and set up the entropy source for future reseeds. * - * \return 0 if successful, or - * MBEDTLS_ERR_MD_BAD_INPUT_DATA, or - * MBEDTLS_ERR_MD_ALLOC_FAILED, or - * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED. + * A typical choice for the \p f_entropy and \p p_entropy parameters is + * to use the entropy module: + * - \p f_entropy is mbedtls_entropy_func(); + * - \p p_entropy is an instance of ::mbedtls_entropy_context initialized + * with mbedtls_entropy_init() (which registers the platform's default + * entropy sources). + * + * You can provide a personalization string in addition to the + * entropy source, to make this instantiation as unique as possible. + * + * \note By default, the security strength as defined by NIST is: + * - 128 bits if \p md_info is SHA-1; + * - 192 bits if \p md_info is SHA-224; + * - 256 bits if \p md_info is SHA-256, SHA-384 or SHA-512. + * Note that SHA-256 is just as efficient as SHA-224. + * The security strength can be reduced if a smaller + * entropy length is set with + * mbedtls_hmac_drbg_set_entropy_len(). + * + * \note The default entropy length is the security strength + * (converted from bits to bytes). You can override + * it by calling mbedtls_hmac_drbg_set_entropy_len(). + * + * \note During the initial seeding, this function calls + * the entropy source to obtain a nonce + * whose length is half the entropy length. + * + * \param ctx HMAC_DRBG context to be seeded. + * \param md_info MD algorithm to use for HMAC_DRBG. + * \param f_entropy The entropy callback, taking as arguments the + * \p p_entropy context, the buffer to fill, and the + * length of the buffer. + * \p f_entropy is always called with a length that is + * less than or equal to the entropy length. + * \param p_entropy The entropy context to pass to \p f_entropy. + * \param custom The personalization string. + * This can be \c NULL, in which case the personalization + * string is empty regardless of the value of \p len. + * \param len The length of the personalization string. + * This must be at most #MBEDTLS_HMAC_DRBG_MAX_INPUT + * and also at most + * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \p entropy_len * 3 / 2 + * where \p entropy_len is the entropy length + * described above. + * + * \return \c 0 if successful. + * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA if \p md_info is + * invalid. + * \return #MBEDTLS_ERR_MD_ALLOC_FAILED if there was not enough + * memory to allocate context data. + * \return #MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED + * if the call to \p f_entropy failed. */ int mbedtls_hmac_drbg_seed( mbedtls_hmac_drbg_context *ctx, const mbedtls_md_info_t * md_info, @@ -146,98 +211,131 @@ int mbedtls_hmac_drbg_seed( mbedtls_hmac_drbg_context *ctx, /** * \brief Initilisation of simpified HMAC_DRBG (never reseeds). - * (For use with deterministic ECDSA.) * - * \param ctx HMAC_DRBG context to be initialised - * \param md_info MD algorithm to use for HMAC_DRBG - * \param data Concatenation of entropy string and additional data - * \param data_len Length of data in bytes + * This function is meant for use in algorithms that need a pseudorandom + * input such as deterministic ECDSA. + * + * \param ctx HMAC_DRBG context to be initialised. + * \param md_info MD algorithm to use for HMAC_DRBG. + * \param data Concatenation of the initial entropy string and + * the additional data. + * \param data_len Length of \p data in bytes. * - * \return 0 if successful, or - * MBEDTLS_ERR_MD_BAD_INPUT_DATA, or - * MBEDTLS_ERR_MD_ALLOC_FAILED. + * \return \c 0 if successful. or + * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA if \p md_info is + * invalid. + * \return #MBEDTLS_ERR_MD_ALLOC_FAILED if there was not enough + * memory to allocate context data. */ int mbedtls_hmac_drbg_seed_buf( mbedtls_hmac_drbg_context *ctx, const mbedtls_md_info_t * md_info, const unsigned char *data, size_t data_len ); /** - * \brief Enable / disable prediction resistance (Default: Off) + * \brief This function turns prediction resistance on or off. + * The default value is off. * - * Note: If enabled, entropy is used for ctx->entropy_len before each call! - * Only use this if you have ample supply of good entropy! + * \note If enabled, entropy is gathered at the beginning of + * every call to mbedtls_hmac_drbg_random_with_add() + * or mbedtls_hmac_drbg_random(). + * Only use this if your entropy source has sufficient + * throughput. * - * \param ctx HMAC_DRBG context - * \param resistance MBEDTLS_HMAC_DRBG_PR_ON or MBEDTLS_HMAC_DRBG_PR_OFF + * \param ctx The HMAC_DRBG context. + * \param resistance #MBEDTLS_HMAC_DRBG_PR_ON or #MBEDTLS_HMAC_DRBG_PR_OFF. */ void mbedtls_hmac_drbg_set_prediction_resistance( mbedtls_hmac_drbg_context *ctx, int resistance ); /** - * \brief Set the amount of entropy grabbed on each reseed - * (Default: given by the security strength, which - * depends on the hash used, see \c mbedtls_hmac_drbg_init() ) + * \brief This function sets the amount of entropy grabbed on each + * seed or reseed. * - * \param ctx HMAC_DRBG context - * \param len Amount of entropy to grab, in bytes + * See the documentation of mbedtls_hmac_drbg_seed() for the default value. + * + * \param ctx The HMAC_DRBG context. + * \param len The amount of entropy to grab, in bytes. */ void mbedtls_hmac_drbg_set_entropy_len( mbedtls_hmac_drbg_context *ctx, size_t len ); /** - * \brief Set the reseed interval - * (Default: MBEDTLS_HMAC_DRBG_RESEED_INTERVAL) + * \brief Set the reseed interval. + * + * The reseed interval is the number of calls to mbedtls_hmac_drbg_random() + * or mbedtls_hmac_drbg_random_with_add() after which the entropy function + * is called again. * - * \param ctx HMAC_DRBG context - * \param interval Reseed interval + * The default value is #MBEDTLS_HMAC_DRBG_RESEED_INTERVAL. + * + * \param ctx The HMAC_DRBG context. + * \param interval The reseed interval. */ void mbedtls_hmac_drbg_set_reseed_interval( mbedtls_hmac_drbg_context *ctx, int interval ); /** - * \brief HMAC_DRBG update state + * \brief This function updates the state of the HMAC_DRBG context. * - * \param ctx HMAC_DRBG context - * \param additional Additional data to update state with, or NULL - * \param add_len Length of additional data, or 0 + * \param ctx The HMAC_DRBG context. + * \param additional The data to update the state with. + * If this is \c NULL, there is no additional data. + * \param add_len Length of \p additional in bytes. + * Unused if \p additional is \c NULL. * * \return \c 0 on success, or an error from the underlying * hash calculation. - * - * \note Additional data is optional, pass NULL and 0 as second - * third argument if no additional data is being used. */ int mbedtls_hmac_drbg_update_ret( mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t add_len ); /** - * \brief HMAC_DRBG reseeding (extracts data from entropy source) - * - * \param ctx HMAC_DRBG context - * \param additional Additional data to add to state (Can be NULL) - * \param len Length of additional data - * - * \return 0 if successful, or - * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED + * \brief This function reseeds the HMAC_DRBG context, that is + * extracts data from the entropy source. + * + * \param ctx The HMAC_DRBG context. + * \param additional Additional data to add to the state. + * If this is \c NULL, there is no additional data + * and \p len should be \c 0. + * \param len The length of the additional data. + * This must be at most #MBEDTLS_HMAC_DRBG_MAX_INPUT + * and also at most + * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \p entropy_len + * where \p entropy_len is the entropy length + * (see mbedtls_hmac_drbg_set_entropy_len()). + * + * \return \c 0 if successful. + * \return #MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED + * if a call to the entropy function failed. */ int mbedtls_hmac_drbg_reseed( mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t len ); /** - * \brief HMAC_DRBG generate random with additional update input - * - * Note: Automatically reseeds if reseed_counter is reached or PR is enabled. - * - * \param p_rng HMAC_DRBG context - * \param output Buffer to fill - * \param output_len Length of the buffer - * \param additional Additional data to update with (can be NULL) - * \param add_len Length of additional data (can be 0) - * - * \return 0 if successful, or - * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED, or - * MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG, or - * MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG. + * \brief This function updates an HMAC_DRBG instance with additional + * data and uses it to generate random data. + * + * This function automatically reseeds if the reseed counter is exceeded + * or prediction resistance is enabled. + * + * \param p_rng The HMAC_DRBG context. This must be a pointer to a + * #mbedtls_hmac_drbg_context structure. + * \param output The buffer to fill. + * \param output_len The length of the buffer in bytes. + * This must be at most #MBEDTLS_HMAC_DRBG_MAX_REQUEST. + * \param additional Additional data to update with. + * If this is \c NULL, there is no additional data + * and \p add_len should be \c 0. + * \param add_len The length of the additional data. + * This must be at most #MBEDTLS_HMAC_DRBG_MAX_INPUT. + * + * \return \c 0 if successful. + * \return #MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED + * if a call to the entropy source failed. + * \return #MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG if + * \p output_len > #MBEDTLS_HMAC_DRBG_MAX_REQUEST. + * \return #MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG if + * \p add_len > #MBEDTLS_HMAC_DRBG_MAX_INPUT. */ int mbedtls_hmac_drbg_random_with_add( void *p_rng, unsigned char *output, size_t output_len, @@ -245,24 +343,29 @@ int mbedtls_hmac_drbg_random_with_add( void *p_rng, size_t add_len ); /** - * \brief HMAC_DRBG generate random - * - * Note: Automatically reseeds if reseed_counter is reached or PR is enabled. - * - * \param p_rng HMAC_DRBG context - * \param output Buffer to fill - * \param out_len Length of the buffer - * - * \return 0 if successful, or - * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED, or - * MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG + * \brief This function uses HMAC_DRBG to generate random data. + * + * This function automatically reseeds if the reseed counter is exceeded + * or prediction resistance is enabled. + * + * \param p_rng The HMAC_DRBG context. This must be a pointer to a + * #mbedtls_hmac_drbg_context structure. + * \param output The buffer to fill. + * \param out_len The length of the buffer in bytes. + * This must be at most #MBEDTLS_HMAC_DRBG_MAX_REQUEST. + * + * \return \c 0 if successful. + * \return #MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED + * if a call to the entropy source failed. + * \return #MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG if + * \p out_len > #MBEDTLS_HMAC_DRBG_MAX_REQUEST. */ int mbedtls_hmac_drbg_random( void *p_rng, unsigned char *output, size_t out_len ); /** * \brief Free an HMAC_DRBG context * - * \param ctx HMAC_DRBG context to free. + * \param ctx The HMAC_DRBG context to free. */ void mbedtls_hmac_drbg_free( mbedtls_hmac_drbg_context *ctx ); @@ -273,17 +376,16 @@ void mbedtls_hmac_drbg_free( mbedtls_hmac_drbg_context *ctx ); #define MBEDTLS_DEPRECATED #endif /** - * \brief HMAC_DRBG update state + * \brief This function updates the state of the HMAC_DRBG context. * * \deprecated Superseded by mbedtls_hmac_drbg_update_ret() * in 2.16.0. * - * \param ctx HMAC_DRBG context - * \param additional Additional data to update state with, or NULL - * \param add_len Length of additional data, or 0 - * - * \note Additional data is optional, pass NULL and 0 as second - * third argument if no additional data is being used. + * \param ctx The HMAC_DRBG context. + * \param additional The data to update the state with. + * If this is \c NULL, there is no additional data. + * \param add_len Length of \p additional in bytes. + * Unused if \p additional is \c NULL. */ MBEDTLS_DEPRECATED void mbedtls_hmac_drbg_update( mbedtls_hmac_drbg_context *ctx, @@ -293,26 +395,31 @@ MBEDTLS_DEPRECATED void mbedtls_hmac_drbg_update( #if defined(MBEDTLS_FS_IO) /** - * \brief Write a seed file + * \brief This function writes a seed file. * - * \param ctx HMAC_DRBG context - * \param path Name of the file + * \param ctx The HMAC_DRBG context. + * \param path The name of the file. * - * \return 0 if successful, 1 on file error, or - * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED + * \return \c 0 on success. + * \return #MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR on file error. + * \return #MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED on reseed + * failure. */ int mbedtls_hmac_drbg_write_seed_file( mbedtls_hmac_drbg_context *ctx, const char *path ); /** - * \brief Read and update a seed file. Seed is added to this - * instance - * - * \param ctx HMAC_DRBG context - * \param path Name of the file - * - * \return 0 if successful, 1 on file error, - * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED or - * MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG + * \brief This function reads and updates a seed file. The seed + * is added to this instance. + * + * \param ctx The HMAC_DRBG context. + * \param path The name of the file. + * + * \return \c 0 on success. + * \return #MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR on file error. + * \return #MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED on + * reseed failure. + * \return #MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG if the existing + * seed file is too large. */ int mbedtls_hmac_drbg_update_seed_file( mbedtls_hmac_drbg_context *ctx, const char *path ); #endif /* MBEDTLS_FS_IO */ @@ -320,9 +427,10 @@ int mbedtls_hmac_drbg_update_seed_file( mbedtls_hmac_drbg_context *ctx, const ch #if defined(MBEDTLS_SELF_TEST) /** - * \brief Checkup routine + * \brief The HMAC_DRBG Checkup routine. * - * \return 0 if successful, or 1 if the test failed + * \return \c 0 if successful. + * \return \c 1 if the test failed. */ int mbedtls_hmac_drbg_self_test( int verbose ); #endif diff --git a/tools/sdk/include/mbedtls/mbedtls/md.h b/tools/sdk/include/mbedtls/mbedtls/md.h index 8bcf766a6ca..6a21f059082 100644 --- a/tools/sdk/include/mbedtls/mbedtls/md.h +++ b/tools/sdk/include/mbedtls/mbedtls/md.h @@ -7,7 +7,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -21,6 +27,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ @@ -98,6 +125,8 @@ typedef struct mbedtls_md_context_t * \brief This function returns the list of digests supported by the * generic digest module. * + * \note The list starts with the strongest available hashes. + * * \return A statically allocated array of digests. Each element * in the returned list is an integer belonging to the * message-digest enumeration #mbedtls_md_type_t. diff --git a/tools/sdk/include/mbedtls/mbedtls/md2.h b/tools/sdk/include/mbedtls/mbedtls/md2.h index fe97cf08d40..6d563b41bec 100644 --- a/tools/sdk/include/mbedtls/mbedtls/md2.h +++ b/tools/sdk/include/mbedtls/mbedtls/md2.h @@ -9,7 +9,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -23,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) * */ diff --git a/tools/sdk/include/mbedtls/mbedtls/md4.h b/tools/sdk/include/mbedtls/mbedtls/md4.h index ce703c0ba4f..3f4bcdc607b 100644 --- a/tools/sdk/include/mbedtls/mbedtls/md4.h +++ b/tools/sdk/include/mbedtls/mbedtls/md4.h @@ -9,7 +9,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -23,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) * */ diff --git a/tools/sdk/include/mbedtls/mbedtls/md5.h b/tools/sdk/include/mbedtls/mbedtls/md5.h index 6eed6cc864a..34279c72121 100644 --- a/tools/sdk/include/mbedtls/mbedtls/md5.h +++ b/tools/sdk/include/mbedtls/mbedtls/md5.h @@ -9,7 +9,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -23,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD5_H diff --git a/tools/sdk/include/mbedtls/mbedtls/md_internal.h b/tools/sdk/include/mbedtls/mbedtls/md_internal.h index 04de4829184..154b8bbc270 100644 --- a/tools/sdk/include/mbedtls/mbedtls/md_internal.h +++ b/tools/sdk/include/mbedtls/mbedtls/md_internal.h @@ -9,7 +9,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -23,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD_WRAP_H diff --git a/tools/sdk/include/mbedtls/mbedtls/memory_buffer_alloc.h b/tools/sdk/include/mbedtls/mbedtls/memory_buffer_alloc.h index 705f9a63690..c1e0926b13f 100644 --- a/tools/sdk/include/mbedtls/mbedtls/memory_buffer_alloc.h +++ b/tools/sdk/include/mbedtls/mbedtls/memory_buffer_alloc.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MEMORY_BUFFER_ALLOC_H diff --git a/tools/sdk/include/mbedtls/mbedtls/net.h b/tools/sdk/include/mbedtls/mbedtls/net.h index 8cead58e5df..bba4a359406 100644 --- a/tools/sdk/include/mbedtls/mbedtls/net.h +++ b/tools/sdk/include/mbedtls/mbedtls/net.h @@ -7,7 +7,13 @@ */ /* * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -21,6 +27,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/tools/sdk/include/mbedtls/mbedtls/net_sockets.h b/tools/sdk/include/mbedtls/mbedtls/net_sockets.h index 4c7ef00fe66..d4d23fe9d89 100644 --- a/tools/sdk/include/mbedtls/mbedtls/net_sockets.h +++ b/tools/sdk/include/mbedtls/mbedtls/net_sockets.h @@ -21,7 +21,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -35,6 +41,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_NET_SOCKETS_H diff --git a/tools/sdk/include/mbedtls/mbedtls/nist_kw.h b/tools/sdk/include/mbedtls/mbedtls/nist_kw.h index 3b67b59cd29..f2b9cebf9ca 100644 --- a/tools/sdk/include/mbedtls/mbedtls/nist_kw.h +++ b/tools/sdk/include/mbedtls/mbedtls/nist_kw.h @@ -17,7 +17,13 @@ */ /* * Copyright (C) 2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -31,6 +37,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/oid.h b/tools/sdk/include/mbedtls/mbedtls/oid.h index 6fbd018aaa1..7fe4b386215 100644 --- a/tools/sdk/include/mbedtls/mbedtls/oid.h +++ b/tools/sdk/include/mbedtls/mbedtls/oid.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_OID_H diff --git a/tools/sdk/include/mbedtls/mbedtls/padlock.h b/tools/sdk/include/mbedtls/mbedtls/padlock.h index 721a5d4930e..bd476f5f385 100644 --- a/tools/sdk/include/mbedtls/mbedtls/padlock.h +++ b/tools/sdk/include/mbedtls/mbedtls/padlock.h @@ -9,7 +9,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -23,6 +29,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PADLOCK_H diff --git a/tools/sdk/include/mbedtls/mbedtls/pem.h b/tools/sdk/include/mbedtls/mbedtls/pem.h index a29e9ce3002..16b6101415a 100644 --- a/tools/sdk/include/mbedtls/mbedtls/pem.h +++ b/tools/sdk/include/mbedtls/mbedtls/pem.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PEM_H diff --git a/tools/sdk/include/mbedtls/mbedtls/pk.h b/tools/sdk/include/mbedtls/mbedtls/pk.h index 91950f9407b..408f7baee7d 100644 --- a/tools/sdk/include/mbedtls/mbedtls/pk.h +++ b/tools/sdk/include/mbedtls/mbedtls/pk.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ @@ -416,6 +443,10 @@ int mbedtls_pk_verify_ext( mbedtls_pk_type_t type, const void *options, * * \note For RSA, md_alg may be MBEDTLS_MD_NONE if hash_len != 0. * For ECDSA, md_alg may never be MBEDTLS_MD_NONE. + * + * \note In order to ensure enough space for the signature, the + * \p sig buffer size must be of at least + * `max(MBEDTLS_ECDSA_MAX_LEN, MBEDTLS_MPI_MAX_SIZE)` bytes. */ int mbedtls_pk_sign( mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, @@ -430,6 +461,10 @@ int mbedtls_pk_sign( mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, * \c mbedtls_ecp_set_max_ops() to reduce blocking for ECC * operations. For RSA, same as \c mbedtls_pk_sign(). * + * \note In order to ensure enough space for the signature, the + * \p sig buffer size must be of at least + * `max(MBEDTLS_ECDSA_MAX_LEN, MBEDTLS_MPI_MAX_SIZE)` bytes. + * * \param ctx The PK context to use. It must have been set up * with a private key. * \param md_alg Hash algorithm used (see notes) diff --git a/tools/sdk/include/mbedtls/mbedtls/pk_internal.h b/tools/sdk/include/mbedtls/mbedtls/pk_internal.h index 48b7a5f7bf2..1cd05943bac 100644 --- a/tools/sdk/include/mbedtls/mbedtls/pk_internal.h +++ b/tools/sdk/include/mbedtls/mbedtls/pk_internal.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/pkcs11.h b/tools/sdk/include/mbedtls/mbedtls/pkcs11.h index 02427ddc1e9..e1446120c85 100644 --- a/tools/sdk/include/mbedtls/mbedtls/pkcs11.h +++ b/tools/sdk/include/mbedtls/mbedtls/pkcs11.h @@ -7,7 +7,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -21,6 +27,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS11_H diff --git a/tools/sdk/include/mbedtls/mbedtls/pkcs12.h b/tools/sdk/include/mbedtls/mbedtls/pkcs12.h index d441357b7f4..c418e8f243d 100644 --- a/tools/sdk/include/mbedtls/mbedtls/pkcs12.h +++ b/tools/sdk/include/mbedtls/mbedtls/pkcs12.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS12_H diff --git a/tools/sdk/include/mbedtls/mbedtls/pkcs5.h b/tools/sdk/include/mbedtls/mbedtls/pkcs5.h index c92185f7a68..c3f645aff1b 100644 --- a/tools/sdk/include/mbedtls/mbedtls/pkcs5.h +++ b/tools/sdk/include/mbedtls/mbedtls/pkcs5.h @@ -7,7 +7,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -21,6 +27,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS5_H diff --git a/tools/sdk/include/mbedtls/mbedtls/platform.h b/tools/sdk/include/mbedtls/mbedtls/platform.h index 89fe8a7b197..dcb5a88eebd 100644 --- a/tools/sdk/include/mbedtls/mbedtls/platform.h +++ b/tools/sdk/include/mbedtls/mbedtls/platform.h @@ -14,7 +14,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -28,6 +34,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PLATFORM_H diff --git a/tools/sdk/include/mbedtls/mbedtls/platform_time.h b/tools/sdk/include/mbedtls/mbedtls/platform_time.h index 2ed36f56c9e..a45870c3a65 100644 --- a/tools/sdk/include/mbedtls/mbedtls/platform_time.h +++ b/tools/sdk/include/mbedtls/mbedtls/platform_time.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PLATFORM_TIME_H diff --git a/tools/sdk/include/mbedtls/mbedtls/platform_util.h b/tools/sdk/include/mbedtls/mbedtls/platform_util.h index dba6d459822..f10574afe6f 100644 --- a/tools/sdk/include/mbedtls/mbedtls/platform_util.h +++ b/tools/sdk/include/mbedtls/mbedtls/platform_util.h @@ -6,7 +6,13 @@ */ /* * Copyright (C) 2018, Arm Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -20,6 +26,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PLATFORM_UTIL_H @@ -43,6 +70,12 @@ extern "C" { #if defined(MBEDTLS_CHECK_PARAMS) +#if defined(MBEDTLS_CHECK_PARAMS_ASSERT) +/* Allow the user to define MBEDTLS_PARAM_FAILED to something like assert + * (which is what our config.h suggests). */ +#include +#endif /* MBEDTLS_CHECK_PARAMS_ASSERT */ + #if defined(MBEDTLS_PARAM_FAILED) /** An alternative definition of MBEDTLS_PARAM_FAILED has been set in config.h. * @@ -50,6 +83,11 @@ extern "C" { * MBEDTLS_PARAM_FAILED() will expand to a call to mbedtls_param_failed(). */ #define MBEDTLS_PARAM_FAILED_ALT + +#elif defined(MBEDTLS_CHECK_PARAMS_ASSERT) +#define MBEDTLS_PARAM_FAILED( cond ) assert( cond ) +#define MBEDTLS_PARAM_FAILED_ALT + #else /* MBEDTLS_PARAM_FAILED */ #define MBEDTLS_PARAM_FAILED( cond ) \ mbedtls_param_failed( #cond, __FILE__, __LINE__ ) diff --git a/tools/sdk/include/mbedtls/mbedtls/poly1305.h b/tools/sdk/include/mbedtls/mbedtls/poly1305.h index f0ec44c9683..6e45b2c2ba0 100644 --- a/tools/sdk/include/mbedtls/mbedtls/poly1305.h +++ b/tools/sdk/include/mbedtls/mbedtls/poly1305.h @@ -12,8 +12,15 @@ * \author Daniel King */ -/* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -27,6 +34,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ diff --git a/tools/sdk/include/mbedtls/mbedtls/ripemd160.h b/tools/sdk/include/mbedtls/mbedtls/ripemd160.h index b42f6d2a959..505c39252e5 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ripemd160.h +++ b/tools/sdk/include/mbedtls/mbedtls/ripemd160.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_RIPEMD160_H diff --git a/tools/sdk/include/mbedtls/mbedtls/rsa.h b/tools/sdk/include/mbedtls/mbedtls/rsa.h index 906c4273325..cd22fc4c1fb 100644 --- a/tools/sdk/include/mbedtls/mbedtls/rsa.h +++ b/tools/sdk/include/mbedtls/mbedtls/rsa.h @@ -11,7 +11,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -25,6 +31,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_RSA_H @@ -150,13 +177,13 @@ mbedtls_rsa_context; * \note The choice of padding mode is strictly enforced for private key * operations, since there might be security concerns in * mixing padding modes. For public key operations it is - * a default value, which can be overriden by calling specific + * a default value, which can be overridden by calling specific * \c rsa_rsaes_xxx or \c rsa_rsassa_xxx functions. * * \note The hash selected in \p hash_id is always used for OEAP * encryption. For PSS signatures, it is always used for - * making signatures, but can be overriden for verifying them. - * If set to #MBEDTLS_MD_NONE, it is always overriden. + * making signatures, but can be overridden for verifying them. + * If set to #MBEDTLS_MD_NONE, it is always overridden. * * \param ctx The RSA context to initialize. This must not be \c NULL. * \param padding The padding mode to use. This must be either @@ -904,7 +931,8 @@ int mbedtls_rsa_rsaes_oaep_decrypt( mbedtls_rsa_context *ctx, * the size of the hash corresponding to \p md_alg. * \param sig The buffer to hold the signature. This must be a writable * buffer of length \c ctx->len Bytes. For example, \c 256 Bytes - * for an 2048-bit RSA modulus. + * for an 2048-bit RSA modulus. A buffer length of + * #MBEDTLS_MPI_MAX_SIZE is always safe. * * \return \c 0 if the signing operation was successful. * \return An \c MBEDTLS_ERR_RSA_XXX error code on failure. @@ -951,7 +979,8 @@ int mbedtls_rsa_pkcs1_sign( mbedtls_rsa_context *ctx, * the size of the hash corresponding to \p md_alg. * \param sig The buffer to hold the signature. This must be a writable * buffer of length \c ctx->len Bytes. For example, \c 256 Bytes - * for an 2048-bit RSA modulus. + * for an 2048-bit RSA modulus. A buffer length of + * #MBEDTLS_MPI_MAX_SIZE is always safe. * * \return \c 0 if the signing operation was successful. * \return An \c MBEDTLS_ERR_RSA_XXX error code on failure. @@ -1012,7 +1041,8 @@ int mbedtls_rsa_rsassa_pkcs1_v15_sign( mbedtls_rsa_context *ctx, * the size of the hash corresponding to \p md_alg. * \param sig The buffer to hold the signature. This must be a writable * buffer of length \c ctx->len Bytes. For example, \c 256 Bytes - * for an 2048-bit RSA modulus. + * for an 2048-bit RSA modulus. A buffer length of + * #MBEDTLS_MPI_MAX_SIZE is always safe. * * \return \c 0 if the signing operation was successful. * \return An \c MBEDTLS_ERR_RSA_XXX error code on failure. diff --git a/tools/sdk/include/mbedtls/mbedtls/rsa_internal.h b/tools/sdk/include/mbedtls/mbedtls/rsa_internal.h index 53abd3c5b0e..2464e6b082b 100644 --- a/tools/sdk/include/mbedtls/mbedtls/rsa_internal.h +++ b/tools/sdk/include/mbedtls/mbedtls/rsa_internal.h @@ -36,7 +36,13 @@ */ /* * Copyright (C) 2006-2017, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -50,6 +56,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) * */ diff --git a/tools/sdk/include/mbedtls/mbedtls/sha1.h b/tools/sdk/include/mbedtls/mbedtls/sha1.h index bb6ecf05a4a..e69db8a15a0 100644 --- a/tools/sdk/include/mbedtls/mbedtls/sha1.h +++ b/tools/sdk/include/mbedtls/mbedtls/sha1.h @@ -12,7 +12,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -26,6 +32,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA1_H diff --git a/tools/sdk/include/mbedtls/mbedtls/sha256.h b/tools/sdk/include/mbedtls/mbedtls/sha256.h index d64739820c6..5b03bc31dc9 100644 --- a/tools/sdk/include/mbedtls/mbedtls/sha256.h +++ b/tools/sdk/include/mbedtls/mbedtls/sha256.h @@ -8,7 +8,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -22,6 +28,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA256_H diff --git a/tools/sdk/include/mbedtls/mbedtls/sha512.h b/tools/sdk/include/mbedtls/mbedtls/sha512.h index c06ceed1d13..2fbc69f80e6 100644 --- a/tools/sdk/include/mbedtls/mbedtls/sha512.h +++ b/tools/sdk/include/mbedtls/mbedtls/sha512.h @@ -7,7 +7,13 @@ */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -21,6 +27,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA512_H diff --git a/tools/sdk/include/mbedtls/mbedtls/ssl.h b/tools/sdk/include/mbedtls/mbedtls/ssl.h index d31f6cdd566..6f56983562e 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ssl.h +++ b/tools/sdk/include/mbedtls/mbedtls/ssl.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_H @@ -123,6 +150,7 @@ #define MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS -0x6500 /**< The asynchronous operation is not completed yet. */ #define MBEDTLS_ERR_SSL_EARLY_MESSAGE -0x6480 /**< Internal-only message signaling that a message arrived early. */ #define MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS -0x7000 /**< A cryptographic operation is in progress. Try again later. */ +#define MBEDTLS_ERR_SSL_BAD_CONFIG -0x5E80 /**< Invalid value in SSL config */ /* * Various constants @@ -137,6 +165,9 @@ #define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1 /*!< DTLS */ #define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255 /*!< Maximum host name defined in RFC 1035 */ +#define MBEDTLS_SSL_MAX_ALPN_NAME_LEN 255 /*!< Maximum size in bytes of a protocol name in alpn ext., RFC 7301 */ + +#define MBEDTLS_SSL_MAX_ALPN_LIST_LEN 65535 /*!< Maximum size in bytes of list in alpn ext., RFC 7301 */ /* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c * NONE must be zero so that memset()ing structure to zero works */ @@ -2033,7 +2064,7 @@ void mbedtls_ssl_conf_ca_chain( mbedtls_ssl_config *conf, * provision more than one cert/key pair (eg one ECDSA, one * RSA with SHA-256, one RSA with SHA-1). An adequate * certificate will be selected according to the client's - * advertised capabilities. In case mutliple certificates are + * advertised capabilities. In case multiple certificates are * adequate, preference is given to the one set by the first * call to this function, then second, etc. * @@ -3206,7 +3237,7 @@ void mbedtls_ssl_free( mbedtls_ssl_context *ssl ); * mbedtls_ssl_config_defaults() or mbedtls_ssl_config_free(). * * \note You need to call mbedtls_ssl_config_defaults() unless you - * manually set all of the relevent fields yourself. + * manually set all of the relevant fields yourself. * * \param conf SSL configuration context */ diff --git a/tools/sdk/include/mbedtls/mbedtls/ssl_cache.h b/tools/sdk/include/mbedtls/mbedtls/ssl_cache.h index 52ba0948c55..e987c29e110 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ssl_cache.h +++ b/tools/sdk/include/mbedtls/mbedtls/ssl_cache.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_CACHE_H diff --git a/tools/sdk/include/mbedtls/mbedtls/ssl_ciphersuites.h b/tools/sdk/include/mbedtls/mbedtls/ssl_ciphersuites.h index 71053e5ba71..8969141165e 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ssl_ciphersuites.h +++ b/tools/sdk/include/mbedtls/mbedtls/ssl_ciphersuites.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_CIPHERSUITES_H diff --git a/tools/sdk/include/mbedtls/mbedtls/ssl_cookie.h b/tools/sdk/include/mbedtls/mbedtls/ssl_cookie.h index e34760ae85e..71e056781c5 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ssl_cookie.h +++ b/tools/sdk/include/mbedtls/mbedtls/ssl_cookie.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_COOKIE_H diff --git a/tools/sdk/include/mbedtls/mbedtls/ssl_internal.h b/tools/sdk/include/mbedtls/mbedtls/ssl_internal.h index bd5ad94dbf0..b371094f1e8 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ssl_internal.h +++ b/tools/sdk/include/mbedtls/mbedtls/ssl_internal.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_INTERNAL_H @@ -182,6 +209,12 @@ : ( MBEDTLS_SSL_IN_CONTENT_LEN ) \ ) +/* Maximum size in bytes of list in sig-hash algorithm ext., RFC 5246 */ +#define MBEDTLS_SSL_MAX_SIG_HASH_ALG_LIST_LEN 65534 + +/* Maximum size in bytes of list in supported elliptic curve ext., RFC 4492 */ +#define MBEDTLS_SSL_MAX_CURVE_LIST_LEN 65535 + /* * Check that we obey the standard's message size bounds */ @@ -236,6 +269,41 @@ #define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT (1 << 0) #define MBEDTLS_TLS_EXT_ECJPAKE_KKPP_OK (1 << 1) +/** + * \brief This function checks if the remaining size in a buffer is + * greater or equal than a needed space. + * + * \param cur Pointer to the current position in the buffer. + * \param end Pointer to one past the end of the buffer. + * \param need Needed space in bytes. + * + * \return Zero if the needed space is available in the buffer, non-zero + * otherwise. + */ +static inline int mbedtls_ssl_chk_buf_ptr( const uint8_t *cur, + const uint8_t *end, size_t need ) +{ + return( ( cur > end ) || ( need > (size_t)( end - cur ) ) ); +} + +/** + * \brief This macro checks if the remaining size in a buffer is + * greater or equal than a needed space. If it is not the case, + * it returns an SSL_BUFFER_TOO_SMALL error. + * + * \param cur Pointer to the current position in the buffer. + * \param end Pointer to one past the end of the buffer. + * \param need Needed space in bytes. + * + */ +#define MBEDTLS_SSL_CHK_BUF_PTR( cur, end, need ) \ + do { \ + if( mbedtls_ssl_chk_buf_ptr( ( cur ), ( end ), ( need ) ) != 0 ) \ + { \ + return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); \ + } \ + } while( 0 ) + #ifdef __cplusplus extern "C" { #endif diff --git a/tools/sdk/include/mbedtls/mbedtls/ssl_ticket.h b/tools/sdk/include/mbedtls/mbedtls/ssl_ticket.h index a84e7816e4a..ac3be043374 100644 --- a/tools/sdk/include/mbedtls/mbedtls/ssl_ticket.h +++ b/tools/sdk/include/mbedtls/mbedtls/ssl_ticket.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_TICKET_H @@ -117,14 +144,14 @@ int mbedtls_ssl_ticket_setup( mbedtls_ssl_ticket_context *ctx, /** * \brief Implementation of the ticket write callback * - * \note See \c mbedlts_ssl_ticket_write_t for description + * \note See \c mbedtls_ssl_ticket_write_t for description */ mbedtls_ssl_ticket_write_t mbedtls_ssl_ticket_write; /** * \brief Implementation of the ticket parse callback * - * \note See \c mbedlts_ssl_ticket_parse_t for description + * \note See \c mbedtls_ssl_ticket_parse_t for description */ mbedtls_ssl_ticket_parse_t mbedtls_ssl_ticket_parse; diff --git a/tools/sdk/include/mbedtls/mbedtls/threading.h b/tools/sdk/include/mbedtls/mbedtls/threading.h index 92e6e6b987e..b6ec4df8e95 100644 --- a/tools/sdk/include/mbedtls/mbedtls/threading.h +++ b/tools/sdk/include/mbedtls/mbedtls/threading.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_THREADING_H diff --git a/tools/sdk/include/mbedtls/mbedtls/timing.h b/tools/sdk/include/mbedtls/mbedtls/timing.h index a965fe0d355..149ccfb6660 100644 --- a/tools/sdk/include/mbedtls/mbedtls/timing.h +++ b/tools/sdk/include/mbedtls/mbedtls/timing.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_TIMING_H diff --git a/tools/sdk/include/mbedtls/mbedtls/version.h b/tools/sdk/include/mbedtls/mbedtls/version.h index ef8e4c1f4fe..2bff31d51f1 100644 --- a/tools/sdk/include/mbedtls/mbedtls/version.h +++ b/tools/sdk/include/mbedtls/mbedtls/version.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ /* @@ -40,16 +67,16 @@ */ #define MBEDTLS_VERSION_MAJOR 2 #define MBEDTLS_VERSION_MINOR 16 -#define MBEDTLS_VERSION_PATCH 2 +#define MBEDTLS_VERSION_PATCH 7 /** * The single version number has the following structure: * MMNNPP00 * Major version | Minor version | Patch version */ -#define MBEDTLS_VERSION_NUMBER 0x02100200 -#define MBEDTLS_VERSION_STRING "2.16.2" -#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.16.2" +#define MBEDTLS_VERSION_NUMBER 0x02100700 +#define MBEDTLS_VERSION_STRING "2.16.7" +#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.16.7" #if defined(MBEDTLS_VERSION_C) diff --git a/tools/sdk/include/mbedtls/mbedtls/x509.h b/tools/sdk/include/mbedtls/mbedtls/x509.h index 9ae825c1838..e9f2fc60245 100644 --- a/tools/sdk/include/mbedtls/mbedtls/x509.h +++ b/tools/sdk/include/mbedtls/mbedtls/x509.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_H @@ -77,7 +104,7 @@ #define MBEDTLS_ERR_X509_ALLOC_FAILED -0x2880 /**< Allocation of memory failed. */ #define MBEDTLS_ERR_X509_FILE_IO_ERROR -0x2900 /**< Read/write of file failed. */ #define MBEDTLS_ERR_X509_BUFFER_TOO_SMALL -0x2980 /**< Destination buffer is too small. */ -#define MBEDTLS_ERR_X509_FATAL_ERROR -0x3000 /**< A fatal error occured, eg the chain is too long or the vrfy callback failed. */ +#define MBEDTLS_ERR_X509_FATAL_ERROR -0x3000 /**< A fatal error occurred, eg the chain is too long or the vrfy callback failed. */ /* \} name */ /** @@ -250,7 +277,7 @@ int mbedtls_x509_serial_gets( char *buf, size_t size, const mbedtls_x509_buf *se * * \param to mbedtls_x509_time to check * - * \return 1 if the given time is in the past or an error occured, + * \return 1 if the given time is in the past or an error occurred, * 0 otherwise. */ int mbedtls_x509_time_is_past( const mbedtls_x509_time *to ); @@ -264,7 +291,7 @@ int mbedtls_x509_time_is_past( const mbedtls_x509_time *to ); * * \param from mbedtls_x509_time to check * - * \return 1 if the given time is in the future or an error occured, + * \return 1 if the given time is in the future or an error occurred, * 0 otherwise. */ int mbedtls_x509_time_is_future( const mbedtls_x509_time *from ); diff --git a/tools/sdk/include/mbedtls/mbedtls/x509_crl.h b/tools/sdk/include/mbedtls/mbedtls/x509_crl.h index 08a4283a674..0e37f65e8f0 100644 --- a/tools/sdk/include/mbedtls/mbedtls/x509_crl.h +++ b/tools/sdk/include/mbedtls/mbedtls/x509_crl.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CRL_H @@ -111,7 +138,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain, /** * \brief Parse one or more CRLs and append them to the chained list * - * \note Mutliple CRLs are accepted only if using PEM format + * \note Multiple CRLs are accepted only if using PEM format * * \param chain points to the start of the chain * \param buf buffer holding the CRL data in PEM or DER format @@ -126,7 +153,7 @@ int mbedtls_x509_crl_parse( mbedtls_x509_crl *chain, const unsigned char *buf, s /** * \brief Load one or more CRLs and append them to the chained list * - * \note Mutliple CRLs are accepted only if using PEM format + * \note Multiple CRLs are accepted only if using PEM format * * \param chain points to the start of the chain * \param path filename to read the CRLs from (in PEM or DER encoding) diff --git a/tools/sdk/include/mbedtls/mbedtls/x509_crt.h b/tools/sdk/include/mbedtls/mbedtls/x509_crt.h index 670bd10d891..4aae923ea02 100644 --- a/tools/sdk/include/mbedtls/mbedtls/x509_crt.h +++ b/tools/sdk/include/mbedtls/mbedtls/x509_crt.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CRT_H diff --git a/tools/sdk/include/mbedtls/mbedtls/x509_csr.h b/tools/sdk/include/mbedtls/mbedtls/x509_csr.h index a3c28048e01..8ba2cda0dc5 100644 --- a/tools/sdk/include/mbedtls/mbedtls/x509_csr.h +++ b/tools/sdk/include/mbedtls/mbedtls/x509_csr.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CSR_H diff --git a/tools/sdk/include/mbedtls/mbedtls/xtea.h b/tools/sdk/include/mbedtls/mbedtls/xtea.h index b47f5535085..d372110215f 100644 --- a/tools/sdk/include/mbedtls/mbedtls/xtea.h +++ b/tools/sdk/include/mbedtls/mbedtls/xtea.h @@ -5,7 +5,13 @@ */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + * + * This file is provided under the Apache License 2.0, or the + * GNU General Public License v2.0 or later. + * + * ********** + * Apache License 2.0: * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. @@ -19,6 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. * + * ********** + * + * ********** + * GNU General Public License v2.0 or later: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * ********** + * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_XTEA_H diff --git a/tools/sdk/include/mqtt/mqtt_client.h b/tools/sdk/include/mqtt/mqtt_client.h index 8ca3293de39..e365cb8463c 100644 --- a/tools/sdk/include/mqtt/mqtt_client.h +++ b/tools/sdk/include/mqtt/mqtt_client.h @@ -14,6 +14,9 @@ #include "mqtt_config.h" #include "esp_event.h" +#if CONFIG_ESP_TLS_USE_DS_PERIPHERAL +#include "rsa_sign_alt.h" +#endif #ifdef __cplusplus extern "C" { @@ -37,6 +40,7 @@ typedef struct esp_mqtt_client *esp_mqtt_client_handle_t; * */ typedef enum { + MQTT_EVENT_ANY = -1, MQTT_EVENT_ERROR = 0, /*!< on error event, additional context: connection return code, error handle from esp_tls (if supported) */ MQTT_EVENT_CONNECTED, /*!< connected event, additional context: session_present flag */ MQTT_EVENT_DISCONNECTED, /*!< disconnected event */ @@ -88,6 +92,15 @@ typedef enum { MQTT_TRANSPORT_OVER_WSS /*!< MQTT over Websocket Secure, using scheme: ``wss`` */ } esp_mqtt_transport_t; +/** + * MQTT protocol version used for connection + */ +typedef enum { + MQTT_PROTOCOL_UNDEFINED = 0, + MQTT_PROTOCOL_V_3_1, + MQTT_PROTOCOL_V_3_1_1 +} esp_mqtt_protocol_ver_t; + /** * @brief MQTT error code structure to be passed as a contextual information into ERROR event * @@ -155,7 +168,7 @@ typedef struct { void *user_context; /*!< pass user context to this option, then can receive that context in ``event->user_context`` */ int task_prio; /*!< MQTT task priority, default is 5, can be changed in ``make menuconfig`` */ int task_stack; /*!< MQTT task stack size, default is 6144 bytes, can be changed in ``make menuconfig`` */ - int buffer_size; /*!< size of MQTT send/receive buffer, default is 1024 */ + int buffer_size; /*!< size of MQTT send/receive buffer, default is 1024 (only receive buffer size if ``out_buffer_size`` defined) */ const char *cert_pem; /*!< Pointer to certificate data in PEM or DER format for server verify (with SSL), default is NULL, not required to verify the server. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in cert_len. */ size_t cert_len; /*!< Length of the buffer pointed to by cert_pem. May be 0 for null-terminated pem */ const char *client_cert_pem; /*!< Pointer to certificate data in PEM or DER format for SSL mutual authentication, default is NULL, not required if mutual authentication is not needed. If it is not NULL, also `client_key_pem` has to be provided. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in client_cert_len. */ @@ -166,6 +179,15 @@ typedef struct { int refresh_connection_after_ms; /*!< Refresh connection after this value (in milliseconds) */ const struct psk_key_hint* psk_hint_key; /*!< Pointer to PSK struct defined in esp_tls.h to enable PSK authentication (as alternative to certificate verification). If not NULL and server/client certificates are NULL, PSK is enabled */ bool use_global_ca_store; /*!< Use a global ca_store for all the connections in which this bool is set. */ + int reconnect_timeout_ms; /*!< Reconnect to the broker after this value in miliseconds if auto reconnect is not disabled */ + const char **alpn_protos; /*!< NULL-terminated list of supported application protocols to be used for ALPN */ + const char *clientkey_password; /*!< Client key decryption password string */ + int clientkey_password_len; /*!< String length of the password pointed to by clientkey_password */ + esp_mqtt_protocol_ver_t protocol_ver; /*!< MQTT protocol version used for connection, defaults to value from menuconfig*/ + int out_buffer_size; /*!< size of MQTT output buffer. If not defined, both output and input buffers have the same size defined as ``buffer_size`` */ + bool skip_cert_common_name_check; /*!< Skip any validation of server certificate CN field, this reduces the security of TLS and makes the mqtt client susceptible to MITM attacks */ + bool use_secure_element; /*!< enable secure element for enabling SSL connection */ + void *ds_data; /*!< carrier of handle for digital signature parameters */ } esp_mqtt_client_config_t; /** @@ -209,9 +231,21 @@ esp_err_t esp_mqtt_client_start(esp_mqtt_client_handle_t client); */ esp_err_t esp_mqtt_client_reconnect(esp_mqtt_client_handle_t client); +/** + * @brief This api is typically used to force disconnection from the broker + * + * @param client mqtt client handle + * + * @return ESP_OK on success + */ +esp_err_t esp_mqtt_client_disconnect(esp_mqtt_client_handle_t client); + /** * @brief Stops mqtt client tasks * + * * Notes: + * - Cannot be called from the mqtt event handler + * * @param client mqtt client handle * * @return ESP_OK on success @@ -257,6 +291,9 @@ int esp_mqtt_client_unsubscribe(esp_mqtt_client_handle_t client, const char *top * @brief Client to send a publish message to the broker * * Notes: + * - This API might block for several seconds, either due to network timeout (10s) + * or if publishing payloads longer than internal buffer (due to message + * fragmentation) * - Client doesn't have to be connected to send publish message * (although it would drop all qos=0 messages, qos>1 messages would be enqueued) * - It is thread safe, please refer to `esp_mqtt_client_subscribe` for details @@ -276,6 +313,9 @@ int esp_mqtt_client_publish(esp_mqtt_client_handle_t client, const char *topic, /** * @brief Destroys the client handle * + * Notes: + * - Cannot be called from the mqtt event handler + * * @param client mqtt client handle * * @return ESP_OK diff --git a/tools/sdk/include/mqtt/mqtt_config.h b/tools/sdk/include/mqtt/mqtt_config.h index 033fc0a732a..e259a2a1188 100644 --- a/tools/sdk/include/mqtt/mqtt_config.h +++ b/tools/sdk/include/mqtt/mqtt_config.h @@ -8,8 +8,11 @@ #include "sdkconfig.h" -#define MQTT_PROTOCOL_311 CONFIG_MQTT_PROTOCOL_311 -#define MQTT_RECONNECT_TIMEOUT_MS (10*1000) +#ifdef CONFIG_MQTT_PROTOCOL_311 +#define MQTT_PROTOCOL_311 +#endif + +#define MQTT_RECON_DEFAULT_MS (10*1000) #define MQTT_POLL_READ_TIMEOUT_MS (1000) #if CONFIG_MQTT_BUFFER_SIZE @@ -24,7 +27,12 @@ #define MQTT_MAX_PASSWORD_LEN 65 #define MQTT_MAX_LWT_TOPIC 32 #define MQTT_MAX_LWT_MSG 128 + +#if CONFIG_MQTT_TASK_PRIORITY +#define MQTT_TASK_PRIORITY CONFIG_MQTT_TASK_PRIORITY +#else #define MQTT_TASK_PRIORITY 5 +#endif #if CONFIG_MQTT_TASK_STACK_SIZE #define MQTT_TASK_STACK CONFIG_MQTT_TASK_STACK_SIZE @@ -76,11 +84,16 @@ #endif #endif +#ifdef CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS +#define OUTBOX_EXPIRED_TIMEOUT_MS CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS +#else +#define OUTBOX_EXPIRED_TIMEOUT_MS (30*1000) +#endif #define MQTT_ENABLE_SSL CONFIG_MQTT_TRANSPORT_SSL #define MQTT_ENABLE_WS CONFIG_MQTT_TRANSPORT_WEBSOCKET #define MQTT_ENABLE_WSS CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE -#define OUTBOX_EXPIRED_TIMEOUT_MS (30*1000) + #define OUTBOX_MAX_SIZE (4*1024) #endif diff --git a/tools/sdk/include/mqtt/mqtt_supported_features.h b/tools/sdk/include/mqtt/mqtt_supported_features.h index 215b707c68f..9f1acf2ffad 100644 --- a/tools/sdk/include/mqtt/mqtt_supported_features.h +++ b/tools/sdk/include/mqtt/mqtt_supported_features.h @@ -31,6 +31,7 @@ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(3, 3, 0) // Features supported from 3.3 #define MQTT_SUPPORTED_FEATURE_EVENT_LOOP +#define MQTT_SUPPORTED_FEATURE_SKIP_CRT_CMN_NAME_CHECK #endif #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0) @@ -43,7 +44,19 @@ // Features supported in 4.1 #define MQTT_SUPPORTED_FEATURE_PSK_AUTHENTICATION #define MQTT_SUPPORTED_FEATURE_DER_CERTIFICATES +#define MQTT_SUPPORTED_FEATURE_ALPN +#define MQTT_SUPPORTED_FEATURE_CLIENT_KEY_PASSWORD #endif + +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0) +// Features supported in 4.2 +#define MQTT_SUPPORTED_FEATURE_SECURE_ELEMENT +#endif + +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0) +// Features supported in 4.3 +#define MQTT_SUPPORTED_FEATURE_DIGITAL_SIGNATURE #endif -#endif // _MQTT_SUPPORTED_FEATURES_H_ \ No newline at end of file +#endif /* ESP_IDF_VERSION */ +#endif // _MQTT_SUPPORTED_FEATURES_H_ diff --git a/tools/sdk/include/newlib/stdio.h b/tools/sdk/include/newlib/stdio.h index e336ee6ebab..0836ab5637d 100644 --- a/tools/sdk/include/newlib/stdio.h +++ b/tools/sdk/include/newlib/stdio.h @@ -696,8 +696,10 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { #ifndef __CYGWIN__ #ifndef lint +#ifdef __SINGLE_THREAD__ #define getc(fp) __sgetc_r(_REENT, fp) #define putc(x, fp) __sputc_r(_REENT, x, fp) +#endif /* __SINGLE_THREAD__ */ #endif /* lint */ #endif /* __CYGWIN__ */ @@ -714,8 +716,10 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { #endif /* !__CUSTOM_FILE_IO__ */ +#ifdef __SINGLE_THREAD__ #define getchar() getc(stdin) #define putchar(x) putc(x, stdout) +#endif /* __SINGLE_THREAD__ */ #ifndef __STRICT_ANSI__ #define getchar_unlocked() getc_unlocked(stdin) diff --git a/tools/sdk/include/smartconfig_ack/smartconfig_ack.h b/tools/sdk/include/smartconfig_ack/smartconfig_ack.h index be49fd3bd13..39f7636ebdc 100644 --- a/tools/sdk/include/smartconfig_ack/smartconfig_ack.h +++ b/tools/sdk/include/smartconfig_ack/smartconfig_ack.h @@ -24,6 +24,8 @@ extern "C" { #define SC_ACK_TOUCH_SERVER_PORT 18266 /*!< ESP touch UDP port of server on cellphone */ #define SC_ACK_AIRKISS_SERVER_PORT 10000 /*!< Airkiss UDP port of server on cellphone */ +#define SC_ACK_AIRKISS_DEVICE_PORT 10001 /*!< Airkiss UDP port of server on device */ +#define SC_ACK_AIRKISS_TIMEOUT 1500 /*!< Airkiss read data timeout millisecond */ #define SC_ACK_TOUCH_LEN 11 /*!< Length of ESP touch ACK context */ #define SC_ACK_AIRKISS_LEN 7 /*!< Length of Airkiss ACK context */ diff --git a/tools/sdk/include/soc/soc/soc_memory_layout.h b/tools/sdk/include/soc/soc/soc_memory_layout.h index 5587abe8d7c..9bca1120ab3 100644 --- a/tools/sdk/include/soc/soc/soc_memory_layout.h +++ b/tools/sdk/include/soc/soc/soc_memory_layout.h @@ -154,6 +154,10 @@ inline static bool IRAM_ATTR esp_ptr_executable(const void *p) intptr_t ip = (intptr_t) p; return (ip >= SOC_IROM_LOW && ip < SOC_IROM_HIGH) || (ip >= SOC_IRAM_LOW && ip < SOC_IRAM_HIGH) + || (ip >= SOC_IROM_MASK_LOW && ip < SOC_IROM_MASK_HIGH) +#if defined(SOC_CACHE_APP_LOW) && defined(CONFIG_FREERTOS_UNICORE) + || (ip >= SOC_CACHE_APP_LOW && ip < SOC_CACHE_APP_HIGH) +#endif || (ip >= SOC_RTC_IRAM_LOW && ip < SOC_RTC_IRAM_HIGH); } diff --git a/tools/sdk/include/spi_flash/esp_spi_flash.h b/tools/sdk/include/spi_flash/esp_spi_flash.h index 254e408959f..ddcbbf62014 100644 --- a/tools/sdk/include/spi_flash/esp_spi_flash.h +++ b/tools/sdk/include/spi_flash/esp_spi_flash.h @@ -317,6 +317,10 @@ typedef void (*spi_flash_op_unlock_func_t)(void); * @brief Function to protect SPI flash critical regions corruption. */ typedef bool (*spi_flash_is_safe_write_address_t)(size_t addr, size_t size); +/** + * @brief Function to yield to the OS during erase operation. + */ +typedef void (*spi_flash_os_yield_t)(void); /** * Structure holding SPI flash access critical sections management functions. @@ -357,6 +361,7 @@ typedef struct { #if !CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED spi_flash_is_safe_write_address_t is_safe_write_address; /**< checks flash write addresses.*/ #endif + spi_flash_os_yield_t yield; /**< yield to the OS during flash erase */ } spi_flash_guard_funcs_t; /** diff --git a/tools/sdk/include/tcp_transport/esp_transport_ws.h b/tools/sdk/include/tcp_transport/esp_transport_ws.h index 582c5c7da28..08ed2ef27e1 100644 --- a/tools/sdk/include/tcp_transport/esp_transport_ws.h +++ b/tools/sdk/include/tcp_transport/esp_transport_ws.h @@ -13,6 +13,15 @@ extern "C" { #endif +typedef enum ws_transport_opcodes { + WS_TRANSPORT_OPCODES_CONT = 0x00, + WS_TRANSPORT_OPCODES_TEXT = 0x01, + WS_TRANSPORT_OPCODES_BINARY = 0x02, + WS_TRANSPORT_OPCODES_CLOSE = 0x08, + WS_TRANSPORT_OPCODES_PING = 0x09, + WS_TRANSPORT_OPCODES_PONG = 0x0a, + WS_TRANSPORT_OPCODES_FIN = 0x80, +} ws_transport_opcodes_t; /** * @brief Create web socket transport @@ -23,8 +32,90 @@ extern "C" { */ esp_transport_handle_t esp_transport_ws_init(esp_transport_handle_t parent_handle); +/** + * @brief Set HTTP path to update protocol to websocket + * + * @param t websocket transport handle + * @param path The HTTP Path + */ void esp_transport_ws_set_path(esp_transport_handle_t t, const char *path); +/** + * @brief Set websocket sub protocol header + * + * @param t websocket transport handle + * @param sub_protocol Sub protocol string + * + * @return + * - ESP_OK on success + * - One of the error codes + */ +esp_err_t esp_transport_ws_set_subprotocol(esp_transport_handle_t t, const char *sub_protocol); + +/** + * @brief Set websocket user-agent header + * + * @param t websocket transport handle + * @param sub_protocol user-agent string + * + * @return + * - ESP_OK on success + * - One of the error codes + */ +esp_err_t esp_transport_ws_set_user_agent(esp_transport_handle_t t, const char *user_agent); + +/** + * @brief Set websocket additional headers + * + * @param t websocket transport handle + * @param sub_protocol additional header strings each terminated with \r\n + * + * @return + * - ESP_OK on success + * - One of the error codes + */ +esp_err_t esp_transport_ws_set_headers(esp_transport_handle_t t, const char *headers); + +/** + * @brief Sends websocket raw message with custom opcode and payload + * + * Note that generic esp_transport_write for ws handle sends + * binary massages by default if size is > 0 and + * ping message if message size is set to 0. + * This API is provided to support explicit messages with arbitrary opcode, + * should it be PING, PONG or TEXT message with arbitrary data. + * + * @param[in] t Websocket transport handle + * @param[in] opcode ws operation code + * @param[in] buffer The buffer + * @param[in] len The length + * @param[in] timeout_ms The timeout milliseconds (-1 indicates block forever) + * + * @return + * - Number of bytes was written + * - (-1) if there are any errors, should check errno + */ +int esp_transport_ws_send_raw(esp_transport_handle_t t, ws_transport_opcodes_t opcode, const char *b, int len, int timeout_ms); + +/** + * @brief Returns websocket op-code for last received data + * + * @param t websocket transport handle + * + * @return + * - Received op-code as enum + */ +ws_transport_opcodes_t esp_transport_ws_get_read_opcode(esp_transport_handle_t t); + +/** + * @brief Returns payload length of the last received data + * + * @param t websocket transport handle + * + * @return + * - Number of bytes in the payload + */ +int esp_transport_ws_get_read_payload_len(esp_transport_handle_t t); #ifdef __cplusplus diff --git a/tools/sdk/include/tcpip_adapter/tcpip_adapter.h b/tools/sdk/include/tcpip_adapter/tcpip_adapter.h index 6850f23a4ad..848bf16adca 100644 --- a/tools/sdk/include/tcpip_adapter/tcpip_adapter.h +++ b/tools/sdk/include/tcpip_adapter/tcpip_adapter.h @@ -406,6 +406,21 @@ esp_err_t tcpip_adapter_create_ip6_linklocal(tcpip_adapter_if_t tcpip_if); */ esp_err_t tcpip_adapter_get_ip6_linklocal(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6); +/** + * @brief Get interface global IPv6 address + * + * If the specified interface is up and a preferred global IPv6 address + * has been created for the interface, return a copy of it. + * + * @param[in] tcpip_if Interface to get global IPv6 address + * @param[out] if_ip6 IPv6 information will be returned in this argument if successful. + * + * @return + * - ESP_OK + * - ESP_FAIL If interface is down, does not have a global IPv6 address. + */ +esp_err_t tcpip_adapter_get_ip6_global(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6); + #if 0 esp_err_t tcpip_adapter_get_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac); diff --git a/tools/sdk/include/vfs/esp_vfs_dev.h b/tools/sdk/include/vfs/esp_vfs_dev.h index b330b4c5654..637f1449ff8 100644 --- a/tools/sdk/include/vfs/esp_vfs_dev.h +++ b/tools/sdk/include/vfs/esp_vfs_dev.h @@ -68,6 +68,44 @@ void esp_vfs_dev_uart_set_rx_line_endings(esp_line_endings_t mode); */ void esp_vfs_dev_uart_set_tx_line_endings(esp_line_endings_t mode); +/** + * @brief Set the line endings expected to be received on specified UART + * + * This specifies the conversion between line endings received on UART and + * newlines ('\n', LF) passed into stdin: + * + * - ESP_LINE_ENDINGS_CRLF: convert CRLF to LF + * - ESP_LINE_ENDINGS_CR: convert CR to LF + * - ESP_LINE_ENDINGS_LF: no modification + * + * @note this function is not thread safe w.r.t. reading from UART + * + * @param uart_num the UART number + * @param mode line endings to send to UART + * @return 0 if successed, or -1 + * when an error (specified by errno) have occurred. + */ +int esp_vfs_dev_uart_port_set_rx_line_endings(int uart_num, esp_line_endings_t mode); + +/** + * @brief Set the line endings to sent to specified UART + * + * This specifies the conversion between newlines ('\n', LF) on stdout and line + * endings sent over UART: + * + * - ESP_LINE_ENDINGS_CRLF: convert LF to CRLF + * - ESP_LINE_ENDINGS_CR: convert LF to CR + * - ESP_LINE_ENDINGS_LF: no modification + * + * @note this function is not thread safe w.r.t. writing to UART + * + * @param uart_num the UART number + * @param mode line endings to send to UART + * @return 0 if successed, or -1 + * when an error (specified by errno) have occurred. + */ +int esp_vfs_dev_uart_port_set_tx_line_endings(int uart_num, esp_line_endings_t mode); + /** * @brief set VFS to use simple functions for reading and writing UART * Read is non-blocking, write is busy waiting until TX FIFO has enough space. diff --git a/tools/sdk/ld/esp32.project.ld b/tools/sdk/ld/esp32.project.ld index 5ef474db370..c8c9582a19e 100644 --- a/tools/sdk/ld/esp32.project.ld +++ b/tools/sdk/ld/esp32.project.ld @@ -1,6 +1,6 @@ /* Automatically generated file; DO NOT EDIT */ /* Espressif IoT Development Framework Linker Script */ -/* Generated from: /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/ld/esp32.project.ld.in */ +/* Generated from: /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/ld/esp32.project.ld.in */ /* Default entry point: */ ENTRY(call_start_cpu0); @@ -163,158 +163,160 @@ SECTIONS _iram_text_start = ABSOLUTE(.); *( .iram1 .iram1.*) - *libspi_flash.a:spi_flash_rom_patch.*( .literal .literal.* .text .text.*) - *libesp_ringbuf.a:( .literal .literal.* .text .text.*) - *libhal.a:( .literal .literal.* .text .text.*) *libapp_trace.a:( .literal .literal.* .text .text.*) - *libesp32.a:panic.*( .literal .literal.* .text .text.*) - *libespcoredump.a:core_dump_flash.*( .literal .literal.* .text .text.*) - *libespcoredump.a:core_dump_common.*( .literal .literal.* .text .text.*) - *libespcoredump.a:core_dump_uart.*( .literal .literal.* .text .text.*) - *libespcoredump.a:core_dump_port.*( .literal .literal.* .text .text.*) - *librtc.a:( .literal .literal.* .text .text.*) - *libgcc.a:lib2funcs.*( .literal .literal.* .text .text.*) - *libsoc.a:rtc_init.*( .literal .literal.* .text .text.*) - *libsoc.a:rtc_time.*( .literal .literal.* .text .text.*) - *libsoc.a:rtc_wdt.*( .literal .literal.* .text .text.*) - *libsoc.a:rtc_periph.*( .literal .literal.* .text .text.*) - *libsoc.a:rtc_pm.*( .literal .literal.* .text .text.*) - *libsoc.a:rtc_clk_init.*( .literal .literal.* .text .text.*) - *libsoc.a:rtc_sleep.*( .literal .literal.* .text .text.*) - *libsoc.a:cpu_util.*( .literal .literal.* .text .text.*) - *libsoc.a:rtc_clk.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-timelocal.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-memccpy.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strptime.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-wctomb_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strncmp.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-creat.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:creat.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:isatty.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-abs.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-asctime.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-asctime_r.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-atoi.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-atol.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-longjmp.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-raise.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strtok_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-isprint.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-ispunct.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-memchr.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-tolower.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-wbuf.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-time.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strtol.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-system.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-bzero.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-close.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-creat.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-ctime.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-ctime_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-ctype_.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-div.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-environ.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-envlock.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-fclose.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-fflush.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-findfp.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-fputwc.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-fvwrite.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-fwalk.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-getenv_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-gettzinfo.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-gmtime.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-gmtime_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-impure.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-isalnum.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-isalpha.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-isascii.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-islower.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-memrchr.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strcpy.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-isblank.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-iscntrl.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-isdigit.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-findfp.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-isgraph.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-islower.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-isprint.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-ispunct.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-isspace.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-isupper.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-itoa.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-labs.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-lcltime.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-lcltime_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-div.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-ldiv.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-longjmp.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-makebuf.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-memccpy.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-memchr.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-memcmp.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strnlen.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-iscntrl.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-tzcalc_limits.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strftime.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-memcpy.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-memmove.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-memrchr.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-memset.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-mktime.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-month_lengths.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-toupper.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-isalnum.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-isspace.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-sf_nan.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strncpy.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-close.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strlcpy.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-ldiv.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-getenv_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strspn.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-sccl.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-systimes.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-isgraph.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-open.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-quorem.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-raise.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-rand.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strcspn.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strcasecmp.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-environ.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-isupper.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-fwalk.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-impure.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-bzero.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-rand_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-read.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-refill.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-rshift.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-ungetc.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-sysclose.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-mktime.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-syswrite.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lock.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strstr.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strchr.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-makebuf.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strncasecmp.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strdup.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-tzlock.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-abs.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-s_fpclassify.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-sbrk.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-read.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-asctime.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-ctype_.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strcmp.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-sysread.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-envlock.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-sccl.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-setjmp.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strncat.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-tzvars.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-wcrtomb.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-sf_nan.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-srand.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-fflush.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-wsetup.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-ctime.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-stdio.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strupr.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-labs.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strcasecmp.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strcasestr.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strcat.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strchr.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strcmp.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strcoll.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strcpy.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strcspn.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strdup.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strdup_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strftime.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strlcat.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strlcpy.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strlen.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-strlwr.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strncasecmp.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strncat.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strncmp.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strncpy.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-strndup.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-gettzinfo.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-memset.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-memcpy.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-syssbrk.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-isblank.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-gmtime_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-quorem.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-sysopen.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-utoa.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-isalpha.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-ctime_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:isatty.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strndup_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strnlen.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strptime.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-strrchr.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-strsep.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-rand_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-fputwc.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-tzset_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-tzset.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-asctime_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strlcat.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strcasestr.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-gmtime.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-fclose.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-refill.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strdup_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-open.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strndup_r.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-itoa.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-fvwrite.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:creat.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-lcltime.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-memmove.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strlen.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strspn.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strstr.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strtok_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strtol.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-strtoul.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-s_fpclassify.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strcoll.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-strupr.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-sysclose.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-sysopen.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-sysread.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-syssbrk.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-system.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-systimes.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-syswrite.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-time.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-timelocal.*( .literal .literal.* .text .text.*) *libc-psram-workaround.a:lib_a-toascii.*( .literal .literal.* .text .text.*) - *libc-psram-workaround.a:lib_a-strcat.*( .literal .literal.* .text .text.*) - *libpp.a:( .wifirxiram .wifirxiram.*) + *libc-psram-workaround.a:lib_a-tolower.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-toupper.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-tzcalc_limits.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-tzlock.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-tzset.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-tzset_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-tzvars.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-ungetc.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-utoa.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-wbuf.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-wcrtomb.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-wctomb_r.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lib_a-wsetup.*( .literal .literal.* .text .text.*) + *libc-psram-workaround.a:lock.*( .literal .literal.* .text .text.*) + *libesp32.a:panic.*( .literal .literal.* .text .text.*) + *libesp_ringbuf.a:( .literal .literal.* .text .text.*) + *libespcoredump.a:core_dump_common.*( .literal .literal.* .text .text.*) + *libespcoredump.a:core_dump_flash.*( .literal .literal.* .text .text.*) + *libespcoredump.a:core_dump_port.*( .literal .literal.* .text .text.*) + *libespcoredump.a:core_dump_uart.*( .literal .literal.* .text .text.*) *libfreertos.a:( .literal .literal.* .text .text.*) + *libgcc.a:lib2funcs.*( .literal .literal.* .text .text.*) *libgcov.a:( .literal .literal.* .text .text.*) - *libxtensa-debug-module.a:eri.*( .literal .literal.* .text .text.*) - *libheap.a:multi_heap_poisoning.*( .literal .literal.* .text .text.*) + *libhal.a:( .literal .literal.* .text .text.*) *libheap.a:multi_heap.*( .literal .literal.* .text .text.*) + *libheap.a:multi_heap_poisoning.*( .literal .literal.* .text .text.*) + *libnet80211.a:( .wifi0iram .wifi0iram.*) *libnet80211.a:( .wifirxiram .wifirxiram.*) + *libpp.a:( .wifi0iram .wifi0iram.*) + *libpp.a:( .wifirxiram .wifirxiram.*) + *librtc.a:( .literal .literal.* .text .text.*) + *libsoc.a:cpu_util.*( .literal .literal.* .text .text.*) + *libsoc.a:rtc_clk.*( .literal .literal.* .text .text.*) + *libsoc.a:rtc_clk_init.*( .literal .literal.* .text .text.*) + *libsoc.a:rtc_init.*( .literal .literal.* .text .text.*) + *libsoc.a:rtc_periph.*( .literal .literal.* .text .text.*) + *libsoc.a:rtc_pm.*( .literal .literal.* .text .text.*) + *libsoc.a:rtc_sleep.*( .literal .literal.* .text .text.*) + *libsoc.a:rtc_time.*( .literal .literal.* .text .text.*) + *libsoc.a:rtc_wdt.*( .literal .literal.* .text .text.*) + *libspi_flash.a:spi_flash_rom_patch.*( .literal .literal.* .text .text.*) + *libxtensa-debug-module.a:eri.*( .literal .literal.* .text .text.*) _iram_text_end = ABSOLUTE(.); _iram_end = ABSOLUTE(.); @@ -346,137 +348,137 @@ SECTIONS *( .data .data.* .dram1 .dram1.*) *libapp_trace.a:( .rodata .rodata.*) - *libesp32.a:panic.*( .rodata .rodata.*) - *libphy.a:( .rodata .rodata.*) - *libsoc.a:rtc_clk.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-timelocal.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-memccpy.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strptime.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-wctomb_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strncmp.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-creat.*( .rodata .rodata.*) + *libc-psram-workaround.a:creat.*( .rodata .rodata.*) + *libc-psram-workaround.a:isatty.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-abs.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-asctime.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-asctime_r.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-atoi.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-atol.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-longjmp.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-raise.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strtok_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-isprint.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-ispunct.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-memchr.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-tolower.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-wbuf.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-time.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strtol.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-system.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-bzero.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-close.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-creat.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-ctime.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-ctime_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-ctype_.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-div.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-environ.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-envlock.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-fclose.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-fflush.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-findfp.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-fputwc.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-fvwrite.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-fwalk.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-getenv_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-gettzinfo.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-gmtime.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-gmtime_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-impure.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-isalnum.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-isalpha.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-isascii.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-islower.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-memrchr.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strcpy.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-isblank.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-iscntrl.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-isdigit.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-findfp.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-isgraph.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-islower.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-isprint.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-ispunct.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-isspace.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-isupper.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-itoa.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-labs.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-lcltime.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-lcltime_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-div.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-ldiv.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-longjmp.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-makebuf.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-memccpy.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-memchr.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-memcmp.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strnlen.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-iscntrl.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-tzcalc_limits.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strftime.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-memcpy.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-memmove.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-memrchr.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-memset.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-mktime.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-month_lengths.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-toupper.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-isalnum.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-isspace.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-sf_nan.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strncpy.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-close.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strlcpy.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-ldiv.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-getenv_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strspn.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-sccl.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-systimes.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-isgraph.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-open.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-quorem.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-raise.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-rand.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strcspn.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strcasecmp.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-environ.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-isupper.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-fwalk.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-impure.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-bzero.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-rand_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-read.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-refill.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-rshift.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-ungetc.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-sysclose.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-mktime.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-syswrite.*( .rodata .rodata.*) - *libc-psram-workaround.a:lock.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strstr.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strchr.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-makebuf.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strncasecmp.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strdup.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-tzlock.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-abs.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-s_fpclassify.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-sbrk.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-read.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-asctime.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-ctype_.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strcmp.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-sysread.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-envlock.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-sccl.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-setjmp.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strncat.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-tzvars.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-wcrtomb.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-sf_nan.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-srand.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-fflush.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-wsetup.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-ctime.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-stdio.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strupr.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-labs.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strcasecmp.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strcasestr.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strcat.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strchr.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strcmp.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strcoll.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strcpy.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strcspn.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strdup.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strdup_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strftime.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strlcat.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strlcpy.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strlen.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-strlwr.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strncasecmp.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strncat.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strncmp.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strncpy.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-strndup.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-gettzinfo.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-memset.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-memcpy.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-syssbrk.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-isblank.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-gmtime_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-quorem.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-sysopen.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-utoa.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-isalpha.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-ctime_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:isatty.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strndup_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strnlen.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strptime.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-strrchr.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-strsep.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-rand_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-fputwc.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-tzset_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-tzset.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-asctime_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strlcat.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strcasestr.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-gmtime.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-fclose.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-refill.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strdup_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-open.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strndup_r.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-itoa.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-fvwrite.*( .rodata .rodata.*) - *libc-psram-workaround.a:creat.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-lcltime.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-memmove.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strlen.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strspn.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strstr.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strtok_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strtol.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-strtoul.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-s_fpclassify.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strcoll.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-strupr.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-sysclose.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-sysopen.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-sysread.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-syssbrk.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-system.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-systimes.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-syswrite.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-time.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-timelocal.*( .rodata .rodata.*) *libc-psram-workaround.a:lib_a-toascii.*( .rodata .rodata.*) - *libc-psram-workaround.a:lib_a-strcat.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-tolower.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-toupper.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-tzcalc_limits.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-tzlock.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-tzset.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-tzset_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-tzvars.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-ungetc.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-utoa.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-wbuf.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-wcrtomb.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-wctomb_r.*( .rodata .rodata.*) + *libc-psram-workaround.a:lib_a-wsetup.*( .rodata .rodata.*) + *libc-psram-workaround.a:lock.*( .rodata .rodata.*) + *libesp32.a:panic.*( .rodata .rodata.*) *libgcov.a:( .rodata .rodata.*) - *libheap.a:multi_heap_poisoning.*( .rodata .rodata.*) *libheap.a:multi_heap.*( .rodata .rodata.*) + *libheap.a:multi_heap_poisoning.*( .rodata .rodata.*) + *libphy.a:( .rodata .rodata.*) + *libsoc.a:rtc_clk.*( .rodata .rodata.*) _data_end = ABSOLUTE(.); . = ALIGN(4); @@ -541,7 +543,7 @@ SECTIONS *(.rodata_desc .rodata_desc.*) /* Should be the first. App version info. DO NOT PUT ANYTHING BEFORE IT! */ *(.rodata_custom_desc .rodata_custom_desc.*) /* Should be the second. Custom app version info. DO NOT PUT ANYTHING BEFORE IT! */ - *(EXCLUDE_FILE(*libapp_trace.a *libesp32.a:panic.* *libphy.a *libsoc.a:rtc_clk.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-atol.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-timelocal.* *libgcov.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .rodata EXCLUDE_FILE(*libapp_trace.a *libesp32.a:panic.* *libphy.a *libsoc.a:rtc_clk.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-atol.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-timelocal.* *libgcov.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .rodata.*) + *(EXCLUDE_FILE(*libapp_trace.a *libesp32.a:panic.* *libphy.a *libsoc.a:rtc_clk.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-timelocal.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-atol.* *libgcov.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .rodata EXCLUDE_FILE(*libapp_trace.a *libesp32.a:panic.* *libphy.a *libsoc.a:rtc_clk.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-timelocal.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-atol.* *libgcov.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .rodata.*) *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ *(.gnu.linkonce.r.*) @@ -601,7 +603,7 @@ SECTIONS _stext = .; _text_start = ABSOLUTE(.); - *(EXCLUDE_FILE(*libspi_flash.a:spi_flash_rom_patch.* *libesp_ringbuf.a *libhal.a *libapp_trace.a *libesp32.a:panic.* *libespcoredump.a:core_dump_port.* *libespcoredump.a:core_dump_uart.* *libespcoredump.a:core_dump_common.* *libespcoredump.a:core_dump_flash.* *librtc.a *libgcc.a:lib2funcs.* *libsoc.a:rtc_clk.* *libsoc.a:cpu_util.* *libsoc.a:rtc_sleep.* *libsoc.a:rtc_clk_init.* *libsoc.a:rtc_pm.* *libsoc.a:rtc_periph.* *libsoc.a:rtc_wdt.* *libsoc.a:rtc_time.* *libsoc.a:rtc_init.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-atol.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-timelocal.* *libfreertos.a *libgcov.a *libxtensa-debug-module.a:eri.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .literal EXCLUDE_FILE(*libspi_flash.a:spi_flash_rom_patch.* *libesp_ringbuf.a *libhal.a *libapp_trace.a *libesp32.a:panic.* *libespcoredump.a:core_dump_port.* *libespcoredump.a:core_dump_uart.* *libespcoredump.a:core_dump_common.* *libespcoredump.a:core_dump_flash.* *librtc.a *libgcc.a:lib2funcs.* *libsoc.a:rtc_clk.* *libsoc.a:cpu_util.* *libsoc.a:rtc_sleep.* *libsoc.a:rtc_clk_init.* *libsoc.a:rtc_pm.* *libsoc.a:rtc_periph.* *libsoc.a:rtc_wdt.* *libsoc.a:rtc_time.* *libsoc.a:rtc_init.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-atol.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-timelocal.* *libfreertos.a *libgcov.a *libxtensa-debug-module.a:eri.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .literal.* EXCLUDE_FILE(*libspi_flash.a:spi_flash_rom_patch.* *libesp_ringbuf.a *libhal.a *libapp_trace.a *libesp32.a:panic.* *libespcoredump.a:core_dump_port.* *libespcoredump.a:core_dump_uart.* *libespcoredump.a:core_dump_common.* *libespcoredump.a:core_dump_flash.* *librtc.a *libgcc.a:lib2funcs.* *libsoc.a:rtc_clk.* *libsoc.a:cpu_util.* *libsoc.a:rtc_sleep.* *libsoc.a:rtc_clk_init.* *libsoc.a:rtc_pm.* *libsoc.a:rtc_periph.* *libsoc.a:rtc_wdt.* *libsoc.a:rtc_time.* *libsoc.a:rtc_init.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-atol.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-timelocal.* *libfreertos.a *libgcov.a *libxtensa-debug-module.a:eri.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .text EXCLUDE_FILE(*libspi_flash.a:spi_flash_rom_patch.* *libesp_ringbuf.a *libhal.a *libapp_trace.a *libesp32.a:panic.* *libespcoredump.a:core_dump_port.* *libespcoredump.a:core_dump_uart.* *libespcoredump.a:core_dump_common.* *libespcoredump.a:core_dump_flash.* *librtc.a *libgcc.a:lib2funcs.* *libsoc.a:rtc_clk.* *libsoc.a:cpu_util.* *libsoc.a:rtc_sleep.* *libsoc.a:rtc_clk_init.* *libsoc.a:rtc_pm.* *libsoc.a:rtc_periph.* *libsoc.a:rtc_wdt.* *libsoc.a:rtc_time.* *libsoc.a:rtc_init.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-atol.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-timelocal.* *libfreertos.a *libgcov.a *libxtensa-debug-module.a:eri.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .text.* .wifi0iram .wifi0iram.* EXCLUDE_FILE(*libpp.a *libnet80211.a) .wifirxiram EXCLUDE_FILE(*libpp.a *libnet80211.a) .wifirxiram.*) + *(EXCLUDE_FILE(*libspi_flash.a:spi_flash_rom_patch.* *libesp_ringbuf.a *libhal.a *libapp_trace.a *libesp32.a:panic.* *libespcoredump.a:core_dump_port.* *libespcoredump.a:core_dump_common.* *libespcoredump.a:core_dump_flash.* *libespcoredump.a:core_dump_uart.* *librtc.a *libgcc.a:lib2funcs.* *libsoc.a:rtc_clk_init.* *libsoc.a:rtc_sleep.* *libsoc.a:cpu_util.* *libsoc.a:rtc_init.* *libsoc.a:rtc_pm.* *libsoc.a:rtc_clk.* *libsoc.a:rtc_wdt.* *libsoc.a:rtc_time.* *libsoc.a:rtc_periph.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-timelocal.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-atol.* *libfreertos.a *libgcov.a *libxtensa-debug-module.a:eri.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .literal EXCLUDE_FILE(*libspi_flash.a:spi_flash_rom_patch.* *libesp_ringbuf.a *libhal.a *libapp_trace.a *libesp32.a:panic.* *libespcoredump.a:core_dump_port.* *libespcoredump.a:core_dump_common.* *libespcoredump.a:core_dump_flash.* *libespcoredump.a:core_dump_uart.* *librtc.a *libgcc.a:lib2funcs.* *libsoc.a:rtc_clk_init.* *libsoc.a:rtc_sleep.* *libsoc.a:cpu_util.* *libsoc.a:rtc_init.* *libsoc.a:rtc_pm.* *libsoc.a:rtc_clk.* *libsoc.a:rtc_wdt.* *libsoc.a:rtc_time.* *libsoc.a:rtc_periph.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-timelocal.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-atol.* *libfreertos.a *libgcov.a *libxtensa-debug-module.a:eri.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .literal.* EXCLUDE_FILE(*libspi_flash.a:spi_flash_rom_patch.* *libesp_ringbuf.a *libhal.a *libapp_trace.a *libesp32.a:panic.* *libespcoredump.a:core_dump_port.* *libespcoredump.a:core_dump_common.* *libespcoredump.a:core_dump_flash.* *libespcoredump.a:core_dump_uart.* *librtc.a *libgcc.a:lib2funcs.* *libsoc.a:rtc_clk_init.* *libsoc.a:rtc_sleep.* *libsoc.a:cpu_util.* *libsoc.a:rtc_init.* *libsoc.a:rtc_pm.* *libsoc.a:rtc_clk.* *libsoc.a:rtc_wdt.* *libsoc.a:rtc_time.* *libsoc.a:rtc_periph.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-timelocal.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-atol.* *libfreertos.a *libgcov.a *libxtensa-debug-module.a:eri.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .text EXCLUDE_FILE(*libspi_flash.a:spi_flash_rom_patch.* *libesp_ringbuf.a *libhal.a *libapp_trace.a *libesp32.a:panic.* *libespcoredump.a:core_dump_port.* *libespcoredump.a:core_dump_common.* *libespcoredump.a:core_dump_flash.* *libespcoredump.a:core_dump_uart.* *librtc.a *libgcc.a:lib2funcs.* *libsoc.a:rtc_clk_init.* *libsoc.a:rtc_sleep.* *libsoc.a:cpu_util.* *libsoc.a:rtc_init.* *libsoc.a:rtc_pm.* *libsoc.a:rtc_clk.* *libsoc.a:rtc_wdt.* *libsoc.a:rtc_time.* *libsoc.a:rtc_periph.* *libc-psram-workaround.a:lib_a-tzvars.* *libc-psram-workaround.a:lib_a-isblank.* *libc-psram-workaround.a:lib_a-sysopen.* *libc-psram-workaround.a:lib_a-time.* *libc-psram-workaround.a:lib_a-rand_r.* *libc-psram-workaround.a:lib_a-tzset.* *libc-psram-workaround.a:lib_a-raise.* *libc-psram-workaround.a:lib_a-sysread.* *libc-psram-workaround.a:lib_a-systimes.* *libc-psram-workaround.a:lib_a-strlwr.* *libc-psram-workaround.a:lib_a-gmtime.* *libc-psram-workaround.a:lib_a-sf_nan.* *libc-psram-workaround.a:lib_a-strcasecmp.* *libc-psram-workaround.a:lib_a-strftime.* *libc-psram-workaround.a:lib_a-wbuf.* *libc-psram-workaround.a:lib_a-strnlen.* *libc-psram-workaround.a:lib_a-close.* *libc-psram-workaround.a:lib_a-strupr.* *libc-psram-workaround.a:lib_a-bzero.* *libc-psram-workaround.a:lib_a-gmtime_r.* *libc-psram-workaround.a:lib_a-memchr.* *libc-psram-workaround.a:lib_a-isdigit.* *libc-psram-workaround.a:lib_a-isupper.* *libc-psram-workaround.a:lock.* *libc-psram-workaround.a:lib_a-itoa.* *libc-psram-workaround.a:lib_a-asctime_r.* *libc-psram-workaround.a:lib_a-wctomb_r.* *libc-psram-workaround.a:lib_a-fclose.* *libc-psram-workaround.a:lib_a-strncpy.* *libc-psram-workaround.a:lib_a-open.* *libc-psram-workaround.a:lib_a-lcltime_r.* *libc-psram-workaround.a:lib_a-syswrite.* *libc-psram-workaround.a:creat.* *libc-psram-workaround.a:lib_a-tolower.* *libc-psram-workaround.a:lib_a-strlcpy.* *libc-psram-workaround.a:lib_a-abs.* *libc-psram-workaround.a:lib_a-system.* *libc-psram-workaround.a:lib_a-strcspn.* *libc-psram-workaround.a:isatty.* *libc-psram-workaround.a:lib_a-gettzinfo.* *libc-psram-workaround.a:lib_a-s_fpclassify.* *libc-psram-workaround.a:lib_a-tzset_r.* *libc-psram-workaround.a:lib_a-strncmp.* *libc-psram-workaround.a:lib_a-strcat.* *libc-psram-workaround.a:lib_a-strndup_r.* *libc-psram-workaround.a:lib_a-strcmp.* *libc-psram-workaround.a:lib_a-memccpy.* *libc-psram-workaround.a:lib_a-fwalk.* *libc-psram-workaround.a:lib_a-tzlock.* *libc-psram-workaround.a:lib_a-strncasecmp.* *libc-psram-workaround.a:lib_a-refill.* *libc-psram-workaround.a:lib_a-longjmp.* *libc-psram-workaround.a:lib_a-memrchr.* *libc-psram-workaround.a:lib_a-toascii.* *libc-psram-workaround.a:lib_a-ctime.* *libc-psram-workaround.a:lib_a-strspn.* *libc-psram-workaround.a:lib_a-ungetc.* *libc-psram-workaround.a:lib_a-strndup.* *libc-psram-workaround.a:lib_a-strtoul.* *libc-psram-workaround.a:lib_a-strtol.* *libc-psram-workaround.a:lib_a-memcpy.* *libc-psram-workaround.a:lib_a-isprint.* *libc-psram-workaround.a:lib_a-sbrk.* *libc-psram-workaround.a:lib_a-strchr.* *libc-psram-workaround.a:lib_a-strdup.* *libc-psram-workaround.a:lib_a-isspace.* *libc-psram-workaround.a:lib_a-isalpha.* *libc-psram-workaround.a:lib_a-isascii.* *libc-psram-workaround.a:lib_a-rand.* *libc-psram-workaround.a:lib_a-strncat.* *libc-psram-workaround.a:lib_a-creat.* *libc-psram-workaround.a:lib_a-read.* *libc-psram-workaround.a:lib_a-memcmp.* *libc-psram-workaround.a:lib_a-fflush.* *libc-psram-workaround.a:lib_a-fputwc.* *libc-psram-workaround.a:lib_a-toupper.* *libc-psram-workaround.a:lib_a-quorem.* *libc-psram-workaround.a:lib_a-div.* *libc-psram-workaround.a:lib_a-tzcalc_limits.* *libc-psram-workaround.a:lib_a-labs.* *libc-psram-workaround.a:lib_a-strtok_r.* *libc-psram-workaround.a:lib_a-strcpy.* *libc-psram-workaround.a:lib_a-iscntrl.* *libc-psram-workaround.a:lib_a-mktime.* *libc-psram-workaround.a:lib_a-strdup_r.* *libc-psram-workaround.a:lib_a-strstr.* *libc-psram-workaround.a:lib_a-strsep.* *libc-psram-workaround.a:lib_a-stdio.* *libc-psram-workaround.a:lib_a-isgraph.* *libc-psram-workaround.a:lib_a-wsetup.* *libc-psram-workaround.a:lib_a-timelocal.* *libc-psram-workaround.a:lib_a-strlcat.* *libc-psram-workaround.a:lib_a-islower.* *libc-psram-workaround.a:lib_a-ldiv.* *libc-psram-workaround.a:lib_a-lcltime.* *libc-psram-workaround.a:lib_a-environ.* *libc-psram-workaround.a:lib_a-sccl.* *libc-psram-workaround.a:lib_a-getenv_r.* *libc-psram-workaround.a:lib_a-sysclose.* *libc-psram-workaround.a:lib_a-strcasestr.* *libc-psram-workaround.a:lib_a-ctime_r.* *libc-psram-workaround.a:lib_a-syssbrk.* *libc-psram-workaround.a:lib_a-setjmp.* *libc-psram-workaround.a:lib_a-isalnum.* *libc-psram-workaround.a:lib_a-strcoll.* *libc-psram-workaround.a:lib_a-memmove.* *libc-psram-workaround.a:lib_a-rshift.* *libc-psram-workaround.a:lib_a-envlock.* *libc-psram-workaround.a:lib_a-strlen.* *libc-psram-workaround.a:lib_a-wcrtomb.* *libc-psram-workaround.a:lib_a-strptime.* *libc-psram-workaround.a:lib_a-findfp.* *libc-psram-workaround.a:lib_a-impure.* *libc-psram-workaround.a:lib_a-fvwrite.* *libc-psram-workaround.a:lib_a-ispunct.* *libc-psram-workaround.a:lib_a-utoa.* *libc-psram-workaround.a:lib_a-srand.* *libc-psram-workaround.a:lib_a-month_lengths.* *libc-psram-workaround.a:lib_a-asctime.* *libc-psram-workaround.a:lib_a-strrchr.* *libc-psram-workaround.a:lib_a-makebuf.* *libc-psram-workaround.a:lib_a-atoi.* *libc-psram-workaround.a:lib_a-ctype_.* *libc-psram-workaround.a:lib_a-memset.* *libc-psram-workaround.a:lib_a-atol.* *libfreertos.a *libgcov.a *libxtensa-debug-module.a:eri.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.*) .text.* EXCLUDE_FILE(*libpp.a *libnet80211.a) .wifi0iram EXCLUDE_FILE(*libpp.a *libnet80211.a) .wifi0iram.* EXCLUDE_FILE(*libpp.a *libnet80211.a) .wifirxiram EXCLUDE_FILE(*libpp.a *libnet80211.a) .wifirxiram.*) *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */ diff --git a/tools/sdk/ld/esp32.rom.ld b/tools/sdk/ld/esp32.rom.ld index c1e3e94bcb2..eefa8c5b431 100644 --- a/tools/sdk/ld/esp32.rom.ld +++ b/tools/sdk/ld/esp32.rom.ld @@ -122,6 +122,8 @@ PROVIDE ( hci_fc_env = 0x3ffb9340 ); PROVIDE ( jd_decomp = 0x400613e8 ); PROVIDE ( jd_prepare = 0x40060fa8 ); PROVIDE ( ke_env = 0x3ffb93cc ); +PROVIDE ( ke_handler_search = 0x4001a430 ); +PROVIDE ( ke_task_env = 0x3ffb81d4 ); PROVIDE ( lb_default_handler = 0x3ff982b8 ); PROVIDE ( lb_default_state_tab_p_get = 0x4001c198 ); PROVIDE ( lb_env = 0x3ffb9424 ); @@ -665,6 +667,7 @@ PROVIDE ( lmp_dhkey_chk_handler = 0x4002ab48 ); PROVIDE ( lmp_pause_enc_aes_req_handler = 0x400279a4 ); PROVIDE ( lmp_io_cap_res_handler = 0x4002c670 ); PROVIDE ( lmp_io_cap_req_handler = 0x4002c7a4 ); +PROVIDE ( lc_cmd_cmp_bd_addr_send = 0x4002cec4 ); PROVIDE ( ld_acl_tx_packet_type_select = 0x4002fb40 ); PROVIDE ( ld_acl_sched = 0x40033268 ); PROVIDE ( ld_acl_sniff_sched = 0x4003340c ); @@ -674,6 +677,7 @@ PROVIDE ( ld_acl_rx_sync = 0x4002fbec ); PROVIDE ( ld_acl_rx_sync2 = 0x4002fd8c ); PROVIDE ( ld_acl_rx_no_sync = 0x4002fe78 ); PROVIDE ( ld_acl_clk_isr = 0x40030cf8 ); +PROVIDE ( ld_acl_rsw_frm_cbk = 0x40033bb0 ); PROVIDE ( ld_sco_modify = 0x40031778 ); PROVIDE ( lm_cmd_cmp_send = 0x40051838 ); PROVIDE ( ld_sco_frm_cbk = 0x400349dc ); @@ -681,6 +685,7 @@ PROVIDE ( ld_acl_sniff_frm_cbk = 0x4003482c ); PROVIDE ( ld_inq_end = 0x4003ab48 ); PROVIDE ( ld_inq_sched = 0x4003aba4 ); PROVIDE ( ld_inq_frm_cbk = 0x4003ae4c ); +PROVIDE ( ld_pscan_frm_cbk = 0x4003ebe4 ); PROVIDE ( r_ld_acl_active_hop_types_get = 0x40036e10 ); PROVIDE ( r_ld_acl_afh_confirm = 0x40036d40 ); PROVIDE ( r_ld_acl_afh_prepare = 0x40036c84 ); @@ -725,6 +730,11 @@ PROVIDE ( r_ld_acl_timing_accuracy_set = 0x4003673c ); PROVIDE ( r_ld_acl_t_poll_get = 0x40036024 ); PROVIDE ( r_ld_acl_t_poll_set = 0x40036068 ); PROVIDE ( r_ld_acl_tx_enc = 0x400362f8 ); +PROVIDE ( ld_acl_frm_cbk = 0x40034414 ); +PROVIDE ( ld_acl_rsw_end = 0x40032bc0 ); +PROVIDE ( ld_acl_end = 0x40033140 ); +PROVIDE ( ld_acl_resched = 0x40033814 ); +PROVIDE ( ld_acl_test_mode_update = 0x40032050 ); PROVIDE ( r_ld_acl_unsniff = 0x400361e0 ); PROVIDE ( r_ld_active_check = 0x4003cac4 ); PROVIDE ( r_ld_afh_ch_assess_data_get = 0x4003caec ); @@ -1382,6 +1392,12 @@ PROVIDE ( esp_rom_spiflash_attach = 0x40062a6c ); PROVIDE ( esp_rom_spiflash_config_clk = 0x40062bc8 ); PROVIDE ( g_rom_spiflash_chip = 0x3ffae270 ); +PROVIDE ( hci_le_rd_rem_used_feats_cmd_handler = 0x400417b4 ); +PROVIDE ( llcp_length_req_handler = 0x40043808 ); +PROVIDE ( llcp_unknown_rsp_handler = 0x40043ba8 ); +PROVIDE ( llcp_channel_map_req_handler = 0x4004291c ); +PROVIDE ( llcp_con_up_req_handler = 0x400426f0 ); + /* These functions are xtos-related (or call xtos-related functions) and do not play well with multicore FreeRTOS. Where needed, we provide alternatives that are multicore diff --git a/tools/sdk/lib/libapp_trace.a b/tools/sdk/lib/libapp_trace.a index cb6c8f122be..204c1b90df0 100644 Binary files a/tools/sdk/lib/libapp_trace.a and b/tools/sdk/lib/libapp_trace.a differ diff --git a/tools/sdk/lib/libapp_update.a b/tools/sdk/lib/libapp_update.a index c54d56140d0..f103f7f2ef4 100644 Binary files a/tools/sdk/lib/libapp_update.a and b/tools/sdk/lib/libapp_update.a differ diff --git a/tools/sdk/lib/libasio.a b/tools/sdk/lib/libasio.a index 60f48f77e0c..f355954c849 100644 Binary files a/tools/sdk/lib/libasio.a and b/tools/sdk/lib/libasio.a differ diff --git a/tools/sdk/lib/libbootloader_support.a b/tools/sdk/lib/libbootloader_support.a index 11c9b8b4009..f2fa27fb3dc 100644 Binary files a/tools/sdk/lib/libbootloader_support.a and b/tools/sdk/lib/libbootloader_support.a differ diff --git a/tools/sdk/lib/libbt.a b/tools/sdk/lib/libbt.a index f32466e021c..631b9ed5479 100644 Binary files a/tools/sdk/lib/libbt.a and b/tools/sdk/lib/libbt.a differ diff --git a/tools/sdk/lib/libbtdm_app.a b/tools/sdk/lib/libbtdm_app.a index b1682920ef2..ef47f3bd1a9 100644 Binary files a/tools/sdk/lib/libbtdm_app.a and b/tools/sdk/lib/libbtdm_app.a differ diff --git a/tools/sdk/lib/libcoap.a b/tools/sdk/lib/libcoap.a index 807c1fe106d..30c004a9efd 100644 Binary files a/tools/sdk/lib/libcoap.a and b/tools/sdk/lib/libcoap.a differ diff --git a/tools/sdk/lib/libcoexist.a b/tools/sdk/lib/libcoexist.a index 20fa6a4ac5a..cc77918e576 100644 Binary files a/tools/sdk/lib/libcoexist.a and b/tools/sdk/lib/libcoexist.a differ diff --git a/tools/sdk/lib/libconsole.a b/tools/sdk/lib/libconsole.a index b87eec3370f..753e84db902 100644 Binary files a/tools/sdk/lib/libconsole.a and b/tools/sdk/lib/libconsole.a differ diff --git a/tools/sdk/lib/libcore.a b/tools/sdk/lib/libcore.a index 63192f4f31f..37396862014 100644 Binary files a/tools/sdk/lib/libcore.a and b/tools/sdk/lib/libcore.a differ diff --git a/tools/sdk/lib/libcxx.a b/tools/sdk/lib/libcxx.a index 47f076310f8..b0ab734e6b7 100644 Binary files a/tools/sdk/lib/libcxx.a and b/tools/sdk/lib/libcxx.a differ diff --git a/tools/sdk/lib/libdetection.a b/tools/sdk/lib/libdetection.a new file mode 100644 index 00000000000..8d5081bdfd9 Binary files /dev/null and b/tools/sdk/lib/libdetection.a differ diff --git a/tools/sdk/lib/libdetection_cat_face.a b/tools/sdk/lib/libdetection_cat_face.a new file mode 100644 index 00000000000..e1d42e756b8 Binary files /dev/null and b/tools/sdk/lib/libdetection_cat_face.a differ diff --git a/tools/sdk/lib/libdl.a b/tools/sdk/lib/libdl.a new file mode 100644 index 00000000000..0160b0edc3c Binary files /dev/null and b/tools/sdk/lib/libdl.a differ diff --git a/tools/sdk/lib/libdl_lib.a b/tools/sdk/lib/libdl_lib.a deleted file mode 100644 index 0611bcd389d..00000000000 Binary files a/tools/sdk/lib/libdl_lib.a and /dev/null differ diff --git a/tools/sdk/lib/libdriver.a b/tools/sdk/lib/libdriver.a index 0567b3c8264..a22ed2542ab 100644 Binary files a/tools/sdk/lib/libdriver.a and b/tools/sdk/lib/libdriver.a differ diff --git a/tools/sdk/lib/libefuse.a b/tools/sdk/lib/libefuse.a index b335e17c5dd..4b89e27c539 100644 Binary files a/tools/sdk/lib/libefuse.a and b/tools/sdk/lib/libefuse.a differ diff --git a/tools/sdk/lib/libesp-tls.a b/tools/sdk/lib/libesp-tls.a index 88dce004bef..a502ee7fab1 100644 Binary files a/tools/sdk/lib/libesp-tls.a and b/tools/sdk/lib/libesp-tls.a differ diff --git a/tools/sdk/lib/libesp32-camera.a b/tools/sdk/lib/libesp32-camera.a index 71806d2fb7d..ddb64cf50a2 100644 Binary files a/tools/sdk/lib/libesp32-camera.a and b/tools/sdk/lib/libesp32-camera.a differ diff --git a/tools/sdk/lib/libesp32.a b/tools/sdk/lib/libesp32.a index 9729523b1b5..09feb7949d5 100644 Binary files a/tools/sdk/lib/libesp32.a and b/tools/sdk/lib/libesp32.a differ diff --git a/tools/sdk/lib/libesp_adc_cal.a b/tools/sdk/lib/libesp_adc_cal.a index bd9fcad8eac..3c3946b3590 100644 Binary files a/tools/sdk/lib/libesp_adc_cal.a and b/tools/sdk/lib/libesp_adc_cal.a differ diff --git a/tools/sdk/lib/libesp_event.a b/tools/sdk/lib/libesp_event.a index 1b719177020..3dd6f86695a 100644 Binary files a/tools/sdk/lib/libesp_event.a and b/tools/sdk/lib/libesp_event.a differ diff --git a/tools/sdk/lib/libesp_http_client.a b/tools/sdk/lib/libesp_http_client.a index b145270dd6b..c163affc337 100644 Binary files a/tools/sdk/lib/libesp_http_client.a and b/tools/sdk/lib/libesp_http_client.a differ diff --git a/tools/sdk/lib/libesp_http_server.a b/tools/sdk/lib/libesp_http_server.a index 96154d150bf..10c4fe0a081 100644 Binary files a/tools/sdk/lib/libesp_http_server.a and b/tools/sdk/lib/libesp_http_server.a differ diff --git a/tools/sdk/lib/libesp_https_ota.a b/tools/sdk/lib/libesp_https_ota.a index 7a203bfc681..5522b5e9a9d 100644 Binary files a/tools/sdk/lib/libesp_https_ota.a and b/tools/sdk/lib/libesp_https_ota.a differ diff --git a/tools/sdk/lib/libesp_https_server.a b/tools/sdk/lib/libesp_https_server.a index c6c503cf328..83513194314 100644 Binary files a/tools/sdk/lib/libesp_https_server.a and b/tools/sdk/lib/libesp_https_server.a differ diff --git a/tools/sdk/lib/libesp_ringbuf.a b/tools/sdk/lib/libesp_ringbuf.a index 545d9adcd67..5d16fdae79d 100644 Binary files a/tools/sdk/lib/libesp_ringbuf.a and b/tools/sdk/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/lib/libesp_websocket_client.a b/tools/sdk/lib/libesp_websocket_client.a new file mode 100644 index 00000000000..76eb42d9d6c Binary files /dev/null and b/tools/sdk/lib/libesp_websocket_client.a differ diff --git a/tools/sdk/lib/libespcoredump.a b/tools/sdk/lib/libespcoredump.a index 84390c46a58..21673707c8e 100644 Binary files a/tools/sdk/lib/libespcoredump.a and b/tools/sdk/lib/libespcoredump.a differ diff --git a/tools/sdk/lib/libespnow.a b/tools/sdk/lib/libespnow.a index dcec9c1eb04..0a501f6825e 100644 Binary files a/tools/sdk/lib/libespnow.a and b/tools/sdk/lib/libespnow.a differ diff --git a/tools/sdk/lib/libethernet.a b/tools/sdk/lib/libethernet.a index f8092f96b2d..955bc47ce06 100644 Binary files a/tools/sdk/lib/libethernet.a and b/tools/sdk/lib/libethernet.a differ diff --git a/tools/sdk/lib/libexpat.a b/tools/sdk/lib/libexpat.a index 9c7f2ee6a75..5b84a14e4dd 100644 Binary files a/tools/sdk/lib/libexpat.a and b/tools/sdk/lib/libexpat.a differ diff --git a/tools/sdk/lib/libface_detection.a b/tools/sdk/lib/libface_detection.a index 7a53ecda8a4..8b9fbb5550c 100644 Binary files a/tools/sdk/lib/libface_detection.a and b/tools/sdk/lib/libface_detection.a differ diff --git a/tools/sdk/lib/libface_recognition.a b/tools/sdk/lib/libface_recognition.a index c48f7263855..48b4726ba31 100644 Binary files a/tools/sdk/lib/libface_recognition.a and b/tools/sdk/lib/libface_recognition.a differ diff --git a/tools/sdk/lib/libfatfs.a b/tools/sdk/lib/libfatfs.a index b493b1f7aca..e56a7dc5494 100644 Binary files a/tools/sdk/lib/libfatfs.a and b/tools/sdk/lib/libfatfs.a differ diff --git a/tools/sdk/lib/libfb_gfx.a b/tools/sdk/lib/libfb_gfx.a index 41929715ba8..506049f37c6 100644 Binary files a/tools/sdk/lib/libfb_gfx.a and b/tools/sdk/lib/libfb_gfx.a differ diff --git a/tools/sdk/lib/libfd.a b/tools/sdk/lib/libfd.a index 9bc636b178b..9f58faef4a2 100644 Binary files a/tools/sdk/lib/libfd.a and b/tools/sdk/lib/libfd.a differ diff --git a/tools/sdk/lib/libfr.a b/tools/sdk/lib/libfr.a index eae7315e2bc..c824bcd9a3e 100644 Binary files a/tools/sdk/lib/libfr.a and b/tools/sdk/lib/libfr.a differ diff --git a/tools/sdk/lib/libfreemodbus.a b/tools/sdk/lib/libfreemodbus.a index c78b72f1600..62544c2a3d5 100644 Binary files a/tools/sdk/lib/libfreemodbus.a and b/tools/sdk/lib/libfreemodbus.a differ diff --git a/tools/sdk/lib/libfreertos.a b/tools/sdk/lib/libfreertos.a index a6f386488c9..b0f2c4a1e42 100644 Binary files a/tools/sdk/lib/libfreertos.a and b/tools/sdk/lib/libfreertos.a differ diff --git a/tools/sdk/lib/libheap.a b/tools/sdk/lib/libheap.a index 9a73697bfb3..75580f6dfb9 100644 Binary files a/tools/sdk/lib/libheap.a and b/tools/sdk/lib/libheap.a differ diff --git a/tools/sdk/lib/libimage_util.a b/tools/sdk/lib/libimage_util.a index 70a2d79272f..a1f60204fbe 100644 Binary files a/tools/sdk/lib/libimage_util.a and b/tools/sdk/lib/libimage_util.a differ diff --git a/tools/sdk/lib/libjsmn.a b/tools/sdk/lib/libjsmn.a index c281ad015c4..ad5d01187b1 100644 Binary files a/tools/sdk/lib/libjsmn.a and b/tools/sdk/lib/libjsmn.a differ diff --git a/tools/sdk/lib/libjson.a b/tools/sdk/lib/libjson.a index eda5d5a7edc..00fd21245a6 100644 Binary files a/tools/sdk/lib/libjson.a and b/tools/sdk/lib/libjson.a differ diff --git a/tools/sdk/lib/liblibsodium.a b/tools/sdk/lib/liblibsodium.a index da5197f7b0c..817f2d26caf 100644 Binary files a/tools/sdk/lib/liblibsodium.a and b/tools/sdk/lib/liblibsodium.a differ diff --git a/tools/sdk/lib/liblog.a b/tools/sdk/lib/liblog.a index 54e970c35a1..7237c90c8bd 100644 Binary files a/tools/sdk/lib/liblog.a and b/tools/sdk/lib/liblog.a differ diff --git a/tools/sdk/lib/liblwip.a b/tools/sdk/lib/liblwip.a index 1efec7c3e51..822ab5d3c3a 100644 Binary files a/tools/sdk/lib/liblwip.a and b/tools/sdk/lib/liblwip.a differ diff --git a/tools/sdk/lib/libmbedtls.a b/tools/sdk/lib/libmbedtls.a index a777e20ea0f..c339e23b69f 100644 Binary files a/tools/sdk/lib/libmbedtls.a and b/tools/sdk/lib/libmbedtls.a differ diff --git a/tools/sdk/lib/libmdns.a b/tools/sdk/lib/libmdns.a index b9aaf9668d5..9bf814d44c9 100644 Binary files a/tools/sdk/lib/libmdns.a and b/tools/sdk/lib/libmdns.a differ diff --git a/tools/sdk/lib/libmesh.a b/tools/sdk/lib/libmesh.a index 7ee1f7805a7..e87dffc40a4 100644 Binary files a/tools/sdk/lib/libmesh.a and b/tools/sdk/lib/libmesh.a differ diff --git a/tools/sdk/lib/libmicro-ecc.a b/tools/sdk/lib/libmicro-ecc.a index 4180452b580..2ece750f0ec 100644 Binary files a/tools/sdk/lib/libmicro-ecc.a and b/tools/sdk/lib/libmicro-ecc.a differ diff --git a/tools/sdk/lib/libmqtt.a b/tools/sdk/lib/libmqtt.a index 859e9939cba..a15c966a3e2 100644 Binary files a/tools/sdk/lib/libmqtt.a and b/tools/sdk/lib/libmqtt.a differ diff --git a/tools/sdk/lib/libnet80211.a b/tools/sdk/lib/libnet80211.a index 5a646065905..bbff542a350 100644 Binary files a/tools/sdk/lib/libnet80211.a and b/tools/sdk/lib/libnet80211.a differ diff --git a/tools/sdk/lib/libnewlib.a b/tools/sdk/lib/libnewlib.a index ab2cb8711c7..5507ff72b67 100644 Binary files a/tools/sdk/lib/libnewlib.a and b/tools/sdk/lib/libnewlib.a differ diff --git a/tools/sdk/lib/libnghttp.a b/tools/sdk/lib/libnghttp.a index 9d2af973f96..f585ee88522 100644 Binary files a/tools/sdk/lib/libnghttp.a and b/tools/sdk/lib/libnghttp.a differ diff --git a/tools/sdk/lib/libnvs_flash.a b/tools/sdk/lib/libnvs_flash.a index 6903a404a6c..996bb234719 100644 Binary files a/tools/sdk/lib/libnvs_flash.a and b/tools/sdk/lib/libnvs_flash.a differ diff --git a/tools/sdk/lib/libod.a b/tools/sdk/lib/libod.a index 922c76d5737..3796f0b2797 100644 Binary files a/tools/sdk/lib/libod.a and b/tools/sdk/lib/libod.a differ diff --git a/tools/sdk/lib/libopenssl.a b/tools/sdk/lib/libopenssl.a index 76cdbc1d0b7..0f1acc7edbc 100644 Binary files a/tools/sdk/lib/libopenssl.a and b/tools/sdk/lib/libopenssl.a differ diff --git a/tools/sdk/lib/libpe.a b/tools/sdk/lib/libpe.a new file mode 100644 index 00000000000..b859f2429eb Binary files /dev/null and b/tools/sdk/lib/libpe.a differ diff --git a/tools/sdk/lib/libpp.a b/tools/sdk/lib/libpp.a index 085d0cbe46a..2b33de2cfbb 100644 Binary files a/tools/sdk/lib/libpp.a and b/tools/sdk/lib/libpp.a differ diff --git a/tools/sdk/lib/libprotobuf-c.a b/tools/sdk/lib/libprotobuf-c.a index cc51b1b6e1d..5865321478b 100644 Binary files a/tools/sdk/lib/libprotobuf-c.a and b/tools/sdk/lib/libprotobuf-c.a differ diff --git a/tools/sdk/lib/libprotocomm.a b/tools/sdk/lib/libprotocomm.a index 99624be917f..65f6c908511 100644 Binary files a/tools/sdk/lib/libprotocomm.a and b/tools/sdk/lib/libprotocomm.a differ diff --git a/tools/sdk/lib/libpthread.a b/tools/sdk/lib/libpthread.a index 5db890022b2..6cd4a7756ec 100644 Binary files a/tools/sdk/lib/libpthread.a and b/tools/sdk/lib/libpthread.a differ diff --git a/tools/sdk/lib/libsdmmc.a b/tools/sdk/lib/libsdmmc.a index f8b8f750bc2..0c8b431facb 100644 Binary files a/tools/sdk/lib/libsdmmc.a and b/tools/sdk/lib/libsdmmc.a differ diff --git a/tools/sdk/lib/libsmartconfig.a b/tools/sdk/lib/libsmartconfig.a index 863856a4bac..3d8e6fac401 100644 Binary files a/tools/sdk/lib/libsmartconfig.a and b/tools/sdk/lib/libsmartconfig.a differ diff --git a/tools/sdk/lib/libsmartconfig_ack.a b/tools/sdk/lib/libsmartconfig_ack.a index cfe749a6b8d..89b515dbde7 100644 Binary files a/tools/sdk/lib/libsmartconfig_ack.a and b/tools/sdk/lib/libsmartconfig_ack.a differ diff --git a/tools/sdk/lib/libsoc.a b/tools/sdk/lib/libsoc.a index 46980250bf0..f3071c759e0 100644 Binary files a/tools/sdk/lib/libsoc.a and b/tools/sdk/lib/libsoc.a differ diff --git a/tools/sdk/lib/libspi_flash.a b/tools/sdk/lib/libspi_flash.a index f34b2317970..bd7fa2070ee 100644 Binary files a/tools/sdk/lib/libspi_flash.a and b/tools/sdk/lib/libspi_flash.a differ diff --git a/tools/sdk/lib/libspiffs.a b/tools/sdk/lib/libspiffs.a index f5b419de3e4..397897bd44f 100644 Binary files a/tools/sdk/lib/libspiffs.a and b/tools/sdk/lib/libspiffs.a differ diff --git a/tools/sdk/lib/libtcp_transport.a b/tools/sdk/lib/libtcp_transport.a index 60bc1633c47..9fc66b53a6b 100644 Binary files a/tools/sdk/lib/libtcp_transport.a and b/tools/sdk/lib/libtcp_transport.a differ diff --git a/tools/sdk/lib/libtcpip_adapter.a b/tools/sdk/lib/libtcpip_adapter.a index e418944f663..4f52a7547ef 100644 Binary files a/tools/sdk/lib/libtcpip_adapter.a and b/tools/sdk/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/lib/libulp.a b/tools/sdk/lib/libulp.a index 70e47ef2177..88d130fbb40 100644 Binary files a/tools/sdk/lib/libulp.a and b/tools/sdk/lib/libulp.a differ diff --git a/tools/sdk/lib/libunity.a b/tools/sdk/lib/libunity.a index 9f2fdc2ed29..26c30c36268 100644 Binary files a/tools/sdk/lib/libunity.a and b/tools/sdk/lib/libunity.a differ diff --git a/tools/sdk/lib/libvfs.a b/tools/sdk/lib/libvfs.a index 9451c9e4e61..5128a431f44 100644 Binary files a/tools/sdk/lib/libvfs.a and b/tools/sdk/lib/libvfs.a differ diff --git a/tools/sdk/lib/libwear_levelling.a b/tools/sdk/lib/libwear_levelling.a index 3de75655f3d..7aad271fd77 100644 Binary files a/tools/sdk/lib/libwear_levelling.a and b/tools/sdk/lib/libwear_levelling.a differ diff --git a/tools/sdk/lib/libwifi_provisioning.a b/tools/sdk/lib/libwifi_provisioning.a index 6e883a34628..60251139756 100644 Binary files a/tools/sdk/lib/libwifi_provisioning.a and b/tools/sdk/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/lib/libwpa.a b/tools/sdk/lib/libwpa.a index ee600649c95..4d6047b487d 100644 Binary files a/tools/sdk/lib/libwpa.a and b/tools/sdk/lib/libwpa.a differ diff --git a/tools/sdk/lib/libwpa2.a b/tools/sdk/lib/libwpa2.a index 555f585d804..79e32afa690 100644 Binary files a/tools/sdk/lib/libwpa2.a and b/tools/sdk/lib/libwpa2.a differ diff --git a/tools/sdk/lib/libwpa_supplicant.a b/tools/sdk/lib/libwpa_supplicant.a index 18af6fac16f..4f4342f60cc 100644 Binary files a/tools/sdk/lib/libwpa_supplicant.a and b/tools/sdk/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/lib/libwps.a b/tools/sdk/lib/libwps.a index 057c3ca7655..bc8bedd1f5d 100644 Binary files a/tools/sdk/lib/libwps.a and b/tools/sdk/lib/libwps.a differ diff --git a/tools/sdk/lib/libxtensa-debug-module.a b/tools/sdk/lib/libxtensa-debug-module.a index fd683676261..bafa0c3431b 100644 Binary files a/tools/sdk/lib/libxtensa-debug-module.a and b/tools/sdk/lib/libxtensa-debug-module.a differ diff --git a/tools/sdk/sdkconfig b/tools/sdk/sdkconfig index 4cdb6a8c2ec..58a34958df1 100644 --- a/tools/sdk/sdkconfig +++ b/tools/sdk/sdkconfig @@ -18,6 +18,7 @@ CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=y CONFIG_APP_COMPILE_TIME_DATE=y CONFIG_APP_EXCLUDE_PROJECT_VER_VAR= CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR= +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 # # Arduino Configuration @@ -35,6 +36,7 @@ CONFIG_ARDUINO_EVENT_RUNNING_CORE=1 CONFIG_ARDUINO_UDP_RUN_CORE0= CONFIG_ARDUINO_UDP_RUN_CORE1=y CONFIG_ARDUINO_UDP_RUN_NO_AFFINITY= +CONFIG_ARDUINO_UDP_TASK_PRIORITY=3 CONFIG_ARDUINO_UDP_RUNNING_CORE=1 CONFIG_DISABLE_HAL_LOCKS= @@ -187,6 +189,10 @@ CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN=2 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN=0 CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 +CONFIG_BTDM_CTRL_AUTO_LATENCY= +CONFIG_BTDM_CTRL_AUTO_LATENCY_EFF= +CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT=y +CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF=y CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=2 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 @@ -210,6 +216,7 @@ CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR= CONFIG_SCAN_DUPLICATE_TYPE=0 CONFIG_DUPLICATE_SCAN_CACHE_SIZE=20 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN= +CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=y CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM=100 CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 @@ -248,6 +255,7 @@ CONFIG_SMP_ENABLE=y CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY= CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30 CONFIG_BT_RESERVE_DRAM=0xdb5c +CONFIG_BLE_MESH= # # Driver configurations @@ -294,13 +302,21 @@ CONFIG_MFN56_4X= # # Object Detection # -CONFIG_LSSH_SPARSE_MN_5=y -CONFIG_LSSH_WITH_LANDMARK= +CONFIG_DETECT_WITH_LANDMARK= + +# +# Pose Estimation +# +CONFIG_HD_NANO1=y +CONFIG_HD_LITE1= +CONFIG_HP_NANO1=y +CONFIG_HP_LITE1= # # ESP32-specific # CONFIG_IDF_TARGET_ESP32=y +CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y CONFIG_ESP32_REV_MIN_0=y CONFIG_ESP32_REV_MIN_1= CONFIG_ESP32_REV_MIN_2= @@ -348,6 +364,7 @@ CONFIG_D2WD_PSRAM_CS_IO=10 # CONFIG_PICO_PSRAM_CS_IO=10 CONFIG_SPIRAM_SPIWP_SD3_PIN=7 +CONFIG_SPIRAM_2T_MODE= CONFIG_MEMMAP_TRACEMEM= CONFIG_MEMMAP_TRACEMEM_TWOBANKS= CONFIG_ESP32_TRAX= @@ -423,10 +440,6 @@ CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 # Wi-Fi # CONFIG_SW_COEXIST_ENABLE=y -CONFIG_SW_COEXIST_PREFERENCE_WIFI= -CONFIG_SW_COEXIST_PREFERENCE_BT= -CONFIG_SW_COEXIST_PREFERENCE_BALANCE=y -CONFIG_SW_COEXIST_PREFERENCE_VALUE=2 CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=16 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 CONFIG_ESP32_WIFI_STATIC_TX_BUFFER= @@ -445,7 +458,7 @@ CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE= CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT= +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y # # PHY @@ -463,10 +476,14 @@ CONFIG_PM_ENABLE= # # Camera configuration # -CONFIG_OV2640_SUPPORT=y +CONFIG_OV7670_SUPPORT=y CONFIG_OV7725_SUPPORT=y +CONFIG_NT99141_SUPPORT=y +CONFIG_OV2640_SUPPORT=y CONFIG_OV3660_SUPPORT=y -CONFIG_SCCB_HARDWARE_I2C=y +CONFIG_OV5640_SUPPORT=y +CONFIG_SCCB_HARDWARE_I2C_PORT0= +CONFIG_SCCB_HARDWARE_I2C_PORT1=y CONFIG_CAMERA_CORE0= CONFIG_CAMERA_CORE1=y CONFIG_CAMERA_NO_AFFINITY= @@ -639,15 +656,19 @@ CONFIG_LOG_COLORS= # LWIP # CONFIG_L2_TO_L3_COPY= +CONFIG_ETHARP_SUPPORT_VLAN= CONFIG_LWIP_IRAM_OPTIMIZATION= CONFIG_LWIP_MAX_SOCKETS=10 CONFIG_LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS=y CONFIG_USE_ONLY_LWIP_SELECT= +CONFIG_LWIP_SO_LINGER= CONFIG_LWIP_SO_REUSE=y CONFIG_LWIP_SO_REUSE_RXTOALL=y CONFIG_LWIP_SO_RCVBUF=y -CONFIG_LWIP_IP_FRAG= -CONFIG_LWIP_IP_REASSEMBLY= +CONFIG_LWIP_IP4_FRAG=y +CONFIG_LWIP_IP6_FRAG=y +CONFIG_LWIP_IP4_REASSEMBLY= +CONFIG_LWIP_IP6_REASSEMBLY= CONFIG_LWIP_STATS= CONFIG_LWIP_ETHARP_TRUST_IP_MAC=y CONFIG_ESP_GRATUITOUS_ARP=y @@ -662,6 +683,7 @@ CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y CONFIG_LWIP_DHCPS_LEASE_UNIT=60 CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 CONFIG_LWIP_AUTOIP= +CONFIG_LWIP_IPV6_AUTOCONFIG= CONFIG_LWIP_NETIF_LOOPBACK=y CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 @@ -682,6 +704,7 @@ CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES= CONFIG_TCP_OVERSIZE_MSS=y CONFIG_TCP_OVERSIZE_QUARTER_MSS= CONFIG_TCP_OVERSIZE_DISABLE= +CONFIG_LWIP_TCP_RTO_TIME=3000 # # UDP @@ -693,6 +716,8 @@ CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY= CONFIG_TCPIP_TASK_AFFINITY_CPU0=y CONFIG_TCPIP_TASK_AFFINITY_CPU1= CONFIG_TCPIP_TASK_AFFINITY=0x0 +CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 +CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 CONFIG_PPP_SUPPORT=y CONFIG_PPP_NOTIFY_PHASE_SUPPORT= CONFIG_PPP_PAP_SUPPORT=y @@ -717,6 +742,7 @@ CONFIG_LWIP_MAX_RAW_PCBS=16 # CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 +CONFIG_LWIP_ESP_LWIP_ASSERT=y # # mbedTLS @@ -919,3 +945,8 @@ CONFIG_WL_SECTOR_SIZE=4096 # Wi-Fi Provisioning Manager # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 + +# +# Supplicant +# +CONFIG_WPA_WPS_WARS= diff --git a/variants/S_ODI_Ultra_v1/pins_arduino.h b/variants/S_ODI_Ultra_v1/pins_arduino.h new file mode 100644 index 00000000000..8badbb01630 --- /dev/null +++ b/variants/S_ODI_Ultra_v1/pins_arduino.h @@ -0,0 +1,63 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 40 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +static const uint8_t LED_BUILTIN = 2; +static const uint8_t LED_BUILTINB = 4; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define BUILTIN_LED2 LED_BUILTINB + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +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 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; + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +#endif /* Pins_Arduino_h */ + +/* compitable with SPELEC S.ODI Ultra v1.0 (based on ESP32 Series)*/ diff --git a/variants/doitESPduino32/pins_Arduino.h b/variants/doitESPduino32/pins_Arduino.h new file mode 100644 index 00000000000..6fd9d57a5ca --- /dev/null +++ b/variants/doitESPduino32/pins_Arduino.h @@ -0,0 +1,61 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 40 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +static const uint8_t LED_BUILTIN = 2; +#define BUILTIN_LED LED_BUILTIN // backward compatibility + + +static const uint8_t SDA = 21; +static const uint8_t SCL = 22; + +//SPI +static const uint8_t IO5 = 5; //SS +static const uint8_t IO23 = 23; //MOSI +static const uint8_t IO19 = 19; //MISO +static const uint8_t IO18 = 18; //SCK + +//ANALOG +static const uint8_t IO36 = 36; +static const uint8_t IO39 = 39; +static const uint8_t IO4 = 4; +static const uint8_t IO2 = 2; +static const uint8_t IO35 = 35; +//ANALOG+ +static const uint8_t IO15 = 15; +static const uint8_t IO33 = 33; +static const uint8_t IO32 = 32; +static const uint8_t IO0 = 0; + +//DIGITAL +static const uint8_t IO13 = 13; +static const uint8_t IO12 = 12; +static const uint8_t IO14 = 14; +static const uint8_t IO27 = 27; +static const uint8_t IO16 = 16; +static const uint8_t IO17 = 17; +static const uint8_t IO25 = 25; +static const uint8_t IO26 = 26; +static const uint8_t TX0 = 1; +static const uint8_t RX0 = 3; +//TFlash(uSD) +static const uint8_t SD2 = 9; +static const uint8_t SD3 = 10; +static const uint8_t CMD = 11; +static const uint8_t CLK = 6; +static const uint8_t SD0 = 7; +static const uint8_t SD1 = 8; + +// ESP-WROOM-32 does not have GPIO 14, 20(NC), 24, 28, 29, 30, 31, 36, 37, 38, 40+ +// All pins should be PWM capable. The board is a clone of WeMos D1 R32. + +#endif /* Pins_Arduino_h */ diff --git a/variants/esp32thing_plus/pins_arduino.h b/variants/esp32thing_plus/pins_arduino.h new file mode 100644 index 00000000000..f0ea952dd86 --- /dev/null +++ b/variants/esp32thing_plus/pins_arduino.h @@ -0,0 +1,61 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 40 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +static const uint8_t LED_BUILTIN = 13; +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +static const uint8_t TX = 17; +static const uint8_t RX = 16; + +#define TX1 TX +#define RX1 RX + +static const uint8_t SDA = 23; +static const uint8_t SCL = 22; + +static const uint8_t SS = 33; +static const uint8_t MOSI = 18; +static const uint8_t MISO = 19; +static const uint8_t SCK = 5; + +// mapping to match other feathers and also in order +static const uint8_t A0 = 26; +static const uint8_t A1 = 25; +static const uint8_t A2 = 34; +static const uint8_t A3 = 39; +static const uint8_t A4 = 36; +static const uint8_t A5 = 4; +static const uint8_t A6 = 14; +static const uint8_t A7 = 32; +static const uint8_t A8 = 15; +static const uint8_t A9 = 33; +static const uint8_t A10 = 27; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; + + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +#endif /* Pins_Arduino_h */ diff --git a/variants/firebeetle32/pins_arduino.h b/variants/firebeetle32/pins_arduino.h index 7fd3583e18d..ef829ad37fe 100644 --- a/variants/firebeetle32/pins_arduino.h +++ b/variants/firebeetle32/pins_arduino.h @@ -11,6 +11,8 @@ #define digitalPinToInterrupt(p) (((p)<40)?(p):-1) #define digitalPinHasPWM(p) (p < 34) +typedef unsigned char uint8_t; + static const uint8_t LED_BUILTIN = 2; #define BUILTIN_LED LED_BUILTIN // backward compatibility @@ -27,22 +29,46 @@ static const uint8_t MOSI = 23; static const uint8_t MISO = 19; static const uint8_t SCK = 18; +static const uint8_t D0 = 3; +static const uint8_t D1 = 1; +static const uint8_t D2 = 25; +static const uint8_t D3 = 26; +static const uint8_t D4 = 27; +static const uint8_t D5 = 9; +static const uint8_t D6 = 10; +static const uint8_t D7 = 13; +static const uint8_t D8 = 5; +static const uint8_t D9 = 2; + 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; +static const uint8_t A1 = 39; +static const uint8_t A2 = 34; +static const uint8_t A3 = 35; +static const uint8_t A4 = 15; +static const uint8_t A5 = 35; +static const uint8_t A6 = 4; +static const uint8_t A7 = 0; +static const uint8_t A8 = 2; +static const uint8_t A9 = 13; +static const uint8_t A10 = 12; +static const uint8_t A11 = 14; +static const uint8_t A12 = 27; +static const uint8_t A13 = 25; +static const uint8_t A14 = 26; + + + +static const uint8_t D0 = 3; +static const uint8_t D1 = 1; +static const uint8_t D2 = 25; +static const uint8_t D3 = 26; +static const uint8_t D4 = 27; +static const uint8_t D5 = 9; +static const uint8_t D6 = 10; +static const uint8_t D7 = 13; +static const uint8_t D8 = 5; +static const uint8_t D9 = 2; +static const uint8_t D10 = 0; static const uint8_t T0 = 4; static const uint8_t T1 = 0; diff --git a/variants/healthypi4/pins_arduino.h b/variants/healthypi4/pins_arduino.h new file mode 100644 index 00000000000..bc041213797 --- /dev/null +++ b/variants/healthypi4/pins_arduino.h @@ -0,0 +1,72 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 40 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +static const uint8_t LED_BUILTIN = 15; +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +static const uint8_t KEY_BUILTIN = 17; + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 21; +static const uint8_t SCL = 22; + +static const uint8_t SS = 2; +static const uint8_t MOSI = 23; +static const uint8_t MISO = 19; +static const uint8_t SCK = 18; + +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; + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADS1292_DRDY_PIN = 26; +static const uint8_t ADS1292_CS_PIN = 13; +static const uint8_t ADS1292_START_PIN = 14; +static const uint8_t ADS1292_PWDN_PIN = 27; +static const uint8_t AFE4490_CS_PIN = 21; +static const uint8_t AFE4490_DRDY_PIN = 39; +static const uint8_t AFE4490_PWDN_PIN = 4; + +static const uint8_t PUSH_BUTTON = 17; +static const uint8_t SLIDE_SWITCH = 16; + +#endif /* Pins_Arduino_h */ diff --git a/variants/honeylemon/pins_arduino.h b/variants/honeylemon/pins_arduino.h index 4d65b6b40e7..0b11cabd98a 100644 --- a/variants/honeylemon/pins_arduino.h +++ b/variants/honeylemon/pins_arduino.h @@ -11,7 +11,7 @@ #define digitalPinToInterrupt(p) (((p)<40)?(p):-1) #define digitalPinHasPWM(p) (p < 34) -static const uint8_t LED_BUILTIN = 16; +static const uint8_t LED_BUILTIN = 2; #define BUILTIN_LED LED_BUILTIN // backward compatibility static const uint8_t BUILTIN_KEY = 0; diff --git a/variants/imbrios-logsens-v1p1/pins_arduino.h b/variants/imbrios-logsens-v1p1/pins_arduino.h new file mode 100644 index 00000000000..3767d7d086f --- /dev/null +++ b/variants/imbrios-logsens-v1p1/pins_arduino.h @@ -0,0 +1,102 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 9 +#define NUM_ANALOG_INPUTS 7 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +// Renaming few signals +#define SPI_CLK SCK // IO14 +#define SPI_MISO MISO // IO12 +#define SPI_MOSI MOSI // IO13 +#define SPI_CS0 SS // IO15, Default SPI CS: Extension Header, Pin_3 +#define SD_SPI_CS1 SPI_CS1 // SPI Chip Select: MicroSD Card +#define LED_WIFI_LINK LED1_BUILDIN // LED6 on the LogSens V1.1 Board +#define LED_WIFI_ACT LED2_BUILDIN // LED7 on the LogSens V1.1 Board\ + +/* LED_BUILTIN is kept for compatibility reason; mapped to LED2 on the LogSens V1.1 Board */ +static const uint8_t LED_BUILTIN = 33; +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +/* UART0: Serial Port for Programming and Debugging on the LogSens V1.1 Board */ +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +#ifdef BOARD_VARIANT_RS485 +/* UART2: Serial Port conencted to RS485 transceiver on the LogSens V1.1 Board */ +static const uint8_t UART2_TX = 17; +static const uint8_t UART2_RX = 16; +static const uint8_t UART2_RTS = 4; +#endif /* BOARD_VARIANT_RS485 */ + +#ifdef BOARD_VARIANT_CAN +/* CAN Bus conencted to CAN transceiver on the LogSens V1.1 Board */ +static const uint8_t CAN_TX = 17; +static const uint8_t CAN_RX = 16; +static const uint8_t CAN_TXDE = 4; +#endif /* BOARD_VARIANT_CAN */ + +/* I2C Bus: Shared between RTC chip, Expansion Header (X3), Sensor Header (X7) on the LogSens V1.1 Board */ +static const uint8_t SDA = 21; +static const uint8_t SCL = 22; + +/* SPI Bus: Shared between MicroSD Card (X6) and Expansion Header (X3) */ +static const uint8_t SS = 15; // SPI Chip Select - 0; Connected to Extension Header, Pin_3 on the LogSens V1.1 Board +static const uint8_t MOSI = 13; +static const uint8_t MISO = 12; +static const uint8_t SCK = 14; + +static const uint8_t SPI_SS1 = 23; // SPI Chip Select - 1; connected to MicroSD Card on the LogSens V1.1 Board + +/* Software Controlled: IO, LEDs and Switches */ +static const uint8_t BUZZER_CTRL = 19; // Signal connected to MOSFET gate pin to control conenctor (X8) +static const uint8_t SD_CARD_DETECT = 35; // MicroSD Card (X6): Card Detect Signal + +static const uint8_t SW2_BUILDIN = 0; // Tactile Switch-2 (SW2); ESP32 BOOT0 pin, Use it with care !! +static const uint8_t SW3_BUILDIN = 36; // Tactile Switch-3 (SW3) +static const uint8_t SW4_BUILDIN = 34; // Tactile Switch-4 (SW4) + +static const uint8_t LED1_BUILDIN = 32; // Connected to LogSens V1.1: LED6 +static const uint8_t LED2_BUILDIN = 33; // Connected to LogSens V1.1: LED7 + + +/* Analog Input Channels accessible on the LogSens V1.1 Board */ +//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; + +//static const uint8_t T0 = 4; +//static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +//static const uint8_t T4 = 13; +//static const uint8_t T5 = 12; +//static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +/* DAC Channels accessible on the LogSens V1.1 Board */ +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_atom/pins_arduino.h b/variants/m5stack_atom/pins_arduino.h index 30c5245203c..b899534a071 100644 --- a/variants/m5stack_atom/pins_arduino.h +++ b/variants/m5stack_atom/pins_arduino.h @@ -20,7 +20,7 @@ static const uint8_t SCL = 32; static const uint8_t G12 = 12; static const uint8_t G19 = 19; -static const uint8_t G22 = 21; +static const uint8_t G21 = 21; static const uint8_t G22 = 22; static const uint8_t G23 = 23; static const uint8_t G25 = 25; @@ -42,4 +42,9 @@ static const uint8_t DAC2 = 26; static const uint8_t ADC1 = 35; static const uint8_t ADC2 = 36; +static const uint8_t SS = 19; +static const uint8_t MOSI = 33; +static const uint8_t MISO = 23; +static const uint8_t SCK = 22; + #endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_core2/pins_arduino.h b/variants/m5stack_core2/pins_arduino.h new file mode 100644 index 00000000000..787b2fe3a1c --- /dev/null +++ b/variants/m5stack_core2/pins_arduino.h @@ -0,0 +1,60 @@ +#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)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t TXD2 = 14; +static const uint8_t RXD2 = 13; + +static const uint8_t SDA = 32; +static const uint8_t SCL = 33; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 23; +static const uint8_t MISO = 38; +static const uint8_t SCK = 18; + +static const uint8_t G23 = 23; +static const uint8_t G38 = 38; +static const uint8_t G18 = 18; +static const uint8_t G3 = 3; +static const uint8_t G13 = 13; +static const uint8_t G21 = 21; +static const uint8_t G32 = 32; +static const uint8_t G27 = 27; +static const uint8_t G2 = 2; +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 G14 = 14; +static const uint8_t G22 = 22; +static const uint8_t G33 = 33; +static const uint8_t G19 = 19; +static const uint8_t G0 = 0; +static const uint8_t G34 = 34; + +static const uint8_t G12 = 12; +static const uint8_t G15 = 15; +static const uint8_t G17 = 17; +static const uint8_t G5 = 5; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADC1 = 35; +static const uint8_t ADC2 = 36; + +#endif /* Pins_Arduino_h */ diff --git a/variants/handbit/pins_arduino.h b/variants/mpython/pins_arduino.h similarity index 100% rename from variants/handbit/pins_arduino.h rename to variants/mpython/pins_arduino.h diff --git a/variants/openkb/pins_arduino.h b/variants/openkb/pins_arduino.h new file mode 100644 index 00000000000..7d8f271a38f --- /dev/null +++ b/variants/openkb/pins_arduino.h @@ -0,0 +1,90 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 38 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +static const uint8_t LED_BUILTIN = 16; +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +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 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; + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t LDR_PIN = 36; + +static const uint8_t SW1 = 16; +static const uint8_t SW2 = 14; + + +static const uint8_t BT_LED = 17; +static const uint8_t WIFI_LED = 2; +static const uint8_t NTP_LED = 15; +static const uint8_t IOT_LED = 12; + +static const uint8_t BUZZER = 13; + +static const uint8_t INPUT1 = 32; +static const uint8_t INPUT2 = 33; +static const uint8_t INPUT3 = 34; +static const uint8_t INPUT4 = 35; + +static const uint8_t OUTPUT1 = 26; +static const uint8_t OUTPUT2 = 27; + +static const uint8_t SDA0 = 21; +static const uint8_t SCL0 = 22; + +static const uint8_t SDA1 = 4; +static const uint8_t SCL1 = 5; + +static const uint8_t KB_GPIO18 = 18; +static const uint8_t KB_GPIO19 = 19; +static const uint8_t KB_GPIO23= 23; + +#endif /* Pins_Arduino_h */ diff --git a/variants/ttgo-lora32-v21new/pins_arduino.h b/variants/ttgo-lora32-v21new/pins_arduino.h new file mode 100644 index 00000000000..a338bfe1015 --- /dev/null +++ b/variants/ttgo-lora32-v21new/pins_arduino.h @@ -0,0 +1,90 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +/************************* +* Definitions for TTGO-Lora32-V2.1.6 Boards +* Labeled with T3 v1.6 20180606 +* or sold as TTGO-LoRa32 2.1 Revision 1.6 +************************/ + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 40 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +// I2C OLED Display works with SSD1306 driver +#define OLED_SDA 21 +#define OLED_SCL 22 +#define OLED_RST 16 + +// SPI LoRa Radio +#define LORA_SCK 5 // GPIO5 - SX1276 SCK +#define LORA_MISO 19 // GPIO19 - SX1276 MISO +#define LORA_MOSI 27 // GPIO27 - SX1276 MOSI +#define LORA_CS 18 // GPIO18 - SX1276 CS +#define LORA_RST 12 // GPIO14 - SX1276 RST +#define LORA_IRQ 26 // GPIO26 - SX1276 IRQ (interrupt request) +#define LORA_D1 33 // GPIO33 - SX1276 IO1 (for LMIC Arduino library) +#define LORA_D2 32 // GPIO32 - SX1276 IO2 + +// SD card +#define SD_SCK 14 +#define SD_MISO 2 +#define SD_MOSI 15 +#define SD_CS 13 + +static const uint8_t LED_BUILTIN = 25 ; +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +static const uint8_t KEY_BUILTIN = 0; + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 21; +static const uint8_t SCL = 22; + +static const uint8_t SS = 18; +static const uint8_t MOSI = 27; +static const uint8_t MISO = 19; +static const uint8_t SCK = 5; + +static const uint8_t A0 = 36; +static const uint8_t A1 = 37; +static const uint8_t A2 = 38; +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; + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +#endif /* Pins_Arduino_h */ diff --git a/variants/twatch/pins_arduino.h b/variants/twatch/pins_arduino.h index 44570b72693..f4b4fc52333 100644 --- a/variants/twatch/pins_arduino.h +++ b/variants/twatch/pins_arduino.h @@ -12,22 +12,19 @@ #define digitalPinHasPWM(p) (p < 34) // touch screen -#define TP_SDA 14 -#define TP_SCL 15 +#define TP_SDA 23 +#define TP_SCL 32 #define TP_INT 38 // Interrupt IO port #define RTC_INT 37 #define APX20X_INT 35 #define BMA42X_INT1 39 -#define BMA42X_INT2 4 //Serial1 Already assigned to GPS LORA #define TX1 33 #define RX1 34 -static const uint8_t KEY_BUILTIN = 36; - // Already assigned to BMA423 PCF8563 and external extensions static const uint8_t SDA = 21; static const uint8_t SCL = 22; diff --git a/variants/wifiduino32/pins_arduino.h b/variants/wifiduino32/pins_arduino.h new file mode 100644 index 00000000000..fd069075af6 --- /dev/null +++ b/variants/wifiduino32/pins_arduino.h @@ -0,0 +1,67 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 40 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +static const uint8_t LED_BUILTIN = 2; +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +static const uint8_t KEY_BUILTIN = 0; + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 5; +static const uint8_t SCL = 16; + +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 A0 = 27; +static const uint8_t A1 = 14; +static const uint8_t A2 = 12; +static const uint8_t A3 = 35; +static const uint8_t A4 = 13; +static const uint8_t A5 = 4; + + +static const uint8_t D0 = 3; +static const uint8_t D1 = 1; +static const uint8_t D2 = 17; +static const uint8_t D3 = 15; +static const uint8_t D4 = 32; +static const uint8_t D5 = 33; +static const uint8_t D6 = 25; +static const uint8_t D7 = 26; +static const uint8_t D8 = 23; +static const uint8_t D9 = 22; +static const uint8_t D10 = 21; +static const uint8_t D11 = 19; +static const uint8_t D12 = 18; +static const uint8_t D13 = 2; + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +#endif /* Pins_Arduino_h */
Username:
Username: