Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 Arduino v3.1 libs from ESP-IDF v5.3 #208

Merged
merged 55 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8c2ee34
fix(build): Changes required to build against IDF v5.3
me-no-dev Aug 19, 2024
dda397c
Use unified Xtensa toolchain
me-no-dev Aug 19, 2024
f757e7c
Merge branch 'master' into release/v5.3
me-no-dev Aug 19, 2024
e7412ce
Merge branch 'master' into release/v5.3
me-no-dev Aug 19, 2024
c021c0c
Merge branch 'master' into release/v5.3
me-no-dev Aug 19, 2024
8c53587
Merge branch 'master' into release/v5.3
me-no-dev Aug 19, 2024
807bddb
add(build): Add initial ESP32-P4 skeleton
me-no-dev Aug 20, 2024
958f8b0
Merge branch 'master' into release/v5.3
me-no-dev Aug 28, 2024
b7394f9
Merge branch 'master' into release/v5.3
me-no-dev Aug 30, 2024
f7cf4b4
Merge branch 'master' into release/v5.3
me-no-dev Aug 31, 2024
fd55708
feat(esp32p4): Build libs for ESP32-P4 (#221)
lucasssvaz Sep 24, 2024
ce5121f
Update SDK in JSON even if version did not change (#223)
lucasssvaz Sep 24, 2024
cd44433
Merge branch 'master' into release/v5.3
me-no-dev Sep 25, 2024
6c219b1
Do not build matter for ESP32-P4
me-no-dev Sep 26, 2024
9960778
Merge branch 'master' into release/v5.3
me-no-dev Sep 26, 2024
956d601
Update ESP-DL configuration
me-no-dev Sep 30, 2024
d1253b5
Add additional DL models and use extra components only when needed
me-no-dev Sep 30, 2024
705ef60
Merge branch 'master' into release/v5.3
me-no-dev Sep 30, 2024
cab451a
Use extra DL models only on S3 and P4
me-no-dev Sep 30, 2024
e3d2928
Switch to the new ESP-DL only for ESP32-P4
me-no-dev Sep 30, 2024
8bc7ec5
Rename old DL component and revert the name of the new
me-no-dev Sep 30, 2024
5c2510f
Merge branch 'master' into release/v5.3
me-no-dev Oct 2, 2024
ac25609
Enable TinyUSB build for ESP32P4
me-no-dev Oct 2, 2024
8fb7dff
Merge branch 'master' into release/v5.3
me-no-dev Oct 2, 2024
0232d0a
Add support for HighSpeed USB in arduino_tinyusb
me-no-dev Oct 3, 2024
9919f9b
Merge branch 'master' into release/v5.3
me-no-dev Oct 10, 2024
11b9bf9
Update tinyusb dcd_dwc2
me-no-dev Oct 10, 2024
062283e
Add P4 configuration for PSRAM, WDT and ESP-HOSTED
me-no-dev Oct 15, 2024
177dc97
Update dcd_dwc2.c
me-no-dev Oct 15, 2024
d7b210b
Remove conditional inclusion of builder specified components
me-no-dev Oct 16, 2024
5aeba7c
Do not use ESP-DL on P4
me-no-dev Oct 16, 2024
7b7b326
Update P4 PSRAM Speed to 200MHz
me-no-dev Oct 17, 2024
7080df0
Fixes Matter over WiFi to disable OpenThread (#232)
SuGlider Oct 22, 2024
e5e0324
Add define to signify that prebuilt libs are used
me-no-dev Oct 22, 2024
7977581
Enable FreeRTOS Trace Facility (#234)
me-no-dev Oct 25, 2024
00ad145
fix(docker): Add docker tag to run scripts in 5.3 branch (#236)
lucasssvaz Oct 31, 2024
aa2ae9f
Merge branch 'master' into release/v5.3
me-no-dev Nov 4, 2024
3ff7a1e
fix(zigbee): Unlink the zigbee libs (#242)
P-R-O-C-H-Y Nov 6, 2024
bc48ab4
fix(): Move mkdir to top as its already used
P-R-O-C-H-Y Nov 6, 2024
1f52459
Update TinyUSB DCD Source
me-no-dev Nov 12, 2024
117ef04
Add missing compile source from TinyUSB
me-no-dev Nov 12, 2024
70f28a9
Fix path to TinyUSB dwc2_common.c
me-no-dev Nov 12, 2024
94d6ca7
Merge branch 'master' into release/v5.3
me-no-dev Nov 18, 2024
8bcf3eb
Update TinyUSB DCD
me-no-dev Nov 18, 2024
19efed2
Merge branch 'master' into release/v5.3
me-no-dev Nov 23, 2024
d96461f
Update TinyUSB DCD
me-no-dev Nov 25, 2024
9f26bc4
Update dcd_dwc2.c
me-no-dev Nov 25, 2024
4e28a07
Update dcd_dwc2.c
me-no-dev Dec 10, 2024
a8ed145
Update copy-libs.sh
me-no-dev Dec 10, 2024
7227862
Support rev 0 for P4 (#254)
P-R-O-C-H-Y Dec 10, 2024
fd1493b
Merge branch 'master' into release/v5.3
me-no-dev Dec 10, 2024
12afeba
Fix the crash for esp32 and esp32c3 (#248)
kvp1703 Dec 10, 2024
ac5db72
fix(trademark): Remove 3rd party trademarks from scripts (#255)
lucasssvaz Dec 10, 2024
c1053bc
Update dcd_dwc2.c
me-no-dev Dec 12, 2024
0c609b1
Prepare for merging release/v5.3 into master
me-no-dev Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
lib_builder_branch: "release/v5.1"
targets: "esp32,esp32s2,esp32s3,esp32c3,esp32c6,esp32h2"
- idf_branch: "release/v5.3"
lib_builder_branch: "release/v5.3"
lib_builder_branch: "master"
targets: "esp32,esp32s2,esp32s3,esp32c3,esp32c6,esp32h2,esp32p4"
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
target: [esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2]
target: [esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2, esp32p4]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ add_custom_command(
)
add_custom_target(mem-variant DEPENDS "mem_variant")

idf_build_set_property(COMPILE_DEFINITIONS "-DESP32_ARDUINO_LIB_BUILDER" APPEND)

##################
### ESP Matter ###
##################
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ if [ "$BUILD_TYPE" = "all" ]; then
if [ $? -ne 0 ]; then exit 1; fi
fi

# Generate PlatformIO manifest file
# Generate pioarduino manifest file
if [ "$BUILD_TYPE" = "all" ]; then
echo "* Generating PlatformIO manifest file..."
echo "* Generating pioarduino manifest file..."
pushd $IDF_PATH
ibr=$(git describe --all 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_pioarduino_manifest.py -o "$TOOLS_JSON_OUT/" -s "$ibr" -c "$ic"
if [ $? -ne 0 ]; then exit 1; fi
fi

Expand Down
3 changes: 2 additions & 1 deletion components/arduino_tinyusb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +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/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"
Expand Down
28 changes: 18 additions & 10 deletions components/arduino_tinyusb/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -219,14 +225,16 @@ 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
Expand Down
7 changes: 7 additions & 0 deletions components/arduino_tinyusb/include/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,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
Expand Down
55 changes: 28 additions & 27 deletions components/arduino_tinyusb/patches/dcd_dwc2.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
--- 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 @@
@@ -243,6 +243,17 @@
//--------------------------------------------------------------------
// Endpoint
//--------------------------------------------------------------------
+#if defined(TUP_USBIP_DWC2_ESP32)
+#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
+
Expand All @@ -14,68 +14,69 @@
+ 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);
@@ -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);
const uint8_t epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress);
@@ -266,7 +277,18 @@
depctl.bm.set_data0_iso_even = 1;
}
if (dir == TUSB_DIR_IN) {
- depctl.bm.tx_fifo_num = epnum;
+ //depctl.bm.tx_fifo_num = epnum;
+ uint8_t fifo_num = epnum;
+#if defined(TUP_USBIP_DWC2_ESP32)
+#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);
+ depctl.bm.tx_fifo_num = fifo_num;
}
}
@@ -850,6 +871,10 @@
xfer_status[n][TUSB_DIR_IN].max_size = 0;

dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum];
@@ -557,6 +579,10 @@
}
}

+#if defined(TUP_USBIP_DWC2_ESP32)
+#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) {
@@ -997,6 +1023,9 @@
if (gintsts & GINTSTS_USBRST) {
// USBRST is start of reset.
dwc2->gintsts = GINTSTS_USBRST;
+#if defined(TUP_USBIP_DWC2_ESP32)
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
+ _allocated_fifos = 1;
+#endif
bus_reset(rhport);
handle_bus_reset(rhport);
}

@@ -1235,7 +1263,11 @@
@@ -1008,7 +1037,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 defined(TUP_USBIP_DWC2_ESP32)
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
+ _allocated_fifos = 1;
+#endif
}

if (int_status & GINTSTS_WKUINT) {
@@ -1252,6 +1284,9 @@
if (gintsts & GINTSTS_WKUINT) {
@@ -1025,6 +1058,9 @@

if (otg_int & GOTGINT_SEDET) {
dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true);
+#if defined(TUP_USBIP_DWC2_ESP32)
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
+ _allocated_fifos = 1;
+#endif
}
Expand Down
Loading
Loading