Skip to content

USBCore SET_CONFIGURATION handler is not interrupt-safe #688

Open
@AlanStern

Description

@AlanStern

In USBCore.cpp, the handleStandardSetup() interrupt subroutine's SET_CONFIGURATION case calls initEndpoints(), which calls initEP(). For Bulk-OUT endpoints, initEP() calls operator new and possibly operator delete. In the absence of any other information, I assume the implementations of those operators internally rely on malloc() and free(), which are not interrupt-safe.

A proper fix requires a fair amount of reorganization. The DoubleBufferedEPOutHandler class object should be created early, during the initialization of the USB device. When a SET_CONFIGURATION request is received, the object should not be deleted and recreated, but properly reset. (This is related to issue #350, although the problem was present before that.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions