• Earle F. Philhower, III's avatar
    Use real FreeRTOS tasks to idle core during flash (#1444) · ae908c8e
    Earle F. Philhower, III authored
    Fixes #1439
    
    Use a real FreeRTOS task, at the highest priority, to idle the other core
    while doing flash accesses.
    
    The USB stack seems to have some timing dependent bits which get broken
    if FreeRTOS switches out the current task when it's running.  Avoid any
    issue by disabling preemption on the core for all tud_task calls.
    
    The PendSV handler disable flag can live completely inside the FreeRTOS
    variant port, so remove any reference to it in the main core.
    
    Tested using Multicode-FreeRTOS, #1402 and #1441
    
    The USB FIFO interrupts were still being serviced even when the core was
    frozen, leading to crashes.  Explicitly shut off IRQs on both the victim
    and the initiator core when freezing.
    
    Removed the need for hack __holdUpPendSV flag
    ae908c8e
main.cpp 4.8 KB