feat(cherryusb): add cherryusb library#2212
Conversation
ac00f28 to
4fb2ab5
Compare
|
Stupid question 1: Why does this modify the linker files in Stupid question 2: Can this be used as a complete replacement for TinyUSB? (or would that require a much larger refactoring of the SDK's existing USB code?) |
1, my mistake, fixed |
|
Could you list or point out which usb code? I can help to match with cherryusb. |
I did a |
a3b8377 to
50f3ab7
Compare
Signed-off-by: sakumisu <1203593632@qq.com>
| bool stdio_usb_init(void) | ||
| { |
There was a problem hiding this comment.
Please stick to existing code-formatting conventions, rather than moving braces to a new line.
|
More stupid questions from me:
|
Sorry, you told me refactor stdio_usb before, so i misunderstood to only support one. |
|
Ahhh, apologies for the confusion! EDIT (to clarify): The Raspberry Pi Pico SDK places a big emphasis on backwards-compatibility, and obviously unconditionally replacing tinyusb with cherryusb would break backwards-compatibility of the SDK for existing projects. So to stay backwards-compatible with all existing projects, |
Yes, i agree, i have changed. |
| * This library also includes (by default) functionality to enable the RP-series microcontroller to be reset over the USB interface. | ||
| */ | ||
|
|
||
| // PICO_CONFIG: PICO_STDIO_USB_DEFAULT_CRLF, Default state of CR/LF translation for USB output, type=bool, default=PICO_STDIO_DEFAULT_CRLF, group=pico_stdio_usb |
There was a problem hiding this comment.
The tools/extract_configs.py script will get upset if the same PICO_CONFIG: entry appears in multiple different files.
Signed-off-by: sakumisu <1203593632@qq.com>
|
Note, i had a little play with this: On RP2350 I did this Which got the one example running, however I don't know which |
Hi, from cherryusb v1.5.0, we use our own memcpy instead, i will update submodule in this pr. |
Signed-off-by: sakumisu <1203593632@qq.com>
|
Just wanted to drop in my two cents since I doubt very many people have tried CherryUSB on Pi Pico. Ultimately, I failed to make it work since I don't have the RAM, but here's what I learned. I use TinyUSB in host mode and support 5 hubs, 16 HID devices, 8 MSC devices, and XInput as a vendor protocol. Of course, we all know that TinyUSB on the rp2 is still unstable, so that's why I tried CherryUSB. Modifying the linker script is unnecessary. This appears to be in there to support a kind of module registration by leveraging the linker. Pico SDK has a mechanism for forcing code into flash and giving it a unique name. While I'm not a fan of extending program logic into the linker, using the tools we already have seems better than complicating an already complicated linker script for a single library that should leverage the existing linker script with a macro that can be changed per platform. The memory usage is crazy large. The math is (5 hubs * (16 hid + 8 msc)) since you need to allocate memory for every potential port usage on every hub. 8-port hubs are very common and some devices, like keyboards, can have hubs built in. Keyboards and mice often report as composite keyboard+mouse so we need 2 HID per port. Even though I only need to support (5 hubs + 16 HID + 8 MSC) = 29 which TinyUSB happily does, I have to allocate for (5 hubs * (16 hid + 8 msc)) = 120. And finally is the requirement of an OS. There's no poll option. I have a 20k loc project that uses usb, bluetooth, and wifi just fine without an OS. I can add an OS but I don't have to like it. |
You can change CONFIG_USBHOST_MAX_INTF_ALTSETTINGS to 1 for the less memory. And i don't think rp2 can support too many usb devices because of hardware endpoints limitation, also in cherryusb, we support dynamic endpoint(in urb) to reuse hardware endpoints. |

Support usb device and host with cherryusb. Also host hub supports.