Closed MB3hel closed 1 year ago
Disabling some compiler settings leads to different results. Likely some form of race condition or out of order initialization.
Compile / link flags disabled:
-ffunction-sections
-fdata-sections
-mlong-calls
-Wl,--gc-sections
New behavior:
Possibly caused by a stack overflow occurring (undetected) and having data get overwritten later because it's using memory that doesn't actually belong to the task. This would be a race condition based on task creation order and also explains the wide variation of behavior.
Stack size currently used is smaller than TinyUSB example uses.
Problem solved on both platforms (with original and reduced compile options) by increasing stack size for TinyUSB device task. Some restructuring also occurred.
Summary:
Versions Tested: v1, v2
Versions Impacted: v1, v2
Details:
USB communication does not seem to work with debug builds. This impacts v1 and v2 in different ways.
v1 deadlocks. In
usbd.c
(tinyusb src) the variable_usbd_mutex
is zero whenusbd_edpt_claim
is called. This causes a null handle to be passed to FreeRTOS causing the program to deadlock inconfigASSERT
.v2 does not deadlock, but USB does not initialize properly (improperly detected by computer).