|
|
3 年之前 | |
|---|---|---|
| class | 3 年之前 | |
| common | 3 年之前 | |
| core | 3 年之前 | |
| demo | 3 年之前 | |
| docs | 3 年之前 | |
| osal | 3 年之前 | |
| packet capture | 3 年之前 | |
| port | 3 年之前 | |
| third_party | 3 年之前 | |
| tools | 3 年之前 | |
| .clang-format | 4 年之前 | |
| .gitattributes | 3 年之前 | |
| .gitignore | 3 年之前 | |
| CMakeLists.txt | 3 年之前 | |
| LICENSE | 4 年之前 | |
| README.md | 3 年之前 | |
| README_zh.md | 3 年之前 | |
| SConscript | 3 年之前 | |
| cherryusb_config_template.h | 3 年之前 |
CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system with USB ip.
.
├── class
├── common
├── core
├── demo
├── docs
├── osal
├── packet capture
└── port
└── tools
| Directory | Description |
|---|---|
| class | usb class driver |
| common | usb spec macros and utils |
| core | usb core implementation |
| demo | different chips demo |
| osal | os wrapper |
| docs | doc for guiding |
| packet capture | packet capture file |
| port | usb dcd and hcd porting |
| tools | tool used url |
CherryUSB Device Stack provides a unified framework of functions for standard device requests, CLASS requests, VENDOR requests and custom special requests. The object-oriented and chained approach allows the user to quickly get started with composite devices without having to worry about the underlying logic. At the same time, a standard dcd porting interface has been standardised for adapting different USB IPs to achieve ip-oriented programming.
CherryUSB Device Stack has the following functions:
CherryUSB Device Stack resource usage (GCC 10.2 with -O2):
| file | FLASH (Byte) | No Cache RAM (Byte) | RAM (Byte) | Heap (Byte) |
|---|---|---|---|---|
| usbd_core.c | 3263 | 384 | 17 | 0 |
| usbd_cdc.c | 490 | 0 | 0 | sizeof(struct usbd_interface) * x |
| usbd_msc.c | 2772 | 128 + 512(default) | 16 | sizeof(struct usbd_interface) * x |
| usbd_hid.c | 501 | 0 | 0 | sizeof(struct usbd_interface) * x |
| usbd_audio.c | 1208 | 0 | 4 | sizeof(struct usbd_interface) * x |
| usbd_video.c | 2272 | 0 | 82 | sizeof(struct usbd_interface) * x |
The CherryUSB Host Stack has a standard enumeration implementation for devices mounted on roothubs and external hubs, and a standard interface for different Classes to indicate what the Class driver needs to do after enumeration and after disconnection. A standard hcd porting interface has also been standardised for adapting different USB IPs for IP-oriented programming. Finally, the host stack is managed using os, and provides osal to make a adaptation for different os.
CherryUSB Host Stack has the following functions:
The CherryUSB Host stack also provides the lsusb function, which allows you to view information about all mounted devices, including those on external hubs, with the help of a shell plugin.
CherryUSB Host Stack resource usage (GCC 10.2 with -O2):
| file | FLASH (Byte) | No Cache RAM (Byte) | RAM (Byte) | Heap (Byte) |
|---|---|---|---|---|
| usbh_core.c | 4261 | 512 | 28 | sizeof(struct usbh_urb) |
| usbh_hub.c | 4633 | sizeof(struct usbh_hub) * (1+n) | sizeof(struct usbh_hubport) + 20 | 0 |
| usbh_cdc_acm.c | 1004 | 7 | 4 | sizeof(struct usbh_cdc_acm) * x |
| usbh_msc.c | 1776 | 32 | 4 | sizeof(struct usbh_msc) * x |
| usbh_hid.c | 822 | 128 | 4 | sizeof(struct usbh_hid) * x |
Among them, sizeof(struct usbh_hub) and sizeof(struct usbh_hubport) are affected by the following macros:
#define CONFIG_USBHOST_MAX_EXTHUBS 1
#define CONFIG_USBHOST_MAX_EHPORTS 4
#define CONFIG_USBHOST_MAX_INTERFACES 6
#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 1
#define CONFIG_USBHOST_MAX_ENDPOINTS 4
Quickly start, USB basic concepts, API manual, Class basic concepts and examples, see CherryUSB Documentation Tutorial
USB basic concepts and how the CherryUSB Device stack is implemented, see CherryUSB Device Stack Tutorial.
chryusb_configurator is written in electron + vite2 + ts framework,currently used to automate the generation of descriptor arrays, with additional functionality to be added later.
Note: After version 0.4.1, the dcd drivers have been refactored and some repositories are not maintained for a long time, so if you use a higher version, you need to update it yourself.
| Manufacturer | CHIP or Series | USB IP | Repo Url | Corresponds to master version |
|---|---|---|---|---|
| Bouffalolab | BL702 | bouffalolab | bl_mcu_sdk | latest |
| Essemi | ES32F36xx | musb | es32f369_repo | latest |
| AllwinnerTech | F1C100S | musb | cherryusb_rtt_f1c100s | latest |
| ST | STM32F103C8T6 | fsdev | stm32f103_repo | latest |
| ST | STM32F4 | dwc2 | stm32f429_device_repo stm32f429_host_repo | latest |
| ST | STM32H7 | dwc2 | stm32h743_device_repo stm32h743_host_repo | latest |
| HPMicro | HPM6750 | hpm/ehci | hpm_repo | latest |
| WCH | CH32V307 | ch32_usbfs/ch32_usbhs | ch32v307_repo | latest |
| WCH | CH57x | ch58x | ch57x_repo | v0.4.1 |
| Nuvoton | Nuc442 | nuvoton | nuc442_repo | v0.4.1 |
| Geehy | APM32E10x APM32F0xx | fsdev | apm32_repo | v0.4.1 |
| Nordicsemi | Nrf52840 | nrf5x | nrf5x_repo | v0.4.1 |
| Espressif | esp32 | dwc2 | esp32_repo | v0.4.1 |
| Mindmotion | MM32L3xx | mm32 | mm32_repo | v0.4.1 |
QQ group: 642693751