diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 31c578ef7..8a8f721db 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -35,11 +35,11 @@ jobs: # - idf_branch: "release/v5.1" # lib_builder_branch: "release/v5.1" # targets: "esp32,esp32s2,esp32s3,esp32c3,esp32c6,esp32h2" - - idf_branch: "release/v5.3" - lib_builder_branch: "master" - targets: "esp32,esp32s2,esp32s3,esp32c3,esp32c6,esp32h2,esp32p4" + # - idf_branch: "release/v5.3" + # lib_builder_branch: "master" + # targets: "esp32,esp32s2,esp32s3,esp32c3,esp32c6,esp32h2,esp32p4" - idf_branch: "release/v5.4" - lib_builder_branch: "release/v5.4" + lib_builder_branch: "master" targets: "esp32,esp32s2,esp32s3,esp32c3,esp32c6,esp32h2,esp32p4" - idf_branch: "master" lib_builder_branch: "release/v5.5" diff --git a/.github/workflows/cron_build.yml b/.github/workflows/cron_build.yml index 8d13759b7..fd9634928 100644 --- a/.github/workflows/cron_build.yml +++ b/.github/workflows/cron_build.yml @@ -41,7 +41,8 @@ jobs: deploy_needed: ${{ steps.check.outputs.deploy_needed }} targets_list: ${{ steps.check.outputs.targets_list }} steps: - - uses: actions/checkout@v4 + - name: Checkout ${{ inputs.lib_builder_branch }} + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ inputs.lib_builder_branch }} @@ -65,7 +66,8 @@ jobs: matrix: target: ${{ fromJson(needs.check-if-needed.outputs.targets_list) }} steps: - - uses: actions/checkout@v4 + - name: Checkout ${{ inputs.lib_builder_branch }} + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ inputs.lib_builder_branch }} @@ -88,13 +90,13 @@ jobs: - name: Upload build if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: build-${{ env.libs_branch }}-${{ matrix.target }} path: build - name: Upload library files - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: libs-${{ env.libs_branch }}-${{ matrix.target }} path: dist @@ -105,7 +107,8 @@ jobs: needs: [check-if-needed, build-libs] if: needs.check-if-needed.outputs.deploy_needed == '1' steps: - - uses: actions/checkout@v4 + - name: Checkout ${{ inputs.lib_builder_branch }} + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ inputs.lib_builder_branch }} @@ -115,7 +118,7 @@ jobs: echo "libs_branch=${branch//\//_}" >> $GITHUB_ENV - name: Download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 with: path: dist pattern: libs-${{ env.libs_branch }}-* @@ -125,7 +128,7 @@ jobs: run: bash ./tools/combine-artifacts.sh - name: Upload full esp32-arduino-libs archive - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: esp32-arduino-libs-${{ env.libs_branch }} path: dist/esp32-arduino-libs.zip @@ -154,7 +157,7 @@ jobs: bash ./tools/push-to-arduino.sh - name: Upload package_esp32_index.template.json - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: package-esp32-index-json-${{ env.libs_branch }} path: out/package_esp32_index.template.json diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d6166a365..c89352150 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -66,23 +66,23 @@ jobs: echo "URL: $URL" - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Login to Docker Hub if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Set up QEMU for multiarch builds - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 with: context: tools/docker push: ${{ github.event_name == 'push' }} @@ -94,7 +94,7 @@ jobs: - name: Update Docker Hub repository description (master branch) if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref_name == 'master' }} - uses: peter-evans/dockerhub-description@v4 + uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 95610c403..756ab0991 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -28,7 +28,8 @@ jobs: target: [esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2, esp32p4] fail-fast: false steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install dependencies run: bash ./tools/prepare-ci.sh @@ -38,13 +39,13 @@ jobs: - name: Upload build if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: build-${{ matrix.target }} path: build - name: Upload archive - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: artifacts-${{ matrix.target }} path: dist @@ -55,7 +56,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 with: path: dist pattern: artifacts-* @@ -69,13 +70,13 @@ jobs: cp out/package_esp32_index.template.json dist/package_esp32_index.template.json - name: Upload full esp32-arduino-libs archive - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: esp32-arduino-libs path: dist/esp32-arduino-libs.tar.gz - name: Upload package_esp32_index.template.json - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: package-esp32-index-json path: dist/package_esp32_index.template.json diff --git a/.github/workflows/repository_dispatch.yml b/.github/workflows/repository_dispatch.yml index a18412a3d..62837976b 100644 --- a/.github/workflows/repository_dispatch.yml +++ b/.github/workflows/repository_dispatch.yml @@ -7,25 +7,30 @@ jobs: name: Dispatch Event runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 + - 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 build if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: build path: build + - name: Upload archive - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: artifacts path: dist diff --git a/CMakeLists.txt b/CMakeLists.txt index 1268b8e68..b79d85c0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,4 +39,4 @@ idf_build_set_property(COMPILE_DEFINITIONS "-DESP32_ARDUINO_LIB_BUILDER" APPEND) ################## ### ESP Matter ### ################## -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++2a;-DCHIP_HAVE_CONFIG_H" APPEND) 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" 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 diff --git a/components/arduino_tinyusb/patches/dcd_dwc2.patch b/components/arduino_tinyusb/patches/dcd_dwc2.patch index 11c1c05c0..14e6975f0 100644 --- 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]; 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]; diff --git a/configs/defconfig.common b/configs/defconfig.common index ef4620bf6..48baf5081 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -78,7 +78,6 @@ CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT=y CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT=y -CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM=y CONFIG_LWIP_MULTICAST_PING=y CONFIG_LWIP_BROADCAST_PING=y CONFIG_LWIP_IPV6_NUM_ADDRESSES=8 @@ -121,6 +120,7 @@ CONFIG_ESP_COREDUMP_STACK_SIZE=0 CONFIG_MBEDTLS_DYNAMIC_BUFFER=y CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y +CONFIG_I2S_ISR_IRAM_SAFE=y # # Matter Settings # @@ -131,3 +131,12 @@ CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n CONFIG_ENABLE_ESP_INSIGHTS_TRACE=n # Use compact attribute storage mode CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=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 + +# Zigbee Config +CONFIG_ZB_ENABLED=y diff --git a/configs/defconfig.esp32c6 b/configs/defconfig.esp32c6 index 8a45b0eed..d0e2b7bbd 100644 --- a/configs/defconfig.esp32c6 +++ b/configs/defconfig.esp32c6 @@ -45,7 +45,6 @@ CONFIG_ENABLE_MATTER_OVER_THREAD=n # # Zigbee # -CONFIG_ZB_ENABLED=y CONFIG_ZB_ZED=y CONFIG_ZB_RADIO_NATIVE=y # end of Zigbee diff --git a/configs/defconfig.esp32h2 b/configs/defconfig.esp32h2 index 9bc304886..024120d34 100644 --- a/configs/defconfig.esp32h2 +++ b/configs/defconfig.esp32h2 @@ -38,7 +38,6 @@ CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53" # # Zigbee # -CONFIG_ZB_ENABLED=y CONFIG_ZB_ZED=y CONFIG_ZB_RADIO_NATIVE=y # end of Zigbee diff --git a/configs/defconfig.esp32p4 b/configs/defconfig.esp32p4 index 8b04e8469..9cc5e8392 100644 --- a/configs/defconfig.esp32p4 +++ b/configs/defconfig.esp32p4 @@ -14,13 +14,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 +# RGB Display Optimizations +CONFIG_LCD_RGB_ISR_IRAM_SAFE=y +CONFIG_LCD_RGB_RESTART_IN_VSYNC=y diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index 2c2cba3cd..ce53e7747 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -17,3 +17,7 @@ CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_TYPE_FSM=y # CONFIG_ULP_COPROC_TYPE_RISCV=y CONFIG_ULP_COPROC_RESERVE_MEM=512 + +# RGB Display Optimizations +CONFIG_LCD_RGB_ISR_IRAM_SAFE=y +CONFIG_LCD_RGB_RESTART_IN_VSYNC=y diff --git a/configs/pioarduino_start.txt b/configs/pioarduino_start.txt index c5174173d..ec10a10dc 100644 --- a/configs/pioarduino_start.txt +++ b/configs/pioarduino_start.txt @@ -45,28 +45,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" ] ) diff --git a/main/idf_component.yml b/main/idf_component.yml index c6bb97f46..8c574bb08 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -17,7 +17,7 @@ dependencies: rules: - if: "target in [esp32s3]" espressif/esp_matter: - version: "^1.3.0" + version: "^1.4.0" require: public rules: - if: "target not in [esp32c2, esp32h2, esp32p4]" diff --git a/tools/config.sh b/tools/config.sh index 89cd9856a..79d4feef5 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.3" + IDF_BRANCH="release/v5.4" fi if [ -z $AR_PR_TARGET_BRANCH ]; then @@ -203,8 +203,11 @@ function github_release_asset_upload(){ # github_release_asset_upload local repo_path="$1" local release_asset_id="$2" - local res=$(curl -s -k -o /dev/null -w "%{http_code}" -X DELETE -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/releases/assets/$release_asset_id") - if [ "$res" -eq 204 ]; then echo 1; else echo 0; fi + local res + local return_code + res=$(curl -s -k -o /dev/null -w "%{http_code}" -X DELETE -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/releases/assets/$release_asset_id") + return_code=$? + if [ "$res" -eq 204 ] && [ "$return_code" -eq 0 ] ; then echo 1; else echo 0; fi } diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 21efe1a78..7c302ab66 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.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 @@ -525,9 +525,10 @@ for flag_file in "c_flags" "cpp_flags" "S_flags"; do sed 's/\\\"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\\\"/-DCHIP_HAVE_CONFIG_H/' $FLAGS_DIR/$flag_file > $FLAGS_DIR/$flag_file.temp mv $FLAGS_DIR/$flag_file.temp $FLAGS_DIR/$flag_file done -CHIP_RESOLVE_DIR="$AR_SDK/include/espressif__esp_matter/connectedhomeip/connectedhomeip/src/lib/address_resolve" -sed 's/CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER//' $CHIP_RESOLVE_DIR/AddressResolve.h > $CHIP_RESOLVE_DIR/AddressResolve_temp.h -mv $CHIP_RESOLVE_DIR/AddressResolve_temp.h $CHIP_RESOLVE_DIR/AddressResolve.h +# this is not necessary for Matter 1.4, but it is for Matter 1.3 +#CHIP_RESOLVE_DIR="$AR_SDK/include/espressif__esp_matter/connectedhomeip/connectedhomeip/src/lib/address_resolve" +#sed 's/CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER//' $CHIP_RESOLVE_DIR/AddressResolve.h > $CHIP_RESOLVE_DIR/AddressResolve_temp.h +#mv $CHIP_RESOLVE_DIR/AddressResolve_temp.h $CHIP_RESOLVE_DIR/AddressResolve.h # End of Matter Library adjustments # sdkconfig diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 3262cbb2d..699f0bd8e 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -1,5 +1,5 @@ # To Do: Check if it is worth to use espressif/idf as base image (image size will be much bigger) -FROM ubuntu:22.04 +FROM ubuntu:latest # switch to root, let the entrypoint drop back to host user USER root @@ -70,7 +70,7 @@ RUN echo LIBBUILDER_CHECKOUT_REF=$LIBBUILDER_CHECKOUT_REF LIBBUILDER_CLONE_BRANC git checkout $LIBBUILDER_CHECKOUT_REF && \ git submodule update --init --recursive; \ fi && \ - pip3 install --upgrade -r $LIBBUILDER_PATH/tools/config_editor/requirements.txt + pip3 install --break-system-packages --upgrade -r $LIBBUILDER_PATH/tools/config_editor/requirements.txt COPY entrypoint.sh $LIBBUILDER_PATH/entrypoint.sh diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py index 392eed508..f03b73d78 100644 --- a/tools/gen_tools_json.py +++ b/tools/gen_tools_json.py @@ -29,6 +29,8 @@ def replace_if_xz(system): new_url = system['url'].replace(".tar.xz", ".tar.gz") new_name = system['archiveFileName'].replace(".tar.xz", ".tar.gz") + new_signed_url = system['url'].replace(".tar.xz", "_signed.tar.gz") + new_signed_name = system['archiveFileName'].replace(".tar.xz", "_signed.tar.gz") new_checksum = "" new_size = 0 @@ -76,6 +78,12 @@ def replace_if_xz(system): release_manifests.append(manifest) # find the new file in the list and get it's size and checksum + for file in release_manifests[manifest_index]['files']: + if file['name'] == new_signed_name: + print("Found a signed version of the file") + new_url = new_signed_url + new_name = new_signed_name + break for file in release_manifests[manifest_index]['files']: if file['name'] == new_name: system['url'] = new_url diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index c4d1959d3..8b9b552a7 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -47,16 +47,22 @@ if [ $AR_HAS_COMMIT == "0" ] || [ $LIBS_HAS_ASSET == "0" ]; then fi fi + sleep 5 echo "Creating asset '$LIBS_ZIP_FILENAME'..." - mv -f "dist/esp32-arduino-libs.zip" "dist/$LIBS_ZIP_FILENAME" + LIBS_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_ZIP_FILENAME" "dist/$LIBS_ZIP_FILENAME"` if [ -z "$LIBS_ASSET_ID" ]; then - echo "ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME'" - exit 1 + echo "ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME. Retrying..." + LIBS_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_ZIP_FILENAME" "dist/$LIBS_ZIP_FILENAME"` + if [ -z "$LIBS_ASSET_ID" ]; then + echo "ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME'" + exit 1 + fi fi echo "Finished uploading asset '$LIBS_ZIP_FILENAME'. Asset ID: $LIBS_ASSET_ID" + sleep 5 # Calculate the local file checksum and size local_checksum=$(sha256sum "dist/$LIBS_ZIP_FILENAME" | awk '{print $1}') @@ -108,8 +114,12 @@ if [ $AR_HAS_COMMIT == "0" ] || [ $LIBS_HAS_ASSET == "0" ]; then JSON_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME" "$AR_OUT/package_esp32_index.template.json"` if [ -z "$JSON_ASSET_ID" ]; then - echo "ERROR: Failed to upload asset '$LIBS_JSON_FILENAME'" - exit 1 + echo "ERROR: Failed to upload asset '$LIBS_JSON_FILENAME'. Retrying..." + JSON_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME" "$AR_OUT/package_esp32_index.template.json"` + if [ -z "$JSON_ASSET_ID" ]; then + echo "ERROR: Failed to upload asset '$LIBS_JSON_FILENAME'" + exit 1 + fi fi fi