Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Teensy 4 Compilation with USB_DISABLED Flag #735

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dmadison
Copy link

Testing with 1.59 I discovered that Teensy 4.0 does not compile when the USB_DISABLED flag is set. This PR fixes that issue with two small corrections.

First, a declaration for serialEvent() is added to the dummy Serial interface block. This was removed during the serial event rework for 1.59, but should be present for the dummy interface.

Second, a dummy usb_isr() function definition was added for situations where the core is compiled with no USB endpoints defined (NUM_ENDPOINTS). This function is invoked by the unused_interrupt_vector() function in startup.c, and without a definition was causing a linker error.

I haven't done any testing in hardware, but the core now compiles at least.

This was removed in 9208360, but is required for the dummy serial interface when compiling with the USB_DISABLED flag.
This is invoked by unused_interrupt_vector() and throws a linker error when USB_DISABLED is set. Declaring a dummy function here to avoid the error.
@schwinn
Copy link

schwinn commented Nov 19, 2024

I noticed today that my project for a Teensy 4.0 does not compile with the USB_DISABLED flag.

I've changed yield.c and startup.c with #ifndef USB_DISABLED macros and now it compiles successfully and a test with 24Mhz shows a decreased power consumption by 10% with USB_DISABLED. This is nice for battery powered devices.

Is there a chance that this will be solved in the core library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants