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

usb: device: next: increased RAM and flash footprint with "device_next" USB stack #83309

Open
henrikbrixandersen opened this issue Dec 22, 2024 · 1 comment
Assignees
Labels
area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features Experimental Experimental features not enabled by default

Comments

@henrikbrixandersen
Copy link
Member

henrikbrixandersen commented Dec 22, 2024

Is your enhancement proposal related to a problem? Please describe.
The device_next USB stack comes with a significant increase in both RAM and flash footprint compared to the "legacy" stack. The impact is especially hard on smaller USB MCUs with e.g. 16k RAM and 64k flash (smaller STM32 parts) where the increase can prevent existing firmware applications from switching to the new stack.

Describe the solution you'd like
While the design and implementation of the device_next is much superior to the "legacy" stack, it would be nice if the RAM and flash footprint could be reduced to be more friendly towards more resource constrained MCUs.

Describe alternatives you've considered
None.

Additional context
As an example, the samples/subsys/usb/hid-mouse/ sample compiled for the frdm_k64f board increases significantly in RAM and flash footprint when built for the device_next stack, but the problem is not limited to this sample/board.

$ west build -b frdm_k64f/mk64f12 samples/subsys/usb/hid-mouse
...
Memory region         Used Size  Region Size  %age Used
           FLASH:       41016 B         1 MB      3.91%
             RAM:       12760 B       192 KB      6.49%
           SRAML:          0 GB        64 KB      0.00%
        IDT_LIST:          0 GB        32 KB      0.00%
$ west build -b frdm_k64f/mk64f12 samples/subsys/usb/hid-mouse/ -- -DCONF_FILE=usbd_next_prj.conf -DEXTRA_DTC_OVERLAY_FILE=usbd_next.overlay
...
Memory region         Used Size  Region Size  %age Used
           FLASH:       54792 B         1 MB      5.23%
             RAM:       15480 B       192 KB      7.87%
           SRAML:          0 GB        64 KB      0.00%
        IDT_LIST:          0 GB        32 KB      0.00%
@henrikbrixandersen henrikbrixandersen added Enhancement Changes/Updates/Additions to existing features area: USB Universal Serial Bus Experimental Experimental features not enabled by default labels Dec 22, 2024
@henrikbrixandersen
Copy link
Member Author

henrikbrixandersen commented Dec 22, 2024

These are the numbers when building the same sample with logging disabled:

$ west build -b frdm_k64f/mk64f12 samples/subsys/usb/hid-mouse -- -DCONFIG_LOG=n
Memory region         Used Size  Region Size  %age Used
           FLASH:       27288 B         1 MB      2.60%
             RAM:       10648 B       192 KB      5.42%
           SRAML:          0 GB        64 KB      0.00%
        IDT_LIST:          0 GB        32 KB      0.00%
$ west build -b frdm_k64f/mk64f12 samples/subsys/usb/hid-mouse/ -- -DCONF_FILE=usbd_next_prj.conf -DEXTRA_DTC_OVERLAY_FILE=usbd_next.overlay -DCONFIG_LOG=n
...
Memory region         Used Size  Region Size  %age Used
           FLASH:       37016 B         1 MB      3.53%
             RAM:       13368 B       192 KB      6.80%
           SRAML:          0 GB        64 KB      0.00%
        IDT_LIST:          0 GB        32 KB      0.00%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features Experimental Experimental features not enabled by default
Projects
None yet
Development

No branches or pull requests

2 participants