├── .github └── workflows │ └── push.yml ├── .gitignore ├── CMakeLists.txt ├── README.md ├── build.sh ├── components ├── arduino_tinyusb │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── include │ │ └── tusb_config.h │ ├── patches │ │ └── dcd_dwc2.patch │ └── src │ │ └── dcd_dwc2.c └── fb_gfx │ ├── CMakeLists.txt │ ├── FreeMonoBold12pt7b.h │ ├── component.mk │ ├── fb_gfx.c │ └── include │ └── fb_gfx.h ├── configs ├── builds.json ├── defconfig.120m ├── defconfig.16m ├── defconfig.30m ├── defconfig.40m ├── defconfig.60m ├── defconfig.64m ├── defconfig.80m ├── defconfig.common ├── defconfig.dio ├── defconfig.esp32 ├── defconfig.esp32c2 ├── defconfig.esp32c3 ├── defconfig.esp32c6 ├── defconfig.esp32h2 ├── defconfig.esp32p4 ├── defconfig.esp32s2 ├── defconfig.esp32s3 ├── defconfig.opi ├── defconfig.opi_ram ├── defconfig.qio ├── defconfig.qio_ram ├── pio_end.txt └── pio_start.txt ├── main ├── CMakeLists.txt ├── Kconfig.projbuild ├── arduino-lib-builder-as.S ├── arduino-lib-builder-cpp.cpp ├── arduino-lib-builder-gcc.c └── sketch.cpp ├── partitions.csv ├── patches ├── esp32s2_i2c_ll_master_init.diff └── lwip_max_tcp_pcb.diff └── tools ├── archive-build.sh ├── check-deploy-needed.sh ├── config.sh ├── config_editor ├── .gitignore ├── README.md ├── app.py ├── compile.py ├── editor.py ├── requirements.txt ├── settings.py ├── style.tcss └── widgets.py ├── copy-bootloader.sh ├── copy-libs.sh ├── copy-mem-variant.sh ├── current_commit.sh ├── gen_pio_frmwk_manifest.py ├── gen_pio_lib_manifest.py ├── get_projbuild_gitconfig.py ├── install-arduino.sh ├── install-esp-idf.sh ├── patch-tinyusb.sh ├── prepare-ci.sh ├── push-to-arduino.sh ├── repository_dispatch.sh └── update-components.sh /.github/workflows/push.yml: -------------------------------------------------------------------------------- 1 | name: IDF v5.4 2 | on: 3 | workflow_dispatch: # Manually start a workflow 4 | 5 | jobs: 6 | build-libs: 7 | name: Build Arduino Libs 8 | runs-on: macos-14 9 | steps: 10 | - uses: actions/checkout@v4 11 | - name: Set up Python 12 | uses: actions/setup-python@v5 13 | with: 14 | python-version: '3.11' 15 | - name: Install dependencies 16 | run: bash ./tools/prepare-ci.sh 17 | - name: Get current branch 18 | run: | 19 | echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV 20 | - name: Build Arduino Libs 21 | env: 22 | GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} 23 | GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} 24 | run: bash ./build.sh 25 | - name: Release 26 | uses: jason2866/action-gh-release@v1.3 27 | with: 28 | tag_name: ${{ github.run_number }} 29 | body_path: release-info.txt 30 | prerelease: true 31 | files: | 32 | dist/framework* 33 | release-info.txt 34 | env: 35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .vscode 3 | managed_components/ 4 | components/arduino/ 5 | components/esp-dl/ 6 | components/esp-sr/ 7 | components/esp32-camera/ 8 | components/esp_littlefs/ 9 | components/esp-rainmaker/ 10 | components/espressif__esp-dsp/ 11 | components/esp-insights/ 12 | components/arduino_tinyusb/tinyusb/ 13 | esp-idf/ 14 | out/ 15 | build/ 16 | dist/ 17 | env.sh 18 | sdkconfig 19 | sdkconfig.old 20 | version.txt 21 | dependencies.lock 22 | managed_components/ 23 | target/ 24 | core_version.h 25 | package.json 26 | release-info.txt 27 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(arduino-lib-builder) 7 | 8 | idf_build_get_property(elf EXECUTABLE GENERATOR_EXPRESSION) 9 | 10 | add_custom_command( 11 | OUTPUT "idf_libs" 12 | COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-libs.sh ${IDF_TARGET} "${CONFIG_LIB_BUILDER_FLASHMODE}" "${CONFIG_SPIRAM_MODE_OCT}" "${CONFIG_IDF_TARGET_ARCH_XTENSA}" 13 | DEPENDS ${elf} 14 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 15 | VERBATIM 16 | ) 17 | add_custom_target(idf-libs DEPENDS "idf_libs") 18 | 19 | add_custom_command( 20 | OUTPUT "copy_bootloader" 21 | COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-bootloader.sh ${IDF_TARGET} "${CONFIG_LIB_BUILDER_FLASHMODE}" "${CONFIG_LIB_BUILDER_FLASHFREQ}" 22 | DEPENDS bootloader 23 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 24 | VERBATIM 25 | ) 26 | add_custom_target(copy-bootloader DEPENDS "copy_bootloader") 27 | 28 | add_custom_command( 29 | OUTPUT "mem_variant" 30 | COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-mem-variant.sh ${IDF_TARGET} "${CONFIG_LIB_BUILDER_FLASHMODE}" "${CONFIG_SPIRAM_MODE_OCT}" 31 | DEPENDS ${elf} 32 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 33 | VERBATIM 34 | ) 35 | add_custom_target(mem-variant DEPENDS "mem_variant") 36 | 37 | idf_build_set_property(COMPILE_DEFINITIONS "-DESP32_ARDUINO_LIB_BUILDER" APPEND) 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tasmota Arduino PlatformIO framework builder [![ESP32 builder](https://github.com/Jason2866/esp32-arduino-lib-builder/actions/workflows/push.yml/badge.svg)](https://github.com/Jason2866/esp32-arduino-lib-builder/actions/workflows/push.yml)[![GitHub Releases](https://img.shields.io/github/downloads/Jason2866/esp32-arduino-lib-builder/total?label=downloads)](https://github.com/Jason2866/esp32-arduino-lib-builder/releases/latest) 2 | 3 | This repository contains the scripts that produce the libraries included with Tasmota esp32-arduino. 4 | 5 | Tested on Ubuntu and MacOS. 6 | 7 | ### Build on Ubuntu 8 | ```bash 9 | sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache jq 10 | sudo pip install --upgrade pip 11 | git clone https://github.com/espressif/esp32-arduino-lib-builder 12 | cd esp32-arduino-lib-builder 13 | ./build.sh 14 | ``` 15 | 16 | ### Using the User Interface 17 | 18 | You can more easily build the libraries using the user interface found in the `tools/config_editor/` folder. 19 | It is a Python script that allows you to select and edit the options for the libraries you want to build. 20 | The script has mouse support and can also be pre-configured using the same command line arguments as the `build.sh` script. 21 | For more information and troubleshooting, please refer to the [UI README](tools/config_editor/README.md). 22 | 23 | To use it, follow these steps: 24 | 25 | 1. Make sure you have the following prerequisites: 26 | - Python 3.9 or later 27 | - All the dependencies listed in the previous section 28 | 29 | 2. Install the required UI packages using `pip install -r tools/config_editor/requirements.txt`. 30 | 31 | 3. Execute the script `tools/config_editor/app.py` from any folder. It will automatically detect the path to the root of the repository. 32 | 33 | 4. Configure the compilation and ESP-IDF options as desired. 34 | 35 | 5. Click on the "Compile Static Libraries" button to start the compilation process. 36 | 37 | 6. The script will show the compilation output in a new screen. Note that the compilation process can take many hours, depending on the number of libraries selected and the options chosen. 38 | 39 | 7. If the compilation is successful and the option to copy the libraries to the Arduino Core folder is enabled, it will already be available for use in the Arduino IDE. Otherwise, you can find the compiled libraries in the `esp32-arduino-libs` folder alongside this repository. 40 | - Note that the copy operation doesn't currently support the core downloaded from the Arduino IDE Boards Manager, only the manual installation from the [`arduino-esp32`](https://github.com/espressif/arduino-esp32) repository. 41 | 42 | ### Documentation 43 | 44 | For more information about how to use the Library builder, please refer to this [Documentation page](https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html?highlight=lib%20builder) 45 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if ! [ -x "$(command -v python3)" ]; then 4 | echo "ERROR: python is not installed or not in PATH! Please install python first." 5 | exit 1 6 | fi 7 | 8 | if ! [ -x "$(command -v git)" ]; then 9 | echo "ERROR: git is not installed or not in PATH! Please install git first." 10 | exit 1 11 | fi 12 | 13 | if ! [ -x "$(command -v ninja)" ]; then 14 | echo "ERROR: ninja is not installed or not in PATH! Please install ninja first." 15 | exit 1 16 | fi 17 | 18 | # Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167 19 | export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 20 | 21 | CCACHE_ENABLE=1 22 | 23 | export TARGET="all" 24 | BUILD_TYPE="all" 25 | SKIP_ENV=0 26 | COPY_OUT=0 27 | ARCHIVE_OUT=1 28 | DEPLOY_OUT=0 29 | 30 | function print_help() { 31 | echo "Usage: build.sh [-s] [-n] [-A ] [-I ] [-i ] [-c ] [-t ] [-b ] [config ...]" 32 | echo " -s Skip installing/updating of ESP-IDF and all components" 33 | echo " -n Disable ccache" 34 | echo " -A Set which branch of arduino-esp32 to be used for compilation" 35 | echo " -I Set which branch of ESP-IDF to be used for compilation" 36 | echo " -i Set which commit of ESP-IDF to be used for compilation" 37 | echo " -e Archive the build to dist" 38 | echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32,esp32s3,esp32c3'" 39 | echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board" 40 | echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b" 41 | exit 1 42 | } 43 | 44 | while getopts ":A:I:i:c:t:b:sde" opt; do 45 | case ${opt} in 46 | s ) 47 | SKIP_ENV=1 48 | ;; 49 | n ) 50 | CCACHE_ENABLE=0 51 | ;; 52 | e ) 53 | ARCHIVE_OUT=1 54 | ;; 55 | A ) 56 | export AR_BRANCH="$OPTARG" 57 | ;; 58 | I ) 59 | export IDF_BRANCH="$OPTARG" 60 | ;; 61 | i ) 62 | export IDF_COMMIT="$OPTARG" 63 | ;; 64 | t ) 65 | IFS=',' read -ra TARGET <<< "$OPTARG" 66 | ;; 67 | b ) 68 | b=$OPTARG 69 | if [ "$b" != "build" ] && 70 | [ "$b" != "menuconfig" ] && 71 | [ "$b" != "reconfigure" ] && 72 | [ "$b" != "idf-libs" ] && 73 | [ "$b" != "copy-bootloader" ] && 74 | [ "$b" != "mem-variant" ]; then 75 | print_help 76 | fi 77 | BUILD_TYPE="$b" 78 | ;; 79 | \? ) 80 | echo "Invalid option: -$OPTARG" 1>&2 81 | print_help 82 | ;; 83 | : ) 84 | echo "Invalid option: -$OPTARG requires an argument" 1>&2 85 | print_help 86 | ;; 87 | esac 88 | done 89 | shift $((OPTIND -1)) 90 | CONFIGS=$@ 91 | 92 | export IDF_CCACHE_ENABLE=$CCACHE_ENABLE 93 | 94 | # Output the TARGET array 95 | echo "TARGET(s): ${TARGET[@]}" 96 | 97 | mkdir -p dist 98 | rm -rf dependencies.lock 99 | 100 | if [ $SKIP_ENV -eq 0 ]; then 101 | echo "* Installing/Updating ESP-IDF and all components..." 102 | # update components from git 103 | ./tools/update-components.sh 104 | if [ $? -ne 0 ]; then exit 1; fi 105 | 106 | # install arduino component 107 | ./tools/install-arduino.sh 108 | if [ $? -ne 0 ]; then exit 1; fi 109 | 110 | # install esp-idf 111 | source ./tools/install-esp-idf.sh 112 | if [ $? -ne 0 ]; then exit 1; fi 113 | else 114 | # $IDF_PATH/install.sh 115 | # source $IDF_PATH/export.sh 116 | source ./tools/config.sh 117 | fi 118 | 119 | if [ "$BUILD_TYPE" != "all" ]; then 120 | if [ "$TARGET" = "all" ]; then 121 | echo "ERROR: You need to specify target for non-default builds" 122 | print_help 123 | fi 124 | 125 | # Target Features Configs 126 | for target_json in `jq -c '.targets[]' configs/builds.json`; do 127 | target=$(echo "$target_json" | jq -c '.target' | tr -d '"') 128 | 129 | # Check if $target is in the $TARGET array 130 | target_in_array=false 131 | for item in "${TARGET[@]}"; do 132 | if [ "$item" = "$target" ]; then 133 | target_in_array=true 134 | break 135 | fi 136 | done 137 | 138 | if [ "$target_in_array" = false ]; then 139 | # Skip building for targets that are not in the $TARGET array 140 | continue 141 | fi 142 | 143 | configs="configs/defconfig.common;configs/defconfig.$target" 144 | for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do 145 | configs="$configs;configs/defconfig.$defconf" 146 | done 147 | 148 | echo "* Building for $target" 149 | 150 | # Configs From Arguments 151 | for conf in $CONFIGS; do 152 | configs="$configs;configs/defconfig.$conf" 153 | done 154 | 155 | echo "idf.py -DIDF_TARGET=\"$target\" -DSDKCONFIG_DEFAULTS=\"$configs\" $BUILD_TYPE" 156 | rm -rf build sdkconfig 157 | idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE 158 | if [ $? -ne 0 ]; then exit 1; fi 159 | done 160 | exit 0 161 | fi 162 | 163 | rm -rf build sdkconfig out 164 | mkdir -p "$AR_TOOLS/esp32-arduino-libs" 165 | 166 | # Add release-info 167 | rm -rf release-info.txt 168 | IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") 169 | AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") 170 | echo "Framework built from 171 | - $IDF_REPO branch [$IDF_BRANCH](https://github.com/$IDF_REPO/tree/$IDF_BRANCH) commit [$IDF_Commit_short](https://github.com/$IDF_REPO/commits/$IDF_BRANCH/#:~:text=$IDF_Commit_short) 172 | - $AR_REPO branch [$AR_BRANCH](https://github.com/$AR_REPO/tree/$AR_BRANCH) commit [$AR_Commit_short](https://github.com/$AR_REPO/commits/$AR_BRANCH/#:~:text=$AR_Commit_short) 173 | - Arduino lib builder branch: $GIT_BRANCH" >> release-info.txt 174 | 175 | #targets_count=`jq -c '.targets[] | length' configs/builds.json` 176 | for target_json in `jq -c '.targets[]' configs/builds.json`; do 177 | target=$(echo "$target_json" | jq -c '.target' | tr -d '"') 178 | target_skip=$(echo "$target_json" | jq -c '.skip // 0') 179 | 180 | # Check if $target is in the $TARGET array if not "all" 181 | if [ "$TARGET" != "all" ]; then 182 | target_in_array=false 183 | for item in "${TARGET[@]}"; do 184 | if [ "$item" = "$target" ]; then 185 | target_in_array=true 186 | break 187 | fi 188 | done 189 | 190 | # If $target is not in the $TARGET array, skip processing 191 | if [ "$target_in_array" = false ]; then 192 | echo "* Skipping Target: $target" 193 | continue 194 | fi 195 | fi 196 | 197 | # Skip chips that should not be a part of the final libs 198 | # WARNING!!! this logic needs to be updated when cron builds are split into jobs 199 | if [ "$TARGET" = "all" ] && [ $target_skip -eq 1 ]; then 200 | echo "* Skipping Target: $target" 201 | continue 202 | fi 203 | 204 | echo "* Target: $target" 205 | 206 | # Build Main Configs List 207 | main_configs="configs/defconfig.common;configs/defconfig.$target" 208 | for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do 209 | main_configs="$main_configs;configs/defconfig.$defconf" 210 | done 211 | 212 | # Build IDF Libs 213 | idf_libs_configs="$main_configs" 214 | for defconf in `echo "$target_json" | jq -c '.idf_libs[]' | tr -d '"'`; do 215 | idf_libs_configs="$idf_libs_configs;configs/defconfig.$defconf" 216 | done 217 | 218 | echo "* Build IDF-Libs: $idf_libs_configs" 219 | rm -rf build sdkconfig 220 | idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs 221 | if [ $? -ne 0 ]; then exit 1; fi 222 | 223 | # Build Bootloaders 224 | for boot_conf in `echo "$target_json" | jq -c '.bootloaders[]'`; do 225 | bootloader_configs="$main_configs" 226 | for defconf in `echo "$boot_conf" | jq -c '.[]' | tr -d '"'`; do 227 | bootloader_configs="$bootloader_configs;configs/defconfig.$defconf"; 228 | done 229 | 230 | echo "* Build BootLoader: $bootloader_configs" 231 | rm -rf build sdkconfig 232 | idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader 233 | if [ $? -ne 0 ]; then exit 1; fi 234 | done 235 | 236 | # Build Memory Variants 237 | for mem_conf in `echo "$target_json" | jq -c '.mem_variants[]'`; do 238 | mem_configs="$main_configs" 239 | for defconf in `echo "$mem_conf" | jq -c '.[]' | tr -d '"'`; do 240 | mem_configs="$mem_configs;configs/defconfig.$defconf"; 241 | done 242 | 243 | echo "* Build Memory Variant: $mem_configs" 244 | rm -rf build sdkconfig 245 | idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant 246 | if [ $? -ne 0 ]; then exit 1; fi 247 | done 248 | done 249 | 250 | # 251 | # Add components version info 252 | # 253 | rm -rf "$AR_TOOLS/esp32-arduino-libs/versions.txt" 254 | # The lib-builder version 255 | component_version="lib-builder: "$(git -C "$AR_ROOT" symbolic-ref --short HEAD || git -C "$AR_ROOT" tag --points-at HEAD)" "$(git -C "$AR_ROOT" rev-parse --short HEAD) 256 | echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" 257 | # ESP-IDF version 258 | component_version="esp-idf: "$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD)" "$(git -C "$IDF_PATH" rev-parse --short HEAD) 259 | echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" 260 | # components version 261 | for component in `ls "$AR_COMPS"`; do 262 | if [ -d "$AR_COMPS/$component/.git" ]; then 263 | component_version="$component: "$(git -C "$AR_COMPS/$component" symbolic-ref --short HEAD || git -C "$AR_COMPS/$component" tag --points-at HEAD)" "$(git -C "$AR_COMPS/$component" rev-parse --short HEAD) 264 | echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" 265 | fi 266 | done 267 | # TinyUSB version 268 | component_version="tinyusb: "$(git -C "$AR_COMPS/arduino_tinyusb/tinyusb" symbolic-ref --short HEAD || git -C "$AR_COMPS/arduino_tinyusb/tinyusb" tag --points-at HEAD)" "$(git -C "$AR_COMPS/arduino_tinyusb/tinyusb" rev-parse --short HEAD) 269 | echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" 270 | # managed components version 271 | for component in `ls "$AR_MANAGED_COMPS"`; do 272 | if [ -d "$AR_MANAGED_COMPS/$component/.git" ]; then 273 | component_version="$component: "$(git -C "$AR_MANAGED_COMPS/$component" symbolic-ref --short HEAD || git -C "$AR_MANAGED_COMPS/$component" tag --points-at HEAD)" "$(git -C "$AR_MANAGED_COMPS/$component" rev-parse --short HEAD) 274 | echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" 275 | elif [ -f "$AR_MANAGED_COMPS/$component/idf_component.yml" ]; then 276 | component_version="$component: "$(cat "$AR_MANAGED_COMPS/$component/idf_component.yml" | grep "^version: " | cut -d ' ' -f 2) 277 | echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" 278 | fi 279 | done 280 | 281 | export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) 282 | 283 | # Generate PlatformIO library manifest file 284 | if [ "$BUILD_TYPE" = "all" ]; then 285 | python3 ./tools/gen_pio_lib_manifest.py -o "$TOOLS_JSON_OUT/" -s "v$IDF_VERSION" -c "$IDF_COMMIT" 286 | if [ $? -ne 0 ]; then exit 1; fi 287 | fi 288 | 289 | AR_VERSION=$(jq -c '.version' "$AR_COMPS/arduino/package.json" | tr -d '"') 290 | AR_VERSION_UNDERSCORE=`echo "$AR_VERSION" | tr . _` 291 | 292 | # Generate PlatformIO framework manifest file 293 | rm -rf "$AR_ROOT/package.json" 294 | if [ "$BUILD_TYPE" = "all" ]; then 295 | python3 ./tools/gen_pio_frmwk_manifest.py -o "$AR_ROOT/" -s "v$AR_VERSION" -c "$IDF_COMMIT" 296 | if [ $? -ne 0 ]; then exit 1; fi 297 | fi 298 | 299 | # Generate core_version.h 300 | rm -rf "$AR_ROOT/core_version.h" 301 | echo "#define ARDUINO_ESP32_GIT_VER 0x$AR_Commit_short 302 | #define ARDUINO_ESP32_GIT_DESC $AR_VERSION 303 | #define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE 304 | #define ARDUINO_ESP32_RELEASE \"$AR_VERSION_UNDERSCORE\"" >> "$AR_ROOT/core_version.h" 305 | 306 | # archive the build 307 | if [ $ARCHIVE_OUT -eq 1 ]; then 308 | ./tools/archive-build.sh "$TARGET" 309 | if [ $? -ne 0 ]; then exit 1; fi 310 | fi 311 | -------------------------------------------------------------------------------- /components/arduino_tinyusb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(CONFIG_TINYUSB_ENABLED) 2 | 3 | ### variables ### 4 | ################# 5 | 6 | if(IDF_TARGET STREQUAL "esp32s2") 7 | set(compile_options 8 | "-DCFG_TUSB_MCU=OPT_MCU_ESP32S2" 9 | "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" 10 | "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes 11 | ) 12 | elseif(IDF_TARGET STREQUAL "esp32s3") 13 | set(compile_options 14 | "-DCFG_TUSB_MCU=OPT_MCU_ESP32S3" 15 | "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" 16 | "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes 17 | ) 18 | elseif(IDF_TARGET STREQUAL "esp32p4") 19 | set(compile_options 20 | "-DCFG_TUSB_MCU=OPT_MCU_ESP32P4" 21 | "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" 22 | "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes 23 | ) 24 | endif() 25 | 26 | set(srcs 27 | # espressif: 28 | "${COMPONENT_DIR}/src/dcd_dwc2.c" 29 | # tusb: 30 | #"${COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c" 31 | "${COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c" 32 | "${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_device.c" 33 | "${COMPONENT_DIR}/tinyusb/src/class/hid/hid_device.c" 34 | "${COMPONENT_DIR}/tinyusb/src/class/midi/midi_device.c" 35 | "${COMPONENT_DIR}/tinyusb/src/class/msc/msc_device.c" 36 | "${COMPONENT_DIR}/tinyusb/src/class/video/video_device.c" 37 | "${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_rt_device.c" 38 | "${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_device.c" 39 | "${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_device.c" 40 | "${COMPONENT_DIR}/tinyusb/src/class/net/ncm_device.c" 41 | "${COMPONENT_DIR}/tinyusb/src/common/tusb_fifo.c" 42 | "${COMPONENT_DIR}/tinyusb/src/device/usbd_control.c" 43 | "${COMPONENT_DIR}/tinyusb/src/device/usbd.c" 44 | "${COMPONENT_DIR}/tinyusb/src/tusb.c") 45 | 46 | set(includes_private 47 | # tusb: 48 | "${COMPONENT_DIR}/tinyusb/hw/bsp/" 49 | "${COMPONENT_DIR}/tinyusb/src/" 50 | "${COMPONENT_DIR}/tinyusb/src/device" 51 | "${COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2" 52 | ) 53 | 54 | idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos 55 | ORIG_INCLUDE_PATH) 56 | set(includes_public 57 | # tusb: 58 | "${FREERTOS_ORIG_INCLUDE_PATH}" 59 | "${COMPONENT_DIR}/tinyusb/src/" 60 | # espressif: 61 | "${COMPONENT_DIR}/include") 62 | 63 | set(requires esp_rom freertos soc) 64 | set(priv_requires arduino main) 65 | 66 | idf_component_register( 67 | INCLUDE_DIRS ${includes_public} 68 | PRIV_INCLUDE_DIRS ${includes_private} 69 | SRCS ${srcs} 70 | REQUIRES ${requires} 71 | PRIV_REQUIRES ${priv_requires} 72 | ) 73 | target_compile_options(${COMPONENT_TARGET} PRIVATE ${compile_options}) 74 | 75 | else() 76 | 77 | idf_component_register() 78 | 79 | endif() 80 | -------------------------------------------------------------------------------- /components/arduino_tinyusb/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Arduino TinyUSB" 2 | depends on ENABLE_ARDUINO_DEPENDS && SOC_USB_OTG_SUPPORTED 3 | 4 | config TINYUSB_ENABLED 5 | bool "Enable TinyUSB driver" 6 | default y 7 | depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4 8 | select FREERTOS_SUPPORT_STATIC_ALLOCATION 9 | select FREERTOS_USE_AUTHENTIC_INCLUDE_PATHS 10 | help 11 | Adds support for TinyUSB 12 | 13 | menu "Serial (CDC) driver" 14 | depends on TINYUSB_ENABLED 15 | 16 | config TINYUSB_CDC_ENABLED 17 | bool "Enable USB Serial (CDC) TinyUSB driver" 18 | default y 19 | help 20 | Enable USB Serial (CDC) TinyUSB driver. 21 | 22 | config TINYUSB_DESC_CDC_STRING 23 | string "CDC Device String" 24 | default "Espressif CDC Device" 25 | depends on TINYUSB_CDC_ENABLED 26 | help 27 | Specify name of the CDC device 28 | 29 | config TINYUSB_CDC_RX_BUFSIZE 30 | int "CDC FIFO size of RX" 31 | default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 32 | default 512 if IDF_TARGET_ESP32P4 33 | depends on TINYUSB_CDC_ENABLED 34 | help 35 | CDC FIFO size of RX 36 | 37 | config TINYUSB_CDC_TX_BUFSIZE 38 | int "CDC FIFO size of TX" 39 | default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 40 | default 512 if IDF_TARGET_ESP32P4 41 | depends on TINYUSB_CDC_ENABLED 42 | help 43 | CDC FIFO size of TX 44 | 45 | config TINYUSB_CDC_MAX_PORTS 46 | int "Maximum enabled CDC ports" 47 | range 1 2 48 | default 1 49 | depends on TINYUSB_CDC_ENABLED 50 | help 51 | Maximum enabled CDC ports 52 | 53 | endmenu 54 | 55 | menu "Mass Storage (MSC) driver" 56 | depends on TINYUSB_ENABLED 57 | 58 | config TINYUSB_MSC_ENABLED 59 | bool "Enable USB Mass Storage (MSC) TinyUSB driver" 60 | default y 61 | help 62 | Enable USB Mass Storage (MSC) TinyUSB driver. 63 | 64 | config TINYUSB_DESC_MSC_STRING 65 | string "MSC Device String" 66 | default "Espressif MSC Device" 67 | depends on TINYUSB_MSC_ENABLED 68 | help 69 | Specify name of the MSC device 70 | 71 | config TINYUSB_MSC_BUFSIZE 72 | int "MSC Buffer size" 73 | range 512 4096 74 | default 4096 75 | depends on TINYUSB_MSC_ENABLED 76 | help 77 | MSC Buffer size 78 | 79 | endmenu 80 | 81 | menu "Human Interface (HID) driver" 82 | depends on TINYUSB_ENABLED 83 | 84 | config TINYUSB_HID_ENABLED 85 | bool "Enable USB Human Interface (HID) TinyUSB driver" 86 | default y 87 | help 88 | Enable USB Human Interface (HID) TinyUSB driver. 89 | 90 | config TINYUSB_DESC_HID_STRING 91 | string "HID Device String" 92 | default "Espressif HID Device" 93 | depends on TINYUSB_HID_ENABLED 94 | help 95 | Specify name of the HID device 96 | 97 | config TINYUSB_HID_BUFSIZE 98 | int "HID Buffer size" 99 | default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 100 | default 512 if IDF_TARGET_ESP32P4 101 | depends on TINYUSB_HID_ENABLED 102 | help 103 | HID Buffer size. Should be sufficient to hold ID (if any) + Data 104 | 105 | endmenu 106 | 107 | menu "MIDI driver" 108 | depends on TINYUSB_ENABLED 109 | 110 | config TINYUSB_MIDI_ENABLED 111 | bool "Enable USB MIDI TinyUSB driver" 112 | default y 113 | help 114 | Enable USB MIDI TinyUSB driver. 115 | 116 | config TINYUSB_DESC_MIDI_STRING 117 | string "MIDI Device String" 118 | default "Espressif MIDI Device" 119 | depends on TINYUSB_MIDI_ENABLED 120 | help 121 | Specify name of the MIDI device 122 | 123 | config TINYUSB_MIDI_RX_BUFSIZE 124 | int "MIDI FIFO size of RX" 125 | default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 126 | default 512 if IDF_TARGET_ESP32P4 127 | depends on TINYUSB_MIDI_ENABLED 128 | help 129 | MIDI FIFO size of RX 130 | 131 | config TINYUSB_MIDI_TX_BUFSIZE 132 | int "MIDI FIFO size of TX" 133 | default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 134 | default 512 if IDF_TARGET_ESP32P4 135 | depends on TINYUSB_MIDI_ENABLED 136 | help 137 | MIDI FIFO size of TX 138 | 139 | endmenu 140 | 141 | menu "VIDEO driver" 142 | depends on TINYUSB_ENABLED 143 | 144 | config TINYUSB_VIDEO_ENABLED 145 | bool "Enable USB VIDEO TinyUSB driver" 146 | default y 147 | help 148 | Enable USB VIDEO TinyUSB driver. 149 | 150 | config TINYUSB_DESC_VIDEO_STRING 151 | string "VIDEO Device String" 152 | default "Espressif VIDEO Device" 153 | depends on TINYUSB_VIDEO_ENABLED 154 | help 155 | Specify name of the VIDEO device 156 | 157 | config TINYUSB_VIDEO_STREAMING_BUFSIZE 158 | int "VIDEO streaming endpoint size" 159 | range 0 512 160 | default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 161 | default 512 if IDF_TARGET_ESP32P4 162 | depends on TINYUSB_VIDEO_ENABLED 163 | help 164 | VIDEO streaming endpoint size 165 | 166 | config TINYUSB_VIDEO_STREAMING_IFS 167 | int "Number of VIDEO streaming interfaces" 168 | range 1 3 169 | default 1 170 | depends on TINYUSB_VIDEO_ENABLED 171 | help 172 | The number of VIDEO streaming interfaces 173 | endmenu 174 | 175 | menu "DFU Runtime driver" 176 | depends on TINYUSB_ENABLED 177 | 178 | config TINYUSB_DFU_RT_ENABLED 179 | bool "Enable USB DFU Runtime TinyUSB driver" 180 | default y 181 | help 182 | Enable USB DFU Runtime TinyUSB driver. 183 | 184 | config TINYUSB_DESC_DFU_RT_STRING 185 | string "DFU_RT Device String" 186 | default "Espressif DFU_RT Device" 187 | depends on TINYUSB_DFU_RT_ENABLED 188 | help 189 | Specify name of the DFU_RT device 190 | 191 | endmenu 192 | 193 | menu "DFU driver" 194 | depends on TINYUSB_ENABLED 195 | 196 | config TINYUSB_DFU_ENABLED 197 | bool "Enable USB DFU TinyUSB driver" 198 | default y 199 | help 200 | Enable USB DFU TinyUSB driver. 201 | 202 | config TINYUSB_DESC_DFU_STRING 203 | string "DFU Device String" 204 | default "Espressif DFU Device" 205 | depends on TINYUSB_DFU_ENABLED 206 | help 207 | Specify name of the DFU device 208 | 209 | config TINYUSB_DFU_BUFSIZE 210 | int "DFU buffer size" 211 | default 4096 212 | depends on TINYUSB_DFU_ENABLED 213 | help 214 | DFU buffer size 215 | 216 | endmenu 217 | 218 | menu "VENDOR driver" 219 | depends on TINYUSB_ENABLED 220 | 221 | config TINYUSB_VENDOR_ENABLED 222 | bool "Enable USB VENDOR TinyUSB driver" 223 | default y 224 | help 225 | Enable USB VENDOR TinyUSB driver. 226 | 227 | config TINYUSB_DESC_VENDOR_STRING 228 | string "VENDOR Device String" 229 | default "Espressif VENDOR Device" 230 | depends on TINYUSB_VENDOR_ENABLED 231 | help 232 | Specify name of the VENDOR device 233 | 234 | config TINYUSB_VENDOR_RX_BUFSIZE 235 | int "VENDOR FIFO size of RX" 236 | default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 237 | default 512 if IDF_TARGET_ESP32P4 238 | depends on TINYUSB_VENDOR_ENABLED 239 | help 240 | VENDOR FIFO size of RX 241 | 242 | config TINYUSB_VENDOR_TX_BUFSIZE 243 | int "VENDOR FIFO size of TX" 244 | default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 245 | default 512 if IDF_TARGET_ESP32P4 246 | depends on TINYUSB_VENDOR_ENABLED 247 | help 248 | VENDOR FIFO size of TX 249 | 250 | endmenu 251 | 252 | menu "NCM driver" 253 | depends on TINYUSB_ENABLED 254 | 255 | config TINYUSB_NCM_ENABLED 256 | bool "Enable USB NCM TinyUSB driver" 257 | default y 258 | help 259 | Enable USB NCM TinyUSB driver. 260 | 261 | endmenu 262 | 263 | config TINYUSB_DEBUG_LEVEL 264 | int "TinyUSB log level (0-3)" 265 | default 0 266 | range 0 3 267 | depends on TINYUSB_ENABLED 268 | help 269 | Define amount of log output from TinyUSB 270 | 271 | endmenu 272 | -------------------------------------------------------------------------------- /components/arduino_tinyusb/include/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org), 5 | * Additions Copyright (c) 2020, Espressif Systems (Shanghai) PTE LTD 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | * 25 | */ 26 | 27 | #pragma once 28 | #include "tusb_option.h" 29 | #include "sdkconfig.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | /* */ 36 | /* KCONFIG */ 37 | /* */ 38 | 39 | #ifndef CONFIG_TINYUSB_CDC_ENABLED 40 | # define CONFIG_TINYUSB_CDC_ENABLED 0 41 | #endif 42 | 43 | #ifndef CONFIG_TINYUSB_MSC_ENABLED 44 | # define CONFIG_TINYUSB_MSC_ENABLED 0 45 | #endif 46 | 47 | #ifndef CONFIG_TINYUSB_HID_ENABLED 48 | # define CONFIG_TINYUSB_HID_ENABLED 0 49 | #endif 50 | 51 | #ifndef CONFIG_TINYUSB_MIDI_ENABLED 52 | # define CONFIG_TINYUSB_MIDI_ENABLED 0 53 | #endif 54 | 55 | #ifndef CONFIG_TINYUSB_VIDEO_ENABLED 56 | # define CONFIG_TINYUSB_VIDEO_ENABLED 0 57 | #endif 58 | 59 | #ifndef CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED 60 | # define CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED 0 61 | #endif 62 | 63 | #ifndef CONFIG_TINYUSB_DFU_RT_ENABLED 64 | # define CONFIG_TINYUSB_DFU_RT_ENABLED 0 65 | #endif 66 | 67 | #ifndef CONFIG_TINYUSB_DFU_ENABLED 68 | # define CONFIG_TINYUSB_DFU_ENABLED 0 69 | #endif 70 | 71 | #ifndef CONFIG_TINYUSB_VENDOR_ENABLED 72 | # define CONFIG_TINYUSB_VENDOR_ENABLED 0 73 | #endif 74 | 75 | #ifndef CONFIG_TINYUSB_NCM_ENABLED 76 | # define CONFIG_TINYUSB_NCM_ENABLED 0 77 | #endif 78 | 79 | /* */ 80 | /* COMMON CONFIGURATION */ 81 | /* */ 82 | #ifndef CFG_TUSB_MCU 83 | #define CFG_TUSB_MCU OPT_MCU_ESP32S2 84 | #endif 85 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 86 | #define CFG_TUSB_OS OPT_OS_FREERTOS 87 | 88 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 89 | * Tinyusb use follows macros to declare transferring memory so that they can be put 90 | * into those specific section. 91 | * e.g 92 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 93 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 94 | */ 95 | #ifndef CFG_TUSB_MEM_SECTION 96 | # define CFG_TUSB_MEM_SECTION 97 | #endif 98 | 99 | #ifndef CFG_TUSB_MEM_ALIGN 100 | # define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4) 101 | #endif 102 | 103 | #if CONFIG_IDF_TARGET_ESP32P4 104 | #define CFG_TUD_MAX_SPEED OPT_MODE_HIGH_SPEED 105 | #else 106 | #define CFG_TUD_MAX_SPEED OPT_MODE_FULL_SPEED 107 | #endif 108 | 109 | /* */ 110 | /* DRIVER CONFIGURATION */ 111 | /* */ 112 | 113 | #define CFG_TUD_MAINTASK_SIZE 4096 114 | #define CFG_TUD_ENDOINT_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 115 | #define CFG_TUD_ENDOINT0_SIZE 64 116 | 117 | // Enabled Drivers 118 | #ifdef CONFIG_TINYUSB_CDC_MAX_PORTS 119 | #define CFG_TUD_CDC CONFIG_TINYUSB_CDC_MAX_PORTS 120 | #else 121 | #define CFG_TUD_CDC 0 122 | #endif 123 | #define CFG_TUD_MSC CONFIG_TINYUSB_MSC_ENABLED 124 | #define CFG_TUD_HID CONFIG_TINYUSB_HID_ENABLED 125 | #define CFG_TUD_MIDI CONFIG_TINYUSB_MIDI_ENABLED 126 | #define CFG_TUD_VIDEO CONFIG_TINYUSB_VIDEO_ENABLED 127 | #define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED 128 | #define CFG_TUD_DFU_RUNTIME CONFIG_TINYUSB_DFU_RT_ENABLED 129 | #define CFG_TUD_DFU CONFIG_TINYUSB_DFU_ENABLED 130 | #define CFG_TUD_VENDOR CONFIG_TINYUSB_VENDOR_ENABLED 131 | #define CFG_TUD_NCM CONFIG_TINYUSB_NCM_ENABLED 132 | 133 | // CDC FIFO size of TX and RX 134 | #define CFG_TUD_CDC_RX_BUFSIZE CONFIG_TINYUSB_CDC_RX_BUFSIZE 135 | #define CFG_TUD_CDC_TX_BUFSIZE CONFIG_TINYUSB_CDC_TX_BUFSIZE 136 | 137 | // MSC Buffer size of Device Mass storage: 138 | #define CFG_TUD_MSC_BUFSIZE CONFIG_TINYUSB_MSC_BUFSIZE 139 | 140 | // HID buffer size Should be sufficient to hold ID (if any) + Data 141 | #define CFG_TUD_HID_BUFSIZE CONFIG_TINYUSB_HID_BUFSIZE 142 | 143 | // MIDI FIFO size of TX and RX 144 | #define CFG_TUD_MIDI_RX_BUFSIZE CONFIG_TINYUSB_MIDI_RX_BUFSIZE 145 | #define CFG_TUD_MIDI_TX_BUFSIZE CONFIG_TINYUSB_MIDI_TX_BUFSIZE 146 | 147 | // The number of video streaming interfaces and endpoint size 148 | #define CFG_TUD_VIDEO_STREAMING CONFIG_TINYUSB_VIDEO_STREAMING_IFS 149 | #define CFG_TUD_VIDEO_STREAMING_EP_BUFSIZE CONFIG_TINYUSB_VIDEO_STREAMING_BUFSIZE 150 | 151 | // DFU buffer size 152 | #define CFG_TUD_DFU_XFER_BUFSIZE CONFIG_TINYUSB_DFU_BUFSIZE 153 | 154 | // VENDOR FIFO size of TX and RX 155 | #define CFG_TUD_VENDOR_RX_BUFSIZE CONFIG_TINYUSB_VENDOR_RX_BUFSIZE 156 | #define CFG_TUD_VENDOR_TX_BUFSIZE CONFIG_TINYUSB_VENDOR_TX_BUFSIZE 157 | 158 | #ifdef __cplusplus 159 | } 160 | #endif 161 | -------------------------------------------------------------------------------- /components/arduino_tinyusb/patches/dcd_dwc2.patch: -------------------------------------------------------------------------------- 1 | --- a/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:17:40.000000000 +0300 2 | +++ b/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:19:48.000000000 +0300 3 | @@ -243,6 +243,17 @@ 4 | //-------------------------------------------------------------------- 5 | // Endpoint 6 | //-------------------------------------------------------------------- 7 | +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) 8 | +// Keep count of how many FIFOs are in use 9 | +static uint8_t _allocated_fifos = 1; //FIFO0 is always in use 10 | + 11 | +// Will either return an unused FIFO number, or 0 if all are used. 12 | +static uint8_t get_free_fifo(void) { 13 | + if (_allocated_fifos < 5) return _allocated_fifos++; 14 | + return 0; 15 | +} 16 | +#endif 17 | + 18 | static void edpt_activate(uint8_t rhport, const tusb_desc_endpoint_t* p_endpoint_desc) { 19 | dwc2_regs_t* dwc2 = DWC2_REG(rhport); 20 | const uint8_t epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); 21 | @@ -266,7 +277,18 @@ 22 | depctl.set_data0_iso_even = 1; 23 | } 24 | if (dir == TUSB_DIR_IN) { 25 | - depctl.tx_fifo_num = epnum; 26 | + //depctl.tx_fifo_num = epnum; 27 | + uint8_t fifo_num = epnum; 28 | +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) 29 | + // Special Case for EP5, which is used by CDC but not actually called by the driver 30 | + // we can give it a fake FIFO 31 | + if (epnum == 5) { 32 | + fifo_num = epnum; 33 | + } else { 34 | + fifo_num = get_free_fifo(); 35 | + } 36 | +#endif 37 | + depctl.tx_fifo_num = fifo_num; 38 | } 39 | 40 | dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; 41 | @@ -557,6 +579,10 @@ 42 | } 43 | } 44 | 45 | +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) 46 | + _allocated_fifos = 1; 47 | +#endif 48 | + 49 | dfifo_flush_tx(dwc2, 0x10); // all tx fifo 50 | dfifo_flush_rx(dwc2); 51 | 52 | @@ -997,6 +1023,9 @@ 53 | if (gintsts & GINTSTS_USBRST) { 54 | // USBRST is start of reset. 55 | dwc2->gintsts = GINTSTS_USBRST; 56 | +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) 57 | + _allocated_fifos = 1; 58 | +#endif 59 | 60 | usbd_spin_lock(true); 61 | handle_bus_reset(rhport); 62 | @@ -1008,7 +1037,11 @@ 63 | 64 | if (gintsts & GINTSTS_USBSUSP) { 65 | dwc2->gintsts = GINTSTS_USBSUSP; 66 | - dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); 67 | + //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); 68 | + dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); 69 | +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) 70 | + _allocated_fifos = 1; 71 | +#endif 72 | } 73 | 74 | if (gintsts & GINTSTS_WKUINT) { 75 | @@ -1025,6 +1058,9 @@ 76 | 77 | if (otg_int & GOTGINT_SEDET) { 78 | dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); 79 | +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) 80 | + _allocated_fifos = 1; 81 | +#endif 82 | } 83 | 84 | dwc2->gotgint = otg_int; 85 | -------------------------------------------------------------------------------- /components/fb_gfx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT_SRCS "fb_gfx.c") 2 | set(COMPONENT_ADD_INCLUDEDIRS "include") 3 | set(COMPONENT_PRIV_INCLUDEDIRS "") 4 | set(COMPONENT_PRIV_REQUIRES newlib) 5 | register_component() -------------------------------------------------------------------------------- /components/fb_gfx/FreeMonoBold12pt7b.h: -------------------------------------------------------------------------------- 1 | const uint8_t FreeMonoBold12pt7bBitmaps[] = { 2 | 0xFF, 0xFF, 0xFF, 0xF6, 0x66, 0x60, 0x6F, 0x60, 0xE7, 0xE7, 0x62, 0x42, 3 | 0x42, 0x42, 0x42, 0x11, 0x87, 0x30, 0xC6, 0x18, 0xC3, 0x31, 0xFF, 0xFF, 4 | 0xF9, 0x98, 0x33, 0x06, 0x60, 0xCC, 0x7F, 0xEF, 0xFC, 0x66, 0x0C, 0xC3, 5 | 0x98, 0x63, 0x04, 0x40, 0x0C, 0x03, 0x00, 0xC0, 0xFE, 0x7F, 0x9C, 0x66, 6 | 0x09, 0x80, 0x78, 0x0F, 0xE0, 0x7F, 0x03, 0xE0, 0xF8, 0x7F, 0xFB, 0xFC, 7 | 0x0C, 0x03, 0x00, 0xC0, 0x30, 0x38, 0x1F, 0x0C, 0x42, 0x10, 0xC4, 0x1F, 8 | 0x03, 0x9C, 0x3C, 0x7F, 0x33, 0xE0, 0x8C, 0x21, 0x08, 0xC3, 0xE0, 0x70, 9 | 0x3E, 0x1F, 0xC6, 0x61, 0x80, 0x70, 0x0C, 0x07, 0x83, 0xEE, 0xDF, 0xB3, 10 | 0xCC, 0x73, 0xFE, 0x7F, 0x80, 0xFD, 0x24, 0x90, 0x39, 0xDC, 0xE6, 0x73, 11 | 0x18, 0xC6, 0x31, 0x8C, 0x31, 0x8E, 0x31, 0xC4, 0xE7, 0x1C, 0xE3, 0x1C, 12 | 0x63, 0x18, 0xC6, 0x31, 0x98, 0xCE, 0x67, 0x10, 0x0C, 0x03, 0x00, 0xC3, 13 | 0xB7, 0xFF, 0xDF, 0xE1, 0xE0, 0xFC, 0x33, 0x0C, 0xC0, 0x06, 0x00, 0x60, 14 | 0x06, 0x00, 0x60, 0x06, 0x0F, 0xFF, 0xFF, 0xF0, 0x60, 0x06, 0x00, 0x60, 15 | 0x06, 0x00, 0x60, 0x06, 0x00, 0x3B, 0x9C, 0xCE, 0x62, 0x00, 0xFF, 0xFF, 16 | 0xFF, 0xFF, 0x80, 0x00, 0x40, 0x30, 0x1C, 0x07, 0x03, 0x80, 0xE0, 0x30, 17 | 0x1C, 0x06, 0x03, 0x80, 0xC0, 0x70, 0x18, 0x0E, 0x03, 0x01, 0xC0, 0x60, 18 | 0x38, 0x0E, 0x01, 0x00, 0x1E, 0x0F, 0xC6, 0x1B, 0x87, 0xC0, 0xF0, 0x3C, 19 | 0x0F, 0x03, 0xC0, 0xF0, 0x3C, 0x0F, 0x87, 0x61, 0x8F, 0xC1, 0xE0, 0x1C, 20 | 0x0F, 0x0F, 0xC3, 0xB0, 0x0C, 0x03, 0x00, 0xC0, 0x30, 0x0C, 0x03, 0x00, 21 | 0xC0, 0x30, 0x0C, 0x3F, 0xFF, 0xFC, 0x1F, 0x1F, 0xEE, 0x1F, 0x83, 0xC0, 22 | 0xC0, 0x70, 0x38, 0x1E, 0x0F, 0x07, 0x83, 0xC1, 0xE3, 0xF0, 0xFF, 0xFF, 23 | 0xFC, 0x3F, 0x0F, 0xF1, 0x87, 0x00, 0x60, 0x0C, 0x03, 0x83, 0xE0, 0x7C, 24 | 0x01, 0xC0, 0x0C, 0x01, 0x80, 0x3C, 0x0F, 0xFF, 0x9F, 0xC0, 0x07, 0x07, 25 | 0x83, 0xC3, 0xE1, 0xB1, 0xD8, 0xCC, 0xC6, 0xE3, 0x7F, 0xFF, 0xE0, 0x61, 26 | 0xF8, 0xFC, 0x7F, 0x9F, 0xE6, 0x01, 0x80, 0x60, 0x1F, 0x87, 0xF9, 0x86, 27 | 0x00, 0xC0, 0x30, 0x0C, 0x03, 0xC1, 0xBF, 0xE7, 0xE0, 0x07, 0xC7, 0xF3, 28 | 0xC1, 0xC0, 0x60, 0x38, 0x0E, 0xF3, 0xFE, 0xF1, 0xF8, 0x3E, 0x0F, 0x83, 29 | 0x71, 0xCF, 0xE1, 0xF0, 0xFF, 0xFF, 0xFC, 0x1F, 0x07, 0x01, 0x80, 0x60, 30 | 0x38, 0x0C, 0x03, 0x01, 0xC0, 0x60, 0x18, 0x0E, 0x03, 0x00, 0xC0, 0x1E, 31 | 0x1F, 0xEE, 0x1F, 0x03, 0xC0, 0xF0, 0x36, 0x19, 0xFE, 0x7F, 0xB8, 0x7C, 32 | 0x0F, 0x03, 0xE1, 0xDF, 0xE3, 0xF0, 0x3E, 0x1F, 0xCE, 0x3B, 0x07, 0xC1, 33 | 0xF0, 0x7E, 0x3D, 0xFF, 0x3D, 0xC0, 0x70, 0x18, 0x0E, 0x0F, 0x3F, 0x8F, 34 | 0x80, 0xFF, 0x80, 0x00, 0xFF, 0x80, 0x77, 0x70, 0x00, 0x00, 0x76, 0x6C, 35 | 0xC8, 0x80, 0x00, 0x30, 0x0F, 0x03, 0xE0, 0xF8, 0x3E, 0x0F, 0x80, 0x3E, 36 | 0x00, 0xF8, 0x03, 0xE0, 0x0F, 0x00, 0x20, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 37 | 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x60, 0x0F, 0x80, 0x3E, 0x00, 0xF8, 38 | 0x03, 0xE0, 0x1F, 0x07, 0xC1, 0xF0, 0x7C, 0x0F, 0x00, 0x40, 0x00, 0x7C, 39 | 0x7F, 0xB0, 0xF8, 0x30, 0x18, 0x1C, 0x3C, 0x3C, 0x18, 0x08, 0x00, 0x07, 40 | 0x03, 0x81, 0xC0, 0x1E, 0x07, 0xF1, 0xC7, 0x30, 0x6C, 0x0D, 0x87, 0xB3, 41 | 0xF6, 0xE6, 0xD8, 0xDB, 0x1B, 0x73, 0x67, 0xFC, 0x7F, 0x80, 0x30, 0x03, 42 | 0x00, 0x71, 0xC7, 0xF8, 0x7C, 0x00, 0x3F, 0x80, 0x7F, 0x80, 0x1F, 0x00, 43 | 0x76, 0x00, 0xEE, 0x01, 0x8C, 0x07, 0x18, 0x0E, 0x38, 0x1F, 0xF0, 0x7F, 44 | 0xF0, 0xC0, 0x61, 0x80, 0xCF, 0xC7, 0xFF, 0x8F, 0xC0, 0xFF, 0xC7, 0xFF, 45 | 0x0C, 0x1C, 0x60, 0x63, 0x03, 0x18, 0x38, 0xFF, 0x87, 0xFE, 0x30, 0x39, 46 | 0x80, 0xCC, 0x06, 0x60, 0x7F, 0xFF, 0x7F, 0xF0, 0x0F, 0xF3, 0xFF, 0x70, 47 | 0x76, 0x03, 0xC0, 0x3C, 0x00, 0xC0, 0x0C, 0x00, 0xC0, 0x0C, 0x00, 0x60, 48 | 0x37, 0x07, 0x3F, 0xF0, 0xFC, 0xFF, 0x0F, 0xFC, 0x60, 0xE6, 0x06, 0x60, 49 | 0x36, 0x03, 0x60, 0x36, 0x03, 0x60, 0x36, 0x03, 0x60, 0x76, 0x0E, 0xFF, 50 | 0xCF, 0xF8, 0xFF, 0xF7, 0xFF, 0x8C, 0x0C, 0x60, 0x63, 0x1B, 0x18, 0xC0, 51 | 0xFE, 0x07, 0xF0, 0x31, 0x81, 0x8C, 0xCC, 0x06, 0x60, 0x3F, 0xFF, 0xFF, 52 | 0xFC, 0xFF, 0xFF, 0xFF, 0xCC, 0x06, 0x60, 0x33, 0x19, 0x98, 0xC0, 0xFE, 53 | 0x07, 0xF0, 0x31, 0x81, 0x8C, 0x0C, 0x00, 0x60, 0x0F, 0xF0, 0x7F, 0x80, 54 | 0x0F, 0xF1, 0xFF, 0x9C, 0x1C, 0xC0, 0x6C, 0x03, 0x60, 0x03, 0x00, 0x18, 55 | 0x7F, 0xC3, 0xFE, 0x01, 0xB8, 0x0C, 0xE0, 0xE3, 0xFF, 0x07, 0xE0, 0x7C, 56 | 0xF9, 0xF3, 0xE3, 0x03, 0x0C, 0x0C, 0x30, 0x30, 0xC0, 0xC3, 0xFF, 0x0F, 57 | 0xFC, 0x30, 0x30, 0xC0, 0xC3, 0x03, 0x0C, 0x0C, 0xFC, 0xFF, 0xF3, 0xF0, 58 | 0xFF, 0xFF, 0xF0, 0xC0, 0x30, 0x0C, 0x03, 0x00, 0xC0, 0x30, 0x0C, 0x03, 59 | 0x00, 0xC0, 0x30, 0xFF, 0xFF, 0xF0, 0x0F, 0xF8, 0x7F, 0xC0, 0x30, 0x01, 60 | 0x80, 0x0C, 0x00, 0x60, 0x03, 0x18, 0x18, 0xC0, 0xC6, 0x06, 0x30, 0x31, 61 | 0xC3, 0x0F, 0xF8, 0x1F, 0x00, 0xFC, 0xFB, 0xF3, 0xE3, 0x0E, 0x0C, 0x70, 62 | 0x33, 0x80, 0xFC, 0x03, 0xF0, 0x0F, 0xE0, 0x39, 0xC0, 0xC3, 0x03, 0x0E, 63 | 0x0C, 0x18, 0xFC, 0x7F, 0xF0, 0xF0, 0xFF, 0x0F, 0xF0, 0x18, 0x01, 0x80, 64 | 0x18, 0x01, 0x80, 0x18, 0x01, 0x80, 0x18, 0x31, 0x83, 0x18, 0x31, 0x83, 65 | 0xFF, 0xFF, 0xFF, 0xF0, 0x3F, 0xC0, 0xF7, 0x87, 0x9E, 0x1E, 0x7C, 0xF9, 66 | 0xB3, 0xE6, 0xFD, 0x99, 0xF6, 0x67, 0x99, 0x8E, 0x66, 0x31, 0x98, 0x06, 67 | 0xFC, 0xFF, 0xF3, 0xF0, 0xF1, 0xFF, 0xCF, 0xCF, 0x0C, 0x78, 0x63, 0xE3, 68 | 0x1B, 0x18, 0xDC, 0xC6, 0x76, 0x31, 0xB1, 0x8F, 0x8C, 0x3C, 0x61, 0xE7, 69 | 0xE7, 0x3F, 0x18, 0x0F, 0x03, 0xFC, 0x70, 0xE6, 0x06, 0xE0, 0x7C, 0x03, 70 | 0xC0, 0x3C, 0x03, 0xC0, 0x3E, 0x07, 0x60, 0x67, 0x0E, 0x3F, 0xC0, 0xF0, 71 | 0xFF, 0x8F, 0xFE, 0x30, 0x73, 0x03, 0x30, 0x33, 0x03, 0x30, 0x73, 0xFE, 72 | 0x3F, 0x83, 0x00, 0x30, 0x03, 0x00, 0xFF, 0x0F, 0xF0, 0x0F, 0x03, 0xFC, 73 | 0x70, 0xE6, 0x06, 0xE0, 0x7C, 0x03, 0xC0, 0x3C, 0x03, 0xC0, 0x3E, 0x07, 74 | 0x60, 0x67, 0x0E, 0x3F, 0xC1, 0xF0, 0x18, 0x33, 0xFF, 0x3F, 0xE0, 0xFF, 75 | 0x83, 0xFF, 0x83, 0x07, 0x0C, 0x0C, 0x30, 0x30, 0xC1, 0xC3, 0xFE, 0x0F, 76 | 0xF0, 0x31, 0xE0, 0xC3, 0x83, 0x07, 0x0C, 0x0C, 0xFE, 0x3F, 0xF8, 0x70, 77 | 0x3F, 0xDF, 0xFE, 0x1F, 0x03, 0xC0, 0xF8, 0x07, 0xE0, 0x7E, 0x01, 0xF0, 78 | 0x3C, 0x0F, 0x87, 0xFF, 0xBF, 0xC0, 0xFF, 0xFF, 0xFF, 0xC6, 0x3C, 0x63, 79 | 0xC6, 0x3C, 0x63, 0x06, 0x00, 0x60, 0x06, 0x00, 0x60, 0x06, 0x00, 0x60, 80 | 0x3F, 0xC3, 0xFC, 0xFF, 0xFF, 0xFF, 0x60, 0x66, 0x06, 0x60, 0x66, 0x06, 81 | 0x60, 0x66, 0x06, 0x60, 0x66, 0x06, 0x60, 0x63, 0x9C, 0x1F, 0xC0, 0xF0, 82 | 0xFC, 0x3F, 0xFC, 0x3F, 0x30, 0x0C, 0x38, 0x1C, 0x18, 0x18, 0x1C, 0x38, 83 | 0x1C, 0x38, 0x0E, 0x70, 0x0E, 0x70, 0x0F, 0x60, 0x07, 0xE0, 0x07, 0xE0, 84 | 0x03, 0xC0, 0x03, 0xC0, 0xFC, 0xFF, 0xF3, 0xF6, 0x01, 0xDC, 0xC6, 0x77, 85 | 0x99, 0xDE, 0x67, 0x79, 0x8D, 0xFE, 0x3F, 0xF8, 0xF3, 0xE3, 0xCF, 0x8F, 86 | 0x3C, 0x38, 0x70, 0xE1, 0xC0, 0xF8, 0xFB, 0xE3, 0xE3, 0x86, 0x0F, 0x38, 87 | 0x1F, 0xC0, 0x3E, 0x00, 0x70, 0x03, 0xE0, 0x0F, 0x80, 0x77, 0x03, 0x8E, 88 | 0x1E, 0x1C, 0xFC, 0xFF, 0xF3, 0xF0, 0xF9, 0xFF, 0x9F, 0x30, 0xC3, 0x9C, 89 | 0x19, 0x81, 0xF8, 0x0F, 0x00, 0x60, 0x06, 0x00, 0x60, 0x06, 0x00, 0x60, 90 | 0x3F, 0xC3, 0xFC, 0xFF, 0xBF, 0xEC, 0x3B, 0x0C, 0xC6, 0x33, 0x80, 0xC0, 91 | 0x60, 0x38, 0xCC, 0x36, 0x0F, 0x03, 0xFF, 0xFF, 0xF0, 0xFF, 0xF1, 0x8C, 92 | 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x63, 0x18, 0xC7, 0xFE, 0x40, 0x30, 0x0E, 93 | 0x01, 0x80, 0x70, 0x0C, 0x03, 0x80, 0x60, 0x1C, 0x03, 0x00, 0xE0, 0x18, 94 | 0x07, 0x00, 0xC0, 0x38, 0x0E, 0x01, 0xC0, 0x70, 0x0C, 0x01, 0xFF, 0xC6, 95 | 0x31, 0x8C, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x63, 0x1F, 0xFE, 0x04, 0x03, 96 | 0x01, 0xE0, 0xFC, 0x7B, 0x9C, 0x7E, 0x1F, 0x03, 0xFF, 0xFF, 0xFF, 0xF0, 97 | 0xCE, 0x73, 0x3F, 0x07, 0xF8, 0x00, 0xC0, 0x0C, 0x1F, 0xC7, 0xFC, 0x60, 98 | 0xCC, 0x0C, 0xC1, 0xCF, 0xFF, 0x3F, 0xF0, 0xF0, 0x07, 0x80, 0x0C, 0x00, 99 | 0x60, 0x03, 0x7C, 0x1F, 0xF8, 0xF1, 0xC7, 0x07, 0x30, 0x19, 0x80, 0xCC, 100 | 0x06, 0x60, 0x73, 0xC7, 0x7F, 0xFB, 0xDF, 0x00, 0x1F, 0xB3, 0xFF, 0x70, 101 | 0xFE, 0x07, 0xC0, 0x3C, 0x00, 0xC0, 0x0C, 0x00, 0x70, 0x77, 0xFF, 0x1F, 102 | 0xC0, 0x01, 0xE0, 0x0F, 0x00, 0x18, 0x00, 0xC1, 0xF6, 0x3F, 0xF1, 0xC7, 103 | 0x9C, 0x1C, 0xC0, 0x66, 0x03, 0x30, 0x19, 0x81, 0xC7, 0x1E, 0x3F, 0xFC, 104 | 0x7D, 0xE0, 0x1F, 0x83, 0xFC, 0x70, 0xEE, 0x07, 0xFF, 0xFF, 0xFF, 0xE0, 105 | 0x0E, 0x00, 0x70, 0x73, 0xFF, 0x1F, 0xC0, 0x07, 0xC3, 0xFC, 0x60, 0x0C, 106 | 0x0F, 0xFD, 0xFF, 0x86, 0x00, 0xC0, 0x18, 0x03, 0x00, 0x60, 0x0C, 0x01, 107 | 0x81, 0xFF, 0xBF, 0xF0, 0x1F, 0x79, 0xFF, 0xDC, 0x79, 0x81, 0xCC, 0x06, 108 | 0x60, 0x33, 0x01, 0x9C, 0x1C, 0x71, 0xE1, 0xFF, 0x07, 0xD8, 0x00, 0xC0, 109 | 0x06, 0x00, 0x70, 0x7F, 0x03, 0xF0, 0xF0, 0x03, 0xC0, 0x03, 0x00, 0x0C, 110 | 0x00, 0x37, 0xC0, 0xFF, 0x83, 0xC7, 0x0C, 0x0C, 0x30, 0x30, 0xC0, 0xC3, 111 | 0x03, 0x0C, 0x0C, 0x30, 0x33, 0xF3, 0xFF, 0xCF, 0xC0, 0x06, 0x00, 0xC0, 112 | 0x00, 0x3F, 0x07, 0xE0, 0x0C, 0x01, 0x80, 0x30, 0x06, 0x00, 0xC0, 0x18, 113 | 0x03, 0x0F, 0xFF, 0xFF, 0xC0, 0x06, 0x06, 0x00, 0xFF, 0xFF, 0x03, 0x03, 114 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0xFE, 0xFC, 115 | 0xF0, 0x07, 0x80, 0x0C, 0x00, 0x60, 0x03, 0x3F, 0x19, 0xF8, 0xDE, 0x07, 116 | 0xE0, 0x3E, 0x01, 0xF0, 0x0F, 0xC0, 0x6F, 0x03, 0x1C, 0x78, 0xFF, 0xC7, 117 | 0xE0, 0x7E, 0x0F, 0xC0, 0x18, 0x03, 0x00, 0x60, 0x0C, 0x01, 0x80, 0x30, 118 | 0x06, 0x00, 0xC0, 0x18, 0x03, 0x00, 0x61, 0xFF, 0xFF, 0xF8, 0xFE, 0xF1, 119 | 0xFF, 0xF1, 0xCE, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x63, 0x18, 0xC6, 0x31, 120 | 0x8C, 0x63, 0x19, 0xF7, 0xBF, 0xEF, 0x78, 0x77, 0xC1, 0xFF, 0x83, 0xC7, 121 | 0x0C, 0x0C, 0x30, 0x30, 0xC0, 0xC3, 0x03, 0x0C, 0x0C, 0x30, 0x33, 0xF1, 122 | 0xFF, 0xC7, 0xC0, 0x1F, 0x83, 0xFC, 0x70, 0xEE, 0x07, 0xC0, 0x3C, 0x03, 123 | 0xC0, 0x3E, 0x07, 0x70, 0xE3, 0xFC, 0x1F, 0x80, 0xF7, 0xE3, 0xFF, 0xC3, 124 | 0xC3, 0x8E, 0x07, 0x30, 0x0C, 0xC0, 0x33, 0x00, 0xCE, 0x07, 0x3C, 0x38, 125 | 0xFF, 0xC3, 0x7E, 0x0C, 0x00, 0x30, 0x00, 0xC0, 0x0F, 0xE0, 0x3F, 0x80, 126 | 0x1F, 0xBC, 0xFF, 0xF7, 0x0F, 0x38, 0x1C, 0xC0, 0x33, 0x00, 0xCC, 0x03, 127 | 0x38, 0x1C, 0x70, 0xF0, 0xFF, 0xC1, 0xFB, 0x00, 0x0C, 0x00, 0x30, 0x00, 128 | 0xC0, 0x1F, 0xC0, 0x7F, 0x79, 0xE7, 0xFF, 0x1F, 0x31, 0xC0, 0x18, 0x01, 129 | 0x80, 0x18, 0x01, 0x80, 0x18, 0x0F, 0xFC, 0xFF, 0xC0, 0x3F, 0x9F, 0xFE, 130 | 0x1F, 0x82, 0xFE, 0x1F, 0xE0, 0xFF, 0x03, 0xE0, 0xFF, 0xFF, 0xF0, 0x30, 131 | 0x06, 0x00, 0xC0, 0x7F, 0xEF, 0xFC, 0x60, 0x0C, 0x01, 0x80, 0x30, 0x06, 132 | 0x00, 0xC0, 0x18, 0x71, 0xFE, 0x1F, 0x00, 0xF1, 0xF7, 0x8F, 0x8C, 0x0C, 133 | 0x60, 0x63, 0x03, 0x18, 0x18, 0xC0, 0xC6, 0x06, 0x38, 0xF0, 0xFF, 0xC3, 134 | 0xEE, 0xFC, 0xFF, 0xF3, 0xF3, 0x87, 0x0E, 0x1C, 0x1C, 0x60, 0x73, 0x80, 135 | 0xEC, 0x03, 0xF0, 0x07, 0x80, 0x1E, 0x00, 0x78, 0x00, 0xF8, 0x7F, 0xE1, 136 | 0xF7, 0x39, 0x8C, 0xE6, 0x37, 0xB0, 0xFF, 0xC3, 0xFF, 0x07, 0xBC, 0x1C, 137 | 0xF0, 0x73, 0x81, 0x86, 0x00, 0x7C, 0xF9, 0xF3, 0xE3, 0xCF, 0x07, 0xF8, 138 | 0x0F, 0xC0, 0x1E, 0x00, 0xFC, 0x07, 0x38, 0x38, 0x73, 0xF3, 0xFF, 0xCF, 139 | 0xC0, 0xF9, 0xFF, 0x9F, 0x70, 0xE3, 0x0C, 0x39, 0xC1, 0x98, 0x19, 0x81, 140 | 0xF8, 0x0F, 0x00, 0xF0, 0x06, 0x00, 0x60, 0x0E, 0x00, 0xC0, 0xFF, 0x0F, 141 | 0xF0, 0x7F, 0xCF, 0xF9, 0x8E, 0x33, 0x80, 0x70, 0x1C, 0x07, 0x01, 0xC6, 142 | 0x70, 0xFF, 0xFF, 0xFF, 0x80, 0x0E, 0x3C, 0x60, 0xC1, 0x83, 0x06, 0x0C, 143 | 0x39, 0xE3, 0xC0, 0xC1, 0x83, 0x06, 0x0C, 0x18, 0x3C, 0x38, 0xFF, 0xFF, 144 | 0xFF, 0xFF, 0xF0, 0xE1, 0xC0, 0xC1, 0x83, 0x06, 0x0C, 0x18, 0x30, 0x3C, 145 | 0x79, 0x83, 0x06, 0x0C, 0x18, 0x31, 0xE3, 0x80, 0x3C, 0x37, 0xE7, 0x67, 146 | 0xE6, 0x1C }; 147 | 148 | const GFXglyph FreeMonoBold12pt7bGlyphs[] = { 149 | { 0, 0, 0, 14, 0, 1 }, // 0x20 ' ' 150 | { 0, 4, 15, 14, 5, -14 }, // 0x21 '!' 151 | { 8, 8, 7, 14, 3, -13 }, // 0x22 '"' 152 | { 15, 11, 18, 14, 2, -15 }, // 0x23 '#' 153 | { 40, 10, 20, 14, 2, -16 }, // 0x24 '$' 154 | { 65, 10, 15, 14, 2, -14 }, // 0x25 '%' 155 | { 84, 10, 13, 14, 2, -12 }, // 0x26 '&' 156 | { 101, 3, 7, 14, 5, -13 }, // 0x27 ''' 157 | { 104, 5, 19, 14, 6, -14 }, // 0x28 '(' 158 | { 116, 5, 19, 14, 3, -14 }, // 0x29 ')' 159 | { 128, 10, 10, 14, 2, -14 }, // 0x2A '*' 160 | { 141, 12, 13, 14, 1, -12 }, // 0x2B '+' 161 | { 161, 5, 7, 14, 4, -2 }, // 0x2C ',' 162 | { 166, 12, 2, 14, 1, -7 }, // 0x2D '-' 163 | { 169, 3, 3, 14, 5, -2 }, // 0x2E '.' 164 | { 171, 10, 20, 14, 2, -16 }, // 0x2F '/' 165 | { 196, 10, 15, 14, 2, -14 }, // 0x30 '0' 166 | { 215, 10, 15, 14, 2, -14 }, // 0x31 '1' 167 | { 234, 10, 15, 14, 2, -14 }, // 0x32 '2' 168 | { 253, 11, 15, 14, 1, -14 }, // 0x33 '3' 169 | { 274, 9, 14, 14, 2, -13 }, // 0x34 '4' 170 | { 290, 10, 15, 14, 2, -14 }, // 0x35 '5' 171 | { 309, 10, 15, 14, 2, -14 }, // 0x36 '6' 172 | { 328, 10, 15, 14, 2, -14 }, // 0x37 '7' 173 | { 347, 10, 15, 14, 2, -14 }, // 0x38 '8' 174 | { 366, 10, 15, 14, 3, -14 }, // 0x39 '9' 175 | { 385, 3, 11, 14, 5, -10 }, // 0x3A ':' 176 | { 390, 4, 15, 14, 4, -10 }, // 0x3B ';' 177 | { 398, 12, 11, 14, 1, -11 }, // 0x3C '<' 178 | { 415, 12, 7, 14, 1, -9 }, // 0x3D '=' 179 | { 426, 12, 11, 14, 1, -11 }, // 0x3E '>' 180 | { 443, 9, 14, 14, 3, -13 }, // 0x3F '?' 181 | { 459, 11, 19, 14, 2, -14 }, // 0x40 '@' 182 | { 486, 15, 14, 14, -1, -13 }, // 0x41 'A' 183 | { 513, 13, 14, 14, 0, -13 }, // 0x42 'B' 184 | { 536, 12, 14, 14, 1, -13 }, // 0x43 'C' 185 | { 557, 12, 14, 14, 1, -13 }, // 0x44 'D' 186 | { 578, 13, 14, 14, 0, -13 }, // 0x45 'E' 187 | { 601, 13, 14, 14, 0, -13 }, // 0x46 'F' 188 | { 624, 13, 14, 14, 1, -13 }, // 0x47 'G' 189 | { 647, 14, 14, 14, 0, -13 }, // 0x48 'H' 190 | { 672, 10, 14, 14, 2, -13 }, // 0x49 'I' 191 | { 690, 13, 14, 14, 1, -13 }, // 0x4A 'J' 192 | { 713, 14, 14, 14, 0, -13 }, // 0x4B 'K' 193 | { 738, 12, 14, 14, 1, -13 }, // 0x4C 'L' 194 | { 759, 14, 14, 14, 0, -13 }, // 0x4D 'M' 195 | { 784, 13, 14, 14, 0, -13 }, // 0x4E 'N' 196 | { 807, 12, 14, 14, 1, -13 }, // 0x4F 'O' 197 | { 828, 12, 14, 14, 0, -13 }, // 0x50 'P' 198 | { 849, 12, 17, 14, 1, -13 }, // 0x51 'Q' 199 | { 875, 14, 14, 14, 0, -13 }, // 0x52 'R' 200 | { 900, 10, 14, 14, 2, -13 }, // 0x53 'S' 201 | { 918, 12, 14, 14, 1, -13 }, // 0x54 'T' 202 | { 939, 12, 14, 14, 1, -13 }, // 0x55 'U' 203 | { 960, 16, 14, 14, -1, -13 }, // 0x56 'V' 204 | { 988, 14, 14, 14, 0, -13 }, // 0x57 'W' 205 | { 1013, 14, 14, 14, 0, -13 }, // 0x58 'X' 206 | { 1038, 12, 14, 14, 1, -13 }, // 0x59 'Y' 207 | { 1059, 10, 14, 14, 2, -13 }, // 0x5A 'Z' 208 | { 1077, 5, 19, 14, 6, -14 }, // 0x5B '[' 209 | { 1089, 10, 20, 14, 2, -16 }, // 0x5C '\' 210 | { 1114, 5, 19, 14, 3, -14 }, // 0x5D ']' 211 | { 1126, 10, 8, 14, 2, -15 }, // 0x5E '^' 212 | { 1136, 14, 2, 14, 0, 4 }, // 0x5F '_' 213 | { 1140, 4, 4, 14, 4, -15 }, // 0x60 '`' 214 | { 1142, 12, 11, 14, 1, -10 }, // 0x61 'a' 215 | { 1159, 13, 15, 14, 0, -14 }, // 0x62 'b' 216 | { 1184, 12, 11, 14, 1, -10 }, // 0x63 'c' 217 | { 1201, 13, 15, 14, 1, -14 }, // 0x64 'd' 218 | { 1226, 12, 11, 14, 1, -10 }, // 0x65 'e' 219 | { 1243, 11, 15, 14, 2, -14 }, // 0x66 'f' 220 | { 1264, 13, 16, 14, 1, -10 }, // 0x67 'g' 221 | { 1290, 14, 15, 14, 0, -14 }, // 0x68 'h' 222 | { 1317, 11, 14, 14, 1, -13 }, // 0x69 'i' 223 | { 1337, 8, 19, 15, 3, -13 }, // 0x6A 'j' 224 | { 1356, 13, 15, 14, 1, -14 }, // 0x6B 'k' 225 | { 1381, 11, 15, 14, 1, -14 }, // 0x6C 'l' 226 | { 1402, 15, 11, 14, 0, -10 }, // 0x6D 'm' 227 | { 1423, 14, 11, 14, 0, -10 }, // 0x6E 'n' 228 | { 1443, 12, 11, 14, 1, -10 }, // 0x6F 'o' 229 | { 1460, 14, 16, 14, 0, -10 }, // 0x70 'p' 230 | { 1488, 14, 16, 14, 0, -10 }, // 0x71 'q' 231 | { 1516, 12, 11, 14, 1, -10 }, // 0x72 'r' 232 | { 1533, 10, 11, 14, 2, -10 }, // 0x73 's' 233 | { 1547, 11, 14, 14, 1, -13 }, // 0x74 't' 234 | { 1567, 13, 11, 14, 0, -10 }, // 0x75 'u' 235 | { 1585, 14, 11, 14, 0, -10 }, // 0x76 'v' 236 | { 1605, 14, 11, 14, 0, -10 }, // 0x77 'w' 237 | { 1625, 14, 11, 14, 0, -10 }, // 0x78 'x' 238 | { 1645, 12, 16, 14, 1, -10 }, // 0x79 'y' 239 | { 1669, 11, 11, 14, 1, -10 }, // 0x7A 'z' 240 | { 1685, 7, 19, 14, 3, -14 }, // 0x7B '{' 241 | { 1702, 2, 19, 14, 6, -14 }, // 0x7C '|' 242 | { 1707, 7, 19, 14, 4, -14 }, // 0x7D '}' 243 | { 1724, 12, 4, 14, 1, -7 } }; // 0x7E '~' 244 | 245 | const GFXfont FreeMonoBold12pt7b = { 246 | (uint8_t *)FreeMonoBold12pt7bBitmaps, 247 | (GFXglyph *)FreeMonoBold12pt7bGlyphs, 248 | 0x20, 0x7E, 24, 17 }; 249 | 250 | // Approx. 2402 bytes 251 | -------------------------------------------------------------------------------- /components/fb_gfx/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS := include 2 | COMPONENT_SRCDIRS := . 3 | -------------------------------------------------------------------------------- /components/fb_gfx/fb_gfx.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #include "stdint.h" 15 | #include "stdarg.h" 16 | #include "string.h" 17 | #include "stdio.h" 18 | #include "stdlib.h" 19 | #include "fb_gfx.h" 20 | 21 | typedef struct { // Data stored PER GLYPH 22 | uint16_t bitmapOffset; // Pointer into GFXfont->bitmap 23 | uint8_t width, height; // Bitmap dimensions in pixels 24 | uint8_t xAdvance; // Distance to advance cursor (x axis) 25 | int8_t xOffset, yOffset; // Dist from cursor pos to UL corner 26 | } GFXglyph; 27 | 28 | typedef struct { // Data stored for FONT AS A WHOLE: 29 | uint8_t *bitmap; // Glyph bitmaps, concatenated 30 | GFXglyph *glyph; // Glyph array 31 | uint8_t first, last; // ASCII extents 32 | uint8_t yAdvance; // Newline distance (y axis) 33 | uint8_t yOffset; // Y offset of the font zero line (y axis) 34 | } GFXfont; 35 | 36 | #include "FreeMonoBold12pt7b.h"//14x24 37 | #define gfxFont ((GFXfont*)(&FreeMonoBold12pt7b)) 38 | 39 | void fb_gfx_fillRect(fb_data_t *fb, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color) 40 | { 41 | int32_t line_step = (fb->width - w) * fb->bytes_per_pixel; 42 | uint8_t *data = fb->data + ((x + (y * fb->width)) * fb->bytes_per_pixel); 43 | uint8_t c0 = color >> 16; 44 | uint8_t c1 = color >> 8; 45 | uint8_t c2 = color; 46 | for (int i=0; ibytes_per_pixel == 2){ 49 | data[0] = c1; 50 | data[1] = c2; 51 | } else if(fb->bytes_per_pixel == 1){ 52 | data[0] = c2; 53 | } else { 54 | data[0] = c0; 55 | data[1] = c1; 56 | data[2] = c2; 57 | } 58 | data+=fb->bytes_per_pixel; 59 | } 60 | data += line_step; 61 | } 62 | } 63 | 64 | void fb_gfx_drawFastHLine(fb_data_t *fb, int32_t x, int32_t y, int32_t w, uint32_t color) 65 | { 66 | fb_gfx_fillRect(fb, x, y, w, 1, color); 67 | } 68 | 69 | void fb_gfx_drawFastVLine(fb_data_t *fb, int32_t x, int32_t y, int32_t h, uint32_t color) 70 | { 71 | fb_gfx_fillRect(fb, x, y, 1, h, color); 72 | } 73 | 74 | uint8_t fb_gfx_putc(fb_data_t *fb, int32_t x, int32_t y, uint32_t color, unsigned char c) 75 | { 76 | uint16_t line_width; 77 | uint8_t xa = 0, bit = 0, bits = 0, xx, yy; 78 | uint8_t *bitmap; 79 | GFXglyph *glyph; 80 | 81 | if ((c < 32) || (c < gfxFont->first) || (c > gfxFont->last)) { 82 | return xa; 83 | } 84 | 85 | c -= gfxFont->first; 86 | 87 | glyph = &(gfxFont->glyph[c]); 88 | bitmap = gfxFont->bitmap + glyph->bitmapOffset; 89 | 90 | xa = glyph->xAdvance; 91 | x += glyph->xOffset; 92 | y += glyph->yOffset; 93 | y += gfxFont->yOffset; 94 | line_width = 0; 95 | 96 | for(yy=0; yyheight; yy++) { 97 | for(xx=0; xxwidth; xx++) { 98 | if(bit == 0) { 99 | bits = *bitmap++; 100 | bit = 0x80; 101 | } 102 | if(bits & bit) { 103 | line_width++; 104 | } else if (line_width) { 105 | fb_gfx_drawFastHLine(fb, x+xx-line_width, y+yy, line_width, color); 106 | line_width=0; 107 | } 108 | bit >>= 1; 109 | } 110 | if (line_width) { 111 | fb_gfx_drawFastHLine(fb, x+xx-line_width, y+yy, line_width, color); 112 | line_width=0; 113 | } 114 | } 115 | return xa; 116 | } 117 | 118 | uint32_t fb_gfx_print(fb_data_t *fb, int32_t x, int32_t y, uint32_t color, const char * str) 119 | { 120 | uint32_t l = 0; 121 | int xc = x, yc = y, lc = fb->width - gfxFont->glyph[0].xAdvance; 122 | uint8_t fh = gfxFont->yAdvance; 123 | char c = *str++; 124 | while(c){ 125 | if(c != '\r'){ 126 | if(c == '\n'){ 127 | yc += fh; 128 | xc = x; 129 | } else { 130 | if(xc > lc){ 131 | yc += fh; 132 | xc = x; 133 | } 134 | xc += fb_gfx_putc(fb, xc, yc, color, c); 135 | } 136 | } 137 | l++; 138 | c = *str++; 139 | } 140 | return l; 141 | } 142 | 143 | uint32_t fb_gfx_printf(fb_data_t *fb, int32_t x, int32_t y, uint32_t color, const char *format, ...) 144 | { 145 | char loc_buf[64]; 146 | char * temp = loc_buf; 147 | int len; 148 | va_list arg; 149 | va_list copy; 150 | va_start(arg, format); 151 | va_copy(copy, arg); 152 | len = vsnprintf(loc_buf, sizeof(loc_buf), format, arg); 153 | va_end(copy); 154 | if(len >= sizeof(loc_buf)){ 155 | temp = (char*)malloc(len+1); 156 | if(temp == NULL) { 157 | return 0; 158 | } 159 | } 160 | vsnprintf(temp, len+1, format, arg); 161 | va_end(arg); 162 | fb_gfx_print(fb, x, y, color, temp); 163 | if(len > 64){ 164 | free(temp); 165 | } 166 | return len; 167 | } 168 | -------------------------------------------------------------------------------- /components/fb_gfx/include/fb_gfx.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #ifndef _FB_GFX_H_ 15 | #define _FB_GFX_H_ 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef enum { 22 | FB_RGB888, FB_BGR888, FB_RGB565, FB_BGR565, FB_GRAY 23 | } fb_format_t; 24 | 25 | typedef struct { 26 | int width; 27 | int height; 28 | int bytes_per_pixel; 29 | fb_format_t format; 30 | uint8_t * data; 31 | } fb_data_t; 32 | 33 | void fb_gfx_fillRect (fb_data_t *fb, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color); 34 | void fb_gfx_drawFastHLine(fb_data_t *fb, int32_t x, int32_t y, int32_t w, uint32_t color); 35 | void fb_gfx_drawFastVLine(fb_data_t *fb, int32_t x, int32_t y, int32_t h, uint32_t color); 36 | uint8_t fb_gfx_putc (fb_data_t *fb, int32_t x, int32_t y, uint32_t color, unsigned char c); 37 | uint32_t fb_gfx_print (fb_data_t *fb, int32_t x, int32_t y, uint32_t color, const char * str); 38 | uint32_t fb_gfx_printf (fb_data_t *fb, int32_t x, int32_t y, uint32_t color, const char *format, ...); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* _FB_GFX_H_ */ 45 | -------------------------------------------------------------------------------- /configs/builds.json: -------------------------------------------------------------------------------- 1 | { 2 | "mem_variants_files":[ 3 | { 4 | "file":"libspi_flash.a", 5 | "src":"build/esp-idf/spi_flash/libspi_flash.a", 6 | "out":"lib/libspi_flash.a", 7 | "targets":["esp32","esp32c2","esp32c3","esp32s2","esp32s3","esp32c6","esp32h2","esp32p4"] 8 | }, 9 | { 10 | "file":"libesp_psram.a", 11 | "src":"build/esp-idf/esp_psram/libesp_psram.a", 12 | "out":"lib/libesp_psram.a", 13 | "targets":["esp32s3"] 14 | }, 15 | { 16 | "file":"libesp_system.a", 17 | "src":"build/esp-idf/esp_system/libesp_system.a", 18 | "out":"lib/libesp_system.a", 19 | "targets":["esp32s3"] 20 | }, 21 | { 22 | "file":"libfreertos.a", 23 | "src":"build/esp-idf/freertos/libfreertos.a", 24 | "out":"lib/libfreertos.a", 25 | "targets":["esp32s3"] 26 | }, 27 | { 28 | "file":"libbootloader_support.a", 29 | "src":"build/esp-idf/bootloader_support/libbootloader_support.a", 30 | "out":"lib/libbootloader_support.a", 31 | "targets":["esp32s3"] 32 | }, 33 | { 34 | "file":"libesp_hw_support.a", 35 | "src":"build/esp-idf/esp_hw_support/libesp_hw_support.a", 36 | "out":"lib/libesp_hw_support.a", 37 | "targets":["esp32s3"] 38 | }, 39 | { 40 | "file":"libesp_lcd.a", 41 | "src":"build/esp-idf/esp_lcd/libesp_lcd.a", 42 | "out":"lib/libesp_lcd.a", 43 | "targets":["esp32s3"] 44 | }, 45 | { 46 | "file":"sections.ld", 47 | "src":"build/esp-idf/esp_system/ld/sections.ld", 48 | "out":"ld/sections.ld", 49 | "targets":["esp32s3"] 50 | } 51 | ], 52 | "targets":[ 53 | { 54 | "target": "esp32c2", 55 | "features":[], 56 | "idf_libs":["qio","60m"], 57 | "bootloaders":[ 58 | ["qio","60m"], 59 | ["dio","60m"], 60 | ["qio","30m"], 61 | ["dio","30m"] 62 | ], 63 | "mem_variants":[ 64 | ["dio","60m"] 65 | ] 66 | }, 67 | { 68 | "target": "esp32h2", 69 | "features":[], 70 | "idf_libs":["qio","64m"], 71 | "bootloaders":[ 72 | ["qio","64m"], 73 | ["dio","64m"], 74 | ["qio","16m"], 75 | ["dio","16m"] 76 | ], 77 | "mem_variants":[ 78 | ["dio","64m"] 79 | ] 80 | }, 81 | { 82 | "target": "esp32c6", 83 | "features":[], 84 | "idf_libs":["qio","80m"], 85 | "bootloaders":[ 86 | ["qio","80m"], 87 | ["dio","80m"], 88 | ["qio","40m"], 89 | ["dio","40m"] 90 | ], 91 | "mem_variants":[ 92 | ["dio","80m"] 93 | ] 94 | }, 95 | { 96 | "target": "esp32p4", 97 | "features":["qio_ram"], 98 | "idf_libs":["qio","80m"], 99 | "bootloaders":[ 100 | ["qio","80m"], 101 | ["dio","80m"], 102 | ["qio","40m"], 103 | ["dio","40m"] 104 | ], 105 | "mem_variants":[ 106 | ["dio","80m"] 107 | ] 108 | }, 109 | { 110 | "target": "esp32c3", 111 | "features":[], 112 | "idf_libs":["qio","80m"], 113 | "bootloaders":[ 114 | ["qio","80m"], 115 | ["dio","80m"], 116 | ["qio","40m"], 117 | ["dio","40m"] 118 | ], 119 | "mem_variants":[ 120 | ["dio","80m"] 121 | ] 122 | }, 123 | { 124 | "target": "esp32", 125 | "features":["qio_ram"], 126 | "idf_libs":["qio","80m"], 127 | "bootloaders":[ 128 | ["qio","80m"], 129 | ["dio","80m"], 130 | ["qio","40m"], 131 | ["dio","40m"] 132 | ], 133 | "mem_variants":[ 134 | ["dio","80m"] 135 | ] 136 | }, 137 | { 138 | "target": "esp32s2", 139 | "features":["qio_ram"], 140 | "idf_libs":["qio","80m"], 141 | "bootloaders":[ 142 | ["qio","80m"], 143 | ["dio","80m"], 144 | ["qio","40m"], 145 | ["dio","40m"] 146 | ], 147 | "mem_variants":[ 148 | ["dio","80m"] 149 | ] 150 | }, 151 | { 152 | "target": "esp32s3", 153 | "features":[], 154 | "idf_libs":["qio","80m","qio_ram"], 155 | "bootloaders":[ 156 | ["qio","120m","qio_ram"], 157 | ["qio","80m","qio_ram"], 158 | ["dio","80m","qio_ram"], 159 | ["opi","80m","opi_ram"] 160 | ], 161 | "mem_variants":[ 162 | ["qio","80m","opi_ram"], 163 | ["dio","80m","qio_ram"], 164 | ["dio","80m","opi_ram"], 165 | ["opi","80m","opi_ram"] 166 | ] 167 | } 168 | ] 169 | } 170 | -------------------------------------------------------------------------------- /configs/defconfig.120m: -------------------------------------------------------------------------------- 1 | CONFIG_IDF_EXPERIMENTAL_FEATURES=y 2 | CONFIG_ESPTOOLPY_FLASHFREQ_120M=y 3 | CONFIG_SPIRAM_SPEED_120M=y 4 | CONFIG_SPIRAM_SPEED=120 5 | # CONFIG_SPI_FLASH_HPM_ENA=y 6 | CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y 7 | -------------------------------------------------------------------------------- /configs/defconfig.16m: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHFREQ_16M=y 2 | -------------------------------------------------------------------------------- /configs/defconfig.30m: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHFREQ_30M=y 2 | -------------------------------------------------------------------------------- /configs/defconfig.40m: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHFREQ_40M=y 2 | CONFIG_SPIRAM_SPEED_40M=y 3 | CONFIG_SPIRAM_SPEED=40 4 | -------------------------------------------------------------------------------- /configs/defconfig.60m: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHFREQ_60M=y 2 | -------------------------------------------------------------------------------- /configs/defconfig.64m: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHFREQ_64M=y 2 | -------------------------------------------------------------------------------- /configs/defconfig.80m: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 2 | CONFIG_SPIRAM_SPEED_80M=y 3 | CONFIG_SPIRAM_SPEED=80 4 | -------------------------------------------------------------------------------- /configs/defconfig.common: -------------------------------------------------------------------------------- 1 | CONFIG_AUTOSTART_ARDUINO=y 2 | # CONFIG_WS2812_LED_ENABLE is not set 3 | CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y 4 | CONFIG_APP_REPRODUCIBLE_BUILD=y 5 | CONFIG_COMPILER_HIDE_PATHS_MACROS=y 6 | CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y 7 | CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y 8 | # CONFIG_APP_COMPILE_TIME_DATE is not set 9 | CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y 10 | CONFIG_BOOT_ROM_LOG_ALWAYS_OFF=y 11 | CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y 12 | CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y 13 | CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y 14 | CONFIG_I2S_ISR_IRAM_SAFE=y 15 | CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y 16 | CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y 17 | CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y 18 | CONFIG_COMPILER_OPTIMIZATION_SIZE=y 19 | CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y 20 | CONFIG_COMPILER_DISABLE_GCC12_WARNINGS=y 21 | CONFIG_COMPILER_DISABLE_GCC13_WARNINGS=y 22 | CONFIG_COMPILER_DISABLE_GCC14_WARNINGS=y 23 | CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y 24 | CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y 25 | CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y 26 | # CONFIG_COMPILER_CXX_EXCEPTIONS is not set 27 | # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set 28 | # CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set 29 | # CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR is not set 30 | CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y 31 | # CONFIG_ESP_HTTPS_SERVER_ENABLE is not set 32 | # CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set 33 | # CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set 34 | CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y 35 | CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM=y 36 | CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 37 | CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 38 | CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 39 | CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048 40 | CONFIG_ESP_TASK_WDT_PANIC=y 41 | # CONFIG_ESP_SYSTEM_HW_STACK_GUARD is not set 42 | CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 43 | CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y 44 | CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y 45 | # CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set 46 | # CONFIG_ESP_WIFI_FTM_ENABLE is not set 47 | # CONFIG_ESP_WIFI_GMAC_SUPPORT is not set 48 | # CONFIG_ESP_WIFI_CSI_ENABLED is not set 49 | # CONFIG_ESP_WIFI_ENABLE_WPA3_SAE is not set 50 | # CONFIG_ESP_WIFI_ENABLE_SAE_PK is not set 51 | # CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set 52 | # CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set 53 | # CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT is not set 54 | # CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set 55 | CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 56 | # CONFIG_ESP_WIFI_IRAM_OPT is not set 57 | # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set 58 | CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 59 | CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 60 | CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 61 | CONFIG_ESP_PHY_REDUCE_TX_POWER=y 62 | CONFIG_ETH_TRANSMIT_MUTEX=y 63 | CONFIG_ETH_SPI_ETHERNET_DM9051=y 64 | CONFIG_ETH_SPI_ETHERNET_W5500=y 65 | CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL=y 66 | CONFIG_FATFS_CODEPAGE_850=y 67 | CONFIG_FATFS_LFN_STACK=y 68 | # CONFIG_FATFS_API_ENCODING_ANSI_OEM is not set 69 | CONFIG_FATFS_API_ENCODING_UTF_8=y 70 | # CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set 71 | CONFIG_FMB_TIMER_PORT_ENABLED=y 72 | CONFIG_FREERTOS_HZ=1000 73 | # CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set 74 | # CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is not set 75 | # CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT is not set 76 | CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 77 | # CONFIG_FREERTOS_FPU_IN_ISR is not set 78 | CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y 79 | CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y 80 | CONFIG_HAL_ASSERTION_DISABLE=y 81 | CONFIG_HEAP_POISONING_DISABLED=y 82 | CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 83 | CONFIG_HTTPD_WS_SUPPORT=y 84 | CONFIG_LOG_DEFAULT_LEVEL_NONE=y 85 | # CONFIG_LOG_COLORS is not set 86 | CONFIG_LWIP_LOCAL_HOSTNAME="tasmota" 87 | CONFIG_LWIP_MAX_SOCKETS=16 88 | CONFIG_LWIP_SO_RCVBUF=y 89 | CONFIG_LWIP_IP_FORWARD=y 90 | CONFIG_LWIP_IPV4_NAPT=y 91 | # CONFIG_LWIP_DHCP_DOES_ARP_CHECK is not set 92 | CONFIG_LWIP_TCP_SYNMAXRTX=6 93 | CONFIG_LWIP_TCP_MSS=1436 94 | CONFIG_LWIP_TCP_RTO_TIME=3000 95 | CONFIG_LWIP_TCP_MSL=6000 96 | CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=2000 97 | CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560 98 | CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y 99 | CONFIG_LWIP_IPV6_AUTOCONFIG=y 100 | CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 101 | CONFIG_LWIP_MAX_SOCKETS=16 102 | CONFIG_LWIP_DHCP_RESTORE_LAST_IP=n 103 | CONFIG_LWIP_DHCP_OPTIONS_LEN=128 104 | CONFIG_LWIP_SNTP_MAX_SERVERS=3 105 | # CONFIG_LWIP_DHCP_GET_NTP_SRV is not set 106 | CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 107 | CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 108 | CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 109 | CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 110 | CONFIG_NEWLIB_NANO_FORMAT=y 111 | # CONFIG_DAC_DMA_AUTO_16BIT_ALIGN is not set 112 | 113 | CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y 114 | CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y 115 | CONFIG_MBEDTLS_TLS_DISABLED=y 116 | # CONFIG_MBEDTLS_TLS_ENABLED is not set 117 | # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set 118 | CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=180 119 | # CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set 120 | # CONFIG_MBEDTLS_PKCS7_C is not set 121 | # CONFIG_MBEDTLS_ERROR_STRINGS is not set 122 | 123 | # 124 | # Symmetric Ciphers 125 | # 126 | CONFIG_MBEDTLS_AES_C=y 127 | # CONFIG_MBEDTLS_CAMELLIA_C is not set 128 | # CONFIG_MBEDTLS_DES_C is not set 129 | # CONFIG_MBEDTLS_BLOWFISH_C is not set 130 | # CONFIG_MBEDTLS_XTEA_C is not set 131 | # CONFIG_MBEDTLS_CCM_C is not set 132 | # CONFIG_MBEDTLS_GCM_C is not set 133 | # CONFIG_MBEDTLS_NIST_KW_C is not set 134 | # end of Symmetric Ciphers 135 | 136 | 137 | # 138 | # TLS Key Exchange Methods 139 | # 140 | 141 | CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y 142 | # CONFIG_MBEDTLS_PSK_MODES is not set 143 | # CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set 144 | # CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA is not set 145 | # CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA is not set 146 | # CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA is not set 147 | # CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA is not set 148 | 149 | CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y 150 | # CONFIG_MBEDTLS_SSL_RENEGOTIATION is not set 151 | # CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set 152 | # CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set 153 | # CONFIG_MBEDTLS_SSL_ALPN is not set 154 | # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set 155 | 156 | CONFIG_MBEDTLS_CMAC_C=y 157 | CONFIG_MBEDTLS_ROM_MD5=y 158 | CONFIG_MBEDTLS_HARDWARE_ECC=y 159 | CONFIG_MBEDTLS_HARDWARE_AES=y 160 | CONFIG_MBEDTLS_HARDWARE_MPI=y 161 | # CONFIG_MBEDTLS_HARDWARE_SHA is not set 162 | # CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK is not set 163 | # CONFIG_MBEDTLS_HAVE_TIME is not set 164 | # CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set 165 | # CONFIG_MBEDTLS_SHA512_C is not set 166 | # CONFIG_MBEDTLS_RIPEMD160_C is not set 167 | 168 | # 169 | # Certificates 170 | # 171 | # CONFIG_MBEDTLS_PEM_PARSE_C is not set 172 | # CONFIG_MBEDTLS_PEM_WRITE_C is not set 173 | # CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set 174 | # CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set 175 | # end of Certificates 176 | 177 | CONFIG_MBEDTLS_ECP_C=y 178 | CONFIG_MBEDTLS_ECDH_C=y 179 | CONFIG_MBEDTLS_ECDSA_C=y 180 | CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y 181 | # CONFIG_MBEDTLS_SHA1_C is not set 182 | # CONFIG_MBEDTLS_SHA1_ALT is not set 183 | # CONFIG_MBEDTLS_DHM_C is not set 184 | # CONFIG_MBEDTLS_ECJPAKE_C is not set 185 | # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set 186 | # CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set 187 | # CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set 188 | # CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set 189 | # CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set 190 | # CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set 191 | # CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set 192 | # CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set 193 | # CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED is not set 194 | # CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED is not set 195 | # CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set 196 | # CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set 197 | # CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set 198 | # CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set 199 | # CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set 200 | # CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set 201 | # CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set 202 | 203 | CONFIG_OPENSSL_ASSERT_DO_NOTHING=y 204 | CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 205 | CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y 206 | # CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE is not set 207 | CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y 208 | CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10 209 | CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2 210 | CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 211 | # CONFIG_UNITY_ENABLE_FLOAT is not set 212 | # CONFIG_UNITY_ENABLE_DOUBLE is not set 213 | # CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set 214 | # CONFIG_USE_WAKENET is not set 215 | # CONFIG_USE_MULTINET is not set 216 | # CONFIG_MBEDTLS_FS_IO is not set 217 | # CONFIG_VFS_SUPPORT_SELECT is not set 218 | # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set 219 | # CONFIG_VFS_SUPPORT_TERMIOS is not set 220 | # CONFIG_SPI_MASTER_ISR_IN_IRAM is not set 221 | # CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set 222 | CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096 223 | CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0 224 | 225 | CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=1 226 | CONFIG_DSP_MAX_FFT_SIZE_1024=y 227 | 228 | CONFIG_LITTLEFS_MAX_PARTITIONS=2 229 | CONFIG_LITTLEFS_MULTIVERSION=y 230 | CONFIG_LITTLEFS_DISK_VERSION_2_0=y 231 | 232 | # 233 | # TinyUSB Config 234 | # 235 | CONFIG_TINYUSB_CDC_MAX_PORTS=2 236 | CONFIG_USB_HOST_HUBS_SUPPORTED=y 237 | CONFIG_USB_HOST_HUB_MULTI_LEVEL=y 238 | CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT=y 239 | 240 | # 241 | # Disable Cameras not used 242 | # 243 | # CONFIG_OV7670_SUPPORT is not set 244 | # CONFIG_OV7725_SUPPORT is not set 245 | # CONFIG_NT99141_SUPPORT is not set 246 | # CONFIG_GC2145_SUPPORT is not set 247 | # CONFIG_GC032A_SUPPORT is not set 248 | # CONFIG_GC0308_SUPPORT is not set 249 | # CONFIG_BF3005_SUPPORT is not set 250 | # CONFIG_BF20A6_SUPPORT is not set 251 | # CONFIG_SC030IOT_SUPPORT is not set 252 | -------------------------------------------------------------------------------- /configs/defconfig.dio: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHMODE_DIO=y -------------------------------------------------------------------------------- /configs/defconfig.esp32: -------------------------------------------------------------------------------- 1 | # 2 | # Bluetooth 3 | # 4 | CONFIG_BT_ENABLED=y 5 | CONFIG_BT_STACK_NO_LOG=y 6 | # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set 7 | # CONFIG_BLE_MESH is not set 8 | CONFIG_BT_NIMBLE_ENABLED=y 9 | CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y 10 | CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 11 | # CONFIG_BT_NIMBLE_NVS_PERSIST is not set 12 | # CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set 13 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set 14 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set 15 | # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set 16 | # CONFIG_BTDM_CTRL_MODE_BTDM is not set 17 | # CONFIG_BT_BTC_TASK_STACK_SIZE is not set 18 | # CONFIG_BT_BTU_TASK_STACK_SIZE is not set 19 | CONFIG_BT_STACK_NO_LOG=y 20 | CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y 21 | 22 | # Enable ULP 23 | CONFIG_ULP_COPROC_ENABLED=y 24 | CONFIG_ULP_COPROC_TYPE_FSM=y 25 | CONFIG_ULP_COPROC_RESERVE_MEM=4096 26 | 27 | CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR=y 28 | 29 | CONFIG_ETH_ENABLED=y 30 | CONFIG_ETH_USE_ESP32_EMAC=y 31 | CONFIG_ETH_PHY_INTERFACE_RMII=y 32 | CONFIG_ETH_USE_SPI_ETHERNET=y 33 | 34 | CONFIG_SPIRAM=y 35 | CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y 36 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set 37 | # CONFIG_UNITY_ENABLE_FLOAT is not set 38 | # CONFIG_UNITY_ENABLE_DOUBLE is not set 39 | # CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set 40 | # CONFIG_USE_WAKENET is not set 41 | # CONFIG_USE_MULTINET is not set 42 | # CONFIG_VFS_SUPPORT_SELECT is not set 43 | # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set 44 | # CONFIG_VFS_SUPPORT_TERMIOS is not set 45 | CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC=y 46 | CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST=y 47 | CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID=y 48 | CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT=y 49 | CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y 50 | 51 | # 52 | # PPP 53 | # 54 | CONFIG_LWIP_PPP_SUPPORT=y 55 | CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y 56 | CONFIG_LWIP_PPP_PAP_SUPPORT=y 57 | CONFIG_LWIP_PPP_ENABLE_IPV6=n 58 | -------------------------------------------------------------------------------- /configs/defconfig.esp32c2: -------------------------------------------------------------------------------- 1 | CONFIG_XTAL_FREQ_26=y 2 | CONFIG_XTAL_FREQ=26 3 | 4 | CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y 5 | 6 | # 7 | # Bluetooth 8 | # 9 | CONFIG_BT_ENABLED=y 10 | CONFIG_BT_STACK_NO_LOG=y 11 | # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set 12 | # CONFIG_BLE_MESH is not set 13 | CONFIG_BT_NIMBLE_ENABLED=y 14 | CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y 15 | CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 16 | # CONFIG_BT_NIMBLE_NVS_PERSIST is not set 17 | # CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set 18 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set 19 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set 20 | # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set 21 | 22 | CONFIG_RTC_CLK_CAL_CYCLES=576 23 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set 24 | CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 25 | 26 | # 27 | # Disable Ethernet 28 | # 29 | # CONFIG_ETH_ENABLED is not set 30 | # CONFIG_ETH_USE_ESP32_EMAC is not set 31 | # CONFIG_ETH_PHY_INTERFACE_RMII is not set 32 | # CONFIG_ETH_USE_SPI_ETHERNET is not set 33 | # CONFIG_ETH_TRANSMIT_MUTEX is not set 34 | # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set 35 | # CONFIG_ETH_SPI_ETHERNET_W5500 is not set 36 | # CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set 37 | -------------------------------------------------------------------------------- /configs/defconfig.esp32c3: -------------------------------------------------------------------------------- 1 | # 2 | # Bluetooth 3 | # 4 | CONFIG_BT_ENABLED=y 5 | CONFIG_BT_STACK_NO_LOG=y 6 | # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set 7 | # CONFIG_BLE_MESH is not set 8 | CONFIG_BT_NIMBLE_ENABLED=y 9 | CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y 10 | CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 11 | # CONFIG_BT_NIMBLE_NVS_PERSIST is not set 12 | # CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set 13 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set 14 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set 15 | # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set 16 | 17 | CONFIG_BT_CTRL_MODEM_SLEEP=y 18 | CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y 19 | CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y 20 | # CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set 21 | CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y 22 | CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y 23 | CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y 24 | CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y 25 | CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y 26 | CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y 27 | CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y 28 | CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y 29 | CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y 30 | CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y 31 | CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y 32 | CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y 33 | CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y 34 | CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y 35 | CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y 36 | CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y 37 | CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y 38 | CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y 39 | CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y 40 | CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y 41 | CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y 42 | CONFIG_RTC_CLK_CAL_CYCLES=576 43 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set 44 | CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 45 | -------------------------------------------------------------------------------- /configs/defconfig.esp32c6: -------------------------------------------------------------------------------- 1 | # C6 has full Newlib in Rom 2 | # CONFIG_NEWLIB_NANO_FORMAT is not set 3 | 4 | CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y 5 | 6 | # v0.0 C6 has reg i2c rom bug 7 | CONFIG_ESP_ROM_HAS_REGI2C_BUG=y 8 | 9 | # Enable LP Core 10 | CONFIG_ULP_COPROC_ENABLED=y 11 | CONFIG_ULP_COPROC_TYPE_LP_CORE=y 12 | CONFIG_ULP_COPROC_RESERVE_MEM=8192 13 | 14 | # 15 | # Bluetooth 16 | # 17 | CONFIG_BT_ENABLED=y 18 | CONFIG_BT_STACK_NO_LOG=y 19 | # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set 20 | # CONFIG_BLE_MESH is not set 21 | CONFIG_BT_NIMBLE_ENABLED=y 22 | CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y 23 | CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 24 | # CONFIG_BT_NIMBLE_NVS_PERSIST is not set 25 | # CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set 26 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set 27 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set 28 | # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set 29 | 30 | CONFIG_BT_CTRL_MODEM_SLEEP=y 31 | CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y 32 | CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y 33 | # CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set 34 | CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y 35 | CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y 36 | CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y 37 | CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y 38 | CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y 39 | CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y 40 | CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y 41 | CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y 42 | CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y 43 | CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y 44 | CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y 45 | CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y 46 | CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y 47 | CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y 48 | CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y 49 | CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y 50 | CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y 51 | CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y 52 | CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y 53 | CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y 54 | CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y 55 | CONFIG_RTC_CLK_CAL_CYCLES=576 56 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set 57 | CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 58 | -------------------------------------------------------------------------------- /configs/defconfig.esp32h2: -------------------------------------------------------------------------------- 1 | # 2 | # Bluetooth 3 | # 4 | CONFIG_BT_ENABLED=y 5 | CONFIG_BT_STACK_NO_LOG=y 6 | # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set 7 | # CONFIG_BLE_MESH is not set 8 | CONFIG_BT_NIMBLE_ENABLED=y 9 | CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y 10 | CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 11 | # CONFIG_BT_NIMBLE_NVS_PERSIST is not set 12 | # CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set 13 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set 14 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set 15 | # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set 16 | 17 | CONFIG_BT_CTRL_MODEM_SLEEP=y 18 | CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y 19 | CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y 20 | # CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set 21 | CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y 22 | CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y 23 | CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y 24 | CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y 25 | CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y 26 | CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y 27 | CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y 28 | CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y 29 | CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y 30 | CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y 31 | CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y 32 | CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y 33 | CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y 34 | CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y 35 | CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y 36 | CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y 37 | CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y 38 | CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y 39 | CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y 40 | CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y 41 | CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y 42 | CONFIG_RTC_CLK_CAL_CYCLES=576 43 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set 44 | CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 45 | 46 | # 47 | # PPP 48 | # 49 | CONFIG_LWIP_PPP_SUPPORT=y 50 | CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y 51 | CONFIG_LWIP_PPP_PAP_SUPPORT=y 52 | CONFIG_LWIP_PPP_ENABLE_IPV6=n 53 | -------------------------------------------------------------------------------- /configs/defconfig.esp32p4: -------------------------------------------------------------------------------- 1 | CONFIG_IDF_EXPERIMENTAL_FEATURES=y 2 | 3 | # Enable LP Core 4 | CONFIG_ULP_COPROC_ENABLED=y 5 | CONFIG_ULP_COPROC_TYPE_LP_CORE=y 6 | CONFIG_ULP_COPROC_RESERVE_MEM=8192 7 | 8 | CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_360=y 9 | CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y 10 | CONFIG_SPIRAM=y 11 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set 12 | CONFIG_LWIP_TCP_SACK_OUT=y 13 | CONFIG_SPIRAM_SPEED_200M=y 14 | CONFIG_SPIRAM_XIP_FROM_PSRAM=y 15 | CONFIG_RTC_CLK_CAL_CYCLES=576 16 | # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set 17 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set 18 | CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y 19 | CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 20 | CONFIG_CACHE_L2_CACHE_256KB=y 21 | CONFIG_CACHE_L2_CACHE_LINE_128B=y 22 | 23 | # RGB Display Optimizations 24 | CONFIG_LCD_RGB_ISR_IRAM_SAFE=y 25 | CONFIG_LCD_RGB_RESTART_IN_VSYNC=y 26 | 27 | CONFIG_SLAVE_IDF_TARGET_ESP32C6=y 28 | CONFIG_ESP_SDIO_BUS_WIDTH=4 29 | CONFIG_ESP_SDIO_CLOCK_FREQ_KHZ=40000 30 | CONFIG_ESP_SDIO_PIN_CMD=19 31 | CONFIG_ESP_SDIO_PIN_CLK=18 32 | CONFIG_ESP_SDIO_PIN_D0=14 33 | CONFIG_ESP_SDIO_PIN_D1=15 34 | CONFIG_ESP_SDIO_PIN_D2=16 35 | CONFIG_ESP_SDIO_PIN_D3=17 36 | 37 | # 38 | # PPP 39 | # 40 | CONFIG_LWIP_PPP_SUPPORT=y 41 | CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y 42 | CONFIG_LWIP_PPP_PAP_SUPPORT=y 43 | CONFIG_LWIP_PPP_ENABLE_IPV6=n 44 | -------------------------------------------------------------------------------- /configs/defconfig.esp32s2: -------------------------------------------------------------------------------- 1 | CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y 2 | CONFIG_SPIRAM=y 3 | CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y 4 | CONFIG_ESP32S2_KEEP_USB_ALIVE=y 5 | CONFIG_ULP_COPROC_ENABLED=y 6 | CONFIG_ESP32_ULP_COPROC_RISCV=y 7 | CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4096 8 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set 9 | # CONFIG_USE_WAKENET is not set 10 | # CONFIG_USE_MULTINET is not set 11 | CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y 12 | CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n 13 | # CONFIG_UNITY_ENABLE_FLOAT is not set 14 | # CONFIG_UNITY_ENABLE_DOUBLE is not set 15 | # CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set 16 | # CONFIG_USE_WAKENET is not set 17 | # CONFIG_USE_MULTINET is not set 18 | # CONFIG_VFS_SUPPORT_SELECT is not set 19 | # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set 20 | # CONFIG_VFS_SUPPORT_TERMIOS is not set 21 | 22 | # 23 | # PPP 24 | # 25 | CONFIG_LWIP_PPP_SUPPORT=y 26 | CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y 27 | CONFIG_LWIP_PPP_PAP_SUPPORT=y 28 | CONFIG_LWIP_PPP_ENABLE_IPV6=n 29 | -------------------------------------------------------------------------------- /configs/defconfig.esp32s3: -------------------------------------------------------------------------------- 1 | # CONFIG_IDF_EXPERIMENTAL_FEATURES=y 2 | 3 | CONFIG_ULP_COPROC_ENABLED=y 4 | CONFIG_ULP_COPROC_TYPE_RISCV=y 5 | CONFIG_ULP_COPROC_RESERVE_MEM=4096 6 | 7 | CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y 8 | CONFIG_SPIRAM=y 9 | CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y 10 | CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y 11 | CONFIG_ESP32S3_DATA_CACHE_16KB=y 12 | CONFIG_RTC_CLK_CAL_CYCLES=576 13 | CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y 14 | # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set 15 | # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set 16 | CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y 17 | CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 18 | CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n 19 | CONFIG_BOOTLOADER_FLASH_DC_AWARE=y 20 | 21 | # CONFIG_LCD_RGB_ISR_IRAM_SAFE is not set 22 | 23 | # 24 | # S3 Display shift fix -> https://espressif-docs.readthedocs-hosted.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html 25 | # 26 | CONFIG_LCD_RGB_RESTART_IN_VSYNC=y 27 | 28 | # 29 | # Bluetooth 30 | # 31 | CONFIG_BT_ENABLED=y 32 | CONFIG_BT_STACK_NO_LOG=y 33 | # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set 34 | # CONFIG_BLE_MESH is not set 35 | CONFIG_BT_NIMBLE_ENABLED=y 36 | CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y 37 | CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 38 | # CONFIG_BT_NIMBLE_NVS_PERSIST is not set 39 | # CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set 40 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set 41 | # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set 42 | # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set 43 | 44 | # 45 | # PPP 46 | # 47 | CONFIG_LWIP_PPP_SUPPORT=y 48 | CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y 49 | CONFIG_LWIP_PPP_PAP_SUPPORT=y 50 | CONFIG_LWIP_PPP_ENABLE_IPV6=n 51 | -------------------------------------------------------------------------------- /configs/defconfig.opi: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_OCT_FLASH=y 2 | CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR=y -------------------------------------------------------------------------------- /configs/defconfig.opi_ram: -------------------------------------------------------------------------------- 1 | CONFIG_SPIRAM_MODE_OCT=y 2 | CONFIG_SPIRAM_IGNORE_NOTFOUND=y 3 | # CONFIG_SPIRAM_MEMTEST is not set 4 | CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y 5 | # bounce buffer mode relies on GDMA EOF interrupt to be service-able 6 | # I2S_ISR_IRAM_SAFE has to be set!! Done in common config 7 | CONFIG_GDMA_ISR_IRAM_SAFE=y 8 | # Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash 9 | CONFIG_SPIRAM_XIP_FROM_PSRAM=y 10 | CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y 11 | CONFIG_SPIRAM_RODATA=y 12 | -------------------------------------------------------------------------------- /configs/defconfig.qio: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHMODE_QIO=y -------------------------------------------------------------------------------- /configs/defconfig.qio_ram: -------------------------------------------------------------------------------- 1 | # CONFIG_SPIRAM_BOOT_INIT is not set -------------------------------------------------------------------------------- /configs/pio_end.txt: -------------------------------------------------------------------------------- 1 | "ARDUINO_ARCH_ESP32", 2 | "CHIP_HAVE_CONFIG_H", 3 | ("ESP32", "ESP32"), 4 | ("F_CPU", "$BOARD_F_CPU"), 5 | ("ARDUINO", 10812), 6 | ("ARDUINO_VARIANT", '\\"%s\\"' % board_config.get("build.variant").replace('"', "")), 7 | ("ARDUINO_BOARD", '\\"%s\\"' % board_config.get("name").replace('"', "")), 8 | "ARDUINO_PARTITION_%s" % basename(board_config.get( 9 | "build.partitions", "default.csv")).replace(".csv", "").replace("-", "_") 10 | ] 11 | ) 12 | -------------------------------------------------------------------------------- /configs/pio_start.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2014-present PlatformIO 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | Arduino 17 | 18 | Arduino Wiring-based Framework allows writing cross-platform software to 19 | control devices attached to a wide range of Arduino boards to create all 20 | kinds of creative coding, interactive objects, spaces or physical experiences. 21 | 22 | http://arduino.cc/en/Reference/HomePage 23 | """ 24 | 25 | # Extends: https://github.com/jason2866/platform-espressif32/blob/develop/builder/main.py 26 | 27 | from os.path import basename, join 28 | 29 | from SCons.Script import DefaultEnvironment 30 | 31 | env = DefaultEnvironment() 32 | 33 | FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoespressif32") 34 | FRAMEWORK_SDK_DIR = join(FRAMEWORK_DIR, "tools", "esp32-arduino-libs") 35 | 36 | board_config = env.BoardConfig() 37 | 38 | flatten_cppdefines = env.Flatten(env['CPPDEFINES']) 39 | 40 | # 41 | # zigbee libs 42 | # 43 | if "ZIGBEE_MODE_ZCZR" in flatten_cppdefines: 44 | env.Append( 45 | LIBS=[ 46 | "-lesp_zb_api.zczr", 47 | "-lzboss_stack.zczr", 48 | "-lzboss_port.native" 49 | ] 50 | ) 51 | if "ZIGBEE_MODE_ED" in flatten_cppdefines: 52 | env.Append( 53 | LIBS=[ 54 | "-lesp_zb_api.ed", 55 | "-lzboss_stack.ed", 56 | "-lzboss_port.native" 57 | ] 58 | ) 59 | 60 | env.Append( 61 | -------------------------------------------------------------------------------- /main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "sketch.cpp" "arduino-lib-builder-gcc.c" "arduino-lib-builder-cpp.cpp" "arduino-lib-builder-as.S" INCLUDE_DIRS ".") 2 | -------------------------------------------------------------------------------- /main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | config LIB_BUILDER_FLASHMODE 2 | string 3 | default "qio" if ESPTOOLPY_FLASHMODE_QIO 4 | default "qout" if ESPTOOLPY_FLASHMODE_QOUT 5 | default "dio" if ESPTOOLPY_FLASHMODE_DIO 6 | default "dout" if ESPTOOLPY_FLASHMODE_DOUT 7 | default "opi" if ESPTOOLPY_FLASHMODE_OPI 8 | 9 | config LIB_BUILDER_FLASHFREQ 10 | string 11 | default "120m" if ESPTOOLPY_FLASHFREQ_120M 12 | default "80m" if ESPTOOLPY_FLASHFREQ_80M 13 | default "64m" if ESPTOOLPY_FLASHFREQ_64M 14 | default "60m" if ESPTOOLPY_FLASHFREQ_60M 15 | default "40m" if ESPTOOLPY_FLASHFREQ_40M 16 | default "32m" if ESPTOOLPY_FLASHFREQ_32M 17 | default "30m" if ESPTOOLPY_FLASHFREQ_30M 18 | default "26m" if ESPTOOLPY_FLASHFREQ_26M 19 | default "20m" if ESPTOOLPY_FLASHFREQ_20M 20 | default "16m" if ESPTOOLPY_FLASHFREQ_16M 21 | default "15m" if ESPTOOLPY_FLASHFREQ_15M 22 | 23 | config LIB_BUILDER_COMPILE 24 | bool 25 | default y 26 | -------------------------------------------------------------------------------- /main/arduino-lib-builder-as.S: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jason2866/esp32-arduino-lib-builder/b2515705771e6933c159d35b6bd04475535df675/main/arduino-lib-builder-as.S -------------------------------------------------------------------------------- /main/arduino-lib-builder-cpp.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jason2866/esp32-arduino-lib-builder/b2515705771e6933c159d35b6bd04475535df675/main/arduino-lib-builder-cpp.cpp -------------------------------------------------------------------------------- /main/arduino-lib-builder-gcc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jason2866/esp32-arduino-lib-builder/b2515705771e6933c159d35b6bd04475535df675/main/arduino-lib-builder-gcc.c -------------------------------------------------------------------------------- /main/sketch.cpp: -------------------------------------------------------------------------------- 1 | #include "Arduino.h" 2 | 3 | void setup() { 4 | Serial.begin(115200); 5 | } 6 | 7 | void loop() { 8 | Serial.println("Hello World!"); 9 | delay(1000); 10 | } 11 | -------------------------------------------------------------------------------- /partitions.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x300000, 5 | app1, app, ota_1, 0x310000, 0x300000, 6 | spiffs, data, spiffs, 0x610000, 0x700000, 7 | model, data, spiffs, 0xD10000, 0x2E0000, 8 | coredump, data, coredump,0xFF0000, 0x10000, 9 | -------------------------------------------------------------------------------- /patches/esp32s2_i2c_ll_master_init.diff: -------------------------------------------------------------------------------- 1 | diff --git a/components/hal/esp32s2/include/hal/i2c_ll.h b/components/hal/esp32s2/include/hal/i2c_ll.h 2 | index f9a66b61d6..2f669b68c0 100644 3 | --- a/components/hal/esp32s2/include/hal/i2c_ll.h 4 | +++ b/components/hal/esp32s2/include/hal/i2c_ll.h 5 | @@ -653,10 +653,12 @@ static inline void i2c_ll_enable_controller_clock(i2c_dev_t *hw, bool en) 6 | static inline void i2c_ll_master_init(i2c_dev_t *hw) 7 | { 8 | typeof(hw->ctr) ctrl_reg; 9 | + uint32_t ref_always_on = hw->ctr.ref_always_on; 10 | ctrl_reg.val = 0; 11 | ctrl_reg.ms_mode = 1; 12 | ctrl_reg.sda_force_out = 1; 13 | ctrl_reg.scl_force_out = 1; 14 | + ctrl_reg.ref_always_on = ref_always_on; 15 | hw->ctr.val = ctrl_reg.val; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /patches/lwip_max_tcp_pcb.diff: -------------------------------------------------------------------------------- 1 | diff --git a/components/lwip/lwip/src/core/memp.c b/components/lwip/lwip/src/core/memp.c 2 | index 352ce5a55127a658b6b3c9d8541298c42df332ff..39433cf476b3456b046e337e9b1f016299964a84 100644 3 | --- a/components/lwip/lwip/src/core/memp.c 4 | +++ b/components/lwip/lwip/src/core/memp.c 5 | @@ -240,6 +240,10 @@ memp_init(void) 6 | #endif /* MEMP_OVERFLOW_CHECK >= 2 */ 7 | } 8 | 9 | +#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP 10 | +static u32_t num_tcp_pcb = 0; 11 | +#endif 12 | + 13 | static void * 14 | #if !MEMP_OVERFLOW_CHECK 15 | do_memp_malloc_pool(const struct memp_desc *desc) 16 | @@ -251,6 +255,16 @@ do_memp_malloc_pool_fn(const struct memp_desc *desc, const char *file, const int 17 | SYS_ARCH_DECL_PROTECT(old_level); 18 | 19 | #if MEMP_MEM_MALLOC 20 | +#if ESP_LWIP 21 | +#if LWIP_TCP 22 | + if(desc == memp_pools[MEMP_TCP_PCB]){ 23 | + if(num_tcp_pcb >= MEMP_NUM_TCP_PCB){ 24 | + return NULL; 25 | + } 26 | + } 27 | +#endif 28 | +#endif 29 | + 30 | memp = (struct memp *)mem_malloc(MEMP_SIZE + MEMP_ALIGN_SIZE(desc->size)); 31 | SYS_ARCH_PROTECT(old_level); 32 | #else /* MEMP_MEM_MALLOC */ 33 | @@ -260,6 +274,12 @@ do_memp_malloc_pool_fn(const struct memp_desc *desc, const char *file, const int 34 | #endif /* MEMP_MEM_MALLOC */ 35 | 36 | if (memp != NULL) { 37 | +#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP 38 | + if (desc == memp_pools[MEMP_TCP_PCB]) { 39 | + num_tcp_pcb++; 40 | + } 41 | +#endif 42 | + 43 | #if !MEMP_MEM_MALLOC 44 | #if MEMP_OVERFLOW_CHECK == 1 45 | memp_overflow_check_element(memp, desc); 46 | @@ -369,6 +389,12 @@ do_memp_free_pool(const struct memp_desc *desc, void *mem) 47 | 48 | SYS_ARCH_PROTECT(old_level); 49 | 50 | +#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP 51 | + if (desc == memp_pools[MEMP_TCP_PCB]) { 52 | + num_tcp_pcb--; 53 | + } 54 | +#endif 55 | + 56 | #if MEMP_OVERFLOW_CHECK == 1 57 | memp_overflow_check_element(memp, desc); 58 | #endif /* MEMP_OVERFLOW_CHECK */ 59 | diff --git a/components/lwip/lwip/src/core/tcp.c b/components/lwip/lwip/src/core/tcp.c 60 | index 3fbdd89ae07807208ff7466abb50f90b5e7727e4..fe6baaf250927cb4b89f8d1dbd41c73def88692b 100644 61 | --- a/components/lwip/lwip/src/core/tcp.c 62 | +++ b/components/lwip/lwip/src/core/tcp.c 63 | @@ -1765,7 +1765,9 @@ tcp_kill_state(enum tcp_state state) 64 | struct tcp_pcb *pcb, *inactive; 65 | u32_t inactivity; 66 | 67 | +#if !ESP_LWIP 68 | LWIP_ASSERT("invalid state", (state == CLOSING) || (state == LAST_ACK)); 69 | +#endif 70 | 71 | inactivity = 0; 72 | inactive = NULL; 73 | @@ -1870,17 +1872,41 @@ tcp_alloc(u8_t prio) 74 | tcp_kill_state(CLOSING); 75 | /* Try to allocate a tcp_pcb again. */ 76 | pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); 77 | +#if ESP_LWIP 78 | if (pcb == NULL) { 79 | - /* Try killing oldest active connection with lower priority than the new one. */ 80 | - LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing oldest connection with prio lower than %d\n", prio)); 81 | - tcp_kill_prio(prio); 82 | - /* Try to allocate a tcp_pcb again. */ 83 | + /* Try killing oldest connection in FIN_WAIT_2. */ 84 | + LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest FIN_WAIT_2 connection\n")); 85 | + tcp_kill_state(FIN_WAIT_2); 86 | pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); 87 | + if (pcb == NULL) { 88 | + /* Try killing oldest connection in FIN_WAIT_1. */ 89 | + LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest FIN_WAIT_1 connection\n")); 90 | + tcp_kill_state(FIN_WAIT_1); 91 | + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); 92 | +#endif 93 | + if (pcb == NULL) { 94 | + /* Try killing oldest active connection with lower priority than the new one. */ 95 | + LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing oldest connection with prio lower than %d\n", prio)); 96 | + tcp_kill_prio(prio); 97 | + /* Try to allocate a tcp_pcb again. */ 98 | + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); 99 | + if (pcb != NULL) { 100 | + /* adjust err stats: memp_malloc failed multiple times before */ 101 | + MEMP_STATS_DEC(err, MEMP_TCP_PCB); 102 | + } 103 | + } 104 | +#if ESP_LWIP 105 | + if (pcb != NULL) { 106 | + /* adjust err stats: memp_malloc failed multiple times before */ 107 | + MEMP_STATS_DEC(err, MEMP_TCP_PCB); 108 | + } 109 | + } 110 | if (pcb != NULL) { 111 | /* adjust err stats: memp_malloc failed multiple times before */ 112 | MEMP_STATS_DEC(err, MEMP_TCP_PCB); 113 | } 114 | } 115 | +#endif 116 | if (pcb != NULL) { 117 | /* adjust err stats: memp_malloc failed multiple times before */ 118 | MEMP_STATS_DEC(err, MEMP_TCP_PCB); 119 | -------------------------------------------------------------------------------- /tools/archive-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT" 4 | 5 | archive_path="dist/arduino-esp32-libs-$TARGET-$idf_version_string.tar.gz" 6 | build_archive_path="dist/arduino-esp32-build-$TARGET-$idf_version_string.tar.gz" 7 | pio_archive_path="dist/framework-arduinoespressif32-$TARGET-$idf_version_string.tar.gz" 8 | pio_zip_archive_path="dist/framework-arduinoespressif32-$TARGET-$idf_version_string.zip" 9 | 10 | mkdir -p dist && rm -rf "$archive_path" "$build_archive_path" 11 | 12 | cd out 13 | echo "Creating PlatformIO Tasmota framework-arduinoespressif32" 14 | mkdir -p arduino-esp32/cores/esp32 15 | mkdir -p arduino-esp32/tools/partitions 16 | cp -rf ../components/arduino/tools arduino-esp32 17 | cp -rf ../components/arduino/cores arduino-esp32 18 | cp -rf ../components/arduino/libraries arduino-esp32 19 | cp -rf ../components/arduino/variants arduino-esp32 20 | cp -f ../components/arduino/CMa* arduino-esp32 21 | cp -f ../components/arduino/idf* arduino-esp32 22 | cp -f ../components/arduino/Kco* arduino-esp32 23 | cp -f ../components/arduino/pac* arduino-esp32 24 | rm -rf arduino-esp32/docs 25 | rm -rf arduino-esp32/tests 26 | rm -rf arduino-esp32/idf_component_examples 27 | rm -rf arduino-esp32/libraries/Matter 28 | rm -rf arduino-esp32/libraries/RainMaker 29 | rm -rf arduino-esp32/libraries/Insights 30 | rm -rf arduino-esp32/libraries/ESP_I2S 31 | rm -rf arduino-esp32/libraries/SPIFFS 32 | rm -rf arduino-esp32/libraries/BLE 33 | rm -rf arduino-esp32/libraries/SimpleBLE 34 | rm -rf arduino-esp32/libraries/BluetoothSerial 35 | rm -rf arduino-esp32/libraries/WiFiProv 36 | rm -rf arduino-esp32/libraries/WiFiClientSecure 37 | rm -rf arduino-esp32/libraries/NetworkClientSecure 38 | rm -rf arduino-esp32/libraries/ESP_SR 39 | rm -rf arduino-esp32/libraries/ESP_NOW 40 | rm -rf arduino-esp32/libraries/TFLiteMicro 41 | rm -rf arduino-esp32/libraries/OpenThread 42 | rm -rf arduino-esp32/libraries/Zigbee 43 | rm -rf arduino-esp32/libraries/ESP32 44 | rm -rf arduino-esp32/package 45 | rm -rf arduino-esp32/tools/pre-commit 46 | rm -rf arduino-esp32/tools/esp32-arduino-libs 47 | rm -rf arduino-esp32/tools/*.exe 48 | rm -rf arduino-esp32/tools/esptool.py 49 | rm -rf arduino-esp32/tools/get.py 50 | rm -rf arduino-esp32/tools/ide-debug 51 | rm -rf arduino-esp32/tools/gen_insights_package.py 52 | rm -rf arduino-esp32/platform.txt 53 | rm -rf arduino-esp32/programmers.txt 54 | rm -rf arduino-esp32/boards.txt 55 | rm -rf arduino-esp32/package.json 56 | rm -rf arduino-esp32/*.md 57 | cp -Rf tools/esp32-arduino-libs arduino-esp32/tools/ 58 | cp ../package.json arduino-esp32/package.json 59 | cp ../core_version.h arduino-esp32/cores/esp32/core_version.h 60 | mv arduino-esp32/ framework-arduinoespressif32/ 61 | cd framework-arduinoespressif32/libraries 62 | rm -rf **/examples 63 | cd ../tools/esp32-arduino-libs 64 | # rm -rf **/flags 65 | cd ../../../ 66 | # If the framework is needed as tar.gz uncomment next line 67 | # tar --exclude=.* -zcf ../$pio_archive_path framework-arduinoespressif32/ 68 | 7z a -mx=9 -tzip -xr'!.*' ../$pio_zip_archive_path framework-arduinoespressif32/ 69 | -------------------------------------------------------------------------------- /tools/check-deploy-needed.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | source ./tools/config.sh 4 | 5 | IDF_COMMIT=`github_last_commit "$IDF_REPO" "$IDF_BRANCH"` 6 | 7 | if [ -z $GITHUB_HEAD_REF ]; then 8 | current_branch=`git branch --show-current` 9 | else 10 | current_branch="$GITHUB_HEAD_REF" 11 | fi 12 | 13 | AR_BRANCH="master" 14 | if [[ "$current_branch" != "master" && `github_branch_exists "$AR_REPO" "$current_branch"` == "1" ]]; then 15 | AR_BRANCH="$current_branch" 16 | else 17 | AR_BRANCH_NAME="idf-$IDF_BRANCH" 18 | has_ar_branch=`github_branch_exists "$AR_REPO" "$AR_BRANCH_NAME"` 19 | if [ "$has_ar_branch" == "1" ]; then 20 | AR_BRANCH="$AR_BRANCH_NAME" 21 | else 22 | has_ar_branch=`github_branch_exists "$AR_REPO" "$AR_PR_TARGET_BRANCH"` 23 | if [ "$has_ar_branch" == "1" ]; then 24 | AR_BRANCH="$AR_PR_TARGET_BRANCH" 25 | fi 26 | fi 27 | fi 28 | 29 | # format new branch name and pr title 30 | AR_NEW_BRANCH_NAME="idf-$IDF_BRANCH" 31 | AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT" 32 | AR_NEW_PR_TITLE="IDF $IDF_BRANCH" 33 | 34 | LIBS_VERSION="idf-"${IDF_BRANCH//\//_}"-$IDF_COMMIT" 35 | 36 | AR_HAS_BRANCH=`github_branch_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"` 37 | if [ "$AR_HAS_BRANCH" == "1" ]; then 38 | AR_HAS_COMMIT=`github_commit_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME" "$IDF_COMMIT"` 39 | else 40 | AR_HAS_COMMIT=`github_commit_exists "$AR_REPO" "$AR_BRANCH" "$IDF_COMMIT"` 41 | fi 42 | AR_HAS_PR=`github_pr_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"` 43 | 44 | LIBS_HAS_BRANCH=`github_branch_exists "$AR_LIBS_REPO" "$AR_NEW_BRANCH_NAME"` 45 | LIBS_HAS_COMMIT=`github_commit_exists "$AR_LIBS_REPO" "$AR_NEW_BRANCH_NAME" "$IDF_COMMIT"` 46 | 47 | export IDF_COMMIT 48 | 49 | export AR_NEW_BRANCH_NAME 50 | export AR_NEW_COMMIT_MESSAGE 51 | export AR_NEW_PR_TITLE 52 | 53 | export AR_HAS_COMMIT 54 | export AR_HAS_BRANCH 55 | export AR_HAS_PR 56 | 57 | export LIBS_VERSION 58 | export LIBS_HAS_COMMIT 59 | export LIBS_HAS_BRANCH 60 | 61 | echo "IDF_COMMIT: $IDF_COMMIT" 62 | echo "AR_BRANCH: $AR_BRANCH" 63 | echo "AR_NEW_COMMIT_MESSAGE: $AR_NEW_COMMIT_MESSAGE" 64 | echo "AR_NEW_BRANCH_NAME: $AR_NEW_BRANCH_NAME" 65 | echo "AR_NEW_PR_TITLE: $AR_NEW_PR_TITLE" 66 | echo "AR_HAS_COMMIT: $AR_HAS_COMMIT" 67 | echo "AR_HAS_BRANCH: $AR_HAS_BRANCH" 68 | echo "AR_HAS_PR: $AR_HAS_PR" 69 | echo "LIBS_VERSION: $LIBS_VERSION" 70 | echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT" 71 | echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH" 72 | 73 | if [ ! -x $GITHUB_OUTPUT ]; then 74 | echo "idf_commit=$IDF_COMMIT" >> "$GITHUB_OUTPUT" 75 | echo "ar_branch=$AR_BRANCH" >> "$GITHUB_OUTPUT" 76 | echo "ar_new_commit_message=$AR_NEW_COMMIT_MESSAGE" >> "$GITHUB_OUTPUT" 77 | echo "ar_new_branch_name=$AR_NEW_BRANCH_NAME" >> "$GITHUB_OUTPUT" 78 | echo "ar_new_pr_title=$AR_NEW_PR_TITLE" >> "$GITHUB_OUTPUT" 79 | echo "ar_has_commit=$AR_HAS_COMMIT" >> "$GITHUB_OUTPUT" 80 | echo "ar_has_branch=$AR_HAS_BRANCH" >> "$GITHUB_OUTPUT" 81 | echo "ar_has_pr=$AR_HAS_PR" >> "$GITHUB_OUTPUT" 82 | echo "libs_version=$LIBS_VERSION" >> "$GITHUB_OUTPUT" 83 | echo "libs_has_commit=$LIBS_HAS_COMMIT" >> "$GITHUB_OUTPUT" 84 | echo "libs_has_branch=$LIBS_HAS_BRANCH" >> "$GITHUB_OUTPUT" 85 | fi 86 | -------------------------------------------------------------------------------- /tools/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | if [ -z $IDF_PATH ]; then 5 | export IDF_PATH="$PWD/esp-idf" 6 | fi 7 | 8 | if [ -z $IDF_BRANCH ]; then 9 | export IDF_BRANCH="release/v5.4" 10 | fi 11 | 12 | # Arduino branch to use 13 | if [ -z $AR_BRANCH ]; then 14 | AR_BRANCH="main" 15 | fi 16 | 17 | if [ -z $IDF_TARGET ]; then 18 | if [ -f sdkconfig ]; then 19 | IDF_TARGET=`cat sdkconfig | grep CONFIG_IDF_TARGET= | cut -d'"' -f2` 20 | if [ "$IDF_TARGET" = "" ]; then 21 | IDF_TARGET="esp32" 22 | fi 23 | else 24 | IDF_TARGET="esp32" 25 | fi 26 | fi 27 | 28 | # Owner of the target ESP32 Arduino repository 29 | AR_USER="tasmota" 30 | 31 | # IDF commit to use 32 | #IDF_COMMIT="" 33 | 34 | # Arduino commit to use 35 | #AR_COMMIT="" 36 | 37 | # The full name of the repository 38 | AR_REPO="$AR_USER/arduino-esp32" 39 | IDF_REPO="$AR_USER/esp-idf" 40 | AR_LIBS_REPO="$AR_USER/esp32-arduino-libs" 41 | 42 | AR_REPO_URL="https://github.com/$AR_REPO.git" 43 | IDF_REPO_URL="https://github.com/$IDF_REPO.git" 44 | AR_LIBS_REPO_URL="https://github.com/$AR_LIBS_REPO.git" 45 | if [ -n $GITHUB_TOKEN ]; then 46 | AR_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_REPO.git" 47 | AR_LIBS_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_LIBS_REPO.git" 48 | fi 49 | 50 | AR_ROOT="$PWD" 51 | AR_COMPS="$AR_ROOT/components" 52 | AR_MANAGED_COMPS="$AR_ROOT/managed_components" 53 | AR_OUT="$AR_ROOT/out" 54 | AR_TOOLS="$AR_OUT/tools" 55 | AR_PATCHES="$AR_ROOT/patches" 56 | AR_PLATFORM_TXT="$AR_OUT/platform.txt" 57 | AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" 58 | AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET" 59 | PIO_SDK="FRAMEWORK_SDK_DIR, \"$IDF_TARGET\"" 60 | TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" 61 | IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" 62 | 63 | if [ "$IDF_COMMIT" ]; then 64 | export IDF_COMMIT 65 | fi 66 | 67 | if [ -d "$IDF_PATH" ]; then 68 | export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) 69 | fi 70 | 71 | echo "Using IDF branch $IDF_BRANCH" 72 | echo "Using IDF commit $IDF_COMMIT" 73 | 74 | if [ "$AR_COMMIT" ]; then 75 | echo "Using Arduino commit $AR_COMMIT" 76 | else 77 | export AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") 78 | fi 79 | 80 | function get_os(){ 81 | OSBITS=`uname -m` 82 | if [[ "$OSTYPE" == "linux"* ]]; then 83 | if [[ "$OSBITS" == "i686" ]]; then 84 | echo "linux32" 85 | elif [[ "$OSBITS" == "x86_64" ]]; then 86 | echo "linux64" 87 | elif [[ "$OSBITS" == "armv7l" ]]; then 88 | echo "linux-armel" 89 | else 90 | echo "unknown" 91 | return 1 92 | fi 93 | elif [[ "$OSTYPE" == "darwin"* ]]; then 94 | echo "macos" 95 | elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then 96 | echo "win32" 97 | else 98 | echo "$OSTYPE" 99 | return 1 100 | fi 101 | return 0 102 | } 103 | 104 | AR_OS=`get_os` 105 | 106 | export SED="sed" 107 | export AWK="awk" 108 | export SSTAT="stat -c %s" 109 | 110 | if [[ "$AR_OS" == "macos" ]]; then 111 | if ! [ -x "$(command -v gsed)" ]; then 112 | echo "ERROR: gsed is not installed! Please install gsed first. ex. brew install gsed" 113 | exit 1 114 | fi 115 | if ! [ -x "$(command -v gawk)" ]; then 116 | echo "ERROR: gawk is not installed! Please install gawk first. ex. brew install gawk" 117 | exit 1 118 | fi 119 | export SED="gsed" 120 | export AWK="gawk" 121 | export SSTAT="stat -f %z" 122 | fi 123 | 124 | function github_commit_exists(){ #github_commit_exists 125 | local repo_path="$1" 126 | local branch_name="$2" 127 | local commit_message="$3" 128 | local commits_found=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/commits?sha=$branch_name" | jq -r '.[].commit.message' | grep "$commit_message" | wc -l` 129 | if [ ! "$commits_found" == "" ] && [ ! "$commits_found" == "null" ] && [ ! "$commits_found" == "0" ]; then echo $commits_found; else echo 0; fi 130 | } 131 | 132 | function github_last_commit(){ # github_last_commit 133 | local repo_path="$1" 134 | local branch_name="$2" 135 | local commit=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/commits/heads/$branch_name" | jq -r '.sha'` 136 | if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then 137 | echo ${commit:0:8} 138 | else 139 | echo "" 140 | fi 141 | } 142 | 143 | function github_branch_exists(){ # github_branch_exists 144 | local repo_path="$1" 145 | local branch_name="$2" 146 | local branch=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/branches/$branch_name" | jq -r '.name'` 147 | if [ "$branch" == "$branch_name" ]; then echo 1; else echo 0; fi 148 | } 149 | 150 | function github_pr_exists(){ # github_pr_exists 151 | local repo_path="$1" 152 | local branch_name="$2" 153 | local pr_num=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/pulls?head=$AR_USER:$branch_name&state=open" | jq -r '.[].number'` 154 | if [ ! "$pr_num" == "" ] && [ ! "$pr_num" == "null" ]; then echo 1; else echo 0; fi 155 | } 156 | 157 | 158 | 159 | function git_branch_exists(){ # git_branch_exists 160 | local repo_path="$1" 161 | local branch_name="$2" 162 | local branch_found=`git -C "$repo_path" ls-remote --heads origin "$branch_name"` 163 | if [ -n "$branch_found" ]; then echo 1; else echo 0; fi 164 | } 165 | 166 | function git_commit_exists(){ #git_commit_exists 167 | local repo_path="$1" 168 | local commit_message="$2" 169 | local commits_found=`git -C "$repo_path" log --all --grep="$commit_message" | grep commit` 170 | if [ -n "$commits_found" ]; then echo 1; else echo 0; fi 171 | } 172 | 173 | function git_create_pr(){ # git_create_pr 174 | local pr_branch="$1" 175 | local pr_title="$2" 176 | local pr_target="$3" 177 | local pr_body="\`\`\`\r\n" 178 | while read -r line; do pr_body+=$line"\r\n"; done < "$AR_TOOLS/esp32-arduino-libs/versions.txt" 179 | pr_body+="\`\`\`\r\n" 180 | local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" 181 | git_create_pr_res=`echo "$pr_data" | curl -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" --data @- "https://api.github.com/repos/$AR_REPO/pulls"` 182 | local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` 183 | if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi 184 | } 185 | -------------------------------------------------------------------------------- /tools/config_editor/.gitignore: -------------------------------------------------------------------------------- 1 | .venv/ 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /tools/config_editor/README.md: -------------------------------------------------------------------------------- 1 | # Arduino Static Libraries Configuration Editor 2 | 3 | This is a simple application to configure the static libraries for the ESP32 Arduino core. 4 | It allows the user to select the targets to compile, change the configuration options and compile the libraries. 5 | It has mouse support and can be pre-configured using command line arguments. 6 | 7 | ## Requirements 8 | - Python 3.9 or later 9 | - Install the required packages using `pip install -r requirements.txt` 10 | - The requirements from esp32-arduino-lib-builder 11 | 12 | ## Troubleshooting 13 | 14 | In some cases, the UI might not look as expected. This can happen due to the terminal emulator not supporting the required features. 15 | 16 | ### WSL 17 | 18 | If you are using WSL, it is recommended to use the Windows Terminal to visualize the application. Otherwise, the application layout and colors might not be displayed correctly. 19 | The Windows Terminal can be installed from the Microsoft Store. 20 | 21 | ### MacOS 22 | 23 | If you are using MacOS and the application looks weird, check [this guide from Textual](https://textual.textualize.io/FAQ/#why-doesnt-textual-look-good-on-macos) to fix it. 24 | 25 | ## Usage 26 | 27 | These command line arguments can be used to pre-configure the application: 28 | 29 | ``` 30 | Command line arguments: 31 | -t, --target <target> Comma-separated list of targets to be compiled. 32 | Choose from: all, esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2. Default: all except esp32c2 33 | --copy, --no-copy Enable/disable copying the compiled libraries to arduino-esp32. Disabled by default 34 | -c, --arduino-path <path> Path to arduino-esp32 directory. Default: OS dependent 35 | -A, --arduino-branch <branch> Branch of the arduino-esp32 repository to be used. Default: set by the build script 36 | -I, --idf-branch <branch> Branch of the ESP-IDF repository to be used. Default: set by the build script 37 | -i, --idf-commit <commit> Commit of the ESP-IDF repository to be used. Default: set by the build script 38 | ``` 39 | -------------------------------------------------------------------------------- /tools/config_editor/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Arduino Static Libraries Configuration Editor 5 | 6 | This is a simple application to configure the static libraries for the ESP32 Arduino core. 7 | It allows the user to select the targets to compile, change the configuration options and compile the libraries. 8 | 9 | Requires Python 3.9 or later. 10 | 11 | The application is built using the "textual" library, which is a Python library for building text-based user interfaces. 12 | 13 | Note that this application still needs the requirements from esp32-arduino-lib-builder to be installed. 14 | 15 | Command line arguments: 16 | -t, --target <target> Comma-separated list of targets to be compiled. 17 | Choose from: all, esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2. Default: all except esp32c2 18 | --copy, --no-copy Enable/disable copying the compiled libraries to arduino-esp32. Disabled by default 19 | -c, --arduino-path <path> Path to arduino-esp32 directory. Default: OS dependent 20 | -A, --arduino-branch <branch> Branch of the arduino-esp32 repository to be used. Default: set by the build script 21 | -I, --idf-branch <branch> Branch of the ESP-IDF repository to be used. Default: set by the build script 22 | -i, --idf-commit <commit> Commit of the ESP-IDF repository to be used. Default: set by the build script 23 | 24 | """ 25 | 26 | import argparse 27 | import json 28 | import os 29 | import platform 30 | import sys 31 | 32 | from pathlib import Path 33 | 34 | try: 35 | from textual.app import App, ComposeResult 36 | from textual.binding import Binding 37 | from textual.containers import VerticalScroll 38 | from textual.screen import Screen 39 | from textual.widgets import Button, Header, Label, Footer 40 | except ImportError: 41 | print("Please install the \"textual\" package before running this script.") 42 | exit(1) 43 | 44 | from settings import SettingsScreen 45 | from editor import EditorScreen 46 | from compile import CompileScreen 47 | 48 | class MainScreen(Screen): 49 | # Main screen class 50 | 51 | # Set the key bindings 52 | BINDINGS = [ 53 | Binding("c", "app.push_screen('compile')", "Compile"), 54 | Binding("e", "app.push_screen('editor')", "Editor"), 55 | Binding("s", "app.push_screen('settings')", "Settings"), 56 | Binding("q", "app.quit", "Quit"), 57 | ] 58 | 59 | def on_button_pressed(self, event: Button.Pressed) -> None: 60 | # Event handler called when a button is pressed 61 | if event.button.id == "compile-button": 62 | print("Compile button pressed") 63 | self.app.push_screen("compile") 64 | elif event.button.id == "settings-button": 65 | print("Settings button pressed") 66 | self.app.push_screen("settings") 67 | elif event.button.id == "editor-button": 68 | print("Editor button pressed") 69 | self.app.push_screen("editor") 70 | elif event.button.id == "quit-button": 71 | print("Quit button pressed") 72 | self.app.exit() 73 | 74 | def compose(self) -> ComposeResult: 75 | # Compose main menu 76 | yield Header() 77 | with VerticalScroll(id="main-menu-container"): 78 | yield Label("ESP32 Arduino Static Libraries Configuration Editor", id="main-menu-title") 79 | yield Button("Compile Static Libraries", id="compile-button", classes="main-menu-button") 80 | yield Button("Sdkconfig Editor", id="editor-button", classes="main-menu-button") 81 | yield Button("Settings", id="settings-button", classes="main-menu-button") 82 | yield Button("Quit", id="quit-button", classes="main-menu-button") 83 | yield Footer() 84 | 85 | def on_mount(self) -> None: 86 | # Event handler called when the app is mounted for the first time 87 | self.title = "Configurator" 88 | self.sub_title = "Main Menu" 89 | print("Main screen mounted.") 90 | 91 | class ConfigEditorApp(App): 92 | # Main application class 93 | 94 | # Set the root and script paths 95 | SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) 96 | ROOT_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..")) 97 | 98 | # Set the application options 99 | supported_targets = [] 100 | setting_enable_copy = False 101 | 102 | # Options to be set by the command line arguments 103 | setting_target = "" 104 | setting_arduino_path = "" 105 | setting_arduino_branch = "" 106 | setting_idf_branch = "" 107 | setting_idf_commit = "" 108 | 109 | ENABLE_COMMAND_PALETTE = False 110 | CSS_PATH = "style.tcss" 111 | SCREENS = { 112 | "main": MainScreen, 113 | "settings": SettingsScreen, 114 | "compile": CompileScreen, 115 | "editor": EditorScreen, 116 | } 117 | 118 | def on_mount(self) -> None: 119 | print("Application mounted. Initial options:") 120 | print("Python version: " + sys.version) 121 | print("Root path: " + self.ROOT_PATH) 122 | print("Script path: " + self.SCRIPT_PATH) 123 | print("Supported Targets: " + ", ".join(self.supported_targets)) 124 | print("Default targets: " + self.setting_target) 125 | print("Enable Copy: " + str(self.setting_enable_copy)) 126 | print("Arduino Path: " + str(self.setting_arduino_path)) 127 | print("Arduino Branch: " + str(self.setting_arduino_branch)) 128 | print("IDF Branch: " + str(self.setting_idf_branch)) 129 | print("IDF Commit: " + str(self.setting_idf_commit)) 130 | self.push_screen("main") 131 | 132 | def arduino_default_path(): 133 | sys_name = platform.system() 134 | home = str(Path.home()) 135 | if sys_name == "Linux": 136 | return os.path.join(home, "Arduino", "hardware", "espressif", "esp32") 137 | else: # Windows and MacOS 138 | return os.path.join(home, "Documents", "Arduino", "hardware", "espressif", "esp32") 139 | 140 | def check_arduino_path(path): 141 | return os.path.isdir(path) 142 | 143 | def main() -> None: 144 | # Set the PYTHONUNBUFFERED environment variable to "1" to disable the output buffering 145 | os.environ['PYTHONUNBUFFERED'] = "1" 146 | 147 | # Check Python version 148 | if sys.version_info < (3, 9): 149 | print("This script requires Python 3.9 or later") 150 | exit(1) 151 | 152 | app = ConfigEditorApp() 153 | 154 | # List of tuples for the target choices containing the target name and if it is enabled by default 155 | target_choices = [] 156 | 157 | # Parse build JSON file 158 | build_json_path = os.path.join(app.ROOT_PATH, "configs", "builds.json") 159 | if os.path.isfile(build_json_path): 160 | with open(build_json_path, "r") as build_json_file: 161 | build_json = json.load(build_json_file) 162 | for target in build_json["targets"]: 163 | try: 164 | default = False if target["skip"] else True 165 | except: 166 | default = True 167 | target_choices.append((target["target"], default)) 168 | else: 169 | print("Error: configs/builds.json file not found.") 170 | exit(1) 171 | 172 | target_choices.sort(key=lambda x: x[0]) 173 | 174 | parser = argparse.ArgumentParser(description="Configure and compile the ESP32 Arduino static libraries") 175 | 176 | parser.add_argument("-t", "--target", 177 | metavar="<target>", 178 | type=str, 179 | default="default", 180 | required=False, 181 | help="Comma-separated list of targets to be compiled. Choose from: " + ", ".join([x[0] for x in target_choices]) 182 | + ". Default: All except " + ", ".join([x[0] for x in target_choices if not x[1]])) 183 | 184 | parser.add_argument("--copy", 185 | type=bool, 186 | action=argparse.BooleanOptionalAction, 187 | default=False, 188 | required=False, 189 | help="Enable/disable copying the compiled libraries to arduino-esp32. Disabled by default") 190 | 191 | parser.add_argument("-c", "--arduino-path", 192 | metavar="<arduino path>", 193 | type=str, 194 | default=arduino_default_path(), 195 | required=False, 196 | help="Path to arduino-esp32 directory. Default: " + arduino_default_path()) 197 | 198 | parser.add_argument("-A", "--arduino-branch", 199 | metavar="<arduino branch>", 200 | type=str, 201 | default="", 202 | required=False, 203 | help="Branch of the arduino-esp32 repository to be used") 204 | 205 | parser.add_argument("-I", "--idf-branch", 206 | metavar="<IDF branch>", 207 | type=str, 208 | default="", 209 | required=False, 210 | help="Branch of the ESP-IDF repository to be used") 211 | 212 | parser.add_argument("-i", "--idf-commit", 213 | metavar="<IDF commit>", 214 | type=str, 215 | default="", 216 | required=False, 217 | help="Commit of the ESP-IDF repository to be used") 218 | 219 | 220 | args = parser.parse_args() 221 | 222 | # Force targets to be lower case 223 | args.target = args.target.lower() 224 | 225 | # Check if the target is valid 226 | if args.target == "default": 227 | args.target = ",".join([x[0] for x in target_choices if x[1]]) 228 | elif args.target == "all": 229 | args.target = ",".join([x[0] for x in target_choices]) 230 | 231 | app.supported_targets = [x[0] for x in target_choices] 232 | 233 | for target in args.target.split(","): 234 | if target not in app.supported_targets: 235 | print("Invalid target: " + target) 236 | exit(1) 237 | 238 | app.setting_target = args.target 239 | 240 | # Check if the Arduino path is valid 241 | if args.copy: 242 | if check_arduino_path(args.arduino_path): 243 | app.setting_enable_copy = True 244 | elif args.arduino_path == arduino_default_path(): 245 | print("Warning: Default Arduino path not found. Disabling copy to Arduino.") 246 | app.setting_enable_copy = False 247 | else: 248 | print("Invalid path to Arduino core: " + os.path.abspath(args.arduino_path)) 249 | exit(1) 250 | else: 251 | app.setting_enable_copy = False 252 | 253 | # Set the other options 254 | app.setting_arduino_path = os.path.abspath(args.arduino_path) 255 | app.setting_arduino_branch = args.arduino_branch 256 | app.setting_idf_branch = args.idf_branch 257 | app.setting_idf_commit = args.idf_commit 258 | 259 | # Change to the root directory of the app to the root of the project 260 | os.chdir(app.ROOT_PATH) 261 | 262 | # Main function to run the app 263 | app.run() 264 | 265 | # Propagate the exit code from the app 266 | exit(app.return_code or 0) 267 | 268 | if __name__ == "__main__": 269 | # If this script is run directly, start the app 270 | main() 271 | -------------------------------------------------------------------------------- /tools/config_editor/compile.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import subprocess 3 | import os 4 | 5 | from rich.console import RenderableType 6 | 7 | from textual import on, work 8 | from textual.app import ComposeResult 9 | from textual.binding import Binding 10 | from textual.events import ScreenResume 11 | from textual.containers import Container 12 | from textual.screen import Screen 13 | from textual.widgets import Header, Static, RichLog, Button, Footer 14 | 15 | class CompileScreen(Screen): 16 | # Compile screen 17 | 18 | # Set the key bindings 19 | BINDINGS = [ 20 | Binding("escape", "back", "Back") 21 | ] 22 | 23 | # Child process running the libraries compilation 24 | child_process = None 25 | 26 | log_widget: RichLog 27 | button_widget: Button 28 | 29 | def action_back(self) -> None: 30 | self.workers.cancel_all() 31 | if self.child_process: 32 | # Terminate the child process if it is running 33 | print("Terminating child process") 34 | self.child_process.terminate() 35 | try: 36 | self.child_process.stdout.close() 37 | self.child_process.stderr.close() 38 | except: 39 | pass 40 | self.child_process.wait() 41 | self.dismiss() 42 | 43 | def print_output(self, renderable: RenderableType, style=None) -> None: 44 | # Print output to the RichLog widget 45 | if style is None: 46 | self.log_widget.write(renderable) 47 | else: 48 | # Check the available styles at https://rich.readthedocs.io/en/stable/style.html 49 | self.log_widget.write("[" + str(style) + "]" + renderable) 50 | 51 | def print_error(self, error: str) -> None: 52 | # Print error to the RichLog widget 53 | self.log_widget.write("[b bright_red]" + error) 54 | self.button_widget.add_class("-error") 55 | #print("Error: " + error) # For debugging 56 | 57 | def print_success(self, message: str) -> None: 58 | # Print success message to the RichLog widget 59 | self.log_widget.write("[b bright_green]" + message) 60 | self.button_widget.add_class("-success") 61 | #print("Success: " + message) # For debugging 62 | 63 | def print_info(self, message: str) -> None: 64 | # Print info message to the RichLog widget 65 | self.log_widget.write("[b bright_cyan]" + message) 66 | #print("Info: " + message) # For debugging 67 | 68 | @work(name="compliation_worker", group="compilation", exclusive=True, thread=True) 69 | def compile_libs(self) -> None: 70 | # Compile the libraries 71 | print("Starting compilation process") 72 | 73 | label = self.query_one("#compile-title", Static) 74 | self.child_process = None 75 | if self.app.setting_target == ",".join(self.app.supported_targets): 76 | target = "all targets" 77 | else: 78 | target = self.app.setting_target.replace(",", ", ").upper() 79 | 80 | label.update("Compiling for " + target) 81 | self.print_info("======== Compiling for " + target + " ========") 82 | 83 | command = ["./build.sh", "-t", self.app.setting_target] 84 | 85 | #command.append("--help") # For testing output without compiling 86 | 87 | if self.app.setting_enable_copy: 88 | if os.path.isdir(self.app.setting_arduino_path): 89 | command.extend(["-c", self.app.setting_arduino_path]) 90 | else: 91 | self.print_error("Invalid path to Arduino core: " + self.app.setting_arduino_path) 92 | label.update("Invalid path to Arduino core") 93 | return 94 | 95 | if self.app.setting_arduino_branch: 96 | command.extend(["-A", self.app.setting_arduino_branch]) 97 | 98 | if self.app.setting_idf_branch: 99 | command.extend(["-I", self.app.setting_idf_branch]) 100 | 101 | if self.app.setting_idf_commit: 102 | command.extend(["-i", self.app.setting_idf_commit]) 103 | 104 | self.print_info("Running: " + " ".join(command) + "\n") 105 | self.child_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) 106 | try: 107 | for output in self.child_process.stdout: 108 | if output == '' and self.child_process.poll() is not None: 109 | break 110 | if output: 111 | self.print_output(output.strip()) # Update RichLog widget with subprocess output 112 | self.child_process.stdout.close() 113 | except Exception as e: 114 | print("Error reading child process output: " + str(e)) 115 | print("Process might have terminated") 116 | 117 | if not self.child_process: 118 | self.print_error("Compilation failed for " + target + "Child process failed to start") 119 | label.update("Compilation failed for " + target + "Child process failed to start") 120 | return 121 | else: 122 | self.child_process.wait() 123 | 124 | if self.child_process.returncode != 0: 125 | self.print_error("Compilation failed for " + target + ". Return code: " + str(self.child_process.returncode)) 126 | self.print_error("Errors:") 127 | try: 128 | for error in self.child_process.stderr: 129 | if error: 130 | self.print_error(error.strip()) 131 | self.child_process.stderr.close() 132 | except Exception as e: 133 | print("Error reading child process errors: " + str(e)) 134 | label.update("Compilation failed for " + target) 135 | else: 136 | self.print_success("Compilation successful for " + target) 137 | label.update("Compilation successful for " + target) 138 | 139 | def on_button_pressed(self, event: Button.Pressed) -> None: 140 | # Event handler called when a button is pressed 141 | self.action_back() 142 | 143 | @on(ScreenResume) 144 | def on_resume(self) -> None: 145 | # Event handler called every time the screen is activated 146 | print("Compile screen resumed. Clearing logs and starting compilation process") 147 | self.button_widget.remove_class("-error") 148 | self.button_widget.remove_class("-success") 149 | self.log_widget.clear() 150 | self.log_widget.focus() 151 | self.compile_libs() 152 | 153 | def compose(self) -> ComposeResult: 154 | # Compose the compilation screen 155 | yield Header() 156 | with Container(id="compile-log-container"): 157 | self.log_widget = RichLog(markup=True, id="compile-log") 158 | yield self.log_widget 159 | with Container(id="compile-status-container"): 160 | yield Static("Compiling for ...", id="compile-title") 161 | self.button_widget = Button("Back", id="compile-back-button") 162 | yield self.button_widget 163 | yield Footer() 164 | -------------------------------------------------------------------------------- /tools/config_editor/editor.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from textual import on 4 | from textual.app import ComposeResult 5 | from textual.binding import Binding 6 | from textual.containers import Container, VerticalScroll, Horizontal 7 | from textual.screen import Screen 8 | from textual.events import ScreenResume 9 | from textual.widgets import DirectoryTree, Header, TextArea, Button, Footer 10 | 11 | class EditorScreen(Screen): 12 | # Configuration file editor screen 13 | 14 | # Set the key bindings 15 | BINDINGS = [ 16 | Binding("ctrl+s", "save", "Save", priority=True), 17 | Binding("escape", "app.pop_screen", "Discard") 18 | ] 19 | 20 | # Current file being edited 21 | current_file = "" 22 | 23 | def action_save(self) -> None: 24 | code_view = self.query_one("#code", TextArea) 25 | current_text = code_view.text 26 | try: 27 | file = open(self.curent_file, "w") 28 | file.write(current_text) 29 | file.close() 30 | except Exception: 31 | print("Error saving file: " + self.curent_file) 32 | self.sub_title = "ERROR" 33 | else: 34 | print("File saved: " + self.curent_file) 35 | self.sub_title = self.curent_file 36 | self.dismiss() 37 | 38 | def on_button_pressed(self, event: Button.Pressed) -> None: 39 | # Event handler called when a button is pressed 40 | if event.button.id == "save-editor-button" and self.curent_file != "": 41 | print("Save button pressed. Trying to save file: " + self.curent_file) 42 | self.action_save() 43 | elif event.button.id == "cancel-editor-button": 44 | print("Cancel button pressed") 45 | self.dismiss() 46 | 47 | def on_directory_tree_file_selected(self, event: DirectoryTree.FileSelected) -> None: 48 | # Called when the user click a file in the directory tree 49 | event.stop() 50 | code_view = self.query_one("#code", TextArea) 51 | code_view.clear() 52 | self.curent_file = str(event.path) 53 | try: 54 | print("Opening file: " + self.curent_file) 55 | file = open(self.curent_file, "r") 56 | file_content = file.read() 57 | file.close() 58 | except Exception: 59 | print("Error opening file: " + self.curent_file) 60 | self.sub_title = "ERROR" 61 | else: 62 | print("File opened: " + self.curent_file) 63 | code_view.insert(file_content) 64 | self.sub_title = self.curent_file 65 | 66 | @on(ScreenResume) 67 | def on_resume(self) -> None: 68 | # Event handler called every time the screen is activated 69 | print("Editor screen resumed. Clearing code view") 70 | self.sub_title = "Select a file" 71 | self.query_one(DirectoryTree).focus() 72 | self.query_one(TextArea).clear() 73 | self.curent_file = "" 74 | 75 | def compose(self) -> ComposeResult: 76 | # Compose editor screen 77 | path = os.path.join(self.app.ROOT_PATH, 'configs') 78 | yield Header() 79 | with Container(): 80 | yield DirectoryTree(path, id="tree-view") 81 | with VerticalScroll(id="code-view"): 82 | yield TextArea.code_editor("", id="code") 83 | with Horizontal(id="editor-buttons-container"): 84 | yield Button("Save", id="save-editor-button", classes="editor-button") 85 | yield Button("Cancel", id="cancel-editor-button", classes="editor-button") 86 | yield Footer() 87 | -------------------------------------------------------------------------------- /tools/config_editor/requirements.txt: -------------------------------------------------------------------------------- 1 | textual==0.79.0 2 | -------------------------------------------------------------------------------- /tools/config_editor/settings.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | from textual import on 4 | from textual.app import ComposeResult 5 | from textual.binding import Binding 6 | from textual.containers import VerticalScroll, Container, Horizontal 7 | from textual.screen import Screen 8 | from textual.events import ScreenResume 9 | from textual.widgets import Header, Button, Switch, Label, Footer, Checkbox 10 | 11 | from widgets import LabelledInput, LabelledSelect 12 | 13 | class SettingsScreen(Screen): 14 | # Settings screen 15 | 16 | # Set the key bindings 17 | BINDINGS = [ 18 | Binding("s", "save", "Save"), 19 | Binding("escape", "app.pop_screen", "Discard") 20 | ] 21 | 22 | enable_copy_switch: Switch 23 | arduino_path_input: LabelledInput 24 | arduino_branch_input: LabelledInput 25 | idf_branch_input: LabelledInput 26 | idf_commit_input: LabelledInput 27 | 28 | def action_save(self) -> None: 29 | checkboxes = self.query(Checkbox) 30 | self.app.setting_target = "" 31 | for checkbox in checkboxes: 32 | if checkbox.value: 33 | if self.app.setting_target: 34 | self.app.setting_target += "," 35 | self.app.setting_target += checkbox.id.replace("-checkbox", "") 36 | print("Target setting updated: " + self.app.setting_target) 37 | 38 | self.app.setting_enable_copy = self.enable_copy_switch.value 39 | print("Enable copy setting updated: " + str(self.app.setting_enable_copy)) 40 | 41 | if self.enable_copy_switch.value: 42 | self.app.setting_arduino_path = self.arduino_path_input.get_input_value() 43 | print("Arduino path setting updated: " + self.app.setting_arduino_path) 44 | 45 | self.app.setting_arduino_branch = self.arduino_branch_input.get_input_value() 46 | print("Arduino branch setting updated: " + self.app.setting_arduino_branch) 47 | 48 | self.app.setting_idf_branch = self.idf_branch_input.get_input_value() 49 | print("IDF branch setting updated: " + self.app.setting_idf_branch) 50 | 51 | self.app.setting_idf_commit = self.idf_commit_input.get_input_value() 52 | print("IDF commit setting updated: " + self.app.setting_idf_commit) 53 | 54 | 55 | def on_button_pressed(self, event: Button.Pressed) -> None: 56 | # Event handler called when a button is pressed 57 | if event.button.id == "save-settings-button": 58 | print("Save button pressed") 59 | self.action_save() 60 | elif event.button.id == "cancel-settings-button": 61 | print("Cancel button pressed") 62 | self.dismiss() 63 | 64 | @on(ScreenResume) 65 | def on_resume(self) -> None: 66 | # Event handler called every time the screen is activated 67 | print("Settings screen resumed. Updating settings.") 68 | targets = self.app.setting_target.split(",") 69 | checkboxes = self.query(Checkbox) 70 | for checkbox in checkboxes: 71 | checkbox.value = False 72 | if checkbox.id.replace("-checkbox", "") in targets: 73 | checkbox.value = True 74 | self.enable_copy_switch.value = self.app.setting_enable_copy 75 | if self.app.setting_enable_copy: 76 | self.arduino_path_input.visible = True 77 | else: 78 | self.arduino_path_input.visible = False 79 | self.arduino_path_input.set_input_value(self.app.setting_arduino_path) 80 | self.arduino_branch_input.set_input_value(self.app.setting_arduino_branch) 81 | self.idf_branch_input.set_input_value(self.app.setting_idf_branch) 82 | self.idf_commit_input.set_input_value(self.app.setting_idf_commit) 83 | 84 | def on_switch_changed(self, event: Switch.Changed) -> None: 85 | # Event handler called when a switch is changed 86 | if event.switch.id == "enable-copy-switch": 87 | if event.switch.value: 88 | self.arduino_path_input.visible = True 89 | else: 90 | self.arduino_path_input.visible = False 91 | 92 | def compose(self) -> ComposeResult: 93 | # Compose the target selection screen 94 | yield Header() 95 | with VerticalScroll(id="settings-scroll-container"): 96 | 97 | yield Label("Compilation Targets", id="settings-target-label") 98 | with Container(id="settings-target-container"): 99 | for target in self.app.supported_targets: 100 | yield Checkbox(target.upper(), id=target + "-checkbox") 101 | 102 | with Horizontal(classes="settings-switch-container"): 103 | self.enable_copy_switch = Switch(value=self.app.setting_enable_copy, id="enable-copy-switch") 104 | yield self.enable_copy_switch 105 | 106 | yield Label("Copy to arduino-esp32 after compilation") 107 | 108 | self.arduino_path_input = LabelledInput("Arduino-esp32 Path", placeholder="Path to your arduino-esp32 installation", value=self.app.setting_arduino_path, id="arduino-path-input") 109 | yield self.arduino_path_input 110 | 111 | self.arduino_branch_input = LabelledInput("Arduino-esp32 Branch", placeholder="Leave empty to use default", value=self.app.setting_arduino_branch, id="arduino-branch-input") 112 | yield self.arduino_branch_input 113 | 114 | self.idf_branch_input = LabelledInput("ESP-IDF Branch", placeholder="Leave empty to use default", value=self.app.setting_idf_branch, id="idf-branch-input") 115 | yield self.idf_branch_input 116 | 117 | self.idf_commit_input = LabelledInput("ESP-IDF Commit", placeholder="Leave empty to use default", value=self.app.setting_idf_commit, id="idf-commit-input") 118 | yield self.idf_commit_input 119 | 120 | with Horizontal(id="settings-button-container"): 121 | yield Button("Save", id="save-settings-button", classes="settings-button") 122 | yield Button("Cancel", id="cancel-settings-button", classes="settings-button") 123 | yield Footer() 124 | 125 | def on_mount(self) -> None: 126 | # Event handler called when the screen is mounted for the first time 127 | self.sub_title = "Settings" 128 | target_container = self.query_one("#settings-target-container") 129 | # Height needs to be 3 for each row of targets + 1 130 | height_value = str(int(math.ceil(len(self.app.supported_targets) / int(target_container.styles.grid_size_columns)) * 3 + 1)) 131 | print("Target container height: " + height_value) 132 | target_container.styles.height = height_value 133 | print("Settings screen mounted") 134 | -------------------------------------------------------------------------------- /tools/config_editor/style.tcss: -------------------------------------------------------------------------------- 1 | # General 2 | 3 | Screen { 4 | background: $surface-darken-1; 5 | } 6 | 7 | Button { 8 | width: auto; 9 | min-width: 16; 10 | height: auto; 11 | color: $text; 12 | border: none; 13 | background: #038c8c; 14 | border-top: tall #026868; 15 | border-bottom: tall #6ab8b8; 16 | text-align: center; 17 | content-align: center middle; 18 | text-style: bold; 19 | 20 | &:focus { 21 | text-style: bold reverse; 22 | } 23 | &:hover { 24 | border-top: tall #014444; 25 | border-bottom: tall #3d8080; 26 | background: #025b5b; 27 | color: $text; 28 | } 29 | &.-active { 30 | background: #025b5b; 31 | border-bottom: tall #3d8080; 32 | border-top: tall #014444; 33 | tint: $background 30%; 34 | } 35 | 36 | &.-success { 37 | background: $success; 38 | color: $text; 39 | border-top: tall $success-lighten-2; 40 | border-bottom: tall $success-darken-3; 41 | 42 | &:hover { 43 | background: $success-darken-2; 44 | color: $text; 45 | border-top: tall $success; 46 | } 47 | 48 | &.-active { 49 | background: $success; 50 | border-bottom: tall $success-lighten-2; 51 | border-top: tall $success-darken-2; 52 | } 53 | } 54 | 55 | &.-error { 56 | background: $error; 57 | color: $text; 58 | border-top: tall $error-lighten-2; 59 | border-bottom: tall $error-darken-3; 60 | 61 | &:hover { 62 | background: $error-darken-1; 63 | color: $text; 64 | border-top: tall $error; 65 | } 66 | 67 | &.-active { 68 | background: $error; 69 | border-bottom: tall $error-lighten-2; 70 | border-top: tall $error-darken-2; 71 | } 72 | } 73 | } 74 | 75 | # Main Screen 76 | 77 | .main-menu-button { 78 | margin-bottom: 1; 79 | min-width: 100%; 80 | max-width: 0.4fr; 81 | } 82 | 83 | #main-menu-container { 84 | align: center middle; 85 | width: 1fr; 86 | } 87 | 88 | #main-menu-title { 89 | text-align: center; 90 | margin-bottom: 4; 91 | text-style: bold; 92 | color: auto; 93 | width: 0.4fr; 94 | } 95 | 96 | # Compile Screen 97 | 98 | #compile-status-container { 99 | layout: horizontal; 100 | padding: 0 2; 101 | height: 4; 102 | } 103 | 104 | #compile-title { 105 | dock: left; 106 | } 107 | 108 | #compile-back-button { 109 | dock: right; 110 | } 111 | 112 | #compile-log { 113 | background: $surface; 114 | padding: 0 1 1 1; 115 | margin: 1 2; 116 | } 117 | 118 | # Settings Screen 119 | 120 | #settings-scroll-container { 121 | padding: 1; 122 | } 123 | 124 | #settings-button-container { 125 | width: 100%; 126 | max-height: 20%; 127 | min-height: 5; 128 | align: center middle; 129 | } 130 | 131 | #settings-target-label { 132 | margin-left: 1; 133 | } 134 | 135 | #settings-target-container { 136 | layout: grid; 137 | grid-size: 4; 138 | } 139 | 140 | #settings-target-container Checkbox { 141 | width: 100%; 142 | margin-right: -1; 143 | } 144 | 145 | .settings-button { 146 | margin: 1; 147 | min-width: 100%; 148 | max-width: 0.2fr; 149 | align: center middle; 150 | } 151 | 152 | .settings-switch-container { 153 | height: 4; 154 | } 155 | 156 | .settings-switch-container Switch { 157 | margin-right: 2; 158 | } 159 | 160 | .settings-switch-container Label { 161 | margin-top: 1; 162 | } 163 | 164 | # Editor Screen 165 | 166 | #tree-view { 167 | display: none; 168 | scrollbar-gutter: stable; 169 | overflow: auto; 170 | width: auto; 171 | height: 100%; 172 | dock: left; 173 | display: block; 174 | max-width: 50%; 175 | } 176 | 177 | #code-view { 178 | overflow: auto scroll; 179 | min-width: 100%; 180 | } 181 | 182 | #code { 183 | width: 100%; 184 | } 185 | 186 | .editor-button { 187 | width: 20%; 188 | } 189 | 190 | #save-editor-button { 191 | dock: left; 192 | margin: 1; 193 | } 194 | 195 | #cancel-editor-button { 196 | dock: right; 197 | margin: 1 3; 198 | } 199 | 200 | #editor-buttons-container { 201 | height: 5; 202 | } 203 | -------------------------------------------------------------------------------- /tools/config_editor/widgets.py: -------------------------------------------------------------------------------- 1 | from textual.widget import Widget 2 | 3 | from textual.widgets import Input, Label, Select 4 | 5 | class LabelledInput(Widget): 6 | DEFAULT_CSS = """ 7 | LabelledInput { 8 | height: 4; 9 | margin-bottom: 1; 10 | } 11 | LabelledInput Label { 12 | padding-left: 1; 13 | } 14 | """ 15 | 16 | label_widget: Label 17 | input_widget: Input 18 | 19 | def set_input_value(self, value): 20 | self.input_widget.value = value 21 | 22 | def get_input_value(self): 23 | return self.input_widget.value 24 | 25 | def __init__(self, 26 | label, 27 | *, 28 | placeholder="", 29 | value="", 30 | name=None, 31 | id=None, 32 | classes=None, 33 | disabled=False): 34 | super().__init__(name=name, id=id, classes=classes, disabled=disabled) 35 | self.__label = label 36 | self.__placeholder = placeholder 37 | self.__init_value = value 38 | 39 | def compose(self): 40 | self.label_widget = Label(f"{self.__label}:") 41 | self.input_widget = Input(placeholder=self.__placeholder, value=self.__init_value) 42 | yield self.label_widget 43 | yield self.input_widget 44 | 45 | 46 | class LabelledSelect(Widget): 47 | DEFAULT_CSS = """ 48 | LabelledSelect { 49 | height: 4; 50 | margin-bottom: 1; 51 | } 52 | LabelledSelect Label { 53 | padding-left: 1; 54 | } 55 | """ 56 | 57 | label_widget: Label 58 | select_widget: Select 59 | 60 | def set_select_options(self, options): 61 | self.__options = options 62 | self.select_widget.options = options 63 | 64 | def get_select_options(self): 65 | return self.__options 66 | 67 | def set_select_value(self, value): 68 | self.select_widget.value = value 69 | 70 | def get_select_value(self): 71 | return self.select_widget.value 72 | 73 | def __init__(self, 74 | label, 75 | options, 76 | *, 77 | prompt="Select", 78 | allow_blank=True, 79 | value=Select.BLANK, 80 | name=None, 81 | id=None, 82 | classes=None, 83 | disabled=False): 84 | super().__init__(name=name, id=id, classes=classes, disabled=disabled) 85 | self.__label = label 86 | self.__options = options 87 | self.__init_value = value 88 | self.__prompt = prompt 89 | self.__allow_blank = allow_blank 90 | 91 | def compose(self): 92 | self.label_widget = Label(f"{self.__label}:") 93 | self.select_widget = Select(options=self.__options, value=self.__init_value, prompt=self.__prompt, allow_blank=self.__allow_blank) 94 | yield self.label_widget 95 | yield self.select_widget 96 | -------------------------------------------------------------------------------- /tools/copy-bootloader.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IDF_TARGET=$1 4 | FLASH_MODE="$2" 5 | FLASH_FREQ="$3" 6 | BOOTCONF=$FLASH_MODE"_$FLASH_FREQ" 7 | 8 | source ./tools/config.sh 9 | 10 | echo "Copying bootloader: $AR_SDK/bin/bootloader_$BOOTCONF.elf" 11 | 12 | mkdir -p "$AR_SDK/bin" 13 | 14 | cp "build/bootloader/bootloader.elf" "$AR_SDK/bin/bootloader_$BOOTCONF.elf" 15 | -------------------------------------------------------------------------------- /tools/copy-libs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # config 3 | 4 | IDF_TARGET=$1 5 | IS_XTENSA=$4 6 | OCT_FLASH="$2" 7 | OCT_PSRAM= 8 | 9 | if [ "$3" = "y" ]; then 10 | OCT_PSRAM="opi" 11 | else 12 | OCT_PSRAM="qspi" 13 | fi 14 | MEMCONF=$OCT_FLASH"_$OCT_PSRAM" 15 | 16 | source ./tools/config.sh 17 | 18 | echo "IDF_TARGET: $IDF_TARGET, MEMCONF: $MEMCONF, PWD: $PWD, OUT: $AR_SDK" 19 | 20 | # clean previous 21 | if [ -e "$AR_SDK/sdkconfig" ]; then 22 | rm -rf "$AR_SDK/sdkconfig" 23 | fi 24 | if [ -e "$AR_SDK/lib" ]; then 25 | rm -rf "$AR_SDK/lib" 26 | fi 27 | if [ -e "$AR_SDK/ld" ]; then 28 | rm -rf "$AR_SDK/ld" 29 | fi 30 | if [ -e "$AR_SDK/include" ]; then 31 | rm -rf "$AR_SDK/include" 32 | fi 33 | if [ -e "$AR_SDK/flags" ]; then 34 | rm -rf "$AR_SDK/flags" 35 | fi 36 | if [ -e "$AR_SDK/$MEMCONF" ]; then 37 | rm -rf "$AR_SDK/$MEMCONF" 38 | fi 39 | if [ -e "$AR_SDK/pioarduino-build.py" ]; then 40 | rm -rf "$AR_SDK/pioarduino-build.py" 41 | fi 42 | 43 | mkdir -p "$AR_SDK" 44 | mkdir -p "$AR_SDK/lib" 45 | 46 | function get_actual_path(){ 47 | d="$1"; 48 | if [ -d "$d" ]; then 49 | p="$PWD"; cd "$d"; r="$PWD"; cd "$p"; echo "$r"; 50 | else 51 | echo ""; 52 | fi 53 | } 54 | 55 | # 56 | # START OF DATA EXTRACTION FROM CMAKE 57 | # 58 | 59 | C_FLAGS="" 60 | CPP_FLAGS="" 61 | AS_FLAGS="" 62 | 63 | INCLUDES="" 64 | DEFINES="" 65 | 66 | EXCLUDE_LIBS=";" 67 | 68 | LD_FLAGS="" 69 | LD_LIBS="" 70 | LD_LIB_FILES="" 71 | LD_LIBS_SEARCH="" 72 | LD_SCRIPTS="" 73 | LD_SCRIPT_DIRS="" 74 | 75 | PIO_CC_FLAGS="-flto=auto " 76 | PIO_C_FLAGS="-flto=auto " 77 | PIO_CXX_FLAGS="-flto=auto " 78 | PIO_AS_FLAGS="" 79 | PIO_LD_FLAGS="-flto " 80 | PIO_LD_FUNCS="" 81 | PIO_LD_SCRIPTS="" 82 | 83 | TOOLCHAIN_PREFIX="" 84 | if [ "$IS_XTENSA" = "y" ]; then 85 | TOOLCHAIN="xtensa-$IDF_TARGET-elf" 86 | else 87 | TOOLCHAIN="riscv32-esp-elf" 88 | fi 89 | 90 | # copy zigbee + zboss lib 91 | if [ -d "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET/" ]; then 92 | cp -r "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" 93 | EXCLUDE_LIBS+="esp_zb_api.ed;esp_zb_api.zczr;" 94 | fi 95 | 96 | if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then 97 | cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" 98 | EXCLUDE_LIBS+="zboss_stack.ed;zboss_stack.zczr;zboss_port.native;zboss_port.native.debug;zboss_port.remote;zboss_port.remote.debug;" 99 | fi 100 | 101 | #collect includes, defines and c-flags 102 | str=`cat build/compile_commands.json | grep arduino-lib-builder-gcc.c | grep command | cut -d':' -f2 | cut -d',' -f1` 103 | str="${str:2:${#str}-1}" #remove leading space and quotes 104 | str=`printf '%b' "$str"` #unescape the string 105 | set -- $str 106 | for item in "${@:2:${#@}-5}"; do 107 | prefix="${item:0:2}" 108 | if [ "$prefix" = "-I" ]; then 109 | item="${item:2}" 110 | if [ "${item:0:1}" = "/" ]; then 111 | item=`get_actual_path $item` 112 | INCLUDES+="$item " 113 | elif [ "${item:0:2}" = ".." ]; then 114 | if [[ "${item:0:14}" = "../components/" && "${item:0:22}" != "../components/arduino/" ]] || [[ "${item:0:11}" = "../esp-idf/" ]] || [[ "${item:0:22}" = "../managed_components/" ]]; then 115 | item="$PWD${item:2}" 116 | item=`get_actual_path $item` 117 | INCLUDES+="$item " 118 | fi 119 | else 120 | item="$PWD/build/$item" 121 | item=`get_actual_path $item` 122 | INCLUDES+="$item " 123 | fi 124 | elif [ "$prefix" = "-D" ]; then 125 | if [[ "${item:2:7}" != "ARDUINO" ]] && [[ "$item" != "-DESP32=ESP32" ]] && [[ "$item" != "-DNDEBUG" ]]; then #skip ARDUINO defines 126 | DEFINES+="$item " 127 | fi 128 | elif [ "$prefix" = "-O" ]; then 129 | PIO_CC_FLAGS+="$item " 130 | elif [[ "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" ]]; then 131 | if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" && "${item:0:19}" != "-fdebug-prefix-map=" && "${item:0:8}" != "-fno-lto" ]]; then 132 | C_FLAGS+="$item " 133 | fi 134 | fi 135 | done 136 | 137 | #collect asm-flags 138 | str=`cat build/compile_commands.json | grep arduino-lib-builder-as.S | grep command | cut -d':' -f2 | cut -d',' -f1` 139 | str="${str:2:${#str}-1}" #remove leading space and quotes 140 | str=`printf '%b' "$str"` #unescape the string 141 | set -- $str 142 | for item in "${@:2:${#@}-5}"; do 143 | prefix="${item:0:2}" 144 | if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$item" != "-fno-lto" && "$prefix" != "-O" ]]; then 145 | if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" && "${item:0:19}" != "-fdebug-prefix-map=" ]]; then 146 | AS_FLAGS+="$item " 147 | if [[ $C_FLAGS == *"$item"* ]]; then 148 | PIO_CC_FLAGS+="$item " 149 | else 150 | PIO_AS_FLAGS+="$item " 151 | fi 152 | fi 153 | fi 154 | done 155 | 156 | #collect cpp-flags 157 | str=`cat build/compile_commands.json | grep arduino-lib-builder-cpp.cpp | grep command | cut -d':' -f2 | cut -d',' -f1` 158 | str="${str:2:${#str}-1}" #remove leading space and quotes 159 | str=`printf '%b' "$str"` #unescape the string 160 | set -- $str 161 | for item in "${@:2:${#@}-5}"; do 162 | prefix="${item:0:2}" 163 | if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$item" != "-fno-lto" && "$prefix" != "-O" ]]; then 164 | if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" && "${item:0:19}" != "-fdebug-prefix-map=" ]]; then 165 | CPP_FLAGS+="$item " 166 | if [[ $PIO_CC_FLAGS != *"$item"* ]]; then 167 | PIO_CXX_FLAGS+="$item " 168 | fi 169 | fi 170 | fi 171 | done 172 | 173 | set -- $C_FLAGS 174 | for item; do 175 | if [[ $PIO_CC_FLAGS != *"$item"* ]]; then 176 | PIO_C_FLAGS+="$item " 177 | fi 178 | done 179 | 180 | #parse link command to extract libs and flags 181 | add_next=0 182 | is_dir=0 183 | is_script=0 184 | if [ -f "build/CMakeFiles/arduino-lib-builder.elf.dir/link.txt" ]; then 185 | str=`cat build/CMakeFiles/arduino-lib-builder.elf.dir/link.txt` 186 | else 187 | libs=`cat build/build.ninja | grep LINK_LIBRARIES` 188 | libs="${libs:19:${#libs}-1}" 189 | flags=`cat build/build.ninja | grep LINK_FLAGS` 190 | flags="${flags:15:${#flags}-1}" 191 | paths=`cat build/build.ninja | grep LINK_PATH` 192 | paths="${paths:14:${#paths}-1}" 193 | if [ "$IDF_TARGET" = "esp32" ]; then 194 | flags="-Wno-frame-address $flags" 195 | fi 196 | if [ "$IS_XTENSA" = "y" ]; then 197 | flags="-mlongcalls $flags" 198 | fi 199 | str="$flags $libs $paths" 200 | fi 201 | if [ "$IDF_TARGET" = "esp32" ]; then 202 | LD_SCRIPTS+="-T esp32.rom.redefined.ld " 203 | PIO_LD_SCRIPTS+="esp32.rom.redefined.ld " 204 | fi 205 | set -- $str 206 | for item; do 207 | prefix="${item:0:1}" 208 | if [ "$prefix" = "-" ]; then 209 | if [ "${item:0:10}" != "-Wl,--Map=" ]; then 210 | if [ "$item" = "-L" ]; then # -L /path 211 | add_next=1 212 | is_dir=1 213 | elif [ "${item:0:2}" = "-L" ]; then # -L/path 214 | LD_SCRIPT_DIRS+="${item:2} " 215 | elif [ "$item" = "-T" ]; then # -T script.ld 216 | add_next=1 217 | is_script=1 218 | LD_SCRIPTS+="$item " 219 | elif [ "$item" = "-u" ]; then # -u function_name 220 | add_next=1 221 | LD_FLAGS+="$item " 222 | elif [ "${item:0:2}" = "-l" ]; then # -l[lib_name] 223 | short_name="${item:2}" 224 | if [[ $EXCLUDE_LIBS != *";$short_name;"* ]]; then 225 | LD_LIBS+="$item " 226 | exclude_libs=";m;c;gcc;stdc++;" 227 | if [[ $exclude_libs != *";$short_name;"* && $LD_LIBS_SEARCH != *"lib$short_name.a"* ]]; then 228 | LD_LIBS_SEARCH+="lib$short_name.a " 229 | #echo "1. lib add: $item" 230 | fi 231 | fi 232 | elif [ "$item" = "-o" ]; then 233 | add_next=0 234 | is_script=0 235 | is_dir=0 236 | elif [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:19}" != "-fdebug-prefix-map=" && "${item:0:8}" != "-fno-lto" && "${item:0:17}" != "-Wl,--start-group" && "${item:0:15}" != "-Wl,--end-group" ]]; then 237 | LD_FLAGS+="$item " 238 | PIO_LD_FLAGS+="$item " 239 | fi 240 | fi 241 | else 242 | if [ "$add_next" = "1" ]; then 243 | add_next=0 244 | if [ "$is_dir" = "1" ]; then 245 | is_dir=0 246 | LD_SCRIPT_DIRS+="$item " 247 | elif [ "$is_script" = "1" ]; then 248 | is_script=0 249 | LD_SCRIPTS+="$item " 250 | PIO_LD_SCRIPTS+="$item " 251 | else 252 | LD_FLAGS+="$item " 253 | PIO_LD_FUNCS+="$item " 254 | fi 255 | else 256 | if [ "${item:${#item}-2:2}" = ".a" ]; then 257 | if [ "${item:0:1}" != "/" ]; then 258 | item="$PWD/build/$item" 259 | fi 260 | lname=$(basename $item) 261 | lname="${lname:3:${#lname}-5}" 262 | if [[ "$lname" != "main" && "$lname" != "arduino" ]]; then 263 | lsize=$($SSTAT "$item") 264 | if (( lsize > 8 )); then 265 | # do we already have this file? 266 | if [[ $LD_LIB_FILES != *"$item"* ]]; then 267 | # do we already have lib with the same name? 268 | if [[ $LD_LIBS != *"-l$lname"* ]]; then 269 | if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then 270 | #echo "2. collecting lib '$lname' and file: $item" 271 | LD_LIB_FILES+="$item " 272 | LD_LIBS+="-l$lname " 273 | fi 274 | else 275 | # echo "!!! need to rename: '$lname'" 276 | for i in {2..9}; do 277 | n_item="${item:0:${#item}-2}_$i.a" 278 | n_name=$lname"_$i" 279 | if [ -f "$n_item" ]; then 280 | if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then 281 | #echo "3. renamed add: -l$n_name" 282 | LD_LIBS+="-l$n_name " 283 | fi 284 | break 285 | elif [[ $LD_LIB_FILES != *"$n_item"* && $LD_LIBS != *"-l$n_name"* ]]; then 286 | if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then 287 | #echo "4. Renaming '$lname' to '$n_name': $item" 288 | cp -f "$item" "$n_item" 289 | LD_LIB_FILES+="$n_item " 290 | LD_LIBS+="-l$n_name " 291 | fi 292 | break 293 | fi 294 | done 295 | fi 296 | else 297 | if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then 298 | #echo "5. just add: -l$lname" 299 | LD_LIBS+="-l$lname " 300 | fi 301 | fi 302 | else 303 | echo "*** Skipping $(basename $item): size too small $lsize" 304 | fi 305 | fi 306 | elif [[ "${item:${#item}-4:4}" = ".obj" || "${item:${#item}-4:4}" = ".elf" || "${item:${#item}-4:4}" = "-g++" ]]; then 307 | item="$item" 308 | else 309 | echo "*** BAD LD ITEM: $item ${item:${#item}-2:2}" 310 | fi 311 | fi 312 | fi 313 | done 314 | 315 | # 316 | # END OF DATA EXTRACTION FROM CMAKE 317 | # 318 | 319 | mkdir -p "$AR_SDK" 320 | 321 | # start generation of pioarduino-build.py 322 | AR_PLATFORMIO_PY="$AR_SDK/pioarduino-build.py" 323 | cat configs/pio_start.txt > "$AR_PLATFORMIO_PY" 324 | 325 | echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY" 326 | if [ "$IS_XTENSA" = "y" ]; then 327 | echo " \"-mlongcalls\"" >> "$AR_PLATFORMIO_PY" 328 | else 329 | echo " \"-march=rv32imc\"" >> "$AR_PLATFORMIO_PY" 330 | fi 331 | echo " ]," >> "$AR_PLATFORMIO_PY" 332 | echo "" >> "$AR_PLATFORMIO_PY" 333 | 334 | echo " ASPPFLAGS=[" >> "$AR_PLATFORMIO_PY" 335 | set -- $PIO_AS_FLAGS 336 | for item; do 337 | echo " \"$item\"," >> "$AR_PLATFORMIO_PY" 338 | done 339 | echo " \"-x\", \"assembler-with-cpp\"" >> "$AR_PLATFORMIO_PY" 340 | echo " ]," >> "$AR_PLATFORMIO_PY" 341 | echo "" >> "$AR_PLATFORMIO_PY" 342 | 343 | echo " CFLAGS=[" >> "$AR_PLATFORMIO_PY" 344 | set -- $PIO_C_FLAGS 345 | last_item="${@: -1}" 346 | for item in "${@:0:${#@}}"; do 347 | if [ "${item:0:1}" != "/" ]; then 348 | echo " \"$item\"," >> "$AR_PLATFORMIO_PY" 349 | fi 350 | done 351 | echo " \"$last_item\"" >> "$AR_PLATFORMIO_PY" 352 | echo " ]," >> "$AR_PLATFORMIO_PY" 353 | echo "" >> "$AR_PLATFORMIO_PY" 354 | 355 | echo " CXXFLAGS=[" >> "$AR_PLATFORMIO_PY" 356 | set -- $PIO_CXX_FLAGS 357 | last_item="${@: -1}" 358 | for item in "${@:0:${#@}}"; do 359 | if [ "${item:0:1}" != "/" ]; then 360 | echo " \"$item\"," >> "$AR_PLATFORMIO_PY" 361 | fi 362 | done 363 | echo " \"$last_item\"" >> "$AR_PLATFORMIO_PY" 364 | echo " ]," >> "$AR_PLATFORMIO_PY" 365 | echo "" >> "$AR_PLATFORMIO_PY" 366 | 367 | echo " CCFLAGS=[" >> "$AR_PLATFORMIO_PY" 368 | set -- $PIO_CC_FLAGS 369 | for item; do 370 | echo " \"$item\"," >> "$AR_PLATFORMIO_PY" 371 | done 372 | echo " \"-MMD\"" >> "$AR_PLATFORMIO_PY" 373 | echo " ]," >> "$AR_PLATFORMIO_PY" 374 | echo "" >> "$AR_PLATFORMIO_PY" 375 | 376 | echo " LINKFLAGS=[" >> "$AR_PLATFORMIO_PY" 377 | set -- $PIO_LD_FLAGS 378 | for item; do 379 | echo " \"$item\"," >> "$AR_PLATFORMIO_PY" 380 | done 381 | set -- $PIO_LD_SCRIPTS 382 | for item; do 383 | echo " \"-T\", \"$item\"," >> "$AR_PLATFORMIO_PY" 384 | done 385 | set -- $PIO_LD_FUNCS 386 | for item; do 387 | echo " \"-u\", \"$item\"," >> "$AR_PLATFORMIO_PY" 388 | done 389 | echo " '-Wl,-Map=\"%s\"' % join(\"\${BUILD_DIR}\", \"\${PROGNAME}.map\")" >> "$AR_PLATFORMIO_PY" 390 | 391 | echo " ]," >> "$AR_PLATFORMIO_PY" 392 | echo "" >> "$AR_PLATFORMIO_PY" 393 | 394 | # include dirs 395 | REL_INC="" 396 | echo " CPPPATH=[" >> "$AR_PLATFORMIO_PY" 397 | 398 | set -- $INCLUDES 399 | 400 | for item; do 401 | if [[ "$item" != $PWD ]]; then 402 | ipath="$item" 403 | fname=`basename "$ipath"` 404 | dname=`basename $(dirname "$ipath")` 405 | if [[ "$fname" == "main" && "$dname" == $(basename "$PWD") ]]; then 406 | continue 407 | fi 408 | while [[ "$dname" != "components" && "$dname" != "managed_components" && "$dname" != "build" ]]; do 409 | ipath=`dirname "$ipath"` 410 | fname=`basename "$ipath"` 411 | dname=`basename $(dirname "$ipath")` 412 | done 413 | if [[ "$fname" == "arduino" ]]; then 414 | continue 415 | fi 416 | if [[ "$fname" == "config" ]]; then 417 | continue 418 | fi 419 | 420 | out_sub="${item#*$ipath}" 421 | out_cpath="$AR_SDK/include/$fname$out_sub" 422 | REL_INC+="-iwithprefixbefore $fname$out_sub " 423 | if [ "$out_sub" = "" ]; then 424 | echo " join($PIO_SDK, \"include\", \"$fname\")," >> "$AR_PLATFORMIO_PY" 425 | else 426 | pio_sub="${out_sub:1}" 427 | pio_sub=`echo $pio_sub | sed 's/\//\\", \\"/g'` 428 | echo " join($PIO_SDK, \"include\", \"$fname\", \"$pio_sub\")," >> "$AR_PLATFORMIO_PY" 429 | fi 430 | for f in `find "$item" -name '*.h'`; do 431 | rel_f=${f#*$item} 432 | rel_p=${rel_f%/*} 433 | mkdir -p "$out_cpath$rel_p" 434 | cp -n $f "$out_cpath$rel_p/" 435 | done 436 | for f in `find "$item" -name '*.hpp'`; do 437 | rel_f=${f#*$item} 438 | rel_p=${rel_f%/*} 439 | mkdir -p "$out_cpath$rel_p" 440 | cp -n $f "$out_cpath$rel_p/" 441 | done 442 | for f in `find "$item" -name '*.inc'`; do 443 | rel_f=${f#*$item} 444 | rel_p=${rel_f%/*} 445 | mkdir -p "$out_cpath$rel_p" 446 | cp -n $f "$out_cpath$rel_p/" 447 | done 448 | # Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17 449 | if [[ "$fname" == "bt" && "$out_sub" == "/include/$IDF_TARGET/include" && -f "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" ]]; then 450 | mkdir -p "$AR_SDK/include/$fname/controller/$IDF_TARGET" 451 | cp -n "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" "$AR_SDK/include/$fname/controller/$IDF_TARGET/esp_bt_cfg.h" 452 | fi 453 | fi 454 | done 455 | echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")), \"include\")," >> "$AR_PLATFORMIO_PY" 456 | echo " join(FRAMEWORK_DIR, \"cores\", board_config.get(\"build.core\"))" >> "$AR_PLATFORMIO_PY" 457 | echo " ]," >> "$AR_PLATFORMIO_PY" 458 | echo "" >> "$AR_PLATFORMIO_PY" 459 | 460 | AR_LIBS="$LD_LIBS" 461 | PIO_LIBS="" 462 | set -- $LD_LIBS 463 | for item; do 464 | if [ "$PIO_LIBS" != "" ]; then 465 | PIO_LIBS+=", " 466 | fi 467 | PIO_LIBS+="\"$item\"" 468 | done 469 | 470 | set -- $LD_LIB_FILES 471 | for item; do 472 | #echo "***** Stripping $item" 473 | "$TOOLCHAIN-strip" -g "$item" 474 | cp "$item" "$AR_SDK/lib/" 475 | done 476 | 477 | echo " LIBPATH=[" >> "$AR_PLATFORMIO_PY" 478 | echo " join($PIO_SDK, \"lib\")," >> "$AR_PLATFORMIO_PY" 479 | echo " join($PIO_SDK, \"ld\")," >> "$AR_PLATFORMIO_PY" 480 | echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")))" >> "$AR_PLATFORMIO_PY" 481 | echo " ]," >> "$AR_PLATFORMIO_PY" 482 | echo "" >> "$AR_PLATFORMIO_PY" 483 | 484 | echo " LIBS=[" >> "$AR_PLATFORMIO_PY" 485 | echo " $PIO_LIBS" >> "$AR_PLATFORMIO_PY" 486 | echo " ]," >> "$AR_PLATFORMIO_PY" 487 | echo "" >> "$AR_PLATFORMIO_PY" 488 | 489 | echo " CPPDEFINES=[" >> "$AR_PLATFORMIO_PY" 490 | set -- $DEFINES 491 | for item; do 492 | item="${item:2}" #remove -D 493 | item="${item/NDEBUG}" #remove NDEBUG 494 | if [[ $item == *"="* ]]; then 495 | item=(${item//=/ }) 496 | re='^[+-]?[0-9]+([.][0-9]+)?$' 497 | if [[ ${item[1]} =~ $re ]]; then 498 | echo " (\"${item[0]}\", ${item[1]})," >> "$AR_PLATFORMIO_PY" 499 | else 500 | echo " (\"${item[0]}\", '${item[1]}')," >> "$AR_PLATFORMIO_PY" 501 | fi 502 | else 503 | echo " \"$item\"," >> "$AR_PLATFORMIO_PY" 504 | fi 505 | done 506 | 507 | # end generation of platformio-build.py 508 | cat configs/pio_end.txt >> "$AR_PLATFORMIO_PY" 509 | 510 | # replace double backslashes with single one 511 | DEFINES=`echo "$DEFINES" | tr -s '\'` 512 | 513 | # target flags files 514 | FLAGS_DIR="$AR_SDK/flags" 515 | mkdir -p "$FLAGS_DIR" 516 | echo -n "$DEFINES" > "$FLAGS_DIR/defines" 517 | echo -n "$REL_INC" > "$FLAGS_DIR/includes" 518 | echo -n "$C_FLAGS" > "$FLAGS_DIR/c_flags" 519 | echo -n "$CPP_FLAGS" > "$FLAGS_DIR/cpp_flags" 520 | echo -n "$AS_FLAGS" > "$FLAGS_DIR/S_flags" 521 | echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags" 522 | echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" 523 | echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" 524 | 525 | if [ -d "managed_components/espressif__esp32-camera/driver/private_include/" ]; then 526 | cp -r "managed_components/espressif__esp32-camera/driver/private_include/cam_hal.h" "$AR_SDK/include/espressif__esp32-camera/driver/include/" 527 | fi 528 | 529 | # sdkconfig 530 | cp -f "sdkconfig" "$AR_SDK/sdkconfig" 531 | 532 | # dependencies.lock 533 | cp -f "dependencies.lock" "$AR_SDK/dependencies.lock" 534 | 535 | # gen_esp32part.py 536 | # cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" 537 | 538 | # copy precompiled libs (if we need them) 539 | function copy_precompiled_lib(){ 540 | lib_file="$1" 541 | lib_name="$(basename $lib_file)" 542 | if [[ $LD_LIBS_SEARCH == *"$lib_name"* ]]; then 543 | "$TOOLCHAIN-strip" -g "$lib_file" 544 | cp "$lib_file" "$AR_SDK/ld/" 545 | fi 546 | } 547 | 548 | # idf ld scripts 549 | mkdir -p "$AR_SDK/ld" 550 | set -- $LD_SCRIPT_DIRS 551 | for item; do 552 | item="${item%\"}" 553 | item="${item#\"}" 554 | find "$item" -name '*.ld' -exec cp -f {} "$AR_SDK/ld/" \; 555 | for lib in `find "$item" -name '*.a'`; do 556 | copy_precompiled_lib "$lib" 557 | done 558 | done 559 | 560 | for lib in "openthread" "espressif__esp-tflite-micro" "bt" "espressif__esp_modem" "espressif__esp-zboss-lib" "espressif__esp-zigbee-lib" "espressif__mdns" "espressif__esp-dsp" "espressif__esp32-camera" "joltwallet__littlefs"; do 561 | if [ -f "$AR_SDK/lib/lib$lib.a" ]; then 562 | echo "Stripping $AR_SDK/lib/lib$lib.a" 563 | "$TOOLCHAIN-strip" -g "$AR_SDK/lib/lib$lib.a" 564 | fi 565 | done 566 | 567 | # Handle Mem Variants 568 | mkdir -p "$AR_SDK/$MEMCONF/include" 569 | mv "$PWD/build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h" 570 | for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do 571 | skip_file=1 572 | for file_target in $(echo "$mem_variant" | jq -c '.targets[]' | tr -d '"'); do 573 | if [ "$file_target" == "$IDF_TARGET" ]; then 574 | skip_file=0 575 | break 576 | fi 577 | done 578 | if [ $skip_file -eq 0 ]; then 579 | file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"') 580 | out=$(echo "$mem_variant" | jq -c '.out' | tr -d '"') 581 | mv "$AR_SDK/$out" "$AR_SDK/$MEMCONF/$file" 582 | "$TOOLCHAIN-strip" -g "$AR_SDK/$MEMCONF/$file" 583 | fi 584 | done; 585 | 586 | # Add IDF versions to sdkconfig 587 | echo "#define CONFIG_ARDUINO_IDF_COMMIT \"$IDF_COMMIT\"" >> "$AR_SDK/$MEMCONF/include/sdkconfig.h" 588 | echo "#define CONFIG_ARDUINO_IDF_BRANCH \"$IDF_BRANCH\"" >> "$AR_SDK/$MEMCONF/include/sdkconfig.h" 589 | -------------------------------------------------------------------------------- /tools/copy-mem-variant.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | IDF_TARGET=$1 3 | OCT_FLASH="$2" 4 | OCT_PSRAM= 5 | 6 | if [ "$3" = "y" ]; then 7 | OCT_PSRAM="opi" 8 | else 9 | OCT_PSRAM="qspi" 10 | fi 11 | 12 | MEMCONF=$OCT_FLASH"_$OCT_PSRAM" 13 | 14 | source ./tools/config.sh 15 | 16 | echo "IDF_TARGET: $IDF_TARGET, MEMCONF: $MEMCONF" 17 | 18 | # Add IDF versions to sdkconfig 19 | echo "#define CONFIG_ARDUINO_IDF_COMMIT \"$IDF_COMMIT\"" >> "build/config/sdkconfig.h" 20 | echo "#define CONFIG_ARDUINO_IDF_BRANCH \"$IDF_BRANCH\"" >> "build/config/sdkconfig.h" 21 | 22 | # Handle Mem Variants 23 | rm -rf "$AR_SDK/$MEMCONF" 24 | mkdir -p "$AR_SDK/$MEMCONF/include" 25 | mv "build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h" 26 | for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do 27 | skip_file=1 28 | for file_target in $(echo "$mem_variant" | jq -c '.targets[]' | tr -d '"'); do 29 | if [ "$file_target" == "$IDF_TARGET" ]; then 30 | skip_file=0 31 | break 32 | fi 33 | done 34 | if [ $skip_file -eq 0 ]; then 35 | file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"') 36 | src=$(echo "$mem_variant" | jq -c '.src' | tr -d '"') 37 | cp "$src" "$AR_SDK/$MEMCONF/$file" 38 | fi 39 | done; 40 | -------------------------------------------------------------------------------- /tools/current_commit.sh: -------------------------------------------------------------------------------- 1 | IDF_COMMIT=$(wget -q -O- "https://github.com/espressif/arduino-esp32/search?q=update+idf&type=Commits" | grep -i "update idf" | grep -e "to [0-9a-f]*" | sed "s/^.*to \([0-9a-f]*\).*/\1/" | head -1) 2 | echo Current commit is $IDF_COMMIT 3 | -------------------------------------------------------------------------------- /tools/gen_pio_frmwk_manifest.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import json 3 | import os 4 | import re 5 | import sys 6 | import datetime 7 | 8 | MANIFEST_DATA = { 9 | "name": "framework-arduinoespressif32", 10 | "description": "Platformio Tasmota Arduino framework for the Espressif ESP32 series of SoCs", 11 | "keywords": ["framework", "tasmota", "arduino", "espressif", "esp32"], 12 | "license": "LGPL-2.1-or-later", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/tasmota/arduino-esp32", 16 | }, 17 | } 18 | 19 | 20 | def convert_version(version_string): 21 | """A helper function that converts a custom IDF version string 22 | extracted from a Git repository to a suitable SemVer alternative. For example: 23 | 'release/v5.1' becomes '5.1.0', 24 | 'v7.7.7' becomes '7.7.7' 25 | """ 26 | 27 | regex_pattern = ( 28 | r"v(?P<MAJOR>0|[1-9]\d*)\.(?P<MINOR>0|[1-9]\d*)\.*(?P<PATCH>0|[1-9]\d*)*" 29 | ) 30 | match = re.search(regex_pattern, version_string) 31 | if not match: 32 | sys.stderr.write( 33 | f"Failed to find a regex match for '{regex_pattern}' in '{version_string}'\n" 34 | ) 35 | return "" 36 | 37 | major, minor, patch = match.groups() 38 | if not patch: 39 | patch = "0" 40 | 41 | return ".".join((major, minor, patch)) 42 | 43 | 44 | def main(dst_dir, version_string, commit_hash): 45 | 46 | converted_version = convert_version(version_string) 47 | if not converted_version: 48 | sys.stderr.write(f"Failed to convert version '{version_string}'\n") 49 | return -1 50 | 51 | manifest_file_path = os.path.join(dst_dir, "package.json") 52 | build_date = datetime.date.today() 53 | with open(manifest_file_path, "w", encoding="utf8") as fp: 54 | MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}" 55 | MANIFEST_DATA["date"] = f"{build_date}" 56 | json.dump(MANIFEST_DATA, fp, indent=2) 57 | 58 | print( 59 | f"Generated PlatformIO framework manifest file '{manifest_file_path}' with '{converted_version}' version" 60 | ) 61 | return 0 62 | 63 | 64 | if __name__ == "__main__": 65 | parser = argparse.ArgumentParser() 66 | parser.add_argument( 67 | "-o", 68 | "--dst-dir", 69 | dest="dst_dir", 70 | required=True, 71 | help="Destination folder where the 'package.json' manifest will be located", 72 | ) 73 | parser.add_argument( 74 | "-s", 75 | "--version-string", 76 | dest="version_string", 77 | required=True, 78 | help="ESP-IDF version string used for compiling libraries", 79 | ) 80 | parser.add_argument( 81 | "-c", 82 | "--commit-hash", 83 | dest="commit_hash", 84 | required=True, 85 | help="ESP-IDF revision in form of a commit hash", 86 | ) 87 | args = parser.parse_args() 88 | 89 | sys.exit(main(args.dst_dir, args.version_string, args.commit_hash)) 90 | -------------------------------------------------------------------------------- /tools/gen_pio_lib_manifest.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import json 3 | import os 4 | import re 5 | import sys 6 | 7 | MANIFEST_DATA = { 8 | "name": "framework-arduinoespressif32-libs", 9 | "description": "Precompiled libraries for Arduino Wiring-based Framework for the Espressif ESP32 series of SoCs", 10 | "keywords": ["framework", "tasmota", "arduino", "espressif", "esp32"], 11 | "license": "LGPL-2.1-or-later", 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/tasmota/esp32-arduino-libs", 15 | }, 16 | } 17 | 18 | 19 | def convert_version(version_string): 20 | """A helper function that converts a custom IDF version string 21 | extracted from a Git repository to a suitable SemVer alternative. For example: 22 | 'release/v5.1' becomes '5.1.0', 23 | 'v7.7.7' becomes '7.7.7' 24 | """ 25 | 26 | regex_pattern = ( 27 | r"v(?P<MAJOR>0|[1-9]\d*)\.(?P<MINOR>0|[1-9]\d*)\.*(?P<PATCH>0|[1-9]\d*)*" 28 | ) 29 | match = re.search(regex_pattern, version_string) 30 | if not match: 31 | sys.stderr.write( 32 | f"Failed to find a regex match for '{regex_pattern}' in '{version_string}'\n" 33 | ) 34 | return "" 35 | 36 | major, minor, patch = match.groups() 37 | if not patch: 38 | patch = "0" 39 | 40 | return ".".join((major, minor, patch)) 41 | 42 | 43 | def main(dst_dir, version_string, commit_hash): 44 | 45 | converted_version = convert_version(version_string) 46 | if not converted_version: 47 | sys.stderr.write(f"Failed to convert version '{version_string}'\n") 48 | return -1 49 | 50 | manifest_file_path = os.path.join(dst_dir, "package.json") 51 | with open(manifest_file_path, "w", encoding="utf8") as fp: 52 | MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}" 53 | json.dump(MANIFEST_DATA, fp, indent=2) 54 | 55 | print( 56 | f"Generated PlatformIO libraries manifest file '{manifest_file_path}' with '{converted_version}' version" 57 | ) 58 | return 0 59 | 60 | 61 | if __name__ == "__main__": 62 | parser = argparse.ArgumentParser() 63 | parser.add_argument( 64 | "-o", 65 | "--dst-dir", 66 | dest="dst_dir", 67 | required=True, 68 | help="Destination folder where the 'package.json' manifest will be located", 69 | ) 70 | parser.add_argument( 71 | "-s", 72 | "--version-string", 73 | dest="version_string", 74 | required=True, 75 | help="ESP-IDF version string used for compiling libraries", 76 | ) 77 | parser.add_argument( 78 | "-c", 79 | "--commit-hash", 80 | dest="commit_hash", 81 | required=True, 82 | help="ESP-IDF revision in form of a commit hash", 83 | ) 84 | args = parser.parse_args() 85 | 86 | sys.exit(main(args.dst_dir, args.version_string, args.commit_hash)) 87 | -------------------------------------------------------------------------------- /tools/get_projbuild_gitconfig.py: -------------------------------------------------------------------------------- 1 | # This file is expected to be present in ${COMPONENT_DIR} 2 | # accessed from components/esp_insights/CMakeLists.txt 3 | # Used in: 4 | # 1. Project ESP Insights build package tar file 5 | 6 | #from __future__ import unicode_literals 7 | import os 8 | import sys 9 | import json 10 | import subprocess 11 | from builtins import range, str 12 | from io import open 13 | 14 | # Input project directory from CMakeLists.txt 15 | PROJ_DIR=sys.argv[1] 16 | # Input project name 17 | PROJ_NAME=sys.argv[2] 18 | # Input project version 19 | PROJ_VER=sys.argv[3] 20 | # Input custom config filename from CMakeLists.txt 21 | FILENAME=sys.argv[4] 22 | # Input IDF_PATH from CMakeLists.txt 23 | IDF_PATH=sys.argv[5] 24 | # Input target 25 | TARGET=sys.argv[6] 26 | 27 | NEWLINE = "\n" 28 | 29 | CONFIG = {} 30 | 31 | # Set Config 32 | 33 | # Set current directory i.e Set ${COMPONENT_DIR} as current directory 34 | CURR_DIR = os.getcwd() 35 | 36 | def _change_dir(dirname): 37 | # Change directory 38 | os.chdir(dirname) 39 | 40 | 41 | def _set_submodule_cfg(submodules, repo_name): 42 | # Set config for submodules 43 | CFG_TITLE = "submodules" 44 | NAME_STR = "name" 45 | VERSION_STR = "version" 46 | CONFIG[repo_name][CFG_TITLE] = [] 47 | 48 | if submodules: 49 | # Get the submodule name and version 50 | submodules_list = submodules.strip().split(NEWLINE) 51 | for i in range(0, len(submodules_list), 2): 52 | name = submodules_list[i].split('\'')[1] 53 | version = submodules_list[i+1] 54 | submodule_json = { NAME_STR: name, VERSION_STR: version } 55 | CONFIG[repo_name][CFG_TITLE].append(submodule_json) 56 | 57 | 58 | def run_cmd(command, get_basename=False): 59 | try: 60 | resp = subprocess.check_output(command, shell=True).strip().decode('utf-8') 61 | if get_basename: 62 | resp = os.path.basename(resp) 63 | return resp 64 | except subprocess.CalledProcessError: 65 | raise Exception("ERROR: Please check command : {}".format(command)) 66 | 67 | def set_cfg(config_name): 68 | # Set config for ESP-IDF Repo 69 | if config_name == "esp-idf": 70 | # Get repo name (for IDF repo) 71 | REPO_CMD='git rev-parse --show-toplevel' 72 | repo_name = run_cmd(REPO_CMD, get_basename=True) 73 | CONFIG[repo_name] = {} 74 | 75 | # Get commit HEAD 76 | GITHEAD_STR = "HEAD" 77 | HEAD='git describe --always --tags --dirty' 78 | head_ver = run_cmd(HEAD) 79 | CONFIG[repo_name][GITHEAD_STR] = head_ver 80 | 81 | # Get submodule latest refs 82 | SUBMODULE = 'git submodule foreach git describe --always --tags --dirty' 83 | submodules = run_cmd(SUBMODULE) 84 | _set_submodule_cfg(submodules, repo_name) 85 | elif config_name == "toolchain": 86 | # Set config for Toolchain Version 87 | arch_target = "xtensa-" + TARGET 88 | if TARGET == "esp32c3" or TARGET == "esp32c2" or TARGET == "esp32h2" or TARGET == "esp32c6": 89 | arch_target = "riscv32-esp" 90 | # Get toolchain version 91 | TOOLCHAIN_STR = "toolchain" 92 | TOOLCHAIN = arch_target + '-elf-gcc --version' 93 | toolchain = run_cmd(TOOLCHAIN) 94 | CONFIG[TOOLCHAIN_STR] = toolchain.strip().split(NEWLINE)[0] 95 | 96 | # Set project details - name and version 97 | def set_project_details(): 98 | # Set project name and version 99 | CONFIG['project'] = {} 100 | CONFIG['project']['name'] = PROJ_NAME 101 | CONFIG['project']['version'] = PROJ_VER 102 | 103 | try: 104 | with open(FILENAME, "w+", encoding="utf-8") as output_file: 105 | # ESP-IDF REPO CONFIG 106 | # Change to ESP-IDF Directory 107 | _change_dir(IDF_PATH) 108 | set_cfg("esp-idf") 109 | 110 | # Change back to ${COMPONENT_DIR} 111 | _change_dir(CURR_DIR) 112 | 113 | # Set project name and version 114 | set_project_details() 115 | 116 | # GET TOOLCHAIN VERSION 117 | set_cfg("toolchain") 118 | 119 | output_file.write(str(json.dumps(CONFIG, indent=4, sort_keys=True))) 120 | 121 | except Exception as e: 122 | # Remove config file created if error occurs 123 | os.system("rm " + FILENAME) 124 | sys.exit(e) 125 | -------------------------------------------------------------------------------- /tools/install-arduino.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | source ./tools/config.sh 4 | 5 | # 6 | # CLONE/UPDATE ARDUINO 7 | # 8 | if [ "$AR_BRANCH" ]; then 9 | echo "Installing Arduino from branch '$AR_BRANCH'" 10 | if [ ! -d "$AR_COMPS/arduino" ]; then 11 | # for using a branch we need no full clone 12 | git clone -b "$AR_BRANCH" --recursive --depth 1 --shallow-submodule $AR_REPO_URL "$AR_COMPS/arduino" 13 | else 14 | # update existing branch 15 | cd "$AR_COMPS/arduino" 16 | git pull 17 | git reset --hard $AR_BRANCH 18 | # -ff is for cleaning untracked files as well as submodules 19 | git clean -ffdx 20 | cd - 21 | fi 22 | fi 23 | 24 | if [ ! -d "$AR_COMPS/arduino" ]; then 25 | # we need a full clone since no branch was set 26 | echo "Full cloning of ESP32 Arduino repo '$AR_REPO_URL'" 27 | git clone $AR_REPO_URL "$AR_COMPS/arduino" 28 | else 29 | if [ "$AR_BRANCH" ]; then 30 | echo "ESP32 Arduino is up to date" 31 | else 32 | # update existing branch 33 | echo "Updating ESP32 Arduino" 34 | cd "$AR_COMPS/arduino" 35 | git pull 36 | # -ff is for cleaning untracked files as well as submodules 37 | git clean -ffdx 38 | cd - 39 | fi 40 | fi 41 | 42 | if [ -z $AR_BRANCH ]; then 43 | if [ -z $GITHUB_HEAD_REF ]; then 44 | current_branch=`git branch --show-current` 45 | else 46 | current_branch="$GITHUB_HEAD_REF" 47 | fi 48 | echo "Current Branch: $current_branch" 49 | if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then 50 | export AR_BRANCH="$current_branch" 51 | else 52 | if [ "$IDF_TAG" ]; then #tag was specified at build time 53 | AR_BRANCH_NAME="idf-$IDF_TAG" 54 | elif [ "$IDF_COMMIT" ]; then #commit was specified at build time 55 | AR_BRANCH_NAME="idf-$IDF_COMMIT" 56 | else 57 | AR_BRANCH_NAME="idf-$IDF_BRANCH" 58 | fi 59 | has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_BRANCH_NAME"` 60 | if [ "$has_ar_branch" == "1" ]; then 61 | export AR_BRANCH="$AR_BRANCH_NAME" 62 | else 63 | has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_PR_TARGET_BRANCH"` 64 | if [ "$has_ar_branch" == "1" ]; then 65 | export AR_BRANCH="$AR_PR_TARGET_BRANCH" 66 | fi 67 | fi 68 | fi 69 | fi 70 | 71 | if [ $? -ne 0 ]; then exit 1; fi 72 | 73 | # 74 | # remove code and libraries not needed/wanted for Tasmota framework 75 | # 76 | rm -rf "$AR_COMPS/arduino/docs" 77 | rm -rf "$AR_COMPS/arduino/idf_component_examples" 78 | rm -rf "$AR_COMPS/arduino/package" 79 | rm -rf "$AR_COMPS/arduino/tests" 80 | rm -rf "$AR_COMPS/arduino/tools/pre-commit" 81 | rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.cpp" 82 | rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.h" 83 | rm -rf "$AR_COMPS/arduino/libraries/Matter" 84 | rm -rf "$AR_COMPS/arduino/libraries/RainMaker" 85 | rm -rf "$AR_COMPS/arduino/libraries/Insights" 86 | rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S" 87 | rm -rf "$AR_COMPS/arduino/libraries/SPIFFS" 88 | rm -rf "$AR_COMPS/arduino/libraries/BLE" 89 | rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" 90 | rm -rf "$AR_COMPS/arduino/libraries/BluetoothSerial" 91 | rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" 92 | rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" 93 | rm -rf "$AR_COMPS/arduino/libraries/NetworkClientSecure" 94 | rm -rf "$AR_COMPS/arduino/libraries/ESP32" 95 | rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" 96 | rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" 97 | rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" 98 | rm -rf "$AR_COMPS/arduino/libraries/OpenThread" 99 | rm -rf "$AR_COMPS/arduino/libraries/Zigbee" 100 | -------------------------------------------------------------------------------- /tools/install-esp-idf.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | source ./tools/config.sh 4 | 5 | if ! [ -x "$(command -v $SED)" ]; then 6 | echo "ERROR: $SED is not installed! Please install $SED first." 7 | exit 1 8 | fi 9 | 10 | # 11 | # CLONE ESP-IDF 12 | # 13 | if [ "$IDF_TAG" ] || [ "$IDF_COMMIT" ]; then 14 | if [ ! -d "$IDF_PATH" ]; then 15 | # full clone needed to check out tag or commit 16 | echo "ESP-IDF is not installed! Installing with full clone from $IDF_REPO_URL branch $IDF_BRANCH" 17 | git clone $IDF_REPO_URL -b $IDF_BRANCH 18 | idf_was_installed="1" 19 | else 20 | # update local clone 21 | echo "ESP-IDF is installed, updating..." 22 | cd $IDF_PATH 23 | git pull 24 | git reset --hard $IDF_BRANCH 25 | git submodule update 26 | # -ff is for cleaning untracked files as well as submodules 27 | git clean -ffdx 28 | cd - 29 | idf_was_installed="1" 30 | fi 31 | fi 32 | 33 | if [ ! -d "$IDF_PATH" ]; then 34 | # for using a branch we need no full clone 35 | echo "ESP-IDF is not installed! Installing branch $IDF_BRANCH from $IDF_REPO_URL" 36 | git clone -b $IDF_BRANCH --recursive --depth 1 --shallow-submodule $IDF_REPO_URL 37 | idf_was_installed="1" 38 | else 39 | # update existing branch 40 | echo "ESP-IDF is already installed, updating branch $IDF_BRANCH" 41 | cd $IDF_PATH 42 | git pull 43 | git reset --hard $IDF_BRANCH 44 | git submodule update --depth 1 45 | # -ff is for cleaning untracked files as well as submodules 46 | git clean -ffdx 47 | cd - 48 | idf_was_installed="1" 49 | fi 50 | 51 | if [ "$IDF_TAG" ]; then 52 | cd $IDF_PATH 53 | git -C "$IDF_PATH" checkout "tags/$IDF_TAG" 54 | git reset --hard "tags/$IDF_TAG" 55 | git submodule update --recursive 56 | git rm -r $IDF_PATH/components/wifi_provisioning 57 | git rm -r $IDF_PATH/components/spiffs 58 | git commit -m "delete components SPIFFS and wifi-provisioning" 59 | cd - 60 | idf_was_installed="1" 61 | elif [ "$IDF_COMMIT" ]; then 62 | cd $IDF_PATH 63 | git -C "$IDF_PATH" checkout "$IDF_COMMIT" 64 | git reset --hard $IDF_COMMIT 65 | git submodule update --recursive 66 | git rm -r $IDF_PATH/components/wifi_provisioning 67 | git rm -r $IDF_PATH/components/spiffs 68 | git commit -m "delete components SPIFFS and wifi-provisioning" 69 | cd - 70 | commit_predefined="1" 71 | fi 72 | 73 | # 74 | # UPDATE ESP-IDF TOOLS AND MODULES 75 | # 76 | 77 | if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then 78 | git submodule update --recursive 79 | echo "Installing ESP-IDF..." 80 | $IDF_PATH/install.sh > /dev/null 81 | 82 | # 1) Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source 83 | # 2) Temporarily fix for mmu map and late init of psram https://github.com/espressif/arduino-esp32/issues/9936 84 | cd $IDF_PATH 85 | patch -p1 -N -i $AR_PATCHES/esp32s2_i2c_ll_master_init.diff 86 | patch -p1 -N -i $AR_PATCHES/lwip_max_tcp_pcb.diff 87 | cd - 88 | 89 | # Get the exact IDF version from file "version.txt" 90 | cd $IDF_PATH 91 | export IDF_VERSION=$(<version.txt) 92 | echo "IDF version: $IDF_VERSION" 93 | cd - 94 | fi 95 | 96 | # 97 | # SETUP ESP-IDF ENV 98 | # 99 | 100 | source $IDF_PATH/export.sh 101 | 102 | # 103 | # SETUP ARDUINO DEPLOY 104 | # 105 | 106 | if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "repository_dispatch" -a "$GITHUB_EVENT_ACTION" == "deploy" ]; then 107 | # format new branch name and pr title 108 | if [ -x $commit_predefined ]; then #commit was not specified at build time 109 | AR_NEW_BRANCH_NAME="idf-$IDF_BRANCH" 110 | AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT" 111 | AR_NEW_PR_TITLE="IDF $IDF_BRANCH" 112 | else 113 | AR_NEW_BRANCH_NAME="idf-$IDF_COMMIT" 114 | AR_NEW_COMMIT_MESSAGE="IDF $IDF_COMMIT" 115 | AR_NEW_PR_TITLE="$AR_NEW_COMMIT_MESSAGE" 116 | fi 117 | LIBS_VERSION="idf-"${IDF_BRANCH//\//_}"-$IDF_COMMIT" 118 | 119 | AR_HAS_COMMIT=`git_commit_exists "$AR_COMPS/arduino" "$AR_NEW_COMMIT_MESSAGE"` 120 | AR_HAS_BRANCH=`git_branch_exists "$AR_COMPS/arduino" "$AR_NEW_BRANCH_NAME"` 121 | AR_HAS_PR=`git_pr_exists "$AR_NEW_BRANCH_NAME"` 122 | 123 | LIBS_HAS_COMMIT=`git_commit_exists "$IDF_LIBS_DIR" "$AR_NEW_COMMIT_MESSAGE"` 124 | LIBS_HAS_BRANCH=`git_branch_exists "$IDF_LIBS_DIR" "$AR_NEW_BRANCH_NAME"` 125 | 126 | if [ "$LIBS_HAS_COMMIT" == "1" ]; then 127 | echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in esp32-arduino-libs" 128 | fi 129 | 130 | if [ "$AR_HAS_COMMIT" == "1" ]; then 131 | echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in arduino-esp32" 132 | fi 133 | 134 | if [ "$LIBS_HAS_COMMIT" == "1" ] && [ "$AR_HAS_COMMIT" == "1" ]; then 135 | exit 0 136 | fi 137 | 138 | export AR_NEW_BRANCH_NAME 139 | export AR_NEW_COMMIT_MESSAGE 140 | export AR_NEW_PR_TITLE 141 | 142 | export AR_HAS_COMMIT 143 | export AR_HAS_BRANCH 144 | export AR_HAS_PR 145 | 146 | export LIBS_VERSION 147 | export LIBS_HAS_COMMIT 148 | export LIBS_HAS_BRANCH 149 | fi 150 | -------------------------------------------------------------------------------- /tools/patch-tinyusb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mv components/arduino_tinyusb/src/dcd_dwc2.c components/arduino_tinyusb/src/dcd_dwc2.c.prev 3 | cp components/arduino_tinyusb/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c components/arduino_tinyusb/src/dcd_dwc2.c 4 | patch -p1 -N -i components/arduino_tinyusb/patches/dcd_dwc2.patch 5 | -------------------------------------------------------------------------------- /tools/prepare-ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Ubuntu setup 4 | # Change in archive-build.sh gawk to awk 5 | #sudo apt update && sudo apt install -y gperf cmake ninja-build ccache 6 | #pip3 install wheel future pyelftools 7 | 8 | # MacOS (ARM) setup 9 | # Change in archive-build.sh awk to gawk 10 | brew install gsed 11 | brew install gawk 12 | brew install gperf 13 | #brew install ninja 14 | brew install ccache 15 | python -m pip install --upgrade pip 16 | pip install wheel future pyelftools 17 | -------------------------------------------------------------------------------- /tools/push-to-arduino.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ./tools/config.sh 3 | 4 | if [ -x $GITHUB_TOKEN ]; then 5 | echo "ERROR: GITHUB_TOKEN was not defined" 6 | exit 1 7 | fi 8 | 9 | if ! [ -d "$AR_COMPS/arduino" ]; then 10 | echo "ERROR: Target arduino folder does not exist!" 11 | exit 1 12 | fi 13 | 14 | # setup git for pushing 15 | git config --global github.user "$GITHUB_ACTOR" 16 | git config --global user.name "$GITHUB_ACTOR" 17 | git config --global user.email "$GITHUB_ACTOR@github.com" 18 | 19 | # 20 | # UPDATE FILES 21 | # 22 | 23 | # 24 | # esp32-arduino-libs 25 | # 26 | 27 | if [ $LIBS_HAS_COMMIT == "0" ] || [ $AR_HAS_COMMIT == "0" ]; then 28 | cd "$AR_ROOT" 29 | # create branch if necessary 30 | if [ "$LIBS_HAS_BRANCH" == "1" ]; then 31 | echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists" 32 | echo "Switching to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." 33 | git -C "$IDF_LIBS_DIR" checkout $AR_NEW_BRANCH_NAME 34 | else 35 | echo "Creating esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." 36 | git -C "$IDF_LIBS_DIR" checkout -b $AR_NEW_BRANCH_NAME 37 | fi 38 | if [ $? -ne 0 ]; then 39 | echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" 40 | exit 1 41 | fi 42 | 43 | # make changes to the files 44 | echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." 45 | rm -rf $IDF_LIBS_DIR/* && cp -Rf $AR_TOOLS/esp32-arduino-libs/* $IDF_LIBS_DIR/ 46 | 47 | cd $IDF_LIBS_DIR 48 | if [ -f "README.md" ]; then 49 | rm -rf "README.md" 50 | fi 51 | 52 | # did any of the files change? 53 | if [ -n "$(git status --porcelain)" ]; then 54 | echo "Pushing changes to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." 55 | git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME 56 | if [ $? -ne 0 ]; then 57 | echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" 58 | exit 1 59 | fi 60 | IDF_LIBS_COMMIT=`git rev-parse --verify HEAD` 61 | IDF_LIBS_DL_URL="https://codeload.github.com/espressif/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT" 62 | # ToDo: this URL needs to get into Arduino's package.json 63 | 64 | # Download the file 65 | filename="esp32-arduino-libs-$IDF_LIBS_COMMIT.zip" 66 | curl -s -o "$filename" "$IDF_LIBS_DL_URL" 67 | 68 | # Check if the download was successful 69 | if [ $? -ne 0 ]; then 70 | echo "Error downloading file from $IDF_LIBS_DL_URL" 71 | exit 1 72 | fi 73 | 74 | # Calculate the size in bytes and SHA-256 sum 75 | size=$(stat -c%s "$filename") 76 | sha256sum=$(sha256sum "$filename" | awk '{print $1}') 77 | 78 | # Clean up the downloaded file 79 | rm "$filename" 80 | 81 | # Print the results 82 | echo "Tool: esp32-arduino-libs" 83 | echo "Version: $LIBS_VERSION" 84 | echo "URL: $IDF_LIBS_DL_URL" 85 | echo "File: $filename" 86 | echo "Size: $size bytes" 87 | echo "SHA-256: $sha256sum" 88 | echo "JSON: $AR_OUT/package_esp32_index.template.json" 89 | cd "$AR_ROOT" 90 | python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_DL_URL" -f "$filename" -s "$size" -c "$sha256sum" 91 | if [ $? -ne 0 ]; then exit 1; fi 92 | 93 | else 94 | echo "No changes in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'" 95 | if [ $LIBS_HAS_BRANCH == "0" ]; then 96 | echo "Delete created branch '$AR_NEW_BRANCH_NAME'" 97 | git branch -d $AR_NEW_BRANCH_NAME 98 | fi 99 | exit 0 100 | fi 101 | fi 102 | 103 | # 104 | # esp32-arduino 105 | # 106 | 107 | if [ $AR_HAS_COMMIT == "0" ]; then 108 | cd "$AR_ROOT" 109 | # create or checkout the branch 110 | if [ ! $AR_HAS_BRANCH == "0" ]; then 111 | echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." 112 | git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME 113 | else 114 | echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." 115 | git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME 116 | fi 117 | if [ $? -ne 0 ]; then 118 | echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" 119 | exit 1 120 | fi 121 | 122 | # make changes to the files 123 | echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." 124 | rm -rf "$AR_COMPS/arduino/package/package_esp32_index.template.json" && cp -f "$AR_OUT/package_esp32_index.template.json" "$AR_COMPS/arduino/package/package_esp32_index.template.json" 125 | 126 | cd $AR_COMPS/arduino 127 | 128 | # did any of the files change? 129 | if [ -n "$(git status --porcelain)" ]; then 130 | echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..." 131 | git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME 132 | if [ $? -ne 0 ]; then 133 | echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" 134 | exit 1 135 | fi 136 | else 137 | echo "No changes in branch '$AR_NEW_BRANCH_NAME'" 138 | if [ $AR_HAS_BRANCH == "0" ]; then 139 | echo "Delete created branch '$AR_NEW_BRANCH_NAME'" 140 | git branch -d $AR_NEW_BRANCH_NAME 141 | fi 142 | exit 0 143 | fi 144 | 145 | # CREATE PULL REQUEST 146 | if [ "$AR_HAS_PR" == "0" ]; then 147 | echo "Creating PR '$AR_NEW_PR_TITLE'..." 148 | pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` 149 | if [ $pr_created == "0" ]; then 150 | echo "ERROR: Failed to create PR '$AR_NEW_PR_TITLE': "`echo "$git_create_pr_res" | jq -r '.message'`": "`echo "$git_create_pr_res" | jq -r '.errors[].message'` 151 | exit 1 152 | fi 153 | else 154 | echo "PR '$AR_NEW_PR_TITLE' Already Exists" 155 | fi 156 | fi 157 | 158 | exit 0 159 | -------------------------------------------------------------------------------- /tools/repository_dispatch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! "$GITHUB_EVENT_NAME" == "repository_dispatch" ]; then 4 | echo "Wrong event '$GITHUB_EVENT_NAME'!" 5 | exit 1 6 | fi 7 | 8 | EVENT_JSON=`cat "$GITHUB_EVENT_PATH"` 9 | action=`echo "$EVENT_JSON" | jq -r '.action'` 10 | payload=`echo "$EVENT_JSON" | jq -r '.client_payload'` 11 | branch=`echo "$payload" | jq -r '.branch'` 12 | tag=`echo "$payload" | jq -r '.tag'` 13 | commit=`echo "$payload" | jq -r '.commit'` 14 | builder=`echo "$payload" | jq -r '.builder'` 15 | arduino=`echo "$payload" | jq -r '.arduino'` 16 | 17 | echo "Action: $action, IDF Branch: $branch, IDF Tag: $tag, IDF Commit: $commit, Builder Branch: $builder, Arduino Branch: $arduino, Actor: $GITHUB_ACTOR" 18 | 19 | if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then 20 | echo "Bad Action $action" 21 | exit 1 22 | fi 23 | 24 | export GITHUB_EVENT_ACTION="$action" 25 | 26 | if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then 27 | export IDF_COMMIT="$commit" 28 | else 29 | commit="" 30 | if [ ! "$tag" == "" ] && [ ! "$tag" == "null" ]; then 31 | export IDF_TAG="$tag" 32 | elif [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then 33 | export IDF_BRANCH="$branch" 34 | fi 35 | fi 36 | 37 | if [ ! "$builder" == "" ] && [ ! "$builder" == "null" ]; then 38 | git checkout "$builder" 39 | fi 40 | 41 | if [ ! "$arduino" == "" ] && [ ! "$arduino" == "null" ]; then 42 | export AR_BRANCH="$arduino" 43 | fi 44 | 45 | if [ "$action" == "deploy" ]; then 46 | DEPLOY_OUT=1 47 | fi 48 | 49 | source ./build.sh 50 | 51 | # if [ "$action" == "deploy" ]; then 52 | # bash ./tools/push-to-arduino.sh 53 | # fi 54 | -------------------------------------------------------------------------------- /tools/update-components.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | source ./tools/config.sh 4 | 5 | TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" 6 | TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" 7 | 8 | # 9 | # CLONE/UPDATE TINYUSB 10 | # 11 | echo "Updating TinyUSB..." 12 | if [ ! -d "$TINYUSB_REPO_DIR" ]; then 13 | git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" 14 | else 15 | cd $TINYUSB_REPO_DIR 16 | git pull 17 | # -ff is for cleaning untracked files as well as submodules 18 | git clean -ffdx 19 | cd - 20 | fi 21 | if [ $? -ne 0 ]; then exit 1; fi 22 | --------------------------------------------------------------------------------