From b0f14056fc4b7219c27ba29d610c3ca459fd82e7 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Mon, 23 Jan 2023 12:09:24 +0200 Subject: [PATCH 001/636] Rework the lib-builder for ESP-IDF v5.1 --- .gitignore | 1 + build.sh | 6 +- components/arduino_tinyusb/CMakeLists.txt | 70 +++++++++++--------- components/arduino_tinyusb/src/dcd_esp32sx.c | 29 +++++++- configs/defconfig.common | 1 + configs/defconfig.esp32 | 6 +- configs/defconfig.esp32c3 | 2 +- configs/defconfig.esp32s2 | 4 +- configs/defconfig.esp32s3 | 6 +- main/idf_component.yml | 47 +++++++++++++ tools/config.sh | 5 +- tools/copy-libs.sh | 14 ++-- tools/update-components.sh | 32 ++++----- 13 files changed, 151 insertions(+), 72 deletions(-) create mode 100644 main/idf_component.yml diff --git a/.gitignore b/.gitignore index 4d9511e9d..3128aa229 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ sdkconfig sdkconfig.old version.txt dependencies.lock +managed_components/ diff --git a/build.sh b/build.sh index 2ef451734..5fc41769d 100755 --- a/build.sh +++ b/build.sh @@ -17,7 +17,7 @@ COPY_OUT=0 DEPLOY_OUT=0 function print_help() { - echo "Usage: build.sh [-s] [-A ] [-I ] [-i ] [-c ] [-t ] [-b ] [config ...]" + echo "Usage: build.sh [-s] [-A ] [-I ] [-i ] [-c ] [-t ] [-b ] [config ...]" echo " -s Skip installing/updating of ESP-IDF and all components" echo " -A Set which branch of arduino-esp32 to be used for compilation" echo " -I Set which branch of ESP-IDF to be used for compilation" @@ -58,6 +58,7 @@ while getopts ":A:I:i:c:t:b:sd" opt; do b=$OPTARG if [ "$b" != "build" ] && [ "$b" != "menuconfig" ] && + [ "$b" != "reconfigure" ] && [ "$b" != "idf_libs" ] && [ "$b" != "copy_bootloader" ] && [ "$b" != "mem_variant" ]; then @@ -121,6 +122,9 @@ if [ "$BUILD_TYPE" != "all" ]; then fi rm -rf build sdkconfig out +echo "* Reconfigure Project" +idf.py reconfigure +rm -rf build sdkconfig # Add components version info mkdir -p "$AR_TOOLS/sdk" && rm -rf version.txt && rm -rf "$AR_TOOLS/sdk/versions.txt" diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index 041eeec0f..0872021eb 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -1,37 +1,22 @@ -idf_component_register(REQUIRES esp_rom freertos soc PRIV_REQUIRES arduino main) - if(CONFIG_TINYUSB_ENABLED) ### variables ### ################# - # if(IDF_TARGET STREQUAL "esp32s2") + + if(IDF_TARGET STREQUAL "esp32s2") set(compile_options "-DCFG_TUSB_MCU=OPT_MCU_ESP32S2" "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes ) - # elseif(IDF_TARGET STREQUAL "esp32s3") - # set(compile_options - # "-DCFG_TUSB_MCU=OPT_MCU_ESP32S2" - # "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" - # "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes - # ) - # endif() - idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos - ORIG_INCLUDE_PATH) - set(includes_private - # tusb: - "${COMPONENT_DIR}/tinyusb/hw/bsp/" - "${COMPONENT_DIR}/tinyusb/src/" - "${COMPONENT_DIR}/tinyusb/src/device" - ) + elseif(IDF_TARGET STREQUAL "esp32s3") + set(compile_options + "-DCFG_TUSB_MCU=OPT_MCU_ESP32S3" + "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" + "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes + ) + endif() - set(includes_public - # tusb: - "${FREERTOS_ORIG_INCLUDE_PATH}" - "${COMPONENT_DIR}/tinyusb/src/" - # espressif: - "${COMPONENT_DIR}/include") set(srcs # espressif: "${COMPONENT_DIR}/src/dcd_esp32sx.c" @@ -49,14 +34,37 @@ if(CONFIG_TINYUSB_ENABLED) "${COMPONENT_DIR}/tinyusb/src/device/usbd.c" "${COMPONENT_DIR}/tinyusb/src/tusb.c") + set(includes_private + # tusb: + "${COMPONENT_DIR}/tinyusb/hw/bsp/" + "${COMPONENT_DIR}/tinyusb/src/" + "${COMPONENT_DIR}/tinyusb/src/device" + ) + + idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos + ORIG_INCLUDE_PATH) + set(includes_public + # tusb: + "${FREERTOS_ORIG_INCLUDE_PATH}" + "${COMPONENT_DIR}/tinyusb/src/" + # espressif: + "${COMPONENT_DIR}/include") + + set(requires esp_rom freertos soc) + set(priv_requires arduino main) ### tinyusb lib ### ################### - add_library(arduino_tinyusb STATIC ${srcs}) - target_include_directories( - arduino_tinyusb - PUBLIC ${includes_public} - PRIVATE ${includes_private}) - target_compile_options(arduino_tinyusb PRIVATE ${compile_options}) - target_link_libraries(${COMPONENT_TARGET} INTERFACE arduino_tinyusb) + idf_component_register(INCLUDE_DIRS ${includes_public} PRIV_INCLUDE_DIRS ${includes_private} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) + # add_library(${COMPONENT_TARGET} STATIC ${srcs}) + # target_include_directories( + # ${COMPONENT_TARGET} + # PUBLIC ${includes_public} + # PRIVATE ${includes_private}) + target_compile_options(${COMPONENT_TARGET} PRIVATE ${compile_options}) + #target_link_libraries(${COMPONENT_TARGET} INTERFACE ${COMPONENT_TARGET}) + +else() + + idf_component_register() endif() diff --git a/components/arduino_tinyusb/src/dcd_esp32sx.c b/components/arduino_tinyusb/src/dcd_esp32sx.c index 048b44e61..29fbe99cb 100755 --- a/components/arduino_tinyusb/src/dcd_esp32sx.c +++ b/components/arduino_tinyusb/src/dcd_esp32sx.c @@ -28,17 +28,16 @@ #include "tusb_option.h" -#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && TUSB_OPT_DEVICE_ENABLED) +#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && CFG_TUD_ENABLED) // Espressif -#include "driver/periph_ctrl.h" #include "freertos/xtensa_api.h" #include "esp_intr_alloc.h" #include "esp_log.h" -#include "driver/gpio.h" #include "soc/dport_reg.h" #include "soc/gpio_sig_map.h" #include "soc/usb_periph.h" +#include "soc/periph_defs.h" // for interrupt source #include "device/dcd.h" @@ -60,6 +59,7 @@ typedef struct { uint16_t queued_len; uint16_t max_size; bool short_packet; + uint8_t interval; } xfer_ctl_t; static const char *TAG = "TUSB:DCD"; @@ -284,6 +284,14 @@ void dcd_disconnect(uint8_t rhport) USB0.dctl |= USB_SFTDISCON_M; } +void dcd_sof_enable(uint8_t rhport, bool en) +{ + (void) rhport; + (void) en; + + // TODO implement later +} + /*------------------------------------------------------------------*/ /* DCD Endpoint port *------------------------------------------------------------------*/ @@ -303,6 +311,7 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const *desc_edpt) xfer_ctl_t *xfer = XFER_CTL_BASE(epnum, dir); xfer->max_size = tu_edpt_packet_size(desc_edpt); + xfer->interval = desc_edpt->bInterval; if (dir == TUSB_DIR_OUT) { out_ep[epnum].doepctl &= ~(USB_D_EPTYPE0_M | USB_D_MPS0_M); @@ -423,6 +432,13 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to USB0.in_ep_reg[epnum].dieptsiz = (num_packets << USB_D_PKTCNT0_S) | total_bytes; USB0.in_ep_reg[epnum].diepctl |= USB_D_EPENA1_M | USB_D_CNAK1_M; // Enable | CNAK + // For ISO endpoint with interval=1 set correct DATA0/DATA1 bit for next frame + if ((USB0.in_ep_reg[epnum].diepctl & USB_D_EPTYPE0_M) == (1 << USB_D_EPTYPE1_S) && xfer->interval == 1) { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (USB0.dsts & (1u << USB_SOFFN_S)); + USB0.in_ep_reg[epnum].diepctl |= (odd_frame_now ? USB_DI_SETD0PID1 : USB_DI_SETD1PID1); + } + // Enable fifo empty interrupt only if there are something to put in the fifo. if(total_bytes != 0) { USB0.dtknqr4_fifoemptymsk |= (1 << epnum); @@ -431,6 +447,13 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to // Each complete packet for OUT xfers triggers XFRC. USB0.out_ep_reg[epnum].doeptsiz |= USB_PKTCNT0_M | ((xfer->max_size & USB_XFERSIZE0_V) << USB_XFERSIZE0_S); USB0.out_ep_reg[epnum].doepctl |= USB_EPENA0_M | USB_CNAK0_M; + + // For ISO endpoint with interval=1 set correct DATA0/DATA1 bit for next frame + if ((USB0.out_ep_reg[epnum].doepctl & USB_D_EPTYPE0_M) == (1 << USB_D_EPTYPE1_S) && xfer->interval == 1) { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (USB0.dsts & (1u << USB_SOFFN_S)); + USB0.out_ep_reg[epnum].doepctl |= (odd_frame_now ? USB_DO_SETD0PID1 : USB_DO_SETD1PID1); + } } return true; } diff --git a/configs/defconfig.common b/configs/defconfig.common index cbcfd8d2c..fb9e2db86 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -37,6 +37,7 @@ CONFIG_FATFS_API_ENCODING_UTF_8=y # CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set CONFIG_FMB_TIMER_PORT_ENABLED=y CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y # CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024 CONFIG_HEAP_POISONING_LIGHT=y diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index bd38b4829..14a4f2c17 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -8,10 +8,10 @@ CONFIG_BT_SPP_ENABLED=y CONFIG_BT_HFP_ENABLE=y CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y -CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_SPIRAM=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y -CONFIG_ESP32_ULP_COPROC_ENABLED=y -CONFIG_ESP32_XTAL_FREQ_AUTO=y +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_XTAL_FREQ_AUTO=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set CONFIG_FREERTOS_FPU_IN_ISR=y # CONFIG_USE_WAKENET is not set diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 31c42f7a0..ced594733 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -1,4 +1,4 @@ CONFIG_BT_BLE_BLUFI_ENABLE=y -CONFIG_ESP32C3_RTC_CLK_CAL_CYCLES=576 +CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 6dc619a9f..f6d2c82f7 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -1,6 +1,6 @@ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32S2_SPIRAM_SUPPORT=y +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_SPIRAM=y CONFIG_ESP32S2_KEEP_USB_ALIVE=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set # CONFIG_USE_WAKENET is not set diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index d56dedcdc..2437efd2e 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,7 +1,7 @@ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=576 +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_SPIRAM=y +CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set diff --git a/main/idf_component.yml b/main/idf_component.yml new file mode 100644 index 000000000..fb266a7af --- /dev/null +++ b/main/idf_component.yml @@ -0,0 +1,47 @@ +dependencies: + # Required IDF version + idf: ">=5.1" + + mdns: "^1.0.7" + # nghttp: "^1.50.0" + # esp_jpeg: "^1.0.4" + # esp-dsp: "^1.2.0" + # esp-sr: "^1.0.3" + # esp32-camera: "^2.0.3" + # esp-dl: + # git: https://github.com/espressif/esp-dl.git + # arduino: + # path: components/arduino + + # # Defining a dependency from the registry: + # # https://components.espressif.com/component/example/cmp + # example/cmp: "^3.3.3" # Automatically update minor releases + # + # # Other ways to define dependencies + # + # # For components maintained by Espressif only name can be used. + # # Same as `espressif/cmp` + # component: "~1.0.0" # Automatically update bugfix releases + # + # # Or in a longer form with extra parameters + # component2: + # version: ">=2.0.0" + # + # # For transient dependencies `public` flag can be set. + # # `public` flag doesn't have an effect for the `main` component. + # # All dependencies of `main` are public by default. + # public: true + # + # # For components hosted on non-default registry: + # service_url: "https://componentregistry.company.com" + # + # # For components in git repository: + # test_component: + # path: test_component + # git: ssh://git@gitlab.com/user/components.git + # + # # For test projects during component development + # # components can be used from a local directory + # # with relative or absolute path + # some_local_component: + # path: ../../projects/component diff --git a/tools/config.sh b/tools/config.sh index 7aac39e5e..4216e0b1f 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v4.4" + IDF_BRANCH="master" fi if [ -z $AR_PR_TARGET_BRANCH ]; then @@ -24,9 +24,6 @@ if [ -z $IDF_TARGET ]; then fi fi -IDF_COMPS="$IDF_PATH/components" -IDF_TOOLCHAIN="xtensa-$IDF_TARGET-elf" - # Owner of the target ESP32 Arduino repository AR_USER="espressif" diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index a6505d084..af8e1b339 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -95,7 +95,7 @@ for item in "${@:2:${#@}-5}"; do elif [ "$prefix" = "-O" ]; then PIO_CC_FLAGS+="$item " elif [[ "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then C_FLAGS+="$item " fi fi @@ -109,7 +109,7 @@ set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then AS_FLAGS+="$item " if [[ $C_FLAGS == *"$item"* ]]; then PIO_CC_FLAGS+="$item " @@ -128,7 +128,7 @@ set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then CPP_FLAGS+="$item " if [[ $PIO_CC_FLAGS != *"$item"* ]]; then PIO_CXX_FLAGS+="$item " @@ -155,13 +155,15 @@ else libs="${libs:19:${#libs}-1}" flags=`cat build/build.ninja | grep LINK_FLAGS` flags="${flags:15:${#flags}-1}" + paths=`cat build/build.ninja | grep LINK_PATH` + paths="${paths:14:${#paths}-1}" if [ "$IDF_TARGET" = "esp32" ]; then flags="-Wno-frame-address $flags" fi if [ "$IDF_TARGET" != "esp32c3" ]; then flags="-mlongcalls $flags" fi - str="$flags $libs" + str="$flags $libs $paths" fi if [ "$IDF_TARGET" = "esp32" ]; then LD_SCRIPTS+="-T esp32.rom.redefined.ld " @@ -362,7 +364,7 @@ for item; do if [[ "$fname" == "main" && "$dname" == "esp32-arduino-lib-builder" ]]; then continue fi - while [[ "$dname" != "components" && "$dname" != "build" ]]; do + while [[ "$dname" != "components" && "$dname" != "managed_components" && "$dname" != "build" ]]; do ipath=`dirname "$ipath"` fname=`basename "$ipath"` dname=`basename $(dirname "$ipath")` @@ -482,7 +484,7 @@ rm -rf platform_start.txt platform_mid.txt 1platform_mid.txt cp -f "sdkconfig" "$AR_SDK/sdkconfig" # gen_esp32part.py -cp "$IDF_COMPS/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" +cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" # copy precompiled libs (if we need them) function copy_precompiled_lib(){ diff --git a/tools/update-components.sh b/tools/update-components.sh index 7bc0dce58..56a2b685e 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -63,10 +63,6 @@ else git -C "$AR_COMPS/esp32-camera" fetch && \ git -C "$AR_COMPS/esp32-camera" pull --ff-only fi -#this is a temp measure to fix build issue -# if [ -f "$AR_COMPS/esp32-camera/idf_component.yml" ]; then -# rm -rf "$AR_COMPS/esp32-camera/idf_component.yml" -# fi if [ $? -ne 0 ]; then exit 1; fi # @@ -98,16 +94,14 @@ fi if [ $? -ne 0 ]; then exit 1; fi # -# CLONE/UPDATE ESP-LITTLEFS +# CLONE/UPDATE ESP-DSP # -echo "Updating ESP-LITTLEFS..." -if [ ! -d "$AR_COMPS/esp_littlefs" ]; then - git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" && \ - git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive +echo "Updating ESP-DSP..." +if [ ! -d "$AR_COMPS/esp-dsp" ]; then + git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" else - git -C "$AR_COMPS/esp_littlefs" fetch && \ - git -C "$AR_COMPS/esp_littlefs" pull --ff-only && \ - git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive + git -C "$AR_COMPS/esp-dsp" fetch && \ + git -C "$AR_COMPS/esp-dsp" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi @@ -140,14 +134,16 @@ fi if [ $? -ne 0 ]; then exit 1; fi # -# CLONE/UPDATE ESP-DSP +# CLONE/UPDATE ESP-LITTLEFS # -echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/esp-dsp" ]; then - git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" +echo "Updating ESP-LITTLEFS..." +if [ ! -d "$AR_COMPS/esp_littlefs" ]; then + git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" && \ + git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive else - git -C "$AR_COMPS/esp-dsp" fetch && \ - git -C "$AR_COMPS/esp-dsp" pull --ff-only + git -C "$AR_COMPS/esp_littlefs" fetch && \ + git -C "$AR_COMPS/esp_littlefs" pull --ff-only && \ + git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive fi if [ $? -ne 0 ]; then exit 1; fi From 01b440e133ff395c3342a1a4171dc5a2d1fe5dd6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 29 Jan 2023 16:11:53 +0100 Subject: [PATCH 002/636] Idf v5.1 --- .github/workflows/cron.yml | 39 ---------- .github/workflows/push.yml | 45 +++++------ .github/workflows/repository_dispatch.yml | 23 ------ .gitignore | 1 + CMakeLists.txt | 2 - build.sh | 6 +- components/arduino_tinyusb/CMakeLists.txt | 70 +++++++++-------- components/arduino_tinyusb/src/dcd_esp32sx.c | 29 ++++++- configs/builds.json | 52 +++++-------- configs/defconfig.common | 57 +++++++------- configs/defconfig.esp32 | 15 +++- configs/defconfig.esp32c3 | 30 +++++++- configs/defconfig.esp32s2 | 16 +++- configs/defconfig.esp32s3 | 43 ++++++++++- core_version.h | 4 + main/idf_component.yml | 47 ++++++++++++ package.json | 17 +++++ tools/archive-build.sh | 35 +++++++-- tools/config.sh | 44 +++-------- tools/copy-libs.sh | 16 ++-- tools/cron.sh | 10 --- tools/install-esp-idf.sh | 80 ++++---------------- tools/prepare-ci.sh | 5 +- tools/push-to-arduino.sh | 54 ------------- tools/repository_dispatch.sh | 46 ----------- tools/update-components.sh | 59 +++------------ 26 files changed, 377 insertions(+), 468 deletions(-) delete mode 100644 .github/workflows/cron.yml delete mode 100644 .github/workflows/repository_dispatch.yml create mode 100644 core_version.h create mode 100644 main/idf_component.yml create mode 100644 package.json delete mode 100644 tools/cron.sh delete mode 100755 tools/push-to-arduino.sh delete mode 100644 tools/repository_dispatch.sh diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml deleted file mode 100644 index 117ca8361..000000000 --- a/.github/workflows/cron.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Cron Build - -on: - schedule: -# ┌───────────── minute (0 - 59) -# │ ┌───────────── hour (0 - 23) -# │ │ ┌───────────── day of the month (1 - 31) -# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) -# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) -# │ │ │ │ │ -# │ │ │ │ │ -# │ │ │ │ │ -# * * * * * - - cron: '0 */6 * * *' - -jobs: - run: - name: Build with IDF ${{ matrix.idf_branch }} - runs-on: ubuntu-latest - - strategy: - matrix: - idf_branch: [release/v4.4] #, release/v3.3] - steps: - - uses: actions/checkout@v1 - - name: Install dependencies - run: bash ./tools/prepare-ci.sh - - name: Build - env: - GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} - GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} - GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} - IDF_BRANCH: ${{ matrix.idf_branch }} - run: bash ./tools/cron.sh - - name: Upload archive - uses: actions/upload-artifact@v1 - with: - name: artifacts - path: dist diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 0d62c8d5e..293608981 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,31 +1,32 @@ -name: ESP32 Arduino Libs CI +name: Arduino IDF 5.x on: - push: - branches: - - master - pull_request: - -concurrency: - group: esp-idf-libs-${{github.event.pull_request.number || github.ref}} - cancel-in-progress: true + workflow_dispatch: # Manually start a workflow jobs: build-libs: - name: Build Libs for ${{ matrix.target }} - runs-on: ubuntu-latest - strategy: - matrix: - target: [esp32, esp32s2, esp32s3, esp32c3] - fail-fast: false + name: Build Arduino Libs + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.7' - name: Install dependencies run: bash ./tools/prepare-ci.sh - - name: Build Libs for ${{ matrix.target }} - run: bash ./build.sh -t ${{ matrix.target }} - - name: Upload archive - uses: actions/upload-artifact@v1 + - name: Build Arduino Libs + run: bash ./build.sh + - name: Display files + run: ls -R ./* + - name: Release + uses: jason2866/action-gh-release@v1.2 with: - name: artifacts-${{ matrix.target }} - path: dist + tag_name: ${{ github.run_number }} + body_path: release-info.txt + prerelease: true + files: | + dist/framework* + release-info.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/repository_dispatch.yml b/.github/workflows/repository_dispatch.yml deleted file mode 100644 index 016b84831..000000000 --- a/.github/workflows/repository_dispatch.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Remote Trigger - -on: repository_dispatch - -jobs: - run: - name: Dispatch Event - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Install dependencies - run: bash ./tools/prepare-ci.sh - - name: Handle Event - env: - GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} - GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} - GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} - run: bash ./tools/repository_dispatch.sh - - name: Upload archive - uses: actions/upload-artifact@v1 - with: - name: artifacts - path: dist diff --git a/.gitignore b/.gitignore index 4d9511e9d..3128aa229 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ sdkconfig sdkconfig.old version.txt dependencies.lock +managed_components/ diff --git a/CMakeLists.txt b/CMakeLists.txt index a3be4c620..023aa709c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(EXTRA_COMPONENT_DIRS ${CMAKE_SOURCE_DIR}/components/esp-rainmaker/components ${CMAKE_SOURCE_DIR}/components/esp-insights/components) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(arduino-lib-builder) diff --git a/build.sh b/build.sh index 2ef451734..5fc41769d 100755 --- a/build.sh +++ b/build.sh @@ -17,7 +17,7 @@ COPY_OUT=0 DEPLOY_OUT=0 function print_help() { - echo "Usage: build.sh [-s] [-A ] [-I ] [-i ] [-c ] [-t ] [-b ] [config ...]" + echo "Usage: build.sh [-s] [-A ] [-I ] [-i ] [-c ] [-t ] [-b ] [config ...]" echo " -s Skip installing/updating of ESP-IDF and all components" echo " -A Set which branch of arduino-esp32 to be used for compilation" echo " -I Set which branch of ESP-IDF to be used for compilation" @@ -58,6 +58,7 @@ while getopts ":A:I:i:c:t:b:sd" opt; do b=$OPTARG if [ "$b" != "build" ] && [ "$b" != "menuconfig" ] && + [ "$b" != "reconfigure" ] && [ "$b" != "idf_libs" ] && [ "$b" != "copy_bootloader" ] && [ "$b" != "mem_variant" ]; then @@ -121,6 +122,9 @@ if [ "$BUILD_TYPE" != "all" ]; then fi rm -rf build sdkconfig out +echo "* Reconfigure Project" +idf.py reconfigure +rm -rf build sdkconfig # Add components version info mkdir -p "$AR_TOOLS/sdk" && rm -rf version.txt && rm -rf "$AR_TOOLS/sdk/versions.txt" diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index 041eeec0f..0872021eb 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -1,37 +1,22 @@ -idf_component_register(REQUIRES esp_rom freertos soc PRIV_REQUIRES arduino main) - if(CONFIG_TINYUSB_ENABLED) ### variables ### ################# - # if(IDF_TARGET STREQUAL "esp32s2") + + if(IDF_TARGET STREQUAL "esp32s2") set(compile_options "-DCFG_TUSB_MCU=OPT_MCU_ESP32S2" "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes ) - # elseif(IDF_TARGET STREQUAL "esp32s3") - # set(compile_options - # "-DCFG_TUSB_MCU=OPT_MCU_ESP32S2" - # "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" - # "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes - # ) - # endif() - idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos - ORIG_INCLUDE_PATH) - set(includes_private - # tusb: - "${COMPONENT_DIR}/tinyusb/hw/bsp/" - "${COMPONENT_DIR}/tinyusb/src/" - "${COMPONENT_DIR}/tinyusb/src/device" - ) + elseif(IDF_TARGET STREQUAL "esp32s3") + set(compile_options + "-DCFG_TUSB_MCU=OPT_MCU_ESP32S3" + "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" + "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes + ) + endif() - set(includes_public - # tusb: - "${FREERTOS_ORIG_INCLUDE_PATH}" - "${COMPONENT_DIR}/tinyusb/src/" - # espressif: - "${COMPONENT_DIR}/include") set(srcs # espressif: "${COMPONENT_DIR}/src/dcd_esp32sx.c" @@ -49,14 +34,37 @@ if(CONFIG_TINYUSB_ENABLED) "${COMPONENT_DIR}/tinyusb/src/device/usbd.c" "${COMPONENT_DIR}/tinyusb/src/tusb.c") + set(includes_private + # tusb: + "${COMPONENT_DIR}/tinyusb/hw/bsp/" + "${COMPONENT_DIR}/tinyusb/src/" + "${COMPONENT_DIR}/tinyusb/src/device" + ) + + idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos + ORIG_INCLUDE_PATH) + set(includes_public + # tusb: + "${FREERTOS_ORIG_INCLUDE_PATH}" + "${COMPONENT_DIR}/tinyusb/src/" + # espressif: + "${COMPONENT_DIR}/include") + + set(requires esp_rom freertos soc) + set(priv_requires arduino main) ### tinyusb lib ### ################### - add_library(arduino_tinyusb STATIC ${srcs}) - target_include_directories( - arduino_tinyusb - PUBLIC ${includes_public} - PRIVATE ${includes_private}) - target_compile_options(arduino_tinyusb PRIVATE ${compile_options}) - target_link_libraries(${COMPONENT_TARGET} INTERFACE arduino_tinyusb) + idf_component_register(INCLUDE_DIRS ${includes_public} PRIV_INCLUDE_DIRS ${includes_private} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) + # add_library(${COMPONENT_TARGET} STATIC ${srcs}) + # target_include_directories( + # ${COMPONENT_TARGET} + # PUBLIC ${includes_public} + # PRIVATE ${includes_private}) + target_compile_options(${COMPONENT_TARGET} PRIVATE ${compile_options}) + #target_link_libraries(${COMPONENT_TARGET} INTERFACE ${COMPONENT_TARGET}) + +else() + + idf_component_register() endif() diff --git a/components/arduino_tinyusb/src/dcd_esp32sx.c b/components/arduino_tinyusb/src/dcd_esp32sx.c index 048b44e61..29fbe99cb 100755 --- a/components/arduino_tinyusb/src/dcd_esp32sx.c +++ b/components/arduino_tinyusb/src/dcd_esp32sx.c @@ -28,17 +28,16 @@ #include "tusb_option.h" -#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && TUSB_OPT_DEVICE_ENABLED) +#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && CFG_TUD_ENABLED) // Espressif -#include "driver/periph_ctrl.h" #include "freertos/xtensa_api.h" #include "esp_intr_alloc.h" #include "esp_log.h" -#include "driver/gpio.h" #include "soc/dport_reg.h" #include "soc/gpio_sig_map.h" #include "soc/usb_periph.h" +#include "soc/periph_defs.h" // for interrupt source #include "device/dcd.h" @@ -60,6 +59,7 @@ typedef struct { uint16_t queued_len; uint16_t max_size; bool short_packet; + uint8_t interval; } xfer_ctl_t; static const char *TAG = "TUSB:DCD"; @@ -284,6 +284,14 @@ void dcd_disconnect(uint8_t rhport) USB0.dctl |= USB_SFTDISCON_M; } +void dcd_sof_enable(uint8_t rhport, bool en) +{ + (void) rhport; + (void) en; + + // TODO implement later +} + /*------------------------------------------------------------------*/ /* DCD Endpoint port *------------------------------------------------------------------*/ @@ -303,6 +311,7 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const *desc_edpt) xfer_ctl_t *xfer = XFER_CTL_BASE(epnum, dir); xfer->max_size = tu_edpt_packet_size(desc_edpt); + xfer->interval = desc_edpt->bInterval; if (dir == TUSB_DIR_OUT) { out_ep[epnum].doepctl &= ~(USB_D_EPTYPE0_M | USB_D_MPS0_M); @@ -423,6 +432,13 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to USB0.in_ep_reg[epnum].dieptsiz = (num_packets << USB_D_PKTCNT0_S) | total_bytes; USB0.in_ep_reg[epnum].diepctl |= USB_D_EPENA1_M | USB_D_CNAK1_M; // Enable | CNAK + // For ISO endpoint with interval=1 set correct DATA0/DATA1 bit for next frame + if ((USB0.in_ep_reg[epnum].diepctl & USB_D_EPTYPE0_M) == (1 << USB_D_EPTYPE1_S) && xfer->interval == 1) { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (USB0.dsts & (1u << USB_SOFFN_S)); + USB0.in_ep_reg[epnum].diepctl |= (odd_frame_now ? USB_DI_SETD0PID1 : USB_DI_SETD1PID1); + } + // Enable fifo empty interrupt only if there are something to put in the fifo. if(total_bytes != 0) { USB0.dtknqr4_fifoemptymsk |= (1 << epnum); @@ -431,6 +447,13 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to // Each complete packet for OUT xfers triggers XFRC. USB0.out_ep_reg[epnum].doeptsiz |= USB_PKTCNT0_M | ((xfer->max_size & USB_XFERSIZE0_V) << USB_XFERSIZE0_S); USB0.out_ep_reg[epnum].doepctl |= USB_EPENA0_M | USB_CNAK0_M; + + // For ISO endpoint with interval=1 set correct DATA0/DATA1 bit for next frame + if ((USB0.out_ep_reg[epnum].doepctl & USB_D_EPTYPE0_M) == (1 << USB_D_EPTYPE1_S) && xfer->interval == 1) { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (USB0.dsts & (1u << USB_SOFFN_S)); + USB0.out_ep_reg[epnum].doepctl |= (odd_frame_now ? USB_DO_SETD0PID1 : USB_DO_SETD1PID1); + } } return true; } diff --git a/configs/builds.json b/configs/builds.json index c32e465e4..e6ed5e4b0 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -41,80 +41,62 @@ { "target": "esp32s3", "features":[], - "idf_libs":["qio","80m","qio_ram"], + "idf_libs":["qio","80m","opi_ram"], "bootloaders":[ ["qio","120m","qio_ram"], ["qio","80m","qio_ram"], - ["dio","80m","qio_ram"], + ["qio","80m","opi_ram"], ["opi","80m","opi_ram"] ], "mem_variants":[ - ["qio","80m","opi_ram"], - ["dio","80m","qio_ram"], - ["dio","80m","opi_ram"], + ["qio","120m","qio_ram"], + ["qio","80m","qio_ram"], ["opi","80m","opi_ram"], ["opi","80m","qio_ram"] ] }, { "target": "esp32s2", - "features":["qio_ram"], - "idf_libs":["qio","80m"], + "features":["qio"], + "idf_libs":["dio","80m"], "bootloaders":[ ["qio","80m"], - ["qout","80m"], ["dio","80m"], - ["dout","80m"], ["qio","40m"], - ["qout","40m"], - ["dio","40m"], - ["dout","40m"] + ["dio","40m"] ], "mem_variants":[ - ["qout","80m"], - ["dio","80m"], - ["dout","80m"] + ["qio","80m"] ] }, { "target": "esp32c3", - "features":[], - "idf_libs":["qio","80m"], + "features":["qio"], + "idf_libs":["dio","80m"], "bootloaders":[ ["qio","80m"], - ["qout","80m"], ["dio","80m"], - ["dout","80m"], ["qio","40m"], - ["qout","40m"], - ["dio","40m"], - ["dout","40m"] + ["dio","40m"] ], "mem_variants":[ - ["qout","80m"], - ["dio","80m"], - ["dout","80m"] + ["qio","80m"] ] }, { "target": "esp32", - "features":["qio_ram"], - "idf_libs":["qio","80m"], + "features":["qio"], + "idf_libs":["dio","40m"], "bootloaders":[ ["qio","80m"], - ["qout","80m"], ["dio","80m"], - ["dout","80m"], ["qio","40m"], - ["qout","40m"], - ["dio","40m"], - ["dout","40m"] + ["dio","40m"] ], "mem_variants":[ - ["qout","80m"], ["dio","80m"], - ["dout","80m"] + ["qio","80m"] ] } ] -} \ No newline at end of file +} diff --git a/configs/defconfig.common b/configs/defconfig.common index cbcfd8d2c..a2af38d45 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -1,14 +1,18 @@ CONFIG_AUTOSTART_ARDUINO=y # CONFIG_WS2812_LED_ENABLE is not set -CONFIG_ARDUHAL_ESP_LOG=y +CONFIG_COMPILER_HIDE_PATHS_MACROS=y +CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y +CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y +# CONFIG_APP_COMPILE_TIME_DATE is not set CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y -CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y -CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP=y +CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y +CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y CONFIG_BLE_MESH=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y -CONFIG_COMPILER_CXX_EXCEPTIONS=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y CONFIG_COMPILER_WARN_WRITE_STRINGS=y CONFIG_ESP_HTTPS_SERVER_ENABLE=y @@ -37,20 +41,29 @@ CONFIG_FATFS_API_ENCODING_UTF_8=y # CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set CONFIG_FMB_TIMER_PORT_ENABLED=y CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y # CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024 +CONFIG_HAL_ASSERTION_DISABLE=y CONFIG_HEAP_POISONING_LIGHT=y CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 CONFIG_HTTPD_WS_SUPPORT=y -CONFIG_LOG_DEFAULT_LEVEL_ERROR=y +CONFIG_LOG_DEFAULT_LEVEL_NONE=y # CONFIG_LOG_COLORS is not set -CONFIG_LWIP_ETHARP_TRUST_IP_MAC=y +CONFIG_LWIP_LOCAL_HOSTNAME="tasmota" +CONFIG_LWIP_MAX_SOCKETS=16 +CONFIG_LWIP_SO_RCVBUF=y +CONFIG_LWIP_IP_FORWARD=y +CONFIG_LWIP_IPV4_NAPT=y # CONFIG_LWIP_DHCP_DOES_ARP_CHECK is not set CONFIG_LWIP_TCP_SYNMAXRTX=6 CONFIG_LWIP_TCP_MSS=1436 CONFIG_LWIP_TCP_RTO_TIME=3000 CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560 CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y +CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 +CONFIG_LWIP_IPV6_AUTOCONFIG=y +CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 CONFIG_LWIP_MAX_SOCKETS=16 CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y CONFIG_LWIP_DHCP_OPTIONS_LEN=128 @@ -59,36 +72,24 @@ CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 CONFIG_LWIP_DHCP_GET_NTP_SRV=y CONFIG_MBEDTLS_PSK_MODES=y CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y -CONFIG_MBEDTLS_CAMELLIA_C=y +CONFIG_NEWLIB_NANO_FORMAT=y # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_MBEDTLS_SSL_PROTO_DTLS=y CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 +CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10 CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2 CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 +# CONFIG_UNITY_ENABLE_FLOAT is not set +# CONFIG_UNITY_ENABLE_DOUBLE is not set +# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set +# CONFIG_USE_WAKENET is not set +# CONFIG_USE_MULTINET is not set +# CONFIG_VFS_SUPPORT_SELECT is not set +# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set +# CONFIG_VFS_SUPPORT_TERMIOS is not set # CONFIG_SPI_MASTER_ISR_IN_IRAM is not set # CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096 CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0 -CONFIG_LWIP_IPV6_AUTOCONFIG=y -CONFIG_ESP_RMAKER_SKIP_VERSION_CHECK=y -CONFIG_ESP_RMAKER_USER_ID_CHECK=y -CONFIG_ESP_INSIGHTS_ENABLED=y -CONFIG_ESP_INSIGHTS_COREDUMP_ENABLE=y -CONFIG_ESP_INSIGHTS_TRANSPORT_HTTPS=y -CONFIG_DIAG_LOG_DROP_WIFI_LOGS=y -CONFIG_DIAG_ENABLE_METRICS=y -CONFIG_DIAG_ENABLE_HEAP_METRICS=y -CONFIG_DIAG_ENABLE_WIFI_METRICS=y -CONFIG_DIAG_ENABLE_VARIABLES=y -CONFIG_DIAG_ENABLE_NETWORK_VARIABLES=y -CONFIG_ESP_COREDUMP_ENABLE=y -CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y -CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y -CONFIG_ESP_COREDUMP_CHECKSUM_CRC32=y -CONFIG_ESP_COREDUMP_MAX_TASKS_NUM=64 -CONFIG_ESP_COREDUMP_STACK_SIZE=1024 -CONFIG_MBEDTLS_DYNAMIC_BUFFER=y -CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y -CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index bd38b4829..a7003718c 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -1,3 +1,4 @@ +CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR=y CONFIG_BTDM_CTRL_MODE_BTDM=y CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=20 CONFIG_BT_BTC_TASK_STACK_SIZE=8192 @@ -8,16 +9,22 @@ CONFIG_BT_SPP_ENABLED=y CONFIG_BT_HFP_ENABLE=y CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y -CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_SPIRAM=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y -CONFIG_ESP32_ULP_COPROC_ENABLED=y -CONFIG_ESP32_XTAL_FREQ_AUTO=y +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_XTAL_FREQ_AUTO=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set CONFIG_FREERTOS_FPU_IN_ISR=y +# CONFIG_UNITY_ENABLE_FLOAT is not set +# CONFIG_UNITY_ENABLE_DOUBLE is not set +# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set # CONFIG_USE_WAKENET is not set # CONFIG_USE_MULTINET is not set +# CONFIG_VFS_SUPPORT_SELECT is not set +# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set +# CONFIG_VFS_SUPPORT_TERMIOS is not set CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC=y CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST=y CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID=y CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT=y -CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y \ No newline at end of file +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 31c42f7a0..8b2ecbb8a 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -1,4 +1,32 @@ +CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y CONFIG_BT_BLE_BLUFI_ENABLE=y -CONFIG_ESP32C3_RTC_CLK_CAL_CYCLES=576 +CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y +CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 +# CONFIG_UNITY_ENABLE_FLOAT is not set +# CONFIG_UNITY_ENABLE_DOUBLE is not set +# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set +# CONFIG_VFS_SUPPORT_SELECT is not set +# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set +# CONFIG_VFS_SUPPORT_TERMIOS is not set diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 6dc619a9f..f6ac0ca72 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -1,8 +1,18 @@ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32S2_SPIRAM_SUPPORT=y +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_SPIRAM=y CONFIG_ESP32S2_KEEP_USB_ALIVE=y +CONFIG_ESP32_ULP_COPROC_RISCV=y +CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4096 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set # CONFIG_USE_WAKENET is not set # CONFIG_USE_MULTINET is not set -CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y \ No newline at end of file +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y +# CONFIG_UNITY_ENABLE_FLOAT is not set +# CONFIG_UNITY_ENABLE_DOUBLE is not set +# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set +# CONFIG_USE_WAKENET is not set +# CONFIG_USE_MULTINET is not set +# CONFIG_VFS_SUPPORT_SELECT is not set +# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set +# CONFIG_VFS_SUPPORT_TERMIOS is not set diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index d56dedcdc..1ea7cdf34 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,7 +1,32 @@ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=576 +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_SPIRAM=y +CONFIG_ESP32_ULP_COPROC_RISCV=y +CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4096 +CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y +CONFIG_BLE_MESH_TRACE_LEVEL_NONE=y +CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_NONE=y +CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set @@ -9,4 +34,14 @@ CONFIG_SR_WN_MODEL_WN8_QUANT=y CONFIG_SR_WN_WN8_HIESP=y CONFIG_SR_MN_ENGLISH=y CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y -CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y \ No newline at end of file +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y +# CONFIG_UNITY_ENABLE_FLOAT is not set +# CONFIG_UNITY_ENABLE_DOUBLE is not set +# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set +CONFIG_SR_WN_MODEL_WN8_QUANT=y +CONFIG_SR_WN_WN8_HIESP=y +CONFIG_SR_MN_ENGLISH=y +CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y +# CONFIG_VFS_SUPPORT_SELECT is not set +# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set +# CONFIG_VFS_SUPPORT_TERMIOS is not set diff --git a/core_version.h b/core_version.h new file mode 100644 index 000000000..468a2459e --- /dev/null +++ b/core_version.h @@ -0,0 +1,4 @@ +#define ARDUINO_ESP32_GIT_VER 0xcbaeab4e +#define ARDUINO_ESP32_GIT_DESC 3.0.0 +#define ARDUINO_ESP32_RELEASE_3_0_0 +#define ARDUINO_ESP32_RELEASE "3_0_0" diff --git a/main/idf_component.yml b/main/idf_component.yml new file mode 100644 index 000000000..fb266a7af --- /dev/null +++ b/main/idf_component.yml @@ -0,0 +1,47 @@ +dependencies: + # Required IDF version + idf: ">=5.1" + + mdns: "^1.0.7" + # nghttp: "^1.50.0" + # esp_jpeg: "^1.0.4" + # esp-dsp: "^1.2.0" + # esp-sr: "^1.0.3" + # esp32-camera: "^2.0.3" + # esp-dl: + # git: https://github.com/espressif/esp-dl.git + # arduino: + # path: components/arduino + + # # Defining a dependency from the registry: + # # https://components.espressif.com/component/example/cmp + # example/cmp: "^3.3.3" # Automatically update minor releases + # + # # Other ways to define dependencies + # + # # For components maintained by Espressif only name can be used. + # # Same as `espressif/cmp` + # component: "~1.0.0" # Automatically update bugfix releases + # + # # Or in a longer form with extra parameters + # component2: + # version: ">=2.0.0" + # + # # For transient dependencies `public` flag can be set. + # # `public` flag doesn't have an effect for the `main` component. + # # All dependencies of `main` are public by default. + # public: true + # + # # For components hosted on non-default registry: + # service_url: "https://componentregistry.company.com" + # + # # For components in git repository: + # test_component: + # path: test_component + # git: ssh://git@gitlab.com/user/components.git + # + # # For test projects during component development + # # components can be used from a local directory + # # with relative or absolute path + # some_local_component: + # path: ../../projects/component diff --git a/package.json b/package.json new file mode 100644 index 000000000..c184e5481 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "framework-arduinoespressif32", + "version": "3.0.0", + "description": "Tasmota Arduino Framework for the Espressif ESP32, ESP32-S and ESP32-C series of SoCs", + "keywords": [ + "tasmota", + "framework", + "arduino", + "espressif", + "esp32" + ], + "license": "LGPL-2.1-or-later", + "repository": { + "type": "git", + "url": "https://github.com/tasmota/arduino-esp32" + } +} diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 432f69031..f3ba888c0 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -6,11 +6,34 @@ IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT" archive_path="dist/arduino-esp32-libs-$idf_version_string.tar.gz" build_archive_path="dist/arduino-esp32-build-$idf_version_string.tar.gz" +pio_archive_path="dist/framework-arduinoespressif32-$idf_version_string.tar.gz" +pio_zip_archive_path="dist/framework-arduinoespressif32-$idf_version_string.zip" mkdir -p dist && rm -rf "$archive_path" "$build_archive_path" -if [ -d "out" ]; then - cd out && tar zcf "../$archive_path" * && cd .. -fi -if [ -d "build" ]; then - cd build && tar zcf "../$build_archive_path" * && cd .. -fi + +cd out +echo "Creating framework-arduinoespressif32" +cp -rf ../components/arduino arduino-esp32 +rm -rf arduino-esp32/docs +rm -rf arduino-esp32/tests +rm -rf arduino-esp32/libraries/RainMaker +rm -rf arduino-esp32/libraries/Insights +rm -rf arduino-esp32/package +rm -rf arduino-esp32/tools/sdk +rm -rf arduino-esp32/tools/esptool.py +rm -rf arduino-esp32/tools/gen_esp32part.py +rm -rf arduino-esp32/tools/gen_insights_package.py +rm -rf arduino-esp32/tools/gen_insights_package.exe +rm -rf arduino-esp32/tools/platformio-build-*.py +rm -rf arduino-esp32/platform.txt +rm -rf arduino-esp32/package.json +cp -f platform.txt arduino-esp32/ +cp -Rf tools/sdk arduino-esp32/tools/ +cp -f tools/gen_esp32part.py arduino-esp32/tools/ +cp -f tools/platformio-build-*.py arduino-esp32/tools/ +cp ../package.json arduino-esp32/package.json +cp ../core_version.h arduino-esp32/cores/esp32/core_version.h +mv arduino-esp32/ framework-arduinoespressif32/ +# If the framework is as tar.gz is needed uncomment next line +# tar --exclude=.* -zcf ../$pio_archive_path framework-arduinoespressif32/ +7z a -mx=9 -tzip -xr'!.*' ../$pio_zip_archive_path framework-arduinoespressif32/ diff --git a/tools/config.sh b/tools/config.sh index 7aac39e5e..8ce831e82 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v4.4" + IDF_BRANCH="Tasmota/v5" fi if [ -z $AR_PR_TARGET_BRANCH ]; then @@ -24,15 +24,15 @@ if [ -z $IDF_TARGET ]; then fi fi -IDF_COMPS="$IDF_PATH/components" -IDF_TOOLCHAIN="xtensa-$IDF_TARGET-elf" - # Owner of the target ESP32 Arduino repository -AR_USER="espressif" +AR_USER="tasmota" # The full name of the repository AR_REPO="$AR_USER/arduino-esp32" +# Arduino branch to use +AR_BRANCH="esp-idf-v5.1-libs" + AR_REPO_URL="https://github.com/$AR_REPO.git" if [ -n $GITHUB_TOKEN ]; then AR_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_REPO.git" @@ -46,6 +46,12 @@ AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" +IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") +AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") + +rm -rf release-info.txt +echo "Framework built from IDF branch $IDF_BRANCH commit $IDF_COMMIT and $AR_REPO branch $AR_BRANCH commit $AR_COMMIT" >> release-info.txt + function get_os(){ OSBITS=`arch` if [[ "$OSTYPE" == "linux"* ]]; then @@ -76,7 +82,7 @@ export SED="sed" export SSTAT="stat -c %s" if [[ "$AR_OS" == "macos" ]]; then - if ! [ -x "$(command -v gsed)" ]; then + if ! [ -x "$(command -v gsed)" ]; then echo "ERROR: gsed is not installed! Please install gsed first. ex. brew install gsed" exit 1 fi @@ -101,29 +107,3 @@ function git_branch_exists(){ # git_branch_exists local branch_found=`git -C "$repo_path" ls-remote --heads origin "$branch_name"` if [ -n "$branch_found" ]; then echo 1; else echo 0; fi } - -function git_pr_exists(){ # git_pr_exists - local pr_num=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$AR_REPO/pulls?head=$AR_USER:$1&state=open" | jq -r '.[].number'` - if [ ! "$pr_num" == "" ] && [ ! "$pr_num" == "null" ]; then echo 1; else echo 0; fi -} - -function git_create_pr(){ # git_create_pr - local pr_branch="$1" - local pr_title="$2" - local pr_target="$3" - local pr_body="" - pr_body+="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)"\r\n" - for component in `ls "$AR_COMPS"`; do - if [ ! $component == "arduino" ]; then - if [ -d "$AR_COMPS/$component/.git" ] || [ -d "$AR_COMPS/$component/.github" ]; then - pr_body+="$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)"\r\n" - fi - fi - done - pr_body+="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)"\r\n" - local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" - 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"` - local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` - if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi -} - diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index a6505d084..85ed296e5 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -95,7 +95,7 @@ for item in "${@:2:${#@}-5}"; do elif [ "$prefix" = "-O" ]; then PIO_CC_FLAGS+="$item " elif [[ "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then C_FLAGS+="$item " fi fi @@ -109,7 +109,7 @@ set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then AS_FLAGS+="$item " if [[ $C_FLAGS == *"$item"* ]]; then PIO_CC_FLAGS+="$item " @@ -128,7 +128,7 @@ set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then CPP_FLAGS+="$item " if [[ $PIO_CC_FLAGS != *"$item"* ]]; then PIO_CXX_FLAGS+="$item " @@ -155,13 +155,15 @@ else libs="${libs:19:${#libs}-1}" flags=`cat build/build.ninja | grep LINK_FLAGS` flags="${flags:15:${#flags}-1}" + paths=`cat build/build.ninja | grep LINK_PATH` + paths="${paths:14:${#paths}-1}" if [ "$IDF_TARGET" = "esp32" ]; then flags="-Wno-frame-address $flags" fi if [ "$IDF_TARGET" != "esp32c3" ]; then flags="-mlongcalls $flags" fi - str="$flags $libs" + str="$flags $libs $paths" fi if [ "$IDF_TARGET" = "esp32" ]; then LD_SCRIPTS+="-T esp32.rom.redefined.ld " @@ -359,10 +361,10 @@ for item; do ipath="$item" fname=`basename "$ipath"` dname=`basename $(dirname "$ipath")` - if [[ "$fname" == "main" && "$dname" == "esp32-arduino-lib-builder" ]]; then + if [[ "$fname" == "main" && "$dname" == $(basename "$PWD") ]]; then continue fi - while [[ "$dname" != "components" && "$dname" != "build" ]]; do + while [[ "$dname" != "components" && "$dname" != "managed_components" && "$dname" != "build" ]]; do ipath=`dirname "$ipath"` fname=`basename "$ipath"` dname=`basename $(dirname "$ipath")` @@ -482,7 +484,7 @@ rm -rf platform_start.txt platform_mid.txt 1platform_mid.txt cp -f "sdkconfig" "$AR_SDK/sdkconfig" # gen_esp32part.py -cp "$IDF_COMPS/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" +cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" # copy precompiled libs (if we need them) function copy_precompiled_lib(){ diff --git a/tools/cron.sh b/tools/cron.sh deleted file mode 100644 index 6122b1eed..000000000 --- a/tools/cron.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if [ ! "$GITHUB_EVENT_NAME" == "schedule" ]; then - echo "Wrong event '$GITHUB_EVENT_NAME'!" - exit 1 -fi - -git checkout "$IDF_BRANCH" #local branches should match what the matrix wants to build -source ./build.sh -bash ./tools/push-to-arduino.sh diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 2b7a0f5fb..ddf6858d0 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -11,17 +11,18 @@ fi # CLONE ESP-IDF # -IDF_REPO_URL="https://github.com/espressif/esp-idf.git" +IDF_REPO_URL="https://github.com/tasmota/esp-idf.git" if [ ! -d "$IDF_PATH" ]; then - echo "ESP-IDF is not installed! Installing local copy" + echo "ESP-IDF is not installed! Installing from $IDF_REPO_URL branch $IDF_BRANCH" git clone $IDF_REPO_URL -b $IDF_BRANCH idf_was_installed="1" fi -if [ "$IDF_COMMIT" ]; then - git -C "$IDF_PATH" checkout "$IDF_COMMIT" - commit_predefined="1" -fi +# Next lines redirects ALWAYS to espressif git since this sha1 only exists there!!! +#if [ "$IDF_COMMIT" ]; then +# git -C "$IDF_PATH" checkout "$IDF_COMMIT" +# commit_predefined="1" +#fi # # UPDATE ESP-IDF TOOLS AND MODULES @@ -32,6 +33,12 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then $IDF_PATH/install.sh fi +# +# Arduino needs cam_hal.h from esp32-camera in include folder +# +# disable workaround for IDF 5.x +# cp "$IDF_PATH/components/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/components/esp32-camera/driver/include/" + # # SETUP ESP-IDF ENV # @@ -39,64 +46,3 @@ fi source $IDF_PATH/export.sh export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) - -# -# SETUP ARDUINO DEPLOY -# - -if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "repository_dispatch" -a "$GITHUB_EVENT_ACTION" == "deploy" ]; then - # format new branch name and pr title - if [ -x $commit_predefined ]; then #commit was not specified at build time - AR_NEW_BRANCH_NAME="idf-$IDF_BRANCH" - AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT" - AR_NEW_PR_TITLE="IDF $IDF_BRANCH" - else - AR_NEW_BRANCH_NAME="idf-$IDF_COMMIT" - AR_NEW_COMMIT_MESSAGE="IDF $IDF_COMMIT" - AR_NEW_PR_TITLE="$AR_NEW_COMMIT_MESSAGE" - fi - - AR_HAS_COMMIT=`git_commit_exists "$AR_COMPS/arduino" "$AR_NEW_COMMIT_MESSAGE"` - AR_HAS_BRANCH=`git_branch_exists "$AR_COMPS/arduino" "$AR_NEW_BRANCH_NAME"` - AR_HAS_PR=`git_pr_exists "$AR_NEW_BRANCH_NAME"` - - if [ "$AR_HAS_COMMIT" == "1" ]; then - echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists" - mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists" > dist/log.txt - exit 0 - fi - - if [ "$AR_HAS_BRANCH" == "1" ]; then - echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists" - fi - - if [ "$AR_HAS_PR" == "1" ]; then - echo "PR '$AR_NEW_PR_TITLE' Already Exists" - fi - - # setup git for pushing - git config --global github.user "$GITHUB_ACTOR" - git config --global user.name "$GITHUB_ACTOR" - git config --global user.email "$GITHUB_ACTOR@github.com" - - # create or checkout the branch - if [ ! $AR_HAS_BRANCH == "0" ]; then - echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." - git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME - else - echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." - git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME - fi - if [ $? -ne 0 ]; then - echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" - exit 1 - fi - - export AR_NEW_BRANCH_NAME - export AR_NEW_COMMIT_MESSAGE - export AR_NEW_PR_TITLE - - export AR_HAS_COMMIT - export AR_HAS_BRANCH - export AR_HAS_PR -fi diff --git a/tools/prepare-ci.sh b/tools/prepare-ci.sh index e39a7983b..711ce154f 100755 --- a/tools/prepare-ci.sh +++ b/tools/prepare-ci.sh @@ -1,5 +1,4 @@ #!/bin/bash -sudo apt-get install -y git wget curl libssl-dev libncurses-dev flex bison gperf python3 cmake ninja-build ccache -curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py && \ -pip3 install setuptools pyserial click future wheel cryptography pyparsing pyelftools +sudo apt-get install -y gperf cmake ninja-build +pip3 install wheel future pyelftools diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh deleted file mode 100755 index f9a2b9955..000000000 --- a/tools/push-to-arduino.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -source ./tools/config.sh - -if [ -x $GITHUB_TOKEN ]; then - echo "ERROR: GITHUB_TOKEN was not defined" - exit 1 -fi - -if ! [ -d "$AR_COMPS/arduino" ]; then - echo "ERROR: Target arduino folder does not exist!" - exit 1 -fi - -# -# UPDATE FILES -# - -if [ $AR_HAS_COMMIT == "0" ]; then - # make changes to the files - echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." - ESP32_ARDUINO="$AR_COMPS/arduino" ./tools/copy-to-arduino.sh - - cd $AR_COMPS/arduino - - # did any of the files change? - if [ -n "$(git status --porcelain)" ]; then - echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..." - git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME - if [ $? -ne 0 ]; then - echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" - exit 1 - fi - else - echo "No changes in branch '$AR_NEW_BRANCH_NAME'" - if [ $AR_HAS_BRANCH == "0" ]; then - echo "Delete created branch '$AR_NEW_BRANCH_NAME'" - git branch -d $AR_NEW_BRANCH_NAME - fi - exit 0 - fi -fi - -# -# CREATE PULL REQUEST -# - -if [ "$AR_HAS_PR" == "0" ]; then - pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` - if [ $pr_created == "0" ]; then - 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'` - exit 1 - fi -fi -exit 0 diff --git a/tools/repository_dispatch.sh b/tools/repository_dispatch.sh deleted file mode 100644 index a920f5b45..000000000 --- a/tools/repository_dispatch.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -if [ ! "$GITHUB_EVENT_NAME" == "repository_dispatch" ]; then - echo "Wrong event '$GITHUB_EVENT_NAME'!" - exit 1 -fi - -EVENT_JSON=`cat "$GITHUB_EVENT_PATH"` -action=`echo "$EVENT_JSON" | jq -r '.action'` -payload=`echo "$EVENT_JSON" | jq -r '.client_payload'` -branch=`echo "$payload" | jq -r '.branch'` -commit=`echo "$payload" | jq -r '.commit'` -builder=`echo "$payload" | jq -r '.builder'` -arduino=`echo "$payload" | jq -r '.arduino'` - -echo "Action: $action, Branch: $branch, Commit: $commit, Builder: $builder" - -if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then - echo "Bad Action $action" - exit 1 -fi - -export GITHUB_EVENT_ACTION="$action" - -if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then - export IDF_COMMIT="$commit" -else - commit="" - if [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then - export IDF_BRANCH="$branch" - fi -fi - -if [ ! "$builder" == "" ] && [ ! "$builder" == "null" ]; then - git checkout "$builder" -fi - -if [ ! "$arduino" == "" ] && [ ! "$arduino" == "null" ]; then - export AR_BRANCH="$arduino" -fi - -source ./build.sh - -if [ "$action" == "deploy" ]; then - bash ./tools/push-to-arduino.sh -fi diff --git a/tools/update-components.sh b/tools/update-components.sh index 7bc0dce58..5af413f49 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -5,8 +5,6 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" DL_REPO_URL="https://github.com/espressif/esp-dl.git" SR_REPO_URL="https://github.com/espressif/esp-sr.git" -RMAKER_REPO_URL="https://github.com/espressif/esp-rainmaker.git" -INSIGHTS_REPO_URL="https://github.com/espressif/esp-insights.git" DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" @@ -63,10 +61,6 @@ else git -C "$AR_COMPS/esp32-camera" fetch && \ git -C "$AR_COMPS/esp32-camera" pull --ff-only fi -#this is a temp measure to fix build issue -# if [ -f "$AR_COMPS/esp32-camera/idf_component.yml" ]; then -# rm -rf "$AR_COMPS/esp32-camera/idf_component.yml" -# fi if [ $? -ne 0 ]; then exit 1; fi # @@ -97,6 +91,18 @@ if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then fi if [ $? -ne 0 ]; then exit 1; fi +# +# CLONE/UPDATE ESP-DSP +# +echo "Updating ESP-DSP..." +if [ ! -d "$AR_COMPS/esp-dsp" ]; then + git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" +else + git -C "$AR_COMPS/esp-dsp" fetch && \ + git -C "$AR_COMPS/esp-dsp" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi + # # CLONE/UPDATE ESP-LITTLEFS # @@ -111,46 +117,6 @@ else fi if [ $? -ne 0 ]; then exit 1; fi -# -# CLONE/UPDATE ESP-RAINMAKER -# -echo "Updating ESP-RainMaker..." -if [ ! -d "$AR_COMPS/esp-rainmaker" ]; then - git clone $RMAKER_REPO_URL "$AR_COMPS/esp-rainmaker" && \ - git -C "$AR_COMPS/esp-rainmaker" submodule update --init --recursive -else - git -C "$AR_COMPS/esp-rainmaker" fetch && \ - git -C "$AR_COMPS/esp-rainmaker" pull --ff-only && \ - git -C "$AR_COMPS/esp-rainmaker" submodule update --init --recursive -fi -if [ $? -ne 0 ]; then exit 1; fi - -# -# CLONE/UPDATE ESP-INSIGHTS -# -echo "Updating ESP-Insights..." -if [ ! -d "$AR_COMPS/esp-insights" ]; then - git clone $INSIGHTS_REPO_URL "$AR_COMPS/esp-insights" && \ - git -C "$AR_COMPS/esp-insights" submodule update --init --recursive -else - git -C "$AR_COMPS/esp-insights" fetch && \ - git -C "$AR_COMPS/esp-insights" pull --ff-only && \ - git -C "$AR_COMPS/esp-insights" submodule update --init --recursive -fi -if [ $? -ne 0 ]; then exit 1; fi - -# -# CLONE/UPDATE ESP-DSP -# -echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/esp-dsp" ]; then - git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" -else - git -C "$AR_COMPS/esp-dsp" fetch && \ - git -C "$AR_COMPS/esp-dsp" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi - # # CLONE/UPDATE TINYUSB # @@ -162,4 +128,3 @@ else git -C "$AR_COMPS/arduino_tinyusb/tinyusb" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi - From a91076de1247e65ddc2b9b3b7e986d7acfbc68f4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:16:40 +0100 Subject: [PATCH 003/636] Disable PHY W5500 not supported in Arduino --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index a2af38d45..9040ad93d 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -33,7 +33,7 @@ CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP32_WIFI_IRAM_OPT is not set # CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set CONFIG_ETH_SPI_ETHERNET_DM9051=y -CONFIG_ETH_SPI_ETHERNET_W5500=y +# CONFIG_ETH_SPI_ETHERNET_W5500 is not set CONFIG_FATFS_CODEPAGE_850=y CONFIG_FATFS_LFN_STACK=y # CONFIG_FATFS_API_ENCODING_ANSI_OEM is not set From 14c8d24d6ccd13669808c4ce12fc497caf9de617 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:33:44 +0100 Subject: [PATCH 004/636] Update defconfig.common --- configs/defconfig.common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 9040ad93d..dd536f766 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -67,9 +67,9 @@ CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 CONFIG_LWIP_MAX_SOCKETS=16 CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y CONFIG_LWIP_DHCP_OPTIONS_LEN=128 -CONFIG_LWIP_SNTP_MAX_SERVERS=3 +CONFIG_LWIP_SNTP_MAX_SERVERS=1 +# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 -CONFIG_LWIP_DHCP_GET_NTP_SRV=y CONFIG_MBEDTLS_PSK_MODES=y CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y CONFIG_NEWLIB_NANO_FORMAT=y From 6630963ffec10023b3a597a91d76fe3aa3a342bf Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 30 Jan 2023 15:13:14 +0100 Subject: [PATCH 005/636] Fix path for `cam_hal.h` since cloned and not included in IDF components --- tools/install-esp-idf.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index ddf6858d0..cf51cb67b 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -36,8 +36,8 @@ fi # # Arduino needs cam_hal.h from esp32-camera in include folder # -# disable workaround for IDF 5.x -# cp "$IDF_PATH/components/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/components/esp32-camera/driver/include/" + +cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/components/esp32-camera/driver/include/" # # SETUP ESP-IDF ENV From fe0c898bf073900048b91587af12500340046104 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 14:38:02 +0100 Subject: [PATCH 006/636] Update defconfig.common --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index dd536f766..a486a68b2 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -1,5 +1,6 @@ CONFIG_AUTOSTART_ARDUINO=y # CONFIG_WS2812_LED_ENABLE is not set +CONFIG_FREERTOS_HZ=1000 CONFIG_COMPILER_HIDE_PATHS_MACROS=y CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y From 8f87117bad8d9f4b222bf4d20c7b3e3267bc549c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:13:01 +0100 Subject: [PATCH 007/636] Update defconfig.common --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index a486a68b2..061e4f91a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -1,6 +1,6 @@ CONFIG_AUTOSTART_ARDUINO=y # CONFIG_WS2812_LED_ENABLE is not set -CONFIG_FREERTOS_HZ=1000 +CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y CONFIG_COMPILER_HIDE_PATHS_MACROS=y CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y From cd9e634f6f11064212e96e9cdedd3484445eb3fb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:33:52 +0100 Subject: [PATCH 008/636] Option to set IDF commit --- tools/config.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 8ce831e82..d9f373c69 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -9,6 +9,9 @@ if [ -z $IDF_BRANCH ]; then IDF_BRANCH="Tasmota/v5" fi +# IDF commit to use +#IDF_COMMIT="" + if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="master" fi @@ -46,7 +49,13 @@ AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" -IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") +if [ "$IDF_COMMIT" ]; then + echo "Using specific commit $IDF_COMMIT for IDF" + commit_predefined="1" +else + IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") +fi + AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") rm -rf release-info.txt From c48d8e322b2056e9cd9b863598794e93a09e982f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:38:14 +0100 Subject: [PATCH 009/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index cf51cb67b..bee339920 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -18,11 +18,10 @@ if [ ! -d "$IDF_PATH" ]; then idf_was_installed="1" fi -# Next lines redirects ALWAYS to espressif git since this sha1 only exists there!!! -#if [ "$IDF_COMMIT" ]; then -# git -C "$IDF_PATH" checkout "$IDF_COMMIT" -# commit_predefined="1" -#fi +if [ "$commit_predefined" ]; then + echo "Use specified commit $IDF_COMMIT" + git -C "$IDF_PATH" checkout "$IDF_COMMIT" +fi # # UPDATE ESP-IDF TOOLS AND MODULES From 9fc3fafbe8f7f4fd2a874785df3e7dc9975f83f2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:40:32 +0100 Subject: [PATCH 010/636] Use IDF commit d6ffee9234522d41e --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index d9f373c69..d9ec56967 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -10,7 +10,7 @@ if [ -z $IDF_BRANCH ]; then fi # IDF commit to use -#IDF_COMMIT="" +IDF_COMMIT="d6ffee9234522d41ed8af891ea4970817c12452e" if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="master" From e88bc8ff83416e4ac8eb20143ae1699a658ab081 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:59:44 +0100 Subject: [PATCH 011/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index bee339920..d62ed8ad0 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -28,6 +28,7 @@ fi # if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then + echo "$IDF_PATH submodule update" git -C $IDF_PATH submodule update --init --recursive $IDF_PATH/install.sh fi From cd9dd1b371ca3b4f21f3b00a9038faa7a4824746 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 16:38:15 +0100 Subject: [PATCH 012/636] Update config.sh --- tools/config.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index d9ec56967..01d2a9a73 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -5,6 +5,10 @@ if [ -z $IDF_PATH ]; then export IDF_PATH="$PWD/esp-idf" fi +# The ESP32 IDF repository +IDF_REPO_URL="https://github.com/tasmota/esp-idf.git" + +# The IDF branch to use if [ -z $IDF_BRANCH ]; then IDF_BRANCH="Tasmota/v5" fi @@ -27,7 +31,7 @@ if [ -z $IDF_TARGET ]; then fi fi -# Owner of the target ESP32 Arduino repository +# Owner of the ESP32 Arduino repository AR_USER="tasmota" # The full name of the repository From af5381ceb110b3f1f818711871b984f67d902454 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 16:39:06 +0100 Subject: [PATCH 013/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index d62ed8ad0..60c73c3fa 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -11,7 +11,6 @@ fi # CLONE ESP-IDF # -IDF_REPO_URL="https://github.com/tasmota/esp-idf.git" if [ ! -d "$IDF_PATH" ]; then echo "ESP-IDF is not installed! Installing from $IDF_REPO_URL branch $IDF_BRANCH" git clone $IDF_REPO_URL -b $IDF_BRANCH From 63bfc9a6ed3fd3611a545a72ee27972f1c125969 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Feb 2023 16:47:47 +0100 Subject: [PATCH 014/636] Delete current_commit.sh --- tools/current_commit.sh | 2 -- 1 file changed, 2 deletions(-) delete mode 100755 tools/current_commit.sh diff --git a/tools/current_commit.sh b/tools/current_commit.sh deleted file mode 100755 index 8d890dc5c..000000000 --- a/tools/current_commit.sh +++ /dev/null @@ -1,2 +0,0 @@ -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) -echo Current commit is $IDF_COMMIT From 5a174cb7761c7b8e834622855d9c2ba5832c0c63 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Fri, 10 Feb 2023 00:29:35 +0200 Subject: [PATCH 015/636] Update package json with tolls matching the ESP-IDF version --- build.sh | 6 ++ tools/copy-to-arduino.sh | 1 + tools/gen_tools_json.py | 136 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 tools/gen_tools_json.py diff --git a/build.sh b/build.sh index 5fc41769d..3a3cbadfa 100755 --- a/build.sh +++ b/build.sh @@ -191,6 +191,12 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do done done +# update package_esp32_index.template.json +if [ "$BUILD_TYPE" = "all" ]; then + python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" + if [ $? -ne 0 ]; then exit 1; fi +fi + # archive the build if [ "$BUILD_TYPE" = "all" ]; then ./tools/archive-build.sh diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh index 6880b75d6..ef8b9074c 100755 --- a/tools/copy-to-arduino.sh +++ b/tools/copy-to-arduino.sh @@ -19,6 +19,7 @@ echo "Installing new libraries to $ESP32_ARDUINO" rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py $ESP32_ARDUINO/platform.txt cp -f $AR_OUT/platform.txt $ESP32_ARDUINO/ +cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json cp -Rf $AR_TOOLS/sdk $ESP32_ARDUINO/tools/ cp -f $AR_TOOLS/gen_esp32part.py $ESP32_ARDUINO/tools/ cp -f $AR_TOOLS/platformio-build-*.py $ESP32_ARDUINO/tools/ diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py new file mode 100644 index 000000000..98657ee71 --- /dev/null +++ b/tools/gen_tools_json.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# python tools/gen_tools_json.py -i $IDF_PATH -j components/arduino/package/package_esp32_index.template.json -o out/ + +from __future__ import print_function + +__author__ = "Hristo Gochkov" +__version__ = "2023" + +import os +import shutil +import errno +import os.path +import json +import platform +import sys +import stat +import argparse + +if sys.version_info[0] == 3: + unicode = lambda s: str(s) + +if __name__ == '__main__': + + parser = argparse.ArgumentParser( + prog = 'gen_tools_json', + description = 'Update Arduino package index with the tolls found in ESP-IDF') + parser.add_argument('-i', '--esp-idf', dest='idf_path', required=True, help='Path to ESP-IDF') + parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=True, help='path to Arduino package json') + parser.add_argument('-o', '--out-path', dest='out_path', required=True, help='Output path to store the update package json') + args = parser.parse_args() + + idf_path = args.idf_path; + arduino_json = args.arduino_json; + out_path = args.out_path; + + # settings + arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","riscv32-esp-elf","openocd-esp32"] + + # code start + farray = json.load(open(arduino_json)) + + idf_tools = json.load(open(idf_path + '/tools/tools.json')) + for tool in idf_tools['tools']: + try: + tool_index = arduino_tools.index(tool['name']) + except: + continue + tool_name = tool['name'] + tool_version = tool['versions'][0]['name'] + if tool_name.endswith('-elf'): + tool_name += '-gcc' + print('Found {0}, version: {1}'.format(tool_name, tool_version)) + + dep_found = False + dep_skip = False + for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: + if dep['name'] == tool_name: + if dep['version'] == tool_version: + print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) + dep_skip = True + break + print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) + dep['version'] = tool_version + dep_found = True + if dep_skip == True: + continue + if dep_found == False: + print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) + deps = { + "packager": "esp32", + "name": tool_name, + "version": tool_version + } + farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) + + systems = [] + for arch in tool['versions'][0]: + if arch == 'name' or arch == 'status': + continue + tool_data = tool['versions'][0][arch] + + system = { + "host": '', + "url": tool_data['url'], + "archiveFileName": os.path.basename(tool_data['url']), + "checksum": "SHA-256:"+tool_data['sha256'], + "size": tool_data['size'] + } + + if arch == "win32": + system["host"] = "i686-mingw32"; + elif arch == "win64": + system["host"] = "x86_64-mingw32"; + elif arch == "macos-arm64": + system["host"] = "arm64-apple-darwin"; + elif arch == "macos": + system["host"] = "x86_64-apple-darwin"; + elif arch == "linux-amd64": + system["host"] = "x86_64-pc-linux-gnu"; + elif arch == "linux-i686": + system["host"] = "i686-pc-linux-gnu"; + elif arch == "linux-arm64": + system["host"] = "aarch64-linux-gnu"; + elif arch == "linux-armel": + system["host"] = "arm-linux-gnueabihf"; + elif arch == "linux-armhf": + # system["host"] = "arm-linux-gnueabihf"; + continue + else : + continue + + systems.append(system) + + tool_found = False + for t in farray['packages'][0]['tools']: + if t['name'] == tool_name: + t['version'] = tool_version + t['systems'] = systems + tool_found = True + print('Updating binaries of {0} to version {1}'.format(tool_name, tool_version)) + if tool_found == False: + print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) + tools = { + "name": tool_name, + "version": tool_version, + "systems": systems + } + farray['packages'][0]['tools'].append(tools) + + json_str = json.dumps(farray, indent=2) + out_file = out_path + os.path.basename(arduino_json) + with open(out_file, "w") as f: + f.write(json_str+"\n") + f.close() + # print(json_str) + print('{0} generated'.format(out_file)) From 9c49d8be0be2d5bc6f64d0374d5998f688892a78 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 Feb 2023 12:49:15 +0100 Subject: [PATCH 016/636] Update build.sh --- build.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.sh b/build.sh index 5fc41769d..3a3cbadfa 100755 --- a/build.sh +++ b/build.sh @@ -191,6 +191,12 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do done done +# update package_esp32_index.template.json +if [ "$BUILD_TYPE" = "all" ]; then + python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" + if [ $? -ne 0 ]; then exit 1; fi +fi + # archive the build if [ "$BUILD_TYPE" = "all" ]; then ./tools/archive-build.sh From 3f6d347097feead91679423a4ded485104c46d87 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 Feb 2023 12:49:52 +0100 Subject: [PATCH 017/636] Update copy-to-arduino.sh --- tools/copy-to-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh index 6880b75d6..ef8b9074c 100755 --- a/tools/copy-to-arduino.sh +++ b/tools/copy-to-arduino.sh @@ -19,6 +19,7 @@ echo "Installing new libraries to $ESP32_ARDUINO" rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py $ESP32_ARDUINO/platform.txt cp -f $AR_OUT/platform.txt $ESP32_ARDUINO/ +cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json cp -Rf $AR_TOOLS/sdk $ESP32_ARDUINO/tools/ cp -f $AR_TOOLS/gen_esp32part.py $ESP32_ARDUINO/tools/ cp -f $AR_TOOLS/platformio-build-*.py $ESP32_ARDUINO/tools/ From 1faa1f1a3f7c5f720c807d83b930be6c12764b5d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 Feb 2023 12:50:30 +0100 Subject: [PATCH 018/636] Create gen_tools_json.py --- tools/gen_tools_json.py | 136 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 tools/gen_tools_json.py diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py new file mode 100644 index 000000000..98657ee71 --- /dev/null +++ b/tools/gen_tools_json.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# python tools/gen_tools_json.py -i $IDF_PATH -j components/arduino/package/package_esp32_index.template.json -o out/ + +from __future__ import print_function + +__author__ = "Hristo Gochkov" +__version__ = "2023" + +import os +import shutil +import errno +import os.path +import json +import platform +import sys +import stat +import argparse + +if sys.version_info[0] == 3: + unicode = lambda s: str(s) + +if __name__ == '__main__': + + parser = argparse.ArgumentParser( + prog = 'gen_tools_json', + description = 'Update Arduino package index with the tolls found in ESP-IDF') + parser.add_argument('-i', '--esp-idf', dest='idf_path', required=True, help='Path to ESP-IDF') + parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=True, help='path to Arduino package json') + parser.add_argument('-o', '--out-path', dest='out_path', required=True, help='Output path to store the update package json') + args = parser.parse_args() + + idf_path = args.idf_path; + arduino_json = args.arduino_json; + out_path = args.out_path; + + # settings + arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","riscv32-esp-elf","openocd-esp32"] + + # code start + farray = json.load(open(arduino_json)) + + idf_tools = json.load(open(idf_path + '/tools/tools.json')) + for tool in idf_tools['tools']: + try: + tool_index = arduino_tools.index(tool['name']) + except: + continue + tool_name = tool['name'] + tool_version = tool['versions'][0]['name'] + if tool_name.endswith('-elf'): + tool_name += '-gcc' + print('Found {0}, version: {1}'.format(tool_name, tool_version)) + + dep_found = False + dep_skip = False + for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: + if dep['name'] == tool_name: + if dep['version'] == tool_version: + print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) + dep_skip = True + break + print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) + dep['version'] = tool_version + dep_found = True + if dep_skip == True: + continue + if dep_found == False: + print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) + deps = { + "packager": "esp32", + "name": tool_name, + "version": tool_version + } + farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) + + systems = [] + for arch in tool['versions'][0]: + if arch == 'name' or arch == 'status': + continue + tool_data = tool['versions'][0][arch] + + system = { + "host": '', + "url": tool_data['url'], + "archiveFileName": os.path.basename(tool_data['url']), + "checksum": "SHA-256:"+tool_data['sha256'], + "size": tool_data['size'] + } + + if arch == "win32": + system["host"] = "i686-mingw32"; + elif arch == "win64": + system["host"] = "x86_64-mingw32"; + elif arch == "macos-arm64": + system["host"] = "arm64-apple-darwin"; + elif arch == "macos": + system["host"] = "x86_64-apple-darwin"; + elif arch == "linux-amd64": + system["host"] = "x86_64-pc-linux-gnu"; + elif arch == "linux-i686": + system["host"] = "i686-pc-linux-gnu"; + elif arch == "linux-arm64": + system["host"] = "aarch64-linux-gnu"; + elif arch == "linux-armel": + system["host"] = "arm-linux-gnueabihf"; + elif arch == "linux-armhf": + # system["host"] = "arm-linux-gnueabihf"; + continue + else : + continue + + systems.append(system) + + tool_found = False + for t in farray['packages'][0]['tools']: + if t['name'] == tool_name: + t['version'] = tool_version + t['systems'] = systems + tool_found = True + print('Updating binaries of {0} to version {1}'.format(tool_name, tool_version)) + if tool_found == False: + print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) + tools = { + "name": tool_name, + "version": tool_version, + "systems": systems + } + farray['packages'][0]['tools'].append(tools) + + json_str = json.dumps(farray, indent=2) + out_file = out_path + os.path.basename(arduino_json) + with open(out_file, "w") as f: + f.write(json_str+"\n") + f.close() + # print(json_str) + print('{0} generated'.format(out_file)) From 1dbc8e4e473aa0e325f3caaea6923af6e2c7bf36 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 Feb 2023 13:03:05 +0100 Subject: [PATCH 019/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 01d2a9a73..b8ff6489f 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -14,7 +14,7 @@ if [ -z $IDF_BRANCH ]; then fi # IDF commit to use -IDF_COMMIT="d6ffee9234522d41ed8af891ea4970817c12452e" +# IDF_COMMIT="d6ffee9234522d41ed8af891ea4970817c12452e" if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="master" From 38fe5fe1c3f79414cf6adcde3e7fa225b3e3bf3e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 13 Feb 2023 15:16:12 +0100 Subject: [PATCH 020/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index b8ff6489f..34eba186f 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -14,7 +14,7 @@ if [ -z $IDF_BRANCH ]; then fi # IDF commit to use -# IDF_COMMIT="d6ffee9234522d41ed8af891ea4970817c12452e" +IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="master" From 0f06b6d087fef7af1a56de0f8056323d73574357 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Feb 2023 17:01:56 +0100 Subject: [PATCH 021/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 34eba186f..1384cf110 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -14,7 +14,7 @@ if [ -z $IDF_BRANCH ]; then fi # IDF commit to use -IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" +# IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="master" From 92c9ed2b4e9156ebe5692165414e49e80bb4596d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 15 Feb 2023 16:23:22 +0100 Subject: [PATCH 022/636] Temp disable SR to fix build fail --- tools/update-components.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 5af413f49..294c9d625 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -78,18 +78,18 @@ if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-SR # -echo "Updating ESP-SR..." -if [ ! -d "$AR_COMPS/esp-sr" ]; then - git clone $SR_REPO_URL "$AR_COMPS/esp-sr" -else - git -C "$AR_COMPS/esp-sr" fetch && \ - git -C "$AR_COMPS/esp-sr" pull --ff-only -fi +#echo "Updating ESP-SR..." +#if [ ! -d "$AR_COMPS/esp-sr" ]; then +# git clone $SR_REPO_URL "$AR_COMPS/esp-sr" +#else +# git -C "$AR_COMPS/esp-sr" fetch && \ +# git -C "$AR_COMPS/esp-sr" pull --ff-only +#fi #this is a temp measure to fix build issue -if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then - rm -rf "$AR_COMPS/esp-sr/idf_component.yml" -fi -if [ $? -ne 0 ]; then exit 1; fi +#if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then +# rm -rf "$AR_COMPS/esp-sr/idf_component.yml" +#fi +#if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-DSP From 52eb6c3c7e775e35254d916f44a83e16771bf8cd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 15 Feb 2023 16:49:08 +0100 Subject: [PATCH 023/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 1384cf110..34eba186f 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -14,7 +14,7 @@ if [ -z $IDF_BRANCH ]; then fi # IDF commit to use -# IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" +IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="master" From 861366e80acad011a53be803b7a5b74c1480f0f0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 15 Feb 2023 17:02:49 +0100 Subject: [PATCH 024/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 34eba186f..f2aef1094 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -14,7 +14,7 @@ if [ -z $IDF_BRANCH ]; then fi # IDF commit to use -IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" +#IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="master" From 98c5321d56d159e690e5cae17272c4f34979b26a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 21 Feb 2023 18:38:41 +0100 Subject: [PATCH 025/636] Update update-components.sh --- tools/update-components.sh | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 294c9d625..c3051937a 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -78,28 +78,16 @@ if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-SR # -#echo "Updating ESP-SR..." -#if [ ! -d "$AR_COMPS/esp-sr" ]; then -# git clone $SR_REPO_URL "$AR_COMPS/esp-sr" -#else -# git -C "$AR_COMPS/esp-sr" fetch && \ -# git -C "$AR_COMPS/esp-sr" pull --ff-only -#fi -#this is a temp measure to fix build issue -#if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then -# rm -rf "$AR_COMPS/esp-sr/idf_component.yml" -#fi -#if [ $? -ne 0 ]; then exit 1; fi - -# -# CLONE/UPDATE ESP-DSP -# -echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/esp-dsp" ]; then - git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" +echo "Updating ESP-SR..." +if [ ! -d "$AR_COMPS/esp-sr" ]; then + git clone $SR_REPO_URL "$AR_COMPS/esp-sr" else - git -C "$AR_COMPS/esp-dsp" fetch && \ - git -C "$AR_COMPS/esp-dsp" pull --ff-only + git -C "$AR_COMPS/esp-sr" fetch && \ + git -C "$AR_COMPS/esp-sr" pull --ff-only +fi +#this is a temp measure to fix build issue +if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then + rm -rf "$AR_COMPS/esp-sr/idf_component.yml" fi if [ $? -ne 0 ]; then exit 1; fi @@ -117,6 +105,18 @@ else fi if [ $? -ne 0 ]; then exit 1; fi +# +# CLONE/UPDATE ESP-DSP +# +echo "Updating ESP-DSP..." +if [ ! -d "$AR_COMPS/espressif__esp-dsp" ]; then + git clone $DSP_REPO_URL "$AR_COMPS/espressif__esp-dsp" +else + git -C "$AR_COMPS/espressif__esp-dsp" fetch && \ + git -C "$AR_COMPS/espressif__esp-dsp" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi + # # CLONE/UPDATE TINYUSB # From cafcea037618a53dca758aac1700fd39a8ff2264 Mon Sep 17 00:00:00 2001 From: Sanket Wadekar <67091512+sanketwadekar@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:25:11 +0530 Subject: [PATCH 026/636] fix: rainmaker examples crashing on s3 due to low stack memory. (#106) (#107) --- configs/defconfig.esp32s3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 2437efd2e..54c3aa350 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -9,4 +9,5 @@ CONFIG_SR_WN_MODEL_WN8_QUANT=y CONFIG_SR_WN_WN8_HIESP=y CONFIG_SR_MN_ENGLISH=y CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y -CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y \ No newline at end of file +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 \ No newline at end of file From 71202f9fe4a7479a015b7fffae8a8bdb8aba7690 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 23 Feb 2023 11:29:26 +0100 Subject: [PATCH 027/636] Update update-components.sh --- tools/update-components.sh | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index c3051937a..294c9d625 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -78,16 +78,28 @@ if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-SR # -echo "Updating ESP-SR..." -if [ ! -d "$AR_COMPS/esp-sr" ]; then - git clone $SR_REPO_URL "$AR_COMPS/esp-sr" -else - git -C "$AR_COMPS/esp-sr" fetch && \ - git -C "$AR_COMPS/esp-sr" pull --ff-only -fi +#echo "Updating ESP-SR..." +#if [ ! -d "$AR_COMPS/esp-sr" ]; then +# git clone $SR_REPO_URL "$AR_COMPS/esp-sr" +#else +# git -C "$AR_COMPS/esp-sr" fetch && \ +# git -C "$AR_COMPS/esp-sr" pull --ff-only +#fi #this is a temp measure to fix build issue -if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then - rm -rf "$AR_COMPS/esp-sr/idf_component.yml" +#if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then +# rm -rf "$AR_COMPS/esp-sr/idf_component.yml" +#fi +#if [ $? -ne 0 ]; then exit 1; fi + +# +# CLONE/UPDATE ESP-DSP +# +echo "Updating ESP-DSP..." +if [ ! -d "$AR_COMPS/esp-dsp" ]; then + git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" +else + git -C "$AR_COMPS/esp-dsp" fetch && \ + git -C "$AR_COMPS/esp-dsp" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi @@ -105,18 +117,6 @@ else fi if [ $? -ne 0 ]; then exit 1; fi -# -# CLONE/UPDATE ESP-DSP -# -echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/espressif__esp-dsp" ]; then - git clone $DSP_REPO_URL "$AR_COMPS/espressif__esp-dsp" -else - git -C "$AR_COMPS/espressif__esp-dsp" fetch && \ - git -C "$AR_COMPS/espressif__esp-dsp" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi - # # CLONE/UPDATE TINYUSB # From 309aca148334506f9d86b4e101b17af382c4f990 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Mar 2023 13:04:25 +0100 Subject: [PATCH 028/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 60c73c3fa..84a709ab7 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -35,7 +35,7 @@ fi # # Arduino needs cam_hal.h from esp32-camera in include folder # - +# fix me, path is not correct cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/components/esp32-camera/driver/include/" # From 097836000a845484aac6c717ed4a2f093bbc404d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 Mar 2023 13:06:55 +0100 Subject: [PATCH 029/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 293608981..68e111aa7 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -12,7 +12,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.7' + python-version: '3.11' - name: Install dependencies run: bash ./tools/prepare-ci.sh - name: Build Arduino Libs From 55c332143ebbd817eeb63c5bccdd182487ee7cfe Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Tue, 14 Mar 2023 01:16:50 +0200 Subject: [PATCH 030/636] Update scripts with the latest requirements --- .gitignore | 2 +- configs/defconfig.esp32 | 1 - tools/copy-libs.sh | 45 +++++++++++++++----------------------- tools/copy-to-arduino.sh | 3 +-- tools/gen_tools_json.py | 2 +- tools/update-components.sh | 9 ++++---- 6 files changed, 26 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index 3128aa229..fe7dfec1c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ components/esp-sr/ components/esp32-camera/ components/esp_littlefs/ components/esp-rainmaker/ -components/esp-dsp/ +components/espressif__esp-dsp/ components/esp-insights/ components/arduino_tinyusb/tinyusb/ esp-idf/ diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 14a4f2c17..65bc3f0c3 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -11,7 +11,6 @@ CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y CONFIG_SPIRAM=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y CONFIG_ULP_COPROC_ENABLED=y -CONFIG_XTAL_FREQ_AUTO=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set CONFIG_FREERTOS_FPU_IN_ISR=y # CONFIG_USE_WAKENET is not set diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index af8e1b339..5aa0e9c14 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -350,8 +350,8 @@ echo " '-Wl,-Map=\"%s\"' % join(\"\${BUILD_DIR}\", \"\${PROGNAME}.map\")" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" -# # include dirs -AR_INC="" +# include dirs +REL_INC="" echo " CPPPATH=[" >> "$AR_PLATFORMIO_PY" set -- $INCLUDES @@ -378,7 +378,7 @@ for item; do out_sub="${item#*$ipath}" out_cpath="$AR_SDK/include/$fname$out_sub" - AR_INC+=" \"-I{compiler.sdk.path}/include/$fname$out_sub\"" + REL_INC+="-iwithprefixbefore $fname$out_sub " if [ "$out_sub" = "" ]; then echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"include\", \"$fname\")," >> "$AR_PLATFORMIO_PY" else @@ -451,34 +451,25 @@ for item; do fi done -# remove backslashes for Arduino -DEFINES=`echo "$DEFINES" | tr -d '\\'` - - # end generation of platformio-build.py cat 1pio_end.txt >> "$AR_PLATFORMIO_PY" rm 1pio_end.txt -# arduino platform.txt -platform_file="$AR_COMPS/arduino/platform.txt" -if [ -f "$AR_PLATFORM_TXT" ]; then - # use the file we have already compiled for other chips - platform_file="$AR_PLATFORM_TXT" -fi -awk "/compiler.cpreprocessor.flags.$IDF_TARGET=/{n++}{print>n\"platform_start.txt\"}" "$platform_file" -$SED -i "/compiler.cpreprocessor.flags.$IDF_TARGET\=/d" 1platform_start.txt -awk "/compiler.ar.flags.$IDF_TARGET=/{n++}{print>n\"platform_mid.txt\"}" 1platform_start.txt -rm -rf 1platform_start.txt - -cat platform_start.txt > "$AR_PLATFORM_TXT" -echo "compiler.cpreprocessor.flags.$IDF_TARGET=$DEFINES $AR_INC" >> "$AR_PLATFORM_TXT" -echo "compiler.c.elf.libs.$IDF_TARGET=$AR_LIBS" >> "$AR_PLATFORM_TXT" -echo "compiler.c.flags.$IDF_TARGET=$C_FLAGS -MMD -c" >> "$AR_PLATFORM_TXT" -echo "compiler.cpp.flags.$IDF_TARGET=$CPP_FLAGS -MMD -c" >> "$AR_PLATFORM_TXT" -echo "compiler.S.flags.$IDF_TARGET=$AS_FLAGS -x assembler-with-cpp -MMD -c" >> "$AR_PLATFORM_TXT" -echo "compiler.c.elf.flags.$IDF_TARGET=$LD_SCRIPTS $LD_FLAGS" >> "$AR_PLATFORM_TXT" -cat 1platform_mid.txt >> "$AR_PLATFORM_TXT" -rm -rf platform_start.txt platform_mid.txt 1platform_mid.txt +# replace double backslashes with single one +DEFINES=`echo "$DEFINES" | tr -s '\'` + +# target flags files +FLAGS_DIR="$AR_SDK/flags" +mkdir -p "$FLAGS_DIR" +echo -n "$DEFINES" > "$FLAGS_DIR/defines" +echo -n "$REL_INC" > "$FLAGS_DIR/includes" +echo -n "$C_FLAGS" > "$FLAGS_DIR/c_flags" +echo -n "$CPP_FLAGS" > "$FLAGS_DIR/cpp_flags" +echo -n "$AS_FLAGS" > "$FLAGS_DIR/S_flags" +echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags" +echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" +echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" + # sdkconfig cp -f "sdkconfig" "$AR_SDK/sdkconfig" diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh index ef8b9074c..5448c7bcb 100755 --- a/tools/copy-to-arduino.sh +++ b/tools/copy-to-arduino.sh @@ -16,9 +16,8 @@ fi echo "Installing new libraries to $ESP32_ARDUINO" -rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py $ESP32_ARDUINO/platform.txt +rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py -cp -f $AR_OUT/platform.txt $ESP32_ARDUINO/ cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json cp -Rf $AR_TOOLS/sdk $ESP32_ARDUINO/tools/ cp -f $AR_TOOLS/gen_esp32part.py $ESP32_ARDUINO/tools/ diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py index 98657ee71..2544c69b1 100644 --- a/tools/gen_tools_json.py +++ b/tools/gen_tools_json.py @@ -84,7 +84,7 @@ "url": tool_data['url'], "archiveFileName": os.path.basename(tool_data['url']), "checksum": "SHA-256:"+tool_data['sha256'], - "size": tool_data['size'] + "size": str(tool_data['size']) } if arch == "win32": diff --git a/tools/update-components.sh b/tools/update-components.sh index 56a2b685e..24240f112 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -47,6 +47,7 @@ if [ -z $AR_BRANCH ]; then fi if [ "$AR_BRANCH" ]; then + echo "AR_BRANCH='$AR_BRANCH'" git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \ git -C "$AR_COMPS/arduino" fetch && \ git -C "$AR_COMPS/arduino" pull --ff-only @@ -97,11 +98,11 @@ if [ $? -ne 0 ]; then exit 1; fi # CLONE/UPDATE ESP-DSP # echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/esp-dsp" ]; then - git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" +if [ ! -d "$AR_COMPS/espressif__esp-dsp" ]; then + git clone $DSP_REPO_URL "$AR_COMPS/espressif__esp-dsp" else - git -C "$AR_COMPS/esp-dsp" fetch && \ - git -C "$AR_COMPS/esp-dsp" pull --ff-only + git -C "$AR_COMPS/espressif__esp-dsp" fetch && \ + git -C "$AR_COMPS/espressif__esp-dsp" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi From 3ab7b45d65ce88756b38f37bc64796da43c85e76 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Mar 2023 18:14:55 +0100 Subject: [PATCH 031/636] Update defconfig.esp32 --- configs/defconfig.esp32 | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index a7003718c..1a6da10f2 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -12,7 +12,6 @@ CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y CONFIG_SPIRAM=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y CONFIG_ULP_COPROC_ENABLED=y -CONFIG_XTAL_FREQ_AUTO=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set CONFIG_FREERTOS_FPU_IN_ISR=y # CONFIG_UNITY_ENABLE_FLOAT is not set From a01cffd25198ba6a822cce0b09b81d22f8bcce2d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Mar 2023 18:19:24 +0100 Subject: [PATCH 032/636] Update copy-libs.sh --- tools/copy-libs.sh | 47 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 85ed296e5..5aa0e9c14 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -350,8 +350,8 @@ echo " '-Wl,-Map=\"%s\"' % join(\"\${BUILD_DIR}\", \"\${PROGNAME}.map\")" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" -# # include dirs -AR_INC="" +# include dirs +REL_INC="" echo " CPPPATH=[" >> "$AR_PLATFORMIO_PY" set -- $INCLUDES @@ -361,7 +361,7 @@ for item; do ipath="$item" fname=`basename "$ipath"` dname=`basename $(dirname "$ipath")` - if [[ "$fname" == "main" && "$dname" == $(basename "$PWD") ]]; then + if [[ "$fname" == "main" && "$dname" == "esp32-arduino-lib-builder" ]]; then continue fi while [[ "$dname" != "components" && "$dname" != "managed_components" && "$dname" != "build" ]]; do @@ -378,7 +378,7 @@ for item; do out_sub="${item#*$ipath}" out_cpath="$AR_SDK/include/$fname$out_sub" - AR_INC+=" \"-I{compiler.sdk.path}/include/$fname$out_sub\"" + REL_INC+="-iwithprefixbefore $fname$out_sub " if [ "$out_sub" = "" ]; then echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"include\", \"$fname\")," >> "$AR_PLATFORMIO_PY" else @@ -451,34 +451,25 @@ for item; do fi done -# remove backslashes for Arduino -DEFINES=`echo "$DEFINES" | tr -d '\\'` - - # end generation of platformio-build.py cat 1pio_end.txt >> "$AR_PLATFORMIO_PY" rm 1pio_end.txt -# arduino platform.txt -platform_file="$AR_COMPS/arduino/platform.txt" -if [ -f "$AR_PLATFORM_TXT" ]; then - # use the file we have already compiled for other chips - platform_file="$AR_PLATFORM_TXT" -fi -awk "/compiler.cpreprocessor.flags.$IDF_TARGET=/{n++}{print>n\"platform_start.txt\"}" "$platform_file" -$SED -i "/compiler.cpreprocessor.flags.$IDF_TARGET\=/d" 1platform_start.txt -awk "/compiler.ar.flags.$IDF_TARGET=/{n++}{print>n\"platform_mid.txt\"}" 1platform_start.txt -rm -rf 1platform_start.txt - -cat platform_start.txt > "$AR_PLATFORM_TXT" -echo "compiler.cpreprocessor.flags.$IDF_TARGET=$DEFINES $AR_INC" >> "$AR_PLATFORM_TXT" -echo "compiler.c.elf.libs.$IDF_TARGET=$AR_LIBS" >> "$AR_PLATFORM_TXT" -echo "compiler.c.flags.$IDF_TARGET=$C_FLAGS -MMD -c" >> "$AR_PLATFORM_TXT" -echo "compiler.cpp.flags.$IDF_TARGET=$CPP_FLAGS -MMD -c" >> "$AR_PLATFORM_TXT" -echo "compiler.S.flags.$IDF_TARGET=$AS_FLAGS -x assembler-with-cpp -MMD -c" >> "$AR_PLATFORM_TXT" -echo "compiler.c.elf.flags.$IDF_TARGET=$LD_SCRIPTS $LD_FLAGS" >> "$AR_PLATFORM_TXT" -cat 1platform_mid.txt >> "$AR_PLATFORM_TXT" -rm -rf platform_start.txt platform_mid.txt 1platform_mid.txt +# replace double backslashes with single one +DEFINES=`echo "$DEFINES" | tr -s '\'` + +# target flags files +FLAGS_DIR="$AR_SDK/flags" +mkdir -p "$FLAGS_DIR" +echo -n "$DEFINES" > "$FLAGS_DIR/defines" +echo -n "$REL_INC" > "$FLAGS_DIR/includes" +echo -n "$C_FLAGS" > "$FLAGS_DIR/c_flags" +echo -n "$CPP_FLAGS" > "$FLAGS_DIR/cpp_flags" +echo -n "$AS_FLAGS" > "$FLAGS_DIR/S_flags" +echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags" +echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" +echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" + # sdkconfig cp -f "sdkconfig" "$AR_SDK/sdkconfig" From f9918d072fe5f181bd81f4d41918245558b2f6a5 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Mar 2023 18:21:06 +0100 Subject: [PATCH 033/636] Update gen_tools_json.py --- tools/gen_tools_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py index 98657ee71..2544c69b1 100644 --- a/tools/gen_tools_json.py +++ b/tools/gen_tools_json.py @@ -84,7 +84,7 @@ "url": tool_data['url'], "archiveFileName": os.path.basename(tool_data['url']), "checksum": "SHA-256:"+tool_data['sha256'], - "size": tool_data['size'] + "size": str(tool_data['size']) } if arch == "win32": From 75e70c1e991c481adf0738f34332c35de6f27a71 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Mar 2023 18:24:47 +0100 Subject: [PATCH 034/636] Update update-components.sh --- tools/update-components.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 294c9d625..4a04760dc 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -45,6 +45,7 @@ if [ -z $AR_BRANCH ]; then fi if [ "$AR_BRANCH" ]; then + echo "AR_BRANCH='$AR_BRANCH'" git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \ git -C "$AR_COMPS/arduino" fetch && \ git -C "$AR_COMPS/arduino" pull --ff-only @@ -95,11 +96,11 @@ if [ $? -ne 0 ]; then exit 1; fi # CLONE/UPDATE ESP-DSP # echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/esp-dsp" ]; then - git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" +if [ ! -d "$AR_COMPS/espressif__esp-dsp" ]; then + git clone $DSP_REPO_URL "$AR_COMPS/espressif__esp-dsp" else - git -C "$AR_COMPS/esp-dsp" fetch && \ - git -C "$AR_COMPS/esp-dsp" pull --ff-only + git -C "$AR_COMPS/espressif__esp-dsp" fetch && \ + git -C "$AR_COMPS/espressif__esp-dsp" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi From 13fdb2d5246e8b8d0dd77716b3af74df94ce9b2d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Mar 2023 18:26:49 +0100 Subject: [PATCH 035/636] Update copy-to-arduino.sh --- tools/copy-to-arduino.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh index ef8b9074c..5448c7bcb 100755 --- a/tools/copy-to-arduino.sh +++ b/tools/copy-to-arduino.sh @@ -16,9 +16,8 @@ fi echo "Installing new libraries to $ESP32_ARDUINO" -rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py $ESP32_ARDUINO/platform.txt +rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py -cp -f $AR_OUT/platform.txt $ESP32_ARDUINO/ cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json cp -Rf $AR_TOOLS/sdk $ESP32_ARDUINO/tools/ cp -f $AR_TOOLS/gen_esp32part.py $ESP32_ARDUINO/tools/ From aea70226bb835eaf56e811251d4cec0a9cff7c50 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Mar 2023 18:27:40 +0100 Subject: [PATCH 036/636] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3128aa229..fe7dfec1c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ components/esp-sr/ components/esp32-camera/ components/esp_littlefs/ components/esp-rainmaker/ -components/esp-dsp/ +components/espressif__esp-dsp/ components/esp-insights/ components/arduino_tinyusb/tinyusb/ esp-idf/ From 7efbdca1b43948754398731b25a50b0b2604b073 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Mar 2023 18:36:14 +0100 Subject: [PATCH 037/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 68e111aa7..2b6b8848a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -12,7 +12,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.10' - name: Install dependencies run: bash ./tools/prepare-ci.sh - name: Build Arduino Libs From d9fc73366f05401045c959b4efae7d3ac155122e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Mar 2023 19:00:51 +0100 Subject: [PATCH 038/636] Update idf_component.yml --- main/idf_component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index fb266a7af..7913f36aa 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -2,7 +2,7 @@ dependencies: # Required IDF version idf: ">=5.1" - mdns: "^1.0.7" + mdns: "^1.0.8" # nghttp: "^1.50.0" # esp_jpeg: "^1.0.4" # esp-dsp: "^1.2.0" From bd08fe3726b582b113492b98a9f2de80bbe4bc0b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 16 Mar 2023 11:08:04 +0100 Subject: [PATCH 039/636] Update update-components.sh --- tools/update-components.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 4a04760dc..06a335007 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -67,14 +67,14 @@ if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-DL # -echo "Updating ESP-DL..." -if [ ! -d "$AR_COMPS/esp-dl" ]; then - git clone $DL_REPO_URL "$AR_COMPS/esp-dl" -else - git -C "$AR_COMPS/esp-dl" fetch && \ - git -C "$AR_COMPS/esp-dl" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi +#echo "Updating ESP-DL..." +#if [ ! -d "$AR_COMPS/esp-dl" ]; then +# git clone $DL_REPO_URL "$AR_COMPS/esp-dl" +#else +# git -C "$AR_COMPS/esp-dl" fetch && \ +# git -C "$AR_COMPS/esp-dl" pull --ff-only +#fi +#if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-SR From a0b4123f4c3201d161f461697687c6a39a349d96 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 16 Mar 2023 11:27:52 +0100 Subject: [PATCH 040/636] Update idf_component.yml --- main/idf_component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index 7913f36aa..fb266a7af 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -2,7 +2,7 @@ dependencies: # Required IDF version idf: ">=5.1" - mdns: "^1.0.8" + mdns: "^1.0.7" # nghttp: "^1.50.0" # esp_jpeg: "^1.0.4" # esp-dsp: "^1.2.0" From f04d50ade08c599e5b6f6f50b25257043f4e2f08 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 21 Mar 2023 18:21:09 +0100 Subject: [PATCH 041/636] IDF_BRANCH="release/v5.1" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index f2aef1094..f7b61e1c6 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -10,7 +10,7 @@ IDF_REPO_URL="https://github.com/tasmota/esp-idf.git" # The IDF branch to use if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="Tasmota/v5" + IDF_BRANCH="release/v5.1" fi # IDF commit to use From 8a93aaa45831fbd46b34f91f79b351646b184b6d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 22 Mar 2023 12:29:12 +0100 Subject: [PATCH 042/636] IDF_BRANCH="master" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index f7b61e1c6..7db3eaf9e 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -10,7 +10,7 @@ IDF_REPO_URL="https://github.com/tasmota/esp-idf.git" # The IDF branch to use if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v5.1" + IDF_BRANCH="master" fi # IDF commit to use From 4d7efdf8ed44d6813048d8e09675f6850925c976 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 25 Mar 2023 10:31:04 +0100 Subject: [PATCH 043/636] rm BLUFI --- configs/defconfig.esp32c3 | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 8b2ecbb8a..76f6b98d2 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -1,5 +1,4 @@ CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y -CONFIG_BT_BLE_BLUFI_ENABLE=y CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y From 47ea807e35b677263378fccf9856fad5c5f2ead0 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Fri, 7 Apr 2023 16:58:47 +0300 Subject: [PATCH 044/636] Update configs + SR Support --- .gitignore | 1 + CMakeLists.txt | 2 +- build.sh | 4 +- configs/builds.json | 8 +++- configs/defconfig.common | 14 +++---- configs/defconfig.esp32s3 | 4 -- configs/defconfig.esp_sr | 37 +++++++++++++++++ configs/pio_end.txt | 10 +++++ configs/pio_start.txt | 35 ++++++++++++++++ partitions.csv | 8 ++++ tools/config.sh | 4 +- tools/copy-libs.sh | 37 ++++++++++------- tools/copy-to-arduino.sh | 7 ++-- tools/gen_tools_json.py | 84 ++++++++++++++++++++++++++------------- 14 files changed, 193 insertions(+), 62 deletions(-) create mode 100644 configs/defconfig.esp_sr create mode 100644 configs/pio_end.txt create mode 100644 configs/pio_start.txt create mode 100644 partitions.csv diff --git a/.gitignore b/.gitignore index fe7dfec1c..d38c0423d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ sdkconfig.old version.txt dependencies.lock managed_components/ +target/ diff --git a/CMakeLists.txt b/CMakeLists.txt index a3be4c620..c562bf23f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ idf_build_get_property(elf EXECUTABLE GENERATOR_EXPRESSION) add_custom_command( OUTPUT "idf_libs" COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-libs.sh ${IDF_TARGET} "${CONFIG_LIB_BUILDER_FLASHMODE}" "${CONFIG_SPIRAM_MODE_OCT}" "${CONFIG_IDF_TARGET_ARCH_XTENSA}" - DEPENDS ${elf} + DEPENDS all WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} VERBATIM ) diff --git a/build.sh b/build.sh index 3a3cbadfa..4dc1d0a70 100755 --- a/build.sh +++ b/build.sh @@ -122,9 +122,6 @@ if [ "$BUILD_TYPE" != "all" ]; then fi rm -rf build sdkconfig out -echo "* Reconfigure Project" -idf.py reconfigure -rm -rf build sdkconfig # Add components version info mkdir -p "$AR_TOOLS/sdk" && rm -rf version.txt && rm -rf "$AR_TOOLS/sdk/versions.txt" @@ -194,6 +191,7 @@ done # update package_esp32_index.template.json if [ "$BUILD_TYPE" = "all" ]; then python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" + python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -o "$TOOLS_JSON_OUT/" if [ $? -ne 0 ]; then exit 1; fi fi diff --git a/configs/builds.json b/configs/builds.json index c32e465e4..3a5dd67c9 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -6,6 +6,12 @@ "out":"lib/libspi_flash.a", "targets":["esp32","esp32c3","esp32s2","esp32s3"] }, + { + "file":"libesp_psram.a", + "src":"build/esp-idf/esp_psram/libesp_psram.a", + "out":"lib/libesp_psram.a", + "targets":["esp32s3"] + }, { "file":"libesp_system.a", "src":"build/esp-idf/esp_system/libesp_system.a", @@ -40,7 +46,7 @@ "targets":[ { "target": "esp32s3", - "features":[], + "features":["esp_sr"], "idf_libs":["qio","80m","qio_ram"], "bootloaders":[ ["qio","120m","qio_ram"], diff --git a/configs/defconfig.common b/configs/defconfig.common index fb9e2db86..34727c842 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -21,13 +21,13 @@ CONFIG_ESP_TASK_WDT_PANIC=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_WIFI_FTM_ENABLE=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 -CONFIG_ESP32_WIFI_CSI_ENABLED=y -CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y -# CONFIG_ESP32_WIFI_IRAM_OPT is not set -# CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_CSI_ENABLED=y +CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y +# CONFIG_ESP_WIFI_IRAM_OPT is not set +# CONFIG_ESP_WIFI_RX_IRAM_OPT is not set CONFIG_ETH_SPI_ETHERNET_DM9051=y CONFIG_ETH_SPI_ETHERNET_W5500=y CONFIG_FATFS_CODEPAGE_850=y diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 54c3aa350..f3a2412ce 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -5,9 +5,5 @@ CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set -CONFIG_SR_WN_MODEL_WN8_QUANT=y -CONFIG_SR_WN_WN8_HIESP=y -CONFIG_SR_MN_ENGLISH=y -CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 \ No newline at end of file diff --git a/configs/defconfig.esp_sr b/configs/defconfig.esp_sr new file mode 100644 index 000000000..03b7c462e --- /dev/null +++ b/configs/defconfig.esp_sr @@ -0,0 +1,37 @@ +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_SR_WN_WN9_HIESP=y +CONFIG_SR_MN_CN_NONE=y +CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y +CONFIG_EN_SPEECH_COMMAND_ID0="" +CONFIG_EN_SPEECH_COMMAND_ID1="" +CONFIG_EN_SPEECH_COMMAND_ID2="" +CONFIG_EN_SPEECH_COMMAND_ID3="" +CONFIG_EN_SPEECH_COMMAND_ID4="" +CONFIG_EN_SPEECH_COMMAND_ID5="" +CONFIG_EN_SPEECH_COMMAND_ID6="" +CONFIG_EN_SPEECH_COMMAND_ID7="" +CONFIG_EN_SPEECH_COMMAND_ID8="" +CONFIG_EN_SPEECH_COMMAND_ID9="" +CONFIG_EN_SPEECH_COMMAND_ID10="" +CONFIG_EN_SPEECH_COMMAND_ID11="" +CONFIG_EN_SPEECH_COMMAND_ID12="" +CONFIG_EN_SPEECH_COMMAND_ID13="" +CONFIG_EN_SPEECH_COMMAND_ID14="" +CONFIG_EN_SPEECH_COMMAND_ID15="" +CONFIG_EN_SPEECH_COMMAND_ID16="" +CONFIG_EN_SPEECH_COMMAND_ID17="" +CONFIG_EN_SPEECH_COMMAND_ID18="" +CONFIG_EN_SPEECH_COMMAND_ID19="" +CONFIG_EN_SPEECH_COMMAND_ID20="" +CONFIG_EN_SPEECH_COMMAND_ID21="" +CONFIG_EN_SPEECH_COMMAND_ID22="" +CONFIG_EN_SPEECH_COMMAND_ID23="" +CONFIG_EN_SPEECH_COMMAND_ID24="" +CONFIG_EN_SPEECH_COMMAND_ID25="" +CONFIG_EN_SPEECH_COMMAND_ID26="" +CONFIG_EN_SPEECH_COMMAND_ID27="" +CONFIG_EN_SPEECH_COMMAND_ID28="" +CONFIG_EN_SPEECH_COMMAND_ID29="" +CONFIG_EN_SPEECH_COMMAND_ID30="" +CONFIG_EN_SPEECH_COMMAND_ID31="" diff --git a/configs/pio_end.txt b/configs/pio_end.txt new file mode 100644 index 000000000..3190217a1 --- /dev/null +++ b/configs/pio_end.txt @@ -0,0 +1,10 @@ + "ARDUINO_ARCH_ESP32", + "ESP32", + ("F_CPU", "$BOARD_F_CPU"), + ("ARDUINO", 10812), + ("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")), + ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")), + "ARDUINO_PARTITION_%s" % basename(env.BoardConfig().get( + "build.partitions", "default.csv")).replace(".csv", "").replace("-", "_") + ] +) diff --git a/configs/pio_start.txt b/configs/pio_start.txt new file mode 100644 index 000000000..010ba60aa --- /dev/null +++ b/configs/pio_start.txt @@ -0,0 +1,35 @@ +# Copyright 2014-present PlatformIO <contact@platformio.org> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Arduino + +Arduino Wiring-based Framework allows writing cross-platform software to +control devices attached to a wide range of Arduino boards to create all +kinds of creative coding, interactive objects, spaces or physical experiences. + +http://arduino.cc/en/Reference/HomePage +""" + +# Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py + +from os.path import basename, join + +from SCons.Script import DefaultEnvironment + +env = DefaultEnvironment() + +FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoespressif32") + +env.Append( diff --git a/partitions.csv b/partitions.csv new file mode 100644 index 000000000..3cf7a7587 --- /dev/null +++ b/partitions.csv @@ -0,0 +1,8 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x300000, +app1, app, ota_1, 0x310000, 0x300000, +spiffs, data, spiffs, 0x610000, 0x5E0000, +model, data, spiffs, 0xBF0000, 0x400000, +coredump, data, coredump,0xFF0000, 0x10000, diff --git a/tools/config.sh b/tools/config.sh index 4216e0b1f..cba97ff0a 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="master" + IDF_BRANCH="release/v5.1" fi if [ -z $AR_PR_TARGET_BRANCH ]; then @@ -42,6 +42,8 @@ AR_TOOLS="$AR_OUT/tools" AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" +PIO_SDK="FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\"" +TOOLS_JSON_OUT="$AR_TOOLS/sdk" function get_os(){ OSBITS=`arch` diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 5aa0e9c14..d3269649c 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -30,9 +30,15 @@ fi if [ -e "$AR_SDK/include" ]; then rm -rf "$AR_SDK/include" fi +if [ -e "$AR_SDK/flags" ]; then + rm -rf "$AR_SDK/flags" +fi if [ -e "$AR_SDK/$MEMCONF" ]; then rm -rf "$AR_SDK/$MEMCONF" fi +if [ -e "$AR_SDK/platformio-build.py" ]; then + rm -rf "$AR_SDK/platformio-build.py" +fi mkdir -p "$AR_SDK" function get_actual_path(){ @@ -273,13 +279,11 @@ done # END OF DATA EXTRACTION FROM CMAKE # -AR_PLATFORMIO_PY="$AR_TOOLS/platformio-build-$IDF_TARGET.py" +mkdir -p "$AR_SDK" # start generation of platformio-build.py -awk "/ASFLAGS=\[/{n++}{print>n\"pio_start.txt\"}" $AR_COMPS/arduino/tools/platformio-build-$IDF_TARGET.py -awk "/\"ARDUINO_ARCH_ESP32\"/{n++}{print>n\"pio_end.txt\"}" 1pio_start.txt -cat pio_start.txt > "$AR_PLATFORMIO_PY" -rm pio_end.txt 1pio_start.txt pio_start.txt +AR_PLATFORMIO_PY="$AR_SDK/platformio-build.py" +cat configs/pio_start.txt > "$AR_PLATFORMIO_PY" echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY" if [ "$IS_XTENSA" = "y" ]; then @@ -380,11 +384,11 @@ for item; do out_cpath="$AR_SDK/include/$fname$out_sub" REL_INC+="-iwithprefixbefore $fname$out_sub " if [ "$out_sub" = "" ]; then - echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"include\", \"$fname\")," >> "$AR_PLATFORMIO_PY" + echo " join($PIO_SDK, \"include\", \"$fname\")," >> "$AR_PLATFORMIO_PY" else pio_sub="${out_sub:1}" pio_sub=`echo $pio_sub | sed 's/\//\\", \\"/g'` - echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"include\", \"$fname\", \"$pio_sub\")," >> "$AR_PLATFORMIO_PY" + echo " join($PIO_SDK, \"include\", \"$fname\", \"$pio_sub\")," >> "$AR_PLATFORMIO_PY" fi for f in `find "$item" -name '*.h'`; do rel_f=${f#*$item} @@ -400,7 +404,7 @@ for item; do done fi done -echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")), \"include\")," >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")), \"include\")," >> "$AR_PLATFORMIO_PY" echo " join(FRAMEWORK_DIR, \"cores\", env.BoardConfig().get(\"build.core\"))" >> "$AR_PLATFORMIO_PY" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" @@ -423,9 +427,9 @@ for item; do done echo " LIBPATH=[" >> "$AR_PLATFORMIO_PY" -echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"lib\")," >> "$AR_PLATFORMIO_PY" -echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"ld\")," >> "$AR_PLATFORMIO_PY" -echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")))" >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, \"lib\")," >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, \"ld\")," >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")))" >> "$AR_PLATFORMIO_PY" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" @@ -452,8 +456,7 @@ for item; do done # end generation of platformio-build.py -cat 1pio_end.txt >> "$AR_PLATFORMIO_PY" -rm 1pio_end.txt +cat configs/pio_end.txt >> "$AR_PLATFORMIO_PY" # replace double backslashes with single one DEFINES=`echo "$DEFINES" | tr -s '\'` @@ -470,12 +473,18 @@ echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags" echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" +# sr model.bin +if [ -f "build/model.bin" ]; then + mkdir -p "$AR_SDK/esp_sr" + cp -f "build/model.bin" "$AR_SDK/esp_sr/" + cp -f "partitions.csv" "$AR_SDK/esp_sr/" +fi # sdkconfig cp -f "sdkconfig" "$AR_SDK/sdkconfig" # gen_esp32part.py -cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" +# cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" # copy precompiled libs (if we need them) function copy_precompiled_lib(){ diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh index 5448c7bcb..2ed90fa9b 100755 --- a/tools/copy-to-arduino.sh +++ b/tools/copy-to-arduino.sh @@ -16,9 +16,8 @@ fi echo "Installing new libraries to $ESP32_ARDUINO" -rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py - +rm -rf $ESP32_ARDUINO/package/package_esp32_index.template.json && \ cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json + +rm -rf $ESP32_ARDUINO/tools/sdk && \ cp -Rf $AR_TOOLS/sdk $ESP32_ARDUINO/tools/ -cp -f $AR_TOOLS/gen_esp32part.py $ESP32_ARDUINO/tools/ -cp -f $AR_TOOLS/platformio-build-*.py $ESP32_ARDUINO/tools/ diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py index 2544c69b1..92fa6f74e 100644 --- a/tools/gen_tools_json.py +++ b/tools/gen_tools_json.py @@ -25,10 +25,17 @@ prog = 'gen_tools_json', description = 'Update Arduino package index with the tolls found in ESP-IDF') parser.add_argument('-i', '--esp-idf', dest='idf_path', required=True, help='Path to ESP-IDF') - parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=True, help='path to Arduino package json') + parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=False, help='path to Arduino package json') parser.add_argument('-o', '--out-path', dest='out_path', required=True, help='Output path to store the update package json') args = parser.parse_args() + simple_output = False + if args.arduino_json == None: + print('Source was not selected') + simple_output = True + else: + print('Source {0}.'.format(args.arduino_json)) + idf_path = args.idf_path; arduino_json = args.arduino_json; out_path = args.out_path; @@ -37,7 +44,9 @@ arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","riscv32-esp-elf","openocd-esp32"] # code start - farray = json.load(open(arduino_json)) + farray = {"packages":[{"platforms":[{"toolsDependencies":[]}],"tools":[]}]} + if simple_output == False: + farray = json.load(open(arduino_json)) idf_tools = json.load(open(idf_path + '/tools/tools.json')) for tool in idf_tools['tools']: @@ -51,21 +60,30 @@ tool_name += '-gcc' print('Found {0}, version: {1}'.format(tool_name, tool_version)) - dep_found = False - dep_skip = False - for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: - if dep['name'] == tool_name: - if dep['version'] == tool_version: - print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) - dep_skip = True - break - print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) - dep['version'] = tool_version - dep_found = True - if dep_skip == True: - continue - if dep_found == False: - print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) + if simple_output == False: + dep_found = False + dep_skip = False + for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: + if dep['name'] == tool_name: + if dep['version'] == tool_version: + print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) + dep_skip = True + break + print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) + dep['version'] = tool_version + dep_found = True + if dep_skip == True: + continue + if dep_found == False: + print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) + deps = { + "packager": "esp32", + "name": tool_name, + "version": tool_version + } + farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) + else: + print('Adding dependency: {0} version {1}'.format(tool_name, tool_version)) deps = { "packager": "esp32", "name": tool_name, @@ -111,15 +129,24 @@ systems.append(system) - tool_found = False - for t in farray['packages'][0]['tools']: - if t['name'] == tool_name: - t['version'] = tool_version - t['systems'] = systems - tool_found = True - print('Updating binaries of {0} to version {1}'.format(tool_name, tool_version)) - if tool_found == False: - print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) + if simple_output == False: + tool_found = False + for t in farray['packages'][0]['tools']: + if t['name'] == tool_name: + t['version'] = tool_version + t['systems'] = systems + tool_found = True + print('Updating binaries of {0} to version {1}'.format(tool_name, tool_version)) + if tool_found == False: + print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) + tools = { + "name": tool_name, + "version": tool_version, + "systems": systems + } + farray['packages'][0]['tools'].append(tools) + else: + print('Adding tool: {0} version {1}'.format(tool_name, tool_version)) tools = { "name": tool_name, "version": tool_version, @@ -128,7 +155,10 @@ farray['packages'][0]['tools'].append(tools) json_str = json.dumps(farray, indent=2) - out_file = out_path + os.path.basename(arduino_json) + out_file = out_path + "tools.json" + if simple_output == False: + out_file = out_path + os.path.basename(arduino_json) + with open(out_file, "w") as f: f.write(json_str+"\n") f.close() From 5ff8be8534f05f5b95021f7c7a9e35e720a64ef0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 7 Apr 2023 22:22:38 +0200 Subject: [PATCH 045/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 7db3eaf9e..f7b61e1c6 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -10,7 +10,7 @@ IDF_REPO_URL="https://github.com/tasmota/esp-idf.git" # The IDF branch to use if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="master" + IDF_BRANCH="release/v5.1" fi # IDF commit to use From 725f9c3c6aaf7c35c68d3ffd37aae4c707384a4a Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Sat, 8 Apr 2023 03:10:23 +0300 Subject: [PATCH 046/636] Add esp-elf-gdp to the list of packages --- tools/gen_tools_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py index 92fa6f74e..ca53ec8cb 100644 --- a/tools/gen_tools_json.py +++ b/tools/gen_tools_json.py @@ -41,7 +41,7 @@ out_path = args.out_path; # settings - arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","riscv32-esp-elf","openocd-esp32"] + arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","xtensa-esp-elf-gdb","riscv32-esp-elf","riscv32-esp-elf-gdb","openocd-esp32"] # code start farray = {"packages":[{"platforms":[{"toolsDependencies":[]}],"tools":[]}]} From 01a9e3984360f44087f599c5df8168bbe69d83aa Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Mon, 10 Apr 2023 17:27:18 +0300 Subject: [PATCH 047/636] Fix RainMaker builds and new sr models path --- CMakeLists.txt | 3 ++- tools/copy-libs.sh | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c562bf23f..5cc989c62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,8 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(EXTRA_COMPONENT_DIRS ${CMAKE_SOURCE_DIR}/components/esp-rainmaker/components ${CMAKE_SOURCE_DIR}/components/esp-insights/components) +set(RMAKER_PATH ${CMAKE_SOURCE_DIR}/components/esp-rainmaker) +set(EXTRA_COMPONENT_DIRS ${RMAKER_PATH}/components/esp-insights/components ${RMAKER_PATH}/components ${CMAKE_SOURCE_DIR}/components/esp-insights/components) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(arduino-lib-builder) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index d3269649c..32992d624 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -84,7 +84,7 @@ for item in "${@:2:${#@}-5}"; do item=`get_actual_path $item` INCLUDES+="$item " elif [ "${item:0:2}" = ".." ]; then - if [[ "${item:0:14}" = "../components/" && "${item:0:22}" != "../components/arduino/" ]] || [[ "${item:0:11}" = "../esp-idf/" ]]; then + if [[ "${item:0:14}" = "../components/" && "${item:0:22}" != "../components/arduino/" ]] || [[ "${item:0:11}" = "../esp-idf/" ]] || [[ "${item:0:22}" = "../managed_components/" ]]; then item="$PWD${item:2}" item=`get_actual_path $item` INCLUDES+="$item " @@ -474,9 +474,9 @@ echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" # sr model.bin -if [ -f "build/model.bin" ]; then +if [ -f "build/srmodels/srmodels.bin" ]; then mkdir -p "$AR_SDK/esp_sr" - cp -f "build/model.bin" "$AR_SDK/esp_sr/" + cp -f "build/srmodels/srmodels.bin" "$AR_SDK/esp_sr/" cp -f "partitions.csv" "$AR_SDK/esp_sr/" fi From 32acbb776c1b8b9c8c8c4e42924c657d6b6cd1c0 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Tue, 11 Apr 2023 00:50:31 +0300 Subject: [PATCH 048/636] Temporary force arduino branch for CI to work --- tools/update-components.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 24240f112..ac7e40253 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -26,7 +26,10 @@ if [ -z $AR_BRANCH ]; then current_branch="$GITHUB_HEAD_REF" fi echo "Current Branch: $current_branch" - if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then + # Temporary to get CI working + if [[ "$current_branch" == "esp-idf-v5.1" ]]; then + export AR_BRANCH="esp-idf-v5.1-libs" + elif [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then export AR_BRANCH="$current_branch" else if [ -z "$IDF_COMMIT" ]; then #commit was not specified at build time From 248e8e8e84846e1b44c8f87d44ad12124f1eb0a1 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Tue, 11 Apr 2023 00:59:30 +0300 Subject: [PATCH 049/636] fix target branch --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 8f6686f8e..cba97ff0a 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -10,7 +10,7 @@ if [ -z $IDF_BRANCH ]; then fi if [ -z $AR_PR_TARGET_BRANCH ]; then - AR_PR_TARGET_BRANCH="release/v2.x" + AR_PR_TARGET_BRANCH="master" fi if [ -z $IDF_TARGET ]; then From 362fbfb41433486f6e72daf4354dfb80289c04ed Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Tue, 11 Apr 2023 01:07:13 +0300 Subject: [PATCH 050/636] Delete esp-dl component manifest for requiring IDF 4.4.x --- tools/update-components.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index ac7e40253..4111dd489 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -80,6 +80,10 @@ else git -C "$AR_COMPS/esp-dl" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi +#this is a temp measure to fix build issue +if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then + rm -rf "$AR_COMPS/esp-dl/idf_component.yml" +fi # # CLONE/UPDATE ESP-SR @@ -91,10 +95,6 @@ else git -C "$AR_COMPS/esp-sr" fetch && \ git -C "$AR_COMPS/esp-sr" pull --ff-only fi -#this is a temp measure to fix build issue -if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then - rm -rf "$AR_COMPS/esp-sr/idf_component.yml" -fi if [ $? -ne 0 ]; then exit 1; fi # From 4db7ea72512fb76f14e8fb3efe7d56b9b8965d33 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Tue, 11 Apr 2023 01:41:12 +0300 Subject: [PATCH 051/636] Temporary changes to allow Cron CI to run --- tools/config.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index cba97ff0a..294d8f078 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -10,7 +10,8 @@ if [ -z $IDF_BRANCH ]; then fi if [ -z $AR_PR_TARGET_BRANCH ]; then - AR_PR_TARGET_BRANCH="master" + # Temporary to get CI working. original is master + AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" fi if [ -z $IDF_TARGET ]; then From 3b1b774c954b1560a615607004f7b2b9e48c561a Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Tue, 11 Apr 2023 15:57:55 +0300 Subject: [PATCH 052/636] Support builds based on ESP-IDF tag --- tools/install-esp-idf.sh | 5 ++++- tools/repository_dispatch.sh | 5 ++++- tools/update-components.sh | 13 ++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 2b7a0f5fb..6f7442d5f 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -18,7 +18,10 @@ if [ ! -d "$IDF_PATH" ]; then idf_was_installed="1" fi -if [ "$IDF_COMMIT" ]; then +if [ "$IDF_TAG" ]; then + git -C "$IDF_PATH" checkout "tags/$IDF_TAG" + idf_was_installed="1" +elif [ "$IDF_COMMIT" ]; then git -C "$IDF_PATH" checkout "$IDF_COMMIT" commit_predefined="1" fi diff --git a/tools/repository_dispatch.sh b/tools/repository_dispatch.sh index a920f5b45..8b2d1b888 100644 --- a/tools/repository_dispatch.sh +++ b/tools/repository_dispatch.sh @@ -9,11 +9,12 @@ EVENT_JSON=`cat "$GITHUB_EVENT_PATH"` action=`echo "$EVENT_JSON" | jq -r '.action'` payload=`echo "$EVENT_JSON" | jq -r '.client_payload'` branch=`echo "$payload" | jq -r '.branch'` +tag=`echo "$payload" | jq -r '.tag'` commit=`echo "$payload" | jq -r '.commit'` builder=`echo "$payload" | jq -r '.builder'` arduino=`echo "$payload" | jq -r '.arduino'` -echo "Action: $action, Branch: $branch, Commit: $commit, Builder: $builder" +echo "Action: $action, Branch: $branch, Tag: $tag, Commit: $commit, Builder: $builder, Arduino: $arduino" if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then echo "Bad Action $action" @@ -26,6 +27,8 @@ if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then export IDF_COMMIT="$commit" else commit="" + if [ ! "$tag" == "" ] && [ ! "$tag" == "null" ]; then + export IDF_TAG="$tag" if [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then export IDF_BRANCH="$branch" fi diff --git a/tools/update-components.sh b/tools/update-components.sh index 4111dd489..64bc85b1f 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -26,16 +26,15 @@ if [ -z $AR_BRANCH ]; then current_branch="$GITHUB_HEAD_REF" fi echo "Current Branch: $current_branch" - # Temporary to get CI working - if [[ "$current_branch" == "esp-idf-v5.1" ]]; then - export AR_BRANCH="esp-idf-v5.1-libs" - elif [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then + if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then export AR_BRANCH="$current_branch" else - if [ -z "$IDF_COMMIT" ]; then #commit was not specified at build time - AR_BRANCH_NAME="idf-$IDF_BRANCH" - else + if [ "$IDF_TAG" ]; then #tag was specified at build time + AR_BRANCH_NAME="idf-$IDF_TAG" + elif [ "$IDF_COMMIT" ]; then #commit was specified at build time AR_BRANCH_NAME="idf-$IDF_COMMIT" + else + AR_BRANCH_NAME="idf-$IDF_BRANCH" fi has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_BRANCH_NAME"` if [ "$has_ar_branch" == "1" ]; then From 8f11fb78eb5ac490f948f14f21d29f7874cb033d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 11 Apr 2023 16:51:57 +0200 Subject: [PATCH 053/636] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fe7dfec1c..fe1986330 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store .vscode +managed_components/ components/arduino/ components/esp-dl/ components/esp-sr/ From 34dbb894a6019d9ffa533dfb96395180b359229a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 11 Apr 2023 16:57:00 +0200 Subject: [PATCH 054/636] Update copy-libs.sh --- tools/copy-libs.sh | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 5aa0e9c14..32992d624 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -30,9 +30,15 @@ fi if [ -e "$AR_SDK/include" ]; then rm -rf "$AR_SDK/include" fi +if [ -e "$AR_SDK/flags" ]; then + rm -rf "$AR_SDK/flags" +fi if [ -e "$AR_SDK/$MEMCONF" ]; then rm -rf "$AR_SDK/$MEMCONF" fi +if [ -e "$AR_SDK/platformio-build.py" ]; then + rm -rf "$AR_SDK/platformio-build.py" +fi mkdir -p "$AR_SDK" function get_actual_path(){ @@ -78,7 +84,7 @@ for item in "${@:2:${#@}-5}"; do item=`get_actual_path $item` INCLUDES+="$item " elif [ "${item:0:2}" = ".." ]; then - if [[ "${item:0:14}" = "../components/" && "${item:0:22}" != "../components/arduino/" ]] || [[ "${item:0:11}" = "../esp-idf/" ]]; then + if [[ "${item:0:14}" = "../components/" && "${item:0:22}" != "../components/arduino/" ]] || [[ "${item:0:11}" = "../esp-idf/" ]] || [[ "${item:0:22}" = "../managed_components/" ]]; then item="$PWD${item:2}" item=`get_actual_path $item` INCLUDES+="$item " @@ -273,13 +279,11 @@ done # END OF DATA EXTRACTION FROM CMAKE # -AR_PLATFORMIO_PY="$AR_TOOLS/platformio-build-$IDF_TARGET.py" +mkdir -p "$AR_SDK" # start generation of platformio-build.py -awk "/ASFLAGS=\[/{n++}{print>n\"pio_start.txt\"}" $AR_COMPS/arduino/tools/platformio-build-$IDF_TARGET.py -awk "/\"ARDUINO_ARCH_ESP32\"/{n++}{print>n\"pio_end.txt\"}" 1pio_start.txt -cat pio_start.txt > "$AR_PLATFORMIO_PY" -rm pio_end.txt 1pio_start.txt pio_start.txt +AR_PLATFORMIO_PY="$AR_SDK/platformio-build.py" +cat configs/pio_start.txt > "$AR_PLATFORMIO_PY" echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY" if [ "$IS_XTENSA" = "y" ]; then @@ -380,11 +384,11 @@ for item; do out_cpath="$AR_SDK/include/$fname$out_sub" REL_INC+="-iwithprefixbefore $fname$out_sub " if [ "$out_sub" = "" ]; then - echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"include\", \"$fname\")," >> "$AR_PLATFORMIO_PY" + echo " join($PIO_SDK, \"include\", \"$fname\")," >> "$AR_PLATFORMIO_PY" else pio_sub="${out_sub:1}" pio_sub=`echo $pio_sub | sed 's/\//\\", \\"/g'` - echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"include\", \"$fname\", \"$pio_sub\")," >> "$AR_PLATFORMIO_PY" + echo " join($PIO_SDK, \"include\", \"$fname\", \"$pio_sub\")," >> "$AR_PLATFORMIO_PY" fi for f in `find "$item" -name '*.h'`; do rel_f=${f#*$item} @@ -400,7 +404,7 @@ for item; do done fi done -echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")), \"include\")," >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")), \"include\")," >> "$AR_PLATFORMIO_PY" echo " join(FRAMEWORK_DIR, \"cores\", env.BoardConfig().get(\"build.core\"))" >> "$AR_PLATFORMIO_PY" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" @@ -423,9 +427,9 @@ for item; do done echo " LIBPATH=[" >> "$AR_PLATFORMIO_PY" -echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"lib\")," >> "$AR_PLATFORMIO_PY" -echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"ld\")," >> "$AR_PLATFORMIO_PY" -echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")))" >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, \"lib\")," >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, \"ld\")," >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")))" >> "$AR_PLATFORMIO_PY" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" @@ -452,8 +456,7 @@ for item; do done # end generation of platformio-build.py -cat 1pio_end.txt >> "$AR_PLATFORMIO_PY" -rm 1pio_end.txt +cat configs/pio_end.txt >> "$AR_PLATFORMIO_PY" # replace double backslashes with single one DEFINES=`echo "$DEFINES" | tr -s '\'` @@ -470,12 +473,18 @@ echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags" echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" +# sr model.bin +if [ -f "build/srmodels/srmodels.bin" ]; then + mkdir -p "$AR_SDK/esp_sr" + cp -f "build/srmodels/srmodels.bin" "$AR_SDK/esp_sr/" + cp -f "partitions.csv" "$AR_SDK/esp_sr/" +fi # sdkconfig cp -f "sdkconfig" "$AR_SDK/sdkconfig" # gen_esp32part.py -cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" +# cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" # copy precompiled libs (if we need them) function copy_precompiled_lib(){ From 5ed506343ff2b6664f0fbe2f8b9f2076010a1594 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:00:40 +0200 Subject: [PATCH 055/636] Update update-components.sh --- tools/update-components.sh | 47 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 06a335007..b9f0c9916 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -24,7 +24,10 @@ if [ -z $AR_BRANCH ]; then current_branch="$GITHUB_HEAD_REF" fi echo "Current Branch: $current_branch" - if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then + # Temporary to get CI working + if [[ "$current_branch" == "esp-idf-v5.1" ]]; then + export AR_BRANCH="esp-idf-v5.1-libs" + elif [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then export AR_BRANCH="$current_branch" else if [ -z "$IDF_COMMIT" ]; then #commit was not specified at build time @@ -45,7 +48,7 @@ if [ -z $AR_BRANCH ]; then fi if [ "$AR_BRANCH" ]; then - echo "AR_BRANCH='$AR_BRANCH'" + echo "AR_BRANCH='$AR_BRANCH'" git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \ git -C "$AR_COMPS/arduino" fetch && \ git -C "$AR_COMPS/arduino" pull --ff-only @@ -67,30 +70,30 @@ if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-DL # -#echo "Updating ESP-DL..." -#if [ ! -d "$AR_COMPS/esp-dl" ]; then -# git clone $DL_REPO_URL "$AR_COMPS/esp-dl" -#else -# git -C "$AR_COMPS/esp-dl" fetch && \ -# git -C "$AR_COMPS/esp-dl" pull --ff-only -#fi -#if [ $? -ne 0 ]; then exit 1; fi +echo "Updating ESP-DL..." +if [ ! -d "$AR_COMPS/esp-dl" ]; then + git clone $DL_REPO_URL "$AR_COMPS/esp-dl" +else + git -C "$AR_COMPS/esp-dl" fetch && \ + git -C "$AR_COMPS/esp-dl" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi +#this is a temp measure to fix build issue +if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then + rm -rf "$AR_COMPS/esp-dl/idf_component.yml" +fi # # CLONE/UPDATE ESP-SR # -#echo "Updating ESP-SR..." -#if [ ! -d "$AR_COMPS/esp-sr" ]; then -# git clone $SR_REPO_URL "$AR_COMPS/esp-sr" -#else -# git -C "$AR_COMPS/esp-sr" fetch && \ -# git -C "$AR_COMPS/esp-sr" pull --ff-only -#fi -#this is a temp measure to fix build issue -#if [ -f "$AR_COMPS/esp-sr/idf_component.yml" ]; then -# rm -rf "$AR_COMPS/esp-sr/idf_component.yml" -#fi -#if [ $? -ne 0 ]; then exit 1; fi +echo "Updating ESP-SR..." +if [ ! -d "$AR_COMPS/esp-sr" ]; then + git clone $SR_REPO_URL "$AR_COMPS/esp-sr" +else + git -C "$AR_COMPS/esp-sr" fetch && \ + git -C "$AR_COMPS/esp-sr" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-DSP From ccac71069eb59f5845316f2405e71dec62685773 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:02:00 +0200 Subject: [PATCH 056/636] Update update-components.sh --- tools/update-components.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index b9f0c9916..d4796c942 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -24,16 +24,15 @@ if [ -z $AR_BRANCH ]; then current_branch="$GITHUB_HEAD_REF" fi echo "Current Branch: $current_branch" - # Temporary to get CI working - if [[ "$current_branch" == "esp-idf-v5.1" ]]; then - export AR_BRANCH="esp-idf-v5.1-libs" - elif [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then + if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then export AR_BRANCH="$current_branch" else - if [ -z "$IDF_COMMIT" ]; then #commit was not specified at build time - AR_BRANCH_NAME="idf-$IDF_BRANCH" - else + if [ "$IDF_TAG" ]; then #tag was specified at build time + AR_BRANCH_NAME="idf-$IDF_TAG" + elif [ "$IDF_COMMIT" ]; then #commit was specified at build time AR_BRANCH_NAME="idf-$IDF_COMMIT" + else + AR_BRANCH_NAME="idf-$IDF_BRANCH" fi has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_BRANCH_NAME"` if [ "$has_ar_branch" == "1" ]; then From 8fce687bf7a8c69aea6129a15feaca379f916f06 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 01:28:26 +0300 Subject: [PATCH 057/636] Push to esp32-arduino-libs --- tools/push-to-arduino.sh | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index f9a2b9955..70b19cda3 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -51,4 +51,69 @@ if [ "$AR_HAS_PR" == "0" ]; then exit 1 fi fi + +# +# esp32-arduino-libs +# +cd "$AR_ROOT" +IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" + +if [ ! -d "$IDF_LIBS_DIR" ]; then + echo "Cloning esp32-arduino-libs..." + git clone "https://github.com/espressif/esp32-arduino-libs.git" "$IDF_LIBS_DIR" +else + echo "Updating esp32-arduino-libs..." + git -C "$IDF_LIBS_DIR" fetch && \ + git -C "$IDF_LIBS_DIR" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi + +LIBS_HAS_COMMIT=`git_commit_exists "$IDF_LIBS_DIR" "$AR_NEW_COMMIT_MESSAGE"` +LIBS_HAS_BRANCH=`git_branch_exists "$IDF_LIBS_DIR" "$AR_NEW_BRANCH_NAME"` + +if [ "$LIBS_HAS_COMMIT" == "1" ]; then + echo "Commit '$AR_NEW_COMMIT_MESSAGE' in esp32-arduino-libs Already Exists" + mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists" > dist/log.txt + exit 0 +fi + +if [ "$LIBS_HAS_BRANCH" == "1" ]; then + echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists" + echo "Switching to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + git -C "$IDF_LIBS_DIR" checkout $AR_NEW_BRANCH_NAME +else + echo "Creating esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + git -C "$IDF_LIBS_DIR" checkout -b $AR_NEW_BRANCH_NAME +fi +if [ $? -ne 0 ]; then + echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 +fi + +if [ $LIBS_HAS_COMMIT == "0" ]; then + # make changes to the files + echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + rm -rf $IDF_LIBS_DIR/sdk && cp -Rf $AR_TOOLS/sdk $IDF_LIBS_DIR/ + + cd $IDF_LIBS_DIR + + # did any of the files change? + if [ -n "$(git status --porcelain)" ]; then + echo "Pushing changes to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME + if [ $? -ne 0 ]; then + echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + else + echo "No changes in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'" + if [ $LIBS_HAS_BRANCH == "0" ]; then + echo "Delete created branch '$AR_NEW_BRANCH_NAME'" + git branch -d $AR_NEW_BRANCH_NAME + fi + exit 0 + fi +fi + + exit 0 From 055de09035ebb5b094ac567224db4aa51658f203 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 01:32:14 +0300 Subject: [PATCH 058/636] Update repository_dispatch.sh --- tools/repository_dispatch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/repository_dispatch.sh b/tools/repository_dispatch.sh index 8b2d1b888..fff912b07 100644 --- a/tools/repository_dispatch.sh +++ b/tools/repository_dispatch.sh @@ -29,7 +29,7 @@ else commit="" if [ ! "$tag" == "" ] && [ ! "$tag" == "null" ]; then export IDF_TAG="$tag" - if [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then + elif [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then export IDF_BRANCH="$branch" fi fi From 7ceb0469fccf14983f962ae00c99f57f026f9427 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 03:43:25 +0300 Subject: [PATCH 059/636] Rework scripts to allow build when either dst needs it --- tools/config.sh | 1 + tools/install-esp-idf.sh | 38 ++++++----------- tools/push-to-arduino.sh | 85 +++++++++++++++++++------------------- tools/update-components.sh | 14 +++++++ 4 files changed, 70 insertions(+), 68 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 294d8f078..e339f31ee 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -45,6 +45,7 @@ AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" PIO_SDK="FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\"" TOOLS_JSON_OUT="$AR_TOOLS/sdk" +IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" function get_os(){ OSBITS=`arch` diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 6f7442d5f..5c4dec5b9 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -63,36 +63,21 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito AR_HAS_BRANCH=`git_branch_exists "$AR_COMPS/arduino" "$AR_NEW_BRANCH_NAME"` AR_HAS_PR=`git_pr_exists "$AR_NEW_BRANCH_NAME"` - if [ "$AR_HAS_COMMIT" == "1" ]; then - echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists" - mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists" > dist/log.txt - exit 0 - fi + LIBS_HAS_COMMIT=`git_commit_exists "$IDF_LIBS_DIR" "$AR_NEW_COMMIT_MESSAGE"` + LIBS_HAS_BRANCH=`git_branch_exists "$IDF_LIBS_DIR" "$AR_NEW_BRANCH_NAME"` - if [ "$AR_HAS_BRANCH" == "1" ]; then - echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists" + if [ "$LIBS_HAS_COMMIT" == "1" ]; then + echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in esp32-arduino-libs" + mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in esp32-arduino-libs" > dist/log.txt fi - if [ "$AR_HAS_PR" == "1" ]; then - echo "PR '$AR_NEW_PR_TITLE' Already Exists" + if [ "$AR_HAS_COMMIT" == "1" ]; then + echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in arduino-esp32" + mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in arduino-esp32" > dist/log.txt fi - # setup git for pushing - git config --global github.user "$GITHUB_ACTOR" - git config --global user.name "$GITHUB_ACTOR" - git config --global user.email "$GITHUB_ACTOR@github.com" - - # create or checkout the branch - if [ ! $AR_HAS_BRANCH == "0" ]; then - echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." - git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME - else - echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." - git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME - fi - if [ $? -ne 0 ]; then - echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" - exit 1 + if [ "$LIBS_HAS_COMMIT" == "1" ] && [ "$AR_HAS_COMMIT" == "1" ]; then + exit 0 fi export AR_NEW_BRANCH_NAME @@ -102,4 +87,7 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito export AR_HAS_COMMIT export AR_HAS_BRANCH export AR_HAS_PR + + export LIBS_HAS_COMMIT + export LIBS_HAS_BRANCH fi diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index 70b19cda3..1e3c50c30 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -11,11 +11,29 @@ if ! [ -d "$AR_COMPS/arduino" ]; then exit 1 fi +# setup git for pushing +git config --global github.user "$GITHUB_ACTOR" +git config --global user.name "$GITHUB_ACTOR" +git config --global user.email "$GITHUB_ACTOR@github.com" + # # UPDATE FILES # if [ $AR_HAS_COMMIT == "0" ]; then + # create or checkout the branch + if [ ! $AR_HAS_BRANCH == "0" ]; then + echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." + git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME + else + echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." + git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME + fi + if [ $? -ne 0 ]; then + echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + # make changes to the files echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." ESP32_ARDUINO="$AR_COMPS/arduino" ./tools/copy-to-arduino.sh @@ -38,17 +56,17 @@ if [ $AR_HAS_COMMIT == "0" ]; then fi exit 0 fi -fi -# -# CREATE PULL REQUEST -# - -if [ "$AR_HAS_PR" == "0" ]; then - pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` - if [ $pr_created == "0" ]; then - 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'` - exit 1 + # CREATE PULL REQUEST + if [ "$AR_HAS_PR" == "0" ]; then + echo "Creating PR '$AR_NEW_PR_TITLE'..." + pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` + if [ $pr_created == "0" ]; then + 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'` + exit 1 + fi + else + echo "PR '$AR_NEW_PR_TITLE' Already Exists" fi fi @@ -56,41 +74,22 @@ fi # esp32-arduino-libs # cd "$AR_ROOT" -IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" - -if [ ! -d "$IDF_LIBS_DIR" ]; then - echo "Cloning esp32-arduino-libs..." - git clone "https://github.com/espressif/esp32-arduino-libs.git" "$IDF_LIBS_DIR" -else - echo "Updating esp32-arduino-libs..." - git -C "$IDF_LIBS_DIR" fetch && \ - git -C "$IDF_LIBS_DIR" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi - -LIBS_HAS_COMMIT=`git_commit_exists "$IDF_LIBS_DIR" "$AR_NEW_COMMIT_MESSAGE"` -LIBS_HAS_BRANCH=`git_branch_exists "$IDF_LIBS_DIR" "$AR_NEW_BRANCH_NAME"` - -if [ "$LIBS_HAS_COMMIT" == "1" ]; then - echo "Commit '$AR_NEW_COMMIT_MESSAGE' in esp32-arduino-libs Already Exists" - mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists" > dist/log.txt - exit 0 -fi - -if [ "$LIBS_HAS_BRANCH" == "1" ]; then - echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists" - echo "Switching to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." - git -C "$IDF_LIBS_DIR" checkout $AR_NEW_BRANCH_NAME -else - echo "Creating esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." - git -C "$IDF_LIBS_DIR" checkout -b $AR_NEW_BRANCH_NAME -fi -if [ $? -ne 0 ]; then - echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" - exit 1 -fi if [ $LIBS_HAS_COMMIT == "0" ]; then + # create branch if necessary + if [ "$LIBS_HAS_BRANCH" == "1" ]; then + echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists" + echo "Switching to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + git -C "$IDF_LIBS_DIR" checkout $AR_NEW_BRANCH_NAME + else + echo "Creating esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + git -C "$IDF_LIBS_DIR" checkout -b $AR_NEW_BRANCH_NAME + fi + if [ $? -ne 0 ]; then + echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + # make changes to the files echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." rm -rf $IDF_LIBS_DIR/sdk && cp -Rf $AR_TOOLS/sdk $IDF_LIBS_DIR/ diff --git a/tools/update-components.sh b/tools/update-components.sh index 64bc85b1f..d2cc7f2f3 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -10,6 +10,7 @@ INSIGHTS_REPO_URL="https://github.com/espressif/esp-insights.git" DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" +IDF_LIBS_REPO_URL="https://github.com/espressif/esp32-arduino-libs.git" # # CLONE/UPDATE ARDUINO @@ -56,6 +57,19 @@ if [ "$AR_BRANCH" ]; then fi if [ $? -ne 0 ]; then exit 1; fi +# +# CLONE/UPDATE ESP32-ARDUINO-LIBS +# +if [ ! -d "$IDF_LIBS_DIR" ]; then + echo "Cloning esp32-arduino-libs..." + git clone "$IDF_LIBS_REPO_URL" "$IDF_LIBS_DIR" +else + echo "Updating esp32-arduino-libs..." + git -C "$IDF_LIBS_DIR" fetch && \ + git -C "$IDF_LIBS_DIR" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi + # # CLONE/UPDATE ESP32-CAMERA # From 7562fbd76de5398d6b555dc6e6383b78137d2fe7 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 12:20:48 +0300 Subject: [PATCH 060/636] Github complains when pushing to the libs repo --- tools/install-esp-idf.sh | 5 +++++ tools/push-to-arduino.sh | 5 ----- tools/repository_dispatch.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 5c4dec5b9..ceb8cbfe6 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -80,6 +80,11 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito exit 0 fi + # setup git for pushing + git config --global github.user "$GITHUB_ACTOR" + git config --global user.name "$GITHUB_ACTOR" + git config --global user.email "$GITHUB_ACTOR@github.com" + export AR_NEW_BRANCH_NAME export AR_NEW_COMMIT_MESSAGE export AR_NEW_PR_TITLE diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index 1e3c50c30..01f0b59d5 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -11,11 +11,6 @@ if ! [ -d "$AR_COMPS/arduino" ]; then exit 1 fi -# setup git for pushing -git config --global github.user "$GITHUB_ACTOR" -git config --global user.name "$GITHUB_ACTOR" -git config --global user.email "$GITHUB_ACTOR@github.com" - # # UPDATE FILES # diff --git a/tools/repository_dispatch.sh b/tools/repository_dispatch.sh index fff912b07..9c9cf1d19 100644 --- a/tools/repository_dispatch.sh +++ b/tools/repository_dispatch.sh @@ -14,7 +14,7 @@ commit=`echo "$payload" | jq -r '.commit'` builder=`echo "$payload" | jq -r '.builder'` arduino=`echo "$payload" | jq -r '.arduino'` -echo "Action: $action, Branch: $branch, Tag: $tag, Commit: $commit, Builder: $builder, Arduino: $arduino" +echo "Action: $action, Branch: $branch, Tag: $tag, Commit: $commit, Builder: $builder, Arduino: $arduino, Actor: $GITHUB_ACTOR" if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then echo "Bad Action $action" From 08eef9c9efc7dd2a986372d821dba524ccc4b8b9 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 12:54:30 +0300 Subject: [PATCH 061/636] Authenticate to the libs repo --- tools/config.sh | 2 ++ tools/update-components.sh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index e339f31ee..c35e1ee42 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -32,8 +32,10 @@ AR_USER="espressif" AR_REPO="$AR_USER/arduino-esp32" AR_REPO_URL="https://github.com/$AR_REPO.git" +IDF_LIBS_REPO_URL="https://github.com/espressif/esp32-arduino-libs.git" if [ -n $GITHUB_TOKEN ]; then AR_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_REPO.git" + IDF_LIBS_REPO_URL="https://$GITHUB_TOKEN@github.com/espressif/esp32-arduino-libs.git" fi AR_ROOT="$PWD" diff --git a/tools/update-components.sh b/tools/update-components.sh index d2cc7f2f3..f6cf986e8 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -10,7 +10,6 @@ INSIGHTS_REPO_URL="https://github.com/espressif/esp-insights.git" DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" -IDF_LIBS_REPO_URL="https://github.com/espressif/esp32-arduino-libs.git" # # CLONE/UPDATE ARDUINO From dbf19e2b7e53347c831c8a3058180c8c8a068ec0 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 16:53:38 +0300 Subject: [PATCH 062/636] Attempt at splitting SDK from Arduino --- tools/add_sdk_json.py | 128 +++++++++++++++++++++++++++ tools/install-esp-idf.sh | 7 +- tools/push-to-arduino.sh | 187 +++++++++++++++++++++++++++++---------- 3 files changed, 271 insertions(+), 51 deletions(-) create mode 100644 tools/add_sdk_json.py diff --git a/tools/add_sdk_json.py b/tools/add_sdk_json.py new file mode 100644 index 000000000..dae269af9 --- /dev/null +++ b/tools/add_sdk_json.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python + +from __future__ import print_function + +__author__ = "Hristo Gochkov" +__version__ = "2023" + +import os +import shutil +import errno +import os.path +import json +import platform +import sys +import stat +import argparse + +if sys.version_info[0] == 3: + unicode = lambda s: str(s) + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + prog = 'add_sdk_json', + description = 'Update SDK in Arduino package index') + parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=True, help='path to package json') + parser.add_argument('-n', '--name', dest='tool_name', required=True, help='name of the SDK package') + parser.add_argument('-v', '--version', dest='tool_version', required=True, help='version of the new SDK') + parser.add_argument('-u', '--url', dest='tool_url', required=True, help='url to the zip of the new SDK') + parser.add_argument('-f', '--filename', dest='tool_filename', required=True, help='filename of the zip of the new SDK') + parser.add_argument('-s', '--size', dest='tool_size', required=True, help='size of the zip of the new SDK') + parser.add_argument('-c', '--sha', dest='tool_sha', required=True, help='sha256 of the zip of the new SDK') + args = parser.parse_args() + + print('Destination : {0}.'.format(args.arduino_json)) + print('Tool Name : {0}.'.format(args.tool_name)) + print('Tool Version : {0}.'.format(args.tool_version)) + print('Tool URL : {0}.'.format(args.tool_url)) + print('Tool File Name: {0}.'.format(args.tool_filename)) + print('Tool Size : {0}.'.format(args.tool_size)) + print('Tool SHA256 : {0}.'.format(args.tool_sha)) + + idf_path = args.idf_path; + arduino_json = args.arduino_json; + tool_name = args.tool_name; + tool_version = args.tool_version; + tool_url = args.tool_url; + tool_filename = args.tool_filename; + tool_size = args.tool_size; + tool_sha = args.tool_sha; + + # code start + farray = {"packages":[{"platforms":[{"toolsDependencies":[]}],"tools":[]}]} + if os.path.isfile(arduino_json) == True: + farray = json.load(open(arduino_json)) + + dep_found = False + dep_skip = False + for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: + if dep['name'] == tool_name: + if dep['version'] == tool_version: + print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) + dep_skip = True + break + print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) + dep['version'] = tool_version + dep_found = True + break + + if dep_skip == False: + if dep_found == False: + print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) + deps = { + "packager": "esp32", + "name": tool_name, + "version": tool_version + } + farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) + + systems = [] + system = { + "host": '', + "url": tool_url, + "archiveFileName": tool_filename, + "checksum": "SHA-256:"+tool_sha, + "size": str(tool_size) + } + + system["host"] = "i686-mingw32"; + systems.append(system) + system["host"] = "x86_64-mingw32"; + systems.append(system) + system["host"] = "arm64-apple-darwin"; + systems.append(system) + system["host"] = "x86_64-apple-darwin"; + systems.append(system) + system["host"] = "x86_64-pc-linux-gnu"; + systems.append(system) + system["host"] = "i686-pc-linux-gnu"; + systems.append(system) + system["host"] = "aarch64-linux-gnu"; + systems.append(system) + system["host"] = "arm-linux-gnueabihf"; + systems.append(system) + + tool_found = False + for t in farray['packages'][0]['tools']: + if t['name'] == tool_name: + t['version'] = tool_version + t['systems'] = systems + tool_found = True + print('Updating systems of {0} to version {1}'.format(tool_name, tool_version)) + break + + if tool_found == False: + print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) + tools = { + "name": tool_name, + "version": tool_version, + "systems": systems + } + farray['packages'][0]['tools'].append(tools) + + json_str = json.dumps(farray, indent=2) + with open(arduino_json, "w") as f: + f.write(json_str+"\n") + f.close() + # print(json_str) + print('{0} generated'.format(arduino_json)) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index ceb8cbfe6..f88b069f5 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -58,6 +58,7 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito AR_NEW_COMMIT_MESSAGE="IDF $IDF_COMMIT" AR_NEW_PR_TITLE="$AR_NEW_COMMIT_MESSAGE" fi + LIBS_VERSION="idf-$IDF_BRANCH-$IDF_COMMIT" AR_HAS_COMMIT=`git_commit_exists "$AR_COMPS/arduino" "$AR_NEW_COMMIT_MESSAGE"` AR_HAS_BRANCH=`git_branch_exists "$AR_COMPS/arduino" "$AR_NEW_BRANCH_NAME"` @@ -80,11 +81,6 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito exit 0 fi - # setup git for pushing - git config --global github.user "$GITHUB_ACTOR" - git config --global user.name "$GITHUB_ACTOR" - git config --global user.email "$GITHUB_ACTOR@github.com" - export AR_NEW_BRANCH_NAME export AR_NEW_COMMIT_MESSAGE export AR_NEW_PR_TITLE @@ -93,6 +89,7 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito export AR_HAS_BRANCH export AR_HAS_PR + export LIBS_VERSION export LIBS_HAS_COMMIT export LIBS_HAS_BRANCH fi diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index 01f0b59d5..36d38ca21 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -11,66 +11,71 @@ if ! [ -d "$AR_COMPS/arduino" ]; then exit 1 fi +# setup git for pushing +git config --global github.user "$GITHUB_ACTOR" +git config --global user.name "$GITHUB_ACTOR" +git config --global user.email "$GITHUB_ACTOR@github.com" + # # UPDATE FILES # -if [ $AR_HAS_COMMIT == "0" ]; then - # create or checkout the branch - if [ ! $AR_HAS_BRANCH == "0" ]; then - echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." - git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME - else - echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." - git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME - fi - if [ $? -ne 0 ]; then - echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" - exit 1 - fi +# if [ $AR_HAS_COMMIT == "0" ]; then +# # create or checkout the branch +# if [ ! $AR_HAS_BRANCH == "0" ]; then +# echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." +# git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME +# else +# echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." +# git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME +# fi +# if [ $? -ne 0 ]; then +# echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" +# exit 1 +# fi - # make changes to the files - echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." - ESP32_ARDUINO="$AR_COMPS/arduino" ./tools/copy-to-arduino.sh +# # make changes to the files +# echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." +# ESP32_ARDUINO="$AR_COMPS/arduino" ./tools/copy-to-arduino.sh - cd $AR_COMPS/arduino +# cd $AR_COMPS/arduino - # did any of the files change? - if [ -n "$(git status --porcelain)" ]; then - echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..." - git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME - if [ $? -ne 0 ]; then - echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" - exit 1 - fi - else - echo "No changes in branch '$AR_NEW_BRANCH_NAME'" - if [ $AR_HAS_BRANCH == "0" ]; then - echo "Delete created branch '$AR_NEW_BRANCH_NAME'" - git branch -d $AR_NEW_BRANCH_NAME - fi - exit 0 - fi +# # did any of the files change? +# if [ -n "$(git status --porcelain)" ]; then +# echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..." +# git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME +# if [ $? -ne 0 ]; then +# echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" +# exit 1 +# fi +# else +# echo "No changes in branch '$AR_NEW_BRANCH_NAME'" +# if [ $AR_HAS_BRANCH == "0" ]; then +# echo "Delete created branch '$AR_NEW_BRANCH_NAME'" +# git branch -d $AR_NEW_BRANCH_NAME +# fi +# exit 0 +# fi - # CREATE PULL REQUEST - if [ "$AR_HAS_PR" == "0" ]; then - echo "Creating PR '$AR_NEW_PR_TITLE'..." - pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` - if [ $pr_created == "0" ]; then - 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'` - exit 1 - fi - else - echo "PR '$AR_NEW_PR_TITLE' Already Exists" - fi -fi +# # CREATE PULL REQUEST +# if [ "$AR_HAS_PR" == "0" ]; then +# echo "Creating PR '$AR_NEW_PR_TITLE'..." +# pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` +# if [ $pr_created == "0" ]; then +# 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'` +# exit 1 +# fi +# else +# echo "PR '$AR_NEW_PR_TITLE' Already Exists" +# fi +# fi # # esp32-arduino-libs # -cd "$AR_ROOT" if [ $LIBS_HAS_COMMIT == "0" ]; then + cd "$AR_ROOT" # create branch if necessary if [ "$LIBS_HAS_BRANCH" == "1" ]; then echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists" @@ -90,6 +95,9 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then rm -rf $IDF_LIBS_DIR/sdk && cp -Rf $AR_TOOLS/sdk $IDF_LIBS_DIR/ cd $IDF_LIBS_DIR + if [ -f "README.md" ]; then + rm -rf "README.md" + fi # did any of the files change? if [ -n "$(git status --porcelain)" ]; then @@ -99,6 +107,38 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" exit 1 fi + IDF_LIBS_COMMIT=`git rev-parse --verify HEAD` + IDF_LIBS_DL_URL="https://github.com/espressif/esp32-arduino-libs/archive/$IDF_LIBS_COMMIT.zip" + # ToDo: this URL needs to get into Arduino's package.json + + # Download the file + filename=$(basename "$IDF_LIBS_DL_URL") + curl -s -O "$IDF_LIBS_DL_URL" + + # Check if the download was successful + if [ $? -ne 0 ]; then + echo "Error downloading file from $IDF_LIBS_DL_URL" + exit 1 + fi + + # Calculate the size in bytes and SHA-256 sum + size=$(stat -c%s "$filename") + sha256sum=$(sha256sum "$filename" | awk '{print $1}') + + # Clean up the downloaded file + rm "$filename" + + # Print the results + echo "Tool: esp32-arduino-libs" + echo "Version: $LIBS_VERSION" + echo "URL: $IDF_LIBS_DL_URL" + echo "File: $filename" + echo "Size: $size bytes" + echo "SHA-256: $sha256sum" + echo "JSON: $AR_OUT/package_esp32_index.template.json" + 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" + if [ $? -ne 0 ]; then exit 1; fi + else echo "No changes in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'" if [ $LIBS_HAS_BRANCH == "0" ]; then @@ -109,5 +149,60 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then fi fi +# https://github.com/espressif/esp32-arduino-libs/archive/refs/heads/[branch].zip +# https://github.com/espressif/esp32-arduino-libs/archive/refs/tags/[tag].zip +# https://github.com/espressif/esp32-arduino-libs/archive/[commit_hash].zip + +if [ $AR_HAS_COMMIT == "0" ]; then + cd "$AR_ROOT" + # create or checkout the branch + if [ ! $AR_HAS_BRANCH == "0" ]; then + echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." + git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME + else + echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." + git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME + fi + if [ $? -ne 0 ]; then + echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + + # make changes to the files + echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." + rm -rf "$AR_COMPS/arduino/tools/sdk" + 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" + + cd $AR_COMPS/arduino + + # did any of the files change? + if [ -n "$(git status --porcelain)" ]; then + echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..." + git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME + if [ $? -ne 0 ]; then + echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + else + echo "No changes in branch '$AR_NEW_BRANCH_NAME'" + if [ $AR_HAS_BRANCH == "0" ]; then + echo "Delete created branch '$AR_NEW_BRANCH_NAME'" + git branch -d $AR_NEW_BRANCH_NAME + fi + exit 0 + fi + + # CREATE PULL REQUEST + if [ "$AR_HAS_PR" == "0" ]; then + echo "Creating PR '$AR_NEW_PR_TITLE'..." + pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` + if [ $pr_created == "0" ]; then + 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'` + exit 1 + fi + else + echo "PR '$AR_NEW_PR_TITLE' Already Exists" + fi +fi exit 0 From 846dc299f7a35125066b308eeecaa21e06fe786c Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 19:15:51 +0300 Subject: [PATCH 063/636] Archive only the result and reorder deploy commands --- build.sh | 18 +++++++++++------- tools/archive-build.sh | 8 ++++---- tools/install-esp-idf.sh | 2 +- tools/repository_dispatch.sh | 10 +++++++--- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/build.sh b/build.sh index 4dc1d0a70..0af3871d8 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,9 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 -DEPLOY_OUT=0 +if [ -z $DEPLOY_OUT ]; then + DEPLOY_OUT=0 +fi function print_help() { echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf_libs|copy_bootloader|mem_variant>] [config ...]" @@ -195,17 +197,19 @@ if [ "$BUILD_TYPE" = "all" ]; then if [ $? -ne 0 ]; then exit 1; fi fi -# archive the build -if [ "$BUILD_TYPE" = "all" ]; then - ./tools/archive-build.sh - if [ $? -ne 0 ]; then exit 1; fi -fi - # copy everything to arduino-esp32 installation if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then ./tools/copy-to-arduino.sh + if [ $? -ne 0 ]; then exit 1; fi fi if [ $DEPLOY_OUT -eq 1 ]; then ./tools/push-to-arduino.sh + if [ $? -ne 0 ]; then exit 1; fi +fi + +# archive the build +if [ "$BUILD_TYPE" = "all" ]; then + ./tools/archive-build.sh + if [ $? -ne 0 ]; then exit 1; fi fi diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 432f69031..7a5afc5da 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -5,12 +5,12 @@ IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT" archive_path="dist/arduino-esp32-libs-$idf_version_string.tar.gz" -build_archive_path="dist/arduino-esp32-build-$idf_version_string.tar.gz" +# build_archive_path="dist/arduino-esp32-build-$idf_version_string.tar.gz" mkdir -p dist && rm -rf "$archive_path" "$build_archive_path" if [ -d "out" ]; then cd out && tar zcf "../$archive_path" * && cd .. fi -if [ -d "build" ]; then - cd build && tar zcf "../$build_archive_path" * && cd .. -fi +# if [ -d "build" ]; then +# cd build && tar zcf "../$build_archive_path" * && cd .. +# fi diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index f88b069f5..ec73eb4ee 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -58,7 +58,7 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito AR_NEW_COMMIT_MESSAGE="IDF $IDF_COMMIT" AR_NEW_PR_TITLE="$AR_NEW_COMMIT_MESSAGE" fi - LIBS_VERSION="idf-$IDF_BRANCH-$IDF_COMMIT" + LIBS_VERSION="idf-"${IDF_BRANCH//\//_}"-$IDF_COMMIT" AR_HAS_COMMIT=`git_commit_exists "$AR_COMPS/arduino" "$AR_NEW_COMMIT_MESSAGE"` AR_HAS_BRANCH=`git_branch_exists "$AR_COMPS/arduino" "$AR_NEW_BRANCH_NAME"` diff --git a/tools/repository_dispatch.sh b/tools/repository_dispatch.sh index 9c9cf1d19..15198e98e 100644 --- a/tools/repository_dispatch.sh +++ b/tools/repository_dispatch.sh @@ -42,8 +42,12 @@ if [ ! "$arduino" == "" ] && [ ! "$arduino" == "null" ]; then export AR_BRANCH="$arduino" fi -source ./build.sh - if [ "$action" == "deploy" ]; then - bash ./tools/push-to-arduino.sh + DEPLOY_OUT=1 fi + +source ./build.sh + +# if [ "$action" == "deploy" ]; then +# bash ./tools/push-to-arduino.sh +# fi From 4e718665b3d451da9247943a526b167972b8ba94 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 19:17:17 +0300 Subject: [PATCH 064/636] Update cron.sh --- tools/cron.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/cron.sh b/tools/cron.sh index 6122b1eed..2a3fb88cd 100644 --- a/tools/cron.sh +++ b/tools/cron.sh @@ -6,5 +6,6 @@ if [ ! "$GITHUB_EVENT_NAME" == "schedule" ]; then fi git checkout "$IDF_BRANCH" #local branches should match what the matrix wants to build +DEPLOY_OUT=1 source ./build.sh -bash ./tools/push-to-arduino.sh +# bash ./tools/push-to-arduino.sh From ae1bfb5462a7d39b06901b549df2981fa38c7e84 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Wed, 12 Apr 2023 21:01:54 +0300 Subject: [PATCH 065/636] Fix script and zip paths --- tools/push-to-arduino.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index 36d38ca21..58d1c2f8a 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -112,7 +112,7 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then # ToDo: this URL needs to get into Arduino's package.json # Download the file - filename=$(basename "$IDF_LIBS_DL_URL") + filename="esp32-arduino-libs-$IDF_LIBS_COMMIT.zip" curl -s -O "$IDF_LIBS_DL_URL" # Check if the download was successful @@ -136,6 +136,7 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then echo "Size: $size bytes" echo "SHA-256: $sha256sum" echo "JSON: $AR_OUT/package_esp32_index.template.json" + cd "$AR_ROOT" 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" if [ $? -ne 0 ]; then exit 1; fi From 8b4c2c9bdf83d3a158d10cf2b24016d20b60e394 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Thu, 13 Apr 2023 00:14:30 +0300 Subject: [PATCH 066/636] Fix download URL and json merger --- tools/add_sdk_json.py | 1 - tools/push-to-arduino.sh | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/add_sdk_json.py b/tools/add_sdk_json.py index dae269af9..c8216f11c 100644 --- a/tools/add_sdk_json.py +++ b/tools/add_sdk_json.py @@ -39,7 +39,6 @@ print('Tool Size : {0}.'.format(args.tool_size)) print('Tool SHA256 : {0}.'.format(args.tool_sha)) - idf_path = args.idf_path; arduino_json = args.arduino_json; tool_name = args.tool_name; tool_version = args.tool_version; diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index 58d1c2f8a..168fadf6e 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -108,12 +108,12 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then exit 1 fi IDF_LIBS_COMMIT=`git rev-parse --verify HEAD` - IDF_LIBS_DL_URL="https://github.com/espressif/esp32-arduino-libs/archive/$IDF_LIBS_COMMIT.zip" + IDF_LIBS_DL_URL="https://codeload.github.com/espressif/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT" # ToDo: this URL needs to get into Arduino's package.json # Download the file filename="esp32-arduino-libs-$IDF_LIBS_COMMIT.zip" - curl -s -O "$IDF_LIBS_DL_URL" + curl -s -o "$filename" "$IDF_LIBS_DL_URL" # Check if the download was successful if [ $? -ne 0 ]; then @@ -150,10 +150,6 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then fi fi -# https://github.com/espressif/esp32-arduino-libs/archive/refs/heads/[branch].zip -# https://github.com/espressif/esp32-arduino-libs/archive/refs/tags/[tag].zip -# https://github.com/espressif/esp32-arduino-libs/archive/[commit_hash].zip - if [ $AR_HAS_COMMIT == "0" ]; then cd "$AR_ROOT" # create or checkout the branch From 6a16048ec460271c6d3b08598933fe3b971ff267 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Thu, 13 Apr 2023 11:15:08 +0300 Subject: [PATCH 067/636] Change sdk folder structure and fix json generation --- tools/add_sdk_json.py | 42 +++++++++++++++++----------------------- tools/push-to-arduino.sh | 2 +- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/tools/add_sdk_json.py b/tools/add_sdk_json.py index c8216f11c..d2deb4a87 100644 --- a/tools/add_sdk_json.py +++ b/tools/add_sdk_json.py @@ -18,6 +18,16 @@ if sys.version_info[0] == 3: unicode = lambda s: str(s) +def add_system(systems, host, url, filename, sha, size): + system = { + "host": host, + "url": url, + "archiveFileName": filename, + "checksum": "SHA-256:"+sha, + "size": str(size) + } + systems.append(system) + if __name__ == '__main__': parser = argparse.ArgumentParser( prog = 'add_sdk_json', @@ -76,30 +86,14 @@ farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) systems = [] - system = { - "host": '', - "url": tool_url, - "archiveFileName": tool_filename, - "checksum": "SHA-256:"+tool_sha, - "size": str(tool_size) - } - - system["host"] = "i686-mingw32"; - systems.append(system) - system["host"] = "x86_64-mingw32"; - systems.append(system) - system["host"] = "arm64-apple-darwin"; - systems.append(system) - system["host"] = "x86_64-apple-darwin"; - systems.append(system) - system["host"] = "x86_64-pc-linux-gnu"; - systems.append(system) - system["host"] = "i686-pc-linux-gnu"; - systems.append(system) - system["host"] = "aarch64-linux-gnu"; - systems.append(system) - system["host"] = "arm-linux-gnueabihf"; - systems.append(system) + add_system(systems, "i686-mingw32", tool_url, tool_filename, tool_sha, tool_size) + add_system(systems, "x86_64-mingw32", tool_url, tool_filename, tool_sha, tool_size) + add_system(systems, "arm64-apple-darwin", tool_url, tool_filename, tool_sha, tool_size) + add_system(systems, "x86_64-apple-darwin", tool_url, tool_filename, tool_sha, tool_size) + add_system(systems, "x86_64-pc-linux-gnu", tool_url, tool_filename, tool_sha, tool_size) + add_system(systems, "i686-pc-linux-gnu", tool_url, tool_filename, tool_sha, tool_size) + add_system(systems, "aarch64-linux-gnu", tool_url, tool_filename, tool_sha, tool_size) + add_system(systems, "arm-linux-gnueabihf", tool_url, tool_filename, tool_sha, tool_size) tool_found = False for t in farray['packages'][0]['tools']: diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index 168fadf6e..e6b9453c0 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -92,7 +92,7 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then # make changes to the files echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." - rm -rf $IDF_LIBS_DIR/sdk && cp -Rf $AR_TOOLS/sdk $IDF_LIBS_DIR/ + rm -rf $IDF_LIBS_DIR/* && cp -Rf $AR_TOOLS/sdk/* $IDF_LIBS_DIR/ cd $IDF_LIBS_DIR if [ -f "README.md" ]; then From 361e98aa20a4ce9dad478b3151d1ebe0df8d1634 Mon Sep 17 00:00:00 2001 From: me-no-dev <hristo@espressif.com> Date: Thu, 13 Apr 2023 12:44:19 +0300 Subject: [PATCH 068/636] Switch output folder from sdk to esp32-arduino-libs --- build.sh | 8 ++++---- tools/config.sh | 6 +++--- tools/copy-to-arduino.sh | 4 ++-- tools/push-to-arduino.sh | 3 +-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/build.sh b/build.sh index 0af3871d8..a5ea518e2 100755 --- a/build.sh +++ b/build.sh @@ -126,17 +126,17 @@ fi rm -rf build sdkconfig out # Add components version info -mkdir -p "$AR_TOOLS/sdk" && rm -rf version.txt && rm -rf "$AR_TOOLS/sdk/versions.txt" +mkdir -p "$AR_TOOLS/esp32-arduino-libs" && rm -rf version.txt && rm -rf "$AR_TOOLS/esp32-arduino-libs/versions.txt" 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) -echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/sdk/versions.txt" +echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" for component in `ls "$AR_COMPS"`; do if [ -d "$AR_COMPS/$component/.git" ] || [ -d "$AR_COMPS/$component/.github" ]; then 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) - echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/sdk/versions.txt" + echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" fi done 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) -echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/sdk/versions.txt" +echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do diff --git a/tools/config.sh b/tools/config.sh index c35e1ee42..96d04d054 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -44,9 +44,9 @@ AR_OUT="$AR_ROOT/out" AR_TOOLS="$AR_OUT/tools" AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" -AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" -PIO_SDK="FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\"" -TOOLS_JSON_OUT="$AR_TOOLS/sdk" +AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET" +PIO_SDK="FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\"" +TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" function get_os(){ diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh index 2ed90fa9b..96092e068 100755 --- a/tools/copy-to-arduino.sh +++ b/tools/copy-to-arduino.sh @@ -19,5 +19,5 @@ echo "Installing new libraries to $ESP32_ARDUINO" rm -rf $ESP32_ARDUINO/package/package_esp32_index.template.json && \ cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json -rm -rf $ESP32_ARDUINO/tools/sdk && \ -cp -Rf $AR_TOOLS/sdk $ESP32_ARDUINO/tools/ +rm -rf $ESP32_ARDUINO/tools/esp32-arduino-libs && \ +cp -Rf $AR_TOOLS/esp32-arduino-libs $ESP32_ARDUINO/tools/ diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index e6b9453c0..d66e7c3c1 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -92,7 +92,7 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then # make changes to the files echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." - rm -rf $IDF_LIBS_DIR/* && cp -Rf $AR_TOOLS/sdk/* $IDF_LIBS_DIR/ + rm -rf $IDF_LIBS_DIR/* && cp -Rf $AR_TOOLS/esp32-arduino-libs/* $IDF_LIBS_DIR/ cd $IDF_LIBS_DIR if [ -f "README.md" ]; then @@ -167,7 +167,6 @@ if [ $AR_HAS_COMMIT == "0" ]; then # make changes to the files echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." - rm -rf "$AR_COMPS/arduino/tools/sdk" 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" cd $AR_COMPS/arduino From 07772cd773f93c3ac2387616f6745cdcab8f25b2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 13 Apr 2023 13:56:49 +0200 Subject: [PATCH 069/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 84a709ab7..6ae1ccca0 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -27,7 +27,6 @@ fi # if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then - echo "$IDF_PATH submodule update" git -C $IDF_PATH submodule update --init --recursive $IDF_PATH/install.sh fi From 0a0e75c254b8a4b90aff07b8d5af2f49c1e8c842 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:46:46 +0200 Subject: [PATCH 070/636] Delete cron.yml --- .github/workflows/cron.yml | 39 -------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/cron.yml diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml deleted file mode 100644 index 49afcdc29..000000000 --- a/.github/workflows/cron.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Cron Build - -on: - schedule: -# ┌───────────── minute (0 - 59) -# │ ┌───────────── hour (0 - 23) -# │ │ ┌───────────── day of the month (1 - 31) -# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) -# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) -# │ │ │ │ │ -# │ │ │ │ │ -# │ │ │ │ │ -# * * * * * - - cron: '0 */6 * * *' - -jobs: - run: - name: Build with IDF ${{ matrix.idf_branch }} - runs-on: ubuntu-latest - - strategy: - matrix: - idf_branch: [release/v5.1, release/v4.4] #, release/v3.3] - steps: - - uses: actions/checkout@v1 - - name: Install dependencies - run: bash ./tools/prepare-ci.sh - - name: Build - env: - GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} - GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} - GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} - IDF_BRANCH: ${{ matrix.idf_branch }} - run: bash ./tools/cron.sh - - name: Upload archive - uses: actions/upload-artifact@v1 - with: - name: artifacts - path: dist From 49862d07e455530a8059b78e935a2f9794feda1c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:47:32 +0200 Subject: [PATCH 071/636] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fe1986330..2d74868b1 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ sdkconfig.old version.txt dependencies.lock managed_components/ +target/ From 705166309808ad53f3abb443d3a983eaad65dc5b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:48:08 +0200 Subject: [PATCH 072/636] Delete cron.sh --- tools/cron.sh | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 tools/cron.sh diff --git a/tools/cron.sh b/tools/cron.sh deleted file mode 100644 index 2a3fb88cd..000000000 --- a/tools/cron.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -if [ ! "$GITHUB_EVENT_NAME" == "schedule" ]; then - echo "Wrong event '$GITHUB_EVENT_NAME'!" - exit 1 -fi - -git checkout "$IDF_BRANCH" #local branches should match what the matrix wants to build -DEPLOY_OUT=1 -source ./build.sh -# bash ./tools/push-to-arduino.sh From 591be5e5a2d7f2537eba61b9a8a6246a1094b3bf Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:49:10 +0200 Subject: [PATCH 073/636] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 023aa709c..f5cdb4a45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ idf_build_get_property(elf EXECUTABLE GENERATOR_EXPRESSION) add_custom_command( OUTPUT "idf_libs" COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-libs.sh ${IDF_TARGET} "${CONFIG_LIB_BUILDER_FLASHMODE}" "${CONFIG_SPIRAM_MODE_OCT}" "${CONFIG_IDF_TARGET_ARCH_XTENSA}" - DEPENDS ${elf} + DEPENDS all WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} VERBATIM ) From 7e0c7d7ea9ba58112bea93bda0e2b9a08ad474a3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:49:41 +0200 Subject: [PATCH 074/636] Update CMakeLists.txt --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cc989c62..f5cdb4a45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(RMAKER_PATH ${CMAKE_SOURCE_DIR}/components/esp-rainmaker) -set(EXTRA_COMPONENT_DIRS ${RMAKER_PATH}/components/esp-insights/components ${RMAKER_PATH}/components ${CMAKE_SOURCE_DIR}/components/esp-insights/components) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(arduino-lib-builder) From cff2078ac72de16c0c292268dbbe3c726009fe2a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:50:29 +0200 Subject: [PATCH 075/636] Update build.sh --- build.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/build.sh b/build.sh index 3a3cbadfa..a5ea518e2 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,9 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 -DEPLOY_OUT=0 +if [ -z $DEPLOY_OUT ]; then + DEPLOY_OUT=0 +fi function print_help() { echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf_libs|copy_bootloader|mem_variant>] [config ...]" @@ -122,22 +124,19 @@ if [ "$BUILD_TYPE" != "all" ]; then fi rm -rf build sdkconfig out -echo "* Reconfigure Project" -idf.py reconfigure -rm -rf build sdkconfig # Add components version info -mkdir -p "$AR_TOOLS/sdk" && rm -rf version.txt && rm -rf "$AR_TOOLS/sdk/versions.txt" +mkdir -p "$AR_TOOLS/esp32-arduino-libs" && rm -rf version.txt && rm -rf "$AR_TOOLS/esp32-arduino-libs/versions.txt" 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) -echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/sdk/versions.txt" +echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" for component in `ls "$AR_COMPS"`; do if [ -d "$AR_COMPS/$component/.git" ] || [ -d "$AR_COMPS/$component/.github" ]; then 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) - echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/sdk/versions.txt" + echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" fi done 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) -echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/sdk/versions.txt" +echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do @@ -194,20 +193,23 @@ done # update package_esp32_index.template.json if [ "$BUILD_TYPE" = "all" ]; then python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" - if [ $? -ne 0 ]; then exit 1; fi -fi - -# archive the build -if [ "$BUILD_TYPE" = "all" ]; then - ./tools/archive-build.sh + python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -o "$TOOLS_JSON_OUT/" if [ $? -ne 0 ]; then exit 1; fi fi # copy everything to arduino-esp32 installation if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then ./tools/copy-to-arduino.sh + if [ $? -ne 0 ]; then exit 1; fi fi if [ $DEPLOY_OUT -eq 1 ]; then ./tools/push-to-arduino.sh + if [ $? -ne 0 ]; then exit 1; fi +fi + +# archive the build +if [ "$BUILD_TYPE" = "all" ]; then + ./tools/archive-build.sh + if [ $? -ne 0 ]; then exit 1; fi fi From d6c2e590f870541223f8f39312693f9e34294829 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:51:19 +0200 Subject: [PATCH 076/636] Update builds.json --- configs/builds.json | 58 ++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/configs/builds.json b/configs/builds.json index e6ed5e4b0..a6310ed90 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -6,6 +6,12 @@ "out":"lib/libspi_flash.a", "targets":["esp32","esp32c3","esp32s2","esp32s3"] }, + { + "file":"libesp_psram.a", + "src":"build/esp-idf/esp_psram/libesp_psram.a", + "out":"lib/libesp_psram.a", + "targets":["esp32s3"] + }, { "file":"libesp_system.a", "src":"build/esp-idf/esp_system/libesp_system.a", @@ -40,62 +46,80 @@ "targets":[ { "target": "esp32s3", - "features":[], - "idf_libs":["qio","80m","opi_ram"], + "features":["esp_sr"], + "idf_libs":["qio","80m","qio_ram"], "bootloaders":[ ["qio","120m","qio_ram"], ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], + ["dio","80m","qio_ram"], ["opi","80m","opi_ram"] ], "mem_variants":[ - ["qio","120m","qio_ram"], - ["qio","80m","qio_ram"], + ["qio","80m","opi_ram"], + ["dio","80m","qio_ram"], + ["dio","80m","opi_ram"], ["opi","80m","opi_ram"], ["opi","80m","qio_ram"] ] }, { "target": "esp32s2", - "features":["qio"], - "idf_libs":["dio","80m"], + "features":["qio_ram"], + "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], + ["qout","80m"], ["dio","80m"], + ["dout","80m"], ["qio","40m"], - ["dio","40m"] + ["qout","40m"], + ["dio","40m"], + ["dout","40m"] ], "mem_variants":[ - ["qio","80m"] + ["qout","80m"], + ["dio","80m"], + ["dout","80m"] ] }, { "target": "esp32c3", - "features":["qio"], - "idf_libs":["dio","80m"], + "features":[], + "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], + ["qout","80m"], ["dio","80m"], + ["dout","80m"], ["qio","40m"], - ["dio","40m"] + ["qout","40m"], + ["dio","40m"], + ["dout","40m"] ], "mem_variants":[ - ["qio","80m"] + ["qout","80m"], + ["dio","80m"], + ["dout","80m"] ] }, { "target": "esp32", - "features":["qio"], - "idf_libs":["dio","40m"], + "features":["qio_ram"], + "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], + ["qout","80m"], ["dio","80m"], + ["dout","80m"], ["qio","40m"], - ["dio","40m"] + ["qout","40m"], + ["dio","40m"], + ["dout","40m"] ], "mem_variants":[ + ["qout","80m"], ["dio","80m"], - ["qio","80m"] + ["dout","80m"] ] } ] From 2fba3bd1c830e790c74bfee80c5bda933736612c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:52:05 +0200 Subject: [PATCH 077/636] Update defconfig.esp32c3 --- configs/defconfig.esp32c3 | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 76f6b98d2..ced594733 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -1,31 +1,4 @@ -CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y -CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y +CONFIG_BT_BLE_BLUFI_ENABLE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 -# CONFIG_UNITY_ENABLE_FLOAT is not set -# CONFIG_UNITY_ENABLE_DOUBLE is not set -# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set -# CONFIG_VFS_SUPPORT_SELECT is not set -# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set -# CONFIG_VFS_SUPPORT_TERMIOS is not set From 5f862ab4ae8131cf1d87af0875a67f0ac47e7cec Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:52:39 +0200 Subject: [PATCH 078/636] Update defconfig.esp32s3 --- configs/defconfig.esp32s3 | 40 +-------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 1ea7cdf34..c8c563092 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,47 +1,9 @@ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y -CONFIG_ESP32_ULP_COPROC_RISCV=y -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4096 -CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y -CONFIG_BLE_MESH_TRACE_LEVEL_NONE=y -CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set -CONFIG_SR_WN_MODEL_WN8_QUANT=y -CONFIG_SR_WN_WN8_HIESP=y -CONFIG_SR_MN_ENGLISH=y -CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y -# CONFIG_UNITY_ENABLE_FLOAT is not set -# CONFIG_UNITY_ENABLE_DOUBLE is not set -# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set -CONFIG_SR_WN_MODEL_WN8_QUANT=y -CONFIG_SR_WN_WN8_HIESP=y -CONFIG_SR_MN_ENGLISH=y -CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y -# CONFIG_VFS_SUPPORT_SELECT is not set -# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set -# CONFIG_VFS_SUPPORT_TERMIOS is not set +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 From ac6400bf4f9503568f90d459a0a2cef15d39923e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:00:36 +0200 Subject: [PATCH 079/636] Update config.sh --- tools/config.sh | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index f7b61e1c6..c64c22592 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -16,8 +16,13 @@ fi # IDF commit to use #IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" +if [ -z $IDF_BRANCH ]; then + IDF_BRANCH="release/v5.1" +fi + if [ -z $AR_PR_TARGET_BRANCH ]; then - AR_PR_TARGET_BRANCH="master" + # Temporary to get CI working. original is master + AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" fi if [ -z $IDF_TARGET ]; then @@ -31,7 +36,7 @@ if [ -z $IDF_TARGET ]; then fi fi -# Owner of the ESP32 Arduino repository +# Owner of the target ESP32 Arduino repository AR_USER="tasmota" # The full name of the repository @@ -40,9 +45,14 @@ AR_REPO="$AR_USER/arduino-esp32" # Arduino branch to use AR_BRANCH="esp-idf-v5.1-libs" +# The full name of the repository +AR_REPO="$AR_USER/arduino-esp32" + AR_REPO_URL="https://github.com/$AR_REPO.git" +IDF_LIBS_REPO_URL="https://github.com/tasmota/esp32-arduino-libs.git" if [ -n $GITHUB_TOKEN ]; then AR_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_REPO.git" + IDF_LIBS_REPO_URL="https://$GITHUB_TOKEN@github.com/tasmota/esp32-arduino-libs.git" fi AR_ROOT="$PWD" @@ -51,6 +61,11 @@ AR_OUT="$AR_ROOT/out" AR_TOOLS="$AR_OUT/tools" AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" +AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET" +PIO_SDK="FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\"" +TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" +IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" + AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" if [ "$IDF_COMMIT" ]; then @@ -95,7 +110,7 @@ export SED="sed" export SSTAT="stat -c %s" if [[ "$AR_OS" == "macos" ]]; then - if ! [ -x "$(command -v gsed)" ]; then + if ! [ -x "$(command -v gsed)" ]; then echo "ERROR: gsed is not installed! Please install gsed first. ex. brew install gsed" exit 1 fi @@ -120,3 +135,29 @@ function git_branch_exists(){ # git_branch_exists <repo-path> <branch-name> local branch_found=`git -C "$repo_path" ls-remote --heads origin "$branch_name"` if [ -n "$branch_found" ]; then echo 1; else echo 0; fi } + +function git_pr_exists(){ # git_pr_exists <branch-name> + local pr_num=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$AR_REPO/pulls?head=$AR_USER:$1&state=open" | jq -r '.[].number'` + if [ ! "$pr_num" == "" ] && [ ! "$pr_num" == "null" ]; then echo 1; else echo 0; fi +} + +function git_create_pr(){ # git_create_pr <branch> <title> + local pr_branch="$1" + local pr_title="$2" + local pr_target="$3" + local pr_body="" + pr_body+="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)"\r\n" + for component in `ls "$AR_COMPS"`; do + if [ ! $component == "arduino" ]; then + if [ -d "$AR_COMPS/$component/.git" ] || [ -d "$AR_COMPS/$component/.github" ]; then + pr_body+="$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)"\r\n" + fi + fi + done + pr_body+="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)"\r\n" + local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" + 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"` + local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` + if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi +} + From 51fffdd3eb9d51a1cc4e1c1a5109f799bf3e30b4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:01:38 +0200 Subject: [PATCH 080/636] Update config.sh --- tools/config.sh | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 96d04d054..ffe63d20e 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -5,6 +5,17 @@ if [ -z $IDF_PATH ]; then export IDF_PATH="$PWD/esp-idf" fi +# The ESP32 IDF repository +IDF_REPO_URL="https://github.com/tasmota/esp-idf.git" + +# The IDF branch to use +if [ -z $IDF_BRANCH ]; then + IDF_BRANCH="release/v5.1" +fi + +# IDF commit to use +#IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" + if [ -z $IDF_BRANCH ]; then IDF_BRANCH="release/v5.1" fi @@ -26,16 +37,22 @@ if [ -z $IDF_TARGET ]; then fi # Owner of the target ESP32 Arduino repository -AR_USER="espressif" +AR_USER="tasmota" + +# The full name of the repository +AR_REPO="$AR_USER/arduino-esp32" + +# Arduino branch to use +AR_BRANCH="esp-idf-v5.1-libs" # The full name of the repository AR_REPO="$AR_USER/arduino-esp32" AR_REPO_URL="https://github.com/$AR_REPO.git" -IDF_LIBS_REPO_URL="https://github.com/espressif/esp32-arduino-libs.git" +IDF_LIBS_REPO_URL="https://github.com/tasmota/esp32-arduino-libs.git" if [ -n $GITHUB_TOKEN ]; then AR_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_REPO.git" - IDF_LIBS_REPO_URL="https://$GITHUB_TOKEN@github.com/espressif/esp32-arduino-libs.git" + IDF_LIBS_REPO_URL="https://$GITHUB_TOKEN@github.com/tasmota/esp32-arduino-libs.git" fi AR_ROOT="$PWD" @@ -49,6 +66,20 @@ PIO_SDK="FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\"" TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" +AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" + +if [ "$IDF_COMMIT" ]; then + echo "Using specific commit $IDF_COMMIT for IDF" + commit_predefined="1" +else + IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") +fi + +AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") + +rm -rf release-info.txt +echo "Framework built from IDF branch $IDF_BRANCH commit $IDF_COMMIT and $AR_REPO branch $AR_BRANCH commit $AR_COMMIT" >> release-info.txt + function get_os(){ OSBITS=`arch` if [[ "$OSTYPE" == "linux"* ]]; then @@ -129,4 +160,3 @@ function git_create_pr(){ # git_create_pr <branch> <title> local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi } - From e9db2118074dbd83e86e7103cfb6c6254cce09d0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:03:39 +0200 Subject: [PATCH 081/636] Update copy-to-arduino.sh --- tools/copy-to-arduino.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh index 5448c7bcb..96092e068 100755 --- a/tools/copy-to-arduino.sh +++ b/tools/copy-to-arduino.sh @@ -16,9 +16,8 @@ fi echo "Installing new libraries to $ESP32_ARDUINO" -rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py - +rm -rf $ESP32_ARDUINO/package/package_esp32_index.template.json && \ cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json -cp -Rf $AR_TOOLS/sdk $ESP32_ARDUINO/tools/ -cp -f $AR_TOOLS/gen_esp32part.py $ESP32_ARDUINO/tools/ -cp -f $AR_TOOLS/platformio-build-*.py $ESP32_ARDUINO/tools/ + +rm -rf $ESP32_ARDUINO/tools/esp32-arduino-libs && \ +cp -Rf $AR_TOOLS/esp32-arduino-libs $ESP32_ARDUINO/tools/ From 962cc5d06263e7f75e7571cf79b129dcca2bfa3a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:04:13 +0200 Subject: [PATCH 082/636] Update gen_tools_json.py --- tools/gen_tools_json.py | 86 +++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 28 deletions(-) diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py index 2544c69b1..ca53ec8cb 100644 --- a/tools/gen_tools_json.py +++ b/tools/gen_tools_json.py @@ -25,19 +25,28 @@ prog = 'gen_tools_json', description = 'Update Arduino package index with the tolls found in ESP-IDF') parser.add_argument('-i', '--esp-idf', dest='idf_path', required=True, help='Path to ESP-IDF') - parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=True, help='path to Arduino package json') + parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=False, help='path to Arduino package json') parser.add_argument('-o', '--out-path', dest='out_path', required=True, help='Output path to store the update package json') args = parser.parse_args() + simple_output = False + if args.arduino_json == None: + print('Source was not selected') + simple_output = True + else: + print('Source {0}.'.format(args.arduino_json)) + idf_path = args.idf_path; arduino_json = args.arduino_json; out_path = args.out_path; # settings - arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","riscv32-esp-elf","openocd-esp32"] + arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","xtensa-esp-elf-gdb","riscv32-esp-elf","riscv32-esp-elf-gdb","openocd-esp32"] # code start - farray = json.load(open(arduino_json)) + farray = {"packages":[{"platforms":[{"toolsDependencies":[]}],"tools":[]}]} + if simple_output == False: + farray = json.load(open(arduino_json)) idf_tools = json.load(open(idf_path + '/tools/tools.json')) for tool in idf_tools['tools']: @@ -51,21 +60,30 @@ tool_name += '-gcc' print('Found {0}, version: {1}'.format(tool_name, tool_version)) - dep_found = False - dep_skip = False - for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: - if dep['name'] == tool_name: - if dep['version'] == tool_version: - print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) - dep_skip = True - break - print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) - dep['version'] = tool_version - dep_found = True - if dep_skip == True: - continue - if dep_found == False: - print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) + if simple_output == False: + dep_found = False + dep_skip = False + for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: + if dep['name'] == tool_name: + if dep['version'] == tool_version: + print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) + dep_skip = True + break + print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) + dep['version'] = tool_version + dep_found = True + if dep_skip == True: + continue + if dep_found == False: + print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) + deps = { + "packager": "esp32", + "name": tool_name, + "version": tool_version + } + farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) + else: + print('Adding dependency: {0} version {1}'.format(tool_name, tool_version)) deps = { "packager": "esp32", "name": tool_name, @@ -111,15 +129,24 @@ systems.append(system) - tool_found = False - for t in farray['packages'][0]['tools']: - if t['name'] == tool_name: - t['version'] = tool_version - t['systems'] = systems - tool_found = True - print('Updating binaries of {0} to version {1}'.format(tool_name, tool_version)) - if tool_found == False: - print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) + if simple_output == False: + tool_found = False + for t in farray['packages'][0]['tools']: + if t['name'] == tool_name: + t['version'] = tool_version + t['systems'] = systems + tool_found = True + print('Updating binaries of {0} to version {1}'.format(tool_name, tool_version)) + if tool_found == False: + print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) + tools = { + "name": tool_name, + "version": tool_version, + "systems": systems + } + farray['packages'][0]['tools'].append(tools) + else: + print('Adding tool: {0} version {1}'.format(tool_name, tool_version)) tools = { "name": tool_name, "version": tool_version, @@ -128,7 +155,10 @@ farray['packages'][0]['tools'].append(tools) json_str = json.dumps(farray, indent=2) - out_file = out_path + os.path.basename(arduino_json) + out_file = out_path + "tools.json" + if simple_output == False: + out_file = out_path + os.path.basename(arduino_json) + with open(out_file, "w") as f: f.write(json_str+"\n") f.close() From dfd68131c7c0220618cb2dffb57978f66e8aad52 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:07:59 +0200 Subject: [PATCH 083/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 56 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 6ae1ccca0..590f33a11 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -20,6 +20,9 @@ fi if [ "$commit_predefined" ]; then echo "Use specified commit $IDF_COMMIT" git -C "$IDF_PATH" checkout "$IDF_COMMIT" +if [ "$IDF_TAG" ]; then + git -C "$IDF_PATH" checkout "tags/$IDF_TAG" + idf_was_installed="1" fi # @@ -35,7 +38,7 @@ fi # Arduino needs cam_hal.h from esp32-camera in include folder # # fix me, path is not correct -cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/components/esp32-camera/driver/include/" +#cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/components/esp32-camera/driver/include/" # # SETUP ESP-IDF ENV @@ -44,3 +47,54 @@ cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/componen source $IDF_PATH/export.sh export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) + +# +# SETUP ARDUINO DEPLOY +# + +if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "repository_dispatch" -a "$GITHUB_EVENT_ACTION" == "deploy" ]; then + # format new branch name and pr title + if [ -x $commit_predefined ]; then #commit was not specified at build time + AR_NEW_BRANCH_NAME="idf-$IDF_BRANCH" + AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT" + AR_NEW_PR_TITLE="IDF $IDF_BRANCH" + else + AR_NEW_BRANCH_NAME="idf-$IDF_COMMIT" + AR_NEW_COMMIT_MESSAGE="IDF $IDF_COMMIT" + AR_NEW_PR_TITLE="$AR_NEW_COMMIT_MESSAGE" + fi + LIBS_VERSION="idf-"${IDF_BRANCH//\//_}"-$IDF_COMMIT" + + AR_HAS_COMMIT=`git_commit_exists "$AR_COMPS/arduino" "$AR_NEW_COMMIT_MESSAGE"` + AR_HAS_BRANCH=`git_branch_exists "$AR_COMPS/arduino" "$AR_NEW_BRANCH_NAME"` + AR_HAS_PR=`git_pr_exists "$AR_NEW_BRANCH_NAME"` + + LIBS_HAS_COMMIT=`git_commit_exists "$IDF_LIBS_DIR" "$AR_NEW_COMMIT_MESSAGE"` + LIBS_HAS_BRANCH=`git_branch_exists "$IDF_LIBS_DIR" "$AR_NEW_BRANCH_NAME"` + + if [ "$LIBS_HAS_COMMIT" == "1" ]; then + echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in esp32-arduino-libs" + mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in esp32-arduino-libs" > dist/log.txt + fi + + if [ "$AR_HAS_COMMIT" == "1" ]; then + echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in arduino-esp32" + mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in arduino-esp32" > dist/log.txt + fi + + if [ "$LIBS_HAS_COMMIT" == "1" ] && [ "$AR_HAS_COMMIT" == "1" ]; then + exit 0 + fi + + export AR_NEW_BRANCH_NAME + export AR_NEW_COMMIT_MESSAGE + export AR_NEW_PR_TITLE + + export AR_HAS_COMMIT + export AR_HAS_BRANCH + export AR_HAS_PR + + export LIBS_VERSION + export LIBS_HAS_COMMIT + export LIBS_HAS_BRANCH +fi From 33a58afad61814f1ea02c0c077d47227da46b42e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:09:10 +0200 Subject: [PATCH 084/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index ec73eb4ee..590f33a11 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -11,19 +11,18 @@ fi # CLONE ESP-IDF # -IDF_REPO_URL="https://github.com/espressif/esp-idf.git" if [ ! -d "$IDF_PATH" ]; then - echo "ESP-IDF is not installed! Installing local copy" + echo "ESP-IDF is not installed! Installing from $IDF_REPO_URL branch $IDF_BRANCH" git clone $IDF_REPO_URL -b $IDF_BRANCH idf_was_installed="1" fi +if [ "$commit_predefined" ]; then + echo "Use specified commit $IDF_COMMIT" + git -C "$IDF_PATH" checkout "$IDF_COMMIT" if [ "$IDF_TAG" ]; then git -C "$IDF_PATH" checkout "tags/$IDF_TAG" idf_was_installed="1" -elif [ "$IDF_COMMIT" ]; then - git -C "$IDF_PATH" checkout "$IDF_COMMIT" - commit_predefined="1" fi # @@ -35,6 +34,12 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then $IDF_PATH/install.sh fi +# +# Arduino needs cam_hal.h from esp32-camera in include folder +# +# fix me, path is not correct +#cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/components/esp32-camera/driver/include/" + # # SETUP ESP-IDF ENV # From d9868de81827c84ff8272df164a11ecd57d77182 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:10:28 +0200 Subject: [PATCH 085/636] Create push-to-arduino.sh --- tools/push-to-arduino.sh | 204 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 tools/push-to-arduino.sh diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh new file mode 100644 index 000000000..d66e7c3c1 --- /dev/null +++ b/tools/push-to-arduino.sh @@ -0,0 +1,204 @@ +#!/bin/bash +source ./tools/config.sh + +if [ -x $GITHUB_TOKEN ]; then + echo "ERROR: GITHUB_TOKEN was not defined" + exit 1 +fi + +if ! [ -d "$AR_COMPS/arduino" ]; then + echo "ERROR: Target arduino folder does not exist!" + exit 1 +fi + +# setup git for pushing +git config --global github.user "$GITHUB_ACTOR" +git config --global user.name "$GITHUB_ACTOR" +git config --global user.email "$GITHUB_ACTOR@github.com" + +# +# UPDATE FILES +# + +# if [ $AR_HAS_COMMIT == "0" ]; then +# # create or checkout the branch +# if [ ! $AR_HAS_BRANCH == "0" ]; then +# echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." +# git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME +# else +# echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." +# git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME +# fi +# if [ $? -ne 0 ]; then +# echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" +# exit 1 +# fi + +# # make changes to the files +# echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." +# ESP32_ARDUINO="$AR_COMPS/arduino" ./tools/copy-to-arduino.sh + +# cd $AR_COMPS/arduino + +# # did any of the files change? +# if [ -n "$(git status --porcelain)" ]; then +# echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..." +# git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME +# if [ $? -ne 0 ]; then +# echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" +# exit 1 +# fi +# else +# echo "No changes in branch '$AR_NEW_BRANCH_NAME'" +# if [ $AR_HAS_BRANCH == "0" ]; then +# echo "Delete created branch '$AR_NEW_BRANCH_NAME'" +# git branch -d $AR_NEW_BRANCH_NAME +# fi +# exit 0 +# fi + +# # CREATE PULL REQUEST +# if [ "$AR_HAS_PR" == "0" ]; then +# echo "Creating PR '$AR_NEW_PR_TITLE'..." +# pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` +# if [ $pr_created == "0" ]; then +# 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'` +# exit 1 +# fi +# else +# echo "PR '$AR_NEW_PR_TITLE' Already Exists" +# fi +# fi + +# +# esp32-arduino-libs +# + +if [ $LIBS_HAS_COMMIT == "0" ]; then + cd "$AR_ROOT" + # create branch if necessary + if [ "$LIBS_HAS_BRANCH" == "1" ]; then + echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists" + echo "Switching to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + git -C "$IDF_LIBS_DIR" checkout $AR_NEW_BRANCH_NAME + else + echo "Creating esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + git -C "$IDF_LIBS_DIR" checkout -b $AR_NEW_BRANCH_NAME + fi + if [ $? -ne 0 ]; then + echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + + # make changes to the files + echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + rm -rf $IDF_LIBS_DIR/* && cp -Rf $AR_TOOLS/esp32-arduino-libs/* $IDF_LIBS_DIR/ + + cd $IDF_LIBS_DIR + if [ -f "README.md" ]; then + rm -rf "README.md" + fi + + # did any of the files change? + if [ -n "$(git status --porcelain)" ]; then + echo "Pushing changes to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..." + git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME + if [ $? -ne 0 ]; then + echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + IDF_LIBS_COMMIT=`git rev-parse --verify HEAD` + IDF_LIBS_DL_URL="https://codeload.github.com/espressif/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT" + # ToDo: this URL needs to get into Arduino's package.json + + # Download the file + filename="esp32-arduino-libs-$IDF_LIBS_COMMIT.zip" + curl -s -o "$filename" "$IDF_LIBS_DL_URL" + + # Check if the download was successful + if [ $? -ne 0 ]; then + echo "Error downloading file from $IDF_LIBS_DL_URL" + exit 1 + fi + + # Calculate the size in bytes and SHA-256 sum + size=$(stat -c%s "$filename") + sha256sum=$(sha256sum "$filename" | awk '{print $1}') + + # Clean up the downloaded file + rm "$filename" + + # Print the results + echo "Tool: esp32-arduino-libs" + echo "Version: $LIBS_VERSION" + echo "URL: $IDF_LIBS_DL_URL" + echo "File: $filename" + echo "Size: $size bytes" + echo "SHA-256: $sha256sum" + echo "JSON: $AR_OUT/package_esp32_index.template.json" + cd "$AR_ROOT" + 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" + if [ $? -ne 0 ]; then exit 1; fi + + else + echo "No changes in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'" + if [ $LIBS_HAS_BRANCH == "0" ]; then + echo "Delete created branch '$AR_NEW_BRANCH_NAME'" + git branch -d $AR_NEW_BRANCH_NAME + fi + exit 0 + fi +fi + +if [ $AR_HAS_COMMIT == "0" ]; then + cd "$AR_ROOT" + # create or checkout the branch + if [ ! $AR_HAS_BRANCH == "0" ]; then + echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." + git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME + else + echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." + git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME + fi + if [ $? -ne 0 ]; then + echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + + # make changes to the files + echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." + 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" + + cd $AR_COMPS/arduino + + # did any of the files change? + if [ -n "$(git status --porcelain)" ]; then + echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..." + git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME + if [ $? -ne 0 ]; then + echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" + exit 1 + fi + else + echo "No changes in branch '$AR_NEW_BRANCH_NAME'" + if [ $AR_HAS_BRANCH == "0" ]; then + echo "Delete created branch '$AR_NEW_BRANCH_NAME'" + git branch -d $AR_NEW_BRANCH_NAME + fi + exit 0 + fi + + # CREATE PULL REQUEST + if [ "$AR_HAS_PR" == "0" ]; then + echo "Creating PR '$AR_NEW_PR_TITLE'..." + pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` + if [ $pr_created == "0" ]; then + 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'` + exit 1 + fi + else + echo "PR '$AR_NEW_PR_TITLE' Already Exists" + fi +fi + +exit 0 From 73c06df66a5e20564cba294e8438b573db00cd1e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:12:07 +0200 Subject: [PATCH 086/636] Create repository_dispatch.sh --- tools/repository_dispatch.sh | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tools/repository_dispatch.sh diff --git a/tools/repository_dispatch.sh b/tools/repository_dispatch.sh new file mode 100644 index 000000000..15198e98e --- /dev/null +++ b/tools/repository_dispatch.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +if [ ! "$GITHUB_EVENT_NAME" == "repository_dispatch" ]; then + echo "Wrong event '$GITHUB_EVENT_NAME'!" + exit 1 +fi + +EVENT_JSON=`cat "$GITHUB_EVENT_PATH"` +action=`echo "$EVENT_JSON" | jq -r '.action'` +payload=`echo "$EVENT_JSON" | jq -r '.client_payload'` +branch=`echo "$payload" | jq -r '.branch'` +tag=`echo "$payload" | jq -r '.tag'` +commit=`echo "$payload" | jq -r '.commit'` +builder=`echo "$payload" | jq -r '.builder'` +arduino=`echo "$payload" | jq -r '.arduino'` + +echo "Action: $action, Branch: $branch, Tag: $tag, Commit: $commit, Builder: $builder, Arduino: $arduino, Actor: $GITHUB_ACTOR" + +if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then + echo "Bad Action $action" + exit 1 +fi + +export GITHUB_EVENT_ACTION="$action" + +if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then + export IDF_COMMIT="$commit" +else + commit="" + if [ ! "$tag" == "" ] && [ ! "$tag" == "null" ]; then + export IDF_TAG="$tag" + elif [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then + export IDF_BRANCH="$branch" + fi +fi + +if [ ! "$builder" == "" ] && [ ! "$builder" == "null" ]; then + git checkout "$builder" +fi + +if [ ! "$arduino" == "" ] && [ ! "$arduino" == "null" ]; then + export AR_BRANCH="$arduino" +fi + +if [ "$action" == "deploy" ]; then + DEPLOY_OUT=1 +fi + +source ./build.sh + +# if [ "$action" == "deploy" ]; then +# bash ./tools/push-to-arduino.sh +# fi From 49c3d17c93fcd0d70ef14841988e8a163e738004 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:14:20 +0200 Subject: [PATCH 087/636] Update update-components.sh --- tools/update-components.sh | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index f6cf986e8..59175bde8 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -5,8 +5,6 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" DL_REPO_URL="https://github.com/espressif/esp-dl.git" SR_REPO_URL="https://github.com/espressif/esp-sr.git" -RMAKER_REPO_URL="https://github.com/espressif/esp-rainmaker.git" -INSIGHTS_REPO_URL="https://github.com/espressif/esp-insights.git" DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" @@ -121,34 +119,6 @@ else fi if [ $? -ne 0 ]; then exit 1; fi -# -# CLONE/UPDATE ESP-RAINMAKER -# -echo "Updating ESP-RainMaker..." -if [ ! -d "$AR_COMPS/esp-rainmaker" ]; then - git clone $RMAKER_REPO_URL "$AR_COMPS/esp-rainmaker" && \ - git -C "$AR_COMPS/esp-rainmaker" submodule update --init --recursive -else - git -C "$AR_COMPS/esp-rainmaker" fetch && \ - git -C "$AR_COMPS/esp-rainmaker" pull --ff-only && \ - git -C "$AR_COMPS/esp-rainmaker" submodule update --init --recursive -fi -if [ $? -ne 0 ]; then exit 1; fi - -# -# CLONE/UPDATE ESP-INSIGHTS -# -echo "Updating ESP-Insights..." -if [ ! -d "$AR_COMPS/esp-insights" ]; then - git clone $INSIGHTS_REPO_URL "$AR_COMPS/esp-insights" && \ - git -C "$AR_COMPS/esp-insights" submodule update --init --recursive -else - git -C "$AR_COMPS/esp-insights" fetch && \ - git -C "$AR_COMPS/esp-insights" pull --ff-only && \ - git -C "$AR_COMPS/esp-insights" submodule update --init --recursive -fi -if [ $? -ne 0 ]; then exit 1; fi - # # CLONE/UPDATE ESP-LITTLEFS # @@ -174,4 +144,3 @@ else git -C "$AR_COMPS/arduino_tinyusb/tinyusb" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi - From 6d440a6ed480ccec8f5bc24dade517ea1110a24b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:14:37 +0200 Subject: [PATCH 088/636] Update update-components.sh --- tools/update-components.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/update-components.sh b/tools/update-components.sh index d4796c942..59175bde8 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -54,6 +54,19 @@ if [ "$AR_BRANCH" ]; then fi if [ $? -ne 0 ]; then exit 1; fi +# +# CLONE/UPDATE ESP32-ARDUINO-LIBS +# +if [ ! -d "$IDF_LIBS_DIR" ]; then + echo "Cloning esp32-arduino-libs..." + git clone "$IDF_LIBS_REPO_URL" "$IDF_LIBS_DIR" +else + echo "Updating esp32-arduino-libs..." + git -C "$IDF_LIBS_DIR" fetch && \ + git -C "$IDF_LIBS_DIR" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi + # # CLONE/UPDATE ESP32-CAMERA # From c0bde1c5390aa1746c80922c70221df55e88211b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:24:29 +0200 Subject: [PATCH 089/636] Update config.sh --- tools/config.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index ffe63d20e..c365fb4f7 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -70,7 +70,6 @@ AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" if [ "$IDF_COMMIT" ]; then echo "Using specific commit $IDF_COMMIT for IDF" - commit_predefined="1" else IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") fi From 88b64eace33942f6c9bfeeb4cacc437d46b93997 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:26:29 +0200 Subject: [PATCH 090/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 590f33a11..e25257584 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -17,12 +17,12 @@ if [ ! -d "$IDF_PATH" ]; then idf_was_installed="1" fi -if [ "$commit_predefined" ]; then - echo "Use specified commit $IDF_COMMIT" - git -C "$IDF_PATH" checkout "$IDF_COMMIT" if [ "$IDF_TAG" ]; then git -C "$IDF_PATH" checkout "tags/$IDF_TAG" idf_was_installed="1" +elif [ "$IDF_COMMIT" ]; then + git -C "$IDF_PATH" checkout "$IDF_COMMIT" + commit_predefined="1" fi # From ae98cbdfb91e5ebb2a609051af65cea70cb7d70f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 21:30:24 +0200 Subject: [PATCH 091/636] DEPLOY_OUT=1 --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index a5ea518e2..8357d3abf 100755 --- a/build.sh +++ b/build.sh @@ -14,6 +14,7 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 +DEPLOY_OUT=1 if [ -z $DEPLOY_OUT ]; then DEPLOY_OUT=0 fi From a2fbacf4f619784d80ddf56290bccb9d2c6761ef Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 21:33:15 +0200 Subject: [PATCH 092/636] Update archive-build.sh --- tools/archive-build.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index f3ba888c0..7bdd662d7 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -12,7 +12,7 @@ pio_zip_archive_path="dist/framework-arduinoespressif32-$idf_version_string.zip" mkdir -p dist && rm -rf "$archive_path" "$build_archive_path" cd out -echo "Creating framework-arduinoespressif32" +echo "Creating PlatformIO Tasmota framework-arduinoespressif32" cp -rf ../components/arduino arduino-esp32 rm -rf arduino-esp32/docs rm -rf arduino-esp32/tests @@ -26,14 +26,16 @@ rm -rf arduino-esp32/tools/gen_insights_package.py rm -rf arduino-esp32/tools/gen_insights_package.exe rm -rf arduino-esp32/tools/platformio-build-*.py rm -rf arduino-esp32/platform.txt +rm -rf arduino-esp32/programmers.txt +rm -rf arduino-esp32/boards.txt rm -rf arduino-esp32/package.json -cp -f platform.txt arduino-esp32/ -cp -Rf tools/sdk arduino-esp32/tools/ +rm -rf arduino-esp32/*.md +mv -f tools/esp32-arduino-libs/platformio-build-*.py arduino-esp32/tools/ cp -f tools/gen_esp32part.py arduino-esp32/tools/ -cp -f tools/platformio-build-*.py arduino-esp32/tools/ +cp -Rf tools/esp32-arduino-libs/ arduino-esp32/tools/sdk cp ../package.json arduino-esp32/package.json cp ../core_version.h arduino-esp32/cores/esp32/core_version.h mv arduino-esp32/ framework-arduinoespressif32/ -# If the framework is as tar.gz is needed uncomment next line +# If the framework is needed as tar.gz uncomment next line # tar --exclude=.* -zcf ../$pio_archive_path framework-arduinoespressif32/ 7z a -mx=9 -tzip -xr'!.*' ../$pio_zip_archive_path framework-arduinoespressif32/ From c39b659d12b1d77e53571895486d26aac7b5ae50 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 22:38:45 +0200 Subject: [PATCH 093/636] Update build.sh --- build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sh b/build.sh index 8357d3abf..a5ea518e2 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,6 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 -DEPLOY_OUT=1 if [ -z $DEPLOY_OUT ]; then DEPLOY_OUT=0 fi From 3429cb398d74888492f9e94ccf22b216e6f5c230 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 22:44:45 +0200 Subject: [PATCH 094/636] Update push-to-arduino.sh --- tools/push-to-arduino.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index d66e7c3c1..6b134429f 100644 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -108,7 +108,7 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then exit 1 fi IDF_LIBS_COMMIT=`git rev-parse --verify HEAD` - IDF_LIBS_DL_URL="https://codeload.github.com/espressif/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT" + IDF_LIBS_DL_URL="https://codeload.github.com/tasmota/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT" # ToDo: this URL needs to get into Arduino's package.json # Download the file From 4133167e883d0fb26765958b4a6009a0b8ab3223 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 17 Apr 2023 23:14:49 +0200 Subject: [PATCH 095/636] Update push.yml --- .github/workflows/push.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2b6b8848a..26dbd4015 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -17,8 +17,6 @@ jobs: run: bash ./tools/prepare-ci.sh - name: Build Arduino Libs run: bash ./build.sh - - name: Display files - run: ls -R ./* - name: Release uses: jason2866/action-gh-release@v1.2 with: From 75d21b4418d9848a59c47830351bde93099cf290 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:05:29 +0200 Subject: [PATCH 096/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index c365fb4f7..8ddbb45d4 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -62,7 +62,7 @@ AR_TOOLS="$AR_OUT/tools" AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET" -PIO_SDK="FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\"" +PIO_SDK="FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\"" TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" From 5aaf2c6e8bd80e007285aa80b4f5d072f4476754 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:10:17 +0200 Subject: [PATCH 097/636] Update copy-libs.sh --- tools/copy-libs.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 32992d624..0124162eb 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -36,8 +36,8 @@ fi if [ -e "$AR_SDK/$MEMCONF" ]; then rm -rf "$AR_SDK/$MEMCONF" fi -if [ -e "$AR_SDK/platformio-build.py" ]; then - rm -rf "$AR_SDK/platformio-build.py" +if [ -e "$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET/platformio-build-*.py" ]; then + rm -rf "$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET/platformio-build-*.py" fi mkdir -p "$AR_SDK" @@ -282,7 +282,7 @@ done mkdir -p "$AR_SDK" # start generation of platformio-build.py -AR_PLATFORMIO_PY="$AR_SDK/platformio-build.py" +AR_PLATFORMIO_PY="$AR_TOOLS/esp32-arduino-libs/platformio-build-$IDF_TARGET.py" cat configs/pio_start.txt > "$AR_PLATFORMIO_PY" echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY" From a36bc33a7f397cbffab40319bcd084132ba84b38 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:19:52 +0200 Subject: [PATCH 098/636] decrease mem build variants --- configs/builds.json | 46 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/configs/builds.json b/configs/builds.json index a6310ed90..8ef8cf83e 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -47,17 +47,16 @@ { "target": "esp32s3", "features":["esp_sr"], - "idf_libs":["qio","80m","qio_ram"], + "idf_libs":["qio","80m","opi_ram"], "bootloaders":[ ["qio","120m","qio_ram"], ["qio","80m","qio_ram"], - ["dio","80m","qio_ram"], + ["qio","80m","opi_ram"], ["opi","80m","opi_ram"] ], "mem_variants":[ - ["qio","80m","opi_ram"], - ["dio","80m","qio_ram"], - ["dio","80m","opi_ram"], + ["qio","120m","qio_ram"], + ["qio","80m","qio_ram"], ["opi","80m","opi_ram"], ["opi","80m","qio_ram"] ] @@ -65,61 +64,44 @@ { "target": "esp32s2", "features":["qio_ram"], - "idf_libs":["qio","80m"], + "idf_libs":["dio","80m"], "bootloaders":[ ["qio","80m"], - ["qout","80m"], ["dio","80m"], - ["dout","80m"], ["qio","40m"], - ["qout","40m"], - ["dio","40m"], - ["dout","40m"] + ["dio","40m"] ], "mem_variants":[ - ["qout","80m"], - ["dio","80m"], - ["dout","80m"] + ["qio","80m"] ] }, { "target": "esp32c3", - "features":[], - "idf_libs":["qio","80m"], + "features":["qio_ram"], + "idf_libs":["dio","80m"], "bootloaders":[ ["qio","80m"], - ["qout","80m"], ["dio","80m"], - ["dout","80m"], ["qio","40m"], - ["qout","40m"], - ["dio","40m"], - ["dout","40m"] + ["dio","40m"] ], "mem_variants":[ - ["qout","80m"], - ["dio","80m"], - ["dout","80m"] + ["qio","80m"] ] }, { "target": "esp32", "features":["qio_ram"], - "idf_libs":["qio","80m"], + "idf_libs":["dio","40m"], "bootloaders":[ ["qio","80m"], - ["qout","80m"], ["dio","80m"], - ["dout","80m"], ["qio","40m"], - ["qout","40m"], - ["dio","40m"], - ["dout","40m"] + ["dio","40m"] ], "mem_variants":[ - ["qout","80m"], ["dio","80m"], - ["dout","80m"] + ["qio","80m"] ] } ] From c422fb86e8dcc635abb123f02842430ed9ea24a7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 12:53:28 +0200 Subject: [PATCH 099/636] fix path --- tools/config.sh | 2 -- tools/install-esp-idf.sh | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 8ddbb45d4..a1089190c 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -66,8 +66,6 @@ PIO_SDK="FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\"" TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" -AR_SDK="$AR_TOOLS/sdk/$IDF_TARGET" - if [ "$IDF_COMMIT" ]; then echo "Using specific commit $IDF_COMMIT for IDF" else diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index e25257584..39bc95408 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -37,8 +37,7 @@ fi # # Arduino needs cam_hal.h from esp32-camera in include folder # -# fix me, path is not correct -#cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$IDF_PATH/components/esp32-camera/driver/include/" +cp "AR_COMPS$/esp32-camera/driver/private_include/cam_hal.h" "AR_COMPS$/esp32-camera/driver/include/" # # SETUP ESP-IDF ENV From cd04574c87a96728070c92af3f36829b2ccd13e7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 14:37:01 +0200 Subject: [PATCH 100/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index a1089190c..6d17b7056 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -62,7 +62,7 @@ AR_TOOLS="$AR_OUT/tools" AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET" -PIO_SDK="FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\"" +PIO_SDK="FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\"" TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" From e94142e0dc02bf57156d079d8cf2696635f1ac02 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 14:47:42 +0200 Subject: [PATCH 101/636] Update archive-build.sh --- tools/archive-build.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 7bdd662d7..e9bfe9c37 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -19,20 +19,18 @@ rm -rf arduino-esp32/tests rm -rf arduino-esp32/libraries/RainMaker rm -rf arduino-esp32/libraries/Insights rm -rf arduino-esp32/package -rm -rf arduino-esp32/tools/sdk +rm -rf arduino-esp32/tools/esp32-arduino-libs rm -rf arduino-esp32/tools/esptool.py rm -rf arduino-esp32/tools/gen_esp32part.py rm -rf arduino-esp32/tools/gen_insights_package.py rm -rf arduino-esp32/tools/gen_insights_package.exe -rm -rf arduino-esp32/tools/platformio-build-*.py rm -rf arduino-esp32/platform.txt rm -rf arduino-esp32/programmers.txt rm -rf arduino-esp32/boards.txt rm -rf arduino-esp32/package.json rm -rf arduino-esp32/*.md -mv -f tools/esp32-arduino-libs/platformio-build-*.py arduino-esp32/tools/ cp -f tools/gen_esp32part.py arduino-esp32/tools/ -cp -Rf tools/esp32-arduino-libs/ arduino-esp32/tools/sdk +cp -Rf tools/esp32-arduino-libs arduino-esp32/tools/ cp ../package.json arduino-esp32/package.json cp ../core_version.h arduino-esp32/cores/esp32/core_version.h mv arduino-esp32/ framework-arduinoespressif32/ From 2c05ddbbadac30ffa5c0e714668be903803aec2c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 14:57:48 +0200 Subject: [PATCH 102/636] Update copy-libs.sh --- tools/copy-libs.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 0124162eb..32992d624 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -36,8 +36,8 @@ fi if [ -e "$AR_SDK/$MEMCONF" ]; then rm -rf "$AR_SDK/$MEMCONF" fi -if [ -e "$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET/platformio-build-*.py" ]; then - rm -rf "$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET/platformio-build-*.py" +if [ -e "$AR_SDK/platformio-build.py" ]; then + rm -rf "$AR_SDK/platformio-build.py" fi mkdir -p "$AR_SDK" @@ -282,7 +282,7 @@ done mkdir -p "$AR_SDK" # start generation of platformio-build.py -AR_PLATFORMIO_PY="$AR_TOOLS/esp32-arduino-libs/platformio-build-$IDF_TARGET.py" +AR_PLATFORMIO_PY="$AR_SDK/platformio-build.py" cat configs/pio_start.txt > "$AR_PLATFORMIO_PY" echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY" From 21578619c5c89571c4eab0ef32a6156c506ca8d0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 15:08:42 +0200 Subject: [PATCH 103/636] Update archive-build.sh --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index e9bfe9c37..1afc8268a 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -21,6 +21,7 @@ rm -rf arduino-esp32/libraries/Insights rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs rm -rf arduino-esp32/tools/esptool.py +rm -rf arduino-esp32/tools/ide-debug rm -rf arduino-esp32/tools/gen_esp32part.py rm -rf arduino-esp32/tools/gen_insights_package.py rm -rf arduino-esp32/tools/gen_insights_package.exe From d27acba92b2a86773024f07b27b13acc7d1bf946 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 16:12:52 +0200 Subject: [PATCH 104/636] Update archive-build.sh --- tools/archive-build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 1afc8268a..402aab5da 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -22,7 +22,6 @@ rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs rm -rf arduino-esp32/tools/esptool.py rm -rf arduino-esp32/tools/ide-debug -rm -rf arduino-esp32/tools/gen_esp32part.py rm -rf arduino-esp32/tools/gen_insights_package.py rm -rf arduino-esp32/tools/gen_insights_package.exe rm -rf arduino-esp32/platform.txt @@ -30,7 +29,6 @@ rm -rf arduino-esp32/programmers.txt rm -rf arduino-esp32/boards.txt rm -rf arduino-esp32/package.json rm -rf arduino-esp32/*.md -cp -f tools/gen_esp32part.py arduino-esp32/tools/ cp -Rf tools/esp32-arduino-libs arduino-esp32/tools/ cp ../package.json arduino-esp32/package.json cp ../core_version.h arduino-esp32/cores/esp32/core_version.h From 15d19d921e6d43d0ebfa439d1cd2159e59ea3207 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 18:15:05 +0200 Subject: [PATCH 105/636] Update README.md --- README.md | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 27584c82c..fc6179237 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,29 @@ -# ESP32 Arduino Lib Builder [![Build Status](https://travis-ci.org/espressif/esp32-arduino-lib-builder.svg?branch=master)](https://travis-ci.org/espressif/esp32-arduino-lib-builder) +# 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) -This repository contains the scripts that produce the libraries included with esp32-arduino. +This repository contains the scripts that produce the libraries included with Tasmota esp32-arduino. -Tested on Ubuntu (32 and 64 bit), Raspberry Pi and MacOS. - -### Build on Ubuntu and Raspberry Pi +### Build on Ubuntu ```bash -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 -sudo pip install --upgrade pip -git clone https://github.com/espressif/esp32-arduino-lib-builder +sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache jq p7zip-full +sudo pip3 install --upgrade pip3 +git clone https://github.com/Jason2866/esp32-arduino-lib-builder cd esp32-arduino-lib-builder ./build.sh ``` +### Development builds +Look in release and download a version. There is the Info of the used commits of IDF / Arduino. + +### Stable Platformio Platform release including ESP32solo1 +based on Arduino Core 2.0.7 and can be used with Platformio for the ESP32/ESP32solo1, ESP32C3, ESP32S2 and ESP32S3 +``` +[platformio] +platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.02.00/platform-espressif32.zip +framework = arduino, espidf +``` +to use the ESP32 Solo1 Arduino framework add in your env +``` +[env:esp32solo1] +board = every esp32 board can be used +build_flags = -DFRAMEWORK_ARDUINO_SOLO1 +``` +The frameworks are here [https://github.com/tasmota/arduino-esp32/releases](https://github.com/tasmota/arduino-esp32/releases) From 77c0e6ae988dc51969fe3081de4d3009c0cf03c8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Apr 2023 18:16:02 +0200 Subject: [PATCH 106/636] Update README.md --- README.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/README.md b/README.md index fc6179237..6e94b2775 100644 --- a/README.md +++ b/README.md @@ -12,18 +12,3 @@ cd esp32-arduino-lib-builder ``` ### Development builds Look in release and download a version. There is the Info of the used commits of IDF / Arduino. - -### Stable Platformio Platform release including ESP32solo1 -based on Arduino Core 2.0.7 and can be used with Platformio for the ESP32/ESP32solo1, ESP32C3, ESP32S2 and ESP32S3 -``` -[platformio] -platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.02.00/platform-espressif32.zip -framework = arduino, espidf -``` -to use the ESP32 Solo1 Arduino framework add in your env -``` -[env:esp32solo1] -board = every esp32 board can be used -build_flags = -DFRAMEWORK_ARDUINO_SOLO1 -``` -The frameworks are here [https://github.com/tasmota/arduino-esp32/releases](https://github.com/tasmota/arduino-esp32/releases) From 418569cbc893797a6eebf70eaf5fd9b4fda7e1df Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 19 Apr 2023 15:47:14 +0200 Subject: [PATCH 107/636] Update config.sh --- tools/config.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 6d17b7056..bb077da91 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -16,10 +16,6 @@ fi # IDF commit to use #IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" -if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v5.1" -fi - if [ -z $AR_PR_TARGET_BRANCH ]; then # Temporary to get CI working. original is master AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" From 4e9db6158125bb3ec7c0481c431e28e69e383c66 Mon Sep 17 00:00:00 2001 From: Luca Burelli <pil@iol.it> Date: Wed, 19 Apr 2023 23:41:48 +0200 Subject: [PATCH 108/636] arduino_tinyusb: compile support for DFU mode (#116) --- components/arduino_tinyusb/CMakeLists.txt | 1 + components/arduino_tinyusb/Kconfig.projbuild | 25 +++++++++++++++++++ .../arduino_tinyusb/include/tusb_config.h | 8 ++++++ 3 files changed, 34 insertions(+) diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index 0872021eb..97591440f 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -28,6 +28,7 @@ if(CONFIG_TINYUSB_ENABLED) "${COMPONENT_DIR}/tinyusb/src/class/msc/msc_device.c" "${COMPONENT_DIR}/tinyusb/src/class/video/video_device.c" "${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_rt_device.c" + "${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_device.c" "${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_device.c" "${COMPONENT_DIR}/tinyusb/src/common/tusb_fifo.c" "${COMPONENT_DIR}/tinyusb/src/device/usbd_control.c" diff --git a/components/arduino_tinyusb/Kconfig.projbuild b/components/arduino_tinyusb/Kconfig.projbuild index a6abd4d8a..80983657f 100755 --- a/components/arduino_tinyusb/Kconfig.projbuild +++ b/components/arduino_tinyusb/Kconfig.projbuild @@ -175,6 +175,31 @@ menu "Arduino TinyUSB" endmenu + menu "DFU driver" + depends on TINYUSB_ENABLED + + config TINYUSB_DFU_ENABLED + bool "Enable USB DFU TinyUSB driver" + default y + help + Enable USB DFU TinyUSB driver. + + config TINYUSB_DESC_DFU_STRING + string "DFU Device String" + default "Espressif DFU Device" + depends on TINYUSB_DFU_ENABLED + help + Specify name of the DFU device + + config TINYUSB_DFU_BUFSIZE + int "DFU buffer size" + default 4096 + depends on TINYUSB_DFU_ENABLED + help + DFU buffer size + + endmenu + menu "VENDOR driver" depends on TINYUSB_ENABLED diff --git a/components/arduino_tinyusb/include/tusb_config.h b/components/arduino_tinyusb/include/tusb_config.h index a5a0afd32..ee1e5d270 100755 --- a/components/arduino_tinyusb/include/tusb_config.h +++ b/components/arduino_tinyusb/include/tusb_config.h @@ -64,6 +64,10 @@ extern "C" { # define CONFIG_TINYUSB_DFU_RT_ENABLED 0 #endif +#ifndef CONFIG_TINYUSB_DFU_ENABLED +# define CONFIG_TINYUSB_DFU_ENABLED 0 +#endif + #ifndef CONFIG_TINYUSB_VENDOR_ENABLED # define CONFIG_TINYUSB_VENDOR_ENABLED 0 #endif @@ -106,6 +110,7 @@ extern "C" { #define CFG_TUD_VIDEO CONFIG_TINYUSB_VIDEO_ENABLED #define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED #define CFG_TUD_DFU_RUNTIME CONFIG_TINYUSB_DFU_RT_ENABLED +#define CFG_TUD_DFU CONFIG_TINYUSB_DFU_ENABLED #define CFG_TUD_VENDOR CONFIG_TINYUSB_VENDOR_ENABLED // CDC FIFO size of TX and RX @@ -126,6 +131,9 @@ extern "C" { #define CFG_TUD_VIDEO_STREAMING CONFIG_TINYUSB_VIDEO_STREAMING_IFS #define CFG_TUD_VIDEO_STREAMING_EP_BUFSIZE CONFIG_TINYUSB_VIDEO_STREAMING_BUFSIZE +// DFU buffer size +#define CFG_TUD_DFU_XFER_BUFSIZE CONFIG_TINYUSB_DFU_BUFSIZE + // VENDOR FIFO size of TX and RX #define CFG_TUD_VENDOR_RX_BUFSIZE CONFIG_TINYUSB_VENDOR_RX_BUFSIZE #define CFG_TUD_VENDOR_TX_BUFSIZE CONFIG_TINYUSB_VENDOR_TX_BUFSIZE From 413bfa9b4ccb1a7a63090194e54c5026dbb55aca Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 20 Apr 2023 12:42:19 +0200 Subject: [PATCH 109/636] Update tusb_config.h --- components/arduino_tinyusb/include/tusb_config.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/arduino_tinyusb/include/tusb_config.h b/components/arduino_tinyusb/include/tusb_config.h index a5a0afd32..ee1e5d270 100755 --- a/components/arduino_tinyusb/include/tusb_config.h +++ b/components/arduino_tinyusb/include/tusb_config.h @@ -64,6 +64,10 @@ extern "C" { # define CONFIG_TINYUSB_DFU_RT_ENABLED 0 #endif +#ifndef CONFIG_TINYUSB_DFU_ENABLED +# define CONFIG_TINYUSB_DFU_ENABLED 0 +#endif + #ifndef CONFIG_TINYUSB_VENDOR_ENABLED # define CONFIG_TINYUSB_VENDOR_ENABLED 0 #endif @@ -106,6 +110,7 @@ extern "C" { #define CFG_TUD_VIDEO CONFIG_TINYUSB_VIDEO_ENABLED #define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED #define CFG_TUD_DFU_RUNTIME CONFIG_TINYUSB_DFU_RT_ENABLED +#define CFG_TUD_DFU CONFIG_TINYUSB_DFU_ENABLED #define CFG_TUD_VENDOR CONFIG_TINYUSB_VENDOR_ENABLED // CDC FIFO size of TX and RX @@ -126,6 +131,9 @@ extern "C" { #define CFG_TUD_VIDEO_STREAMING CONFIG_TINYUSB_VIDEO_STREAMING_IFS #define CFG_TUD_VIDEO_STREAMING_EP_BUFSIZE CONFIG_TINYUSB_VIDEO_STREAMING_BUFSIZE +// DFU buffer size +#define CFG_TUD_DFU_XFER_BUFSIZE CONFIG_TINYUSB_DFU_BUFSIZE + // VENDOR FIFO size of TX and RX #define CFG_TUD_VENDOR_RX_BUFSIZE CONFIG_TINYUSB_VENDOR_RX_BUFSIZE #define CFG_TUD_VENDOR_TX_BUFSIZE CONFIG_TINYUSB_VENDOR_TX_BUFSIZE From 5340477de2ef8a540d5e5de8cedd42d0425fc10f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 20 Apr 2023 12:43:24 +0200 Subject: [PATCH 110/636] Update CMakeLists.txt --- components/arduino_tinyusb/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index 0872021eb..97591440f 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -28,6 +28,7 @@ if(CONFIG_TINYUSB_ENABLED) "${COMPONENT_DIR}/tinyusb/src/class/msc/msc_device.c" "${COMPONENT_DIR}/tinyusb/src/class/video/video_device.c" "${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_rt_device.c" + "${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_device.c" "${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_device.c" "${COMPONENT_DIR}/tinyusb/src/common/tusb_fifo.c" "${COMPONENT_DIR}/tinyusb/src/device/usbd_control.c" From a37b01f0858fe5e6f33dd1573aa0f16ea09d99ea Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 20 Apr 2023 12:44:03 +0200 Subject: [PATCH 111/636] Update Kconfig.projbuild --- components/arduino_tinyusb/Kconfig.projbuild | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/components/arduino_tinyusb/Kconfig.projbuild b/components/arduino_tinyusb/Kconfig.projbuild index a6abd4d8a..80983657f 100755 --- a/components/arduino_tinyusb/Kconfig.projbuild +++ b/components/arduino_tinyusb/Kconfig.projbuild @@ -175,6 +175,31 @@ menu "Arduino TinyUSB" endmenu + menu "DFU driver" + depends on TINYUSB_ENABLED + + config TINYUSB_DFU_ENABLED + bool "Enable USB DFU TinyUSB driver" + default y + help + Enable USB DFU TinyUSB driver. + + config TINYUSB_DESC_DFU_STRING + string "DFU Device String" + default "Espressif DFU Device" + depends on TINYUSB_DFU_ENABLED + help + Specify name of the DFU device + + config TINYUSB_DFU_BUFSIZE + int "DFU buffer size" + default 4096 + depends on TINYUSB_DFU_ENABLED + help + DFU buffer size + + endmenu + menu "VENDOR driver" depends on TINYUSB_ENABLED From 5a155ea7a9ceacdc66bec6016a0a7cd20bc81472 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 21 Apr 2023 20:17:04 +0200 Subject: [PATCH 112/636] rm get.exe py --- tools/archive-build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 402aab5da..f6065eaff 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -21,6 +21,8 @@ rm -rf arduino-esp32/libraries/Insights rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs rm -rf arduino-esp32/tools/esptool.py +rm -rf arduino-esp32/tools/get.py +rm -rf arduino-esp32/tools/get.exe rm -rf arduino-esp32/tools/ide-debug rm -rf arduino-esp32/tools/gen_insights_package.py rm -rf arduino-esp32/tools/gen_insights_package.exe From 2cd35e73444409d9eb69a8e82baadfe36a6a2d34 Mon Sep 17 00:00:00 2001 From: Valerii Koval <valeros@users.noreply.github.com> Date: Fri, 28 Apr 2023 11:56:16 +0300 Subject: [PATCH 113/636] Update PlatformIO build script templates (#118) Adds support for new package with precompiled SDK libraries --- configs/pio_end.txt | 6 +++--- configs/pio_start.txt | 5 +++++ tools/config.sh | 2 +- tools/copy-libs.sh | 6 +++--- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/configs/pio_end.txt b/configs/pio_end.txt index 3190217a1..e7544f1dd 100644 --- a/configs/pio_end.txt +++ b/configs/pio_end.txt @@ -2,9 +2,9 @@ "ESP32", ("F_CPU", "$BOARD_F_CPU"), ("ARDUINO", 10812), - ("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")), - ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")), - "ARDUINO_PARTITION_%s" % basename(env.BoardConfig().get( + ("ARDUINO_VARIANT", '\\"%s\\"' % board_config.get("build.variant").replace('"', "")), + ("ARDUINO_BOARD", '\\"%s\\"' % board_config.get("name").replace('"', "")), + "ARDUINO_PARTITION_%s" % basename(board_config.get( "build.partitions", "default.csv")).replace(".csv", "").replace("-", "_") ] ) diff --git a/configs/pio_start.txt b/configs/pio_start.txt index 010ba60aa..9a38020fb 100644 --- a/configs/pio_start.txt +++ b/configs/pio_start.txt @@ -31,5 +31,10 @@ from SCons.Script import DefaultEnvironment env = DefaultEnvironment() FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoespressif32") +FRAMEWORK_SDK_DIR = env.PioPlatform().get_package_dir( + "framework-arduinoespressif32-libs" +) + +board_config = env.BoardConfig() env.Append( diff --git a/tools/config.sh b/tools/config.sh index 96d04d054..9b2fa3133 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -45,7 +45,7 @@ AR_TOOLS="$AR_OUT/tools" AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET" -PIO_SDK="FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\"" +PIO_SDK="FRAMEWORK_SDK_DIR, \"$IDF_TARGET\"" TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 32992d624..fad66279e 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -404,8 +404,8 @@ for item; do done fi done -echo " join($PIO_SDK, env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")), \"include\")," >> "$AR_PLATFORMIO_PY" -echo " join(FRAMEWORK_DIR, \"cores\", env.BoardConfig().get(\"build.core\"))" >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")), \"include\")," >> "$AR_PLATFORMIO_PY" +echo " join(FRAMEWORK_DIR, \"cores\", board_config.get(\"build.core\"))" >> "$AR_PLATFORMIO_PY" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" @@ -429,7 +429,7 @@ done echo " LIBPATH=[" >> "$AR_PLATFORMIO_PY" echo " join($PIO_SDK, \"lib\")," >> "$AR_PLATFORMIO_PY" echo " join($PIO_SDK, \"ld\")," >> "$AR_PLATFORMIO_PY" -echo " join($PIO_SDK, env.BoardConfig().get(\"build.arduino.memory_type\", (env.BoardConfig().get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")))" >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")))" >> "$AR_PLATFORMIO_PY" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" From c523797ce2ec89a090185048b0190d992572f547 Mon Sep 17 00:00:00 2001 From: Valerii Koval <valeros@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:00:30 +0300 Subject: [PATCH 114/636] Autogenerate PlatformIO manifest file for prebuilt SDK libs - Add a special Python script that generates "package.json" with IDF revision from the "version.txt" according to SemVer --- build.sh | 8 ++- tools/gen_platformio_manifest.py | 95 ++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 tools/gen_platformio_manifest.py diff --git a/build.sh b/build.sh index a5ea518e2..086554845 100755 --- a/build.sh +++ b/build.sh @@ -197,6 +197,12 @@ if [ "$BUILD_TYPE" = "all" ]; then if [ $? -ne 0 ]; then exit 1; fi fi +# Generate PlatformIO manifest file +if [ "$BUILD_TYPE" = "all" ]; then + python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" + if [ $? -ne 0 ]; then exit 1; fi +fi + # copy everything to arduino-esp32 installation if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then ./tools/copy-to-arduino.sh @@ -212,4 +218,4 @@ fi if [ "$BUILD_TYPE" = "all" ]; then ./tools/archive-build.sh if [ $? -ne 0 ]; then exit 1; fi -fi +fi diff --git a/tools/gen_platformio_manifest.py b/tools/gen_platformio_manifest.py new file mode 100644 index 000000000..a0a1d162b --- /dev/null +++ b/tools/gen_platformio_manifest.py @@ -0,0 +1,95 @@ +import argparse +import json +import os +import re +import sys + +MANIFEST_DATA = { + "name": "framework-arduinoespressif32-libs", + "description": "Precompiled libraries for Arduino Wiring-based Framework for the Espressif ESP32 series of SoCs", + "keywords": ["framework", "arduino", "espressif", "esp32"], + "license": "LGPL-2.1-or-later", + "repository": { + "type": "git", + "url": "https://github.com/espressif/esp32-arduino-libs", + }, +} + + +def convert_version(version_line): + """A helper function that converts a custom IDF version string + to a suitable SemVer alternative. For example: + 'release/v5.1 420ebd208a' becomes '5.1.0+sha.420ebd208a' + """ + + regex_pattern = r"^esp-idf:\s*release\/v(?P<IDF_VERSION>[\d\.]{3,5})\s*(?P<COMMIT_HASH>[0-9a-f]{5,40})" + match = re.search(regex_pattern, version_line) + if not match: + sys.stderr.write( + f"Failed to find a regex match for '{regex_pattern}' in '{version_line}'\n" + ) + return "" + + version = match.group("IDF_VERSION") + commit = match.group("COMMIT_HASH") + + assert version, f"Failed to parse version value from '{version_line}'" + assert commit, f"Failed to parse commit hash value from '{version_line}'" + + if version.count(".") < 2: + # The most basic casting to a SemVer with three digits + version = version + ".0" + + return f"{version}+sha.{commit}" + + +def main(dst_dir): + # The "version.txt" file is expected to contain IDF version in the following format + # "esp-idf: release/v$VERSION COMMIT_HASH". + version_file = os.path.join("version.txt") + + if not os.path.isfile(version_file): + sys.stderr.write("Missing the 'version.txt' file.\n") + return -1 + + version_line = "" + with open(version_file, encoding="utf8") as fp: + for line in fp.readlines(): + if not line.startswith("esp-idf"): + continue + version_line = line.strip() + + if not version_line: + sys.stderr.write("Failed to find ESP-IDF version in the 'version.txt' file!\n") + return -1 + + converted_version = convert_version(version_line) + if not converted_version: + sys.stderr.write( + f"Failed to convert version '{version_line}' from version.txt\n" + ) + return -1 + + manifest_file_path = os.path.join(dst_dir, "package.json") + with open(manifest_file_path, "w", encoding="utf8") as fp: + MANIFEST_DATA["version"] = converted_version + json.dump(MANIFEST_DATA, fp, indent=2) + + print( + f"Generated PlatformIO manifest file '{manifest_file_path}' with '{converted_version}' version" + ) + return 0 + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "-o", + "--dst-dir", + dest="dst_dir", + required=True, + help="Destination folder where the 'package.json' manifest will be located", + ) + args = parser.parse_args() + + sys.exit(main(args.dst_dir)) From 615d1a96eeb1b852086a0d91e91ab388ef03dcba Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 5 May 2023 14:59:15 +0200 Subject: [PATCH 115/636] Update build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 086554845..7465f04be 100755 --- a/build.sh +++ b/build.sh @@ -199,7 +199,7 @@ fi # Generate PlatformIO manifest file if [ "$BUILD_TYPE" = "all" ]; then - python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" + python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s $(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) -c $(git -C "$IDF_PATH" rev-parse --short HEAD) if [ $? -ne 0 ]; then exit 1; fi fi @@ -218,4 +218,4 @@ fi if [ "$BUILD_TYPE" = "all" ]; then ./tools/archive-build.sh if [ $? -ne 0 ]; then exit 1; fi -fi +fi From 4c424b649e6664e6fb548a64900ea6eadda8836a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 5 May 2023 15:05:38 +0200 Subject: [PATCH 116/636] Update config.sh --- tools/config.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index f1d686a58..5fc7dee8c 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -63,9 +63,12 @@ TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" if [ "$IDF_COMMIT" ]; then - echo "Using specific commit $IDF_COMMIT for IDF" -else - IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") + echo "Using specific commit $IDF_COMMIT for IDF" + export IDF_COMMIT + export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) +elif [ -d "$IDF_PATH" ]; then + export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) + export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) fi AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") From d09d7b8b3cf370d56fa272390da33fb6f3076d8a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 5 May 2023 15:07:34 +0200 Subject: [PATCH 117/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 39bc95408..3fa8a8e58 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -32,6 +32,8 @@ fi if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then git -C $IDF_PATH submodule update --init --recursive $IDF_PATH/install.sh + export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) + export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) fi # @@ -44,8 +46,6 @@ cp "AR_COMPS$/esp32-camera/driver/private_include/cam_hal.h" "AR_COMPS$/esp32-ca # source $IDF_PATH/export.sh -export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) -export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) # # SETUP ARDUINO DEPLOY From 46ab78f529ce2c6f89b33a701ed222b6c74063e0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 5 May 2023 15:09:02 +0200 Subject: [PATCH 118/636] Update gen_platformio_manifest.py --- tools/gen_platformio_manifest.py | 73 ++++++++++++++------------------ 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/tools/gen_platformio_manifest.py b/tools/gen_platformio_manifest.py index a0a1d162b..2d031b687 100644 --- a/tools/gen_platformio_manifest.py +++ b/tools/gen_platformio_manifest.py @@ -16,63 +16,40 @@ } -def convert_version(version_line): +def convert_version(version_string): """A helper function that converts a custom IDF version string - to a suitable SemVer alternative. For example: - 'release/v5.1 420ebd208a' becomes '5.1.0+sha.420ebd208a' + extracted from a Git repository to a suitable SemVer alternative. For example: + 'release/v5.1' becomes '5.1.0', + 'v7.7.7' becomes '7.7.7' """ - regex_pattern = r"^esp-idf:\s*release\/v(?P<IDF_VERSION>[\d\.]{3,5})\s*(?P<COMMIT_HASH>[0-9a-f]{5,40})" - match = re.search(regex_pattern, version_line) + regex_pattern = ( + r"v(?P<MAJOR>0|[1-9]\d*)\.(?P<MINOR>0|[1-9]\d*)\.*(?P<PATCH>0|[1-9]\d*)*" + ) + match = re.search(regex_pattern, version_string) if not match: sys.stderr.write( - f"Failed to find a regex match for '{regex_pattern}' in '{version_line}'\n" + f"Failed to find a regex match for '{regex_pattern}' in '{version_string}'\n" ) return "" - version = match.group("IDF_VERSION") - commit = match.group("COMMIT_HASH") - - assert version, f"Failed to parse version value from '{version_line}'" - assert commit, f"Failed to parse commit hash value from '{version_line}'" - - if version.count(".") < 2: - # The most basic casting to a SemVer with three digits - version = version + ".0" - - return f"{version}+sha.{commit}" + major, minor, patch = match.groups() + if not patch: + patch = "0" + return ".".join((major, minor, patch)) -def main(dst_dir): - # The "version.txt" file is expected to contain IDF version in the following format - # "esp-idf: release/v$VERSION COMMIT_HASH". - version_file = os.path.join("version.txt") - if not os.path.isfile(version_file): - sys.stderr.write("Missing the 'version.txt' file.\n") - return -1 - - version_line = "" - with open(version_file, encoding="utf8") as fp: - for line in fp.readlines(): - if not line.startswith("esp-idf"): - continue - version_line = line.strip() - - if not version_line: - sys.stderr.write("Failed to find ESP-IDF version in the 'version.txt' file!\n") - return -1 +def main(dst_dir, version_string, commit_hash): - converted_version = convert_version(version_line) + converted_version = convert_version(version_string) if not converted_version: - sys.stderr.write( - f"Failed to convert version '{version_line}' from version.txt\n" - ) + sys.stderr.write(f"Failed to convert version '{version_string}'\n") return -1 manifest_file_path = os.path.join(dst_dir, "package.json") with open(manifest_file_path, "w", encoding="utf8") as fp: - MANIFEST_DATA["version"] = converted_version + MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}" json.dump(MANIFEST_DATA, fp, indent=2) print( @@ -90,6 +67,20 @@ def main(dst_dir): required=True, help="Destination folder where the 'package.json' manifest will be located", ) + parser.add_argument( + "-s", + "--version-string", + dest="version_string", + required=True, + help="ESP-IDF version string used for compiling libraries", + ) + parser.add_argument( + "-c", + "--commit-hash", + dest="commit_hash", + required=True, + help="ESP-IDF revision in form of a commit hash", + ) args = parser.parse_args() - sys.exit(main(args.dst_dir)) + sys.exit(main(args.dst_dir, args.version_string, args.commit_hash)) From 1e7996a3de84d0f93da7f61a00774d08c5d30f32 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 7 May 2023 11:51:37 +0200 Subject: [PATCH 119/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 5fc7dee8c..118241ab7 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -63,7 +63,7 @@ TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" if [ "$IDF_COMMIT" ]; then - echo "Using specific commit $IDF_COMMIT for IDF" + echo "Using IDF commit $IDF_COMMIT" export IDF_COMMIT export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) elif [ -d "$IDF_PATH" ]; then From 287d87e60ec0ce87a917ffe14478860c0279508f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 May 2023 11:57:33 +0200 Subject: [PATCH 120/636] Framework all in one build (libs included) --- configs/pio_start.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configs/pio_start.txt b/configs/pio_start.txt index 9a38020fb..616cacbd9 100644 --- a/configs/pio_start.txt +++ b/configs/pio_start.txt @@ -31,9 +31,7 @@ from SCons.Script import DefaultEnvironment env = DefaultEnvironment() FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoespressif32") -FRAMEWORK_SDK_DIR = env.PioPlatform().get_package_dir( - "framework-arduinoespressif32-libs" -) +FRAMEWORK_SDK_DIR = join(FRAMEWORK_DIR, "tools", "esp32-arduino-libs") board_config = env.BoardConfig() From f34c38fc7ab014a6272cac697a9496a66d97dbc2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 11 May 2023 18:03:31 +0200 Subject: [PATCH 121/636] Disable SR --- tools/update-components.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 59175bde8..646c8c581 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -98,14 +98,14 @@ fi # # CLONE/UPDATE ESP-SR # -echo "Updating ESP-SR..." -if [ ! -d "$AR_COMPS/esp-sr" ]; then - git clone $SR_REPO_URL "$AR_COMPS/esp-sr" -else - git -C "$AR_COMPS/esp-sr" fetch && \ - git -C "$AR_COMPS/esp-sr" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi +#echo "Updating ESP-SR..." +#if [ ! -d "$AR_COMPS/esp-sr" ]; then +# git clone $SR_REPO_URL "$AR_COMPS/esp-sr" +#else +# git -C "$AR_COMPS/esp-sr" fetch && \ +# git -C "$AR_COMPS/esp-sr" pull --ff-only +#fi +#if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-DSP From a0ba48e974b16cd71319c57a22809d582600b942 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 12 May 2023 19:11:57 +0200 Subject: [PATCH 122/636] disable DL --- tools/update-components.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 646c8c581..34091b9b2 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -82,18 +82,18 @@ if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-DL # -echo "Updating ESP-DL..." -if [ ! -d "$AR_COMPS/esp-dl" ]; then - git clone $DL_REPO_URL "$AR_COMPS/esp-dl" -else - git -C "$AR_COMPS/esp-dl" fetch && \ - git -C "$AR_COMPS/esp-dl" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi +#echo "Updating ESP-DL..." +#if [ ! -d "$AR_COMPS/esp-dl" ]; then +# git clone $DL_REPO_URL "$AR_COMPS/esp-dl" +#%else +# git -C "$AR_COMPS/esp-dl" fetch && \ +# git -C "$AR_COMPS/esp-dl" pull --ff-only +#fi +#if [ $? -ne 0 ]; then exit 1; fi #this is a temp measure to fix build issue -if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then - rm -rf "$AR_COMPS/esp-dl/idf_component.yml" -fi +#if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then +# rm -rf "$AR_COMPS/esp-dl/idf_component.yml" +#fi # # CLONE/UPDATE ESP-SR From 219dd76172a5d85722f4b43338e669dac39abc37 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 12 May 2023 19:14:23 +0200 Subject: [PATCH 123/636] Try DEPLOY_OUT=1 --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index 7465f04be..3403dcb2a 100755 --- a/build.sh +++ b/build.sh @@ -14,6 +14,7 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 +DEPLOY_OUT=1 if [ -z $DEPLOY_OUT ]; then DEPLOY_OUT=0 fi From c7baca60896a85abe6a05bc0499fbf849636deee Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 12 May 2023 20:44:16 +0200 Subject: [PATCH 124/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 3403dcb2a..b0690e616 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,7 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 -DEPLOY_OUT=1 +# DEPLOY_OUT=1 if [ -z $DEPLOY_OUT ]; then DEPLOY_OUT=0 fi From 445aa863881c0861fe056bba2618b363b60c0da5 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 13 May 2023 18:30:50 +0200 Subject: [PATCH 125/636] enable DL --- tools/update-components.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 34091b9b2..646c8c581 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -82,18 +82,18 @@ if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE ESP-DL # -#echo "Updating ESP-DL..." -#if [ ! -d "$AR_COMPS/esp-dl" ]; then -# git clone $DL_REPO_URL "$AR_COMPS/esp-dl" -#%else -# git -C "$AR_COMPS/esp-dl" fetch && \ -# git -C "$AR_COMPS/esp-dl" pull --ff-only -#fi -#if [ $? -ne 0 ]; then exit 1; fi +echo "Updating ESP-DL..." +if [ ! -d "$AR_COMPS/esp-dl" ]; then + git clone $DL_REPO_URL "$AR_COMPS/esp-dl" +else + git -C "$AR_COMPS/esp-dl" fetch && \ + git -C "$AR_COMPS/esp-dl" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi #this is a temp measure to fix build issue -#if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then -# rm -rf "$AR_COMPS/esp-dl/idf_component.yml" -#fi +if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then + rm -rf "$AR_COMPS/esp-dl/idf_component.yml" +fi # # CLONE/UPDATE ESP-SR From cf412c29e7033a17db2350ec0a0ea66ece4d1a41 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 13 May 2023 18:34:59 +0200 Subject: [PATCH 126/636] Update update-components.sh --- tools/update-components.sh | 55 +++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 646c8c581..f8ce790b6 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -95,30 +95,6 @@ if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then rm -rf "$AR_COMPS/esp-dl/idf_component.yml" fi -# -# CLONE/UPDATE ESP-SR -# -#echo "Updating ESP-SR..." -#if [ ! -d "$AR_COMPS/esp-sr" ]; then -# git clone $SR_REPO_URL "$AR_COMPS/esp-sr" -#else -# git -C "$AR_COMPS/esp-sr" fetch && \ -# git -C "$AR_COMPS/esp-sr" pull --ff-only -#fi -#if [ $? -ne 0 ]; then exit 1; fi - -# -# CLONE/UPDATE ESP-DSP -# -echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/espressif__esp-dsp" ]; then - git clone $DSP_REPO_URL "$AR_COMPS/espressif__esp-dsp" -else - git -C "$AR_COMPS/espressif__esp-dsp" fetch && \ - git -C "$AR_COMPS/espressif__esp-dsp" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi - # # CLONE/UPDATE ESP-LITTLEFS # @@ -144,3 +120,34 @@ else git -C "$AR_COMPS/arduino_tinyusb/tinyusb" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi + +## +## CLONE/UPDATE ESP-SR +## +#SR_REPO_URL="https://github.com/espressif/esp-sr.git" +#echo "Updating ESP-SR..." +#if [ ! -d "$AR_COMPS/esp-sr" ]; then +# git clone $SR_REPO_URL "$AR_COMPS/esp-sr" +# mv "$AR_COMPS/esp-sr/CMakeLists.txt" "$AR_COMPS/esp-sr/CMakeListsOld.txt" +# echo "if(IDF_TARGET STREQUAL \"esp32s3\")" > "$AR_COMPS/esp-sr/CMakeLists.txt" +# cat "$AR_COMPS/esp-sr/CMakeListsOld.txt" >> "$AR_COMPS/esp-sr/CMakeLists.txt" +# echo "endif()" >> "$AR_COMPS/esp-sr/CMakeLists.txt" +#else +# git -C "$AR_COMPS/esp-sr" fetch && \ +# git -C "$AR_COMPS/esp-sr" pull --ff-only +#fi +#if [ $? -ne 0 ]; then exit 1; fi + +# # +# # CLONE/UPDATE ESP-DSP +# # +# DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" +# echo "Updating ESP-DSP..." +# if [ ! -d "$AR_COMPS/espressif__esp-dsp" ]; then +# git clone $DSP_REPO_URL "$AR_COMPS/espressif__esp-dsp" +# else +# git -C "$AR_COMPS/espressif__esp-dsp" fetch && \ +# git -C "$AR_COMPS/espressif__esp-dsp" pull --ff-only +# fi +# if [ $? -ne 0 ]; then exit 1; fi + From 808011ec406b768b1781293de69ac42034842aa7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 13 May 2023 18:46:45 +0200 Subject: [PATCH 127/636] Update build.sh --- build.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index b0690e616..2c3cdaf6e 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,6 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 -# DEPLOY_OUT=1 if [ -z $DEPLOY_OUT ]; then DEPLOY_OUT=0 fi @@ -92,9 +91,15 @@ if [ $SKIP_ENV -eq 0 ]; then source ./tools/install-esp-idf.sh if [ $? -ne 0 ]; then exit 1; fi else + # $IDF_PATH/install.sh + # source $IDF_PATH/export.sh source ./tools/config.sh fi +if [ -f "./managed_components/espressif__esp-sr/.component_hash" ]; then + rm -rf ./managed_components/espressif__esp-sr/.component_hash +fi + if [ "$BUILD_TYPE" != "all" ]; then if [ "$TARGET" = "all" ]; then echo "ERROR: You need to specify target for non-default builds" @@ -161,6 +166,11 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do for defconf in `echo "$target_json" | jq -c '.idf_libs[]' | tr -d '"'`; do idf_libs_configs="$idf_libs_configs;configs/defconfig.$defconf" done + + if [ -f "./managed_components/espressif__esp-sr/.component_hash" ]; then + rm -rf ./managed_components/espressif__esp-sr/.component_hash + fi + echo "* Build IDF-Libs: $idf_libs_configs" rm -rf build sdkconfig idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf_libs @@ -172,6 +182,11 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do for defconf in `echo "$boot_conf" | jq -c '.[]' | tr -d '"'`; do bootloader_configs="$bootloader_configs;configs/defconfig.$defconf"; done + + if [ -f "./managed_components/espressif__esp-sr/.component_hash" ]; then + rm -rf ./managed_components/espressif__esp-sr/.component_hash + fi + echo "* Build BootLoader: $bootloader_configs" rm -rf build sdkconfig idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy_bootloader @@ -184,6 +199,11 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do for defconf in `echo "$mem_conf" | jq -c '.[]' | tr -d '"'`; do mem_configs="$mem_configs;configs/defconfig.$defconf"; done + + if [ -f "./managed_components/espressif__esp-sr/.component_hash" ]; then + rm -rf ./managed_components/espressif__esp-sr/.component_hash + fi + echo "* Build Memory Variant: $mem_configs" rm -rf build sdkconfig idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem_variant From 53066ae813b7bb33ce63e493e2847b4b75cf23af Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 13 May 2023 18:48:27 +0200 Subject: [PATCH 128/636] Update idf_component.yml --- main/idf_component.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index fb266a7af..2ba047577 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -2,16 +2,17 @@ dependencies: # Required IDF version idf: ">=5.1" - mdns: "^1.0.7" - # nghttp: "^1.50.0" - # esp_jpeg: "^1.0.4" - # esp-dsp: "^1.2.0" - # esp-sr: "^1.0.3" - # esp32-camera: "^2.0.3" + mdns: "^1.1.0" + chmorgan/esp-libhelix-mp3: "1.0.3" + esp-dsp: "^1.3.4" + + # esp-sr: "^1.3.1" + # esp32-camera: "^2.0.4" # esp-dl: # git: https://github.com/espressif/esp-dl.git - # arduino: - # path: components/arduino + # espressif/esp_rainmaker: + # path: components/esp_rainmaker + # git: https://github.com/espressif/esp-rainmaker.git # # Defining a dependency from the registry: # # https://components.espressif.com/component/example/cmp From 18b13aaf7cd63d2e699dbf8acc0d0d35349b97cc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 13 May 2023 18:50:22 +0200 Subject: [PATCH 129/636] Update partitions.csv --- partitions.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/partitions.csv b/partitions.csv index 3cf7a7587..97e41c452 100644 --- a/partitions.csv +++ b/partitions.csv @@ -3,6 +3,6 @@ nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x300000, app1, app, ota_1, 0x310000, 0x300000, -spiffs, data, spiffs, 0x610000, 0x5E0000, -model, data, spiffs, 0xBF0000, 0x400000, +spiffs, data, spiffs, 0x610000, 0x700000, +model, data, spiffs, 0xD10000, 0x2E0000, coredump, data, coredump,0xFF0000, 0x10000, From 83b3b5bc24b339563a419e708bdfb38336435a54 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 13 May 2023 18:53:34 +0200 Subject: [PATCH 130/636] Update update-components.sh --- tools/update-components.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index f8ce790b6..619423e78 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -4,8 +4,6 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" DL_REPO_URL="https://github.com/espressif/esp-dl.git" -SR_REPO_URL="https://github.com/espressif/esp-sr.git" -DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" From 5d518288b01a44ce2e534bc53c293214a8c8fd4e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 13 May 2023 20:43:32 +0200 Subject: [PATCH 131/636] default qio_qspi --- tools/copy-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index fad66279e..48217a405 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -404,7 +404,7 @@ for item; do done fi done -echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")), \"include\")," >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")), \"include\")," >> "$AR_PLATFORMIO_PY" echo " join(FRAMEWORK_DIR, \"cores\", board_config.get(\"build.core\"))" >> "$AR_PLATFORMIO_PY" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" @@ -429,7 +429,7 @@ done echo " LIBPATH=[" >> "$AR_PLATFORMIO_PY" echo " join($PIO_SDK, \"lib\")," >> "$AR_PLATFORMIO_PY" echo " join($PIO_SDK, \"ld\")," >> "$AR_PLATFORMIO_PY" -echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_$OCT_PSRAM\")))" >> "$AR_PLATFORMIO_PY" +echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")))" >> "$AR_PLATFORMIO_PY" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" From 2df54a1773934fae1eaf3247ae521f4898a4b157 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 15 May 2023 17:05:24 +0200 Subject: [PATCH 132/636] disable DL --- tools/update-components.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 619423e78..8f481cf07 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -77,21 +77,21 @@ else fi if [ $? -ne 0 ]; then exit 1; fi -# -# CLONE/UPDATE ESP-DL -# -echo "Updating ESP-DL..." -if [ ! -d "$AR_COMPS/esp-dl" ]; then - git clone $DL_REPO_URL "$AR_COMPS/esp-dl" -else - git -C "$AR_COMPS/esp-dl" fetch && \ - git -C "$AR_COMPS/esp-dl" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi -#this is a temp measure to fix build issue -if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then - rm -rf "$AR_COMPS/esp-dl/idf_component.yml" -fi +## +## CLONE/UPDATE ESP-DL +## +#echo "Updating ESP-DL..." +#if [ ! -d "$AR_COMPS/esp-dl" ]; then +# git clone $DL_REPO_URL "$AR_COMPS/esp-dl" +#else +# git -C "$AR_COMPS/esp-dl" fetch && \ +# git -C "$AR_COMPS/esp-dl" pull --ff-only +#fi +#if [ $? -ne 0 ]; then exit 1; fi +##this is a temp measure to fix build issue +#if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then +# rm -rf "$AR_COMPS/esp-dl/idf_component.yml" +#fi # # CLONE/UPDATE ESP-LITTLEFS From 319baf664cc9636094a06b2690117e4294620d47 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 17 May 2023 10:32:02 +0200 Subject: [PATCH 133/636] AR commit choice --- tools/config.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 118241ab7..41065799d 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -21,6 +21,9 @@ if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" fi +# IDF commit to use +#IDF_COMMIT="2549b9fe369005664ce817c4d290a3132177eb8d" + if [ -z $IDF_TARGET ]; then if [ -f sdkconfig ]; then IDF_TARGET=`cat sdkconfig | grep CONFIG_IDF_TARGET= | cut -d'"' -f2` @@ -42,8 +45,12 @@ AR_REPO="$AR_USER/arduino-esp32" AR_BRANCH="esp-idf-v5.1-libs" # The full name of the repository +# Arduino commit to use AR_REPO="$AR_USER/arduino-esp32" +# Arduino commit to use +#$AR_COMMIT = + AR_REPO_URL="https://github.com/$AR_REPO.git" IDF_LIBS_REPO_URL="https://github.com/tasmota/esp32-arduino-libs.git" if [ -n $GITHUB_TOKEN ]; then @@ -64,17 +71,24 @@ IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" if [ "$IDF_COMMIT" ]; then echo "Using IDF commit $IDF_COMMIT" + echo "Using commit $IDF_COMMIT for IDF" export IDF_COMMIT +else export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) + IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") elif [ -d "$IDF_PATH" ]; then export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) fi -AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") +if [ "$AR_COMMIT" ]; then + echo "Using commit $AR_COMMIT for Arduino" +else + AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") +fi rm -rf release-info.txt -echo "Framework built from IDF branch $IDF_BRANCH commit $IDF_COMMIT and $AR_REPO branch $AR_BRANCH commit $AR_COMMIT" >> release-info.txt +echo "Framework built from Tasmota IDF branch $IDF_BRANCH commit $IDF_COMMIT and $AR_REPO branch $AR_BRANCH commit $AR_COMMIT" >> release-info.txt function get_os(){ OSBITS=`arch` From 29149b0adec95a3a7c0ee3d3771157e58c13f636 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 17 May 2023 10:32:43 +0200 Subject: [PATCH 134/636] Update config.sh --- tools/config.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 41065799d..fbe02c1a7 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -21,9 +21,6 @@ if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" fi -# IDF commit to use -#IDF_COMMIT="2549b9fe369005664ce817c4d290a3132177eb8d" - if [ -z $IDF_TARGET ]; then if [ -f sdkconfig ]; then IDF_TARGET=`cat sdkconfig | grep CONFIG_IDF_TARGET= | cut -d'"' -f2` From 95e28ceae245eb6ae0fbeabafbddbe6a04c16c5f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 17 May 2023 10:35:22 +0200 Subject: [PATCH 135/636] Update config.sh --- tools/config.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index fbe02c1a7..693260395 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -42,7 +42,6 @@ AR_REPO="$AR_USER/arduino-esp32" AR_BRANCH="esp-idf-v5.1-libs" # The full name of the repository -# Arduino commit to use AR_REPO="$AR_USER/arduino-esp32" # Arduino commit to use From cd055a6b0478fc57de96a3d4b41b3c03c0b5a1ba Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 19 May 2023 16:40:39 +0200 Subject: [PATCH 136/636] Update config.sh --- tools/config.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 693260395..b3d40ef62 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -67,11 +67,10 @@ IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" if [ "$IDF_COMMIT" ]; then echo "Using IDF commit $IDF_COMMIT" - echo "Using commit $IDF_COMMIT for IDF" export IDF_COMMIT else export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) - IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") + export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") elif [ -d "$IDF_PATH" ]; then export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) From 700c70e9b93872b829515102866c4d491d7590d6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 19 May 2023 16:51:17 +0200 Subject: [PATCH 137/636] Update config.sh --- tools/config.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index b3d40ef62..ba050fd2e 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -71,9 +71,6 @@ if [ "$IDF_COMMIT" ]; then else export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") -elif [ -d "$IDF_PATH" ]; then - export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) - export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) fi if [ "$AR_COMMIT" ]; then From cc5c30ebe54bd2d4257b92636985302cfa40cd06 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 19 May 2023 16:55:01 +0200 Subject: [PATCH 138/636] Update config.sh --- tools/config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index ba050fd2e..0280007a3 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -68,9 +68,9 @@ IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" if [ "$IDF_COMMIT" ]; then echo "Using IDF commit $IDF_COMMIT" export IDF_COMMIT -else +elif [ -d "$IDF_PATH" ]; then + export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) - export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") fi if [ "$AR_COMMIT" ]; then From 2cef4aad2b44cec524c80c9b43cc7fdc2ed39f70 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 6 Jun 2023 11:37:35 +0200 Subject: [PATCH 139/636] Update CMakeLists.txt --- components/arduino_tinyusb/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index 97591440f..792b2a39f 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -20,8 +20,10 @@ if(CONFIG_TINYUSB_ENABLED) set(srcs # espressif: "${COMPONENT_DIR}/src/dcd_esp32sx.c" + #"${COMPONENT_DIR}/src/dcd_dwc2.c" # tusb: #"${COMPONENT_DIR}/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c" + #"{COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c" "${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_device.c" "${COMPONENT_DIR}/tinyusb/src/class/hid/hid_device.c" "${COMPONENT_DIR}/tinyusb/src/class/midi/midi_device.c" @@ -40,6 +42,7 @@ if(CONFIG_TINYUSB_ENABLED) "${COMPONENT_DIR}/tinyusb/hw/bsp/" "${COMPONENT_DIR}/tinyusb/src/" "${COMPONENT_DIR}/tinyusb/src/device" + "${COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2" ) idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos From aaca639b19669251497ea854cc452b094e34148d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 6 Jun 2023 11:38:50 +0200 Subject: [PATCH 140/636] Create dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 1389 +++++++++++++++++++++ 1 file changed, 1389 insertions(+) create mode 100644 components/arduino_tinyusb/src/dcd_dwc2.c diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c new file mode 100644 index 000000000..67653fda0 --- /dev/null +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -0,0 +1,1389 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 William D. Jones + * Copyright (c) 2019 Ha Thach (tinyusb.org) + * Copyright (c) 2020 Jan Duempelmann + * Copyright (c) 2020 Reinhard Panhuber + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ + +#include "tusb_option.h" + +#if CFG_TUD_ENABLED && defined(TUP_USBIP_DWC2) + +#include "device/dcd.h" +#include "dwc2_type.h" + +// Following symbols must be defined by port header +// - _dwc2_controller[]: array of controllers +// - DWC2_EP_MAX: largest EP counts of all controllers +// - dwc2_phy_init/dwc2_phy_update: phy init called before and after core reset +// - dwc2_dcd_int_enable/dwc2_dcd_int_disable +// - dwc2_remote_wakeup_delay + +#if defined(TUP_USBIP_DWC2_STM32) + #include "dwc2_stm32.h" +#elif TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + #include "dwc2_esp32.h" +#elif TU_CHECK_MCU(OPT_MCU_GD32VF103) + #include "dwc2_gd32.h" +#elif TU_CHECK_MCU(OPT_MCU_BCM2711, OPT_MCU_BCM2835, OPT_MCU_BCM2837) + #include "dwc2_bcm.h" +#elif TU_CHECK_MCU(OPT_MCU_EFM32GG) + #include "dwc2_efm32.h" +#elif TU_CHECK_MCU(OPT_MCU_XMC4000) + #include "dwc2_xmc.h" +#else + #error "Unsupported MCUs" +#endif + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ + +// DWC2 registers +#define DWC2_REG(_port) ((dwc2_regs_t*) _dwc2_controller[_port].reg_base) + +// Debug level for DWC2 +#define DWC2_DEBUG 2 + +#ifndef dcache_clean +#define dcache_clean(_addr, _size) +#endif + +#ifndef dcache_invalidate +#define dcache_invalidate(_addr, _size) +#endif + +#ifndef dcache_clean_invalidate +#define dcache_clean_invalidate(_addr, _size) +#endif + +static TU_ATTR_ALIGNED(4) uint32_t _setup_packet[2]; + +typedef struct { + uint8_t * buffer; + tu_fifo_t * ff; + uint16_t total_len; + uint16_t max_size; + uint8_t interval; +} xfer_ctl_t; + +static xfer_ctl_t xfer_status[DWC2_EP_MAX][2]; +#define XFER_CTL_BASE(_ep, _dir) (&xfer_status[_ep][_dir]) + +// EP0 transfers are limited to 1 packet - larger sizes has to be split +static uint16_t ep0_pending[2]; // Index determines direction as tusb_dir_t type + +// TX FIFO RAM allocation so far in words - RX FIFO size is readily available from dwc2->grxfsiz +static uint16_t _allocated_fifo_words_tx; // TX FIFO size in words (IN EPs) +static bool _out_ep_closed; // Flag to check if RX FIFO size needs an update (reduce its size) + +// SOF enabling flag - required for SOF to not get disabled in ISR when SOF was enabled by +static bool _sof_en; + +// Calculate the RX FIFO size according to recommendations from reference manual +static inline uint16_t calc_grxfsiz(uint16_t max_ep_size, uint8_t ep_count) +{ + return 15 + 2*(max_ep_size/4) + 2*ep_count; +} + +static void update_grxfsiz(uint8_t rhport) +{ + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + + // Determine largest EP size for RX FIFO + uint16_t max_epsize = 0; + for (uint8_t epnum = 0; epnum < ep_count; epnum++) + { + max_epsize = tu_max16(max_epsize, xfer_status[epnum][TUSB_DIR_OUT].max_size); + } + + // Update size of RX FIFO + dwc2->grxfsiz = calc_grxfsiz(max_epsize, ep_count); +} + +// Start of Bus Reset +static void bus_reset(uint8_t rhport) +{ + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + + tu_memclr(xfer_status, sizeof(xfer_status)); + _out_ep_closed = false; + + _sof_en = false; + + // clear device address + dwc2->dcfg &= ~DCFG_DAD_Msk; + + // 1. NAK for all OUT endpoints + for ( uint8_t n = 0; n < ep_count; n++ ) + { + dwc2->epout[n].doepctl |= DOEPCTL_SNAK; + } + + // 2. Set up interrupt mask + dwc2->daintmsk = TU_BIT(DAINTMSK_OEPM_Pos) | TU_BIT(DAINTMSK_IEPM_Pos); + dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM; + dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM; + + // "USB Data FIFOs" section in reference manual + // Peripheral FIFO architecture + // + // The FIFO is split up in a lower part where the RX FIFO is located and an upper part where the TX FIFOs start. + // We do this to allow the RX FIFO to grow dynamically which is possible since the free space is located + // between the RX and TX FIFOs. This is required by ISO OUT EPs which need a bigger FIFO than the standard + // configuration done below. + // + // Dynamically FIFO sizes are of interest only for ISO EPs since all others are usually not opened and closed. + // All EPs other than ISO are opened as soon as the driver starts up i.e. when the host sends a + // configure interface command. Hence, all IN EPs other the ISO will be located at the top. IN ISO EPs are usually + // opened when the host sends an additional command: setInterface. At this point in time + // the ISO EP will be located next to the free space and can change its size. In case more IN EPs change its size + // an additional memory + // + // --------------- 320 or 1024 ( 1280 or 4096 bytes ) + // | IN FIFO 0 | + // --------------- (320 or 1024) - 16 + // | IN FIFO 1 | + // --------------- (320 or 1024) - 16 - x + // | . . . . | + // --------------- (320 or 1024) - 16 - x - y - ... - z + // | IN FIFO MAX | + // --------------- + // | FREE | + // --------------- GRXFSIZ + // | OUT FIFO | + // | ( Shared ) | + // --------------- 0 + // + // According to "FIFO RAM allocation" section in RM, FIFO RAM are allocated as follows (each word 32-bits): + // - Each EP IN needs at least max packet size, 16 words is sufficient for EP0 IN + // + // - All EP OUT shared a unique OUT FIFO which uses + // - 13 for setup packets + control words (up to 3 setup packets). + // - 1 for global NAK (not required/used here). + // - Largest-EPsize / 4 + 1. ( FS: 64 bytes, HS: 512 bytes). Recommended is "2 x (Largest-EPsize/4) + 1" + // - 2 for each used OUT endpoint + // + // Therefore GRXFSIZ = 13 + 1 + 1 + 2 x (Largest-EPsize/4) + 2 x EPOUTnum + // - FullSpeed (64 Bytes ): GRXFSIZ = 15 + 2 x 16 + 2 x ep_count = 47 + 2 x ep_count + // - Highspeed (512 bytes): GRXFSIZ = 15 + 2 x 128 + 2 x ep_count = 271 + 2 x ep_count + // + // NOTE: Largest-EPsize & EPOUTnum is actual used endpoints in configuration. Since DCD has no knowledge + // of the overall picture yet. We will use the worst scenario: largest possible + ep_count + // + // For Isochronous, largest EP size can be 1023/1024 for FS/HS respectively. In addition if multiple ISO + // are enabled at least "2 x (Largest-EPsize/4) + 1" are recommended. Maybe provide a macro for application to + // overwrite this. + + // EP0 out max is 64 + dwc2->grxfsiz = calc_grxfsiz(64, ep_count); + + // Setup the control endpoint 0 + _allocated_fifo_words_tx = 16; + + // Control IN uses FIFO 0 with 64 bytes ( 16 32-bit word ) + dwc2->dieptxf0 = (16 << DIEPTXF0_TX0FD_Pos) | (_dwc2_controller[rhport].ep_fifo_size/4 - _allocated_fifo_words_tx); + + // Fixed control EP0 size to 64 bytes + dwc2->epin[0].diepctl &= ~(0x03 << DIEPCTL_MPSIZ_Pos); + xfer_status[0][TUSB_DIR_OUT].max_size = 64; + xfer_status[0][TUSB_DIR_IN ].max_size = 64; + + dwc2->epout[0].doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); + + dwc2->gintmsk |= GINTMSK_OEPINT | GINTMSK_IEPINT; +} + +static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t const dir, uint16_t const num_packets, uint16_t total_bytes) +{ + (void) rhport; + + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + + // EP0 is limited to one packet each xfer + // We use multiple transaction of xfer->max_size length to get a whole transfer done + if ( epnum == 0 ) + { + xfer_ctl_t *const xfer = XFER_CTL_BASE(epnum, dir); + total_bytes = tu_min16(ep0_pending[dir], xfer->max_size); + ep0_pending[dir] -= total_bytes; + } + + // IN and OUT endpoint xfers are interrupt-driven, we just schedule them here. + if ( dir == TUSB_DIR_IN ) + { + dwc2_epin_t* epin = dwc2->epin; + + // A full IN transfer (multiple packets, possibly) triggers XFRC. + epin[epnum].dieptsiz = (num_packets << DIEPTSIZ_PKTCNT_Pos) | + ((total_bytes << DIEPTSIZ_XFRSIZ_Pos) & DIEPTSIZ_XFRSIZ_Msk); + + epin[epnum].diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; + + // For ISO endpoint set correct odd/even bit for next frame. + if ( (epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1 ) + { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); + epin[epnum].diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); + } + // Enable fifo empty interrupt only if there are something to put in the fifo. + if ( total_bytes != 0 ) + { + dwc2->diepempmsk |= (1 << epnum); + } + } + else + { + dwc2_epout_t* epout = dwc2->epout; + + // A full OUT transfer (multiple packets, possibly) triggers XFRC. + epout[epnum].doeptsiz &= ~(DOEPTSIZ_PKTCNT_Msk | DOEPTSIZ_XFRSIZ); + epout[epnum].doeptsiz |= (num_packets << DOEPTSIZ_PKTCNT_Pos) | + ((total_bytes << DOEPTSIZ_XFRSIZ_Pos) & DOEPTSIZ_XFRSIZ_Msk); + + epout[epnum].doepctl |= DOEPCTL_EPENA | DOEPCTL_CNAK; + if ( (epout[epnum].doepctl & DOEPCTL_EPTYP) == DOEPCTL_EPTYP_0 && + XFER_CTL_BASE(epnum, dir)->interval == 1 ) + { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); + epout[epnum].doepctl |= (odd_frame_now ? DOEPCTL_SD0PID_SEVNFRM_Msk : DOEPCTL_SODDFRM_Msk); + } + } +} + +/*------------------------------------------------------------------*/ +/* Controller API + *------------------------------------------------------------------*/ +#if CFG_TUSB_DEBUG >= DWC2_DEBUG +void print_dwc2_info(dwc2_regs_t * dwc2) +{ + dwc2_ghwcfg2_t const * hw_cfg2 = &dwc2->ghwcfg2_bm; + dwc2_ghwcfg3_t const * hw_cfg3 = &dwc2->ghwcfg3_bm; + dwc2_ghwcfg4_t const * hw_cfg4 = &dwc2->ghwcfg4_bm; + +// TU_LOG_HEX(DWC2_DEBUG, dwc2->gotgctl); +// TU_LOG_HEX(DWC2_DEBUG, dwc2->gusbcfg); +// TU_LOG_HEX(DWC2_DEBUG, dwc2->dcfg); + TU_LOG_HEX(DWC2_DEBUG, dwc2->guid); + TU_LOG_HEX(DWC2_DEBUG, dwc2->gsnpsid); + TU_LOG_HEX(DWC2_DEBUG, dwc2->ghwcfg1); + + // HW configure 2 + TU_LOG(DWC2_DEBUG, "\r\n"); + TU_LOG_HEX(DWC2_DEBUG, dwc2->ghwcfg2); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->op_mode ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->arch ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->point2point ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->hs_phy_type ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->fs_phy_type ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->num_dev_ep ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->num_host_ch ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->period_channel_support ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->enable_dynamic_fifo ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->mul_cpu_int ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->nperiod_tx_q_depth ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->host_period_tx_q_depth ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->dev_token_q_depth ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg2->otg_enable_ic_usb ); + + // HW configure 3 + TU_LOG(DWC2_DEBUG, "\r\n"); + TU_LOG_HEX(DWC2_DEBUG, dwc2->ghwcfg3); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->xfer_size_width ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->packet_size_width ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->otg_enable ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->i2c_enable ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->vendor_ctrl_itf ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->optional_feature_removed ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->synch_reset ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->otg_adp_support ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->otg_enable_hsic ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->battery_charger_support ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->lpm_mode ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg3->total_fifo_size ); + + // HW configure 4 + TU_LOG(DWC2_DEBUG, "\r\n"); + TU_LOG_HEX(DWC2_DEBUG, dwc2->ghwcfg4); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->num_dev_period_in_ep ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->power_optimized ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->ahb_freq_min ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->hibernation ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->service_interval_mode ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->ipg_isoc_en ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->acg_enable ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->utmi_phy_data_width ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->dev_ctrl_ep_num ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->iddg_filter_enabled ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->vbus_valid_filter_enabled ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->a_valid_filter_enabled ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->b_valid_filter_enabled ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->dedicated_fifos ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->num_dev_in_eps ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->dma_desc_enable ); + TU_LOG_INT(DWC2_DEBUG, hw_cfg4->dma_dynamic ); +} +#endif + +static void reset_core(dwc2_regs_t * dwc2) +{ + // reset core + dwc2->grstctl |= GRSTCTL_CSRST; + + // wait for reset bit is cleared + // TODO version 4.20a should wait for RESET DONE mask + while (dwc2->grstctl & GRSTCTL_CSRST) { } + + // wait for AHB master IDLE + while ( !(dwc2->grstctl & GRSTCTL_AHBIDL) ) { } + + // wait for device mode ? +} + +static bool phy_hs_supported(dwc2_regs_t * dwc2) +{ + // note: esp32 incorrect report its hs_phy_type as utmi +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + return false; +#else + return TUD_OPT_HIGH_SPEED && dwc2->ghwcfg2_bm.hs_phy_type != HS_PHY_TYPE_NONE; +#endif +} + +static void phy_fs_init(dwc2_regs_t * dwc2) +{ + TU_LOG(DWC2_DEBUG, "Fullspeed PHY init\r\n"); + + // Select FS PHY + dwc2->gusbcfg |= GUSBCFG_PHYSEL; + + // MCU specific PHY init before reset + dwc2_phy_init(dwc2, HS_PHY_TYPE_NONE); + + // Reset core after selecting PHY + reset_core(dwc2); + + // USB turnaround time is critical for certification where long cables and 5-Hubs are used. + // So if you need the AHB to run at less than 30 MHz, and if USB turnaround time is not critical, + // these bits can be programmed to a larger value. Default is 5 + dwc2->gusbcfg = (dwc2->gusbcfg & ~GUSBCFG_TRDT_Msk) | (5u << GUSBCFG_TRDT_Pos); + + // MCU specific PHY update post reset + dwc2_phy_update(dwc2, HS_PHY_TYPE_NONE); + + // set max speed + dwc2->dcfg = (dwc2->dcfg & ~DCFG_DSPD_Msk) | (DCFG_DSPD_FS << DCFG_DSPD_Pos); +} + +static void phy_hs_init(dwc2_regs_t * dwc2) +{ + uint32_t gusbcfg = dwc2->gusbcfg; + + // De-select FS PHY + gusbcfg &= ~GUSBCFG_PHYSEL; + + if (dwc2->ghwcfg2_bm.hs_phy_type == HS_PHY_TYPE_ULPI) + { + TU_LOG(DWC2_DEBUG, "Highspeed ULPI PHY init\r\n"); + + // Select ULPI + gusbcfg |= GUSBCFG_ULPI_UTMI_SEL; + + // ULPI 8-bit interface, single data rate + gusbcfg &= ~(GUSBCFG_PHYIF16 | GUSBCFG_DDRSEL); + + // default internal VBUS Indicator and Drive + gusbcfg &= ~(GUSBCFG_ULPIEVBUSD | GUSBCFG_ULPIEVBUSI); + + // Disable FS/LS ULPI + gusbcfg &= ~(GUSBCFG_ULPIFSLS | GUSBCFG_ULPICSM); + }else + { + TU_LOG(DWC2_DEBUG, "Highspeed UTMI+ PHY init\r\n"); + + // Select UTMI+ with 8-bit interface + gusbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16); + + // Set 16-bit interface if supported + if (dwc2->ghwcfg4_bm.utmi_phy_data_width) gusbcfg |= GUSBCFG_PHYIF16; + } + + // Apply config + dwc2->gusbcfg = gusbcfg; + + // mcu specific phy init + dwc2_phy_init(dwc2, dwc2->ghwcfg2_bm.hs_phy_type); + + // Reset core after selecting PHY + reset_core(dwc2); + + // Set turn-around, must after core reset otherwise it will be clear + // - 9 if using 8-bit PHY interface + // - 5 if using 16-bit PHY interface + gusbcfg &= ~GUSBCFG_TRDT_Msk; + gusbcfg |= (dwc2->ghwcfg4_bm.utmi_phy_data_width ? 5u : 9u) << GUSBCFG_TRDT_Pos; + dwc2->gusbcfg = gusbcfg; + + // MCU specific PHY update post reset + dwc2_phy_update(dwc2, dwc2->ghwcfg2_bm.hs_phy_type); + + // Set max speed + uint32_t dcfg = dwc2->dcfg; + dcfg &= ~DCFG_DSPD_Msk; + dcfg |= DCFG_DSPD_HS << DCFG_DSPD_Pos; + + // XCVRDLY: transceiver delay between xcvr_sel and txvalid during device chirp is required + // when using with some PHYs such as USB334x (USB3341, USB3343, USB3346, USB3347) + if (dwc2->ghwcfg2_bm.hs_phy_type == HS_PHY_TYPE_ULPI) dcfg |= DCFG_XCVRDLY; + + dwc2->dcfg = dcfg; +} + +static bool check_dwc2(dwc2_regs_t * dwc2) +{ +#if CFG_TUSB_DEBUG >= DWC2_DEBUG + print_dwc2_info(dwc2); +#endif + + // For some reasons: GD32VF103 snpsid and all hwcfg register are always zero (skip it) + (void) dwc2; +#if !TU_CHECK_MCU(OPT_MCU_GD32VF103) + uint32_t const gsnpsid = dwc2->gsnpsid & GSNPSID_ID_MASK; + TU_ASSERT(gsnpsid == DWC2_OTG_ID || gsnpsid == DWC2_FS_IOT_ID || gsnpsid == DWC2_HS_IOT_ID); +#endif + + return true; +} + +void dcd_init (uint8_t rhport) +{ + // Programming model begins in the last section of the chapter on the USB + // peripheral in each Reference Manual. + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + + // Check Synopsys ID register, failed if controller clock/power is not enabled + TU_VERIFY(check_dwc2(dwc2), ); + + dcd_disconnect(rhport); + + // max number of endpoints & total_fifo_size are: + // hw_cfg2->num_dev_ep, hw_cfg2->total_fifo_size + + if( phy_hs_supported(dwc2) ) + { + // Highspeed + phy_hs_init(dwc2); + }else + { + // core does not support highspeed or hs-phy is not present + phy_fs_init(dwc2); + } + + // Restart PHY clock + dwc2->pcgctl &= ~(PCGCTL_STOPPCLK | PCGCTL_GATEHCLK | PCGCTL_PWRCLMP | PCGCTL_RSTPDWNMODULE); + + /* Set HS/FS Timeout Calibration to 7 (max available value). + * The number of PHY clocks that the application programs in + * this field is added to the high/full speed interpacket timeout + * duration in the core to account for any additional delays + * introduced by the PHY. This can be required, because the delay + * introduced by the PHY in generating the linestate condition + * can vary from one PHY to another. + */ + dwc2->gusbcfg |= (7ul << GUSBCFG_TOCAL_Pos); + + // Force device mode + dwc2->gusbcfg = (dwc2->gusbcfg & ~GUSBCFG_FHMOD) | GUSBCFG_FDMOD; + + // Clear A override, force B Valid + dwc2->gotgctl = (dwc2->gotgctl & ~GOTGCTL_AVALOEN) | GOTGCTL_BVALOEN | GOTGCTL_BVALOVAL; + + // If USB host misbehaves during status portion of control xfer + // (non zero-length packet), send STALL back and discard. + dwc2->dcfg |= DCFG_NZLSOHSK; + + // Clear all interrupts + uint32_t int_mask = dwc2->gintsts; + dwc2->gintsts |= int_mask; + int_mask = dwc2->gotgint; + dwc2->gotgint |= int_mask; + + // Required as part of core initialization. + // TODO: How should mode mismatch be handled? It will cause + // the core to stop working/require reset. + dwc2->gintmsk = GINTMSK_OTGINT | GINTMSK_MMISM | GINTMSK_RXFLVLM | + GINTMSK_USBSUSPM | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM; + + // Enable global interrupt + dwc2->gahbcfg |= GAHBCFG_GINT; + + // make sure we are in device mode +// TU_ASSERT(!(dwc2->gintsts & GINTSTS_CMOD), ); + +// TU_LOG_HEX(DWC2_DEBUG, dwc2->gotgctl); +// TU_LOG_HEX(DWC2_DEBUG, dwc2->gusbcfg); +// TU_LOG_HEX(DWC2_DEBUG, dwc2->dcfg); +// TU_LOG_HEX(DWC2_DEBUG, dwc2->gahbcfg); + + dcd_connect(rhport); +} + +void dcd_int_enable (uint8_t rhport) +{ + dwc2_dcd_int_enable(rhport); +} + +void dcd_int_disable (uint8_t rhport) +{ + dwc2_dcd_int_disable(rhport); +} + +void dcd_set_address (uint8_t rhport, uint8_t dev_addr) +{ + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2->dcfg = (dwc2->dcfg & ~DCFG_DAD_Msk) | (dev_addr << DCFG_DAD_Pos); + + // Response with status after changing device address + dcd_edpt_xfer(rhport, tu_edpt_addr(0, TUSB_DIR_IN), NULL, 0); +} + +void dcd_remote_wakeup(uint8_t rhport) +{ + (void) rhport; + + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + + // set remote wakeup + dwc2->dctl |= DCTL_RWUSIG; + + // enable SOF to detect bus resume + dwc2->gintsts = GINTSTS_SOF; + dwc2->gintmsk |= GINTMSK_SOFM; + + // Per specs: remote wakeup signal bit must be clear within 1-15ms + dwc2_remote_wakeup_delay(); + + dwc2->dctl &= ~DCTL_RWUSIG; +} + +void dcd_connect(uint8_t rhport) +{ + (void) rhport; + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2->dctl &= ~DCTL_SDIS; +} + +void dcd_disconnect(uint8_t rhport) +{ + (void) rhport; + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2->dctl |= DCTL_SDIS; +} + +// Be advised: audio, video and possibly other iso-ep classes use dcd_sof_enable() to enable/disable its corresponding ISR on purpose! +void dcd_sof_enable(uint8_t rhport, bool en) +{ + (void) rhport; + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + + _sof_en = en; + + if (en) + { + dwc2->gintsts = GINTSTS_SOF; + dwc2->gintmsk |= GINTMSK_SOFM; + } + else + { + dwc2->gintmsk &= ~GINTMSK_SOFM; + } +} + +/*------------------------------------------------------------------*/ +/* DCD Endpoint port + *------------------------------------------------------------------*/ +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) +// Keep count of how many FIFOs are in use +static uint8_t _allocated_fifos = 1; //FIFO0 is always in use + +// Will either return an unused FIFO number, or 0 if all are used. +static uint8_t get_free_fifo(void) +{ + if (_allocated_fifos < 5) return _allocated_fifos++; + return 0; +} +#endif + +bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt) +{ + (void) rhport; + + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + + uint8_t const epnum = tu_edpt_number(desc_edpt->bEndpointAddress); + uint8_t const dir = tu_edpt_dir(desc_edpt->bEndpointAddress); + + TU_ASSERT(epnum < ep_count); + + xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir); + xfer->max_size = tu_edpt_packet_size(desc_edpt); + xfer->interval = desc_edpt->bInterval; + + uint16_t const fifo_size = tu_div_ceil(xfer->max_size, 4); + + if(dir == TUSB_DIR_OUT) + { + // Calculate required size of RX FIFO + uint16_t const sz = calc_grxfsiz(4*fifo_size, ep_count); + + // If size_rx needs to be extended check if possible and if so enlarge it + if (dwc2->grxfsiz < sz) + { + TU_ASSERT(sz + _allocated_fifo_words_tx <= _dwc2_controller[rhport].ep_fifo_size/4); + + // Enlarge RX FIFO + dwc2->grxfsiz = sz; + } + + dwc2->epout[epnum].doepctl |= (1 << DOEPCTL_USBAEP_Pos) | + (desc_edpt->bmAttributes.xfer << DOEPCTL_EPTYP_Pos) | + (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | + (xfer->max_size << DOEPCTL_MPSIZ_Pos); + + dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum); + } + else + { + // "USB Data FIFOs" section in reference manual + // Peripheral FIFO architecture + // + // --------------- 320 or 1024 ( 1280 or 4096 bytes ) + // | IN FIFO 0 | + // --------------- (320 or 1024) - 16 + // | IN FIFO 1 | + // --------------- (320 or 1024) - 16 - x + // | . . . . | + // --------------- (320 or 1024) - 16 - x - y - ... - z + // | IN FIFO MAX | + // --------------- + // | FREE | + // --------------- GRXFSIZ + // | OUT FIFO | + // | ( Shared ) | + // --------------- 0 + // + // In FIFO is allocated by following rules: + // - IN EP 1 gets FIFO 1, IN EP "n" gets FIFO "n". + + uint8_t fifo_num = epnum; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + // Special Case for EP5, which is used by CDC but not actually called by the driver + // we can give it a fake FIFO + if (epnum == 5) { + fifo_num = epnum; + } else { + fifo_num = get_free_fifo(); + } + TU_ASSERT(fifo_num != 0); +#endif + // Check if free space is available + TU_ASSERT(_allocated_fifo_words_tx + fifo_size + dwc2->grxfsiz <= _dwc2_controller[rhport].ep_fifo_size/4); + + _allocated_fifo_words_tx += fifo_size; + + TU_LOG(DWC2_DEBUG, " Allocated %u bytes at offset %lu", fifo_size*4, _dwc2_controller[rhport].ep_fifo_size-_allocated_fifo_words_tx*4); + + // DIEPTXF starts at FIFO #1. + // Both TXFD and TXSA are in unit of 32-bit words. + dwc2->dieptxf[epnum - 1] = (fifo_size << DIEPTXF_INEPTXFD_Pos) | (_dwc2_controller[rhport].ep_fifo_size/4 - _allocated_fifo_words_tx); + + dwc2->epin[epnum].diepctl |= (1 << DIEPCTL_USBAEP_Pos) | + (fifo_num << DIEPCTL_TXFNUM_Pos) | + (desc_edpt->bmAttributes.xfer << DIEPCTL_EPTYP_Pos) | + (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DIEPCTL_SD0PID_SEVNFRM : 0) | + (xfer->max_size << DIEPCTL_MPSIZ_Pos); + + dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum)); + } + + return true; +} + +// Close all non-control endpoints, cancel all pending transfers if any. +void dcd_edpt_close_all (uint8_t rhport) +{ + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + + // Disable non-control interrupt + dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos); + + for(uint8_t n = 1; n < ep_count; n++) + { + // disable OUT endpoint + dwc2->epout[n].doepctl = 0; + xfer_status[n][TUSB_DIR_OUT].max_size = 0; + + // disable IN endpoint + dwc2->epin[n].diepctl = 0; + xfer_status[n][TUSB_DIR_IN].max_size = 0; + } + + // reset allocated fifo IN + _allocated_fifo_words_tx = 16; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + _allocated_fifos = 1; +#endif +} + +bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes) +{ + uint8_t const epnum = tu_edpt_number(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); + + xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir); + xfer->buffer = buffer; + xfer->ff = NULL; + xfer->total_len = total_bytes; + + // EP0 can only handle one packet + if(epnum == 0) + { + ep0_pending[dir] = total_bytes; + + // Schedule the first transaction for EP0 transfer + edpt_schedule_packets(rhport, epnum, dir, 1, ep0_pending[dir]); + } + else + { + uint16_t num_packets = (total_bytes / xfer->max_size); + uint16_t const short_packet_size = total_bytes % xfer->max_size; + + // Zero-size packet is special case. + if ( (short_packet_size > 0) || (total_bytes == 0) ) num_packets++; + + // Schedule packets to be sent within interrupt + edpt_schedule_packets(rhport, epnum, dir, num_packets, total_bytes); + } + + return true; +} + +// The number of bytes has to be given explicitly to allow more flexible control of how many +// bytes should be written and second to keep the return value free to give back a boolean +// success message. If total_bytes is too big, the FIFO will copy only what is available +// into the USB buffer! +bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes) +{ + // USB buffers always work in bytes so to avoid unnecessary divisions we demand item_size = 1 + TU_ASSERT(ff->item_size == 1); + + uint8_t const epnum = tu_edpt_number(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); + + xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir); + xfer->buffer = NULL; + xfer->ff = ff; + xfer->total_len = total_bytes; + + uint16_t num_packets = (total_bytes / xfer->max_size); + uint16_t const short_packet_size = total_bytes % xfer->max_size; + + // Zero-size packet is special case. + if ( short_packet_size > 0 || (total_bytes == 0) ) num_packets++; + + // Schedule packets to be sent within interrupt + edpt_schedule_packets(rhport, epnum, dir, num_packets, total_bytes); + + return true; +} + +static void dcd_edpt_disable (uint8_t rhport, uint8_t ep_addr, bool stall) +{ + (void) rhport; + + dwc2_regs_t *dwc2 = DWC2_REG(rhport); + + uint8_t const epnum = tu_edpt_number(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); + + if ( dir == TUSB_DIR_IN ) + { + dwc2_epin_t* epin = dwc2->epin; + + // Only disable currently enabled non-control endpoint + if ( (epnum == 0) || !(epin[epnum].diepctl & DIEPCTL_EPENA) ) + { + epin[epnum].diepctl |= DIEPCTL_SNAK | (stall ? DIEPCTL_STALL : 0); + } + else + { + // Stop transmitting packets and NAK IN xfers. + epin[epnum].diepctl |= DIEPCTL_SNAK; + while ( (epin[epnum].diepint & DIEPINT_INEPNE) == 0 ) {} + + // Disable the endpoint. + epin[epnum].diepctl |= DIEPCTL_EPDIS | (stall ? DIEPCTL_STALL : 0); + while ( (epin[epnum].diepint & DIEPINT_EPDISD_Msk) == 0 ) {} + + epin[epnum].diepint = DIEPINT_EPDISD; + } + + // Flush the FIFO, and wait until we have confirmed it cleared. + dwc2->grstctl = ((epnum << GRSTCTL_TXFNUM_Pos) | GRSTCTL_TXFFLSH); + while ( (dwc2->grstctl & GRSTCTL_TXFFLSH_Msk) != 0 ) {} + } + else + { + dwc2_epout_t* epout = dwc2->epout; + + // Only disable currently enabled non-control endpoint + if ( (epnum == 0) || !(epout[epnum].doepctl & DOEPCTL_EPENA) ) + { + epout[epnum].doepctl |= stall ? DOEPCTL_STALL : 0; + } + else + { + // Asserting GONAK is required to STALL an OUT endpoint. + // Simpler to use polling here, we don't use the "B"OUTNAKEFF interrupt + // anyway, and it can't be cleared by user code. If this while loop never + // finishes, we have bigger problems than just the stack. + dwc2->dctl |= DCTL_SGONAK; + while ( (dwc2->gintsts & GINTSTS_BOUTNAKEFF_Msk) == 0 ) {} + + // Ditto here- disable the endpoint. + epout[epnum].doepctl |= DOEPCTL_EPDIS | (stall ? DOEPCTL_STALL : 0); + while ( (epout[epnum].doepint & DOEPINT_EPDISD_Msk) == 0 ) {} + + epout[epnum].doepint = DOEPINT_EPDISD; + + // Allow other OUT endpoints to keep receiving. + dwc2->dctl |= DCTL_CGONAK; + } + } +} + +/** + * Close an endpoint. + */ +void dcd_edpt_close (uint8_t rhport, uint8_t ep_addr) +{ + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + + uint8_t const epnum = tu_edpt_number(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); + + dcd_edpt_disable(rhport, ep_addr, false); + + // Update max_size + xfer_status[epnum][dir].max_size = 0; // max_size = 0 marks a disabled EP - required for changing FIFO allocation + + if (dir == TUSB_DIR_IN) + { + uint16_t const fifo_size = (dwc2->dieptxf[epnum - 1] & DIEPTXF_INEPTXFD_Msk) >> DIEPTXF_INEPTXFD_Pos; + uint16_t const fifo_start = (dwc2->dieptxf[epnum - 1] & DIEPTXF_INEPTXSA_Msk) >> DIEPTXF_INEPTXSA_Pos; + + // For now only the last opened endpoint can be closed without fuss. + TU_ASSERT(fifo_start == _dwc2_controller[rhport].ep_fifo_size/4 - _allocated_fifo_words_tx,); + _allocated_fifo_words_tx -= fifo_size; + } + else + { + _out_ep_closed = true; // Set flag such that RX FIFO gets reduced in size once RX FIFO is empty + } +} + +void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr) +{ + dcd_edpt_disable(rhport, ep_addr, true); +} + +void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) +{ + (void) rhport; + + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + + uint8_t const epnum = tu_edpt_number(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); + + // Clear stall and reset data toggle + if ( dir == TUSB_DIR_IN ) + { + dwc2->epin[epnum].diepctl &= ~DIEPCTL_STALL; + dwc2->epin[epnum].diepctl |= DIEPCTL_SD0PID_SEVNFRM; + } + else + { + dwc2->epout[epnum].doepctl &= ~DOEPCTL_STALL; + dwc2->epout[epnum].doepctl |= DOEPCTL_SD0PID_SEVNFRM; + } +} + +/*------------------------------------------------------------------*/ + +// Read a single data packet from receive FIFO +static void read_fifo_packet(uint8_t rhport, uint8_t * dst, uint16_t len) +{ + (void) rhport; + + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + volatile const uint32_t * rx_fifo = dwc2->fifo[0]; + + // Reading full available 32 bit words from fifo + uint16_t full_words = len >> 2; + while(full_words--) + { + tu_unaligned_write32(dst, *rx_fifo); + dst += 4; + } + + // Read the remaining 1-3 bytes from fifo + uint8_t const bytes_rem = len & 0x03; + if ( bytes_rem != 0 ) + { + uint32_t const tmp = *rx_fifo; + dst[0] = tu_u32_byte0(tmp); + if ( bytes_rem > 1 ) dst[1] = tu_u32_byte1(tmp); + if ( bytes_rem > 2 ) dst[2] = tu_u32_byte2(tmp); + } +} + +// Write a single data packet to EPIN FIFO +static void write_fifo_packet(uint8_t rhport, uint8_t fifo_num, uint8_t const * src, uint16_t len) +{ + (void) rhport; + + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + volatile uint32_t * tx_fifo = dwc2->fifo[fifo_num]; + + // Pushing full available 32 bit words to fifo + uint16_t full_words = len >> 2; + while(full_words--) + { + *tx_fifo = tu_unaligned_read32(src); + src += 4; + } + + // Write the remaining 1-3 bytes into fifo + uint8_t const bytes_rem = len & 0x03; + if ( bytes_rem ) + { + uint32_t tmp_word = src[0]; + if ( bytes_rem > 1 ) tmp_word |= (src[1] << 8); + if ( bytes_rem > 2 ) tmp_word |= (src[2] << 16); + + *tx_fifo = tmp_word; + } +} + +static void handle_rxflvl_irq(uint8_t rhport) +{ + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + volatile uint32_t const * rx_fifo = dwc2->fifo[0]; + + // Pop control word off FIFO + uint32_t const ctl_word = dwc2->grxstsp; + uint8_t const pktsts = (ctl_word & GRXSTSP_PKTSTS_Msk ) >> GRXSTSP_PKTSTS_Pos; + uint8_t const epnum = (ctl_word & GRXSTSP_EPNUM_Msk ) >> GRXSTSP_EPNUM_Pos; + uint16_t const bcnt = (ctl_word & GRXSTSP_BCNT_Msk ) >> GRXSTSP_BCNT_Pos; + + dwc2_epout_t* epout = &dwc2->epout[epnum]; + +//#if CFG_TUSB_DEBUG >= DWC2_DEBUG +// const char * pktsts_str[] = +// { +// "ASSERT", "Global NAK (ISR)", "Out Data Received", "Out Transfer Complete (ISR)", +// "Setup Complete (ISR)", "ASSERT", "Setup Data Received" +// }; +// TU_LOG_LOCATION(); +// TU_LOG(DWC2_DEBUG, " EP %02X, Byte Count %u, %s\r\n", epnum, bcnt, pktsts_str[pktsts]); +// TU_LOG(DWC2_DEBUG, " daint = %08lX, doepint = %04X\r\n", (unsigned long) dwc2->daint, (unsigned int) epout->doepint); +//#endif + + switch ( pktsts ) + { + // Global OUT NAK: do nothing + case GRXSTS_PKTSTS_GLOBALOUTNAK: break; + + case GRXSTS_PKTSTS_SETUPRX: + // Setup packet received + + // We can receive up to three setup packets in succession, but + // only the last one is valid. + _setup_packet[0] = (*rx_fifo); + _setup_packet[1] = (*rx_fifo); + break; + + case GRXSTS_PKTSTS_SETUPDONE: + // Setup packet done (Interrupt) + epout->doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); + break; + + case GRXSTS_PKTSTS_OUTRX: + { + // Out packet received + xfer_ctl_t *xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); + + // Read packet off RxFIFO + if ( xfer->ff ) + { + // Ring buffer + tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void*) (uintptr_t) rx_fifo, bcnt); + } + else + { + // Linear buffer + read_fifo_packet(rhport, xfer->buffer, bcnt); + + // Increment pointer to xfer data + xfer->buffer += bcnt; + } + + // Truncate transfer length in case of short packet + if ( bcnt < xfer->max_size ) + { + xfer->total_len -= (epout->doeptsiz & DOEPTSIZ_XFRSIZ_Msk) >> DOEPTSIZ_XFRSIZ_Pos; + if ( epnum == 0 ) + { + xfer->total_len -= ep0_pending[TUSB_DIR_OUT]; + ep0_pending[TUSB_DIR_OUT] = 0; + } + } + } + break; + + // Out packet done (Interrupt) + case GRXSTS_PKTSTS_OUTDONE: + // Occurred on STM32L47 with dwc2 version 3.10a but not found on other version like 2.80a or 3.30a + // May (or not) be 3.10a specific feature/bug or depending on MCU configuration + // XFRC complete is additionally generated when + // - setup packet is received + // - complete the data stage of control write is complete + if ((epnum == 0) && (bcnt == 0) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) + { + uint32_t doepint = epout->doepint; + + if (doepint & (DOEPINT_STPKTRX | DOEPINT_OTEPSPR)) + { + // skip this "no-data" transfer complete event + // Note: STPKTRX will be clear later by setup received handler + uint32_t clear_flags = DOEPINT_XFRC; + + if (doepint & DOEPINT_OTEPSPR) clear_flags |= DOEPINT_OTEPSPR; + + epout->doepint = clear_flags; + + // TU_LOG(DWC2_DEBUG, " FIX extra transfer complete on setup/data compete\r\n"); + } + } + break; + + default: // Invalid + TU_BREAKPOINT(); + break; + } +} + +static void handle_epout_irq (uint8_t rhport) +{ + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + + // DAINT for a given EP clears when DOEPINTx is cleared. + // OEPINT will be cleared when DAINT's out bits are cleared. + for ( uint8_t n = 0; n < ep_count; n++ ) + { + if ( dwc2->daint & TU_BIT(DAINT_OEPINT_Pos + n) ) + { + dwc2_epout_t* epout = &dwc2->epout[n]; + + uint32_t const doepint = epout->doepint; + + // SETUP packet Setup Phase done. + if ( doepint & DOEPINT_STUP ) + { + uint32_t clear_flag = DOEPINT_STUP; + + // STPKTRX is only available for version from 3_00a + if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) + { + clear_flag |= DOEPINT_STPKTRX; + } + + epout->doepint = clear_flag; + dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); + } + + // OUT XFER complete + if ( epout->doepint & DOEPINT_XFRC ) + { + epout->doepint = DOEPINT_XFRC; + + xfer_ctl_t *xfer = XFER_CTL_BASE(n, TUSB_DIR_OUT); + + // EP0 can only handle one packet + if ( (n == 0) && ep0_pending[TUSB_DIR_OUT] ) + { + // Schedule another packet to be received. + edpt_schedule_packets(rhport, n, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); + } + else + { + dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true); + } + } + } + } +} + +static void handle_epin_irq (uint8_t rhport) +{ + dwc2_regs_t * dwc2 = DWC2_REG(rhport); + uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + dwc2_epin_t* epin = dwc2->epin; + + // DAINT for a given EP clears when DIEPINTx is cleared. + // IEPINT will be cleared when DAINT's out bits are cleared. + for ( uint8_t n = 0; n < ep_count; n++ ) + { + if ( dwc2->daint & TU_BIT(DAINT_IEPINT_Pos + n) ) + { + // IN XFER complete (entire xfer). + xfer_ctl_t *xfer = XFER_CTL_BASE(n, TUSB_DIR_IN); + + if ( epin[n].diepint & DIEPINT_XFRC ) + { + epin[n].diepint = DIEPINT_XFRC; + + // EP0 can only handle one packet + if ( (n == 0) && ep0_pending[TUSB_DIR_IN] ) + { + // Schedule another packet to be transmitted. + edpt_schedule_packets(rhport, n, TUSB_DIR_IN, 1, ep0_pending[TUSB_DIR_IN]); + } + else + { + dcd_event_xfer_complete(rhport, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); + } + } + + // XFER FIFO empty + if ( (epin[n].diepint & DIEPINT_TXFE) && (dwc2->diepempmsk & (1 << n)) ) + { + // diepint's TXFE bit is read-only, software cannot clear it. + // It will only be cleared by hardware when written bytes is more than + // - 64 bytes or + // - Half of TX FIFO size (configured by DIEPTXF) + + uint16_t remaining_packets = (epin[n].dieptsiz & DIEPTSIZ_PKTCNT_Msk) >> DIEPTSIZ_PKTCNT_Pos; + + // Process every single packet (only whole packets can be written to fifo) + for ( uint16_t i = 0; i < remaining_packets; i++ ) + { + uint16_t const remaining_bytes = (epin[n].dieptsiz & DIEPTSIZ_XFRSIZ_Msk) >> DIEPTSIZ_XFRSIZ_Pos; + + // Packet can not be larger than ep max size + uint16_t const packet_size = tu_min16(remaining_bytes, xfer->max_size); + + // It's only possible to write full packets into FIFO. Therefore DTXFSTS register of current + // EP has to be checked if the buffer can take another WHOLE packet + if ( packet_size > ((epin[n].dtxfsts & DTXFSTS_INEPTFSAV_Msk) << 2) ) break; + + // Push packet to Tx-FIFO + if ( xfer->ff ) + { + volatile uint32_t *tx_fifo = dwc2->fifo[n]; + tu_fifo_read_n_const_addr_full_words(xfer->ff, (void*) (uintptr_t) tx_fifo, packet_size); + } + else + { + write_fifo_packet(rhport, n, xfer->buffer, packet_size); + + // Increment pointer to xfer data + xfer->buffer += packet_size; + } + } + + // Turn off TXFE if all bytes are written. + if ( ((epin[n].dieptsiz & DIEPTSIZ_XFRSIZ_Msk) >> DIEPTSIZ_XFRSIZ_Pos) == 0 ) + { + dwc2->diepempmsk &= ~(1 << n); + } + } + } + } +} + +void dcd_int_handler(uint8_t rhport) +{ + dwc2_regs_t *dwc2 = DWC2_REG(rhport); + + uint32_t const int_mask = dwc2->gintmsk; + uint32_t const int_status = dwc2->gintsts & int_mask; + + if(int_status & GINTSTS_USBRST) + { + // USBRST is start of reset. + dwc2->gintsts = GINTSTS_USBRST; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + _allocated_fifos = 1; +#endif + bus_reset(rhport); + } + + if(int_status & GINTSTS_ENUMDNE) + { + // ENUMDNE is the end of reset where speed of the link is detected + + dwc2->gintsts = GINTSTS_ENUMDNE; + + tusb_speed_t speed; + switch ((dwc2->dsts & DSTS_ENUMSPD_Msk) >> DSTS_ENUMSPD_Pos) + { + case DSTS_ENUMSPD_HS: + speed = TUSB_SPEED_HIGH; + break; + + case DSTS_ENUMSPD_LS: + speed = TUSB_SPEED_LOW; + break; + + case DSTS_ENUMSPD_FS_HSPHY: + case DSTS_ENUMSPD_FS: + default: + speed = TUSB_SPEED_FULL; + break; + } + + dcd_event_bus_reset(rhport, speed, true); + } + + if(int_status & GINTSTS_USBSUSP) + { + dwc2->gintsts = GINTSTS_USBSUSP; + //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); + dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + _allocated_fifos = 1; +#endif + } + + if(int_status & GINTSTS_WKUINT) + { + dwc2->gintsts = GINTSTS_WKUINT; + dcd_event_bus_signal(rhport, DCD_EVENT_RESUME, true); + } + + // TODO check GINTSTS_DISCINT for disconnect detection + // if(int_status & GINTSTS_DISCINT) + + if(int_status & GINTSTS_OTGINT) + { + // OTG INT bit is read-only + uint32_t const otg_int = dwc2->gotgint; + + if (otg_int & GOTGINT_SEDET) + { + dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + _allocated_fifos = 1; +#endif + } + + dwc2->gotgint = otg_int; + } + + if(int_status & GINTSTS_SOF) + { + dwc2->gotgint = GINTSTS_SOF; + + if (_sof_en) + { + uint32_t frame = (dwc2->dsts & (DSTS_FNSOF)) >> 8; + dcd_event_sof(rhport, frame, true); + } + else + { + // Disable SOF interrupt if SOF was not explicitly enabled. SOF was used for remote wakeup detection + dwc2->gintmsk &= ~GINTMSK_SOFM; + } + + dcd_event_bus_signal(rhport, DCD_EVENT_SOF, true); + } + + // RxFIFO non-empty interrupt handling. + if(int_status & GINTSTS_RXFLVL) + { + // RXFLVL bit is read-only + + // Mask out RXFLVL while reading data from FIFO + dwc2->gintmsk &= ~GINTMSK_RXFLVLM; + + // Loop until all available packets were handled + do + { + handle_rxflvl_irq(rhport); + } while(dwc2->gotgint & GINTSTS_RXFLVL); + + // Manage RX FIFO size + if (_out_ep_closed) + { + update_grxfsiz(rhport); + + // Disable flag + _out_ep_closed = false; + } + + dwc2->gintmsk |= GINTMSK_RXFLVLM; + } + + // OUT endpoint interrupt handling. + if(int_status & GINTSTS_OEPINT) + { + // OEPINT is read-only, clear using DOEPINTn + handle_epout_irq(rhport); + } + + // IN endpoint interrupt handling. + if(int_status & GINTSTS_IEPINT) + { + // IEPINT bit read-only, clear using DIEPINTn + handle_epin_irq(rhport); + } + + // // Check for Incomplete isochronous IN transfer + // if(int_status & GINTSTS_IISOIXFR) { + // printf(" IISOIXFR!\r\n"); + //// TU_LOG(DWC2_DEBUG, " IISOIXFR!\r\n"); + // } +} + +#endif From ac0ad86255ccf171ffb790f7365781f6282fc85b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 6 Jun 2023 11:39:32 +0200 Subject: [PATCH 141/636] Update dcd_esp32sx.c --- components/arduino_tinyusb/src/dcd_esp32sx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_esp32sx.c b/components/arduino_tinyusb/src/dcd_esp32sx.c index 29fbe99cb..cfccf95ae 100755 --- a/components/arduino_tinyusb/src/dcd_esp32sx.c +++ b/components/arduino_tinyusb/src/dcd_esp32sx.c @@ -482,7 +482,8 @@ void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) } else { // Stop transmitting packets and NAK IN xfers. in_ep[epnum].diepctl |= USB_DI_SNAK1_M; - while ((in_ep[epnum].diepint & USB_DI_SNAK1_M) == 0) ; + // while ((in_ep[epnum].diepint & USB_DI_SNAK1_M) == 0) ; + while ((in_ep[epnum].diepint & USB_D_INEPNAKEFF1_M) == 0) ; // Disable the endpoint. Note that both SNAK and STALL are set here. in_ep[epnum].diepctl |= (USB_DI_SNAK1_M | USB_D_STALL1_M | USB_D_EPDIS1_M); @@ -492,9 +493,16 @@ void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) // Flush the FIFO, and wait until we have confirmed it cleared. uint8_t const fifo_num = ((in_ep[epnum].diepctl >> USB_D_TXFNUM1_S) & USB_D_TXFNUM1_V); - USB0.grstctl |= (fifo_num << USB_TXFNUM_S); - USB0.grstctl |= USB_TXFFLSH_M; + // USB0.grstctl |= (fifo_num << USB_TXFNUM_S); + // USB0.grstctl |= USB_TXFFLSH_M; + // while ((USB0.grstctl & USB_TXFFLSH_M) != 0) ; + uint32_t rstctl_last = USB0.grstctl; + uint32_t rstctl = USB_TXFFLSH_M; + rstctl |= (fifo_num << USB_TXFNUM_S); + USB0.grstctl = rstctl; while ((USB0.grstctl & USB_TXFFLSH_M) != 0) ; + USB0.grstctl = rstctl_last; + // TODO: Clear grstctl::fifo_num after fifo flsh } else { // Only disable currently enabled non-control endpoint if ((epnum == 0) || !(out_ep[epnum].doepctl & USB_EPENA0_M)) { From ec5d9a5362b6ea83b00a76fdac7c4075c356f295 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Jun 2023 11:40:22 +0200 Subject: [PATCH 142/636] C6 --- configs/builds.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/configs/builds.json b/configs/builds.json index 8ef8cf83e..5390e40ec 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -4,7 +4,7 @@ "file":"libspi_flash.a", "src":"build/esp-idf/spi_flash/libspi_flash.a", "out":"lib/libspi_flash.a", - "targets":["esp32","esp32c3","esp32s2","esp32s3"] + "targets":["esp32","esp32c3","esp32s2","esp32s3","esp32c6"] }, { "file":"libesp_psram.a", @@ -44,6 +44,20 @@ } ], "targets":[ + { + "target": "esp32c6", + "features":[], + "idf_libs":["qio","80m"], + "bootloaders":[ + ["qio","80m"], + ["dio","80m"], + ["qio","40m"], + ["qio","40m"] + ], + "mem_variants":[ + ["dio","80m"] + ] + }, { "target": "esp32s3", "features":["esp_sr"], From d7d7bfda540dfa0ec7d2a43df3404dc8d23ea745 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Jun 2023 11:41:29 +0200 Subject: [PATCH 143/636] Create defconfig.esp32c6 --- configs/defconfig.esp32c6 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 configs/defconfig.esp32c6 diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 new file mode 100644 index 000000000..ced594733 --- /dev/null +++ b/configs/defconfig.esp32c6 @@ -0,0 +1,4 @@ +CONFIG_BT_BLE_BLUFI_ENABLE=y +CONFIG_RTC_CLK_CAL_CYCLES=576 +# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 From 8458c3a3d6bd44688065058aacda6fca09f5ab11 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Jun 2023 11:45:13 +0200 Subject: [PATCH 144/636] Update update-components.sh --- tools/update-components.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/update-components.sh b/tools/update-components.sh index 8f481cf07..ac8ef37f9 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -83,6 +83,11 @@ if [ $? -ne 0 ]; then exit 1; fi #echo "Updating ESP-DL..." #if [ ! -d "$AR_COMPS/esp-dl" ]; then # git clone $DL_REPO_URL "$AR_COMPS/esp-dl" +# mv "$AR_COMPS/esp-dl/CMakeLists.txt" "$AR_COMPS/esp-dl/CMakeListsOld.txt" +# echo "idf_build_get_property(target IDF_TARGET)" > "$AR_COMPS/esp-dl/CMakeLists.txt" +# echo "if(NOT \${IDF_TARGET} STREQUAL \"esp32c6\")" >> "$AR_COMPS/esp-dl/CMakeLists.txt" +# cat "$AR_COMPS/esp-dl/CMakeListsOld.txt" >> "$AR_COMPS/esp-dl/CMakeLists.txt" +# echo "endif()" >> "$AR_COMPS/esp-dl/CMakeLists.txt" #else # git -C "$AR_COMPS/esp-dl" fetch && \ # git -C "$AR_COMPS/esp-dl" pull --ff-only @@ -130,6 +135,7 @@ if [ $? -ne 0 ]; then exit 1; fi # echo "if(IDF_TARGET STREQUAL \"esp32s3\")" > "$AR_COMPS/esp-sr/CMakeLists.txt" # cat "$AR_COMPS/esp-sr/CMakeListsOld.txt" >> "$AR_COMPS/esp-sr/CMakeLists.txt" # echo "endif()" >> "$AR_COMPS/esp-sr/CMakeLists.txt" +# echo " - esp32c6" >> "$AR_COMPS/esp-sr/idf_component.yml" #else # git -C "$AR_COMPS/esp-sr" fetch && \ # git -C "$AR_COMPS/esp-sr" pull --ff-only From d65c2b3aefe57f9c0f5206757cae8e62fe6237af Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Jun 2023 11:52:42 +0200 Subject: [PATCH 145/636] branch feature/esp32c6-support --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 0280007a3..3aa60446f 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -18,7 +18,7 @@ fi if [ -z $AR_PR_TARGET_BRANCH ]; then # Temporary to get CI working. original is master - AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" + AR_PR_TARGET_BRANCH="feature/esp32c6-support" fi if [ -z $IDF_TARGET ]; then From ad383c8729005a6a7acb5c8b3aad4560a95416ae Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Jun 2023 12:06:19 +0200 Subject: [PATCH 146/636] feature/esp32c6-support --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 3aa60446f..f306f68ac 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -39,7 +39,7 @@ AR_USER="tasmota" AR_REPO="$AR_USER/arduino-esp32" # Arduino branch to use -AR_BRANCH="esp-idf-v5.1-libs" +AR_BRANCH="feature/esp32c6-support" # The full name of the repository AR_REPO="$AR_USER/arduino-esp32" From 0b08367327441e8873972ea455c732756793ed20 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Jun 2023 17:29:03 +0200 Subject: [PATCH 147/636] Remove -mlongcalls for non-xtensa chips --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 48217a405..3a888d1e2 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -166,7 +166,7 @@ else if [ "$IDF_TARGET" = "esp32" ]; then flags="-Wno-frame-address $flags" fi - if [ "$IDF_TARGET" != "esp32c3" ]; then + if [ "$IS_XTENSA" = "y" ]; then flags="-mlongcalls $flags" fi str="$flags $libs $paths" From bb35f7176b93517fa773e28c5ee8542d37deae82 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 1 Jul 2023 10:48:29 +0200 Subject: [PATCH 148/636] esp-idf-v5.1-libs --- tools/config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index f306f68ac..2f98e5eb2 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -18,7 +18,7 @@ fi if [ -z $AR_PR_TARGET_BRANCH ]; then # Temporary to get CI working. original is master - AR_PR_TARGET_BRANCH="feature/esp32c6-support" + AR_PR_TARGET_BRANCH="release/v5.1" fi if [ -z $IDF_TARGET ]; then @@ -39,7 +39,7 @@ AR_USER="tasmota" AR_REPO="$AR_USER/arduino-esp32" # Arduino branch to use -AR_BRANCH="feature/esp32c6-support" +AR_BRANCH="esp-idf-v5.1-libs" # The full name of the repository AR_REPO="$AR_USER/arduino-esp32" From 4fb14710c0488f8d84c4d665ea5e911b37c5805a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:25:31 +0200 Subject: [PATCH 149/636] Create defconfig.16m --- configs/defconfig.16m | 1 + 1 file changed, 1 insertion(+) create mode 100644 configs/defconfig.16m diff --git a/configs/defconfig.16m b/configs/defconfig.16m new file mode 100644 index 000000000..8fd9f172b --- /dev/null +++ b/configs/defconfig.16m @@ -0,0 +1 @@ +CONFIG_ESPTOOLPY_FLASHFREQ_16M=y From 7ac2c531c4badca22759d8ce3269dea44a3c34f2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:26:03 +0200 Subject: [PATCH 150/636] Create defconfig.64m --- configs/defconfig.64m | 1 + 1 file changed, 1 insertion(+) create mode 100644 configs/defconfig.64m diff --git a/configs/defconfig.64m b/configs/defconfig.64m new file mode 100644 index 000000000..c0d361666 --- /dev/null +++ b/configs/defconfig.64m @@ -0,0 +1 @@ +CONFIG_ESPTOOLPY_FLASHFREQ_64M=y From f064198a4a3ca3067695fa92d6666df217df0d42 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:26:46 +0200 Subject: [PATCH 151/636] Create defconfig.esp32h2 --- configs/defconfig.esp32h2 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 configs/defconfig.esp32h2 diff --git a/configs/defconfig.esp32h2 b/configs/defconfig.esp32h2 new file mode 100644 index 000000000..ced594733 --- /dev/null +++ b/configs/defconfig.esp32h2 @@ -0,0 +1,4 @@ +CONFIG_BT_BLE_BLUFI_ENABLE=y +CONFIG_RTC_CLK_CAL_CYCLES=576 +# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 From 74f9b6f88a7bf783ed8261595ef10217f478c3f6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:28:51 +0200 Subject: [PATCH 152/636] Update builds.json --- configs/builds.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/configs/builds.json b/configs/builds.json index 5390e40ec..8604a07c7 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -4,7 +4,7 @@ "file":"libspi_flash.a", "src":"build/esp-idf/spi_flash/libspi_flash.a", "out":"lib/libspi_flash.a", - "targets":["esp32","esp32c3","esp32s2","esp32s3","esp32c6"] + "targets":["esp32","esp32c3","esp32s2","esp32s3","esp32c6","esp32h2"] }, { "file":"libesp_psram.a", @@ -44,6 +44,20 @@ } ], "targets":[ + { + "target": "esp32h2", + "features":[], + "idf_libs":["qio","64m"], + "bootloaders":[ + ["qio","64m"], + ["dio","64m"], + ["qio","16m"], + ["dio","16m"] + ], + "mem_variants":[ + ["dio","64m"] + ] + }, { "target": "esp32c6", "features":[], From 0b4fc9b6ff3b67b3c853fd30baea5a1b9b1ad41e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:30:01 +0200 Subject: [PATCH 153/636] Update Kconfig.projbuild --- main/Kconfig.projbuild | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 8e6ddef14..71fcc41cc 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -10,10 +10,13 @@ config LIB_BUILDER_FLASHFREQ string default "120m" if ESPTOOLPY_FLASHFREQ_120M default "80m" if ESPTOOLPY_FLASHFREQ_80M + default "64m" if ESPTOOLPY_FLASHFREQ_64M default "40m" if ESPTOOLPY_FLASHFREQ_40M + default "32m" if ESPTOOLPY_FLASHFREQ_32M default "26m" if ESPTOOLPY_FLASHFREQ_26M default "20m" if ESPTOOLPY_FLASHFREQ_20M + default "16m" if ESPTOOLPY_FLASHFREQ_16M config LIB_BUILDER_COMPILE bool - default y \ No newline at end of file + default y From 234ec1d933683f363a942224a22dc2c944b744c3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:31:10 +0200 Subject: [PATCH 154/636] Create get_projbuild_gitconfig.py --- tools/get_projbuild_gitconfig.py | 124 +++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 tools/get_projbuild_gitconfig.py diff --git a/tools/get_projbuild_gitconfig.py b/tools/get_projbuild_gitconfig.py new file mode 100644 index 000000000..befbe6fb1 --- /dev/null +++ b/tools/get_projbuild_gitconfig.py @@ -0,0 +1,124 @@ +# This file is expected to be present in ${COMPONENT_DIR} +# accessed from components/esp_insights/CMakeLists.txt +# Used in: +# 1. Project ESP Insights build package tar file + +#from __future__ import unicode_literals +import os +import sys +import json +import subprocess +from builtins import range, str +from io import open + +# Input project directory from CMakeLists.txt +PROJ_DIR=sys.argv[1] +# Input project name +PROJ_NAME=sys.argv[2] +# Input project version +PROJ_VER=sys.argv[3] +# Input custom config filename from CMakeLists.txt +FILENAME=sys.argv[4] +# Input IDF_PATH from CMakeLists.txt +IDF_PATH=sys.argv[5] +# Input target +TARGET=sys.argv[6] + +NEWLINE = "\n" + +CONFIG = {} + +# Set Config + +# Set current directory i.e Set ${COMPONENT_DIR} as current directory +CURR_DIR = os.getcwd() + +def _change_dir(dirname): + # Change directory + os.chdir(dirname) + + +def _set_submodule_cfg(submodules, repo_name): + # Set config for submodules + CFG_TITLE = "submodules" + NAME_STR = "name" + VERSION_STR = "version" + CONFIG[repo_name][CFG_TITLE] = [] + + if submodules: + # Get the submodule name and version + submodules_list = submodules.strip().split(NEWLINE) + for i in range(0, len(submodules_list), 2): + name = submodules_list[i].split('\'')[1] + version = submodules_list[i+1] + submodule_json = { NAME_STR: name, VERSION_STR: version } + CONFIG[repo_name][CFG_TITLE].append(submodule_json) + + +def run_cmd(command, get_basename=False): + try: + resp = subprocess.check_output(command, shell=True).strip().decode('utf-8') + if get_basename: + resp = os.path.basename(resp) + return resp + except subprocess.CalledProcessError: + raise Exception("ERROR: Please check command : {}".format(command)) + +def set_cfg(config_name): + # Set config for ESP-IDF Repo + if config_name == "esp-idf": + # Get repo name (for IDF repo) + REPO_CMD='git rev-parse --show-toplevel' + repo_name = run_cmd(REPO_CMD, get_basename=True) + CONFIG[repo_name] = {} + + # Get commit HEAD + GITHEAD_STR = "HEAD" + HEAD='git describe --always --tags --dirty' + head_ver = run_cmd(HEAD) + CONFIG[repo_name][GITHEAD_STR] = head_ver + + # Get submodule latest refs + SUBMODULE = 'git submodule foreach git describe --always --tags --dirty' + submodules = run_cmd(SUBMODULE) + _set_submodule_cfg(submodules, repo_name) + elif config_name == "toolchain": + # Set config for Toolchain Version + arch_target = "xtensa-" + TARGET + if TARGET == "esp32c3" or TARGET == "esp32c2" or TARGET == "esp32h2" or TARGET == "esp32c6": + arch_target = "riscv32-esp" + # Get toolchain version + TOOLCHAIN_STR = "toolchain" + TOOLCHAIN = arch_target + '-elf-gcc --version' + toolchain = run_cmd(TOOLCHAIN) + CONFIG[TOOLCHAIN_STR] = toolchain.strip().split(NEWLINE)[0] + +# Set project details - name and version +def set_project_details(): + # Set project name and version + CONFIG['project'] = {} + CONFIG['project']['name'] = PROJ_NAME + CONFIG['project']['version'] = PROJ_VER + +try: + with open(FILENAME, "w+", encoding="utf-8") as output_file: + # ESP-IDF REPO CONFIG + # Change to ESP-IDF Directory + _change_dir(IDF_PATH) + set_cfg("esp-idf") + + # Change back to ${COMPONENT_DIR} + _change_dir(CURR_DIR) + + # Set project name and version + set_project_details() + + # GET TOOLCHAIN VERSION + set_cfg("toolchain") + + output_file.write(str(json.dumps(CONFIG, indent=4, sort_keys=True))) + +except Exception as e: + # Remove config file created if error occurs + os.system("rm " + FILENAME) + sys.exit(e) From 427172bcab9c82ba0b9b77fdfd12115c1e1bba2e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:34:10 +0200 Subject: [PATCH 155/636] Update update-components.sh --- tools/update-components.sh | 53 -------------------------------------- 1 file changed, 53 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index ac8ef37f9..8bd80c299 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -77,27 +77,6 @@ else fi if [ $? -ne 0 ]; then exit 1; fi -## -## CLONE/UPDATE ESP-DL -## -#echo "Updating ESP-DL..." -#if [ ! -d "$AR_COMPS/esp-dl" ]; then -# git clone $DL_REPO_URL "$AR_COMPS/esp-dl" -# mv "$AR_COMPS/esp-dl/CMakeLists.txt" "$AR_COMPS/esp-dl/CMakeListsOld.txt" -# echo "idf_build_get_property(target IDF_TARGET)" > "$AR_COMPS/esp-dl/CMakeLists.txt" -# echo "if(NOT \${IDF_TARGET} STREQUAL \"esp32c6\")" >> "$AR_COMPS/esp-dl/CMakeLists.txt" -# cat "$AR_COMPS/esp-dl/CMakeListsOld.txt" >> "$AR_COMPS/esp-dl/CMakeLists.txt" -# echo "endif()" >> "$AR_COMPS/esp-dl/CMakeLists.txt" -#else -# git -C "$AR_COMPS/esp-dl" fetch && \ -# git -C "$AR_COMPS/esp-dl" pull --ff-only -#fi -#if [ $? -ne 0 ]; then exit 1; fi -##this is a temp measure to fix build issue -#if [ -f "$AR_COMPS/esp-dl/idf_component.yml" ]; then -# rm -rf "$AR_COMPS/esp-dl/idf_component.yml" -#fi - # # CLONE/UPDATE ESP-LITTLEFS # @@ -123,35 +102,3 @@ else git -C "$AR_COMPS/arduino_tinyusb/tinyusb" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi - -## -## CLONE/UPDATE ESP-SR -## -#SR_REPO_URL="https://github.com/espressif/esp-sr.git" -#echo "Updating ESP-SR..." -#if [ ! -d "$AR_COMPS/esp-sr" ]; then -# git clone $SR_REPO_URL "$AR_COMPS/esp-sr" -# mv "$AR_COMPS/esp-sr/CMakeLists.txt" "$AR_COMPS/esp-sr/CMakeListsOld.txt" -# echo "if(IDF_TARGET STREQUAL \"esp32s3\")" > "$AR_COMPS/esp-sr/CMakeLists.txt" -# cat "$AR_COMPS/esp-sr/CMakeListsOld.txt" >> "$AR_COMPS/esp-sr/CMakeLists.txt" -# echo "endif()" >> "$AR_COMPS/esp-sr/CMakeLists.txt" -# echo " - esp32c6" >> "$AR_COMPS/esp-sr/idf_component.yml" -#else -# git -C "$AR_COMPS/esp-sr" fetch && \ -# git -C "$AR_COMPS/esp-sr" pull --ff-only -#fi -#if [ $? -ne 0 ]; then exit 1; fi - -# # -# # CLONE/UPDATE ESP-DSP -# # -# DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" -# echo "Updating ESP-DSP..." -# if [ ! -d "$AR_COMPS/espressif__esp-dsp" ]; then -# git clone $DSP_REPO_URL "$AR_COMPS/espressif__esp-dsp" -# else -# git -C "$AR_COMPS/espressif__esp-dsp" fetch && \ -# git -C "$AR_COMPS/espressif__esp-dsp" pull --ff-only -# fi -# if [ $? -ne 0 ]; then exit 1; fi - From a7868471e75ea845cabc9dae1e3accea33c6541c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 20 Jul 2023 16:04:40 +0200 Subject: [PATCH 156/636] Update copy-libs.sh --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 3a888d1e2..2542a9a31 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -365,7 +365,7 @@ for item; do ipath="$item" fname=`basename "$ipath"` dname=`basename $(dirname "$ipath")` - if [[ "$fname" == "main" && "$dname" == "esp32-arduino-lib-builder" ]]; then + if [[ "$fname" == "main" && "$dname" == $(basename "$PWD") ]]; then continue fi while [[ "$dname" != "components" && "$dname" != "managed_components" && "$dname" != "build" ]]; do From 3f66a7bc1c4ddca0f1c6950b8ebdf719f1fe5b6a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:23:36 +0200 Subject: [PATCH 157/636] Remove not needed flash / sped variants --- configs/builds.json | 53 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/configs/builds.json b/configs/builds.json index 8604a07c7..bfac61cc2 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -66,33 +66,30 @@ ["qio","80m"], ["dio","80m"], ["qio","40m"], - ["qio","40m"] + ["dio","40m"] ], "mem_variants":[ ["dio","80m"] ] }, { - "target": "esp32s3", - "features":["esp_sr"], - "idf_libs":["qio","80m","opi_ram"], + "target": "esp32c3", + "features":[], + "idf_libs":["qio","80m"], "bootloaders":[ - ["qio","120m","qio_ram"], - ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], - ["opi","80m","opi_ram"] + ["qio","80m"], + ["dio","80m"], + ["qio","40m"], + ["dio","40m"] ], "mem_variants":[ - ["qio","120m","qio_ram"], - ["qio","80m","qio_ram"], - ["opi","80m","opi_ram"], - ["opi","80m","qio_ram"] + ["dio","80m"] ] }, { - "target": "esp32s2", + "target": "esp32", "features":["qio_ram"], - "idf_libs":["dio","80m"], + "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], ["dio","80m"], @@ -100,13 +97,13 @@ ["dio","40m"] ], "mem_variants":[ - ["qio","80m"] + ["dio","80m"] ] }, { - "target": "esp32c3", + "target": "esp32s2", "features":["qio_ram"], - "idf_libs":["dio","80m"], + "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], ["dio","80m"], @@ -114,22 +111,24 @@ ["dio","40m"] ], "mem_variants":[ - ["qio","80m"] + ["dio","80m"] ] }, { - "target": "esp32", - "features":["qio_ram"], - "idf_libs":["dio","40m"], + "target": "esp32s3", + "features":[], + "idf_libs":["qio","80m","opi_ram"], "bootloaders":[ - ["qio","80m"], - ["dio","80m"], - ["qio","40m"], - ["dio","40m"] + ["qio","120m","qio_ram"], + ["qio","80m","qio_ram"], + ["qio","80m","opi_ram"], + ["opi","80m","opi_ram"] ], "mem_variants":[ - ["dio","80m"], - ["qio","80m"] + ["qio","120m","qio_ram"], + ["qio","80m","qio_ram"], + ["opi","80m","opi_ram"], + ["opi","80m","qio_ram"] ] } ] From 7dc03de90f4251e638b64a95754b1a623ea64bc1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:25:25 +0200 Subject: [PATCH 158/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 3fa8a8e58..0ca6083db 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -73,12 +73,10 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito if [ "$LIBS_HAS_COMMIT" == "1" ]; then echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in esp32-arduino-libs" - mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in esp32-arduino-libs" > dist/log.txt fi if [ "$AR_HAS_COMMIT" == "1" ]; then echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in arduino-esp32" - mkdir -p dist && echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in arduino-esp32" > dist/log.txt fi if [ "$LIBS_HAS_COMMIT" == "1" ] && [ "$AR_HAS_COMMIT" == "1" ]; then From 8a703978b95654ebef13a57f67f87369d78f9844 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:34:06 +0200 Subject: [PATCH 159/636] Update config.sh --- tools/config.sh | 140 +++++++++++++++++++++++++++++------------------- 1 file changed, 85 insertions(+), 55 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 2f98e5eb2..7a94b529d 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -83,27 +83,27 @@ rm -rf release-info.txt echo "Framework built from Tasmota IDF branch $IDF_BRANCH commit $IDF_COMMIT and $AR_REPO branch $AR_BRANCH commit $AR_COMMIT" >> release-info.txt function get_os(){ - OSBITS=`arch` - if [[ "$OSTYPE" == "linux"* ]]; then + OSBITS=`arch` + if [[ "$OSTYPE" == "linux"* ]]; then if [[ "$OSBITS" == "i686" ]]; then - echo "linux32" + echo "linux32" elif [[ "$OSBITS" == "x86_64" ]]; then - echo "linux64" + echo "linux64" elif [[ "$OSBITS" == "armv7l" ]]; then - echo "linux-armel" + echo "linux-armel" else - echo "unknown" - return 1 + echo "unknown" + return 1 fi - elif [[ "$OSTYPE" == "darwin"* ]]; then - echo "macos" - elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then - echo "win32" - else - echo "$OSTYPE" - return 1 - fi - return 0 + elif [[ "$OSTYPE" == "darwin"* ]]; then + echo "macos" + elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then + echo "win32" + else + echo "$OSTYPE" + return 1 + fi + return 0 } AR_OS=`get_os` @@ -112,53 +112,83 @@ export SED="sed" export SSTAT="stat -c %s" if [[ "$AR_OS" == "macos" ]]; then - if ! [ -x "$(command -v gsed)" ]; then - echo "ERROR: gsed is not installed! Please install gsed first. ex. brew install gsed" - exit 1 - fi - if ! [ -x "$(command -v gawk)" ]; then - echo "ERROR: gawk is not installed! Please install gawk first. ex. brew install gawk" - exit 1 - fi - export SED="gsed" - export SSTAT="stat -f %z" + if ! [ -x "$(command -v gsed)" ]; then + echo "ERROR: gsed is not installed! Please install gsed first. ex. brew install gsed" + exit 1 + fi + if ! [ -x "$(command -v gawk)" ]; then + echo "ERROR: gawk is not installed! Please install gawk first. ex. brew install gawk" + exit 1 + fi + export SED="gsed" + export SSTAT="stat -f %z" fi -function git_commit_exists(){ #git_commit_exists <repo-path> <commit-message> - local repo_path="$1" - local commit_message="$2" - local commits_found=`git -C "$repo_path" log --all --grep="$commit_message" | grep commit` - if [ -n "$commits_found" ]; then echo 1; else echo 0; fi +function github_commit_exists(){ #github_commit_exists <repo-path> <branch-name> <commit-message> + local repo_path="$1" + local branch_name="$2" + local commit_message="$3" + 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` + if [ ! "$commits_found" == "" ] && [ ! "$commits_found" == "null" ] && [ ! "$commits_found" == "0" ]; then echo $commits_found; else echo 0; fi +} + +function github_last_commit(){ # github_last_commit <repo-path> <branch-name> + local repo_path="$1" + local branch_name="$2" + 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'` + if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then + echo ${commit:0:8} + else + echo "" + fi +} + +function github_branch_exists(){ # github_branch_exists <repo-path> <branch-name> + local repo_path="$1" + local branch_name="$2" + 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'` + if [ "$branch" == "$branch_name" ]; then echo 1; else echo 0; fi +} + +function github_pr_exists(){ # github_pr_exists <repo-path> <branch-name> + local repo_path="$1" + local branch_name="$2" + 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'` + if [ ! "$pr_num" == "" ] && [ ! "$pr_num" == "null" ]; then echo 1; else echo 0; fi } + + function git_branch_exists(){ # git_branch_exists <repo-path> <branch-name> - local repo_path="$1" - local branch_name="$2" - local branch_found=`git -C "$repo_path" ls-remote --heads origin "$branch_name"` - if [ -n "$branch_found" ]; then echo 1; else echo 0; fi + local repo_path="$1" + local branch_name="$2" + local branch_found=`git -C "$repo_path" ls-remote --heads origin "$branch_name"` + if [ -n "$branch_found" ]; then echo 1; else echo 0; fi } -function git_pr_exists(){ # git_pr_exists <branch-name> - local pr_num=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$AR_REPO/pulls?head=$AR_USER:$1&state=open" | jq -r '.[].number'` - if [ ! "$pr_num" == "" ] && [ ! "$pr_num" == "null" ]; then echo 1; else echo 0; fi +function git_commit_exists(){ #git_commit_exists <repo-path> <commit-message> + local repo_path="$1" + local commit_message="$2" + local commits_found=`git -C "$repo_path" log --all --grep="$commit_message" | grep commit` + if [ -n "$commits_found" ]; then echo 1; else echo 0; fi } function git_create_pr(){ # git_create_pr <branch> <title> - local pr_branch="$1" - local pr_title="$2" - local pr_target="$3" - local pr_body="" - pr_body+="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)"\r\n" - for component in `ls "$AR_COMPS"`; do - if [ ! $component == "arduino" ]; then - if [ -d "$AR_COMPS/$component/.git" ] || [ -d "$AR_COMPS/$component/.github" ]; then - pr_body+="$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)"\r\n" - fi - fi - done - pr_body+="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)"\r\n" - local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" - 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"` - local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` - if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi + local pr_branch="$1" + local pr_title="$2" + local pr_target="$3" + local pr_body="" + pr_body+="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)"\r\n" + for component in `ls "$AR_COMPS"`; do + if [ ! $component == "arduino" ]; then + if [ -d "$AR_COMPS/$component/.git" ] || [ -d "$AR_COMPS/$component/.github" ]; then + pr_body+="$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)"\r\n" + fi + fi + done + pr_body+="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)"\r\n" + local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" + 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"` + local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` + if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi } From 63d0ecef83bab5cea4e4b0d589751653d6ac16f3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:39:22 +0200 Subject: [PATCH 160/636] Update config.sh --- tools/config.sh | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 7a94b529d..af47e3382 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -2,34 +2,30 @@ if [ -z $IDF_PATH ]; then - export IDF_PATH="$PWD/esp-idf" + export IDF_PATH="$PWD/esp-idf" fi -# The ESP32 IDF repository -IDF_REPO_URL="https://github.com/tasmota/esp-idf.git" - -# The IDF branch to use if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v5.1" + IDF_BRANCH="release/v5.1" fi # IDF commit to use #IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" if [ -z $AR_PR_TARGET_BRANCH ]; then - # Temporary to get CI working. original is master - AR_PR_TARGET_BRANCH="release/v5.1" + # Temporary to get CI working. original is master + AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" fi if [ -z $IDF_TARGET ]; then - if [ -f sdkconfig ]; then - IDF_TARGET=`cat sdkconfig | grep CONFIG_IDF_TARGET= | cut -d'"' -f2` - if [ "$IDF_TARGET" = "" ]; then - IDF_TARGET="esp32" - fi - else - IDF_TARGET="esp32" - fi + if [ -f sdkconfig ]; then + IDF_TARGET=`cat sdkconfig | grep CONFIG_IDF_TARGET= | cut -d'"' -f2` + if [ "$IDF_TARGET" = "" ]; then + IDF_TARGET="esp32" + fi + else + IDF_TARGET="esp32" + fi fi # Owner of the target ESP32 Arduino repository @@ -37,21 +33,15 @@ AR_USER="tasmota" # The full name of the repository AR_REPO="$AR_USER/arduino-esp32" - -# Arduino branch to use -AR_BRANCH="esp-idf-v5.1-libs" - -# The full name of the repository -AR_REPO="$AR_USER/arduino-esp32" - -# Arduino commit to use -#$AR_COMMIT = +IDF_REPO="$AR_USER/esp-idf" +AR_LIBS_REPO="$AR_USER/esp32-arduino-libs" AR_REPO_URL="https://github.com/$AR_REPO.git" -IDF_LIBS_REPO_URL="https://github.com/tasmota/esp32-arduino-libs.git" +IDF_REPO_URL="https://github.com/$IDF_REPO.git" +AR_LIBS_REPO_URL="https://github.com/$AR_LIBS_REPO.git" if [ -n $GITHUB_TOKEN ]; then - AR_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_REPO.git" - IDF_LIBS_REPO_URL="https://$GITHUB_TOKEN@github.com/tasmota/esp32-arduino-libs.git" + AR_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_REPO.git" + AR_LIBS_REPO_URL="https://$GITHUB_TOKEN@github.com/$AR_LIBS_REPO.git" fi AR_ROOT="$PWD" From 269d9d1c1c4f6358302f8157ba26f2b0c4d3cbfb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:41:07 +0200 Subject: [PATCH 161/636] Update archive-build.sh --- tools/archive-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index f6065eaff..5185f0805 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -2,8 +2,8 @@ IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD || echo "") - idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT" + archive_path="dist/arduino-esp32-libs-$idf_version_string.tar.gz" build_archive_path="dist/arduino-esp32-build-$idf_version_string.tar.gz" pio_archive_path="dist/framework-arduinoespressif32-$idf_version_string.tar.gz" From d1db1f19f97b5cd38f34e0e7c9e95c74d27405fc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:43:53 +0200 Subject: [PATCH 162/636] Create install-arduino.sh --- tools/install-arduino.sh | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tools/install-arduino.sh diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh new file mode 100644 index 000000000..deba2aae0 --- /dev/null +++ b/tools/install-arduino.sh @@ -0,0 +1,61 @@ +#/bin/bash + +source ./tools/config.sh + +# +# CLONE/UPDATE ARDUINO +# +echo "Updating ESP32 Arduino..." +if [ ! -d "$AR_COMPS/arduino" ]; then + git clone $AR_REPO_URL "$AR_COMPS/arduino" +fi + +if [ -z $AR_BRANCH ]; then + if [ -z $GITHUB_HEAD_REF ]; then + current_branch=`git branch --show-current` + else + current_branch="$GITHUB_HEAD_REF" + fi + echo "Current Branch: $current_branch" + if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then + export AR_BRANCH="$current_branch" + else + if [ "$IDF_TAG" ]; then #tag was specified at build time + AR_BRANCH_NAME="idf-$IDF_TAG" + elif [ "$IDF_COMMIT" ]; then #commit was specified at build time + AR_BRANCH_NAME="idf-$IDF_COMMIT" + else + AR_BRANCH_NAME="idf-$IDF_BRANCH" + fi + has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_BRANCH_NAME"` + if [ "$has_ar_branch" == "1" ]; then + export AR_BRANCH="$AR_BRANCH_NAME" + else + has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_PR_TARGET_BRANCH"` + if [ "$has_ar_branch" == "1" ]; then + export AR_BRANCH="$AR_PR_TARGET_BRANCH" + fi + fi + fi +fi + +if [ "$AR_BRANCH" ]; then + echo "AR_BRANCH='$AR_BRANCH'" + git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \ + git -C "$AR_COMPS/arduino" fetch && \ + git -C "$AR_COMPS/arduino" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi + +# +# CLONE/UPDATE ESP32-ARDUINO-LIBS +# +if [ ! -d "$IDF_LIBS_DIR" ]; then + echo "Cloning esp32-arduino-libs..." + git clone "$AR_LIBS_REPO_URL" "$IDF_LIBS_DIR" +else + echo "Updating esp32-arduino-libs..." + git -C "$IDF_LIBS_DIR" fetch && \ + git -C "$IDF_LIBS_DIR" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi From 2a60f4ae05087169e99a0036641252cafcf0857b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:44:54 +0200 Subject: [PATCH 163/636] Update push-to-arduino.sh --- tools/push-to-arduino.sh | 58 +++++----------------------------------- 1 file changed, 6 insertions(+), 52 deletions(-) diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index 6b134429f..f4d794d0c 100644 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -20,61 +20,11 @@ git config --global user.email "$GITHUB_ACTOR@github.com" # UPDATE FILES # -# if [ $AR_HAS_COMMIT == "0" ]; then -# # create or checkout the branch -# if [ ! $AR_HAS_BRANCH == "0" ]; then -# echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..." -# git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME -# else -# echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..." -# git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME -# fi -# if [ $? -ne 0 ]; then -# echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed" -# exit 1 -# fi - -# # make changes to the files -# echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..." -# ESP32_ARDUINO="$AR_COMPS/arduino" ./tools/copy-to-arduino.sh - -# cd $AR_COMPS/arduino - -# # did any of the files change? -# if [ -n "$(git status --porcelain)" ]; then -# echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..." -# git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME -# if [ $? -ne 0 ]; then -# echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed" -# exit 1 -# fi -# else -# echo "No changes in branch '$AR_NEW_BRANCH_NAME'" -# if [ $AR_HAS_BRANCH == "0" ]; then -# echo "Delete created branch '$AR_NEW_BRANCH_NAME'" -# git branch -d $AR_NEW_BRANCH_NAME -# fi -# exit 0 -# fi - -# # CREATE PULL REQUEST -# if [ "$AR_HAS_PR" == "0" ]; then -# echo "Creating PR '$AR_NEW_PR_TITLE'..." -# pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` -# if [ $pr_created == "0" ]; then -# 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'` -# exit 1 -# fi -# else -# echo "PR '$AR_NEW_PR_TITLE' Already Exists" -# fi -# fi - # # esp32-arduino-libs # -if [ $LIBS_HAS_COMMIT == "0" ]; then +if [ $LIBS_HAS_COMMIT == "0" ] || [ $AR_HAS_COMMIT == "0" ]; then cd "$AR_ROOT" # create branch if necessary if [ "$LIBS_HAS_BRANCH" == "1" ]; then @@ -108,7 +58,7 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then exit 1 fi IDF_LIBS_COMMIT=`git rev-parse --verify HEAD` - IDF_LIBS_DL_URL="https://codeload.github.com/tasmota/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT" + IDF_LIBS_DL_URL="https://codeload.github.com/espressif/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT" # ToDo: this URL needs to get into Arduino's package.json # Download the file @@ -150,6 +100,10 @@ if [ $LIBS_HAS_COMMIT == "0" ]; then fi fi +# +# esp32-arduino +# + if [ $AR_HAS_COMMIT == "0" ]; then cd "$AR_ROOT" # create or checkout the branch From 5de629e0f90664192c0737758d310b522df19601 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:48:27 +0200 Subject: [PATCH 164/636] Update update-components.sh --- tools/update-components.sh | 59 -------------------------------------- 1 file changed, 59 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 8bd80c299..23baf0657 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -3,68 +3,9 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" -DL_REPO_URL="https://github.com/espressif/esp-dl.git" LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" -# -# CLONE/UPDATE ARDUINO -# -echo "Updating ESP32 Arduino..." -if [ ! -d "$AR_COMPS/arduino" ]; then - git clone $AR_REPO_URL "$AR_COMPS/arduino" -fi - -if [ -z $AR_BRANCH ]; then - if [ -z $GITHUB_HEAD_REF ]; then - current_branch=`git branch --show-current` - else - current_branch="$GITHUB_HEAD_REF" - fi - echo "Current Branch: $current_branch" - if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then - export AR_BRANCH="$current_branch" - else - if [ "$IDF_TAG" ]; then #tag was specified at build time - AR_BRANCH_NAME="idf-$IDF_TAG" - elif [ "$IDF_COMMIT" ]; then #commit was specified at build time - AR_BRANCH_NAME="idf-$IDF_COMMIT" - else - AR_BRANCH_NAME="idf-$IDF_BRANCH" - fi - has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_BRANCH_NAME"` - if [ "$has_ar_branch" == "1" ]; then - export AR_BRANCH="$AR_BRANCH_NAME" - else - has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_PR_TARGET_BRANCH"` - if [ "$has_ar_branch" == "1" ]; then - export AR_BRANCH="$AR_PR_TARGET_BRANCH" - fi - fi - fi -fi - -if [ "$AR_BRANCH" ]; then - echo "AR_BRANCH='$AR_BRANCH'" - git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \ - git -C "$AR_COMPS/arduino" fetch && \ - git -C "$AR_COMPS/arduino" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi - -# -# CLONE/UPDATE ESP32-ARDUINO-LIBS -# -if [ ! -d "$IDF_LIBS_DIR" ]; then - echo "Cloning esp32-arduino-libs..." - git clone "$IDF_LIBS_REPO_URL" "$IDF_LIBS_DIR" -else - echo "Updating esp32-arduino-libs..." - git -C "$IDF_LIBS_DIR" fetch && \ - git -C "$IDF_LIBS_DIR" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi - # # CLONE/UPDATE ESP32-CAMERA # From 0067122a0434fe2d5496dc6bfdfeb19124215138 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:49:41 +0200 Subject: [PATCH 165/636] Create check-deploy-needed.sh --- tools/check-deploy-needed.sh | 85 ++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tools/check-deploy-needed.sh diff --git a/tools/check-deploy-needed.sh b/tools/check-deploy-needed.sh new file mode 100644 index 000000000..52401942a --- /dev/null +++ b/tools/check-deploy-needed.sh @@ -0,0 +1,85 @@ +#/bin/bash + +source ./tools/config.sh + +IDF_COMMIT=`github_last_commit "$IDF_REPO" "$IDF_BRANCH"` + +if [ -z $GITHUB_HEAD_REF ]; then + current_branch=`git branch --show-current` +else + current_branch="$GITHUB_HEAD_REF" +fi + +AR_BRANCH="master" +if [[ "$current_branch" != "master" && `github_branch_exists "$AR_REPO" "$current_branch"` == "1" ]]; then + AR_BRANCH="$current_branch" +else + AR_BRANCH_NAME="idf-$IDF_BRANCH" + has_ar_branch=`github_branch_exists "$AR_REPO" "$AR_BRANCH_NAME"` + if [ "$has_ar_branch" == "1" ]; then + AR_BRANCH="$AR_BRANCH_NAME" + else + has_ar_branch=`github_branch_exists "$AR_REPO" "$AR_PR_TARGET_BRANCH"` + if [ "$has_ar_branch" == "1" ]; then + AR_BRANCH="$AR_PR_TARGET_BRANCH" + fi + fi +fi + +# format new branch name and pr title +AR_NEW_BRANCH_NAME="idf-$IDF_BRANCH" +AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT" +AR_NEW_PR_TITLE="IDF $IDF_BRANCH" + +LIBS_VERSION="idf-"${IDF_BRANCH//\//_}"-$IDF_COMMIT" + +AR_HAS_BRANCH=`github_branch_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"` +if [ "$AR_HAS_BRANCH" == "1" ]; then + AR_HAS_COMMIT=`github_commit_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME" "$IDF_COMMIT"` +else + AR_HAS_COMMIT=`github_commit_exists "$AR_REPO" "$AR_BRANCH" "$IDF_COMMIT"` +fi +AR_HAS_PR=`github_pr_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"` + +LIBS_HAS_BRANCH=`github_branch_exists "$AR_LIBS_REPO" "$AR_NEW_BRANCH_NAME"` +LIBS_HAS_COMMIT=`github_commit_exists "$AR_LIBS_REPO" "$AR_NEW_BRANCH_NAME" "$IDF_COMMIT"` + +export IDF_COMMIT + +export AR_NEW_BRANCH_NAME +export AR_NEW_COMMIT_MESSAGE +export AR_NEW_PR_TITLE + +export AR_HAS_COMMIT +export AR_HAS_BRANCH +export AR_HAS_PR + +export LIBS_VERSION +export LIBS_HAS_COMMIT +export LIBS_HAS_BRANCH + +echo "IDF_COMMIT: $IDF_COMMIT" +echo "AR_BRANCH: $AR_BRANCH" +echo "AR_NEW_COMMIT_MESSAGE: $AR_NEW_COMMIT_MESSAGE" +echo "AR_NEW_BRANCH_NAME: $AR_NEW_BRANCH_NAME" +echo "AR_NEW_PR_TITLE: $AR_NEW_PR_TITLE" +echo "AR_HAS_COMMIT: $AR_HAS_COMMIT" +echo "AR_HAS_BRANCH: $AR_HAS_BRANCH" +echo "AR_HAS_PR: $AR_HAS_PR" +echo "LIBS_VERSION: $LIBS_VERSION" +echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT" +echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH" + +if [ ! -x $GITHUB_OUTPUT ]; then + echo "idf_commit=$IDF_COMMIT" >> "$GITHUB_OUTPUT" + echo "ar_branch=$AR_BRANCH" >> "$GITHUB_OUTPUT" + echo "ar_new_commit_message=$AR_NEW_COMMIT_MESSAGE" >> "$GITHUB_OUTPUT" + echo "ar_new_branch_name=$AR_NEW_BRANCH_NAME" >> "$GITHUB_OUTPUT" + echo "ar_new_pr_title=$AR_NEW_PR_TITLE" >> "$GITHUB_OUTPUT" + echo "ar_has_commit=$AR_HAS_COMMIT" >> "$GITHUB_OUTPUT" + echo "ar_has_branch=$AR_HAS_BRANCH" >> "$GITHUB_OUTPUT" + echo "ar_has_pr=$AR_HAS_PR" >> "$GITHUB_OUTPUT" + echo "libs_version=$LIBS_VERSION" >> "$GITHUB_OUTPUT" + echo "libs_has_commit=$LIBS_HAS_COMMIT" >> "$GITHUB_OUTPUT" + echo "libs_has_branch=$LIBS_HAS_BRANCH" >> "$GITHUB_OUTPUT" +fi From 2b677fa606f42f576aff70227b419918854448b9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:50:47 +0200 Subject: [PATCH 166/636] Create current_commit.sh --- tools/current_commit.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tools/current_commit.sh diff --git a/tools/current_commit.sh b/tools/current_commit.sh new file mode 100644 index 000000000..8d890dc5c --- /dev/null +++ b/tools/current_commit.sh @@ -0,0 +1,2 @@ +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) +echo Current commit is $IDF_COMMIT From 8651b273449b81881369309d7b03b478cc334087 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 11:52:54 +0200 Subject: [PATCH 167/636] Update build.sh --- build.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 2c3cdaf6e..5987b78b3 100755 --- a/build.sh +++ b/build.sh @@ -14,6 +14,7 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 +ARCHIVE_OUT=0 if [ -z $DEPLOY_OUT ]; then DEPLOY_OUT=0 fi @@ -24,6 +25,7 @@ function print_help() { echo " -A Set which branch of arduino-esp32 to be used for compilation" echo " -I Set which branch of ESP-IDF to be used for compilation" echo " -i Set which commit of ESP-IDF to be used for compilation" + echo " -e Archive the build to dist" echo " -d Deploy the build to github arduino-esp32" echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'" echo " -t Set the build target(chip). ex. 'esp32s3'" @@ -32,7 +34,7 @@ function print_help() { exit 1 } -while getopts ":A:I:i:c:t:b:sd" opt; do +while getopts ":A:I:i:c:t:b:sde" opt; do case ${opt} in s ) SKIP_ENV=1 @@ -40,6 +42,9 @@ while getopts ":A:I:i:c:t:b:sd" opt; do d ) DEPLOY_OUT=1 ;; + e ) + ARCHIVE_OUT=1 + ;; c ) export ESP32_ARDUINO="$OPTARG" COPY_OUT=1 @@ -81,12 +86,18 @@ done shift $((OPTIND -1)) CONFIGS=$@ +mkdir -p dist + if [ $SKIP_ENV -eq 0 ]; then echo "* Installing/Updating ESP-IDF and all components..." # update components from git ./tools/update-components.sh if [ $? -ne 0 ]; then exit 1; fi + # install arduino component + ./tools/install-arduino.sh + if [ $? -ne 0 ]; then exit 1; fi + # install esp-idf source ./tools/install-esp-idf.sh if [ $? -ne 0 ]; then exit 1; fi @@ -230,13 +241,14 @@ if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then if [ $? -ne 0 ]; then exit 1; fi fi +# push changes to esp32-arduino-libs and create pull request into arduino-esp32 if [ $DEPLOY_OUT -eq 1 ]; then ./tools/push-to-arduino.sh if [ $? -ne 0 ]; then exit 1; fi fi # archive the build -if [ "$BUILD_TYPE" = "all" ]; then - ./tools/archive-build.sh +if [ $ARCHIVE_OUT -eq 1 ]; then + ./tools/archive-build.sh "$TARGET" if [ $? -ne 0 ]; then exit 1; fi fi From 157f3227387c849e63c23f434d12b68870eb898f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 12:03:41 +0200 Subject: [PATCH 168/636] change rights --- tools/check-deploy-needed.sh | 0 tools/current_commit.sh | 0 tools/install-arduino.sh | 0 tools/push-to-arduino.sh | 0 tools/repository_dispatch.sh | 0 5 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/check-deploy-needed.sh mode change 100644 => 100755 tools/current_commit.sh mode change 100644 => 100755 tools/install-arduino.sh mode change 100644 => 100755 tools/push-to-arduino.sh mode change 100644 => 100755 tools/repository_dispatch.sh diff --git a/tools/check-deploy-needed.sh b/tools/check-deploy-needed.sh old mode 100644 new mode 100755 diff --git a/tools/current_commit.sh b/tools/current_commit.sh old mode 100644 new mode 100755 diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh old mode 100644 new mode 100755 diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh old mode 100644 new mode 100755 diff --git a/tools/repository_dispatch.sh b/tools/repository_dispatch.sh old mode 100644 new mode 100755 From 90c37c26da8c01c7607ce9376668880cca82b4ce Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 13:41:19 +0200 Subject: [PATCH 169/636] Update build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 5987b78b3..51b086e7e 100755 --- a/build.sh +++ b/build.sh @@ -248,7 +248,7 @@ if [ $DEPLOY_OUT -eq 1 ]; then fi # archive the build -if [ $ARCHIVE_OUT -eq 1 ]; then - ./tools/archive-build.sh "$TARGET" +if [ "$BUILD_TYPE" = "all" ]; then + ./tools/archive-build.sh if [ $? -ne 0 ]; then exit 1; fi fi From 9c9cc5091a75169dc45015c5068c86378038b0ef Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 17:03:48 +0200 Subject: [PATCH 170/636] add c2 --- configs/builds.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/configs/builds.json b/configs/builds.json index bfac61cc2..2de37abeb 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -4,7 +4,7 @@ "file":"libspi_flash.a", "src":"build/esp-idf/spi_flash/libspi_flash.a", "out":"lib/libspi_flash.a", - "targets":["esp32","esp32c3","esp32s2","esp32s3","esp32c6","esp32h2"] + "targets":["esp32","esp32c3","esp32s2","esp32s3","esp32c6","esp32h2","esp32c2"] }, { "file":"libesp_psram.a", @@ -44,6 +44,20 @@ } ], "targets":[ + { + "target": "esp32c2", + "features":[], + "idf_libs":["qio","60m"], + "bootloaders":[ + ["qio","60m"], + ["dio","60m"], + ["qio","30m"], + ["dio","30m"] + ], + "mem_variants":[ + ["dio","60m"] + ] + }, { "target": "esp32h2", "features":[], From 16dc38cbdd737235f0f380959c6d6e8c17a0dc15 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 17:05:24 +0200 Subject: [PATCH 171/636] Create defconfig.60 --- configs/defconfig.60 | 1 + 1 file changed, 1 insertion(+) create mode 100644 configs/defconfig.60 diff --git a/configs/defconfig.60 b/configs/defconfig.60 new file mode 100644 index 000000000..797665f52 --- /dev/null +++ b/configs/defconfig.60 @@ -0,0 +1 @@ +CONFIG_ESPTOOLPY_FLASHFREQ_60M=y From 9d97b08efba9d3a9b1dce88a0d4a1be8c51fb815 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 17:05:39 +0200 Subject: [PATCH 172/636] Rename defconfig.60 to defconfig.60m --- configs/{defconfig.60 => defconfig.60m} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename configs/{defconfig.60 => defconfig.60m} (100%) diff --git a/configs/defconfig.60 b/configs/defconfig.60m similarity index 100% rename from configs/defconfig.60 rename to configs/defconfig.60m From 30d7ad8ad06c234ba12258c0876134a953ff0321 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 17:06:21 +0200 Subject: [PATCH 173/636] Create defconfig.30m --- configs/defconfig.30m | 1 + 1 file changed, 1 insertion(+) create mode 100644 configs/defconfig.30m diff --git a/configs/defconfig.30m b/configs/defconfig.30m new file mode 100644 index 000000000..f915b230f --- /dev/null +++ b/configs/defconfig.30m @@ -0,0 +1 @@ +CONFIG_ESPTOOLPY_FLASHFREQ_30M=y From 431a7bcdf319adf9df54567a8ffc353c91210e9a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 17:08:38 +0200 Subject: [PATCH 174/636] Create defconfig.esp32c2 --- configs/defconfig.esp32c2 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 configs/defconfig.esp32c2 diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 new file mode 100644 index 000000000..ced594733 --- /dev/null +++ b/configs/defconfig.esp32c2 @@ -0,0 +1,4 @@ +CONFIG_BT_BLE_BLUFI_ENABLE=y +CONFIG_RTC_CLK_CAL_CYCLES=576 +# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 From 27a1d8feecdd2e4292534d095e606e7bf8db70ef Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 17:11:04 +0200 Subject: [PATCH 175/636] Update Kconfig.projbuild --- main/Kconfig.projbuild | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 71fcc41cc..248e93d94 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -10,12 +10,15 @@ config LIB_BUILDER_FLASHFREQ string default "120m" if ESPTOOLPY_FLASHFREQ_120M default "80m" if ESPTOOLPY_FLASHFREQ_80M + default "60m" if ESPTOOLPY_FLASHFREQ_60M default "64m" if ESPTOOLPY_FLASHFREQ_64M default "40m" if ESPTOOLPY_FLASHFREQ_40M default "32m" if ESPTOOLPY_FLASHFREQ_32M + default "30m" if ESPTOOLPY_FLASHFREQ_30M default "26m" if ESPTOOLPY_FLASHFREQ_26M default "20m" if ESPTOOLPY_FLASHFREQ_20M default "16m" if ESPTOOLPY_FLASHFREQ_16M + default "15m" if ESPTOOLPY_FLASHFREQ_15M config LIB_BUILDER_COMPILE bool From 0c5098aadcb7217d487d04f3e9e0bc482efa8542 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 17:12:35 +0200 Subject: [PATCH 176/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 26dbd4015..f61e85db5 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: Arduino IDF 5.x +name: Arduino IDF 5.1 with C2 on: workflow_dispatch: # Manually start a workflow From cfb47259214d4a141e227c0766e9c354a250384d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 18:10:13 +0200 Subject: [PATCH 177/636] Update config.sh --- tools/config.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/config.sh b/tools/config.sh index af47e3382..e5c4397b6 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -31,6 +31,12 @@ fi # Owner of the target ESP32 Arduino repository AR_USER="tasmota" +# Arduino branch to use +AR_BRANCH="idf-v5.1-c2" + +# Arduino commit to use +#$AR_COMMIT = + # The full name of the repository AR_REPO="$AR_USER/arduino-esp32" IDF_REPO="$AR_USER/esp-idf" From a3679612819a8fc3b97acdc34ff8612207e43a28 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 22 Jul 2023 18:23:49 +0200 Subject: [PATCH 178/636] Update config.sh --- tools/config.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index e5c4397b6..3ca5f3fb8 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -9,9 +9,6 @@ if [ -z $IDF_BRANCH ]; then IDF_BRANCH="release/v5.1" fi -# IDF commit to use -#IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" - if [ -z $AR_PR_TARGET_BRANCH ]; then # Temporary to get CI working. original is master AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" @@ -32,7 +29,12 @@ fi AR_USER="tasmota" # Arduino branch to use -AR_BRANCH="idf-v5.1-c2" +if [ -z $AR_BRANCH ]; then + AR_BRANCH="idf-v5.1-c2" +fi + +# IDF commit to use +#IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" # Arduino commit to use #$AR_COMMIT = From 52f0d62325356d0bf2b245a51eaff49a964172ee Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 23 Jul 2023 18:11:53 +0200 Subject: [PATCH 179/636] AR_BRANCH="esp-idf-v5.1-c2" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 3ca5f3fb8..bf6476f45 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -30,7 +30,7 @@ AR_USER="tasmota" # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="idf-v5.1-c2" + AR_BRANCH="esp-idf-v5.1-c2" fi # IDF commit to use From e6abe0de12d9f648be30615ef7ac705fd9a2b04d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 24 Jul 2023 12:54:19 +0200 Subject: [PATCH 180/636] Update defconfig.esp32c2 --- configs/defconfig.esp32c2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index ced594733..726ad4c73 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,3 +1,5 @@ +CONFIG_XTAL_FREQ_26=y +CONFIG_XTAL_FREQ=26 CONFIG_BT_BLE_BLUFI_ENABLE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set From 5fa2e27c7fa1ed1e3c086b44955536dae729b2f6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 26 Jul 2023 15:23:37 +0200 Subject: [PATCH 181/636] Update defconfig.esp32s3 --- configs/defconfig.esp32s3 | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index c8c563092..991117d39 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -7,3 +7,4 @@ CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 +CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n From 87b616eaa169b4b27e411b2931508d3bb5263391 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 26 Jul 2023 15:24:00 +0200 Subject: [PATCH 182/636] Update defconfig.esp32s2 --- configs/defconfig.esp32s2 | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index f6ac0ca72..aa6d3ed5f 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -8,6 +8,7 @@ CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4096 # CONFIG_USE_WAKENET is not set # CONFIG_USE_MULTINET is not set CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y +CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n # CONFIG_UNITY_ENABLE_FLOAT is not set # CONFIG_UNITY_ENABLE_DOUBLE is not set # CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set From d1ee759f38c6ceeafd2514e0c3ca6b012f329b9c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 31 Jul 2023 21:27:36 +0200 Subject: [PATCH 183/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index bf6476f45..22397992f 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -37,7 +37,7 @@ fi #IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" # Arduino commit to use -#$AR_COMMIT = +#AR_COMMIT="" # The full name of the repository AR_REPO="$AR_USER/arduino-esp32" From a7c0cbbf4af845d9a884c1ff6371d624587af07a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 13:10:46 +0200 Subject: [PATCH 184/636] Update defconfig.esp32c3 --- configs/defconfig.esp32c3 | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index ced594733..b6864433c 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -1,4 +1,30 @@ -CONFIG_BT_BLE_BLUFI_ENABLE=y +CONFIG_BT_ENABLED=y +CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +CONFIG_BT_CTRL_MODEM_SLEEP=y +CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y +CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y +# CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set +CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 From 682adcb43fa3f8f1b26ab099e419170f059a3dae Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 13:11:20 +0200 Subject: [PATCH 185/636] Update defconfig.esp32c6 --- configs/defconfig.esp32c6 | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index ced594733..fc5d9bea5 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -1,4 +1,29 @@ -CONFIG_BT_BLE_BLUFI_ENABLE=y +CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +CONFIG_BT_CTRL_MODEM_SLEEP=y +CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y +CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y +# CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set +CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 From 20807dc0f38cf53e4a16c8035aa72d6ac1d74d94 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 13:11:43 +0200 Subject: [PATCH 186/636] Update defconfig.esp32h2 --- configs/defconfig.esp32h2 | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.esp32h2 b/configs/defconfig.esp32h2 index ced594733..fc5d9bea5 100644 --- a/configs/defconfig.esp32h2 +++ b/configs/defconfig.esp32h2 @@ -1,4 +1,29 @@ -CONFIG_BT_BLE_BLUFI_ENABLE=y +CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +CONFIG_BT_CTRL_MODEM_SLEEP=y +CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y +CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y +# CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set +CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 From 5fdca1ef0c6ced6e639b4814c0e7e3aefb710505 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:24:14 +0200 Subject: [PATCH 187/636] optimize settings --- configs/defconfig.common | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index aa2d2c65f..25b2aa29d 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -11,12 +11,18 @@ CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y -CONFIG_BLE_MESH=y +# CONFIG_BLE_MESH is not set CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y CONFIG_COMPILER_WARN_WRITE_STRINGS=y -CONFIG_ESP_HTTPS_SERVER_ENABLE=y +# CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set +# CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR is not set +CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y +# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y +CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM=y CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH=y CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 @@ -33,7 +39,6 @@ CONFIG_ESP_WIFI_CSI_ENABLED=y CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_IRAM_OPT is not set # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set -CONFIG_ETH_SPI_ETHERNET_DM9051=y # CONFIG_ETH_SPI_ETHERNET_W5500 is not set CONFIG_FATFS_CODEPAGE_850=y CONFIG_FATFS_LFN_STACK=y @@ -44,7 +49,10 @@ CONFIG_FMB_TIMER_PORT_ENABLED=y CONFIG_FREERTOS_HZ=1000 CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y # CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is not set -CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 +# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y CONFIG_HAL_ASSERTION_DISABLE=y CONFIG_HEAP_POISONING_LIGHT=y CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 @@ -71,11 +79,13 @@ CONFIG_LWIP_DHCP_OPTIONS_LEN=128 CONFIG_LWIP_SNTP_MAX_SERVERS=1 # CONFIG_LWIP_DHCP_GET_NTP_SRV is not set CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_MBEDTLS_PSK_MODES=y CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y CONFIG_NEWLIB_NANO_FORMAT=y # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set -CONFIG_MBEDTLS_SSL_PROTO_DTLS=y CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y @@ -94,3 +104,17 @@ CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 # CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096 CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0 +# +# Disable Cameras not used +# +# CONFIG_OV7670_SUPPORT is not set +# CONFIG_OV7725_SUPPORT is not set +# CONFIG_NT99141_SUPPORT is not set +# CONFIG_OV3660_SUPPORT is not set +# CONFIG_OV5640_SUPPORT is not set +# CONFIG_GC2145_SUPPORT is not set +# CONFIG_GC032A_SUPPORT is not set +# CONFIG_GC0308_SUPPORT is not set +# CONFIG_BF3005_SUPPORT is not set +# CONFIG_BF20A6_SUPPORT is not set +# CONFIG_SC030IOT_SUPPORT is not set From 4c3a48b8b9964ed65882109679c0a5a0bc8c5f64 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:22:35 +0200 Subject: [PATCH 188/636] no BTDM --- configs/defconfig.esp32 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 1a6da10f2..c6346c205 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -1,6 +1,5 @@ CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR=y -CONFIG_BTDM_CTRL_MODE_BTDM=y -CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=20 +# CONFIG_BTDM_CTRL_MODE_BTDM is not set CONFIG_BT_BTC_TASK_STACK_SIZE=8192 CONFIG_BT_BTU_TASK_STACK_SIZE=8192 CONFIG_BT_CLASSIC_ENABLED=y @@ -13,7 +12,6 @@ CONFIG_SPIRAM=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y CONFIG_ULP_COPROC_ENABLED=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set -CONFIG_FREERTOS_FPU_IN_ISR=y # CONFIG_UNITY_ENABLE_FLOAT is not set # CONFIG_UNITY_ENABLE_DOUBLE is not set # CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set From f42c13cde03ffca32bc9f717e9f0fe262932cce5 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:37:49 +0200 Subject: [PATCH 189/636] Update defconfig.common --- configs/defconfig.common | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 25b2aa29d..a8b119c3b 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -70,7 +70,6 @@ CONFIG_LWIP_TCP_MSS=1436 CONFIG_LWIP_TCP_RTO_TIME=3000 CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560 CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y -CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_LWIP_IPV6_AUTOCONFIG=y CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 CONFIG_LWIP_MAX_SOCKETS=16 From cc98cd97c900b944a10b9230a48ea3370bbe9a28 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:21:31 +0200 Subject: [PATCH 190/636] disable some crypto --- configs/defconfig.common | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index a8b119c3b..d1cbc5a80 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -20,7 +20,7 @@ CONFIG_COMPILER_WARN_WRITE_STRINGS=y # CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR is not set CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y # CONFIG_ESP_HTTPS_SERVER_ENABLE is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM=y CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH=y @@ -47,8 +47,9 @@ CONFIG_FATFS_API_ENCODING_UTF_8=y # CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set CONFIG_FMB_TIMER_PORT_ENABLED=y CONFIG_FREERTOS_HZ=1000 -CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y +# CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set # CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is not set +# CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 # CONFIG_FREERTOS_FPU_IN_ISR is not set CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y @@ -82,7 +83,7 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y CONFIG_NEWLIB_NANO_FORMAT=y # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y From 33088ed335371c3cde74368138bef7ae02fab6f7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:47:23 +0200 Subject: [PATCH 191/636] Set all crypto manually --- configs/defconfig.common | 72 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index d1cbc5a80..a7522b946 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -82,10 +82,78 @@ CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 -CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y CONFIG_NEWLIB_NANO_FORMAT=y + +# +# TLS Key Exchange Methods +# +CONFIG_MBEDTLS_PSK_MODES=y +# CONFIG_MBEDTLS_KEY_EXCHANGE_PSK is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set +# end of TLS Key Exchange Methods + +# CONFIG_MBEDTLS_SSL_RENEGOTIATION is not set +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 is not set +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_ALPN is not set +# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set + # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set + +# +# Symmetric Ciphers +# +CONFIG_MBEDTLS_AES_C=y +# CONFIG_MBEDTLS_CAMELLIA_C is not set +# CONFIG_MBEDTLS_DES_C is not set +# CONFIG_MBEDTLS_BLOWFISH_C is not set +# CONFIG_MBEDTLS_XTEA_C is not set +# CONFIG_MBEDTLS_CCM_C is not set +# CONFIG_MBEDTLS_GCM_C is not set +# CONFIG_MBEDTLS_NIST_KW_C is not set +# end of Symmetric Ciphers + +# CONFIG_MBEDTLS_RIPEMD160_C is not set + +# +# Certificates +# +# CONFIG_MBEDTLS_PEM_PARSE_C is not set +# CONFIG_MBEDTLS_PEM_WRITE_C is not set +# CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set +# CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set +# end of Certificates + +CONFIG_MBEDTLS_ECP_C=y +# CONFIG_MBEDTLS_DHM_C is not set +CONFIG_MBEDTLS_ECDH_C=y +CONFIG_MBEDTLS_ECDSA_C=y +# CONFIG_MBEDTLS_ECJPAKE_C is not set +# CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set +# CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set +# CONFIG_MBEDTLS_POLY1305_C is not set +# CONFIG_MBEDTLS_CHACHA20_C is not set +# CONFIG_MBEDTLS_HKDF_C is not set +# CONFIG_MBEDTLS_THREADING_C is not set +# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set +# CONFIG_MBEDTLS_SECURITY_RISKS is not set +# end of mbedTLS + + CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y From 1ad6685dfc488e278c67467195f91bdfcb48a3f6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:53:29 +0200 Subject: [PATCH 192/636] mbedTLS v3.x related --- configs/defconfig.common | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index a7522b946..e74474848 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -84,6 +84,43 @@ CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y +# +# mbedTLS v3.x related +# +# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set +# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set +# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set +# end of mbedTLS v3.x related + +# +# Certificate Bundle +# +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE is not set +# end of Certificate Bundle + +# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set +# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_AES_USE_INTERRUPT=y +CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y +CONFIG_MBEDTLS_HARDWARE_SHA=y +CONFIG_MBEDTLS_ROM_MD5=y +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set +CONFIG_MBEDTLS_HAVE_TIME=y +# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set +# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set +# CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set +# CONFIG_MBEDTLS_SHA512_C is not set +CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y +# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set +# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set +# CONFIG_MBEDTLS_TLS_DISABLED is not set +CONFIG_MBEDTLS_TLS_SERVER=y +CONFIG_MBEDTLS_TLS_CLIENT=y +CONFIG_MBEDTLS_TLS_ENABLED=y + # # TLS Key Exchange Methods # From 3fff9468c2f0c6fb8ea6898107733032f91de96f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:03:48 +0200 Subject: [PATCH 193/636] Update defconfig.common --- configs/defconfig.common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index e74474848..043a1aa7a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -166,8 +166,8 @@ CONFIG_MBEDTLS_AES_C=y CONFIG_MBEDTLS_ECP_C=y # CONFIG_MBEDTLS_DHM_C is not set -CONFIG_MBEDTLS_ECDH_C=y -CONFIG_MBEDTLS_ECDSA_C=y +# CONFIG_MBEDTLS_ECDH_C is not set +# CONFIG_MBEDTLS_ECDSA_C is not set # CONFIG_MBEDTLS_ECJPAKE_C is not set # CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set From dfc968eb9fba00cb179f861a9ed4548011b69120 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:58:08 +0200 Subject: [PATCH 194/636] Update defconfig.common --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 043a1aa7a..579a56ef0 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -164,7 +164,7 @@ CONFIG_MBEDTLS_AES_C=y # CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set # end of Certificates -CONFIG_MBEDTLS_ECP_C=y +# CONFIG_MBEDTLS_ECP_C is not set # CONFIG_MBEDTLS_DHM_C is not set # CONFIG_MBEDTLS_ECDH_C is not set # CONFIG_MBEDTLS_ECDSA_C is not set From 5969f8cbf8e56ccfdc185872ab5ae80642f6b684 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:11:08 +0200 Subject: [PATCH 195/636] Update defconfig.common --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 579a56ef0..6ba437183 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -143,7 +143,7 @@ CONFIG_MBEDTLS_PSK_MODES=y # # Symmetric Ciphers # -CONFIG_MBEDTLS_AES_C=y +# CONFIG_MBEDTLS_AES_C is not set # CONFIG_MBEDTLS_CAMELLIA_C is not set # CONFIG_MBEDTLS_DES_C is not set # CONFIG_MBEDTLS_BLOWFISH_C is not set From 8fda0ab20331e37eab6baf6f5468f9d347a24e1d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 23:13:42 +0200 Subject: [PATCH 196/636] Update defconfig.common --- configs/defconfig.common | 66 ---------------------------------------- 1 file changed, 66 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 6ba437183..0a5f96157 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -84,14 +84,6 @@ CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y -# -# mbedTLS v3.x related -# -# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set -# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set -# end of mbedTLS v3.x related - # # Certificate Bundle # @@ -113,13 +105,6 @@ CONFIG_MBEDTLS_HAVE_TIME=y # CONFIG_MBEDTLS_HAVE_TIME_DATE is not set # CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set # CONFIG_MBEDTLS_SHA512_C is not set -CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y -# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set -# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set -# CONFIG_MBEDTLS_TLS_DISABLED is not set -CONFIG_MBEDTLS_TLS_SERVER=y -CONFIG_MBEDTLS_TLS_CLIENT=y -CONFIG_MBEDTLS_TLS_ENABLED=y # # TLS Key Exchange Methods @@ -140,57 +125,6 @@ CONFIG_MBEDTLS_PSK_MODES=y # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set -# -# Symmetric Ciphers -# -# CONFIG_MBEDTLS_AES_C is not set -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -# CONFIG_MBEDTLS_CCM_C is not set -# CONFIG_MBEDTLS_GCM_C is not set -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers - -# CONFIG_MBEDTLS_RIPEMD160_C is not set - -# -# Certificates -# -# CONFIG_MBEDTLS_PEM_PARSE_C is not set -# CONFIG_MBEDTLS_PEM_WRITE_C is not set -# CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set -# CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set -# end of Certificates - -# CONFIG_MBEDTLS_ECP_C is not set -# CONFIG_MBEDTLS_DHM_C is not set -# CONFIG_MBEDTLS_ECDH_C is not set -# CONFIG_MBEDTLS_ECDSA_C is not set -# CONFIG_MBEDTLS_ECJPAKE_C is not set -# CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set -# CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set -# CONFIG_MBEDTLS_POLY1305_C is not set -# CONFIG_MBEDTLS_CHACHA20_C is not set -# CONFIG_MBEDTLS_HKDF_C is not set -# CONFIG_MBEDTLS_THREADING_C is not set -# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -# CONFIG_MBEDTLS_SECURITY_RISKS is not set -# end of mbedTLS - - CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y From 094363364be7aaa935750281665bc7bc4fc4e476 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 23:28:14 +0200 Subject: [PATCH 197/636] Update defconfig.common --- configs/defconfig.common | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 0a5f96157..88f7f4b9a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -110,6 +110,8 @@ CONFIG_MBEDTLS_HAVE_TIME=y # TLS Key Exchange Methods # CONFIG_MBEDTLS_PSK_MODES=y +CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y # CONFIG_MBEDTLS_KEY_EXCHANGE_PSK is not set # CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK is not set # CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK is not set From fbe9d229571f9752a63dd72789ac7199f02af08d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Aug 2023 23:49:45 +0200 Subject: [PATCH 198/636] Update defconfig.common --- configs/defconfig.common | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 88f7f4b9a..6242230d5 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -84,12 +84,6 @@ CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y -# -# Certificate Bundle -# -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE is not set -# end of Certificate Bundle - # CONFIG_MBEDTLS_ECP_RESTARTABLE is not set # CONFIG_MBEDTLS_CMAC_C is not set CONFIG_MBEDTLS_HARDWARE_AES=y @@ -119,12 +113,6 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y # CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set # end of TLS Key Exchange Methods -# CONFIG_MBEDTLS_SSL_RENEGOTIATION is not set -# CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 is not set -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_ALPN is not set -# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set - # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y From dffd56cd759840c5c4d2ea19efa08d81fcd3e0e1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 09:08:42 +0200 Subject: [PATCH 199/636] Update defconfig.common --- configs/defconfig.common | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 6242230d5..d1cbc5a80 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -82,39 +82,10 @@ CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 -CONFIG_NEWLIB_NANO_FORMAT=y - -# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set -CONFIG_MBEDTLS_HARDWARE_AES=y -CONFIG_MBEDTLS_AES_USE_INTERRUPT=y -CONFIG_MBEDTLS_HARDWARE_MPI=y -CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y -CONFIG_MBEDTLS_HARDWARE_SHA=y -CONFIG_MBEDTLS_ROM_MD5=y -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set -CONFIG_MBEDTLS_HAVE_TIME=y -# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set -# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set -# CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set -# CONFIG_MBEDTLS_SHA512_C is not set - -# -# TLS Key Exchange Methods -# CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y -# CONFIG_MBEDTLS_KEY_EXCHANGE_PSK is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set -# end of TLS Key Exchange Methods - +CONFIG_NEWLIB_NANO_FORMAT=y # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set - CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y From 790d89addffa0513981e755be1f8dad3313cff7d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:29:19 +0200 Subject: [PATCH 200/636] reduce MBEDTLS key exchange moddes --- configs/defconfig.common | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index d1cbc5a80..23c063c2c 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -82,10 +82,16 @@ CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 -CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y CONFIG_NEWLIB_NANO_FORMAT=y -# CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set + +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y +CONFIG_MBEDTLS_PSK_MODES=y +# CONFIG_MBEDTLS_KEY_EXCHANGE_PSK is not set +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y +# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set + CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y From 2a2c0d57c61db0a89ee2db4a39e66e6a8fa6c16b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:31:38 +0200 Subject: [PATCH 201/636] unset `CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN` --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 23c063c2c..df593839a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -91,6 +91,7 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y # CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set # CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set +# CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 From 719c64bc27910b609b983a73e52e4acf041f7dec Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:01:41 +0200 Subject: [PATCH 202/636] Back to known working mbedtls settings --- configs/defconfig.common | 5 ----- 1 file changed, 5 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index df593839a..98eb8eaa6 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -86,11 +86,6 @@ CONFIG_NEWLIB_NANO_FORMAT=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y CONFIG_MBEDTLS_PSK_MODES=y -# CONFIG_MBEDTLS_KEY_EXCHANGE_PSK is not set -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y -# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y From b7d1ed2e8367a11dbbaa40314e2acd579536a8f6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:32:51 +0200 Subject: [PATCH 203/636] only `MBEDTLS_KEY_EXCHANGE_PSK` --- configs/defconfig.common | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 98eb8eaa6..9dd292626 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -86,6 +86,11 @@ CONFIG_NEWLIB_NANO_FORMAT=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y CONFIG_MBEDTLS_PSK_MODES=y +CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y From e824a2bdffc32cb9618b883b473e62e62432dbed Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:37:51 +0200 Subject: [PATCH 204/636] Disable some mbedtls SSL protocols --- configs/defconfig.common | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 9dd292626..ffef02d52 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -91,6 +91,9 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y # CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK is not set # CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set # CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set +# CONFIG_MBEDTLS_SSL_ALPN is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y From 2c6f834dafa67e8a3209ce1959ea9d80047207bf Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:40:40 +0200 Subject: [PATCH 205/636] enable TLS protocols --- configs/defconfig.common | 3 --- 1 file changed, 3 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index ffef02d52..9dd292626 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -91,9 +91,6 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y # CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK is not set # CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set # CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -# CONFIG_MBEDTLS_SSL_ALPN is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y From c1679a0aeeaca6b8334cd3aa4c567f7d089f7a35 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:42:46 +0200 Subject: [PATCH 206/636] Update defconfig.common --- configs/defconfig.common | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 9dd292626..8a9156345 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -87,10 +87,9 @@ CONFIG_NEWLIB_NANO_FORMAT=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y CONFIG_MBEDTLS_PSK_MODES=y CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set +# CONFIG_MBEDTLS_SSL_ALPN is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y From 1f7b5075a73613a2afbf237eff1f9217c470c4ce Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:46:13 +0200 Subject: [PATCH 207/636] enable ALPN protocol --- configs/defconfig.common | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 8a9156345..1f2e6486c 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -89,7 +89,6 @@ CONFIG_MBEDTLS_PSK_MODES=y CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y # CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set # CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -# CONFIG_MBEDTLS_SSL_ALPN is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y From 56ab32de445502e3b9bed54b3e179171c73eaf9f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 28 Aug 2023 15:22:45 +0200 Subject: [PATCH 208/636] NimBLE updates / S3 Display shift fix (#68) * Update push.yml * Update idf_component.yml * staars optimizations * remove BT Classic * rm not needed Arduino libs for Tasmota * Update defconfig.common * add "espressif/libsodium^1.0.20" * Update BLE in defconfig.esp32c2 * Update BLE in defconfig.esp32c6 * Update BLE in defconfig.esp32 * Update BLE in defconfig.esp32c3 * Update BLE in defconfig.esp32h2 * Update BLE in defconfig.esp32s3 * CONFIG_LITTLEFS_MAX_PARTITIONS=2 Try to fix SD-Card not working * rm libsodium only needed from Homekit * rm Arduino BLE Tasmota uses h2zero BLE * rm BLE lib * use actual setting name `CONFIG_BT_NIMBLE_NVS_PERSIST` * use actual config declaration * Update defconfig.esp32c3 * Update defconfig.esp32c6 * Update defconfig.esp32h2 * Update defconfig.esp32s3 * rm SimpleBLE * rm SimpleBLE * rm WiFiProv * rm WiFiProv * CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y * rm ESP32 examples * rm ESP32 examples * no clone of Arduino Libs... since Tasmota does still include everything needed in the framework * Update install-esp-idf.sh * Update update-components.sh * fix typo * # CONFIG_ETH_USE_SPI_ETHERNET is not set * Enable Eternet * revert Ethernet changes * CONFIG_ETH_USE_SPI_ETHERNET is not set * use ESP-LITTLEFS v1.7.0 * # CONFIG_MBEDTLS_HARDWARE_MPI is not set only needed for libsodium * Update defconfig.120m * Update defconfig.common * Update defconfig.esp32s3 * LittleFS v1.5.5 use same version as in Tasmota Core 2.0.11 Try to fix loosing FS content when switching between Core 2.0.11 and Core 3.0.0 * Update defconfig.120m * Update defconfig.esp32s3 --------- Co-authored-by: Christian Baars <Baars@gmx.de> --- .github/workflows/push.yml | 2 +- configs/defconfig.120m | 2 +- configs/defconfig.common | 52 +++++++++++++++++++++++++++++++++----- configs/defconfig.esp32 | 22 +++++++++++++--- configs/defconfig.esp32c2 | 14 +++++++++- configs/defconfig.esp32c3 | 13 +++++++++- configs/defconfig.esp32c6 | 14 +++++++++- configs/defconfig.esp32h2 | 14 +++++++++- configs/defconfig.esp32s3 | 20 ++++++++++++++- main/idf_component.yml | 7 ++--- tools/archive-build.sh | 4 +++ tools/install-arduino.sh | 28 +++++++++++++------- tools/install-esp-idf.sh | 5 ---- tools/update-components.sh | 19 +++++++++----- 14 files changed, 175 insertions(+), 41 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f61e85db5..436e62527 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: Arduino IDF 5.1 with C2 +name: Arduino IDF 5.1 without DSP and MP3 on: workflow_dispatch: # Manually start a workflow diff --git a/configs/defconfig.120m b/configs/defconfig.120m index a21a8285e..2dd8e0253 100644 --- a/configs/defconfig.120m +++ b/configs/defconfig.120m @@ -1,2 +1,2 @@ CONFIG_ESPTOOLPY_FLASHFREQ_120M=y -CONFIG_SPIRAM_SPEED_120M=y \ No newline at end of file +CONFIG_SPIRAM_SPEED_120M=y diff --git a/configs/defconfig.common b/configs/defconfig.common index 1f2e6486c..9104fe94e 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -8,14 +8,16 @@ CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y # CONFIG_BLE_MESH is not set +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y -CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y -CONFIG_COMPILER_WARN_WRITE_STRINGS=y +CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y +# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set # CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set # CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR is not set CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y @@ -31,11 +33,11 @@ CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048 CONFIG_ESP_TASK_WDT_PANIC=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y -CONFIG_ESP_WIFI_FTM_ENABLE=y +CONFIG_ESP_WIFI_FTM_ENABLE=n CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 -CONFIG_ESP_WIFI_CSI_ENABLED=y +CONFIG_ESP_WIFI_CSI_ENABLED=n CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_IRAM_OPT is not set # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set @@ -84,9 +86,35 @@ CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y -CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y +# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set +# CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 + +CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=n +CONFIG_MBEDTLS_PSK_MODES=n + +# CONFIG_MBEDTLS_HARDWARE_AES is not set +# CONFIG_MBEDTLS_HARDWARE_MPI is not set +# CONFIG_MBEDTLS_HARDWARE_SHA is not set +# CONFIG_MBEDTLS_HAVE_TIME is not set + +# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set +# CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set +# CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set + + +# CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set # CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set # CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set @@ -109,6 +137,15 @@ CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 # CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096 CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0 + +CONFIG_SPIFFS_MAX_PARTITIONS=1 +# CONFIG_SPIFFS_PAGE_CHECK is not set +# CONFIG_SPIFFS_USE_MAGIC is not set +# CONFIG_SPIFFS_USE_MTIME is not set +CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=1 +CONFIG_LITTLEFS_MAX_PARTITIONS=2 +CONFIG_DSP_MAX_FFT_SIZE_1024=y + # # Disable Cameras not used # @@ -123,3 +160,4 @@ CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0 # CONFIG_BF3005_SUPPORT is not set # CONFIG_BF20A6_SUPPORT is not set # CONFIG_SC030IOT_SUPPORT is not set + diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index c6346c205..cccfea48e 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -1,11 +1,25 @@ CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR=y +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + +CONFIG_ETH_ENABLED=y +CONFIG_ETH_USE_ESP32_EMAC=y +CONFIG_ETH_PHY_INTERFACE_RMII=y +# CONFIG_ETH_USE_SPI_ETHERNET is not set + # CONFIG_BTDM_CTRL_MODE_BTDM is not set CONFIG_BT_BTC_TASK_STACK_SIZE=8192 CONFIG_BT_BTU_TASK_STACK_SIZE=8192 -CONFIG_BT_CLASSIC_ENABLED=y -CONFIG_BT_A2DP_ENABLE=y -CONFIG_BT_SPP_ENABLED=y -CONFIG_BT_HFP_ENABLE=y CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y CONFIG_SPIRAM=y diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 726ad4c73..6441674b0 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,6 +1,18 @@ CONFIG_XTAL_FREQ_26=y CONFIG_XTAL_FREQ=26 -CONFIG_BT_BLE_BLUFI_ENABLE=y +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index b6864433c..96296de58 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -1,5 +1,16 @@ +# +# Bluetooth +# CONFIG_BT_ENABLED=y -CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + CONFIG_BT_CTRL_MODEM_SLEEP=y CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index fc5d9bea5..96296de58 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -1,4 +1,16 @@ -CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + CONFIG_BT_CTRL_MODEM_SLEEP=y CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y diff --git a/configs/defconfig.esp32h2 b/configs/defconfig.esp32h2 index fc5d9bea5..96296de58 100644 --- a/configs/defconfig.esp32h2 +++ b/configs/defconfig.esp32h2 @@ -1,4 +1,16 @@ -CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + CONFIG_BT_CTRL_MODEM_SLEEP=y CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 991117d39..3ac337072 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,6 +1,6 @@ -CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y +CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set @@ -8,3 +8,21 @@ CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n + +# +# S3 Display shift fix -> https://espressif-docs.readthedocs-hosted.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html +# +CONFIG_LCD_RGB_RESTART_IN_VSYNC=y + +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set diff --git a/main/idf_component.yml b/main/idf_component.yml index 2ba047577..fb3137b46 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -2,9 +2,10 @@ dependencies: # Required IDF version idf: ">=5.1" - mdns: "^1.1.0" - chmorgan/esp-libhelix-mp3: "1.0.3" - esp-dsp: "^1.3.4" + mdns: "^1.2.0" + #libsodium: "^1.0.20" + #chmorgan/esp-libhelix-mp3: "1.0.3" + #esp-dsp: "^1.3.4" # esp-sr: "^1.3.1" # esp32-camera: "^2.0.4" diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 5185f0805..b09efbe5c 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -18,6 +18,10 @@ rm -rf arduino-esp32/docs rm -rf arduino-esp32/tests rm -rf arduino-esp32/libraries/RainMaker rm -rf arduino-esp32/libraries/Insights +rm -rf arduino-esp32/libraries/BLE +rm -rf arduino-esp32/libraries/SimpleBLE +rm -rf arduino-esp32/libraries/WiFiProv +rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs rm -rf arduino-esp32/tools/esptool.py diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index deba2aae0..18254011e 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -47,15 +47,25 @@ if [ "$AR_BRANCH" ]; then fi if [ $? -ne 0 ]; then exit 1; fi +# +# remove libraries not needed for Tasmota +# +rm -rf "$AR_COMPS/arduino/libraries/RainMaker" +rm -rf "$AR_COMPS/arduino/libraries/Insights" +rm -rf "$AR_COMPS/arduino/libraries/BLE" +rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" +rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" +rm -rf "$AR_COMPS/arduino/libraries/ESP32" + # # CLONE/UPDATE ESP32-ARDUINO-LIBS # -if [ ! -d "$IDF_LIBS_DIR" ]; then - echo "Cloning esp32-arduino-libs..." - git clone "$AR_LIBS_REPO_URL" "$IDF_LIBS_DIR" -else - echo "Updating esp32-arduino-libs..." - git -C "$IDF_LIBS_DIR" fetch && \ - git -C "$IDF_LIBS_DIR" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi +#if [ ! -d "$IDF_LIBS_DIR" ]; then +# echo "Cloning esp32-arduino-libs..." +# git clone "$AR_LIBS_REPO_URL" "$IDF_LIBS_DIR" +#else +# echo "Updating esp32-arduino-libs..." +# git -C "$IDF_LIBS_DIR" fetch && \ +# git -C "$IDF_LIBS_DIR" pull --ff-only +#fi +#if [ $? -ne 0 ]; then exit 1; fi diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 0ca6083db..6c74775df 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -36,11 +36,6 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) fi -# -# Arduino needs cam_hal.h from esp32-camera in include folder -# -cp "AR_COMPS$/esp32-camera/driver/private_include/cam_hal.h" "AR_COMPS$/esp32-camera/driver/include/" - # # SETUP ESP-IDF ENV # diff --git a/tools/update-components.sh b/tools/update-components.sh index 23baf0657..6e490e1d5 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -19,16 +19,23 @@ fi if [ $? -ne 0 ]; then exit 1; fi # -# CLONE/UPDATE ESP-LITTLEFS +# Arduino needs cam_hal.h from esp32-camera in include folder +# +cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" + +# +# CLONE/UPDATE ESP-LITTLEFS v1.5.5 commit 9eeac09... # echo "Updating ESP-LITTLEFS..." if [ ! -d "$AR_COMPS/esp_littlefs" ]; then - git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" && \ - git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive + git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" + git -C "$AR_COMPS/esp_littlefs" checkout 9eeac09c9c250643a32df47ea870dae2dd042648 + git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive else - git -C "$AR_COMPS/esp_littlefs" fetch && \ - git -C "$AR_COMPS/esp_littlefs" pull --ff-only && \ - git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive + git -C "$AR_COMPS/esp_littlefs" fetch + git -C "$AR_COMPS/esp_littlefs" pull --ff-only + git -C "$AR_COMPS/esp_littlefs" checkout 9eeac09c9c250643a32df47ea870dae2dd042648 + git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive fi if [ $? -ne 0 ]; then exit 1; fi From 7b74053c2ce79d60c121cb3c5e36f2dc41dd646d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:08:02 +0200 Subject: [PATCH 209/636] SPI_ETHERNET --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 9104fe94e..ebe5f29d5 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -41,7 +41,7 @@ CONFIG_ESP_WIFI_CSI_ENABLED=n CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_IRAM_OPT is not set # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set -# CONFIG_ETH_SPI_ETHERNET_W5500 is not set +CONFIG_ETH_SPI_ETHERNET_W5500=y CONFIG_FATFS_CODEPAGE_850=y CONFIG_FATFS_LFN_STACK=y # CONFIG_FATFS_API_ENCODING_ANSI_OEM is not set From b9e5f5cc258538bf89c952699690faba0df4059a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:08:45 +0200 Subject: [PATCH 210/636] Update defconfig.esp32 --- configs/defconfig.esp32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index cccfea48e..0397e29b1 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -15,7 +15,7 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 CONFIG_ETH_ENABLED=y CONFIG_ETH_USE_ESP32_EMAC=y CONFIG_ETH_PHY_INTERFACE_RMII=y -# CONFIG_ETH_USE_SPI_ETHERNET is not set +CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_BTDM_CTRL_MODE_BTDM is not set CONFIG_BT_BTC_TASK_STACK_SIZE=8192 From 200704673b7e003a9a7b519ad56fe0ece7b40a58 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:09:49 +0200 Subject: [PATCH 211/636] AR branch "feature/eth_spi" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 22397992f..15d54b770 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -30,7 +30,7 @@ AR_USER="tasmota" # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="esp-idf-v5.1-c2" + AR_BRANCH="feature/eth_spi" fi # IDF commit to use From 2b65d3112c17fe098d944c56975b18d64cdba47d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:10:06 +0200 Subject: [PATCH 212/636] Update push.yml --- .github/workflows/push.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 436e62527..8125d5ea0 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,5 +1,4 @@ -name: Arduino IDF 5.1 without DSP and MP3 - +name: Arduino IDF 5.1 feature/eth_spi on: workflow_dispatch: # Manually start a workflow From 8dad25d5b21b5cc3c003c7667e76ac551c27e914 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:11:51 +0200 Subject: [PATCH 213/636] Create spi_eth.diff --- patches/spi_eth.diff | 1103 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1103 insertions(+) create mode 100644 patches/spi_eth.diff diff --git a/patches/spi_eth.diff b/patches/spi_eth.diff new file mode 100644 index 000000000..6b5281fef --- /dev/null +++ b/patches/spi_eth.diff @@ -0,0 +1,1103 @@ +diff --git a/components/esp_eth/include/esp_eth_mac.h b/components/esp_eth/include/esp_eth_mac.h +index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..c2600a178df7fd756624e200148ec899ba522807 100644 +--- a/components/esp_eth/include/esp_eth_mac.h ++++ b/components/esp_eth/include/esp_eth_mac.h +@@ -1,5 +1,5 @@ + /* +- * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD ++ * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +@@ -470,15 +470,113 @@ typedef struct { + esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config, const eth_mac_config_t *config); + #endif // CONFIG_ETH_USE_ESP32_EMAC + ++#if CONFIG_ETH_USE_SPI_ETHERNET ++/** ++ * @brief Custom SPI Driver Configuration. ++ * This structure declares configuration and callback functions to access Ethernet SPI module via ++ * user's custom SPI driver. ++ * ++ */ ++typedef struct ++{ ++ /** ++ * @brief Custom driver specific configuration structure used by `init()` function. ++ * ++ * @note Type and its content is fully under user's control ++ * ++ */ ++ void *config; ++ ++ /** ++ * @brief Custom driver SPI Initialization ++ * ++ * @param[in] spi_config: Custom driver specific configuration ++ * ++ * @return ++ * - spi_ctx: when initialization is successful, a pointer to context structure holding all variables ++ * needed for subsequent SPI access operations (e.g. SPI bus identification, mutexes, etc.) ++ * - NULL: driver initialization failed ++ * ++ * @note return type and its content is fully under user's control ++ */ ++ void *(*init)(const void *spi_config); ++ ++ /** ++ * @brief Custom driver De-initialization ++ * ++ * @param[in] spi_ctx: a pointer to driver specific context structure ++ * ++ * @return ++ * - ESP_OK: driver de-initialization was successful ++ * - ESP_FAIL: driver de-initialization failed ++ * - any other failure codes are allowed to be used to provide failure isolation ++ */ ++ esp_err_t (*deinit)(void *spi_ctx); ++ ++ /** ++ * @brief Custom driver SPI read ++ * ++ * @note The read function is responsible to construct command, address and data fields ++ * of the SPI frame in format expected by particular SPI Ethernet module ++ * ++ * @param[in] spi_ctx: a pointer to driver specific context structure ++ * @param[in] cmd: command ++ * @param[in] addr: register address ++ * @param[out] data: read data ++ * @param[in] data_len: read data length in bytes ++ * ++ * @return ++ * - ESP_OK: read was successful ++ * - ESP_FAIL: read failed ++ * - any other failure codes are allowed to be used to provide failure isolation ++ */ ++ esp_err_t (*read)(void *spi_ctx, uint32_t cmd, uint32_t addr, void *data, uint32_t data_len); ++ ++ /** ++ * @brief Custom driver SPI write ++ * ++ * @note The write function is responsible to construct command, address and data fields ++ * of the SPI frame in format expected by particular SPI Ethernet module ++ * ++ * @param[in] spi_ctx: a pointer to driver specific context structure ++ * @param[in] cmd: command ++ * @param[in] addr: register address ++ * @param[in] data: data to write ++ * @param[in] data_len: length of data to write in bytes ++ * ++ * @return ++ * - ESP_OK: write was successful ++ * - ESP_FAIL: write failed ++ * - any other failure codes are allowed to be used to provide failure isolation ++ */ ++ esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len); ++} eth_spi_custom_driver_t; ++ ++/** ++ * @brief Default configuration of the custom SPI driver. ++ * Internal ESP-IDF SPI Master driver is used by default. ++ * ++ */ ++#define ETH_NO_CUSTOM_SPI \ ++ { \ ++ .config = NULL, \ ++ .init = NULL, \ ++ .deinit = NULL, \ ++ .read = NULL, \ ++ .write = NULL \ ++ } ++#endif // CONFIG_ETH_USE_SPI_ETHERNET ++ + #if CONFIG_ETH_SPI_ETHERNET_DM9051 + /** + * @brief DM9051 specific configuration + * + */ + typedef struct { +- spi_host_device_t spi_host_id; /*!< SPI peripheral */ +- spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */ + int int_gpio_num; /*!< Interrupt GPIO number */ ++ spi_host_device_t spi_host_id; /*!< SPI peripheral (this field is invalid when custom SPI driver is defined) */ ++ spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration (this field is invalid when custom SPI driver is defined) */ ++ eth_spi_custom_driver_t custom_spi_driver; /*!< Custom SPI driver definitions */ + } eth_dm9051_config_t; + + /** +@@ -487,9 +585,10 @@ typedef struct { + */ + #define ETH_DM9051_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \ + { \ ++ .int_gpio_num = 4, \ + .spi_host_id = spi_host, \ + .spi_devcfg = spi_devcfg_p, \ +- .int_gpio_num = 4, \ ++ .custom_spi_driver = ETH_NO_CUSTOM_SPI, \ + } + + /** +@@ -511,9 +610,10 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, + * + */ + typedef struct { +- spi_host_device_t spi_host_id; /*!< SPI peripheral */ +- spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */ + int int_gpio_num; /*!< Interrupt GPIO number */ ++ spi_host_device_t spi_host_id; /*!< SPI peripheral (this field is invalid when custom SPI driver is defined)*/ ++ spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration (this field is invalid when custom SPI driver is defined)*/ ++ eth_spi_custom_driver_t custom_spi_driver; /*!< Custom SPI driver definitions */ + } eth_w5500_config_t; + + /** +@@ -521,10 +621,11 @@ typedef struct { + * + */ + #define ETH_W5500_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \ +- { \ +- .spi_host_id = spi_host, \ +- .spi_devcfg = spi_devcfg_p, \ +- .int_gpio_num = 4, \ ++ { \ ++ .int_gpio_num = 4, \ ++ .spi_host_id = spi_host, \ ++ .spi_devcfg = spi_devcfg_p, \ ++ .custom_spi_driver = ETH_NO_CUSTOM_SPI, \ + } + + /** +@@ -546,9 +647,10 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con + * + */ + typedef struct { +- spi_host_device_t spi_host_id; /*!< SPI peripheral */ +- spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */ + int int_gpio_num; /*!< Interrupt GPIO number */ ++ spi_host_device_t spi_host_id; /*!< SPI peripheral (this field is invalid when custom SPI driver is defined) */ ++ spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration (this field is invalid when custom SPI driver is defined) */ ++ eth_spi_custom_driver_t custom_spi_driver; /*!< Custom SPI driver definitions */ + } eth_ksz8851snl_config_t; + + /** +@@ -557,9 +659,10 @@ typedef struct { + */ + #define ETH_KSZ8851SNL_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \ + { \ ++ .int_gpio_num = 4, \ + .spi_host_id = spi_host, \ + .spi_devcfg = spi_devcfg_p, \ +- .int_gpio_num = 14, \ ++ .custom_spi_driver = ETH_NO_CUSTOM_SPI, \ + } + + /** +diff --git a/components/esp_eth/src/esp_eth_mac_dm9051.c b/components/esp_eth/src/esp_eth_mac_dm9051.c +index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd829a49d7d 100644 +--- a/components/esp_eth/src/esp_eth_mac_dm9051.c ++++ b/components/esp_eth/src/esp_eth_mac_dm9051.c +@@ -1,5 +1,5 @@ + /* +- * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD ++ * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +@@ -47,11 +47,23 @@ typedef struct { + uint8_t length_high; + } dm9051_rx_header_t; + ++typedef struct { ++ spi_device_handle_t hdl; ++ SemaphoreHandle_t lock; ++} spi_info_t; ++ ++typedef struct { ++ void *ctx; ++ void *(*init)(const void *spi_config); ++ esp_err_t (*deinit)(void *spi_ctx); ++ esp_err_t (*read)(void *spi_ctx, uint32_t cmd, uint32_t addr, void *data, uint32_t data_len); ++ esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len); ++} spi_interface_t; ++ + typedef struct { + esp_eth_mac_t parent; + esp_eth_mediator_t *eth; +- spi_device_handle_t spi_hdl; +- SemaphoreHandle_t spi_lock; ++ spi_interface_t spi; + TaskHandle_t rx_task_hdl; + uint32_t sw_reset_timeout_ms; + int int_gpio_num; +@@ -61,89 +73,133 @@ typedef struct { + uint8_t *rx_buffer; + } emac_dm9051_t; + +-static inline bool dm9051_lock(emac_dm9051_t *emac) ++static void *spi_init_std(const void *spi_config) ++{ ++ void *ret = NULL; ++ eth_dm9051_config_t *dm9051_config = (eth_dm9051_config_t *)spi_config; ++ spi_info_t *spi = calloc(1, sizeof(spi_info_t)); ++ ESP_GOTO_ON_FALSE(spi, NULL, err, TAG, "no memory for SPI context data"); ++ ++ /* SPI device init */ ++ spi_device_interface_config_t spi_devcfg; ++ memcpy(&spi_devcfg, dm9051_config->spi_devcfg, sizeof(spi_device_interface_config_t)); ++ if (dm9051_config->spi_devcfg->command_bits == 0 && dm9051_config->spi_devcfg->address_bits == 0) { ++ /* configure default SPI frame format */ ++ spi_devcfg.command_bits = 1; ++ spi_devcfg.address_bits = 7; ++ } else { ++ ESP_GOTO_ON_FALSE(dm9051_config->spi_devcfg->command_bits == 1 || dm9051_config->spi_devcfg->address_bits == 7, ++ NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); ++ } ++ ESP_GOTO_ON_FALSE(spi_bus_add_device(dm9051_config->spi_host_id, &spi_devcfg, &spi->hdl) == ESP_OK, ++ NULL, err, TAG, "adding device to SPI host #%d failed", dm9051_config->spi_host_id + 1); ++ ++ /* create mutex */ ++ spi->lock = xSemaphoreCreateMutex(); ++ ESP_GOTO_ON_FALSE(spi->lock, NULL, err, TAG, "create lock failed"); ++ ++ return spi; ++err: ++ if (spi->lock) { ++ vSemaphoreDelete(spi->lock); ++ } ++ return ret; ++} ++ ++static esp_err_t spi_deinit_std(void *spi_ctx) ++{ ++ esp_err_t ret = ESP_OK; ++ spi_info_t *spi = (spi_info_t *)spi_ctx; ++ ++ spi_bus_remove_device(spi->hdl); ++ vSemaphoreDelete(spi->lock); ++ ++ free(spi); ++ return ret; ++} ++ ++static inline bool dm9051_lock(spi_info_t *spi) + { +- return xSemaphoreTake(emac->spi_lock, pdMS_TO_TICKS(DM9051_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; ++ return xSemaphoreTake(spi->lock, pdMS_TO_TICKS(DM9051_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; + } + +-static inline bool dm9051_unlock(emac_dm9051_t *emac) ++static inline bool dm9051_unlock(spi_info_t *spi) + { +- return xSemaphoreGive(emac->spi_lock) == pdTRUE; ++ return xSemaphoreGive(spi->lock) == pdTRUE; + } + +-/** +- * @brief write value to dm9051 internal register +- */ +-static esp_err_t dm9051_register_write(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t value) ++static esp_err_t spi_write_std(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) + { + esp_err_t ret = ESP_OK; ++ spi_info_t *spi = (spi_info_t *)spi_ctx; ++ + spi_transaction_t trans = { +- .cmd = DM9051_SPI_WR, +- .addr = reg_addr, +- .length = 8, +- .flags = SPI_TRANS_USE_TXDATA ++ .cmd = cmd, ++ .addr = addr, ++ .length = 8 * len, ++ .tx_buffer = value + }; +- trans.tx_data[0] = value; +- if (dm9051_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { ++ if (dm9051_lock(spi)) { ++ if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { + ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); + ret = ESP_FAIL; + } +- dm9051_unlock(emac); ++ dm9051_unlock(spi); + } else { + ret = ESP_ERR_TIMEOUT; + } + return ret; + } + +-/** +- * @brief read value from dm9051 internal register +- */ +-static esp_err_t dm9051_register_read(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t *value) ++static esp_err_t spi_read_std(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) + { + esp_err_t ret = ESP_OK; ++ spi_info_t *spi = (spi_info_t *)spi_ctx; ++ + spi_transaction_t trans = { +- .cmd = DM9051_SPI_RD, +- .addr = reg_addr, +- .length = 8, +- .flags = SPI_TRANS_USE_TXDATA | SPI_TRANS_USE_RXDATA ++ .flags = len <= 4 ? SPI_TRANS_USE_RXDATA : 0, // use direct reads for registers to prevent overwrites by 4-byte boundary writes ++ .cmd = cmd, ++ .addr = addr, ++ .length = 8 * len, ++ .rx_buffer = value + }; +- if (dm9051_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { ++ if (dm9051_lock(spi)) { ++ if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { + ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); + ret = ESP_FAIL; +- } else { +- *value = trans.rx_data[0]; + } +- dm9051_unlock(emac); ++ dm9051_unlock(spi); + } else { + ret = ESP_ERR_TIMEOUT; + } ++ if ((trans.flags&SPI_TRANS_USE_RXDATA) && len <= 4) { ++ memcpy(value, trans.rx_data, len); // copy register values to output ++ } + return ret; + } + ++/** ++ * @brief write value to dm9051 internal register ++ */ ++static esp_err_t dm9051_register_write(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t value) ++{ ++ return emac->spi.write(emac->spi.ctx, DM9051_SPI_WR, reg_addr, &value, 1); ++} ++ ++/** ++ * @brief read value from dm9051 internal register ++ */ ++static esp_err_t dm9051_register_read(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t *value) ++{ ++ return emac->spi.read(emac->spi.ctx, DM9051_SPI_RD, reg_addr, value, 1); ++} ++ + /** + * @brief write buffer to dm9051 internal memory + */ + static esp_err_t dm9051_memory_write(emac_dm9051_t *emac, uint8_t *buffer, uint32_t len) + { +- esp_err_t ret = ESP_OK; +- spi_transaction_t trans = { +- .cmd = DM9051_SPI_WR, +- .addr = DM9051_MWCMD, +- .length = len * 8, +- .tx_buffer = buffer +- }; +- if (dm9051_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { +- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); +- ret = ESP_FAIL; +- } +- dm9051_unlock(emac); +- } else { +- ret = ESP_ERR_TIMEOUT; +- } +- return ret; ++ return emac->spi.write(emac->spi.ctx, DM9051_SPI_WR, DM9051_MWCMD, buffer, len); + } + + /** +@@ -151,23 +207,7 @@ static esp_err_t dm9051_memory_write(emac_dm9051_t *emac, uint8_t *buffer, uint3 + */ + static esp_err_t dm9051_memory_read(emac_dm9051_t *emac, uint8_t *buffer, uint32_t len) + { +- esp_err_t ret = ESP_OK; +- spi_transaction_t trans = { +- .cmd = DM9051_SPI_RD, +- .addr = DM9051_MRCMD, +- .length = len * 8, +- .rx_buffer = buffer +- }; +- if (dm9051_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { +- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); +- ret = ESP_FAIL; +- } +- dm9051_unlock(emac); +- } else { +- ret = ESP_ERR_TIMEOUT; +- } +- return ret; ++ return emac->spi.read(emac->spi.ctx, DM9051_SPI_RD, DM9051_MRCMD, buffer, len); + } + + /** +@@ -175,23 +215,7 @@ static esp_err_t dm9051_memory_read(emac_dm9051_t *emac, uint8_t *buffer, uint32 + */ + static esp_err_t dm9051_memory_peek(emac_dm9051_t *emac, uint8_t *buffer, uint32_t len) + { +- esp_err_t ret = ESP_OK; +- spi_transaction_t trans = { +- .cmd = DM9051_SPI_RD, +- .addr = DM9051_MRCMDX1, +- .length = len * 8, +- .rx_buffer = buffer +- }; +- if (dm9051_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { +- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); +- ret = ESP_FAIL; +- } +- dm9051_unlock(emac); +- } else { +- ret = ESP_ERR_TIMEOUT; +- } +- return ret; ++ return emac->spi.read(emac->spi.ctx, DM9051_SPI_RD, DM9051_MRCMDX1, buffer, len); + } + + /** +@@ -840,8 +864,7 @@ static esp_err_t emac_dm9051_del(esp_eth_mac_t *mac) + { + emac_dm9051_t *emac = __containerof(mac, emac_dm9051_t, parent); + vTaskDelete(emac->rx_task_hdl); +- spi_bus_remove_device(emac->spi_hdl); +- vSemaphoreDelete(emac->spi_lock); ++ emac->spi.deinit(emac->spi.ctx); + heap_caps_free(emac->rx_buffer); + free(emac); + return ESP_OK; +@@ -857,19 +880,6 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, + ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "calloc emac failed"); + /* dm9051 receive is driven by interrupt only for now*/ + ESP_GOTO_ON_FALSE(dm9051_config->int_gpio_num >= 0, NULL, err, TAG, "error interrupt gpio number"); +- /* SPI device init */ +- spi_device_interface_config_t spi_devcfg; +- memcpy(&spi_devcfg, dm9051_config->spi_devcfg, sizeof(spi_device_interface_config_t)); +- if (dm9051_config->spi_devcfg->command_bits == 0 && dm9051_config->spi_devcfg->address_bits == 0) { +- /* configure default SPI frame format */ +- spi_devcfg.command_bits = 1; +- spi_devcfg.address_bits = 7; +- } else { +- ESP_GOTO_ON_FALSE(dm9051_config->spi_devcfg->command_bits == 1 || dm9051_config->spi_devcfg->address_bits == 7, +- NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); +- } +- ESP_GOTO_ON_FALSE(spi_bus_add_device(dm9051_config->spi_host_id, &spi_devcfg, &emac->spi_hdl) == ESP_OK, +- NULL, err, TAG, "adding device to SPI host #%d failed", dm9051_config->spi_host_id + 1); + /* bind methods and attributes */ + emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; + emac->int_gpio_num = dm9051_config->int_gpio_num; +@@ -891,9 +901,26 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, + emac->parent.enable_flow_ctrl = emac_dm9051_enable_flow_ctrl; + emac->parent.transmit = emac_dm9051_transmit; + emac->parent.receive = emac_dm9051_receive; +- /* create mutex */ +- emac->spi_lock = xSemaphoreCreateMutex(); +- ESP_GOTO_ON_FALSE(emac->spi_lock, NULL, err, TAG, "create lock failed"); ++ ++ if (dm9051_config->custom_spi_driver.init != NULL && dm9051_config->custom_spi_driver.deinit != NULL ++ && dm9051_config->custom_spi_driver.read != NULL && dm9051_config->custom_spi_driver.write != NULL) { ++ ESP_LOGD(TAG, "custom SPI Driver is used"); ++ emac->spi.init = dm9051_config->custom_spi_driver.init; ++ emac->spi.deinit = dm9051_config->custom_spi_driver.deinit; ++ emac->spi.read = dm9051_config->custom_spi_driver.read; ++ emac->spi.write = dm9051_config->custom_spi_driver.write; ++ /* Custom SPI driver device init */ ++ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(dm9051_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); ++ } else { ++ ESP_LOGD(TAG, "internal SPI Master Driver is used"); ++ emac->spi.init = spi_init_std; ++ emac->spi.deinit = spi_deinit_std; ++ emac->spi.read = spi_read_std; ++ emac->spi.write = spi_write_std; ++ /* SPI device init */ ++ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(dm9051_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); ++ } ++ + /* create dm9051 task */ + BaseType_t core_num = tskNO_AFFINITY; + if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { +@@ -913,9 +940,6 @@ err: + if (emac->rx_task_hdl) { + vTaskDelete(emac->rx_task_hdl); + } +- if (emac->spi_lock) { +- vSemaphoreDelete(emac->spi_lock); +- } + heap_caps_free(emac->rx_buffer); + free(emac); + } +diff --git a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c +index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f22f0f5520 100644 +--- a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c ++++ b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c +@@ -3,7 +3,7 @@ + * + * SPDX-License-Identifier: MIT + * +- * SPDX-FileContributor: 2021-2022 Espressif Systems (Shanghai) CO LTD ++ * SPDX-FileContributor: 2021-2023 Espressif Systems (Shanghai) CO LTD + */ + + #include <string.h> +@@ -22,10 +22,22 @@ + + #define KSZ8851_ETH_MAC_RX_BUF_SIZE_AUTO (0) + ++typedef struct { ++ spi_device_handle_t hdl; ++} spi_info_t; ++ ++typedef struct { ++ void *ctx; ++ void *(*init)(const void *spi_config); ++ esp_err_t (*deinit)(void *spi_ctx); ++ esp_err_t (*read)(void *spi_ctx, uint32_t cmd,uint32_t addr, void *data, uint32_t data_len); ++ esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len); ++} spi_interface_t; ++ + typedef struct { + esp_eth_mac_t parent; + esp_eth_mediator_t *eth; +- spi_device_handle_t spi_hdl; ++ spi_interface_t spi; + SemaphoreHandle_t spi_lock; + TaskHandle_t rx_task_hdl; + uint32_t sw_reset_timeout_ms; +@@ -73,6 +85,32 @@ IRAM_ATTR static void ksz8851_isr_handler(void *arg) + } + } + ++static void *spi_init_std(const void *spi_config) ++{ ++ void *ret = NULL; ++ eth_ksz8851snl_config_t *ksz8851snl_config = (eth_ksz8851snl_config_t *)spi_config; ++ spi_info_t *spi = calloc(1, sizeof(spi_info_t)); // TODO maybe replace with static variable spi_host_id ++ ESP_GOTO_ON_FALSE(spi, NULL, err, TAG, "no memory for SPI context data"); ++ ++ /* SPI device init */ ++ ESP_GOTO_ON_FALSE(spi_bus_add_device(ksz8851snl_config->spi_host_id, ksz8851snl_config->spi_devcfg, &spi->hdl) == ESP_OK, NULL, ++ err, TAG, "adding device to SPI host #%d failed", ksz8851snl_config->spi_host_id + 1); ++ return spi; ++err: ++ return ret; ++} ++ ++static esp_err_t spi_deinit_std(void *spi_ctx) ++{ ++ esp_err_t ret = ESP_OK; ++ spi_info_t *spi = (spi_info_t *)spi_ctx; ++ ++ spi_bus_remove_device(spi->hdl); ++ ++ free(spi); ++ return ret; ++} ++ + static inline bool ksz8851_mutex_lock(emac_ksz8851snl_t *emac) + { + return xSemaphoreTakeRecursive(emac->spi_lock, pdMS_TO_TICKS(KSZ8851_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; +@@ -83,70 +121,102 @@ static inline bool ksz8851_mutex_unlock(emac_ksz8851snl_t *emac) + return xSemaphoreGiveRecursive(emac->spi_lock) == pdTRUE; + } + +-static esp_err_t ksz8851_read_reg(emac_ksz8851snl_t *emac, uint32_t address, uint16_t *value) ++static esp_err_t spi_read_std(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) + { + esp_err_t ret = ESP_OK; +- ESP_GOTO_ON_FALSE(value != NULL, ESP_ERR_INVALID_ARG, err, TAG, "out pointer must not be null"); +- ESP_GOTO_ON_FALSE((address & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); ++ spi_info_t *spi = (spi_info_t *)spi_ctx; + +- const unsigned data_size = 16U; // NOTE(v.chistyakov): bits +- // NOTE(v.chistyakov): select upper or lower word inside a dword +- const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (address & 0x2U)); +- address <<= KSZ8851_SPI_ADDR_SHIFT; ++ spi_transaction_ext_t trans = { ++ .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | (len <= 4 ? SPI_TRANS_USE_RXDATA : 0), ++ .base.cmd = cmd, ++ .base.addr = addr, ++ .base.length = 8 * len, ++ .base.rx_buffer = value, ++ .command_bits = KSZ8851_SPI_COMMAND_BITS ++ }; ++ if (cmd >= KSZ8851_SPI_COMMAND_READ_FIFO) { ++ trans.address_bits = 8 - KSZ8851_SPI_COMMAND_BITS; ++ } else { ++ trans.address_bits = 16 - KSZ8851_SPI_COMMAND_BITS; ++ } ++ ++ if (spi_device_polling_transmit(spi->hdl, &trans.base) != ESP_OK) { ++ ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); ++ ret = ESP_FAIL; ++ } ++ ++ if ((trans.base.flags & SPI_TRANS_USE_RXDATA) && len <= 4) { ++ memcpy(value, trans.base.rx_data, len); // copy register values to output ++ //ESP_LOGV(TAG, "reading reg 0x%02x == 0x%04x", addr, *value); // TODO ++ } ++ return ret; ++} ++ ++static esp_err_t spi_write_std(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) ++{ ++ esp_err_t ret = ESP_OK; ++ spi_info_t *spi = (spi_info_t *)spi_ctx; + + spi_transaction_ext_t trans = { +- .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | SPI_TRANS_USE_RXDATA, +- .base.cmd = KSZ8851_SPI_COMMAND_READ_REG, +- .base.addr = address | byte_mask, +- .base.length = data_size, +- .command_bits = KSZ8851_SPI_COMMAND_BITS, +- .address_bits = 16 - KSZ8851_SPI_COMMAND_BITS, ++ .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY, ++ .base.cmd = cmd, ++ .base.addr = addr, ++ .base.length = 8 * len, ++ .base.tx_buffer = value, ++ .command_bits = KSZ8851_SPI_COMMAND_BITS + }; ++ if (cmd >= KSZ8851_SPI_COMMAND_READ_FIFO) { ++ trans.address_bits = 8 - KSZ8851_SPI_COMMAND_BITS; ++ } else { ++ trans.address_bits = 16 - KSZ8851_SPI_COMMAND_BITS; ++ } ++ ++ if (spi_device_polling_transmit(spi->hdl, &trans.base) != ESP_OK) { ++ ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); ++ ret = ESP_FAIL; ++ } ++ ++ return ret; ++} ++ ++static esp_err_t ksz8851_read_reg(emac_ksz8851snl_t *emac, uint32_t reg_addr, uint16_t *value) ++{ ++ esp_err_t ret = ESP_OK; ++ ESP_GOTO_ON_FALSE(value != NULL, ESP_ERR_INVALID_ARG, err, TAG, "out pointer must not be null"); ++ ESP_GOTO_ON_FALSE((reg_addr & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); ++ ++ // NOTE(v.chistyakov): select upper or lower word inside a dword ++ const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (reg_addr & 0x2U)); ++ reg_addr <<= KSZ8851_SPI_ADDR_SHIFT; ++ + if (ksz8851_mutex_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { +- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); +- ret = ESP_FAIL; +- } +- ksz8851_mutex_unlock(emac); +- memcpy(value, trans.base.rx_data, data_size >> 3U); +- ESP_LOGV(TAG, "reading reg 0x%02x == 0x%04x", address, *value); ++ ret = emac->spi.read(emac->spi.ctx, KSZ8851_SPI_COMMAND_READ_REG, reg_addr | byte_mask, value, 2); + } else { + ret = ESP_ERR_TIMEOUT; + } ++ ksz8851_mutex_unlock(emac); ++ + err: + return ret; + } + +-static esp_err_t ksz8851_write_reg(emac_ksz8851snl_t *emac, uint32_t address, uint16_t value) ++static esp_err_t ksz8851_write_reg(emac_ksz8851snl_t *emac, uint32_t reg_addr, uint16_t value) + { + esp_err_t ret = ESP_OK; +- ESP_GOTO_ON_FALSE((address & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); +- ESP_LOGV(TAG, "writing reg 0x%02x = 0x%04x", address, value); ++ ESP_GOTO_ON_FALSE((reg_addr & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); ++ ESP_LOGV(TAG, "writing reg 0x%02x = 0x%04x", reg_addr, value); + +- const unsigned data_size = 16U; // NOTE(v.chistyakov): bits + // NOTE(v.chistyakov): select upper or lower word inside a dword +- const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (address & 0x2U)); +- address <<= KSZ8851_SPI_ADDR_SHIFT; +- +- spi_transaction_ext_t trans = { +- .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | SPI_TRANS_USE_TXDATA, +- .base.cmd = KSZ8851_SPI_COMMAND_WRITE_REG, +- .base.addr = address | byte_mask, +- .base.length = data_size, +- .command_bits = KSZ8851_SPI_COMMAND_BITS, +- .address_bits = 16 - KSZ8851_SPI_COMMAND_BITS, +- }; ++ const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (reg_addr & 0x2U)); ++ reg_addr <<= KSZ8851_SPI_ADDR_SHIFT; + +- memcpy(trans.base.tx_data, &value, data_size >> 3U); + if (ksz8851_mutex_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { +- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); +- ret = ESP_FAIL; +- } +- ksz8851_mutex_unlock(emac); ++ ret = emac->spi.write(emac->spi.ctx, KSZ8851_SPI_COMMAND_WRITE_REG, reg_addr | byte_mask, &value, 2); + } else { + ret = ESP_ERR_TIMEOUT; + } ++ ksz8851_mutex_unlock(emac); ++ + err: + return ret; + } +@@ -333,24 +403,12 @@ static esp_err_t emac_ksz8851snl_transmit(esp_eth_mac_t *mac, uint8_t *buf, uint + emac->tx_buffer[3] = (length >> 8U) & 0xFFU; + memcpy(emac->tx_buffer + 4U, buf, length); + +- spi_transaction_ext_t trans = { +- .base.flags = SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_CMD, +- .base.cmd = KSZ8851_SPI_COMMAND_WRITE_FIFO, +- .base.length = transmit_length * 8U, // NOTE(v.chistyakov): bits +- .base.tx_buffer = emac->tx_buffer, +- .command_bits = 2U, +- .address_bits = 6U, +- }; +- + uint16_t ier; + ESP_GOTO_ON_ERROR(ksz8851_read_reg(emac, KSZ8851_IER, &ier), err, TAG, "IER read failed"); + ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_IER, 0), err, TAG, "IER write failed"); + + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); +- if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { +- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); +- ret = ESP_FAIL; +- } ++ ret = emac->spi.write(emac->spi.ctx, KSZ8851_SPI_COMMAND_WRITE_FIFO, 0, emac->tx_buffer, transmit_length); + ESP_GOTO_ON_ERROR(ksz8851_clear_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); + + ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_IER, ier), err, TAG, "IER write failed"); +@@ -438,23 +496,12 @@ static esp_err_t emac_ksz8851_receive(esp_eth_mac_t *mac, uint8_t *buf, uint32_t + + // NOTE(v.chistyakov): 4 dummy + 4 header + alignment + const unsigned receive_size = 8U + ((byte_count + 3U) & ~0x3U); +- spi_transaction_ext_t trans = { +- .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY, +- .base.cmd = KSZ8851_SPI_COMMAND_READ_FIFO, +- .base.length = receive_size * 8U, // NOTE(v.chistyakov): bits +- .base.rx_buffer = emac->rx_buffer, +- .command_bits = 2U, +- .address_bits = 6U, +- }; + if (!ksz8851_mutex_lock(emac)) { + return ESP_ERR_TIMEOUT; + } + ESP_GOTO_ON_ERROR(ksz8851_clear_bits(emac, KSZ8851_RXFDPR, RXFDPR_RXFP_MASK), err, TAG, "RXFDPR write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); +- if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { +- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); +- ret = ESP_FAIL; +- } ++ ret = emac->spi.read(emac->spi.ctx, KSZ8851_SPI_COMMAND_READ_FIFO, 0, emac->rx_buffer, receive_size); + ESP_GOTO_ON_ERROR(ksz8851_clear_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); + ksz8851_mutex_unlock(emac); + // NOTE(v.chistyakov): skip 4 dummy, 4 header +@@ -728,7 +775,7 @@ static esp_err_t emac_ksz8851_del(esp_eth_mac_t *mac) + { + emac_ksz8851snl_t *emac = __containerof(mac, emac_ksz8851snl_t, parent); + vTaskDelete(emac->rx_task_hdl); +- spi_bus_remove_device(emac->spi_hdl); ++ emac->spi.deinit(emac->spi.ctx); + vSemaphoreDelete(emac->spi_lock); + heap_caps_free(emac->rx_buffer); + heap_caps_free(emac->tx_buffer); +@@ -748,10 +795,6 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 + emac = calloc(1, sizeof(emac_ksz8851snl_t)); + ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "no mem for MAC instance"); + +- /* SPI device init */ +- ESP_GOTO_ON_FALSE(spi_bus_add_device(ksz8851snl_config->spi_host_id, ksz8851snl_config->spi_devcfg, &emac->spi_hdl) == ESP_OK, +- NULL, err, TAG, "adding device to SPI host #%d failed", ksz8851snl_config->spi_host_id + 1); +- + emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; + emac->int_gpio_num = ksz8851snl_config->int_gpio_num; + emac->parent.set_mediator = emac_ksz8851_set_mediator; +@@ -772,8 +815,6 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 + emac->parent.enable_flow_ctrl = emac_ksz8851_enable_flow_ctrl; + emac->parent.set_peer_pause_ability = emac_ksz8851_set_peer_pause_ability; + emac->parent.del = emac_ksz8851_del; +- emac->spi_lock = xSemaphoreCreateRecursiveMutex(); +- ESP_GOTO_ON_FALSE(emac->spi_lock, NULL, err, TAG, "create lock failed"); + emac->rx_buffer = NULL; + emac->tx_buffer = NULL; + emac->rx_buffer = heap_caps_malloc(KSZ8851_QMU_PACKET_LENGTH + KSZ8851_QMU_PACKET_PADDING, MALLOC_CAP_DMA); +@@ -781,6 +822,29 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 + ESP_GOTO_ON_FALSE(emac->rx_buffer, NULL, err, TAG, "RX buffer allocation failed"); + ESP_GOTO_ON_FALSE(emac->tx_buffer, NULL, err, TAG, "TX buffer allocation failed"); + ++ /* create mutex */ ++ emac->spi_lock = xSemaphoreCreateRecursiveMutex(); ++ ESP_GOTO_ON_FALSE(emac->spi_lock, NULL, err, TAG, "create lock failed"); ++ ++ if (ksz8851snl_config->custom_spi_driver.init != NULL && ksz8851snl_config->custom_spi_driver.deinit != NULL ++ && ksz8851snl_config->custom_spi_driver.read != NULL && ksz8851snl_config->custom_spi_driver.write != NULL) { ++ ESP_LOGD(TAG, "custom SPI Driver is used"); ++ emac->spi.init = ksz8851snl_config->custom_spi_driver.init; ++ emac->spi.deinit = ksz8851snl_config->custom_spi_driver.deinit; ++ emac->spi.read = ksz8851snl_config->custom_spi_driver.read; ++ emac->spi.write = ksz8851snl_config->custom_spi_driver.write; ++ /* Custom SPI driver device init */ ++ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(ksz8851snl_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); ++ } else { ++ ESP_LOGD(TAG, "internal SPI Master Driver is used"); ++ emac->spi.init = spi_init_std; ++ emac->spi.deinit = spi_deinit_std; ++ emac->spi.read = spi_read_std; ++ emac->spi.write = spi_write_std; ++ /* SPI device init */ ++ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(ksz8851snl_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); ++ } ++ + BaseType_t core_num = tskNO_AFFINITY; + if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { + core_num = esp_cpu_get_core_id(); +diff --git a/components/esp_eth/src/esp_eth_mac_w5500.c b/components/esp_eth/src/esp_eth_mac_w5500.c +index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538b2903f98 100644 +--- a/components/esp_eth/src/esp_eth_mac_w5500.c ++++ b/components/esp_eth/src/esp_eth_mac_w5500.c +@@ -37,11 +37,23 @@ typedef struct { + uint32_t remain; + }__attribute__((packed)) emac_w5500_auto_buf_info_t; + ++typedef struct { ++ spi_device_handle_t hdl; ++ SemaphoreHandle_t lock; ++} spi_info_t; ++ ++typedef struct { ++ void *ctx; ++ void *(*init)(const void *spi_config); ++ esp_err_t (*deinit)(void *spi_ctx); ++ esp_err_t (*read)(void *spi_ctx, uint32_t cmd,uint32_t addr, void *data, uint32_t data_len); ++ esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len); ++} spi_interface_t; ++ + typedef struct { + esp_eth_mac_t parent; + esp_eth_mediator_t *eth; +- spi_device_handle_t spi_hdl; +- SemaphoreHandle_t spi_lock; ++ spi_interface_t spi; + TaskHandle_t rx_task_hdl; + uint32_t sw_reset_timeout_ms; + int int_gpio_num; +@@ -50,55 +62,101 @@ typedef struct { + uint8_t *rx_buffer; + } emac_w5500_t; + +-static inline bool w5500_lock(emac_w5500_t *emac) ++static void *spi_init_std(const void *spi_config) ++{ ++ void *ret = NULL; ++ eth_w5500_config_t *w5500_config = (eth_w5500_config_t *)spi_config; ++ spi_info_t *spi = calloc(1, sizeof(spi_info_t)); ++ ESP_GOTO_ON_FALSE(spi, NULL, err, TAG, "no memory for SPI context data"); ++ ++ /* SPI device init */ ++ spi_device_interface_config_t spi_devcfg; ++ memcpy(&spi_devcfg, w5500_config->spi_devcfg, sizeof(spi_device_interface_config_t)); ++ if (w5500_config->spi_devcfg->command_bits == 0 && w5500_config->spi_devcfg->address_bits == 0) { ++ /* configure default SPI frame format */ ++ spi_devcfg.command_bits = 16; // Actually it's the address phase in W5500 SPI frame ++ spi_devcfg.address_bits = 8; // Actually it's the control phase in W5500 SPI frame ++ } else { ++ ESP_GOTO_ON_FALSE(w5500_config->spi_devcfg->command_bits == 16 || w5500_config->spi_devcfg->address_bits == 8, ++ NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); ++ } ++ ESP_GOTO_ON_FALSE(spi_bus_add_device(w5500_config->spi_host_id, &spi_devcfg, &spi->hdl) == ESP_OK, NULL, ++ err, TAG, "adding device to SPI host #%d failed", w5500_config->spi_host_id + 1); ++ /* create mutex */ ++ spi->lock = xSemaphoreCreateMutex(); ++ ESP_GOTO_ON_FALSE(spi->lock, NULL, err, TAG, "create lock failed"); ++ ++ return spi; ++err: ++ if (spi->lock) { ++ vSemaphoreDelete(spi->lock); ++ } ++ return ret; ++} ++ ++static esp_err_t spi_deinit_std(void *spi_ctx) ++{ ++ esp_err_t ret = ESP_OK; ++ spi_info_t *spi = (spi_info_t *)spi_ctx; ++ ++ spi_bus_remove_device(spi->hdl); ++ vSemaphoreDelete(spi->lock); ++ ++ free(spi); ++ return ret; ++} ++ ++static inline bool w5500_lock(spi_info_t *spi) + { +- return xSemaphoreTake(emac->spi_lock, pdMS_TO_TICKS(W5500_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; ++ return xSemaphoreTake(spi->lock, pdMS_TO_TICKS(W5500_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; + } + +-static inline bool w5500_unlock(emac_w5500_t *emac) ++static inline bool w5500_unlock(spi_info_t *spi) + { +- return xSemaphoreGive(emac->spi_lock) == pdTRUE; ++ return xSemaphoreGive(spi->lock) == pdTRUE; + } + +-static esp_err_t w5500_write(emac_w5500_t *emac, uint32_t address, const void *value, uint32_t len) ++static esp_err_t spi_write_std(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) + { + esp_err_t ret = ESP_OK; ++ spi_info_t *spi = (spi_info_t *)spi_ctx; + + spi_transaction_t trans = { +- .cmd = (address >> W5500_ADDR_OFFSET), +- .addr = ((address & 0xFFFF) | (W5500_ACCESS_MODE_WRITE << W5500_RWB_OFFSET) | W5500_SPI_OP_MODE_VDM), ++ .cmd = cmd, ++ .addr = addr, + .length = 8 * len, + .tx_buffer = value + }; +- if (w5500_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { ++ if (w5500_lock(spi)) { ++ if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { + ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); + ret = ESP_FAIL; + } +- w5500_unlock(emac); ++ w5500_unlock(spi); + } else { + ret = ESP_ERR_TIMEOUT; + } + return ret; + } + +-static esp_err_t w5500_read(emac_w5500_t *emac, uint32_t address, void *value, uint32_t len) ++static esp_err_t spi_read_std(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) + { + esp_err_t ret = ESP_OK; ++ spi_info_t *spi = (spi_info_t *)spi_ctx; + + spi_transaction_t trans = { + .flags = len <= 4 ? SPI_TRANS_USE_RXDATA : 0, // use direct reads for registers to prevent overwrites by 4-byte boundary writes +- .cmd = (address >> W5500_ADDR_OFFSET), +- .addr = ((address & 0xFFFF) | (W5500_ACCESS_MODE_READ << W5500_RWB_OFFSET) | W5500_SPI_OP_MODE_VDM), ++ .cmd = cmd, ++ .addr = addr, + .length = 8 * len, + .rx_buffer = value + }; +- if (w5500_lock(emac)) { +- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { ++ if (w5500_lock(spi)) { ++ if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { + ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); + ret = ESP_FAIL; + } +- w5500_unlock(emac); ++ w5500_unlock(spi); + } else { + ret = ESP_ERR_TIMEOUT; + } +@@ -108,6 +166,24 @@ static esp_err_t w5500_read(emac_w5500_t *emac, uint32_t address, void *value, u + return ret; + } + ++static esp_err_t w5500_read(emac_w5500_t *emac, uint32_t address, void *data, uint32_t len) ++{ ++ uint32_t cmd = (address >> W5500_ADDR_OFFSET); // Actually it's the address phase in W5500 SPI frame ++ uint32_t addr = ((address & 0xFFFF) | (W5500_ACCESS_MODE_READ << W5500_RWB_OFFSET) ++ | W5500_SPI_OP_MODE_VDM); // Actually it's the command phase in W5500 SPI frame ++ ++ return emac->spi.read(emac->spi.ctx, cmd, addr, data, len); ++} ++ ++static esp_err_t w5500_write(emac_w5500_t *emac, uint32_t address, const void *data, uint32_t len) ++{ ++ uint32_t cmd = (address >> W5500_ADDR_OFFSET); // Actually it's the address phase in W5500 SPI frame ++ uint32_t addr = ((address & 0xFFFF) | (W5500_ACCESS_MODE_WRITE << W5500_RWB_OFFSET) ++ | W5500_SPI_OP_MODE_VDM); // Actually it's the command phase in W5500 SPI frame ++ ++ return emac->spi.write(emac->spi.ctx, cmd, addr, data, len); ++} ++ + static esp_err_t w5500_send_command(emac_w5500_t *emac, uint8_t command, uint32_t timeout_ms) + { + esp_err_t ret = ESP_OK; +@@ -738,8 +814,7 @@ static esp_err_t emac_w5500_del(esp_eth_mac_t *mac) + { + emac_w5500_t *emac = __containerof(mac, emac_w5500_t, parent); + vTaskDelete(emac->rx_task_hdl); +- spi_bus_remove_device(emac->spi_hdl); +- vSemaphoreDelete(emac->spi_lock); ++ emac->spi.deinit(emac->spi.ctx); + heap_caps_free(emac->rx_buffer); + free(emac); + return ESP_OK; +@@ -754,19 +829,6 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con + ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "no mem for MAC instance"); + /* w5500 driver is interrupt driven */ + ESP_GOTO_ON_FALSE(w5500_config->int_gpio_num >= 0, NULL, err, TAG, "invalid interrupt gpio number"); +- /* SPI device init */ +- spi_device_interface_config_t spi_devcfg; +- memcpy(&spi_devcfg, w5500_config->spi_devcfg, sizeof(spi_device_interface_config_t)); +- if (w5500_config->spi_devcfg->command_bits == 0 && w5500_config->spi_devcfg->address_bits == 0) { +- /* configure default SPI frame format */ +- spi_devcfg.command_bits = 16; // Actually it's the address phase in W5500 SPI frame +- spi_devcfg.address_bits = 8; // Actually it's the control phase in W5500 SPI frame +- } else { +- ESP_GOTO_ON_FALSE(w5500_config->spi_devcfg->command_bits == 16 || w5500_config->spi_devcfg->address_bits == 8, +- NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); +- } +- ESP_GOTO_ON_FALSE(spi_bus_add_device(w5500_config->spi_host_id, &spi_devcfg, &emac->spi_hdl) == ESP_OK, +- NULL, err, TAG, "adding device to SPI host #%d failed", w5500_config->spi_host_id + 1); + /* bind methods and attributes */ + emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; + emac->int_gpio_num = w5500_config->int_gpio_num; +@@ -788,9 +850,26 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con + emac->parent.enable_flow_ctrl = emac_w5500_enable_flow_ctrl; + emac->parent.transmit = emac_w5500_transmit; + emac->parent.receive = emac_w5500_receive; +- /* create mutex */ +- emac->spi_lock = xSemaphoreCreateMutex(); +- ESP_GOTO_ON_FALSE(emac->spi_lock, NULL, err, TAG, "create lock failed"); ++ ++ if (w5500_config->custom_spi_driver.init != NULL && w5500_config->custom_spi_driver.deinit != NULL ++ && w5500_config->custom_spi_driver.read != NULL && w5500_config->custom_spi_driver.write != NULL) { ++ ESP_LOGD(TAG, "custom SPI Driver is used"); ++ emac->spi.init = w5500_config->custom_spi_driver.init; ++ emac->spi.deinit = w5500_config->custom_spi_driver.deinit; ++ emac->spi.read = w5500_config->custom_spi_driver.read; ++ emac->spi.write = w5500_config->custom_spi_driver.write; ++ /* Custom SPI driver device init */ ++ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(w5500_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); ++ } else { ++ ESP_LOGD(TAG, "internal SPI Master Driver is used"); ++ emac->spi.init = spi_init_std; ++ emac->spi.deinit = spi_deinit_std; ++ emac->spi.read = spi_read_std; ++ emac->spi.write = spi_write_std; ++ /* SPI device init */ ++ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(w5500_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); ++ } ++ + /* create w5500 task */ + BaseType_t core_num = tskNO_AFFINITY; + if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { +@@ -806,13 +885,11 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con + return &(emac->parent); + + err: ++ // TODO SPI deinit? + if (emac) { + if (emac->rx_task_hdl) { + vTaskDelete(emac->rx_task_hdl); + } +- if (emac->spi_lock) { +- vSemaphoreDelete(emac->spi_lock); +- } + heap_caps_free(emac->rx_buffer); + free(emac); + } + From 1e20dc8c4bf4678c265bc16fbfd72c71a6212b2f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:14:21 +0200 Subject: [PATCH 214/636] Add temporary support for Arduino SPI Ethernet --- tools/install-esp-idf.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 6c74775df..6c33a01eb 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -34,6 +34,11 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then $IDF_PATH/install.sh export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) + + # Temporarily patch the ETH driver to support custom SPI + cd $IDF_PATH + patch -p1 -i ../patches/spi_eth.diff + cd - fi # From fb1825ae6d1946dbf89bc133be48e9800e7de630 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:15:55 +0200 Subject: [PATCH 215/636] Enable all SPI ETH PHY --- configs/defconfig.common | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index ebe5f29d5..9fb552d55 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -41,7 +41,9 @@ CONFIG_ESP_WIFI_CSI_ENABLED=n CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_IRAM_OPT is not set # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set +CONFIG_ETH_SPI_ETHERNET_DM9051=y CONFIG_ETH_SPI_ETHERNET_W5500=y +CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL=y CONFIG_FATFS_CODEPAGE_850=y CONFIG_FATFS_LFN_STACK=y # CONFIG_FATFS_API_ENCODING_ANSI_OEM is not set From 95f40179e485ad70aac1d3abfd5d43c93da5aaad Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:17:31 +0200 Subject: [PATCH 216/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8125d5ea0..d2c7226a6 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: Arduino IDF 5.1 feature/eth_spi +name: Arduino IDF 5.1 feature/eth_spi -> with IDF Patch on: workflow_dispatch: # Manually start a workflow From 4a717d0f61fbf2465367b39998d7d7b514b978c6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:58:54 +0200 Subject: [PATCH 217/636] Create nimble.diff --- patches/nimble.diff | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 patches/nimble.diff diff --git a/patches/nimble.diff b/patches/nimble.diff new file mode 100644 index 000000000..4b6e60c7d --- /dev/null +++ b/patches/nimble.diff @@ -0,0 +1,12 @@ +diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h +index a1f84f1d6..f748d6494 100644 +--- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h ++++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h +@@ -20,6 +20,7 @@ + #ifndef H_BLE_SVC_GAP_ + #define H_BLE_SVC_GAP_ + ++#include "syscfg/syscfg.h" + #include <inttypes.h> + #if MYNEWT_VAL(ENC_ADV_DATA) + #include "host/ble_ead.h" From 39213c57204560ee65184b8bc29fa1b649d5b028 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Sep 2023 12:01:58 +0200 Subject: [PATCH 218/636] Patch nimble to support h2zero `esp-nimble-cpp` --- tools/install-esp-idf.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 6c33a01eb..7096e49a8 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -39,6 +39,11 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then cd $IDF_PATH patch -p1 -i ../patches/spi_eth.diff cd - + + # Patch espressif nimble driver to support esp-nimble-cpp from h2zero + cd $IDF_PATH + patch -p1 -i ../patches/nimble.diff + cd - fi # From 3df991118a69ce8be948702e732608e5ba1cefee Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Sep 2023 13:13:59 +0200 Subject: [PATCH 219/636] Update nimble.diff --- patches/nimble.diff | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patches/nimble.diff b/patches/nimble.diff index 4b6e60c7d..10803bb6c 100644 --- a/patches/nimble.diff +++ b/patches/nimble.diff @@ -1,7 +1,7 @@ -diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h +diff --git a/components/bt/host/nimble/nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h b/components/bt/host/nimble/nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h index a1f84f1d6..f748d6494 100644 ---- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h -+++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h +--- a/components/bt/host/nimble/nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h ++++ b/components/bt/host/nimble/nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h @@ -20,6 +20,7 @@ #ifndef H_BLE_SVC_GAP_ #define H_BLE_SVC_GAP_ @@ -10,3 +10,4 @@ index a1f84f1d6..f748d6494 100644 #include <inttypes.h> #if MYNEWT_VAL(ENC_ADV_DATA) #include "host/ble_ead.h" + From 268f502ee903ee9ef51810ca4a210c9c8ca03aa2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:07:15 +0200 Subject: [PATCH 220/636] freeze IDF to commit 707b703... --- tools/config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 15d54b770..15a94af9c 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -33,8 +33,8 @@ if [ -z $AR_BRANCH ]; then AR_BRANCH="feature/eth_spi" fi -# IDF commit to use -#IDF_COMMIT="cf913a00e34d61adeee0dc52414a9e10c9b3737e" +# IDF commit to use / Nimble fails in actual release/v5.1 +IDF_COMMIT="707b7039850844173e46eb634081a37bbbadaa9b" # Arduino commit to use #AR_COMMIT="" From e7f8b9a1ccb8abe4237e2fd3c95b41754d1a99f9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:06:22 +0200 Subject: [PATCH 221/636] Update config.sh --- tools/config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 15a94af9c..978ffd305 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -77,8 +77,8 @@ else AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") fi -rm -rf release-info.txt -echo "Framework built from Tasmota IDF branch $IDF_BRANCH commit $IDF_COMMIT and $AR_REPO branch $AR_BRANCH commit $AR_COMMIT" >> release-info.txt +#rm -rf release-info.txt +#echo "Framework built from Tasmota IDF branch $IDF_BRANCH commit $IDF_COMMIT and $AR_REPO branch $AR_BRANCH commit $AR_COMMIT" >> release-info.txt function get_os(){ OSBITS=`arch` From 5a566de7da2b6ed90b60791d80fbafe5e859d78b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:07:24 +0200 Subject: [PATCH 222/636] Update build.sh --- build.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.sh b/build.sh index 51b086e7e..f5ea7ce5b 100755 --- a/build.sh +++ b/build.sh @@ -155,6 +155,13 @@ done 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) echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" +# Add release-info +rm -rf release-info.txt +IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") +AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") +echo "Framework built from Tasmota IDF branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt + + #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do target=$(echo "$target_json" | jq -c '.target' | tr -d '"') From 5205c94c67d4d35c85466874462056388b3a8efe Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:15:51 +0200 Subject: [PATCH 223/636] add repo owner in release-info.txt --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index f5ea7ce5b..95a5dbd00 100755 --- a/build.sh +++ b/build.sh @@ -159,7 +159,7 @@ echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/ rm -rf release-info.txt IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") -echo "Framework built from Tasmota IDF branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt +echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt #targets_count=`jq -c '.targets[] | length' configs/builds.json` From 63c1756b75664d4aaea3cbb36ad1e95940bf00dd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:30:10 +0200 Subject: [PATCH 224/636] Add a temporary fix for relative include in BT lib --- tools/copy-libs.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 2542a9a31..a20358c6a 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -402,6 +402,11 @@ for item; do mkdir -p "$out_cpath$rel_p" cp -n $f "$out_cpath$rel_p/" done + # Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17 + if [[ "$fname" == "bt" && "$out_sub" == "/include/$IDF_TARGET/include" && -f "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" ]]; then + mkdir -p "$AR_SDK/include/$fname/controller/$IDF_TARGET" + cp -n "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" "$AR_SDK/include/$fname/controller/$IDF_TARGET/esp_bt_cfg.h" + fi fi done echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")), \"include\")," >> "$AR_PLATFORMIO_PY" From 59f351f3e529819e07eaa9d130ee8f6c9aee2f3d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:33:45 +0200 Subject: [PATCH 225/636] use latest IDF 5.1 --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 978ffd305..c210ac254 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -34,7 +34,7 @@ if [ -z $AR_BRANCH ]; then fi # IDF commit to use / Nimble fails in actual release/v5.1 -IDF_COMMIT="707b7039850844173e46eb634081a37bbbadaa9b" +#IDF_COMMIT="707b7039850844173e46eb634081a37bbbadaa9b" # Arduino commit to use #AR_COMMIT="" From 0b8a9629c5fdf1b6b8e9854f4c4996a02058b6f0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:28:46 +0200 Subject: [PATCH 226/636] Update spi_eth.diff --- patches/spi_eth.diff | 358 ++++++++++++++++++++++++------------------- 1 file changed, 197 insertions(+), 161 deletions(-) diff --git a/patches/spi_eth.diff b/patches/spi_eth.diff index 6b5281fef..1e57dbef1 100644 --- a/patches/spi_eth.diff +++ b/patches/spi_eth.diff @@ -1,5 +1,5 @@ diff --git a/components/esp_eth/include/esp_eth_mac.h b/components/esp_eth/include/esp_eth_mac.h -index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..c2600a178df7fd756624e200148ec899ba522807 100644 +index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..885d332d4363e093d84af1a196c532450386b8ce 100644 --- a/components/esp_eth/include/esp_eth_mac.h +++ b/components/esp_eth/include/esp_eth_mac.h @@ -1,5 +1,5 @@ @@ -23,7 +23,7 @@ index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..c2600a178df7fd756624e200148ec899 +typedef struct +{ + /** -+ * @brief Custom driver specific configuration structure used by `init()` function. ++ * @brief Custom driver specific configuration data used by `init()` function. + * + * @note Type and its content is fully under user's control + * @@ -100,13 +100,13 @@ index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..c2600a178df7fd756624e200148ec899 + * Internal ESP-IDF SPI Master driver is used by default. + * + */ -+#define ETH_NO_CUSTOM_SPI \ -+ { \ -+ .config = NULL, \ -+ .init = NULL, \ -+ .deinit = NULL, \ -+ .read = NULL, \ -+ .write = NULL \ ++#define ETH_DEFAULT_SPI \ ++ { \ ++ .config = NULL, \ ++ .init = NULL, \ ++ .deinit = NULL, \ ++ .read = NULL, \ ++ .write = NULL \ + } +#endif // CONFIG_ETH_USE_SPI_ETHERNET + @@ -133,7 +133,7 @@ index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..c2600a178df7fd756624e200148ec899 .spi_host_id = spi_host, \ .spi_devcfg = spi_devcfg_p, \ - .int_gpio_num = 4, \ -+ .custom_spi_driver = ETH_NO_CUSTOM_SPI, \ ++ .custom_spi_driver = ETH_DEFAULT_SPI, \ } /** @@ -162,7 +162,7 @@ index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..c2600a178df7fd756624e200148ec899 + .int_gpio_num = 4, \ + .spi_host_id = spi_host, \ + .spi_devcfg = spi_devcfg_p, \ -+ .custom_spi_driver = ETH_NO_CUSTOM_SPI, \ ++ .custom_spi_driver = ETH_DEFAULT_SPI, \ } /** @@ -187,12 +187,12 @@ index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..c2600a178df7fd756624e200148ec899 .spi_host_id = spi_host, \ .spi_devcfg = spi_devcfg_p, \ - .int_gpio_num = 14, \ -+ .custom_spi_driver = ETH_NO_CUSTOM_SPI, \ ++ .custom_spi_driver = ETH_DEFAULT_SPI, \ } /** diff --git a/components/esp_eth/src/esp_eth_mac_dm9051.c b/components/esp_eth/src/esp_eth_mac_dm9051.c -index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd829a49d7d 100644 +index b0d339cc93d1d6ef39b1e819102c220d431114b2..ba796121b7065ba984cfbc683283e82a6702a04a 100644 --- a/components/esp_eth/src/esp_eth_mac_dm9051.c +++ b/components/esp_eth/src/esp_eth_mac_dm9051.c @@ -1,5 +1,5 @@ @@ -228,27 +228,27 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 TaskHandle_t rx_task_hdl; uint32_t sw_reset_timeout_ms; int int_gpio_num; -@@ -61,89 +73,133 @@ typedef struct { +@@ -61,89 +73,137 @@ typedef struct { uint8_t *rx_buffer; } emac_dm9051_t; -static inline bool dm9051_lock(emac_dm9051_t *emac) -+static void *spi_init_std(const void *spi_config) ++static void *dm9051_spi_init(const void *spi_config) +{ + void *ret = NULL; + eth_dm9051_config_t *dm9051_config = (eth_dm9051_config_t *)spi_config; + spi_info_t *spi = calloc(1, sizeof(spi_info_t)); + ESP_GOTO_ON_FALSE(spi, NULL, err, TAG, "no memory for SPI context data"); + -+ /* SPI device init */ ++ /* SPI device init */ + spi_device_interface_config_t spi_devcfg; -+ memcpy(&spi_devcfg, dm9051_config->spi_devcfg, sizeof(spi_device_interface_config_t)); ++ spi_devcfg = *(dm9051_config->spi_devcfg); + if (dm9051_config->spi_devcfg->command_bits == 0 && dm9051_config->spi_devcfg->address_bits == 0) { + /* configure default SPI frame format */ + spi_devcfg.command_bits = 1; + spi_devcfg.address_bits = 7; + } else { -+ ESP_GOTO_ON_FALSE(dm9051_config->spi_devcfg->command_bits == 1 || dm9051_config->spi_devcfg->address_bits == 7, ++ ESP_GOTO_ON_FALSE(dm9051_config->spi_devcfg->command_bits == 1 && dm9051_config->spi_devcfg->address_bits == 7, + NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); + } + ESP_GOTO_ON_FALSE(spi_bus_add_device(dm9051_config->spi_host_id, &spi_devcfg, &spi->hdl) == ESP_OK, @@ -258,16 +258,21 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 + spi->lock = xSemaphoreCreateMutex(); + ESP_GOTO_ON_FALSE(spi->lock, NULL, err, TAG, "create lock failed"); + -+ return spi; ++ ret = spi; ++ return ret; +err: -+ if (spi->lock) { -+ vSemaphoreDelete(spi->lock); ++ if (spi) { ++ if (spi->lock) { ++ vSemaphoreDelete(spi->lock); ++ } ++ free(spi); + } + return ret; +} + -+static esp_err_t spi_deinit_std(void *spi_ctx) -+{ ++static esp_err_t dm9051_spi_deinit(void *spi_ctx) + { +- return xSemaphoreTake(emac->spi_lock, pdMS_TO_TICKS(DM9051_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; + esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; + @@ -276,26 +281,25 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 + + free(spi); + return ret; -+} -+ -+static inline bool dm9051_lock(spi_info_t *spi) - { -- return xSemaphoreTake(emac->spi_lock, pdMS_TO_TICKS(DM9051_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; -+ return xSemaphoreTake(spi->lock, pdMS_TO_TICKS(DM9051_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; } -static inline bool dm9051_unlock(emac_dm9051_t *emac) -+static inline bool dm9051_unlock(spi_info_t *spi) ++static inline bool dm9051_spi_lock(spi_info_t *spi) { - return xSemaphoreGive(emac->spi_lock) == pdTRUE; -+ return xSemaphoreGive(spi->lock) == pdTRUE; ++ return xSemaphoreTake(spi->lock, pdMS_TO_TICKS(DM9051_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; } -/** - * @brief write value to dm9051 internal register - */ -static esp_err_t dm9051_register_write(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t value) -+static esp_err_t spi_write_std(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) ++static inline bool dm9051_spi_unlock(spi_info_t *spi) ++{ ++ return xSemaphoreGive(spi->lock) == pdTRUE; ++} ++ ++static esp_err_t dm9051_spi_write(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) { esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; @@ -313,13 +317,13 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 - trans.tx_data[0] = value; - if (dm9051_lock(emac)) { - if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -+ if (dm9051_lock(spi)) { ++ if (dm9051_spi_lock(spi)) { + if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); ret = ESP_FAIL; } - dm9051_unlock(emac); -+ dm9051_unlock(spi); ++ dm9051_spi_unlock(spi); } else { ret = ESP_ERR_TIMEOUT; } @@ -330,7 +334,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 - * @brief read value from dm9051 internal register - */ -static esp_err_t dm9051_register_read(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t *value) -+static esp_err_t spi_read_std(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) ++static esp_err_t dm9051_spi_read(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) { esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; @@ -348,7 +352,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 }; - if (dm9051_lock(emac)) { - if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -+ if (dm9051_lock(spi)) { ++ if (dm9051_spi_lock(spi)) { + if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); ret = ESP_FAIL; @@ -356,7 +360,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 - *value = trans.rx_data[0]; } - dm9051_unlock(emac); -+ dm9051_unlock(spi); ++ dm9051_spi_unlock(spi); } else { ret = ESP_ERR_TIMEOUT; } @@ -408,7 +412,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 } /** -@@ -151,23 +207,7 @@ static esp_err_t dm9051_memory_write(emac_dm9051_t *emac, uint8_t *buffer, uint3 +@@ -151,23 +211,7 @@ static esp_err_t dm9051_memory_write(emac_dm9051_t *emac, uint8_t *buffer, uint3 */ static esp_err_t dm9051_memory_read(emac_dm9051_t *emac, uint8_t *buffer, uint32_t len) { @@ -433,7 +437,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 } /** -@@ -175,23 +215,7 @@ static esp_err_t dm9051_memory_read(emac_dm9051_t *emac, uint8_t *buffer, uint32 +@@ -175,23 +219,7 @@ static esp_err_t dm9051_memory_read(emac_dm9051_t *emac, uint8_t *buffer, uint32 */ static esp_err_t dm9051_memory_peek(emac_dm9051_t *emac, uint8_t *buffer, uint32_t len) { @@ -458,7 +462,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 } /** -@@ -840,8 +864,7 @@ static esp_err_t emac_dm9051_del(esp_eth_mac_t *mac) +@@ -840,8 +868,7 @@ static esp_err_t emac_dm9051_del(esp_eth_mac_t *mac) { emac_dm9051_t *emac = __containerof(mac, emac_dm9051_t, parent); vTaskDelete(emac->rx_task_hdl); @@ -468,7 +472,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 heap_caps_free(emac->rx_buffer); free(emac); return ESP_OK; -@@ -857,19 +880,6 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, +@@ -857,19 +884,6 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "calloc emac failed"); /* dm9051 receive is driven by interrupt only for now*/ ESP_GOTO_ON_FALSE(dm9051_config->int_gpio_num >= 0, NULL, err, TAG, "error interrupt gpio number"); @@ -488,7 +492,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 /* bind methods and attributes */ emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; emac->int_gpio_num = dm9051_config->int_gpio_num; -@@ -891,9 +901,26 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, +@@ -891,9 +905,26 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, emac->parent.enable_flow_ctrl = emac_dm9051_enable_flow_ctrl; emac->parent.transmit = emac_dm9051_transmit; emac->parent.receive = emac_dm9051_receive; @@ -498,7 +502,7 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 + + if (dm9051_config->custom_spi_driver.init != NULL && dm9051_config->custom_spi_driver.deinit != NULL + && dm9051_config->custom_spi_driver.read != NULL && dm9051_config->custom_spi_driver.write != NULL) { -+ ESP_LOGD(TAG, "custom SPI Driver is used"); ++ ESP_LOGD(TAG, "Using user's custom SPI Driver"); + emac->spi.init = dm9051_config->custom_spi_driver.init; + emac->spi.deinit = dm9051_config->custom_spi_driver.deinit; + emac->spi.read = dm9051_config->custom_spi_driver.read; @@ -506,11 +510,11 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 + /* Custom SPI driver device init */ + ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(dm9051_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); + } else { -+ ESP_LOGD(TAG, "internal SPI Master Driver is used"); -+ emac->spi.init = spi_init_std; -+ emac->spi.deinit = spi_deinit_std; -+ emac->spi.read = spi_read_std; -+ emac->spi.write = spi_write_std; ++ ESP_LOGD(TAG, "Using default SPI Driver"); ++ emac->spi.init = dm9051_spi_init; ++ emac->spi.deinit = dm9051_spi_deinit; ++ emac->spi.read = dm9051_spi_read; ++ emac->spi.write = dm9051_spi_write; + /* SPI device init */ + ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(dm9051_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); + } @@ -518,18 +522,19 @@ index b0d339cc93d1d6ef39b1e819102c220d431114b2..22b9efa2b2eb353b4493ac9f0437bcd8 /* create dm9051 task */ BaseType_t core_num = tskNO_AFFINITY; if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { -@@ -913,9 +940,6 @@ err: +@@ -913,8 +944,8 @@ err: if (emac->rx_task_hdl) { vTaskDelete(emac->rx_task_hdl); } - if (emac->spi_lock) { - vSemaphoreDelete(emac->spi_lock); -- } ++ if (emac->spi.ctx) { ++ emac->spi.deinit(emac->spi.ctx); + } heap_caps_free(emac->rx_buffer); free(emac); - } diff --git a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f22f0f5520 100644 +index b6aea4df90ead8dc2162e0735bdc310717881c97..cda12f0159835ea1cb818736bdc2611056b131ff 100644 --- a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c +++ b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c @@ -3,7 +3,7 @@ @@ -565,26 +570,30 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 SemaphoreHandle_t spi_lock; TaskHandle_t rx_task_hdl; uint32_t sw_reset_timeout_ms; -@@ -73,6 +85,32 @@ IRAM_ATTR static void ksz8851_isr_handler(void *arg) +@@ -73,6 +85,95 @@ IRAM_ATTR static void ksz8851_isr_handler(void *arg) } } -+static void *spi_init_std(const void *spi_config) ++static void *ksz8851_spi_init(const void *spi_config) +{ + void *ret = NULL; + eth_ksz8851snl_config_t *ksz8851snl_config = (eth_ksz8851snl_config_t *)spi_config; -+ spi_info_t *spi = calloc(1, sizeof(spi_info_t)); // TODO maybe replace with static variable spi_host_id ++ spi_info_t *spi = calloc(1, sizeof(spi_info_t)); + ESP_GOTO_ON_FALSE(spi, NULL, err, TAG, "no memory for SPI context data"); + -+ /* SPI device init */ ++ // SPI device init + ESP_GOTO_ON_FALSE(spi_bus_add_device(ksz8851snl_config->spi_host_id, ksz8851snl_config->spi_devcfg, &spi->hdl) == ESP_OK, NULL, + err, TAG, "adding device to SPI host #%d failed", ksz8851snl_config->spi_host_id + 1); -+ return spi; ++ ret = spi; ++ return ret; +err: ++ if (spi) { ++ free(spi); ++ } + return ret; +} + -+static esp_err_t spi_deinit_std(void *spi_ctx) ++static esp_err_t ksz8851_spi_deinit(void *spi_ctx) +{ + esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; @@ -595,25 +604,11 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 + return ret; +} + - static inline bool ksz8851_mutex_lock(emac_ksz8851snl_t *emac) - { - return xSemaphoreTakeRecursive(emac->spi_lock, pdMS_TO_TICKS(KSZ8851_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; -@@ -83,70 +121,102 @@ static inline bool ksz8851_mutex_unlock(emac_ksz8851snl_t *emac) - return xSemaphoreGiveRecursive(emac->spi_lock) == pdTRUE; - } - --static esp_err_t ksz8851_read_reg(emac_ksz8851snl_t *emac, uint32_t address, uint16_t *value) -+static esp_err_t spi_read_std(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) - { - esp_err_t ret = ESP_OK; -- ESP_GOTO_ON_FALSE(value != NULL, ESP_ERR_INVALID_ARG, err, TAG, "out pointer must not be null"); -- ESP_GOTO_ON_FALSE((address & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); ++static esp_err_t ksz8851_spi_read(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) ++{ ++ esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; - -- const unsigned data_size = 16U; // NOTE(v.chistyakov): bits -- // NOTE(v.chistyakov): select upper or lower word inside a dword -- const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (address & 0x2U)); -- address <<= KSZ8851_SPI_ADDR_SHIFT; ++ + spi_transaction_ext_t trans = { + .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | (len <= 4 ? SPI_TRANS_USE_RXDATA : 0), + .base.cmd = cmd, @@ -628,6 +623,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 + trans.address_bits = 16 - KSZ8851_SPI_COMMAND_BITS; + } + ++ // No need for mutex here since SPI access is protected at higher layer of this driver + if (spi_device_polling_transmit(spi->hdl, &trans.base) != ESP_OK) { + ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); + ret = ESP_FAIL; @@ -635,36 +631,30 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 + + if ((trans.base.flags & SPI_TRANS_USE_RXDATA) && len <= 4) { + memcpy(value, trans.base.rx_data, len); // copy register values to output -+ //ESP_LOGV(TAG, "reading reg 0x%02x == 0x%04x", addr, *value); // TODO + } + return ret; +} + -+static esp_err_t spi_write_std(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) ++static esp_err_t ksz8851_spi_write(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) +{ + esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; - - spi_transaction_ext_t trans = { -- .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | SPI_TRANS_USE_RXDATA, -- .base.cmd = KSZ8851_SPI_COMMAND_READ_REG, -- .base.addr = address | byte_mask, -- .base.length = data_size, -- .command_bits = KSZ8851_SPI_COMMAND_BITS, -- .address_bits = 16 - KSZ8851_SPI_COMMAND_BITS, ++ ++ spi_transaction_ext_t trans = { + .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY, + .base.cmd = cmd, + .base.addr = addr, + .base.length = 8 * len, + .base.tx_buffer = value, + .command_bits = KSZ8851_SPI_COMMAND_BITS - }; ++ }; + if (cmd >= KSZ8851_SPI_COMMAND_READ_FIFO) { + trans.address_bits = 8 - KSZ8851_SPI_COMMAND_BITS; + } else { + trans.address_bits = 16 - KSZ8851_SPI_COMMAND_BITS; + } + ++ // No need for mutex here since SPI access is protected at higher layer of this driver + if (spi_device_polling_transmit(spi->hdl, &trans.base) != ESP_OK) { + ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); + ret = ESP_FAIL; @@ -673,16 +663,38 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 + return ret; +} + + static inline bool ksz8851_mutex_lock(emac_ksz8851snl_t *emac) + { + return xSemaphoreTakeRecursive(emac->spi_lock, pdMS_TO_TICKS(KSZ8851_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; +@@ -83,70 +184,49 @@ static inline bool ksz8851_mutex_unlock(emac_ksz8851snl_t *emac) + return xSemaphoreGiveRecursive(emac->spi_lock) == pdTRUE; + } + +-static esp_err_t ksz8851_read_reg(emac_ksz8851snl_t *emac, uint32_t address, uint16_t *value) +static esp_err_t ksz8851_read_reg(emac_ksz8851snl_t *emac, uint32_t reg_addr, uint16_t *value) -+{ -+ esp_err_t ret = ESP_OK; -+ ESP_GOTO_ON_FALSE(value != NULL, ESP_ERR_INVALID_ARG, err, TAG, "out pointer must not be null"); + { + esp_err_t ret = ESP_OK; + ESP_GOTO_ON_FALSE(value != NULL, ESP_ERR_INVALID_ARG, err, TAG, "out pointer must not be null"); +- ESP_GOTO_ON_FALSE((address & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); + ESP_GOTO_ON_FALSE((reg_addr & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); -+ -+ // NOTE(v.chistyakov): select upper or lower word inside a dword + +- const unsigned data_size = 16U; // NOTE(v.chistyakov): bits + // NOTE(v.chistyakov): select upper or lower word inside a dword +- const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (address & 0x2U)); +- address <<= KSZ8851_SPI_ADDR_SHIFT; + const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (reg_addr & 0x2U)); + reg_addr <<= KSZ8851_SPI_ADDR_SHIFT; -+ + +- spi_transaction_ext_t trans = { +- .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | SPI_TRANS_USE_RXDATA, +- .base.cmd = KSZ8851_SPI_COMMAND_READ_REG, +- .base.addr = address | byte_mask, +- .base.length = data_size, +- .command_bits = KSZ8851_SPI_COMMAND_BITS, +- .address_bits = 16 - KSZ8851_SPI_COMMAND_BITS, +- }; ++ // Need to protect SPI access at higher layer of the driver since once packet transmit/receive is started (`SDA Start DMA Access` bit is set), ++ // all registers access are disabled. if (ksz8851_mutex_lock(emac)) { - if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { - ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); @@ -696,6 +708,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 ret = ESP_ERR_TIMEOUT; } + ksz8851_mutex_unlock(emac); ++ ESP_LOGV(TAG, "reading reg 0x%02x == 0x%02x", reg_addr, *value); + err: return ret; @@ -708,13 +721,15 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 - ESP_GOTO_ON_FALSE((address & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); - ESP_LOGV(TAG, "writing reg 0x%02x = 0x%04x", address, value); + ESP_GOTO_ON_FALSE((reg_addr & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); -+ ESP_LOGV(TAG, "writing reg 0x%02x = 0x%04x", reg_addr, value); ++ ESP_LOGV(TAG, "writing reg 0x%02x = 0x%02x", reg_addr, value); - const unsigned data_size = 16U; // NOTE(v.chistyakov): bits // NOTE(v.chistyakov): select upper or lower word inside a dword - const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (address & 0x2U)); - address <<= KSZ8851_SPI_ADDR_SHIFT; -- ++ const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (reg_addr & 0x2U)); ++ reg_addr <<= KSZ8851_SPI_ADDR_SHIFT; + - spi_transaction_ext_t trans = { - .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | SPI_TRANS_USE_TXDATA, - .base.cmd = KSZ8851_SPI_COMMAND_WRITE_REG, @@ -723,10 +738,10 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 - .command_bits = KSZ8851_SPI_COMMAND_BITS, - .address_bits = 16 - KSZ8851_SPI_COMMAND_BITS, - }; -+ const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (reg_addr & 0x2U)); -+ reg_addr <<= KSZ8851_SPI_ADDR_SHIFT; - +- - memcpy(trans.base.tx_data, &value, data_size >> 3U); ++ // Need to protect SPI access at higher layer of the driver since once packet transmit/receive is started (`SDA Start DMA Access` bit is set), ++ // all registers access are disabled. if (ksz8851_mutex_lock(emac)) { - if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { - ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); @@ -742,7 +757,15 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 err: return ret; } -@@ -333,24 +403,12 @@ static esp_err_t emac_ksz8851snl_transmit(esp_eth_mac_t *mac, uint8_t *buf, uint +@@ -313,6 +393,7 @@ static esp_err_t emac_ksz8851snl_transmit(esp_eth_mac_t *mac, uint8_t *buf, uint + ESP_LOGV(TAG, "transmitting frame of size %u", length); + esp_err_t ret = ESP_OK; + emac_ksz8851snl_t *emac = __containerof(mac, emac_ksz8851snl_t, parent); ++ // Lock SPI since once `SDA Start DMA Access` bit is set, all registers access are disabled. + if (!ksz8851_mutex_lock(emac)) { + return ESP_ERR_TIMEOUT; + } +@@ -333,24 +414,12 @@ static esp_err_t emac_ksz8851snl_transmit(esp_eth_mac_t *mac, uint8_t *buf, uint emac->tx_buffer[3] = (length >> 8U) & 0xFFU; memcpy(emac->tx_buffer + 4U, buf, length); @@ -768,7 +791,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 ESP_GOTO_ON_ERROR(ksz8851_clear_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_IER, ier), err, TAG, "IER write failed"); -@@ -438,23 +496,12 @@ static esp_err_t emac_ksz8851_receive(esp_eth_mac_t *mac, uint8_t *buf, uint32_t +@@ -438,23 +507,13 @@ static esp_err_t emac_ksz8851_receive(esp_eth_mac_t *mac, uint8_t *buf, uint32_t // NOTE(v.chistyakov): 4 dummy + 4 header + alignment const unsigned receive_size = 8U + ((byte_count + 3U) & ~0x3U); @@ -780,6 +803,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 - .command_bits = 2U, - .address_bits = 6U, - }; ++ // Lock SPI since once `SDA Start DMA Access` bit is set, all registers access are disabled. if (!ksz8851_mutex_lock(emac)) { return ESP_ERR_TIMEOUT; } @@ -793,7 +817,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 ESP_GOTO_ON_ERROR(ksz8851_clear_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); ksz8851_mutex_unlock(emac); // NOTE(v.chistyakov): skip 4 dummy, 4 header -@@ -728,7 +775,7 @@ static esp_err_t emac_ksz8851_del(esp_eth_mac_t *mac) +@@ -728,7 +787,7 @@ static esp_err_t emac_ksz8851_del(esp_eth_mac_t *mac) { emac_ksz8851snl_t *emac = __containerof(mac, emac_ksz8851snl_t, parent); vTaskDelete(emac->rx_task_hdl); @@ -802,7 +826,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 vSemaphoreDelete(emac->spi_lock); heap_caps_free(emac->rx_buffer); heap_caps_free(emac->tx_buffer); -@@ -748,10 +795,6 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 +@@ -748,10 +807,6 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 emac = calloc(1, sizeof(emac_ksz8851snl_t)); ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "no mem for MAC instance"); @@ -813,7 +837,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; emac->int_gpio_num = ksz8851snl_config->int_gpio_num; emac->parent.set_mediator = emac_ksz8851_set_mediator; -@@ -772,8 +815,6 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 +@@ -772,8 +827,6 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 emac->parent.enable_flow_ctrl = emac_ksz8851_enable_flow_ctrl; emac->parent.set_peer_pause_ability = emac_ksz8851_set_peer_pause_ability; emac->parent.del = emac_ksz8851_del; @@ -822,7 +846,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 emac->rx_buffer = NULL; emac->tx_buffer = NULL; emac->rx_buffer = heap_caps_malloc(KSZ8851_QMU_PACKET_LENGTH + KSZ8851_QMU_PACKET_PADDING, MALLOC_CAP_DMA); -@@ -781,6 +822,29 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 +@@ -781,6 +834,29 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 ESP_GOTO_ON_FALSE(emac->rx_buffer, NULL, err, TAG, "RX buffer allocation failed"); ESP_GOTO_ON_FALSE(emac->tx_buffer, NULL, err, TAG, "TX buffer allocation failed"); @@ -832,7 +856,7 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 + + if (ksz8851snl_config->custom_spi_driver.init != NULL && ksz8851snl_config->custom_spi_driver.deinit != NULL + && ksz8851snl_config->custom_spi_driver.read != NULL && ksz8851snl_config->custom_spi_driver.write != NULL) { -+ ESP_LOGD(TAG, "custom SPI Driver is used"); ++ ESP_LOGD(TAG, "Using user's custom SPI Driver"); + emac->spi.init = ksz8851snl_config->custom_spi_driver.init; + emac->spi.deinit = ksz8851snl_config->custom_spi_driver.deinit; + emac->spi.read = ksz8851snl_config->custom_spi_driver.read; @@ -840,11 +864,11 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 + /* Custom SPI driver device init */ + ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(ksz8851snl_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); + } else { -+ ESP_LOGD(TAG, "internal SPI Master Driver is used"); -+ emac->spi.init = spi_init_std; -+ emac->spi.deinit = spi_deinit_std; -+ emac->spi.read = spi_read_std; -+ emac->spi.write = spi_write_std; ++ ESP_LOGD(TAG, "Using default SPI Driver"); ++ emac->spi.init = ksz8851_spi_init; ++ emac->spi.deinit = ksz8851_spi_deinit; ++ emac->spi.read = ksz8851_spi_read; ++ emac->spi.write = ksz8851_spi_write; + /* SPI device init */ + ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(ksz8851snl_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); + } @@ -852,8 +876,18 @@ index b6aea4df90ead8dc2162e0735bdc310717881c97..9690a6364c6775ecb5941e8fdcad69f2 BaseType_t core_num = tskNO_AFFINITY; if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { core_num = esp_cpu_get_core_id(); +@@ -798,6 +874,9 @@ err: + if (emac->spi_lock) { + vSemaphoreDelete(emac->spi_lock); + } ++ if (emac->spi.ctx) { ++ emac->spi.deinit(emac->spi.ctx); ++ } + // NOTE(v.chistyakov): safe to call with NULL + heap_caps_free(emac->rx_buffer); + heap_caps_free(emac->tx_buffer); diff --git a/components/esp_eth/src/esp_eth_mac_w5500.c b/components/esp_eth/src/esp_eth_mac_w5500.c -index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538b2903f98 100644 +index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..5b19d5cfcdfc67105809cbca33e780850b9d4fea 100644 --- a/components/esp_eth/src/esp_eth_mac_w5500.c +++ b/components/esp_eth/src/esp_eth_mac_w5500.c @@ -37,11 +37,23 @@ typedef struct { @@ -882,13 +916,14 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 TaskHandle_t rx_task_hdl; uint32_t sw_reset_timeout_ms; int int_gpio_num; -@@ -50,55 +62,101 @@ typedef struct { +@@ -50,64 +62,132 @@ typedef struct { uint8_t *rx_buffer; } emac_w5500_t; -static inline bool w5500_lock(emac_w5500_t *emac) -+static void *spi_init_std(const void *spi_config) -+{ ++static void *w5500_spi_init(const void *spi_config) + { +- return xSemaphoreTake(emac->spi_lock, pdMS_TO_TICKS(W5500_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; + void *ret = NULL; + eth_w5500_config_t *w5500_config = (eth_w5500_config_t *)spi_config; + spi_info_t *spi = calloc(1, sizeof(spi_info_t)); @@ -896,13 +931,13 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 + + /* SPI device init */ + spi_device_interface_config_t spi_devcfg; -+ memcpy(&spi_devcfg, w5500_config->spi_devcfg, sizeof(spi_device_interface_config_t)); ++ spi_devcfg = *(w5500_config->spi_devcfg); + if (w5500_config->spi_devcfg->command_bits == 0 && w5500_config->spi_devcfg->address_bits == 0) { + /* configure default SPI frame format */ + spi_devcfg.command_bits = 16; // Actually it's the address phase in W5500 SPI frame + spi_devcfg.address_bits = 8; // Actually it's the control phase in W5500 SPI frame + } else { -+ ESP_GOTO_ON_FALSE(w5500_config->spi_devcfg->command_bits == 16 || w5500_config->spi_devcfg->address_bits == 8, ++ ESP_GOTO_ON_FALSE(w5500_config->spi_devcfg->command_bits == 16 && w5500_config->spi_devcfg->address_bits == 8, + NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); + } + ESP_GOTO_ON_FALSE(spi_bus_add_device(w5500_config->spi_host_id, &spi_devcfg, &spi->hdl) == ESP_OK, NULL, @@ -911,16 +946,22 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 + spi->lock = xSemaphoreCreateMutex(); + ESP_GOTO_ON_FALSE(spi->lock, NULL, err, TAG, "create lock failed"); + -+ return spi; ++ ret = spi; ++ return ret; +err: -+ if (spi->lock) { -+ vSemaphoreDelete(spi->lock); ++ if (spi) { ++ if (spi->lock) { ++ vSemaphoreDelete(spi->lock); ++ } ++ free(spi); + } + return ret; -+} -+ -+static esp_err_t spi_deinit_std(void *spi_ctx) -+{ + } + +-static inline bool w5500_unlock(emac_w5500_t *emac) ++static esp_err_t w5500_spi_deinit(void *spi_ctx) + { +- return xSemaphoreGive(emac->spi_lock) == pdTRUE; + esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; + @@ -929,23 +970,20 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 + + free(spi); + return ret; -+} -+ -+static inline bool w5500_lock(spi_info_t *spi) - { -- return xSemaphoreTake(emac->spi_lock, pdMS_TO_TICKS(W5500_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; -+ return xSemaphoreTake(spi->lock, pdMS_TO_TICKS(W5500_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; - } - --static inline bool w5500_unlock(emac_w5500_t *emac) -+static inline bool w5500_unlock(spi_info_t *spi) - { -- return xSemaphoreGive(emac->spi_lock) == pdTRUE; -+ return xSemaphoreGive(spi->lock) == pdTRUE; } -static esp_err_t w5500_write(emac_w5500_t *emac, uint32_t address, const void *value, uint32_t len) -+static esp_err_t spi_write_std(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) ++static inline bool w5500_spi_lock(spi_info_t *spi) ++{ ++ return xSemaphoreTake(spi->lock, pdMS_TO_TICKS(W5500_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; ++} ++ ++static inline bool w5500_spi_unlock(spi_info_t *spi) ++{ ++ return xSemaphoreGive(spi->lock) == pdTRUE; ++} ++ ++static esp_err_t w5500_spi_write(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) { esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; @@ -960,13 +998,13 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 }; - if (w5500_lock(emac)) { - if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -+ if (w5500_lock(spi)) { ++ if (w5500_spi_lock(spi)) { + if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); ret = ESP_FAIL; } - w5500_unlock(emac); -+ w5500_unlock(spi); ++ w5500_spi_unlock(spi); } else { ret = ESP_ERR_TIMEOUT; } @@ -974,7 +1012,7 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 } -static esp_err_t w5500_read(emac_w5500_t *emac, uint32_t address, void *value, uint32_t len) -+static esp_err_t spi_read_std(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) ++static esp_err_t w5500_spi_read(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) { esp_err_t ret = ESP_OK; + spi_info_t *spi = (spi_info_t *)spi_ctx; @@ -990,17 +1028,20 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 }; - if (w5500_lock(emac)) { - if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -+ if (w5500_lock(spi)) { ++ if (w5500_spi_lock(spi)) { + if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); ret = ESP_FAIL; } - w5500_unlock(emac); -+ w5500_unlock(spi); ++ w5500_spi_unlock(spi); } else { ret = ESP_ERR_TIMEOUT; } -@@ -108,6 +166,24 @@ static esp_err_t w5500_read(emac_w5500_t *emac, uint32_t address, void *value, u +- if ((trans.flags&SPI_TRANS_USE_RXDATA) && len <= 4) { ++ if ((trans.flags & SPI_TRANS_USE_RXDATA) && len <= 4) { + memcpy(value, trans.rx_data, len); // copy register values to output + } return ret; } @@ -1025,7 +1066,7 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 static esp_err_t w5500_send_command(emac_w5500_t *emac, uint8_t command, uint32_t timeout_ms) { esp_err_t ret = ESP_OK; -@@ -738,8 +814,7 @@ static esp_err_t emac_w5500_del(esp_eth_mac_t *mac) +@@ -738,8 +818,7 @@ static esp_err_t emac_w5500_del(esp_eth_mac_t *mac) { emac_w5500_t *emac = __containerof(mac, emac_w5500_t, parent); vTaskDelete(emac->rx_task_hdl); @@ -1035,7 +1076,7 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 heap_caps_free(emac->rx_buffer); free(emac); return ESP_OK; -@@ -754,19 +829,6 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con +@@ -754,19 +833,6 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "no mem for MAC instance"); /* w5500 driver is interrupt driven */ ESP_GOTO_ON_FALSE(w5500_config->int_gpio_num >= 0, NULL, err, TAG, "invalid interrupt gpio number"); @@ -1055,7 +1096,7 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 /* bind methods and attributes */ emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; emac->int_gpio_num = w5500_config->int_gpio_num; -@@ -788,9 +850,26 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con +@@ -788,9 +854,26 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con emac->parent.enable_flow_ctrl = emac_w5500_enable_flow_ctrl; emac->parent.transmit = emac_w5500_transmit; emac->parent.receive = emac_w5500_receive; @@ -1065,7 +1106,7 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 + + if (w5500_config->custom_spi_driver.init != NULL && w5500_config->custom_spi_driver.deinit != NULL + && w5500_config->custom_spi_driver.read != NULL && w5500_config->custom_spi_driver.write != NULL) { -+ ESP_LOGD(TAG, "custom SPI Driver is used"); ++ ESP_LOGD(TAG, "Using user's custom SPI Driver"); + emac->spi.init = w5500_config->custom_spi_driver.init; + emac->spi.deinit = w5500_config->custom_spi_driver.deinit; + emac->spi.read = w5500_config->custom_spi_driver.read; @@ -1073,11 +1114,11 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 + /* Custom SPI driver device init */ + ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(w5500_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); + } else { -+ ESP_LOGD(TAG, "internal SPI Master Driver is used"); -+ emac->spi.init = spi_init_std; -+ emac->spi.deinit = spi_deinit_std; -+ emac->spi.read = spi_read_std; -+ emac->spi.write = spi_write_std; ++ ESP_LOGD(TAG, "Using default SPI Driver"); ++ emac->spi.init = w5500_spi_init; ++ emac->spi.deinit = w5500_spi_deinit; ++ emac->spi.read = w5500_spi_read; ++ emac->spi.write = w5500_spi_write; + /* SPI device init */ + ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(w5500_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); + } @@ -1085,19 +1126,14 @@ index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..1d5bdc19f6749cd8b02112d7a31f3538 /* create w5500 task */ BaseType_t core_num = tskNO_AFFINITY; if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { -@@ -806,13 +885,11 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con - return &(emac->parent); - - err: -+ // TODO SPI deinit? - if (emac) { +@@ -810,8 +893,8 @@ err: if (emac->rx_task_hdl) { vTaskDelete(emac->rx_task_hdl); } - if (emac->spi_lock) { - vSemaphoreDelete(emac->spi_lock); -- } ++ if (emac->spi.ctx) { ++ emac->spi.deinit(emac->spi.ctx); + } heap_caps_free(emac->rx_buffer); free(emac); - } - From a89cb35121d75bc24ac068f5e177ebf076ccbbd1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 18 Sep 2023 13:20:26 +0200 Subject: [PATCH 227/636] rm Nimble patch --- tools/install-esp-idf.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 7096e49a8..46ab5a980 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -41,9 +41,10 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then cd - # Patch espressif nimble driver to support esp-nimble-cpp from h2zero - cd $IDF_PATH - patch -p1 -i ../patches/nimble.diff - cd - + # Not needed anymore, fixed with https://github.com/tasmota/esp-idf/commit/9d8af9748b54d4b2ef565ca1675f1b5de62d80e6 + #cd $IDF_PATH + #patch -p1 -i ../patches/nimble.diff + #cd - fi # From 71c82779a3048ecc49c97d7f22cff28594b23a73 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Sep 2023 22:15:09 +0200 Subject: [PATCH 228/636] Delete patches/nimble.diff --- patches/nimble.diff | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 patches/nimble.diff diff --git a/patches/nimble.diff b/patches/nimble.diff deleted file mode 100644 index 10803bb6c..000000000 --- a/patches/nimble.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/components/bt/host/nimble/nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h b/components/bt/host/nimble/nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h -index a1f84f1d6..f748d6494 100644 ---- a/components/bt/host/nimble/nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h -+++ b/components/bt/host/nimble/nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h -@@ -20,6 +20,7 @@ - #ifndef H_BLE_SVC_GAP_ - #define H_BLE_SVC_GAP_ - -+#include "syscfg/syscfg.h" - #include <inttypes.h> - #if MYNEWT_VAL(ENC_ADV_DATA) - #include "host/ble_ead.h" - From 72329e9b824d2c9fba19b749f53ca7d782d11a17 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Sep 2023 22:16:20 +0200 Subject: [PATCH 229/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 46ab5a980..6c33a01eb 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -39,12 +39,6 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then cd $IDF_PATH patch -p1 -i ../patches/spi_eth.diff cd - - - # Patch espressif nimble driver to support esp-nimble-cpp from h2zero - # Not needed anymore, fixed with https://github.com/tasmota/esp-idf/commit/9d8af9748b54d4b2ef565ca1675f1b5de62d80e6 - #cd $IDF_PATH - #patch -p1 -i ../patches/nimble.diff - #cd - fi # From 112d7538fbd7bd0ef98ec554ec402242661db695 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Sep 2023 22:18:28 +0200 Subject: [PATCH 230/636] ESP-LITTLEFS v1.9.0 --- tools/update-components.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 6e490e1d5..a8b56806d 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -24,17 +24,17 @@ if [ $? -ne 0 ]; then exit 1; fi cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" # -# CLONE/UPDATE ESP-LITTLEFS v1.5.5 commit 9eeac09... +# CLONE/UPDATE ESP-LITTLEFS v1.9.0 commit fb8514c2... # echo "Updating ESP-LITTLEFS..." if [ ! -d "$AR_COMPS/esp_littlefs" ]; then git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" - git -C "$AR_COMPS/esp_littlefs" checkout 9eeac09c9c250643a32df47ea870dae2dd042648 + git -C "$AR_COMPS/esp_littlefs" checkout fb8514c2e0f786c1c747c6061b56e056119f69b2 git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive else git -C "$AR_COMPS/esp_littlefs" fetch git -C "$AR_COMPS/esp_littlefs" pull --ff-only - git -C "$AR_COMPS/esp_littlefs" checkout 9eeac09c9c250643a32df47ea870dae2dd042648 + git -C "$AR_COMPS/esp_littlefs" checkout fb8514c2e0f786c1c747c6061b56e056119f69b2 git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive fi if [ $? -ne 0 ]; then exit 1; fi From b865821d1708642593583ad7d4fb7fc45384ba39 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Sep 2023 22:20:52 +0200 Subject: [PATCH 231/636] LittleFS v1.9.0 --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d2c7226a6..68ca8adbb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: Arduino IDF 5.1 feature/eth_spi -> with IDF Patch +name: IDF 5.1 feature/eth_spi and littleFS v1.9.0 on: workflow_dispatch: # Manually start a workflow From d9fec14d0530b79cf02b2367d3b7b0abe817bd25 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 25 Sep 2023 10:52:48 +0200 Subject: [PATCH 232/636] esp_littlefs branch lfs2.8 --- tools/update-components.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index a8b56806d..55c11e191 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -24,17 +24,17 @@ if [ $? -ne 0 ]; then exit 1; fi cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" # -# CLONE/UPDATE ESP-LITTLEFS v1.9.0 commit fb8514c2... +# CLONE/UPDATE ESP-LITTLEFS branch https://github.com/joltwallet/esp_littlefs/tree/lfs2.8 # echo "Updating ESP-LITTLEFS..." if [ ! -d "$AR_COMPS/esp_littlefs" ]; then git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" - git -C "$AR_COMPS/esp_littlefs" checkout fb8514c2e0f786c1c747c6061b56e056119f69b2 + git -C "$AR_COMPS/esp_littlefs" checkout lfs2.8 git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive else git -C "$AR_COMPS/esp_littlefs" fetch git -C "$AR_COMPS/esp_littlefs" pull --ff-only - git -C "$AR_COMPS/esp_littlefs" checkout fb8514c2e0f786c1c747c6061b56e056119f69b2 + git -C "$AR_COMPS/esp_littlefs" checkout lfs2.8 git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive fi if [ $? -ne 0 ]; then exit 1; fi From 2d5b009465255e79545bcc275d8fac571ed37a4c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:42:43 +0200 Subject: [PATCH 233/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 68ca8adbb..012e7832c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF 5.1 feature/eth_spi and littleFS v1.9.0 +name: IDF 5.1 feature/eth_spi and littleFS with feature grow on: workflow_dispatch: # Manually start a workflow From 4fcae2e25e3d3d17f4cb758f7149ab74a643ec0b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:52:28 +0200 Subject: [PATCH 234/636] Update archive-build.sh --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index b09efbe5c..96af68ae0 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -18,6 +18,7 @@ rm -rf arduino-esp32/docs rm -rf arduino-esp32/tests rm -rf arduino-esp32/libraries/RainMaker rm -rf arduino-esp32/libraries/Insights +rm -rf arduino-esp32/libraries/SPIFFS rm -rf arduino-esp32/libraries/BLE rm -rf arduino-esp32/libraries/SimpleBLE rm -rf arduino-esp32/libraries/WiFiProv From 7e605107d69409eef937ba3169ac8ccdaf3dd911 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 29 Sep 2023 17:18:35 +0200 Subject: [PATCH 235/636] rm SPIFFS / set LittleFS disk 2.0 --- configs/defconfig.common | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 9fb552d55..66665292e 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -140,14 +140,13 @@ CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096 CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0 -CONFIG_SPIFFS_MAX_PARTITIONS=1 -# CONFIG_SPIFFS_PAGE_CHECK is not set -# CONFIG_SPIFFS_USE_MAGIC is not set -# CONFIG_SPIFFS_USE_MTIME is not set CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=1 -CONFIG_LITTLEFS_MAX_PARTITIONS=2 CONFIG_DSP_MAX_FFT_SIZE_1024=y +CONFIG_LITTLEFS_MAX_PARTITIONS=2 +CONFIG_LITTLEFS_MULTIVERSION=y +CONFIG_LITTLEFS_DISK_VERSION_2_0=y + # # Disable Cameras not used # From 3f8f6feed1d941c31e9d8d7db8da65226ee010cd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:49:13 +0200 Subject: [PATCH 236/636] C6: use newlib from ROM --- configs/defconfig.esp32c6 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index 96296de58..76c575e4e 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -1,3 +1,6 @@ +# C6 has full Newlib in Rom +# CONFIG_NEWLIB_NANO_FORMAT is not set + # # Bluetooth # From 5f011a7e5e9732b08e15219565dace54485b3c48 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 3 Oct 2023 20:58:26 +0200 Subject: [PATCH 237/636] ESP-LITTLEFS v1.10.0 --- tools/update-components.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 55c11e191..21c27dccb 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -24,17 +24,17 @@ if [ $? -ne 0 ]; then exit 1; fi cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" # -# CLONE/UPDATE ESP-LITTLEFS branch https://github.com/joltwallet/esp_littlefs/tree/lfs2.8 +# CLONE/UPDATE ESP-LITTLEFS v1.10.0 commit 032f9... # echo "Updating ESP-LITTLEFS..." if [ ! -d "$AR_COMPS/esp_littlefs" ]; then git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" - git -C "$AR_COMPS/esp_littlefs" checkout lfs2.8 + git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495 git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive else git -C "$AR_COMPS/esp_littlefs" fetch git -C "$AR_COMPS/esp_littlefs" pull --ff-only - git -C "$AR_COMPS/esp_littlefs" checkout lfs2.8 + git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495 git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive fi if [ $? -ne 0 ]; then exit 1; fi From 6736f8a26bc6579748143d3446ec8173113f99b9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 3 Oct 2023 21:08:35 +0200 Subject: [PATCH 238/636] Update config.sh --- tools/config.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index c210ac254..e7078e586 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -9,6 +9,11 @@ if [ -z $IDF_BRANCH ]; then IDF_BRANCH="release/v5.1" fi +# Arduino branch to use +if [ -z $AR_BRANCH ]; then + AR_BRANCH="feature/eth_spi" +fi + if [ -z $AR_PR_TARGET_BRANCH ]; then # Temporary to get CI working. original is master AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" @@ -28,11 +33,6 @@ fi # Owner of the target ESP32 Arduino repository AR_USER="tasmota" -# Arduino branch to use -if [ -z $AR_BRANCH ]; then - AR_BRANCH="feature/eth_spi" -fi - # IDF commit to use / Nimble fails in actual release/v5.1 #IDF_COMMIT="707b7039850844173e46eb634081a37bbbadaa9b" From a27ab0d8a4a9427e96c79a35e12a838ef2252843 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:50:50 +0200 Subject: [PATCH 239/636] Arduino 3.0 is now `main` --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index e7078e586..4ee016398 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="feature/eth_spi" + AR_BRANCH="main" fi if [ -z $AR_PR_TARGET_BRANCH ]; then From ca854a9be1482bd2a70ca69f0bb75a56bf04a933 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:55:25 +0200 Subject: [PATCH 240/636] rm TFLiteMicro --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 18254011e..61c030b82 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -56,6 +56,7 @@ rm -rf "$AR_COMPS/arduino/libraries/BLE" rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" rm -rf "$AR_COMPS/arduino/libraries/ESP32" +rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" # # CLONE/UPDATE ESP32-ARDUINO-LIBS From 206a60f8b4d3291968153703d3fece227bff8a2d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:56:18 +0200 Subject: [PATCH 241/636] rm TFLiteMicro --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 96af68ae0..2b521f332 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -22,6 +22,7 @@ rm -rf arduino-esp32/libraries/SPIFFS rm -rf arduino-esp32/libraries/BLE rm -rf arduino-esp32/libraries/SimpleBLE rm -rf arduino-esp32/libraries/WiFiProv +rm -rf arduino-esp32/libraries/TFLiteMicro rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs From 68d06150d708ff6ca9ed61de5f7086386fe94dd2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:16:56 +0200 Subject: [PATCH 242/636] Update gen_platformio_manifest.py --- tools/gen_platformio_manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gen_platformio_manifest.py b/tools/gen_platformio_manifest.py index 2d031b687..02057d9a2 100644 --- a/tools/gen_platformio_manifest.py +++ b/tools/gen_platformio_manifest.py @@ -11,7 +11,7 @@ "license": "LGPL-2.1-or-later", "repository": { "type": "git", - "url": "https://github.com/espressif/esp32-arduino-libs", + "url": "https://github.com/tasmota/esp32-arduino-libs", }, } From 5130b8583a5f0dbd158eb63ed3803423a7755faa Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:21:15 +0200 Subject: [PATCH 243/636] rm sr left overs --- build.sh | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/build.sh b/build.sh index 95a5dbd00..e2b82e8aa 100755 --- a/build.sh +++ b/build.sh @@ -107,10 +107,6 @@ else source ./tools/config.sh fi -if [ -f "./managed_components/espressif__esp-sr/.component_hash" ]; then - rm -rf ./managed_components/espressif__esp-sr/.component_hash -fi - if [ "$BUILD_TYPE" != "all" ]; then if [ "$TARGET" = "all" ]; then echo "ERROR: You need to specify target for non-default builds" @@ -185,10 +181,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do idf_libs_configs="$idf_libs_configs;configs/defconfig.$defconf" done - if [ -f "./managed_components/espressif__esp-sr/.component_hash" ]; then - rm -rf ./managed_components/espressif__esp-sr/.component_hash - fi - echo "* Build IDF-Libs: $idf_libs_configs" rm -rf build sdkconfig idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf_libs @@ -201,10 +193,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do bootloader_configs="$bootloader_configs;configs/defconfig.$defconf"; done - if [ -f "./managed_components/espressif__esp-sr/.component_hash" ]; then - rm -rf ./managed_components/espressif__esp-sr/.component_hash - fi - echo "* Build BootLoader: $bootloader_configs" rm -rf build sdkconfig idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy_bootloader @@ -218,10 +206,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do mem_configs="$mem_configs;configs/defconfig.$defconf"; done - if [ -f "./managed_components/espressif__esp-sr/.component_hash" ]; then - rm -rf ./managed_components/espressif__esp-sr/.component_hash - fi - echo "* Build Memory Variant: $mem_configs" rm -rf build sdkconfig idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem_variant From 6aa4cafd241a34c9ce3ba90ca98c935dc9487ce4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:05:07 +0200 Subject: [PATCH 244/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 012e7832c..4ac494c06 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF 5.1 feature/eth_spi and littleFS with feature grow +name: IDF 5.1 Arduino on: workflow_dispatch: # Manually start a workflow From fb6754e1a17594c4bcfd8f472553de6572c46294 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:59:20 +0200 Subject: [PATCH 245/636] CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 66665292e..ab9a3574a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -105,7 +105,7 @@ CONFIG_MBEDTLS_PSK_MODES=n # CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set # CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED is not set +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y # CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set From b38f58a4f672b8eddc84666e187082f29ccb9f87 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:10:17 +0200 Subject: [PATCH 246/636] CONFIG_MBEDTLS_CMAC_C=y --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index ab9a3574a..1f6e6fc61 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -95,6 +95,7 @@ CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=n CONFIG_MBEDTLS_PSK_MODES=n +CONFIG_MBEDTLS_CMAC_C=y # CONFIG_MBEDTLS_HARDWARE_AES is not set # CONFIG_MBEDTLS_HARDWARE_MPI is not set From 9f68a8b93cb8770b1715f976c8620e96edb46c35 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:31:01 +0200 Subject: [PATCH 247/636] CONFIG_SOC_WIFI_GCMP_SUPPORT=y --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 1f6e6fc61..8c2433576 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -96,6 +96,7 @@ CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=n CONFIG_MBEDTLS_PSK_MODES=n CONFIG_MBEDTLS_CMAC_C=y +CONFIG_SOC_WIFI_GCMP_SUPPORT=y # CONFIG_MBEDTLS_HARDWARE_AES is not set # CONFIG_MBEDTLS_HARDWARE_MPI is not set From a193534cb5b5c98bb34836020324b755073bccbd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:54:25 +0200 Subject: [PATCH 248/636] # CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set --- configs/defconfig.common | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 8c2433576..ad6bc75b6 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -95,8 +95,8 @@ CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=n CONFIG_MBEDTLS_PSK_MODES=n -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_SOC_WIFI_GCMP_SUPPORT=y + +# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set # CONFIG_MBEDTLS_HARDWARE_AES is not set # CONFIG_MBEDTLS_HARDWARE_MPI is not set @@ -107,7 +107,7 @@ CONFIG_SOC_WIFI_GCMP_SUPPORT=y # CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set # CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +# CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set From 49ecda9bd47718baa77707dc69e63cff61ea5246 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:22:58 +0200 Subject: [PATCH 249/636] Update defconfig.common --- configs/defconfig.common | 2 -- 1 file changed, 2 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index ad6bc75b6..66665292e 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -96,8 +96,6 @@ CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=n CONFIG_MBEDTLS_PSK_MODES=n -# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set - # CONFIG_MBEDTLS_HARDWARE_AES is not set # CONFIG_MBEDTLS_HARDWARE_MPI is not set # CONFIG_MBEDTLS_HARDWARE_SHA is not set From 063fc839c66f3510b179adc35aee2f345dc6f7f8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:18:38 +0200 Subject: [PATCH 250/636] reduce footprint --- configs/defconfig.common | 67 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 66665292e..c97349109 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -88,24 +88,82 @@ CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y -# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set +# CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set + # CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y +# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=n -CONFIG_MBEDTLS_PSK_MODES=n +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=100 + +# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set +# CONFIG_MBEDTLS_PKCS7_C is not set + +# +# Symmetric Ciphers +# +# CONFIG_MBEDTLS_AES_C is not set +# CONFIG_MBEDTLS_CAMELLIA_C is not set +# CONFIG_MBEDTLS_DES_C is not set +# CONFIG_MBEDTLS_BLOWFISH_C is not set +# CONFIG_MBEDTLS_XTEA_C is not set +# CONFIG_MBEDTLS_CCM_C is not set +# CONFIG_MBEDTLS_GCM_C is not set +# CONFIG_MBEDTLS_NIST_KW_C is not set +# end of Symmetric Ciphers +# CONFIG_MBEDTLS_RIPEMD160_C is not set + +# +# TLS Key Exchange Methods +# +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y +# CONFIG_MBEDTLS_PSK_MODES is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA is not set + +# CONFIG_MBEDTLS_SSL_RENEGOTIATION is not set +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set +# CONFIG_MBEDTLS_SSL_ALPN is not set +# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set + +# CONFIG_MBEDTLS_CMAC_C is not set +# CONFIG_MBEDTLS_HARDWARE_ECC is not set +# CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK is not set # CONFIG_MBEDTLS_HARDWARE_AES is not set # CONFIG_MBEDTLS_HARDWARE_MPI is not set # CONFIG_MBEDTLS_HARDWARE_SHA is not set # CONFIG_MBEDTLS_HAVE_TIME is not set +# CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set +# CONFIG_MBEDTLS_SHA512_C is not set + +# +# Certificates +# +# CONFIG_MBEDTLS_PEM_PARSE_C is not set +# CONFIG_MBEDTLS_PEM_WRITE_C is not set +# CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set +# CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set +# end of Certificates + +# CONFIG_MBEDTLS_ECP_C is not set +# CONFIG_MBEDTLS_DHM_C is not set +# CONFIG_MBEDTLS_ECDH_C is not set +# CONFIG_MBEDTLS_ECDSA_C is not set +# CONFIG_MBEDTLS_ECJPAKE_C is not set # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set # CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set # CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set @@ -114,7 +172,7 @@ CONFIG_MBEDTLS_PSK_MODES=n # CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set - +# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set # CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set # CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set @@ -161,4 +219,3 @@ CONFIG_LITTLEFS_DISK_VERSION_2_0=y # CONFIG_BF3005_SUPPORT is not set # CONFIG_BF20A6_SUPPORT is not set # CONFIG_SC030IOT_SUPPORT is not set - From 2da2d40383dc40a41617566fe936801f60f3cc2f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:59:30 +0200 Subject: [PATCH 251/636] use v5.1.1.231006 --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 4ee016398..47a9de8a9 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -34,7 +34,7 @@ fi AR_USER="tasmota" # IDF commit to use / Nimble fails in actual release/v5.1 -#IDF_COMMIT="707b7039850844173e46eb634081a37bbbadaa9b" +IDF_COMMIT="ec31b4d09d3da05001648eaa58aa582c5cc923c8" # Arduino commit to use #AR_COMMIT="" From f403138cf6db9921ad0a448b2f03427646c973a0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:00:05 +0200 Subject: [PATCH 252/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 47a9de8a9..51b5f59f7 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -33,7 +33,7 @@ fi # Owner of the target ESP32 Arduino repository AR_USER="tasmota" -# IDF commit to use / Nimble fails in actual release/v5.1 +# IDF commit to use IDF_COMMIT="ec31b4d09d3da05001648eaa58aa582c5cc923c8" # Arduino commit to use From 51bc0a7779052e814fbaff6f0d034f4a1357b04d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:04:21 +0200 Subject: [PATCH 253/636] Update config.sh --- tools/config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 51b5f59f7..08a3178e5 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v5.1" + IDF_BRANCH="v5.1.1.231007" fi # Arduino branch to use @@ -34,7 +34,7 @@ fi AR_USER="tasmota" # IDF commit to use -IDF_COMMIT="ec31b4d09d3da05001648eaa58aa582c5cc923c8" +#IDF_COMMIT="ec31b4d09d3da05001648eaa58aa582c5cc923c8" # Arduino commit to use #AR_COMMIT="" From 04971526270abbc9a133af9910d3a4204c5f2320 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:11:08 +0200 Subject: [PATCH 254/636] main_old --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 08a3178e5..897cf5777 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="main" + AR_BRANCH="main_old" fi if [ -z $AR_PR_TARGET_BRANCH ]; then From f5da15c6a52250b2bd7232913cde105e2694aa9b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:11:44 +0200 Subject: [PATCH 255/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4ac494c06..4e236be7c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF 5.1 Arduino +name: Arduino IDF 5.1.1.231007 on: workflow_dispatch: # Manually start a workflow From d261a17657cc01df78b94a73e3d188f3438deb9b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:12:43 +0200 Subject: [PATCH 256/636] Update defconfig.common --- configs/defconfig.common | 66 +++------------------------------------- 1 file changed, 5 insertions(+), 61 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index c97349109..af72408f5 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -88,82 +88,26 @@ CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y -# CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set - +# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set # CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y -# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=100 - -# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set -# CONFIG_MBEDTLS_PKCS7_C is not set - -# -# Symmetric Ciphers -# -# CONFIG_MBEDTLS_AES_C is not set -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -# CONFIG_MBEDTLS_CCM_C is not set -# CONFIG_MBEDTLS_GCM_C is not set -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers - -# CONFIG_MBEDTLS_RIPEMD160_C is not set - -# -# TLS Key Exchange Methods -# -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -# CONFIG_MBEDTLS_PSK_MODES is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA is not set +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=n +CONFIG_MBEDTLS_PSK_MODES=n -# CONFIG_MBEDTLS_SSL_RENEGOTIATION is not set -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -# CONFIG_MBEDTLS_SSL_ALPN is not set -# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set +# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set -# CONFIG_MBEDTLS_CMAC_C is not set -# CONFIG_MBEDTLS_HARDWARE_ECC is not set -# CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK is not set # CONFIG_MBEDTLS_HARDWARE_AES is not set # CONFIG_MBEDTLS_HARDWARE_MPI is not set # CONFIG_MBEDTLS_HARDWARE_SHA is not set # CONFIG_MBEDTLS_HAVE_TIME is not set -# CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set -# CONFIG_MBEDTLS_SHA512_C is not set - -# -# Certificates -# -# CONFIG_MBEDTLS_PEM_PARSE_C is not set -# CONFIG_MBEDTLS_PEM_WRITE_C is not set -# CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set -# CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set -# end of Certificates - -# CONFIG_MBEDTLS_ECP_C is not set -# CONFIG_MBEDTLS_DHM_C is not set -# CONFIG_MBEDTLS_ECDH_C is not set -# CONFIG_MBEDTLS_ECDSA_C is not set -# CONFIG_MBEDTLS_ECJPAKE_C is not set # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set # CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set # CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set @@ -172,7 +116,7 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y # CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set -# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set + # CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set # CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set From caf390b8ceb06eabe82204207c851ca0aaf44f68 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:38:52 +0200 Subject: [PATCH 257/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 897cf5777..08a3178e5 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="main_old" + AR_BRANCH="main" fi if [ -z $AR_PR_TARGET_BRANCH ]; then From 85bae98d7606d20fc31824b6cc57360c3b7aee85 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 12 Oct 2023 20:36:59 +0200 Subject: [PATCH 258/636] rm -rf arduino-esp32/libraries/WiFiClientSecure --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 2b521f332..98f7cf860 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -22,6 +22,7 @@ rm -rf arduino-esp32/libraries/SPIFFS rm -rf arduino-esp32/libraries/BLE rm -rf arduino-esp32/libraries/SimpleBLE rm -rf arduino-esp32/libraries/WiFiProv +rm -rf arduino-esp32/libraries/WiFiClientSecure rm -rf arduino-esp32/libraries/TFLiteMicro rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package From 201dc34645fe019d839af82f8413c026b27e82a2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 12 Oct 2023 20:42:44 +0200 Subject: [PATCH 259/636] rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 61c030b82..bb8dafb94 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -55,6 +55,7 @@ rm -rf "$AR_COMPS/arduino/libraries/Insights" rm -rf "$AR_COMPS/arduino/libraries/BLE" rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" +rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" rm -rf "$AR_COMPS/arduino/libraries/ESP32" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" From 18ec1661de75a8497d001d9e71b24adba88c6332 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 12 Oct 2023 21:36:58 +0200 Subject: [PATCH 260/636] clean up --- configs/defconfig.common | 74 +++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index af72408f5..e919ac673 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -88,26 +88,86 @@ CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y -# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set +# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set +# CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set +# CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT is not set # CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 +# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y +CONFIG_MBEDTLS_TLS_DISABLED=y CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=n -CONFIG_MBEDTLS_PSK_MODES=n +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 -# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set +# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set +# CONFIG_MBEDTLS_PKCS7_C is not set + +# +# Symmetric Ciphers +# +CONFIG_MBEDTLS_AES_C=y +# CONFIG_MBEDTLS_CAMELLIA_C is not set +# CONFIG_MBEDTLS_DES_C is not set +# CONFIG_MBEDTLS_BLOWFISH_C is not set +# CONFIG_MBEDTLS_XTEA_C is not set +# CONFIG_MBEDTLS_CCM_C is not set +# CONFIG_MBEDTLS_GCM_C is not set +# CONFIG_MBEDTLS_NIST_KW_C is not set +# end of Symmetric Ciphers + + +# +# TLS Key Exchange Methods +# +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y +# CONFIG_MBEDTLS_PSK_MODES is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA is not set + +CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +# CONFIG_MBEDTLS_SSL_RENEGOTIATION is not set +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set +# CONFIG_MBEDTLS_SSL_ALPN is not set +# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set + +CONFIG_MBEDTLS_CMAC_C=y +# CONFIG_MBEDTLS_HARDWARE_ECC is not set +# CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK is not set # CONFIG_MBEDTLS_HARDWARE_AES is not set # CONFIG_MBEDTLS_HARDWARE_MPI is not set # CONFIG_MBEDTLS_HARDWARE_SHA is not set # CONFIG_MBEDTLS_HAVE_TIME is not set +# CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set +# CONFIG_MBEDTLS_SHA512_C is not set +# CONFIG_MBEDTLS_RIPEMD160_C is not set +# +# Certificates +# +# CONFIG_MBEDTLS_PEM_PARSE_C is not set +# CONFIG_MBEDTLS_PEM_WRITE_C is not set +# CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set +# CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set +# end of Certificates + +CONFIG_MBEDTLS_ECP_C=y +CONFIG_MBEDTLS_ECDH_C=y +CONFIG_MBEDTLS_ECDSA_C=y +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +# CONFIG_MBEDTLS_DHM_C is not set +# CONFIG_MBEDTLS_ECJPAKE_C is not set # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set # CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set # CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set @@ -116,12 +176,10 @@ CONFIG_MBEDTLS_PSK_MODES=n # CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set # CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set - - +# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set # CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set # CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set # CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -# CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 From 78c6e652e1b398bcbbcb15c76078a0ce558a9e58 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 13 Oct 2023 12:40:35 +0200 Subject: [PATCH 261/636] Use Hardware mbedtls --- configs/defconfig.common | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index e919ac673..88581f1c9 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -138,11 +138,12 @@ CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set CONFIG_MBEDTLS_CMAC_C=y -# CONFIG_MBEDTLS_HARDWARE_ECC is not set +CONFIG_MBEDTLS_ROM_MD5=y +CONFIG_MBEDTLS_HARDWARE_ECC=y +CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_HARDWARE_SHA=y # CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK is not set -# CONFIG_MBEDTLS_HARDWARE_AES is not set -# CONFIG_MBEDTLS_HARDWARE_MPI is not set -# CONFIG_MBEDTLS_HARDWARE_SHA is not set # CONFIG_MBEDTLS_HAVE_TIME is not set # CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set # CONFIG_MBEDTLS_SHA512_C is not set From c4f9bc73671409cdabee89dd6449ca9fb4542dff Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:17:46 +0200 Subject: [PATCH 262/636] rm -rf arduino-esp32/libraries/ESP_I2S --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 98f7cf860..da957dfb4 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -18,6 +18,7 @@ rm -rf arduino-esp32/docs rm -rf arduino-esp32/tests rm -rf arduino-esp32/libraries/RainMaker rm -rf arduino-esp32/libraries/Insights +rm -rf arduino-esp32/libraries/ESP_I2S rm -rf arduino-esp32/libraries/SPIFFS rm -rf arduino-esp32/libraries/BLE rm -rf arduino-esp32/libraries/SimpleBLE From 786e146ad950574a8c8c15d7d5eb6876f949a795 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:20:57 +0200 Subject: [PATCH 263/636] rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index bb8dafb94..5730d14e8 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -52,6 +52,7 @@ if [ $? -ne 0 ]; then exit 1; fi # rm -rf "$AR_COMPS/arduino/libraries/RainMaker" rm -rf "$AR_COMPS/arduino/libraries/Insights" +rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S rm -rf "$AR_COMPS/arduino/libraries/BLE" rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" From c8d0633223f95dfb6be9611eb73a58980f2f27e6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:21:13 +0200 Subject: [PATCH 264/636] Update install-arduino.sh --- tools/install-arduino.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 5730d14e8..f0da248be 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -52,7 +52,7 @@ if [ $? -ne 0 ]; then exit 1; fi # rm -rf "$AR_COMPS/arduino/libraries/RainMaker" rm -rf "$AR_COMPS/arduino/libraries/Insights" -rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S +rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S" rm -rf "$AR_COMPS/arduino/libraries/BLE" rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" From b109b241442667340e673bb8eadff86846780a7b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:53:35 +0200 Subject: [PATCH 265/636] rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index f0da248be..e490916a9 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -58,6 +58,7 @@ rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" rm -rf "$AR_COMPS/arduino/libraries/ESP32" +rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" # From 830032da9626be1cfe7e9208502724cd6b6b2830 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:56:21 +0200 Subject: [PATCH 266/636] rm -rf arduino-esp32/libraries/ESP_SR --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index da957dfb4..b12f1be4c 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -24,6 +24,7 @@ rm -rf arduino-esp32/libraries/BLE rm -rf arduino-esp32/libraries/SimpleBLE rm -rf arduino-esp32/libraries/WiFiProv rm -rf arduino-esp32/libraries/WiFiClientSecure +rm -rf arduino-esp32/libraries/ESP_SR rm -rf arduino-esp32/libraries/TFLiteMicro rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package From 0a4804b1d9c0feba3c7f2ef9f04d2a1939dccac7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 24 Oct 2023 16:50:31 +0200 Subject: [PATCH 267/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 08a3178e5..b687a5bb5 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="v5.1.1.231007" + IDF_BRANCH="release/v5.1_no_SECP256R1" fi # Arduino branch to use From ed676c156b2a5cc6b84abca227dcd541d4da3f44 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 24 Oct 2023 16:51:09 +0200 Subject: [PATCH 268/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4e236be7c..eed024adc 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: Arduino IDF 5.1.1.231007 +name: IDF v5.1_no_SECP256R1 on: workflow_dispatch: # Manually start a workflow From d54054f2b538f61c97448cc745dc5789306ff423 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:22:32 +0200 Subject: [PATCH 269/636] rm -rf arduino-esp32/libraries/BluetoothSerial --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index b12f1be4c..93cb2eb01 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -22,6 +22,7 @@ rm -rf arduino-esp32/libraries/ESP_I2S rm -rf arduino-esp32/libraries/SPIFFS rm -rf arduino-esp32/libraries/BLE rm -rf arduino-esp32/libraries/SimpleBLE +rm -rf arduino-esp32/libraries/BluetoothSerial rm -rf arduino-esp32/libraries/WiFiProv rm -rf arduino-esp32/libraries/WiFiClientSecure rm -rf arduino-esp32/libraries/ESP_SR From e2ad24297adb987703d712db03d8b78bdb0b935d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:24:02 +0200 Subject: [PATCH 270/636] rm -rf "$AR_COMPS/arduino/libraries/libraries/BluetoothSerial" --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index e490916a9..dc0bf9c53 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -55,6 +55,7 @@ rm -rf "$AR_COMPS/arduino/libraries/Insights" rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S" rm -rf "$AR_COMPS/arduino/libraries/BLE" rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" +rm -rf "$AR_COMPS/arduino/libraries/libraries/BluetoothSerial" rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" rm -rf "$AR_COMPS/arduino/libraries/ESP32" From 756495ff7ea15d3ce2963364b00f5192214cfffe Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:24:43 +0200 Subject: [PATCH 271/636] rm -rf "$AR_COMPS/arduino/libraries/BluetoothSerial" --- tools/install-arduino.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index dc0bf9c53..78668b7f3 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -55,7 +55,7 @@ rm -rf "$AR_COMPS/arduino/libraries/Insights" rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S" rm -rf "$AR_COMPS/arduino/libraries/BLE" rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" -rm -rf "$AR_COMPS/arduino/libraries/libraries/BluetoothSerial" +rm -rf "$AR_COMPS/arduino/libraries/BluetoothSerial" rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" rm -rf "$AR_COMPS/arduino/libraries/ESP32" From 3a04bdb2635487fd694aca3e459af92e628d0c8a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:59:08 +0200 Subject: [PATCH 272/636] rm arduino examples --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 78668b7f3..deb93fddf 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -61,6 +61,7 @@ rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" rm -rf "$AR_COMPS/arduino/libraries/ESP32" rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" +rm -rf "$AR_COMPS/**/examples" # # CLONE/UPDATE ESP32-ARDUINO-LIBS From dff9910e7f8a400bd473fb3814355c84618b3605 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 26 Oct 2023 11:00:27 +0200 Subject: [PATCH 273/636] rm all Arduino examples --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 93cb2eb01..a1f44a730 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -28,6 +28,7 @@ rm -rf arduino-esp32/libraries/WiFiClientSecure rm -rf arduino-esp32/libraries/ESP_SR rm -rf arduino-esp32/libraries/TFLiteMicro rm -rf arduino-esp32/libraries/ESP32 +rm -rf arduino-esp32/**/examples rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs rm -rf arduino-esp32/tools/esptool.py From d4194071ea3605a5124ab7d12a16b7b7a2522ff9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:29:35 +0200 Subject: [PATCH 274/636] rm examples / reduce build zip time --- tools/archive-build.sh | 15 +++++++++++++-- tools/install-arduino.sh | 1 - tools/install-esp-idf.sh | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index a1f44a730..10c9ac331 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -13,7 +13,16 @@ mkdir -p dist && rm -rf "$archive_path" "$build_archive_path" cd out echo "Creating PlatformIO Tasmota framework-arduinoespressif32" -cp -rf ../components/arduino arduino-esp32 +mkdir -p arduino-esp32/cores/esp32 +mkdir -p arduino-esp32/tools/partitions +cp -rf ../components/arduino/tools arduino-esp32 +cp -rf ../components/arduino/cores arduino-esp32 +cp -rf ../components/arduino/libraries arduino-esp32 +cp -rf ../components/arduino/variants arduino-esp32 +cp -f ../components/arduino/CMa* arduino-esp32 +cp -f ../components/arduino/idf* arduino-esp32 +cp -f ../components/arduino/Kco* arduino-esp32 +cp -f ../components/arduino/pac* arduino-esp32 rm -rf arduino-esp32/docs rm -rf arduino-esp32/tests rm -rf arduino-esp32/libraries/RainMaker @@ -28,7 +37,6 @@ rm -rf arduino-esp32/libraries/WiFiClientSecure rm -rf arduino-esp32/libraries/ESP_SR rm -rf arduino-esp32/libraries/TFLiteMicro rm -rf arduino-esp32/libraries/ESP32 -rm -rf arduino-esp32/**/examples rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs rm -rf arduino-esp32/tools/esptool.py @@ -46,6 +54,9 @@ cp -Rf tools/esp32-arduino-libs arduino-esp32/tools/ cp ../package.json arduino-esp32/package.json cp ../core_version.h arduino-esp32/cores/esp32/core_version.h mv arduino-esp32/ framework-arduinoespressif32/ +cd framework-arduinoespressif32/libraries +rm -rf **/examples +cd ../../ # If the framework is needed as tar.gz uncomment next line # tar --exclude=.* -zcf ../$pio_archive_path framework-arduinoespressif32/ 7z a -mx=9 -tzip -xr'!.*' ../$pio_zip_archive_path framework-arduinoespressif32/ diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index deb93fddf..78668b7f3 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -61,7 +61,6 @@ rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" rm -rf "$AR_COMPS/arduino/libraries/ESP32" rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" -rm -rf "$AR_COMPS/**/examples" # # CLONE/UPDATE ESP32-ARDUINO-LIBS diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 6c33a01eb..9f9a4722b 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -37,7 +37,7 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then # Temporarily patch the ETH driver to support custom SPI cd $IDF_PATH - patch -p1 -i ../patches/spi_eth.diff + patch -p1 -N -i ../patches/spi_eth.diff cd - fi From a06cb3a22cfaa9a2eae643b69a1b49f29bef0664 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 28 Oct 2023 10:16:28 +0200 Subject: [PATCH 275/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index b687a5bb5..07f5f3ca7 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v5.1_no_SECP256R1" + IDF_BRANCH="release/v5.1" fi # Arduino branch to use From dfb897f078dee8d8681594a67887434025940359 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 28 Oct 2023 10:16:51 +0200 Subject: [PATCH 276/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index eed024adc..5c7b2b2da 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF v5.1_no_SECP256R1 +name: IDF v5.1 on: workflow_dispatch: # Manually start a workflow From 6c2d755ff787c5bc16a02a20921bdb02983655e9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:24:40 +0100 Subject: [PATCH 277/636] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5cdb4a45..88cede199 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ idf_build_get_property(elf EXECUTABLE GENERATOR_EXPRESSION) add_custom_command( OUTPUT "idf_libs" COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-libs.sh ${IDF_TARGET} "${CONFIG_LIB_BUILDER_FLASHMODE}" "${CONFIG_SPIRAM_MODE_OCT}" "${CONFIG_IDF_TARGET_ARCH_XTENSA}" - DEPENDS all + DEPENDS ${elf} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} VERBATIM ) From d75aa10433c52b7157c4f78f378fb1b9294cc603 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:30:29 +0100 Subject: [PATCH 278/636] Update idf_component.yml --- main/idf_component.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index fb3137b46..da7132ddd 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,12 +1,11 @@ dependencies: # Required IDF version idf: ">=5.1" - - mdns: "^1.2.0" - #libsodium: "^1.0.20" - #chmorgan/esp-libhelix-mp3: "1.0.3" - #esp-dsp: "^1.3.4" - + espressif/esp32-camera: + version: "*" + git: https://github.com/espressif/esp32-camera.git + require: public + # esp-sr: "^1.3.1" # esp32-camera: "^2.0.4" # esp-dl: From 8a9c37d45620e2bae8a8a01ef4eb4a0cdfc72036 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:37:51 +0100 Subject: [PATCH 279/636] Update update-components.sh --- tools/update-components.sh | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 21c27dccb..954c87f48 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -9,14 +9,14 @@ TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" # # CLONE/UPDATE ESP32-CAMERA # -echo "Updating ESP32 Camera..." -if [ ! -d "$AR_COMPS/esp32-camera" ]; then - git clone $CAMERA_REPO_URL "$AR_COMPS/esp32-camera" -else - git -C "$AR_COMPS/esp32-camera" fetch && \ - git -C "$AR_COMPS/esp32-camera" pull --ff-only -fi -if [ $? -ne 0 ]; then exit 1; fi +#echo "Updating ESP32 Camera..." +#if [ ! -d "$AR_COMPS/esp32-camera" ]; then +# git clone $CAMERA_REPO_URL "$AR_COMPS/esp32-camera" +#else +# git -C "$AR_COMPS/esp32-camera" fetch && \ +# git -C "$AR_COMPS/esp32-camera" pull --ff-only +#fi +#if [ $? -ne 0 ]; then exit 1; fi # # Arduino needs cam_hal.h from esp32-camera in include folder @@ -26,18 +26,18 @@ cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-ca # # CLONE/UPDATE ESP-LITTLEFS v1.10.0 commit 032f9... # -echo "Updating ESP-LITTLEFS..." -if [ ! -d "$AR_COMPS/esp_littlefs" ]; then - git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" - git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495 - git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive -else - git -C "$AR_COMPS/esp_littlefs" fetch - git -C "$AR_COMPS/esp_littlefs" pull --ff-only - git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495 - git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive -fi -if [ $? -ne 0 ]; then exit 1; fi +#echo "Updating ESP-LITTLEFS..." +#if [ ! -d "$AR_COMPS/esp_littlefs" ]; then +# git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" +# git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495 +# git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive +#else +# git -C "$AR_COMPS/esp_littlefs" fetch +# git -C "$AR_COMPS/esp_littlefs" pull --ff-only +# git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495 +# git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive +#fi +#if [ $? -ne 0 ]; then exit 1; fi # # CLONE/UPDATE TINYUSB From 4e72dd432e81c89d0eb67c50b5c56b9273b3f92e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:43:38 +0100 Subject: [PATCH 280/636] Just one Arduino 5.1 (#69) * rm `rm -rf arduino-esp32/libraries/WiFiClientSecure` * rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" * clean up * use Hardware mbedtls * rm -rf arduino-esp32/libraries/ESP_I2S * rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S * Update install-arduino.sh * rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" * rm -rf arduino-esp32/libraries/ESP_SR * Update CMakeLists.txt * Update idf_component.yml * Update update-components.sh From e6cc1d4462c988cdab74bc9370c43efb96a790f9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 11 Nov 2023 13:13:32 +0100 Subject: [PATCH 281/636] Update idf_component.yml --- main/idf_component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index da7132ddd..861798c19 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -2,7 +2,7 @@ dependencies: # Required IDF version idf: ">=5.1" espressif/esp32-camera: - version: "*" + version: "master" git: https://github.com/espressif/esp32-camera.git require: public From bd41f75869f912b50c857da4da48f1e08cb9a0c2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:15:16 +0100 Subject: [PATCH 282/636] Update defconfig.esp32c2 --- configs/defconfig.esp32c2 | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 6441674b0..726ad4c73 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,18 +1,6 @@ CONFIG_XTAL_FREQ_26=y CONFIG_XTAL_FREQ=26 -# -# Bluetooth -# -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y -CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 -# CONFIG_BT_NIMBLE_NVS_PERSIST is not set -# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set -# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set -# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set -# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set - +CONFIG_BT_BLE_BLUFI_ENABLE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 From 204a0b673e8ecf4d222759a749c3281b3db674c6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:17:58 +0100 Subject: [PATCH 283/636] Update defconfig.esp32c2 --- configs/defconfig.esp32c2 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 726ad4c73..6441674b0 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,6 +1,18 @@ CONFIG_XTAL_FREQ_26=y CONFIG_XTAL_FREQ=26 -CONFIG_BT_BLE_BLUFI_ENABLE=y +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 From 16e678c8eeabeb354ec98cadaa4b4bf62b3021f4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 16 Nov 2023 14:16:49 +0100 Subject: [PATCH 284/636] # CONFIG_DAC_DMA_AUTO_16BIT_ALIGN is not set --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 88581f1c9..a60f3e100 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -87,6 +87,7 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y +# CONFIG_DAC_DMA_AUTO_16BIT_ALIGN is not set # CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set # CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set From f825dd1d7fbe0c36cfe1b1d348ce48a6d64533d6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 10:42:08 +0100 Subject: [PATCH 285/636] Disable BLE4.2 --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index a60f3e100..0f21b7ef8 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -11,7 +11,7 @@ CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y -CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set # CONFIG_BLE_MESH is not set CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y From a710d2da5734eb38e0a650fe5bc0b86e59a02aff Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 10:44:30 +0100 Subject: [PATCH 286/636] Disable BT Stack size --- configs/defconfig.esp32 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 0397e29b1..7ef4ac4cf 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -18,8 +18,8 @@ CONFIG_ETH_PHY_INTERFACE_RMII=y CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_BTDM_CTRL_MODE_BTDM is not set -CONFIG_BT_BTC_TASK_STACK_SIZE=8192 -CONFIG_BT_BTU_TASK_STACK_SIZE=8192 +# CONFIG_BT_BTC_TASK_STACK_SIZE is not set +# CONFIG_BT_BTU_TASK_STACK_SIZE is not set CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y CONFIG_SPIRAM=y From 6c3eafae8c8b3467c5e1c14050caedc213e9ceda Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 11:01:37 +0100 Subject: [PATCH 287/636] add var for managed_components --- tools/config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/config.sh b/tools/config.sh index 07f5f3ca7..635ec9dba 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -54,6 +54,7 @@ fi AR_ROOT="$PWD" AR_COMPS="$AR_ROOT/components" +AR_MAN_COMPS="$AR_ROOT/managed_components" AR_OUT="$AR_ROOT/out" AR_TOOLS="$AR_OUT/tools" AR_PLATFORM_TXT="$AR_OUT/platform.txt" From 23bd13d2a33c6f52011c0b8236553ee0d0c615cd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 11:04:04 +0100 Subject: [PATCH 288/636] changed folder of webcam *.h --- tools/update-components.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 954c87f48..f4e4c339d 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -21,7 +21,7 @@ TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" # # Arduino needs cam_hal.h from esp32-camera in include folder # -cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" +# cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" # # CLONE/UPDATE ESP-LITTLEFS v1.10.0 commit 032f9... From 0b4816281eba28d425d38740d70a0bb8253b1341 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 11:20:50 +0100 Subject: [PATCH 289/636] changed path for webcam *.h --- build.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.sh b/build.sh index e2b82e8aa..9bad308b3 100755 --- a/build.sh +++ b/build.sh @@ -213,6 +213,11 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do done done +# +# Arduino needs cam_hal.h from esp32-camera in include folder +# +cp "$AR_MAN_COMPS/espressif__esp32-camera/driver/private_include/cam_hal.h" "$AR_MAN_COMPS/espressif__esp32-camera/driver/include/" + # update package_esp32_index.template.json if [ "$BUILD_TYPE" = "all" ]; then python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" From 18d2adea4628b35f14d9fff7d462cb1763213e27 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 11:43:55 +0100 Subject: [PATCH 290/636] fix webcam setup --- build.sh | 6 +----- main/idf_component.yml | 10 +++++----- tools/update-components.sh | 18 +++++++++--------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/build.sh b/build.sh index 9bad308b3..7b8cd2a87 100755 --- a/build.sh +++ b/build.sh @@ -87,6 +87,7 @@ shift $((OPTIND -1)) CONFIGS=$@ mkdir -p dist +rm -rf dependencies.lock if [ $SKIP_ENV -eq 0 ]; then echo "* Installing/Updating ESP-IDF and all components..." @@ -213,11 +214,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do done done -# -# Arduino needs cam_hal.h from esp32-camera in include folder -# -cp "$AR_MAN_COMPS/espressif__esp32-camera/driver/private_include/cam_hal.h" "$AR_MAN_COMPS/espressif__esp32-camera/driver/include/" - # update package_esp32_index.template.json if [ "$BUILD_TYPE" = "all" ]; then python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" diff --git a/main/idf_component.yml b/main/idf_component.yml index 861798c19..b119e44da 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,11 +1,11 @@ dependencies: # Required IDF version idf: ">=5.1" - espressif/esp32-camera: - version: "master" - git: https://github.com/espressif/esp32-camera.git - require: public - + + # espressif/esp32-camera: + # version: "master" + # git: https://github.com/espressif/esp32-camera.git + # require: public # esp-sr: "^1.3.1" # esp32-camera: "^2.0.4" # esp-dl: diff --git a/tools/update-components.sh b/tools/update-components.sh index f4e4c339d..06e24d23a 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -9,19 +9,19 @@ TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" # # CLONE/UPDATE ESP32-CAMERA # -#echo "Updating ESP32 Camera..." -#if [ ! -d "$AR_COMPS/esp32-camera" ]; then -# git clone $CAMERA_REPO_URL "$AR_COMPS/esp32-camera" -#else -# git -C "$AR_COMPS/esp32-camera" fetch && \ -# git -C "$AR_COMPS/esp32-camera" pull --ff-only -#fi -#if [ $? -ne 0 ]; then exit 1; fi +echo "Updating ESP32 Camera..." +if [ ! -d "$AR_COMPS/esp32-camera" ]; then + git clone $CAMERA_REPO_URL "$AR_COMPS/esp32-camera" +else + git -C "$AR_COMPS/esp32-camera" fetch && \ + git -C "$AR_COMPS/esp32-camera" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi # # Arduino needs cam_hal.h from esp32-camera in include folder # -# cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" +cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" # # CLONE/UPDATE ESP-LITTLEFS v1.10.0 commit 032f9... From 5f57e324bf3d59b4289b5f26a9c41c476d623e42 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 15:30:15 +0100 Subject: [PATCH 291/636] MBEDTLS_USE_CRYPTO_ROM_IMPL --- configs/defconfig.esp32c2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 6441674b0..fd38105c6 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,5 +1,9 @@ CONFIG_XTAL_FREQ_26=y CONFIG_XTAL_FREQ=26 + +CONFIG_IDF_EXPERIMENTAL_FEATURES=y +CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL=y + # # Bluetooth # From ea877464023bfa05c025cef06e33d48b09799412 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 16:47:25 +0100 Subject: [PATCH 292/636] Update defconfig.esp32c2 --- configs/defconfig.esp32c2 | 3 --- 1 file changed, 3 deletions(-) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index fd38105c6..2e3ecad3d 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,9 +1,6 @@ CONFIG_XTAL_FREQ_26=y CONFIG_XTAL_FREQ=26 -CONFIG_IDF_EXPERIMENTAL_FEATURES=y -CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL=y - # # Bluetooth # From 231e4602daa20cde4962373615e818427e0fb5bb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 18 Nov 2023 17:31:12 +0100 Subject: [PATCH 293/636] Update defconfig.common --- configs/defconfig.common | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 0f21b7ef8..364d3e1d1 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -73,6 +73,8 @@ CONFIG_LWIP_IPV4_NAPT=y CONFIG_LWIP_TCP_SYNMAXRTX=6 CONFIG_LWIP_TCP_MSS=1436 CONFIG_LWIP_TCP_RTO_TIME=3000 +CONFIG_LWIP_TCP_MSL=6000 +CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=2000 CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560 CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y CONFIG_LWIP_IPV6_AUTOCONFIG=y From e751bf4faff5cfbc0b2f70dd4a347c99f4dd7228 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:59:42 +0100 Subject: [PATCH 294/636] # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 364d3e1d1..b4d293319 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -101,7 +101,7 @@ CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_TLS_DISABLED=y -CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y +# CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 # CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set From 8674dbfbbc9f4d3f4ed75d82f1849d4dcd3e4cf1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:10:46 +0100 Subject: [PATCH 295/636] Try to reduce mbedtls footprint --- configs/defconfig.common | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index b4d293319..b51aaa75d 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -103,7 +103,9 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_TLS_DISABLED=y # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 - +CONFIG_MBEDTLS_DYNAMIC_BUFFER=y +CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y +CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y # CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set # CONFIG_MBEDTLS_PKCS7_C is not set From a27cb34d1d7245350f4e952fcf9d1ea0eec0d442 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:24:03 +0100 Subject: [PATCH 296/636] Update defconfig.common --- configs/defconfig.common | 3 --- 1 file changed, 3 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index b51aaa75d..6a7da076b 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -103,9 +103,6 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_TLS_DISABLED=y # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 -CONFIG_MBEDTLS_DYNAMIC_BUFFER=y -CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y -CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y # CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set # CONFIG_MBEDTLS_PKCS7_C is not set From 8697cfcbc641cae1a241676c609bda282564a391 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:15:55 +0100 Subject: [PATCH 297/636] Copy dependencies.lock for each target --- tools/copy-libs.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index a20358c6a..7836441d4 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -488,6 +488,9 @@ fi # sdkconfig cp -f "sdkconfig" "$AR_SDK/sdkconfig" +# dependencies.lock +cp -f "dependencies.lock" "$AR_SDK/dependencies.lock + # gen_esp32part.py # cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" From 3ddf8cac29353d1f3d0c8f509209d1c1a70c10c6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:21:02 +0100 Subject: [PATCH 298/636] Make PR title use the info from versions.txt --- tools/config.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 635ec9dba..031710483 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -177,15 +177,7 @@ function git_create_pr(){ # git_create_pr <branch> <title> local pr_title="$2" local pr_target="$3" local pr_body="" - pr_body+="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)"\r\n" - for component in `ls "$AR_COMPS"`; do - if [ ! $component == "arduino" ]; then - if [ -d "$AR_COMPS/$component/.git" ] || [ -d "$AR_COMPS/$component/.github" ]; then - pr_body+="$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)"\r\n" - fi - fi - done - pr_body+="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)"\r\n" + pr_body+=$(cat "$AR_TOOLS/esp32-arduino-libs/versions.txt")"\r\n" local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" 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"` local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` From dd380dce76c7568b988575b6f3fe0f69d8aaeead Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:22:50 +0100 Subject: [PATCH 299/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 031710483..b50fe1591 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -54,7 +54,7 @@ fi AR_ROOT="$PWD" AR_COMPS="$AR_ROOT/components" -AR_MAN_COMPS="$AR_ROOT/managed_components" +AR_MANAGED_COMPS="$AR_ROOT/managed_components" AR_OUT="$AR_ROOT/out" AR_TOOLS="$AR_OUT/tools" AR_PLATFORM_TXT="$AR_OUT/platform.txt" From b69a857731b11572dddf4a357548640dce75ab3e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:32:35 +0100 Subject: [PATCH 300/636] changed components info generating --- build.sh | 52 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/build.sh b/build.sh index 7b8cd2a87..8529492ba 100755 --- a/build.sh +++ b/build.sh @@ -138,26 +138,7 @@ if [ "$BUILD_TYPE" != "all" ]; then fi rm -rf build sdkconfig out - -# Add components version info -mkdir -p "$AR_TOOLS/esp32-arduino-libs" && rm -rf version.txt && rm -rf "$AR_TOOLS/esp32-arduino-libs/versions.txt" -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) -echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" -for component in `ls "$AR_COMPS"`; do - if [ -d "$AR_COMPS/$component/.git" ] || [ -d "$AR_COMPS/$component/.github" ]; then - 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) - echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" - fi -done -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) -echo $component_version >> version.txt && echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" - -# Add release-info -rm -rf release-info.txt -IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") -AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") -echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt - +mkdir -p "$AR_TOOLS/esp32-arduino-libs" #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do @@ -214,6 +195,37 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do done done +# +# Add components version info +# +rm -rf "$AR_TOOLS/esp32-arduino-libs/versions.txt" +# The lib-builder version +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) +echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" +# ESP-IDF version +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) +echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" +# components version +for component in `ls "$AR_COMPS"`; do + if [ -d "$AR_COMPS/$component/.git" ]; then + 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) + echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" + fi +done +# TinyUSB version +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) +echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" +# managed components version +for component in `ls "$AR_MANAGED_COMPS"`; do + if [ -d "$AR_MANAGED_COMPS/$component/.git" ]; then + 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) + echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" + elif [ -f "$AR_MANAGED_COMPS/$component/idf_component.yml" ]; then + component_version="$component: "$(cat "$AR_MANAGED_COMPS/$component/idf_component.yml" | grep "^version: " | cut -d ' ' -f 2) + echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" + fi +done + # update package_esp32_index.template.json if [ "$BUILD_TYPE" = "all" ]; then python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" From 48cffaffd1c63d7426443572f5a774bf7f41aa37 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:38:06 +0100 Subject: [PATCH 301/636] Update update-components.sh --- tools/update-components.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 06e24d23a..d2d819fdd 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -5,6 +5,7 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" +TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" # # CLONE/UPDATE ESP32-CAMERA @@ -43,10 +44,10 @@ cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-ca # CLONE/UPDATE TINYUSB # echo "Updating TinyUSB..." -if [ ! -d "$AR_COMPS/arduino_tinyusb/tinyusb" ]; then - git clone $TINYUSB_REPO_URL "$AR_COMPS/arduino_tinyusb/tinyusb" +if [ ! -d "$TINYUSB_REPO_DIR" ]; then + git clone "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" else - git -C "$AR_COMPS/arduino_tinyusb/tinyusb" fetch && \ - git -C "$AR_COMPS/arduino_tinyusb/tinyusb" pull --ff-only + git -C "$TINYUSB_REPO_DIR" fetch && \ + git -C "$TINYUSB_REPO_DIR" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi From f2339c9ecf90852c6607a382438347a6d81ce651 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:46:14 +0100 Subject: [PATCH 302/636] Update copy-libs.sh --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 7836441d4..f49434462 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -489,7 +489,7 @@ fi cp -f "sdkconfig" "$AR_SDK/sdkconfig" # dependencies.lock -cp -f "dependencies.lock" "$AR_SDK/dependencies.lock +cp -f "dependencies.lock" "$AR_SDK/dependencies.lock" # gen_esp32part.py # cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" From d5a508032a96b81fb2f6a279799bfe3cba1c75e7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:28:09 +0100 Subject: [PATCH 303/636] add release info txt --- build.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.sh b/build.sh index 8529492ba..bca5e2e97 100755 --- a/build.sh +++ b/build.sh @@ -140,6 +140,12 @@ fi rm -rf build sdkconfig out mkdir -p "$AR_TOOLS/esp32-arduino-libs" +# Add release-info +rm -rf release-info.txt +IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") +AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") +echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt + #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do target=$(echo "$target_json" | jq -c '.target' | tr -d '"') From 7a7f3a87ae74297252338787e87425c2979073ce Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:32:06 +0100 Subject: [PATCH 304/636] Create eth_multicast.diff --- patches/eth_multicast.diff | 1 + 1 file changed, 1 insertion(+) create mode 100644 patches/eth_multicast.diff diff --git a/patches/eth_multicast.diff b/patches/eth_multicast.diff new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/patches/eth_multicast.diff @@ -0,0 +1 @@ + From 32c62f6d5760423823f0b5de9c2383eaa4d6260d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:33:00 +0100 Subject: [PATCH 305/636] Create esp32s2_i2c_ll_master_init.diff --- patches/esp32s2_i2c_ll_master_init.diff | 1 + 1 file changed, 1 insertion(+) create mode 100644 patches/esp32s2_i2c_ll_master_init.diff diff --git a/patches/esp32s2_i2c_ll_master_init.diff b/patches/esp32s2_i2c_ll_master_init.diff new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/patches/esp32s2_i2c_ll_master_init.diff @@ -0,0 +1 @@ + From de362da16edfd1b3e205aeb4f4ca0cd0c3aed056 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:36:07 +0100 Subject: [PATCH 306/636] Multicast / s2 i2c fix --- tools/install-esp-idf.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 9f9a4722b..9175b83dc 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -38,6 +38,8 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then # Temporarily patch the ETH driver to support custom SPI cd $IDF_PATH patch -p1 -N -i ../patches/spi_eth.diff + patch -p1 -N -i ../patches/eth_multicast.diff + patch -p1 -N -i ../patches/esp32s2_i2c_ll_master_init.diff cd - fi From ff82d63c6e1dc56878b18e7629aeb1d86be77c91 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:37:10 +0100 Subject: [PATCH 307/636] Update esp32s2_i2c_ll_master_init.diff --- patches/esp32s2_i2c_ll_master_init.diff | 110 +++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/patches/esp32s2_i2c_ll_master_init.diff b/patches/esp32s2_i2c_ll_master_init.diff index 8b1378917..da7f8691b 100644 --- a/patches/esp32s2_i2c_ll_master_init.diff +++ b/patches/esp32s2_i2c_ll_master_init.diff @@ -1 +1,109 @@ - +diff --git a/components/esp_eth/src/esp_eth_mac_esp.c b/components/esp_eth/src/esp_eth_mac_esp.c +index 7704d9ac48cbe572aefcacd24bfcf6097a9a0562..d59e1e33b4ab3d8a9bde7527ec8f68175bf5dc1e 100644 +--- a/components/esp_eth/src/esp_eth_mac_esp.c ++++ b/components/esp_eth/src/esp_eth_mac_esp.c +@@ -634,7 +634,6 @@ esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config + emac->smi_mdio_gpio_num = esp32_config->smi_mdio_gpio_num; + emac->flow_control_high_water_mark = FLOW_CONTROL_HIGH_WATER_MARK; + emac->flow_control_low_water_mark = FLOW_CONTROL_LOW_WATER_MARK; +- emac->use_apll = false; + emac->parent.set_mediator = emac_esp32_set_mediator; + emac->parent.init = emac_esp32_init; + emac->parent.deinit = emac_esp32_deinit; +diff --git a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c +index 10ab357fc4c68141361e5038af1856fa769fe168..473195a83b236236a604f26f5ce1765eed2c1d91 100644 +--- a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c ++++ b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c +@@ -298,7 +298,7 @@ static esp_err_t init_set_defaults(emac_ksz8851snl_t *emac) + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDTTR, RXDTTR_INIT_VALUE), err, TAG, "RXDTTR write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDBCTR, RXDBCTR_INIT_VALUE), err, TAG, "RXDBCTR write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR1, +- RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE | RXCR1_RXME), err, TAG, "RXCR1 write failed"); ++ RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXUE | RXCR1_RXME | RXCR1_RXMAFMA | RXCR1_RXAE), err, TAG, "RXCR1 write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR2, + (4 << RXCR2_SRDBL_SHIFT) | RXCR2_IUFFP | RXCR2_RXIUFCEZ | RXCR2_UDPLFE | RXCR2_RXICMPFCC), err, TAG, "RXCR2 write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_RXFCTE | RXQCR_ADRFE), err, TAG, "RXQCR write failed"); +@@ -650,13 +650,13 @@ static esp_err_t emac_ksz8851_set_promiscuous(esp_eth_mac_t *mac, bool enable) + if (enable) { + // NOTE(v.chistyakov): set promiscuous mode + ESP_LOGD(TAG, "setting promiscuous mode"); +- rxcr1 |= RXCR1_RXINVF | RXCR1_RXAE; ++ rxcr1 |= RXCR1_RXAE | RXCR1_RXINVF; + rxcr1 &= ~(RXCR1_RXPAFMA | RXCR1_RXMAFMA); + } else { + // NOTE(v.chistyakov): set hash perfect (default) +- ESP_LOGD(TAG, "setting hash perfect mode"); +- rxcr1 |= RXCR1_RXPAFMA; +- rxcr1 &= ~(RXCR1_RXINVF | RXCR1_RXAE | RXCR1_RXMAFMA); ++ ESP_LOGD(TAG, "setting perfect with multicast passed"); ++ rxcr1 |= RXCR1_RXAE| RXCR1_RXPAFMA | RXCR1_RXMAFMA; ++ rxcr1 &= ~RXCR1_RXINVF; + } + ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_RXCR1, rxcr1), err, TAG, "RXCR1 write failed"); + err: +diff --git a/components/esp_eth/src/esp_eth_phy_802_3.c b/components/esp_eth/src/esp_eth_phy_802_3.c +index 51a10fd551820bda41db581a3f65d63f63306972..785a0c0feb7725e5f9ce7174220d4df37cb14b45 100644 +--- a/components/esp_eth/src/esp_eth_phy_802_3.c ++++ b/components/esp_eth/src/esp_eth_phy_802_3.c +@@ -302,16 +302,18 @@ esp_err_t esp_eth_phy_802_3_detect_phy_addr(esp_eth_mediator_t *eth, int *detect + } + int addr_try = 0; + uint32_t reg_value = 0; +- for (; addr_try < 16; addr_try++) { +- eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value); +- if (reg_value != 0xFFFF && reg_value != 0x00) { +- *detected_addr = addr_try; +- break; ++ for (int i = 0; i < 3; i++){ ++ for (addr_try = 0; addr_try < 32; addr_try++) { ++ eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value); ++ if (reg_value != 0xFFFF && reg_value != 0x00) { ++ *detected_addr = addr_try; ++ break; ++ } ++ } ++ if (addr_try < 32) { ++ ESP_LOGD(TAG, "Found PHY address: %d", addr_try); ++ return ESP_OK; + } +- } +- if (addr_try < 16) { +- ESP_LOGD(TAG, "Found PHY address: %d", addr_try); +- return ESP_OK; + } + ESP_LOGE(TAG, "No PHY device detected"); + return ESP_ERR_NOT_FOUND; +diff --git a/components/esp_eth/src/esp_eth_phy_dm9051.c b/components/esp_eth/src/esp_eth_phy_dm9051.c +index d8f9bad9fc8a4da396f65c47f283335bf5448b2f..6db49f8fad0adacf78c52e78525b856bfb53b643 100644 +--- a/components/esp_eth/src/esp_eth_phy_dm9051.c ++++ b/components/esp_eth/src/esp_eth_phy_dm9051.c +@@ -95,7 +95,7 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051) + eth_duplex_t duplex = ETH_DUPLEX_HALF; + uint32_t peer_pause_ability = false; + bmsr_reg_t bmsr; +- dscsr_reg_t dscsr; ++ bmcr_reg_t bmcr; + anlpar_reg_t anlpar; + // BMSR is a latch low register + // after power up, the first latched value must be 0, which means down +@@ -108,17 +108,9 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051) + if (dm9051->phy_802_3.link_status != link) { + /* when link up, read negotiation result */ + if (link == ETH_LINK_UP) { +- ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_DSCSR_REG_ADDR, &(dscsr.val)), err, TAG, "read DSCSR failed"); +- if (dscsr.fdx100 || dscsr.hdx100) { +- speed = ETH_SPEED_100M; +- } else { +- speed = ETH_SPEED_10M; +- } +- if (dscsr.fdx100 || dscsr.fdx10) { +- duplex = ETH_DUPLEX_FULL; +- } else { +- duplex = ETH_DUPLEX_HALF; +- } ++ ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed"); ++ speed = bmcr.speed_select == 1 ? ETH_SPEED_100M : ETH_SPEED_10M; ++ duplex = bmcr.duplex_mode == 1 ? ETH_DUPLEX_FULL : ETH_DUPLEX_HALF; + ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_SPEED, (void *)speed), err, TAG, "change speed failed"); + ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_DUPLEX, (void *)duplex), err, TAG, "change duplex failed"); + /* if we're in duplex mode, and peer has the flow control ability */ From 4248169e5a8a9d4b5bc0e2669468abfc6a795c06 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:38:32 +0100 Subject: [PATCH 308/636] Update esp32s2_i2c_ll_master_init.diff --- patches/esp32s2_i2c_ll_master_init.diff | 126 ++++-------------------- 1 file changed, 17 insertions(+), 109 deletions(-) diff --git a/patches/esp32s2_i2c_ll_master_init.diff b/patches/esp32s2_i2c_ll_master_init.diff index da7f8691b..2a129c695 100644 --- a/patches/esp32s2_i2c_ll_master_init.diff +++ b/patches/esp32s2_i2c_ll_master_init.diff @@ -1,109 +1,17 @@ -diff --git a/components/esp_eth/src/esp_eth_mac_esp.c b/components/esp_eth/src/esp_eth_mac_esp.c -index 7704d9ac48cbe572aefcacd24bfcf6097a9a0562..d59e1e33b4ab3d8a9bde7527ec8f68175bf5dc1e 100644 ---- a/components/esp_eth/src/esp_eth_mac_esp.c -+++ b/components/esp_eth/src/esp_eth_mac_esp.c -@@ -634,7 +634,6 @@ esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config - emac->smi_mdio_gpio_num = esp32_config->smi_mdio_gpio_num; - emac->flow_control_high_water_mark = FLOW_CONTROL_HIGH_WATER_MARK; - emac->flow_control_low_water_mark = FLOW_CONTROL_LOW_WATER_MARK; -- emac->use_apll = false; - emac->parent.set_mediator = emac_esp32_set_mediator; - emac->parent.init = emac_esp32_init; - emac->parent.deinit = emac_esp32_deinit; -diff --git a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -index 10ab357fc4c68141361e5038af1856fa769fe168..473195a83b236236a604f26f5ce1765eed2c1d91 100644 ---- a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -+++ b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -@@ -298,7 +298,7 @@ static esp_err_t init_set_defaults(emac_ksz8851snl_t *emac) - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDTTR, RXDTTR_INIT_VALUE), err, TAG, "RXDTTR write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDBCTR, RXDBCTR_INIT_VALUE), err, TAG, "RXDBCTR write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR1, -- RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE | RXCR1_RXME), err, TAG, "RXCR1 write failed"); -+ RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXUE | RXCR1_RXME | RXCR1_RXMAFMA | RXCR1_RXAE), err, TAG, "RXCR1 write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR2, - (4 << RXCR2_SRDBL_SHIFT) | RXCR2_IUFFP | RXCR2_RXIUFCEZ | RXCR2_UDPLFE | RXCR2_RXICMPFCC), err, TAG, "RXCR2 write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_RXFCTE | RXQCR_ADRFE), err, TAG, "RXQCR write failed"); -@@ -650,13 +650,13 @@ static esp_err_t emac_ksz8851_set_promiscuous(esp_eth_mac_t *mac, bool enable) - if (enable) { - // NOTE(v.chistyakov): set promiscuous mode - ESP_LOGD(TAG, "setting promiscuous mode"); -- rxcr1 |= RXCR1_RXINVF | RXCR1_RXAE; -+ rxcr1 |= RXCR1_RXAE | RXCR1_RXINVF; - rxcr1 &= ~(RXCR1_RXPAFMA | RXCR1_RXMAFMA); - } else { - // NOTE(v.chistyakov): set hash perfect (default) -- ESP_LOGD(TAG, "setting hash perfect mode"); -- rxcr1 |= RXCR1_RXPAFMA; -- rxcr1 &= ~(RXCR1_RXINVF | RXCR1_RXAE | RXCR1_RXMAFMA); -+ ESP_LOGD(TAG, "setting perfect with multicast passed"); -+ rxcr1 |= RXCR1_RXAE| RXCR1_RXPAFMA | RXCR1_RXMAFMA; -+ rxcr1 &= ~RXCR1_RXINVF; - } - ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_RXCR1, rxcr1), err, TAG, "RXCR1 write failed"); - err: -diff --git a/components/esp_eth/src/esp_eth_phy_802_3.c b/components/esp_eth/src/esp_eth_phy_802_3.c -index 51a10fd551820bda41db581a3f65d63f63306972..785a0c0feb7725e5f9ce7174220d4df37cb14b45 100644 ---- a/components/esp_eth/src/esp_eth_phy_802_3.c -+++ b/components/esp_eth/src/esp_eth_phy_802_3.c -@@ -302,16 +302,18 @@ esp_err_t esp_eth_phy_802_3_detect_phy_addr(esp_eth_mediator_t *eth, int *detect - } - int addr_try = 0; - uint32_t reg_value = 0; -- for (; addr_try < 16; addr_try++) { -- eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value); -- if (reg_value != 0xFFFF && reg_value != 0x00) { -- *detected_addr = addr_try; -- break; -+ for (int i = 0; i < 3; i++){ -+ for (addr_try = 0; addr_try < 32; addr_try++) { -+ eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value); -+ if (reg_value != 0xFFFF && reg_value != 0x00) { -+ *detected_addr = addr_try; -+ break; -+ } -+ } -+ if (addr_try < 32) { -+ ESP_LOGD(TAG, "Found PHY address: %d", addr_try); -+ return ESP_OK; - } -- } -- if (addr_try < 16) { -- ESP_LOGD(TAG, "Found PHY address: %d", addr_try); -- return ESP_OK; - } - ESP_LOGE(TAG, "No PHY device detected"); - return ESP_ERR_NOT_FOUND; -diff --git a/components/esp_eth/src/esp_eth_phy_dm9051.c b/components/esp_eth/src/esp_eth_phy_dm9051.c -index d8f9bad9fc8a4da396f65c47f283335bf5448b2f..6db49f8fad0adacf78c52e78525b856bfb53b643 100644 ---- a/components/esp_eth/src/esp_eth_phy_dm9051.c -+++ b/components/esp_eth/src/esp_eth_phy_dm9051.c -@@ -95,7 +95,7 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051) - eth_duplex_t duplex = ETH_DUPLEX_HALF; - uint32_t peer_pause_ability = false; - bmsr_reg_t bmsr; -- dscsr_reg_t dscsr; -+ bmcr_reg_t bmcr; - anlpar_reg_t anlpar; - // BMSR is a latch low register - // after power up, the first latched value must be 0, which means down -@@ -108,17 +108,9 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051) - if (dm9051->phy_802_3.link_status != link) { - /* when link up, read negotiation result */ - if (link == ETH_LINK_UP) { -- ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_DSCSR_REG_ADDR, &(dscsr.val)), err, TAG, "read DSCSR failed"); -- if (dscsr.fdx100 || dscsr.hdx100) { -- speed = ETH_SPEED_100M; -- } else { -- speed = ETH_SPEED_10M; -- } -- if (dscsr.fdx100 || dscsr.fdx10) { -- duplex = ETH_DUPLEX_FULL; -- } else { -- duplex = ETH_DUPLEX_HALF; -- } -+ ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed"); -+ speed = bmcr.speed_select == 1 ? ETH_SPEED_100M : ETH_SPEED_10M; -+ duplex = bmcr.duplex_mode == 1 ? ETH_DUPLEX_FULL : ETH_DUPLEX_HALF; - ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_SPEED, (void *)speed), err, TAG, "change speed failed"); - ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_DUPLEX, (void *)duplex), err, TAG, "change duplex failed"); - /* if we're in duplex mode, and peer has the flow control ability */ +diff --git a/components/hal/esp32s2/include/hal/i2c_ll.h b/components/hal/esp32s2/include/hal/i2c_ll.h +index f9a66b61d6..2f669b68c0 100644 +--- a/components/hal/esp32s2/include/hal/i2c_ll.h ++++ b/components/hal/esp32s2/include/hal/i2c_ll.h +@@ -653,10 +653,12 @@ static inline void i2c_ll_enable_controller_clock(i2c_dev_t *hw, bool en) + static inline void i2c_ll_master_init(i2c_dev_t *hw) + { + typeof(hw->ctr) ctrl_reg; ++ uint32_t ref_always_on = hw->ctr.ref_always_on; + ctrl_reg.val = 0; + ctrl_reg.ms_mode = 1; + ctrl_reg.sda_force_out = 1; + ctrl_reg.scl_force_out = 1; ++ ctrl_reg.ref_always_on = ref_always_on; + hw->ctr.val = ctrl_reg.val; + } + From b5a608416865a78c37a2ad3277bf8cbf0b72cf25 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:39:30 +0100 Subject: [PATCH 309/636] Update eth_multicast.diff --- patches/eth_multicast.diff | 110 ++++++++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/patches/eth_multicast.diff b/patches/eth_multicast.diff index 8b1378917..da7f8691b 100644 --- a/patches/eth_multicast.diff +++ b/patches/eth_multicast.diff @@ -1 +1,109 @@ - +diff --git a/components/esp_eth/src/esp_eth_mac_esp.c b/components/esp_eth/src/esp_eth_mac_esp.c +index 7704d9ac48cbe572aefcacd24bfcf6097a9a0562..d59e1e33b4ab3d8a9bde7527ec8f68175bf5dc1e 100644 +--- a/components/esp_eth/src/esp_eth_mac_esp.c ++++ b/components/esp_eth/src/esp_eth_mac_esp.c +@@ -634,7 +634,6 @@ esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config + emac->smi_mdio_gpio_num = esp32_config->smi_mdio_gpio_num; + emac->flow_control_high_water_mark = FLOW_CONTROL_HIGH_WATER_MARK; + emac->flow_control_low_water_mark = FLOW_CONTROL_LOW_WATER_MARK; +- emac->use_apll = false; + emac->parent.set_mediator = emac_esp32_set_mediator; + emac->parent.init = emac_esp32_init; + emac->parent.deinit = emac_esp32_deinit; +diff --git a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c +index 10ab357fc4c68141361e5038af1856fa769fe168..473195a83b236236a604f26f5ce1765eed2c1d91 100644 +--- a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c ++++ b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c +@@ -298,7 +298,7 @@ static esp_err_t init_set_defaults(emac_ksz8851snl_t *emac) + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDTTR, RXDTTR_INIT_VALUE), err, TAG, "RXDTTR write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDBCTR, RXDBCTR_INIT_VALUE), err, TAG, "RXDBCTR write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR1, +- RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE | RXCR1_RXME), err, TAG, "RXCR1 write failed"); ++ RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXUE | RXCR1_RXME | RXCR1_RXMAFMA | RXCR1_RXAE), err, TAG, "RXCR1 write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR2, + (4 << RXCR2_SRDBL_SHIFT) | RXCR2_IUFFP | RXCR2_RXIUFCEZ | RXCR2_UDPLFE | RXCR2_RXICMPFCC), err, TAG, "RXCR2 write failed"); + ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_RXFCTE | RXQCR_ADRFE), err, TAG, "RXQCR write failed"); +@@ -650,13 +650,13 @@ static esp_err_t emac_ksz8851_set_promiscuous(esp_eth_mac_t *mac, bool enable) + if (enable) { + // NOTE(v.chistyakov): set promiscuous mode + ESP_LOGD(TAG, "setting promiscuous mode"); +- rxcr1 |= RXCR1_RXINVF | RXCR1_RXAE; ++ rxcr1 |= RXCR1_RXAE | RXCR1_RXINVF; + rxcr1 &= ~(RXCR1_RXPAFMA | RXCR1_RXMAFMA); + } else { + // NOTE(v.chistyakov): set hash perfect (default) +- ESP_LOGD(TAG, "setting hash perfect mode"); +- rxcr1 |= RXCR1_RXPAFMA; +- rxcr1 &= ~(RXCR1_RXINVF | RXCR1_RXAE | RXCR1_RXMAFMA); ++ ESP_LOGD(TAG, "setting perfect with multicast passed"); ++ rxcr1 |= RXCR1_RXAE| RXCR1_RXPAFMA | RXCR1_RXMAFMA; ++ rxcr1 &= ~RXCR1_RXINVF; + } + ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_RXCR1, rxcr1), err, TAG, "RXCR1 write failed"); + err: +diff --git a/components/esp_eth/src/esp_eth_phy_802_3.c b/components/esp_eth/src/esp_eth_phy_802_3.c +index 51a10fd551820bda41db581a3f65d63f63306972..785a0c0feb7725e5f9ce7174220d4df37cb14b45 100644 +--- a/components/esp_eth/src/esp_eth_phy_802_3.c ++++ b/components/esp_eth/src/esp_eth_phy_802_3.c +@@ -302,16 +302,18 @@ esp_err_t esp_eth_phy_802_3_detect_phy_addr(esp_eth_mediator_t *eth, int *detect + } + int addr_try = 0; + uint32_t reg_value = 0; +- for (; addr_try < 16; addr_try++) { +- eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value); +- if (reg_value != 0xFFFF && reg_value != 0x00) { +- *detected_addr = addr_try; +- break; ++ for (int i = 0; i < 3; i++){ ++ for (addr_try = 0; addr_try < 32; addr_try++) { ++ eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value); ++ if (reg_value != 0xFFFF && reg_value != 0x00) { ++ *detected_addr = addr_try; ++ break; ++ } ++ } ++ if (addr_try < 32) { ++ ESP_LOGD(TAG, "Found PHY address: %d", addr_try); ++ return ESP_OK; + } +- } +- if (addr_try < 16) { +- ESP_LOGD(TAG, "Found PHY address: %d", addr_try); +- return ESP_OK; + } + ESP_LOGE(TAG, "No PHY device detected"); + return ESP_ERR_NOT_FOUND; +diff --git a/components/esp_eth/src/esp_eth_phy_dm9051.c b/components/esp_eth/src/esp_eth_phy_dm9051.c +index d8f9bad9fc8a4da396f65c47f283335bf5448b2f..6db49f8fad0adacf78c52e78525b856bfb53b643 100644 +--- a/components/esp_eth/src/esp_eth_phy_dm9051.c ++++ b/components/esp_eth/src/esp_eth_phy_dm9051.c +@@ -95,7 +95,7 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051) + eth_duplex_t duplex = ETH_DUPLEX_HALF; + uint32_t peer_pause_ability = false; + bmsr_reg_t bmsr; +- dscsr_reg_t dscsr; ++ bmcr_reg_t bmcr; + anlpar_reg_t anlpar; + // BMSR is a latch low register + // after power up, the first latched value must be 0, which means down +@@ -108,17 +108,9 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051) + if (dm9051->phy_802_3.link_status != link) { + /* when link up, read negotiation result */ + if (link == ETH_LINK_UP) { +- ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_DSCSR_REG_ADDR, &(dscsr.val)), err, TAG, "read DSCSR failed"); +- if (dscsr.fdx100 || dscsr.hdx100) { +- speed = ETH_SPEED_100M; +- } else { +- speed = ETH_SPEED_10M; +- } +- if (dscsr.fdx100 || dscsr.fdx10) { +- duplex = ETH_DUPLEX_FULL; +- } else { +- duplex = ETH_DUPLEX_HALF; +- } ++ ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed"); ++ speed = bmcr.speed_select == 1 ? ETH_SPEED_100M : ETH_SPEED_10M; ++ duplex = bmcr.duplex_mode == 1 ? ETH_DUPLEX_FULL : ETH_DUPLEX_HALF; + ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_SPEED, (void *)speed), err, TAG, "change speed failed"); + ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_DUPLEX, (void *)duplex), err, TAG, "change duplex failed"); + /* if we're in duplex mode, and peer has the flow control ability */ From 7786b7a79c03b55099858927508aacc2b3f9e2b0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:43:23 +0100 Subject: [PATCH 310/636] Update config.sh --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index b50fe1591..7c9723443 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -177,7 +177,7 @@ function git_create_pr(){ # git_create_pr <branch> <title> local pr_title="$2" local pr_target="$3" local pr_body="" - pr_body+=$(cat "$AR_TOOLS/esp32-arduino-libs/versions.txt")"\r\n" + pr_body+="\`\`\`\r\n"$(cat "$AR_TOOLS/esp32-arduino-libs/versions.txt")"\r\n\`\`\`\r\n" local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" 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"` local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` From 3ccc3397d7e8d0b9c595f9586c153417c6224482 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:41:40 +0100 Subject: [PATCH 311/636] rm component examples --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 10c9ac331..109ecf6fc 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -25,6 +25,7 @@ cp -f ../components/arduino/Kco* arduino-esp32 cp -f ../components/arduino/pac* arduino-esp32 rm -rf arduino-esp32/docs rm -rf arduino-esp32/tests +rm -rf arduino-esp32/idf_component_examples rm -rf arduino-esp32/libraries/RainMaker rm -rf arduino-esp32/libraries/Insights rm -rf arduino-esp32/libraries/ESP_I2S From e1fca29c915ba1dc167ec4a7ead66af368b92e24 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:07:51 +0100 Subject: [PATCH 312/636] versions.txt --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 7c9723443..4db94e1b2 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -177,7 +177,7 @@ function git_create_pr(){ # git_create_pr <branch> <title> local pr_title="$2" local pr_target="$3" local pr_body="" - pr_body+="\`\`\`\r\n"$(cat "$AR_TOOLS/esp32-arduino-libs/versions.txt")"\r\n\`\`\`\r\n" + while read -r line; do pr_body+=$line"\r\n"; done < "$AR_TOOLS/esp32-arduino-libs/versions.txt" local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" 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"` local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` From 7742cdcf1c9a27ad2c80779cc6c133a40436cc62 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:52:10 +0100 Subject: [PATCH 313/636] CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 6a7da076b..8dfa7a1b2 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -33,6 +33,7 @@ CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048 CONFIG_ESP_TASK_WDT_PANIC=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y CONFIG_ESP_WIFI_FTM_ENABLE=n CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 From 2766ee3bc11cf68fcb38ca76d2096371ee454952 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:24:14 +0100 Subject: [PATCH 314/636] V5.1 git clone optimize --- build.sh | 12 +++++------ tools/config.sh | 10 +++------ tools/install-arduino.sh | 37 +++++++++++++++++++++++++++------- tools/install-esp-idf.sh | 39 ++++++++++++++++++++++++++++++++---- tools/repository_dispatch.sh | 2 +- tools/update-components.sh | 35 +++++++++++--------------------- 6 files changed, 87 insertions(+), 48 deletions(-) diff --git a/build.sh b/build.sh index bca5e2e97..506493276 100755 --- a/build.sh +++ b/build.sh @@ -63,11 +63,11 @@ while getopts ":A:I:i:c:t:b:sde" opt; do ;; b ) b=$OPTARG - if [ "$b" != "build" ] && - [ "$b" != "menuconfig" ] && - [ "$b" != "reconfigure" ] && - [ "$b" != "idf_libs" ] && - [ "$b" != "copy_bootloader" ] && + if [ "$b" != "build" ] && + [ "$b" != "menuconfig" ] && + [ "$b" != "reconfigure" ] && + [ "$b" != "idf_libs" ] && + [ "$b" != "copy_bootloader" ] && [ "$b" != "mem_variant" ]; then print_help fi @@ -114,7 +114,7 @@ if [ "$BUILD_TYPE" != "all" ]; then print_help fi configs="configs/defconfig.common;configs/defconfig.$TARGET" - + # Target Features Configs for target_json in `jq -c '.targets[]' configs/builds.json`; do target=$(echo "$target_json" | jq -c '.target' | tr -d '"') diff --git a/tools/config.sh b/tools/config.sh index 4db94e1b2..fe8a65d4f 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -14,11 +14,6 @@ if [ -z $AR_BRANCH ]; then AR_BRANCH="main" fi -if [ -z $AR_PR_TARGET_BRANCH ]; then - # Temporary to get CI working. original is master - AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs" -fi - if [ -z $IDF_TARGET ]; then if [ -f sdkconfig ]; then IDF_TARGET=`cat sdkconfig | grep CONFIG_IDF_TARGET= | cut -d'"' -f2` @@ -34,7 +29,7 @@ fi AR_USER="tasmota" # IDF commit to use -#IDF_COMMIT="ec31b4d09d3da05001648eaa58aa582c5cc923c8" +#IDF_COMMIT="" # Arduino commit to use #AR_COMMIT="" @@ -176,8 +171,9 @@ function git_create_pr(){ # git_create_pr <branch> <title> local pr_branch="$1" local pr_title="$2" local pr_target="$3" - local pr_body="" + local pr_body="\`\`\`\r\n" while read -r line; do pr_body+=$line"\r\n"; done < "$AR_TOOLS/esp32-arduino-libs/versions.txt" + pr_body+="\`\`\`\r\n" local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" 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"` local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 78668b7f3..93b53a6e2 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -5,9 +5,38 @@ source ./tools/config.sh # # CLONE/UPDATE ARDUINO # -echo "Updating ESP32 Arduino..." +if [ "$AR_BRANCH" ]; then + echo "Installing Arduino from branch '$AR_BRANCH'" + if [ ! -d "$AR_COMPS/arduino" ]; then + # for using a branch we need no full clone + git clone -b "$AR_BRANCH" --recursive --depth 1 --shallow-submodule $AR_REPO_URL "$AR_COMPS/arduino" + else + # update existing branch + cd "$AR_COMPS/arduino" + git pull + git reset --hard $AR_BRANCH + # -ff is for cleaning untracked files as well as submodules + git clean -ffdx + cd - + fi +fi + if [ ! -d "$AR_COMPS/arduino" ]; then + # we need a full clone since no branch was set + echo "Full cloning of ESP32 Arduino repo '$AR_REPO_URL'" git clone $AR_REPO_URL "$AR_COMPS/arduino" +else + if [ "$AR_BRANCH" ]; then + echo "ESP32 Arduino is up to date" + else + # update existing branch + echo "Updating ESP32 Arduino" + cd "$AR_COMPS/arduino" + git pull + # -ff is for cleaning untracked files as well as submodules + git clean -ffdx + cd - + fi fi if [ -z $AR_BRANCH ]; then @@ -39,12 +68,6 @@ if [ -z $AR_BRANCH ]; then fi fi -if [ "$AR_BRANCH" ]; then - echo "AR_BRANCH='$AR_BRANCH'" - git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \ - git -C "$AR_COMPS/arduino" fetch && \ - git -C "$AR_COMPS/arduino" pull --ff-only -fi if [ $? -ne 0 ]; then exit 1; fi # diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 9175b83dc..e3433e9c1 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -10,11 +10,42 @@ fi # # CLONE ESP-IDF # +if [ "$IDF_TAG" ] || [ "$IDF_COMMIT" ]; then + if [ ! -d "$IDF_PATH" ]; then + # full clone needed to check out tag or commit + echo "ESP-IDF is not installed! Installing with full clone from $IDF_REPO_URL branch $IDF_BRANCH" + git clone $IDF_REPO_URL -b $IDF_BRANCH + idf_was_installed="1" + else + # update local clone + echo "ESP-IDF is installed, updating..." + cd $IDF_PATH + git pull + git reset --hard $IDF_BRANCH + git submodule update + # -ff is for cleaning untracked files as well as submodules + git clean -ffdx + cd - + idf_was_installed="1" + fi +fi if [ ! -d "$IDF_PATH" ]; then - echo "ESP-IDF is not installed! Installing from $IDF_REPO_URL branch $IDF_BRANCH" - git clone $IDF_REPO_URL -b $IDF_BRANCH - idf_was_installed="1" + # for using a branch we need no full clone + echo "ESP-IDF is not installed! Installing branch $IDF_BRANCH from $IDF_REPO_URL" + git clone -b $IDF_BRANCH --recursive --depth 1 --shallow-submodule $IDF_REPO_URL + idf_was_installed="1" +else + # update existing branch + echo "ESP-IDF is already installed, updating branch '$IDF_BRANCH'" + cd $IDF_PATH + git pull + git reset --hard $IDF_BRANCH + git submodule update --depth 1 + # -ff is for cleaning untracked files as well as submodules + git clean -ffdx + cd - + idf_was_installed="1" fi if [ "$IDF_TAG" ]; then @@ -30,7 +61,7 @@ fi # if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then - git -C $IDF_PATH submodule update --init --recursive + git submodule update --recursive $IDF_PATH/install.sh export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) diff --git a/tools/repository_dispatch.sh b/tools/repository_dispatch.sh index 15198e98e..ad23620a8 100755 --- a/tools/repository_dispatch.sh +++ b/tools/repository_dispatch.sh @@ -14,7 +14,7 @@ commit=`echo "$payload" | jq -r '.commit'` builder=`echo "$payload" | jq -r '.builder'` arduino=`echo "$payload" | jq -r '.arduino'` -echo "Action: $action, Branch: $branch, Tag: $tag, Commit: $commit, Builder: $builder, Arduino: $arduino, Actor: $GITHUB_ACTOR" +echo "Action: $action, IDF Branch: $branch, IDF Tag: $tag, IDF Commit: $commit, Builder Branch: $builder, Arduino Branch: $arduino, Actor: $GITHUB_ACTOR" if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then echo "Bad Action $action" diff --git a/tools/update-components.sh b/tools/update-components.sh index d2d819fdd..9fdbb8ea6 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -3,7 +3,6 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" -LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" @@ -12,10 +11,14 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" # echo "Updating ESP32 Camera..." if [ ! -d "$AR_COMPS/esp32-camera" ]; then - git clone $CAMERA_REPO_URL "$AR_COMPS/esp32-camera" + git clone -b master --recursive --depth 1 --shallow-submodule $CAMERA_REPO_URL "$AR_COMPS/esp32-camera" else - git -C "$AR_COMPS/esp32-camera" fetch && \ - git -C "$AR_COMPS/esp32-camera" pull --ff-only + cd "$AR_COMPS/esp32-camera" + git pull + git submodule update --depth 1 + # -ff is for cleaning untracked files as well as submodules + git clean -ffdx + cd - fi if [ $? -ne 0 ]; then exit 1; fi @@ -24,30 +27,16 @@ if [ $? -ne 0 ]; then exit 1; fi # cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" -# -# CLONE/UPDATE ESP-LITTLEFS v1.10.0 commit 032f9... -# -#echo "Updating ESP-LITTLEFS..." -#if [ ! -d "$AR_COMPS/esp_littlefs" ]; then -# git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" -# git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495 -# git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive -#else -# git -C "$AR_COMPS/esp_littlefs" fetch -# git -C "$AR_COMPS/esp_littlefs" pull --ff-only -# git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495 -# git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive -#fi -#if [ $? -ne 0 ]; then exit 1; fi - # # CLONE/UPDATE TINYUSB # echo "Updating TinyUSB..." if [ ! -d "$TINYUSB_REPO_DIR" ]; then - git clone "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" + git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" else - git -C "$TINYUSB_REPO_DIR" fetch && \ - git -C "$TINYUSB_REPO_DIR" pull --ff-only + cd $TINYUSB_REPO_DIR + git pull + # -ff is for cleaning untracked files as well as submodules + git clean -ffdx fi if [ $? -ne 0 ]; then exit 1; fi From 2cb2c2d0dff07d03bcd6878f945e14bf234b094a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:02:23 +0100 Subject: [PATCH 315/636] Update defconfig.esp32s3 --- configs/defconfig.esp32s3 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 3ac337072..0a4aae470 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,3 +1,7 @@ +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_TYPE_RISCV=y +CONFIG_ULP_COPROC_RESERVE_MEM=4096 + CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y From 11526161b9a4fd59ffd9595ac64861d70a65edef Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:03:12 +0100 Subject: [PATCH 316/636] Update defconfig.esp32s2 --- configs/defconfig.esp32s2 | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index aa6d3ed5f..7aad2865d 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -2,6 +2,7 @@ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y CONFIG_ESP32S2_KEEP_USB_ALIVE=y +CONFIG_ULP_COPROC_ENABLED=y CONFIG_ESP32_ULP_COPROC_RISCV=y CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4096 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set From b8d5dfc09f3f61b316031a2b930ab018c69bad46 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 7 Dec 2023 22:02:34 +0100 Subject: [PATCH 317/636] Enable C6 ULP --- configs/defconfig.esp32c6 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index 76c575e4e..5aa525c0c 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -1,6 +1,11 @@ # C6 has full Newlib in Rom # CONFIG_NEWLIB_NANO_FORMAT is not set +# Enable LP Core +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_TYPE_LP_CORE=y +CONFIG_ULP_COPROC_RESERVE_MEM=8192 + # # Bluetooth # From 151d4997d254dbc75eae504c669933aaafaa30b1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Dec 2023 11:43:38 +0100 Subject: [PATCH 318/636] add URL to commit in release --- build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 506493276..14cf204ff 100755 --- a/build.sh +++ b/build.sh @@ -144,7 +144,9 @@ mkdir -p "$AR_TOOLS/esp32-arduino-libs" rm -rf release-info.txt IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") -echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt +#echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt +echo "Framework built from $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) +and [$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)" >> release-info.txt #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do From 509e184cfca5569a78568b342973ee2a026d57c3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:21:01 +0100 Subject: [PATCH 319/636] add AR repo to release.txt --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 14cf204ff..3a847ba6f 100755 --- a/build.sh +++ b/build.sh @@ -146,7 +146,7 @@ IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") #echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt echo "Framework built from $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) -and [$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)" >> release-info.txt +and $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)" >> release-info.txt #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do From 8727e71e0fffdfdb64d26a32e21f0dd64d6b6dcf Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:45:44 +0100 Subject: [PATCH 320/636] release info styling --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 3a847ba6f..99357c274 100755 --- a/build.sh +++ b/build.sh @@ -144,9 +144,9 @@ mkdir -p "$AR_TOOLS/esp32-arduino-libs" rm -rf release-info.txt IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") -#echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt -echo "Framework built from $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) -and $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)" >> release-info.txt +echo "Framework built from +- $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) +- $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)" >> release-info.txt #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do From a1ae8b34e11d11b2a58afe062927b8f9afdcc39e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 29 Dec 2023 12:56:48 +0100 Subject: [PATCH 321/636] rm SPIFFS lib --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 93b53a6e2..865dc3fbb 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -76,6 +76,7 @@ if [ $? -ne 0 ]; then exit 1; fi rm -rf "$AR_COMPS/arduino/libraries/RainMaker" rm -rf "$AR_COMPS/arduino/libraries/Insights" rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S" +rm -rf "$AR_COMPS/arduino/libraries/SPIFFS" rm -rf "$AR_COMPS/arduino/libraries/BLE" rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" rm -rf "$AR_COMPS/arduino/libraries/BluetoothSerial" From 0933a471ee5f2760b059cdcdfe9c811ea32e63e6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Jan 2024 14:08:18 +0100 Subject: [PATCH 322/636] Delete patches/eth_multicast.diff --- patches/eth_multicast.diff | 109 ------------------------------------- 1 file changed, 109 deletions(-) delete mode 100644 patches/eth_multicast.diff diff --git a/patches/eth_multicast.diff b/patches/eth_multicast.diff deleted file mode 100644 index da7f8691b..000000000 --- a/patches/eth_multicast.diff +++ /dev/null @@ -1,109 +0,0 @@ -diff --git a/components/esp_eth/src/esp_eth_mac_esp.c b/components/esp_eth/src/esp_eth_mac_esp.c -index 7704d9ac48cbe572aefcacd24bfcf6097a9a0562..d59e1e33b4ab3d8a9bde7527ec8f68175bf5dc1e 100644 ---- a/components/esp_eth/src/esp_eth_mac_esp.c -+++ b/components/esp_eth/src/esp_eth_mac_esp.c -@@ -634,7 +634,6 @@ esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config - emac->smi_mdio_gpio_num = esp32_config->smi_mdio_gpio_num; - emac->flow_control_high_water_mark = FLOW_CONTROL_HIGH_WATER_MARK; - emac->flow_control_low_water_mark = FLOW_CONTROL_LOW_WATER_MARK; -- emac->use_apll = false; - emac->parent.set_mediator = emac_esp32_set_mediator; - emac->parent.init = emac_esp32_init; - emac->parent.deinit = emac_esp32_deinit; -diff --git a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -index 10ab357fc4c68141361e5038af1856fa769fe168..473195a83b236236a604f26f5ce1765eed2c1d91 100644 ---- a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -+++ b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -@@ -298,7 +298,7 @@ static esp_err_t init_set_defaults(emac_ksz8851snl_t *emac) - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDTTR, RXDTTR_INIT_VALUE), err, TAG, "RXDTTR write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDBCTR, RXDBCTR_INIT_VALUE), err, TAG, "RXDBCTR write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR1, -- RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE | RXCR1_RXME), err, TAG, "RXCR1 write failed"); -+ RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXUE | RXCR1_RXME | RXCR1_RXMAFMA | RXCR1_RXAE), err, TAG, "RXCR1 write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR2, - (4 << RXCR2_SRDBL_SHIFT) | RXCR2_IUFFP | RXCR2_RXIUFCEZ | RXCR2_UDPLFE | RXCR2_RXICMPFCC), err, TAG, "RXCR2 write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_RXFCTE | RXQCR_ADRFE), err, TAG, "RXQCR write failed"); -@@ -650,13 +650,13 @@ static esp_err_t emac_ksz8851_set_promiscuous(esp_eth_mac_t *mac, bool enable) - if (enable) { - // NOTE(v.chistyakov): set promiscuous mode - ESP_LOGD(TAG, "setting promiscuous mode"); -- rxcr1 |= RXCR1_RXINVF | RXCR1_RXAE; -+ rxcr1 |= RXCR1_RXAE | RXCR1_RXINVF; - rxcr1 &= ~(RXCR1_RXPAFMA | RXCR1_RXMAFMA); - } else { - // NOTE(v.chistyakov): set hash perfect (default) -- ESP_LOGD(TAG, "setting hash perfect mode"); -- rxcr1 |= RXCR1_RXPAFMA; -- rxcr1 &= ~(RXCR1_RXINVF | RXCR1_RXAE | RXCR1_RXMAFMA); -+ ESP_LOGD(TAG, "setting perfect with multicast passed"); -+ rxcr1 |= RXCR1_RXAE| RXCR1_RXPAFMA | RXCR1_RXMAFMA; -+ rxcr1 &= ~RXCR1_RXINVF; - } - ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_RXCR1, rxcr1), err, TAG, "RXCR1 write failed"); - err: -diff --git a/components/esp_eth/src/esp_eth_phy_802_3.c b/components/esp_eth/src/esp_eth_phy_802_3.c -index 51a10fd551820bda41db581a3f65d63f63306972..785a0c0feb7725e5f9ce7174220d4df37cb14b45 100644 ---- a/components/esp_eth/src/esp_eth_phy_802_3.c -+++ b/components/esp_eth/src/esp_eth_phy_802_3.c -@@ -302,16 +302,18 @@ esp_err_t esp_eth_phy_802_3_detect_phy_addr(esp_eth_mediator_t *eth, int *detect - } - int addr_try = 0; - uint32_t reg_value = 0; -- for (; addr_try < 16; addr_try++) { -- eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value); -- if (reg_value != 0xFFFF && reg_value != 0x00) { -- *detected_addr = addr_try; -- break; -+ for (int i = 0; i < 3; i++){ -+ for (addr_try = 0; addr_try < 32; addr_try++) { -+ eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value); -+ if (reg_value != 0xFFFF && reg_value != 0x00) { -+ *detected_addr = addr_try; -+ break; -+ } -+ } -+ if (addr_try < 32) { -+ ESP_LOGD(TAG, "Found PHY address: %d", addr_try); -+ return ESP_OK; - } -- } -- if (addr_try < 16) { -- ESP_LOGD(TAG, "Found PHY address: %d", addr_try); -- return ESP_OK; - } - ESP_LOGE(TAG, "No PHY device detected"); - return ESP_ERR_NOT_FOUND; -diff --git a/components/esp_eth/src/esp_eth_phy_dm9051.c b/components/esp_eth/src/esp_eth_phy_dm9051.c -index d8f9bad9fc8a4da396f65c47f283335bf5448b2f..6db49f8fad0adacf78c52e78525b856bfb53b643 100644 ---- a/components/esp_eth/src/esp_eth_phy_dm9051.c -+++ b/components/esp_eth/src/esp_eth_phy_dm9051.c -@@ -95,7 +95,7 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051) - eth_duplex_t duplex = ETH_DUPLEX_HALF; - uint32_t peer_pause_ability = false; - bmsr_reg_t bmsr; -- dscsr_reg_t dscsr; -+ bmcr_reg_t bmcr; - anlpar_reg_t anlpar; - // BMSR is a latch low register - // after power up, the first latched value must be 0, which means down -@@ -108,17 +108,9 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051) - if (dm9051->phy_802_3.link_status != link) { - /* when link up, read negotiation result */ - if (link == ETH_LINK_UP) { -- ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_DSCSR_REG_ADDR, &(dscsr.val)), err, TAG, "read DSCSR failed"); -- if (dscsr.fdx100 || dscsr.hdx100) { -- speed = ETH_SPEED_100M; -- } else { -- speed = ETH_SPEED_10M; -- } -- if (dscsr.fdx100 || dscsr.fdx10) { -- duplex = ETH_DUPLEX_FULL; -- } else { -- duplex = ETH_DUPLEX_HALF; -- } -+ ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed"); -+ speed = bmcr.speed_select == 1 ? ETH_SPEED_100M : ETH_SPEED_10M; -+ duplex = bmcr.duplex_mode == 1 ? ETH_DUPLEX_FULL : ETH_DUPLEX_HALF; - ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_SPEED, (void *)speed), err, TAG, "change speed failed"); - ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_DUPLEX, (void *)duplex), err, TAG, "change duplex failed"); - /* if we're in duplex mode, and peer has the flow control ability */ From e002ad5727cae9596d2b5d9ebc3a6b240e9c1b27 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Jan 2024 14:08:27 +0100 Subject: [PATCH 323/636] Delete patches/spi_eth.diff --- patches/spi_eth.diff | 1139 ------------------------------------------ 1 file changed, 1139 deletions(-) delete mode 100644 patches/spi_eth.diff diff --git a/patches/spi_eth.diff b/patches/spi_eth.diff deleted file mode 100644 index 1e57dbef1..000000000 --- a/patches/spi_eth.diff +++ /dev/null @@ -1,1139 +0,0 @@ -diff --git a/components/esp_eth/include/esp_eth_mac.h b/components/esp_eth/include/esp_eth_mac.h -index dfc1af2c73b5e6a872a5c0583e0223ca86b49ae2..885d332d4363e093d84af1a196c532450386b8ce 100644 ---- a/components/esp_eth/include/esp_eth_mac.h -+++ b/components/esp_eth/include/esp_eth_mac.h -@@ -1,5 +1,5 @@ - /* -- * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD -+ * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -@@ -470,15 +470,113 @@ typedef struct { - esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config, const eth_mac_config_t *config); - #endif // CONFIG_ETH_USE_ESP32_EMAC - -+#if CONFIG_ETH_USE_SPI_ETHERNET -+/** -+ * @brief Custom SPI Driver Configuration. -+ * This structure declares configuration and callback functions to access Ethernet SPI module via -+ * user's custom SPI driver. -+ * -+ */ -+typedef struct -+{ -+ /** -+ * @brief Custom driver specific configuration data used by `init()` function. -+ * -+ * @note Type and its content is fully under user's control -+ * -+ */ -+ void *config; -+ -+ /** -+ * @brief Custom driver SPI Initialization -+ * -+ * @param[in] spi_config: Custom driver specific configuration -+ * -+ * @return -+ * - spi_ctx: when initialization is successful, a pointer to context structure holding all variables -+ * needed for subsequent SPI access operations (e.g. SPI bus identification, mutexes, etc.) -+ * - NULL: driver initialization failed -+ * -+ * @note return type and its content is fully under user's control -+ */ -+ void *(*init)(const void *spi_config); -+ -+ /** -+ * @brief Custom driver De-initialization -+ * -+ * @param[in] spi_ctx: a pointer to driver specific context structure -+ * -+ * @return -+ * - ESP_OK: driver de-initialization was successful -+ * - ESP_FAIL: driver de-initialization failed -+ * - any other failure codes are allowed to be used to provide failure isolation -+ */ -+ esp_err_t (*deinit)(void *spi_ctx); -+ -+ /** -+ * @brief Custom driver SPI read -+ * -+ * @note The read function is responsible to construct command, address and data fields -+ * of the SPI frame in format expected by particular SPI Ethernet module -+ * -+ * @param[in] spi_ctx: a pointer to driver specific context structure -+ * @param[in] cmd: command -+ * @param[in] addr: register address -+ * @param[out] data: read data -+ * @param[in] data_len: read data length in bytes -+ * -+ * @return -+ * - ESP_OK: read was successful -+ * - ESP_FAIL: read failed -+ * - any other failure codes are allowed to be used to provide failure isolation -+ */ -+ esp_err_t (*read)(void *spi_ctx, uint32_t cmd, uint32_t addr, void *data, uint32_t data_len); -+ -+ /** -+ * @brief Custom driver SPI write -+ * -+ * @note The write function is responsible to construct command, address and data fields -+ * of the SPI frame in format expected by particular SPI Ethernet module -+ * -+ * @param[in] spi_ctx: a pointer to driver specific context structure -+ * @param[in] cmd: command -+ * @param[in] addr: register address -+ * @param[in] data: data to write -+ * @param[in] data_len: length of data to write in bytes -+ * -+ * @return -+ * - ESP_OK: write was successful -+ * - ESP_FAIL: write failed -+ * - any other failure codes are allowed to be used to provide failure isolation -+ */ -+ esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len); -+} eth_spi_custom_driver_t; -+ -+/** -+ * @brief Default configuration of the custom SPI driver. -+ * Internal ESP-IDF SPI Master driver is used by default. -+ * -+ */ -+#define ETH_DEFAULT_SPI \ -+ { \ -+ .config = NULL, \ -+ .init = NULL, \ -+ .deinit = NULL, \ -+ .read = NULL, \ -+ .write = NULL \ -+ } -+#endif // CONFIG_ETH_USE_SPI_ETHERNET -+ - #if CONFIG_ETH_SPI_ETHERNET_DM9051 - /** - * @brief DM9051 specific configuration - * - */ - typedef struct { -- spi_host_device_t spi_host_id; /*!< SPI peripheral */ -- spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */ - int int_gpio_num; /*!< Interrupt GPIO number */ -+ spi_host_device_t spi_host_id; /*!< SPI peripheral (this field is invalid when custom SPI driver is defined) */ -+ spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration (this field is invalid when custom SPI driver is defined) */ -+ eth_spi_custom_driver_t custom_spi_driver; /*!< Custom SPI driver definitions */ - } eth_dm9051_config_t; - - /** -@@ -487,9 +585,10 @@ typedef struct { - */ - #define ETH_DM9051_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \ - { \ -+ .int_gpio_num = 4, \ - .spi_host_id = spi_host, \ - .spi_devcfg = spi_devcfg_p, \ -- .int_gpio_num = 4, \ -+ .custom_spi_driver = ETH_DEFAULT_SPI, \ - } - - /** -@@ -511,9 +610,10 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, - * - */ - typedef struct { -- spi_host_device_t spi_host_id; /*!< SPI peripheral */ -- spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */ - int int_gpio_num; /*!< Interrupt GPIO number */ -+ spi_host_device_t spi_host_id; /*!< SPI peripheral (this field is invalid when custom SPI driver is defined)*/ -+ spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration (this field is invalid when custom SPI driver is defined)*/ -+ eth_spi_custom_driver_t custom_spi_driver; /*!< Custom SPI driver definitions */ - } eth_w5500_config_t; - - /** -@@ -521,10 +621,11 @@ typedef struct { - * - */ - #define ETH_W5500_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \ -- { \ -- .spi_host_id = spi_host, \ -- .spi_devcfg = spi_devcfg_p, \ -- .int_gpio_num = 4, \ -+ { \ -+ .int_gpio_num = 4, \ -+ .spi_host_id = spi_host, \ -+ .spi_devcfg = spi_devcfg_p, \ -+ .custom_spi_driver = ETH_DEFAULT_SPI, \ - } - - /** -@@ -546,9 +647,10 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con - * - */ - typedef struct { -- spi_host_device_t spi_host_id; /*!< SPI peripheral */ -- spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */ - int int_gpio_num; /*!< Interrupt GPIO number */ -+ spi_host_device_t spi_host_id; /*!< SPI peripheral (this field is invalid when custom SPI driver is defined) */ -+ spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration (this field is invalid when custom SPI driver is defined) */ -+ eth_spi_custom_driver_t custom_spi_driver; /*!< Custom SPI driver definitions */ - } eth_ksz8851snl_config_t; - - /** -@@ -557,9 +659,10 @@ typedef struct { - */ - #define ETH_KSZ8851SNL_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \ - { \ -+ .int_gpio_num = 4, \ - .spi_host_id = spi_host, \ - .spi_devcfg = spi_devcfg_p, \ -- .int_gpio_num = 14, \ -+ .custom_spi_driver = ETH_DEFAULT_SPI, \ - } - - /** -diff --git a/components/esp_eth/src/esp_eth_mac_dm9051.c b/components/esp_eth/src/esp_eth_mac_dm9051.c -index b0d339cc93d1d6ef39b1e819102c220d431114b2..ba796121b7065ba984cfbc683283e82a6702a04a 100644 ---- a/components/esp_eth/src/esp_eth_mac_dm9051.c -+++ b/components/esp_eth/src/esp_eth_mac_dm9051.c -@@ -1,5 +1,5 @@ - /* -- * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD -+ * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -@@ -47,11 +47,23 @@ typedef struct { - uint8_t length_high; - } dm9051_rx_header_t; - -+typedef struct { -+ spi_device_handle_t hdl; -+ SemaphoreHandle_t lock; -+} spi_info_t; -+ -+typedef struct { -+ void *ctx; -+ void *(*init)(const void *spi_config); -+ esp_err_t (*deinit)(void *spi_ctx); -+ esp_err_t (*read)(void *spi_ctx, uint32_t cmd, uint32_t addr, void *data, uint32_t data_len); -+ esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len); -+} spi_interface_t; -+ - typedef struct { - esp_eth_mac_t parent; - esp_eth_mediator_t *eth; -- spi_device_handle_t spi_hdl; -- SemaphoreHandle_t spi_lock; -+ spi_interface_t spi; - TaskHandle_t rx_task_hdl; - uint32_t sw_reset_timeout_ms; - int int_gpio_num; -@@ -61,89 +73,137 @@ typedef struct { - uint8_t *rx_buffer; - } emac_dm9051_t; - --static inline bool dm9051_lock(emac_dm9051_t *emac) -+static void *dm9051_spi_init(const void *spi_config) -+{ -+ void *ret = NULL; -+ eth_dm9051_config_t *dm9051_config = (eth_dm9051_config_t *)spi_config; -+ spi_info_t *spi = calloc(1, sizeof(spi_info_t)); -+ ESP_GOTO_ON_FALSE(spi, NULL, err, TAG, "no memory for SPI context data"); -+ -+ /* SPI device init */ -+ spi_device_interface_config_t spi_devcfg; -+ spi_devcfg = *(dm9051_config->spi_devcfg); -+ if (dm9051_config->spi_devcfg->command_bits == 0 && dm9051_config->spi_devcfg->address_bits == 0) { -+ /* configure default SPI frame format */ -+ spi_devcfg.command_bits = 1; -+ spi_devcfg.address_bits = 7; -+ } else { -+ ESP_GOTO_ON_FALSE(dm9051_config->spi_devcfg->command_bits == 1 && dm9051_config->spi_devcfg->address_bits == 7, -+ NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); -+ } -+ ESP_GOTO_ON_FALSE(spi_bus_add_device(dm9051_config->spi_host_id, &spi_devcfg, &spi->hdl) == ESP_OK, -+ NULL, err, TAG, "adding device to SPI host #%d failed", dm9051_config->spi_host_id + 1); -+ -+ /* create mutex */ -+ spi->lock = xSemaphoreCreateMutex(); -+ ESP_GOTO_ON_FALSE(spi->lock, NULL, err, TAG, "create lock failed"); -+ -+ ret = spi; -+ return ret; -+err: -+ if (spi) { -+ if (spi->lock) { -+ vSemaphoreDelete(spi->lock); -+ } -+ free(spi); -+ } -+ return ret; -+} -+ -+static esp_err_t dm9051_spi_deinit(void *spi_ctx) - { -- return xSemaphoreTake(emac->spi_lock, pdMS_TO_TICKS(DM9051_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; -+ esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; -+ -+ spi_bus_remove_device(spi->hdl); -+ vSemaphoreDelete(spi->lock); -+ -+ free(spi); -+ return ret; - } - --static inline bool dm9051_unlock(emac_dm9051_t *emac) -+static inline bool dm9051_spi_lock(spi_info_t *spi) - { -- return xSemaphoreGive(emac->spi_lock) == pdTRUE; -+ return xSemaphoreTake(spi->lock, pdMS_TO_TICKS(DM9051_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; - } - --/** -- * @brief write value to dm9051 internal register -- */ --static esp_err_t dm9051_register_write(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t value) -+static inline bool dm9051_spi_unlock(spi_info_t *spi) -+{ -+ return xSemaphoreGive(spi->lock) == pdTRUE; -+} -+ -+static esp_err_t dm9051_spi_write(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) - { - esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; -+ - spi_transaction_t trans = { -- .cmd = DM9051_SPI_WR, -- .addr = reg_addr, -- .length = 8, -- .flags = SPI_TRANS_USE_TXDATA -+ .cmd = cmd, -+ .addr = addr, -+ .length = 8 * len, -+ .tx_buffer = value - }; -- trans.tx_data[0] = value; -- if (dm9051_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -+ if (dm9051_spi_lock(spi)) { -+ if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { - ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); - ret = ESP_FAIL; - } -- dm9051_unlock(emac); -+ dm9051_spi_unlock(spi); - } else { - ret = ESP_ERR_TIMEOUT; - } - return ret; - } - --/** -- * @brief read value from dm9051 internal register -- */ --static esp_err_t dm9051_register_read(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t *value) -+static esp_err_t dm9051_spi_read(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) - { - esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; -+ - spi_transaction_t trans = { -- .cmd = DM9051_SPI_RD, -- .addr = reg_addr, -- .length = 8, -- .flags = SPI_TRANS_USE_TXDATA | SPI_TRANS_USE_RXDATA -+ .flags = len <= 4 ? SPI_TRANS_USE_RXDATA : 0, // use direct reads for registers to prevent overwrites by 4-byte boundary writes -+ .cmd = cmd, -+ .addr = addr, -+ .length = 8 * len, -+ .rx_buffer = value - }; -- if (dm9051_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -+ if (dm9051_spi_lock(spi)) { -+ if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { - ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); - ret = ESP_FAIL; -- } else { -- *value = trans.rx_data[0]; - } -- dm9051_unlock(emac); -+ dm9051_spi_unlock(spi); - } else { - ret = ESP_ERR_TIMEOUT; - } -+ if ((trans.flags&SPI_TRANS_USE_RXDATA) && len <= 4) { -+ memcpy(value, trans.rx_data, len); // copy register values to output -+ } - return ret; - } - -+/** -+ * @brief write value to dm9051 internal register -+ */ -+static esp_err_t dm9051_register_write(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t value) -+{ -+ return emac->spi.write(emac->spi.ctx, DM9051_SPI_WR, reg_addr, &value, 1); -+} -+ -+/** -+ * @brief read value from dm9051 internal register -+ */ -+static esp_err_t dm9051_register_read(emac_dm9051_t *emac, uint8_t reg_addr, uint8_t *value) -+{ -+ return emac->spi.read(emac->spi.ctx, DM9051_SPI_RD, reg_addr, value, 1); -+} -+ - /** - * @brief write buffer to dm9051 internal memory - */ - static esp_err_t dm9051_memory_write(emac_dm9051_t *emac, uint8_t *buffer, uint32_t len) - { -- esp_err_t ret = ESP_OK; -- spi_transaction_t trans = { -- .cmd = DM9051_SPI_WR, -- .addr = DM9051_MWCMD, -- .length = len * 8, -- .tx_buffer = buffer -- }; -- if (dm9051_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -- ret = ESP_FAIL; -- } -- dm9051_unlock(emac); -- } else { -- ret = ESP_ERR_TIMEOUT; -- } -- return ret; -+ return emac->spi.write(emac->spi.ctx, DM9051_SPI_WR, DM9051_MWCMD, buffer, len); - } - - /** -@@ -151,23 +211,7 @@ static esp_err_t dm9051_memory_write(emac_dm9051_t *emac, uint8_t *buffer, uint3 - */ - static esp_err_t dm9051_memory_read(emac_dm9051_t *emac, uint8_t *buffer, uint32_t len) - { -- esp_err_t ret = ESP_OK; -- spi_transaction_t trans = { -- .cmd = DM9051_SPI_RD, -- .addr = DM9051_MRCMD, -- .length = len * 8, -- .rx_buffer = buffer -- }; -- if (dm9051_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -- ret = ESP_FAIL; -- } -- dm9051_unlock(emac); -- } else { -- ret = ESP_ERR_TIMEOUT; -- } -- return ret; -+ return emac->spi.read(emac->spi.ctx, DM9051_SPI_RD, DM9051_MRCMD, buffer, len); - } - - /** -@@ -175,23 +219,7 @@ static esp_err_t dm9051_memory_read(emac_dm9051_t *emac, uint8_t *buffer, uint32 - */ - static esp_err_t dm9051_memory_peek(emac_dm9051_t *emac, uint8_t *buffer, uint32_t len) - { -- esp_err_t ret = ESP_OK; -- spi_transaction_t trans = { -- .cmd = DM9051_SPI_RD, -- .addr = DM9051_MRCMDX1, -- .length = len * 8, -- .rx_buffer = buffer -- }; -- if (dm9051_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -- ret = ESP_FAIL; -- } -- dm9051_unlock(emac); -- } else { -- ret = ESP_ERR_TIMEOUT; -- } -- return ret; -+ return emac->spi.read(emac->spi.ctx, DM9051_SPI_RD, DM9051_MRCMDX1, buffer, len); - } - - /** -@@ -840,8 +868,7 @@ static esp_err_t emac_dm9051_del(esp_eth_mac_t *mac) - { - emac_dm9051_t *emac = __containerof(mac, emac_dm9051_t, parent); - vTaskDelete(emac->rx_task_hdl); -- spi_bus_remove_device(emac->spi_hdl); -- vSemaphoreDelete(emac->spi_lock); -+ emac->spi.deinit(emac->spi.ctx); - heap_caps_free(emac->rx_buffer); - free(emac); - return ESP_OK; -@@ -857,19 +884,6 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, - ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "calloc emac failed"); - /* dm9051 receive is driven by interrupt only for now*/ - ESP_GOTO_ON_FALSE(dm9051_config->int_gpio_num >= 0, NULL, err, TAG, "error interrupt gpio number"); -- /* SPI device init */ -- spi_device_interface_config_t spi_devcfg; -- memcpy(&spi_devcfg, dm9051_config->spi_devcfg, sizeof(spi_device_interface_config_t)); -- if (dm9051_config->spi_devcfg->command_bits == 0 && dm9051_config->spi_devcfg->address_bits == 0) { -- /* configure default SPI frame format */ -- spi_devcfg.command_bits = 1; -- spi_devcfg.address_bits = 7; -- } else { -- ESP_GOTO_ON_FALSE(dm9051_config->spi_devcfg->command_bits == 1 || dm9051_config->spi_devcfg->address_bits == 7, -- NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); -- } -- ESP_GOTO_ON_FALSE(spi_bus_add_device(dm9051_config->spi_host_id, &spi_devcfg, &emac->spi_hdl) == ESP_OK, -- NULL, err, TAG, "adding device to SPI host #%d failed", dm9051_config->spi_host_id + 1); - /* bind methods and attributes */ - emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; - emac->int_gpio_num = dm9051_config->int_gpio_num; -@@ -891,9 +905,26 @@ esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, - emac->parent.enable_flow_ctrl = emac_dm9051_enable_flow_ctrl; - emac->parent.transmit = emac_dm9051_transmit; - emac->parent.receive = emac_dm9051_receive; -- /* create mutex */ -- emac->spi_lock = xSemaphoreCreateMutex(); -- ESP_GOTO_ON_FALSE(emac->spi_lock, NULL, err, TAG, "create lock failed"); -+ -+ if (dm9051_config->custom_spi_driver.init != NULL && dm9051_config->custom_spi_driver.deinit != NULL -+ && dm9051_config->custom_spi_driver.read != NULL && dm9051_config->custom_spi_driver.write != NULL) { -+ ESP_LOGD(TAG, "Using user's custom SPI Driver"); -+ emac->spi.init = dm9051_config->custom_spi_driver.init; -+ emac->spi.deinit = dm9051_config->custom_spi_driver.deinit; -+ emac->spi.read = dm9051_config->custom_spi_driver.read; -+ emac->spi.write = dm9051_config->custom_spi_driver.write; -+ /* Custom SPI driver device init */ -+ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(dm9051_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); -+ } else { -+ ESP_LOGD(TAG, "Using default SPI Driver"); -+ emac->spi.init = dm9051_spi_init; -+ emac->spi.deinit = dm9051_spi_deinit; -+ emac->spi.read = dm9051_spi_read; -+ emac->spi.write = dm9051_spi_write; -+ /* SPI device init */ -+ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(dm9051_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); -+ } -+ - /* create dm9051 task */ - BaseType_t core_num = tskNO_AFFINITY; - if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { -@@ -913,8 +944,8 @@ err: - if (emac->rx_task_hdl) { - vTaskDelete(emac->rx_task_hdl); - } -- if (emac->spi_lock) { -- vSemaphoreDelete(emac->spi_lock); -+ if (emac->spi.ctx) { -+ emac->spi.deinit(emac->spi.ctx); - } - heap_caps_free(emac->rx_buffer); - free(emac); -diff --git a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -index b6aea4df90ead8dc2162e0735bdc310717881c97..cda12f0159835ea1cb818736bdc2611056b131ff 100644 ---- a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -+++ b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c -@@ -3,7 +3,7 @@ - * - * SPDX-License-Identifier: MIT - * -- * SPDX-FileContributor: 2021-2022 Espressif Systems (Shanghai) CO LTD -+ * SPDX-FileContributor: 2021-2023 Espressif Systems (Shanghai) CO LTD - */ - - #include <string.h> -@@ -22,10 +22,22 @@ - - #define KSZ8851_ETH_MAC_RX_BUF_SIZE_AUTO (0) - -+typedef struct { -+ spi_device_handle_t hdl; -+} spi_info_t; -+ -+typedef struct { -+ void *ctx; -+ void *(*init)(const void *spi_config); -+ esp_err_t (*deinit)(void *spi_ctx); -+ esp_err_t (*read)(void *spi_ctx, uint32_t cmd,uint32_t addr, void *data, uint32_t data_len); -+ esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len); -+} spi_interface_t; -+ - typedef struct { - esp_eth_mac_t parent; - esp_eth_mediator_t *eth; -- spi_device_handle_t spi_hdl; -+ spi_interface_t spi; - SemaphoreHandle_t spi_lock; - TaskHandle_t rx_task_hdl; - uint32_t sw_reset_timeout_ms; -@@ -73,6 +85,95 @@ IRAM_ATTR static void ksz8851_isr_handler(void *arg) - } - } - -+static void *ksz8851_spi_init(const void *spi_config) -+{ -+ void *ret = NULL; -+ eth_ksz8851snl_config_t *ksz8851snl_config = (eth_ksz8851snl_config_t *)spi_config; -+ spi_info_t *spi = calloc(1, sizeof(spi_info_t)); -+ ESP_GOTO_ON_FALSE(spi, NULL, err, TAG, "no memory for SPI context data"); -+ -+ // SPI device init -+ ESP_GOTO_ON_FALSE(spi_bus_add_device(ksz8851snl_config->spi_host_id, ksz8851snl_config->spi_devcfg, &spi->hdl) == ESP_OK, NULL, -+ err, TAG, "adding device to SPI host #%d failed", ksz8851snl_config->spi_host_id + 1); -+ ret = spi; -+ return ret; -+err: -+ if (spi) { -+ free(spi); -+ } -+ return ret; -+} -+ -+static esp_err_t ksz8851_spi_deinit(void *spi_ctx) -+{ -+ esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; -+ -+ spi_bus_remove_device(spi->hdl); -+ -+ free(spi); -+ return ret; -+} -+ -+static esp_err_t ksz8851_spi_read(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) -+{ -+ esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; -+ -+ spi_transaction_ext_t trans = { -+ .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | (len <= 4 ? SPI_TRANS_USE_RXDATA : 0), -+ .base.cmd = cmd, -+ .base.addr = addr, -+ .base.length = 8 * len, -+ .base.rx_buffer = value, -+ .command_bits = KSZ8851_SPI_COMMAND_BITS -+ }; -+ if (cmd >= KSZ8851_SPI_COMMAND_READ_FIFO) { -+ trans.address_bits = 8 - KSZ8851_SPI_COMMAND_BITS; -+ } else { -+ trans.address_bits = 16 - KSZ8851_SPI_COMMAND_BITS; -+ } -+ -+ // No need for mutex here since SPI access is protected at higher layer of this driver -+ if (spi_device_polling_transmit(spi->hdl, &trans.base) != ESP_OK) { -+ ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -+ ret = ESP_FAIL; -+ } -+ -+ if ((trans.base.flags & SPI_TRANS_USE_RXDATA) && len <= 4) { -+ memcpy(value, trans.base.rx_data, len); // copy register values to output -+ } -+ return ret; -+} -+ -+static esp_err_t ksz8851_spi_write(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) -+{ -+ esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; -+ -+ spi_transaction_ext_t trans = { -+ .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY, -+ .base.cmd = cmd, -+ .base.addr = addr, -+ .base.length = 8 * len, -+ .base.tx_buffer = value, -+ .command_bits = KSZ8851_SPI_COMMAND_BITS -+ }; -+ if (cmd >= KSZ8851_SPI_COMMAND_READ_FIFO) { -+ trans.address_bits = 8 - KSZ8851_SPI_COMMAND_BITS; -+ } else { -+ trans.address_bits = 16 - KSZ8851_SPI_COMMAND_BITS; -+ } -+ -+ // No need for mutex here since SPI access is protected at higher layer of this driver -+ if (spi_device_polling_transmit(spi->hdl, &trans.base) != ESP_OK) { -+ ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -+ ret = ESP_FAIL; -+ } -+ -+ return ret; -+} -+ - static inline bool ksz8851_mutex_lock(emac_ksz8851snl_t *emac) - { - return xSemaphoreTakeRecursive(emac->spi_lock, pdMS_TO_TICKS(KSZ8851_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; -@@ -83,70 +184,49 @@ static inline bool ksz8851_mutex_unlock(emac_ksz8851snl_t *emac) - return xSemaphoreGiveRecursive(emac->spi_lock) == pdTRUE; - } - --static esp_err_t ksz8851_read_reg(emac_ksz8851snl_t *emac, uint32_t address, uint16_t *value) -+static esp_err_t ksz8851_read_reg(emac_ksz8851snl_t *emac, uint32_t reg_addr, uint16_t *value) - { - esp_err_t ret = ESP_OK; - ESP_GOTO_ON_FALSE(value != NULL, ESP_ERR_INVALID_ARG, err, TAG, "out pointer must not be null"); -- ESP_GOTO_ON_FALSE((address & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); -+ ESP_GOTO_ON_FALSE((reg_addr & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); - -- const unsigned data_size = 16U; // NOTE(v.chistyakov): bits - // NOTE(v.chistyakov): select upper or lower word inside a dword -- const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (address & 0x2U)); -- address <<= KSZ8851_SPI_ADDR_SHIFT; -+ const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (reg_addr & 0x2U)); -+ reg_addr <<= KSZ8851_SPI_ADDR_SHIFT; - -- spi_transaction_ext_t trans = { -- .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | SPI_TRANS_USE_RXDATA, -- .base.cmd = KSZ8851_SPI_COMMAND_READ_REG, -- .base.addr = address | byte_mask, -- .base.length = data_size, -- .command_bits = KSZ8851_SPI_COMMAND_BITS, -- .address_bits = 16 - KSZ8851_SPI_COMMAND_BITS, -- }; -+ // Need to protect SPI access at higher layer of the driver since once packet transmit/receive is started (`SDA Start DMA Access` bit is set), -+ // all registers access are disabled. - if (ksz8851_mutex_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { -- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -- ret = ESP_FAIL; -- } -- ksz8851_mutex_unlock(emac); -- memcpy(value, trans.base.rx_data, data_size >> 3U); -- ESP_LOGV(TAG, "reading reg 0x%02x == 0x%04x", address, *value); -+ ret = emac->spi.read(emac->spi.ctx, KSZ8851_SPI_COMMAND_READ_REG, reg_addr | byte_mask, value, 2); - } else { - ret = ESP_ERR_TIMEOUT; - } -+ ksz8851_mutex_unlock(emac); -+ ESP_LOGV(TAG, "reading reg 0x%02x == 0x%02x", reg_addr, *value); -+ - err: - return ret; - } - --static esp_err_t ksz8851_write_reg(emac_ksz8851snl_t *emac, uint32_t address, uint16_t value) -+static esp_err_t ksz8851_write_reg(emac_ksz8851snl_t *emac, uint32_t reg_addr, uint16_t value) - { - esp_err_t ret = ESP_OK; -- ESP_GOTO_ON_FALSE((address & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); -- ESP_LOGV(TAG, "writing reg 0x%02x = 0x%04x", address, value); -+ ESP_GOTO_ON_FALSE((reg_addr & ~KSZ8851_VALID_ADDRESS_MASK) == 0U, ESP_ERR_INVALID_ARG, err, TAG, "address is out of bounds"); -+ ESP_LOGV(TAG, "writing reg 0x%02x = 0x%02x", reg_addr, value); - -- const unsigned data_size = 16U; // NOTE(v.chistyakov): bits - // NOTE(v.chistyakov): select upper or lower word inside a dword -- const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (address & 0x2U)); -- address <<= KSZ8851_SPI_ADDR_SHIFT; -+ const unsigned byte_mask = 0x3U << (KSZ8851_SPI_BYTE_MASK_SHIFT + (reg_addr & 0x2U)); -+ reg_addr <<= KSZ8851_SPI_ADDR_SHIFT; - -- spi_transaction_ext_t trans = { -- .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY | SPI_TRANS_USE_TXDATA, -- .base.cmd = KSZ8851_SPI_COMMAND_WRITE_REG, -- .base.addr = address | byte_mask, -- .base.length = data_size, -- .command_bits = KSZ8851_SPI_COMMAND_BITS, -- .address_bits = 16 - KSZ8851_SPI_COMMAND_BITS, -- }; -- -- memcpy(trans.base.tx_data, &value, data_size >> 3U); -+ // Need to protect SPI access at higher layer of the driver since once packet transmit/receive is started (`SDA Start DMA Access` bit is set), -+ // all registers access are disabled. - if (ksz8851_mutex_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { -- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -- ret = ESP_FAIL; -- } -- ksz8851_mutex_unlock(emac); -+ ret = emac->spi.write(emac->spi.ctx, KSZ8851_SPI_COMMAND_WRITE_REG, reg_addr | byte_mask, &value, 2); - } else { - ret = ESP_ERR_TIMEOUT; - } -+ ksz8851_mutex_unlock(emac); -+ - err: - return ret; - } -@@ -313,6 +393,7 @@ static esp_err_t emac_ksz8851snl_transmit(esp_eth_mac_t *mac, uint8_t *buf, uint - ESP_LOGV(TAG, "transmitting frame of size %u", length); - esp_err_t ret = ESP_OK; - emac_ksz8851snl_t *emac = __containerof(mac, emac_ksz8851snl_t, parent); -+ // Lock SPI since once `SDA Start DMA Access` bit is set, all registers access are disabled. - if (!ksz8851_mutex_lock(emac)) { - return ESP_ERR_TIMEOUT; - } -@@ -333,24 +414,12 @@ static esp_err_t emac_ksz8851snl_transmit(esp_eth_mac_t *mac, uint8_t *buf, uint - emac->tx_buffer[3] = (length >> 8U) & 0xFFU; - memcpy(emac->tx_buffer + 4U, buf, length); - -- spi_transaction_ext_t trans = { -- .base.flags = SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_CMD, -- .base.cmd = KSZ8851_SPI_COMMAND_WRITE_FIFO, -- .base.length = transmit_length * 8U, // NOTE(v.chistyakov): bits -- .base.tx_buffer = emac->tx_buffer, -- .command_bits = 2U, -- .address_bits = 6U, -- }; -- - uint16_t ier; - ESP_GOTO_ON_ERROR(ksz8851_read_reg(emac, KSZ8851_IER, &ier), err, TAG, "IER read failed"); - ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_IER, 0), err, TAG, "IER write failed"); - - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); -- if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { -- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -- ret = ESP_FAIL; -- } -+ ret = emac->spi.write(emac->spi.ctx, KSZ8851_SPI_COMMAND_WRITE_FIFO, 0, emac->tx_buffer, transmit_length); - ESP_GOTO_ON_ERROR(ksz8851_clear_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); - - ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_IER, ier), err, TAG, "IER write failed"); -@@ -438,23 +507,13 @@ static esp_err_t emac_ksz8851_receive(esp_eth_mac_t *mac, uint8_t *buf, uint32_t - - // NOTE(v.chistyakov): 4 dummy + 4 header + alignment - const unsigned receive_size = 8U + ((byte_count + 3U) & ~0x3U); -- spi_transaction_ext_t trans = { -- .base.flags = SPI_TRANS_VARIABLE_CMD | SPI_TRANS_VARIABLE_ADDR | SPI_TRANS_VARIABLE_DUMMY, -- .base.cmd = KSZ8851_SPI_COMMAND_READ_FIFO, -- .base.length = receive_size * 8U, // NOTE(v.chistyakov): bits -- .base.rx_buffer = emac->rx_buffer, -- .command_bits = 2U, -- .address_bits = 6U, -- }; -+ // Lock SPI since once `SDA Start DMA Access` bit is set, all registers access are disabled. - if (!ksz8851_mutex_lock(emac)) { - return ESP_ERR_TIMEOUT; - } - ESP_GOTO_ON_ERROR(ksz8851_clear_bits(emac, KSZ8851_RXFDPR, RXFDPR_RXFP_MASK), err, TAG, "RXFDPR write failed"); - ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); -- if (spi_device_polling_transmit(emac->spi_hdl, &trans.base) != ESP_OK) { -- ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); -- ret = ESP_FAIL; -- } -+ ret = emac->spi.read(emac->spi.ctx, KSZ8851_SPI_COMMAND_READ_FIFO, 0, emac->rx_buffer, receive_size); - ESP_GOTO_ON_ERROR(ksz8851_clear_bits(emac, KSZ8851_RXQCR, RXQCR_SDA), err, TAG, "RXQCR write failed"); - ksz8851_mutex_unlock(emac); - // NOTE(v.chistyakov): skip 4 dummy, 4 header -@@ -728,7 +787,7 @@ static esp_err_t emac_ksz8851_del(esp_eth_mac_t *mac) - { - emac_ksz8851snl_t *emac = __containerof(mac, emac_ksz8851snl_t, parent); - vTaskDelete(emac->rx_task_hdl); -- spi_bus_remove_device(emac->spi_hdl); -+ emac->spi.deinit(emac->spi.ctx); - vSemaphoreDelete(emac->spi_lock); - heap_caps_free(emac->rx_buffer); - heap_caps_free(emac->tx_buffer); -@@ -748,10 +807,6 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 - emac = calloc(1, sizeof(emac_ksz8851snl_t)); - ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "no mem for MAC instance"); - -- /* SPI device init */ -- ESP_GOTO_ON_FALSE(spi_bus_add_device(ksz8851snl_config->spi_host_id, ksz8851snl_config->spi_devcfg, &emac->spi_hdl) == ESP_OK, -- NULL, err, TAG, "adding device to SPI host #%d failed", ksz8851snl_config->spi_host_id + 1); -- - emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; - emac->int_gpio_num = ksz8851snl_config->int_gpio_num; - emac->parent.set_mediator = emac_ksz8851_set_mediator; -@@ -772,8 +827,6 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 - emac->parent.enable_flow_ctrl = emac_ksz8851_enable_flow_ctrl; - emac->parent.set_peer_pause_ability = emac_ksz8851_set_peer_pause_ability; - emac->parent.del = emac_ksz8851_del; -- emac->spi_lock = xSemaphoreCreateRecursiveMutex(); -- ESP_GOTO_ON_FALSE(emac->spi_lock, NULL, err, TAG, "create lock failed"); - emac->rx_buffer = NULL; - emac->tx_buffer = NULL; - emac->rx_buffer = heap_caps_malloc(KSZ8851_QMU_PACKET_LENGTH + KSZ8851_QMU_PACKET_PADDING, MALLOC_CAP_DMA); -@@ -781,6 +834,29 @@ esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851 - ESP_GOTO_ON_FALSE(emac->rx_buffer, NULL, err, TAG, "RX buffer allocation failed"); - ESP_GOTO_ON_FALSE(emac->tx_buffer, NULL, err, TAG, "TX buffer allocation failed"); - -+ /* create mutex */ -+ emac->spi_lock = xSemaphoreCreateRecursiveMutex(); -+ ESP_GOTO_ON_FALSE(emac->spi_lock, NULL, err, TAG, "create lock failed"); -+ -+ if (ksz8851snl_config->custom_spi_driver.init != NULL && ksz8851snl_config->custom_spi_driver.deinit != NULL -+ && ksz8851snl_config->custom_spi_driver.read != NULL && ksz8851snl_config->custom_spi_driver.write != NULL) { -+ ESP_LOGD(TAG, "Using user's custom SPI Driver"); -+ emac->spi.init = ksz8851snl_config->custom_spi_driver.init; -+ emac->spi.deinit = ksz8851snl_config->custom_spi_driver.deinit; -+ emac->spi.read = ksz8851snl_config->custom_spi_driver.read; -+ emac->spi.write = ksz8851snl_config->custom_spi_driver.write; -+ /* Custom SPI driver device init */ -+ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(ksz8851snl_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); -+ } else { -+ ESP_LOGD(TAG, "Using default SPI Driver"); -+ emac->spi.init = ksz8851_spi_init; -+ emac->spi.deinit = ksz8851_spi_deinit; -+ emac->spi.read = ksz8851_spi_read; -+ emac->spi.write = ksz8851_spi_write; -+ /* SPI device init */ -+ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(ksz8851snl_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); -+ } -+ - BaseType_t core_num = tskNO_AFFINITY; - if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { - core_num = esp_cpu_get_core_id(); -@@ -798,6 +874,9 @@ err: - if (emac->spi_lock) { - vSemaphoreDelete(emac->spi_lock); - } -+ if (emac->spi.ctx) { -+ emac->spi.deinit(emac->spi.ctx); -+ } - // NOTE(v.chistyakov): safe to call with NULL - heap_caps_free(emac->rx_buffer); - heap_caps_free(emac->tx_buffer); -diff --git a/components/esp_eth/src/esp_eth_mac_w5500.c b/components/esp_eth/src/esp_eth_mac_w5500.c -index 7a7708d0ca8bbbf77b32d9cb01ce34e57cc1f242..5b19d5cfcdfc67105809cbca33e780850b9d4fea 100644 ---- a/components/esp_eth/src/esp_eth_mac_w5500.c -+++ b/components/esp_eth/src/esp_eth_mac_w5500.c -@@ -37,11 +37,23 @@ typedef struct { - uint32_t remain; - }__attribute__((packed)) emac_w5500_auto_buf_info_t; - -+typedef struct { -+ spi_device_handle_t hdl; -+ SemaphoreHandle_t lock; -+} spi_info_t; -+ -+typedef struct { -+ void *ctx; -+ void *(*init)(const void *spi_config); -+ esp_err_t (*deinit)(void *spi_ctx); -+ esp_err_t (*read)(void *spi_ctx, uint32_t cmd,uint32_t addr, void *data, uint32_t data_len); -+ esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len); -+} spi_interface_t; -+ - typedef struct { - esp_eth_mac_t parent; - esp_eth_mediator_t *eth; -- spi_device_handle_t spi_hdl; -- SemaphoreHandle_t spi_lock; -+ spi_interface_t spi; - TaskHandle_t rx_task_hdl; - uint32_t sw_reset_timeout_ms; - int int_gpio_num; -@@ -50,64 +62,132 @@ typedef struct { - uint8_t *rx_buffer; - } emac_w5500_t; - --static inline bool w5500_lock(emac_w5500_t *emac) -+static void *w5500_spi_init(const void *spi_config) - { -- return xSemaphoreTake(emac->spi_lock, pdMS_TO_TICKS(W5500_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; -+ void *ret = NULL; -+ eth_w5500_config_t *w5500_config = (eth_w5500_config_t *)spi_config; -+ spi_info_t *spi = calloc(1, sizeof(spi_info_t)); -+ ESP_GOTO_ON_FALSE(spi, NULL, err, TAG, "no memory for SPI context data"); -+ -+ /* SPI device init */ -+ spi_device_interface_config_t spi_devcfg; -+ spi_devcfg = *(w5500_config->spi_devcfg); -+ if (w5500_config->spi_devcfg->command_bits == 0 && w5500_config->spi_devcfg->address_bits == 0) { -+ /* configure default SPI frame format */ -+ spi_devcfg.command_bits = 16; // Actually it's the address phase in W5500 SPI frame -+ spi_devcfg.address_bits = 8; // Actually it's the control phase in W5500 SPI frame -+ } else { -+ ESP_GOTO_ON_FALSE(w5500_config->spi_devcfg->command_bits == 16 && w5500_config->spi_devcfg->address_bits == 8, -+ NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); -+ } -+ ESP_GOTO_ON_FALSE(spi_bus_add_device(w5500_config->spi_host_id, &spi_devcfg, &spi->hdl) == ESP_OK, NULL, -+ err, TAG, "adding device to SPI host #%d failed", w5500_config->spi_host_id + 1); -+ /* create mutex */ -+ spi->lock = xSemaphoreCreateMutex(); -+ ESP_GOTO_ON_FALSE(spi->lock, NULL, err, TAG, "create lock failed"); -+ -+ ret = spi; -+ return ret; -+err: -+ if (spi) { -+ if (spi->lock) { -+ vSemaphoreDelete(spi->lock); -+ } -+ free(spi); -+ } -+ return ret; - } - --static inline bool w5500_unlock(emac_w5500_t *emac) -+static esp_err_t w5500_spi_deinit(void *spi_ctx) - { -- return xSemaphoreGive(emac->spi_lock) == pdTRUE; -+ esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; -+ -+ spi_bus_remove_device(spi->hdl); -+ vSemaphoreDelete(spi->lock); -+ -+ free(spi); -+ return ret; - } - --static esp_err_t w5500_write(emac_w5500_t *emac, uint32_t address, const void *value, uint32_t len) -+static inline bool w5500_spi_lock(spi_info_t *spi) -+{ -+ return xSemaphoreTake(spi->lock, pdMS_TO_TICKS(W5500_SPI_LOCK_TIMEOUT_MS)) == pdTRUE; -+} -+ -+static inline bool w5500_spi_unlock(spi_info_t *spi) -+{ -+ return xSemaphoreGive(spi->lock) == pdTRUE; -+} -+ -+static esp_err_t w5500_spi_write(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *value, uint32_t len) - { - esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; - - spi_transaction_t trans = { -- .cmd = (address >> W5500_ADDR_OFFSET), -- .addr = ((address & 0xFFFF) | (W5500_ACCESS_MODE_WRITE << W5500_RWB_OFFSET) | W5500_SPI_OP_MODE_VDM), -+ .cmd = cmd, -+ .addr = addr, - .length = 8 * len, - .tx_buffer = value - }; -- if (w5500_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -+ if (w5500_spi_lock(spi)) { -+ if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { - ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); - ret = ESP_FAIL; - } -- w5500_unlock(emac); -+ w5500_spi_unlock(spi); - } else { - ret = ESP_ERR_TIMEOUT; - } - return ret; - } - --static esp_err_t w5500_read(emac_w5500_t *emac, uint32_t address, void *value, uint32_t len) -+static esp_err_t w5500_spi_read(void *spi_ctx, uint32_t cmd, uint32_t addr, void *value, uint32_t len) - { - esp_err_t ret = ESP_OK; -+ spi_info_t *spi = (spi_info_t *)spi_ctx; - - spi_transaction_t trans = { - .flags = len <= 4 ? SPI_TRANS_USE_RXDATA : 0, // use direct reads for registers to prevent overwrites by 4-byte boundary writes -- .cmd = (address >> W5500_ADDR_OFFSET), -- .addr = ((address & 0xFFFF) | (W5500_ACCESS_MODE_READ << W5500_RWB_OFFSET) | W5500_SPI_OP_MODE_VDM), -+ .cmd = cmd, -+ .addr = addr, - .length = 8 * len, - .rx_buffer = value - }; -- if (w5500_lock(emac)) { -- if (spi_device_polling_transmit(emac->spi_hdl, &trans) != ESP_OK) { -+ if (w5500_spi_lock(spi)) { -+ if (spi_device_polling_transmit(spi->hdl, &trans) != ESP_OK) { - ESP_LOGE(TAG, "%s(%d): spi transmit failed", __FUNCTION__, __LINE__); - ret = ESP_FAIL; - } -- w5500_unlock(emac); -+ w5500_spi_unlock(spi); - } else { - ret = ESP_ERR_TIMEOUT; - } -- if ((trans.flags&SPI_TRANS_USE_RXDATA) && len <= 4) { -+ if ((trans.flags & SPI_TRANS_USE_RXDATA) && len <= 4) { - memcpy(value, trans.rx_data, len); // copy register values to output - } - return ret; - } - -+static esp_err_t w5500_read(emac_w5500_t *emac, uint32_t address, void *data, uint32_t len) -+{ -+ uint32_t cmd = (address >> W5500_ADDR_OFFSET); // Actually it's the address phase in W5500 SPI frame -+ uint32_t addr = ((address & 0xFFFF) | (W5500_ACCESS_MODE_READ << W5500_RWB_OFFSET) -+ | W5500_SPI_OP_MODE_VDM); // Actually it's the command phase in W5500 SPI frame -+ -+ return emac->spi.read(emac->spi.ctx, cmd, addr, data, len); -+} -+ -+static esp_err_t w5500_write(emac_w5500_t *emac, uint32_t address, const void *data, uint32_t len) -+{ -+ uint32_t cmd = (address >> W5500_ADDR_OFFSET); // Actually it's the address phase in W5500 SPI frame -+ uint32_t addr = ((address & 0xFFFF) | (W5500_ACCESS_MODE_WRITE << W5500_RWB_OFFSET) -+ | W5500_SPI_OP_MODE_VDM); // Actually it's the command phase in W5500 SPI frame -+ -+ return emac->spi.write(emac->spi.ctx, cmd, addr, data, len); -+} -+ - static esp_err_t w5500_send_command(emac_w5500_t *emac, uint8_t command, uint32_t timeout_ms) - { - esp_err_t ret = ESP_OK; -@@ -738,8 +818,7 @@ static esp_err_t emac_w5500_del(esp_eth_mac_t *mac) - { - emac_w5500_t *emac = __containerof(mac, emac_w5500_t, parent); - vTaskDelete(emac->rx_task_hdl); -- spi_bus_remove_device(emac->spi_hdl); -- vSemaphoreDelete(emac->spi_lock); -+ emac->spi.deinit(emac->spi.ctx); - heap_caps_free(emac->rx_buffer); - free(emac); - return ESP_OK; -@@ -754,19 +833,6 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con - ESP_GOTO_ON_FALSE(emac, NULL, err, TAG, "no mem for MAC instance"); - /* w5500 driver is interrupt driven */ - ESP_GOTO_ON_FALSE(w5500_config->int_gpio_num >= 0, NULL, err, TAG, "invalid interrupt gpio number"); -- /* SPI device init */ -- spi_device_interface_config_t spi_devcfg; -- memcpy(&spi_devcfg, w5500_config->spi_devcfg, sizeof(spi_device_interface_config_t)); -- if (w5500_config->spi_devcfg->command_bits == 0 && w5500_config->spi_devcfg->address_bits == 0) { -- /* configure default SPI frame format */ -- spi_devcfg.command_bits = 16; // Actually it's the address phase in W5500 SPI frame -- spi_devcfg.address_bits = 8; // Actually it's the control phase in W5500 SPI frame -- } else { -- ESP_GOTO_ON_FALSE(w5500_config->spi_devcfg->command_bits == 16 || w5500_config->spi_devcfg->address_bits == 8, -- NULL, err, TAG, "incorrect SPI frame format (command_bits/address_bits)"); -- } -- ESP_GOTO_ON_FALSE(spi_bus_add_device(w5500_config->spi_host_id, &spi_devcfg, &emac->spi_hdl) == ESP_OK, -- NULL, err, TAG, "adding device to SPI host #%d failed", w5500_config->spi_host_id + 1); - /* bind methods and attributes */ - emac->sw_reset_timeout_ms = mac_config->sw_reset_timeout_ms; - emac->int_gpio_num = w5500_config->int_gpio_num; -@@ -788,9 +854,26 @@ esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, con - emac->parent.enable_flow_ctrl = emac_w5500_enable_flow_ctrl; - emac->parent.transmit = emac_w5500_transmit; - emac->parent.receive = emac_w5500_receive; -- /* create mutex */ -- emac->spi_lock = xSemaphoreCreateMutex(); -- ESP_GOTO_ON_FALSE(emac->spi_lock, NULL, err, TAG, "create lock failed"); -+ -+ if (w5500_config->custom_spi_driver.init != NULL && w5500_config->custom_spi_driver.deinit != NULL -+ && w5500_config->custom_spi_driver.read != NULL && w5500_config->custom_spi_driver.write != NULL) { -+ ESP_LOGD(TAG, "Using user's custom SPI Driver"); -+ emac->spi.init = w5500_config->custom_spi_driver.init; -+ emac->spi.deinit = w5500_config->custom_spi_driver.deinit; -+ emac->spi.read = w5500_config->custom_spi_driver.read; -+ emac->spi.write = w5500_config->custom_spi_driver.write; -+ /* Custom SPI driver device init */ -+ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(w5500_config->custom_spi_driver.config)) != NULL, NULL, err, TAG, "SPI initialization failed"); -+ } else { -+ ESP_LOGD(TAG, "Using default SPI Driver"); -+ emac->spi.init = w5500_spi_init; -+ emac->spi.deinit = w5500_spi_deinit; -+ emac->spi.read = w5500_spi_read; -+ emac->spi.write = w5500_spi_write; -+ /* SPI device init */ -+ ESP_GOTO_ON_FALSE((emac->spi.ctx = emac->spi.init(w5500_config)) != NULL, NULL, err, TAG, "SPI initialization failed"); -+ } -+ - /* create w5500 task */ - BaseType_t core_num = tskNO_AFFINITY; - if (mac_config->flags & ETH_MAC_FLAG_PIN_TO_CORE) { -@@ -810,8 +893,8 @@ err: - if (emac->rx_task_hdl) { - vTaskDelete(emac->rx_task_hdl); - } -- if (emac->spi_lock) { -- vSemaphoreDelete(emac->spi_lock); -+ if (emac->spi.ctx) { -+ emac->spi.deinit(emac->spi.ctx); - } - heap_caps_free(emac->rx_buffer); - free(emac); From 645582dcbc21874ca61d8484e28f20830215626b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Jan 2024 14:10:58 +0100 Subject: [PATCH 324/636] rm not needed patches --- tools/install-esp-idf.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index e3433e9c1..45d3c21af 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -66,10 +66,8 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) - # Temporarily patch the ETH driver to support custom SPI + # Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source cd $IDF_PATH - patch -p1 -N -i ../patches/spi_eth.diff - patch -p1 -N -i ../patches/eth_multicast.diff patch -p1 -N -i ../patches/esp32s2_i2c_ll_master_init.diff cd - fi From b4448178530e81cc98dc777c5544d6e337fb6430 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:26:09 +0100 Subject: [PATCH 325/636] add two cam variants --- configs/defconfig.common | 2 -- 1 file changed, 2 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 8dfa7a1b2..896ef78e8 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -217,8 +217,6 @@ CONFIG_LITTLEFS_DISK_VERSION_2_0=y # CONFIG_OV7670_SUPPORT is not set # CONFIG_OV7725_SUPPORT is not set # CONFIG_NT99141_SUPPORT is not set -# CONFIG_OV3660_SUPPORT is not set -# CONFIG_OV5640_SUPPORT is not set # CONFIG_GC2145_SUPPORT is not set # CONFIG_GC032A_SUPPORT is not set # CONFIG_GC0308_SUPPORT is not set From 0061bc37304f0921224d50753af94cb9bae182da Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:08:04 +0100 Subject: [PATCH 326/636] Update GH actions --- .github/workflows/push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5c7b2b2da..763b3d3b8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -7,7 +7,7 @@ jobs: name: Build Arduino Libs runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: @@ -17,7 +17,7 @@ jobs: - name: Build Arduino Libs run: bash ./build.sh - name: Release - uses: jason2866/action-gh-release@v1.2 + uses: jason2866/action-gh-release@v1.3 with: tag_name: ${{ github.run_number }} body_path: release-info.txt From b66acb2c63f461b9f990fa3bbba5c3c8ceb450f0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:30:28 +0100 Subject: [PATCH 327/636] Update python --- .github/workflows/push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 763b3d3b8..7e41952c0 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -9,9 +9,9 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' - name: Install dependencies run: bash ./tools/prepare-ci.sh - name: Build Arduino Libs From c80552a78845b95e948ed2a39c5de3c9bfed0b23 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:46:44 +0100 Subject: [PATCH 328/636] CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 896ef78e8..62156e7d1 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -188,6 +188,7 @@ CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y +CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10 CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2 CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 From 0f59011b06095ecde5a231b131a652b5bbd7467d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 31 Jan 2024 22:05:33 +0100 Subject: [PATCH 329/636] Use MacOS ARM --- tools/prepare-ci.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/prepare-ci.sh b/tools/prepare-ci.sh index 711ce154f..436191a4c 100755 --- a/tools/prepare-ci.sh +++ b/tools/prepare-ci.sh @@ -1,4 +1,14 @@ #!/bin/bash -sudo apt-get install -y gperf cmake ninja-build -pip3 install wheel future pyelftools +# Ubuntu setup +#sudo apt-get install -y gperf cmake ninja-build +#pip3 install wheel future pyelftools + +# MacOS (ARM) setup +brew install gsed +brew install gawk +brew install gperf +brew install ninja +brew install ccache +python -m pip install --upgrade pip +pip install wheel future pyelftools From 0022e78725d2bede958bb7fc887722d2119a1cc6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 31 Jan 2024 22:36:18 +0100 Subject: [PATCH 330/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 7e41952c0..9cb38db6c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -5,7 +5,7 @@ on: jobs: build-libs: name: Build Arduino Libs - runs-on: ubuntu-22.04 + runs-on: macOS-14 steps: - uses: actions/checkout@v4 - name: Set up Python From f37be2df37e025b5769f6c8de6bf42fda347d16d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 31 Jan 2024 22:37:17 +0100 Subject: [PATCH 331/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9cb38db6c..1ca8e7faa 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -5,7 +5,7 @@ on: jobs: build-libs: name: Build Arduino Libs - runs-on: macOS-14 + runs-on: macos-14 steps: - uses: actions/checkout@v4 - name: Set up Python From 328330b1045080b5517ea419e9a38e01113fa177 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 11 Feb 2024 23:12:56 +0100 Subject: [PATCH 332/636] add lib Builder branch --- build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 99357c274..024935d40 100755 --- a/build.sh +++ b/build.sh @@ -146,7 +146,8 @@ IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") echo "Framework built from - $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) -- $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)" >> release-info.txt +- $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) +- Arduino lib builder branch: $GIT_BRANCH" >> release-info.txt #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do From c7e6e23fe49ebc118b6670786cdf1b38e767aea4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 11 Feb 2024 23:17:31 +0100 Subject: [PATCH 333/636] add env --- .github/workflows/push.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1ca8e7faa..4de8ec07c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -14,6 +14,9 @@ jobs: python-version: '3.11' - name: Install dependencies run: bash ./tools/prepare-ci.sh + - name: Get current branch + run: | + echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV - name: Build Arduino Libs run: bash ./build.sh - name: Release From 639381f00abe30714e9ace79d2ca430389cc7043 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 11 Feb 2024 23:46:59 +0100 Subject: [PATCH 334/636] add comments --- tools/prepare-ci.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/prepare-ci.sh b/tools/prepare-ci.sh index 436191a4c..52773a90a 100755 --- a/tools/prepare-ci.sh +++ b/tools/prepare-ci.sh @@ -1,10 +1,12 @@ #!/bin/bash # Ubuntu setup +# Change in archive-build.sh gawk to awk #sudo apt-get install -y gperf cmake ninja-build #pip3 install wheel future pyelftools # MacOS (ARM) setup +# Change in archive-build.sh awk to gawk brew install gsed brew install gawk brew install gperf From bf616da67cec79c60f025dcefddc55ccf0797036 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:52:12 +0100 Subject: [PATCH 335/636] CONFIG_ETH_TRANSMIT_MUTEX --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 62156e7d1..eb900e418 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -42,6 +42,7 @@ CONFIG_ESP_WIFI_CSI_ENABLED=n CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_IRAM_OPT is not set # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set +CONFIG_ETH_TRANSMIT_MUTEX=y CONFIG_ETH_SPI_ETHERNET_DM9051=y CONFIG_ETH_SPI_ETHERNET_W5500=y CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL=y From 7c466b9e9d0c4091a94f4762b59eedcb5dd6be08 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:33:55 +0100 Subject: [PATCH 336/636] Fix build of build Platformio manifest (fail in second run) --- build.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 024935d40..438c4dfac 100755 --- a/build.sh +++ b/build.sh @@ -244,7 +244,11 @@ fi # Generate PlatformIO manifest file if [ "$BUILD_TYPE" = "all" ]; then - python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s $(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) -c $(git -C "$IDF_PATH" rev-parse --short HEAD) + pushd $IDF_PATH + ibr=$(git branch --show-current) + ic=$(git -C "$IDF_PATH" rev-parse --short HEAD) + popd + python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s "$ibr" -c "$ic" if [ $? -ne 0 ]; then exit 1; fi fi From b17252f96bcb0ce3fdd4dab6525328ac8943dfba Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:29:51 +0100 Subject: [PATCH 337/636] fix manifest script build error --- build.sh | 8 ++++---- tools/archive-build.sh | 2 -- tools/config.sh | 19 ++++++++++++------- tools/gen_tools_json.py | 2 +- tools/install-esp-idf.sh | 2 -- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/build.sh b/build.sh index 438c4dfac..ad5223a0e 100755 --- a/build.sh +++ b/build.sh @@ -144,8 +144,8 @@ mkdir -p "$AR_TOOLS/esp32-arduino-libs" rm -rf release-info.txt IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") -echo "Framework built from -- $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) +echo "Framework built from +- $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) - $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) - Arduino lib builder branch: $GIT_BRANCH" >> release-info.txt @@ -245,10 +245,10 @@ fi # Generate PlatformIO manifest file if [ "$BUILD_TYPE" = "all" ]; then pushd $IDF_PATH - ibr=$(git branch --show-current) + ibr=$(git describe --all --exact-match 2>/dev/null) ic=$(git -C "$IDF_PATH" rev-parse --short HEAD) popd - python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s "$ibr" -c "$ic" + python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s "$IDF_BRANCH" -c "$IDF_COMMIT" if [ $? -ne 0 ]; then exit 1; fi fi diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 109ecf6fc..a8f564e2f 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -1,7 +1,5 @@ #!/bin/bash -IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") -IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD || echo "") idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT" archive_path="dist/arduino-esp32-libs-$idf_version_string.tar.gz" diff --git a/tools/config.sh b/tools/config.sh index fe8a65d4f..94472f03a 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v5.1" + export IDF_BRANCH="release/v5.1" fi # Arduino branch to use @@ -60,17 +60,20 @@ TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs" IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs" if [ "$IDF_COMMIT" ]; then - echo "Using IDF commit $IDF_COMMIT" export IDF_COMMIT -elif [ -d "$IDF_PATH" ]; then - export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) - export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) fi +if [ -d "$IDF_PATH" ]; then + export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) +fi + +echo "Using IDF branch $IDF_BRANCH" +echo "Using IDF commit $IDF_COMMIT" + if [ "$AR_COMMIT" ]; then - echo "Using commit $AR_COMMIT for Arduino" + echo "Using Arduino commit $AR_COMMIT" else - AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") + export AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") fi #rm -rf release-info.txt @@ -103,6 +106,7 @@ function get_os(){ AR_OS=`get_os` export SED="sed" +export AWK="awk" export SSTAT="stat -c %s" if [[ "$AR_OS" == "macos" ]]; then @@ -115,6 +119,7 @@ if [[ "$AR_OS" == "macos" ]]; then exit 1 fi export SED="gsed" + export AWK="gawk" export SSTAT="stat -f %z" fi diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py index ca53ec8cb..20d8f864b 100644 --- a/tools/gen_tools_json.py +++ b/tools/gen_tools_json.py @@ -59,7 +59,7 @@ if tool_name.endswith('-elf'): tool_name += '-gcc' print('Found {0}, version: {1}'.format(tool_name, tool_version)) - + if simple_output == False: dep_found = False dep_skip = False diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 45d3c21af..27ae59289 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -63,8 +63,6 @@ fi if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then git submodule update --recursive $IDF_PATH/install.sh - export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) - export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) # Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source cd $IDF_PATH From ee78dbb46545d8b33f2451d6dea3bd234aaa346d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:38:34 +0100 Subject: [PATCH 338/636] rm outdated code --- build.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.sh b/build.sh index ad5223a0e..216e1af0e 100755 --- a/build.sh +++ b/build.sh @@ -244,10 +244,6 @@ fi # Generate PlatformIO manifest file if [ "$BUILD_TYPE" = "all" ]; then - pushd $IDF_PATH - ibr=$(git describe --all --exact-match 2>/dev/null) - ic=$(git -C "$IDF_PATH" rev-parse --short HEAD) - popd python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s "$IDF_BRANCH" -c "$IDF_COMMIT" if [ $? -ne 0 ]; then exit 1; fi fi From 7a56befc27866142aae815373b53316a14dbb733 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Feb 2024 21:41:01 +0100 Subject: [PATCH 339/636] don't know why it needs to be restored?!? --- build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sh b/build.sh index 216e1af0e..87391c5a4 100755 --- a/build.sh +++ b/build.sh @@ -235,6 +235,8 @@ for component in `ls "$AR_MANAGED_COMPS"`; do fi done +export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) + # update package_esp32_index.template.json if [ "$BUILD_TYPE" = "all" ]; then python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" From 89add5757a07cefb93cc88f2a49dbd9456a930d9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 21 Feb 2024 12:25:54 +0100 Subject: [PATCH 340/636] Build Pio framework manifest (#78) --- build.sh | 11 ++- package.json | 17 ---- tools/gen_pio_frmwk_manifest.py | 87 +++++++++++++++++++ ...io_manifest.py => gen_pio_lib_manifest.py} | 4 +- 4 files changed, 98 insertions(+), 21 deletions(-) delete mode 100644 package.json create mode 100644 tools/gen_pio_frmwk_manifest.py rename tools/{gen_platformio_manifest.py => gen_pio_lib_manifest.py} (89%) diff --git a/build.sh b/build.sh index 87391c5a4..d5c4f5bc5 100755 --- a/build.sh +++ b/build.sh @@ -244,9 +244,16 @@ if [ "$BUILD_TYPE" = "all" ]; then if [ $? -ne 0 ]; then exit 1; fi fi -# Generate PlatformIO manifest file +# Generate PlatformIO library manifest file if [ "$BUILD_TYPE" = "all" ]; then - python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s "$IDF_BRANCH" -c "$IDF_COMMIT" + python3 ./tools/gen_pio_lib_manifest.py -o "$TOOLS_JSON_OUT/" -s "$IDF_BRANCH" -c "$IDF_COMMIT" + if [ $? -ne 0 ]; then exit 1; fi +fi + +# Generate PlatformIO framework manifest file +rm -rf "$AR_ROOT/package.json" +if [ "$BUILD_TYPE" = "all" ]; then + python3 ./tools/gen_pio_frmwk_manifest.py -o "$AR_ROOT/" -s "$IDF_BRANCH" -c "$IDF_COMMIT" if [ $? -ne 0 ]; then exit 1; fi fi diff --git a/package.json b/package.json deleted file mode 100644 index c184e5481..000000000 --- a/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "framework-arduinoespressif32", - "version": "3.0.0", - "description": "Tasmota Arduino Framework for the Espressif ESP32, ESP32-S and ESP32-C series of SoCs", - "keywords": [ - "tasmota", - "framework", - "arduino", - "espressif", - "esp32" - ], - "license": "LGPL-2.1-or-later", - "repository": { - "type": "git", - "url": "https://github.com/tasmota/arduino-esp32" - } -} diff --git a/tools/gen_pio_frmwk_manifest.py b/tools/gen_pio_frmwk_manifest.py new file mode 100644 index 000000000..dc5c26471 --- /dev/null +++ b/tools/gen_pio_frmwk_manifest.py @@ -0,0 +1,87 @@ +import argparse +import json +import os +import re +import sys + +MANIFEST_DATA = { + "name": "framework-arduinoespressif32", + "description": "Platformio Tasmota Arduino framework for the Espressif ESP32 series of SoCs", + "keywords": ["framework", "tasmota", "arduino", "espressif", "esp32"], + "license": "LGPL-2.1-or-later", + "repository": { + "type": "git", + "url": "https://github.com/tasmota/arduino-esp32", + }, +} + + +def convert_version(version_string): + """A helper function that converts a custom IDF version string + extracted from a Git repository to a suitable SemVer alternative. For example: + 'release/v5.1' becomes '5.1.0', + 'v7.7.7' becomes '7.7.7' + """ + + regex_pattern = ( + r"v(?P<MAJOR>0|[1-9]\d*)\.(?P<MINOR>0|[1-9]\d*)\.*(?P<PATCH>0|[1-9]\d*)*" + ) + match = re.search(regex_pattern, version_string) + if not match: + sys.stderr.write( + f"Failed to find a regex match for '{regex_pattern}' in '{version_string}'\n" + ) + return "" + + major, minor, patch = match.groups() + if not patch: + patch = "0" + + return ".".join((major, minor, patch)) + + +def main(dst_dir, version_string, commit_hash): + + converted_version = convert_version(version_string) + if not converted_version: + sys.stderr.write(f"Failed to convert version '{version_string}'\n") + return -1 + + manifest_file_path = os.path.join(dst_dir, "package.json") + with open(manifest_file_path, "w", encoding="utf8") as fp: + MANIFEST_DATA["version"] = f"3.0.0+sha.{commit_hash}" + #MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}" + json.dump(MANIFEST_DATA, fp, indent=2) + + print( + f"Generated PlatformIO framework manifest file '{manifest_file_path}' with '{converted_version}' version" + ) + return 0 + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "-o", + "--dst-dir", + dest="dst_dir", + required=True, + help="Destination folder where the 'package.json' manifest will be located", + ) + parser.add_argument( + "-s", + "--version-string", + dest="version_string", + required=True, + help="ESP-IDF version string used for compiling libraries", + ) + parser.add_argument( + "-c", + "--commit-hash", + dest="commit_hash", + required=True, + help="ESP-IDF revision in form of a commit hash", + ) + args = parser.parse_args() + + sys.exit(main(args.dst_dir, args.version_string, args.commit_hash)) diff --git a/tools/gen_platformio_manifest.py b/tools/gen_pio_lib_manifest.py similarity index 89% rename from tools/gen_platformio_manifest.py rename to tools/gen_pio_lib_manifest.py index 02057d9a2..22df9a730 100644 --- a/tools/gen_platformio_manifest.py +++ b/tools/gen_pio_lib_manifest.py @@ -7,7 +7,7 @@ MANIFEST_DATA = { "name": "framework-arduinoespressif32-libs", "description": "Precompiled libraries for Arduino Wiring-based Framework for the Espressif ESP32 series of SoCs", - "keywords": ["framework", "arduino", "espressif", "esp32"], + "keywords": ["framework", "tasmota", "arduino", "espressif", "esp32"], "license": "LGPL-2.1-or-later", "repository": { "type": "git", @@ -53,7 +53,7 @@ def main(dst_dir, version_string, commit_hash): json.dump(MANIFEST_DATA, fp, indent=2) print( - f"Generated PlatformIO manifest file '{manifest_file_path}' with '{converted_version}' version" + f"Generated PlatformIO libraries manifest file '{manifest_file_path}' with '{converted_version}' version" ) return 0 From 24cbf60a6b8a506f0c37140a86a37a61e7a2ae1f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:30:14 +0100 Subject: [PATCH 341/636] Update build.sh --- build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index d5c4f5bc5..6418ee3aa 100755 --- a/build.sh +++ b/build.sh @@ -252,8 +252,9 @@ fi # Generate PlatformIO framework manifest file rm -rf "$AR_ROOT/package.json" +AR_VERSION=$(jq -c '.version' "$AR_COMPS/arduino/package.json" | tr -d '"') if [ "$BUILD_TYPE" = "all" ]; then - python3 ./tools/gen_pio_frmwk_manifest.py -o "$AR_ROOT/" -s "$IDF_BRANCH" -c "$IDF_COMMIT" + python3 ./tools/gen_pio_frmwk_manifest.py -o "$AR_ROOT/" -s "v$AR_VERSION" -c "$IDF_COMMIT" if [ $? -ne 0 ]; then exit 1; fi fi From 291df1050aa6a6a28dbbb5f39ea2769295acf895 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:32:47 +0100 Subject: [PATCH 342/636] Update gen_pio_frmwk_manifest.py --- tools/gen_pio_frmwk_manifest.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/gen_pio_frmwk_manifest.py b/tools/gen_pio_frmwk_manifest.py index dc5c26471..303784bfb 100644 --- a/tools/gen_pio_frmwk_manifest.py +++ b/tools/gen_pio_frmwk_manifest.py @@ -49,8 +49,7 @@ def main(dst_dir, version_string, commit_hash): manifest_file_path = os.path.join(dst_dir, "package.json") with open(manifest_file_path, "w", encoding="utf8") as fp: - MANIFEST_DATA["version"] = f"3.0.0+sha.{commit_hash}" - #MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}" + MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}" json.dump(MANIFEST_DATA, fp, indent=2) print( From 636cbc98092ea61b99b3b5bca8b91b540ddd6a0a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:01:57 +0100 Subject: [PATCH 343/636] Delete core_version.h --- core_version.h | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 core_version.h diff --git a/core_version.h b/core_version.h deleted file mode 100644 index 468a2459e..000000000 --- a/core_version.h +++ /dev/null @@ -1,4 +0,0 @@ -#define ARDUINO_ESP32_GIT_VER 0xcbaeab4e -#define ARDUINO_ESP32_GIT_DESC 3.0.0 -#define ARDUINO_ESP32_RELEASE_3_0_0 -#define ARDUINO_ESP32_RELEASE "3_0_0" From d211c9fc6b77af4895753215da431b365bf6eee4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:03:38 +0100 Subject: [PATCH 344/636] generate core version.h --- build.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 6418ee3aa..cd6ecedec 100755 --- a/build.sh +++ b/build.sh @@ -250,14 +250,23 @@ if [ "$BUILD_TYPE" = "all" ]; then if [ $? -ne 0 ]; then exit 1; fi fi +AR_VERSION=$(jq -c '.version' "$AR_COMPS/arduino/package.json" | tr -d '"') +AR_VERSION_UNDERSCORE=`echo "$AR_VERSION" | tr . _` + # Generate PlatformIO framework manifest file rm -rf "$AR_ROOT/package.json" -AR_VERSION=$(jq -c '.version' "$AR_COMPS/arduino/package.json" | tr -d '"') if [ "$BUILD_TYPE" = "all" ]; then python3 ./tools/gen_pio_frmwk_manifest.py -o "$AR_ROOT/" -s "v$AR_VERSION" -c "$IDF_COMMIT" if [ $? -ne 0 ]; then exit 1; fi fi +# Generate core_version.h +rm -rf "$AR_ROOT/core_version.h" +echo "#define ARDUINO_ESP32_GIT_VER 0x$IDF_Commit_short +#define ARDUINO_ESP32_GIT_DESC $AR_VERSION +#define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE +#define ARDUINO_ESP32_RELEASE \"$AR_VERSION_UNDERSCORE\"" >> "$AR_ROOT/core_version.h" + # copy everything to arduino-esp32 installation if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then ./tools/copy-to-arduino.sh From 59adfe45d724cb367e79db96703644974b7a8259 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:06:33 +0100 Subject: [PATCH 345/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index cd6ecedec..7e8ea6efe 100755 --- a/build.sh +++ b/build.sh @@ -262,7 +262,7 @@ fi # Generate core_version.h rm -rf "$AR_ROOT/core_version.h" -echo "#define ARDUINO_ESP32_GIT_VER 0x$IDF_Commit_short +echo "#define ARDUINO_ESP32_GIT_VER 0x$AR_Commit_short #define ARDUINO_ESP32_GIT_DESC $AR_VERSION #define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE #define ARDUINO_ESP32_RELEASE \"$AR_VERSION_UNDERSCORE\"" >> "$AR_ROOT/core_version.h" From 9feeb62d47857a641d2d948faa05c5f151a70ae3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:56:26 +0100 Subject: [PATCH 346/636] Update .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 2d74868b1..99ced40ba 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ version.txt dependencies.lock managed_components/ target/ +core_version.h +package.json +release-info.txt From 04555ede11c8536f80cbe771f7650a782f50a789 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:14:24 +0100 Subject: [PATCH 347/636] Update prepare-ci.sh --- tools/prepare-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/prepare-ci.sh b/tools/prepare-ci.sh index 52773a90a..a18e63d5a 100755 --- a/tools/prepare-ci.sh +++ b/tools/prepare-ci.sh @@ -2,7 +2,7 @@ # Ubuntu setup # Change in archive-build.sh gawk to awk -#sudo apt-get install -y gperf cmake ninja-build +#sudo apt update && sudo apt install -y gperf cmake ninja-build #pip3 install wheel future pyelftools # MacOS (ARM) setup From f6a89740d824aed0f86414edb1ffef796de9161b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:27:53 +0100 Subject: [PATCH 348/636] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e94b2775..3c9478c93 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,9 @@ This repository contains the scripts that produce the libraries included with Ta ### Build on Ubuntu ```bash -sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache jq p7zip-full -sudo pip3 install --upgrade pip3 +sudo apt update && sudo apt install -y git wget curl libssl-dev libncurses-dev flex bison gperf python3 cmake ninja-build ccache +curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py && \ +pip3 install setuptools pyserial click future wheel cryptography pyparsing pyelftools git clone https://github.com/Jason2866/esp32-arduino-lib-builder cd esp32-arduino-lib-builder ./build.sh From 851df9ba5e88ae29ca872b3d2253cdbdfbb42a57 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:31:01 +0100 Subject: [PATCH 349/636] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c9478c93..9e78ce862 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repository contains the scripts that produce the libraries included with Ta ### Build on Ubuntu ```bash -sudo apt update && sudo apt install -y git wget curl libssl-dev libncurses-dev flex bison gperf python3 cmake ninja-build ccache +sudo apt update && sudo apt install -y git wget curl libssl-dev libncurses-dev flex bison gperf python3 cmake ninja-build ccache jq curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py && \ pip3 install setuptools pyserial click future wheel cryptography pyparsing pyelftools git clone https://github.com/Jason2866/esp32-arduino-lib-builder From 1f03952826fe37cc1e87b00b51380ab20009dbcd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:03:15 +0100 Subject: [PATCH 350/636] NO BT in common settings --- configs/defconfig.esp32 | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 7ef4ac4cf..e880e5e92 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -1,16 +1,4 @@ CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR=y -# -# Bluetooth -# -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y -CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 -# CONFIG_BT_NIMBLE_NVS_PERSIST is not set -# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set -# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set -# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set -# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set CONFIG_ETH_ENABLED=y CONFIG_ETH_USE_ESP32_EMAC=y From 3d2787f41e524c6486bbed921891e1304d6d5674 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:04:41 +0100 Subject: [PATCH 351/636] Fix wrong change --- configs/defconfig.esp32 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index e880e5e92..3c471c7e9 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -1,3 +1,16 @@ +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR=y CONFIG_ETH_ENABLED=y From 0f4c5ad131fe0ce9bc2f93b20540fbeb79bccc12 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:07:15 +0100 Subject: [PATCH 352/636] NO BT setting in common --- configs/defconfig.common | 4 ---- 1 file changed, 4 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index eb900e418..7752d455a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -9,10 +9,6 @@ CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y -CONFIG_BT_ENABLED=y -CONFIG_BT_STACK_NO_LOG=y -# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y From 44d708ad403aa3e97f441bf7bee0b6f100119f63 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:08:34 +0100 Subject: [PATCH 353/636] add BT settings --- configs/defconfig.esp32 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 3c471c7e9..95eff7089 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -2,6 +2,9 @@ # Bluetooth # CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 From 2b4c28f8381a7df022522c49dbcc122c9ec244ff Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:09:21 +0100 Subject: [PATCH 354/636] add BT settings --- configs/defconfig.esp32c2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 2e3ecad3d..b0cb51820 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -5,6 +5,9 @@ CONFIG_XTAL_FREQ=26 # Bluetooth # CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 From 74374add70baeaa3cbac9d74e018db7bda6e62f1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:10:09 +0100 Subject: [PATCH 355/636] add BT settings --- configs/defconfig.esp32c3 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 96296de58..c3c5f8518 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -2,6 +2,9 @@ # Bluetooth # CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 From 28d2236368b904e93764e0d3e8583573a3c2905c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:10:47 +0100 Subject: [PATCH 356/636] add BT settings --- configs/defconfig.esp32c6 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index 5aa525c0c..f2cfcded3 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -10,6 +10,9 @@ CONFIG_ULP_COPROC_RESERVE_MEM=8192 # Bluetooth # CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 From f88ffdea618e3f9fc3e0d8687a03759d98437a42 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:11:20 +0100 Subject: [PATCH 357/636] add BT settings --- configs/defconfig.esp32h2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32h2 b/configs/defconfig.esp32h2 index 96296de58..c3c5f8518 100644 --- a/configs/defconfig.esp32h2 +++ b/configs/defconfig.esp32h2 @@ -2,6 +2,9 @@ # Bluetooth # CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 From d9a868500c7fcd013a1e08dd5cc4663029bfaee7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:12:01 +0100 Subject: [PATCH 358/636] add BT settings --- configs/defconfig.esp32s3 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 0a4aae470..460ac7dac 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -22,6 +22,9 @@ CONFIG_LCD_RGB_RESTART_IN_VSYNC=y # Bluetooth # CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 From ffa7e986bb57bb192b3caf516a6b81cd97e85f72 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:26:08 +0100 Subject: [PATCH 359/636] Use exact IDF version --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 7e8ea6efe..43e9c4d3e 100755 --- a/build.sh +++ b/build.sh @@ -246,7 +246,7 @@ fi # Generate PlatformIO library manifest file if [ "$BUILD_TYPE" = "all" ]; then - python3 ./tools/gen_pio_lib_manifest.py -o "$TOOLS_JSON_OUT/" -s "$IDF_BRANCH" -c "$IDF_COMMIT" + python3 ./tools/gen_pio_lib_manifest.py -o "$TOOLS_JSON_OUT/" -s "v$IDF_VERSION" -c "$IDF_COMMIT" if [ $? -ne 0 ]; then exit 1; fi fi From 3639e684acdfaf43948b18a1c70157eec9a35e77 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:27:23 +0100 Subject: [PATCH 360/636] get version from file --- tools/install-esp-idf.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 27ae59289..57150e7c7 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -37,7 +37,7 @@ if [ ! -d "$IDF_PATH" ]; then idf_was_installed="1" else # update existing branch - echo "ESP-IDF is already installed, updating branch '$IDF_BRANCH'" + echo "ESP-IDF is already installed, updating branch $IDF_BRANCH" cd $IDF_PATH git pull git reset --hard $IDF_BRANCH @@ -68,6 +68,12 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then cd $IDF_PATH patch -p1 -N -i ../patches/esp32s2_i2c_ll_master_init.diff cd - + + # Get the exact IDF version from file "version.txt" + cd $IDF_PATH + export IDF_VERSION=$(<version.txt) + echo "IDF version: $IDF_VERSION" + cd - fi # From a93eb10efc266158f629bbce5ea518d5c46a7d7a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:36:38 +0100 Subject: [PATCH 361/636] CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y --- configs/defconfig.common | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 7752d455a..06e498a30 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -30,12 +30,19 @@ CONFIG_ESP_TASK_WDT_PANIC=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y -CONFIG_ESP_WIFI_FTM_ENABLE=n +# CONFIG_ESP_WIFI_FTM_ENABLE is not set CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 -CONFIG_ESP_WIFI_CSI_ENABLED=n +# CONFIG_ESP_WIFI_CSI_ENABLED is not set CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLE_SAE_PK=y +# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set +CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y +# CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT is not set +# CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 +# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set # CONFIG_ESP_WIFI_IRAM_OPT is not set # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set CONFIG_ETH_TRANSMIT_MUTEX=y @@ -89,13 +96,6 @@ CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 CONFIG_NEWLIB_NANO_FORMAT=y # CONFIG_DAC_DMA_AUTO_16BIT_ALIGN is not set -# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set -# CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set -# CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT is not set -# CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set -CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 -# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set - CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_TLS_DISABLED=y From d45f640b84356b7b6fcb445b7b0fb8bf9f648413 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 5 Mar 2024 13:27:57 +0100 Subject: [PATCH 362/636] rm every exe from folder tools --- tools/archive-build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index a8f564e2f..5889cdc44 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -38,12 +38,11 @@ rm -rf arduino-esp32/libraries/TFLiteMicro rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs +rm -rf arduino-esp32/tools/*.exe rm -rf arduino-esp32/tools/esptool.py rm -rf arduino-esp32/tools/get.py -rm -rf arduino-esp32/tools/get.exe rm -rf arduino-esp32/tools/ide-debug rm -rf arduino-esp32/tools/gen_insights_package.py -rm -rf arduino-esp32/tools/gen_insights_package.exe rm -rf arduino-esp32/platform.txt rm -rf arduino-esp32/programmers.txt rm -rf arduino-esp32/boards.txt From d986a7ef2746209786926430780d8d87a783187b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:37:52 +0100 Subject: [PATCH 363/636] add $TARGET to framework name --- tools/archive-build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 5889cdc44..1f7b48955 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -2,10 +2,10 @@ idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT" -archive_path="dist/arduino-esp32-libs-$idf_version_string.tar.gz" -build_archive_path="dist/arduino-esp32-build-$idf_version_string.tar.gz" -pio_archive_path="dist/framework-arduinoespressif32-$idf_version_string.tar.gz" -pio_zip_archive_path="dist/framework-arduinoespressif32-$idf_version_string.zip" +archive_path="dist/arduino-esp32-libs-$TARGET-$idf_version_string.tar.gz" +build_archive_path="dist/arduino-esp32-build-$TARGET-$idf_version_string.tar.gz" +pio_archive_path="dist/framework-arduinoespressif32-$TARGET-$idf_version_string.tar.gz" +pio_zip_archive_path="dist/framework-arduinoespressif32-$TARGET-$idf_version_string.zip" mkdir -p dist && rm -rf "$archive_path" "$build_archive_path" From 0eee43f015b47f7dbe295232044a093f922451cb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 8 Mar 2024 13:37:04 +0100 Subject: [PATCH 364/636] prepare tokens use for pushing in target repos --- .github/workflows/push.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4de8ec07c..2faff00ce 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -18,6 +18,9 @@ jobs: run: | echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV - name: Build Arduino Libs + env: + GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} + GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} run: bash ./build.sh - name: Release uses: jason2866/action-gh-release@v1.3 From e3b8a169e8a132e8189e4f01163b9e70912faa14 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:50:25 +0100 Subject: [PATCH 365/636] rm Arduino chip debug report --- tools/install-arduino.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 865dc3fbb..ab66b0f47 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -71,8 +71,9 @@ fi if [ $? -ne 0 ]; then exit 1; fi # -# remove libraries not needed for Tasmota +# remove code and libraries not needed/wanted for Tasmota framework # +rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.cpp" rm -rf "$AR_COMPS/arduino/libraries/RainMaker" rm -rf "$AR_COMPS/arduino/libraries/Insights" rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S" From 9f9a58ec84db9554dedd32b6d6bbf86467ad9534 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 8 Mar 2024 16:04:35 +0100 Subject: [PATCH 366/636] rm chip debug report header file --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index ab66b0f47..707fd7f4b 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -74,6 +74,7 @@ if [ $? -ne 0 ]; then exit 1; fi # remove code and libraries not needed/wanted for Tasmota framework # rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.cpp" +rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.h" rm -rf "$AR_COMPS/arduino/libraries/RainMaker" rm -rf "$AR_COMPS/arduino/libraries/Insights" rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S" From 6dc0063d8c51b22f807d2582c68c1d764a4fa4cf Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 8 Mar 2024 16:50:18 +0100 Subject: [PATCH 367/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 43e9c4d3e..2ed1d610b 100755 --- a/build.sh +++ b/build.sh @@ -10,7 +10,7 @@ if ! [ -x "$(command -v git)" ]; then exit 1 fi -TARGET="all" +export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From 3f17e26bbe1ea889dba41d0ca63d8871b892388b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 8 Mar 2024 20:09:41 +0100 Subject: [PATCH 368/636] deprecate warn off --- configs/defconfig.common | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 06e498a30..b983a3375 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -9,6 +9,8 @@ CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y From c01650201534a57aa2af5e48ae5071a95a314c56 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 8 Mar 2024 20:16:24 +0100 Subject: [PATCH 369/636] Update defconfig.common --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index b983a3375..01329fdb0 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -6,6 +6,7 @@ CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y # CONFIG_APP_COMPILE_TIME_DATE is not set CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +CONFIG_BOOT_ROM_LOG_ALWAYS_OFF=y CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y From b25552a0b2e2a461076911da11555af3e9a32b4b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 8 Mar 2024 20:30:00 +0100 Subject: [PATCH 370/636] Update defconfig.common --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 01329fdb0..4a2be049d 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -1,6 +1,7 @@ CONFIG_AUTOSTART_ARDUINO=y # CONFIG_WS2812_LED_ENABLE is not set CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y +CONFIG_APP_REPRODUCIBLE_BUILD=y CONFIG_COMPILER_HIDE_PATHS_MACROS=y CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y From 0f6d8188a6f313e1080e10d547c21163217332a7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Mar 2024 18:13:31 +0100 Subject: [PATCH 371/636] add build date --- tools/gen_pio_frmwk_manifest.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/gen_pio_frmwk_manifest.py b/tools/gen_pio_frmwk_manifest.py index 303784bfb..e3e84629a 100644 --- a/tools/gen_pio_frmwk_manifest.py +++ b/tools/gen_pio_frmwk_manifest.py @@ -3,6 +3,7 @@ import os import re import sys +import datetime MANIFEST_DATA = { "name": "framework-arduinoespressif32", @@ -48,8 +49,10 @@ def main(dst_dir, version_string, commit_hash): return -1 manifest_file_path = os.path.join(dst_dir, "package.json") + build_date = datetime.date.today() with open(manifest_file_path, "w", encoding="utf8") as fp: MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}" + MANIFEST_DATA["date"] = f"{build_date}" json.dump(MANIFEST_DATA, fp, indent=2) print( From c19844e460e67d169b618b26455eb897fc25dca1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Apr 2024 22:16:32 +0200 Subject: [PATCH 372/636] rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 707fd7f4b..0108de4ee 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -86,6 +86,7 @@ rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" rm -rf "$AR_COMPS/arduino/libraries/ESP32" rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" +rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" # From 65b82d4b7a24b47ca6e1f7e11beb7f0245713f3d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Apr 2024 22:24:36 +0200 Subject: [PATCH 373/636] rm -rf arduino-esp32/libraries/ESP_NOW --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 1f7b48955..6bd370eb6 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -34,6 +34,7 @@ rm -rf arduino-esp32/libraries/BluetoothSerial rm -rf arduino-esp32/libraries/WiFiProv rm -rf arduino-esp32/libraries/WiFiClientSecure rm -rf arduino-esp32/libraries/ESP_SR +rm -rf arduino-esp32/libraries/ESP_NOW rm -rf arduino-esp32/libraries/TFLiteMicro rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package From 0c297de92d808a91c05e33857a0236bcf44424fd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Apr 2024 22:37:20 +0200 Subject: [PATCH 374/636] OSBITS=`uname -m` --- tools/config.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 94472f03a..a5cdfe840 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -76,11 +76,8 @@ else export AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "") fi -#rm -rf release-info.txt -#echo "Framework built from Tasmota IDF branch $IDF_BRANCH commit $IDF_COMMIT and $AR_REPO branch $AR_BRANCH commit $AR_COMMIT" >> release-info.txt - function get_os(){ - OSBITS=`arch` + OSBITS=`uname -m` if [[ "$OSTYPE" == "linux"* ]]; then if [[ "$OSBITS" == "i686" ]]; then echo "linux32" From 8f8f7de75192b91e1624709a15168828ad5140ac Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:54:25 +0200 Subject: [PATCH 375/636] feat(): Allow multiple targets selection --- build.sh | 95 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 28 deletions(-) diff --git a/build.sh b/build.sh index 2ed1d610b..c912d2b39 100755 --- a/build.sh +++ b/build.sh @@ -20,15 +20,16 @@ if [ -z $DEPLOY_OUT ]; then fi function print_help() { - echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf_libs|copy_bootloader|mem_variant>] [config ...]" + echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]" echo " -s Skip installing/updating of ESP-IDF and all components" echo " -A Set which branch of arduino-esp32 to be used for compilation" echo " -I Set which branch of ESP-IDF to be used for compilation" echo " -i Set which commit of ESP-IDF to be used for compilation" echo " -e Archive the build to dist" echo " -d Deploy the build to github arduino-esp32" + echo " -D Debug level to be set to ESP-IDF. One of default,none,error,warning,info,debug or verbose" echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'" - echo " -t Set the build target(chip). ex. 'esp32s3'" + echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32,esp32s3,esp32c3'" echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board" echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b" exit 1 @@ -59,16 +60,16 @@ while getopts ":A:I:i:c:t:b:sde" opt; do export IDF_COMMIT="$OPTARG" ;; t ) - TARGET=$OPTARG + IFS=',' read -ra TARGET <<< "$OPTARG" ;; b ) b=$OPTARG - if [ "$b" != "build" ] && - [ "$b" != "menuconfig" ] && - [ "$b" != "reconfigure" ] && - [ "$b" != "idf_libs" ] && - [ "$b" != "copy_bootloader" ] && - [ "$b" != "mem_variant" ]; then + if [ "$b" != "build" ] && + [ "$b" != "menuconfig" ] && + [ "$b" != "reconfigure" ] && + [ "$b" != "idf-libs" ] && + [ "$b" != "copy-bootloader" ] && + [ "$b" != "mem-variant" ]; then print_help fi BUILD_TYPE="$b" @@ -86,6 +87,9 @@ done shift $((OPTIND -1)) CONFIGS=$@ +# Output the TARGET array +echo "TARGET(s): ${TARGET[@]}" + mkdir -p dist rm -rf dependencies.lock @@ -113,27 +117,42 @@ if [ "$BUILD_TYPE" != "all" ]; then echo "ERROR: You need to specify target for non-default builds" print_help fi - configs="configs/defconfig.common;configs/defconfig.$TARGET" # Target Features Configs for target_json in `jq -c '.targets[]' configs/builds.json`; do target=$(echo "$target_json" | jq -c '.target' | tr -d '"') - if [ "$TARGET" == "$target" ]; then - for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do - configs="$configs;configs/defconfig.$defconf" - done + + # Check if $target is in the $TARGET array + target_in_array=false + for item in "${TARGET[@]}"; do + if [ "$item" = "$target" ]; then + target_in_array=true + break + fi + done + + if [ "$target_in_array" = false ]; then + # Skip building for targets that are not in the $TARGET array + continue fi - done + + configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG" + for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do + configs="$configs;configs/defconfig.$defconf" + done - # Configs From Arguments - for conf in $CONFIGS; do - configs="$configs;configs/defconfig.$conf" - done + echo "* Building for $target" - echo "idf.py -DIDF_TARGET=\"$TARGET\" -DSDKCONFIG_DEFAULTS=\"$configs\" $BUILD_TYPE" - rm -rf build sdkconfig - idf.py -DIDF_TARGET="$TARGET" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE - if [ $? -ne 0 ]; then exit 1; fi + # Configs From Arguments + for conf in $CONFIGS; do + configs="$configs;configs/defconfig.$conf" + done + + echo "idf.py -DIDF_TARGET=\"$target\" -DSDKCONFIG_DEFAULTS=\"$configs\" $BUILD_TYPE" + rm -rf build sdkconfig + idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE + if [ $? -ne 0 ]; then exit 1; fi + done exit 0 fi @@ -152,8 +171,28 @@ echo "Framework built from #targets_count=`jq -c '.targets[] | length' configs/builds.json` for target_json in `jq -c '.targets[]' configs/builds.json`; do target=$(echo "$target_json" | jq -c '.target' | tr -d '"') + target_skip=$(echo "$target_json" | jq -c '.skip // 0') + + # Check if $target is in the $TARGET array if not "all" + if [ "$TARGET" != "all" ]; then + target_in_array=false + for item in "${TARGET[@]}"; do + if [ "$item" = "$target" ]; then + target_in_array=true + break + fi + done - if [ "$TARGET" != "all" ] && [ "$TARGET" != "$target" ]; then + # If $target is not in the $TARGET array, skip processing + if [ "$target_in_array" = false ]; then + echo "* Skipping Target: $target" + continue + fi + fi + + # Skip chips that should not be a part of the final libs + # WARNING!!! this logic needs to be updated when cron builds are split into jobs + if [ "$TARGET" = "all" ] && [ $target_skip -eq 1 ]; then echo "* Skipping Target: $target" continue fi @@ -161,7 +200,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Target: $target" # Build Main Configs List - main_configs="configs/defconfig.common;configs/defconfig.$target" + main_configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG" for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do main_configs="$main_configs;configs/defconfig.$defconf" done @@ -174,7 +213,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build IDF-Libs: $idf_libs_configs" rm -rf build sdkconfig - idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf_libs + idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs if [ $? -ne 0 ]; then exit 1; fi # Build Bootloaders @@ -186,7 +225,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build BootLoader: $bootloader_configs" rm -rf build sdkconfig - idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy_bootloader + idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader if [ $? -ne 0 ]; then exit 1; fi done @@ -199,7 +238,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build Memory Variant: $mem_configs" rm -rf build sdkconfig - idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem_variant + idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant if [ $? -ne 0 ]; then exit 1; fi done done From 8c06eba4aa817dc0cc2742351bf76ac4e9e92c40 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:56:40 +0200 Subject: [PATCH 376/636] remove debug level choice --- build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sh b/build.sh index c912d2b39..c355990d7 100755 --- a/build.sh +++ b/build.sh @@ -27,7 +27,6 @@ function print_help() { echo " -i Set which commit of ESP-IDF to be used for compilation" echo " -e Archive the build to dist" echo " -d Deploy the build to github arduino-esp32" - echo " -D Debug level to be set to ESP-IDF. One of default,none,error,warning,info,debug or verbose" echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'" echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32,esp32s3,esp32c3'" echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board" From 986daa3ba0dfdd8326135845a34ec7f6437adf05 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:59:47 +0200 Subject: [PATCH 377/636] remove "defconfig.debug" --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c355990d7..f049b860f 100755 --- a/build.sh +++ b/build.sh @@ -135,7 +135,7 @@ if [ "$BUILD_TYPE" != "all" ]; then continue fi - configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG" + configs="configs/defconfig.common;configs/defconfig.$target" for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do configs="$configs;configs/defconfig.$defconf" done From 5367cecddc63e958d49b6874c933b991420e8088 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 5 Apr 2024 18:02:57 +0200 Subject: [PATCH 378/636] remove "configs/defconfig.debug_$BUILD_DEBUG" --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index f049b860f..35db7b5cd 100755 --- a/build.sh +++ b/build.sh @@ -199,7 +199,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Target: $target" # Build Main Configs List - main_configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG" + main_configs="configs/defconfig.common;configs/defconfig.$target" for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do main_configs="$main_configs;configs/defconfig.$defconf" done From 9633157c9f00e7be7a3a24a4f963ffb41456b146 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 6 Apr 2024 12:12:46 +0200 Subject: [PATCH 379/636] V5.1 s3 120Mhz no sync res (#88) * CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y * CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y * esp32 no external RAM use * add s3 speed & mem variants * enable experimental * moved `BOOTLOADER_FLASH_DC_AWARE` to s3 defconfig * CONFIG_LCD_RGB_RESTART_IN_VSYNC is not set * rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" * OSBITS=`uname -m` --- .github/workflows/push.yml | 2 +- configs/builds.json | 12 ++++++++++-- configs/defconfig.120m | 1 + configs/defconfig.esp32 | 10 +++++----- configs/defconfig.esp32s2 | 5 ++++- configs/defconfig.esp32s3 | 8 +++++++- 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2faff00ce..14dadeac9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF v5.1 +name: S3 OPI 120Mhz no reset vsync on: workflow_dispatch: # Manually start a workflow diff --git a/configs/builds.json b/configs/builds.json index 2de37abeb..02695519c 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -134,15 +134,23 @@ "idf_libs":["qio","80m","opi_ram"], "bootloaders":[ ["qio","120m","qio_ram"], + ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], ["qio","80m","opi_ram"], + ["opi","120m","qio_ram"], + ["opi","120m","opi_ram"], + ["opi","80m","qio_ram"], ["opi","80m","opi_ram"] ], "mem_variants":[ ["qio","120m","qio_ram"], + ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], - ["opi","80m","opi_ram"], - ["opi","80m","qio_ram"] + ["qio","80m","opi_ram"], + ["opi","120m","qio_ram"], + ["opi","120m","opi_ram"], + ["opi","80m","qio_ram"], + ["opi","80m","opi_ram"] ] } ] diff --git a/configs/defconfig.120m b/configs/defconfig.120m index 2dd8e0253..11d11177f 100644 --- a/configs/defconfig.120m +++ b/configs/defconfig.120m @@ -1,2 +1,3 @@ CONFIG_ESPTOOLPY_FLASHFREQ_120M=y CONFIG_SPIRAM_SPEED_120M=y +CONFIG_SPI_FLASH_HPM_ENA=y diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 95eff7089..d15399735 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -13,6 +13,11 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set +# CONFIG_BTDM_CTRL_MODE_BTDM is not set +# CONFIG_BT_BTC_TASK_STACK_SIZE is not set +# CONFIG_BT_BTU_TASK_STACK_SIZE is not set +CONFIG_BT_STACK_NO_LOG=y +CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR=y @@ -21,11 +26,6 @@ CONFIG_ETH_USE_ESP32_EMAC=y CONFIG_ETH_PHY_INTERFACE_RMII=y CONFIG_ETH_USE_SPI_ETHERNET=y -# CONFIG_BTDM_CTRL_MODE_BTDM is not set -# CONFIG_BT_BTC_TASK_STACK_SIZE is not set -# CONFIG_BT_BTU_TASK_STACK_SIZE is not set -CONFIG_BT_STACK_NO_LOG=y -CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y CONFIG_SPIRAM=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y CONFIG_ULP_COPROC_ENABLED=y diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 7aad2865d..23842a80b 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -1,6 +1,9 @@ -CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y +CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y CONFIG_ESP32S2_KEEP_USB_ALIVE=y CONFIG_ULP_COPROC_ENABLED=y CONFIG_ESP32_ULP_COPROC_RISCV=y diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 460ac7dac..210bbb8bd 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,10 +1,15 @@ +CONFIG_IDF_EXPERIMENTAL_FEATURES=y + CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_RISCV=y CONFIG_ULP_COPROC_RESERVE_MEM=4096 CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y +CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set @@ -12,11 +17,12 @@ CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n +CONFIG_BOOTLOADER_FLASH_DC_AWARE=y # # S3 Display shift fix -> https://espressif-docs.readthedocs-hosted.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html # -CONFIG_LCD_RGB_RESTART_IN_VSYNC=y +# CONFIG_LCD_RGB_RESTART_IN_VSYNC is not set # # Bluetooth From fcd839e252ed3cc9f83279b60f6ab046e5645be2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 6 Apr 2024 12:13:33 +0200 Subject: [PATCH 380/636] default IDF 5.1 / Arduino 3.0 --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 14dadeac9..2faff00ce 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: S3 OPI 120Mhz no reset vsync +name: IDF v5.1 on: workflow_dispatch: # Manually start a workflow From 059d150d5f50b38fd0417c5a32d504b20189a1bb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 6 Apr 2024 13:16:48 +0200 Subject: [PATCH 381/636] CONFIG_LCD_RGB_RESTART_IN_VSYNC=y without shift appears sometimes --- configs/defconfig.esp32s3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 210bbb8bd..5a96b55b8 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -22,7 +22,7 @@ CONFIG_BOOTLOADER_FLASH_DC_AWARE=y # # S3 Display shift fix -> https://espressif-docs.readthedocs-hosted.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html # -# CONFIG_LCD_RGB_RESTART_IN_VSYNC is not set +CONFIG_LCD_RGB_RESTART_IN_VSYNC=y # # Bluetooth From a50850fe089e0c31e1eb0411d93ae091906d3dc0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 7 Apr 2024 12:24:28 +0200 Subject: [PATCH 382/636] rm options dangerous with only 2MB PSRAM --- configs/defconfig.esp32s2 | 3 --- 1 file changed, 3 deletions(-) diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 23842a80b..4363869bf 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -1,9 +1,6 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y -CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y -CONFIG_SPIRAM_RODATA=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y CONFIG_ESP32S2_KEEP_USB_ALIVE=y CONFIG_ULP_COPROC_ENABLED=y CONFIG_ESP32_ULP_COPROC_RISCV=y From fac385065954d3650ad698ffd039b1cf1d0950e6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 7 Apr 2024 12:25:21 +0200 Subject: [PATCH 383/636] rm options dangerous with only 2MB PSRAM --- configs/defconfig.esp32s3 | 3 --- 1 file changed, 3 deletions(-) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 5a96b55b8..b772c28b1 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -6,10 +6,7 @@ CONFIG_ULP_COPROC_RESERVE_MEM=4096 CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y -CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y -CONFIG_SPIRAM_RODATA=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set From 3963dc271d8f0450283bf0a2a3845ef8abe1a84e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:12:52 +0200 Subject: [PATCH 384/636] rm -rf "$AR_COMPS/arduino/libraries/NetworkClientSecure" --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 0108de4ee..7e6fac782 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -84,6 +84,7 @@ rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE" rm -rf "$AR_COMPS/arduino/libraries/BluetoothSerial" rm -rf "$AR_COMPS/arduino/libraries/WiFiProv" rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure" +rm -rf "$AR_COMPS/arduino/libraries/NetworkClientSecure" rm -rf "$AR_COMPS/arduino/libraries/ESP32" rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" From 1d9396efdfa2b64d2074f40d9d63ecca3ed50a2f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:14:03 +0200 Subject: [PATCH 385/636] rm -rf arduino-esp32/libraries/NetworkClientSecure --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 6bd370eb6..5a4363cb3 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -33,6 +33,7 @@ rm -rf arduino-esp32/libraries/SimpleBLE rm -rf arduino-esp32/libraries/BluetoothSerial rm -rf arduino-esp32/libraries/WiFiProv rm -rf arduino-esp32/libraries/WiFiClientSecure +rm -rf arduino-esp32/libraries/NetworkClientSecure rm -rf arduino-esp32/libraries/ESP_SR rm -rf arduino-esp32/libraries/ESP_NOW rm -rf arduino-esp32/libraries/TFLiteMicro From a6d9a3afbf5f72357e050819e6fcadd30efb1e89 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 12:30:43 +0200 Subject: [PATCH 386/636] AR_BRANCH="main_cdc_pr" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index a5cdfe840..bf99dc82a 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="main" + AR_BRANCH="main_cdc_pr" fi if [ -z $IDF_TARGET ]; then From 0f02ba02ca2e470167c303d423b3ca42a78911da Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 16:49:16 +0200 Subject: [PATCH 387/636] AR_BRANCH="main" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index bf99dc82a..a5cdfe840 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="main_cdc_pr" + AR_BRANCH="main" fi if [ -z $IDF_TARGET ]; then From 72be81c836adf56a531b1c95eb93fec0f7ecad4a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 17:36:59 +0200 Subject: [PATCH 388/636] add graphic tool --- README.md | 31 ++++ tools/config_editor/.gitignore | 2 + tools/config_editor/README.md | 38 +++++ tools/config_editor/app.py | 270 ++++++++++++++++++++++++++++++++ tools/config_editor/compile.py | 163 +++++++++++++++++++ tools/config_editor/editor.py | 86 ++++++++++ tools/config_editor/settings.py | 133 ++++++++++++++++ tools/config_editor/style.tcss | 202 ++++++++++++++++++++++++ tools/config_editor/widgets.py | 95 +++++++++++ 9 files changed, 1020 insertions(+) create mode 100644 tools/config_editor/.gitignore create mode 100644 tools/config_editor/README.md create mode 100755 tools/config_editor/app.py create mode 100644 tools/config_editor/compile.py create mode 100644 tools/config_editor/editor.py create mode 100644 tools/config_editor/settings.py create mode 100644 tools/config_editor/style.tcss create mode 100644 tools/config_editor/widgets.py diff --git a/README.md b/README.md index 9e78ce862..516667514 100644 --- a/README.md +++ b/README.md @@ -11,5 +11,36 @@ git clone https://github.com/Jason2866/esp32-arduino-lib-builder cd esp32-arduino-lib-builder ./build.sh ``` + + +### Using the User Interface + +You can more easily build the libraries using the user interface found in the `tools/config_editor/` folder. +It is a Python script that allows you to select and edit the options for the libraries you want to build. +The script has mouse support and can also be pre-configured using the same command line arguments as the `build.sh` script. +For more information and troubleshooting, please refer to the [UI README](tools/config_editor/README.md). + +To use it, follow these steps: + +1. Make sure you have the required dependencies installed: + - Python 3.9 or later + - The [Textual](https://github.com/textualize/textual/) library + - All the dependencies listed in the previous section + +2. Execute the script `tools/config_editor/app.py` from any folder. It will automatically detect the path to the root of the repository. + +3. Configure the compilation and ESP-IDF options as desired. + +4. Click on the "Compile Static Libraries" button to start the compilation process. + +5. 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. + +6. 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. + - 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. + +### Documentation + +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) + ### Development builds Look in release and download a version. There is the Info of the used commits of IDF / Arduino. diff --git a/tools/config_editor/.gitignore b/tools/config_editor/.gitignore new file mode 100644 index 000000000..a230a78ae --- /dev/null +++ b/tools/config_editor/.gitignore @@ -0,0 +1,2 @@ +.venv/ +__pycache__/ diff --git a/tools/config_editor/README.md b/tools/config_editor/README.md new file mode 100644 index 000000000..c2bf755ee --- /dev/null +++ b/tools/config_editor/README.md @@ -0,0 +1,38 @@ +# Arduino Static Libraries Configuration Editor + +This is a simple application to configure the static libraries for the ESP32 Arduino core. +It allows the user to select the targets to compile, change the configuration options and compile the libraries. +It has mouse support and can be pre-configured using command line arguments. + +## Requirements + - Python 3.9 or later + - The "textual" library (install it using `pip install textual`) + - The requirements from esp32-arduino-lib-builder + +## Troubleshooting + +In some cases, the UI might not look as expected. This can happen due to the terminal emulator not supporting the required features. + +### WSL + +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. +The Windows Terminal can be installed from the Microsoft Store. + +### MacOS + +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. + +## Usage + +These command line arguments can be used to pre-configure the application: + +``` +Command line arguments: + -t, --target <target> Comma-separated list of targets to be compiled. + Choose from: all, esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2. Default: all except esp32c2 + --copy, --no-copy Enable/disable copying the compiled libraries to arduino-esp32. Enabled by default + -c, --arduino-path <path> Path to arduino-esp32 directory. Default: OS dependent + -A, --arduino-branch <branch> Branch of the arduino-esp32 repository to be used. Default: set by the build script + -I, --idf-branch <branch> Branch of the ESP-IDF repository to be used. Default: set by the build script + -i, --idf-commit <commit> Commit of the ESP-IDF repository to be used. Default: set by the build script +``` diff --git a/tools/config_editor/app.py b/tools/config_editor/app.py new file mode 100755 index 000000000..e2d6d6b99 --- /dev/null +++ b/tools/config_editor/app.py @@ -0,0 +1,270 @@ +#!/usr/bin/env python + +""" +Arduino Static Libraries Configuration Editor + +This is a simple application to configure the static libraries for the ESP32 Arduino core. +It allows the user to select the targets to compile, change the configuration options and compile the libraries. + +Requires Python 3.9 or later. + +The application is built using the "textual" library, which is a Python library for building text-based user interfaces. + +Note that this application still needs the requirements from esp32-arduino-lib-builder to be installed. + +Command line arguments: + -t, --target <target> Comma-separated list of targets to be compiled. + Choose from: all, esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2. Default: all except esp32c2 + --copy, --no-copy Enable/disable copying the compiled libraries to arduino-esp32. Enabled by default + -c, --arduino-path <path> Path to arduino-esp32 directory. Default: OS dependent + -A, --arduino-branch <branch> Branch of the arduino-esp32 repository to be used. Default: set by the build script + -I, --idf-branch <branch> Branch of the ESP-IDF repository to be used. Default: set by the build script + -i, --idf-commit <commit> Commit of the ESP-IDF repository to be used. Default: set by the build script + +""" + +import argparse +import json +import os +import platform +import sys + +from pathlib import Path + +try: + from textual.app import App, ComposeResult + from textual.binding import Binding + from textual.containers import VerticalScroll + from textual.screen import Screen + from textual.widgets import Button, Header, Label, Footer +except ImportError: + print("Please install the \"textual\" package before running this script.") + exit(1) + +from settings import SettingsScreen +from editor import EditorScreen +from compile import CompileScreen + +class MainScreen(Screen): + # Main screen class + + # Set the key bindings + BINDINGS = [ + Binding("c", "app.push_screen('compile')", "Compile"), + Binding("e", "app.push_screen('editor')", "Editor"), + Binding("s", "app.push_screen('settings')", "Settings"), + Binding("q", "app.quit", "Quit"), + ] + + def on_button_pressed(self, event: Button.Pressed) -> None: + # Event handler called when a button is pressed + if event.button.id == "compile-button": + print("Compile button pressed") + self.app.push_screen("compile") + elif event.button.id == "settings-button": + print("Settings button pressed") + self.app.push_screen("settings") + elif event.button.id == "editor-button": + print("Editor button pressed") + self.app.push_screen("editor") + elif event.button.id == "quit-button": + print("Quit button pressed") + self.app.exit() + + def compose(self) -> ComposeResult: + # Compose main menu + yield Header() + with VerticalScroll(id="main-menu-container"): + yield Label("ESP32 Arduino Static Libraries Configuration Editor", id="main-menu-title") + yield Button("Compile Static Libraries", id="compile-button", classes="main-menu-button") + yield Button("Sdkconfig Editor", id="editor-button", classes="main-menu-button") + yield Button("Settings", id="settings-button", classes="main-menu-button") + yield Button("Quit", id="quit-button", classes="main-menu-button") + yield Footer() + + def on_mount(self) -> None: + # Event handler called when the app is mounted for the first time + self.title = "Configurator" + self.sub_title = "Main Menu" + print("Main screen mounted.") + +class ConfigEditorApp(App): + # Main application class + + # Set the root and script paths + SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) + ROOT_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..")) + + # Set the application options + supported_targets = [] + setting_enable_copy = True + + # Options to be set by the command line arguments + setting_target = "" + setting_arduino_path = "" + setting_arduino_branch = "" + setting_idf_branch = "" + setting_idf_commit = "" + + ENABLE_COMMAND_PALETTE = False + CSS_PATH = "style.tcss" + SCREENS = { + "main": MainScreen(), + "settings": SettingsScreen(), + "compile": CompileScreen(), + "editor": EditorScreen(), + } + + def on_mount(self) -> None: + print("Application mounted. Initial options:") + print("Python version: " + sys.version) + print("Root path: " + self.ROOT_PATH) + print("Script path: " + self.SCRIPT_PATH) + print("Supported Targets: " + ", ".join(self.supported_targets)) + print("Default targets: " + self.setting_target) + print("Enable Copy: " + str(self.setting_enable_copy)) + print("Arduino Path: " + str(self.setting_arduino_path)) + print("Arduino Branch: " + str(self.setting_arduino_branch)) + print("IDF Branch: " + str(self.setting_idf_branch)) + print("IDF Commit: " + str(self.setting_idf_commit)) + self.push_screen("main") + +def arduino_default_path(): + sys_name = platform.system() + home = str(Path.home()) + if sys_name == "Linux": + return os.path.join(home, "Arduino", "hardware", "espressif", "esp32") + else: # Windows and MacOS + return os.path.join(home, "Documents", "Arduino", "hardware", "espressif", "esp32") + +def check_arduino_path(path): + return os.path.isdir(path) + +def main() -> None: + # Set the PYTHONUNBUFFERED environment variable to "1" to disable the output buffering + os.environ['PYTHONUNBUFFERED'] = "1" + + # Check Python version + if sys.version_info < (3, 9): + print("This script requires Python 3.9 or later") + exit(1) + + app = ConfigEditorApp() + + # List of tuples for the target choices containing the target name and if it is enabled by default + target_choices = [] + + # Parse build JSON file + build_json_path = os.path.join(app.ROOT_PATH, "configs", "builds.json") + if os.path.isfile(build_json_path): + with open(build_json_path, "r") as build_json_file: + build_json = json.load(build_json_file) + for target in build_json["targets"]: + try: + default = False if target["skip"] else True + except: + default = True + target_choices.append((target["target"], default)) + else: + print("Error: configs/builds.json file not found.") + exit(1) + + target_choices.sort(key=lambda x: x[0]) + + parser = argparse.ArgumentParser(description="Configure and compile the ESP32 Arduino static libraries") + + parser.add_argument("-t", "--target", + metavar="<target>", + type=str, + default="default", + required=False, + help="Comma-separated list of targets to be compiled. Choose from: " + ", ".join([x[0] for x in target_choices]) + + ". Default: All except " + ", ".join([x[0] for x in target_choices if not x[1]])) + + parser.add_argument("--copy", + type=bool, + action=argparse.BooleanOptionalAction, + default=True, + required=False, + help="Enable/disable copying the compiled libraries to arduino-esp32. Enabled by default") + + parser.add_argument("-c", "--arduino-path", + metavar="<arduino path>", + type=str, + default=arduino_default_path(), + required=False, + help="Path to arduino-esp32 directory. Default: " + arduino_default_path()) + + parser.add_argument("-A", "--arduino-branch", + metavar="<arduino branch>", + type=str, + default="", + required=False, + help="Branch of the arduino-esp32 repository to be used") + + parser.add_argument("-I", "--idf-branch", + metavar="<IDF branch>", + type=str, + default="", + required=False, + help="Branch of the ESP-IDF repository to be used") + + parser.add_argument("-i", "--idf-commit", + metavar="<IDF commit>", + type=str, + default="", + required=False, + help="Commit of the ESP-IDF repository to be used") + + + args = parser.parse_args() + + # Force targets to be lower case + args.target = args.target.lower() + + # Check if the target is valid + if args.target == "default": + args.target = ",".join([x[0] for x in target_choices if x[1]]) + elif args.target == "all": + args.target = ",".join([x[0] for x in target_choices]) + + app.supported_targets = [x[0] for x in target_choices] + + for target in args.target.split(","): + if target not in app.supported_targets: + print("Invalid target: " + target) + exit(1) + + app.setting_target = args.target + + # Check if the Arduino path is valid + if args.copy: + if check_arduino_path(args.arduino_path): + app.setting_enable_copy = True + elif args.arduino_path == arduino_default_path(): + print("Warning: Default Arduino path not found. Disabling copy to Arduino.") + app.setting_enable_copy = False + else: + print("Invalid path to Arduino core: " + os.path.abspath(args.arduino_path)) + exit(1) + else: + app.setting_enable_copy = False + + # Set the other options + app.setting_arduino_path = os.path.abspath(args.arduino_path) + app.setting_arduino_branch = args.arduino_branch + app.setting_idf_branch = args.idf_branch + app.setting_idf_commit = args.idf_commit + + # Change to the root directory of the app to the root of the project + os.chdir(app.ROOT_PATH) + + # Main function to run the app + app.run() + + # Propagate the exit code from the app + exit(app.return_code or 0) + +if __name__ == "__main__": + # If this script is run directly, start the app + main() diff --git a/tools/config_editor/compile.py b/tools/config_editor/compile.py new file mode 100644 index 000000000..4dad1d5f3 --- /dev/null +++ b/tools/config_editor/compile.py @@ -0,0 +1,163 @@ +import sys +import subprocess +import os + +from rich.console import RenderableType + +from textual import on, work +from textual.app import ComposeResult +from textual.binding import Binding +from textual.events import ScreenResume +from textual.containers import Container +from textual.screen import Screen +from textual.widgets import Header, Static, RichLog, Button, Footer + +class CompileScreen(Screen): + # Compile screen + + # Set the key bindings + BINDINGS = [ + Binding("escape", "back", "Back") + ] + + # Child process running the libraries compilation + child_process = None + + log_widget: RichLog + button_widget: Button + + def action_back(self) -> None: + self.workers.cancel_all() + if self.child_process: + # Terminate the child process if it is running + print("Terminating child process") + self.child_process.terminate() + try: + self.child_process.stdout.close() + self.child_process.stderr.close() + except: + pass + self.child_process.wait() + self.dismiss() + + def print_output(self, renderable: RenderableType, style=None) -> None: + # Print output to the RichLog widget + if style is None: + self.log_widget.write(renderable) + else: + # Check the available styles at https://rich.readthedocs.io/en/stable/style.html + self.log_widget.write("[" + str(style) + "]" + renderable) + + def print_error(self, error: str) -> None: + # Print error to the RichLog widget + self.log_widget.write("[b bright_red]" + error) + self.button_widget.add_class("-error") + #print("Error: " + error) # For debugging + + def print_success(self, message: str) -> None: + # Print success message to the RichLog widget + self.log_widget.write("[b bright_green]" + message) + self.button_widget.add_class("-success") + #print("Success: " + message) # For debugging + + def print_info(self, message: str) -> None: + # Print info message to the RichLog widget + self.log_widget.write("[b bright_cyan]" + message) + #print("Info: " + message) # For debugging + + @work(name="compliation_worker", group="compilation", exclusive=True, thread=True) + def compile_libs(self) -> None: + # Compile the libraries + print("Starting compilation process") + + label = self.query_one("#compile-title", Static) + self.child_process = None + if self.app.setting_target == ",".join(self.app.supported_targets): + target = "all targets" + else: + target = self.app.setting_target.replace(",", ", ").upper() + + label.update("Compiling for " + target) + self.print_info("======== Compiling for " + target + " ========") + + command = ["./build.sh", "-t", self.app.setting_target] + + #command.append("--help") # For testing output without compiling + + if self.app.setting_enable_copy: + if os.path.isdir(self.app.setting_arduino_path): + command.extend(["-c", self.app.setting_arduino_path]) + else: + self.print_error("Invalid path to Arduino core: " + self.app.setting_arduino_path) + label.update("Invalid path to Arduino core") + return + + if self.app.setting_arduino_branch: + command.extend(["-A", self.app.setting_arduino_branch]) + + if self.app.setting_idf_branch: + command.extend(["-I", self.app.setting_idf_branch]) + + if self.app.setting_idf_commit: + command.extend(["-i", self.app.setting_idf_commit]) + + self.print_info("Running: " + " ".join(command) + "\n") + self.child_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + try: + for output in self.child_process.stdout: + if output == '' and self.child_process.poll() is not None: + break + if output: + self.print_output(output.strip()) # Update RichLog widget with subprocess output + self.child_process.stdout.close() + except Exception as e: + print("Error reading child process output: " + str(e)) + print("Process might have terminated") + + if not self.child_process: + self.print_error("Compilation failed for " + target + "Child process failed to start") + label.update("Compilation failed for " + target + "Child process failed to start") + return + else: + self.child_process.wait() + + if self.child_process.returncode != 0: + self.print_error("Compilation failed for " + target + ". Return code: " + str(self.child_process.returncode)) + self.print_error("Errors:") + try: + for error in self.child_process.stderr: + if error: + self.print_error(error.strip()) + self.child_process.stderr.close() + except Exception as e: + print("Error reading child process errors: " + str(e)) + label.update("Compilation failed for " + target) + else: + self.print_success("Compilation successful for " + target) + label.update("Compilation successful for " + target) + + def on_button_pressed(self, event: Button.Pressed) -> None: + # Event handler called when a button is pressed + self.action_back() + + @on(ScreenResume) + def on_resume(self) -> None: + # Event handler called every time the screen is activated + print("Compile screen resumed. Clearing logs and starting compilation process") + self.button_widget.remove_class("-error") + self.button_widget.remove_class("-success") + self.log_widget.clear() + self.log_widget.focus() + self.compile_libs() + + def compose(self) -> ComposeResult: + # Compose the compilation screen + yield Header() + with Container(id="compile-log-container"): + self.log_widget = RichLog(markup=True, id="compile-log") + yield self.log_widget + with Container(id="compile-status-container"): + yield Static("Compiling for ...", id="compile-title") + self.button_widget = Button("Back", id="compile-back-button") + yield self.button_widget + yield Footer() diff --git a/tools/config_editor/editor.py b/tools/config_editor/editor.py new file mode 100644 index 000000000..87217f49d --- /dev/null +++ b/tools/config_editor/editor.py @@ -0,0 +1,86 @@ +import os + +from textual import on +from textual.app import ComposeResult +from textual.binding import Binding +from textual.containers import Container, VerticalScroll, Horizontal +from textual.screen import Screen +from textual.events import ScreenResume +from textual.widgets import DirectoryTree, Header, TextArea, Button, Footer + +class EditorScreen(Screen): + # Configuration file editor screen + + # Set the key bindings + BINDINGS = [ + Binding("ctrl+s", "save", "Save", priority=True), + Binding("escape", "app.pop_screen", "Discard") + ] + + # Current file being edited + current_file = "" + + def action_save(self) -> None: + code_view = self.query_one("#code", TextArea) + current_text = code_view.text + try: + file = open(self.curent_file, "w") + file.write(current_text) + file.close() + except Exception: + print("Error saving file: " + self.curent_file) + self.sub_title = "ERROR" + else: + print("File saved: " + self.curent_file) + self.sub_title = self.curent_file + self.dismiss() + + def on_button_pressed(self, event: Button.Pressed) -> None: + # Event handler called when a button is pressed + if event.button.id == "save-editor-button" and self.curent_file != "": + print("Save button pressed. Trying to save file: " + self.curent_file) + self.action_save() + elif event.button.id == "cancel-editor-button": + print("Cancel button pressed") + self.dismiss() + + def on_directory_tree_file_selected(self, event: DirectoryTree.FileSelected) -> None: + # Called when the user click a file in the directory tree + event.stop() + code_view = self.query_one("#code", TextArea) + code_view.clear() + self.curent_file = str(event.path) + try: + print("Opening file: " + self.curent_file) + file = open(self.curent_file, "r") + file_content = file.read() + file.close() + except Exception: + print("Error opening file: " + self.curent_file) + self.sub_title = "ERROR" + else: + print("File opened: " + self.curent_file) + code_view.insert(file_content) + self.sub_title = self.curent_file + + @on(ScreenResume) + def on_resume(self) -> None: + # Event handler called every time the screen is activated + print("Editor screen resumed. Clearing code view") + self.sub_title = "Select a file" + self.query_one(DirectoryTree).focus() + self.query_one(TextArea).clear() + self.curent_file = "" + + def compose(self) -> ComposeResult: + # Compose editor screen + path = os.path.join(self.app.ROOT_PATH, 'configs') + yield Header() + with Container(): + yield DirectoryTree(path, id="tree-view") + with VerticalScroll(id="code-view"): + yield TextArea.code_editor("", id="code") + with Horizontal(id="editor-buttons-container"): + yield Button("Save", id="save-editor-button", classes="editor-button") + yield Button("Cancel", id="cancel-editor-button", classes="editor-button") + yield Footer() diff --git a/tools/config_editor/settings.py b/tools/config_editor/settings.py new file mode 100644 index 000000000..e5c833ae8 --- /dev/null +++ b/tools/config_editor/settings.py @@ -0,0 +1,133 @@ +import math + +from textual import on +from textual.app import ComposeResult +from textual.binding import Binding +from textual.containers import VerticalScroll, Container, Horizontal +from textual.screen import Screen +from textual.events import ScreenResume +from textual.widgets import Header, Button, Switch, Label, Footer, Checkbox + +from widgets import LabelledInput, LabelledSelect + +class SettingsScreen(Screen): + # Settings screen + + # Set the key bindings + BINDINGS = [ + Binding("s", "save", "Save"), + Binding("escape", "app.pop_screen", "Discard") + ] + + enable_copy_switch: Switch + arduino_path_input: LabelledInput + arduino_branch_input: LabelledInput + idf_branch_input: LabelledInput + idf_commit_input: LabelledInput + + def action_save(self) -> None: + checkboxes = self.query(Checkbox) + self.app.setting_target = "" + for checkbox in checkboxes: + if checkbox.value: + if self.app.setting_target: + self.app.setting_target += "," + self.app.setting_target += checkbox.id.replace("-checkbox", "") + print("Target setting updated: " + self.app.setting_target) + + self.app.setting_enable_copy = self.enable_copy_switch.value + print("Enable copy setting updated: " + str(self.app.setting_enable_copy)) + + if self.enable_copy_switch.value: + self.app.setting_arduino_path = self.arduino_path_input.get_input_value() + print("Arduino path setting updated: " + self.app.setting_arduino_path) + + self.app.setting_arduino_branch = self.arduino_branch_input.get_input_value() + print("Arduino branch setting updated: " + self.app.setting_arduino_branch) + + self.app.setting_idf_branch = self.idf_branch_input.get_input_value() + print("IDF branch setting updated: " + self.app.setting_idf_branch) + + self.app.setting_idf_commit = self.idf_commit_input.get_input_value() + print("IDF commit setting updated: " + self.app.setting_idf_commit) + + + def on_button_pressed(self, event: Button.Pressed) -> None: + # Event handler called when a button is pressed + if event.button.id == "save-settings-button": + print("Save button pressed") + self.action_save() + elif event.button.id == "cancel-settings-button": + print("Cancel button pressed") + self.dismiss() + + @on(ScreenResume) + def on_resume(self) -> None: + # Event handler called every time the screen is activated + print("Settings screen resumed. Updating settings.") + targets = self.app.setting_target.split(",") + checkboxes = self.query(Checkbox) + for checkbox in checkboxes: + checkbox.value = False + if checkbox.id.replace("-checkbox", "") in targets: + checkbox.value = True + self.enable_copy_switch.value = self.app.setting_enable_copy + if self.app.setting_enable_copy: + self.arduino_path_input.visible = True + else: + self.arduino_path_input.visible = False + self.arduino_path_input.set_input_value(self.app.setting_arduino_path) + self.arduino_branch_input.set_input_value(self.app.setting_arduino_branch) + self.idf_branch_input.set_input_value(self.app.setting_idf_branch) + self.idf_commit_input.set_input_value(self.app.setting_idf_commit) + + def on_switch_changed(self, event: Switch.Changed) -> None: + # Event handler called when a switch is changed + if event.switch.id == "enable-copy-switch": + if event.switch.value: + self.arduino_path_input.visible = True + else: + self.arduino_path_input.visible = False + + def compose(self) -> ComposeResult: + # Compose the target selection screen + yield Header() + with VerticalScroll(id="settings-scroll-container"): + + yield Label("Compilation Targets", id="settings-target-label") + with Container(id="settings-target-container"): + for target in self.app.supported_targets: + yield Checkbox(target.upper(), id=target + "-checkbox") + + with Horizontal(classes="settings-switch-container"): + self.enable_copy_switch = Switch(value=self.app.setting_enable_copy, id="enable-copy-switch") + yield self.enable_copy_switch + + yield Label("Copy to arduino-esp32 after compilation") + + 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") + yield self.arduino_path_input + + self.arduino_branch_input = LabelledInput("Arduino-esp32 Branch", placeholder="Leave empty to use default", value=self.app.setting_arduino_branch, id="arduino-branch-input") + yield self.arduino_branch_input + + self.idf_branch_input = LabelledInput("ESP-IDF Branch", placeholder="Leave empty to use default", value=self.app.setting_idf_branch, id="idf-branch-input") + yield self.idf_branch_input + + self.idf_commit_input = LabelledInput("ESP-IDF Commit", placeholder="Leave empty to use default", value=self.app.setting_idf_commit, id="idf-commit-input") + yield self.idf_commit_input + + with Horizontal(id="settings-button-container"): + yield Button("Save", id="save-settings-button", classes="settings-button") + yield Button("Cancel", id="cancel-settings-button", classes="settings-button") + yield Footer() + + def on_mount(self) -> None: + # Event handler called when the screen is mounted for the first time + self.sub_title = "Settings" + target_container = self.query_one("#settings-target-container") + # Height needs to be 3 for each row of targets + 1 + height_value = str(int(math.ceil(len(self.app.supported_targets) / int(target_container.styles.grid_size_columns)) * 3 + 1)) + print("Target container height: " + height_value) + target_container.styles.height = height_value + print("Settings screen mounted") diff --git a/tools/config_editor/style.tcss b/tools/config_editor/style.tcss new file mode 100644 index 000000000..4359e58e0 --- /dev/null +++ b/tools/config_editor/style.tcss @@ -0,0 +1,202 @@ +# General + +Screen { + background: $surface-darken-1; +} + +Button { + width: auto; + min-width: 16; + height: auto; + color: $text; + border: none; + background: #038c8c; + border-top: tall #026868; + border-bottom: tall #6ab8b8; + text-align: center; + content-align: center middle; + text-style: bold; + + &:focus { + text-style: bold reverse; + } + &:hover { + border-top: tall #014444; + border-bottom: tall #3d8080; + background: #025b5b; + color: $text; + } + &.-active { + background: #025b5b; + border-bottom: tall #3d8080; + border-top: tall #014444; + tint: $background 30%; + } + + &.-success { + background: $success; + color: $text; + border-top: tall $success-lighten-2; + border-bottom: tall $success-darken-3; + + &:hover { + background: $success-darken-2; + color: $text; + border-top: tall $success; + } + + &.-active { + background: $success; + border-bottom: tall $success-lighten-2; + border-top: tall $success-darken-2; + } + } + + &.-error { + background: $error; + color: $text; + border-top: tall $error-lighten-2; + border-bottom: tall $error-darken-3; + + &:hover { + background: $error-darken-1; + color: $text; + border-top: tall $error; + } + + &.-active { + background: $error; + border-bottom: tall $error-lighten-2; + border-top: tall $error-darken-2; + } + } +} + +# Main Screen + +.main-menu-button { + margin-bottom: 1; + min-width: 100%; + max-width: 0.4fr; +} + +#main-menu-container { + align: center middle; + width: 1fr; +} + +#main-menu-title { + text-align: center; + margin-bottom: 4; + text-style: bold; + color: auto; + width: 0.4fr; +} + +# Compile Screen + +#compile-status-container { + layout: horizontal; + padding: 0 2; + height: 4; +} + +#compile-title { + dock: left; +} + +#compile-back-button { + dock: right; +} + +#compile-log { + background: $surface; + padding: 0 1 1 1; + margin: 1 2; +} + +# Settings Screen + +#settings-scroll-container { + padding: 1; +} + +#settings-button-container { + width: 100%; + max-height: 20%; + min-height: 5; + align: center middle; +} + +#settings-target-label { + margin-left: 1; +} + +#settings-target-container { + layout: grid; + grid-size: 4; +} + +#settings-target-container Checkbox { + width: 100%; + margin-right: -1; +} + +.settings-button { + margin: 1; + min-width: 100%; + max-width: 0.2fr; + align: center middle; +} + +.settings-switch-container { + height: 4; +} + +.settings-switch-container Switch { + margin-right: 2; +} + +.settings-switch-container Label { + margin-top: 1; +} + +# Editor Screen + +#tree-view { + display: none; + scrollbar-gutter: stable; + overflow: auto; + width: auto; + height: 100%; + dock: left; + display: block; + max-width: 50%; +} + +#code-view { + overflow: auto scroll; + min-width: 100%; +} + +#code { + width: 100%; +} + +.editor-button { + width: 20%; +} + +#save-editor-button { + dock: left; + margin: 1; +} + +#cancel-editor-button { + dock: right; + margin: 1 3; +} + +#editor-buttons-container { + height: 5; +} diff --git a/tools/config_editor/widgets.py b/tools/config_editor/widgets.py new file mode 100644 index 000000000..afec3297f --- /dev/null +++ b/tools/config_editor/widgets.py @@ -0,0 +1,95 @@ +from textual.widget import Widget + +from textual.widgets import Input, Label, Select + +class LabelledInput(Widget): + DEFAULT_CSS = """ + LabelledInput { + height: 4; + margin-bottom: 1; + } + LabelledInput Label { + padding-left: 1; + } + """ + + label_widget: Label + input_widget: Input + + def set_input_value(self, value): + self.input_widget.value = value + + def get_input_value(self): + return self.input_widget.value + + def __init__(self, + label, + *, + placeholder="", + value="", + name=None, + id=None, + classes=None, + disabled=False): + super().__init__(name=name, id=id, classes=classes, disabled=disabled) + self.__label = label + self.__placeholder = placeholder + self.__init_value = value + + def compose(self): + self.label_widget = Label(f"{self.__label}:") + self.input_widget = Input(placeholder=self.__placeholder, value=self.__init_value) + yield self.label_widget + yield self.input_widget + + +class LabelledSelect(Widget): + DEFAULT_CSS = """ + LabelledSelect { + height: 4; + margin-bottom: 1; + } + LabelledSelect Label { + padding-left: 1; + } + """ + + label_widget: Label + select_widget: Select + + def set_select_options(self, options): + self.__options = options + self.select_widget.options = options + + def get_select_options(self): + return self.__options + + def set_select_value(self, value): + self.select_widget.value = value + + def get_select_value(self): + return self.select_widget.value + + def __init__(self, + label, + options, + *, + prompt="Select", + allow_blank=True, + value=Select.BLANK, + name=None, + id=None, + classes=None, + disabled=False): + super().__init__(name=name, id=id, classes=classes, disabled=disabled) + self.__label = label + self.__options = options + self.__init_value = value + self.__prompt = prompt + self.__allow_blank = allow_blank + + def compose(self): + self.label_widget = Label(f"{self.__label}:") + self.select_widget = Select(options=self.__options, value=self.__init_value, prompt=self.__prompt, allow_blank=self.__allow_blank) + yield self.label_widget + yield self.select_widget From 4cde702a24b16c944d8ee6323bbbe4e479987fd7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:15:16 +0200 Subject: [PATCH 389/636] disable copy to Arduino folder --- tools/config_editor/README.md | 2 +- tools/config_editor/app.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/config_editor/README.md b/tools/config_editor/README.md index c2bf755ee..0ca0aaf0a 100644 --- a/tools/config_editor/README.md +++ b/tools/config_editor/README.md @@ -30,7 +30,7 @@ These command line arguments can be used to pre-configure the application: Command line arguments: -t, --target <target> Comma-separated list of targets to be compiled. Choose from: all, esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2. Default: all except esp32c2 - --copy, --no-copy Enable/disable copying the compiled libraries to arduino-esp32. Enabled by default + --copy, --no-copy Enable/disable copying the compiled libraries to arduino-esp32. Disabled by default -c, --arduino-path <path> Path to arduino-esp32 directory. Default: OS dependent -A, --arduino-branch <branch> Branch of the arduino-esp32 repository to be used. Default: set by the build script -I, --idf-branch <branch> Branch of the ESP-IDF repository to be used. Default: set by the build script diff --git a/tools/config_editor/app.py b/tools/config_editor/app.py index e2d6d6b99..f92b283ac 100755 --- a/tools/config_editor/app.py +++ b/tools/config_editor/app.py @@ -15,7 +15,7 @@ Command line arguments: -t, --target <target> Comma-separated list of targets to be compiled. Choose from: all, esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2. Default: all except esp32c2 - --copy, --no-copy Enable/disable copying the compiled libraries to arduino-esp32. Enabled by default + --copy, --no-copy Enable/disable copying the compiled libraries to arduino-esp32. Disabled by default -c, --arduino-path <path> Path to arduino-esp32 directory. Default: OS dependent -A, --arduino-branch <branch> Branch of the arduino-esp32 repository to be used. Default: set by the build script -I, --idf-branch <branch> Branch of the ESP-IDF repository to be used. Default: set by the build script @@ -97,7 +97,7 @@ class ConfigEditorApp(App): # Set the application options supported_targets = [] - setting_enable_copy = True + setting_enable_copy = False # Options to be set by the command line arguments setting_target = "" @@ -184,7 +184,7 @@ def main() -> None: parser.add_argument("--copy", type=bool, action=argparse.BooleanOptionalAction, - default=True, + default=False, required=False, help="Enable/disable copying the compiled libraries to arduino-esp32. Enabled by default") From 8bf0388c1736fe1955b3bd26bd7dfd9bae5c61fd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:17:16 +0200 Subject: [PATCH 390/636] changed help text --- tools/config_editor/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config_editor/app.py b/tools/config_editor/app.py index f92b283ac..02ae85d2c 100755 --- a/tools/config_editor/app.py +++ b/tools/config_editor/app.py @@ -186,7 +186,7 @@ def main() -> None: action=argparse.BooleanOptionalAction, default=False, required=False, - help="Enable/disable copying the compiled libraries to arduino-esp32. Enabled by default") + help="Enable/disable copying the compiled libraries to arduino-esp32. Disabled by default") parser.add_argument("-c", "--arduino-path", metavar="<arduino path>", From f92bb7b9523e9f505a63c37d64d3b2ff9cffa733 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:36:19 +0200 Subject: [PATCH 391/636] rm whitespaces --- build.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 35db7b5cd..7de939b4f 100755 --- a/build.sh +++ b/build.sh @@ -63,11 +63,11 @@ while getopts ":A:I:i:c:t:b:sde" opt; do ;; b ) b=$OPTARG - if [ "$b" != "build" ] && - [ "$b" != "menuconfig" ] && - [ "$b" != "reconfigure" ] && - [ "$b" != "idf-libs" ] && - [ "$b" != "copy-bootloader" ] && + if [ "$b" != "build" ] && + [ "$b" != "menuconfig" ] && + [ "$b" != "reconfigure" ] && + [ "$b" != "idf-libs" ] && + [ "$b" != "copy-bootloader" ] && [ "$b" != "mem-variant" ]; then print_help fi @@ -134,7 +134,7 @@ if [ "$BUILD_TYPE" != "all" ]; then # Skip building for targets that are not in the $TARGET array continue fi - + configs="configs/defconfig.common;configs/defconfig.$target" for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do configs="$configs;configs/defconfig.$defconf" @@ -188,7 +188,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do continue fi fi - + # Skip chips that should not be a part of the final libs # WARNING!!! this logic needs to be updated when cron builds are split into jobs if [ "$TARGET" = "all" ] && [ $target_skip -eq 1 ]; then From 6e0c27a15d92eb42a827781096f762ab236bc5cb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Apr 2024 21:45:12 +0200 Subject: [PATCH 392/636] add `*.inc` files --- tools/copy-libs.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index f49434462..219b68add 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -402,6 +402,12 @@ for item; do mkdir -p "$out_cpath$rel_p" cp -n $f "$out_cpath$rel_p/" done + for f in `find "$item" -name '*.inc'`; do + rel_f=${f#*$item} + rel_p=${rel_f%/*} + mkdir -p "$out_cpath$rel_p" + cp -n $f "$out_cpath$rel_p/" + done # Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17 if [[ "$fname" == "bt" && "$out_sub" == "/include/$IDF_TARGET/include" && -f "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" ]]; then mkdir -p "$AR_SDK/include/$fname/controller/$IDF_TARGET" From 47ef169e5076037796aa8df4c00180f80fc7b3d4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:38:20 +0200 Subject: [PATCH 393/636] rm srmodels copy --- tools/copy-libs.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 219b68add..b76e2b5a3 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -484,13 +484,6 @@ echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags" echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" -# sr model.bin -if [ -f "build/srmodels/srmodels.bin" ]; then - mkdir -p "$AR_SDK/esp_sr" - cp -f "build/srmodels/srmodels.bin" "$AR_SDK/esp_sr/" - cp -f "partitions.csv" "$AR_SDK/esp_sr/" -fi - # sdkconfig cp -f "sdkconfig" "$AR_SDK/sdkconfig" From fe4438fff04e61677d06935799771f07870dbd43 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:02:15 +0200 Subject: [PATCH 394/636] rm `-fdebug-prefix-map` entrys from "CCFLAGS" --- tools/copy-libs.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index b76e2b5a3..2de6dbbbd 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -101,7 +101,7 @@ for item in "${@:2:${#@}-5}"; do elif [ "$prefix" = "-O" ]; then PIO_CC_FLAGS+="$item " elif [[ "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then + 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 C_FLAGS+="$item " fi fi @@ -115,7 +115,7 @@ set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then + 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 AS_FLAGS+="$item " if [[ $C_FLAGS == *"$item"* ]]; then PIO_CC_FLAGS+="$item " @@ -134,7 +134,7 @@ set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then + 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 CPP_FLAGS+="$item " if [[ $PIO_CC_FLAGS != *"$item"* ]]; then PIO_CXX_FLAGS+="$item " @@ -204,7 +204,7 @@ for item; do add_next=0 is_script=0 is_dir=0 - elif [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:17}" != "-Wl,--start-group" && "${item:0:15}" != "-Wl,--end-group" ]]; then + elif [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:19}" != "-fdebug-prefix-map=" && "${item:0:17}" != "-Wl,--start-group" && "${item:0:15}" != "-Wl,--end-group" ]]; then LD_FLAGS+="$item " PIO_LD_FLAGS+="$item " fi From 2a68e3108c986fae60e5f9ddc1e35d890493dc83 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:21:09 +0200 Subject: [PATCH 395/636] remove folder "flags" --- tools/archive-build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 5a4363cb3..8cc59ef33 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -56,7 +56,9 @@ cp ../core_version.h arduino-esp32/cores/esp32/core_version.h mv arduino-esp32/ framework-arduinoespressif32/ cd framework-arduinoespressif32/libraries rm -rf **/examples -cd ../../ +cd ../tools/esp32-arduino-libs +rm -rf **/flags +cd ../../../ # If the framework is needed as tar.gz uncomment next line # tar --exclude=.* -zcf ../$pio_archive_path framework-arduinoespressif32/ 7z a -mx=9 -tzip -xr'!.*' ../$pio_zip_archive_path framework-arduinoespressif32/ From b79f0294ab4f2d6b031439bee43b228ced2a8204 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:55:02 +0200 Subject: [PATCH 396/636] Platformio changes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 516667514..fe1a47534 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,8 @@ To use it, follow these steps: 5. 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. -6. 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. - - 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. +6. If the compilation is successful you can find the Platformio framework in the `dist` folder alongside this repository. + ### Documentation From ae17228400f7abe55dcf04bcc78f9b23ef96d3da Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:58:51 +0200 Subject: [PATCH 397/636] Delete configs/defconfig.esp_sr --- configs/defconfig.esp_sr | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 configs/defconfig.esp_sr diff --git a/configs/defconfig.esp_sr b/configs/defconfig.esp_sr deleted file mode 100644 index 03b7c462e..000000000 --- a/configs/defconfig.esp_sr +++ /dev/null @@ -1,37 +0,0 @@ -CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_SR_WN_WN9_HIESP=y -CONFIG_SR_MN_CN_NONE=y -CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y -CONFIG_EN_SPEECH_COMMAND_ID0="" -CONFIG_EN_SPEECH_COMMAND_ID1="" -CONFIG_EN_SPEECH_COMMAND_ID2="" -CONFIG_EN_SPEECH_COMMAND_ID3="" -CONFIG_EN_SPEECH_COMMAND_ID4="" -CONFIG_EN_SPEECH_COMMAND_ID5="" -CONFIG_EN_SPEECH_COMMAND_ID6="" -CONFIG_EN_SPEECH_COMMAND_ID7="" -CONFIG_EN_SPEECH_COMMAND_ID8="" -CONFIG_EN_SPEECH_COMMAND_ID9="" -CONFIG_EN_SPEECH_COMMAND_ID10="" -CONFIG_EN_SPEECH_COMMAND_ID11="" -CONFIG_EN_SPEECH_COMMAND_ID12="" -CONFIG_EN_SPEECH_COMMAND_ID13="" -CONFIG_EN_SPEECH_COMMAND_ID14="" -CONFIG_EN_SPEECH_COMMAND_ID15="" -CONFIG_EN_SPEECH_COMMAND_ID16="" -CONFIG_EN_SPEECH_COMMAND_ID17="" -CONFIG_EN_SPEECH_COMMAND_ID18="" -CONFIG_EN_SPEECH_COMMAND_ID19="" -CONFIG_EN_SPEECH_COMMAND_ID20="" -CONFIG_EN_SPEECH_COMMAND_ID21="" -CONFIG_EN_SPEECH_COMMAND_ID22="" -CONFIG_EN_SPEECH_COMMAND_ID23="" -CONFIG_EN_SPEECH_COMMAND_ID24="" -CONFIG_EN_SPEECH_COMMAND_ID25="" -CONFIG_EN_SPEECH_COMMAND_ID26="" -CONFIG_EN_SPEECH_COMMAND_ID27="" -CONFIG_EN_SPEECH_COMMAND_ID28="" -CONFIG_EN_SPEECH_COMMAND_ID29="" -CONFIG_EN_SPEECH_COMMAND_ID30="" -CONFIG_EN_SPEECH_COMMAND_ID31="" From 6a6fe5915d37c01cb36884d980b9279eb7861124 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Apr 2024 19:07:42 +0200 Subject: [PATCH 398/636] rm unneeded --- tools/install-arduino.sh | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 7e6fac782..a098a61c7 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -89,16 +89,3 @@ rm -rf "$AR_COMPS/arduino/libraries/ESP32" rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" - -# -# CLONE/UPDATE ESP32-ARDUINO-LIBS -# -#if [ ! -d "$IDF_LIBS_DIR" ]; then -# echo "Cloning esp32-arduino-libs..." -# git clone "$AR_LIBS_REPO_URL" "$IDF_LIBS_DIR" -#else -# echo "Updating esp32-arduino-libs..." -# git -C "$IDF_LIBS_DIR" fetch && \ -# git -C "$IDF_LIBS_DIR" pull --ff-only -#fi -#if [ $? -ne 0 ]; then exit 1; fi From edb2dd7d2da80857d9adc3bcab921acb4765efd9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:24:10 +0200 Subject: [PATCH 399/636] rm unneeded from Arduino --- tools/install-arduino.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index a098a61c7..9991750eb 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -73,6 +73,10 @@ if [ $? -ne 0 ]; then exit 1; fi # # remove code and libraries not needed/wanted for Tasmota framework # +rm -rf "$AR_COMPS/arduino/docs" +rm -rf "$AR_COMPS/arduino/idf_component_examples" +rm -rf "$AR_COMPS/arduino/package" +rm -rf "$AR_COMPS/arduino/tests" rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.cpp" rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.h" rm -rf "$AR_COMPS/arduino/libraries/RainMaker" From bd1819191acd46b64d1d92248c81bd85c889fa0f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 13:31:59 +0200 Subject: [PATCH 400/636] we don't need Arduino json --- build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 7de939b4f..42b5cd7ec 100755 --- a/build.sh +++ b/build.sh @@ -276,11 +276,11 @@ done export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) # update package_esp32_index.template.json -if [ "$BUILD_TYPE" = "all" ]; then - python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" - python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -o "$TOOLS_JSON_OUT/" - if [ $? -ne 0 ]; then exit 1; fi -fi +#if [ "$BUILD_TYPE" = "all" ]; then +# python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" +# python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -o "$TOOLS_JSON_OUT/" +# if [ $? -ne 0 ]; then exit 1; fi +#fi # Generate PlatformIO library manifest file if [ "$BUILD_TYPE" = "all" ]; then From 2dc11c0b68c2b7ef999641e3eaa12f7e5be1c6a9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 14:12:36 +0200 Subject: [PATCH 401/636] add esp32-camera version --- build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sh b/build.sh index 42b5cd7ec..14c5ec998 100755 --- a/build.sh +++ b/build.sh @@ -259,6 +259,9 @@ for component in `ls "$AR_COMPS"`; do echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" fi done +# esp32-camera version +component_version="esp32-camera: "$(git -C "$AR_COMPS/esp32-camera" symbolic-ref --short HEAD || git -C "$AR_COMPS/esp32-camera" tag --points-at HEAD)" "$(git -C "$AR_COMPS/esp32-camera" rev-parse --short HEAD) +echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" # TinyUSB version 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) echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" From 261086a1580e256b1cbb2bee76d085cecc054ddc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 14:18:24 +0200 Subject: [PATCH 402/636] Delete tools/gen_tools_json.py --- tools/gen_tools_json.py | 166 ---------------------------------------- 1 file changed, 166 deletions(-) delete mode 100644 tools/gen_tools_json.py diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py deleted file mode 100644 index 20d8f864b..000000000 --- a/tools/gen_tools_json.py +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/env python -# python tools/gen_tools_json.py -i $IDF_PATH -j components/arduino/package/package_esp32_index.template.json -o out/ - -from __future__ import print_function - -__author__ = "Hristo Gochkov" -__version__ = "2023" - -import os -import shutil -import errno -import os.path -import json -import platform -import sys -import stat -import argparse - -if sys.version_info[0] == 3: - unicode = lambda s: str(s) - -if __name__ == '__main__': - - parser = argparse.ArgumentParser( - prog = 'gen_tools_json', - description = 'Update Arduino package index with the tolls found in ESP-IDF') - parser.add_argument('-i', '--esp-idf', dest='idf_path', required=True, help='Path to ESP-IDF') - parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=False, help='path to Arduino package json') - parser.add_argument('-o', '--out-path', dest='out_path', required=True, help='Output path to store the update package json') - args = parser.parse_args() - - simple_output = False - if args.arduino_json == None: - print('Source was not selected') - simple_output = True - else: - print('Source {0}.'.format(args.arduino_json)) - - idf_path = args.idf_path; - arduino_json = args.arduino_json; - out_path = args.out_path; - - # settings - arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","xtensa-esp-elf-gdb","riscv32-esp-elf","riscv32-esp-elf-gdb","openocd-esp32"] - - # code start - farray = {"packages":[{"platforms":[{"toolsDependencies":[]}],"tools":[]}]} - if simple_output == False: - farray = json.load(open(arduino_json)) - - idf_tools = json.load(open(idf_path + '/tools/tools.json')) - for tool in idf_tools['tools']: - try: - tool_index = arduino_tools.index(tool['name']) - except: - continue - tool_name = tool['name'] - tool_version = tool['versions'][0]['name'] - if tool_name.endswith('-elf'): - tool_name += '-gcc' - print('Found {0}, version: {1}'.format(tool_name, tool_version)) - - if simple_output == False: - dep_found = False - dep_skip = False - for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: - if dep['name'] == tool_name: - if dep['version'] == tool_version: - print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) - dep_skip = True - break - print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) - dep['version'] = tool_version - dep_found = True - if dep_skip == True: - continue - if dep_found == False: - print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) - deps = { - "packager": "esp32", - "name": tool_name, - "version": tool_version - } - farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) - else: - print('Adding dependency: {0} version {1}'.format(tool_name, tool_version)) - deps = { - "packager": "esp32", - "name": tool_name, - "version": tool_version - } - farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) - - systems = [] - for arch in tool['versions'][0]: - if arch == 'name' or arch == 'status': - continue - tool_data = tool['versions'][0][arch] - - system = { - "host": '', - "url": tool_data['url'], - "archiveFileName": os.path.basename(tool_data['url']), - "checksum": "SHA-256:"+tool_data['sha256'], - "size": str(tool_data['size']) - } - - if arch == "win32": - system["host"] = "i686-mingw32"; - elif arch == "win64": - system["host"] = "x86_64-mingw32"; - elif arch == "macos-arm64": - system["host"] = "arm64-apple-darwin"; - elif arch == "macos": - system["host"] = "x86_64-apple-darwin"; - elif arch == "linux-amd64": - system["host"] = "x86_64-pc-linux-gnu"; - elif arch == "linux-i686": - system["host"] = "i686-pc-linux-gnu"; - elif arch == "linux-arm64": - system["host"] = "aarch64-linux-gnu"; - elif arch == "linux-armel": - system["host"] = "arm-linux-gnueabihf"; - elif arch == "linux-armhf": - # system["host"] = "arm-linux-gnueabihf"; - continue - else : - continue - - systems.append(system) - - if simple_output == False: - tool_found = False - for t in farray['packages'][0]['tools']: - if t['name'] == tool_name: - t['version'] = tool_version - t['systems'] = systems - tool_found = True - print('Updating binaries of {0} to version {1}'.format(tool_name, tool_version)) - if tool_found == False: - print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) - tools = { - "name": tool_name, - "version": tool_version, - "systems": systems - } - farray['packages'][0]['tools'].append(tools) - else: - print('Adding tool: {0} version {1}'.format(tool_name, tool_version)) - tools = { - "name": tool_name, - "version": tool_version, - "systems": systems - } - farray['packages'][0]['tools'].append(tools) - - json_str = json.dumps(farray, indent=2) - out_file = out_path + "tools.json" - if simple_output == False: - out_file = out_path + os.path.basename(arduino_json) - - with open(out_file, "w") as f: - f.write(json_str+"\n") - f.close() - # print(json_str) - print('{0} generated'.format(out_file)) From a9d47be1c01bbb81c47a9bf0dcd9b3db75d8e10b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 15:18:46 +0200 Subject: [PATCH 403/636] rm Arduino settings --- build.sh | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/build.sh b/build.sh index 14c5ec998..31ba08055 100755 --- a/build.sh +++ b/build.sh @@ -14,10 +14,8 @@ export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 -ARCHIVE_OUT=0 -if [ -z $DEPLOY_OUT ]; then - DEPLOY_OUT=0 -fi +ARCHIVE_OUT=1 +DEPLOY_OUT=0 function print_help() { echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]" @@ -26,8 +24,6 @@ function print_help() { echo " -I Set which branch of ESP-IDF to be used for compilation" echo " -i Set which commit of ESP-IDF to be used for compilation" echo " -e Archive the build to dist" - echo " -d Deploy the build to github arduino-esp32" - echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'" echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32,esp32s3,esp32c3'" echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board" echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b" @@ -39,16 +35,9 @@ while getopts ":A:I:i:c:t:b:sde" opt; do s ) SKIP_ENV=1 ;; - d ) - DEPLOY_OUT=1 - ;; e ) ARCHIVE_OUT=1 ;; - c ) - export ESP32_ARDUINO="$OPTARG" - COPY_OUT=1 - ;; A ) export AR_BRANCH="$OPTARG" ;; @@ -308,20 +297,7 @@ echo "#define ARDUINO_ESP32_GIT_VER 0x$AR_Commit_short #define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE #define ARDUINO_ESP32_RELEASE \"$AR_VERSION_UNDERSCORE\"" >> "$AR_ROOT/core_version.h" -# copy everything to arduino-esp32 installation -if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then - ./tools/copy-to-arduino.sh - if [ $? -ne 0 ]; then exit 1; fi -fi - -# push changes to esp32-arduino-libs and create pull request into arduino-esp32 -if [ $DEPLOY_OUT -eq 1 ]; then - ./tools/push-to-arduino.sh - if [ $? -ne 0 ]; then exit 1; fi -fi - -# archive the build -if [ "$BUILD_TYPE" = "all" ]; then - ./tools/archive-build.sh +if [ $ARCHIVE_OUT -eq 1 ]; then + ./tools/archive-build.sh "$TARGET" if [ $? -ne 0 ]; then exit 1; fi fi From 2d7b7e13282949753f1e4f9e5e347ebb80a7aee2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 15:29:25 +0200 Subject: [PATCH 404/636] Update build.sh --- build.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/build.sh b/build.sh index 31ba08055..f4e26bcdc 100755 --- a/build.sh +++ b/build.sh @@ -267,13 +267,6 @@ done export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) -# update package_esp32_index.template.json -#if [ "$BUILD_TYPE" = "all" ]; then -# python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" -# python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -o "$TOOLS_JSON_OUT/" -# if [ $? -ne 0 ]; then exit 1; fi -#fi - # Generate PlatformIO library manifest file if [ "$BUILD_TYPE" = "all" ]; then python3 ./tools/gen_pio_lib_manifest.py -o "$TOOLS_JSON_OUT/" -s "v$IDF_VERSION" -c "$IDF_COMMIT" From 7b1980625ae780f75860326add83f85e22d60287 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 15:31:34 +0200 Subject: [PATCH 405/636] Update build.sh --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index f4e26bcdc..d5dee0d8a 100755 --- a/build.sh +++ b/build.sh @@ -290,6 +290,7 @@ echo "#define ARDUINO_ESP32_GIT_VER 0x$AR_Commit_short #define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE #define ARDUINO_ESP32_RELEASE \"$AR_VERSION_UNDERSCORE\"" >> "$AR_ROOT/core_version.h" +# archive the build if [ $ARCHIVE_OUT -eq 1 ]; then ./tools/archive-build.sh "$TARGET" if [ $? -ne 0 ]; then exit 1; fi From 01b0e7558031798f1c36255214a993ee129446d5 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 15:33:14 +0200 Subject: [PATCH 406/636] Delete tools/add_sdk_json.py --- tools/add_sdk_json.py | 121 ------------------------------------------ 1 file changed, 121 deletions(-) delete mode 100644 tools/add_sdk_json.py diff --git a/tools/add_sdk_json.py b/tools/add_sdk_json.py deleted file mode 100644 index d2deb4a87..000000000 --- a/tools/add_sdk_json.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function - -__author__ = "Hristo Gochkov" -__version__ = "2023" - -import os -import shutil -import errno -import os.path -import json -import platform -import sys -import stat -import argparse - -if sys.version_info[0] == 3: - unicode = lambda s: str(s) - -def add_system(systems, host, url, filename, sha, size): - system = { - "host": host, - "url": url, - "archiveFileName": filename, - "checksum": "SHA-256:"+sha, - "size": str(size) - } - systems.append(system) - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - prog = 'add_sdk_json', - description = 'Update SDK in Arduino package index') - parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=True, help='path to package json') - parser.add_argument('-n', '--name', dest='tool_name', required=True, help='name of the SDK package') - parser.add_argument('-v', '--version', dest='tool_version', required=True, help='version of the new SDK') - parser.add_argument('-u', '--url', dest='tool_url', required=True, help='url to the zip of the new SDK') - parser.add_argument('-f', '--filename', dest='tool_filename', required=True, help='filename of the zip of the new SDK') - parser.add_argument('-s', '--size', dest='tool_size', required=True, help='size of the zip of the new SDK') - parser.add_argument('-c', '--sha', dest='tool_sha', required=True, help='sha256 of the zip of the new SDK') - args = parser.parse_args() - - print('Destination : {0}.'.format(args.arduino_json)) - print('Tool Name : {0}.'.format(args.tool_name)) - print('Tool Version : {0}.'.format(args.tool_version)) - print('Tool URL : {0}.'.format(args.tool_url)) - print('Tool File Name: {0}.'.format(args.tool_filename)) - print('Tool Size : {0}.'.format(args.tool_size)) - print('Tool SHA256 : {0}.'.format(args.tool_sha)) - - arduino_json = args.arduino_json; - tool_name = args.tool_name; - tool_version = args.tool_version; - tool_url = args.tool_url; - tool_filename = args.tool_filename; - tool_size = args.tool_size; - tool_sha = args.tool_sha; - - # code start - farray = {"packages":[{"platforms":[{"toolsDependencies":[]}],"tools":[]}]} - if os.path.isfile(arduino_json) == True: - farray = json.load(open(arduino_json)) - - dep_found = False - dep_skip = False - for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: - if dep['name'] == tool_name: - if dep['version'] == tool_version: - print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) - dep_skip = True - break - print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) - dep['version'] = tool_version - dep_found = True - break - - if dep_skip == False: - if dep_found == False: - print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) - deps = { - "packager": "esp32", - "name": tool_name, - "version": tool_version - } - farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) - - systems = [] - add_system(systems, "i686-mingw32", tool_url, tool_filename, tool_sha, tool_size) - add_system(systems, "x86_64-mingw32", tool_url, tool_filename, tool_sha, tool_size) - add_system(systems, "arm64-apple-darwin", tool_url, tool_filename, tool_sha, tool_size) - add_system(systems, "x86_64-apple-darwin", tool_url, tool_filename, tool_sha, tool_size) - add_system(systems, "x86_64-pc-linux-gnu", tool_url, tool_filename, tool_sha, tool_size) - add_system(systems, "i686-pc-linux-gnu", tool_url, tool_filename, tool_sha, tool_size) - add_system(systems, "aarch64-linux-gnu", tool_url, tool_filename, tool_sha, tool_size) - add_system(systems, "arm-linux-gnueabihf", tool_url, tool_filename, tool_sha, tool_size) - - tool_found = False - for t in farray['packages'][0]['tools']: - if t['name'] == tool_name: - t['version'] = tool_version - t['systems'] = systems - tool_found = True - print('Updating systems of {0} to version {1}'.format(tool_name, tool_version)) - break - - if tool_found == False: - print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) - tools = { - "name": tool_name, - "version": tool_version, - "systems": systems - } - farray['packages'][0]['tools'].append(tools) - - json_str = json.dumps(farray, indent=2) - with open(arduino_json, "w") as f: - f.write(json_str+"\n") - f.close() - # print(json_str) - print('{0} generated'.format(arduino_json)) From 476c6c76b676f44b6d08581c51d4755e8e787994 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:13:21 +0200 Subject: [PATCH 407/636] Update build.sh --- build.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/build.sh b/build.sh index d5dee0d8a..cef559e19 100755 --- a/build.sh +++ b/build.sh @@ -248,9 +248,6 @@ for component in `ls "$AR_COMPS"`; do echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" fi done -# esp32-camera version -component_version="esp32-camera: "$(git -C "$AR_COMPS/esp32-camera" symbolic-ref --short HEAD || git -C "$AR_COMPS/esp32-camera" tag --points-at HEAD)" "$(git -C "$AR_COMPS/esp32-camera" rev-parse --short HEAD) -echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" # TinyUSB version 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) echo $component_version >> "$AR_TOOLS/esp32-arduino-libs/versions.txt" From 6fe0ea040617faae7e3de6cc1ac7ae66e42d5fa0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 22:27:54 +0200 Subject: [PATCH 408/636] Set Options which speed up but crashed with QIO --- configs/defconfig.opi_ram | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index 16e6a278c..36fe40f6b 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -1,3 +1,5 @@ CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y -# CONFIG_SPIRAM_MEMTEST is not set \ No newline at end of file +# CONFIG_SPIRAM_MEMTEST is not set +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y From 946970ea9436af6c9afa9f8f457762b475266161 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 21 Apr 2024 22:45:38 +0200 Subject: [PATCH 409/636] switch off speed up options until it is verified it is safe to use --- configs/defconfig.opi_ram | 2 -- 1 file changed, 2 deletions(-) diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index 36fe40f6b..ad5646526 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -1,5 +1,3 @@ CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y # CONFIG_SPIRAM_MEMTEST is not set -CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y -CONFIG_SPIRAM_RODATA=y From 01dcb26c20c98bcbb96e7da63f5095b10c7bf6da Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 23 Apr 2024 22:56:33 +0200 Subject: [PATCH 410/636] S3 OPI tweak LCD RGB parallel speed * add `COMPILER_OPTIMIZATION_CHECKS_SILENT` * add `COMPILER_FLOAT_LIB_FROM_RVFPLIB` to C2,C6 * S3 reduced build mem variants --- configs/builds.json | 13 ++----------- configs/defconfig.common | 1 + configs/defconfig.dout | 1 - configs/defconfig.esp32 | 2 +- configs/defconfig.esp32c2 | 4 +++- configs/defconfig.esp32c6 | 2 ++ configs/defconfig.opi_ram | 9 +++++++++ configs/defconfig.qout | 1 - 8 files changed, 18 insertions(+), 15 deletions(-) delete mode 100644 configs/defconfig.dout delete mode 100644 configs/defconfig.qout diff --git a/configs/builds.json b/configs/builds.json index 02695519c..47786817b 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -131,26 +131,17 @@ { "target": "esp32s3", "features":[], - "idf_libs":["qio","80m","opi_ram"], + "idf_libs":["qio","120m","opi_ram"], "bootloaders":[ ["qio","120m","qio_ram"], - ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], - ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], - ["opi","80m","qio_ram"], ["opi","80m","opi_ram"] ], "mem_variants":[ ["qio","120m","qio_ram"], - ["qio","120m","opi_ram"], - ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], - ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], - ["opi","80m","qio_ram"], - ["opi","80m","opi_ram"] + ["opi","120m","qio_ram"] ] } ] diff --git a/configs/defconfig.common b/configs/defconfig.common index 4a2be049d..628749a05 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -16,6 +16,7 @@ CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y +CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set # CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set diff --git a/configs/defconfig.dout b/configs/defconfig.dout deleted file mode 100644 index 48d652cc2..000000000 --- a/configs/defconfig.dout +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y \ No newline at end of file diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index d15399735..2b41cdb3d 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -4,7 +4,7 @@ CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index b0cb51820..6179c84f2 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,13 +1,15 @@ CONFIG_XTAL_FREQ_26=y CONFIG_XTAL_FREQ=26 +CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y + # # Bluetooth # CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index f2cfcded3..e950a2489 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -1,6 +1,8 @@ # C6 has full Newlib in Rom # CONFIG_NEWLIB_NANO_FORMAT is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y + # Enable LP Core CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_LP_CORE=y diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index ad5646526..a0309da41 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -1,3 +1,12 @@ CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y # CONFIG_SPIRAM_MEMTEST is not set +CONFIG_LCD_RGB_ISR_IRAM_SAFE=y +CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y +# bounce buffer mode relies on GDMA EOF interrupt to be service-able +CONFIG_GDMA_ISR_IRAM_SAFE=y +# place non-ISR FreeRTOS functions in Flash +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +# Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y diff --git a/configs/defconfig.qout b/configs/defconfig.qout deleted file mode 100644 index 154cabf41..000000000 --- a/configs/defconfig.qout +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y \ No newline at end of file From 616a550628b6b35986a789bf774929e7bb80a8f1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:07:20 +0200 Subject: [PATCH 411/636] Revert "S3 OPI tweak LCD RGB parallel speed" This reverts commit 01dcb26c20c98bcbb96e7da63f5095b10c7bf6da. --- configs/builds.json | 13 +++++++++++-- configs/defconfig.common | 1 - configs/defconfig.dout | 1 + configs/defconfig.esp32 | 2 +- configs/defconfig.esp32c2 | 4 +--- configs/defconfig.esp32c6 | 2 -- configs/defconfig.opi_ram | 9 --------- configs/defconfig.qout | 1 + 8 files changed, 15 insertions(+), 18 deletions(-) create mode 100644 configs/defconfig.dout create mode 100644 configs/defconfig.qout diff --git a/configs/builds.json b/configs/builds.json index 47786817b..02695519c 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -131,17 +131,26 @@ { "target": "esp32s3", "features":[], - "idf_libs":["qio","120m","opi_ram"], + "idf_libs":["qio","80m","opi_ram"], "bootloaders":[ ["qio","120m","qio_ram"], + ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], + ["qio","80m","opi_ram"], + ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], + ["opi","80m","qio_ram"], ["opi","80m","opi_ram"] ], "mem_variants":[ ["qio","120m","qio_ram"], + ["qio","120m","opi_ram"], + ["qio","80m","qio_ram"], + ["qio","80m","opi_ram"], + ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], - ["opi","120m","qio_ram"] + ["opi","80m","qio_ram"], + ["opi","80m","opi_ram"] ] } ] diff --git a/configs/defconfig.common b/configs/defconfig.common index 628749a05..4a2be049d 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -16,7 +16,6 @@ CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y -CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set # CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set diff --git a/configs/defconfig.dout b/configs/defconfig.dout new file mode 100644 index 000000000..48d652cc2 --- /dev/null +++ b/configs/defconfig.dout @@ -0,0 +1 @@ +CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y \ No newline at end of file diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 2b41cdb3d..d15399735 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -4,7 +4,7 @@ CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 6179c84f2..b0cb51820 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,15 +1,13 @@ CONFIG_XTAL_FREQ_26=y CONFIG_XTAL_FREQ=26 -CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y - # # Bluetooth # CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index e950a2489..f2cfcded3 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -1,8 +1,6 @@ # C6 has full Newlib in Rom # CONFIG_NEWLIB_NANO_FORMAT is not set -CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y - # Enable LP Core CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_LP_CORE=y diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index a0309da41..ad5646526 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -1,12 +1,3 @@ CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y # CONFIG_SPIRAM_MEMTEST is not set -CONFIG_LCD_RGB_ISR_IRAM_SAFE=y -CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y -# bounce buffer mode relies on GDMA EOF interrupt to be service-able -CONFIG_GDMA_ISR_IRAM_SAFE=y -# place non-ISR FreeRTOS functions in Flash -CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y -# Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash -CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y -CONFIG_SPIRAM_RODATA=y diff --git a/configs/defconfig.qout b/configs/defconfig.qout new file mode 100644 index 000000000..154cabf41 --- /dev/null +++ b/configs/defconfig.qout @@ -0,0 +1 @@ +CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y \ No newline at end of file From 9056f6730fcce67511741b230c00998faeafdb3f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:09:09 +0200 Subject: [PATCH 412/636] CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 4a2be049d..628749a05 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -16,6 +16,7 @@ CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y +CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set # CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set From 519fbf570e2f184fb7efbd40cb3dd07a5d5e0be3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:09:31 +0200 Subject: [PATCH 413/636] Delete configs/defconfig.dout --- configs/defconfig.dout | 1 - 1 file changed, 1 deletion(-) delete mode 100644 configs/defconfig.dout diff --git a/configs/defconfig.dout b/configs/defconfig.dout deleted file mode 100644 index 48d652cc2..000000000 --- a/configs/defconfig.dout +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y \ No newline at end of file From 5b2f77d440b1e50013cbf6ed2e64d441f9ba1ba0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:09:52 +0200 Subject: [PATCH 414/636] Update defconfig.esp32 --- configs/defconfig.esp32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index d15399735..2b41cdb3d 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -4,7 +4,7 @@ CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 From 09575bf239b51f04827337b5ed3bdf3fe812f1c7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:10:49 +0200 Subject: [PATCH 415/636] CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y --- configs/defconfig.esp32c2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index b0cb51820..6179c84f2 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -1,13 +1,15 @@ CONFIG_XTAL_FREQ_26=y CONFIG_XTAL_FREQ=26 +CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y + # # Bluetooth # CONFIG_BT_ENABLED=y CONFIG_BT_STACK_NO_LOG=y # CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set +# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 From f03d16c449746ea303ee94568625c7243c08ae74 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:11:18 +0200 Subject: [PATCH 416/636] CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y --- configs/defconfig.esp32c6 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index f2cfcded3..e950a2489 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -1,6 +1,8 @@ # C6 has full Newlib in Rom # CONFIG_NEWLIB_NANO_FORMAT is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y + # Enable LP Core CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_LP_CORE=y From 743ad73dbecdbf9f3069fc2d135c3451bec5ad7d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:11:37 +0200 Subject: [PATCH 417/636] Delete configs/defconfig.qout --- configs/defconfig.qout | 1 - 1 file changed, 1 deletion(-) delete mode 100644 configs/defconfig.qout diff --git a/configs/defconfig.qout b/configs/defconfig.qout deleted file mode 100644 index 154cabf41..000000000 --- a/configs/defconfig.qout +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y \ No newline at end of file From f8479a8afa281203dacecb5c2b1a9ebb8103c0cf Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:14:51 +0200 Subject: [PATCH 418/636] S3 XIP PSRAM feature --- configs/defconfig.opi_ram | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index ad5646526..a0309da41 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -1,3 +1,12 @@ CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y # CONFIG_SPIRAM_MEMTEST is not set +CONFIG_LCD_RGB_ISR_IRAM_SAFE=y +CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y +# bounce buffer mode relies on GDMA EOF interrupt to be service-able +CONFIG_GDMA_ISR_IRAM_SAFE=y +# place non-ISR FreeRTOS functions in Flash +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +# Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y From eacae285410841d451748cd26a98c05927c2e9a4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:29:21 +0200 Subject: [PATCH 419/636] Update builds.json --- configs/builds.json | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/configs/builds.json b/configs/builds.json index 02695519c..9e7aa208f 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -131,21 +131,15 @@ { "target": "esp32s3", "features":[], - "idf_libs":["qio","80m","opi_ram"], + "idf_libs":["qio","80m","qio_ram"], "bootloaders":[ ["qio","120m","qio_ram"], - ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], - ["opi","120m","qio_ram"], - ["opi","120m","opi_ram"], - ["opi","80m","qio_ram"], - ["opi","80m","opi_ram"] + ["opi","80m","opi_ram"], + ["opi","120m","opi_ram"] ], "mem_variants":[ - ["qio","120m","qio_ram"], ["qio","120m","opi_ram"], - ["qio","80m","qio_ram"], ["qio","80m","opi_ram"], ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], From d35c1323a4e7d7f80480cd573c4430d3425d5f50 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 20:24:44 +0200 Subject: [PATCH 420/636] reduce s3 build variants --- configs/builds.json | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/configs/builds.json b/configs/builds.json index 9e7aa208f..47786817b 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -131,20 +131,17 @@ { "target": "esp32s3", "features":[], - "idf_libs":["qio","80m","qio_ram"], + "idf_libs":["qio","120m","opi_ram"], "bootloaders":[ ["qio","120m","qio_ram"], ["qio","80m","qio_ram"], - ["opi","80m","opi_ram"], - ["opi","120m","opi_ram"] + ["opi","120m","opi_ram"], + ["opi","80m","opi_ram"] ], "mem_variants":[ - ["qio","120m","opi_ram"], - ["qio","80m","opi_ram"], - ["opi","120m","qio_ram"], + ["qio","120m","qio_ram"], ["opi","120m","opi_ram"], - ["opi","80m","qio_ram"], - ["opi","80m","opi_ram"] + ["opi","120m","qio_ram"] ] } ] From cb6e67c138d4e66c7d752928e38e2480d55d3b5b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 20:27:13 +0200 Subject: [PATCH 421/636] Disable the XIP-PSRAM feature --- configs/defconfig.opi_ram | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index a0309da41..6054a3b56 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -8,5 +8,5 @@ CONFIG_GDMA_ISR_IRAM_SAFE=y # place non-ISR FreeRTOS functions in Flash CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y # Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash -CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y -CONFIG_SPIRAM_RODATA=y +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set From f89e259ec6f66e57367cd6803dd89f094ccae305 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 20:36:47 +0200 Subject: [PATCH 422/636] remove slow flash variants --- configs/builds.json | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/configs/builds.json b/configs/builds.json index 47786817b..cec7ca90d 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -50,9 +50,7 @@ "idf_libs":["qio","60m"], "bootloaders":[ ["qio","60m"], - ["dio","60m"], - ["qio","30m"], - ["dio","30m"] + ["dio","60m"] ], "mem_variants":[ ["dio","60m"] @@ -64,9 +62,7 @@ "idf_libs":["qio","64m"], "bootloaders":[ ["qio","64m"], - ["dio","64m"], - ["qio","16m"], - ["dio","16m"] + ["dio","64m"] ], "mem_variants":[ ["dio","64m"] @@ -78,9 +74,7 @@ "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], - ["dio","80m"], - ["qio","40m"], - ["dio","40m"] + ["dio","80m"] ], "mem_variants":[ ["dio","80m"] @@ -92,9 +86,7 @@ "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], - ["dio","80m"], - ["qio","40m"], - ["dio","40m"] + ["dio","80m"] ], "mem_variants":[ ["dio","80m"] @@ -106,9 +98,7 @@ "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], - ["dio","80m"], - ["qio","40m"], - ["dio","40m"] + ["dio","80m"] ], "mem_variants":[ ["dio","80m"] @@ -120,9 +110,7 @@ "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], - ["dio","80m"], - ["qio","40m"], - ["dio","40m"] + ["dio","80m"] ], "mem_variants":[ ["dio","80m"] From afe5724a52c986950d477c4737db92073bd90ac6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:46:39 +0200 Subject: [PATCH 423/636] Update defconfig.opi_ram --- configs/defconfig.opi_ram | 9 --------- 1 file changed, 9 deletions(-) diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index 6054a3b56..ad5646526 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -1,12 +1,3 @@ CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y # CONFIG_SPIRAM_MEMTEST is not set -CONFIG_LCD_RGB_ISR_IRAM_SAFE=y -CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y -# bounce buffer mode relies on GDMA EOF interrupt to be service-able -CONFIG_GDMA_ISR_IRAM_SAFE=y -# place non-ISR FreeRTOS functions in Flash -CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y -# Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set From da8c71a833c4ce08dccf616d244c9333396fd2a2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:32:26 +0200 Subject: [PATCH 424/636] Build again many variants --- configs/builds.json | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/configs/builds.json b/configs/builds.json index cec7ca90d..02695519c 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -50,7 +50,9 @@ "idf_libs":["qio","60m"], "bootloaders":[ ["qio","60m"], - ["dio","60m"] + ["dio","60m"], + ["qio","30m"], + ["dio","30m"] ], "mem_variants":[ ["dio","60m"] @@ -62,7 +64,9 @@ "idf_libs":["qio","64m"], "bootloaders":[ ["qio","64m"], - ["dio","64m"] + ["dio","64m"], + ["qio","16m"], + ["dio","16m"] ], "mem_variants":[ ["dio","64m"] @@ -74,7 +78,9 @@ "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], - ["dio","80m"] + ["dio","80m"], + ["qio","40m"], + ["dio","40m"] ], "mem_variants":[ ["dio","80m"] @@ -86,7 +92,9 @@ "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], - ["dio","80m"] + ["dio","80m"], + ["qio","40m"], + ["dio","40m"] ], "mem_variants":[ ["dio","80m"] @@ -98,7 +106,9 @@ "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], - ["dio","80m"] + ["dio","80m"], + ["qio","40m"], + ["dio","40m"] ], "mem_variants":[ ["dio","80m"] @@ -110,7 +120,9 @@ "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], - ["dio","80m"] + ["dio","80m"], + ["qio","40m"], + ["dio","40m"] ], "mem_variants":[ ["dio","80m"] @@ -119,17 +131,26 @@ { "target": "esp32s3", "features":[], - "idf_libs":["qio","120m","opi_ram"], + "idf_libs":["qio","80m","opi_ram"], "bootloaders":[ ["qio","120m","qio_ram"], + ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], + ["qio","80m","opi_ram"], + ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], + ["opi","80m","qio_ram"], ["opi","80m","opi_ram"] ], "mem_variants":[ ["qio","120m","qio_ram"], + ["qio","120m","opi_ram"], + ["qio","80m","qio_ram"], + ["qio","80m","opi_ram"], + ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], - ["opi","120m","qio_ram"] + ["opi","80m","qio_ram"], + ["opi","80m","opi_ram"] ] } ] From ce1bd0c3972f04be515f352fd9bffdb8e64a80db Mon Sep 17 00:00:00 2001 From: Christian Baars <Baars@gmx.de> Date: Thu, 2 May 2024 10:43:47 +0200 Subject: [PATCH 425/636] ESP-DSP in update-components.sh --- tools/update-components.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/update-components.sh b/tools/update-components.sh index 9fdbb8ea6..562e9f3ac 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -5,6 +5,8 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" +ESPDSP_REPO_URL="https://github.com/espressif/esp-dsp.git" +ESPDSP_REPO_DIR="$AR_COMPS/esp-dsp/espdsp" # # CLONE/UPDATE ESP32-CAMERA @@ -40,3 +42,17 @@ else git clean -ffdx fi if [ $? -ne 0 ]; then exit 1; fi + +# +# CLONE/UPDATE ESP-DSP +# +echo "Updating ESP-DSP..." +if [ ! -d "$ESPDSP_REPO_DIR" ]; then + git clone -b master --depth 1 "$ESPDSP_REPO_URL" "$ESPDSP_REPO_DIR" +else + cd $ESPDSP_REPO_DIR + git pull + # -ff is for cleaning untracked files as well as submodules + git clean -ffdx +fi +if [ $? -ne 0 ]; then exit 1; fi From 3f27b8fa46629370895ac2d651f03c96c4b80098 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 May 2024 10:51:29 +0200 Subject: [PATCH 426/636] revert accident commit --- tools/update-components.sh | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 562e9f3ac..9fdbb8ea6 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -5,8 +5,6 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" -ESPDSP_REPO_URL="https://github.com/espressif/esp-dsp.git" -ESPDSP_REPO_DIR="$AR_COMPS/esp-dsp/espdsp" # # CLONE/UPDATE ESP32-CAMERA @@ -42,17 +40,3 @@ else git clean -ffdx fi if [ $? -ne 0 ]; then exit 1; fi - -# -# CLONE/UPDATE ESP-DSP -# -echo "Updating ESP-DSP..." -if [ ! -d "$ESPDSP_REPO_DIR" ]; then - git clone -b master --depth 1 "$ESPDSP_REPO_URL" "$ESPDSP_REPO_DIR" -else - cd $ESPDSP_REPO_DIR - git pull - # -ff is for cleaning untracked files as well as submodules - git clean -ffdx -fi -if [ $? -ne 0 ]; then exit 1; fi From 99e5e066391597c058506792147996ebbf5f4fc8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 May 2024 15:42:08 +0200 Subject: [PATCH 427/636] CONFIG_ULP_COPROC_TYPE_FSM=y --- configs/defconfig.esp32s2 | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 4363869bf..9d01fe73c 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -3,6 +3,7 @@ CONFIG_SPIRAM=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y CONFIG_ESP32S2_KEEP_USB_ALIVE=y CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_TYPE_FSM=y CONFIG_ESP32_ULP_COPROC_RISCV=y CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4096 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set From 356a62cf39052424ad3ab9949022ed63d807b428 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 May 2024 15:42:59 +0200 Subject: [PATCH 428/636] CONFIG_ULP_COPROC_TYPE_FSM=y --- configs/defconfig.esp32s3 | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index b772c28b1..a69c1d31f 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,6 +1,7 @@ CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_TYPE_FSM=y CONFIG_ULP_COPROC_TYPE_RISCV=y CONFIG_ULP_COPROC_RESERVE_MEM=4096 From fe4f96df84c69a86ef4a4c13fae4550f8292f4cf Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 May 2024 15:55:05 +0200 Subject: [PATCH 429/636] CONFIG_LWIP_DHCP_RESTORE_LAST_IP=n --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 628749a05..00abc6fa8 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -90,7 +90,7 @@ CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y CONFIG_LWIP_IPV6_AUTOCONFIG=y CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 CONFIG_LWIP_MAX_SOCKETS=16 -CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y +CONFIG_LWIP_DHCP_RESTORE_LAST_IP=n CONFIG_LWIP_DHCP_OPTIONS_LEN=128 CONFIG_LWIP_SNTP_MAX_SERVERS=1 # CONFIG_LWIP_DHCP_GET_NTP_SRV is not set From 0920ba7c15720c7d6d727a5ea03ae465cd164db3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 May 2024 21:26:03 +0200 Subject: [PATCH 430/636] add dsp component --- tools/update-components.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/update-components.sh b/tools/update-components.sh index 9fdbb8ea6..9a112f55b 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -5,6 +5,7 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" +ESP_DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" # # CLONE/UPDATE ESP32-CAMERA @@ -22,6 +23,22 @@ else fi if [ $? -ne 0 ]; then exit 1; fi +# +# CLONE/UPDATE ESP-DSP +# +echo "Updating ESP-DSP..." +if [ ! -d "$AR_COMPS/esp-dsp" ]; then + git clone -b master --recursive --depth 1 --shallow-submodule $ESP_DSP_REPO_URL "$AR_COMPS/esp-dsp" +else + cd "$AR_COMPS/esp-dsp" + git pull + git submodule update --depth 1 + # -ff is for cleaning untracked files as well as submodules + git clean -ffdx + cd - +fi +if [ $? -ne 0 ]; then exit 1; fi + # # Arduino needs cam_hal.h from esp32-camera in include folder # From 3e780a9de0afb023e1550e9d4f634c30e2ccc08b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 May 2024 21:39:58 +0200 Subject: [PATCH 431/636] add esp-dsp --- main/idf_component.yml | 46 +----------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index b119e44da..cfa1df234 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,48 +1,4 @@ dependencies: # Required IDF version idf: ">=5.1" - - # espressif/esp32-camera: - # version: "master" - # git: https://github.com/espressif/esp32-camera.git - # require: public - # esp-sr: "^1.3.1" - # esp32-camera: "^2.0.4" - # esp-dl: - # git: https://github.com/espressif/esp-dl.git - # espressif/esp_rainmaker: - # path: components/esp_rainmaker - # git: https://github.com/espressif/esp-rainmaker.git - - # # Defining a dependency from the registry: - # # https://components.espressif.com/component/example/cmp - # example/cmp: "^3.3.3" # Automatically update minor releases - # - # # Other ways to define dependencies - # - # # For components maintained by Espressif only name can be used. - # # Same as `espressif/cmp` - # component: "~1.0.0" # Automatically update bugfix releases - # - # # Or in a longer form with extra parameters - # component2: - # version: ">=2.0.0" - # - # # For transient dependencies `public` flag can be set. - # # `public` flag doesn't have an effect for the `main` component. - # # All dependencies of `main` are public by default. - # public: true - # - # # For components hosted on non-default registry: - # service_url: "https://componentregistry.company.com" - # - # # For components in git repository: - # test_component: - # path: test_component - # git: ssh://git@gitlab.com/user/components.git - # - # # For test projects during component development - # # components can be used from a local directory - # # with relative or absolute path - # some_local_component: - # path: ../../projects/component + esp-dsp: "^1.4.12" From 7174a74295f54859e41b4ba97bc5eb4acaebf497 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 May 2024 21:41:24 +0200 Subject: [PATCH 432/636] install DSP from registry --- tools/update-components.sh | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 9a112f55b..9fdbb8ea6 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -5,7 +5,6 @@ source ./tools/config.sh CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" -ESP_DSP_REPO_URL="https://github.com/espressif/esp-dsp.git" # # CLONE/UPDATE ESP32-CAMERA @@ -23,22 +22,6 @@ else fi if [ $? -ne 0 ]; then exit 1; fi -# -# CLONE/UPDATE ESP-DSP -# -echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/esp-dsp" ]; then - git clone -b master --recursive --depth 1 --shallow-submodule $ESP_DSP_REPO_URL "$AR_COMPS/esp-dsp" -else - cd "$AR_COMPS/esp-dsp" - git pull - git submodule update --depth 1 - # -ff is for cleaning untracked files as well as submodules - git clean -ffdx - cd - -fi -if [ $? -ne 0 ]; then exit 1; fi - # # Arduino needs cam_hal.h from esp32-camera in include folder # From 35775006da690de647fc2953103dc0f8cba343b8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 2 May 2024 22:23:46 +0200 Subject: [PATCH 433/636] DSP only esp32 / S3 --- main/idf_component.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/idf_component.yml b/main/idf_component.yml index cfa1df234..3558e2457 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -2,3 +2,5 @@ dependencies: # Required IDF version idf: ">=5.1" esp-dsp: "^1.4.12" + rules: + - if: "target in [esp32s3, esp32]" From d149a15771b685b7005b1db78ae25e68c2408eea Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 3 May 2024 17:21:12 +0200 Subject: [PATCH 434/636] PPP modem support --- configs/defconfig.esp32 | 8 ++++++++ configs/defconfig.esp32c2 | 8 ++++++++ configs/defconfig.esp32c3 | 8 ++++++++ configs/defconfig.esp32c6 | 8 ++++++++ configs/defconfig.esp32h2 | 8 ++++++++ configs/defconfig.esp32s2 | 8 ++++++++ configs/defconfig.esp32s3 | 8 ++++++++ tools/copy-to-arduino.sh | 23 ----------------------- 8 files changed, 56 insertions(+), 23 deletions(-) delete mode 100755 tools/copy-to-arduino.sh diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 2b41cdb3d..9ceab04e5 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -43,3 +43,11 @@ CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST=y CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID=y CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 6179c84f2..767e62596 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -22,3 +22,11 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index c3c5f8518..6d18ad8cc 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -42,3 +42,11 @@ CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index e950a2489..c64082f70 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -52,3 +52,11 @@ CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32h2 b/configs/defconfig.esp32h2 index c3c5f8518..6d18ad8cc 100644 --- a/configs/defconfig.esp32h2 +++ b/configs/defconfig.esp32h2 @@ -42,3 +42,11 @@ CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 9d01fe73c..1ce5ef338 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -19,3 +19,11 @@ CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n # CONFIG_VFS_SUPPORT_SELECT is not set # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set # CONFIG_VFS_SUPPORT_TERMIOS is not set + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index a69c1d31f..d288cf2b5 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -37,3 +37,11 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh deleted file mode 100755 index 96092e068..000000000 --- a/tools/copy-to-arduino.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -source ./tools/config.sh - -if [ -z $ESP32_ARDUINO ]; then - if [[ "$AR_OS" == "macos" ]]; then - ESP32_ARDUINO="$HOME/Documents/Arduino/hardware/espressif/esp32" - else - ESP32_ARDUINO="$HOME/Arduino/hardware/espressif/esp32" - fi -fi - -if ! [ -d "$ESP32_ARDUINO" ]; then - echo "ERROR: Target arduino folder does not exist!" - exit 1 -fi - -echo "Installing new libraries to $ESP32_ARDUINO" - -rm -rf $ESP32_ARDUINO/package/package_esp32_index.template.json && \ -cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json - -rm -rf $ESP32_ARDUINO/tools/esp32-arduino-libs && \ -cp -Rf $AR_TOOLS/esp32-arduino-libs $ESP32_ARDUINO/tools/ From b93e8edf7d75fde3e84fa1d8db0473e20946808d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 3 May 2024 17:57:49 +0200 Subject: [PATCH 435/636] add targets --- main/idf_component.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main/idf_component.yml b/main/idf_component.yml index 3558e2457..3a07e095f 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,3 +1,11 @@ +targets: + - esp32 + - esp32s2 + - esp32s3 + - esp32c2 + - esp32c3 + - esp32c6 + - esp32h2 dependencies: # Required IDF version idf: ">=5.1" From 773f80b0939fe36264f53067061bca06021fb52c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 3 May 2024 18:06:02 +0200 Subject: [PATCH 436/636] MCU rules later... --- main/idf_component.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index 3a07e095f..cfa1df234 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,14 +1,4 @@ -targets: - - esp32 - - esp32s2 - - esp32s3 - - esp32c2 - - esp32c3 - - esp32c6 - - esp32h2 dependencies: # Required IDF version idf: ">=5.1" esp-dsp: "^1.4.12" - rules: - - if: "target in [esp32s3, esp32]" From f6ffecac2783053852891088bc4a1e7f0916b139 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 3 May 2024 18:42:06 +0200 Subject: [PATCH 437/636] DSP not for all MCU --- main/idf_component.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index cfa1df234..8b26d9535 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,4 +1,7 @@ dependencies: # Required IDF version idf: ">=5.1" - esp-dsp: "^1.4.12" + espressif/esp-dsp: + version: "^1.4.12" + rules: + - if: "target in [esp32s3, esp32]" From b58b75b2b43f6b89a0aaf6b6ebd7a209f1819723 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 5 May 2024 17:35:47 +0200 Subject: [PATCH 438/636] Disable PPP modem support --- configs/defconfig.esp32c2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 767e62596..1c766f832 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -26,7 +26,7 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 # # PPP # -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -CONFIG_LWIP_PPP_PAP_SUPPORT=y -CONFIG_LWIP_PPP_ENABLE_IPV6=n +# CONFIG_LWIP_PPP_SUPPORT=y +# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +# CONFIG_LWIP_PPP_PAP_SUPPORT=y +# CONFIG_LWIP_PPP_ENABLE_IPV6=n From f7513e7cfb229790d2522ecb760c472acbe1fac5 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 5 May 2024 17:36:41 +0200 Subject: [PATCH 439/636] Disable PPP modem support --- configs/defconfig.esp32c3 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 6d18ad8cc..5239db0dc 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -46,7 +46,7 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 # # PPP # -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -CONFIG_LWIP_PPP_PAP_SUPPORT=y -CONFIG_LWIP_PPP_ENABLE_IPV6=n +# CONFIG_LWIP_PPP_SUPPORT=y +# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +# CONFIG_LWIP_PPP_PAP_SUPPORT=y +# CONFIG_LWIP_PPP_ENABLE_IPV6=n From 4b1583a0846221dde2684a59983202c1db6a2389 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 5 May 2024 17:38:19 +0200 Subject: [PATCH 440/636] Disable PPP modem support Tasmota safeboot firmware is too big --- configs/defconfig.esp32c6 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index c64082f70..5dd6878c8 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -56,7 +56,7 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 # # PPP # -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -CONFIG_LWIP_PPP_PAP_SUPPORT=y -CONFIG_LWIP_PPP_ENABLE_IPV6=n +# CONFIG_LWIP_PPP_SUPPORT=y +# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +# CONFIG_LWIP_PPP_PAP_SUPPORT=y +# CONFIG_LWIP_PPP_ENABLE_IPV6=n From 9b4991d083d31f2b48c69fe171950b46463e1047 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 6 May 2024 12:31:36 +0200 Subject: [PATCH 441/636] Only one ULP is possible to enable --- configs/defconfig.esp32s2 | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 1ce5ef338..f3fca9b8f 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -3,7 +3,6 @@ CONFIG_SPIRAM=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y CONFIG_ESP32S2_KEEP_USB_ALIVE=y CONFIG_ULP_COPROC_ENABLED=y -CONFIG_ULP_COPROC_TYPE_FSM=y CONFIG_ESP32_ULP_COPROC_RISCV=y CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4096 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set From 44b3662eafb52536d22555265aabc45c06c6f84b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 6 May 2024 12:32:27 +0200 Subject: [PATCH 442/636] Only one ULP is possible --- configs/defconfig.esp32s3 | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index d288cf2b5..c8375eeef 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,7 +1,6 @@ CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_ULP_COPROC_ENABLED=y -CONFIG_ULP_COPROC_TYPE_FSM=y CONFIG_ULP_COPROC_TYPE_RISCV=y CONFIG_ULP_COPROC_RESERVE_MEM=4096 From e1a47042ea97469a26efd8feae47f44210d3d995 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 May 2024 13:08:13 +0200 Subject: [PATCH 443/636] disable `SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE` --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 00abc6fa8..921d9de13 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -190,6 +190,7 @@ CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y CONFIG_OPENSSL_ASSERT_DO_NOTHING=y CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y +# CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE is not set CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10 CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2 From d03bec9e8bb6beb1cff8776853717bac92e2175a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 May 2024 13:19:38 +0200 Subject: [PATCH 444/636] disable `HTTP_CLIENT_ENABLE_BASIC_AUTH` --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 921d9de13..62c905f7a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -26,7 +26,7 @@ CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y # CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM=y -CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH=y +# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 From e90c4b562669d291a1a55030c13b343f452c7fcd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 10 May 2024 13:21:09 +0200 Subject: [PATCH 445/636] move entry --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 62c905f7a..88e5c23b7 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -24,9 +24,9 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y # CONFIG_ESP_HTTPS_SERVER_ENABLE is not set # CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM=y -# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 From a1654a8eb46f62f35f4151158d2a2465fa0ec394 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 11 May 2024 21:41:32 +0200 Subject: [PATCH 446/636] # CONFIG_MBEDTLS_ERROR_STRINGS is not set --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 88e5c23b7..68a00bb5f 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -108,6 +108,7 @@ CONFIG_MBEDTLS_TLS_DISABLED=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 # CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set # CONFIG_MBEDTLS_PKCS7_C is not set +# CONFIG_MBEDTLS_ERROR_STRINGS is not set # # Symmetric Ciphers From 0df4f359eed2b508f367ee9d857647226e548bf3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 13 May 2024 19:36:54 +0200 Subject: [PATCH 447/636] Fix compile with latest IDF 5.1 --- components/arduino_tinyusb/src/dcd_esp32sx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/arduino_tinyusb/src/dcd_esp32sx.c b/components/arduino_tinyusb/src/dcd_esp32sx.c index cfccf95ae..324aad595 100755 --- a/components/arduino_tinyusb/src/dcd_esp32sx.c +++ b/components/arduino_tinyusb/src/dcd_esp32sx.c @@ -37,10 +37,21 @@ #include "soc/dport_reg.h" #include "soc/gpio_sig_map.h" #include "soc/usb_periph.h" +#include "soc/usb_reg.h" +#include "soc/usb_struct.h" #include "soc/periph_defs.h" // for interrupt source +#include "soc/usb_wrap_struct.h" #include "device/dcd.h" +#ifndef USB_OUT_EP_NUM +#define USB_OUT_EP_NUM ((int) (sizeof(USB0.out_ep_reg) / sizeof(USB0.out_ep_reg[0]))) +#endif + +#ifndef USB_IN_EP_NUM +#define USB_IN_EP_NUM ((int) (sizeof(USB0.in_ep_reg) / sizeof(USB0.in_ep_reg[0]))) +#endif + // Max number of bi-directional endpoints including EP0 // Note: ESP32S2 specs say there are only up to 5 IN active endpoints include EP0 // We should probably prohibit enabling Endpoint IN > 4 (not done yet) From 81f7e4b50f3ea2bc72038f23cd5c543c8c3b1451 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 20 May 2024 22:41:02 +0200 Subject: [PATCH 448/636] copy zigbee + zboss lib for H2 --- tools/copy-libs.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 2de6dbbbd..95b659829 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -484,6 +484,15 @@ echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags" echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" +# copy zigbee + zboss lib +if [ -d "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET/" ]; then + cp -r "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" +fi + +if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then + cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" +fi + # sdkconfig cp -f "sdkconfig" "$AR_SDK/sdkconfig" From e3f1ecedfd26bb074578ed5fa5def07e6495ce53 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 29 May 2024 23:25:22 +0200 Subject: [PATCH 449/636] sort --- main/Kconfig.projbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 248e93d94..d5c62deaf 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -10,8 +10,8 @@ config LIB_BUILDER_FLASHFREQ string default "120m" if ESPTOOLPY_FLASHFREQ_120M default "80m" if ESPTOOLPY_FLASHFREQ_80M - default "60m" if ESPTOOLPY_FLASHFREQ_60M default "64m" if ESPTOOLPY_FLASHFREQ_64M + default "60m" if ESPTOOLPY_FLASHFREQ_60M default "40m" if ESPTOOLPY_FLASHFREQ_40M default "32m" if ESPTOOLPY_FLASHFREQ_32M default "30m" if ESPTOOLPY_FLASHFREQ_30M From 6c91f5da91a11d6c82ae23b6953d64ca89446331 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:23:11 +0200 Subject: [PATCH 450/636] Update idf_component.yml --- main/idf_component.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index 8b26d9535..f3eb39623 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,7 +1,3 @@ dependencies: # Required IDF version idf: ">=5.1" - espressif/esp-dsp: - version: "^1.4.12" - rules: - - if: "target in [esp32s3, esp32]" From 2cbcd1657f4286f78e6a41d60299be99f772df93 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:03:13 +0200 Subject: [PATCH 451/636] OPI optimize / strip *.a --- configs/defconfig.opi_ram | 7 +++++++ tools/copy-libs.sh | 22 ++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index ad5646526..e6df61d08 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -1,3 +1,10 @@ CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y # CONFIG_SPIRAM_MEMTEST is not set +CONFIG_LCD_RGB_ISR_IRAM_SAFE=y +CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y +# bounce buffer mode relies on GDMA EOF interrupt to be service-able +CONFIG_GDMA_ISR_IRAM_SAFE=y +# Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 95b659829..0bf3511c5 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -71,6 +71,13 @@ PIO_LD_FLAGS="" PIO_LD_FUNCS="" PIO_LD_SCRIPTS="" +TOOLCHAIN_PREFIX="" +if [ "$IS_XTENSA" = "y" ]; then + TOOLCHAIN="xtensa-$IDF_TARGET-elf" +else + TOOLCHAIN="riscv32-esp-elf" +fi + #collect includes, defines and c-flags str=`cat build/compile_commands.json | grep arduino-lib-builder-gcc.c | grep command | cut -d':' -f2 | cut -d',' -f1` str="${str:2:${#str}-1}" #remove leading space and quotes @@ -402,13 +409,13 @@ for item; do mkdir -p "$out_cpath$rel_p" cp -n $f "$out_cpath$rel_p/" done - for f in `find "$item" -name '*.inc'`; do + for f in `find "$item" -name '*.inc'`; do rel_f=${f#*$item} rel_p=${rel_f%/*} mkdir -p "$out_cpath$rel_p" cp -n $f "$out_cpath$rel_p/" done - # Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17 + # Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17 if [[ "$fname" == "bt" && "$out_sub" == "/include/$IDF_TARGET/include" && -f "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" ]]; then mkdir -p "$AR_SDK/include/$fname/controller/$IDF_TARGET" cp -n "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" "$AR_SDK/include/$fname/controller/$IDF_TARGET/esp_bt_cfg.h" @@ -434,6 +441,8 @@ done set -- $LD_LIB_FILES for item; do + #echo "***** Stripping $item" + "$TOOLCHAIN-strip" -g "$item" cp "$item" "$AR_SDK/lib/" done @@ -507,6 +516,7 @@ function copy_precompiled_lib(){ lib_file="$1" lib_name="$(basename $lib_file)" if [[ $LD_LIBS_SEARCH == *"$lib_name"* ]]; then + "$TOOLCHAIN-strip" -g "$lib_file" cp "$lib_file" "$AR_SDK/ld/" fi } @@ -523,6 +533,13 @@ for item; do done done +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" "joltwallet__littlefs"; do + if [ -f "$AR_SDK/lib/lib$lib.a" ]; then + echo "Stripping $AR_SDK/lib/lib$lib.a" + "$TOOLCHAIN-strip" -g "$AR_SDK/lib/lib$lib.a" + fi +done + # Handle Mem Variants mkdir -p "$AR_SDK/$MEMCONF/include" mv "$PWD/build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h" @@ -538,6 +555,7 @@ for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"') out=$(echo "$mem_variant" | jq -c '.out' | tr -d '"') mv "$AR_SDK/$out" "$AR_SDK/$MEMCONF/$file" + "$TOOLCHAIN-strip" -g "$AR_SDK/$MEMCONF/$file" fi done; From 05431c63b9d4aeb2d403ec0dc236592cdc0e983d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 10 Jun 2024 23:17:22 +0200 Subject: [PATCH 452/636] Webcam component from registry --- main/idf_component.yml | 6 ++++++ tools/copy-libs.sh | 6 +++++- tools/update-components.sh | 22 ---------------------- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index f3eb39623..3f1b3fabd 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,3 +1,9 @@ dependencies: # Required IDF version idf: ">=5.1" + espressif/esp32-camera: + version: "master" + git: https://github.com/espressif/esp32-camera.git + require: public + rules: + - if: "target in [esp32, esp32s2, esp32s3]" diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 0bf3511c5..88c1b5400 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -502,6 +502,10 @@ if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" fi +if [ -d "managed_components/espressif__esp32-camera/driver/private_include/" ]; then + cp -r "managed_components/espressif__esp32-camera/driver/private_include/cam_hal.h" "$AR_SDK/include/espressif__esp32-camera/driver/include/" +fi + # sdkconfig cp -f "sdkconfig" "$AR_SDK/sdkconfig" @@ -533,7 +537,7 @@ for item; do done done -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" "joltwallet__littlefs"; do +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 if [ -f "$AR_SDK/lib/lib$lib.a" ]; then echo "Stripping $AR_SDK/lib/lib$lib.a" "$TOOLCHAIN-strip" -g "$AR_SDK/lib/lib$lib.a" diff --git a/tools/update-components.sh b/tools/update-components.sh index 9fdbb8ea6..6c97f2c3a 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -2,31 +2,9 @@ source ./tools/config.sh -CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git" TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git" TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" -# -# CLONE/UPDATE ESP32-CAMERA -# -echo "Updating ESP32 Camera..." -if [ ! -d "$AR_COMPS/esp32-camera" ]; then - git clone -b master --recursive --depth 1 --shallow-submodule $CAMERA_REPO_URL "$AR_COMPS/esp32-camera" -else - cd "$AR_COMPS/esp32-camera" - git pull - git submodule update --depth 1 - # -ff is for cleaning untracked files as well as submodules - git clean -ffdx - cd - -fi -if [ $? -ne 0 ]; then exit 1; fi - -# -# Arduino needs cam_hal.h from esp32-camera in include folder -# -cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/" - # # CLONE/UPDATE TINYUSB # From 4d59f76ca05cef8373ad9f9b083ca2c38f4905af Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:40:48 +0200 Subject: [PATCH 453/636] Update Kconfig.projbuild --- components/arduino_tinyusb/Kconfig.projbuild | 1 + 1 file changed, 1 insertion(+) diff --git a/components/arduino_tinyusb/Kconfig.projbuild b/components/arduino_tinyusb/Kconfig.projbuild index 80983657f..50e24b6a6 100755 --- a/components/arduino_tinyusb/Kconfig.projbuild +++ b/components/arduino_tinyusb/Kconfig.projbuild @@ -1,4 +1,5 @@ menu "Arduino TinyUSB" + depends on ENABLE_ARDUINO_DEPENDS && SOC_USB_OTG_SUPPORTED config TINYUSB_ENABLED bool "Enable TinyUSB driver" From 9a97b1753e7ce8847f4a9b0ec08008b33c3fa927 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:42:19 +0200 Subject: [PATCH 454/636] Update dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 1039 +++++++++------------ 1 file changed, 453 insertions(+), 586 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index 67653fda0..d9d15d4c6 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -82,8 +82,8 @@ static TU_ATTR_ALIGNED(4) uint32_t _setup_packet[2]; typedef struct { - uint8_t * buffer; - tu_fifo_t * ff; + uint8_t* buffer; + tu_fifo_t* ff; uint16_t total_len; uint16_t max_size; uint8_t interval; @@ -93,45 +93,205 @@ static xfer_ctl_t xfer_status[DWC2_EP_MAX][2]; #define XFER_CTL_BASE(_ep, _dir) (&xfer_status[_ep][_dir]) // EP0 transfers are limited to 1 packet - larger sizes has to be split -static uint16_t ep0_pending[2]; // Index determines direction as tusb_dir_t type +static uint16_t ep0_pending[2]; // Index determines direction as tusb_dir_t type // TX FIFO RAM allocation so far in words - RX FIFO size is readily available from dwc2->grxfsiz -static uint16_t _allocated_fifo_words_tx; // TX FIFO size in words (IN EPs) -static bool _out_ep_closed; // Flag to check if RX FIFO size needs an update (reduce its size) +static uint16_t _allocated_fifo_words_tx; // TX FIFO size in words (IN EPs) // SOF enabling flag - required for SOF to not get disabled in ISR when SOF was enabled by static bool _sof_en; -// Calculate the RX FIFO size according to recommendations from reference manual -static inline uint16_t calc_grxfsiz(uint16_t max_ep_size, uint8_t ep_count) -{ - return 15 + 2*(max_ep_size/4) + 2*ep_count; +// Calculate the RX FIFO size according to minimum recommendations from reference manual +// RxFIFO = (5 * number of control endpoints + 8) + +// ((largest USB packet used / 4) + 1 for status information) + +// (2 * number of OUT endpoints) + 1 for Global NAK +// with number of control endpoints = 1 we have +// RxFIFO = 15 + (largest USB packet used / 4) + 2 * number of OUT endpoints +// we double the largest USB packet size to be able to hold up to 2 packets +static inline uint16_t calc_grxfsiz(uint16_t max_ep_size, uint8_t ep_count) { + return 15 + 2 * (max_ep_size / 4) + 2 * ep_count; } -static void update_grxfsiz(uint8_t rhport) -{ - dwc2_regs_t * dwc2 = DWC2_REG(rhport); +TU_ATTR_ALWAYS_INLINE static inline void fifo_flush_tx(dwc2_regs_t* dwc2, uint8_t epnum) { + // flush TX fifo and wait for it cleared + dwc2->grstctl = GRSTCTL_TXFFLSH | (epnum << GRSTCTL_TXFNUM_Pos); + while (dwc2->grstctl & GRSTCTL_TXFFLSH_Msk) {} +} +TU_ATTR_ALWAYS_INLINE static inline void fifo_flush_rx(dwc2_regs_t* dwc2) { + // flush RX fifo and wait for it cleared + dwc2->grstctl = GRSTCTL_RXFFLSH; + while (dwc2->grstctl & GRSTCTL_RXFFLSH_Msk) {} +} + +static bool fifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + uint8_t const epnum = tu_edpt_number(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); - // Determine largest EP size for RX FIFO - uint16_t max_epsize = 0; - for (uint8_t epnum = 0; epnum < ep_count; epnum++) - { - max_epsize = tu_max16(max_epsize, xfer_status[epnum][TUSB_DIR_OUT].max_size); + TU_ASSERT(epnum < ep_count); + + uint16_t fifo_size = tu_div_ceil(packet_size, 4); + + // "USB Data FIFOs" section in reference manual + // Peripheral FIFO architecture + // + // --------------- 320 or 1024 ( 1280 or 4096 bytes ) + // | IN FIFO 0 | + // --------------- (320 or 1024) - 16 + // | IN FIFO 1 | + // --------------- (320 or 1024) - 16 - x + // | . . . . | + // --------------- (320 or 1024) - 16 - x - y - ... - z + // | IN FIFO MAX | + // --------------- + // | FREE | + // --------------- GRXFSIZ + // | OUT FIFO | + // | ( Shared ) | + // --------------- 0 + // + // In FIFO is allocated by following rules: + // - IN EP 1 gets FIFO 1, IN EP "n" gets FIFO "n". + if (dir == TUSB_DIR_OUT) { + // Calculate required size of RX FIFO + uint16_t const sz = calc_grxfsiz(4 * fifo_size, ep_count); + + // If size_rx needs to be extended check if possible and if so enlarge it + if (dwc2->grxfsiz < sz) { + TU_ASSERT(sz + _allocated_fifo_words_tx <= _dwc2_controller[rhport].ep_fifo_size / 4); + + // Enlarge RX FIFO + dwc2->grxfsiz = sz; + } + } else { + // Note if The TXFELVL is configured as half empty. In order + // to be able to write a packet at that point, the fifo must be twice the max_size. + if ((dwc2->gahbcfg & GAHBCFG_TXFELVL) == 0) { + fifo_size *= 2; + } + + // Check if free space is available + TU_ASSERT(_allocated_fifo_words_tx + fifo_size + dwc2->grxfsiz <= _dwc2_controller[rhport].ep_fifo_size / 4); + _allocated_fifo_words_tx += fifo_size; + TU_LOG(DWC2_DEBUG, " Allocated %u bytes at offset %" PRIu32, fifo_size * 4, + _dwc2_controller[rhport].ep_fifo_size - _allocated_fifo_words_tx * 4); + + // DIEPTXF starts at FIFO #1. + // Both TXFD and TXSA are in unit of 32-bit words. + dwc2->dieptxf[epnum - 1] = (fifo_size << DIEPTXF_INEPTXFD_Pos) | + (_dwc2_controller[rhport].ep_fifo_size / 4 - _allocated_fifo_words_tx); } - // Update size of RX FIFO - dwc2->grxfsiz = calc_grxfsiz(max_epsize, ep_count); + return true; } -// Start of Bus Reset -static void bus_reset(uint8_t rhport) +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) +// Keep count of how many FIFOs are in use +static uint8_t _allocated_fifos = 1; //FIFO0 is always in use + +// Will either return an unused FIFO number, or 0 if all are used. +static uint8_t get_free_fifo(void) { - dwc2_regs_t * dwc2 = DWC2_REG(rhport); + if (_allocated_fifos < 5) return _allocated_fifos++; + return 0; +} +#endif + +static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + uint8_t const epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); + uint8_t const dir = tu_edpt_dir(p_endpoint_desc->bEndpointAddress); + + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, dir); + xfer->max_size = tu_edpt_packet_size(p_endpoint_desc); + xfer->interval = p_endpoint_desc->bInterval; + + // USBAEP, EPTYP, SD0PID_SEVNFRM, MPSIZ are the same for IN and OUT endpoints. + uint32_t const dxepctl = (1 << DOEPCTL_USBAEP_Pos) | + (p_endpoint_desc->bmAttributes.xfer << DOEPCTL_EPTYP_Pos) | + (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | + (xfer->max_size << DOEPCTL_MPSIZ_Pos); + + if (dir == TUSB_DIR_OUT) { + dwc2->epout[epnum].doepctl = dxepctl; + dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum); + } else { + uint8_t fifo_num = epnum; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + // Special Case for EP5, which is used by CDC but not actually called by the driver + // we can give it a fake FIFO + if (epnum == 5) { + fifo_num = epnum; + } else { + fifo_num = get_free_fifo(); + } + TU_ASSERT(fifo_num != 0); +#endif + dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos); + dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum)); + } +} + +static void edpt_disable(uint8_t rhport, uint8_t ep_addr, bool stall) { + (void) rhport; + + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + uint8_t const epnum = tu_edpt_number(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); + + if (dir == TUSB_DIR_IN) { + dwc2_epin_t* epin = dwc2->epin; + + // Only disable currently enabled non-control endpoint + if ((epnum == 0) || !(epin[epnum].diepctl & DIEPCTL_EPENA)) { + epin[epnum].diepctl |= DIEPCTL_SNAK | (stall ? DIEPCTL_STALL : 0); + } else { + // Stop transmitting packets and NAK IN xfers. + epin[epnum].diepctl |= DIEPCTL_SNAK; + while ((epin[epnum].diepint & DIEPINT_INEPNE) == 0) {} + + // Disable the endpoint. + epin[epnum].diepctl |= DIEPCTL_EPDIS | (stall ? DIEPCTL_STALL : 0); + while ((epin[epnum].diepint & DIEPINT_EPDISD_Msk) == 0) {} + + epin[epnum].diepint = DIEPINT_EPDISD; + } + + // Flush the FIFO, and wait until we have confirmed it cleared. + fifo_flush_tx(dwc2, epnum); + } else { + dwc2_epout_t* epout = dwc2->epout; + + // Only disable currently enabled non-control endpoint + if ((epnum == 0) || !(epout[epnum].doepctl & DOEPCTL_EPENA)) { + epout[epnum].doepctl |= stall ? DOEPCTL_STALL : 0; + } else { + // Asserting GONAK is required to STALL an OUT endpoint. + // Simpler to use polling here, we don't use the "B"OUTNAKEFF interrupt + // anyway, and it can't be cleared by user code. If this while loop never + // finishes, we have bigger problems than just the stack. + dwc2->dctl |= DCTL_SGONAK; + while ((dwc2->gintsts & GINTSTS_BOUTNAKEFF_Msk) == 0) {} + + // Ditto here- disable the endpoint. + epout[epnum].doepctl |= DOEPCTL_EPDIS | (stall ? DOEPCTL_STALL : 0); + while ((epout[epnum].doepint & DOEPINT_EPDISD_Msk) == 0) {} + + epout[epnum].doepint = DOEPINT_EPDISD; + + // Allow other OUT endpoints to keep receiving. + dwc2->dctl |= DCTL_CGONAK; + } + } +} + +// Start of Bus Reset +static void bus_reset(uint8_t rhport) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const ep_count = _dwc2_controller[rhport].ep_count; tu_memclr(xfer_status, sizeof(xfer_status)); - _out_ep_closed = false; _sof_en = false; @@ -139,15 +299,24 @@ static void bus_reset(uint8_t rhport) dwc2->dcfg &= ~DCFG_DAD_Msk; // 1. NAK for all OUT endpoints - for ( uint8_t n = 0; n < ep_count; n++ ) - { + for (uint8_t n = 0; n < ep_count; n++) { dwc2->epout[n].doepctl |= DOEPCTL_SNAK; } - // 2. Set up interrupt mask + // 2. Disable all IN endpoints + for (uint8_t n = 0; n < ep_count; n++) { + if (dwc2->epin[n].diepctl & DIEPCTL_EPENA) { + dwc2->epin[n].diepctl |= DIEPCTL_SNAK | DIEPCTL_EPDIS; + } + } + + fifo_flush_tx(dwc2, 0x10); // all tx fifo + fifo_flush_rx(dwc2); + + // 3. Set up interrupt mask dwc2->daintmsk = TU_BIT(DAINTMSK_OEPM_Pos) | TU_BIT(DAINTMSK_IEPM_Pos); - dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM; - dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM; + dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM; + dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM; // "USB Data FIFOs" section in reference manual // Peripheral FIFO architecture @@ -206,36 +375,34 @@ static void bus_reset(uint8_t rhport) _allocated_fifo_words_tx = 16; // Control IN uses FIFO 0 with 64 bytes ( 16 32-bit word ) - dwc2->dieptxf0 = (16 << DIEPTXF0_TX0FD_Pos) | (_dwc2_controller[rhport].ep_fifo_size/4 - _allocated_fifo_words_tx); + dwc2->dieptxf0 = (16 << DIEPTXF0_TX0FD_Pos) | (_dwc2_controller[rhport].ep_fifo_size / 4 - _allocated_fifo_words_tx); // Fixed control EP0 size to 64 bytes dwc2->epin[0].diepctl &= ~(0x03 << DIEPCTL_MPSIZ_Pos); xfer_status[0][TUSB_DIR_OUT].max_size = 64; - xfer_status[0][TUSB_DIR_IN ].max_size = 64; + xfer_status[0][TUSB_DIR_IN].max_size = 64; dwc2->epout[0].doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); dwc2->gintmsk |= GINTMSK_OEPINT | GINTMSK_IEPINT; } -static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t const dir, uint16_t const num_packets, uint16_t total_bytes) -{ +static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t const dir, uint16_t const num_packets, + uint16_t total_bytes) { (void) rhport; - dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2_regs_t* dwc2 = DWC2_REG(rhport); // EP0 is limited to one packet each xfer // We use multiple transaction of xfer->max_size length to get a whole transfer done - if ( epnum == 0 ) - { - xfer_ctl_t *const xfer = XFER_CTL_BASE(epnum, dir); + if (epnum == 0) { + xfer_ctl_t* const xfer = XFER_CTL_BASE(epnum, dir); total_bytes = tu_min16(ep0_pending[dir], xfer->max_size); ep0_pending[dir] -= total_bytes; } // IN and OUT endpoint xfers are interrupt-driven, we just schedule them here. - if ( dir == TUSB_DIR_IN ) - { + if (dir == TUSB_DIR_IN) { dwc2_epin_t* epin = dwc2->epin; // A full IN transfer (multiple packets, possibly) triggers XFRC. @@ -245,20 +412,16 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c epin[epnum].diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; // For ISO endpoint set correct odd/even bit for next frame. - if ( (epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1 ) - { + if ((epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { // Take odd/even bit from frame counter. uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); epin[epnum].diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); } // Enable fifo empty interrupt only if there are something to put in the fifo. - if ( total_bytes != 0 ) - { + if (total_bytes != 0) { dwc2->diepempmsk |= (1 << epnum); } - } - else - { + } else { dwc2_epout_t* epout = dwc2->epout; // A full OUT transfer (multiple packets, possibly) triggers XFRC. @@ -267,9 +430,8 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c ((total_bytes << DOEPTSIZ_XFRSIZ_Pos) & DOEPTSIZ_XFRSIZ_Msk); epout[epnum].doepctl |= DOEPCTL_EPENA | DOEPCTL_CNAK; - if ( (epout[epnum].doepctl & DOEPCTL_EPTYP) == DOEPCTL_EPTYP_0 && - XFER_CTL_BASE(epnum, dir)->interval == 1 ) - { + if ((epout[epnum].doepctl & DOEPCTL_EPTYP) == DOEPCTL_EPTYP_0 && + XFER_CTL_BASE(epnum, dir)->interval == 1) { // Take odd/even bit from frame counter. uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); epout[epnum].doepctl |= (odd_frame_now ? DOEPCTL_SD0PID_SEVNFRM_Msk : DOEPCTL_SODDFRM_Msk); @@ -281,103 +443,46 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c /* Controller API *------------------------------------------------------------------*/ #if CFG_TUSB_DEBUG >= DWC2_DEBUG -void print_dwc2_info(dwc2_regs_t * dwc2) -{ - dwc2_ghwcfg2_t const * hw_cfg2 = &dwc2->ghwcfg2_bm; - dwc2_ghwcfg3_t const * hw_cfg3 = &dwc2->ghwcfg3_bm; - dwc2_ghwcfg4_t const * hw_cfg4 = &dwc2->ghwcfg4_bm; - -// TU_LOG_HEX(DWC2_DEBUG, dwc2->gotgctl); -// TU_LOG_HEX(DWC2_DEBUG, dwc2->gusbcfg); -// TU_LOG_HEX(DWC2_DEBUG, dwc2->dcfg); - TU_LOG_HEX(DWC2_DEBUG, dwc2->guid); - TU_LOG_HEX(DWC2_DEBUG, dwc2->gsnpsid); - TU_LOG_HEX(DWC2_DEBUG, dwc2->ghwcfg1); - - // HW configure 2 - TU_LOG(DWC2_DEBUG, "\r\n"); - TU_LOG_HEX(DWC2_DEBUG, dwc2->ghwcfg2); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->op_mode ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->arch ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->point2point ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->hs_phy_type ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->fs_phy_type ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->num_dev_ep ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->num_host_ch ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->period_channel_support ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->enable_dynamic_fifo ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->mul_cpu_int ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->nperiod_tx_q_depth ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->host_period_tx_q_depth ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->dev_token_q_depth ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg2->otg_enable_ic_usb ); - - // HW configure 3 - TU_LOG(DWC2_DEBUG, "\r\n"); - TU_LOG_HEX(DWC2_DEBUG, dwc2->ghwcfg3); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->xfer_size_width ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->packet_size_width ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->otg_enable ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->i2c_enable ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->vendor_ctrl_itf ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->optional_feature_removed ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->synch_reset ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->otg_adp_support ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->otg_enable_hsic ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->battery_charger_support ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->lpm_mode ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg3->total_fifo_size ); - - // HW configure 4 - TU_LOG(DWC2_DEBUG, "\r\n"); - TU_LOG_HEX(DWC2_DEBUG, dwc2->ghwcfg4); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->num_dev_period_in_ep ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->power_optimized ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->ahb_freq_min ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->hibernation ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->service_interval_mode ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->ipg_isoc_en ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->acg_enable ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->utmi_phy_data_width ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->dev_ctrl_ep_num ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->iddg_filter_enabled ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->vbus_valid_filter_enabled ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->a_valid_filter_enabled ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->b_valid_filter_enabled ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->dedicated_fifos ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->num_dev_in_eps ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->dma_desc_enable ); - TU_LOG_INT(DWC2_DEBUG, hw_cfg4->dma_dynamic ); +void print_dwc2_info(dwc2_regs_t* dwc2) { + // print guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4 + // use dwc2_info.py/md for bit-field value and comparison with other ports + volatile uint32_t const* p = (volatile uint32_t const*) &dwc2->guid; + TU_LOG(DWC2_DEBUG, "guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4\r\n"); + for (size_t i = 0; i < 5; i++) { + TU_LOG(DWC2_DEBUG, "0x%08" PRIX32 ", ", p[i]); + } + TU_LOG(DWC2_DEBUG, "0x%08" PRIX32 "\r\n", p[5]); } #endif -static void reset_core(dwc2_regs_t * dwc2) -{ +static void reset_core(dwc2_regs_t* dwc2) { // reset core dwc2->grstctl |= GRSTCTL_CSRST; // wait for reset bit is cleared // TODO version 4.20a should wait for RESET DONE mask - while (dwc2->grstctl & GRSTCTL_CSRST) { } + while (dwc2->grstctl & GRSTCTL_CSRST) {} // wait for AHB master IDLE - while ( !(dwc2->grstctl & GRSTCTL_AHBIDL) ) { } + while (!(dwc2->grstctl & GRSTCTL_AHBIDL)) {} // wait for device mode ? } -static bool phy_hs_supported(dwc2_regs_t * dwc2) -{ - // note: esp32 incorrect report its hs_phy_type as utmi +static bool phy_hs_supported(dwc2_regs_t* dwc2) { + (void) dwc2; + #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + // note: esp32 incorrect report its hs_phy_type as utmi + return false; +#elif !TUD_OPT_HIGH_SPEED return false; #else - return TUD_OPT_HIGH_SPEED && dwc2->ghwcfg2_bm.hs_phy_type != HS_PHY_TYPE_NONE; + return dwc2->ghwcfg2_bm.hs_phy_type != HS_PHY_TYPE_NONE; #endif } -static void phy_fs_init(dwc2_regs_t * dwc2) -{ +static void phy_fs_init(dwc2_regs_t* dwc2) { TU_LOG(DWC2_DEBUG, "Fullspeed PHY init\r\n"); // Select FS PHY @@ -401,15 +506,13 @@ static void phy_fs_init(dwc2_regs_t * dwc2) dwc2->dcfg = (dwc2->dcfg & ~DCFG_DSPD_Msk) | (DCFG_DSPD_FS << DCFG_DSPD_Pos); } -static void phy_hs_init(dwc2_regs_t * dwc2) -{ +static void phy_hs_init(dwc2_regs_t* dwc2) { uint32_t gusbcfg = dwc2->gusbcfg; // De-select FS PHY gusbcfg &= ~GUSBCFG_PHYSEL; - if (dwc2->ghwcfg2_bm.hs_phy_type == HS_PHY_TYPE_ULPI) - { + if (dwc2->ghwcfg2_bm.hs_phy_type == HS_PHY_TYPE_ULPI) { TU_LOG(DWC2_DEBUG, "Highspeed ULPI PHY init\r\n"); // Select ULPI @@ -423,8 +526,7 @@ static void phy_hs_init(dwc2_regs_t * dwc2) // Disable FS/LS ULPI gusbcfg &= ~(GUSBCFG_ULPIFSLS | GUSBCFG_ULPICSM); - }else - { + } else { TU_LOG(DWC2_DEBUG, "Highspeed UTMI+ PHY init\r\n"); // Select UTMI+ with 8-bit interface @@ -465,8 +567,7 @@ static void phy_hs_init(dwc2_regs_t * dwc2) dwc2->dcfg = dcfg; } -static bool check_dwc2(dwc2_regs_t * dwc2) -{ +static bool check_dwc2(dwc2_regs_t* dwc2) { #if CFG_TUSB_DEBUG >= DWC2_DEBUG print_dwc2_info(dwc2); #endif @@ -481,41 +582,35 @@ static bool check_dwc2(dwc2_regs_t * dwc2) return true; } -void dcd_init (uint8_t rhport) -{ +void dcd_init(uint8_t rhport) { // Programming model begins in the last section of the chapter on the USB // peripheral in each Reference Manual. - dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2_regs_t* dwc2 = DWC2_REG(rhport); // Check Synopsys ID register, failed if controller clock/power is not enabled - TU_VERIFY(check_dwc2(dwc2), ); - + if (!check_dwc2(dwc2)) return; dcd_disconnect(rhport); // max number of endpoints & total_fifo_size are: // hw_cfg2->num_dev_ep, hw_cfg2->total_fifo_size - if( phy_hs_supported(dwc2) ) - { - // Highspeed - phy_hs_init(dwc2); - }else - { - // core does not support highspeed or hs-phy is not present - phy_fs_init(dwc2); + if (phy_hs_supported(dwc2)) { + phy_hs_init(dwc2); // Highspeed + } else { + phy_fs_init(dwc2); // core does not support highspeed or hs phy is not present } // Restart PHY clock dwc2->pcgctl &= ~(PCGCTL_STOPPCLK | PCGCTL_GATEHCLK | PCGCTL_PWRCLMP | PCGCTL_RSTPDWNMODULE); - /* Set HS/FS Timeout Calibration to 7 (max available value). - * The number of PHY clocks that the application programs in - * this field is added to the high/full speed interpacket timeout - * duration in the core to account for any additional delays - * introduced by the PHY. This can be required, because the delay - * introduced by the PHY in generating the linestate condition - * can vary from one PHY to another. - */ + /* Set HS/FS Timeout Calibration to 7 (max available value). + * The number of PHY clocks that the application programs in + * this field is added to the high/full speed interpacket timeout + * duration in the core to account for any additional delays + * introduced by the PHY. This can be required, because the delay + * introduced by the PHY in generating the linestate condition + * can vary from one PHY to another. + */ dwc2->gusbcfg |= (7ul << GUSBCFG_TOCAL_Pos); // Force device mode @@ -528,6 +623,9 @@ void dcd_init (uint8_t rhport) // (non zero-length packet), send STALL back and discard. dwc2->dcfg |= DCFG_NZLSOHSK; + fifo_flush_tx(dwc2, 0x10); // all tx fifo + fifo_flush_rx(dwc2); + // Clear all interrupts uint32_t int_mask = dwc2->gintsts; dwc2->gintsts |= int_mask; @@ -535,11 +633,12 @@ void dcd_init (uint8_t rhport) dwc2->gotgint |= int_mask; // Required as part of core initialization. - // TODO: How should mode mismatch be handled? It will cause - // the core to stop working/require reset. - dwc2->gintmsk = GINTMSK_OTGINT | GINTMSK_MMISM | GINTMSK_RXFLVLM | + dwc2->gintmsk = GINTMSK_OTGINT | GINTMSK_RXFLVLM | GINTMSK_USBSUSPM | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM; + // Configure TX FIFO empty level for interrupt. Default is complete empty + dwc2->gahbcfg |= GAHBCFG_TXFELVL; + // Enable global interrupt dwc2->gahbcfg |= GAHBCFG_GINT; @@ -554,30 +653,26 @@ void dcd_init (uint8_t rhport) dcd_connect(rhport); } -void dcd_int_enable (uint8_t rhport) -{ +void dcd_int_enable(uint8_t rhport) { dwc2_dcd_int_enable(rhport); } -void dcd_int_disable (uint8_t rhport) -{ +void dcd_int_disable(uint8_t rhport) { dwc2_dcd_int_disable(rhport); } -void dcd_set_address (uint8_t rhport, uint8_t dev_addr) -{ - dwc2_regs_t * dwc2 = DWC2_REG(rhport); +void dcd_set_address(uint8_t rhport, uint8_t dev_addr) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); dwc2->dcfg = (dwc2->dcfg & ~DCFG_DAD_Msk) | (dev_addr << DCFG_DAD_Pos); // Response with status after changing device address dcd_edpt_xfer(rhport, tu_edpt_addr(0, TUSB_DIR_IN), NULL, 0); } -void dcd_remote_wakeup(uint8_t rhport) -{ +void dcd_remote_wakeup(uint8_t rhport) { (void) rhport; - dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2_regs_t* dwc2 = DWC2_REG(rhport); // set remote wakeup dwc2->dctl |= DCTL_RWUSIG; @@ -592,35 +687,29 @@ void dcd_remote_wakeup(uint8_t rhport) dwc2->dctl &= ~DCTL_RWUSIG; } -void dcd_connect(uint8_t rhport) -{ +void dcd_connect(uint8_t rhport) { (void) rhport; - dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2_regs_t* dwc2 = DWC2_REG(rhport); dwc2->dctl &= ~DCTL_SDIS; } -void dcd_disconnect(uint8_t rhport) -{ +void dcd_disconnect(uint8_t rhport) { (void) rhport; - dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2_regs_t* dwc2 = DWC2_REG(rhport); dwc2->dctl |= DCTL_SDIS; } // Be advised: audio, video and possibly other iso-ep classes use dcd_sof_enable() to enable/disable its corresponding ISR on purpose! -void dcd_sof_enable(uint8_t rhport, bool en) -{ +void dcd_sof_enable(uint8_t rhport, bool en) { (void) rhport; - dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2_regs_t* dwc2 = DWC2_REG(rhport); _sof_en = en; - if (en) - { + if (en) { dwc2->gintsts = GINTSTS_SOF; dwc2->gintmsk |= GINTMSK_SOFM; - } - else - { + } else { dwc2->gintmsk &= ~GINTMSK_SOFM; } } @@ -628,166 +717,83 @@ void dcd_sof_enable(uint8_t rhport, bool en) /*------------------------------------------------------------------*/ /* DCD Endpoint port *------------------------------------------------------------------*/ -#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -// Keep count of how many FIFOs are in use -static uint8_t _allocated_fifos = 1; //FIFO0 is always in use - -// Will either return an unused FIFO number, or 0 if all are used. -static uint8_t get_free_fifo(void) -{ - if (_allocated_fifos < 5) return _allocated_fifos++; - return 0; -} -#endif - -bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt) -{ - (void) rhport; - - dwc2_regs_t * dwc2 = DWC2_REG(rhport); - uint8_t const ep_count = _dwc2_controller[rhport].ep_count; - - uint8_t const epnum = tu_edpt_number(desc_edpt->bEndpointAddress); - uint8_t const dir = tu_edpt_dir(desc_edpt->bEndpointAddress); - - TU_ASSERT(epnum < ep_count); - - xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir); - xfer->max_size = tu_edpt_packet_size(desc_edpt); - xfer->interval = desc_edpt->bInterval; - - uint16_t const fifo_size = tu_div_ceil(xfer->max_size, 4); - - if(dir == TUSB_DIR_OUT) - { - // Calculate required size of RX FIFO - uint16_t const sz = calc_grxfsiz(4*fifo_size, ep_count); - - // If size_rx needs to be extended check if possible and if so enlarge it - if (dwc2->grxfsiz < sz) - { - TU_ASSERT(sz + _allocated_fifo_words_tx <= _dwc2_controller[rhport].ep_fifo_size/4); - - // Enlarge RX FIFO - dwc2->grxfsiz = sz; - } - - dwc2->epout[epnum].doepctl |= (1 << DOEPCTL_USBAEP_Pos) | - (desc_edpt->bmAttributes.xfer << DOEPCTL_EPTYP_Pos) | - (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | - (xfer->max_size << DOEPCTL_MPSIZ_Pos); - - dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum); - } - else - { - // "USB Data FIFOs" section in reference manual - // Peripheral FIFO architecture - // - // --------------- 320 or 1024 ( 1280 or 4096 bytes ) - // | IN FIFO 0 | - // --------------- (320 or 1024) - 16 - // | IN FIFO 1 | - // --------------- (320 or 1024) - 16 - x - // | . . . . | - // --------------- (320 or 1024) - 16 - x - y - ... - z - // | IN FIFO MAX | - // --------------- - // | FREE | - // --------------- GRXFSIZ - // | OUT FIFO | - // | ( Shared ) | - // --------------- 0 - // - // In FIFO is allocated by following rules: - // - IN EP 1 gets FIFO 1, IN EP "n" gets FIFO "n". - - uint8_t fifo_num = epnum; -#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) - // Special Case for EP5, which is used by CDC but not actually called by the driver - // we can give it a fake FIFO - if (epnum == 5) { - fifo_num = epnum; - } else { - fifo_num = get_free_fifo(); - } - TU_ASSERT(fifo_num != 0); -#endif - // Check if free space is available - TU_ASSERT(_allocated_fifo_words_tx + fifo_size + dwc2->grxfsiz <= _dwc2_controller[rhport].ep_fifo_size/4); - - _allocated_fifo_words_tx += fifo_size; - - TU_LOG(DWC2_DEBUG, " Allocated %u bytes at offset %lu", fifo_size*4, _dwc2_controller[rhport].ep_fifo_size-_allocated_fifo_words_tx*4); - - // DIEPTXF starts at FIFO #1. - // Both TXFD and TXSA are in unit of 32-bit words. - dwc2->dieptxf[epnum - 1] = (fifo_size << DIEPTXF_INEPTXFD_Pos) | (_dwc2_controller[rhport].ep_fifo_size/4 - _allocated_fifo_words_tx); - - dwc2->epin[epnum].diepctl |= (1 << DIEPCTL_USBAEP_Pos) | - (fifo_num << DIEPCTL_TXFNUM_Pos) | - (desc_edpt->bmAttributes.xfer << DIEPCTL_EPTYP_Pos) | - (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DIEPCTL_SD0PID_SEVNFRM : 0) | - (xfer->max_size << DIEPCTL_MPSIZ_Pos); - - dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum)); - } +bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const* desc_edpt) { + TU_ASSERT(fifo_alloc(rhport, desc_edpt->bEndpointAddress, tu_edpt_packet_size(desc_edpt))); + edpt_activate(rhport, desc_edpt); return true; } // Close all non-control endpoints, cancel all pending transfers if any. -void dcd_edpt_close_all (uint8_t rhport) -{ - dwc2_regs_t * dwc2 = DWC2_REG(rhport); +void dcd_edpt_close_all(uint8_t rhport) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const ep_count = _dwc2_controller[rhport].ep_count; // Disable non-control interrupt dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos); - for(uint8_t n = 1; n < ep_count; n++) - { + for (uint8_t n = 1; n < ep_count; n++) { // disable OUT endpoint - dwc2->epout[n].doepctl = 0; + if (dwc2->epout[n].doepctl & DOEPCTL_EPENA) { + dwc2->epout[n].doepctl |= DOEPCTL_SNAK | DOEPCTL_EPDIS; + } xfer_status[n][TUSB_DIR_OUT].max_size = 0; // disable IN endpoint - dwc2->epin[n].diepctl = 0; + if (dwc2->epin[n].diepctl & DIEPCTL_EPENA) { + dwc2->epin[n].diepctl |= DIEPCTL_SNAK | DIEPCTL_EPDIS; + } xfer_status[n][TUSB_DIR_IN].max_size = 0; } + // reset allocated fifo OUT + dwc2->grxfsiz = calc_grxfsiz(64, ep_count); // reset allocated fifo IN _allocated_fifo_words_tx = 16; + #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) _allocated_fifos = 1; #endif + + fifo_flush_tx(dwc2, 0x10); // all tx fifo + fifo_flush_rx(dwc2); } -bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes) -{ +bool dcd_edpt_iso_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t largest_packet_size) { + TU_ASSERT(fifo_alloc(rhport, ep_addr, largest_packet_size)); + return true; +} + +bool dcd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { + // Disable EP to clear potential incomplete transfers + edpt_disable(rhport, p_endpoint_desc->bEndpointAddress, false); + + edpt_activate(rhport, p_endpoint_desc); + + return true; +} + +bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t total_bytes) { uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); - xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir); - xfer->buffer = buffer; - xfer->ff = NULL; - xfer->total_len = total_bytes; + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, dir); + xfer->buffer = buffer; + xfer->ff = NULL; + xfer->total_len = total_bytes; // EP0 can only handle one packet - if(epnum == 0) - { + if (epnum == 0) { ep0_pending[dir] = total_bytes; // Schedule the first transaction for EP0 transfer edpt_schedule_packets(rhport, epnum, dir, 1, ep0_pending[dir]); - } - else - { + } else { uint16_t num_packets = (total_bytes / xfer->max_size); uint16_t const short_packet_size = total_bytes % xfer->max_size; // Zero-size packet is special case. - if ( (short_packet_size > 0) || (total_bytes == 0) ) num_packets++; + if ((short_packet_size > 0) || (total_bytes == 0)) num_packets++; // Schedule packets to be sent within interrupt edpt_schedule_packets(rhport, epnum, dir, num_packets, total_bytes); @@ -800,24 +806,23 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t // bytes should be written and second to keep the return value free to give back a boolean // success message. If total_bytes is too big, the FIFO will copy only what is available // into the USB buffer! -bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes) -{ +bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t total_bytes) { // USB buffers always work in bytes so to avoid unnecessary divisions we demand item_size = 1 TU_ASSERT(ff->item_size == 1); uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); - xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir); - xfer->buffer = NULL; - xfer->ff = ff; - xfer->total_len = total_bytes; + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, dir); + xfer->buffer = NULL; + xfer->ff = ff; + xfer->total_len = total_bytes; uint16_t num_packets = (total_bytes / xfer->max_size); uint16_t const short_packet_size = total_bytes % xfer->max_size; // Zero-size packet is special case. - if ( short_packet_size > 0 || (total_bytes == 0) ) num_packets++; + if (short_packet_size > 0 || (total_bytes == 0)) num_packets++; // Schedule packets to be sent within interrupt edpt_schedule_packets(rhport, epnum, dir, num_packets, total_bytes); @@ -825,123 +830,27 @@ bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16 return true; } -static void dcd_edpt_disable (uint8_t rhport, uint8_t ep_addr, bool stall) -{ - (void) rhport; - - dwc2_regs_t *dwc2 = DWC2_REG(rhport); - - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); - - if ( dir == TUSB_DIR_IN ) - { - dwc2_epin_t* epin = dwc2->epin; - - // Only disable currently enabled non-control endpoint - if ( (epnum == 0) || !(epin[epnum].diepctl & DIEPCTL_EPENA) ) - { - epin[epnum].diepctl |= DIEPCTL_SNAK | (stall ? DIEPCTL_STALL : 0); - } - else - { - // Stop transmitting packets and NAK IN xfers. - epin[epnum].diepctl |= DIEPCTL_SNAK; - while ( (epin[epnum].diepint & DIEPINT_INEPNE) == 0 ) {} - - // Disable the endpoint. - epin[epnum].diepctl |= DIEPCTL_EPDIS | (stall ? DIEPCTL_STALL : 0); - while ( (epin[epnum].diepint & DIEPINT_EPDISD_Msk) == 0 ) {} - - epin[epnum].diepint = DIEPINT_EPDISD; - } - - // Flush the FIFO, and wait until we have confirmed it cleared. - dwc2->grstctl = ((epnum << GRSTCTL_TXFNUM_Pos) | GRSTCTL_TXFFLSH); - while ( (dwc2->grstctl & GRSTCTL_TXFFLSH_Msk) != 0 ) {} - } - else - { - dwc2_epout_t* epout = dwc2->epout; - - // Only disable currently enabled non-control endpoint - if ( (epnum == 0) || !(epout[epnum].doepctl & DOEPCTL_EPENA) ) - { - epout[epnum].doepctl |= stall ? DOEPCTL_STALL : 0; - } - else - { - // Asserting GONAK is required to STALL an OUT endpoint. - // Simpler to use polling here, we don't use the "B"OUTNAKEFF interrupt - // anyway, and it can't be cleared by user code. If this while loop never - // finishes, we have bigger problems than just the stack. - dwc2->dctl |= DCTL_SGONAK; - while ( (dwc2->gintsts & GINTSTS_BOUTNAKEFF_Msk) == 0 ) {} - - // Ditto here- disable the endpoint. - epout[epnum].doepctl |= DOEPCTL_EPDIS | (stall ? DOEPCTL_STALL : 0); - while ( (epout[epnum].doepint & DOEPINT_EPDISD_Msk) == 0 ) {} - - epout[epnum].doepint = DOEPINT_EPDISD; - - // Allow other OUT endpoints to keep receiving. - dwc2->dctl |= DCTL_CGONAK; - } - } -} - -/** - * Close an endpoint. - */ -void dcd_edpt_close (uint8_t rhport, uint8_t ep_addr) -{ - dwc2_regs_t * dwc2 = DWC2_REG(rhport); - - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); - - dcd_edpt_disable(rhport, ep_addr, false); - - // Update max_size - xfer_status[epnum][dir].max_size = 0; // max_size = 0 marks a disabled EP - required for changing FIFO allocation - - if (dir == TUSB_DIR_IN) - { - uint16_t const fifo_size = (dwc2->dieptxf[epnum - 1] & DIEPTXF_INEPTXFD_Msk) >> DIEPTXF_INEPTXFD_Pos; - uint16_t const fifo_start = (dwc2->dieptxf[epnum - 1] & DIEPTXF_INEPTXSA_Msk) >> DIEPTXF_INEPTXSA_Pos; - - // For now only the last opened endpoint can be closed without fuss. - TU_ASSERT(fifo_start == _dwc2_controller[rhport].ep_fifo_size/4 - _allocated_fifo_words_tx,); - _allocated_fifo_words_tx -= fifo_size; - } - else - { - _out_ep_closed = true; // Set flag such that RX FIFO gets reduced in size once RX FIFO is empty - } +void dcd_edpt_close(uint8_t rhport, uint8_t ep_addr) { + edpt_disable(rhport, ep_addr, false); } -void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr) -{ - dcd_edpt_disable(rhport, ep_addr, true); +void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) { + edpt_disable(rhport, ep_addr, true); } -void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) -{ +void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) { (void) rhport; - dwc2_regs_t * dwc2 = DWC2_REG(rhport); + dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); // Clear stall and reset data toggle - if ( dir == TUSB_DIR_IN ) - { + if (dir == TUSB_DIR_IN) { dwc2->epin[epnum].diepctl &= ~DIEPCTL_STALL; dwc2->epin[epnum].diepctl |= DIEPCTL_SD0PID_SEVNFRM; - } - else - { + } else { dwc2->epout[epnum].doepctl &= ~DOEPCTL_STALL; dwc2->epout[epnum].doepctl |= DOEPCTL_SD0PID_SEVNFRM; } @@ -950,70 +859,63 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) /*------------------------------------------------------------------*/ // Read a single data packet from receive FIFO -static void read_fifo_packet(uint8_t rhport, uint8_t * dst, uint16_t len) -{ +static void read_fifo_packet(uint8_t rhport, uint8_t* dst, uint16_t len) { (void) rhport; - dwc2_regs_t * dwc2 = DWC2_REG(rhport); - volatile const uint32_t * rx_fifo = dwc2->fifo[0]; + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + volatile const uint32_t* rx_fifo = dwc2->fifo[0]; // Reading full available 32 bit words from fifo uint16_t full_words = len >> 2; - while(full_words--) - { + while (full_words--) { tu_unaligned_write32(dst, *rx_fifo); dst += 4; } // Read the remaining 1-3 bytes from fifo uint8_t const bytes_rem = len & 0x03; - if ( bytes_rem != 0 ) - { + if (bytes_rem != 0) { uint32_t const tmp = *rx_fifo; dst[0] = tu_u32_byte0(tmp); - if ( bytes_rem > 1 ) dst[1] = tu_u32_byte1(tmp); - if ( bytes_rem > 2 ) dst[2] = tu_u32_byte2(tmp); + if (bytes_rem > 1) dst[1] = tu_u32_byte1(tmp); + if (bytes_rem > 2) dst[2] = tu_u32_byte2(tmp); } } // Write a single data packet to EPIN FIFO -static void write_fifo_packet(uint8_t rhport, uint8_t fifo_num, uint8_t const * src, uint16_t len) -{ +static void write_fifo_packet(uint8_t rhport, uint8_t fifo_num, uint8_t const* src, uint16_t len) { (void) rhport; - dwc2_regs_t * dwc2 = DWC2_REG(rhport); - volatile uint32_t * tx_fifo = dwc2->fifo[fifo_num]; + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + volatile uint32_t* tx_fifo = dwc2->fifo[fifo_num]; // Pushing full available 32 bit words to fifo uint16_t full_words = len >> 2; - while(full_words--) - { + while (full_words--) { *tx_fifo = tu_unaligned_read32(src); src += 4; } // Write the remaining 1-3 bytes into fifo uint8_t const bytes_rem = len & 0x03; - if ( bytes_rem ) - { + if (bytes_rem) { uint32_t tmp_word = src[0]; - if ( bytes_rem > 1 ) tmp_word |= (src[1] << 8); - if ( bytes_rem > 2 ) tmp_word |= (src[2] << 16); + if (bytes_rem > 1) tmp_word |= (src[1] << 8); + if (bytes_rem > 2) tmp_word |= (src[2] << 16); *tx_fifo = tmp_word; } } -static void handle_rxflvl_irq(uint8_t rhport) -{ - dwc2_regs_t * dwc2 = DWC2_REG(rhport); - volatile uint32_t const * rx_fifo = dwc2->fifo[0]; +static void handle_rxflvl_irq(uint8_t rhport) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + volatile uint32_t const* rx_fifo = dwc2->fifo[0]; // Pop control word off FIFO uint32_t const ctl_word = dwc2->grxstsp; - uint8_t const pktsts = (ctl_word & GRXSTSP_PKTSTS_Msk ) >> GRXSTSP_PKTSTS_Pos; - uint8_t const epnum = (ctl_word & GRXSTSP_EPNUM_Msk ) >> GRXSTSP_EPNUM_Pos; - uint16_t const bcnt = (ctl_word & GRXSTSP_BCNT_Msk ) >> GRXSTSP_BCNT_Pos; + uint8_t const pktsts = (ctl_word & GRXSTSP_PKTSTS_Msk) >> GRXSTSP_PKTSTS_Pos; + uint8_t const epnum = (ctl_word & GRXSTSP_EPNUM_Msk) >> GRXSTSP_EPNUM_Pos; + uint16_t const bcnt = (ctl_word & GRXSTSP_BCNT_Msk) >> GRXSTSP_BCNT_Pos; dwc2_epout_t* epout = &dwc2->epout[epnum]; @@ -1028,10 +930,10 @@ static void handle_rxflvl_irq(uint8_t rhport) // TU_LOG(DWC2_DEBUG, " daint = %08lX, doepint = %04X\r\n", (unsigned long) dwc2->daint, (unsigned int) epout->doepint); //#endif - switch ( pktsts ) - { + switch (pktsts) { // Global OUT NAK: do nothing - case GRXSTS_PKTSTS_GLOBALOUTNAK: break; + case GRXSTS_PKTSTS_GLOBALOUTNAK: + break; case GRXSTS_PKTSTS_SETUPRX: // Setup packet received @@ -1040,26 +942,22 @@ static void handle_rxflvl_irq(uint8_t rhport) // only the last one is valid. _setup_packet[0] = (*rx_fifo); _setup_packet[1] = (*rx_fifo); - break; + break; case GRXSTS_PKTSTS_SETUPDONE: // Setup packet done (Interrupt) epout->doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); - break; + break; - case GRXSTS_PKTSTS_OUTRX: - { + case GRXSTS_PKTSTS_OUTRX: { // Out packet received - xfer_ctl_t *xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); // Read packet off RxFIFO - if ( xfer->ff ) - { + if (xfer->ff) { // Ring buffer tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void*) (uintptr_t) rx_fifo, bcnt); - } - else - { + } else { // Linear buffer read_fifo_packet(rhport, xfer->buffer, bcnt); @@ -1068,73 +966,64 @@ static void handle_rxflvl_irq(uint8_t rhport) } // Truncate transfer length in case of short packet - if ( bcnt < xfer->max_size ) - { + if (bcnt < xfer->max_size) { xfer->total_len -= (epout->doeptsiz & DOEPTSIZ_XFRSIZ_Msk) >> DOEPTSIZ_XFRSIZ_Pos; - if ( epnum == 0 ) - { + if (epnum == 0) { xfer->total_len -= ep0_pending[TUSB_DIR_OUT]; ep0_pending[TUSB_DIR_OUT] = 0; } } } - break; + break; - // Out packet done (Interrupt) + // Out packet done (Interrupt) case GRXSTS_PKTSTS_OUTDONE: - // Occurred on STM32L47 with dwc2 version 3.10a but not found on other version like 2.80a or 3.30a - // May (or not) be 3.10a specific feature/bug or depending on MCU configuration - // XFRC complete is additionally generated when - // - setup packet is received - // - complete the data stage of control write is complete - if ((epnum == 0) && (bcnt == 0) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) - { - uint32_t doepint = epout->doepint; - - if (doepint & (DOEPINT_STPKTRX | DOEPINT_OTEPSPR)) - { - // skip this "no-data" transfer complete event - // Note: STPKTRX will be clear later by setup received handler - uint32_t clear_flags = DOEPINT_XFRC; - - if (doepint & DOEPINT_OTEPSPR) clear_flags |= DOEPINT_OTEPSPR; - - epout->doepint = clear_flags; - - // TU_LOG(DWC2_DEBUG, " FIX extra transfer complete on setup/data compete\r\n"); - } + // Occurred on STM32L47 with dwc2 version 3.10a but not found on other version like 2.80a or 3.30a + // May (or not) be 3.10a specific feature/bug or depending on MCU configuration + // XFRC complete is additionally generated when + // - setup packet is received + // - complete the data stage of control write is complete + if ((epnum == 0) && (bcnt == 0) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) { + uint32_t doepint = epout->doepint; + + if (doepint & (DOEPINT_STPKTRX | DOEPINT_OTEPSPR)) { + // skip this "no-data" transfer complete event + // Note: STPKTRX will be clear later by setup received handler + uint32_t clear_flags = DOEPINT_XFRC; + + if (doepint & DOEPINT_OTEPSPR) clear_flags |= DOEPINT_OTEPSPR; + + epout->doepint = clear_flags; + + // TU_LOG(DWC2_DEBUG, " FIX extra transfer complete on setup/data compete\r\n"); } - break; + } + break; default: // Invalid TU_BREAKPOINT(); - break; + break; } } -static void handle_epout_irq (uint8_t rhport) -{ - dwc2_regs_t * dwc2 = DWC2_REG(rhport); +static void handle_epout_irq(uint8_t rhport) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const ep_count = _dwc2_controller[rhport].ep_count; // DAINT for a given EP clears when DOEPINTx is cleared. // OEPINT will be cleared when DAINT's out bits are cleared. - for ( uint8_t n = 0; n < ep_count; n++ ) - { - if ( dwc2->daint & TU_BIT(DAINT_OEPINT_Pos + n) ) - { + for (uint8_t n = 0; n < ep_count; n++) { + if (dwc2->daint & TU_BIT(DAINT_OEPINT_Pos + n)) { dwc2_epout_t* epout = &dwc2->epout[n]; uint32_t const doepint = epout->doepint; // SETUP packet Setup Phase done. - if ( doepint & DOEPINT_STUP ) - { + if (doepint & DOEPINT_STUP) { uint32_t clear_flag = DOEPINT_STUP; // STPKTRX is only available for version from 3_00a - if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) - { + if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) { clear_flag |= DOEPINT_STPKTRX; } @@ -1143,20 +1032,16 @@ static void handle_epout_irq (uint8_t rhport) } // OUT XFER complete - if ( epout->doepint & DOEPINT_XFRC ) - { + if (epout->doepint & DOEPINT_XFRC) { epout->doepint = DOEPINT_XFRC; - xfer_ctl_t *xfer = XFER_CTL_BASE(n, TUSB_DIR_OUT); + xfer_ctl_t* xfer = XFER_CTL_BASE(n, TUSB_DIR_OUT); // EP0 can only handle one packet - if ( (n == 0) && ep0_pending[TUSB_DIR_OUT] ) - { + if ((n == 0) && ep0_pending[TUSB_DIR_OUT]) { // Schedule another packet to be received. edpt_schedule_packets(rhport, n, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); - } - else - { + } else { dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true); } } @@ -1164,40 +1049,32 @@ static void handle_epout_irq (uint8_t rhport) } } -static void handle_epin_irq (uint8_t rhport) -{ - dwc2_regs_t * dwc2 = DWC2_REG(rhport); +static void handle_epin_irq(uint8_t rhport) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const ep_count = _dwc2_controller[rhport].ep_count; - dwc2_epin_t* epin = dwc2->epin; + dwc2_epin_t* epin = dwc2->epin; // DAINT for a given EP clears when DIEPINTx is cleared. // IEPINT will be cleared when DAINT's out bits are cleared. - for ( uint8_t n = 0; n < ep_count; n++ ) - { - if ( dwc2->daint & TU_BIT(DAINT_IEPINT_Pos + n) ) - { + for (uint8_t n = 0; n < ep_count; n++) { + if (dwc2->daint & TU_BIT(DAINT_IEPINT_Pos + n)) { // IN XFER complete (entire xfer). - xfer_ctl_t *xfer = XFER_CTL_BASE(n, TUSB_DIR_IN); + xfer_ctl_t* xfer = XFER_CTL_BASE(n, TUSB_DIR_IN); - if ( epin[n].diepint & DIEPINT_XFRC ) - { + if (epin[n].diepint & DIEPINT_XFRC) { epin[n].diepint = DIEPINT_XFRC; // EP0 can only handle one packet - if ( (n == 0) && ep0_pending[TUSB_DIR_IN] ) - { + if ((n == 0) && ep0_pending[TUSB_DIR_IN]) { // Schedule another packet to be transmitted. edpt_schedule_packets(rhport, n, TUSB_DIR_IN, 1, ep0_pending[TUSB_DIR_IN]); - } - else - { + } else { dcd_event_xfer_complete(rhport, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); } } // XFER FIFO empty - if ( (epin[n].diepint & DIEPINT_TXFE) && (dwc2->diepempmsk & (1 << n)) ) - { + if ((epin[n].diepint & DIEPINT_TXFE) && (dwc2->diepempmsk & (1 << n))) { // diepint's TXFE bit is read-only, software cannot clear it. // It will only be cleared by hardware when written bytes is more than // - 64 bytes or @@ -1206,8 +1083,7 @@ static void handle_epin_irq (uint8_t rhport) uint16_t remaining_packets = (epin[n].dieptsiz & DIEPTSIZ_PKTCNT_Msk) >> DIEPTSIZ_PKTCNT_Pos; // Process every single packet (only whole packets can be written to fifo) - for ( uint16_t i = 0; i < remaining_packets; i++ ) - { + for (uint16_t i = 0; i < remaining_packets; i++) { uint16_t const remaining_bytes = (epin[n].dieptsiz & DIEPTSIZ_XFRSIZ_Msk) >> DIEPTSIZ_XFRSIZ_Pos; // Packet can not be larger than ep max size @@ -1215,16 +1091,13 @@ static void handle_epin_irq (uint8_t rhport) // It's only possible to write full packets into FIFO. Therefore DTXFSTS register of current // EP has to be checked if the buffer can take another WHOLE packet - if ( packet_size > ((epin[n].dtxfsts & DTXFSTS_INEPTFSAV_Msk) << 2) ) break; + if (packet_size > ((epin[n].dtxfsts & DTXFSTS_INEPTFSAV_Msk) << 2)) break; // Push packet to Tx-FIFO - if ( xfer->ff ) - { - volatile uint32_t *tx_fifo = dwc2->fifo[n]; + if (xfer->ff) { + volatile uint32_t* tx_fifo = dwc2->fifo[n]; tu_fifo_read_n_const_addr_full_words(xfer->ff, (void*) (uintptr_t) tx_fifo, packet_size); - } - else - { + } else { write_fifo_packet(rhport, n, xfer->buffer, packet_size); // Increment pointer to xfer data @@ -1233,8 +1106,7 @@ static void handle_epin_irq (uint8_t rhport) } // Turn off TXFE if all bytes are written. - if ( ((epin[n].dieptsiz & DIEPTSIZ_XFRSIZ_Msk) >> DIEPTSIZ_XFRSIZ_Pos) == 0 ) - { + if (((epin[n].dieptsiz & DIEPTSIZ_XFRSIZ_Msk) >> DIEPTSIZ_XFRSIZ_Pos) == 0) { dwc2->diepempmsk &= ~(1 << n); } } @@ -1242,15 +1114,13 @@ static void handle_epin_irq (uint8_t rhport) } } -void dcd_int_handler(uint8_t rhport) -{ - dwc2_regs_t *dwc2 = DWC2_REG(rhport); +void dcd_int_handler(uint8_t rhport) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint32_t const int_mask = dwc2->gintmsk; uint32_t const int_status = dwc2->gintsts & int_mask; - if(int_status & GINTSTS_USBRST) - { + if (int_status & GINTSTS_USBRST) { // USBRST is start of reset. dwc2->gintsts = GINTSTS_USBRST; #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) @@ -1259,35 +1129,33 @@ void dcd_int_handler(uint8_t rhport) bus_reset(rhport); } - if(int_status & GINTSTS_ENUMDNE) - { + if (int_status & GINTSTS_ENUMDNE) { // ENUMDNE is the end of reset where speed of the link is detected - dwc2->gintsts = GINTSTS_ENUMDNE; tusb_speed_t speed; - switch ((dwc2->dsts & DSTS_ENUMSPD_Msk) >> DSTS_ENUMSPD_Pos) - { + switch ((dwc2->dsts & DSTS_ENUMSPD_Msk) >> DSTS_ENUMSPD_Pos) { case DSTS_ENUMSPD_HS: speed = TUSB_SPEED_HIGH; - break; + break; case DSTS_ENUMSPD_LS: speed = TUSB_SPEED_LOW; - break; + break; case DSTS_ENUMSPD_FS_HSPHY: case DSTS_ENUMSPD_FS: default: speed = TUSB_SPEED_FULL; - break; + break; } + // TODO must update GUSBCFG_TRDT according to link speed + dcd_event_bus_reset(rhport, speed, true); } - if(int_status & GINTSTS_USBSUSP) - { + if (int_status & GINTSTS_USBSUSP) { dwc2->gintsts = GINTSTS_USBSUSP; //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); @@ -1296,8 +1164,7 @@ void dcd_int_handler(uint8_t rhport) #endif } - if(int_status & GINTSTS_WKUINT) - { + if (int_status & GINTSTS_WKUINT) { dwc2->gintsts = GINTSTS_WKUINT; dcd_event_bus_signal(rhport, DCD_EVENT_RESUME, true); } @@ -1305,13 +1172,11 @@ void dcd_int_handler(uint8_t rhport) // TODO check GINTSTS_DISCINT for disconnect detection // if(int_status & GINTSTS_DISCINT) - if(int_status & GINTSTS_OTGINT) - { + if (int_status & GINTSTS_OTGINT) { // OTG INT bit is read-only uint32_t const otg_int = dwc2->gotgint; - if (otg_int & GOTGINT_SEDET) - { + if (otg_int & GOTGINT_SEDET) { dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) _allocated_fifos = 1; @@ -1321,60 +1186,41 @@ void dcd_int_handler(uint8_t rhport) dwc2->gotgint = otg_int; } - if(int_status & GINTSTS_SOF) - { - dwc2->gotgint = GINTSTS_SOF; + if(int_status & GINTSTS_SOF) { + dwc2->gintsts = GINTSTS_SOF; + const uint32_t frame = (dwc2->dsts & DSTS_FNSOF) >> DSTS_FNSOF_Pos; - if (_sof_en) - { - uint32_t frame = (dwc2->dsts & (DSTS_FNSOF)) >> 8; - dcd_event_sof(rhport, frame, true); - } - else - { - // Disable SOF interrupt if SOF was not explicitly enabled. SOF was used for remote wakeup detection + // Disable SOF interrupt if SOF was not explicitly enabled since SOF was used for remote wakeup detection + if (!_sof_en) { dwc2->gintmsk &= ~GINTMSK_SOFM; } - dcd_event_bus_signal(rhport, DCD_EVENT_SOF, true); + dcd_event_sof(rhport, frame, true); } // RxFIFO non-empty interrupt handling. - if(int_status & GINTSTS_RXFLVL) - { + if (int_status & GINTSTS_RXFLVL) { // RXFLVL bit is read-only // Mask out RXFLVL while reading data from FIFO dwc2->gintmsk &= ~GINTMSK_RXFLVLM; // Loop until all available packets were handled - do - { + do { handle_rxflvl_irq(rhport); - } while(dwc2->gotgint & GINTSTS_RXFLVL); - - // Manage RX FIFO size - if (_out_ep_closed) - { - update_grxfsiz(rhport); - - // Disable flag - _out_ep_closed = false; - } + } while(dwc2->gintsts & GINTSTS_RXFLVL); dwc2->gintmsk |= GINTMSK_RXFLVLM; } // OUT endpoint interrupt handling. - if(int_status & GINTSTS_OEPINT) - { + if (int_status & GINTSTS_OEPINT) { // OEPINT is read-only, clear using DOEPINTn handle_epout_irq(rhport); } // IN endpoint interrupt handling. - if(int_status & GINTSTS_IEPINT) - { + if (int_status & GINTSTS_IEPINT) { // IEPINT bit read-only, clear using DIEPINTn handle_epin_irq(rhport); } @@ -1386,4 +1232,25 @@ void dcd_int_handler(uint8_t rhport) // } } +#if defined(TUP_USBIP_DWC2_TEST_MODE) && CFG_TUD_TEST_MODE + +bool dcd_check_test_mode_support(test_mode_t test_selector) { + // Check if test mode selector is unsupported + if (TEST_FORCE_ENABLE < test_selector || TEST_J > test_selector) { + return false; + } + + return true; +} + +void dcd_enter_test_mode(uint8_t rhport, test_mode_t test_selector) { + // Get port address... + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + + // Enable the test mode + dwc2->dctl = (dwc2->dctl & ~DCTL_TCTL_Msk) | (test_selector << DCTL_TCTL_Pos); +} + +#endif /* TUP_USBIP_DWC2_TEST_MODE && CFG_TUD_TEST_MODE */ + #endif From 126f0b55d3d604a7c4d379a2a4f4d30ab7ac51fe Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:43:25 +0200 Subject: [PATCH 455/636] Create tinyusb_dcd_dwc2.diff --- patches/tinyusb_dcd_dwc2.diff | 85 +++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 patches/tinyusb_dcd_dwc2.diff diff --git a/patches/tinyusb_dcd_dwc2.diff b/patches/tinyusb_dcd_dwc2.diff new file mode 100644 index 000000000..23755c8fc --- /dev/null +++ b/patches/tinyusb_dcd_dwc2.diff @@ -0,0 +1,85 @@ +--- a/components/arduino_tinyusb/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c 2024-06-10 22:10:55.000000000 +0300 ++++ b/components/arduino_tinyusb/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c 2024-06-10 22:20:01.000000000 +0300 +@@ -186,6 +186,18 @@ + return true; + } + ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++// Keep count of how many FIFOs are in use ++static uint8_t _allocated_fifos = 1; //FIFO0 is always in use ++ ++// Will either return an unused FIFO number, or 0 if all are used. ++static uint8_t get_free_fifo(void) ++{ ++ if (_allocated_fifos < 5) return _allocated_fifos++; ++ return 0; ++} ++#endif ++ + static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + uint8_t const epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); +@@ -205,7 +217,18 @@ + dwc2->epout[epnum].doepctl = dxepctl; + dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum); + } else { +- dwc2->epin[epnum].diepctl = dxepctl | (epnum << DIEPCTL_TXFNUM_Pos); ++ uint8_t fifo_num = epnum; ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ // Special Case for EP5, which is used by CDC but not actually called by the driver ++ // we can give it a fake FIFO ++ if (epnum == 5) { ++ fifo_num = epnum; ++ } else { ++ fifo_num = get_free_fifo(); ++ } ++ TU_ASSERT(fifo_num != 0); ++#endif ++ dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos); + dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum)); + } + } +@@ -728,6 +751,10 @@ + // reset allocated fifo IN + _allocated_fifo_words_tx = 16; + ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ _allocated_fifos = 1; ++#endif ++ + fifo_flush_tx(dwc2, 0x10); // all tx fifo + fifo_flush_rx(dwc2); + } +@@ -1096,6 +1123,9 @@ + if (int_status & GINTSTS_USBRST) { + // USBRST is start of reset. + dwc2->gintsts = GINTSTS_USBRST; ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ _allocated_fifos = 1; ++#endif + bus_reset(rhport); + } + +@@ -1127,7 +1157,11 @@ + + if (int_status & GINTSTS_USBSUSP) { + dwc2->gintsts = GINTSTS_USBSUSP; +- dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); ++ //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); ++ dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ _allocated_fifos = 1; ++#endif + } + + if (int_status & GINTSTS_WKUINT) { +@@ -1144,6 +1178,9 @@ + + if (otg_int & GOTGINT_SEDET) { + dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ _allocated_fifos = 1; ++#endif + } + + dwc2->gotgint = otg_int; From 2ae2ad66345becf826c5a005da63a79fba6c0ae5 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:44:20 +0200 Subject: [PATCH 456/636] Create tinyusb_dcd_esp32sx.diff --- patches/tinyusb_dcd_esp32sx.diff | 119 +++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 patches/tinyusb_dcd_esp32sx.diff diff --git a/patches/tinyusb_dcd_esp32sx.diff b/patches/tinyusb_dcd_esp32sx.diff new file mode 100644 index 000000000..024af0ddf --- /dev/null +++ b/patches/tinyusb_dcd_esp32sx.diff @@ -0,0 +1,119 @@ +--- a/components/arduino_tinyusb/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c 2024-06-10 20:45:02.000000000 +0300 ++++ b/components/arduino_tinyusb/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c 2024-06-10 22:25:05.000000000 +0300 +@@ -282,6 +281,7 @@ + xfer->interval = desc_edpt->bInterval; + + if (dir == TUSB_DIR_OUT) { ++ out_ep[epnum].doepctl &= ~(USB_D_EPTYPE0_M | USB_D_MPS0_M); + out_ep[epnum].doepctl |= USB_USBACTEP1_M | + desc_edpt->bmAttributes.xfer << USB_EPTYPE1_S | + (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? USB_DO_SETD0PID1_M : 0) | +@@ -311,7 +311,14 @@ + // - Offset: GRXFSIZ + 16 + Size*(epnum-1) + // - IN EP 1 gets FIFO 1, IN EP "n" gets FIFO "n". + +- uint8_t fifo_num = get_free_fifo(); ++ uint8_t fifo_num = 0; ++ // Special Case for EP5, which is used by CDC but not actually called by the driver ++ // we can give it a fake FIFO ++ if (epnum == 5) { ++ fifo_num = EP_FIFO_NUM; ++ } else { ++ fifo_num = get_free_fifo(); ++ } + TU_ASSERT(fifo_num != 0); + + in_ep[epnum].diepctl &= ~(USB_D_TXFNUM1_M | USB_D_EPTYPE1_M | USB_DI_SETD0PID1 | USB_D_MPS1_M); +@@ -442,7 +449,8 @@ + } else { + // Stop transmitting packets and NAK IN xfers. + in_ep[epnum].diepctl |= USB_DI_SNAK1_M; +- while ((in_ep[epnum].diepint & USB_DI_SNAK1_M) == 0) ; ++ // while ((in_ep[epnum].diepint & USB_DI_SNAK1_M) == 0) ; ++ while ((in_ep[epnum].diepint & USB_D_INEPNAKEFF1_M) == 0) ; + + // Disable the endpoint. Note that both SNAK and STALL are set here. + in_ep[epnum].diepctl |= (USB_DI_SNAK1_M | USB_D_STALL1_M | USB_D_EPDIS1_M); +@@ -452,9 +460,16 @@ + + // Flush the FIFO, and wait until we have confirmed it cleared. + uint8_t const fifo_num = ((in_ep[epnum].diepctl >> USB_D_TXFNUM1_S) & USB_D_TXFNUM1_V); +- USB0.grstctl |= (fifo_num << USB_TXFNUM_S); +- USB0.grstctl |= USB_TXFFLSH_M; ++ // USB0.grstctl |= (fifo_num << USB_TXFNUM_S); ++ // USB0.grstctl |= USB_TXFFLSH_M; ++ // while ((USB0.grstctl & USB_TXFFLSH_M) != 0) ; ++ uint32_t rstctl_last = USB0.grstctl; ++ uint32_t rstctl = USB_TXFFLSH_M; ++ rstctl |= (fifo_num << USB_TXFNUM_S); ++ USB0.grstctl = rstctl; + while ((USB0.grstctl & USB_TXFFLSH_M) != 0) ; ++ USB0.grstctl = rstctl_last; ++ // TODO: Clear grstctl::fifo_num after fifo flsh + } else { + // Only disable currently enabled non-control endpoint + if ((epnum == 0) || !(out_ep[epnum].doepctl & USB_EPENA0_M)) { +@@ -730,11 +745,21 @@ + + if (USB0.daint & (1 << (0 + n))) { + ESP_EARLY_LOGV(TAG, "TUSB IRQ - EP IN %u", n); ++ ++ if (USB0.in_ep_reg[n].diepint & BIT(15)) { ++ USB0.in_ep_reg[n].diepint = BIT(15); ++ ESP_EARLY_LOGE(TAG, "Unknown Condition");//todo: ++ bus_reset(); ++ } ++ + // IN XFER complete (entire xfer). + if (USB0.in_ep_reg[n].diepint & USB_D_XFERCOMPL0_M) { + ESP_EARLY_LOGV(TAG, "TUSB IRQ - IN XFER complete!"); + USB0.in_ep_reg[n].diepint = USB_D_XFERCOMPL0_M; + dcd_event_xfer_complete(0, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); ++ if (!(USB0.in_ep_reg[n].diepint & USB_D_TXFEMP0_M)) { ++ ESP_EARLY_LOGE(TAG, "Complete but not empty: %u/%u", xfer->queued_len, xfer->total_len);//todo: ++ } + } + + // XFER FIFO empty +@@ -754,6 +779,7 @@ + if (USB0.in_ep_reg[n].diepint & USB_D_TIMEOUT0_M) { + // Clear interrupt or endpoint will hang. + USB0.in_ep_reg[n].diepint = USB_D_TIMEOUT0_M; ++ ESP_EARLY_LOGE(TAG, "XFER Timeout");//todo: + // Maybe retry? + } + } +@@ -781,8 +807,12 @@ + if (int_status & USB_RESETDET_M) { + ESP_EARLY_LOGV(TAG, "dcd_int_handler - reset while suspend"); + USB0.gintsts = USB_RESETDET_M; +- bus_reset(); +- } ++ // no need to double reset ++ if ((int_status & USB_USBRST_M) == 0) { ++ _allocated_fifos = 1; ++ bus_reset(); ++ } ++ } + + if (int_status & USB_ENUMDONE_M) { + // ENUMDNE detects speed of the link. For full-speed, we +@@ -796,7 +826,9 @@ + if(int_status & USB_USBSUSP_M) + { + USB0.gintsts = USB_USBSUSP_M; +- dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); ++ //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); ++ dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); ++ _allocated_fifos = 1; + } + + if(int_status & USB_WKUPINT_M) +@@ -815,6 +847,7 @@ + if (otg_int & USB_SESENDDET_M) + { + dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); ++ _allocated_fifos = 1; + } + + USB0.gotgint = otg_int; From 013b19e919a007af7feb0ce9573c6b47889d110f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:48:16 +0200 Subject: [PATCH 457/636] CONFIG_ESP_PHY_REDUCE_TX_POWER=y --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 68a00bb5f..c23e6f8dc 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -50,6 +50,7 @@ CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 # CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set # CONFIG_ESP_WIFI_IRAM_OPT is not set # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set +CONFIG_ESP_PHY_REDUCE_TX_POWER=y CONFIG_ETH_TRANSMIT_MUTEX=y CONFIG_ETH_SPI_ETHERNET_DM9051=y CONFIG_ETH_SPI_ETHERNET_W5500=y From b459234d53b89d2b9546bd3483ad280ee6f13168 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:40:02 +0200 Subject: [PATCH 458/636] Disable C2 Ethernet support (#100) --- configs/defconfig.esp32c2 | 22 +++++++++++++++++----- configs/defconfig.esp32c3 | 8 ++++---- configs/defconfig.esp32c6 | 8 ++++---- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 1c766f832..6517ecba1 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -24,9 +24,21 @@ CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 # -# PPP +# Disable Ethernet # -# CONFIG_LWIP_PPP_SUPPORT=y -# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -# CONFIG_LWIP_PPP_PAP_SUPPORT=y -# CONFIG_LWIP_PPP_ENABLE_IPV6=n +# CONFIG_ETH_ENABLED is not set +# CONFIG_ETH_USE_ESP32_EMAC is not set +# CONFIG_ETH_PHY_INTERFACE_RMII is not set +# CONFIG_ETH_USE_SPI_ETHERNET is not set +# CONFIG_ETH_TRANSMIT_MUTEX is not set +# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set +# CONFIG_ETH_SPI_ETHERNET_W5500 is not set +# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set + +# +# Disable PPP +# +# CONFIG_LWIP_PPP_SUPPORT is not set +# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT is not set +# CONFIG_LWIP_PPP_PAP_SUPPORT is not set +# CONFIG_LWIP_PPP_ENABLE_IPV6 is not set diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 5239db0dc..607e53e86 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -46,7 +46,7 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 # # PPP # -# CONFIG_LWIP_PPP_SUPPORT=y -# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -# CONFIG_LWIP_PPP_PAP_SUPPORT=y -# CONFIG_LWIP_PPP_ENABLE_IPV6=n +# CONFIG_LWIP_PPP_SUPPORT is not set +# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT is not set +# CONFIG_LWIP_PPP_PAP_SUPPORT is not set +# CONFIG_LWIP_PPP_ENABLE_IPV6 is not set diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index 5dd6878c8..68ddf8a67 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -56,7 +56,7 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 # # PPP # -# CONFIG_LWIP_PPP_SUPPORT=y -# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -# CONFIG_LWIP_PPP_PAP_SUPPORT=y -# CONFIG_LWIP_PPP_ENABLE_IPV6=n +# CONFIG_LWIP_PPP_SUPPORT is not set +# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT is not set +# CONFIG_LWIP_PPP_PAP_SUPPORT is not set +# CONFIG_LWIP_PPP_ENABLE_IPV6 is not set From e07258489ab9ba1c7434b8facd54d1198951d85b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:48:44 +0200 Subject: [PATCH 459/636] rm openthread --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 9991750eb..07b947634 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -93,3 +93,4 @@ rm -rf "$AR_COMPS/arduino/libraries/ESP32" rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" +rm -rf "$AR_COMPS/arduino/libraries/OpenThread" From c32f5800c363c22972c280e5b514dfffcf40c2b3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:50:14 +0200 Subject: [PATCH 460/636] rm -rf arduino-esp32/libraries/OpenThread --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 8cc59ef33..56c432adf 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -37,6 +37,7 @@ rm -rf arduino-esp32/libraries/NetworkClientSecure rm -rf arduino-esp32/libraries/ESP_SR rm -rf arduino-esp32/libraries/ESP_NOW rm -rf arduino-esp32/libraries/TFLiteMicro +rm -rf arduino-esp32/libraries/OpenThread rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs From 012937ec35150c799674183270aae92d76895156 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:37:32 +0200 Subject: [PATCH 461/636] Create mmu_map.diff --- patches/mmu_map.diff | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/mmu_map.diff diff --git a/patches/mmu_map.diff b/patches/mmu_map.diff new file mode 100644 index 000000000..3bf56005a --- /dev/null +++ b/patches/mmu_map.diff @@ -0,0 +1,24 @@ +diff --git a/components/esp_mm/esp_mmu_map.c b/components/esp_mm/esp_mmu_map.c +index b7d927f8fe..6a8c4635f0 100644 +--- a/components/esp_mm/esp_mmu_map.c ++++ b/components/esp_mm/esp_mmu_map.c +@@ -315,6 +315,19 @@ esp_err_t esp_mmu_map_reserve_block_with_caps(size_t size, mmu_mem_caps_t caps, + s_mmu_ctx.mem_regions[found_region_id].max_slot_size -= aligned_size; + ESP_EARLY_LOGV(TAG, "found laddr is 0x%x", laddr); + ++ mem_block_t *mem_block = NULL; ++ mem_region_t *region = &s_mmu_ctx.mem_regions[found_region_id]; ++ TAILQ_FOREACH(mem_block, ®ion->mem_block_head, entries) { ++ if (mem_block == TAILQ_FIRST(®ion->mem_block_head) || mem_block == TAILQ_LAST(®ion->mem_block_head, mem_block_head_)) { ++ TAILQ_REMOVE(®ion->mem_block_head, mem_block, entries); ++ } else { ++ // probably the reservation of MMU region should be disallowed for this case - already some MMU mappings exist? ++ // assert/abort ++ ESP_EARLY_LOGE(TAG, "already some MMU mappings exist?"); ++ abort(); ++ } ++ } ++ + uint32_t vaddr = 0; + if (caps & MMU_MEM_CAP_EXEC) { + vaddr = mmu_ll_laddr_to_vaddr(laddr, MMU_VADDR_INSTRUCTION); From c6714dd5ba536e6855e2d2285b030bc7f669b8f4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:50:02 +0200 Subject: [PATCH 462/636] Add temporary fix for mmu map and late init of psram --- tools/install-esp-idf.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 57150e7c7..68cfe6db2 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -64,9 +64,11 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then git submodule update --recursive $IDF_PATH/install.sh - # Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source + # 1) Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source + # 2) Temporarily fix for mmu map and late init of psram https://github.com/espressif/arduino-esp32/issues/9936 cd $IDF_PATH patch -p1 -N -i ../patches/esp32s2_i2c_ll_master_init.diff + patch -p1 -N -i ../patches/mmu_map.diff cd - # Get the exact IDF version from file "version.txt" From 5704442349909dc8b53916c02b1c2732cfe34440 Mon Sep 17 00:00:00 2001 From: vortigont <gpm@hotplug.ru> Date: Fri, 28 Jun 2024 22:40:24 +0900 Subject: [PATCH 463/636] Allow using 3 different NTP servers and NTP over DHCP (#101) * allow using 3 different NTP servers and NTP over DHCP * undo wrong change --------- Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com> --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index c23e6f8dc..ac45b3825 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -93,7 +93,7 @@ CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 CONFIG_LWIP_MAX_SOCKETS=16 CONFIG_LWIP_DHCP_RESTORE_LAST_IP=n CONFIG_LWIP_DHCP_OPTIONS_LEN=128 -CONFIG_LWIP_SNTP_MAX_SERVERS=1 +CONFIG_LWIP_SNTP_MAX_SERVERS=3 # CONFIG_LWIP_DHCP_GET_NTP_SRV is not set CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 From 86772176c48b6b7e2e3b54a9fd88e28d94493b94 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:21:23 +0200 Subject: [PATCH 464/636] IDF 5.2 Arduino --- .github/workflows/push.yml | 2 +- components/arduino_tinyusb/include/tusb_config.h | 5 ++++- components/arduino_tinyusb/src/dcd_esp32sx.c | 2 +- configs/builds.json | 6 +++--- configs/defconfig.120m | 4 +++- configs/defconfig.40m | 1 - configs/defconfig.80m | 1 - configs/defconfig.esp32 | 8 -------- configs/defconfig.esp32c2 | 8 -------- configs/defconfig.esp32c3 | 8 -------- configs/defconfig.esp32c6 | 8 -------- configs/defconfig.esp32h2 | 8 -------- configs/defconfig.esp32s2 | 8 -------- configs/defconfig.esp32s3 | 10 +--------- tools/config.sh | 4 ++-- 15 files changed, 15 insertions(+), 68 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2faff00ce..c84407ec2 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF v5.1 +name: IDF v5.2 on: workflow_dispatch: # Manually start a workflow diff --git a/components/arduino_tinyusb/include/tusb_config.h b/components/arduino_tinyusb/include/tusb_config.h index ee1e5d270..9f7f2566a 100755 --- a/components/arduino_tinyusb/include/tusb_config.h +++ b/components/arduino_tinyusb/include/tusb_config.h @@ -76,7 +76,10 @@ extern "C" { /* COMMON CONFIGURATION */ /* */ -#define CFG_TUSB_MCU OPT_MCU_ESP32S2 +#ifdef CFG_TUSB_MCU +# undef CFG_TUSB_MCU +#endif +#define CFG_TUSB_MCU OPT_MCU_ESP32S2 #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE #define CFG_TUSB_OS OPT_OS_FREERTOS diff --git a/components/arduino_tinyusb/src/dcd_esp32sx.c b/components/arduino_tinyusb/src/dcd_esp32sx.c index 324aad595..9d4d8bf7c 100755 --- a/components/arduino_tinyusb/src/dcd_esp32sx.c +++ b/components/arduino_tinyusb/src/dcd_esp32sx.c @@ -31,7 +31,7 @@ #if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && CFG_TUD_ENABLED) // Espressif -#include "freertos/xtensa_api.h" +#include "xtensa_api.h" #include "esp_intr_alloc.h" #include "esp_log.h" #include "soc/dport_reg.h" diff --git a/configs/builds.json b/configs/builds.json index 02695519c..af264eabe 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -4,7 +4,7 @@ "file":"libspi_flash.a", "src":"build/esp-idf/spi_flash/libspi_flash.a", "out":"lib/libspi_flash.a", - "targets":["esp32","esp32c3","esp32s2","esp32s3","esp32c6","esp32h2","esp32c2"] + "targets":["esp32","esp32c2","esp32c3","esp32s2","esp32s3","esp32c6","esp32h2"] }, { "file":"libesp_psram.a", @@ -136,7 +136,7 @@ ["qio","120m","qio_ram"], ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], + ["qio","80m","opi_ram"], ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], ["opi","80m","qio_ram"], @@ -146,7 +146,7 @@ ["qio","120m","qio_ram"], ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], + ["qio","80m","opi_ram"], ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], ["opi","80m","qio_ram"], diff --git a/configs/defconfig.120m b/configs/defconfig.120m index 11d11177f..1dce09930 100644 --- a/configs/defconfig.120m +++ b/configs/defconfig.120m @@ -1,3 +1,5 @@ +CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_ESPTOOLPY_FLASHFREQ_120M=y CONFIG_SPIRAM_SPEED_120M=y -CONFIG_SPI_FLASH_HPM_ENA=y +# CONFIG_SPI_FLASH_HPM_ENA=y +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y diff --git a/configs/defconfig.40m b/configs/defconfig.40m index 079a0336a..ffc4b5c1c 100644 --- a/configs/defconfig.40m +++ b/configs/defconfig.40m @@ -1,2 +1 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y -CONFIG_SPIRAM_SPEED_40M=y \ No newline at end of file diff --git a/configs/defconfig.80m b/configs/defconfig.80m index 38980b0d9..7014fa954 100644 --- a/configs/defconfig.80m +++ b/configs/defconfig.80m @@ -1,2 +1 @@ CONFIG_ESPTOOLPY_FLASHFREQ_80M=y -CONFIG_SPIRAM_SPEED_80M=y \ No newline at end of file diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 9ceab04e5..2b41cdb3d 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -43,11 +43,3 @@ CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST=y CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID=y CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y - -# -# PPP -# -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -CONFIG_LWIP_PPP_PAP_SUPPORT=y -CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32c2 b/configs/defconfig.esp32c2 index 6517ecba1..943a7a45f 100644 --- a/configs/defconfig.esp32c2 +++ b/configs/defconfig.esp32c2 @@ -34,11 +34,3 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set # CONFIG_ETH_SPI_ETHERNET_W5500 is not set # CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set - -# -# Disable PPP -# -# CONFIG_LWIP_PPP_SUPPORT is not set -# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT is not set -# CONFIG_LWIP_PPP_PAP_SUPPORT is not set -# CONFIG_LWIP_PPP_ENABLE_IPV6 is not set diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 607e53e86..c3c5f8518 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -42,11 +42,3 @@ CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 - -# -# PPP -# -# CONFIG_LWIP_PPP_SUPPORT is not set -# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT is not set -# CONFIG_LWIP_PPP_PAP_SUPPORT is not set -# CONFIG_LWIP_PPP_ENABLE_IPV6 is not set diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index 68ddf8a67..e950a2489 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -52,11 +52,3 @@ CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 - -# -# PPP -# -# CONFIG_LWIP_PPP_SUPPORT is not set -# CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT is not set -# CONFIG_LWIP_PPP_PAP_SUPPORT is not set -# CONFIG_LWIP_PPP_ENABLE_IPV6 is not set diff --git a/configs/defconfig.esp32h2 b/configs/defconfig.esp32h2 index 6d18ad8cc..c3c5f8518 100644 --- a/configs/defconfig.esp32h2 +++ b/configs/defconfig.esp32h2 @@ -42,11 +42,3 @@ CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 - -# -# PPP -# -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -CONFIG_LWIP_PPP_PAP_SUPPORT=y -CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index f3fca9b8f..4363869bf 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -18,11 +18,3 @@ CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n # CONFIG_VFS_SUPPORT_SELECT is not set # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set # CONFIG_VFS_SUPPORT_TERMIOS is not set - -# -# PPP -# -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -CONFIG_LWIP_PPP_PAP_SUPPORT=y -CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index c8375eeef..741cf9fe4 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,4 +1,4 @@ -CONFIG_IDF_EXPERIMENTAL_FEATURES=y +# CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_RISCV=y @@ -36,11 +36,3 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set - -# -# PPP -# -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y -CONFIG_LWIP_PPP_PAP_SUPPORT=y -CONFIG_LWIP_PPP_ENABLE_IPV6=n diff --git a/tools/config.sh b/tools/config.sh index a5cdfe840..3476d8dda 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,12 +6,12 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - export IDF_BRANCH="release/v5.1" + export IDF_BRANCH="release/v5.2" fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="main" + AR_BRANCH="release/v5.2" fi if [ -z $IDF_TARGET ]; then From 088351d480ec9ae9796588c1ca519a79f15e4efe Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:23:05 +0200 Subject: [PATCH 465/636] Update builds.json --- configs/builds.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/builds.json b/configs/builds.json index af264eabe..c4db14790 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -146,7 +146,7 @@ ["qio","120m","qio_ram"], ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], + ["qio","80m","opi_ram"], ["opi","120m","qio_ram"], ["opi","120m","opi_ram"], ["opi","80m","qio_ram"], From 9455b54e17c74a1ecae4cc85ea33740490861229 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:14:55 +0200 Subject: [PATCH 466/636] explicit disable `CONFIG_COMPILER_CXX_EXCEPTIONS` --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index ac45b3825..93eedc4b2 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -18,6 +18,7 @@ CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y +# CONFIG_COMPILER_CXX_EXCEPTIONS is not set # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set # CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set # CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR is not set From 1ccb1d181cb8a64256ec3330e48754a7f66d8eeb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:12:06 +0200 Subject: [PATCH 467/636] Update defconfig.esp32s2 --- configs/defconfig.esp32s2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 4363869bf..f3fca9b8f 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -18,3 +18,11 @@ CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n # CONFIG_VFS_SUPPORT_SELECT is not set # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set # CONFIG_VFS_SUPPORT_TERMIOS is not set + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n From 5d68dd35b27f366b58281b3f01daa00a2436426d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:12:21 +0200 Subject: [PATCH 468/636] Update defconfig.esp32 --- configs/defconfig.esp32 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 2b41cdb3d..9ceab04e5 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -43,3 +43,11 @@ CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST=y CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID=y CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT=y CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n From a957f6a5a80b4a947a17f366dc6d409215f7a7b1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:12:36 +0200 Subject: [PATCH 469/636] Update defconfig.esp32s3 --- configs/defconfig.esp32s3 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 741cf9fe4..758a1c9c4 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -36,3 +36,11 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set # CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set # CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n From b1cbfecff978816d79bc8651713d09bbc6e322c9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:12:48 +0200 Subject: [PATCH 470/636] Update defconfig.esp32h2 --- configs/defconfig.esp32h2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configs/defconfig.esp32h2 b/configs/defconfig.esp32h2 index c3c5f8518..6d18ad8cc 100644 --- a/configs/defconfig.esp32h2 +++ b/configs/defconfig.esp32h2 @@ -42,3 +42,11 @@ CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n From 0a0aab6e24c890ab327f25f117efcf8bf5e0f58d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:25:14 +0200 Subject: [PATCH 471/636] Update install-arduino.sh --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 07b947634..69be11130 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -94,3 +94,4 @@ rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" rm -rf "$AR_COMPS/arduino/libraries/OpenThread" +rm -rf "$AR_COMPS/arduino/libraries/PPP" From 10a648408a8c851aeb9a46bc823eed5214d79510 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:43:01 +0200 Subject: [PATCH 472/636] Update install-arduino.sh --- tools/install-arduino.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 69be11130..07b947634 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -94,4 +94,3 @@ rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" rm -rf "$AR_COMPS/arduino/libraries/OpenThread" -rm -rf "$AR_COMPS/arduino/libraries/PPP" From 37ee889db2aad6fa6fc9074927bbf32602ae2447 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:46:00 +0200 Subject: [PATCH 473/636] Update install-arduino.sh --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 07b947634..69be11130 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -94,3 +94,4 @@ rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" rm -rf "$AR_COMPS/arduino/libraries/OpenThread" +rm -rf "$AR_COMPS/arduino/libraries/PPP" From f8d158c51c4325dedad6d6b2d4de8456e52d9099 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:52:31 +0200 Subject: [PATCH 474/636] Update install-arduino.sh --- tools/install-arduino.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 69be11130..07b947634 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -94,4 +94,3 @@ rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" rm -rf "$AR_COMPS/arduino/libraries/OpenThread" -rm -rf "$AR_COMPS/arduino/libraries/PPP" From 8246030b810b0dfa24432534cb936dce0ee4efce Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:29:02 +0200 Subject: [PATCH 475/636] Create lwip_max_tcp_pcb.diff --- patches/lwip_max_tcp_pcb.diff | 118 ++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 patches/lwip_max_tcp_pcb.diff diff --git a/patches/lwip_max_tcp_pcb.diff b/patches/lwip_max_tcp_pcb.diff new file mode 100644 index 000000000..6b9e73cb6 --- /dev/null +++ b/patches/lwip_max_tcp_pcb.diff @@ -0,0 +1,118 @@ +diff --git a/components/lwip/lwip/src/core/memp.c b/components/lwip/lwip/src/core/memp.c +index 352ce5a55127a658b6b3c9d8541298c42df332ff..39433cf476b3456b046e337e9b1f016299964a84 100644 +--- a/components/lwip/lwip/src/core/memp.c ++++ b/components/lwip/lwip/src/core/memp.c +@@ -240,6 +240,10 @@ memp_init(void) + #endif /* MEMP_OVERFLOW_CHECK >= 2 */ + } + ++#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP ++static u32_t num_tcp_pcb = 0; ++#endif ++ + static void * + #if !MEMP_OVERFLOW_CHECK + do_memp_malloc_pool(const struct memp_desc *desc) +@@ -251,6 +255,16 @@ do_memp_malloc_pool_fn(const struct memp_desc *desc, const char *file, const int + SYS_ARCH_DECL_PROTECT(old_level); + + #if MEMP_MEM_MALLOC ++#if ESP_LWIP ++#if LWIP_TCP ++ if(desc == memp_pools[MEMP_TCP_PCB]){ ++ if(num_tcp_pcb >= MEMP_NUM_TCP_PCB){ ++ return NULL; ++ } ++ } ++#endif ++#endif ++ + memp = (struct memp *)mem_malloc(MEMP_SIZE + MEMP_ALIGN_SIZE(desc->size)); + SYS_ARCH_PROTECT(old_level); + #else /* MEMP_MEM_MALLOC */ +@@ -260,6 +274,12 @@ do_memp_malloc_pool_fn(const struct memp_desc *desc, const char *file, const int + #endif /* MEMP_MEM_MALLOC */ + + if (memp != NULL) { ++#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP ++ if (desc == memp_pools[MEMP_TCP_PCB]) { ++ num_tcp_pcb++; ++ } ++#endif ++ + #if !MEMP_MEM_MALLOC + #if MEMP_OVERFLOW_CHECK == 1 + memp_overflow_check_element(memp, desc); +@@ -369,6 +389,12 @@ do_memp_free_pool(const struct memp_desc *desc, void *mem) + + SYS_ARCH_PROTECT(old_level); + ++#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP ++ if (desc == memp_pools[MEMP_TCP_PCB]) { ++ num_tcp_pcb--; ++ } ++#endif ++ + #if MEMP_OVERFLOW_CHECK == 1 + memp_overflow_check_element(memp, desc); + #endif /* MEMP_OVERFLOW_CHECK */ +diff --git a/components/lwip/lwip/src/core/tcp.c b/components/lwip/lwip/src/core/tcp.c +index 3fbdd89ae07807208ff7466abb50f90b5e7727e4..fe6baaf250927cb4b89f8d1dbd41c73def88692b 100644 +--- a/components/lwip/lwip/src/core/tcp.c ++++ b/components/lwip/lwip/src/core/tcp.c +@@ -1765,7 +1765,9 @@ tcp_kill_state(enum tcp_state state) + struct tcp_pcb *pcb, *inactive; + u32_t inactivity; + ++#if !ESP_LWIP + LWIP_ASSERT("invalid state", (state == CLOSING) || (state == LAST_ACK)); ++#endif + + inactivity = 0; + inactive = NULL; +@@ -1870,17 +1872,41 @@ tcp_alloc(u8_t prio) + tcp_kill_state(CLOSING); + /* Try to allocate a tcp_pcb again. */ + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); ++#if ESP_LWIP + if (pcb == NULL) { +- /* Try killing oldest active connection with lower priority than the new one. */ +- LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing oldest connection with prio lower than %d\n", prio)); +- tcp_kill_prio(prio); +- /* Try to allocate a tcp_pcb again. */ ++ /* Try killing oldest connection in FIN_WAIT_2. */ ++ LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest FIN_WAIT_2 connection\n")); ++ tcp_kill_state(FIN_WAIT_2); + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); ++ if (pcb == NULL) { ++ /* Try killing oldest connection in FIN_WAIT_1. */ ++ LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest FIN_WAIT_1 connection\n")); ++ tcp_kill_state(FIN_WAIT_1); ++ pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); ++#endif ++ if (pcb == NULL) { ++ /* Try killing oldest active connection with lower priority than the new one. */ ++ LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing oldest connection with prio lower than %d\n", prio)); ++ tcp_kill_prio(prio); ++ /* Try to allocate a tcp_pcb again. */ ++ pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); ++ if (pcb != NULL) { ++ /* adjust err stats: memp_malloc failed multiple times before */ ++ MEMP_STATS_DEC(err, MEMP_TCP_PCB); ++ } ++ } ++#if ESP_LWIP ++ if (pcb != NULL) { ++ /* adjust err stats: memp_malloc failed multiple times before */ ++ MEMP_STATS_DEC(err, MEMP_TCP_PCB); ++ } ++ } + if (pcb != NULL) { + /* adjust err stats: memp_malloc failed multiple times before */ + MEMP_STATS_DEC(err, MEMP_TCP_PCB); + } + } ++#endif + if (pcb != NULL) { + /* adjust err stats: memp_malloc failed multiple times before */ + MEMP_STATS_DEC(err, MEMP_TCP_PCB); From 24e2be5057b11ae20e0e30b9a000a622b7c8d8a7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:32:44 +0200 Subject: [PATCH 476/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 68cfe6db2..3b43b2b7a 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -69,6 +69,7 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then cd $IDF_PATH patch -p1 -N -i ../patches/esp32s2_i2c_ll_master_init.diff patch -p1 -N -i ../patches/mmu_map.diff + patch -p1 -N -i ../patches/lwip_max_tcp_pcb.diff cd - # Get the exact IDF version from file "version.txt" From c3b4559deef76e36a115b15b2fdedb337b73ec95 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:42:47 +0200 Subject: [PATCH 477/636] fix i2s audio * enable `CONFIG_I2S_ISR_IRAM_SAFE` --- configs/defconfig.common | 1 + configs/defconfig.opi_ram | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 93eedc4b2..48b9352f6 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -11,6 +11,7 @@ CONFIG_BOOT_ROM_LOG_ALWAYS_OFF=y CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +CONFIG_I2S_ISR_IRAM_SAFE=y CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index e6df61d08..7b94edaf9 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -4,6 +4,7 @@ CONFIG_SPIRAM_IGNORE_NOTFOUND=y CONFIG_LCD_RGB_ISR_IRAM_SAFE=y CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y # bounce buffer mode relies on GDMA EOF interrupt to be service-able +# I2S_ISR_IRAM_SAFE has to be set!! Done in common config CONFIG_GDMA_ISR_IRAM_SAFE=y # Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y From 0f06610e0175ac942613df5bf1c2aabfa3ed6510 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 13 Jul 2024 21:16:54 +0200 Subject: [PATCH 478/636] Update defconfig.esp32 --- configs/defconfig.esp32 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 9ceab04e5..92f4dbe4e 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -19,6 +19,11 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y +# Enable ULP +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_TYPE_FSM=y +CONFIG_ULP_COPROC_RESERVE_MEM=4096 + CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR=y CONFIG_ETH_ENABLED=y From 9da1b8f0c61d90f365fe0f164c32edffc4f89ef7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:12:50 +0200 Subject: [PATCH 479/636] # CONFIG_ESP_WIFI_GMAC_SUPPORT is not set --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 48b9352f6..e76d17ac6 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -38,6 +38,7 @@ CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y # CONFIG_ESP_WIFI_FTM_ENABLE is not set +# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 From 34e5a6f715f071af8e00c0b107cfe8224e5c03e4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:17:54 +0200 Subject: [PATCH 480/636] make files executable --- tools/config_editor/compile.py | 0 tools/config_editor/editor.py | 0 tools/config_editor/settings.py | 0 tools/config_editor/widgets.py | 0 tools/gen_pio_frmwk_manifest.py | 0 tools/gen_pio_lib_manifest.py | 0 tools/get_projbuild_gitconfig.py | 0 7 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/config_editor/compile.py mode change 100644 => 100755 tools/config_editor/editor.py mode change 100644 => 100755 tools/config_editor/settings.py mode change 100644 => 100755 tools/config_editor/widgets.py mode change 100644 => 100755 tools/gen_pio_frmwk_manifest.py mode change 100644 => 100755 tools/gen_pio_lib_manifest.py mode change 100644 => 100755 tools/get_projbuild_gitconfig.py diff --git a/tools/config_editor/compile.py b/tools/config_editor/compile.py old mode 100644 new mode 100755 diff --git a/tools/config_editor/editor.py b/tools/config_editor/editor.py old mode 100644 new mode 100755 diff --git a/tools/config_editor/settings.py b/tools/config_editor/settings.py old mode 100644 new mode 100755 diff --git a/tools/config_editor/widgets.py b/tools/config_editor/widgets.py old mode 100644 new mode 100755 diff --git a/tools/gen_pio_frmwk_manifest.py b/tools/gen_pio_frmwk_manifest.py old mode 100644 new mode 100755 diff --git a/tools/gen_pio_lib_manifest.py b/tools/gen_pio_lib_manifest.py old mode 100644 new mode 100755 diff --git a/tools/get_projbuild_gitconfig.py b/tools/get_projbuild_gitconfig.py old mode 100644 new mode 100755 From 574046f2101c500d836a13a15bdf1d7558cf58a9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:38:41 +0200 Subject: [PATCH 481/636] Update config.sh --- tools/config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/config.sh b/tools/config.sh index 3476d8dda..94ed2afaf 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -52,6 +52,7 @@ AR_COMPS="$AR_ROOT/components" AR_MANAGED_COMPS="$AR_ROOT/managed_components" AR_OUT="$AR_ROOT/out" AR_TOOLS="$AR_OUT/tools" +AR_PATCHES="$AR_ROOT/patches" AR_PLATFORM_TXT="$AR_OUT/platform.txt" AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py" AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET" From a859dfcf89065b46539038b58dce520bf8cd158d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:44:33 +0200 Subject: [PATCH 482/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 3b43b2b7a..0994c09b7 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -67,9 +67,9 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then # 1) Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source # 2) Temporarily fix for mmu map and late init of psram https://github.com/espressif/arduino-esp32/issues/9936 cd $IDF_PATH - patch -p1 -N -i ../patches/esp32s2_i2c_ll_master_init.diff - patch -p1 -N -i ../patches/mmu_map.diff - patch -p1 -N -i ../patches/lwip_max_tcp_pcb.diff + patch -p1 -N -i $AR_PATCHES/esp32s2_i2c_ll_master_init.diff + patch -p1 -N -i $AR_PATCHES/mmu_map.diff + patch -p1 -N -i $AR_PATCHES/lwip_max_tcp_pcb.diff cd - # Get the exact IDF version from file "version.txt" From c36346edde26f41e28f3c3391a7be784561f74d6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 10 Aug 2024 19:20:26 +0200 Subject: [PATCH 483/636] Update build.sh --- build.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.sh b/build.sh index cef559e19..e25cf8eed 100755 --- a/build.sh +++ b/build.sh @@ -201,6 +201,9 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build IDF-Libs: $idf_libs_configs" rm -rf build sdkconfig + pushd $AR_MANAGED_COMPS + rm -- **/.component_hash + popd idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs if [ $? -ne 0 ]; then exit 1; fi @@ -213,6 +216,9 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build BootLoader: $bootloader_configs" rm -rf build sdkconfig + pushd $AR_MANAGED_COMPS + rm -- **/.component_hash + popd idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader if [ $? -ne 0 ]; then exit 1; fi done @@ -226,6 +232,9 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build Memory Variant: $mem_configs" rm -rf build sdkconfig + pushd $AR_MANAGED_COMPS + rm -- **/.component_hash + popd idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant if [ $? -ne 0 ]; then exit 1; fi done From e6f4fff3102f1d535a1fd7da72c33d9b7df69c47 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 15 Aug 2024 21:12:14 +0200 Subject: [PATCH 484/636] Update pio_start.txt --- configs/pio_start.txt | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/configs/pio_start.txt b/configs/pio_start.txt index 616cacbd9..078f0b085 100644 --- a/configs/pio_start.txt +++ b/configs/pio_start.txt @@ -35,4 +35,39 @@ FRAMEWORK_SDK_DIR = join(FRAMEWORK_DIR, "tools", "esp32-arduino-libs") board_config = env.BoardConfig() +flatten_cppdefines = env.Flatten(env['CPPDEFINES']) + +# +# zigbee libs +# +if "ZIGBEE_MODE_ZCZR" in flatten_cppdefines: + env.Append( + LIBS=[ + "-lesp_zb_api_zczr", + "-lesp_zb_cli_command", + "-lzboss_stack.zczr.trace", + "-lzboss_stack.zczr", + "-lzboss_port" + ] + ) +if "ZIGBEE_MODE_ED" in flatten_cppdefines: + env.Append( + LIBS=[ + "-lesp_zb_api_ed", + "-lesp_zb_cli_command", + "-lzboss_stack.ed.trace", + "-lzboss_stack.ed", + "-lzboss_port" + ] + ) +if "ZIGBEE_MODE_RCP" in flatten_cppdefines: + env.Append( + LIBS=[ + "-lesp_zb_api_rcp", + "-lesp_zb_cli_command", + "-lzboss_stack.rcp", + "-lzboss_port" + ] + ) + env.Append( From 4154d3255c759c15a5a96b9fbae7653960d7261a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 15 Aug 2024 22:31:35 +0200 Subject: [PATCH 485/636] Update build.sh --- build.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index e25cf8eed..df0c49eb8 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,9 @@ if ! [ -x "$(command -v git)" ]; then exit 1 fi +# Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167 +export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 + export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 @@ -201,9 +204,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build IDF-Libs: $idf_libs_configs" rm -rf build sdkconfig - pushd $AR_MANAGED_COMPS - rm -- **/.component_hash - popd idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs if [ $? -ne 0 ]; then exit 1; fi @@ -216,9 +216,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build BootLoader: $bootloader_configs" rm -rf build sdkconfig - pushd $AR_MANAGED_COMPS - rm -- **/.component_hash - popd idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader if [ $? -ne 0 ]; then exit 1; fi done @@ -232,9 +229,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build Memory Variant: $mem_configs" rm -rf build sdkconfig - pushd $AR_MANAGED_COMPS - rm -- **/.component_hash - popd idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant if [ $? -ne 0 ]; then exit 1; fi done From 90410389baa82913344c29336ba4e1e6bd167d0c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:21:34 +0200 Subject: [PATCH 486/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c84407ec2..cb3350cf6 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF v5.2 +name: IDF v5.3 on: workflow_dispatch: # Manually start a workflow From f7486ab6a580bbdf51aaed03539c0737ddc39ee4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:23:00 +0200 Subject: [PATCH 487/636] Arduinon3.1 based on IDF 5.3 --- tools/config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 94ed2afaf..17b5c13ae 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,12 +6,12 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - export IDF_BRANCH="release/v5.2" + export IDF_BRANCH="release/v5.3" fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="release/v5.2" + AR_BRANCH="release/v3.1.x" fi if [ -z $IDF_TARGET ]; then From 10927da4ce77019c4063c06e0f21e5eeeed17363 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:38:57 +0200 Subject: [PATCH 488/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index df0c49eb8..4e924706d 100755 --- a/build.sh +++ b/build.sh @@ -13,7 +13,7 @@ fi # Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167 export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 -export TARGET="all" +export TARGET="esp32c3" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From e40cbb46078db00eeafdcb033ce392b65b3ab3cc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:58:10 +0200 Subject: [PATCH 489/636] Update build.sh --- build.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 4e924706d..43fd47ebc 100755 --- a/build.sh +++ b/build.sh @@ -1,12 +1,17 @@ #!/bin/bash if ! [ -x "$(command -v python3)" ]; then - echo "ERROR: python is not installed! Please install python first." + echo "ERROR: python is not installed or not in PATH! Please install python first." exit 1 fi if ! [ -x "$(command -v git)" ]; then - echo "ERROR: git is not installed! Please install git first." + echo "ERROR: git is not installed or not in PATH! Please install git first." + exit 1 +fi + +if ! [ -x "$(command -v ninja)" ]; then + echo "ERROR: ninja is not installed or not in PATH! Please install ninja first." exit 1 fi From 9038b7ff53fa335e1344c1e1ffa098acb40c6060 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:00:33 +0200 Subject: [PATCH 490/636] Update builds.json --- configs/builds.json | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/configs/builds.json b/configs/builds.json index c4db14790..7c4611553 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -131,25 +131,17 @@ { "target": "esp32s3", "features":[], - "idf_libs":["qio","80m","opi_ram"], + "idf_libs":["qio","80m","qio_ram"], "bootloaders":[ ["qio","120m","qio_ram"], - ["qio","120m","opi_ram"], ["qio","80m","qio_ram"], - ["qio","80m","opi_ram"], - ["opi","120m","qio_ram"], - ["opi","120m","opi_ram"], - ["opi","80m","qio_ram"], + ["dio","80m","qio_ram"], ["opi","80m","opi_ram"] ], "mem_variants":[ - ["qio","120m","qio_ram"], - ["qio","120m","opi_ram"], - ["qio","80m","qio_ram"], ["qio","80m","opi_ram"], - ["opi","120m","qio_ram"], - ["opi","120m","opi_ram"], - ["opi","80m","qio_ram"], + ["dio","80m","qio_ram"], + ["dio","80m","opi_ram"], ["opi","80m","opi_ram"] ] } From 50f2e999d4a7ff2321a162ce8e735de26e4de95a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:03:34 +0200 Subject: [PATCH 491/636] Update CMakeLists.txt --- components/arduino_tinyusb/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index 792b2a39f..b0227ec5a 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -19,8 +19,8 @@ if(CONFIG_TINYUSB_ENABLED) set(srcs # espressif: - "${COMPONENT_DIR}/src/dcd_esp32sx.c" - #"${COMPONENT_DIR}/src/dcd_dwc2.c" + #"${COMPONENT_DIR}/src/dcd_esp32sx.c" + "${COMPONENT_DIR}/src/dcd_dwc2.c" # tusb: #"${COMPONENT_DIR}/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c" #"{COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c" From f1bc727095d2fda5888647d4fac43a08c260d67c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 20:08:48 +0200 Subject: [PATCH 492/636] Update dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index d9d15d4c6..adf018fe8 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -226,7 +226,6 @@ static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoin } else { fifo_num = get_free_fifo(); } - TU_ASSERT(fifo_num != 0); #endif dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos); dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum)); From f34ce6a6b2e5d193db9ec291107e39afdb7728aa Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:11:03 +0200 Subject: [PATCH 493/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 43fd47ebc..c554ba753 100755 --- a/build.sh +++ b/build.sh @@ -18,7 +18,7 @@ fi # Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167 export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 -export TARGET="esp32c3" +export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From 3fa2ba1da12370b6322f210e203d7f1d86505de4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:12:22 +0200 Subject: [PATCH 494/636] AR_BRANCH="release/3.1.x_p4_tasmota" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 17b5c13ae..46dc36762 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="release/v3.1.x" + AR_BRANCH="release/3.1.x_p4_tasmota" fi if [ -z $IDF_TARGET ]; then From 90f2f15da826909c881636c03c36e344e001784c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:12:51 +0200 Subject: [PATCH 495/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index cb3350cf6..064581d4d 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF v5.3 +name: IDF v5.3 with P4 on: workflow_dispatch: # Manually start a workflow From d4d5bdccdff12138b93a875b98464dca27fda240 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:49:04 +0200 Subject: [PATCH 496/636] add P4 --- configs/builds.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/configs/builds.json b/configs/builds.json index 7c4611553..70ddff6d1 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -4,7 +4,7 @@ "file":"libspi_flash.a", "src":"build/esp-idf/spi_flash/libspi_flash.a", "out":"lib/libspi_flash.a", - "targets":["esp32","esp32c2","esp32c3","esp32s2","esp32s3","esp32c6","esp32h2"] + "targets":["esp32","esp32c2","esp32c3","esp32s2","esp32s3","esp32c6","esp32h2","esp32p4"] }, { "file":"libesp_psram.a", @@ -86,6 +86,20 @@ ["dio","80m"] ] }, + { + "target": "esp32p4", + "features":[], + "idf_libs":["qio","80m"], + "bootloaders":[ + ["qio","80m"], + ["dio","80m"], + ["qio","40m"], + ["dio","40m"] + ], + "mem_variants":[ + ["dio","80m"] + ] + }, { "target": "esp32c3", "features":[], From fff067c73d40281dd45dcde1d1b5355366ff974d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Aug 2024 00:14:25 +0200 Subject: [PATCH 497/636] Create defconfig.esp32p4 --- configs/defconfig.esp32p4 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 configs/defconfig.esp32p4 diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 new file mode 100644 index 000000000..f1cb933ce --- /dev/null +++ b/configs/defconfig.esp32p4 @@ -0,0 +1,11 @@ +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160=y +# PSRAM is connected in parallel to Flash chip and max clock is 20Mhz +# CONFIG_SPIRAM is not set + +# +# PPP +# +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_PPP_ENABLE_IPV6=n From efa168437afaa77fb68bb38e6fbc1bb550536bd1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:23:10 +0200 Subject: [PATCH 498/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c554ba753..7f021c771 100755 --- a/build.sh +++ b/build.sh @@ -18,7 +18,7 @@ fi # Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167 export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 -export TARGET="all" +export TARGET="esp32p4" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From 9ee8ef7baeb456ba758f3b1de9b49e015573afd0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:07:06 +0200 Subject: [PATCH 499/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 7f021c771..c554ba753 100755 --- a/build.sh +++ b/build.sh @@ -18,7 +18,7 @@ fi # Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167 export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 -export TARGET="esp32p4" +export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From e6d4422049a7f7186977aa4afe1a2b8d7f50e74b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:59:10 +0200 Subject: [PATCH 500/636] Update tusb_config.h --- components/arduino_tinyusb/include/tusb_config.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/arduino_tinyusb/include/tusb_config.h b/components/arduino_tinyusb/include/tusb_config.h index 9f7f2566a..f4acaa232 100755 --- a/components/arduino_tinyusb/include/tusb_config.h +++ b/components/arduino_tinyusb/include/tusb_config.h @@ -75,11 +75,9 @@ extern "C" { /* */ /* COMMON CONFIGURATION */ /* */ - -#ifdef CFG_TUSB_MCU -# undef CFG_TUSB_MCU +#ifndef CFG_TUSB_MCU +#define CFG_TUSB_MCU OPT_MCU_ESP32S2 #endif -#define CFG_TUSB_MCU OPT_MCU_ESP32S2 #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE #define CFG_TUSB_OS OPT_OS_FREERTOS From 90a10e41986544091189d780d8e830e7bb8076d3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 28 Aug 2024 21:49:25 +0200 Subject: [PATCH 501/636] Update pio_start.txt --- configs/pio_start.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/configs/pio_start.txt b/configs/pio_start.txt index 078f0b085..0f2fe3d8b 100644 --- a/configs/pio_start.txt +++ b/configs/pio_start.txt @@ -45,7 +45,6 @@ if "ZIGBEE_MODE_ZCZR" in flatten_cppdefines: LIBS=[ "-lesp_zb_api_zczr", "-lesp_zb_cli_command", - "-lzboss_stack.zczr.trace", "-lzboss_stack.zczr", "-lzboss_port" ] @@ -55,7 +54,6 @@ if "ZIGBEE_MODE_ED" in flatten_cppdefines: LIBS=[ "-lesp_zb_api_ed", "-lesp_zb_cli_command", - "-lzboss_stack.ed.trace", "-lzboss_stack.ed", "-lzboss_port" ] From a6ea86483a326682cc7a523a8c2c441bd006c133 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 30 Aug 2024 11:44:54 +0200 Subject: [PATCH 502/636] enable CCACHE --- build.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c554ba753..e96fc314b 100755 --- a/build.sh +++ b/build.sh @@ -18,6 +18,8 @@ fi # Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167 export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 +CCACHE_ENABLE=1 + export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 @@ -26,8 +28,9 @@ ARCHIVE_OUT=1 DEPLOY_OUT=0 function print_help() { - echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]" + echo "Usage: build.sh [-s] [-n] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]" echo " -s Skip installing/updating of ESP-IDF and all components" + echo " -n Disable ccache" echo " -A Set which branch of arduino-esp32 to be used for compilation" echo " -I Set which branch of ESP-IDF to be used for compilation" echo " -i Set which commit of ESP-IDF to be used for compilation" @@ -43,6 +46,9 @@ while getopts ":A:I:i:c:t:b:sde" opt; do s ) SKIP_ENV=1 ;; + n ) + CCACHE_ENABLE=0 + ;; e ) ARCHIVE_OUT=1 ;; @@ -83,6 +89,8 @@ done shift $((OPTIND -1)) CONFIGS=$@ +export IDF_CCACHE_ENABLE=$CCACHE_ENABLE + # Output the TARGET array echo "TARGET(s): ${TARGET[@]}" From a5129859fc980e1bfe8ac5c013d2a6910701d259 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 30 Aug 2024 11:50:47 +0200 Subject: [PATCH 503/636] Update prepare-ci.sh --- tools/prepare-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/prepare-ci.sh b/tools/prepare-ci.sh index a18e63d5a..0855e8496 100755 --- a/tools/prepare-ci.sh +++ b/tools/prepare-ci.sh @@ -2,7 +2,7 @@ # Ubuntu setup # Change in archive-build.sh gawk to awk -#sudo apt update && sudo apt install -y gperf cmake ninja-build +#sudo apt update && sudo apt install -y gperf cmake ninja-build ccache #pip3 install wheel future pyelftools # MacOS (ARM) setup From b1d660b1409cc60cb1bc344bed9bc401f66a1040 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 31 Aug 2024 12:33:11 +0200 Subject: [PATCH 504/636] Update app.py --- tools/config_editor/app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/config_editor/app.py b/tools/config_editor/app.py index 02ae85d2c..37e2f0e57 100755 --- a/tools/config_editor/app.py +++ b/tools/config_editor/app.py @@ -109,10 +109,10 @@ class ConfigEditorApp(App): ENABLE_COMMAND_PALETTE = False CSS_PATH = "style.tcss" SCREENS = { - "main": MainScreen(), - "settings": SettingsScreen(), - "compile": CompileScreen(), - "editor": EditorScreen(), + "main": MainScreen, + "settings": SettingsScreen, + "compile": CompileScreen, + "editor": EditorScreen, } def on_mount(self) -> None: From 36b836c7b326904f5131d907a1b8f8cb15ba1f63 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 31 Aug 2024 12:34:18 +0200 Subject: [PATCH 505/636] Create requirements.txt --- tools/config_editor/requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/config_editor/requirements.txt diff --git a/tools/config_editor/requirements.txt b/tools/config_editor/requirements.txt new file mode 100644 index 000000000..f3cac7be0 --- /dev/null +++ b/tools/config_editor/requirements.txt @@ -0,0 +1 @@ +textual==0.79.0 From bc63c01de12d65e6fbbdbfeda29b39765bce1882 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 31 Aug 2024 12:34:58 +0200 Subject: [PATCH 506/636] Update README.md --- README.md | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index fe1a47534..7535475f0 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ This repository contains the scripts that produce the libraries included with Tasmota esp32-arduino. +Tested on Ubuntu and MacOS. + ### Build on Ubuntu ```bash -sudo apt update && sudo apt install -y git wget curl libssl-dev libncurses-dev flex bison gperf python3 cmake ninja-build ccache jq -curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py && \ -pip3 install setuptools pyserial click future wheel cryptography pyparsing pyelftools -git clone https://github.com/Jason2866/esp32-arduino-lib-builder +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 +sudo pip install --upgrade pip +git clone https://github.com/espressif/esp32-arduino-lib-builder cd esp32-arduino-lib-builder ./build.sh ``` - ### Using the User Interface You can more easily build the libraries using the user interface found in the `tools/config_editor/` folder. @@ -22,25 +22,23 @@ For more information and troubleshooting, please refer to the [UI README](tools/ To use it, follow these steps: -1. Make sure you have the required dependencies installed: +1. Make sure you have the following prerequisites: - Python 3.9 or later - - The [Textual](https://github.com/textualize/textual/) library - All the dependencies listed in the previous section -2. Execute the script `tools/config_editor/app.py` from any folder. It will automatically detect the path to the root of the repository. +2. Install the required UI packages using `pip install -r tools/config_editor/requirements.txt`. -3. Configure the compilation and ESP-IDF options as desired. +3. Execute the script `tools/config_editor/app.py` from any folder. It will automatically detect the path to the root of the repository. -4. Click on the "Compile Static Libraries" button to start the compilation process. +4. Configure the compilation and ESP-IDF options as desired. -5. 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. +5. Click on the "Compile Static Libraries" button to start the compilation process. -6. If the compilation is successful you can find the Platformio framework in the `dist` folder alongside this repository. +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. +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. + - 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. ### Documentation 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) - -### Development builds -Look in release and download a version. There is the Info of the used commits of IDF / Arduino. From 8056184d63bd066e9d53f1e02c0473bc2f64e801 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 31 Aug 2024 12:36:58 +0200 Subject: [PATCH 507/636] Update README.md --- tools/config_editor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config_editor/README.md b/tools/config_editor/README.md index 0ca0aaf0a..51d55ee4a 100644 --- a/tools/config_editor/README.md +++ b/tools/config_editor/README.md @@ -6,7 +6,7 @@ It has mouse support and can be pre-configured using command line arguments. ## Requirements - Python 3.9 or later - - The "textual" library (install it using `pip install textual`) + - Install the required packages using `pip install -r requirements.txt` - The requirements from esp32-arduino-lib-builder ## Troubleshooting From 78162b2ebedfed2ba2efe2e19685d3bfc7f014fd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 31 Aug 2024 15:50:50 +0200 Subject: [PATCH 508/636] Update pio_end.txt --- configs/pio_end.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/pio_end.txt b/configs/pio_end.txt index e7544f1dd..f942d442d 100644 --- a/configs/pio_end.txt +++ b/configs/pio_end.txt @@ -1,5 +1,5 @@ "ARDUINO_ARCH_ESP32", - "ESP32", + ("ESP32", "ESP32"), ("F_CPU", "$BOARD_F_CPU"), ("ARDUINO", 10812), ("ARDUINO_VARIANT", '\\"%s\\"' % board_config.get("build.variant").replace('"', "")), From 75bb93f3c3a288406dc25e4f9eddc56cd012d24f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 6 Sep 2024 21:59:02 +0200 Subject: [PATCH 509/636] V5.3 no wpa3 --- configs/defconfig.common | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index e76d17ac6..c6ef4ea89 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -37,22 +37,22 @@ CONFIG_ESP_TASK_WDT_PANIC=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y +# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set # CONFIG_ESP_WIFI_FTM_ENABLE is not set # CONFIG_ESP_WIFI_GMAC_SUPPORT is not set -CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 -CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 -CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 # CONFIG_ESP_WIFI_CSI_ENABLED is not set -CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y -CONFIG_ESP_WIFI_ENABLE_SAE_PK=y +# CONFIG_ESP_WIFI_ENABLE_WPA3_SAE is not set +# CONFIG_ESP_WIFI_ENABLE_SAE_PK is not set # CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y # CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT is not set # CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 -# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set # CONFIG_ESP_WIFI_IRAM_OPT is not set # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 CONFIG_ESP_PHY_REDUCE_TX_POWER=y CONFIG_ETH_TRANSMIT_MUTEX=y CONFIG_ETH_SPI_ETHERNET_DM9051=y @@ -108,6 +108,7 @@ CONFIG_NEWLIB_NANO_FORMAT=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_TLS_DISABLED=y +# CONFIG_MBEDTLS_TLS_ENABLED is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 # CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set @@ -171,7 +172,7 @@ CONFIG_MBEDTLS_HARDWARE_SHA=y CONFIG_MBEDTLS_ECP_C=y CONFIG_MBEDTLS_ECDH_C=y CONFIG_MBEDTLS_ECDSA_C=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLE=y # CONFIG_MBEDTLS_DHM_C is not set # CONFIG_MBEDTLS_ECJPAKE_C is not set # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set From d8ce16b9d87f2fe356cb98b4f11da61b3687f120 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:24:56 +0200 Subject: [PATCH 510/636] Update defconfig.common --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index c6ef4ea89..b53ad4ba8 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -172,7 +172,7 @@ CONFIG_MBEDTLS_HARDWARE_SHA=y CONFIG_MBEDTLS_ECP_C=y CONFIG_MBEDTLS_ECDH_C=y CONFIG_MBEDTLS_ECDSA_C=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLE=y +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y # CONFIG_MBEDTLS_DHM_C is not set # CONFIG_MBEDTLS_ECJPAKE_C is not set # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set From e717f7768a63fb66c0cc917e62f5900dcd4efdec Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:57:56 +0200 Subject: [PATCH 511/636] Update defconfig.common --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index b53ad4ba8..8daa1e5f2 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -44,7 +44,7 @@ CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y # CONFIG_ESP_WIFI_ENABLE_WPA3_SAE is not set # CONFIG_ESP_WIFI_ENABLE_SAE_PK is not set # CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set -CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y +# CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set # CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT is not set # CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 From 807b448e6f1a09691b60f8ac292cf1e0bbdaf7e9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 20 Sep 2024 13:25:06 +0200 Subject: [PATCH 512/636] Update idf_component.yml --- main/idf_component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index 3f1b3fabd..bf96b25c8 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -6,4 +6,4 @@ dependencies: git: https://github.com/espressif/esp32-camera.git require: public rules: - - if: "target in [esp32, esp32s2, esp32s3]" + - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" From 7f8b58b00ac7a70bb0f7c132e23fb02125f48724 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 20 Sep 2024 13:25:25 +0200 Subject: [PATCH 513/636] Delete patches/mmu_map.diff --- patches/mmu_map.diff | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 patches/mmu_map.diff diff --git a/patches/mmu_map.diff b/patches/mmu_map.diff deleted file mode 100644 index 3bf56005a..000000000 --- a/patches/mmu_map.diff +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/components/esp_mm/esp_mmu_map.c b/components/esp_mm/esp_mmu_map.c -index b7d927f8fe..6a8c4635f0 100644 ---- a/components/esp_mm/esp_mmu_map.c -+++ b/components/esp_mm/esp_mmu_map.c -@@ -315,6 +315,19 @@ esp_err_t esp_mmu_map_reserve_block_with_caps(size_t size, mmu_mem_caps_t caps, - s_mmu_ctx.mem_regions[found_region_id].max_slot_size -= aligned_size; - ESP_EARLY_LOGV(TAG, "found laddr is 0x%x", laddr); - -+ mem_block_t *mem_block = NULL; -+ mem_region_t *region = &s_mmu_ctx.mem_regions[found_region_id]; -+ TAILQ_FOREACH(mem_block, ®ion->mem_block_head, entries) { -+ if (mem_block == TAILQ_FIRST(®ion->mem_block_head) || mem_block == TAILQ_LAST(®ion->mem_block_head, mem_block_head_)) { -+ TAILQ_REMOVE(®ion->mem_block_head, mem_block, entries); -+ } else { -+ // probably the reservation of MMU region should be disallowed for this case - already some MMU mappings exist? -+ // assert/abort -+ ESP_EARLY_LOGE(TAG, "already some MMU mappings exist?"); -+ abort(); -+ } -+ } -+ - uint32_t vaddr = 0; - if (caps & MMU_MEM_CAP_EXEC) { - vaddr = mmu_ll_laddr_to_vaddr(laddr, MMU_VADDR_INSTRUCTION); From 25f0dd5c07d99b05a1019dc535bcfced6a11a706 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 20 Sep 2024 13:26:33 +0200 Subject: [PATCH 514/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 0994c09b7..f79f5c7f9 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -68,7 +68,6 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then # 2) Temporarily fix for mmu map and late init of psram https://github.com/espressif/arduino-esp32/issues/9936 cd $IDF_PATH patch -p1 -N -i $AR_PATCHES/esp32s2_i2c_ll_master_init.diff - patch -p1 -N -i $AR_PATCHES/mmu_map.diff patch -p1 -N -i $AR_PATCHES/lwip_max_tcp_pcb.diff cd - From da7e3ab9f2190cad21c6a2f8797553f39e7d17f1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:08:42 +0200 Subject: [PATCH 515/636] AR_BRANCH="feature/esp32p4" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 46dc36762..8422d6884 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="release/3.1.x_p4_tasmota" + AR_BRANCH="feature/esp32p4" fi if [ -z $IDF_TARGET ]; then From a5b6cb3f782432344ff1d07b578c95e3c6480cd1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 21 Sep 2024 19:24:58 +0200 Subject: [PATCH 516/636] Enable LTO and disable warnings --- configs/defconfig.common | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 8daa1e5f2..53013aa28 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -16,6 +16,11 @@ CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_ENABLE_LTO=y +CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y +CONFIG_COMPILER_DISABLE_GCC12_WARNINGS=y +CONFIG_COMPILER_DISABLE_GCC13_WARNINGS=y +CONFIG_COMPILER_DISABLE_GCC14_WARNINGS=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y From ea8cfe3931b10b1b0817dcde8ada9682fabc6214 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 21 Sep 2024 21:46:16 +0200 Subject: [PATCH 517/636] Delete main/component.mk --- main/component.mk | 1 - 1 file changed, 1 deletion(-) delete mode 100644 main/component.mk diff --git a/main/component.mk b/main/component.mk deleted file mode 100644 index 08c3b49f4..000000000 --- a/main/component.mk +++ /dev/null @@ -1 +0,0 @@ -CXXFLAGS += -fno-rtti From 605ce994801807bc35a6309c8060d2be825d9640 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 21 Sep 2024 22:57:26 +0200 Subject: [PATCH 518/636] IDF is not LTO ready --- configs/defconfig.common | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 53013aa28..5fc910b8a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -16,7 +16,6 @@ CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y -CONFIG_COMPILER_ENABLE_LTO=y CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y CONFIG_COMPILER_DISABLE_GCC12_WARNINGS=y CONFIG_COMPILER_DISABLE_GCC13_WARNINGS=y From 1c27fd65f5301cf4fab1f4d2f8c5c30895c233dc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 24 Sep 2024 21:49:50 +0200 Subject: [PATCH 519/636] AR_BRANCH="release/v3.1.x" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 8422d6884..17b5c13ae 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="feature/esp32p4" + AR_BRANCH="release/v3.1.x" fi if [ -z $IDF_TARGET ]; then From 082ee01159ae9ad583032336f4103ea78bd6ba5b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 25 Sep 2024 17:32:32 +0200 Subject: [PATCH 520/636] enable PSRAM with 200Mhz --- configs/defconfig.esp32p4 | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index f1cb933ce..0053b95eb 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -1,6 +1,38 @@ -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160=y -# PSRAM is connected in parallel to Flash chip and max clock is 20Mhz -# CONFIG_SPIRAM is not set +CONFIG_IDF_EXPERIMENTAL_FEATURES=y + +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_TYPE_RISCV=y +CONFIG_ULP_COPROC_RESERVE_MEM=4096 + +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_360=y +CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_SPEED_200M=y +CONFIG_SPIRAM_XIP_FROM_PSRAM=y +CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y +CONFIG_RTC_CLK_CAL_CYCLES=576 +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 +CONFIG_CACHE_L2_CACHE_256KB=y +CONFIG_CACHE_L2_CACHE_LINE_128B=y + +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +# CONFIG_BLE_MESH is not set +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set # # PPP From 59f05ec73ef30e05bb06e964b6005c21ab14c105 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 25 Sep 2024 17:33:54 +0200 Subject: [PATCH 521/636] LP core enable --- configs/defconfig.esp32p4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index 0053b95eb..32f312dd1 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -1,8 +1,9 @@ CONFIG_IDF_EXPERIMENTAL_FEATURES=y +# Enable LP Core CONFIG_ULP_COPROC_ENABLED=y -CONFIG_ULP_COPROC_TYPE_RISCV=y -CONFIG_ULP_COPROC_RESERVE_MEM=4096 +CONFIG_ULP_COPROC_TYPE_LP_CORE=y +CONFIG_ULP_COPROC_RESERVE_MEM=8192 CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_360=y CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y From e962222b33d4cca8e628c4aafbcdd7c6820bf74e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 25 Sep 2024 18:02:44 +0200 Subject: [PATCH 522/636] Update defconfig.esp32p4 --- configs/defconfig.esp32p4 | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index 32f312dd1..1550c9e10 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -10,7 +10,6 @@ CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y CONFIG_SPIRAM=y CONFIG_SPIRAM_SPEED_200M=y CONFIG_SPIRAM_XIP_FROM_PSRAM=y -CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set @@ -19,22 +18,6 @@ CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 CONFIG_CACHE_L2_CACHE_256KB=y CONFIG_CACHE_L2_CACHE_LINE_128B=y -# -# Bluetooth -# -CONFIG_BT_ENABLED=y -CONFIG_BT_STACK_NO_LOG=y -# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y -CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 -# CONFIG_BT_NIMBLE_NVS_PERSIST is not set -# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set -# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set -# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set -# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set - # # PPP # From 2f8372630b8767fda2b329b4447c4e98dc51e7d9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:18:37 +0200 Subject: [PATCH 523/636] Fix remove Arduino defines --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 88c1b5400..896effc0e 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -102,7 +102,7 @@ for item in "${@:2:${#@}-5}"; do INCLUDES+="$item " fi elif [ "$prefix" = "-D" ]; then - if [[ "${item:2:7}" != "ARDUINO" ]] && [[ "$item" != "-DESP32" ]]; then #skip ARDUINO defines + if [[ "${item:2:7}" != "ARDUINO" ]] && [[ "$item" != "-DESP32=ESP32" ]]; then #skip ARDUINO defines DEFINES+="$item " fi elif [ "$prefix" = "-O" ]; then From d96ca0576d7df8e3149fbefb6524f686c86b845f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:46:20 +0200 Subject: [PATCH 524/636] Update copy-libs.sh --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 896effc0e..743f55d7b 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -140,7 +140,7 @@ str=`printf '%b' "$str"` #unescape the string set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" - if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then + if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$item" != "-fno-lto" && "$prefix" != "-O" ]]; then 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 CPP_FLAGS+="$item " if [[ $PIO_CC_FLAGS != *"$item"* ]]; then From a3d1f61cb7f5464cadb376f810ac153647c78312 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 28 Sep 2024 21:00:44 +0200 Subject: [PATCH 525/636] remove "-fno-lto" frome linker flags --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 743f55d7b..1c80551a5 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -211,7 +211,7 @@ for item; do add_next=0 is_script=0 is_dir=0 - elif [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:19}" != "-fdebug-prefix-map=" && "${item:0:17}" != "-Wl,--start-group" && "${item:0:15}" != "-Wl,--end-group" ]]; then + 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 LD_FLAGS+="$item " PIO_LD_FLAGS+="$item " fi From 1a5743a13421a6adc93dbeb08e5bf3743002bd43 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 28 Sep 2024 21:19:29 +0200 Subject: [PATCH 526/636] remove -fno-lto --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 1c80551a5..8c2a33f0c 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -121,7 +121,7 @@ str=`printf '%b' "$str"` #unescape the string set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" - if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then + if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$item" != "-fno-lto" && "$prefix" != "-O" ]]; then 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 AS_FLAGS+="$item " if [[ $C_FLAGS == *"$item"* ]]; then From 3f9253534d1786329f2e8f9f29b5712f5daa764d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 28 Sep 2024 21:44:42 +0200 Subject: [PATCH 527/636] enable -flto --- tools/copy-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 8c2a33f0c..76457e8ee 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -65,9 +65,9 @@ LD_SCRIPT_DIRS="" PIO_CC_FLAGS="" PIO_C_FLAGS="" -PIO_CXX_FLAGS="" +PIO_CXX_FLAGS="-flto=auto " PIO_AS_FLAGS="" -PIO_LD_FLAGS="" +PIO_LD_FLAGS="-flto " PIO_LD_FUNCS="" PIO_LD_SCRIPTS="" From 3b6c7cabde9c4bcc4f27171a78275be9df4a109a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 29 Sep 2024 13:03:15 +0200 Subject: [PATCH 528/636] PIO_CC_FLAGS="-flto=auto " (#107) --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 76457e8ee..b0b7bb190 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -63,7 +63,7 @@ LD_LIBS_SEARCH="" LD_SCRIPTS="" LD_SCRIPT_DIRS="" -PIO_CC_FLAGS="" +PIO_CC_FLAGS="-flto=auto " PIO_C_FLAGS="" PIO_CXX_FLAGS="-flto=auto " PIO_AS_FLAGS="" From 853fa4232b01c2648d70c6420618461f97c1f5e7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 1 Oct 2024 23:04:55 +0200 Subject: [PATCH 529/636] Update dcd_esp32sx.c --- components/arduino_tinyusb/src/dcd_esp32sx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/arduino_tinyusb/src/dcd_esp32sx.c b/components/arduino_tinyusb/src/dcd_esp32sx.c index 9d4d8bf7c..324aad595 100755 --- a/components/arduino_tinyusb/src/dcd_esp32sx.c +++ b/components/arduino_tinyusb/src/dcd_esp32sx.c @@ -31,7 +31,7 @@ #if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && CFG_TUD_ENABLED) // Espressif -#include "xtensa_api.h" +#include "freertos/xtensa_api.h" #include "esp_intr_alloc.h" #include "esp_log.h" #include "soc/dport_reg.h" From 4c436e97240e95e976ace36949722a0f297a3d71 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 1 Oct 2024 23:23:49 +0200 Subject: [PATCH 530/636] Update defconfig.esp32s2 --- configs/defconfig.esp32s2 | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index f3fca9b8f..d79c71242 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -1,3 +1,4 @@ +# CONFIG_TINYUSB_ENABLED is not set CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y From 2fa5a59d3989391ef8d9b1f718571c2421954467 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 1 Oct 2024 23:27:41 +0200 Subject: [PATCH 531/636] Update defconfig.esp32s3 --- configs/defconfig.esp32s3 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 758a1c9c4..68639bd74 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,5 +1,7 @@ # CONFIG_IDF_EXPERIMENTAL_FEATURES=y +# CONFIG_TINYUSB_ENABLED is not + CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_RISCV=y CONFIG_ULP_COPROC_RESERVE_MEM=4096 From c326cd23c6e78210929fe0abec7b77eb928328c5 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:03:53 +0200 Subject: [PATCH 532/636] temp Tinyusb fix --- tools/update-components.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/update-components.sh b/tools/update-components.sh index 6c97f2c3a..48bad8f79 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -11,10 +11,23 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" echo "Updating TinyUSB..." if [ ! -d "$TINYUSB_REPO_DIR" ]; then git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" + # from right before Keyboard LED problem - No issue found + # git checkout 69313ef45564cc8967575f47fb8c57371cbea470 + # from right after Keyboard LED problem - No issue found + # git checkout 7fb8d3341ce2feb46b0bce0bef069d31cf080168 + # from feW DAYS after Keyboard LED problem COMMIT - Breaks LED + # git checkout a435befcdeb6bbd40cf3ba342756f8d73f031957 + # Commit from April 26th, later. WORKS + # git checkout ee9ad0f184752e4006ccfa6ae49b7ac83707d771 + # Last commit done the 26th April + cd "$TINYUSB_REPO_DIR" + git checkout 31b559370d29f5093979fc50de2ae415fa6612ce + cd - else cd $TINYUSB_REPO_DIR git pull # -ff is for cleaning untracked files as well as submodules git clean -ffdx + git checkout 31b559370d29f5093979fc50de2ae415fa6612ce fi if [ $? -ne 0 ]; then exit 1; fi From fedf53272b8062986e22c2ac1f728c9a70ec30ed Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:04:24 +0200 Subject: [PATCH 533/636] Update defconfig.esp32s3 --- configs/defconfig.esp32s3 | 2 -- 1 file changed, 2 deletions(-) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 68639bd74..758a1c9c4 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,7 +1,5 @@ # CONFIG_IDF_EXPERIMENTAL_FEATURES=y -# CONFIG_TINYUSB_ENABLED is not - CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_RISCV=y CONFIG_ULP_COPROC_RESERVE_MEM=4096 From 2b071f5e40b3f0222b7d416401be8893fec06b7f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:04:49 +0200 Subject: [PATCH 534/636] Update defconfig.esp32s2 --- configs/defconfig.esp32s2 | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index d79c71242..f3fca9b8f 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -1,4 +1,3 @@ -# CONFIG_TINYUSB_ENABLED is not set CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y From 161a283a7b2583d7cfc259b20dbfb5741263d4b4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:10:41 +0200 Subject: [PATCH 535/636] COMPONENTS_SUBSET --- main/idf_component.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/main/idf_component.yml b/main/idf_component.yml index bf96b25c8..702a6ad9b 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -7,3 +7,4 @@ dependencies: require: public rules: - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" + - if: "$COMPONENTS_SUBSET in [full, all]" From 851a8a5ae1cde6150d36320ba4a465a9721fa801 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:14:35 +0200 Subject: [PATCH 536/636] add COMPONENTS_SUBSET --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index e96fc314b..062f197b2 100755 --- a/build.sh +++ b/build.sh @@ -154,7 +154,7 @@ if [ "$BUILD_TYPE" != "all" ]; then echo "idf.py -DIDF_TARGET=\"$target\" -DSDKCONFIG_DEFAULTS=\"$configs\" $BUILD_TYPE" rm -rf build sdkconfig - idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE + COMPONENTS_SUBSET=full idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE if [ $? -ne 0 ]; then exit 1; fi done exit 0 @@ -217,7 +217,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build IDF-Libs: $idf_libs_configs" rm -rf build sdkconfig - idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs + COMPONENTS_SUBSET=full idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs if [ $? -ne 0 ]; then exit 1; fi # Build Bootloaders @@ -229,7 +229,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build BootLoader: $bootloader_configs" rm -rf build sdkconfig - idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader + COMPONENTS_SUBSET=none idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader if [ $? -ne 0 ]; then exit 1; fi done @@ -242,7 +242,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build Memory Variant: $mem_configs" rm -rf build sdkconfig - idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant + COMPONENTS_SUBSET=none idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant if [ $? -ne 0 ]; then exit 1; fi done done From c097781cc40b6e1186224f102e5f7738a34c022a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:29:28 +0200 Subject: [PATCH 537/636] Update CMakeLists.txt --- components/arduino_tinyusb/CMakeLists.txt | 26 +++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index b0227ec5a..6a2e35150 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -15,14 +15,18 @@ if(CONFIG_TINYUSB_ENABLED) "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes ) + elseif(IDF_TARGET STREQUAL "esp32p4") + set(compile_options + "-DCFG_TUSB_MCU=OPT_MCU_ESP32P4" + "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" + "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes + ) endif() set(srcs # espressif: - #"${COMPONENT_DIR}/src/dcd_esp32sx.c" "${COMPONENT_DIR}/src/dcd_dwc2.c" # tusb: - #"${COMPONENT_DIR}/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c" #"{COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c" "${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_device.c" "${COMPONENT_DIR}/tinyusb/src/class/hid/hid_device.c" @@ -32,6 +36,7 @@ if(CONFIG_TINYUSB_ENABLED) "${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_rt_device.c" "${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_device.c" "${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_device.c" + "${COMPONENT_DIR}/tinyusb/src/class/net/ncm_device.c" "${COMPONENT_DIR}/tinyusb/src/common/tusb_fifo.c" "${COMPONENT_DIR}/tinyusb/src/device/usbd_control.c" "${COMPONENT_DIR}/tinyusb/src/device/usbd.c" @@ -56,16 +61,15 @@ if(CONFIG_TINYUSB_ENABLED) set(requires esp_rom freertos soc) set(priv_requires arduino main) - ### tinyusb lib ### - ################### - idf_component_register(INCLUDE_DIRS ${includes_public} PRIV_INCLUDE_DIRS ${includes_private} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) - # add_library(${COMPONENT_TARGET} STATIC ${srcs}) - # target_include_directories( - # ${COMPONENT_TARGET} - # PUBLIC ${includes_public} - # PRIVATE ${includes_private}) + + idf_component_register( + INCLUDE_DIRS ${includes_public} + PRIV_INCLUDE_DIRS ${includes_private} + SRCS ${srcs} + REQUIRES ${requires} + PRIV_REQUIRES ${priv_requires} + ) target_compile_options(${COMPONENT_TARGET} PRIVATE ${compile_options}) - #target_link_libraries(${COMPONENT_TARGET} INTERFACE ${COMPONENT_TARGET}) else() From ad047209eb0c4a503764f154b4f30fa69fd37fb2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:30:15 +0200 Subject: [PATCH 538/636] Update Kconfig.projbuild --- components/arduino_tinyusb/Kconfig.projbuild | 39 +++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/components/arduino_tinyusb/Kconfig.projbuild b/components/arduino_tinyusb/Kconfig.projbuild index 50e24b6a6..65d9c37be 100755 --- a/components/arduino_tinyusb/Kconfig.projbuild +++ b/components/arduino_tinyusb/Kconfig.projbuild @@ -4,7 +4,7 @@ menu "Arduino TinyUSB" config TINYUSB_ENABLED bool "Enable TinyUSB driver" default y - depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4 select FREERTOS_SUPPORT_STATIC_ALLOCATION select FREERTOS_USE_AUTHENTIC_INCLUDE_PATHS help @@ -28,14 +28,16 @@ menu "Arduino TinyUSB" config TINYUSB_CDC_RX_BUFSIZE int "CDC FIFO size of RX" - default 64 + default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 512 if IDF_TARGET_ESP32P4 depends on TINYUSB_CDC_ENABLED help CDC FIFO size of RX config TINYUSB_CDC_TX_BUFSIZE int "CDC FIFO size of TX" - default 64 + default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 512 if IDF_TARGET_ESP32P4 depends on TINYUSB_CDC_ENABLED help CDC FIFO size of TX @@ -86,7 +88,8 @@ menu "Arduino TinyUSB" config TINYUSB_HID_BUFSIZE int "HID Buffer size" - default 64 + default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 512 if IDF_TARGET_ESP32P4 depends on TINYUSB_HID_ENABLED help HID Buffer size. Should be sufficient to hold ID (if any) + Data @@ -111,14 +114,16 @@ menu "Arduino TinyUSB" config TINYUSB_MIDI_RX_BUFSIZE int "MIDI FIFO size of RX" - default 64 + default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 512 if IDF_TARGET_ESP32P4 depends on TINYUSB_MIDI_ENABLED help MIDI FIFO size of RX config TINYUSB_MIDI_TX_BUFSIZE int "MIDI FIFO size of TX" - default 64 + default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 512 if IDF_TARGET_ESP32P4 depends on TINYUSB_MIDI_ENABLED help MIDI FIFO size of TX @@ -143,8 +148,9 @@ menu "Arduino TinyUSB" config TINYUSB_VIDEO_STREAMING_BUFSIZE int "VIDEO streaming endpoint size" - range 0 64 - default 64 + range 0 512 + default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 512 if IDF_TARGET_ESP32P4 depends on TINYUSB_VIDEO_ENABLED help VIDEO streaming endpoint size @@ -219,20 +225,33 @@ menu "Arduino TinyUSB" config TINYUSB_VENDOR_RX_BUFSIZE int "VENDOR FIFO size of RX" - default 64 + default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 512 if IDF_TARGET_ESP32P4 depends on TINYUSB_VENDOR_ENABLED help VENDOR FIFO size of RX config TINYUSB_VENDOR_TX_BUFSIZE int "VENDOR FIFO size of TX" - default 64 + default 64 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 512 if IDF_TARGET_ESP32P4 depends on TINYUSB_VENDOR_ENABLED help VENDOR FIFO size of TX endmenu + menu "NCM driver" + depends on TINYUSB_ENABLED + + config TINYUSB_NCM_ENABLED + bool "Enable USB NCM TinyUSB driver" + default y + help + Enable USB NCM TinyUSB driver. + + endmenu + config TINYUSB_DEBUG_LEVEL int "TinyUSB log level (0-3)" default 0 From 2b18259a68add89263d0954bf938002bea76cfc6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:31:03 +0200 Subject: [PATCH 539/636] Update tusb_config.h --- components/arduino_tinyusb/include/tusb_config.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/arduino_tinyusb/include/tusb_config.h b/components/arduino_tinyusb/include/tusb_config.h index f4acaa232..458c78cf1 100755 --- a/components/arduino_tinyusb/include/tusb_config.h +++ b/components/arduino_tinyusb/include/tusb_config.h @@ -72,6 +72,10 @@ extern "C" { # define CONFIG_TINYUSB_VENDOR_ENABLED 0 #endif +#ifndef CONFIG_TINYUSB_NCM_ENABLED +# define CONFIG_TINYUSB_NCM_ENABLED 0 +#endif + /* */ /* COMMON CONFIGURATION */ /* */ @@ -96,11 +100,18 @@ extern "C" { # define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4) #endif +#if CONFIG_IDF_TARGET_ESP32P4 +#define CFG_TUD_MAX_SPEED OPT_MODE_HIGH_SPEED +#else +#define CFG_TUD_MAX_SPEED OPT_MODE_FULL_SPEED +#endif + /* */ /* DRIVER CONFIGURATION */ /* */ #define CFG_TUD_MAINTASK_SIZE 4096 +#define CFG_TUD_ENDOINT_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) #define CFG_TUD_ENDOINT0_SIZE 64 // Enabled Drivers @@ -113,6 +124,7 @@ extern "C" { #define CFG_TUD_DFU_RUNTIME CONFIG_TINYUSB_DFU_RT_ENABLED #define CFG_TUD_DFU CONFIG_TINYUSB_DFU_ENABLED #define CFG_TUD_VENDOR CONFIG_TINYUSB_VENDOR_ENABLED +#define CFG_TUD_NCM CONFIG_TINYUSB_NCM_ENABLED // CDC FIFO size of TX and RX #define CFG_TUD_CDC_RX_BUFSIZE CONFIG_TINYUSB_CDC_RX_BUFSIZE From 7d67041ecb1fbf13719bef51da134d4c01dc7381 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:32:34 +0200 Subject: [PATCH 540/636] Update dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 681 ++++++++++++---------- 1 file changed, 388 insertions(+), 293 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index adf018fe8..fa81e5e29 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -31,6 +31,9 @@ #if CFG_TUD_ENABLED && defined(TUP_USBIP_DWC2) +// Debug level for DWC2 +#define DWC2_DEBUG 2 + #include "device/dcd.h" #include "dwc2_type.h" @@ -43,7 +46,7 @@ #if defined(TUP_USBIP_DWC2_STM32) #include "dwc2_stm32.h" -#elif TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) +#elif defined(TUP_USBIP_DWC2_ESP32) #include "dwc2_esp32.h" #elif TU_CHECK_MCU(OPT_MCU_GD32VF103) #include "dwc2_gd32.h" @@ -57,29 +60,26 @@ #error "Unsupported MCUs" #endif -//--------------------------------------------------------------------+ -// MACRO TYPEDEF CONSTANT ENUM -//--------------------------------------------------------------------+ +enum { + DWC2_CONTROLLER_COUNT = TU_ARRAY_SIZE(_dwc2_controller) +}; // DWC2 registers -#define DWC2_REG(_port) ((dwc2_regs_t*) _dwc2_controller[_port].reg_base) +//#define DWC2_REG(_port) ((dwc2_regs_t*) _dwc2_controller[_port].reg_base) -// Debug level for DWC2 -#define DWC2_DEBUG 2 - -#ifndef dcache_clean -#define dcache_clean(_addr, _size) -#endif - -#ifndef dcache_invalidate -#define dcache_invalidate(_addr, _size) -#endif +TU_ATTR_ALWAYS_INLINE static inline dwc2_regs_t* DWC2_REG(uint8_t rhport) { + if (rhport >= DWC2_CONTROLLER_COUNT) { + // user mis-configured, ignore and use first controller + rhport = 0; + } + return (dwc2_regs_t*) _dwc2_controller[rhport].reg_base; +} -#ifndef dcache_clean_invalidate -#define dcache_clean_invalidate(_addr, _size) -#endif +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ -static TU_ATTR_ALIGNED(4) uint32_t _setup_packet[2]; +static CFG_TUD_MEM_SECTION TU_ATTR_ALIGNED(4) uint32_t _setup_packet[2]; typedef struct { uint8_t* buffer; @@ -93,106 +93,235 @@ static xfer_ctl_t xfer_status[DWC2_EP_MAX][2]; #define XFER_CTL_BASE(_ep, _dir) (&xfer_status[_ep][_dir]) // EP0 transfers are limited to 1 packet - larger sizes has to be split -static uint16_t ep0_pending[2]; // Index determines direction as tusb_dir_t type +static uint16_t ep0_pending[2]; // Index determines direction as tusb_dir_t type +static uint16_t _dfifo_top; // top free location in FIFO RAM -// TX FIFO RAM allocation so far in words - RX FIFO size is readily available from dwc2->grxfsiz -static uint16_t _allocated_fifo_words_tx; // TX FIFO size in words (IN EPs) +// Number of IN endpoints active +static uint8_t _allocated_ep_in_count; // SOF enabling flag - required for SOF to not get disabled in ISR when SOF was enabled by static bool _sof_en; -// Calculate the RX FIFO size according to minimum recommendations from reference manual -// RxFIFO = (5 * number of control endpoints + 8) + -// ((largest USB packet used / 4) + 1 for status information) + -// (2 * number of OUT endpoints) + 1 for Global NAK -// with number of control endpoints = 1 we have -// RxFIFO = 15 + (largest USB packet used / 4) + 2 * number of OUT endpoints -// we double the largest USB packet size to be able to hold up to 2 packets -static inline uint16_t calc_grxfsiz(uint16_t max_ep_size, uint8_t ep_count) { - return 15 + 2 * (max_ep_size / 4) + 2 * ep_count; +//-------------------------------------------------------------------- +// DMA +//-------------------------------------------------------------------- + +TU_ATTR_ALWAYS_INLINE static inline bool dma_enabled(const dwc2_regs_t* dwc2) { + #if !CFG_TUD_DWC2_DMA + (void) dwc2; + return false; + #else + // Internal DMA only + return (dwc2->ghwcfg2_bm.arch == GHWCFG2_ARCH_INTERNAL_DMA); + #endif +} + +TU_ATTR_ALWAYS_INLINE static inline uint16_t dma_cal_epfifo_base(uint8_t rhport) { + // Scatter/Gather DMA mode is not yet supported. Buffer DMA only need 1 words per endpoint direction + const dwc2_controller_t* dwc2_controller = &_dwc2_controller[rhport]; + return dwc2_controller->ep_fifo_size/4 - 2*dwc2_controller->ep_count; +} + +static void dma_setup_prepare(uint8_t rhport) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + + if (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a) { + if(dwc2->epout[0].doepctl & DOEPCTL_EPENA) { + return; + } + } + + // Receive only 1 packet + dwc2->epout[0].doeptsiz = (1 << DOEPTSIZ_STUPCNT_Pos) | (1 << DOEPTSIZ_PKTCNT_Pos) | (8 << DOEPTSIZ_XFRSIZ_Pos); + dwc2->epout[0].doepdma = (uintptr_t)_setup_packet; + dwc2->epout[0].doepctl |= DOEPCTL_EPENA | DOEPCTL_USBAEP; } -TU_ATTR_ALWAYS_INLINE static inline void fifo_flush_tx(dwc2_regs_t* dwc2, uint8_t epnum) { +//--------------------------------------------------------------------+ +// Data FIFO +//--------------------------------------------------------------------+ + +TU_ATTR_ALWAYS_INLINE static inline void dfifo_flush_tx(dwc2_regs_t* dwc2, uint8_t epnum) { // flush TX fifo and wait for it cleared dwc2->grstctl = GRSTCTL_TXFFLSH | (epnum << GRSTCTL_TXFNUM_Pos); while (dwc2->grstctl & GRSTCTL_TXFFLSH_Msk) {} } -TU_ATTR_ALWAYS_INLINE static inline void fifo_flush_rx(dwc2_regs_t* dwc2) { +TU_ATTR_ALWAYS_INLINE static inline void dfifo_flush_rx(dwc2_regs_t* dwc2) { // flush RX fifo and wait for it cleared dwc2->grstctl = GRSTCTL_RXFFLSH; while (dwc2->grstctl & GRSTCTL_RXFFLSH_Msk) {} } -static bool fifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { +/* USB Data FIFO Layout + + The FIFO is split up into + - EPInfo: for storing DMA metadata, only required when use DMA. Maximum size is called + EP_LOC_CNT = ep_fifo_size - ghwcfg3.dfifo_depth. For value less than EP_LOC_CNT, gdfifocfg must be configured before + gahbcfg.dmaen is set + - Buffer mode: 1 word per endpoint direction + - Scatter/Gather DMA: 4 words per endpoint direction + - TX FIFO: one fifo for each IN endpoint. Size is dynamic depending on packet size, starting from top with EP0 IN. + - Shared RX FIFO: a shared fifo for all OUT endpoints. Typically, can hold up to 2 packets of the largest EP size. + + We allocated TX FIFO from top to bottom (using top pointer), this to allow the RX FIFO to grow dynamically which is + possible since the free space is located between the RX and TX FIFOs. + + ---------------- ep_fifo_size + | EPInfo | + | for DMA | + |-------------|-- gdfifocfg.EPINFOBASE (max is ghwcfg3.dfifo_depth) + | IN FIFO 0 | + | control | + |-------------| + | IN FIFO 1 | + |-------------| + | . . . . | + |-------------| + | IN FIFO n | + |-------------| + | FREE | + |-------------|-- GRXFSIZ (expandable) + | OUT FIFO | + | ( Shared ) | + --------------- 0 + + According to "FIFO RAM allocation" section in RM, FIFO RAM are allocated as follows (each word 32-bits): + - Each EP IN needs at least max packet size + - All EP OUT shared a unique OUT FIFO which uses (for Slave or Buffer DMA, Scatt/Gather DMA use different formula): + - 13 for setup packets + control words (up to 3 setup packets). + - 1 for global NAK (not required/used here). + - Largest-EPsize / 4 + 1. ( FS: 64 bytes, HS: 512 bytes). Recommended is "2 x (Largest-EPsize/4) + 1" + - 2 for each used OUT endpoint + + Therefore GRXFSIZ = 13 + 1 + 2 x (Largest-EPsize/4 + 1) + 2 x EPOUTnum +*/ + +TU_ATTR_ALWAYS_INLINE static inline uint16_t calc_grxfsiz(uint16_t largest_ep_size, uint8_t ep_count) { + return 13 + 1 + 2 * ((largest_ep_size / 4) + 1) + 2 * ep_count; +} + +static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + const dwc2_controller_t* dwc2_controller = &_dwc2_controller[rhport]; + uint8_t const ep_count = dwc2_controller->ep_count; uint8_t const epnum = tu_edpt_number(ep_addr); uint8_t const dir = tu_edpt_dir(ep_addr); TU_ASSERT(epnum < ep_count); uint16_t fifo_size = tu_div_ceil(packet_size, 4); - - // "USB Data FIFOs" section in reference manual - // Peripheral FIFO architecture - // - // --------------- 320 or 1024 ( 1280 or 4096 bytes ) - // | IN FIFO 0 | - // --------------- (320 or 1024) - 16 - // | IN FIFO 1 | - // --------------- (320 or 1024) - 16 - x - // | . . . . | - // --------------- (320 or 1024) - 16 - x - y - ... - z - // | IN FIFO MAX | - // --------------- - // | FREE | - // --------------- GRXFSIZ - // | OUT FIFO | - // | ( Shared ) | - // --------------- 0 - // - // In FIFO is allocated by following rules: - // - IN EP 1 gets FIFO 1, IN EP "n" gets FIFO "n". if (dir == TUSB_DIR_OUT) { // Calculate required size of RX FIFO - uint16_t const sz = calc_grxfsiz(4 * fifo_size, ep_count); + uint16_t const new_sz = calc_grxfsiz(4 * fifo_size, ep_count); - // If size_rx needs to be extended check if possible and if so enlarge it - if (dwc2->grxfsiz < sz) { - TU_ASSERT(sz + _allocated_fifo_words_tx <= _dwc2_controller[rhport].ep_fifo_size / 4); - - // Enlarge RX FIFO - dwc2->grxfsiz = sz; + // If size_rx needs to be extended check if there is enough free space + if (dwc2->grxfsiz < new_sz) { + TU_ASSERT(new_sz <= _dfifo_top); + dwc2->grxfsiz = new_sz; // Enlarge RX FIFO } } else { - // Note if The TXFELVL is configured as half empty. In order - // to be able to write a packet at that point, the fifo must be twice the max_size. + // Check IN endpoints concurrently active limit + if(_dwc2_controller->ep_in_count) { + TU_ASSERT(_allocated_ep_in_count < _dwc2_controller->ep_in_count); + _allocated_ep_in_count++; + } + + // If The TXFELVL is configured as half empty, the fifo must be twice the max_size. if ((dwc2->gahbcfg & GAHBCFG_TXFELVL) == 0) { fifo_size *= 2; } // Check if free space is available - TU_ASSERT(_allocated_fifo_words_tx + fifo_size + dwc2->grxfsiz <= _dwc2_controller[rhport].ep_fifo_size / 4); - _allocated_fifo_words_tx += fifo_size; - TU_LOG(DWC2_DEBUG, " Allocated %u bytes at offset %" PRIu32, fifo_size * 4, - _dwc2_controller[rhport].ep_fifo_size - _allocated_fifo_words_tx * 4); + TU_ASSERT(_dfifo_top >= fifo_size + dwc2->grxfsiz); + _dfifo_top -= fifo_size; + TU_LOG(DWC2_DEBUG, " TX FIFO %u: allocated %u words at offset %u\r\n", epnum, fifo_size, _dfifo_top); - // DIEPTXF starts at FIFO #1. // Both TXFD and TXSA are in unit of 32-bit words. - dwc2->dieptxf[epnum - 1] = (fifo_size << DIEPTXF_INEPTXFD_Pos) | - (_dwc2_controller[rhport].ep_fifo_size / 4 - _allocated_fifo_words_tx); + if (epnum == 0) { + dwc2->dieptxf0 = (fifo_size << DIEPTXF0_TX0FD_Pos) | _dfifo_top; + } else { + // DIEPTXF starts at FIFO #1. + dwc2->dieptxf[epnum - 1] = (fifo_size << DIEPTXF_INEPTXFD_Pos) | _dfifo_top; + } } return true; } +static void dfifo_init(uint8_t rhport) { + const dwc2_controller_t* dwc2_controller = &_dwc2_controller[rhport]; + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + dwc2->grxfsiz = calc_grxfsiz(CFG_TUD_ENDPOINT0_SIZE, dwc2_controller->ep_count); + + if(dma_enabled(dwc2)) { + // DMA use last DFIFO to store metadata + _dfifo_top = dma_cal_epfifo_base(rhport); + }else { + _dfifo_top = dwc2_controller->ep_fifo_size / 4; + } + + // Allocate FIFO for EP0 IN + dfifo_alloc(rhport, 0x80, CFG_TUD_ENDPOINT0_SIZE); +} + +// Read a single data packet from receive FIFO +static void dfifo_read_packet(uint8_t rhport, uint8_t* dst, uint16_t len) { + (void) rhport; + + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + volatile const uint32_t* rx_fifo = dwc2->fifo[0]; + + // Reading full available 32 bit words from fifo + uint16_t full_words = len >> 2; + while (full_words--) { + tu_unaligned_write32(dst, *rx_fifo); + dst += 4; + } + + // Read the remaining 1-3 bytes from fifo + uint8_t const bytes_rem = len & 0x03; + if (bytes_rem != 0) { + uint32_t const tmp = *rx_fifo; + dst[0] = tu_u32_byte0(tmp); + if (bytes_rem > 1) dst[1] = tu_u32_byte1(tmp); + if (bytes_rem > 2) dst[2] = tu_u32_byte2(tmp); + } +} + +// Write a single data packet to EPIN FIFO +static void dfifo_write_packet(uint8_t rhport, uint8_t fifo_num, uint8_t const* src, uint16_t len) { + (void) rhport; + + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + volatile uint32_t* tx_fifo = dwc2->fifo[fifo_num]; + + // Pushing full available 32 bit words to fifo + uint16_t full_words = len >> 2; + while (full_words--) { + *tx_fifo = tu_unaligned_read32(src); + src += 4; + } + + // Write the remaining 1-3 bytes into fifo + uint8_t const bytes_rem = len & 0x03; + if (bytes_rem) { + uint32_t tmp_word = src[0]; + if (bytes_rem > 1) tmp_word |= (src[1] << 8); + if (bytes_rem > 2) tmp_word |= (src[2] << 16); + + *tx_fifo = tmp_word; + } +} + +//-------------------------------------------------------------------- +// Endpoint +//-------------------------------------------------------------------- #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) // Keep count of how many FIFOs are in use static uint8_t _allocated_fifos = 1; //FIFO0 is always in use // Will either return an unused FIFO number, or 0 if all are used. -static uint8_t get_free_fifo(void) -{ +static uint8_t get_free_fifo(void) { if (_allocated_fifos < 5) return _allocated_fifos++; return 0; } @@ -226,9 +355,10 @@ static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoin } else { fifo_num = get_free_fifo(); } + //TU_ASSERT(fifo_num != 0); #endif dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos); - dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum)); + dwc2->daintmsk |= TU_BIT(DAINTMSK_IEPM_Pos + epnum); } } @@ -258,7 +388,7 @@ static void edpt_disable(uint8_t rhport, uint8_t ep_addr, bool stall) { } // Flush the FIFO, and wait until we have confirmed it cleared. - fifo_flush_tx(dwc2, epnum); + dfifo_flush_tx(dwc2, epnum); } else { dwc2_epout_t* epout = dwc2->epout; @@ -294,6 +424,8 @@ static void bus_reset(uint8_t rhport) { _sof_en = false; + _allocated_ep_in_count = 1; + // clear device address dwc2->dcfg &= ~DCFG_DAD_Msk; @@ -309,79 +441,28 @@ static void bus_reset(uint8_t rhport) { } } - fifo_flush_tx(dwc2, 0x10); // all tx fifo - fifo_flush_rx(dwc2); + dfifo_flush_tx(dwc2, 0x10); // all tx fifo + dfifo_flush_rx(dwc2); // 3. Set up interrupt mask dwc2->daintmsk = TU_BIT(DAINTMSK_OEPM_Pos) | TU_BIT(DAINTMSK_IEPM_Pos); dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM; dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM; - // "USB Data FIFOs" section in reference manual - // Peripheral FIFO architecture - // - // The FIFO is split up in a lower part where the RX FIFO is located and an upper part where the TX FIFOs start. - // We do this to allow the RX FIFO to grow dynamically which is possible since the free space is located - // between the RX and TX FIFOs. This is required by ISO OUT EPs which need a bigger FIFO than the standard - // configuration done below. - // - // Dynamically FIFO sizes are of interest only for ISO EPs since all others are usually not opened and closed. - // All EPs other than ISO are opened as soon as the driver starts up i.e. when the host sends a - // configure interface command. Hence, all IN EPs other the ISO will be located at the top. IN ISO EPs are usually - // opened when the host sends an additional command: setInterface. At this point in time - // the ISO EP will be located next to the free space and can change its size. In case more IN EPs change its size - // an additional memory - // - // --------------- 320 or 1024 ( 1280 or 4096 bytes ) - // | IN FIFO 0 | - // --------------- (320 or 1024) - 16 - // | IN FIFO 1 | - // --------------- (320 or 1024) - 16 - x - // | . . . . | - // --------------- (320 or 1024) - 16 - x - y - ... - z - // | IN FIFO MAX | - // --------------- - // | FREE | - // --------------- GRXFSIZ - // | OUT FIFO | - // | ( Shared ) | - // --------------- 0 - // - // According to "FIFO RAM allocation" section in RM, FIFO RAM are allocated as follows (each word 32-bits): - // - Each EP IN needs at least max packet size, 16 words is sufficient for EP0 IN - // - // - All EP OUT shared a unique OUT FIFO which uses - // - 13 for setup packets + control words (up to 3 setup packets). - // - 1 for global NAK (not required/used here). - // - Largest-EPsize / 4 + 1. ( FS: 64 bytes, HS: 512 bytes). Recommended is "2 x (Largest-EPsize/4) + 1" - // - 2 for each used OUT endpoint - // - // Therefore GRXFSIZ = 13 + 1 + 1 + 2 x (Largest-EPsize/4) + 2 x EPOUTnum - // - FullSpeed (64 Bytes ): GRXFSIZ = 15 + 2 x 16 + 2 x ep_count = 47 + 2 x ep_count - // - Highspeed (512 bytes): GRXFSIZ = 15 + 2 x 128 + 2 x ep_count = 271 + 2 x ep_count - // - // NOTE: Largest-EPsize & EPOUTnum is actual used endpoints in configuration. Since DCD has no knowledge - // of the overall picture yet. We will use the worst scenario: largest possible + ep_count - // - // For Isochronous, largest EP size can be 1023/1024 for FS/HS respectively. In addition if multiple ISO - // are enabled at least "2 x (Largest-EPsize/4) + 1" are recommended. Maybe provide a macro for application to - // overwrite this. - - // EP0 out max is 64 - dwc2->grxfsiz = calc_grxfsiz(64, ep_count); - - // Setup the control endpoint 0 - _allocated_fifo_words_tx = 16; - - // Control IN uses FIFO 0 with 64 bytes ( 16 32-bit word ) - dwc2->dieptxf0 = (16 << DIEPTXF0_TX0FD_Pos) | (_dwc2_controller[rhport].ep_fifo_size / 4 - _allocated_fifo_words_tx); + dfifo_init(rhport); // Fixed control EP0 size to 64 bytes dwc2->epin[0].diepctl &= ~(0x03 << DIEPCTL_MPSIZ_Pos); + dwc2->epout[0].doepctl &= ~(0x03 << DOEPCTL_MPSIZ_Pos); + xfer_status[0][TUSB_DIR_OUT].max_size = 64; xfer_status[0][TUSB_DIR_IN].max_size = 64; - dwc2->epout[0].doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); + if(dma_enabled(dwc2)) { + dma_setup_prepare(rhport); + } else { + dwc2->epout[0].doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); + } dwc2->gintmsk |= GINTMSK_OEPINT | GINTMSK_IEPINT; } @@ -391,11 +472,11 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c (void) rhport; dwc2_regs_t* dwc2 = DWC2_REG(rhport); + xfer_ctl_t* const xfer = XFER_CTL_BASE(epnum, dir); // EP0 is limited to one packet each xfer // We use multiple transaction of xfer->max_size length to get a whole transfer done if (epnum == 0) { - xfer_ctl_t* const xfer = XFER_CTL_BASE(epnum, dir); total_bytes = tu_min16(ep0_pending[dir], xfer->max_size); ep0_pending[dir] -= total_bytes; } @@ -408,17 +489,31 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c epin[epnum].dieptsiz = (num_packets << DIEPTSIZ_PKTCNT_Pos) | ((total_bytes << DIEPTSIZ_XFRSIZ_Pos) & DIEPTSIZ_XFRSIZ_Msk); - epin[epnum].diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; + if(dma_enabled(dwc2)) { + epin[epnum].diepdma = (uintptr_t)xfer->buffer; - // For ISO endpoint set correct odd/even bit for next frame. - if ((epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { - // Take odd/even bit from frame counter. - uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); - epin[epnum].diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); - } - // Enable fifo empty interrupt only if there are something to put in the fifo. - if (total_bytes != 0) { - dwc2->diepempmsk |= (1 << epnum); + // For ISO endpoint set correct odd/even bit for next frame. + if ((epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); + epin[epnum].diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); + } + + epin[epnum].diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; + } else { + + epin[epnum].diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; + + // For ISO endpoint set correct odd/even bit for next frame. + if ((epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); + epin[epnum].diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); + } + // Enable fifo empty interrupt only if there are something to put in the fifo. + if (total_bytes != 0) { + dwc2->diepempmsk |= (1 << epnum); + } } } else { dwc2_epout_t* epout = dwc2->epout; @@ -428,31 +523,24 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c epout[epnum].doeptsiz |= (num_packets << DOEPTSIZ_PKTCNT_Pos) | ((total_bytes << DOEPTSIZ_XFRSIZ_Pos) & DOEPTSIZ_XFRSIZ_Msk); - epout[epnum].doepctl |= DOEPCTL_EPENA | DOEPCTL_CNAK; if ((epout[epnum].doepctl & DOEPCTL_EPTYP) == DOEPCTL_EPTYP_0 && XFER_CTL_BASE(epnum, dir)->interval == 1) { // Take odd/even bit from frame counter. uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); epout[epnum].doepctl |= (odd_frame_now ? DOEPCTL_SD0PID_SEVNFRM_Msk : DOEPCTL_SODDFRM_Msk); } + + if(dma_enabled(dwc2)) { + epout[epnum].doepdma = (uintptr_t)xfer->buffer; + } + + epout[epnum].doepctl |= DOEPCTL_EPENA | DOEPCTL_CNAK; } } /*------------------------------------------------------------------*/ /* Controller API *------------------------------------------------------------------*/ -#if CFG_TUSB_DEBUG >= DWC2_DEBUG -void print_dwc2_info(dwc2_regs_t* dwc2) { - // print guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4 - // use dwc2_info.py/md for bit-field value and comparison with other ports - volatile uint32_t const* p = (volatile uint32_t const*) &dwc2->guid; - TU_LOG(DWC2_DEBUG, "guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4\r\n"); - for (size_t i = 0; i < 5; i++) { - TU_LOG(DWC2_DEBUG, "0x%08" PRIX32 ", ", p[i]); - } - TU_LOG(DWC2_DEBUG, "0x%08" PRIX32 "\r\n", p[5]); -} -#endif static void reset_core(dwc2_regs_t* dwc2) { // reset core @@ -471,13 +559,10 @@ static void reset_core(dwc2_regs_t* dwc2) { static bool phy_hs_supported(dwc2_regs_t* dwc2) { (void) dwc2; -#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) - // note: esp32 incorrect report its hs_phy_type as utmi - return false; -#elif !TUD_OPT_HIGH_SPEED +#if !TUD_OPT_HIGH_SPEED return false; #else - return dwc2->ghwcfg2_bm.hs_phy_type != HS_PHY_TYPE_NONE; + return dwc2->ghwcfg2_bm.hs_phy_type != GHWCFG2_HSPHY_NOT_SUPPORTED; #endif } @@ -488,7 +573,7 @@ static void phy_fs_init(dwc2_regs_t* dwc2) { dwc2->gusbcfg |= GUSBCFG_PHYSEL; // MCU specific PHY init before reset - dwc2_phy_init(dwc2, HS_PHY_TYPE_NONE); + dwc2_phy_init(dwc2, GHWCFG2_HSPHY_NOT_SUPPORTED); // Reset core after selecting PHY reset_core(dwc2); @@ -499,7 +584,7 @@ static void phy_fs_init(dwc2_regs_t* dwc2) { dwc2->gusbcfg = (dwc2->gusbcfg & ~GUSBCFG_TRDT_Msk) | (5u << GUSBCFG_TRDT_Pos); // MCU specific PHY update post reset - dwc2_phy_update(dwc2, HS_PHY_TYPE_NONE); + dwc2_phy_update(dwc2, GHWCFG2_HSPHY_NOT_SUPPORTED); // set max speed dwc2->dcfg = (dwc2->dcfg & ~DCFG_DSPD_Msk) | (DCFG_DSPD_FS << DCFG_DSPD_Pos); @@ -511,7 +596,7 @@ static void phy_hs_init(dwc2_regs_t* dwc2) { // De-select FS PHY gusbcfg &= ~GUSBCFG_PHYSEL; - if (dwc2->ghwcfg2_bm.hs_phy_type == HS_PHY_TYPE_ULPI) { + if (dwc2->ghwcfg2_bm.hs_phy_type == GHWCFG2_HSPHY_ULPI) { TU_LOG(DWC2_DEBUG, "Highspeed ULPI PHY init\r\n"); // Select ULPI @@ -532,7 +617,9 @@ static void phy_hs_init(dwc2_regs_t* dwc2) { gusbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16); // Set 16-bit interface if supported - if (dwc2->ghwcfg4_bm.utmi_phy_data_width) gusbcfg |= GUSBCFG_PHYIF16; + if (dwc2->ghwcfg4_bm.phy_data_width) { + gusbcfg |= GUSBCFG_PHYIF16; + } } // Apply config @@ -548,7 +635,7 @@ static void phy_hs_init(dwc2_regs_t* dwc2) { // - 9 if using 8-bit PHY interface // - 5 if using 16-bit PHY interface gusbcfg &= ~GUSBCFG_TRDT_Msk; - gusbcfg |= (dwc2->ghwcfg4_bm.utmi_phy_data_width ? 5u : 9u) << GUSBCFG_TRDT_Pos; + gusbcfg |= (dwc2->ghwcfg4_bm.phy_data_width ? 5u : 9u) << GUSBCFG_TRDT_Pos; dwc2->gusbcfg = gusbcfg; // MCU specific PHY update post reset @@ -561,17 +648,26 @@ static void phy_hs_init(dwc2_regs_t* dwc2) { // XCVRDLY: transceiver delay between xcvr_sel and txvalid during device chirp is required // when using with some PHYs such as USB334x (USB3341, USB3343, USB3346, USB3347) - if (dwc2->ghwcfg2_bm.hs_phy_type == HS_PHY_TYPE_ULPI) dcfg |= DCFG_XCVRDLY; + if (dwc2->ghwcfg2_bm.hs_phy_type == GHWCFG2_HSPHY_ULPI) { + dcfg |= DCFG_XCVRDLY; + } dwc2->dcfg = dcfg; } static bool check_dwc2(dwc2_regs_t* dwc2) { #if CFG_TUSB_DEBUG >= DWC2_DEBUG - print_dwc2_info(dwc2); + // print guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4 + // Run 'dwc2_info.py render-md' and check dwc2_info.md for bit-field value and comparison with other ports + volatile uint32_t const* p = (volatile uint32_t const*) &dwc2->guid; + TU_LOG1("guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4\r\n"); + for (size_t i = 0; i < 5; i++) { + TU_LOG1("0x%08" PRIX32 ", ", p[i]); + } + TU_LOG1("0x%08" PRIX32 "\r\n", p[5]); #endif - // For some reasons: GD32VF103 snpsid and all hwcfg register are always zero (skip it) + // For some reason: GD32VF103 snpsid and all hwcfg register are always zero (skip it) (void) dwc2; #if !TU_CHECK_MCU(OPT_MCU_GD32VF103) uint32_t const gsnpsid = dwc2->gsnpsid & GSNPSID_ID_MASK; @@ -587,12 +683,9 @@ void dcd_init(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); // Check Synopsys ID register, failed if controller clock/power is not enabled - if (!check_dwc2(dwc2)) return; + TU_ASSERT(check_dwc2(dwc2), ); dcd_disconnect(rhport); - // max number of endpoints & total_fifo_size are: - // hw_cfg2->num_dev_ep, hw_cfg2->total_fifo_size - if (phy_hs_supported(dwc2)) { phy_hs_init(dwc2); // Highspeed } else { @@ -622,8 +715,8 @@ void dcd_init(uint8_t rhport) { // (non zero-length packet), send STALL back and discard. dwc2->dcfg |= DCFG_NZLSOHSK; - fifo_flush_tx(dwc2, 0x10); // all tx fifo - fifo_flush_rx(dwc2); + dfifo_flush_tx(dwc2, 0x10); // all tx fifo + dfifo_flush_rx(dwc2); // Clear all interrupts uint32_t int_mask = dwc2->gintsts; @@ -632,12 +725,21 @@ void dcd_init(uint8_t rhport) { dwc2->gotgint |= int_mask; // Required as part of core initialization. - dwc2->gintmsk = GINTMSK_OTGINT | GINTMSK_RXFLVLM | - GINTMSK_USBSUSPM | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM; + dwc2->gintmsk = GINTMSK_OTGINT | GINTMSK_USBSUSPM | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM; // Configure TX FIFO empty level for interrupt. Default is complete empty dwc2->gahbcfg |= GAHBCFG_TXFELVL; + if (dma_enabled(dwc2)) { + const uint16_t epinfo_base = dma_cal_epfifo_base(rhport); + dwc2->gdfifocfg = (epinfo_base << GDFIFOCFG_EPINFOBASE_SHIFT) | epinfo_base; + + // DMA seems to be only settable after a core reset + dwc2->gahbcfg |= GAHBCFG_DMAEN | GAHBCFG_HBSTLEN_2; + }else { + dwc2->gintmsk |= GINTMSK_RXFLVLM; + } + // Enable global interrupt dwc2->gahbcfg |= GAHBCFG_GINT; @@ -689,12 +791,34 @@ void dcd_remote_wakeup(uint8_t rhport) { void dcd_connect(uint8_t rhport) { (void) rhport; dwc2_regs_t* dwc2 = DWC2_REG(rhport); + +#ifdef TUP_USBIP_DWC2_ESP32 + usb_wrap_otg_conf_reg_t conf = USB_WRAP.otg_conf; + conf.pad_pull_override = 0; + conf.dp_pullup = 0; + conf.dp_pulldown = 0; + conf.dm_pullup = 0; + conf.dm_pulldown = 0; + USB_WRAP.otg_conf = conf; +#endif + dwc2->dctl &= ~DCTL_SDIS; } void dcd_disconnect(uint8_t rhport) { (void) rhport; dwc2_regs_t* dwc2 = DWC2_REG(rhport); + +#ifdef TUP_USBIP_DWC2_ESP32 + usb_wrap_otg_conf_reg_t conf = USB_WRAP.otg_conf; + conf.pad_pull_override = 1; + conf.dp_pullup = 0; + conf.dp_pulldown = 1; + conf.dm_pullup = 0; + conf.dm_pulldown = 1; + USB_WRAP.otg_conf = conf; +#endif + dwc2->dctl |= DCTL_SDIS; } @@ -718,7 +842,7 @@ void dcd_sof_enable(uint8_t rhport, bool en) { *------------------------------------------------------------------*/ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const* desc_edpt) { - TU_ASSERT(fifo_alloc(rhport, desc_edpt->bEndpointAddress, tu_edpt_packet_size(desc_edpt))); + TU_ASSERT(dfifo_alloc(rhport, desc_edpt->bEndpointAddress, tu_edpt_packet_size(desc_edpt))); edpt_activate(rhport, desc_edpt); return true; } @@ -728,6 +852,8 @@ void dcd_edpt_close_all(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const ep_count = _dwc2_controller[rhport].ep_count; + _allocated_ep_in_count = 1; + // Disable non-control interrupt dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos); @@ -745,30 +871,25 @@ void dcd_edpt_close_all(uint8_t rhport) { xfer_status[n][TUSB_DIR_IN].max_size = 0; } - // reset allocated fifo OUT - dwc2->grxfsiz = calc_grxfsiz(64, ep_count); - // reset allocated fifo IN - _allocated_fifo_words_tx = 16; - #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) _allocated_fifos = 1; #endif - fifo_flush_tx(dwc2, 0x10); // all tx fifo - fifo_flush_rx(dwc2); + dfifo_flush_tx(dwc2, 0x10); // all tx fifo + dfifo_flush_rx(dwc2); + + dfifo_init(rhport); // re-init dfifo } bool dcd_edpt_iso_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t largest_packet_size) { - TU_ASSERT(fifo_alloc(rhport, ep_addr, largest_packet_size)); + TU_ASSERT(dfifo_alloc(rhport, ep_addr, largest_packet_size)); return true; } bool dcd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { // Disable EP to clear potential incomplete transfers edpt_disable(rhport, p_endpoint_desc->bEndpointAddress, false); - edpt_activate(rhport, p_endpoint_desc); - return true; } @@ -835,6 +956,9 @@ void dcd_edpt_close(uint8_t rhport, uint8_t ep_addr) { void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) { edpt_disable(rhport, ep_addr, true); + if((tu_edpt_number(ep_addr) == 0) && dma_enabled(DWC2_REG(rhport))) { + dma_setup_prepare(rhport); + } } void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) { @@ -855,56 +979,9 @@ void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) { } } -/*------------------------------------------------------------------*/ - -// Read a single data packet from receive FIFO -static void read_fifo_packet(uint8_t rhport, uint8_t* dst, uint16_t len) { - (void) rhport; - - dwc2_regs_t* dwc2 = DWC2_REG(rhport); - volatile const uint32_t* rx_fifo = dwc2->fifo[0]; - - // Reading full available 32 bit words from fifo - uint16_t full_words = len >> 2; - while (full_words--) { - tu_unaligned_write32(dst, *rx_fifo); - dst += 4; - } - - // Read the remaining 1-3 bytes from fifo - uint8_t const bytes_rem = len & 0x03; - if (bytes_rem != 0) { - uint32_t const tmp = *rx_fifo; - dst[0] = tu_u32_byte0(tmp); - if (bytes_rem > 1) dst[1] = tu_u32_byte1(tmp); - if (bytes_rem > 2) dst[2] = tu_u32_byte2(tmp); - } -} - -// Write a single data packet to EPIN FIFO -static void write_fifo_packet(uint8_t rhport, uint8_t fifo_num, uint8_t const* src, uint16_t len) { - (void) rhport; - - dwc2_regs_t* dwc2 = DWC2_REG(rhport); - volatile uint32_t* tx_fifo = dwc2->fifo[fifo_num]; - - // Pushing full available 32 bit words to fifo - uint16_t full_words = len >> 2; - while (full_words--) { - *tx_fifo = tu_unaligned_read32(src); - src += 4; - } - - // Write the remaining 1-3 bytes into fifo - uint8_t const bytes_rem = len & 0x03; - if (bytes_rem) { - uint32_t tmp_word = src[0]; - if (bytes_rem > 1) tmp_word |= (src[1] << 8); - if (bytes_rem > 2) tmp_word |= (src[2] << 16); - - *tx_fifo = tmp_word; - } -} +//-------------------------------------------------------------------- +// Interrupt Handler +//-------------------------------------------------------------------- static void handle_rxflvl_irq(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); @@ -958,7 +1035,7 @@ static void handle_rxflvl_irq(uint8_t rhport) { tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void*) (uintptr_t) rx_fifo, bcnt); } else { // Linear buffer - read_fifo_packet(rhport, xfer->buffer, bcnt); + dfifo_read_packet(rhport, xfer->buffer, bcnt); // Increment pointer to xfer data xfer->buffer += bcnt; @@ -982,21 +1059,7 @@ static void handle_rxflvl_irq(uint8_t rhport) { // XFRC complete is additionally generated when // - setup packet is received // - complete the data stage of control write is complete - if ((epnum == 0) && (bcnt == 0) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) { - uint32_t doepint = epout->doepint; - - if (doepint & (DOEPINT_STPKTRX | DOEPINT_OTEPSPR)) { - // skip this "no-data" transfer complete event - // Note: STPKTRX will be clear later by setup received handler - uint32_t clear_flags = DOEPINT_XFRC; - - if (doepint & DOEPINT_OTEPSPR) clear_flags |= DOEPINT_OTEPSPR; - - epout->doepint = clear_flags; - - // TU_LOG(DWC2_DEBUG, " FIX extra transfer complete on setup/data compete\r\n"); - } - } + // It will be handled in handle_epout_irq() break; default: // Invalid @@ -1017,18 +1080,7 @@ static void handle_epout_irq(uint8_t rhport) { uint32_t const doepint = epout->doepint; - // SETUP packet Setup Phase done. - if (doepint & DOEPINT_STUP) { - uint32_t clear_flag = DOEPINT_STUP; - - // STPKTRX is only available for version from 3_00a - if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) { - clear_flag |= DOEPINT_STPKTRX; - } - - epout->doepint = clear_flag; - dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); - } + TU_ASSERT((epout->doepint & DOEPINT_AHBERR) == 0, ); // OUT XFER complete if (epout->doepint & DOEPINT_XFRC) { @@ -1036,13 +1088,65 @@ static void handle_epout_irq(uint8_t rhport) { xfer_ctl_t* xfer = XFER_CTL_BASE(n, TUSB_DIR_OUT); - // EP0 can only handle one packet - if ((n == 0) && ep0_pending[TUSB_DIR_OUT]) { - // Schedule another packet to be received. - edpt_schedule_packets(rhport, n, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); + if(dma_enabled(dwc2)) { + if (doepint & DOEPINT_STUP) { + // STPKTRX is only available for version from 3_00a + if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid > DWC2_CORE_REV_3_00a)) { + epout->doepint = DOEPINT_STPKTRX; + } + } else if (doepint & DOEPINT_OTEPSPR) { + epout->doepint = DOEPINT_OTEPSPR; + } else { + if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid > DWC2_CORE_REV_3_00a)) { + epout->doepint = DOEPINT_STPKTRX; + } else { + // EP0 can only handle one packet + if ((n == 0) && ep0_pending[TUSB_DIR_OUT]) { + // Schedule another packet to be received. + edpt_schedule_packets(rhport, n, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); + } else { + // Fix packet length + uint16_t remain = (epout->doeptsiz & DOEPTSIZ_XFRSIZ_Msk) >> DOEPTSIZ_XFRSIZ_Pos; + xfer->total_len -= remain; + // this is ZLP, so prepare EP0 for next setup + if(n == 0 && xfer->total_len == 0) { + dma_setup_prepare(rhport); + } + + dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true); + } + } + } } else { - dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true); + if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid == DWC2_CORE_REV_3_10a)) { + epout->doepint = DOEPINT_STPKTRX; + } else { + if ((doepint & DOEPINT_OTEPSPR) && (dwc2->gsnpsid == DWC2_CORE_REV_3_10a)) { + epout->doepint = DOEPINT_OTEPSPR; + } + + // EP0 can only handle one packet + if ((n == 0) && ep0_pending[TUSB_DIR_OUT]) { + // Schedule another packet to be received. + edpt_schedule_packets(rhport, n, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); + } else { + dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true); + } + } + } + } + + // SETUP packet Setup Phase done. + if (doepint & DOEPINT_STUP) { + epout->doepint = DOEPINT_STUP; + if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid > DWC2_CORE_REV_3_00a)) { + epout->doepint = DOEPINT_STPKTRX; } + if(dma_enabled(dwc2) && (dwc2->gsnpsid > DWC2_CORE_REV_3_00a)) { + dma_setup_prepare(rhport); + } + + dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); } } } @@ -1068,6 +1172,9 @@ static void handle_epin_irq(uint8_t rhport) { // Schedule another packet to be transmitted. edpt_schedule_packets(rhport, n, TUSB_DIR_IN, 1, ep0_pending[TUSB_DIR_IN]); } else { + if((n == 0) && dma_enabled(dwc2)) { + dma_setup_prepare(rhport); + } dcd_event_xfer_complete(rhport, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); } } @@ -1097,7 +1204,7 @@ static void handle_epin_irq(uint8_t rhport) { volatile uint32_t* tx_fifo = dwc2->fifo[n]; tu_fifo_read_n_const_addr_full_words(xfer->ff, (void*) (uintptr_t) tx_fifo, packet_size); } else { - write_fifo_packet(rhport, n, xfer->buffer, packet_size); + dfifo_write_packet(rhport, n, xfer->buffer, packet_size); // Increment pointer to xfer data xfer->buffer += packet_size; @@ -1231,25 +1338,13 @@ void dcd_int_handler(uint8_t rhport) { // } } -#if defined(TUP_USBIP_DWC2_TEST_MODE) && CFG_TUD_TEST_MODE - -bool dcd_check_test_mode_support(test_mode_t test_selector) { - // Check if test mode selector is unsupported - if (TEST_FORCE_ENABLE < test_selector || TEST_J > test_selector) { - return false; - } - - return true; -} - -void dcd_enter_test_mode(uint8_t rhport, test_mode_t test_selector) { - // Get port address... +#if CFG_TUD_TEST_MODE +void dcd_enter_test_mode(uint8_t rhport, tusb_feature_test_mode_t test_selector) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); // Enable the test mode - dwc2->dctl = (dwc2->dctl & ~DCTL_TCTL_Msk) | (test_selector << DCTL_TCTL_Pos); + dwc2->dctl = (dwc2->dctl & ~DCTL_TCTL_Msk) | (((uint8_t) test_selector) << DCTL_TCTL_Pos); } - -#endif /* TUP_USBIP_DWC2_TEST_MODE && CFG_TUD_TEST_MODE */ +#endif #endif From 4991c68ea6ab4379cd4bf70f5df97e22705ae8bb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:34:20 +0200 Subject: [PATCH 541/636] Update and rename dcd_esp32sx.c to dcd_dwc2.patch --- .../arduino_tinyusb/patches/dcd_dwc2.patch | 83 ++ components/arduino_tinyusb/src/dcd_esp32sx.c | 965 ------------------ 2 files changed, 83 insertions(+), 965 deletions(-) create mode 100755 components/arduino_tinyusb/patches/dcd_dwc2.patch delete mode 100755 components/arduino_tinyusb/src/dcd_esp32sx.c diff --git a/components/arduino_tinyusb/patches/dcd_dwc2.patch b/components/arduino_tinyusb/patches/dcd_dwc2.patch new file mode 100755 index 000000000..7aef99c33 --- /dev/null +++ b/components/arduino_tinyusb/patches/dcd_dwc2.patch @@ -0,0 +1,83 @@ +--- a/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:17:40.000000000 +0300 ++++ b/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:19:48.000000000 +0300 +@@ -316,6 +316,16 @@ + //-------------------------------------------------------------------- + // Endpoint + //-------------------------------------------------------------------- ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++// Keep count of how many FIFOs are in use ++static uint8_t _allocated_fifos = 1; //FIFO0 is always in use ++ ++// Will either return an unused FIFO number, or 0 if all are used. ++static uint8_t get_free_fifo(void) { ++ if (_allocated_fifos < 5) return _allocated_fifos++; ++ return 0; ++} ++#endif + + static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); +@@ -336,7 +346,18 @@ + dwc2->epout[epnum].doepctl = dxepctl; + dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum); + } else { +- dwc2->epin[epnum].diepctl = dxepctl | (epnum << DIEPCTL_TXFNUM_Pos); ++ uint8_t fifo_num = epnum; ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ // Special Case for EP5, which is used by CDC but not actually called by the driver ++ // we can give it a fake FIFO ++ if (epnum == 5) { ++ fifo_num = epnum; ++ } else { ++ fifo_num = get_free_fifo(); ++ } ++ //TU_ASSERT(fifo_num != 0); ++#endif ++ dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos); + dwc2->daintmsk |= TU_BIT(DAINTMSK_IEPM_Pos + epnum); + } + } +@@ -850,6 +871,10 @@ + xfer_status[n][TUSB_DIR_IN].max_size = 0; + } + ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ _allocated_fifos = 1; ++#endif ++ + dfifo_flush_tx(dwc2, 0x10); // all tx fifo + dfifo_flush_rx(dwc2); + +@@ -1204,6 +1229,9 @@ + if (int_status & GINTSTS_USBRST) { + // USBRST is start of reset. + dwc2->gintsts = GINTSTS_USBRST; ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ _allocated_fifos = 1; ++#endif + bus_reset(rhport); + } + +@@ -1235,7 +1263,11 @@ + + if (int_status & GINTSTS_USBSUSP) { + dwc2->gintsts = GINTSTS_USBSUSP; +- dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); ++ //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); ++ dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ _allocated_fifos = 1; ++#endif + } + + if (int_status & GINTSTS_WKUINT) { +@@ -1252,6 +1284,9 @@ + + if (otg_int & GOTGINT_SEDET) { + dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); ++#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) ++ _allocated_fifos = 1; ++#endif + } + + dwc2->gotgint = otg_int; diff --git a/components/arduino_tinyusb/src/dcd_esp32sx.c b/components/arduino_tinyusb/src/dcd_esp32sx.c deleted file mode 100755 index 324aad595..000000000 --- a/components/arduino_tinyusb/src/dcd_esp32sx.c +++ /dev/null @@ -1,965 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2018 Scott Shawcroft, 2019 William D. Jones for Adafruit Industries - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * Additions Copyright (c) 2020, Espressif Systems (Shanghai) Co. Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * This file is part of the TinyUSB stack. - */ - -#include "tusb_option.h" - -#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && CFG_TUD_ENABLED) - -// Espressif -#include "freertos/xtensa_api.h" -#include "esp_intr_alloc.h" -#include "esp_log.h" -#include "soc/dport_reg.h" -#include "soc/gpio_sig_map.h" -#include "soc/usb_periph.h" -#include "soc/usb_reg.h" -#include "soc/usb_struct.h" -#include "soc/periph_defs.h" // for interrupt source -#include "soc/usb_wrap_struct.h" - -#include "device/dcd.h" - -#ifndef USB_OUT_EP_NUM -#define USB_OUT_EP_NUM ((int) (sizeof(USB0.out_ep_reg) / sizeof(USB0.out_ep_reg[0]))) -#endif - -#ifndef USB_IN_EP_NUM -#define USB_IN_EP_NUM ((int) (sizeof(USB0.in_ep_reg) / sizeof(USB0.in_ep_reg[0]))) -#endif - -// Max number of bi-directional endpoints including EP0 -// Note: ESP32S2 specs say there are only up to 5 IN active endpoints include EP0 -// We should probably prohibit enabling Endpoint IN > 4 (not done yet) -#define EP_MAX USB_OUT_EP_NUM - -// FIFO size in bytes -#define EP_FIFO_SIZE 1024 - -// Max number of IN EP FIFOs -#define EP_FIFO_NUM 5 - -typedef struct { - uint8_t *buffer; - // tu_fifo_t * ff; // TODO support dcd_edpt_xfer_fifo API - uint16_t total_len; - uint16_t queued_len; - uint16_t max_size; - bool short_packet; - uint8_t interval; -} xfer_ctl_t; - -static const char *TAG = "TUSB:DCD"; -static intr_handle_t usb_ih; - - -static uint32_t _setup_packet[2]; - -#define XFER_CTL_BASE(_ep, _dir) &xfer_status[_ep][_dir] -static xfer_ctl_t xfer_status[EP_MAX][2]; - -// Keep count of how many FIFOs are in use -static uint8_t _allocated_fifos = 1; //FIFO0 is always in use - -// Will either return an unused FIFO number, or 0 if all are used. -static uint8_t get_free_fifo(void) -{ - if (_allocated_fifos < EP_FIFO_NUM) return _allocated_fifos++; - return 0; -} - -// Setup the control endpoint 0. -static void bus_reset(void) -{ - for (int ep_num = 0; ep_num < USB_OUT_EP_NUM; ep_num++) { - USB0.out_ep_reg[ep_num].doepctl |= USB_DO_SNAK0_M; // DOEPCTL0_SNAK - } - - // clear device address - USB0.dcfg &= ~USB_DEVADDR_M; - - USB0.daintmsk = USB_OUTEPMSK0_M | USB_INEPMSK0_M; - USB0.doepmsk = USB_SETUPMSK_M | USB_XFERCOMPLMSK; - USB0.diepmsk = USB_TIMEOUTMSK_M | USB_DI_XFERCOMPLMSK_M /*| USB_INTKNTXFEMPMSK_M*/; - - // "USB Data FIFOs" section in reference manual - // Peripheral FIFO architecture - // - // --------------- 320 or 1024 ( 1280 or 4096 bytes ) - // | IN FIFO MAX | - // --------------- - // | ... | - // --------------- y + x + 16 + GRXFSIZ - // | IN FIFO 2 | - // --------------- x + 16 + GRXFSIZ - // | IN FIFO 1 | - // --------------- 16 + GRXFSIZ - // | IN FIFO 0 | - // --------------- GRXFSIZ - // | OUT FIFO | - // | ( Shared ) | - // --------------- 0 - // - // According to "FIFO RAM allocation" section in RM, FIFO RAM are allocated as follows (each word 32-bits): - // - Each EP IN needs at least max packet size, 16 words is sufficient for EP0 IN - // - // - All EP OUT shared a unique OUT FIFO which uses - // * 10 locations in hardware for setup packets + setup control words (up to 3 setup packets). - // * 2 locations for OUT endpoint control words. - // * 16 for largest packet size of 64 bytes. ( TODO Highspeed is 512 bytes) - // * 1 location for global NAK (not required/used here). - // * It is recommended to allocate 2 times the largest packet size, therefore - // Recommended value = 10 + 1 + 2 x (16+2) = 47 --> Let's make it 52 - USB0.grstctl |= 0x10 << USB_TXFNUM_S; // fifo 0x10, - USB0.grstctl |= USB_TXFFLSH_M; // Flush fifo - USB0.grxfsiz = 52; - - // Control IN uses FIFO 0 with 64 bytes ( 16 32-bit word ) - USB0.gnptxfsiz = (16 << USB_NPTXFDEP_S) | (USB0.grxfsiz & 0x0000ffffUL); - - // Ready to receive SETUP packet - USB0.out_ep_reg[0].doeptsiz |= USB_SUPCNT0_M; - - USB0.gintmsk |= USB_IEPINTMSK_M | USB_OEPINTMSK_M; -} - -static void enum_done_processing(void) -{ - ESP_EARLY_LOGV(TAG, "dcd_int_handler - Speed enumeration done! Sending DCD_EVENT_BUS_RESET then"); - // On current silicon on the Full Speed core, speed is fixed to Full Speed. - // However, keep for debugging and in case Low Speed is ever supported. - uint32_t enum_spd = (USB0.dsts >> USB_ENUMSPD_S) & (USB_ENUMSPD_V); - - // Maximum packet size for EP 0 is set for both directions by writing DIEPCTL - if (enum_spd == 0x03) { // Full-Speed (PHY on 48 MHz) - USB0.in_ep_reg[0].diepctl &= ~USB_D_MPS0_V; // 64 bytes - USB0.in_ep_reg[0].diepctl &= ~USB_D_STALL0_M; // clear Stall - xfer_status[0][TUSB_DIR_OUT].max_size = 64; - xfer_status[0][TUSB_DIR_IN].max_size = 64; - } else { - USB0.in_ep_reg[0].diepctl |= USB_D_MPS0_V; // 8 bytes - USB0.in_ep_reg[0].diepctl &= ~USB_D_STALL0_M; // clear Stall - xfer_status[0][TUSB_DIR_OUT].max_size = 8; - xfer_status[0][TUSB_DIR_IN].max_size = 8; - } -} - - -/*------------------------------------------------------------------*/ -/* Controller API - *------------------------------------------------------------------*/ -void dcd_init(uint8_t rhport) -{ - ESP_LOGV(TAG, "DCD init - Start"); - - bool did_persist = (USB_WRAP.date.val & (1 << 31)) != 0; - - if (did_persist) { - //Clear persistence of USB peripheral through reset - USB_WRAP.date.val = 0; - } else { - // A. Disconnect - ESP_LOGV(TAG, "DCD init - Soft DISCONNECT and Setting up"); - USB0.dctl |= USB_SFTDISCON_M; // Soft disconnect - - // B. Programming DCFG - /* If USB host misbehaves during status portion of control xfer - (non zero-length packet), send STALL back and discard. Full speed. */ - USB0.dcfg |= USB_NZSTSOUTHSHK_M | // NonZero .... STALL - (3 << 0); // dev speed: fullspeed 1.1 on 48 mhz // TODO no value in usb_reg.h (IDF-1476) - } - - USB0.gahbcfg |= USB_NPTXFEMPLVL_M | USB_GLBLLNTRMSK_M; // Global interruptions ON - USB0.gusbcfg |= USB_FORCEDEVMODE_M; // force devmode - USB0.gotgctl &= ~(USB_BVALIDOVVAL_M | USB_BVALIDOVEN_M | USB_VBVALIDOVVAL_M); //no overrides - - // C. Setting SNAKs, then connect - for (int n = 0; n < USB_OUT_EP_NUM; n++) { - USB0.out_ep_reg[n].doepctl |= USB_DO_SNAK0_M; // DOEPCTL0_SNAK - } - - if (!did_persist) { - // D. Interruption masking - USB0.gintmsk = 0; //mask all - USB0.gotgint = ~0U; //clear OTG ints - USB0.gintsts = ~0U; //clear pending ints - } - - USB0.gintmsk = USB_OTGINTMSK_M | - USB_MODEMISMSK_M | - USB_RXFLVIMSK_M | - USB_ERLYSUSPMSK_M | - USB_USBSUSPMSK_M | - USB_USBRSTMSK_M | - USB_ENUMDONEMSK_M | - USB_RESETDETMSK_M | - USB_DISCONNINTMSK_M; // host most only - if (did_persist) { - USB0.grstctl &= ~USB_TXFNUM_M; - USB0.grstctl |= 0x10 << USB_TXFNUM_S; - USB0.grstctl |= USB_TXFFLSH; - USB0.grxfsiz = 52; - - for (int n = 0; n < USB_IN_EP_NUM; n++) { - USB0.in_ep_reg[n].diepint = USB_D_XFERCOMPL0_M | USB_D_TXFEMP0_M; - USB0.in_ep_reg[n].diepctl &= ~USB_D_STALL0_M; // clear Stall - USB0.in_ep_reg[n].diepctl |= USB_D_CNAK0 | USB_D_EPENA0; // clear NAK - } - USB0.dtknqr4_fifoemptymsk &= ~(0x7F); - - USB0.gnptxfsiz = (16 << USB_NPTXFDEP_S) | (USB0.grxfsiz & 0x0000ffffUL); - - USB0.daintmsk |= USB_OUTEPMSK0_M | USB_INEPMSK0_M; - USB0.doepmsk |= USB_SETUP0 | USB_XFERCOMPLMSK; - USB0.diepmsk |= USB_TIMEOUTMSK_M | USB_DI_XFERCOMPLMSK_M;//USB_INEPNAKEFFMSK - - USB0.gintmsk |= USB_IEPINTMSK_M | USB_OEPINTMSK_M; - USB0.gotgint = ~0; //clear OTG ints - USB0.gintsts = ~0; //clear pending ints - enum_done_processing(); - dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET, true); - tusb_control_request_t request = { - .bmRequestType_bit = { .recipient = TUSB_REQ_RCPT_DEVICE, .type = TUSB_REQ_TYPE_STANDARD, .direction = TUSB_DIR_OUT }, - .bRequest = TUSB_REQ_SET_CONFIGURATION, - .wValue = 1, - .wIndex = 0, - .wLength = 0 - }; - dcd_event_setup_received(0, (uint8_t *)&request, true); - } else { - dcd_connect(rhport); - } -} - -void dcd_set_address(uint8_t rhport, uint8_t dev_addr) -{ - (void)rhport; - ESP_LOGV(TAG, "DCD init - Set address : %u", dev_addr); - USB0.dcfg |= ((dev_addr & USB_DEVADDR_V) << USB_DEVADDR_S); - // Response with status after changing device address - dcd_edpt_xfer(rhport, tu_edpt_addr(0, TUSB_DIR_IN), NULL, 0); -} - -void dcd_remote_wakeup(uint8_t rhport) -{ - (void)rhport; - - // set remote wakeup - USB0.dctl |= USB_RMTWKUPSIG_M; - - // enable SOF to detect bus resume - USB0.gintsts = USB_SOF_M; - USB0.gintmsk |= USB_SOFMSK_M; - - // Per specs: remote wakeup signal bit must be clear within 1-15ms - vTaskDelay(pdMS_TO_TICKS(1)); - - USB0.dctl &= ~USB_RMTWKUPSIG_M; -} - -// connect by enabling internal pull-up resistor on D+/D- -void dcd_connect(uint8_t rhport) -{ - (void) rhport; - USB0.dctl &= ~USB_SFTDISCON_M; -} - -// disconnect by disabling internal pull-up resistor on D+/D- -void dcd_disconnect(uint8_t rhport) -{ - (void) rhport; - USB0.dctl |= USB_SFTDISCON_M; -} - -void dcd_sof_enable(uint8_t rhport, bool en) -{ - (void) rhport; - (void) en; - - // TODO implement later -} - -/*------------------------------------------------------------------*/ -/* DCD Endpoint port - *------------------------------------------------------------------*/ - -bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const *desc_edpt) -{ - ESP_LOGV(TAG, "DCD endpoint opened"); - (void)rhport; - - usb_out_endpoint_t *out_ep = &(USB0.out_ep_reg[0]); - usb_in_endpoint_t *in_ep = &(USB0.in_ep_reg[0]); - - uint8_t const epnum = tu_edpt_number(desc_edpt->bEndpointAddress); - uint8_t const dir = tu_edpt_dir(desc_edpt->bEndpointAddress); - - TU_ASSERT(epnum < EP_MAX); - - xfer_ctl_t *xfer = XFER_CTL_BASE(epnum, dir); - xfer->max_size = tu_edpt_packet_size(desc_edpt); - xfer->interval = desc_edpt->bInterval; - - if (dir == TUSB_DIR_OUT) { - out_ep[epnum].doepctl &= ~(USB_D_EPTYPE0_M | USB_D_MPS0_M); - out_ep[epnum].doepctl |= USB_USBACTEP1_M | - desc_edpt->bmAttributes.xfer << USB_EPTYPE1_S | - (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? USB_DO_SETD0PID1_M : 0) | - xfer->max_size << USB_MPS1_S; - USB0.daintmsk |= (1 << (16 + epnum)); - } else { - // "USB Data FIFOs" section in reference manual - // Peripheral FIFO architecture - // - // --------------- 320 or 1024 ( 1280 or 4096 bytes ) - // | IN FIFO MAX | - // --------------- - // | ... | - // --------------- y + x + 16 + GRXFSIZ - // | IN FIFO 2 | - // --------------- x + 16 + GRXFSIZ - // | IN FIFO 1 | - // --------------- 16 + GRXFSIZ - // | IN FIFO 0 | - // --------------- GRXFSIZ - // | OUT FIFO | - // | ( Shared ) | - // --------------- 0 - // - // Since OUT FIFO = GRXFSIZ, FIFO 0 = 16, for simplicity, we equally allocated for the rest of endpoints - // - Size : (FIFO_SIZE/4 - GRXFSIZ - 16) / (EP_MAX-1) - // - Offset: GRXFSIZ + 16 + Size*(epnum-1) - // - IN EP 1 gets FIFO 1, IN EP "n" gets FIFO "n". - - uint8_t fifo_num = 0; - // Special Case for EP5, which is used by CDC but not actually called by the driver - // we can give it a fake FIFO - if (epnum == 5) { - fifo_num = EP_FIFO_NUM; - } else { - fifo_num = get_free_fifo(); - } - TU_ASSERT(fifo_num != 0); - - in_ep[epnum].diepctl &= ~(USB_D_TXFNUM1_M | USB_D_EPTYPE1_M | USB_DI_SETD0PID1 | USB_D_MPS1_M); - in_ep[epnum].diepctl |= USB_D_USBACTEP1_M | - fifo_num << USB_D_TXFNUM1_S | - desc_edpt->bmAttributes.xfer << USB_D_EPTYPE1_S | - (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? (1 << USB_DI_SETD0PID1_S) : 0) | - xfer->max_size << 0; - - USB0.daintmsk |= (1 << (0 + epnum)); - - // Both TXFD and TXSA are in unit of 32-bit words. - // IN FIFO 0 was configured during enumeration, hence the "+ 16". - uint16_t const allocated_size = (USB0.grxfsiz & 0x0000ffff) + 16; - uint16_t const fifo_size = (EP_FIFO_SIZE/4 - allocated_size) / (EP_FIFO_NUM-1); - uint32_t const fifo_offset = allocated_size + fifo_size*(fifo_num-1); - - // DIEPTXF starts at FIFO #1. - USB0.dieptxf[epnum - 1] = (fifo_size << USB_NPTXFDEP_S) | fifo_offset; - } - return true; -} - -void dcd_edpt_close_all(uint8_t rhport) -{ - (void) rhport; - - usb_out_endpoint_t *out_ep = &(USB0.out_ep_reg[0]); - usb_in_endpoint_t *in_ep = &(USB0.in_ep_reg[0]); - - // Disable non-control interrupt - USB0.daintmsk = USB_OUTEPMSK0_M | USB_INEPMSK0_M; - - for(uint8_t n = 1; n < EP_MAX; n++) - { - // disable OUT endpoint - out_ep[n].doepctl = 0; - xfer_status[n][TUSB_DIR_OUT].max_size = 0; - - // disable IN endpoint - in_ep[n].diepctl = 0; - xfer_status[n][TUSB_DIR_IN].max_size = 0; - } - - _allocated_fifos = 1; -} - -bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t total_bytes) -{ - (void)rhport; - - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); - - xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir); - xfer->buffer = buffer; - // xfer->ff = NULL; // TODO support dcd_edpt_xfer_fifo API - xfer->total_len = total_bytes; - xfer->queued_len = 0; - xfer->short_packet = false; - - uint16_t num_packets = (total_bytes / xfer->max_size); - uint8_t short_packet_size = total_bytes % xfer->max_size; - - // Zero-size packet is special case. - if (short_packet_size > 0 || (total_bytes == 0)) { - num_packets++; - } - - ESP_LOGV(TAG, "Transfer <-> EP%i, %s, pkgs: %i, bytes: %i", - epnum, ((dir == TUSB_DIR_IN) ? "USB0.HOST (in)" : "HOST->DEV (out)"), - num_packets, total_bytes); - - // IN and OUT endpoint xfers are interrupt-driven, we just schedule them - // here. - if (dir == TUSB_DIR_IN) { - // A full IN transfer (multiple packets, possibly) triggers XFRC. - USB0.in_ep_reg[epnum].dieptsiz = (num_packets << USB_D_PKTCNT0_S) | total_bytes; - USB0.in_ep_reg[epnum].diepctl |= USB_D_EPENA1_M | USB_D_CNAK1_M; // Enable | CNAK - - // For ISO endpoint with interval=1 set correct DATA0/DATA1 bit for next frame - if ((USB0.in_ep_reg[epnum].diepctl & USB_D_EPTYPE0_M) == (1 << USB_D_EPTYPE1_S) && xfer->interval == 1) { - // Take odd/even bit from frame counter. - uint32_t const odd_frame_now = (USB0.dsts & (1u << USB_SOFFN_S)); - USB0.in_ep_reg[epnum].diepctl |= (odd_frame_now ? USB_DI_SETD0PID1 : USB_DI_SETD1PID1); - } - - // Enable fifo empty interrupt only if there are something to put in the fifo. - if(total_bytes != 0) { - USB0.dtknqr4_fifoemptymsk |= (1 << epnum); - } - } else { - // Each complete packet for OUT xfers triggers XFRC. - USB0.out_ep_reg[epnum].doeptsiz |= USB_PKTCNT0_M | ((xfer->max_size & USB_XFERSIZE0_V) << USB_XFERSIZE0_S); - USB0.out_ep_reg[epnum].doepctl |= USB_EPENA0_M | USB_CNAK0_M; - - // For ISO endpoint with interval=1 set correct DATA0/DATA1 bit for next frame - if ((USB0.out_ep_reg[epnum].doepctl & USB_D_EPTYPE0_M) == (1 << USB_D_EPTYPE1_S) && xfer->interval == 1) { - // Take odd/even bit from frame counter. - uint32_t const odd_frame_now = (USB0.dsts & (1u << USB_SOFFN_S)); - USB0.out_ep_reg[epnum].doepctl |= (odd_frame_now ? USB_DO_SETD0PID1 : USB_DO_SETD1PID1); - } - } - return true; -} - -#if 0 // TODO support dcd_edpt_xfer_fifo API -bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes) -{ - (void)rhport; -} -#endif - -void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) -{ - (void)rhport; - - usb_out_endpoint_t *out_ep = &(USB0.out_ep_reg[0]); - usb_in_endpoint_t *in_ep = &(USB0.in_ep_reg[0]); - - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); - - if (dir == TUSB_DIR_IN) { - // Only disable currently enabled non-control endpoint - if ((epnum == 0) || !(in_ep[epnum].diepctl & USB_D_EPENA1_M)) { - in_ep[epnum].diepctl |= (USB_DI_SNAK1_M | USB_D_STALL1_M); - } else { - // Stop transmitting packets and NAK IN xfers. - in_ep[epnum].diepctl |= USB_DI_SNAK1_M; - // while ((in_ep[epnum].diepint & USB_DI_SNAK1_M) == 0) ; - while ((in_ep[epnum].diepint & USB_D_INEPNAKEFF1_M) == 0) ; - - // Disable the endpoint. Note that both SNAK and STALL are set here. - in_ep[epnum].diepctl |= (USB_DI_SNAK1_M | USB_D_STALL1_M | USB_D_EPDIS1_M); - while ((in_ep[epnum].diepint & USB_D_EPDISBLD0_M) == 0) ; - in_ep[epnum].diepint = USB_D_EPDISBLD0_M; - } - - // Flush the FIFO, and wait until we have confirmed it cleared. - uint8_t const fifo_num = ((in_ep[epnum].diepctl >> USB_D_TXFNUM1_S) & USB_D_TXFNUM1_V); - // USB0.grstctl |= (fifo_num << USB_TXFNUM_S); - // USB0.grstctl |= USB_TXFFLSH_M; - // while ((USB0.grstctl & USB_TXFFLSH_M) != 0) ; - uint32_t rstctl_last = USB0.grstctl; - uint32_t rstctl = USB_TXFFLSH_M; - rstctl |= (fifo_num << USB_TXFNUM_S); - USB0.grstctl = rstctl; - while ((USB0.grstctl & USB_TXFFLSH_M) != 0) ; - USB0.grstctl = rstctl_last; - // TODO: Clear grstctl::fifo_num after fifo flsh - } else { - // Only disable currently enabled non-control endpoint - if ((epnum == 0) || !(out_ep[epnum].doepctl & USB_EPENA0_M)) { - out_ep[epnum].doepctl |= USB_STALL0_M; - } else { - // Asserting GONAK is required to STALL an OUT endpoint. - // Simpler to use polling here, we don't use the "B"OUTNAKEFF interrupt - // anyway, and it can't be cleared by user code. If this while loop never - // finishes, we have bigger problems than just the stack. - USB0.dctl |= USB_SGOUTNAK_M; - while ((USB0.gintsts & USB_GOUTNAKEFF_M) == 0) ; - - // Ditto here- disable the endpoint. Note that only STALL and not SNAK - // is set here. - out_ep[epnum].doepctl |= (USB_STALL0_M | USB_EPDIS0_M); - while ((out_ep[epnum].doepint & USB_EPDISBLD0_M) == 0) ; - out_ep[epnum].doepint = USB_EPDISBLD0_M; - - // Allow other OUT endpoints to keep receiving. - USB0.dctl |= USB_CGOUTNAK_M; - } - } -} - -void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) -{ - (void)rhport; - - usb_out_endpoint_t *out_ep = &(USB0.out_ep_reg[0]); - usb_in_endpoint_t *in_ep = &(USB0.in_ep_reg[0]); - - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); - - if (dir == TUSB_DIR_IN) { - in_ep[epnum].diepctl &= ~USB_D_STALL1_M; - - uint8_t eptype = (in_ep[epnum].diepctl & USB_D_EPTYPE1_M) >> USB_D_EPTYPE1_S; - // Required by USB spec to reset DATA toggle bit to DATA0 on interrupt - // and bulk endpoints. - if (eptype == 2 || eptype == 3) { - in_ep[epnum].diepctl |= USB_DI_SETD0PID1_M; - } - } else { - out_ep[epnum].doepctl &= ~USB_STALL1_M; - - uint8_t eptype = (out_ep[epnum].doepctl & USB_EPTYPE1_M) >> USB_EPTYPE1_S; - // Required by USB spec to reset DATA toggle bit to DATA0 on interrupt - // and bulk endpoints. - if (eptype == 2 || eptype == 3) { - out_ep[epnum].doepctl |= USB_DO_SETD0PID1_M; - } - } -} - -/*------------------------------------------------------------------*/ - -static void receive_packet(xfer_ctl_t *xfer, /* usb_out_endpoint_t * out_ep, */ uint16_t xfer_size) -{ - ESP_EARLY_LOGV(TAG, "USB - receive_packet"); - volatile uint32_t *rx_fifo = USB0.fifo[0]; - - // See above TODO - // uint16_t remaining = (out_ep->DOEPTSIZ & UsbDOEPTSIZ_XFRSIZ_Msk) >> UsbDOEPTSIZ_XFRSIZ_Pos; - // xfer->queued_len = xfer->total_len - remaining; - - uint16_t remaining = xfer->total_len - xfer->queued_len; - uint16_t to_recv_size; - - if (remaining <= xfer->max_size) { - // Avoid buffer overflow. - to_recv_size = (xfer_size > remaining) ? remaining : xfer_size; - } else { - // Room for full packet, choose recv_size based on what the microcontroller - // claims. - to_recv_size = (xfer_size > xfer->max_size) ? xfer->max_size : xfer_size; - } - - // Common buffer read -#if 0 // TODO support dcd_edpt_xfer_fifo API - if (xfer->ff) - { - // Ring buffer - tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void *) rx_fifo, to_recv_size); - } - else -#endif - { - uint8_t to_recv_rem = to_recv_size % 4; - uint16_t to_recv_size_aligned = to_recv_size - to_recv_rem; - - // Do not assume xfer buffer is aligned. - uint8_t *base = (xfer->buffer + xfer->queued_len); - - // This for loop always runs at least once- skip if less than 4 bytes - // to collect. - if (to_recv_size >= 4) { - for (uint16_t i = 0; i < to_recv_size_aligned; i += 4) { - uint32_t tmp = (*rx_fifo); - base[i] = tmp & 0x000000FF; - base[i + 1] = (tmp & 0x0000FF00) >> 8; - base[i + 2] = (tmp & 0x00FF0000) >> 16; - base[i + 3] = (tmp & 0xFF000000) >> 24; - } - } - - // Do not read invalid bytes from RX FIFO. - if (to_recv_rem != 0) { - uint32_t tmp = (*rx_fifo); - uint8_t *last_32b_bound = base + to_recv_size_aligned; - - last_32b_bound[0] = tmp & 0x000000FF; - if (to_recv_rem > 1) { - last_32b_bound[1] = (tmp & 0x0000FF00) >> 8; - } - if (to_recv_rem > 2) { - last_32b_bound[2] = (tmp & 0x00FF0000) >> 16; - } - } - } - - xfer->queued_len += xfer_size; - - // Per USB spec, a short OUT packet (including length 0) is always - // indicative of the end of a transfer (at least for ctl, bulk, int). - xfer->short_packet = (xfer_size < xfer->max_size); -} - -static void transmit_packet(xfer_ctl_t *xfer, volatile usb_in_endpoint_t *in_ep, uint8_t fifo_num) -{ - ESP_EARLY_LOGV(TAG, "USB - transmit_packet"); - volatile uint32_t *tx_fifo = USB0.fifo[fifo_num]; - - uint16_t remaining = (in_ep->dieptsiz & 0x7FFFFU) >> USB_D_XFERSIZE0_S; - xfer->queued_len = xfer->total_len - remaining; - - uint16_t to_xfer_size = (remaining > xfer->max_size) ? xfer->max_size : remaining; - -#if 0 // TODO support dcd_edpt_xfer_fifo API - if (xfer->ff) - { - tu_fifo_read_n_const_addr_full_words(xfer->ff, (void *) tx_fifo, to_xfer_size); - } - else -#endif - { - uint8_t to_xfer_rem = to_xfer_size % 4; - uint16_t to_xfer_size_aligned = to_xfer_size - to_xfer_rem; - - // Buffer might not be aligned to 32b, so we need to force alignment - // by copying to a temp var. - uint8_t *base = (xfer->buffer + xfer->queued_len); - - // This for loop always runs at least once- skip if less than 4 bytes - // to send off. - if (to_xfer_size >= 4) { - for (uint16_t i = 0; i < to_xfer_size_aligned; i += 4) { - uint32_t tmp = base[i] | (base[i + 1] << 8) | - (base[i + 2] << 16) | (base[i + 3] << 24); - (*tx_fifo) = tmp; - } - } - - // Do not read beyond end of buffer if not divisible by 4. - if (to_xfer_rem != 0) { - uint32_t tmp = 0; - uint8_t *last_32b_bound = base + to_xfer_size_aligned; - - tmp |= last_32b_bound[0]; - if (to_xfer_rem > 1) { - tmp |= (last_32b_bound[1] << 8); - } - if (to_xfer_rem > 2) { - tmp |= (last_32b_bound[2] << 16); - } - - (*tx_fifo) = tmp; - } - } -} - -static void read_rx_fifo(void) -{ - // Pop control word off FIFO (completed xfers will have 2 control words, - // we only pop one ctl word each interrupt). - uint32_t const ctl_word = USB0.grxstsp; - uint8_t const pktsts = (ctl_word & USB_PKTSTS_M) >> USB_PKTSTS_S; - uint8_t const epnum = (ctl_word & USB_CHNUM_M ) >> USB_CHNUM_S; - uint16_t const bcnt = (ctl_word & USB_BCNT_M ) >> USB_BCNT_S; - - switch (pktsts) { - case 0x01: // Global OUT NAK (Interrupt) - ESP_EARLY_LOGV(TAG, "TUSB IRQ - RX type : Global OUT NAK"); - break; - - case 0x02: { // Out packet recvd - ESP_EARLY_LOGV(TAG, "TUSB IRQ - RX type : Out packet"); - xfer_ctl_t *xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); - receive_packet(xfer, bcnt); - } - break; - - case 0x03: // Out packet done (Interrupt) - ESP_EARLY_LOGV(TAG, "TUSB IRQ - RX type : Out packet done"); - break; - - case 0x04: // Step 2: Setup transaction completed (Interrupt) - // After this event, OEPINT interrupt will occur with SETUP bit set - ESP_EARLY_LOGV(TAG, "TUSB IRQ - RX : Setup packet done"); - USB0.out_ep_reg[epnum].doeptsiz |= USB_SUPCNT0_M; - break; - - case 0x06: { // Step1: Setup data packet received - volatile uint32_t *rx_fifo = USB0.fifo[0]; - - // We can receive up to three setup packets in succession, but - // only the last one is valid. Therefore we just overwrite it - _setup_packet[0] = (*rx_fifo); - _setup_packet[1] = (*rx_fifo); - - ESP_EARLY_LOGV(TAG, "TUSB IRQ - RX : Setup packet : 0x%08x 0x%08x", _setup_packet[0], _setup_packet[1]); - } - break; - - default: // Invalid, do something here, like breakpoint? - TU_BREAKPOINT(); - break; - } -} - -static void handle_epout_ints(void) -{ - // GINTSTS will be cleared with DAINT == 0 - // DAINT for a given EP clears when DOEPINTx is cleared. - // DOEPINT will be cleared when DAINT's out bits are cleared. - for (int n = 0; n < USB_OUT_EP_NUM; n++) { - xfer_ctl_t *xfer = XFER_CTL_BASE(n, TUSB_DIR_OUT); - - if (USB0.daint & (1 << (16 + n))) { - // SETUP packet Setup Phase done. - if ((USB0.out_ep_reg[n].doepint & USB_SETUP0_M)) { - USB0.out_ep_reg[n].doepint = USB_STUPPKTRCVD0_M | USB_SETUP0_M; // clear - dcd_event_setup_received(0, (uint8_t *)&_setup_packet[0], true); - } - - // OUT XFER complete (single packet).q - if (USB0.out_ep_reg[n].doepint & USB_XFERCOMPL0_M) { - - ESP_EARLY_LOGV(TAG, "TUSB IRQ - EP OUT - XFER complete (single packet)"); - USB0.out_ep_reg[n].doepint = USB_XFERCOMPL0_M; - - // Transfer complete if short packet or total len is transferred - if (xfer->short_packet || (xfer->queued_len == xfer->total_len)) { - xfer->short_packet = false; - dcd_event_xfer_complete(0, n, xfer->queued_len, XFER_RESULT_SUCCESS, true); - } else { - // Schedule another packet to be received. - USB0.out_ep_reg[n].doeptsiz |= USB_PKTCNT0_M | ((xfer->max_size & USB_XFERSIZE0_V) << USB_XFERSIZE0_S); - USB0.out_ep_reg[n].doepctl |= USB_EPENA0_M | USB_CNAK0_M; - } - } - } - } -} - -static void handle_epin_ints(void) -{ - // GINTSTS will be cleared with DAINT == 0 - // DAINT for a given EP clears when DIEPINTx is cleared. - // IEPINT will be cleared when DAINT's out bits are cleared. - for (uint32_t n = 0; n < USB_IN_EP_NUM; n++) { - xfer_ctl_t *xfer = &xfer_status[n][TUSB_DIR_IN]; - - if (USB0.daint & (1 << (0 + n))) { - ESP_EARLY_LOGV(TAG, "TUSB IRQ - EP IN %u", n); - - if (USB0.in_ep_reg[n].diepint & BIT(15)) { - USB0.in_ep_reg[n].diepint = BIT(15); - ESP_EARLY_LOGE(TAG, "Unknown Condition");//todo: - bus_reset(); - } - - // IN XFER complete (entire xfer). - if (USB0.in_ep_reg[n].diepint & USB_D_XFERCOMPL0_M) { - ESP_EARLY_LOGV(TAG, "TUSB IRQ - IN XFER complete!"); - USB0.in_ep_reg[n].diepint = USB_D_XFERCOMPL0_M; - dcd_event_xfer_complete(0, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); - if (!(USB0.in_ep_reg[n].diepint & USB_D_TXFEMP0_M)) { - ESP_EARLY_LOGE(TAG, "Complete but not empty: %u/%u", xfer->queued_len, xfer->total_len);//todo: - } - } - - // XFER FIFO empty - if (USB0.in_ep_reg[n].diepint & USB_D_TXFEMP0_M) { - ESP_EARLY_LOGV(TAG, "TUSB IRQ - IN XFER FIFO empty!"); - USB0.in_ep_reg[n].diepint = USB_D_TXFEMP0_M; - transmit_packet(xfer, &USB0.in_ep_reg[n], n); - - // Turn off TXFE if all bytes are written. - if (xfer->queued_len == xfer->total_len) - { - USB0.dtknqr4_fifoemptymsk &= ~(1 << n); - } - } - - // XFER Timeout - if (USB0.in_ep_reg[n].diepint & USB_D_TIMEOUT0_M) { - // Clear interrupt or enpoint will hang. - USB0.in_ep_reg[n].diepint = USB_D_TIMEOUT0_M; - ESP_EARLY_LOGE(TAG, "XFER Timeout");//todo: - // Maybe retry? - } - } - } -} - - -static void _dcd_int_handler(void* arg) -{ - (void) arg; - uint8_t const rhport = 0; - - const uint32_t int_msk = USB0.gintmsk; - const uint32_t int_status = USB0.gintsts & int_msk; - - if (int_status & USB_USBRST_M) { - // start of reset - ESP_EARLY_LOGV(TAG, "dcd_int_handler - reset"); - USB0.gintsts = USB_USBRST_M; - // FIFOs will be reassigned when the endpoints are reopen - _allocated_fifos = 1; - bus_reset(); - } - - if (int_status & USB_RESETDET_M) { - ESP_EARLY_LOGV(TAG, "dcd_int_handler - reset while suspend"); - USB0.gintsts = USB_RESETDET_M; - // no need to double reset - if ((int_status & USB_USBRST_M) == 0) { - _allocated_fifos = 1; - bus_reset(); - } - } - - if (int_status & USB_ENUMDONE_M) { - // ENUMDNE detects speed of the link. For full-speed, we - // always expect the same value. This interrupt is considered - // the end of reset. - USB0.gintsts = USB_ENUMDONE_M; - enum_done_processing(); - dcd_event_bus_reset(rhport, TUSB_SPEED_FULL, true); - } - - if(int_status & USB_USBSUSP_M) - { - USB0.gintsts = USB_USBSUSP_M; - //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); - dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); - _allocated_fifos = 1; - } - - if(int_status & USB_WKUPINT_M) - { - USB0.gintsts = USB_WKUPINT_M; - dcd_event_bus_signal(rhport, DCD_EVENT_RESUME, true); - } - - if (int_status & USB_OTGINT_M) - { - // OTG INT bit is read-only - ESP_EARLY_LOGV(TAG, "dcd_int_handler - disconnected"); - - uint32_t const otg_int = USB0.gotgint; - - if (otg_int & USB_SESENDDET_M) - { - dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); - _allocated_fifos = 1; - } - - USB0.gotgint = otg_int; - } - - if (int_status & USB_SOF_M) { - USB0.gintsts = USB_SOF_M; - - // Disable SOF interrupt since currently only used for remote wakeup detection - USB0.gintmsk &= ~USB_SOFMSK_M; - - dcd_event_bus_signal(rhport, DCD_EVENT_SOF, true); - } - - - if (int_status & USB_RXFLVI_M) { - // RXFLVL bit is read-only - ESP_EARLY_LOGV(TAG, "dcd_int_handler - rx!"); - - // Mask out RXFLVL while reading data from FIFO - USB0.gintmsk &= ~USB_RXFLVIMSK_M; - read_rx_fifo(); - USB0.gintmsk |= USB_RXFLVIMSK_M; - } - - // OUT endpoint interrupt handling. - if (int_status & USB_OEPINT_M) { - // OEPINT is read-only - ESP_EARLY_LOGV(TAG, "dcd_int_handler - OUT endpoint!"); - handle_epout_ints(); - } - - // IN endpoint interrupt handling. - if (int_status & USB_IEPINT_M) { - // IEPINT bit read-only - ESP_EARLY_LOGV(TAG, "dcd_int_handler - IN endpoint!"); - handle_epin_ints(); - } - - // Without handling - USB0.gintsts |= USB_CURMOD_INT_M | - USB_MODEMIS_M | - USB_OTGINT_M | - USB_NPTXFEMP_M | - USB_GINNAKEFF_M | - USB_GOUTNAKEFF | - USB_ERLYSUSP_M | - USB_USBSUSP_M | - USB_ISOOUTDROP_M | - USB_EOPF_M | - USB_EPMIS_M | - USB_INCOMPISOIN_M | - USB_INCOMPIP_M | - USB_FETSUSP_M | - USB_PTXFEMP_M; -} - -void dcd_int_enable (uint8_t rhport) -{ - (void) rhport; - esp_intr_alloc(ETS_USB_INTR_SOURCE, ESP_INTR_FLAG_LOWMED, (intr_handler_t) _dcd_int_handler, NULL, &usb_ih); -} - -void dcd_int_disable (uint8_t rhport) -{ - (void) rhport; - esp_intr_free(usb_ih); -} - -#endif // #if OPT_MCU_ESP32S2 || OPT_MCU_ESP32S3 - From a0d31221667bdb7b9cd994f05e04c47e690ace21 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:36:54 +0200 Subject: [PATCH 542/636] Delete patches/tinyusb_dcd_dwc2.diff --- patches/tinyusb_dcd_dwc2.diff | 85 ----------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 patches/tinyusb_dcd_dwc2.diff diff --git a/patches/tinyusb_dcd_dwc2.diff b/patches/tinyusb_dcd_dwc2.diff deleted file mode 100644 index 23755c8fc..000000000 --- a/patches/tinyusb_dcd_dwc2.diff +++ /dev/null @@ -1,85 +0,0 @@ ---- a/components/arduino_tinyusb/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c 2024-06-10 22:10:55.000000000 +0300 -+++ b/components/arduino_tinyusb/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c 2024-06-10 22:20:01.000000000 +0300 -@@ -186,6 +186,18 @@ - return true; - } - -+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+// Keep count of how many FIFOs are in use -+static uint8_t _allocated_fifos = 1; //FIFO0 is always in use -+ -+// Will either return an unused FIFO number, or 0 if all are used. -+static uint8_t get_free_fifo(void) -+{ -+ if (_allocated_fifos < 5) return _allocated_fifos++; -+ return 0; -+} -+#endif -+ - static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { - dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); -@@ -205,7 +217,18 @@ - dwc2->epout[epnum].doepctl = dxepctl; - dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum); - } else { -- dwc2->epin[epnum].diepctl = dxepctl | (epnum << DIEPCTL_TXFNUM_Pos); -+ uint8_t fifo_num = epnum; -+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ // Special Case for EP5, which is used by CDC but not actually called by the driver -+ // we can give it a fake FIFO -+ if (epnum == 5) { -+ fifo_num = epnum; -+ } else { -+ fifo_num = get_free_fifo(); -+ } -+ TU_ASSERT(fifo_num != 0); -+#endif -+ dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos); - dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum)); - } - } -@@ -728,6 +751,10 @@ - // reset allocated fifo IN - _allocated_fifo_words_tx = 16; - -+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ _allocated_fifos = 1; -+#endif -+ - fifo_flush_tx(dwc2, 0x10); // all tx fifo - fifo_flush_rx(dwc2); - } -@@ -1096,6 +1123,9 @@ - if (int_status & GINTSTS_USBRST) { - // USBRST is start of reset. - dwc2->gintsts = GINTSTS_USBRST; -+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ _allocated_fifos = 1; -+#endif - bus_reset(rhport); - } - -@@ -1127,7 +1157,11 @@ - - if (int_status & GINTSTS_USBSUSP) { - dwc2->gintsts = GINTSTS_USBSUSP; -- dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); -+ //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); -+ dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); -+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ _allocated_fifos = 1; -+#endif - } - - if (int_status & GINTSTS_WKUINT) { -@@ -1144,6 +1178,9 @@ - - if (otg_int & GOTGINT_SEDET) { - dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); -+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ _allocated_fifos = 1; -+#endif - } - - dwc2->gotgint = otg_int; From 4cece9dacdf675f62c34a3d8fae57ca306eaa103 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:37:05 +0200 Subject: [PATCH 543/636] Delete patches/tinyusb_dcd_esp32sx.diff --- patches/tinyusb_dcd_esp32sx.diff | 119 ------------------------------- 1 file changed, 119 deletions(-) delete mode 100644 patches/tinyusb_dcd_esp32sx.diff diff --git a/patches/tinyusb_dcd_esp32sx.diff b/patches/tinyusb_dcd_esp32sx.diff deleted file mode 100644 index 024af0ddf..000000000 --- a/patches/tinyusb_dcd_esp32sx.diff +++ /dev/null @@ -1,119 +0,0 @@ ---- a/components/arduino_tinyusb/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c 2024-06-10 20:45:02.000000000 +0300 -+++ b/components/arduino_tinyusb/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c 2024-06-10 22:25:05.000000000 +0300 -@@ -282,6 +281,7 @@ - xfer->interval = desc_edpt->bInterval; - - if (dir == TUSB_DIR_OUT) { -+ out_ep[epnum].doepctl &= ~(USB_D_EPTYPE0_M | USB_D_MPS0_M); - out_ep[epnum].doepctl |= USB_USBACTEP1_M | - desc_edpt->bmAttributes.xfer << USB_EPTYPE1_S | - (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? USB_DO_SETD0PID1_M : 0) | -@@ -311,7 +311,14 @@ - // - Offset: GRXFSIZ + 16 + Size*(epnum-1) - // - IN EP 1 gets FIFO 1, IN EP "n" gets FIFO "n". - -- uint8_t fifo_num = get_free_fifo(); -+ uint8_t fifo_num = 0; -+ // Special Case for EP5, which is used by CDC but not actually called by the driver -+ // we can give it a fake FIFO -+ if (epnum == 5) { -+ fifo_num = EP_FIFO_NUM; -+ } else { -+ fifo_num = get_free_fifo(); -+ } - TU_ASSERT(fifo_num != 0); - - in_ep[epnum].diepctl &= ~(USB_D_TXFNUM1_M | USB_D_EPTYPE1_M | USB_DI_SETD0PID1 | USB_D_MPS1_M); -@@ -442,7 +449,8 @@ - } else { - // Stop transmitting packets and NAK IN xfers. - in_ep[epnum].diepctl |= USB_DI_SNAK1_M; -- while ((in_ep[epnum].diepint & USB_DI_SNAK1_M) == 0) ; -+ // while ((in_ep[epnum].diepint & USB_DI_SNAK1_M) == 0) ; -+ while ((in_ep[epnum].diepint & USB_D_INEPNAKEFF1_M) == 0) ; - - // Disable the endpoint. Note that both SNAK and STALL are set here. - in_ep[epnum].diepctl |= (USB_DI_SNAK1_M | USB_D_STALL1_M | USB_D_EPDIS1_M); -@@ -452,9 +460,16 @@ - - // Flush the FIFO, and wait until we have confirmed it cleared. - uint8_t const fifo_num = ((in_ep[epnum].diepctl >> USB_D_TXFNUM1_S) & USB_D_TXFNUM1_V); -- USB0.grstctl |= (fifo_num << USB_TXFNUM_S); -- USB0.grstctl |= USB_TXFFLSH_M; -+ // USB0.grstctl |= (fifo_num << USB_TXFNUM_S); -+ // USB0.grstctl |= USB_TXFFLSH_M; -+ // while ((USB0.grstctl & USB_TXFFLSH_M) != 0) ; -+ uint32_t rstctl_last = USB0.grstctl; -+ uint32_t rstctl = USB_TXFFLSH_M; -+ rstctl |= (fifo_num << USB_TXFNUM_S); -+ USB0.grstctl = rstctl; - while ((USB0.grstctl & USB_TXFFLSH_M) != 0) ; -+ USB0.grstctl = rstctl_last; -+ // TODO: Clear grstctl::fifo_num after fifo flsh - } else { - // Only disable currently enabled non-control endpoint - if ((epnum == 0) || !(out_ep[epnum].doepctl & USB_EPENA0_M)) { -@@ -730,11 +745,21 @@ - - if (USB0.daint & (1 << (0 + n))) { - ESP_EARLY_LOGV(TAG, "TUSB IRQ - EP IN %u", n); -+ -+ if (USB0.in_ep_reg[n].diepint & BIT(15)) { -+ USB0.in_ep_reg[n].diepint = BIT(15); -+ ESP_EARLY_LOGE(TAG, "Unknown Condition");//todo: -+ bus_reset(); -+ } -+ - // IN XFER complete (entire xfer). - if (USB0.in_ep_reg[n].diepint & USB_D_XFERCOMPL0_M) { - ESP_EARLY_LOGV(TAG, "TUSB IRQ - IN XFER complete!"); - USB0.in_ep_reg[n].diepint = USB_D_XFERCOMPL0_M; - dcd_event_xfer_complete(0, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); -+ if (!(USB0.in_ep_reg[n].diepint & USB_D_TXFEMP0_M)) { -+ ESP_EARLY_LOGE(TAG, "Complete but not empty: %u/%u", xfer->queued_len, xfer->total_len);//todo: -+ } - } - - // XFER FIFO empty -@@ -754,6 +779,7 @@ - if (USB0.in_ep_reg[n].diepint & USB_D_TIMEOUT0_M) { - // Clear interrupt or endpoint will hang. - USB0.in_ep_reg[n].diepint = USB_D_TIMEOUT0_M; -+ ESP_EARLY_LOGE(TAG, "XFER Timeout");//todo: - // Maybe retry? - } - } -@@ -781,8 +807,12 @@ - if (int_status & USB_RESETDET_M) { - ESP_EARLY_LOGV(TAG, "dcd_int_handler - reset while suspend"); - USB0.gintsts = USB_RESETDET_M; -- bus_reset(); -- } -+ // no need to double reset -+ if ((int_status & USB_USBRST_M) == 0) { -+ _allocated_fifos = 1; -+ bus_reset(); -+ } -+ } - - if (int_status & USB_ENUMDONE_M) { - // ENUMDNE detects speed of the link. For full-speed, we -@@ -796,7 +826,9 @@ - if(int_status & USB_USBSUSP_M) - { - USB0.gintsts = USB_USBSUSP_M; -- dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); -+ //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); -+ dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); -+ _allocated_fifos = 1; - } - - if(int_status & USB_WKUPINT_M) -@@ -815,6 +847,7 @@ - if (otg_int & USB_SESENDDET_M) - { - dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); -+ _allocated_fifos = 1; - } - - USB0.gotgint = otg_int; From 03dc56547397412088fa6b7297c76489f0f82bf6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:41:35 +0200 Subject: [PATCH 544/636] Update update-components.sh --- tools/update-components.sh | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 48bad8f79..8b3499875 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -11,23 +11,11 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" echo "Updating TinyUSB..." if [ ! -d "$TINYUSB_REPO_DIR" ]; then git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" - # from right before Keyboard LED problem - No issue found - # git checkout 69313ef45564cc8967575f47fb8c57371cbea470 - # from right after Keyboard LED problem - No issue found - # git checkout 7fb8d3341ce2feb46b0bce0bef069d31cf080168 - # from feW DAYS after Keyboard LED problem COMMIT - Breaks LED - # git checkout a435befcdeb6bbd40cf3ba342756f8d73f031957 - # Commit from April 26th, later. WORKS - # git checkout ee9ad0f184752e4006ccfa6ae49b7ac83707d771 - # Last commit done the 26th April - cd "$TINYUSB_REPO_DIR" - git checkout 31b559370d29f5093979fc50de2ae415fa6612ce - cd - else cd $TINYUSB_REPO_DIR git pull # -ff is for cleaning untracked files as well as submodules git clean -ffdx - git checkout 31b559370d29f5093979fc50de2ae415fa6612ce + cd - fi if [ $? -ne 0 ]; then exit 1; fi From 2ffedba07ed7ccf8a049758ec9d30d328a588b07 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:29:03 +0200 Subject: [PATCH 545/636] Update dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 314 ++++++++++------------ 1 file changed, 147 insertions(+), 167 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index fa81e5e29..fcc8d1f8c 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -337,15 +337,12 @@ static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoin xfer->interval = p_endpoint_desc->bInterval; // USBAEP, EPTYP, SD0PID_SEVNFRM, MPSIZ are the same for IN and OUT endpoints. - uint32_t const dxepctl = (1 << DOEPCTL_USBAEP_Pos) | - (p_endpoint_desc->bmAttributes.xfer << DOEPCTL_EPTYP_Pos) | - (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | - (xfer->max_size << DOEPCTL_MPSIZ_Pos); - - if (dir == TUSB_DIR_OUT) { - dwc2->epout[epnum].doepctl = dxepctl; - dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum); - } else { + uint32_t epctl = (1 << DOEPCTL_USBAEP_Pos) | + (p_endpoint_desc->bmAttributes.xfer << DOEPCTL_EPTYP_Pos) | + (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | + (xfer->max_size << DOEPCTL_MPSIZ_Pos); + if (dir == TUSB_DIR_IN) { + //epctl |= (epnum << DIEPCTL_TXFNUM_Pos); uint8_t fifo_num = epnum; #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) // Special Case for EP5, which is used by CDC but not actually called by the driver @@ -357,44 +354,44 @@ static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoin } //TU_ASSERT(fifo_num != 0); #endif - dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos); - dwc2->daintmsk |= TU_BIT(DAINTMSK_IEPM_Pos + epnum); + epctl |= (fifo_num << DIEPCTL_TXFNUM_Pos); } + + dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; + dep->ctl = epctl; + dwc2->daintmsk |= TU_BIT(epnum + DAINT_SHIFT(dir)); } static void edpt_disable(uint8_t rhport, uint8_t ep_addr, bool stall) { (void) rhport; dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); + const uint8_t epnum = tu_edpt_number(ep_addr); + const uint8_t dir = tu_edpt_dir(ep_addr); + dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; if (dir == TUSB_DIR_IN) { - dwc2_epin_t* epin = dwc2->epin; - // Only disable currently enabled non-control endpoint - if ((epnum == 0) || !(epin[epnum].diepctl & DIEPCTL_EPENA)) { - epin[epnum].diepctl |= DIEPCTL_SNAK | (stall ? DIEPCTL_STALL : 0); + if ((epnum == 0) || !(dep->diepctl & DIEPCTL_EPENA)) { + dep->diepctl |= DIEPCTL_SNAK | (stall ? DIEPCTL_STALL : 0); } else { // Stop transmitting packets and NAK IN xfers. - epin[epnum].diepctl |= DIEPCTL_SNAK; - while ((epin[epnum].diepint & DIEPINT_INEPNE) == 0) {} + dep->diepctl |= DIEPCTL_SNAK; + while ((dep->diepint & DIEPINT_INEPNE) == 0) {} // Disable the endpoint. - epin[epnum].diepctl |= DIEPCTL_EPDIS | (stall ? DIEPCTL_STALL : 0); - while ((epin[epnum].diepint & DIEPINT_EPDISD_Msk) == 0) {} + dep->diepctl |= DIEPCTL_EPDIS | (stall ? DIEPCTL_STALL : 0); + while ((dep->diepint & DIEPINT_EPDISD_Msk) == 0) {} - epin[epnum].diepint = DIEPINT_EPDISD; + dep->diepint = DIEPINT_EPDISD; } // Flush the FIFO, and wait until we have confirmed it cleared. dfifo_flush_tx(dwc2, epnum); } else { - dwc2_epout_t* epout = dwc2->epout; - // Only disable currently enabled non-control endpoint - if ((epnum == 0) || !(epout[epnum].doepctl & DOEPCTL_EPENA)) { - epout[epnum].doepctl |= stall ? DOEPCTL_STALL : 0; + if ((epnum == 0) || !(dep->doepctl & DOEPCTL_EPENA)) { + dep->doepctl |= stall ? DOEPCTL_STALL : 0; } else { // Asserting GONAK is required to STALL an OUT endpoint. // Simpler to use polling here, we don't use the "B"OUTNAKEFF interrupt @@ -403,11 +400,11 @@ static void edpt_disable(uint8_t rhport, uint8_t ep_addr, bool stall) { dwc2->dctl |= DCTL_SGONAK; while ((dwc2->gintsts & GINTSTS_BOUTNAKEFF_Msk) == 0) {} - // Ditto here- disable the endpoint. - epout[epnum].doepctl |= DOEPCTL_EPDIS | (stall ? DOEPCTL_STALL : 0); - while ((epout[epnum].doepint & DOEPINT_EPDISD_Msk) == 0) {} + // Ditto here disable the endpoint. + dep->doepctl |= DOEPCTL_EPDIS | (stall ? DOEPCTL_STALL : 0); + while ((dep->doepint & DOEPINT_EPDISD_Msk) == 0) {} - epout[epnum].doepint = DOEPINT_EPDISD; + dep->doepint = DOEPINT_EPDISD; // Allow other OUT endpoints to keep receiving. dwc2->dctl |= DCTL_CGONAK; @@ -423,12 +420,8 @@ static void bus_reset(uint8_t rhport) { tu_memclr(xfer_status, sizeof(xfer_status)); _sof_en = false; - _allocated_ep_in_count = 1; - // clear device address - dwc2->dcfg &= ~DCFG_DAD_Msk; - // 1. NAK for all OUT endpoints for (uint8_t n = 0; n < ep_count; n++) { dwc2->epout[n].doepctl |= DOEPCTL_SNAK; @@ -444,14 +437,18 @@ static void bus_reset(uint8_t rhport) { dfifo_flush_tx(dwc2, 0x10); // all tx fifo dfifo_flush_rx(dwc2); - // 3. Set up interrupt mask + // 3. Set up interrupt mask for EP0 dwc2->daintmsk = TU_BIT(DAINTMSK_OEPM_Pos) | TU_BIT(DAINTMSK_IEPM_Pos); dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM; dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM; + // 4. Set up DFIFO dfifo_init(rhport); - // Fixed control EP0 size to 64 bytes + // 5. Reset device address + dwc2->dcfg &= ~DCFG_DAD_Msk; + + // Fixed both control EP0 size to 64 bytes dwc2->epin[0].diepctl &= ~(0x03 << DIEPCTL_MPSIZ_Pos); dwc2->epout[0].doepctl &= ~(0x03 << DOEPCTL_MPSIZ_Pos); @@ -482,33 +479,33 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c } // IN and OUT endpoint xfers are interrupt-driven, we just schedule them here. - if (dir == TUSB_DIR_IN) { - dwc2_epin_t* epin = dwc2->epin; + const uint8_t is_epout = 1 - dir; + dwc2_dep_t* dep = &dwc2->ep[is_epout][epnum]; + if (dir == TUSB_DIR_IN) { // A full IN transfer (multiple packets, possibly) triggers XFRC. - epin[epnum].dieptsiz = (num_packets << DIEPTSIZ_PKTCNT_Pos) | + dep->dieptsiz = (num_packets << DIEPTSIZ_PKTCNT_Pos) | ((total_bytes << DIEPTSIZ_XFRSIZ_Pos) & DIEPTSIZ_XFRSIZ_Msk); if(dma_enabled(dwc2)) { - epin[epnum].diepdma = (uintptr_t)xfer->buffer; + dep->diepdma = (uintptr_t)xfer->buffer; // For ISO endpoint set correct odd/even bit for next frame. - if ((epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { + if ((dep->diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { // Take odd/even bit from frame counter. uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); - epin[epnum].diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); + dep->diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); } - epin[epnum].diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; + dep->diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; } else { - - epin[epnum].diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; + dep->diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; // For ISO endpoint set correct odd/even bit for next frame. - if ((epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { + if ((dep->diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { // Take odd/even bit from frame counter. uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); - epin[epnum].diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); + dep->diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); } // Enable fifo empty interrupt only if there are something to put in the fifo. if (total_bytes != 0) { @@ -516,25 +513,23 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c } } } else { - dwc2_epout_t* epout = dwc2->epout; - // A full OUT transfer (multiple packets, possibly) triggers XFRC. - epout[epnum].doeptsiz &= ~(DOEPTSIZ_PKTCNT_Msk | DOEPTSIZ_XFRSIZ); - epout[epnum].doeptsiz |= (num_packets << DOEPTSIZ_PKTCNT_Pos) | + dep->doeptsiz &= ~(DOEPTSIZ_PKTCNT_Msk | DOEPTSIZ_XFRSIZ); + dep->doeptsiz |= (num_packets << DOEPTSIZ_PKTCNT_Pos) | ((total_bytes << DOEPTSIZ_XFRSIZ_Pos) & DOEPTSIZ_XFRSIZ_Msk); - if ((epout[epnum].doepctl & DOEPCTL_EPTYP) == DOEPCTL_EPTYP_0 && + if ((dep->doepctl & DOEPCTL_EPTYP) == DOEPCTL_EPTYP_0 && XFER_CTL_BASE(epnum, dir)->interval == 1) { // Take odd/even bit from frame counter. uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); - epout[epnum].doepctl |= (odd_frame_now ? DOEPCTL_SD0PID_SEVNFRM_Msk : DOEPCTL_SODDFRM_Msk); + dep->doepctl |= (odd_frame_now ? DOEPCTL_SD0PID_SEVNFRM_Msk : DOEPCTL_SODDFRM_Msk); } if(dma_enabled(dwc2)) { - epout[epnum].doepdma = (uintptr_t)xfer->buffer; + dep->doepdma = (uintptr_t)xfer->buffer; } - epout[epnum].doepctl |= DOEPCTL_EPENA | DOEPCTL_CNAK; + dep->doepctl |= DOEPCTL_EPENA | DOEPCTL_CNAK; } } @@ -658,7 +653,7 @@ static void phy_hs_init(dwc2_regs_t* dwc2) { static bool check_dwc2(dwc2_regs_t* dwc2) { #if CFG_TUSB_DEBUG >= DWC2_DEBUG // print guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4 - // Run 'dwc2_info.py render-md' and check dwc2_info.md for bit-field value and comparison with other ports + // Run 'python dwc2_info.py' and check dwc2_info.md for bit-field value and comparison with other ports volatile uint32_t const* p = (volatile uint32_t const*) &dwc2->guid; TU_LOG1("guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4\r\n"); for (size_t i = 0; i < 5; i++) { @@ -858,17 +853,13 @@ void dcd_edpt_close_all(uint8_t rhport) { dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos); for (uint8_t n = 1; n < ep_count; n++) { - // disable OUT endpoint - if (dwc2->epout[n].doepctl & DOEPCTL_EPENA) { - dwc2->epout[n].doepctl |= DOEPCTL_SNAK | DOEPCTL_EPDIS; - } - xfer_status[n][TUSB_DIR_OUT].max_size = 0; - - // disable IN endpoint - if (dwc2->epin[n].diepctl & DIEPCTL_EPENA) { - dwc2->epin[n].diepctl |= DIEPCTL_SNAK | DIEPCTL_EPDIS; + for (uint8_t d = 0; d < 2; d++) { + dwc2_dep_t* dep = &dwc2->ep[d][n]; + if (dep->ctl & EPCTL_EPENA) { + dep->ctl |= EPCTL_SNAK | EPCTL_EPDIS; + } + xfer_status[n][1-d].max_size = 0; } - xfer_status[n][TUSB_DIR_IN].max_size = 0; } #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) @@ -942,7 +933,9 @@ bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t uint16_t const short_packet_size = total_bytes % xfer->max_size; // Zero-size packet is special case. - if (short_packet_size > 0 || (total_bytes == 0)) num_packets++; + if (short_packet_size > 0 || (total_bytes == 0)) { + num_packets++; + } // Schedule packets to be sent within interrupt edpt_schedule_packets(rhport, epnum, dir, num_packets, total_bytes); @@ -962,50 +955,32 @@ void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) { } void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) { - (void) rhport; - dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const epnum = tu_edpt_number(ep_addr); uint8_t const dir = tu_edpt_dir(ep_addr); + dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; // Clear stall and reset data toggle - if (dir == TUSB_DIR_IN) { - dwc2->epin[epnum].diepctl &= ~DIEPCTL_STALL; - dwc2->epin[epnum].diepctl |= DIEPCTL_SD0PID_SEVNFRM; - } else { - dwc2->epout[epnum].doepctl &= ~DOEPCTL_STALL; - dwc2->epout[epnum].doepctl |= DOEPCTL_SD0PID_SEVNFRM; - } + dep->ctl &= ~EPCTL_STALL;; + dep->ctl |= EPCTL_SD0PID_SEVNFRM; } //-------------------------------------------------------------------- // Interrupt Handler //-------------------------------------------------------------------- +// Process shared receive FIFO, this interrupt is only used in Slave mode static void handle_rxflvl_irq(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); volatile uint32_t const* rx_fifo = dwc2->fifo[0]; // Pop control word off FIFO - uint32_t const ctl_word = dwc2->grxstsp; - uint8_t const pktsts = (ctl_word & GRXSTSP_PKTSTS_Msk) >> GRXSTSP_PKTSTS_Pos; - uint8_t const epnum = (ctl_word & GRXSTSP_EPNUM_Msk) >> GRXSTSP_EPNUM_Pos; - uint16_t const bcnt = (ctl_word & GRXSTSP_BCNT_Msk) >> GRXSTSP_BCNT_Pos; - + uint32_t const grxstsp = dwc2->grxstsp; + uint8_t const pktsts = (grxstsp & GRXSTSP_PKTSTS_Msk) >> GRXSTSP_PKTSTS_Pos; + uint8_t const epnum = (grxstsp & GRXSTSP_EPNUM_Msk) >> GRXSTSP_EPNUM_Pos; + uint16_t const bcnt = (grxstsp & GRXSTSP_BCNT_Msk) >> GRXSTSP_BCNT_Pos; dwc2_epout_t* epout = &dwc2->epout[epnum]; -//#if CFG_TUSB_DEBUG >= DWC2_DEBUG -// const char * pktsts_str[] = -// { -// "ASSERT", "Global NAK (ISR)", "Out Data Received", "Out Transfer Complete (ISR)", -// "Setup Complete (ISR)", "ASSERT", "Setup Data Received" -// }; -// TU_LOG_LOCATION(); -// TU_LOG(DWC2_DEBUG, " EP %02X, Byte Count %u, %s\r\n", epnum, bcnt, pktsts_str[pktsts]); -// TU_LOG(DWC2_DEBUG, " daint = %08lX, doepint = %04X\r\n", (unsigned long) dwc2->daint, (unsigned int) epout->doepint); -//#endif - switch (pktsts) { // Global OUT NAK: do nothing case GRXSTS_PKTSTS_GLOBALOUTNAK: @@ -1013,15 +988,14 @@ static void handle_rxflvl_irq(uint8_t rhport) { case GRXSTS_PKTSTS_SETUPRX: // Setup packet received - - // We can receive up to three setup packets in succession, but - // only the last one is valid. + // We can receive up to three setup packets in succession, but only the last one is valid. _setup_packet[0] = (*rx_fifo); _setup_packet[1] = (*rx_fifo); break; case GRXSTS_PKTSTS_SETUPDONE: - // Setup packet done (Interrupt) + // Setup packet done: + // After popping this out, dwc2 asserts a DOEPINT_SETUP interrupt which is handled by handle_epout_irq() epout->doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); break; @@ -1049,20 +1023,16 @@ static void handle_rxflvl_irq(uint8_t rhport) { ep0_pending[TUSB_DIR_OUT] = 0; } } - } break; + } - // Out packet done (Interrupt) case GRXSTS_PKTSTS_OUTDONE: - // Occurred on STM32L47 with dwc2 version 3.10a but not found on other version like 2.80a or 3.30a - // May (or not) be 3.10a specific feature/bug or depending on MCU configuration - // XFRC complete is additionally generated when - // - setup packet is received - // - complete the data stage of control write is complete - // It will be handled in handle_epout_irq() + /* Out packet done + After this entry is popped from the receive FIFO, dwc2 asserts a Transfer Completed interrupt on + the specified OUT endpoint which will be handled by handle_epout_irq() */ break; - default: // Invalid + default: TU_BREAKPOINT(); break; } @@ -1074,80 +1044,70 @@ static void handle_epout_irq(uint8_t rhport) { // DAINT for a given EP clears when DOEPINTx is cleared. // OEPINT will be cleared when DAINT's out bits are cleared. - for (uint8_t n = 0; n < ep_count; n++) { - if (dwc2->daint & TU_BIT(DAINT_OEPINT_Pos + n)) { - dwc2_epout_t* epout = &dwc2->epout[n]; + for (uint8_t epnum = 0; epnum < ep_count; epnum++) { + if (dwc2->daint & TU_BIT(DAINT_OEPINT_Pos + epnum)) { + dwc2_epout_t* epout = &dwc2->epout[epnum]; + const uint32_t doepint = epout->doepint; + TU_ASSERT((epout->doepint & DOEPINT_AHBERR) == 0, ); - uint32_t const doepint = epout->doepint; + // Setup and/or STPKTRX/STSPHSRX (from 3.00a) can be set along with XFRC, and also set independently. + if (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a) { + if (doepint & DOEPINT_STSPHSRX) { + // Status phase received for control write: In token received from Host + epout->doepint = DOEPINT_STSPHSRX; + } - TU_ASSERT((epout->doepint & DOEPINT_AHBERR) == 0, ); + if (doepint & DOEPINT_STPKTRX) { + // New setup packet received, but wait for Setup done, since we can receive up to 3 setup consecutively + epout->doepint = DOEPINT_STPKTRX; + } + } + + if (doepint & DOEPINT_SETUP) { + epout->doepint = DOEPINT_SETUP; + + if(dma_enabled(dwc2)) { + dma_setup_prepare(rhport); + } + + dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); + } // OUT XFER complete - if (epout->doepint & DOEPINT_XFRC) { + if (doepint & DOEPINT_XFRC) { epout->doepint = DOEPINT_XFRC; - xfer_ctl_t* xfer = XFER_CTL_BASE(n, TUSB_DIR_OUT); + // only handle data skip if it is setup or status related + // Normal OUT transfer complete + if (!(doepint & (DOEPINT_SETUP | DOEPINT_STPKTRX | DOEPINT_STSPHSRX))) { + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); - if(dma_enabled(dwc2)) { - if (doepint & DOEPINT_STUP) { - // STPKTRX is only available for version from 3_00a - if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid > DWC2_CORE_REV_3_00a)) { - epout->doepint = DOEPINT_STPKTRX; - } - } else if (doepint & DOEPINT_OTEPSPR) { - epout->doepint = DOEPINT_OTEPSPR; - } else { - if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid > DWC2_CORE_REV_3_00a)) { - epout->doepint = DOEPINT_STPKTRX; + if(dma_enabled(dwc2)) { + if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { + // EP0 can only handle one packet Schedule another packet to be received. + edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); } else { - // EP0 can only handle one packet - if ((n == 0) && ep0_pending[TUSB_DIR_OUT]) { - // Schedule another packet to be received. - edpt_schedule_packets(rhport, n, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); - } else { - // Fix packet length - uint16_t remain = (epout->doeptsiz & DOEPTSIZ_XFRSIZ_Msk) >> DOEPTSIZ_XFRSIZ_Pos; - xfer->total_len -= remain; - // this is ZLP, so prepare EP0 for next setup - if(n == 0 && xfer->total_len == 0) { - dma_setup_prepare(rhport); - } - - dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true); + // Fix packet length + uint16_t remain = (epout->doeptsiz & DOEPTSIZ_XFRSIZ_Msk) >> DOEPTSIZ_XFRSIZ_Pos; + xfer->total_len -= remain; + // this is ZLP, so prepare EP0 for next setup + if(epnum == 0 && xfer->total_len == 0) { + dma_setup_prepare(rhport); } + + dcd_event_xfer_complete(rhport, epnum, xfer->total_len, XFER_RESULT_SUCCESS, true); } - } - } else { - if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid == DWC2_CORE_REV_3_10a)) { - epout->doepint = DOEPINT_STPKTRX; } else { - if ((doepint & DOEPINT_OTEPSPR) && (dwc2->gsnpsid == DWC2_CORE_REV_3_10a)) { - epout->doepint = DOEPINT_OTEPSPR; - } - // EP0 can only handle one packet - if ((n == 0) && ep0_pending[TUSB_DIR_OUT]) { + if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { // Schedule another packet to be received. - edpt_schedule_packets(rhport, n, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); + edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); } else { - dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true); + dcd_event_xfer_complete(rhport, epnum, xfer->total_len, XFER_RESULT_SUCCESS, true); } } } } - - // SETUP packet Setup Phase done. - if (doepint & DOEPINT_STUP) { - epout->doepint = DOEPINT_STUP; - if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid > DWC2_CORE_REV_3_00a)) { - epout->doepint = DOEPINT_STPKTRX; - } - if(dma_enabled(dwc2) && (dwc2->gsnpsid > DWC2_CORE_REV_3_00a)) { - dma_setup_prepare(rhport); - } - - dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); - } } } } @@ -1220,6 +1180,29 @@ static void handle_epin_irq(uint8_t rhport) { } } +/* Interrupt Hierarchy + + DxEPMSK.XferComplMsk DxEPINTn.XferCompl + | | + +---------- AND --------+ + | + DAINT.xEPnInt DAINTMSK.xEPnMsk + | | + +---------- AND --------+ + | + GINTSTS.xEPInt GINTMSK.xEPIntMsk + | | + +---------- AND --------+ + | + GAHBCFG.GblIntrMsk + | + IRQn + + Note: when OTG_MULTI_PROC_INTRPT = 1, Device Each endpoint interrupt deachint/deachmsk/diepeachmsk/doepeachmsk + are combined to generate dedicated interrupt line for each endpoint. + */ + + void dcd_int_handler(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); @@ -1307,13 +1290,10 @@ void dcd_int_handler(uint8_t rhport) { // RxFIFO non-empty interrupt handling. if (int_status & GINTSTS_RXFLVL) { // RXFLVL bit is read-only + dwc2->gintmsk &= ~GINTMSK_RXFLVLM; // disable RXFLVL interrupt while reading - // Mask out RXFLVL while reading data from FIFO - dwc2->gintmsk &= ~GINTMSK_RXFLVLM; - - // Loop until all available packets were handled do { - handle_rxflvl_irq(rhport); + handle_rxflvl_irq(rhport); // read all packets } while(dwc2->gintsts & GINTSTS_RXFLVL); dwc2->gintmsk |= GINTMSK_RXFLVLM; From c35acbfd3190a0f89fec325bb4a646ebbbbf8717 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:29:44 +0200 Subject: [PATCH 546/636] Update dcd_dwc2.patch --- .../arduino_tinyusb/patches/dcd_dwc2.patch | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/components/arduino_tinyusb/patches/dcd_dwc2.patch b/components/arduino_tinyusb/patches/dcd_dwc2.patch index 7aef99c33..e93f9629b 100755 --- a/components/arduino_tinyusb/patches/dcd_dwc2.patch +++ b/components/arduino_tinyusb/patches/dcd_dwc2.patch @@ -17,11 +17,12 @@ static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); -@@ -336,7 +346,18 @@ - dwc2->epout[epnum].doepctl = dxepctl; - dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum); - } else { -- dwc2->epin[epnum].diepctl = dxepctl | (epnum << DIEPCTL_TXFNUM_Pos); +@@ -332,7 +342,19 @@ + (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | + (xfer->max_size << DOEPCTL_MPSIZ_Pos); + if (dir == TUSB_DIR_IN) { +- epctl |= (epnum << DIEPCTL_TXFNUM_Pos); ++ //epctl |= (epnum << DIEPCTL_TXFNUM_Pos); + uint8_t fifo_num = epnum; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + // Special Case for EP5, which is used by CDC but not actually called by the driver @@ -33,12 +34,12 @@ + } + //TU_ASSERT(fifo_num != 0); +#endif -+ dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos); - dwc2->daintmsk |= TU_BIT(DAINTMSK_IEPM_Pos + epnum); ++ epctl |= (fifo_num << DIEPCTL_TXFNUM_Pos); } - } -@@ -850,6 +871,10 @@ - xfer_status[n][TUSB_DIR_IN].max_size = 0; + + dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; +@@ -840,6 +862,10 @@ + } } +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) @@ -48,7 +49,7 @@ dfifo_flush_tx(dwc2, 0x10); // all tx fifo dfifo_flush_rx(dwc2); -@@ -1204,6 +1229,9 @@ +@@ -1186,6 +1212,9 @@ if (int_status & GINTSTS_USBRST) { // USBRST is start of reset. dwc2->gintsts = GINTSTS_USBRST; @@ -58,7 +59,7 @@ bus_reset(rhport); } -@@ -1235,7 +1263,11 @@ +@@ -1217,7 +1246,11 @@ if (int_status & GINTSTS_USBSUSP) { dwc2->gintsts = GINTSTS_USBSUSP; @@ -71,7 +72,7 @@ } if (int_status & GINTSTS_WKUINT) { -@@ -1252,6 +1284,9 @@ +@@ -1234,6 +1267,9 @@ if (otg_int & GOTGINT_SEDET) { dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); From def45e7159ab0987d8f50765945965a04bee7515 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:12:35 +0200 Subject: [PATCH 547/636] remove lib `zigbee` --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 07b947634..14629fdc0 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -94,3 +94,4 @@ rm -rf "$AR_COMPS/arduino/libraries/ESP_SR" rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW" rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro" rm -rf "$AR_COMPS/arduino/libraries/OpenThread" +rm -rf "$AR_COMPS/arduino/libraries/Zigbee" From 7813acf12e684d0dec6b3f28009567bba7b3cfc4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:17:10 +0200 Subject: [PATCH 548/636] rremove lib zigbee --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 56c432adf..49b1fa7ab 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -38,6 +38,7 @@ rm -rf arduino-esp32/libraries/ESP_SR rm -rf arduino-esp32/libraries/ESP_NOW rm -rf arduino-esp32/libraries/TFLiteMicro rm -rf arduino-esp32/libraries/OpenThread +rm -rf arduino-esp32/libraries/Zigbee rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package rm -rf arduino-esp32/tools/esp32-arduino-libs From 037a712d0a21eb5885a43e4b68a7ad1f78cf8ef7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:34:05 +0200 Subject: [PATCH 549/636] Disable Tinyusb support --- components/arduino_tinyusb/Kconfig.projbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/arduino_tinyusb/Kconfig.projbuild b/components/arduino_tinyusb/Kconfig.projbuild index 65d9c37be..26dacb8b9 100755 --- a/components/arduino_tinyusb/Kconfig.projbuild +++ b/components/arduino_tinyusb/Kconfig.projbuild @@ -3,7 +3,7 @@ menu "Arduino TinyUSB" config TINYUSB_ENABLED bool "Enable TinyUSB driver" - default y + default n depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4 select FREERTOS_SUPPORT_STATIC_ALLOCATION select FREERTOS_USE_AUTHENTIC_INCLUDE_PATHS From e3795f01251a70e5b20f26415771ba6a781deb6d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:39:20 +0200 Subject: [PATCH 550/636] remove no LTO --- tools/copy-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index b0b7bb190..8cbb6c625 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -64,7 +64,7 @@ LD_SCRIPTS="" LD_SCRIPT_DIRS="" PIO_CC_FLAGS="-flto=auto " -PIO_C_FLAGS="" +PIO_C_FLAGS="-flto=auto " PIO_CXX_FLAGS="-flto=auto " PIO_AS_FLAGS="" PIO_LD_FLAGS="-flto " @@ -108,7 +108,7 @@ for item in "${@:2:${#@}-5}"; do elif [ "$prefix" = "-O" ]; then PIO_CC_FLAGS+="$item " elif [[ "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" ]]; then - 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 + 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 C_FLAGS+="$item " fi fi From bb620686d54fd82976b7a76024ed80e2449f78e0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:49:28 +0200 Subject: [PATCH 551/636] Enable TinyUSB driver --- components/arduino_tinyusb/Kconfig.projbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/arduino_tinyusb/Kconfig.projbuild b/components/arduino_tinyusb/Kconfig.projbuild index 26dacb8b9..65d9c37be 100755 --- a/components/arduino_tinyusb/Kconfig.projbuild +++ b/components/arduino_tinyusb/Kconfig.projbuild @@ -3,7 +3,7 @@ menu "Arduino TinyUSB" config TINYUSB_ENABLED bool "Enable TinyUSB driver" - default n + default y depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4 select FREERTOS_SUPPORT_STATIC_ALLOCATION select FREERTOS_USE_AUTHENTIC_INCLUDE_PATHS From cc109a4a200198f06712b454904eed5796563020 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:27:02 +0200 Subject: [PATCH 552/636] Update defconfig.esp32p4 --- configs/defconfig.esp32p4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index 1550c9e10..e201bd734 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -1,3 +1,6 @@ +# temp disable tinyusb for P4 since compile fails +# CONFIG_TINYUSB_ENABLED is not set + CONFIG_IDF_EXPERIMENTAL_FEATURES=y # Enable LP Core From 00fa9e265afff8e5ddd1b571aee92b18b1cb4559 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:56:40 +0200 Subject: [PATCH 553/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 062f197b2..c2ec016a6 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 CCACHE_ENABLE=1 -export TARGET="all" +export TARGET="esp32s2" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From f92b3141b8e00c9411a92ba7dc2ed800084f4b6f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:02:09 +0200 Subject: [PATCH 554/636] Update defconfig.esp32p4 --- configs/defconfig.esp32p4 | 3 --- 1 file changed, 3 deletions(-) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index e201bd734..1550c9e10 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -1,6 +1,3 @@ -# temp disable tinyusb for P4 since compile fails -# CONFIG_TINYUSB_ENABLED is not set - CONFIG_IDF_EXPERIMENTAL_FEATURES=y # Enable LP Core From e308b1e4694f6209467841b1c8e6edb37148c51e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:08:56 +0200 Subject: [PATCH 555/636] temp Tinyusb compile fix --- tools/update-components.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 8b3499875..6d22dddee 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -11,11 +11,14 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" echo "Updating TinyUSB..." if [ ! -d "$TINYUSB_REPO_DIR" ]; then git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" + cd "$TINYUSB_REPO_DIR" + git checkout a4fb8354e41b2604f66e7da22afa292b1a44f0a2 + cd - else cd $TINYUSB_REPO_DIR git pull # -ff is for cleaning untracked files as well as submodules git clean -ffdx - cd - + git checkout a4fb8354e41b2604f66e7da22afa292b1a44f0a2 fi if [ $? -ne 0 ]; then exit 1; fi From 9804819a98e3f3fa3a12b45c718c0da6abf41d81 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:14:40 +0200 Subject: [PATCH 556/636] Update update-components.sh --- tools/update-components.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 6d22dddee..14f422502 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -10,7 +10,7 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" # echo "Updating TinyUSB..." if [ ! -d "$TINYUSB_REPO_DIR" ]; then - git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" + git clone -b master "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" cd "$TINYUSB_REPO_DIR" git checkout a4fb8354e41b2604f66e7da22afa292b1a44f0a2 cd - From 254ea00c3a26b459e21830730fdcc19996f587ed Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:19:35 +0200 Subject: [PATCH 557/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c2ec016a6..062f197b2 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 CCACHE_ENABLE=1 -export TARGET="esp32s2" +export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From c1617e87d0fc0f8caf7f2c43bb44629134d9bf8c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:02:28 +0200 Subject: [PATCH 558/636] changes for latest tinyusb --- components/arduino_tinyusb/src/dcd_dwc2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index fcc8d1f8c..e76bdf70e 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -672,13 +672,15 @@ static bool check_dwc2(dwc2_regs_t* dwc2) { return true; } -void dcd_init(uint8_t rhport) { +bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) { + (void) rhport; + (void) rh_init; // Programming model begins in the last section of the chapter on the USB // peripheral in each Reference Manual. dwc2_regs_t* dwc2 = DWC2_REG(rhport); // Check Synopsys ID register, failed if controller clock/power is not enabled - TU_ASSERT(check_dwc2(dwc2), ); + TU_ASSERT(check_dwc2(dwc2)); dcd_disconnect(rhport); if (phy_hs_supported(dwc2)) { @@ -747,6 +749,8 @@ void dcd_init(uint8_t rhport) { // TU_LOG_HEX(DWC2_DEBUG, dwc2->gahbcfg); dcd_connect(rhport); + + return true; } void dcd_int_enable(uint8_t rhport) { From 893b867879661c448171822a6878b19fea3f52b7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:03:57 +0200 Subject: [PATCH 559/636] Update update-components.sh --- tools/update-components.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 14f422502..8b3499875 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -10,15 +10,12 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" # echo "Updating TinyUSB..." if [ ! -d "$TINYUSB_REPO_DIR" ]; then - git clone -b master "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" - cd "$TINYUSB_REPO_DIR" - git checkout a4fb8354e41b2604f66e7da22afa292b1a44f0a2 - cd - + git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" else cd $TINYUSB_REPO_DIR git pull # -ff is for cleaning untracked files as well as submodules git clean -ffdx - git checkout a4fb8354e41b2604f66e7da22afa292b1a44f0a2 + cd - fi if [ $? -ne 0 ]; then exit 1; fi From 1f2bf02568bbfc6942ce9b974939f7685bd7842c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:06:12 +0200 Subject: [PATCH 560/636] Update builds.json --- configs/builds.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/builds.json b/configs/builds.json index 70ddff6d1..5ec2470cc 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -88,7 +88,7 @@ }, { "target": "esp32p4", - "features":[], + "features":["qio_ram"], "idf_libs":["qio","80m"], "bootloaders":[ ["qio","80m"], From 20423c663795b134c1b45cbe9f3417f65a540126 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:10:52 +0200 Subject: [PATCH 561/636] Update defconfig.esp32p4 --- configs/defconfig.esp32p4 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index 1550c9e10..b7d9a6539 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -8,6 +8,8 @@ CONFIG_ULP_COPROC_RESERVE_MEM=8192 CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_360=y CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y CONFIG_SPIRAM=y +# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set +CONFIG_LWIP_TCP_SACK_OUT=y CONFIG_SPIRAM_SPEED_200M=y CONFIG_SPIRAM_XIP_FROM_PSRAM=y CONFIG_RTC_CLK_CAL_CYCLES=576 @@ -18,6 +20,16 @@ CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 CONFIG_CACHE_L2_CACHE_256KB=y CONFIG_CACHE_L2_CACHE_LINE_128B=y +CONFIG_SLAVE_IDF_TARGET_ESP32C6=y +CONFIG_ESP_SDIO_BUS_WIDTH=4 +CONFIG_ESP_SDIO_CLOCK_FREQ_KHZ=40000 +CONFIG_ESP_SDIO_PIN_CMD=19 +CONFIG_ESP_SDIO_PIN_CLK=18 +CONFIG_ESP_SDIO_PIN_D0=14 +CONFIG_ESP_SDIO_PIN_D1=15 +CONFIG_ESP_SDIO_PIN_D2=16 +CONFIG_ESP_SDIO_PIN_D3=17 + # # PPP # From 0339ae2132b145a3499b8d98dcee1fbc3d51e086 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 16 Oct 2024 22:59:41 +0200 Subject: [PATCH 562/636] Update idf_component.yml --- main/idf_component.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index 702a6ad9b..bf96b25c8 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -7,4 +7,3 @@ dependencies: require: public rules: - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" - - if: "$COMPONENTS_SUBSET in [full, all]" From d8ee2893ff2d3da20969ca648715168074d65274 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:02:43 +0200 Subject: [PATCH 563/636] Remove conditional inclusion of builder specified components --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 062f197b2..e96fc314b 100755 --- a/build.sh +++ b/build.sh @@ -154,7 +154,7 @@ if [ "$BUILD_TYPE" != "all" ]; then echo "idf.py -DIDF_TARGET=\"$target\" -DSDKCONFIG_DEFAULTS=\"$configs\" $BUILD_TYPE" rm -rf build sdkconfig - COMPONENTS_SUBSET=full idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE + idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE if [ $? -ne 0 ]; then exit 1; fi done exit 0 @@ -217,7 +217,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build IDF-Libs: $idf_libs_configs" rm -rf build sdkconfig - COMPONENTS_SUBSET=full idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs + idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs if [ $? -ne 0 ]; then exit 1; fi # Build Bootloaders @@ -229,7 +229,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build BootLoader: $bootloader_configs" rm -rf build sdkconfig - COMPONENTS_SUBSET=none idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader + idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader if [ $? -ne 0 ]; then exit 1; fi done @@ -242,7 +242,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do echo "* Build Memory Variant: $mem_configs" rm -rf build sdkconfig - COMPONENTS_SUBSET=none idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant + idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant if [ $? -ne 0 ]; then exit 1; fi done done From 2c7c6f5e2d9d09f007ebca0aedd130561a351700 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:39:58 +0200 Subject: [PATCH 564/636] rm -rf "$AR_COMPS/arduino/libraries/Matter" --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index 14629fdc0..d67a98129 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -79,6 +79,7 @@ rm -rf "$AR_COMPS/arduino/package" rm -rf "$AR_COMPS/arduino/tests" rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.cpp" rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.h" +rm -rf "$AR_COMPS/arduino/libraries/Matter" rm -rf "$AR_COMPS/arduino/libraries/RainMaker" rm -rf "$AR_COMPS/arduino/libraries/Insights" rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S" From 55103c2b065dd9306f5b0a6402f526540d9a39d8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:41:15 +0200 Subject: [PATCH 565/636] rm -rf arduino-esp32/libraries/Matter --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 49b1fa7ab..3ce051140 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -24,6 +24,7 @@ cp -f ../components/arduino/pac* arduino-esp32 rm -rf arduino-esp32/docs rm -rf arduino-esp32/tests rm -rf arduino-esp32/idf_component_examples +rm -rf arduino-esp32/libraries/Matter rm -rf arduino-esp32/libraries/RainMaker rm -rf arduino-esp32/libraries/Insights rm -rf arduino-esp32/libraries/ESP_I2S From 3f5137f0add1832ce67886c80de623dcfe68fe05 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:47:48 +0200 Subject: [PATCH 566/636] Update defconfig.esp32c6 --- configs/defconfig.esp32c6 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index e950a2489..32e626fa4 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -3,6 +3,9 @@ CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y +# v0.0 C6 has reg i2c rom bug +CONFIG_ESP_ROM_HAS_REGI2C_BUG + # Enable LP Core CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_LP_CORE=y From fab6f6f5f33804a03bdb617d9dc2483f4fb80048 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:55:43 +0200 Subject: [PATCH 567/636] CONFIG_ESP_ROM_HAS_REGI2C_BUG=y --- configs/defconfig.esp32c6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index 32e626fa4..06615dccd 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -4,7 +4,7 @@ CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y # v0.0 C6 has reg i2c rom bug -CONFIG_ESP_ROM_HAS_REGI2C_BUG +CONFIG_ESP_ROM_HAS_REGI2C_BUG=y # Enable LP Core CONFIG_ULP_COPROC_ENABLED=y From 13122d02c8c098c2f74093ececa4354cd990b111 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:33:46 +0200 Subject: [PATCH 568/636] Update CMakeLists.txt --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88cede199..bbf8583cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,3 +33,5 @@ add_custom_command( VERBATIM ) add_custom_target(mem-variant DEPENDS "mem_variant") + +idf_build_set_property(COMPILE_DEFINITIONS "-DESP32_ARDUINO_LIB_BUILDER" APPEND) From 3538f21245afa7df3ed2f248cb0df21b1eaa795a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:06:06 +0200 Subject: [PATCH 569/636] CONFIG_MBEDTLS_FS_IO --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 5fc910b8a..ba567d3fc 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -210,6 +210,7 @@ CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 # CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set # CONFIG_USE_WAKENET is not set # CONFIG_USE_MULTINET is not set +# CONFIG_MBEDTLS_FS_IO is not set # CONFIG_VFS_SUPPORT_SELECT is not set # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set # CONFIG_VFS_SUPPORT_TERMIOS is not set From 98fa3d768448e7ad7b1b3a3370592ad9be778e92 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:02:52 +0100 Subject: [PATCH 570/636] Update push.yml --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 064581d4d..cb3350cf6 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF v5.3 with P4 +name: IDF v5.3 on: workflow_dispatch: # Manually start a workflow From 7d302d8ce85cfea9d60773f9d02c5846f96d7d01 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:01:40 +0100 Subject: [PATCH 571/636] Delete main/idf_component.yml --- main/idf_component.yml | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 main/idf_component.yml diff --git a/main/idf_component.yml b/main/idf_component.yml deleted file mode 100644 index bf96b25c8..000000000 --- a/main/idf_component.yml +++ /dev/null @@ -1,9 +0,0 @@ -dependencies: - # Required IDF version - idf: ">=5.1" - espressif/esp32-camera: - version: "master" - git: https://github.com/espressif/esp32-camera.git - require: public - rules: - - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" From 349a23dd5fa3192e0be00e649c45e323ba7bb163 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:58:41 +0100 Subject: [PATCH 572/636] Update install-arduino.sh --- tools/install-arduino.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install-arduino.sh b/tools/install-arduino.sh index d67a98129..54e464e3b 100755 --- a/tools/install-arduino.sh +++ b/tools/install-arduino.sh @@ -77,6 +77,7 @@ rm -rf "$AR_COMPS/arduino/docs" rm -rf "$AR_COMPS/arduino/idf_component_examples" rm -rf "$AR_COMPS/arduino/package" rm -rf "$AR_COMPS/arduino/tests" +rm -rf "$AR_COMPS/arduino/tools/pre-commit" rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.cpp" rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.h" rm -rf "$AR_COMPS/arduino/libraries/Matter" From 48ea5024e17b9d5eca597814be597ee662287aa0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:03:07 +0100 Subject: [PATCH 573/636] Update archive-build.sh --- tools/archive-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 3ce051140..139d720bf 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -42,6 +42,7 @@ rm -rf arduino-esp32/libraries/OpenThread rm -rf arduino-esp32/libraries/Zigbee rm -rf arduino-esp32/libraries/ESP32 rm -rf arduino-esp32/package +rm -rf arduino-esp32/tools/pre-commit rm -rf arduino-esp32/tools/esp32-arduino-libs rm -rf arduino-esp32/tools/*.exe rm -rf arduino-esp32/tools/esptool.py From 9e0d7895e27ed93515d486d8227a03e1e747e7ff Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:00:56 +0100 Subject: [PATCH 574/636] fix(zigbee): Unlink the zigbee libs --- tools/copy-libs.sh | 64 ++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 8cbb6c625..0f54913f1 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -56,6 +56,8 @@ AS_FLAGS="" INCLUDES="" DEFINES="" +EXCLUDE_LIBS=";" + LD_FLAGS="" LD_LIBS="" LD_LIB_FILES="" @@ -78,6 +80,17 @@ else TOOLCHAIN="riscv32-esp-elf" fi +# copy zigbee + zboss lib +if [ -d "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET/" ]; then + cp -r "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" + EXCLUDE_LIBS+="esp_zb_api_ed;" +fi + +if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then + cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" + EXCLUDE_LIBS+="zboss_stack.ed;zboss_port.debug;" +fi + #collect includes, defines and c-flags str=`cat build/compile_commands.json | grep arduino-lib-builder-gcc.c | grep command | cut -d':' -f2 | cut -d',' -f1` str="${str:2:${#str}-1}" #remove leading space and quotes @@ -200,12 +213,14 @@ for item; do add_next=1 LD_FLAGS+="$item " elif [ "${item:0:2}" = "-l" ]; then # -l[lib_name] - LD_LIBS+="$item " - exclude_libs=";m;c;gcc;stdc++;" short_name="${item:2}" - if [[ $exclude_libs != *";$short_name;"* && $LD_LIBS_SEARCH != *"lib$short_name.a"* ]]; then - LD_LIBS_SEARCH+="lib$short_name.a " - #echo "lib add: $item" + if [[ $EXCLUDE_LIBS != *";$short_name;"* ]]; then + LD_LIBS+="$item " + exclude_libs=";m;c;gcc;stdc++;" + if [[ $exclude_libs != *";$short_name;"* && $LD_LIBS_SEARCH != *"lib$short_name.a"* ]]; then + LD_LIBS_SEARCH+="lib$short_name.a " + #echo "1. lib add: $item" + fi fi elif [ "$item" = "-o" ]; then add_next=0 @@ -244,30 +259,38 @@ for item; do if [[ $LD_LIB_FILES != *"$item"* ]]; then # do we already have lib with the same name? if [[ $LD_LIBS != *"-l$lname"* ]]; then - # echo "collecting lib '$lname' and file: $item" - LD_LIB_FILES+="$item " - LD_LIBS+="-l$lname " + if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then + #echo "2. collecting lib '$lname' and file: $item" + LD_LIB_FILES+="$item " + LD_LIBS+="-l$lname " + fi else # echo "!!! need to rename: '$lname'" for i in {2..9}; do n_item="${item:0:${#item}-2}_$i.a" n_name=$lname"_$i" if [ -f "$n_item" ]; then - # echo "renamed add: -l$n_name" - LD_LIBS+="-l$n_name " + if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then + #echo "3. renamed add: -l$n_name" + LD_LIBS+="-l$n_name " + fi break elif [[ $LD_LIB_FILES != *"$n_item"* && $LD_LIBS != *"-l$n_name"* ]]; then - echo "Renaming '$lname' to '$n_name': $item" - cp -f "$item" "$n_item" - LD_LIB_FILES+="$n_item " - LD_LIBS+="-l$n_name " + if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then + #echo "4. Renaming '$lname' to '$n_name': $item" + cp -f "$item" "$n_item" + LD_LIB_FILES+="$n_item " + LD_LIBS+="-l$n_name " + fi break fi done fi else - # echo "just add: -l$lname" - LD_LIBS+="-l$lname " + if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then + #echo "5. just add: -l$lname" + LD_LIBS+="-l$lname " + fi fi else echo "*** Skipping $(basename $item): size too small $lsize" @@ -493,15 +516,6 @@ echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags" echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts" echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs" -# copy zigbee + zboss lib -if [ -d "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET/" ]; then - cp -r "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" -fi - -if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then - cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" -fi - if [ -d "managed_components/espressif__esp32-camera/driver/private_include/" ]; then cp -r "managed_components/espressif__esp32-camera/driver/private_include/cam_hal.h" "$AR_SDK/include/espressif__esp32-camera/driver/include/" fi From bf201df2eeebc0a47dfa66078ab4cbbf8e0036fc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:00:02 +0100 Subject: [PATCH 575/636] Update copy-libs.sh --- tools/copy-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 0f54913f1..2c2f56204 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -39,7 +39,9 @@ fi if [ -e "$AR_SDK/platformio-build.py" ]; then rm -rf "$AR_SDK/platformio-build.py" fi + mkdir -p "$AR_SDK" +mkdir -p "$AR_SDK/lib" function get_actual_path(){ p="$PWD"; cd "$1"; r="$PWD"; cd "$p"; echo "$r"; @@ -450,8 +452,6 @@ echo " join(FRAMEWORK_DIR, \"cores\", board_config.get(\"build.core\"))" echo " ]," >> "$AR_PLATFORMIO_PY" echo "" >> "$AR_PLATFORMIO_PY" -mkdir -p "$AR_SDK/lib" - AR_LIBS="$LD_LIBS" PIO_LIBS="" set -- $LD_LIBS From 4d0119cc02315e841c68cba1e5eed4205958c981 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 14:51:26 +0100 Subject: [PATCH 576/636] Update update-components.sh --- tools/update-components.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index 8b3499875..d5d3f32f2 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -10,12 +10,15 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" # echo "Updating TinyUSB..." if [ ! -d "$TINYUSB_REPO_DIR" ]; then - git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" + git clone -b master "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" + cd "$TINYUSB_REPO_DIR" + git checkout 038be21e4d94c958043eb54d179948cd9e52fe18 + cd - else cd $TINYUSB_REPO_DIR git pull # -ff is for cleaning untracked files as well as submodules git clean -ffdx - cd - + git checkout 038be21e4d94c958043eb54d179948cd9e52fe18 fi if [ $? -ne 0 ]; then exit 1; fi From cc89f2518b00e09643f8dca6feab6e6a50c4c950 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:56:44 +0100 Subject: [PATCH 577/636] again tinyusb update... --- components/arduino_tinyusb/src/dcd_dwc2.c | 493 +++++----------------- 1 file changed, 106 insertions(+), 387 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index e76bdf70e..035e335cd 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -35,45 +35,7 @@ #define DWC2_DEBUG 2 #include "device/dcd.h" -#include "dwc2_type.h" - -// Following symbols must be defined by port header -// - _dwc2_controller[]: array of controllers -// - DWC2_EP_MAX: largest EP counts of all controllers -// - dwc2_phy_init/dwc2_phy_update: phy init called before and after core reset -// - dwc2_dcd_int_enable/dwc2_dcd_int_disable -// - dwc2_remote_wakeup_delay - -#if defined(TUP_USBIP_DWC2_STM32) - #include "dwc2_stm32.h" -#elif defined(TUP_USBIP_DWC2_ESP32) - #include "dwc2_esp32.h" -#elif TU_CHECK_MCU(OPT_MCU_GD32VF103) - #include "dwc2_gd32.h" -#elif TU_CHECK_MCU(OPT_MCU_BCM2711, OPT_MCU_BCM2835, OPT_MCU_BCM2837) - #include "dwc2_bcm.h" -#elif TU_CHECK_MCU(OPT_MCU_EFM32GG) - #include "dwc2_efm32.h" -#elif TU_CHECK_MCU(OPT_MCU_XMC4000) - #include "dwc2_xmc.h" -#else - #error "Unsupported MCUs" -#endif - -enum { - DWC2_CONTROLLER_COUNT = TU_ARRAY_SIZE(_dwc2_controller) -}; - -// DWC2 registers -//#define DWC2_REG(_port) ((dwc2_regs_t*) _dwc2_controller[_port].reg_base) - -TU_ATTR_ALWAYS_INLINE static inline dwc2_regs_t* DWC2_REG(uint8_t rhport) { - if (rhport >= DWC2_CONTROLLER_COUNT) { - // user mis-configured, ignore and use first controller - rhport = 0; - } - return (dwc2_regs_t*) _dwc2_controller[rhport].reg_base; -} +#include "dwc2_common.h" //--------------------------------------------------------------------+ // MACRO TYPEDEF CONSTANT ENUM @@ -94,7 +56,7 @@ static xfer_ctl_t xfer_status[DWC2_EP_MAX][2]; // EP0 transfers are limited to 1 packet - larger sizes has to be split static uint16_t ep0_pending[2]; // Index determines direction as tusb_dir_t type -static uint16_t _dfifo_top; // top free location in FIFO RAM +static uint16_t _dfifo_top; // top free location in DFIFO in words // Number of IN endpoints active static uint8_t _allocated_ep_in_count; @@ -106,20 +68,10 @@ static bool _sof_en; // DMA //-------------------------------------------------------------------- -TU_ATTR_ALWAYS_INLINE static inline bool dma_enabled(const dwc2_regs_t* dwc2) { - #if !CFG_TUD_DWC2_DMA +TU_ATTR_ALWAYS_INLINE static inline bool dma_device_enabled(const dwc2_regs_t* dwc2) { (void) dwc2; - return false; - #else // Internal DMA only - return (dwc2->ghwcfg2_bm.arch == GHWCFG2_ARCH_INTERNAL_DMA); - #endif -} - -TU_ATTR_ALWAYS_INLINE static inline uint16_t dma_cal_epfifo_base(uint8_t rhport) { - // Scatter/Gather DMA mode is not yet supported. Buffer DMA only need 1 words per endpoint direction - const dwc2_controller_t* dwc2_controller = &_dwc2_controller[rhport]; - return dwc2_controller->ep_fifo_size/4 - 2*dwc2_controller->ep_count; + return CFG_TUD_DWC2_DMA && dwc2->ghwcfg2_bm.arch == GHWCFG2_ARCH_INTERNAL_DMA; } static void dma_setup_prepare(uint8_t rhport) { @@ -141,18 +93,8 @@ static void dma_setup_prepare(uint8_t rhport) { // Data FIFO //--------------------------------------------------------------------+ -TU_ATTR_ALWAYS_INLINE static inline void dfifo_flush_tx(dwc2_regs_t* dwc2, uint8_t epnum) { - // flush TX fifo and wait for it cleared - dwc2->grstctl = GRSTCTL_TXFFLSH | (epnum << GRSTCTL_TXFNUM_Pos); - while (dwc2->grstctl & GRSTCTL_TXFFLSH_Msk) {} -} -TU_ATTR_ALWAYS_INLINE static inline void dfifo_flush_rx(dwc2_regs_t* dwc2) { - // flush RX fifo and wait for it cleared - dwc2->grstctl = GRSTCTL_RXFFLSH; - while (dwc2->grstctl & GRSTCTL_RXFFLSH_Msk) {} -} -/* USB Data FIFO Layout +/* Device Data FIFO scheme The FIFO is split up into - EPInfo: for storing DMA metadata, only required when use DMA. Maximum size is called @@ -167,11 +109,9 @@ TU_ATTR_ALWAYS_INLINE static inline void dfifo_flush_rx(dwc2_regs_t* dwc2) { possible since the free space is located between the RX and TX FIFOs. ---------------- ep_fifo_size - | EPInfo | - | for DMA | + | DxEPIDMAn | |-------------|-- gdfifocfg.EPINFOBASE (max is ghwcfg3.dfifo_depth) - | IN FIFO 0 | - | control | + | IN FIFO 0 | control EP |-------------| | IN FIFO 1 | |-------------| @@ -190,13 +130,13 @@ TU_ATTR_ALWAYS_INLINE static inline void dfifo_flush_rx(dwc2_regs_t* dwc2) { - All EP OUT shared a unique OUT FIFO which uses (for Slave or Buffer DMA, Scatt/Gather DMA use different formula): - 13 for setup packets + control words (up to 3 setup packets). - 1 for global NAK (not required/used here). - - Largest-EPsize / 4 + 1. ( FS: 64 bytes, HS: 512 bytes). Recommended is "2 x (Largest-EPsize/4) + 1" + - Largest-EPsize/4 + 1. ( FS: 64 bytes, HS: 512 bytes). Recommended is "2 x (Largest-EPsize/4 + 1)" - 2 for each used OUT endpoint Therefore GRXFSIZ = 13 + 1 + 2 x (Largest-EPsize/4 + 1) + 2 x EPOUTnum */ -TU_ATTR_ALWAYS_INLINE static inline uint16_t calc_grxfsiz(uint16_t largest_ep_size, uint8_t ep_count) { +TU_ATTR_ALWAYS_INLINE static inline uint16_t calc_device_grxfsiz(uint16_t largest_ep_size, uint8_t ep_count) { return 13 + 1 + 2 * ((largest_ep_size / 4) + 1) + 2 * ep_count; } @@ -212,7 +152,7 @@ static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { uint16_t fifo_size = tu_div_ceil(packet_size, 4); if (dir == TUSB_DIR_OUT) { // Calculate required size of RX FIFO - uint16_t const new_sz = calc_grxfsiz(4 * fifo_size, ep_count); + uint16_t const new_sz = calc_device_grxfsiz(4 * fifo_size, ep_count); // If size_rx needs to be extended check if there is enough free space if (dwc2->grxfsiz < new_sz) { @@ -227,7 +167,7 @@ static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { } // If The TXFELVL is configured as half empty, the fifo must be twice the max_size. - if ((dwc2->gahbcfg & GAHBCFG_TXFELVL) == 0) { + if ((dwc2->gahbcfg & GAHBCFG_TX_FIFO_EPMTY_LVL) == 0) { fifo_size *= 2; } @@ -248,70 +188,23 @@ static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { return true; } -static void dfifo_init(uint8_t rhport) { +static void dfifo_device_init(uint8_t rhport) { const dwc2_controller_t* dwc2_controller = &_dwc2_controller[rhport]; dwc2_regs_t* dwc2 = DWC2_REG(rhport); - dwc2->grxfsiz = calc_grxfsiz(CFG_TUD_ENDPOINT0_SIZE, dwc2_controller->ep_count); + dwc2->grxfsiz = calc_device_grxfsiz(CFG_TUD_ENDPOINT0_SIZE, dwc2_controller->ep_count); - if(dma_enabled(dwc2)) { - // DMA use last DFIFO to store metadata - _dfifo_top = dma_cal_epfifo_base(rhport); - }else { - _dfifo_top = dwc2_controller->ep_fifo_size / 4; + // Scatter/Gather DMA mode is not yet supported. Buffer DMA only need 1 words per endpoint direction + const bool is_dma = dma_device_enabled(dwc2); + _dfifo_top = dwc2_controller->ep_fifo_size/4; + if (is_dma) { + _dfifo_top -= 2 * dwc2_controller->ep_count; } + dwc2->gdfifocfg = (_dfifo_top << GDFIFOCFG_EPINFOBASE_SHIFT) | _dfifo_top; // Allocate FIFO for EP0 IN dfifo_alloc(rhport, 0x80, CFG_TUD_ENDPOINT0_SIZE); } -// Read a single data packet from receive FIFO -static void dfifo_read_packet(uint8_t rhport, uint8_t* dst, uint16_t len) { - (void) rhport; - - dwc2_regs_t* dwc2 = DWC2_REG(rhport); - volatile const uint32_t* rx_fifo = dwc2->fifo[0]; - - // Reading full available 32 bit words from fifo - uint16_t full_words = len >> 2; - while (full_words--) { - tu_unaligned_write32(dst, *rx_fifo); - dst += 4; - } - - // Read the remaining 1-3 bytes from fifo - uint8_t const bytes_rem = len & 0x03; - if (bytes_rem != 0) { - uint32_t const tmp = *rx_fifo; - dst[0] = tu_u32_byte0(tmp); - if (bytes_rem > 1) dst[1] = tu_u32_byte1(tmp); - if (bytes_rem > 2) dst[2] = tu_u32_byte2(tmp); - } -} - -// Write a single data packet to EPIN FIFO -static void dfifo_write_packet(uint8_t rhport, uint8_t fifo_num, uint8_t const* src, uint16_t len) { - (void) rhport; - - dwc2_regs_t* dwc2 = DWC2_REG(rhport); - volatile uint32_t* tx_fifo = dwc2->fifo[fifo_num]; - - // Pushing full available 32 bit words to fifo - uint16_t full_words = len >> 2; - while (full_words--) { - *tx_fifo = tu_unaligned_read32(src); - src += 4; - } - - // Write the remaining 1-3 bytes into fifo - uint8_t const bytes_rem = len & 0x03; - if (bytes_rem) { - uint32_t tmp_word = src[0]; - if (bytes_rem > 1) tmp_word |= (src[1] << 8); - if (bytes_rem > 2) tmp_word |= (src[2] << 16); - - *tx_fifo = tmp_word; - } -} //-------------------------------------------------------------------- // Endpoint @@ -326,7 +219,7 @@ static uint8_t get_free_fifo(void) { return 0; } #endif - + static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); @@ -434,6 +327,10 @@ static void bus_reset(uint8_t rhport) { } } +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + _allocated_fifos = 1; +#endif + dfifo_flush_tx(dwc2, 0x10); // all tx fifo dfifo_flush_rx(dwc2); @@ -443,7 +340,7 @@ static void bus_reset(uint8_t rhport) { dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM; // 4. Set up DFIFO - dfifo_init(rhport); + dfifo_device_init(rhport); // 5. Reset device address dwc2->dcfg &= ~DCFG_DAD_Msk; @@ -455,7 +352,7 @@ static void bus_reset(uint8_t rhport) { xfer_status[0][TUSB_DIR_OUT].max_size = 64; xfer_status[0][TUSB_DIR_IN].max_size = 64; - if(dma_enabled(dwc2)) { + if(dma_device_enabled(dwc2)) { dma_setup_prepare(rhport); } else { dwc2->epout[0].doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); @@ -485,9 +382,9 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c if (dir == TUSB_DIR_IN) { // A full IN transfer (multiple packets, possibly) triggers XFRC. dep->dieptsiz = (num_packets << DIEPTSIZ_PKTCNT_Pos) | - ((total_bytes << DIEPTSIZ_XFRSIZ_Pos) & DIEPTSIZ_XFRSIZ_Msk); + ((total_bytes << DIEPTSIZ_XFRSIZ_Pos) & DIEPTSIZ_XFRSIZ_Msk); - if(dma_enabled(dwc2)) { + if(dma_device_enabled(dwc2)) { dep->diepdma = (uintptr_t)xfer->buffer; // For ISO endpoint set correct odd/even bit for next frame. @@ -525,7 +422,7 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c dep->doepctl |= (odd_frame_now ? DOEPCTL_SD0PID_SEVNFRM_Msk : DOEPCTL_SODDFRM_Msk); } - if(dma_enabled(dwc2)) { + if(dma_device_enabled(dwc2)) { dep->doepdma = (uintptr_t)xfer->buffer; } @@ -533,174 +430,41 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c } } -/*------------------------------------------------------------------*/ -/* Controller API - *------------------------------------------------------------------*/ - -static void reset_core(dwc2_regs_t* dwc2) { - // reset core - dwc2->grstctl |= GRSTCTL_CSRST; - - // wait for reset bit is cleared - // TODO version 4.20a should wait for RESET DONE mask - while (dwc2->grstctl & GRSTCTL_CSRST) {} - - // wait for AHB master IDLE - while (!(dwc2->grstctl & GRSTCTL_AHBIDL)) {} - - // wait for device mode ? -} - -static bool phy_hs_supported(dwc2_regs_t* dwc2) { - (void) dwc2; - -#if !TUD_OPT_HIGH_SPEED - return false; -#else - return dwc2->ghwcfg2_bm.hs_phy_type != GHWCFG2_HSPHY_NOT_SUPPORTED; -#endif -} - -static void phy_fs_init(dwc2_regs_t* dwc2) { - TU_LOG(DWC2_DEBUG, "Fullspeed PHY init\r\n"); - - // Select FS PHY - dwc2->gusbcfg |= GUSBCFG_PHYSEL; - - // MCU specific PHY init before reset - dwc2_phy_init(dwc2, GHWCFG2_HSPHY_NOT_SUPPORTED); - - // Reset core after selecting PHY - reset_core(dwc2); - - // USB turnaround time is critical for certification where long cables and 5-Hubs are used. - // So if you need the AHB to run at less than 30 MHz, and if USB turnaround time is not critical, - // these bits can be programmed to a larger value. Default is 5 - dwc2->gusbcfg = (dwc2->gusbcfg & ~GUSBCFG_TRDT_Msk) | (5u << GUSBCFG_TRDT_Pos); - - // MCU specific PHY update post reset - dwc2_phy_update(dwc2, GHWCFG2_HSPHY_NOT_SUPPORTED); - - // set max speed - dwc2->dcfg = (dwc2->dcfg & ~DCFG_DSPD_Msk) | (DCFG_DSPD_FS << DCFG_DSPD_Pos); -} - -static void phy_hs_init(dwc2_regs_t* dwc2) { - uint32_t gusbcfg = dwc2->gusbcfg; - - // De-select FS PHY - gusbcfg &= ~GUSBCFG_PHYSEL; - - if (dwc2->ghwcfg2_bm.hs_phy_type == GHWCFG2_HSPHY_ULPI) { - TU_LOG(DWC2_DEBUG, "Highspeed ULPI PHY init\r\n"); - - // Select ULPI - gusbcfg |= GUSBCFG_ULPI_UTMI_SEL; - - // ULPI 8-bit interface, single data rate - gusbcfg &= ~(GUSBCFG_PHYIF16 | GUSBCFG_DDRSEL); - - // default internal VBUS Indicator and Drive - gusbcfg &= ~(GUSBCFG_ULPIEVBUSD | GUSBCFG_ULPIEVBUSI); - - // Disable FS/LS ULPI - gusbcfg &= ~(GUSBCFG_ULPIFSLS | GUSBCFG_ULPICSM); - } else { - TU_LOG(DWC2_DEBUG, "Highspeed UTMI+ PHY init\r\n"); - - // Select UTMI+ with 8-bit interface - gusbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16); - - // Set 16-bit interface if supported - if (dwc2->ghwcfg4_bm.phy_data_width) { - gusbcfg |= GUSBCFG_PHYIF16; - } - } - - // Apply config - dwc2->gusbcfg = gusbcfg; - - // mcu specific phy init - dwc2_phy_init(dwc2, dwc2->ghwcfg2_bm.hs_phy_type); - - // Reset core after selecting PHY - reset_core(dwc2); - - // Set turn-around, must after core reset otherwise it will be clear - // - 9 if using 8-bit PHY interface - // - 5 if using 16-bit PHY interface - gusbcfg &= ~GUSBCFG_TRDT_Msk; - gusbcfg |= (dwc2->ghwcfg4_bm.phy_data_width ? 5u : 9u) << GUSBCFG_TRDT_Pos; - dwc2->gusbcfg = gusbcfg; - - // MCU specific PHY update post reset - dwc2_phy_update(dwc2, dwc2->ghwcfg2_bm.hs_phy_type); - - // Set max speed - uint32_t dcfg = dwc2->dcfg; - dcfg &= ~DCFG_DSPD_Msk; - dcfg |= DCFG_DSPD_HS << DCFG_DSPD_Pos; - - // XCVRDLY: transceiver delay between xcvr_sel and txvalid during device chirp is required - // when using with some PHYs such as USB334x (USB3341, USB3343, USB3346, USB3347) - if (dwc2->ghwcfg2_bm.hs_phy_type == GHWCFG2_HSPHY_ULPI) { - dcfg |= DCFG_XCVRDLY; - } - - dwc2->dcfg = dcfg; -} - -static bool check_dwc2(dwc2_regs_t* dwc2) { -#if CFG_TUSB_DEBUG >= DWC2_DEBUG - // print guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4 - // Run 'python dwc2_info.py' and check dwc2_info.md for bit-field value and comparison with other ports - volatile uint32_t const* p = (volatile uint32_t const*) &dwc2->guid; - TU_LOG1("guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4\r\n"); - for (size_t i = 0; i < 5; i++) { - TU_LOG1("0x%08" PRIX32 ", ", p[i]); - } - TU_LOG1("0x%08" PRIX32 "\r\n", p[5]); -#endif - - // For some reason: GD32VF103 snpsid and all hwcfg register are always zero (skip it) - (void) dwc2; -#if !TU_CHECK_MCU(OPT_MCU_GD32VF103) - uint32_t const gsnpsid = dwc2->gsnpsid & GSNPSID_ID_MASK; - TU_ASSERT(gsnpsid == DWC2_OTG_ID || gsnpsid == DWC2_FS_IOT_ID || gsnpsid == DWC2_HS_IOT_ID); -#endif - - return true; -} - +//-------------------------------------------------------------------- +// Controller API +//-------------------------------------------------------------------- bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) { - (void) rhport; (void) rh_init; - // Programming model begins in the last section of the chapter on the USB - // peripheral in each Reference Manual. dwc2_regs_t* dwc2 = DWC2_REG(rhport); - // Check Synopsys ID register, failed if controller clock/power is not enabled - TU_ASSERT(check_dwc2(dwc2)); - dcd_disconnect(rhport); + // Core Initialization + const bool is_highspeed = dwc2_core_is_highspeed(dwc2, TUSB_ROLE_DEVICE); + TU_ASSERT(dwc2_core_init(rhport, is_highspeed)); - if (phy_hs_supported(dwc2)) { - phy_hs_init(dwc2); // Highspeed + if (dma_device_enabled(dwc2)) { + // DMA seems to be only settable after a core reset, and not possible to switch on-the-fly + dwc2->gahbcfg |= GAHBCFG_DMAEN | GAHBCFG_HBSTLEN_2; } else { - phy_fs_init(dwc2); // core does not support highspeed or hs phy is not present + dwc2->gintmsk |= GINTSTS_RXFLVL; } - // Restart PHY clock - dwc2->pcgctl &= ~(PCGCTL_STOPPCLK | PCGCTL_GATEHCLK | PCGCTL_PWRCLMP | PCGCTL_RSTPDWNMODULE); + // Device Initialization + dcd_disconnect(rhport); + + // Set device max speed + uint32_t dcfg = dwc2->dcfg & ~DCFG_DSPD_Msk; + if (is_highspeed) { + dcfg |= DCFG_DSPD_HS << DCFG_DSPD_Pos; - /* Set HS/FS Timeout Calibration to 7 (max available value). - * The number of PHY clocks that the application programs in - * this field is added to the high/full speed interpacket timeout - * duration in the core to account for any additional delays - * introduced by the PHY. This can be required, because the delay - * introduced by the PHY in generating the linestate condition - * can vary from one PHY to another. - */ - dwc2->gusbcfg |= (7ul << GUSBCFG_TOCAL_Pos); + // XCVRDLY: transceiver delay between xcvr_sel and txvalid during device chirp is required + // when using with some PHYs such as USB334x (USB3341, USB3343, USB3346, USB3347) + if (dwc2->ghwcfg2_bm.hs_phy_type == GHWCFG2_HSPHY_ULPI) { + dcfg |= DCFG_XCVRDLY; + } + }else { + dcfg |= DCFG_DSPD_FS << DCFG_DSPD_Pos; + } + dwc2->dcfg = dcfg; // Force device mode dwc2->gusbcfg = (dwc2->gusbcfg & ~GUSBCFG_FHMOD) | GUSBCFG_FDMOD; @@ -708,48 +472,19 @@ bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) { // Clear A override, force B Valid dwc2->gotgctl = (dwc2->gotgctl & ~GOTGCTL_AVALOEN) | GOTGCTL_BVALOEN | GOTGCTL_BVALOVAL; - // If USB host misbehaves during status portion of control xfer - // (non zero-length packet), send STALL back and discard. + // If USB host misbehaves during status portion of control xfer (non zero-length packet), send STALL back and discard dwc2->dcfg |= DCFG_NZLSOHSK; - dfifo_flush_tx(dwc2, 0x10); // all tx fifo - dfifo_flush_rx(dwc2); - - // Clear all interrupts - uint32_t int_mask = dwc2->gintsts; - dwc2->gintsts |= int_mask; - int_mask = dwc2->gotgint; - dwc2->gotgint |= int_mask; - - // Required as part of core initialization. - dwc2->gintmsk = GINTMSK_OTGINT | GINTMSK_USBSUSPM | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM; - - // Configure TX FIFO empty level for interrupt. Default is complete empty - dwc2->gahbcfg |= GAHBCFG_TXFELVL; - - if (dma_enabled(dwc2)) { - const uint16_t epinfo_base = dma_cal_epfifo_base(rhport); - dwc2->gdfifocfg = (epinfo_base << GDFIFOCFG_EPINFOBASE_SHIFT) | epinfo_base; + // Enable required interrupts + dwc2->gintmsk |= GINTMSK_OTGINT | GINTMSK_USBSUSPM | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM; - // DMA seems to be only settable after a core reset - dwc2->gahbcfg |= GAHBCFG_DMAEN | GAHBCFG_HBSTLEN_2; - }else { - dwc2->gintmsk |= GINTMSK_RXFLVLM; - } - - // Enable global interrupt - dwc2->gahbcfg |= GAHBCFG_GINT; - - // make sure we are in device mode -// TU_ASSERT(!(dwc2->gintsts & GINTSTS_CMOD), ); - -// TU_LOG_HEX(DWC2_DEBUG, dwc2->gotgctl); -// TU_LOG_HEX(DWC2_DEBUG, dwc2->gusbcfg); -// TU_LOG_HEX(DWC2_DEBUG, dwc2->dcfg); -// TU_LOG_HEX(DWC2_DEBUG, dwc2->gahbcfg); + // TX FIFO empty level for interrupt is complete empty + uint32_t gahbcfg = dwc2->gahbcfg; + gahbcfg |= GAHBCFG_TX_FIFO_EPMTY_LVL; + gahbcfg |= GAHBCFG_GINT; // Enable global interrupt + dwc2->gahbcfg = gahbcfg; dcd_connect(rhport); - return true; } @@ -866,14 +601,10 @@ void dcd_edpt_close_all(uint8_t rhport) { } } -#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) - _allocated_fifos = 1; -#endif - dfifo_flush_tx(dwc2, 0x10); // all tx fifo dfifo_flush_rx(dwc2); - dfifo_init(rhport); // re-init dfifo + dfifo_device_init(rhport); // re-init dfifo } bool dcd_edpt_iso_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t largest_packet_size) { @@ -904,11 +635,10 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t to // Schedule the first transaction for EP0 transfer edpt_schedule_packets(rhport, epnum, dir, 1, ep0_pending[dir]); } else { - uint16_t num_packets = (total_bytes / xfer->max_size); - uint16_t const short_packet_size = total_bytes % xfer->max_size; - - // Zero-size packet is special case. - if ((short_packet_size > 0) || (total_bytes == 0)) num_packets++; + uint16_t num_packets = tu_div_ceil(total_bytes, xfer->max_size); + if (num_packets == 0) { + num_packets = 1; // zero length packet still count as 1 + } // Schedule packets to be sent within interrupt edpt_schedule_packets(rhport, epnum, dir, num_packets, total_bytes); @@ -952,8 +682,9 @@ void dcd_edpt_close(uint8_t rhport, uint8_t ep_addr) { } void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); edpt_disable(rhport, ep_addr, true); - if((tu_edpt_number(ep_addr) == 0) && dma_enabled(DWC2_REG(rhport))) { + if((tu_edpt_number(ep_addr) == 0) && dma_device_enabled(dwc2)) { dma_setup_prepare(rhport); } } @@ -976,16 +707,15 @@ void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) { // Process shared receive FIFO, this interrupt is only used in Slave mode static void handle_rxflvl_irq(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); - volatile uint32_t const* rx_fifo = dwc2->fifo[0]; + const volatile uint32_t* rx_fifo = dwc2->fifo[0]; // Pop control word off FIFO - uint32_t const grxstsp = dwc2->grxstsp; - uint8_t const pktsts = (grxstsp & GRXSTSP_PKTSTS_Msk) >> GRXSTSP_PKTSTS_Pos; - uint8_t const epnum = (grxstsp & GRXSTSP_EPNUM_Msk) >> GRXSTSP_EPNUM_Pos; - uint16_t const bcnt = (grxstsp & GRXSTSP_BCNT_Msk) >> GRXSTSP_BCNT_Pos; + const dwc2_grxstsp_t grxstsp_bm = dwc2->grxstsp_bm; + const uint8_t epnum = grxstsp_bm.ep_ch_num; + const uint16_t byte_count = grxstsp_bm.byte_count; dwc2_epout_t* epout = &dwc2->epout[epnum]; - switch (pktsts) { + switch (grxstsp_bm.packet_status) { // Global OUT NAK: do nothing case GRXSTS_PKTSTS_GLOBALOUTNAK: break; @@ -1010,18 +740,18 @@ static void handle_rxflvl_irq(uint8_t rhport) { // Read packet off RxFIFO if (xfer->ff) { // Ring buffer - tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void*) (uintptr_t) rx_fifo, bcnt); + tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void*) (uintptr_t) rx_fifo, byte_count); } else { // Linear buffer - dfifo_read_packet(rhport, xfer->buffer, bcnt); + dfifo_read_packet(dwc2, xfer->buffer, byte_count); // Increment pointer to xfer data - xfer->buffer += bcnt; + xfer->buffer += byte_count; } - // Truncate transfer length in case of short packet - if (bcnt < xfer->max_size) { - xfer->total_len -= (epout->doeptsiz & DOEPTSIZ_XFRSIZ_Msk) >> DOEPTSIZ_XFRSIZ_Pos; + // short packet, minus remaining bytes (xfer_size) + if (byte_count < xfer->max_size) { + xfer->total_len -= epout->doeptsiz_bm.xfer_size; if (epnum == 0) { xfer->total_len -= ep0_pending[TUSB_DIR_OUT]; ep0_pending[TUSB_DIR_OUT] = 0; @@ -1070,7 +800,7 @@ static void handle_epout_irq(uint8_t rhport) { if (doepint & DOEPINT_SETUP) { epout->doepint = DOEPINT_SETUP; - if(dma_enabled(dwc2)) { + if(dma_device_enabled(dwc2)) { dma_setup_prepare(rhport); } @@ -1086,7 +816,7 @@ static void handle_epout_irq(uint8_t rhport) { if (!(doepint & (DOEPINT_SETUP | DOEPINT_STPKTRX | DOEPINT_STSPHSRX))) { xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); - if(dma_enabled(dwc2)) { + if(dma_device_enabled(dwc2)) { if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { // EP0 can only handle one packet Schedule another packet to be received. edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); @@ -1118,8 +848,7 @@ static void handle_epout_irq(uint8_t rhport) { static void handle_epin_irq(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const ep_count = _dwc2_controller[rhport].ep_count; - dwc2_epin_t* epin = dwc2->epin; + const uint8_t ep_count = _dwc2_controller[rhport].ep_count; // DAINT for a given EP clears when DIEPINTx is cleared. // IEPINT will be cleared when DAINT's out bits are cleared. @@ -1127,16 +856,17 @@ static void handle_epin_irq(uint8_t rhport) { if (dwc2->daint & TU_BIT(DAINT_IEPINT_Pos + n)) { // IN XFER complete (entire xfer). xfer_ctl_t* xfer = XFER_CTL_BASE(n, TUSB_DIR_IN); + dwc2_epin_t* epin = &dwc2->epin[n]; - if (epin[n].diepint & DIEPINT_XFRC) { - epin[n].diepint = DIEPINT_XFRC; + if (epin->diepint & DIEPINT_XFRC) { + epin->diepint = DIEPINT_XFRC; // EP0 can only handle one packet if ((n == 0) && ep0_pending[TUSB_DIR_IN]) { // Schedule another packet to be transmitted. edpt_schedule_packets(rhport, n, TUSB_DIR_IN, 1, ep0_pending[TUSB_DIR_IN]); } else { - if((n == 0) && dma_enabled(dwc2)) { + if((n == 0) && dma_device_enabled(dwc2)) { dma_setup_prepare(rhport); } dcd_event_xfer_complete(rhport, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); @@ -1144,39 +874,38 @@ static void handle_epin_irq(uint8_t rhport) { } // XFER FIFO empty - if ((epin[n].diepint & DIEPINT_TXFE) && (dwc2->diepempmsk & (1 << n))) { + if ((epin->diepint & DIEPINT_TXFE) && (dwc2->diepempmsk & (1 << n))) { // diepint's TXFE bit is read-only, software cannot clear it. // It will only be cleared by hardware when written bytes is more than // - 64 bytes or - // - Half of TX FIFO size (configured by DIEPTXF) - - uint16_t remaining_packets = (epin[n].dieptsiz & DIEPTSIZ_PKTCNT_Msk) >> DIEPTSIZ_PKTCNT_Pos; + // - Half/Empty of TX FIFO size (configured by GAHBCFG.TXFELVL) + const uint16_t remain_packets = epin->dieptsiz_bm.packet_count; // Process every single packet (only whole packets can be written to fifo) - for (uint16_t i = 0; i < remaining_packets; i++) { - uint16_t const remaining_bytes = (epin[n].dieptsiz & DIEPTSIZ_XFRSIZ_Msk) >> DIEPTSIZ_XFRSIZ_Pos; + for (uint16_t i = 0; i < remain_packets; i++) { + const uint16_t remain_bytes = (uint16_t) epin->dieptsiz_bm.xfer_size; // Packet can not be larger than ep max size - uint16_t const packet_size = tu_min16(remaining_bytes, xfer->max_size); + const uint16_t xact_bytes = tu_min16(remain_bytes, xfer->max_size); // It's only possible to write full packets into FIFO. Therefore DTXFSTS register of current // EP has to be checked if the buffer can take another WHOLE packet - if (packet_size > ((epin[n].dtxfsts & DTXFSTS_INEPTFSAV_Msk) << 2)) break; + if (xact_bytes > ((epin->dtxfsts & DTXFSTS_INEPTFSAV_Msk) << 2)) { + break; + } // Push packet to Tx-FIFO if (xfer->ff) { volatile uint32_t* tx_fifo = dwc2->fifo[n]; - tu_fifo_read_n_const_addr_full_words(xfer->ff, (void*) (uintptr_t) tx_fifo, packet_size); + tu_fifo_read_n_const_addr_full_words(xfer->ff, (void*) (uintptr_t) tx_fifo, xact_bytes); } else { - dfifo_write_packet(rhport, n, xfer->buffer, packet_size); - - // Increment pointer to xfer data - xfer->buffer += packet_size; + dfifo_write_packet(dwc2, n, xfer->buffer, xact_bytes); + xfer->buffer += xact_bytes; } } // Turn off TXFE if all bytes are written. - if (((epin[n].dieptsiz & DIEPTSIZ_XFRSIZ_Msk) >> DIEPTSIZ_XFRSIZ_Pos) == 0) { + if (epin->dieptsiz_bm.xfer_size == 0) { dwc2->diepempmsk &= ~(1 << n); } } @@ -1186,21 +915,11 @@ static void handle_epin_irq(uint8_t rhport) { /* Interrupt Hierarchy - DxEPMSK.XferComplMsk DxEPINTn.XferCompl - | | - +---------- AND --------+ - | - DAINT.xEPnInt DAINTMSK.xEPnMsk - | | - +---------- AND --------+ - | - GINTSTS.xEPInt GINTMSK.xEPIntMsk - | | - +---------- AND --------+ - | - GAHBCFG.GblIntrMsk - | - IRQn + DxEPINTn + | + DAINT.xEPn + | + GINTSTS: xEPInt Note: when OTG_MULTI_PROC_INTRPT = 1, Device Each endpoint interrupt deachint/deachmsk/diepeachmsk/doepeachmsk are combined to generate dedicated interrupt line for each endpoint. From 4213909efa5746e4d36b23c81d6a0fe06048cc73 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:57:49 +0100 Subject: [PATCH 578/636] Update dcd_dwc2.patch --- components/arduino_tinyusb/patches/dcd_dwc2.patch | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/components/arduino_tinyusb/patches/dcd_dwc2.patch b/components/arduino_tinyusb/patches/dcd_dwc2.patch index e93f9629b..9307bd8d0 100755 --- a/components/arduino_tinyusb/patches/dcd_dwc2.patch +++ b/components/arduino_tinyusb/patches/dcd_dwc2.patch @@ -1,6 +1,6 @@ --- a/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:17:40.000000000 +0300 +++ b/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:19:48.000000000 +0300 -@@ -316,6 +316,16 @@ +@@ -209,6 +209,17 @@ //-------------------------------------------------------------------- // Endpoint //-------------------------------------------------------------------- @@ -14,10 +14,11 @@ + return 0; +} +#endif - ++ static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); -@@ -332,7 +342,19 @@ + uint8_t const epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); +@@ -224,7 +235,19 @@ (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | (xfer->max_size << DOEPCTL_MPSIZ_Pos); if (dir == TUSB_DIR_IN) { @@ -38,7 +39,7 @@ } dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; -@@ -840,6 +862,10 @@ +@@ -304,6 +327,10 @@ } } @@ -49,7 +50,7 @@ dfifo_flush_tx(dwc2, 0x10); // all tx fifo dfifo_flush_rx(dwc2); -@@ -1186,6 +1212,9 @@ +@@ -908,6 +935,9 @@ if (int_status & GINTSTS_USBRST) { // USBRST is start of reset. dwc2->gintsts = GINTSTS_USBRST; @@ -59,7 +60,7 @@ bus_reset(rhport); } -@@ -1217,7 +1246,11 @@ +@@ -939,7 +969,11 @@ if (int_status & GINTSTS_USBSUSP) { dwc2->gintsts = GINTSTS_USBSUSP; @@ -72,7 +73,7 @@ } if (int_status & GINTSTS_WKUINT) { -@@ -1234,6 +1267,9 @@ +@@ -956,6 +990,9 @@ if (otg_int & GOTGINT_SEDET) { dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); From 9f70c9f0be2dacf3015d5220f963ba4526ad09fb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:59:13 +0100 Subject: [PATCH 579/636] back to master latest commit --- tools/update-components.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/update-components.sh b/tools/update-components.sh index d5d3f32f2..8b3499875 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -10,15 +10,12 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb" # echo "Updating TinyUSB..." if [ ! -d "$TINYUSB_REPO_DIR" ]; then - git clone -b master "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" - cd "$TINYUSB_REPO_DIR" - git checkout 038be21e4d94c958043eb54d179948cd9e52fe18 - cd - + git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR" else cd $TINYUSB_REPO_DIR git pull # -ff is for cleaning untracked files as well as submodules git clean -ffdx - git checkout 038be21e4d94c958043eb54d179948cd9e52fe18 + cd - fi if [ $? -ne 0 ]; then exit 1; fi From a0c40d4bd9fa4796928a3be563aff2560ae482c4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 12 Nov 2024 23:08:05 +0100 Subject: [PATCH 580/636] Create patch-tinyusb.sh --- tools/patch-tinyusb.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tools/patch-tinyusb.sh diff --git a/tools/patch-tinyusb.sh b/tools/patch-tinyusb.sh new file mode 100644 index 000000000..eeaa4d43b --- /dev/null +++ b/tools/patch-tinyusb.sh @@ -0,0 +1,4 @@ +#!/bin/bash +mv components/arduino_tinyusb/src/dcd_dwc2.c components/arduino_tinyusb/src/dcd_dwc2.c.prev +cp components/arduino_tinyusb/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c components/arduino_tinyusb/src/dcd_dwc2.c +patch -p1 -N -i components/arduino_tinyusb/patches/dcd_dwc2.patch From 52e95e2c33cbc088ef39fffd31774012d20224b1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 12 Nov 2024 23:17:40 +0100 Subject: [PATCH 581/636] Update CMakeLists.txt --- components/arduino_tinyusb/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index 6a2e35150..a3965728d 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -28,6 +28,7 @@ if(CONFIG_TINYUSB_ENABLED) "${COMPONENT_DIR}/src/dcd_dwc2.c" # tusb: #"{COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c" + "{COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c" "${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_device.c" "${COMPONENT_DIR}/tinyusb/src/class/hid/hid_device.c" "${COMPONENT_DIR}/tinyusb/src/class/midi/midi_device.c" From 408773c8c208fe826339b6c8551e848039d6fd89 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:50:47 +0100 Subject: [PATCH 582/636] Update CMakeLists.txt --- components/arduino_tinyusb/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index a3965728d..fd6f5983d 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -27,8 +27,8 @@ if(CONFIG_TINYUSB_ENABLED) # espressif: "${COMPONENT_DIR}/src/dcd_dwc2.c" # tusb: - #"{COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c" - "{COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c" + #"${COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c" + "${COMPONENT_DIR}/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c" "${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_device.c" "${COMPONENT_DIR}/tinyusb/src/class/hid/hid_device.c" "${COMPONENT_DIR}/tinyusb/src/class/midi/midi_device.c" From 8360561488633c0580cac2c1192eb233eb33e38c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:49:48 +0100 Subject: [PATCH 583/636] never ending updates with tinyusb --- components/arduino_tinyusb/src/dcd_dwc2.c | 738 +++++++++++----------- 1 file changed, 382 insertions(+), 356 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index 035e335cd..da4709a72 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -37,6 +37,12 @@ #include "device/dcd.h" #include "dwc2_common.h" +#if TU_CHECK_MCU(OPT_MCU_GD32VF103) + #define DWC2_EP_COUNT(_dwc2) DWC2_EP_MAX +#else + #define DWC2_EP_COUNT(_dwc2) ((_dwc2)->ghwcfg2_bm.num_dev_ep) +#endif + //--------------------------------------------------------------------+ // MACRO TYPEDEF CONSTANT ENUM //--------------------------------------------------------------------+ @@ -71,7 +77,7 @@ static bool _sof_en; TU_ATTR_ALWAYS_INLINE static inline bool dma_device_enabled(const dwc2_regs_t* dwc2) { (void) dwc2; // Internal DMA only - return CFG_TUD_DWC2_DMA && dwc2->ghwcfg2_bm.arch == GHWCFG2_ARCH_INTERNAL_DMA; + return CFG_TUD_DWC2_DMA_ENABLE && dwc2->ghwcfg2_bm.arch == GHWCFG2_ARCH_INTERNAL_DMA; } static void dma_setup_prepare(uint8_t rhport) { @@ -222,20 +228,28 @@ static uint8_t get_free_fifo(void) { static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); - uint8_t const dir = tu_edpt_dir(p_endpoint_desc->bEndpointAddress); + const uint8_t epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); + const uint8_t dir = tu_edpt_dir(p_endpoint_desc->bEndpointAddress); xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, dir); xfer->max_size = tu_edpt_packet_size(p_endpoint_desc); xfer->interval = p_endpoint_desc->bInterval; - // USBAEP, EPTYP, SD0PID_SEVNFRM, MPSIZ are the same for IN and OUT endpoints. - uint32_t epctl = (1 << DOEPCTL_USBAEP_Pos) | - (p_endpoint_desc->bmAttributes.xfer << DOEPCTL_EPTYP_Pos) | - (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | - (xfer->max_size << DOEPCTL_MPSIZ_Pos); + // Endpoint control + union { + uint32_t value; + dwc2_depctl_t bm; + } depctl; + depctl.value = 0; + + depctl.bm.mps = xfer->max_size; + depctl.bm.active = 1; + depctl.bm.type = p_endpoint_desc->bmAttributes.xfer; + if (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS) { + depctl.bm.set_data0_iso_even = 1; + } if (dir == TUSB_DIR_IN) { - //epctl |= (epnum << DIEPCTL_TXFNUM_Pos); + //depctl.bm.tx_fifo_num = epnum; uint8_t fifo_num = epnum; #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) // Special Case for EP5, which is used by CDC but not actually called by the driver @@ -245,13 +259,12 @@ static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoin } else { fifo_num = get_free_fifo(); } - //TU_ASSERT(fifo_num != 0); #endif - epctl |= (fifo_num << DIEPCTL_TXFNUM_Pos); + depctl.bm.tx_fifo_num = fifo_num; } - dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; - dep->ctl = epctl; + dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; + dep->ctl = depctl.value; dwc2->daintmsk |= TU_BIT(epnum + DAINT_SHIFT(dir)); } @@ -261,7 +274,7 @@ static void edpt_disable(uint8_t rhport, uint8_t ep_addr, bool stall) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); const uint8_t epnum = tu_edpt_number(ep_addr); const uint8_t dir = tu_edpt_dir(ep_addr); - dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; + dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; if (dir == TUSB_DIR_IN) { // Only disable currently enabled non-control endpoint @@ -305,128 +318,66 @@ static void edpt_disable(uint8_t rhport, uint8_t ep_addr, bool stall) { } } -// Start of Bus Reset -static void bus_reset(uint8_t rhport) { - dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const ep_count = _dwc2_controller[rhport].ep_count; - - tu_memclr(xfer_status, sizeof(xfer_status)); - - _sof_en = false; - _allocated_ep_in_count = 1; - - // 1. NAK for all OUT endpoints - for (uint8_t n = 0; n < ep_count; n++) { - dwc2->epout[n].doepctl |= DOEPCTL_SNAK; - } - - // 2. Disable all IN endpoints - for (uint8_t n = 0; n < ep_count; n++) { - if (dwc2->epin[n].diepctl & DIEPCTL_EPENA) { - dwc2->epin[n].diepctl |= DIEPCTL_SNAK | DIEPCTL_EPDIS; - } - } - -#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) - _allocated_fifos = 1; -#endif - - dfifo_flush_tx(dwc2, 0x10); // all tx fifo - dfifo_flush_rx(dwc2); - - // 3. Set up interrupt mask for EP0 - dwc2->daintmsk = TU_BIT(DAINTMSK_OEPM_Pos) | TU_BIT(DAINTMSK_IEPM_Pos); - dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM; - dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM; - - // 4. Set up DFIFO - dfifo_device_init(rhport); - - // 5. Reset device address - dwc2->dcfg &= ~DCFG_DAD_Msk; - - // Fixed both control EP0 size to 64 bytes - dwc2->epin[0].diepctl &= ~(0x03 << DIEPCTL_MPSIZ_Pos); - dwc2->epout[0].doepctl &= ~(0x03 << DOEPCTL_MPSIZ_Pos); - - xfer_status[0][TUSB_DIR_OUT].max_size = 64; - xfer_status[0][TUSB_DIR_IN].max_size = 64; - - if(dma_device_enabled(dwc2)) { - dma_setup_prepare(rhport); - } else { - dwc2->epout[0].doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); - } - - dwc2->gintmsk |= GINTMSK_OEPINT | GINTMSK_IEPINT; -} - -static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t const dir, uint16_t const num_packets, - uint16_t total_bytes) { - (void) rhport; - +static void edpt_schedule_packets(uint8_t rhport, const uint8_t epnum, const uint8_t dir) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); xfer_ctl_t* const xfer = XFER_CTL_BASE(epnum, dir); + dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; - // EP0 is limited to one packet each xfer - // We use multiple transaction of xfer->max_size length to get a whole transfer done + uint16_t num_packets; + uint16_t total_bytes; + + // EP0 is limited to one packet per xfer if (epnum == 0) { total_bytes = tu_min16(ep0_pending[dir], xfer->max_size); ep0_pending[dir] -= total_bytes; + num_packets = 1; + } else { + total_bytes = xfer->total_len; + num_packets = tu_div_ceil(total_bytes, xfer->max_size); + if (num_packets == 0) { + num_packets = 1; // zero length packet still count as 1 + } } - // IN and OUT endpoint xfers are interrupt-driven, we just schedule them here. - const uint8_t is_epout = 1 - dir; - dwc2_dep_t* dep = &dwc2->ep[is_epout][epnum]; - - if (dir == TUSB_DIR_IN) { - // A full IN transfer (multiple packets, possibly) triggers XFRC. - dep->dieptsiz = (num_packets << DIEPTSIZ_PKTCNT_Pos) | - ((total_bytes << DIEPTSIZ_XFRSIZ_Pos) & DIEPTSIZ_XFRSIZ_Msk); - - if(dma_device_enabled(dwc2)) { - dep->diepdma = (uintptr_t)xfer->buffer; - - // For ISO endpoint set correct odd/even bit for next frame. - if ((dep->diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { - // Take odd/even bit from frame counter. - uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); - dep->diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); - } - - dep->diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; + // transfer size: A full OUT transfer (multiple packets, possibly) triggers XFRC. + union { + uint32_t value; + dwc2_ep_tsize_t bm; + } deptsiz; + deptsiz.value = 0; + deptsiz.bm.xfer_size = total_bytes; + deptsiz.bm.packet_count = num_packets; + + dep->tsiz = deptsiz.value; + + // control + union { + dwc2_depctl_t bm; + uint32_t value; + } depctl; + depctl.value = dep->ctl; + + depctl.bm.clear_nak = 1; + depctl.bm.enable = 1; + if (depctl.bm.type == DEPCTL_EPTYPE_ISOCHRONOUS && xfer->interval == 1) { + const uint32_t odd_now = (dwc2->dsts_bm.frame_number & 1u); + if (odd_now) { + depctl.bm.set_data0_iso_even = 1; } else { - dep->diepctl |= DIEPCTL_EPENA | DIEPCTL_CNAK; - - // For ISO endpoint set correct odd/even bit for next frame. - if ((dep->diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { - // Take odd/even bit from frame counter. - uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); - dep->diepctl |= (odd_frame_now ? DIEPCTL_SD0PID_SEVNFRM_Msk : DIEPCTL_SODDFRM_Msk); - } - // Enable fifo empty interrupt only if there are something to put in the fifo. - if (total_bytes != 0) { - dwc2->diepempmsk |= (1 << epnum); - } - } - } else { - // A full OUT transfer (multiple packets, possibly) triggers XFRC. - dep->doeptsiz &= ~(DOEPTSIZ_PKTCNT_Msk | DOEPTSIZ_XFRSIZ); - dep->doeptsiz |= (num_packets << DOEPTSIZ_PKTCNT_Pos) | - ((total_bytes << DOEPTSIZ_XFRSIZ_Pos) & DOEPTSIZ_XFRSIZ_Msk); - - if ((dep->doepctl & DOEPCTL_EPTYP) == DOEPCTL_EPTYP_0 && - XFER_CTL_BASE(epnum, dir)->interval == 1) { - // Take odd/even bit from frame counter. - uint32_t const odd_frame_now = (dwc2->dsts & (1u << DSTS_FNSOF_Pos)); - dep->doepctl |= (odd_frame_now ? DOEPCTL_SD0PID_SEVNFRM_Msk : DOEPCTL_SODDFRM_Msk); + depctl.bm.set_data1_iso_odd = 1; } + } - if(dma_device_enabled(dwc2)) { - dep->doepdma = (uintptr_t)xfer->buffer; - } + const bool is_dma = dma_device_enabled(dwc2); + if(is_dma) { + dep->diepdma = (uintptr_t) xfer->buffer; + } + + dep->diepctl = depctl.value; // enable endpoint - dep->doepctl |= DOEPCTL_EPENA | DOEPCTL_CNAK; + // Slave: enable tx fifo empty interrupt only if there is data. Note must after depctl enable + if (!is_dma && dir == TUSB_DIR_IN && total_bytes != 0) { + dwc2->diepempmsk |= (1 << epnum); } } @@ -439,18 +390,10 @@ bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) { // Core Initialization const bool is_highspeed = dwc2_core_is_highspeed(dwc2, TUSB_ROLE_DEVICE); - TU_ASSERT(dwc2_core_init(rhport, is_highspeed)); - - if (dma_device_enabled(dwc2)) { - // DMA seems to be only settable after a core reset, and not possible to switch on-the-fly - dwc2->gahbcfg |= GAHBCFG_DMAEN | GAHBCFG_HBSTLEN_2; - } else { - dwc2->gintmsk |= GINTSTS_RXFLVL; - } - - // Device Initialization - dcd_disconnect(rhport); + const bool is_dma = dma_device_enabled(dwc2); + TU_ASSERT(dwc2_core_init(rhport, is_highspeed, is_dma)); + //------------- 7.1 Device Initialization -------------// // Set device max speed uint32_t dcfg = dwc2->dcfg & ~DCFG_DSPD_Msk; if (is_highspeed) { @@ -461,20 +404,21 @@ bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) { if (dwc2->ghwcfg2_bm.hs_phy_type == GHWCFG2_HSPHY_ULPI) { dcfg |= DCFG_XCVRDLY; } - }else { + } else { dcfg |= DCFG_DSPD_FS << DCFG_DSPD_Pos; } + + dcfg |= DCFG_NZLSOHSK; // send STALL back and discard if host send non-zlp during control status dwc2->dcfg = dcfg; + dcd_disconnect(rhport); + // Force device mode dwc2->gusbcfg = (dwc2->gusbcfg & ~GUSBCFG_FHMOD) | GUSBCFG_FDMOD; // Clear A override, force B Valid dwc2->gotgctl = (dwc2->gotgctl & ~GOTGCTL_AVALOEN) | GOTGCTL_BVALOEN | GOTGCTL_BVALOVAL; - // If USB host misbehaves during status portion of control xfer (non zero-length packet), send STALL back and discard - dwc2->dcfg |= DCFG_NZLSOHSK; - // Enable required interrupts dwc2->gintmsk |= GINTMSK_OTGINT | GINTMSK_USBSUSPM | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM; @@ -601,6 +545,10 @@ void dcd_edpt_close_all(uint8_t rhport) { } } +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + _allocated_fifos = 1; +#endif + dfifo_flush_tx(dwc2, 0x10); // all tx fifo dfifo_flush_rx(dwc2); @@ -631,19 +579,11 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t to // EP0 can only handle one packet if (epnum == 0) { ep0_pending[dir] = total_bytes; - - // Schedule the first transaction for EP0 transfer - edpt_schedule_packets(rhport, epnum, dir, 1, ep0_pending[dir]); - } else { - uint16_t num_packets = tu_div_ceil(total_bytes, xfer->max_size); - if (num_packets == 0) { - num_packets = 1; // zero length packet still count as 1 - } - - // Schedule packets to be sent within interrupt - edpt_schedule_packets(rhport, epnum, dir, num_packets, total_bytes); } + // Schedule packets to be sent within interrupt + edpt_schedule_packets(rhport, epnum, dir); + return true; } @@ -663,16 +603,9 @@ bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t xfer->ff = ff; xfer->total_len = total_bytes; - uint16_t num_packets = (total_bytes / xfer->max_size); - uint16_t const short_packet_size = total_bytes % xfer->max_size; - - // Zero-size packet is special case. - if (short_packet_size > 0 || (total_bytes == 0)) { - num_packets++; - } - // Schedule packets to be sent within interrupt - edpt_schedule_packets(rhport, epnum, dir, num_packets, total_bytes); + // TODO xfer fifo may only available for slave mode + edpt_schedule_packets(rhport, epnum, dir); return true; } @@ -693,7 +626,7 @@ void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const epnum = tu_edpt_number(ep_addr); uint8_t const dir = tu_edpt_dir(ep_addr); - dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; + dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; // Clear stall and reset data toggle dep->ctl &= ~EPCTL_STALL;; @@ -704,6 +637,99 @@ void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) { // Interrupt Handler //-------------------------------------------------------------------- +// 7.4.1 Initialization on USB Reset +static void handle_bus_reset(uint8_t rhport) { + dwc2_regs_t *dwc2 = DWC2_REG(rhport); + const uint8_t ep_count = DWC2_EP_COUNT(dwc2); + + tu_memclr(xfer_status, sizeof(xfer_status)); + + _sof_en = false; + _allocated_ep_in_count = 1; + + // 1. NAK for all OUT endpoints + for (uint8_t n = 0; n < ep_count; n++) { + dwc2->epout[n].doepctl |= DOEPCTL_SNAK; + } + + // Disable all IN endpoints + for (uint8_t n = 0; n < ep_count; n++) { + if (dwc2->epin[n].diepctl & DIEPCTL_EPENA) { + dwc2->epin[n].diepctl |= DIEPCTL_SNAK | DIEPCTL_EPDIS; + } + } + + // 2. Set up interrupt mask for EP0 + dwc2->daintmsk = TU_BIT(DAINTMSK_OEPM_Pos) | TU_BIT(DAINTMSK_IEPM_Pos); + dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM; + dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM; + + // 4. Set up DFIFO + dfifo_flush_tx(dwc2, 0x10); // all tx fifo + dfifo_flush_rx(dwc2); + dfifo_device_init(rhport); + + // 5. Reset device address + dwc2->dcfg_bm.address = 0; + + // Fixed both control EP0 size to 64 bytes + dwc2->epin[0].ctl &= ~(0x03 << DIEPCTL_MPSIZ_Pos); + dwc2->epout[0].ctl &= ~(0x03 << DOEPCTL_MPSIZ_Pos); + + xfer_status[0][TUSB_DIR_OUT].max_size = 64; + xfer_status[0][TUSB_DIR_IN].max_size = 64; + + if(dma_device_enabled(dwc2)) { + dma_setup_prepare(rhport); + } else { + dwc2->epout[0].doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); + } + + dwc2->gintmsk |= GINTMSK_OEPINT | GINTMSK_IEPINT; +} + +static void handle_enum_done(uint8_t rhport) { + dwc2_regs_t *dwc2 = DWC2_REG(rhport); + tusb_speed_t speed; + switch (dwc2->dsts_bm.enum_speed) { + case DCFG_SPEED_HIGH: + speed = TUSB_SPEED_HIGH; + break; + + case DCFG_SPEED_LOW: + speed = TUSB_SPEED_LOW; + break; + + case DCFG_SPEED_FULL_30_60MHZ: + case DCFG_SPEED_FULL_48MHZ: + default: + speed = TUSB_SPEED_FULL; + break; + } + + // TODO must update GUSBCFG_TRDT according to link speed + dcd_event_bus_reset(rhport, speed, true); +} + +#if 0 +TU_ATTR_ALWAYS_INLINE static inline void print_doepint(uint32_t doepint) { + const char* str[] = { + "XFRC", "DIS", "AHBERR", "SETUP_DONE", + "ORXED", "STATUS_RX", "SETUP_B2B", "RSV7", + "OPERR", "BNA", "RSV10", "ISODROP", + "BBLERR", "NAK", "NYET", "SETUP_RX" + }; + + for(uint32_t i=0; i<TU_ARRAY_SIZE(str); i++) { + if (doepint & TU_BIT(i)) { + TU_LOG1("%s ", str[i]); + } + } + TU_LOG1("\r\n"); +} +#endif + +#if CFG_TUD_DWC2_SLAVE_ENABLE // Process shared receive FIFO, this interrupt is only used in Slave mode static void handle_rxflvl_irq(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); @@ -712,262 +738,266 @@ static void handle_rxflvl_irq(uint8_t rhport) { // Pop control word off FIFO const dwc2_grxstsp_t grxstsp_bm = dwc2->grxstsp_bm; const uint8_t epnum = grxstsp_bm.ep_ch_num; - const uint16_t byte_count = grxstsp_bm.byte_count; - dwc2_epout_t* epout = &dwc2->epout[epnum]; + + dwc2_dep_t* epout = &dwc2->epout[epnum]; switch (grxstsp_bm.packet_status) { - // Global OUT NAK: do nothing - case GRXSTS_PKTSTS_GLOBALOUTNAK: + case GRXSTS_PKTSTS_GLOBAL_OUT_NAK: + // Global OUT NAK: do nothing break; - case GRXSTS_PKTSTS_SETUPRX: + case GRXSTS_PKTSTS_SETUP_RX: // Setup packet received - // We can receive up to three setup packets in succession, but only the last one is valid. + // We can receive up to three setup packets in succession, but only the last one is valid. _setup_packet[0] = (*rx_fifo); _setup_packet[1] = (*rx_fifo); break; - case GRXSTS_PKTSTS_SETUPDONE: + case GRXSTS_PKTSTS_SETUP_DONE: // Setup packet done: // After popping this out, dwc2 asserts a DOEPINT_SETUP interrupt which is handled by handle_epout_irq() epout->doeptsiz |= (3 << DOEPTSIZ_STUPCNT_Pos); break; - case GRXSTS_PKTSTS_OUTRX: { + case GRXSTS_PKTSTS_RX_DATA: { // Out packet received + const uint16_t byte_count = grxstsp_bm.byte_count; xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); - // Read packet off RxFIFO - if (xfer->ff) { - // Ring buffer - tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void*) (uintptr_t) rx_fifo, byte_count); - } else { - // Linear buffer - dfifo_read_packet(dwc2, xfer->buffer, byte_count); - - // Increment pointer to xfer data - xfer->buffer += byte_count; - } + if (byte_count) { + // Read packet off RxFIFO + if (xfer->ff) { + tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void*) (uintptr_t) rx_fifo, byte_count); + } else { + dfifo_read_packet(dwc2, xfer->buffer, byte_count); + xfer->buffer += byte_count; + } - // short packet, minus remaining bytes (xfer_size) - if (byte_count < xfer->max_size) { - xfer->total_len -= epout->doeptsiz_bm.xfer_size; - if (epnum == 0) { - xfer->total_len -= ep0_pending[TUSB_DIR_OUT]; - ep0_pending[TUSB_DIR_OUT] = 0; + // short packet, minus remaining bytes (xfer_size) + if (byte_count < xfer->max_size) { + xfer->total_len -= epout->tsiz_bm.xfer_size; + if (epnum == 0) { + xfer->total_len -= ep0_pending[TUSB_DIR_OUT]; + ep0_pending[TUSB_DIR_OUT] = 0; + } } } break; } - case GRXSTS_PKTSTS_OUTDONE: - /* Out packet done - After this entry is popped from the receive FIFO, dwc2 asserts a Transfer Completed interrupt on - the specified OUT endpoint which will be handled by handle_epout_irq() */ + case GRXSTS_PKTSTS_RX_COMPLETE: + // Out packet done + // After this entry is popped from the receive FIFO, dwc2 asserts a Transfer Completed interrupt on + // the specified OUT endpoint which will be handled by handle_epout_irq() break; - default: - TU_BREAKPOINT(); - break; + default: break; } } -static void handle_epout_irq(uint8_t rhport) { - dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const ep_count = _dwc2_controller[rhport].ep_count; +static void handle_epout_slave(uint8_t rhport, uint8_t epnum, dwc2_doepint_t doepint_bm) { + if (doepint_bm.setup_phase_done) { + dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); + return; + } - // DAINT for a given EP clears when DOEPINTx is cleared. - // OEPINT will be cleared when DAINT's out bits are cleared. - for (uint8_t epnum = 0; epnum < ep_count; epnum++) { - if (dwc2->daint & TU_BIT(DAINT_OEPINT_Pos + epnum)) { - dwc2_epout_t* epout = &dwc2->epout[epnum]; - const uint32_t doepint = epout->doepint; - TU_ASSERT((epout->doepint & DOEPINT_AHBERR) == 0, ); - - // Setup and/or STPKTRX/STSPHSRX (from 3.00a) can be set along with XFRC, and also set independently. - if (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a) { - if (doepint & DOEPINT_STSPHSRX) { - // Status phase received for control write: In token received from Host - epout->doepint = DOEPINT_STSPHSRX; - } + // Normal OUT transfer complete + if (doepint_bm.xfer_complete) { + // only handle data skip if it is setup or status related + // Note: even though (xfer_complete + status_phase_rx) is for buffered DMA only, for STM32L47x (dwc2 v3.00a) they + // can is set when GRXSTS_PKTSTS_SETUP_RX is popped therefore they can bet set before/together with setup_phase_done + if (!doepint_bm.status_phase_rx && !doepint_bm.setup_packet_rx) { + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); - if (doepint & DOEPINT_STPKTRX) { - // New setup packet received, but wait for Setup done, since we can receive up to 3 setup consecutively - epout->doepint = DOEPINT_STPKTRX; - } + if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { + // EP0 can only handle one packet, Schedule another packet to be received. + edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT); + } else { + dcd_event_xfer_complete(rhport, epnum, xfer->total_len, XFER_RESULT_SUCCESS, true); } + } + } +} - if (doepint & DOEPINT_SETUP) { - epout->doepint = DOEPINT_SETUP; +static void handle_epin_slave(uint8_t rhport, uint8_t epnum, dwc2_diepint_t diepint_bm) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + dwc2_dep_t* epin = &dwc2->epin[epnum]; + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_IN); - if(dma_device_enabled(dwc2)) { - dma_setup_prepare(rhport); - } + if (diepint_bm.xfer_complete) { + if ((epnum == 0) && ep0_pending[TUSB_DIR_IN]) { + // EP0 can only handle one packet. Schedule another packet to be transmitted. + edpt_schedule_packets(rhport, epnum, TUSB_DIR_IN); + } else { + dcd_event_xfer_complete(rhport, epnum | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); + } + } + + // TX FIFO empty bit is read-only. It will only be cleared by hardware when written bytes is more than + // - 64 bytes or + // - Half/Empty of TX FIFO size (configured by GAHBCFG.TXFELVL) + if (diepint_bm.txfifo_empty && (dwc2->diepempmsk & (1 << epnum))) { + const uint16_t remain_packets = epin->tsiz_bm.packet_count; - dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); + // Process every single packet (only whole packets can be written to fifo) + for (uint16_t i = 0; i < remain_packets; i++) { + const uint16_t remain_bytes = (uint16_t) epin->tsiz_bm.xfer_size; + const uint16_t xact_bytes = tu_min16(remain_bytes, xfer->max_size); + + // Check if dtxfsts has enough space available + if (xact_bytes > ((epin->dtxfsts & DTXFSTS_INEPTFSAV_Msk) << 2)) { + break; } - // OUT XFER complete - if (doepint & DOEPINT_XFRC) { - epout->doepint = DOEPINT_XFRC; - - // only handle data skip if it is setup or status related - // Normal OUT transfer complete - if (!(doepint & (DOEPINT_SETUP | DOEPINT_STPKTRX | DOEPINT_STSPHSRX))) { - xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); - - if(dma_device_enabled(dwc2)) { - if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { - // EP0 can only handle one packet Schedule another packet to be received. - edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); - } else { - // Fix packet length - uint16_t remain = (epout->doeptsiz & DOEPTSIZ_XFRSIZ_Msk) >> DOEPTSIZ_XFRSIZ_Pos; - xfer->total_len -= remain; - // this is ZLP, so prepare EP0 for next setup - if(epnum == 0 && xfer->total_len == 0) { - dma_setup_prepare(rhport); - } - - dcd_event_xfer_complete(rhport, epnum, xfer->total_len, XFER_RESULT_SUCCESS, true); - } - } else { - // EP0 can only handle one packet - if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { - // Schedule another packet to be received. - edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]); - } else { - dcd_event_xfer_complete(rhport, epnum, xfer->total_len, XFER_RESULT_SUCCESS, true); - } - } - } + // Push packet to Tx-FIFO + if (xfer->ff) { + volatile uint32_t* tx_fifo = dwc2->fifo[epnum]; + tu_fifo_read_n_const_addr_full_words(xfer->ff, (void*)(uintptr_t)tx_fifo, xact_bytes); + } else { + dfifo_write_packet(dwc2, epnum, xfer->buffer, xact_bytes); + xfer->buffer += xact_bytes; } } + + // Turn off TXFE if all bytes are written. + if (epin->tsiz_bm.xfer_size == 0) { + dwc2->diepempmsk &= ~(1 << epnum); + } } } +#endif -static void handle_epin_irq(uint8_t rhport) { +#if CFG_TUD_DWC2_DMA_ENABLE +static void handle_epout_dma(uint8_t rhport, uint8_t epnum, dwc2_doepint_t doepint_bm) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); - const uint8_t ep_count = _dwc2_controller[rhport].ep_count; - // DAINT for a given EP clears when DIEPINTx is cleared. - // IEPINT will be cleared when DAINT's out bits are cleared. - for (uint8_t n = 0; n < ep_count; n++) { - if (dwc2->daint & TU_BIT(DAINT_IEPINT_Pos + n)) { - // IN XFER complete (entire xfer). - xfer_ctl_t* xfer = XFER_CTL_BASE(n, TUSB_DIR_IN); - dwc2_epin_t* epin = &dwc2->epin[n]; - - if (epin->diepint & DIEPINT_XFRC) { - epin->diepint = DIEPINT_XFRC; - - // EP0 can only handle one packet - if ((n == 0) && ep0_pending[TUSB_DIR_IN]) { - // Schedule another packet to be transmitted. - edpt_schedule_packets(rhport, n, TUSB_DIR_IN, 1, ep0_pending[TUSB_DIR_IN]); - } else { - if((n == 0) && dma_device_enabled(dwc2)) { - dma_setup_prepare(rhport); - } - dcd_event_xfer_complete(rhport, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); + if (doepint_bm.setup_phase_done) { + dma_setup_prepare(rhport); + dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); + return; + } + + // OUT XFER complete + if (doepint_bm.xfer_complete) { + // only handle data skip if it is setup or status related + // Normal OUT transfer complete + if (!doepint_bm.status_phase_rx && !doepint_bm.setup_packet_rx) { + if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { + // EP0 can only handle one packet Schedule another packet to be received. + edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT); + } else { + dwc2_dep_t* epout = &dwc2->epout[epnum]; + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); + + // determine actual received bytes + const uint16_t remain = epout->tsiz_bm.xfer_size; + xfer->total_len -= remain; + + // this is ZLP, so prepare EP0 for next setup + // TODO use status phase rx + if(epnum == 0 && xfer->total_len == 0) { + dma_setup_prepare(rhport); } + + dcd_event_xfer_complete(rhport, epnum, xfer->total_len, XFER_RESULT_SUCCESS, true); } + } + } +} - // XFER FIFO empty - if ((epin->diepint & DIEPINT_TXFE) && (dwc2->diepempmsk & (1 << n))) { - // diepint's TXFE bit is read-only, software cannot clear it. - // It will only be cleared by hardware when written bytes is more than - // - 64 bytes or - // - Half/Empty of TX FIFO size (configured by GAHBCFG.TXFELVL) - const uint16_t remain_packets = epin->dieptsiz_bm.packet_count; - - // Process every single packet (only whole packets can be written to fifo) - for (uint16_t i = 0; i < remain_packets; i++) { - const uint16_t remain_bytes = (uint16_t) epin->dieptsiz_bm.xfer_size; - - // Packet can not be larger than ep max size - const uint16_t xact_bytes = tu_min16(remain_bytes, xfer->max_size); - - // It's only possible to write full packets into FIFO. Therefore DTXFSTS register of current - // EP has to be checked if the buffer can take another WHOLE packet - if (xact_bytes > ((epin->dtxfsts & DTXFSTS_INEPTFSAV_Msk) << 2)) { - break; - } +static void handle_epin_dma(uint8_t rhport, uint8_t epnum, dwc2_diepint_t diepint_bm) { + xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_IN); - // Push packet to Tx-FIFO - if (xfer->ff) { - volatile uint32_t* tx_fifo = dwc2->fifo[n]; - tu_fifo_read_n_const_addr_full_words(xfer->ff, (void*) (uintptr_t) tx_fifo, xact_bytes); - } else { - dfifo_write_packet(dwc2, n, xfer->buffer, xact_bytes); - xfer->buffer += xact_bytes; - } - } + if (diepint_bm.xfer_complete) { + if ((epnum == 0) && ep0_pending[TUSB_DIR_IN]) { + // EP0 can only handle one packet. Schedule another packet to be transmitted. + edpt_schedule_packets(rhport, epnum, TUSB_DIR_IN); + } else { + if(epnum == 0) { + dma_setup_prepare(rhport); + } + dcd_event_xfer_complete(rhport, epnum | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true); + } + } +} +#endif - // Turn off TXFE if all bytes are written. - if (epin->dieptsiz_bm.xfer_size == 0) { - dwc2->diepempmsk &= ~(1 << n); +static void handle_ep_irq(uint8_t rhport, uint8_t dir) { + dwc2_regs_t* dwc2 = DWC2_REG(rhport); + const bool is_dma = dma_device_enabled(dwc2); + const uint8_t ep_count = DWC2_EP_COUNT(dwc2); + const uint8_t daint_offset = (dir == TUSB_DIR_IN) ? DAINT_IEPINT_Pos : DAINT_OEPINT_Pos; + dwc2_dep_t* ep_base = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][0]; + + // DAINT for a given EP clears when DEPINTx is cleared. + // EPINT will be cleared when DAINT bits are cleared. + for (uint8_t epnum = 0; epnum < ep_count; epnum++) { + if (dwc2->daint & TU_BIT(daint_offset + epnum)) { + dwc2_dep_t* epout = &ep_base[epnum]; + union { + uint32_t value; + dwc2_diepint_t diepint_bm; + dwc2_doepint_t doepint_bm; + } intr; + intr.value = epout->intr; + + epout->intr = intr.value; // Clear interrupt + + if (is_dma) { + #if CFG_TUD_DWC2_DMA_ENABLE + if (dir == TUSB_DIR_IN) { + handle_epin_dma(rhport, epnum, intr.diepint_bm); + } else { + handle_epout_dma(rhport, epnum, intr.doepint_bm); + } + #endif + } else { + #if CFG_TUD_DWC2_SLAVE_ENABLE + if (dir == TUSB_DIR_IN) { + handle_epin_slave(rhport, epnum, intr.diepint_bm); + } else { + handle_epout_slave(rhport, epnum, intr.doepint_bm); } + #endif } } } } /* Interrupt Hierarchy - - DxEPINTn - | - DAINT.xEPn - | - GINTSTS: xEPInt + DIEPINT DIEPINT + \ / + \ / + DAINT + / \ + / \ + GINTSTS: OEPInt IEPInt | USBReset | EnumDone | USBSusp | WkUpInt | OTGInt | SOF | RXFLVL Note: when OTG_MULTI_PROC_INTRPT = 1, Device Each endpoint interrupt deachint/deachmsk/diepeachmsk/doepeachmsk are combined to generate dedicated interrupt line for each endpoint. */ - - void dcd_int_handler(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint32_t const int_mask = dwc2->gintmsk; - uint32_t const int_status = dwc2->gintsts & int_mask; + const uint32_t gintmask = dwc2->gintmsk; + const uint32_t gintsts = dwc2->gintsts & gintmask; - if (int_status & GINTSTS_USBRST) { + if (gintsts & GINTSTS_USBRST) { // USBRST is start of reset. dwc2->gintsts = GINTSTS_USBRST; #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) _allocated_fifos = 1; #endif - bus_reset(rhport); + handle_bus_reset(rhport); } - if (int_status & GINTSTS_ENUMDNE) { + if (gintsts & GINTSTS_ENUMDNE) { // ENUMDNE is the end of reset where speed of the link is detected dwc2->gintsts = GINTSTS_ENUMDNE; - - tusb_speed_t speed; - switch ((dwc2->dsts & DSTS_ENUMSPD_Msk) >> DSTS_ENUMSPD_Pos) { - case DSTS_ENUMSPD_HS: - speed = TUSB_SPEED_HIGH; - break; - - case DSTS_ENUMSPD_LS: - speed = TUSB_SPEED_LOW; - break; - - case DSTS_ENUMSPD_FS_HSPHY: - case DSTS_ENUMSPD_FS: - default: - speed = TUSB_SPEED_FULL; - break; - } - - // TODO must update GUSBCFG_TRDT according to link speed - - dcd_event_bus_reset(rhport, speed, true); + handle_enum_done(rhport); } - if (int_status & GINTSTS_USBSUSP) { + if (gintsts & GINTSTS_USBSUSP) { dwc2->gintsts = GINTSTS_USBSUSP; //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); @@ -976,7 +1006,7 @@ void dcd_int_handler(uint8_t rhport) { #endif } - if (int_status & GINTSTS_WKUINT) { + if (gintsts & GINTSTS_WKUINT) { dwc2->gintsts = GINTSTS_WKUINT; dcd_event_bus_signal(rhport, DCD_EVENT_RESUME, true); } @@ -984,7 +1014,7 @@ void dcd_int_handler(uint8_t rhport) { // TODO check GINTSTS_DISCINT for disconnect detection // if(int_status & GINTSTS_DISCINT) - if (int_status & GINTSTS_OTGINT) { + if (gintsts & GINTSTS_OTGINT) { // OTG INT bit is read-only uint32_t const otg_int = dwc2->gotgint; @@ -998,7 +1028,7 @@ void dcd_int_handler(uint8_t rhport) { dwc2->gotgint = otg_int; } - if(int_status & GINTSTS_SOF) { + if(gintsts & GINTSTS_SOF) { dwc2->gintsts = GINTSTS_SOF; const uint32_t frame = (dwc2->dsts & DSTS_FNSOF) >> DSTS_FNSOF_Pos; @@ -1010,8 +1040,9 @@ void dcd_int_handler(uint8_t rhport) { dcd_event_sof(rhport, frame, true); } +#if CFG_TUD_DWC2_SLAVE_ENABLE // RxFIFO non-empty interrupt handling. - if (int_status & GINTSTS_RXFLVL) { + if (gintsts & GINTSTS_RXFLVL) { // RXFLVL bit is read-only dwc2->gintmsk &= ~GINTMSK_RXFLVLM; // disable RXFLVL interrupt while reading @@ -1021,24 +1052,19 @@ void dcd_int_handler(uint8_t rhport) { dwc2->gintmsk |= GINTMSK_RXFLVLM; } +#endif // OUT endpoint interrupt handling. - if (int_status & GINTSTS_OEPINT) { + if (gintsts & GINTSTS_OEPINT) { // OEPINT is read-only, clear using DOEPINTn - handle_epout_irq(rhport); + handle_ep_irq(rhport, TUSB_DIR_OUT); } // IN endpoint interrupt handling. - if (int_status & GINTSTS_IEPINT) { + if (gintsts & GINTSTS_IEPINT) { // IEPINT bit read-only, clear using DIEPINTn - handle_epin_irq(rhport); + handle_ep_irq(rhport, TUSB_DIR_IN); } - - // // Check for Incomplete isochronous IN transfer - // if(int_status & GINTSTS_IISOIXFR) { - // printf(" IISOIXFR!\r\n"); - //// TU_LOG(DWC2_DEBUG, " IISOIXFR!\r\n"); - // } } #if CFG_TUD_TEST_MODE From a668c5d9298e2ce674bf80adfb0f820b9293e66f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:52:21 +0100 Subject: [PATCH 584/636] Update dcd_dwc2.patch --- .../arduino_tinyusb/patches/dcd_dwc2.patch | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/components/arduino_tinyusb/patches/dcd_dwc2.patch b/components/arduino_tinyusb/patches/dcd_dwc2.patch index 9307bd8d0..0c45bb0ae 100755 --- a/components/arduino_tinyusb/patches/dcd_dwc2.patch +++ b/components/arduino_tinyusb/patches/dcd_dwc2.patch @@ -1,6 +1,6 @@ --- a/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:17:40.000000000 +0300 +++ b/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:19:48.000000000 +0300 -@@ -209,6 +209,17 @@ +@@ -215,6 +215,17 @@ //-------------------------------------------------------------------- // Endpoint //-------------------------------------------------------------------- @@ -17,13 +17,13 @@ + static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); - uint8_t const epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); -@@ -224,7 +235,19 @@ - (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) | - (xfer->max_size << DOEPCTL_MPSIZ_Pos); + const uint8_t epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); +@@ -238,7 +249,18 @@ + depctl.bm.set_data0_iso_even = 1; + } if (dir == TUSB_DIR_IN) { -- epctl |= (epnum << DIEPCTL_TXFNUM_Pos); -+ //epctl |= (epnum << DIEPCTL_TXFNUM_Pos); +- depctl.bm.tx_fifo_num = epnum; ++ //depctl.bm.tx_fifo_num = epnum; + uint8_t fifo_num = epnum; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + // Special Case for EP5, which is used by CDC but not actually called by the driver @@ -33,13 +33,12 @@ + } else { + fifo_num = get_free_fifo(); + } -+ //TU_ASSERT(fifo_num != 0); +#endif -+ epctl |= (fifo_num << DIEPCTL_TXFNUM_Pos); ++ depctl.bm.tx_fifo_num = fifo_num; } - dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; -@@ -304,6 +327,10 @@ + dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; +@@ -523,6 +545,10 @@ } } @@ -50,35 +49,35 @@ dfifo_flush_tx(dwc2, 0x10); // all tx fifo dfifo_flush_rx(dwc2); -@@ -908,6 +935,9 @@ - if (int_status & GINTSTS_USBRST) { +@@ -959,6 +985,9 @@ + if (gintsts & GINTSTS_USBRST) { // USBRST is start of reset. dwc2->gintsts = GINTSTS_USBRST; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ _allocated_fifos = 1; ++ allocated_fifos = 1; +#endif - bus_reset(rhport); + handle_bus_reset(rhport); } -@@ -939,7 +969,11 @@ +@@ -970,7 +999,11 @@ - if (int_status & GINTSTS_USBSUSP) { + if (gintsts & GINTSTS_USBSUSP) { dwc2->gintsts = GINTSTS_USBSUSP; - dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); + //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); + dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ _allocated_fifos = 1; ++ allocated_fifos = 1; +#endif } - if (int_status & GINTSTS_WKUINT) { -@@ -956,6 +990,9 @@ + if (gintsts & GINTSTS_WKUINT) { +@@ -987,6 +1020,9 @@ if (otg_int & GOTGINT_SEDET) { dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ _allocated_fifos = 1; ++ allocated_fifos = 1; +#endif } From a0e3e5c17f290ba303c734dc6ccac2786a4f7e80 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:10:59 +0100 Subject: [PATCH 585/636] Update dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 146 ++++++++++++++-------- 1 file changed, 92 insertions(+), 54 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index da4709a72..da36a144f 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -31,6 +31,10 @@ #if CFG_TUD_ENABLED && defined(TUP_USBIP_DWC2) +#if !CFG_TUD_DWC2_SLAVE_ENABLE && !CFG_TUH_DWC2_DMA_ENABLE +#error DWC2 require either CFG_TUD_DWC2_SLAVE_ENABLE or CFG_TUH_DWC2_DMA_ENABLE to be enabled +#endif + // Debug level for DWC2 #define DWC2_DEBUG 2 @@ -46,9 +50,6 @@ //--------------------------------------------------------------------+ // MACRO TYPEDEF CONSTANT ENUM //--------------------------------------------------------------------+ - -static CFG_TUD_MEM_SECTION TU_ATTR_ALIGNED(4) uint32_t _setup_packet[2]; - typedef struct { uint8_t* buffer; tu_fifo_t* ff; @@ -60,19 +61,46 @@ typedef struct { static xfer_ctl_t xfer_status[DWC2_EP_MAX][2]; #define XFER_CTL_BASE(_ep, _dir) (&xfer_status[_ep][_dir]) -// EP0 transfers are limited to 1 packet - larger sizes has to be split -static uint16_t ep0_pending[2]; // Index determines direction as tusb_dir_t type -static uint16_t _dfifo_top; // top free location in DFIFO in words +typedef struct { + // EP0 transfers are limited to 1 packet - larger sizes has to be split + uint16_t ep0_pending[2]; // Index determines direction as tusb_dir_t type + uint16_t dfifo_top; // top free location in DFIFO in words + + // Number of IN endpoints active + uint8_t allocated_epin_count; + + // SOF enabling flag - required for SOF to not get disabled in ISR when SOF was enabled by + bool sof_en; +} dcd_data_t; -// Number of IN endpoints active -static uint8_t _allocated_ep_in_count; +static dcd_data_t _dcd_data; -// SOF enabling flag - required for SOF to not get disabled in ISR when SOF was enabled by -static bool _sof_en; +CFG_TUD_MEM_SECTION static struct { + TUD_EPBUF_DEF(setup_packet, 8); +} _dcd_usbbuf; //-------------------------------------------------------------------- // DMA //-------------------------------------------------------------------- +#if CFG_TUD_MEM_DCACHE_ENABLE +void dcd_dcache_clean(const void* addr, uint32_t data_size) { + if (addr && data_size) { + dwc2_dcache_clean(addr, data_size); + } +} + +void dcd_dcache_invalidate(const void* addr, uint32_t data_size) { + if (addr && data_size) { + dwc2_dcache_invalidate(addr, data_size); + } +} + +void dcd_dcache_clean_invalidate(const void* addr, uint32_t data_size) { + if (addr && data_size) { + dwc2_dcache_clean_invalidate(addr, data_size); + } +} +#endif TU_ATTR_ALWAYS_INLINE static inline bool dma_device_enabled(const dwc2_regs_t* dwc2) { (void) dwc2; @@ -91,7 +119,7 @@ static void dma_setup_prepare(uint8_t rhport) { // Receive only 1 packet dwc2->epout[0].doeptsiz = (1 << DOEPTSIZ_STUPCNT_Pos) | (1 << DOEPTSIZ_PKTCNT_Pos) | (8 << DOEPTSIZ_XFRSIZ_Pos); - dwc2->epout[0].doepdma = (uintptr_t)_setup_packet; + dwc2->epout[0].doepdma = (uintptr_t) _dcd_usbbuf.setup_packet; dwc2->epout[0].doepctl |= DOEPCTL_EPENA | DOEPCTL_USBAEP; } @@ -149,27 +177,27 @@ TU_ATTR_ALWAYS_INLINE static inline uint16_t calc_device_grxfsiz(uint16_t larges static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); const dwc2_controller_t* dwc2_controller = &_dwc2_controller[rhport]; - uint8_t const ep_count = dwc2_controller->ep_count; - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); + const uint8_t ep_count = dwc2_controller->ep_count; + const uint8_t epnum = tu_edpt_number(ep_addr); + const uint8_t dir = tu_edpt_dir(ep_addr); TU_ASSERT(epnum < ep_count); uint16_t fifo_size = tu_div_ceil(packet_size, 4); if (dir == TUSB_DIR_OUT) { // Calculate required size of RX FIFO - uint16_t const new_sz = calc_device_grxfsiz(4 * fifo_size, ep_count); + const uint16_t new_sz = calc_device_grxfsiz(4 * fifo_size, ep_count); // If size_rx needs to be extended check if there is enough free space if (dwc2->grxfsiz < new_sz) { - TU_ASSERT(new_sz <= _dfifo_top); + TU_ASSERT(new_sz <= _dcd_data.dfifo_top); dwc2->grxfsiz = new_sz; // Enlarge RX FIFO } } else { // Check IN endpoints concurrently active limit if(_dwc2_controller->ep_in_count) { - TU_ASSERT(_allocated_ep_in_count < _dwc2_controller->ep_in_count); - _allocated_ep_in_count++; + TU_ASSERT(_dcd_data.allocated_epin_count < _dwc2_controller->ep_in_count); + _dcd_data.allocated_epin_count++; } // If The TXFELVL is configured as half empty, the fifo must be twice the max_size. @@ -178,16 +206,16 @@ static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { } // Check if free space is available - TU_ASSERT(_dfifo_top >= fifo_size + dwc2->grxfsiz); - _dfifo_top -= fifo_size; - TU_LOG(DWC2_DEBUG, " TX FIFO %u: allocated %u words at offset %u\r\n", epnum, fifo_size, _dfifo_top); + TU_ASSERT(_dcd_data.dfifo_top >= fifo_size + dwc2->grxfsiz); + _dcd_data.dfifo_top -= fifo_size; + // TU_LOG(DWC2_DEBUG, " TX FIFO %u: allocated %u words at offset %u\r\n", epnum, fifo_size, dfifo_top); // Both TXFD and TXSA are in unit of 32-bit words. if (epnum == 0) { - dwc2->dieptxf0 = (fifo_size << DIEPTXF0_TX0FD_Pos) | _dfifo_top; + dwc2->dieptxf0 = (fifo_size << DIEPTXF0_TX0FD_Pos) | _dcd_data.dfifo_top; } else { // DIEPTXF starts at FIFO #1. - dwc2->dieptxf[epnum - 1] = (fifo_size << DIEPTXF_INEPTXFD_Pos) | _dfifo_top; + dwc2->dieptxf[epnum - 1] = (fifo_size << DIEPTXF_INEPTXFD_Pos) | _dcd_data.dfifo_top; } } @@ -201,11 +229,11 @@ static void dfifo_device_init(uint8_t rhport) { // Scatter/Gather DMA mode is not yet supported. Buffer DMA only need 1 words per endpoint direction const bool is_dma = dma_device_enabled(dwc2); - _dfifo_top = dwc2_controller->ep_fifo_size/4; + _dcd_data.dfifo_top = dwc2_controller->ep_fifo_size/4; if (is_dma) { - _dfifo_top -= 2 * dwc2_controller->ep_count; + _dcd_data.dfifo_top -= 2 * dwc2_controller->ep_count; } - dwc2->gdfifocfg = (_dfifo_top << GDFIFOCFG_EPINFOBASE_SHIFT) | _dfifo_top; + dwc2->gdfifocfg = (_dcd_data.dfifo_top << GDFIFOCFG_EPINFOBASE_SHIFT) | _dcd_data.dfifo_top; // Allocate FIFO for EP0 IN dfifo_alloc(rhport, 0x80, CFG_TUD_ENDPOINT0_SIZE); @@ -225,8 +253,8 @@ static uint8_t get_free_fifo(void) { return 0; } #endif - -static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { + +static void edpt_activate(uint8_t rhport, const tusb_desc_endpoint_t* p_endpoint_desc) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); const uint8_t epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); const uint8_t dir = tu_edpt_dir(p_endpoint_desc->bEndpointAddress); @@ -328,8 +356,8 @@ static void edpt_schedule_packets(uint8_t rhport, const uint8_t epnum, const uin // EP0 is limited to one packet per xfer if (epnum == 0) { - total_bytes = tu_min16(ep0_pending[dir], xfer->max_size); - ep0_pending[dir] -= total_bytes; + total_bytes = tu_min16(_dcd_data.ep0_pending[dir], xfer->max_size); + _dcd_data.ep0_pending[dir] -= total_bytes; num_packets = 1; } else { total_bytes = xfer->total_len; @@ -370,14 +398,18 @@ static void edpt_schedule_packets(uint8_t rhport, const uint8_t epnum, const uin const bool is_dma = dma_device_enabled(dwc2); if(is_dma) { + if (dir == TUSB_DIR_IN && total_bytes != 0) { + dcd_dcache_clean(xfer->buffer, total_bytes); + } dep->diepdma = (uintptr_t) xfer->buffer; - } - - dep->diepctl = depctl.value; // enable endpoint + dep->diepctl = depctl.value; // enable endpoint + } else { + dep->diepctl = depctl.value; // enable endpoint - // Slave: enable tx fifo empty interrupt only if there is data. Note must after depctl enable - if (!is_dma && dir == TUSB_DIR_IN && total_bytes != 0) { - dwc2->diepempmsk |= (1 << epnum); + // Enable tx fifo empty interrupt only if there is data. Note must after depctl enable + if (dir == TUSB_DIR_IN && total_bytes != 0) { + dwc2->diepempmsk |= (1 << epnum); + } } } @@ -388,6 +420,8 @@ bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) { (void) rh_init; dwc2_regs_t* dwc2 = DWC2_REG(rhport); + tu_memclr(&_dcd_data, sizeof(_dcd_data)); + // Core Initialization const bool is_highspeed = dwc2_core_is_highspeed(dwc2, TUSB_ROLE_DEVICE); const bool is_dma = dma_device_enabled(dwc2); @@ -505,7 +539,7 @@ void dcd_sof_enable(uint8_t rhport, bool en) { (void) rhport; dwc2_regs_t* dwc2 = DWC2_REG(rhport); - _sof_en = en; + _dcd_data.sof_en = en; if (en) { dwc2->gintsts = GINTSTS_SOF; @@ -530,7 +564,7 @@ void dcd_edpt_close_all(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const ep_count = _dwc2_controller[rhport].ep_count; - _allocated_ep_in_count = 1; + _dcd_data.allocated_epin_count = 1; // Disable non-control interrupt dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos); @@ -578,7 +612,7 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t to // EP0 can only handle one packet if (epnum == 0) { - ep0_pending[dir] = total_bytes; + _dcd_data.ep0_pending[dir] = total_bytes; } // Schedule packets to be sent within interrupt @@ -644,8 +678,8 @@ static void handle_bus_reset(uint8_t rhport) { tu_memclr(xfer_status, sizeof(xfer_status)); - _sof_en = false; - _allocated_ep_in_count = 1; + _dcd_data.sof_en = false; + _dcd_data.allocated_epin_count = 1; // 1. NAK for all OUT endpoints for (uint8_t n = 0; n < ep_count; n++) { @@ -746,12 +780,14 @@ static void handle_rxflvl_irq(uint8_t rhport) { // Global OUT NAK: do nothing break; - case GRXSTS_PKTSTS_SETUP_RX: + case GRXSTS_PKTSTS_SETUP_RX: { // Setup packet received + uint32_t* setup = (uint32_t*)(uintptr_t) _dcd_usbbuf.setup_packet; // We can receive up to three setup packets in succession, but only the last one is valid. - _setup_packet[0] = (*rx_fifo); - _setup_packet[1] = (*rx_fifo); + setup[0] = (*rx_fifo); + setup[1] = (*rx_fifo); break; + } case GRXSTS_PKTSTS_SETUP_DONE: // Setup packet done: @@ -777,8 +813,8 @@ static void handle_rxflvl_irq(uint8_t rhport) { if (byte_count < xfer->max_size) { xfer->total_len -= epout->tsiz_bm.xfer_size; if (epnum == 0) { - xfer->total_len -= ep0_pending[TUSB_DIR_OUT]; - ep0_pending[TUSB_DIR_OUT] = 0; + xfer->total_len -= _dcd_data.ep0_pending[TUSB_DIR_OUT]; + _dcd_data.ep0_pending[TUSB_DIR_OUT] = 0; } } } @@ -797,7 +833,7 @@ static void handle_rxflvl_irq(uint8_t rhport) { static void handle_epout_slave(uint8_t rhport, uint8_t epnum, dwc2_doepint_t doepint_bm) { if (doepint_bm.setup_phase_done) { - dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); + dcd_event_setup_received(rhport, _dcd_usbbuf.setup_packet, true); return; } @@ -809,7 +845,7 @@ static void handle_epout_slave(uint8_t rhport, uint8_t epnum, dwc2_doepint_t doe if (!doepint_bm.status_phase_rx && !doepint_bm.setup_packet_rx) { xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); - if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { + if ((epnum == 0) && _dcd_data.ep0_pending[TUSB_DIR_OUT]) { // EP0 can only handle one packet, Schedule another packet to be received. edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT); } else { @@ -825,7 +861,7 @@ static void handle_epin_slave(uint8_t rhport, uint8_t epnum, dwc2_diepint_t diep xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_IN); if (diepint_bm.xfer_complete) { - if ((epnum == 0) && ep0_pending[TUSB_DIR_IN]) { + if ((epnum == 0) && _dcd_data.ep0_pending[TUSB_DIR_IN]) { // EP0 can only handle one packet. Schedule another packet to be transmitted. edpt_schedule_packets(rhport, epnum, TUSB_DIR_IN); } else { @@ -873,7 +909,8 @@ static void handle_epout_dma(uint8_t rhport, uint8_t epnum, dwc2_doepint_t doepi if (doepint_bm.setup_phase_done) { dma_setup_prepare(rhport); - dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); + dcd_dcache_invalidate(_dcd_usbbuf.setup_packet, 8); + dcd_event_setup_received(rhport, _dcd_usbbuf.setup_packet, true); return; } @@ -882,7 +919,7 @@ static void handle_epout_dma(uint8_t rhport, uint8_t epnum, dwc2_doepint_t doepi // only handle data skip if it is setup or status related // Normal OUT transfer complete if (!doepint_bm.status_phase_rx && !doepint_bm.setup_packet_rx) { - if ((epnum == 0) && ep0_pending[TUSB_DIR_OUT]) { + if ((epnum == 0) && _dcd_data.ep0_pending[TUSB_DIR_OUT]) { // EP0 can only handle one packet Schedule another packet to be received. edpt_schedule_packets(rhport, epnum, TUSB_DIR_OUT); } else { @@ -899,6 +936,7 @@ static void handle_epout_dma(uint8_t rhport, uint8_t epnum, dwc2_doepint_t doepi dma_setup_prepare(rhport); } + dcd_dcache_invalidate(xfer->buffer, xfer->total_len); dcd_event_xfer_complete(rhport, epnum, xfer->total_len, XFER_RESULT_SUCCESS, true); } } @@ -909,7 +947,7 @@ static void handle_epin_dma(uint8_t rhport, uint8_t epnum, dwc2_diepint_t diepin xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_IN); if (diepint_bm.xfer_complete) { - if ((epnum == 0) && ep0_pending[TUSB_DIR_IN]) { + if ((epnum == 0) && _dcd_data.ep0_pending[TUSB_DIR_IN]) { // EP0 can only handle one packet. Schedule another packet to be transmitted. edpt_schedule_packets(rhport, epnum, TUSB_DIR_IN); } else { @@ -1016,7 +1054,7 @@ void dcd_int_handler(uint8_t rhport) { if (gintsts & GINTSTS_OTGINT) { // OTG INT bit is read-only - uint32_t const otg_int = dwc2->gotgint; + const uint32_t otg_int = dwc2->gotgint; if (otg_int & GOTGINT_SEDET) { dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); @@ -1033,7 +1071,7 @@ void dcd_int_handler(uint8_t rhport) { const uint32_t frame = (dwc2->dsts & DSTS_FNSOF) >> DSTS_FNSOF_Pos; // Disable SOF interrupt if SOF was not explicitly enabled since SOF was used for remote wakeup detection - if (!_sof_en) { + if (!_dcd_data.sof_en) { dwc2->gintmsk &= ~GINTMSK_SOFM; } From e1c616f3de1d285bf76579c05e9c2808cdff06d8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:13:34 +0100 Subject: [PATCH 586/636] Update dcd_dwc2.patch --- .../arduino_tinyusb/patches/dcd_dwc2.patch | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/components/arduino_tinyusb/patches/dcd_dwc2.patch b/components/arduino_tinyusb/patches/dcd_dwc2.patch index 0c45bb0ae..11c1c05c0 100755 --- a/components/arduino_tinyusb/patches/dcd_dwc2.patch +++ b/components/arduino_tinyusb/patches/dcd_dwc2.patch @@ -1,6 +1,6 @@ --- a/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:17:40.000000000 +0300 +++ b/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:19:48.000000000 +0300 -@@ -215,6 +215,17 @@ +@@ -243,6 +243,17 @@ //-------------------------------------------------------------------- // Endpoint //-------------------------------------------------------------------- @@ -14,11 +14,11 @@ + return 0; +} +#endif -+ - static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { ++ + static void edpt_activate(uint8_t rhport, const tusb_desc_endpoint_t* p_endpoint_desc) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); const uint8_t epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); -@@ -238,7 +249,18 @@ +@@ -266,7 +277,18 @@ depctl.bm.set_data0_iso_even = 1; } if (dir == TUSB_DIR_IN) { @@ -38,7 +38,7 @@ } dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; -@@ -523,6 +545,10 @@ +@@ -557,6 +579,10 @@ } } @@ -49,17 +49,17 @@ dfifo_flush_tx(dwc2, 0x10); // all tx fifo dfifo_flush_rx(dwc2); -@@ -959,6 +985,9 @@ +@@ -997,6 +1023,9 @@ if (gintsts & GINTSTS_USBRST) { // USBRST is start of reset. dwc2->gintsts = GINTSTS_USBRST; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ allocated_fifos = 1; ++ _allocated_fifos = 1; +#endif handle_bus_reset(rhport); } -@@ -970,7 +999,11 @@ +@@ -1008,7 +1037,11 @@ if (gintsts & GINTSTS_USBSUSP) { dwc2->gintsts = GINTSTS_USBSUSP; @@ -67,17 +67,17 @@ + //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true); + dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ allocated_fifos = 1; ++ _allocated_fifos = 1; +#endif } if (gintsts & GINTSTS_WKUINT) { -@@ -987,6 +1020,9 @@ +@@ -1025,6 +1058,9 @@ if (otg_int & GOTGINT_SEDET) { dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true); +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) -+ allocated_fifos = 1; ++ _allocated_fifos = 1; +#endif } From 3d0af908d1e55f6605fc6d6c384ccd6ead97eeb4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:02:38 +0100 Subject: [PATCH 587/636] never ending tinyusb --- components/arduino_tinyusb/src/dcd_dwc2.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index da36a144f..8a2b585b4 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -83,22 +83,19 @@ CFG_TUD_MEM_SECTION static struct { // DMA //-------------------------------------------------------------------- #if CFG_TUD_MEM_DCACHE_ENABLE -void dcd_dcache_clean(const void* addr, uint32_t data_size) { - if (addr && data_size) { - dwc2_dcache_clean(addr, data_size); - } +bool dcd_dcache_clean(const void* addr, uint32_t data_size) { + TU_VERIFY(addr && data_size); + return dwc2_dcache_clean(addr, data_size); } -void dcd_dcache_invalidate(const void* addr, uint32_t data_size) { - if (addr && data_size) { - dwc2_dcache_invalidate(addr, data_size); - } +bool dcd_dcache_invalidate(const void* addr, uint32_t data_size) { + TU_VERIFY(addr && data_size); + return dwc2_dcache_invalidate(addr, data_size); } -void dcd_dcache_clean_invalidate(const void* addr, uint32_t data_size) { - if (addr && data_size) { - dwc2_dcache_clean_invalidate(addr, data_size); - } +bool dcd_dcache_clean_invalidate(const void* addr, uint32_t data_size) { + TU_VERIFY(addr && data_size); + return dwc2_dcache_clean_invalidate(addr, data_size); } #endif From a58eddacda17078e0718cf24ba0c35170a2aa6be Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:21:54 +0100 Subject: [PATCH 588/636] Update copy-libs.sh --- tools/copy-libs.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 2c2f56204..ed72c7d04 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -44,7 +44,12 @@ mkdir -p "$AR_SDK" mkdir -p "$AR_SDK/lib" function get_actual_path(){ - p="$PWD"; cd "$1"; r="$PWD"; cd "$p"; echo "$r"; + d="$1"; + if [ -d "$d" ]; then + p="$PWD"; cd "$d"; r="$PWD"; cd "$p"; echo "$r"; + else + echo ""; + fi } # From 878dee8affa4119ca1454b6146814251bc348f94 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:23:27 +0100 Subject: [PATCH 589/636] Update defconfig.esp32p4 --- configs/defconfig.esp32p4 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index b7d9a6539..94618d831 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -30,6 +30,17 @@ CONFIG_ESP_SDIO_PIN_D1=15 CONFIG_ESP_SDIO_PIN_D2=16 CONFIG_ESP_SDIO_PIN_D3=17 +# +# Chip revision +# +CONFIG_ESP32P4_REV_MIN_0=y +# CONFIG_ESP32P4_REV_MIN_1 is not set +CONFIG_ESP32P4_REV_MIN_FULL=0 +CONFIG_ESP_REV_MIN_FULL=0 +CONFIG_ESP32P4_REV_MAX_FULL=99 +CONFIG_ESP_REV_MAX_FULL=99 +# end of Chip revision + # # PPP # From b7b250279b208df3c1acf4f0a8d14dfa6b12a076 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:25:56 +0100 Subject: [PATCH 590/636] Update dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index 8a2b585b4..7df5d3792 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -31,8 +31,8 @@ #if CFG_TUD_ENABLED && defined(TUP_USBIP_DWC2) -#if !CFG_TUD_DWC2_SLAVE_ENABLE && !CFG_TUH_DWC2_DMA_ENABLE -#error DWC2 require either CFG_TUD_DWC2_SLAVE_ENABLE or CFG_TUH_DWC2_DMA_ENABLE to be enabled +#if !(CFG_TUD_DWC2_SLAVE_ENABLE || CFG_TUD_DWC2_DMA_ENABLE) +#error DWC2 require either CFG_TUD_DWC2_SLAVE_ENABLE or CFG_TUD_DWC2_DMA_ENABLE to be enabled #endif // Debug level for DWC2 @@ -192,8 +192,8 @@ static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) { } } else { // Check IN endpoints concurrently active limit - if(_dwc2_controller->ep_in_count) { - TU_ASSERT(_dcd_data.allocated_epin_count < _dwc2_controller->ep_in_count); + if(dwc2_controller->ep_in_count) { + TU_ASSERT(_dcd_data.allocated_epin_count < dwc2_controller->ep_in_count); _dcd_data.allocated_epin_count++; } @@ -561,7 +561,7 @@ void dcd_edpt_close_all(uint8_t rhport) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); uint8_t const ep_count = _dwc2_controller[rhport].ep_count; - _dcd_data.allocated_epin_count = 1; + _dcd_data.allocated_epin_count = 0; // Disable non-control interrupt dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos); @@ -641,10 +641,6 @@ bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t return true; } -void dcd_edpt_close(uint8_t rhport, uint8_t ep_addr) { - edpt_disable(rhport, ep_addr, false); -} - void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); edpt_disable(rhport, ep_addr, true); @@ -676,7 +672,7 @@ static void handle_bus_reset(uint8_t rhport) { tu_memclr(xfer_status, sizeof(xfer_status)); _dcd_data.sof_en = false; - _dcd_data.allocated_epin_count = 1; + _dcd_data.allocated_epin_count = 0; // 1. NAK for all OUT endpoints for (uint8_t n = 0; n < ep_count; n++) { From 9ebd648740ca8724b157ac3e8b21bd7c79d128fc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:46:13 +0100 Subject: [PATCH 591/636] Update pio_start.txt --- configs/pio_start.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/pio_start.txt b/configs/pio_start.txt index 0f2fe3d8b..9682d59de 100644 --- a/configs/pio_start.txt +++ b/configs/pio_start.txt @@ -22,7 +22,7 @@ kinds of creative coding, interactive objects, spaces or physical experiences. http://arduino.cc/en/Reference/HomePage """ -# Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py +# Extends: https://github.com/jason2866/platform-espressif32/blob/develop/builder/main.py from os.path import basename, join From b079be97d7d6eec422658268f0746dbb83d30ad3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:48:48 +0100 Subject: [PATCH 592/636] Update copy-libs.sh --- tools/copy-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index ed72c7d04..f5da25067 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -36,8 +36,8 @@ fi if [ -e "$AR_SDK/$MEMCONF" ]; then rm -rf "$AR_SDK/$MEMCONF" fi -if [ -e "$AR_SDK/platformio-build.py" ]; then - rm -rf "$AR_SDK/platformio-build.py" +if [ -e "$AR_SDK/pioarduino-build.py" ]; then + rm -rf "$AR_SDK/pioarduino-build.py" fi mkdir -p "$AR_SDK" From aa7826c14b0157659b98c803ea220f9ccedd26c2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:53:53 +0100 Subject: [PATCH 593/636] Update copy-libs.sh --- tools/copy-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index f5da25067..9513e862a 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -318,8 +318,8 @@ done mkdir -p "$AR_SDK" -# start generation of platformio-build.py -AR_PLATFORMIO_PY="$AR_SDK/platformio-build.py" +# start generation of pioarduino-build.py +AR_PLATFORMIO_PY="$AR_SDK/pioarduino-build.py" cat configs/pio_start.txt > "$AR_PLATFORMIO_PY" echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY" From dd7d3721eeb84ab7fa5b4183fced94c17d392299 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:14:58 +0100 Subject: [PATCH 594/636] Update dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index 7df5d3792..d6796641a 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -44,7 +44,7 @@ #if TU_CHECK_MCU(OPT_MCU_GD32VF103) #define DWC2_EP_COUNT(_dwc2) DWC2_EP_MAX #else - #define DWC2_EP_COUNT(_dwc2) ((_dwc2)->ghwcfg2_bm.num_dev_ep) + #define DWC2_EP_COUNT(_dwc2) ((_dwc2)->ghwcfg2_bm.num_dev_ep + 1) #endif //--------------------------------------------------------------------+ From da6a034fc99b3b6c813d61cfb7ef1eab2bbf6ad1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:32:00 +0100 Subject: [PATCH 595/636] AR_BRANCH="main" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index 17b5c13ae..cac07c340 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="release/v3.1.x" + AR_BRANCH="main" fi if [ -z $IDF_TARGET ]; then From 6328f8d521cdc5fb0ceb9638652bab5b98ebdaa2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:19:26 +0100 Subject: [PATCH 596/636] IDF 5.4 --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index cb3350cf6..6fc2c1c0d 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: IDF v5.3 +name: IDF v5.4 on: workflow_dispatch: # Manually start a workflow From 218b7b2a24de53f4036829d31015f3be3e4403f8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:20:47 +0100 Subject: [PATCH 597/636] Branch release/v3.2.x / IDF 5.4 --- tools/config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index cac07c340..c0c031d26 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,12 +6,12 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - export IDF_BRANCH="release/v5.3" + export IDF_BRANCH="release/v5.4" fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="main" + AR_BRANCH="release/v3.2.x" fi if [ -z $IDF_TARGET ]; then From 38316237bd2fe6295a160def6e7cdd4073659653 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:27:30 +0100 Subject: [PATCH 598/636] Update defconfig.common --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index ba567d3fc..313af609a 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -114,7 +114,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_TLS_DISABLED=y # CONFIG_MBEDTLS_TLS_ENABLED is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=100 # CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set # CONFIG_MBEDTLS_PKCS7_C is not set # CONFIG_MBEDTLS_ERROR_STRINGS is not set From 956a02453e1aa29a2ee6bde4823b27815a228746 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 7 Jan 2025 20:54:00 +0100 Subject: [PATCH 599/636] Update defconfig.common --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 313af609a..8d8fece5e 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -114,7 +114,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_TLS_DISABLED=y # CONFIG_MBEDTLS_TLS_ENABLED is not set # CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=100 +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=180 # CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set # CONFIG_MBEDTLS_PKCS7_C is not set # CONFIG_MBEDTLS_ERROR_STRINGS is not set From ded9f62cca9c4daf82146c9708d644d2188ae05c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:52:18 +0100 Subject: [PATCH 600/636] Update defconfig.esp32p4 --- configs/defconfig.esp32p4 | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index 94618d831..b7d9a6539 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -30,17 +30,6 @@ CONFIG_ESP_SDIO_PIN_D1=15 CONFIG_ESP_SDIO_PIN_D2=16 CONFIG_ESP_SDIO_PIN_D3=17 -# -# Chip revision -# -CONFIG_ESP32P4_REV_MIN_0=y -# CONFIG_ESP32P4_REV_MIN_1 is not set -CONFIG_ESP32P4_REV_MIN_FULL=0 -CONFIG_ESP_REV_MIN_FULL=0 -CONFIG_ESP32P4_REV_MAX_FULL=99 -CONFIG_ESP_REV_MAX_FULL=99 -# end of Chip revision - # # PPP # From 35d28b741f8428ab3c4659e9eeac2b4a10ec500d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:32:13 +0100 Subject: [PATCH 601/636] Update pio_end.txt --- configs/pio_end.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/pio_end.txt b/configs/pio_end.txt index f942d442d..d9b5d5467 100644 --- a/configs/pio_end.txt +++ b/configs/pio_end.txt @@ -1,4 +1,5 @@ "ARDUINO_ARCH_ESP32", + "CHIP_HAVE_CONFIG_H", ("ESP32", "ESP32"), ("F_CPU", "$BOARD_F_CPU"), ("ARDUINO", 10812), From 75b59ca2802431120237fa200c9ab7f203dd360d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 17 Jan 2025 23:44:03 +0100 Subject: [PATCH 602/636] C3: issues/14456 --- configs/defconfig.common | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 8d8fece5e..44843fe5e 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -38,6 +38,7 @@ CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048 CONFIG_ESP_TASK_WDT_PANIC=y +# CONFIG_ESP_SYSTEM_HW_STACK_GUARD is not set CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y From df99bdf07d0eaa79093d6c4b5b88b44deda55650 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 24 Jan 2025 15:48:37 +0100 Subject: [PATCH 603/636] fix(zigbee): Exclude correct libs for 1.6.2 version --- tools/copy-libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 9513e862a..e20858df9 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -95,7 +95,7 @@ fi if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" - EXCLUDE_LIBS+="zboss_stack.ed;zboss_port.debug;" + EXCLUDE_LIBS+="zboss_stack.ed;zboss_port.native.debug;" fi #collect includes, defines and c-flags From af0e2a66432c5784e89009d099f0e3d1fa347053 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 25 Jan 2025 22:00:47 +0100 Subject: [PATCH 604/636] keep the flags folder --- tools/archive-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 139d720bf..1a999662e 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -61,7 +61,7 @@ mv arduino-esp32/ framework-arduinoespressif32/ cd framework-arduinoespressif32/libraries rm -rf **/examples cd ../tools/esp32-arduino-libs -rm -rf **/flags +# rm -rf **/flags cd ../../../ # If the framework is needed as tar.gz uncomment next line # tar --exclude=.* -zcf ../$pio_archive_path framework-arduinoespressif32/ From dd076b1b1dc5a22b1e2b3dd4ff06aebb52020fa2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 31 Jan 2025 00:13:34 +0100 Subject: [PATCH 605/636] Use 80Mhz for PSRAM too --- configs/defconfig.80m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.80m b/configs/defconfig.80m index 7014fa954..2cc7bd0ef 100644 --- a/configs/defconfig.80m +++ b/configs/defconfig.80m @@ -1 +1,3 @@ CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM_SPEED=80 From 0c0d8b14c9a3a604879825b2214878b15f6e9792 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 31 Jan 2025 00:15:29 +0100 Subject: [PATCH 606/636] CONFIG_SPIRAM_SPEED=120 --- configs/defconfig.120m | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.120m b/configs/defconfig.120m index 1dce09930..baadadcfb 100644 --- a/configs/defconfig.120m +++ b/configs/defconfig.120m @@ -1,5 +1,6 @@ CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_ESPTOOLPY_FLASHFREQ_120M=y CONFIG_SPIRAM_SPEED_120M=y +CONFIG_SPIRAM_SPEED=120 # CONFIG_SPI_FLASH_HPM_ENA=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y From e9e73af61489f32afab66147a2b5981f07e3836e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 31 Jan 2025 00:16:12 +0100 Subject: [PATCH 607/636] Update defconfig.40m --- configs/defconfig.40m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.40m b/configs/defconfig.40m index ffc4b5c1c..f265bd780 100644 --- a/configs/defconfig.40m +++ b/configs/defconfig.40m @@ -1 +1,3 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM_SPEED=40 From e6e3fb15b852e4f28c4f75b3077e965fab915154 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 31 Jan 2025 22:22:02 +0100 Subject: [PATCH 608/636] Update builds.json --- configs/builds.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configs/builds.json b/configs/builds.json index 5ec2470cc..026c8d23b 100644 --- a/configs/builds.json +++ b/configs/builds.json @@ -36,6 +36,12 @@ "out":"lib/libesp_hw_support.a", "targets":["esp32s3"] }, + { + "file":"libesp_lcd.a", + "src":"build/esp-idf/esp_lcd/libesp_lcd.a", + "out":"lib/libesp_lcd.a", + "targets":["esp32s3"] + }, { "file":"sections.ld", "src":"build/esp-idf/esp_system/ld/sections.ld", From 15983672ae6009a071aff60e40622f1bdd8fd128 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:20:55 +0100 Subject: [PATCH 609/636] Update defconfig.esp32p4 --- configs/defconfig.esp32p4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index b7d9a6539..5fcdb5616 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -20,6 +20,10 @@ CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 CONFIG_CACHE_L2_CACHE_256KB=y CONFIG_CACHE_L2_CACHE_LINE_128B=y +# RGB Display Optimizations +CONFIG_LCD_RGB_ISR_IRAM_SAFE=y +CONFIG_LCD_RGB_RESTART_IN_VSYNC=y + CONFIG_SLAVE_IDF_TARGET_ESP32C6=y CONFIG_ESP_SDIO_BUS_WIDTH=4 CONFIG_ESP_SDIO_CLOCK_FREQ_KHZ=40000 From e3d43f683fe0d3c5f838d4172ec98ff77cca2220 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:25:11 +0100 Subject: [PATCH 610/636] fix(zigbee): Update exclude libs in script --- tools/copy-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index e20858df9..015912622 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -90,12 +90,12 @@ fi # copy zigbee + zboss lib if [ -d "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET/" ]; then cp -r "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" - EXCLUDE_LIBS+="esp_zb_api_ed;" + EXCLUDE_LIBS+="esp_zb_api.ed;" fi if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" - EXCLUDE_LIBS+="zboss_stack.ed;zboss_port.native.debug;" + EXCLUDE_LIBS+="zboss_stack.ed;zboss_port.native;zboss_port.native.debug;" fi #collect includes, defines and c-flags From cb9843a4d66b9d6ef872db62efe987242cd63a29 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 12 Feb 2025 11:33:57 +0100 Subject: [PATCH 611/636] CONFIG_TINYUSB_CDC_MAX_PORTS=2 --- configs/defconfig.common | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 44843fe5e..1e73eff05 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -227,6 +227,11 @@ CONFIG_LITTLEFS_MAX_PARTITIONS=2 CONFIG_LITTLEFS_MULTIVERSION=y CONFIG_LITTLEFS_DISK_VERSION_2_0=y +# +# TinyUSB Config +# +CONFIG_TINYUSB_CDC_MAX_PORTS=2 + # # Disable Cameras not used # From a595a828c0b2e2ef6daf723c626eb957ba707d6b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 12 Feb 2025 11:36:10 +0100 Subject: [PATCH 612/636] Update tusb_config.h --- components/arduino_tinyusb/include/tusb_config.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/arduino_tinyusb/include/tusb_config.h b/components/arduino_tinyusb/include/tusb_config.h index 458c78cf1..7802bea8f 100755 --- a/components/arduino_tinyusb/include/tusb_config.h +++ b/components/arduino_tinyusb/include/tusb_config.h @@ -115,7 +115,11 @@ extern "C" { #define CFG_TUD_ENDOINT0_SIZE 64 // Enabled Drivers -#define CFG_TUD_CDC CONFIG_TINYUSB_CDC_ENABLED +#ifdef CONFIG_TINYUSB_CDC_MAX_PORTS +#define CFG_TUD_CDC CONFIG_TINYUSB_CDC_MAX_PORTS +#else +#define CFG_TUD_CDC 0 +#endif #define CFG_TUD_MSC CONFIG_TINYUSB_MSC_ENABLED #define CFG_TUD_HID CONFIG_TINYUSB_HID_ENABLED #define CFG_TUD_MIDI CONFIG_TINYUSB_MIDI_ENABLED From 8366fef5d439d4f9928fb333b727d21a4f0c7779 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 12 Feb 2025 11:37:47 +0100 Subject: [PATCH 613/636] Update Kconfig.projbuild --- components/arduino_tinyusb/Kconfig.projbuild | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/arduino_tinyusb/Kconfig.projbuild b/components/arduino_tinyusb/Kconfig.projbuild index 65d9c37be..f0a1b4dc6 100755 --- a/components/arduino_tinyusb/Kconfig.projbuild +++ b/components/arduino_tinyusb/Kconfig.projbuild @@ -42,6 +42,14 @@ menu "Arduino TinyUSB" help CDC FIFO size of TX + config TINYUSB_CDC_MAX_PORTS + int "Maximum enabled CDC ports" + range 1 2 + default 1 + depends on TINYUSB_CDC_ENABLED + help + Maximum enabled CDC ports + endmenu menu "Mass Storage (MSC) driver" From c5f9c5a9e41f966475778a5d6965b962faffd563 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:34:42 +0100 Subject: [PATCH 614/636] AR_BRANCH="main" --- tools/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.sh b/tools/config.sh index c0c031d26..747689ae0 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -11,7 +11,7 @@ fi # Arduino branch to use if [ -z $AR_BRANCH ]; then - AR_BRANCH="release/v3.2.x" + AR_BRANCH="main" fi if [ -z $IDF_TARGET ]; then From 92a6d801d1dc150dfc44fa8153f4e210d8fc9217 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 18 Feb 2025 22:05:12 +0100 Subject: [PATCH 615/636] Update pio_start.txt --- configs/pio_start.txt | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/configs/pio_start.txt b/configs/pio_start.txt index 9682d59de..61ec7b79f 100644 --- a/configs/pio_start.txt +++ b/configs/pio_start.txt @@ -43,28 +43,17 @@ flatten_cppdefines = env.Flatten(env['CPPDEFINES']) if "ZIGBEE_MODE_ZCZR" in flatten_cppdefines: env.Append( LIBS=[ - "-lesp_zb_api_zczr", - "-lesp_zb_cli_command", + "-lesp_zb_api.zczr", "-lzboss_stack.zczr", - "-lzboss_port" + "-lzboss_port.native" ] ) if "ZIGBEE_MODE_ED" in flatten_cppdefines: env.Append( LIBS=[ - "-lesp_zb_api_ed", - "-lesp_zb_cli_command", + "-lesp_zb_api.ed", "-lzboss_stack.ed", - "-lzboss_port" - ] - ) -if "ZIGBEE_MODE_RCP" in flatten_cppdefines: - env.Append( - LIBS=[ - "-lesp_zb_api_rcp", - "-lesp_zb_cli_command", - "-lzboss_stack.rcp", - "-lzboss_port" + "-lzboss_port.native" ] ) From 92fd164531ea1bfd29a9125d4f8d41539f7962e4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 20 Feb 2025 20:37:37 +0100 Subject: [PATCH 616/636] Update copy-libs.sh --- tools/copy-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 015912622..cdfc149e8 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -90,12 +90,12 @@ fi # copy zigbee + zboss lib if [ -d "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET/" ]; then cp -r "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" - EXCLUDE_LIBS+="esp_zb_api.ed;" + EXCLUDE_LIBS+="esp_zb_api.ed;esp_zb_api.zczr;" fi if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/" - EXCLUDE_LIBS+="zboss_stack.ed;zboss_port.native;zboss_port.native.debug;" + EXCLUDE_LIBS+="zboss_stack.ed;zboss_stack.zczr;zboss_port.native;zboss_port.native.debug;zboss_port.remote;zboss_port.remote.debug;" fi #collect includes, defines and c-flags From f2a7df0cf2580b1a69f3e7f3733ea620b365a9f2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 7 Mar 2025 12:05:16 +0100 Subject: [PATCH 617/636] fix(TinyUSB): USB HUB Subport Added, FIFO sizes(Bias Periodic OUT) --- configs/defconfig.common | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/defconfig.common b/configs/defconfig.common index 1e73eff05..1baaecc57 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -231,6 +231,9 @@ CONFIG_LITTLEFS_DISK_VERSION_2_0=y # TinyUSB Config # CONFIG_TINYUSB_CDC_MAX_PORTS=2 +CONFIG_USB_HOST_HUBS_SUPPORTED=y +CONFIG_USB_HOST_HUB_MULTI_LEVEL=y +CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT=y # # Disable Cameras not used From 0affcdeb6825ba3502e60213a118faa1b42fa093 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 15 Mar 2025 15:05:36 +0100 Subject: [PATCH 618/636] Update defconfig.opi_ram --- configs/defconfig.opi_ram | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index 7b94edaf9..f1f2238cd 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -7,5 +7,6 @@ CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y # I2S_ISR_IRAM_SAFE has to be set!! Done in common config CONFIG_GDMA_ISR_IRAM_SAFE=y # Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash +CONFIG_SPIRAM_XIP_FROM_PSRAM=y CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y CONFIG_SPIRAM_RODATA=y From 5015eb513dceb450b6d72655797149c740657a4f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 15 Mar 2025 15:46:17 +0100 Subject: [PATCH 619/636] set s3 cache size to 16kb --- configs/defconfig.esp32s3 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 758a1c9c4..2a42d9317 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -7,6 +7,8 @@ CONFIG_ULP_COPROC_RESERVE_MEM=4096 CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIRAM=y CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y +CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y +CONFIG_ESP32S3_DATA_CACHE_16KB=y CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set From ed26bbc207510f12893fe8d179c6472a724f50c0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 24 Mar 2025 13:26:02 +0100 Subject: [PATCH 620/636] CONFIG_HEAP_POISONING_DISABLED=y --- configs/defconfig.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 1baaecc57..4a421ec3b 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -78,7 +78,7 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y CONFIG_HAL_ASSERTION_DISABLE=y -CONFIG_HEAP_POISONING_LIGHT=y +CONFIG_HEAP_POISONING_DISABLED=y CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 CONFIG_HTTPD_WS_SUPPORT=y CONFIG_LOG_DEFAULT_LEVEL_NONE=y From 2b468c95cde21289328cad3787227665b57b1e10 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 31 Mar 2025 15:34:21 +0200 Subject: [PATCH 621/636] Update CMakeLists.txt --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbf8583cb..276e073a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,3 +35,4 @@ add_custom_command( add_custom_target(mem-variant DEPENDS "mem_variant") idf_build_set_property(COMPILE_DEFINITIONS "-DESP32_ARDUINO_LIB_BUILDER" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++2a;-DCHIP_HAVE_CONFIG_H" APPEND) From af1456a96004ce9b9d8947e3c7070f10c2701d90 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 13 Apr 2025 16:19:32 +0200 Subject: [PATCH 622/636] rm "-DNDEBUG" from compile DEFINES --- tools/copy-libs.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index cdfc149e8..f604ec54b 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -122,7 +122,7 @@ for item in "${@:2:${#@}-5}"; do INCLUDES+="$item " fi elif [ "$prefix" = "-D" ]; then - if [[ "${item:2:7}" != "ARDUINO" ]] && [[ "$item" != "-DESP32=ESP32" ]]; then #skip ARDUINO defines + if [[ "${item:2:7}" != "ARDUINO" ]] && [[ "$item" != "-DESP32=ESP32" ]] && [[ "$item" != "-DNDEBUG" ]]; then #skip ARDUINO defines DEFINES+="$item " fi elif [ "$prefix" = "-O" ]; then @@ -489,7 +489,8 @@ echo "" >> "$AR_PLATFORMIO_PY" echo " CPPDEFINES=[" >> "$AR_PLATFORMIO_PY" set -- $DEFINES for item; do - item="${item:2}" #remove -D + item="${item:2}" #remove -D + item="${item/NDEBUG}" #remove NDEBUG if [[ $item == *"="* ]]; then item=(${item//=/ }) re='^[+-]?[0-9]+([.][0-9]+)?$' From 5f2a6c0b6ad52ba9f78fdf6c2c208aedf99a6549 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 13 Apr 2025 16:21:07 +0200 Subject: [PATCH 623/636] test only for esp32 --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index e96fc314b..795a7e02b 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 CCACHE_ENABLE=1 -export TARGET="all" +export TARGET="esp32" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From 66ead5af549a48dad37b15590716fde0c2484363 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 13 Apr 2025 16:32:02 +0200 Subject: [PATCH 624/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 795a7e02b..e96fc314b 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 CCACHE_ENABLE=1 -export TARGET="esp32" +export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From 89bbf9c57f5e1a1de3ce1d89f10ad75e8b16b8e2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 14 Apr 2025 21:08:38 +0200 Subject: [PATCH 625/636] Update prepare-ci.sh --- tools/prepare-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/prepare-ci.sh b/tools/prepare-ci.sh index 0855e8496..7e5a29f1f 100755 --- a/tools/prepare-ci.sh +++ b/tools/prepare-ci.sh @@ -10,7 +10,7 @@ brew install gsed brew install gawk brew install gperf -brew install ninja +#brew install ninja brew install ccache python -m pip install --upgrade pip pip install wheel future pyelftools From 479a435e099985167b60cade8e3b711211d66277 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:59:01 +0200 Subject: [PATCH 626/636] Update dcd_dwc2.c --- components/arduino_tinyusb/src/dcd_dwc2.c | 106 +++++++++++----------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/components/arduino_tinyusb/src/dcd_dwc2.c b/components/arduino_tinyusb/src/dcd_dwc2.c index d6796641a..ea931ab90 100644 --- a/components/arduino_tinyusb/src/dcd_dwc2.c +++ b/components/arduino_tinyusb/src/dcd_dwc2.c @@ -41,12 +41,6 @@ #include "device/dcd.h" #include "dwc2_common.h" -#if TU_CHECK_MCU(OPT_MCU_GD32VF103) - #define DWC2_EP_COUNT(_dwc2) DWC2_EP_MAX -#else - #define DWC2_EP_COUNT(_dwc2) ((_dwc2)->ghwcfg2_bm.num_dev_ep + 1) -#endif - //--------------------------------------------------------------------+ // MACRO TYPEDEF CONSTANT ENUM //--------------------------------------------------------------------+ @@ -79,6 +73,16 @@ CFG_TUD_MEM_SECTION static struct { TUD_EPBUF_DEF(setup_packet, 8); } _dcd_usbbuf; +TU_ATTR_ALWAYS_INLINE static inline uint8_t dwc2_ep_count(const dwc2_regs_t* dwc2) { + #if TU_CHECK_MCU(OPT_MCU_GD32VF103) + return DWC2_EP_MAX; + #else + const dwc2_ghwcfg2_t ghwcfg2 = {.value = dwc2->ghwcfg2}; + return ghwcfg2.num_dev_ep + 1; + #endif +} + + //-------------------------------------------------------------------- // DMA //-------------------------------------------------------------------- @@ -102,7 +106,8 @@ bool dcd_dcache_clean_invalidate(const void* addr, uint32_t data_size) { TU_ATTR_ALWAYS_INLINE static inline bool dma_device_enabled(const dwc2_regs_t* dwc2) { (void) dwc2; // Internal DMA only - return CFG_TUD_DWC2_DMA_ENABLE && dwc2->ghwcfg2_bm.arch == GHWCFG2_ARCH_INTERNAL_DMA; + const dwc2_ghwcfg2_t ghwcfg2 = {.value = dwc2->ghwcfg2}; + return CFG_TUD_DWC2_DMA_ENABLE && ghwcfg2.arch == GHWCFG2_ARCH_INTERNAL_DMA; } static void dma_setup_prepare(uint8_t rhport) { @@ -261,20 +266,15 @@ static void edpt_activate(uint8_t rhport, const tusb_desc_endpoint_t* p_endpoint xfer->interval = p_endpoint_desc->bInterval; // Endpoint control - union { - uint32_t value; - dwc2_depctl_t bm; - } depctl; - depctl.value = 0; - - depctl.bm.mps = xfer->max_size; - depctl.bm.active = 1; - depctl.bm.type = p_endpoint_desc->bmAttributes.xfer; + dwc2_depctl_t depctl = {.value = 0}; + depctl.mps = xfer->max_size; + depctl.active = 1; + depctl.type = p_endpoint_desc->bmAttributes.xfer; if (p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS) { - depctl.bm.set_data0_iso_even = 1; + depctl.set_data0_iso_even = 1; } if (dir == TUSB_DIR_IN) { - //depctl.bm.tx_fifo_num = epnum; + //depctl.tx_fifo_num = epnum; uint8_t fifo_num = epnum; #if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) // Special Case for EP5, which is used by CDC but not actually called by the driver @@ -285,7 +285,7 @@ static void edpt_activate(uint8_t rhport, const tusb_desc_endpoint_t* p_endpoint fifo_num = get_free_fifo(); } #endif - depctl.bm.tx_fifo_num = fifo_num; + depctl.tx_fifo_num = fifo_num; } dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; @@ -365,31 +365,22 @@ static void edpt_schedule_packets(uint8_t rhport, const uint8_t epnum, const uin } // transfer size: A full OUT transfer (multiple packets, possibly) triggers XFRC. - union { - uint32_t value; - dwc2_ep_tsize_t bm; - } deptsiz; - deptsiz.value = 0; - deptsiz.bm.xfer_size = total_bytes; - deptsiz.bm.packet_count = num_packets; - + dwc2_ep_tsize_t deptsiz = {.value = 0}; + deptsiz.xfer_size = total_bytes; + deptsiz.packet_count = num_packets; dep->tsiz = deptsiz.value; // control - union { - dwc2_depctl_t bm; - uint32_t value; - } depctl; - depctl.value = dep->ctl; - - depctl.bm.clear_nak = 1; - depctl.bm.enable = 1; - if (depctl.bm.type == DEPCTL_EPTYPE_ISOCHRONOUS && xfer->interval == 1) { - const uint32_t odd_now = (dwc2->dsts_bm.frame_number & 1u); + dwc2_depctl_t depctl = {.value = dep->ctl}; + depctl.clear_nak = 1; + depctl.enable = 1; + if (depctl.type == DEPCTL_EPTYPE_ISOCHRONOUS && xfer->interval == 1) { + const dwc2_dsts_t dsts = {.value = dwc2->dsts}; + const uint32_t odd_now = dsts.frame_number & 1u; if (odd_now) { - depctl.bm.set_data0_iso_even = 1; + depctl.set_data0_iso_even = 1; } else { - depctl.bm.set_data1_iso_odd = 1; + depctl.set_data1_iso_odd = 1; } } @@ -432,7 +423,8 @@ bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) { // XCVRDLY: transceiver delay between xcvr_sel and txvalid during device chirp is required // when using with some PHYs such as USB334x (USB3341, USB3343, USB3346, USB3347) - if (dwc2->ghwcfg2_bm.hs_phy_type == GHWCFG2_HSPHY_ULPI) { + const dwc2_ghwcfg2_t ghwcfg2 = {.value = dwc2->ghwcfg2}; + if (ghwcfg2.hs_phy_type == GHWCFG2_HSPHY_ULPI) { dcfg |= DCFG_XCVRDLY; } } else { @@ -667,7 +659,7 @@ void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) { // 7.4.1 Initialization on USB Reset static void handle_bus_reset(uint8_t rhport) { dwc2_regs_t *dwc2 = DWC2_REG(rhport); - const uint8_t ep_count = DWC2_EP_COUNT(dwc2); + const uint8_t ep_count = dwc2_ep_count(dwc2); tu_memclr(xfer_status, sizeof(xfer_status)); @@ -697,7 +689,9 @@ static void handle_bus_reset(uint8_t rhport) { dfifo_device_init(rhport); // 5. Reset device address - dwc2->dcfg_bm.address = 0; + dwc2_dcfg_t dcfg = {.value = dwc2->dcfg}; + dcfg.address = 0; + dwc2->dcfg = dcfg.value; // Fixed both control EP0 size to 64 bytes dwc2->epin[0].ctl &= ~(0x03 << DIEPCTL_MPSIZ_Pos); @@ -717,8 +711,9 @@ static void handle_bus_reset(uint8_t rhport) { static void handle_enum_done(uint8_t rhport) { dwc2_regs_t *dwc2 = DWC2_REG(rhport); + const dwc2_dsts_t dsts = {.value = dwc2->dsts}; tusb_speed_t speed; - switch (dwc2->dsts_bm.enum_speed) { + switch (dsts.enum_speed) { case DCFG_SPEED_HIGH: speed = TUSB_SPEED_HIGH; break; @@ -763,12 +758,12 @@ static void handle_rxflvl_irq(uint8_t rhport) { const volatile uint32_t* rx_fifo = dwc2->fifo[0]; // Pop control word off FIFO - const dwc2_grxstsp_t grxstsp_bm = dwc2->grxstsp_bm; - const uint8_t epnum = grxstsp_bm.ep_ch_num; + const dwc2_grxstsp_t grxstsp = {.value = dwc2->grxstsp}; + const uint8_t epnum = grxstsp.ep_ch_num; dwc2_dep_t* epout = &dwc2->epout[epnum]; - switch (grxstsp_bm.packet_status) { + switch (grxstsp.packet_status) { case GRXSTS_PKTSTS_GLOBAL_OUT_NAK: // Global OUT NAK: do nothing break; @@ -790,7 +785,7 @@ static void handle_rxflvl_irq(uint8_t rhport) { case GRXSTS_PKTSTS_RX_DATA: { // Out packet received - const uint16_t byte_count = grxstsp_bm.byte_count; + const uint16_t byte_count = grxstsp.byte_count; xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); if (byte_count) { @@ -804,7 +799,8 @@ static void handle_rxflvl_irq(uint8_t rhport) { // short packet, minus remaining bytes (xfer_size) if (byte_count < xfer->max_size) { - xfer->total_len -= epout->tsiz_bm.xfer_size; + const dwc2_ep_tsize_t tsiz = {.value = epout->tsiz}; + xfer->total_len -= tsiz.xfer_size; if (epnum == 0) { xfer->total_len -= _dcd_data.ep0_pending[TUSB_DIR_OUT]; _dcd_data.ep0_pending[TUSB_DIR_OUT] = 0; @@ -866,11 +862,13 @@ static void handle_epin_slave(uint8_t rhport, uint8_t epnum, dwc2_diepint_t diep // - 64 bytes or // - Half/Empty of TX FIFO size (configured by GAHBCFG.TXFELVL) if (diepint_bm.txfifo_empty && (dwc2->diepempmsk & (1 << epnum))) { - const uint16_t remain_packets = epin->tsiz_bm.packet_count; + dwc2_ep_tsize_t tsiz = {.value = epin->tsiz}; + const uint16_t remain_packets = tsiz.packet_count; // Process every single packet (only whole packets can be written to fifo) for (uint16_t i = 0; i < remain_packets; i++) { - const uint16_t remain_bytes = (uint16_t) epin->tsiz_bm.xfer_size; + tsiz.value = epin->tsiz; + const uint16_t remain_bytes = (uint16_t) tsiz.xfer_size; const uint16_t xact_bytes = tu_min16(remain_bytes, xfer->max_size); // Check if dtxfsts has enough space available @@ -889,7 +887,8 @@ static void handle_epin_slave(uint8_t rhport, uint8_t epnum, dwc2_diepint_t diep } // Turn off TXFE if all bytes are written. - if (epin->tsiz_bm.xfer_size == 0) { + tsiz.value = epin->tsiz; + if (tsiz.xfer_size == 0) { dwc2->diepempmsk &= ~(1 << epnum); } } @@ -920,7 +919,8 @@ static void handle_epout_dma(uint8_t rhport, uint8_t epnum, dwc2_doepint_t doepi xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT); // determine actual received bytes - const uint16_t remain = epout->tsiz_bm.xfer_size; + const dwc2_ep_tsize_t tsiz = {.value = epout->tsiz}; + const uint16_t remain = tsiz.xfer_size; xfer->total_len -= remain; // this is ZLP, so prepare EP0 for next setup @@ -956,7 +956,7 @@ static void handle_epin_dma(uint8_t rhport, uint8_t epnum, dwc2_diepint_t diepin static void handle_ep_irq(uint8_t rhport, uint8_t dir) { dwc2_regs_t* dwc2 = DWC2_REG(rhport); const bool is_dma = dma_device_enabled(dwc2); - const uint8_t ep_count = DWC2_EP_COUNT(dwc2); + const uint8_t ep_count = dwc2_ep_count(dwc2); const uint8_t daint_offset = (dir == TUSB_DIR_IN) ? DAINT_IEPINT_Pos : DAINT_OEPINT_Pos; dwc2_dep_t* ep_base = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][0]; From f7cea326a83d178c7b176b5940efd335f5f0fc3b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 15 Apr 2025 19:02:05 +0200 Subject: [PATCH 627/636] Update dcd_dwc2.patch --- components/arduino_tinyusb/patches/dcd_dwc2.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/arduino_tinyusb/patches/dcd_dwc2.patch b/components/arduino_tinyusb/patches/dcd_dwc2.patch index 11c1c05c0..14e6975f0 100755 --- a/components/arduino_tinyusb/patches/dcd_dwc2.patch +++ b/components/arduino_tinyusb/patches/dcd_dwc2.patch @@ -19,11 +19,11 @@ dwc2_regs_t* dwc2 = DWC2_REG(rhport); const uint8_t epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); @@ -266,7 +277,18 @@ - depctl.bm.set_data0_iso_even = 1; + depctl.set_data0_iso_even = 1; } if (dir == TUSB_DIR_IN) { -- depctl.bm.tx_fifo_num = epnum; -+ //depctl.bm.tx_fifo_num = epnum; +- depctl.tx_fifo_num = epnum; ++ //depctl.tx_fifo_num = epnum; + uint8_t fifo_num = epnum; +#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) + // Special Case for EP5, which is used by CDC but not actually called by the driver @@ -34,7 +34,7 @@ + fifo_num = get_free_fifo(); + } +#endif -+ depctl.bm.tx_fifo_num = fifo_num; ++ depctl.tx_fifo_num = fifo_num; } dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; From 99b0eef639da200f39aa7b41cffd3c27ef5bb791 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 28 Apr 2025 16:21:01 +0200 Subject: [PATCH 628/636] remove duplicate entry --- configs/defconfig.esp32 | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index 92f4dbe4e..22d811b0e 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -33,7 +33,6 @@ CONFIG_ETH_USE_SPI_ETHERNET=y CONFIG_SPIRAM=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y -CONFIG_ULP_COPROC_ENABLED=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set # CONFIG_UNITY_ENABLE_FLOAT is not set # CONFIG_UNITY_ENABLE_DOUBLE is not set From d873078411c09418f7abfabfb57e3643a88a677d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:36:06 +0200 Subject: [PATCH 629/636] remove matter settings --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 276e073a9..bbf8583cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,4 +35,3 @@ add_custom_command( add_custom_target(mem-variant DEPENDS "mem_variant") idf_build_set_property(COMPILE_DEFINITIONS "-DESP32_ARDUINO_LIB_BUILDER" APPEND) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++2a;-DCHIP_HAVE_CONFIG_H" APPEND) From be161f0fd61b2b04627e3c4de10e96ae30c2882b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 4 May 2025 22:48:51 +0200 Subject: [PATCH 630/636] Update defconfig.common --- configs/defconfig.common | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/defconfig.common b/configs/defconfig.common index 4a421ec3b..445868554 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -158,7 +158,7 @@ CONFIG_MBEDTLS_ROM_MD5=y CONFIG_MBEDTLS_HARDWARE_ECC=y CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_HARDWARE_MPI=y -CONFIG_MBEDTLS_HARDWARE_SHA=y +# CONFIG_MBEDTLS_HARDWARE_SHA is not set # CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK is not set # CONFIG_MBEDTLS_HAVE_TIME is not set # CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set @@ -178,6 +178,8 @@ CONFIG_MBEDTLS_ECP_C=y CONFIG_MBEDTLS_ECDH_C=y CONFIG_MBEDTLS_ECDSA_C=y CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +# CONFIG_MBEDTLS_SHA1_C is not set +# CONFIG_MBEDTLS_SHA1_ALT is not set # CONFIG_MBEDTLS_DHM_C is not set # CONFIG_MBEDTLS_ECJPAKE_C is not set # CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set From 5f3942f5e8226401474d25d73bbb718a10fa8265 Mon Sep 17 00:00:00 2001 From: Christian Baars <Baars@gmx.de> Date: Thu, 8 May 2025 21:12:04 +0200 Subject: [PATCH 631/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index e96fc314b..b6ab3487a 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 CCACHE_ENABLE=1 -export TARGET="all" +export TARGET="esp32s3" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From f60f918b4c18832cbcb6b8793f1ca4d53d1a57b8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 9 May 2025 10:40:38 +0200 Subject: [PATCH 632/636] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index b6ab3487a..e96fc314b 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1 CCACHE_ENABLE=1 -export TARGET="esp32s3" +export TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 From 80315600f0e38a58be59360d694e8f8d22b5d034 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 12 May 2025 12:28:41 +0200 Subject: [PATCH 633/636] better IDF commit checkout handling --- tools/install-esp-idf.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index f79f5c7f9..5db354e62 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -52,7 +52,14 @@ if [ "$IDF_TAG" ]; then git -C "$IDF_PATH" checkout "tags/$IDF_TAG" idf_was_installed="1" elif [ "$IDF_COMMIT" ]; then + cd $IDF_PATH git -C "$IDF_PATH" checkout "$IDF_COMMIT" + git reset --hard $IDF_COMMIT + git submodule update --recursive + git rm -r $IDF_PATH/components/wifi_provisioning + git rm -r $IDF_PATH/components/spiffs + git commit -m "delete components SPIFFS and wifi-provisioning" + cd - commit_predefined="1" fi From aa0f875fbc0c8fe09565065f634fb5de6a59e6c5 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 12 May 2025 12:35:44 +0200 Subject: [PATCH 634/636] Update install-esp-idf.sh --- tools/install-esp-idf.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index 5db354e62..16b827060 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -49,7 +49,14 @@ else fi if [ "$IDF_TAG" ]; then + cd $IDF_PATH git -C "$IDF_PATH" checkout "tags/$IDF_TAG" + git reset --hard "tags/$IDF_TAG" + git submodule update --recursive + git rm -r $IDF_PATH/components/wifi_provisioning + git rm -r $IDF_PATH/components/spiffs + git commit -m "delete components SPIFFS and wifi-provisioning" + cd - idf_was_installed="1" elif [ "$IDF_COMMIT" ]; then cd $IDF_PATH From 5b79b4f02c6348a2854f428edd3bdb2213ea84e7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 13 May 2025 15:04:39 +0200 Subject: [PATCH 635/636] Update defconfig.esp32s3 --- configs/defconfig.esp32s3 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 2a42d9317..c29bfa1ef 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -18,6 +18,8 @@ CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n CONFIG_BOOTLOADER_FLASH_DC_AWARE=y +# CONFIG_LCD_RGB_ISR_IRAM_SAFE is not set + # # S3 Display shift fix -> https://espressif-docs.readthedocs-hosted.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html # From 33a3d957a9fc2ad35c6374455390e00344d81fa4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 13 May 2025 15:07:53 +0200 Subject: [PATCH 636/636] remove CONFIG_LCD_RGB_ISR_IRAM_SAFE=y and set # CONFIG_LCD_RGB_ISR_IRAM_SAFE is not set as default in defconfig.esp32s3 See https://github.com/espressif/esp32-arduino-lib-builder/pull/298 --- configs/defconfig.opi_ram | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/defconfig.opi_ram b/configs/defconfig.opi_ram index f1f2238cd..19d6ce00c 100644 --- a/configs/defconfig.opi_ram +++ b/configs/defconfig.opi_ram @@ -1,7 +1,6 @@ CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y # CONFIG_SPIRAM_MEMTEST is not set -CONFIG_LCD_RGB_ISR_IRAM_SAFE=y CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y # bounce buffer mode relies on GDMA EOF interrupt to be service-able # I2S_ISR_IRAM_SAFE has to be set!! Done in common config