Skip to content

Commit 1c1d199

Browse files
committed
Reorganized some build files & commented out WFI to debug USB. USB enumerates but has some issues starting interfaces for CDC/MSC/HID.
1 parent 5374625 commit 1c1d199

3 files changed

Lines changed: 18 additions & 29 deletions

File tree

ports/analog/Makefile

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -167,36 +167,24 @@ COPT += -O0 #opt completely off to start
167167
endif
168168

169169
# TinyUSB CFLAGS
170-
ifeq ($(CIRCUITPY_TINYUSB),1)
171170
CFLAGS += \
172171
-DCFG_TUSB_MCU=OPT_MCU_$(MCU_VARIANT_UPPER) \
173172
-DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED \
174-
-DCFG_TUSB_OS=OPT_OS_NONE
175-
176-
# -DCFG_TUD_TASK_QUEUE_SZ=32
177-
178-
# Add TinyUSB sources
179-
INC += -I../../lib/tinyusb/src
180-
INC += -I../../supervisor/shared/usb
181-
SRC_C += lib/tinyusb/src/portable/mentor/musb/dcd_musb.c
182-
endif
183-
184-
ifeq ($(CIRCUITPY_USB_DEVICE),1)
185-
CFLAGS += \
173+
-DCFG_TUSB_OS=OPT_OS_NONE \
186174
-DCFG_TUD_CDC_TX_BUFSIZE=1024 \
187175
-DCFG_TUD_CDC_RX_BUFSIZE=1024 \
188-
-DCFG_TUD_MSC_BUFSIZE=4096
189-
endif
190-
191-
ifdef CIRCUITPY_USB_VENDOR
192-
CFLASGS += \
176+
-DCFG_TUD_MSC_BUFSIZE=4096 \
177+
-DCFG_TUD_MIDI_RX_BUFSIZE=128 \
178+
-DCFG_TUD_MIDI_TX_BUFSIZE=128 \
193179
-DCFG_TUD_VENDOR_RX_BUFSIZE=1024 \
194180
-DCFG_TUD_VENDOR_TX_BUFSIZE=1024
195-
endif
196181

197-
# -DCFG_TUD_MIDI_RX_BUFSIZE=128
198-
# -DCFG_TUD_MIDI_TX_BUFSIZE=128
182+
# Add TinyUSB sources
183+
INC += -I../../lib/tinyusb/src
184+
INC += -I../../supervisor/shared/usb
185+
SRC_C += lib/tinyusb/src/portable/mentor/musb/dcd_musb.c
199186

187+
# Add port sources incl. any board functions
200188
SRC_C += \
201189
boards/$(BOARD)/board.c \
202190
background.c \

ports/analog/mpconfigport.mk

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ INTERNAL_FLASH_FILESYSTEM = 1
1717
SPI_FLASH_FILESYSTEM = 0
1818
QSPI_FLASH_FILESYSTEM = 0
1919

20-
# TODO: Test/Debug fs & general bringup
20+
# TODO: Test/Debug fs once USB-MSC is ready
2121
DISABLE_FILESYSTEM = 0
2222

2323
# TODO: Test/Debug TinyUSB!
24-
CIRCUITPY_TINYUSB = 1
25-
CIRCUITPY_USB_DEVICE ?= 1
26-
CIRCUITPY_USB_CDC ?= 1
27-
CIRCUITPY_USB_HID ?= 0
28-
CIRCUITPY_USB_MIDI ?= 0
24+
# CIRCUITPY_TINYUSB = 1
25+
# CIRCUITPY_USB_DEVICE ?= 1
26+
# CIRCUITPY_USB_CDC ?= 1
27+
# CIRCUITPY_USB_VENDOR ?=1
28+
# CIRCUITPY_USB_HID ?= 0
29+
# CIRCUITPY_USB_MIDI ?= 0
2930

3031
####################################################################################
3132
# Suggested config for first-time porting

ports/analog/supervisor/port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ uint32_t *port_stack_get_limit(void) {
163163
#pragma GCC diagnostic push
164164
#pragma GCC diagnostic ignored "-Warray-bounds"
165165

166-
// NOTE: Only return how much stack we have alloted for CircuitPython
166+
// NOTE: Only return how much stack we have allotted for CircuitPython
167167
return port_stack_get_top() - (CIRCUITPY_DEFAULT_STACK_SIZE + CIRCUITPY_EXCEPTION_STACK_SIZE) / sizeof(uint32_t);
168168
#pragma GCC diagnostic pop
169169
}
@@ -268,7 +268,7 @@ void port_idle_until_interrupt(void) {
268268
if (!background_callback_pending()) {
269269
__DSB();
270270
/** DEBUG: may comment out WFI for debugging port functions */
271-
__WFI();
271+
// __WFI();
272272
}
273273
common_hal_mcu_enable_interrupts();
274274
}

0 commit comments

Comments
 (0)