You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most (all?) usb string descriptors use ASCII, but are stored as uint16_t[], and on metro m0 express these total 273 elements. If we "compress" them (store 8-bit values) we save half of that (546->273 bytes).
Tag the string pointers with the low bit to distinguish them; when requested, decompress them to a stack buffer, something like (untested)
This depends on it being OK for the buffer to not be static--I don't know if when tud_control_xfer returns, the buffer is "done with" or not.
This might work out or not, just writing it up in case someone wants to look into it further or in case of further need. It might need changes in tinyusb, or we might be able to do it inside tud_descriptor_string_cb, not sure.
The text was updated successfully, but these errors were encountered:
This is a nice savings for descriptors in flash. We have to make sure they are really transmitted before giving up the stack buffer. Once we go to some kind of dynamic descriptors, they will be constructed at runtime anyway, so we will just store the 8-bit strings, or even concatenate them at runtime. (There's a lot of duplication of "CircuitPython", for instance.)
cost: may use more stack
Most (all?) usb string descriptors use ASCII, but are stored as
uint16_t[]
, and on metro m0 express these total 273 elements. If we "compress" them (store 8-bit values) we save half of that (546->273 bytes).Tag the string pointers with the low bit to distinguish them; when requested, decompress them to a stack buffer, something like (untested)
This depends on it being OK for the buffer to not be static--I don't know if when
tud_control_xfer
returns, the buffer is "done with" or not.This might work out or not, just writing it up in case someone wants to look into it further or in case of further need. It might need changes in tinyusb, or we might be able to do it inside
tud_descriptor_string_cb
, not sure.The text was updated successfully, but these errors were encountered: