Skip to content

Commit 36bc41c

Browse files
authored
Merge pull request adafruit#10293 from tannewt/shrink_host_enum_buffer
Reduce USB static buffers for ESP32-S2
2 parents f9ab642 + f5aef15 commit 36bc41c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ports/espressif/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,19 @@ CFLAGS += \
360360
-DCFG_TUD_TASK_QUEUE_SZ=32
361361
endif
362362
ifeq ($(CIRCUITPY_USB_DEVICE),1)
363+
ifeq ($(IDF_TARGET),esp32s2)
364+
# Make more room in internal RAM on the S2.
365+
CFLAGS += \
366+
-DCFG_TUD_CDC_RX_BUFSIZE=128 \
367+
-DCFG_TUD_CDC_TX_BUFSIZE=128 \
368+
-DCFG_TUD_MSC_BUFSIZE=1024
369+
else
363370
CFLAGS += \
364371
-DCFG_TUD_CDC_RX_BUFSIZE=1024 \
365372
-DCFG_TUD_CDC_TX_BUFSIZE=1024 \
366-
-DCFG_TUD_MSC_BUFSIZE=4096 \
373+
-DCFG_TUD_MSC_BUFSIZE=4096
374+
endif
375+
CFLAGS += \
367376
-DCFG_TUD_MIDI_RX_BUFSIZE=128 \
368377
-DCFG_TUD_MIDI_TX_BUFSIZE=128 \
369378
-DCFG_TUD_VENDOR_RX_BUFSIZE=128 \

supervisor/shared/usb/tusb_config.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ extern "C" {
172172
#endif
173173

174174
// Size of buffer to hold descriptors and other data used for enumeration
175+
// CircuitPython itself is 284 bytes of configuration descriptor when both CDC endpoints are
176+
// enabled, plus 4 bytes for alignment.
175177
#ifndef CFG_TUH_ENUMERATION_BUFSIZE
176-
#define CFG_TUH_ENUMERATION_BUFSIZE 512
178+
#define CFG_TUH_ENUMERATION_BUFSIZE (284 + 4)
177179
#endif
178180

179181
#if CIRCUITPY_USB_KEYBOARD_WORKFLOW

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy